From nobody Sun Feb 8 05:29:44 2026 Received: from mail-io1-f73.google.com (mail-io1-f73.google.com [209.85.166.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5316124A047 for ; Thu, 30 Oct 2025 14:10:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761833444; cv=none; b=OwvxpQekd4wcw38RkRzL7AgX4IC1t8OeO1zSiMcrqGSY4iJwP2o9nU6NlQgc9SgIOMqXw/zH0cnRIfIcSt0zkHOqXg/ZvuTM/KEr1D9lx+XcKaC0nURVZJ7ll867IQfRQVPk8FmaHhcxIo7J0LC/WHlHZSMpaOwTudMJBXtpQgg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761833444; c=relaxed/simple; bh=1Rv+cNZUnHqjrlP4AuPv1UvjdUJGPgsu2fReIcVoAss=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=n2eI0txAugpG7HgtxuPcWKQwN90KuMc6oWP/KT9SZeYttV3xY5ebOE5qjH9X516osES/9SyZ+iTu6s5/2E7i57CZn37JLfCnWYOLbCz3Elwl6HVQRIQqQL3pwip23gAIk/LUAFbZYK+1YzCItNzaoCd2p1rI54+A4rJx3/ajZEM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jdenose.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=JB67kJya; arc=none smtp.client-ip=209.85.166.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jdenose.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JB67kJya" Received: by mail-io1-f73.google.com with SMTP id ca18e2360f4ac-945a4849260so305368939f.3 for ; Thu, 30 Oct 2025 07:10:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1761833442; x=1762438242; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=uzx+TIGAHeWAdlRbvKzxCvCV+3aa2fiQ4ymntya7+7o=; b=JB67kJyaAPmlahBeN0yC/NaYZyjgzoCJo5z6MKZdBgiMKJIsU6KGWIdK6zpb/qxkbj F4mOtsNZTCtu8ZV9seE7+kpClrMSb4Y3OX+QL3RLvsw3gG/HPpNs1kggur4dXyMlv5G5 6NySnIVj+LC35ANVHc4uaO0Ii23KJNscZ/5Lw0sVjv3DsQ8j+Wbdxhb4oFbGXoHL7jfv mZGjgwH5nsbtnCzYt31QCNXm59DDyOZXe2Ywf6g/tLuOZrQAov13X3fd46LLmCg/x0l7 BvFgsM6dUHFUJNEOFMlhRxuaUpwqoXVz7zs49/3a8wFbtBFZbRDfVkRfwhZCnzepURC7 N9SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761833442; x=1762438242; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uzx+TIGAHeWAdlRbvKzxCvCV+3aa2fiQ4ymntya7+7o=; b=FVVyqXQe0Ai1grJEcRP9blAvlAcj7jVXwOVR0WbU9Kd8Cc+XY2QihlYsdX0zyTa7L0 mJQbevMKNmz8MMPd/NOKbbGdLKFSOBayG0N7mIYFloOIDPiF1Q39JtKTDyaAQb+iBIur n96Pn1lPy3E3Al66AwxZXkThtolA9fndc2LMKH3brEZZo8mCAS5j01hEpZALn56X5T90 fB0JSvjZMFuV4EvFT5Yl4f8ATCihUFVnn6OhscVyeAtR0cKbXM6i2TUXKUxj0yUyeiVc 8SD6j2f14RbPwDEva15n3EgBPnenHrEGvCSLkZJVxmVf6hgOrEYHtS/sLJMXUR77oorG hVeg== X-Forwarded-Encrypted: i=1; AJvYcCVNmJ5ARMgVZ8pyEu6DWMxin3fwz2NsSkngPUMqIxrQJAFR9/gz51hNqr+ecRSdC3GrPfRTbteX3f4fXBk=@vger.kernel.org X-Gm-Message-State: AOJu0YwHxenLGgGP08VfFkxjj9aBt9wpBVB1kOAY++nz9TicbnyLW0ML ZNYULaQCvRXGcnfd87tp+rTrmWJ6ck/3Vx4ou+j/FQXLKHZ91yYe90MoFq1yaT7qqg7gFIeOCgB zqFEtldhevA== X-Google-Smtp-Source: AGHT+IEwb0t0Qlisa1OGs7apQisuIV8c9QvZ3+m4D0xseH90T0W4voKqMOYGDhGhJCAdffYKjr4Z1nUlCfXn X-Received: from iobbe6.prod.google.com ([2002:a05:6602:3786:b0:943:5a50:ad49]) (user=jdenose job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6e02:1609:b0:42d:b5d0:1930 with SMTP id e9e14a558f8ab-4330154fb44mr46377195ab.23.1761833442501; Thu, 30 Oct 2025 07:10:42 -0700 (PDT) Date: Thu, 30 Oct 2025 14:10:40 +0000 In-Reply-To: <20251030-lid-switch-notifier-v1-0-c58dc9b1439d@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251030-lid-switch-notifier-v1-0-c58dc9b1439d@google.com> X-Mailer: b4 0.14.2 Message-ID: <20251030-lid-switch-notifier-v1-1-c58dc9b1439d@google.com> Subject: [PATCH 1/2] Input: Create input notifier chain in input.c From: Jonathan Denose To: Dmitry Torokhov , Jiri Kosina , Benjamin Tissoires Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Denose Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable To expose input events to other kernel modules, add a blocking notifier chain. Publish LID_SWITCH_OPEN/LID_SWITCH_CLOSE events through this notifier chain when input_handle_event detects events signaling the lid switch has opened or closed. Additionally, export a function which allows other kernel modules to register notifier_block structs against this notifier chain. Signed-off-by: Jonathan Denose --- drivers/input/input.c | 13 +++++++++++++ include/linux/input.h | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/drivers/input/input.c b/drivers/input/input.c index a500e1e276c211d1146dbfea421a3402084007f8..b342b1ff138ccc58d4623edcf11= 52bd85d7054bf 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "input-compat.h" #include "input-core-private.h" #include "input-poller.h" @@ -62,6 +63,8 @@ static const unsigned int input_max_code[EV_CNT] =3D { [EV_FF] =3D FF_MAX, }; =20 +static struct blocking_notifier_head input_notifier_head; + static inline int is_event_supported(unsigned int code, unsigned long *bm, unsigned int max) { @@ -367,10 +370,20 @@ void input_handle_event(struct input_dev *dev, if (type !=3D EV_SYN) add_input_randomness(type, code, value); =20 + if (type =3D=3D EV_SW && code =3D=3D SW_LID && !value) + blocking_notifier_call_chain(&input_notifier_head, value ? + LID_SWITCH_CLOSE : LID_SWITCH_OPEN, dev); + input_event_dispose(dev, disposition, type, code, value); } } =20 +int register_input_notifier(struct notifier_block *notifier) +{ + return blocking_notifier_chain_register(&input_notifier_head, notifier); +} +EXPORT_SYMBOL(register_input_notifier); + /** * input_event() - report new input event * @dev: device that generated the event diff --git a/include/linux/input.h b/include/linux/input.h index 7d7cb0593a63e93c4906c49cde430188db2d1ab5..e940aff8843a0afc693c60a252d= 6b0dbcb3476c4 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -42,6 +42,11 @@ enum input_clock_type { INPUT_CLK_MAX }; =20 +enum input_notify_event_type { + LID_SWITCH_OPEN, + LID_SWITCH_CLOSE +}; + /** * struct input_dev - represents an input device * @name: name of the device @@ -431,6 +436,8 @@ int input_flush_device(struct input_handle *handle, str= uct file *file); void input_set_timestamp(struct input_dev *dev, ktime_t timestamp); ktime_t *input_get_timestamp(struct input_dev *dev); =20 +int register_input_notifier(struct notifier_block *notifier); + void input_event(struct input_dev *dev, unsigned int type, unsigned int co= de, int value); void input_inject_event(struct input_handle *handle, unsigned int type, un= signed int code, int value); =20 --=20 2.51.1.851.g4ebd6896fd-goog From nobody Sun Feb 8 05:29:44 2026 Received: from mail-io1-f73.google.com (mail-io1-f73.google.com [209.85.166.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58D38242D60 for ; Thu, 30 Oct 2025 14:10:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761833446; cv=none; b=qLzH8OLUpeG/P43zrhNrFCazUDIfjW/oHgrmbOBiPxcw7OSQO2KksvTZiZYhKxpa86cX0wyL5/bmQXYFBnMIRoRd/rQNrI4AjQ6FD3yUU+Y3xRlYKJU97ORjRICaRseIt5r/pOSRd1YcrcTiFYej+sEREHKVNIhEYmtSZoFT3fE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761833446; c=relaxed/simple; bh=q3jHj61zXvz5MN2y9J6SalSvSDG9xMqxfmXbK044WsM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=M0OMVf9QhJLC66VHGFFcn+WMGc/3TRV1mOXafhIS1Lsakn9tGT9I2YpfZgeIqcmH1bnvXl9uKe5d44M/dOK/CTsYP5r4UD2KXbvapAngnPgrGdDEOLUB2YykohWXaLzywn/71E+gcPbMUf7ys2XHb+bpDe/4RIGu7kcsJTQ9TDM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jdenose.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=kW4asABi; arc=none smtp.client-ip=209.85.166.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jdenose.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="kW4asABi" Received: by mail-io1-f73.google.com with SMTP id ca18e2360f4ac-945aae1d9f7so108015139f.3 for ; Thu, 30 Oct 2025 07:10:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1761833443; x=1762438243; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=pmuXm6118pY2fmFrwM3cdE3k0F1cDt7ZnMWQFLJv4F8=; b=kW4asABiElYUnaGo4ZZcTKPhygn+wuNmHWRMsd9kV+sKIDgCsSjd01yxDLQ/nCssUB jEErut2YbI8BxKWWWPa5Kwcchy0pGW/ZKQzN9DxT8aOi4nlOpLp6Laix0FcAGjsTuo71 J0VuGsR+/UqGtjoZ0a5Tr1iWnmo2MhqtlQbMStsag+kEAsTn6Ju3Hb52md0lSltiP9Wv 94nq5fb9jeJgFC8E5y+TWduuPqeKO5bDnNDW0FMFE/gyjh/jiZvfxC6vr3//+I8lOK4d OmpMy4B4DUW1xc6wplNkxjS5C8+EYm6XqnNoqH4BCfgke7VYFbSUpDNWMzTQQk5K+QHD 6LoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761833443; x=1762438243; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pmuXm6118pY2fmFrwM3cdE3k0F1cDt7ZnMWQFLJv4F8=; b=ZBlfsboCjHj0g8HWzvzhYdtwsh/eL7GlCqvYvrWgHuEFt6stWKQwu9g19Begc8K3fM 2lMuJBed/wZGtn+CZ5ssfR5Zc0uczrIwsDNU6uyDY3Yon8HjjUvRA8W7zp5/WhDzBb/H rdzriQieWGEGJ4jXK8qN2XeFIQpGCwouO/SU7czaxdurBKS6AGUMf9H07YkqSPuUJM7Z I6c+0TGCzV7NSzNISZchaTQiV+EK/deJP483ul+BFwwO3/O3txO1DP6bCMTyxjEWXKFi 5ZlPV4joiOFjlsndjDNbwsXykM7PYoMlF6phYEJ/Rm1ZQXKDCuHERUp+4jM1LRjOO8Xw qjPw== X-Forwarded-Encrypted: i=1; AJvYcCUJiO6VsmxEaXtW/ImaGdc+jeqAYB2oReynWSW6T54NAeyCOy+GlaCVrscrWkvQIb73b29Rovi09oXA8VE=@vger.kernel.org X-Gm-Message-State: AOJu0Yy+H/yd78pzY6PaOCarHzT2MmSWBD+hRY8OgYqcQLPiRqwk4fM2 q9Cx9xlUCf/J9RJIqqtXBXYK3kfBhTLZezv8nhXWwJXNLS/+dt3vP0dWzyEhHhxxYoSnZNi2tEH lKzO0feO2DA== X-Google-Smtp-Source: AGHT+IH6LnWqO+DOElFFG3eH7qSxiHTlugiupzsGZZ7UfXk5ZpCwRsS8lH2J52EOivUvNIfmz+2MU500c8LK X-Received: from iobjh5.prod.google.com ([2002:a05:6602:7185:b0:93e:8094:6993]) (user=jdenose job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6602:14c8:b0:945:c311:44e2 with SMTP id ca18e2360f4ac-945c97e558emr962817139f.13.1761833443503; Thu, 30 Oct 2025 07:10:43 -0700 (PDT) Date: Thu, 30 Oct 2025 14:10:41 +0000 In-Reply-To: <20251030-lid-switch-notifier-v1-0-c58dc9b1439d@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251030-lid-switch-notifier-v1-0-c58dc9b1439d@google.com> X-Mailer: b4 0.14.2 Message-ID: <20251030-lid-switch-notifier-v1-2-c58dc9b1439d@google.com> Subject: [PATCH 2/2] HID: multitouch: Toggle touch surface on Elan touchpad on lid event From: Jonathan Denose To: Dmitry Torokhov , Jiri Kosina , Benjamin Tissoires Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Denose Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Many touchpad modules have a pin which is expected to be connected to the lid angle sensor in laptops. The pin sends a signal to the touchpad module about the lid state and each touchpad vendor handles this notification in their firmware. The Elan touchpad with VID 323b does not always have this aforementioned pin, which then causes interference between the lid and the touchpad when the lid is closed. This interference causes a few seconds delay before the touchpad works again, or it causes it to be come completely unresponsive. To circumvent this hardware issue in software, implement a device quirk which will allow the hid-multitouch driver to register a notifier_block to listen for lid switch events and turn the touchpad surface on and off triggering a recalibration of the touchpad. This recalibration resolves interference issues when the lid is closed. Signed-off-by: Jonathan Denose --- drivers/hid/hid-multitouch.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 2879e65cf303b1456311ac06115adda5a78a2600..feb0a0b65b6355cc412fcf8ea88= 132dc5bdc6a26 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -76,6 +77,7 @@ MODULE_LICENSE("GPL"); #define MT_QUIRK_DISABLE_WAKEUP BIT(21) #define MT_QUIRK_ORIENTATION_INVERT BIT(22) #define MT_QUIRK_APPLE_TOUCHBAR BIT(23) +#define MT_QUIRK_REGISTER_INPUT_NOTIFIER BIT(24) =20 #define MT_INPUTMODE_TOUCHSCREEN 0x02 #define MT_INPUTMODE_TOUCHPAD 0x03 @@ -183,6 +185,8 @@ struct mt_device { struct list_head reports; }; =20 +static struct hid_device *lid_notify_hdev; + static void mt_post_parse_default_settings(struct mt_device *td, struct mt_application *app); static void mt_post_parse(struct mt_device *td, struct mt_application *app= ); @@ -227,6 +231,7 @@ static void mt_post_parse(struct mt_device *td, struct = mt_application *app); #define MT_CLS_SMART_TECH 0x0113 #define MT_CLS_APPLE_TOUCHBAR 0x0114 #define MT_CLS_SIS 0x0457 +#define MT_CLS_REGISTER_INPUT_NOTIFIER 0x0115 =20 #define MT_DEFAULT_MAXCONTACT 10 #define MT_MAX_MAXCONTACT 250 @@ -327,7 +332,9 @@ static const struct mt_class mt_classes[] =3D { MT_QUIRK_CONTACT_CNT_ACCURATE | MT_QUIRK_WIN8_PTP_BUTTONS, .export_all_inputs =3D true }, - + { .name =3D MT_CLS_REGISTER_INPUT_NOTIFIER, + .quirks =3D MT_QUIRK_REGISTER_INPUT_NOTIFIER, + .export_all_inputs =3D true }, /* * vendor specific classes */ @@ -1840,6 +1847,20 @@ static void mt_expired_timeout(struct timer_list *t) clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); } =20 +static int mt_input_notifier(struct notifier_block *nb, unsigned long acti= on, void *dev) +{ + if (action =3D=3D LID_SWITCH_CLOSE) + mt_set_modes(lid_notify_hdev, HID_LATENCY_NORMAL, TOUCHPAD_REPORT_NONE); + else if (action =3D=3D LID_SWITCH_OPEN) + mt_set_modes(lid_notify_hdev, HID_LATENCY_NORMAL, TOUCHPAD_REPORT_ALL); + + return 0; +} + +static struct notifier_block mt_notifier_block =3D { + .notifier_call =3D mt_input_notifier +}; + static int mt_probe(struct hid_device *hdev, const struct hid_device_id *i= d) { int ret, i; @@ -1920,6 +1941,11 @@ static int mt_probe(struct hid_device *hdev, const s= truct hid_device_id *id) if (hdev->vendor =3D=3D USB_VENDOR_ID_SIS_TOUCH) hdev->quirks |=3D HID_QUIRK_NOGET; =20 + if (mtclass->quirks & MT_CLS_REGISTER_INPUT_NOTIFIER) { + lid_notify_hdev =3D hdev; + register_input_notifier(&mt_notifier_block); + } + ret =3D hid_hw_start(hdev, HID_CONNECT_DEFAULT); if (ret) return ret; @@ -2150,6 +2176,10 @@ static const struct hid_device_id mt_devices[] =3D { HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, USB_VENDOR_ID_ELAN, 0x32ae) }, =20 + { .driver_data =3D MT_CLS_REGISTER_INPUT_NOTIFIER, + HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, + USB_VENDOR_ID_ELAN, 0x323b) }, + /* Elitegroup panel */ { .driver_data =3D MT_CLS_SERIAL, MT_USB_DEVICE(USB_VENDOR_ID_ELITEGROUP, --=20 2.51.1.851.g4ebd6896fd-goog