public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Randolph Ha <rha051117@gmail.com>
Cc: wsa+renesas@sang-engineering.com, linux-i2c@vger.kernel.org,
	linux-acpi@vger.kernel.org, trivial@kernel.org,
	jarkko.nikula@linux.intel.com
Subject: Re: [PATCH] Force ELAN06FA touchpad I2C bus freq to 100KHz
Date: Mon, 13 Jan 2025 08:48:02 +0200	[thread overview]
Message-ID: <20250113064802.GJ3713119@black.fi.intel.com> (raw)
In-Reply-To: <20250111155744.2874-1-rha051117@gmail.com>

Hi,

On Sat, Jan 11, 2025 at 09:57:10AM -0600, Randolph Ha wrote:
> When a 400KHz freq is used on this model of ELAN touchpad in Linux,
> excessive smoothing (similar to when the touchpad's firmware detects
> a noisy signal) is sometimes applied. As some devices' (e.g, Lenovo
> V15 G4) ACPI tables do not specify a frequency for this device and
> some I2C busses (e.g, Designware I2C) default to a 400KHz freq,
> force the speed to 100KHz as a workaround.

Actually the ACPI tables provide the speed:

	I2cSerialBusV2 (0x002C, ControllerInitiated, 0x00061A80,
	    AddressingMode7Bit, "\\_SB.PC00.I2C1",
	    0x00, ResourceConsumer, _Y53, Exclusive,
	    )

It's that 0x00061A80 == 400kHz. Linux uses that and I would expect Windows
to do the same.

However, since the behavior is different between the OSses we are missing
something in Linux side. And because we cannot figure out what that is the
current workaround is to quirk the speed down to 100kHz which seems to cure
the problem.

> This problem may be related to the default HCNT/LCNT values given by
> some busses' drivers, because they are also not specified in the
> aforementioned devices' ACPI tables, and because the device works at
> what appears to be a 400KHz frequency in Windows without issues.
> 
> Signed-off-by: Randolph Ha <rha051117@gmail.com>

This is fine by me if we cannot figure out a better way but please correct
the commit message and the comment below to match the fact that the speed
is specified and that we don't know the root cause.

Once done, freel free to add my,

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

> ---
>  drivers/i2c/i2c-core-acpi.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
> index 14ae0cfc325e..6f1c2377db0a 100644
> --- a/drivers/i2c/i2c-core-acpi.c
> +++ b/drivers/i2c/i2c-core-acpi.c
> @@ -355,6 +355,24 @@ 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 in Linux,
> +	 * excessive smoothing (similar to when the touchpad's firmware detects
> +	 * a noisy signal) is sometimes applied. As some devices' (e.g, Lenovo
> +	 * V15 G4) ACPI tables do not specify a frequency for this device and
> +	 * some I2C busses (e.g, Designware I2C) default to a 400KHz freq,
> +	 * force the speed to 100KHz as a workaround.
> +	 *
> +	 * This problem may be related to the default HCNT/LCNT values given by
> +	 * some busses' drivers, because they are also not specified in the
> +	 * aforementioned devices' ACPI tables, and because the device works at
> +	 * what appears to be a 400KHz frequency in Windows without issues.
> +	 */
> +	{ "ELAN06FA", 0 },
> +	{}
> +};
> +
>  static acpi_status i2c_acpi_lookup_speed(acpi_handle handle, u32 level,
>  					   void *data, void **return_value)
>  {
> @@ -373,6 +391,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;
>  }
>  
> -- 
> 2.47.1

  reply	other threads:[~2025-01-13  6:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-03  5:16 [PATCH 0/1] Force I2C bus freq to 100KHz for ELAN06FA touchpad Randolph Ha
2025-01-03  5:16 ` [PATCH 1/1] Force ELAN06FA touchpad I2C bus freq to 100KHz Randolph Ha
2025-01-03  9:33   ` Mika Westerberg
2025-01-03 23:46     ` R Ha
2025-01-05  8:33       ` Mika Westerberg
2025-01-06  1:28         ` [PATCH] " Randolph Ha
2025-01-06  9:00         ` [PATCH 1/1] " R Ha
2025-01-07  7:27           ` Mika Westerberg
2025-01-07 12:16             ` R Ha
2025-01-08  5:51               ` Mika Westerberg
2025-01-08  9:29                 ` R Ha
2025-01-09 11:19                   ` Mika Westerberg
2025-01-10  8:31                     ` R Ha
2025-01-10 11:26                       ` Mika Westerberg
2025-01-10 11:45                         ` Jarkko Nikula
2025-01-10 12:07                           ` Mika Westerberg
2025-01-11 15:57                             ` [PATCH] " Randolph Ha
2025-01-13  6:48                               ` Mika Westerberg [this message]
2025-01-13 19:52                                 ` Randolph Ha
2025-01-14 11:58                                   ` Wolfram Sang
2025-01-15 19:39                                     ` R Ha
2025-01-11 16:05                             ` [PATCH 1/1] " R Ha
2025-01-13  6:49                               ` Mika Westerberg
2025-01-06  9:08         ` R Ha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250113064802.GJ3713119@black.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=rha051117@gmail.com \
    --cc=trivial@kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox