Re: [PATCH 1/1] Force ELAN06FA touchpad I2C bus freq to 100KHz

Mika Westerberg
2025-01-07T07:27:50Z

Hi,

On Mon, Jan 06, 2025 at 03:00:53AM -0600, R Ha wrote:
> On Sun, Jan 5, 2025 at 2:34 AM Mika Westerberg
> <mika.westerberg@linux.intel.com> wrote:
> > In general it is good to follow the existing changelogs but in this case I
> > would prefer to add the details of the system in question (so we know what
> > systems the quirk is applied to).
>
> Alright, I sent an updated patch with a commit message that specifies
> the devices affected.
>
> On Sun, Jan 5, 2025 at 2:34 AM Mika Westerberg
> <mika.westerberg@linux.intel.com> wrote:
> > Okay thanks for sharing. I don't see the "SPED" beeing assigned in the
> > below snipped though.
>
> I believe "SPED" is left unassigned. There are two reasons for this.
> 1. I could not find a place where it was assigned in the ACPI table
> (in the snippet, every line with the word "SPED" was already
> included).
> 2. In the file drivers/i2c/busses/i2c-designware-common.c, the code in
> the function "i2c_dw_adjust_bus_speed" falls through to the "else"
> case.
>
> For (2), here is the relevant function where the control flow falls to
> the "else" case. I found this by adding a print-debugging statement
> after the last "else" statement.
> static void i2c_dw_adjust_bus_speed(struct dw_i2c_dev *dev)
> {
> u32 acpi_speed = i2c_dw_acpi_round_bus_speed(dev->dev);
> struct i2c_timings *t = &dev->timings;
>
> /*
> * Find bus speed from the "clock-frequency" device property, ACPI
> * or by using fast mode if neither is set.
> */
> if (acpi_speed && t->bus_freq_hz)
> t->bus_freq_hz = min(t->bus_freq_hz, acpi_speed);
> else if (acpi_speed || t->bus_freq_hz)
> t->bus_freq_hz = max(t->bus_freq_hz, acpi_speed);
> else
> t->bus_freq_hz = I2C_MAX_FAST_MODE_FREQ;
> }
>
> Actually, after some further investigation, I found that I missed a
> few lines in my previous snippet. Specifically the line concerning the
> method "I2CSerialBusV2".
> Here is the full snippet pasted below since I don't want to miss
> anything else, I'm sorry for the length but want to make sure
> everything is included.

Thanks! Okay the speed set in the I2CSerialBusV2 resource is 400kHZ but
there is one more variable in this equation: \\_SB.PC00.I2C1 that's the I2C
controller itself. DW I2C has some timing related methods (HCNT/LCNT) that
may affect this so I wonder if you can share that one too?

> Scope (_SB.PC00.I2C1)
> {
> Name (I2CN, Zero)
> Name (I2CX, Zero)
> Name (I2CI, One)
> Method (_INI, 0, NotSerialized) // _INI: Initialize
> {
> I2CN = SDS1 /* \SDS1 */
> I2CX = One
> }
>
> Device (TPD0)
> {
> Name (HID2, Zero)
> Name (SBFB, ResourceTemplate ()
> {
> I2cSerialBusV2 (0x002C, ControllerInitiated, 0x00061A80,
> AddressingMode7Bit, "\\_SB.PC00.I2C1",
> 0x00, ResourceConsumer, _Y53, Exclusive,
> )
> })