diff mbox series

Force ELAN06FA touchpad I2C bus freq to 100KHz

Message ID 20250106012902.212850-1-rha051117@gmail.com
State New
Headers show
Series Force ELAN06FA touchpad I2C bus freq to 100KHz | expand

Commit Message

R Ha Jan. 6, 2025, 1:28 a.m. UTC
When a 400KHz freq is used on this model of ELAN touchpad,
excessive smoothing (similar to when there is noise in the signal)
is sometimes applied. As some devices' (e.g, Lenovo V15 G4) ACPI
tables do not specify the 100KHz frequency requirement, and some
I2C busses (e.g, Designware I2C) default to a 400KHz frequency,
it is necessary to force the speed to 100KHz.

Signed-off-by: Randolph Ha <rha051117@gmail.com>
---
 drivers/i2c/i2c-core-acpi.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
index 14ae0cfc325e..8ba167f59db1 100644
--- a/drivers/i2c/i2c-core-acpi.c
+++ b/drivers/i2c/i2c-core-acpi.c
@@ -355,6 +355,19 @@  static const struct acpi_device_id i2c_acpi_force_400khz_device_ids[] = {
 	{}
 };
 
+static const struct acpi_device_id i2c_acpi_force_100khz_device_ids[] = {
+	/*
+	 * When a 400KHz freq is used on this model of ELAN touchpad,
+	 * excessive smoothing (similar to when there is noise in the signal)
+	 * is sometimes applied. As some devices' (e.g, Lenovo V15 G4) ACPI
+	 * tables do not specify the 100KHz frequency requirement, and some
+	 * I2C busses (e.g, Designware I2C) default to a 400KHz frequency,
+	 * it is necessary to force the speed to 100KHz.
+	 */
+	{ "ELAN06FA", 0 },
+	{}
+};
+
 static acpi_status i2c_acpi_lookup_speed(acpi_handle handle, u32 level,
 					   void *data, void **return_value)
 {
@@ -373,6 +386,9 @@  static acpi_status i2c_acpi_lookup_speed(acpi_handle handle, u32 level,
 	if (acpi_match_device_ids(adev, i2c_acpi_force_400khz_device_ids) == 0)
 		lookup->force_speed = I2C_MAX_FAST_MODE_FREQ;
 
+	if (acpi_match_device_ids(adev, i2c_acpi_force_100khz_device_ids) == 0)
+		lookup->force_speed = I2C_MAX_STANDARD_MODE_FREQ;
+
 	return AE_OK;
 }