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

R Ha
2025-01-06T09:01:05Z

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.
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,
)
})
Name (SBFG, ResourceTemplate ()
{
GpioInt (Level, ActiveLow, ExclusiveAndWake, PullDefault, 0x0000,
"\\_SB.GPI0", 0x00, ResourceConsumer, ,
)
{ // Pin list
0x0000
}
})
Name (SBFI, ResourceTemplate ()
{
Interrupt (ResourceConsumer, Level, ActiveLow,
ExclusiveAndWake, ,, _Y54)
{
0x00000000,
}
})
CreateWordField (SBFB, \_SB.PC00.I2C1.TPD0._Y53._ADR, BADR)
// _ADR: Address
CreateDWordField (SBFB, \_SB.PC00.I2C1.TPD0._Y53._SPE, SPED)
// _SPE: Speed
CreateWordField (SBFG, 0x17, INT1)
CreateDWordField (SBFI, \_SB.PC00.I2C1.TPD0._Y54._INT, INT2)
// _INT: Interrupts
Method (_INI, 0, NotSerialized) // _INI: Initialize
{
If ((OSYS < 0x07DC))
{
SRXO (0x09080011, One)
}

INT1 = GNUM (0x09080011)
INT2 = INUM (0x09080011)
If ((TPTY == One))
{
_HID = "ELAN06FA"
_SUB = "ELAN0001"
BADR = 0x15
HID2 = One
Return (Zero)
}

If ((TPTY == 0x02))
{
_HID = "SYNA2BA6"
_SUB = "SYNA0001"
BADR = 0x2C
HID2 = 0x20
Return (Zero)
}

If ((TPTY == 0x04))
{
_HID = "CRQ1080"
_SUB = "CRQ0001"
BADR = 0x2C
HID2 = 0x20
Return (Zero)
}

If ((TPTY == 0x05))
{
_HID = "FTCS0038"
_SUB = "FTCS0001"
BADR = 0x38
HID2 = One
Return (Zero)
}
}

Name (_HID, "XXXX0000") // _HID: Hardware ID
Name (_CID, "PNP0C50" /* HID Protocol Device (I2C bus) */) //
_CID: Compatible ID
Name (_SUB, "XXXX0000") // _SUB: Subsystem ID
Name (_S0W, 0x03) // _S0W: S0 Device Wake State
Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method
{
If ((Arg0 == HIDG))
{
Return (HIDD (Arg0, Arg1, Arg2, Arg3, HID2))
}

If ((Arg0 == TP7G))
{
Return (TP7D (Arg0, Arg1, Arg2, Arg3, SBFB, SBFG))
}

Return (Buffer (One)
{
0x00 // .
})
}

Method (_STA, 0, NotSerialized) // _STA: Status
{
If ((TPTY == Zero))
{
Return (Zero)
}
Else
{
Return (0x0F)
}
}

Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
{
If ((OSYS < 0x07DC))
{
Return (SBFI) /* \_SB_.PC00.I2C1.TPD0.SBFI */
}

If ((TPDM == Zero))
{
Return (ConcatenateResTemplate (I2CM (I2CX, BADR, SPED), SBFG))
}

Return (ConcatenateResTemplate (I2CM (I2CX, BADR, SPED), SBFI))
}

Method (TPRD, 0, Serialized)
{
Return (^^^LPCB.EC0.ECTP) /* \_SB_.PC00.LPCB.EC0_.ECTP */
}

Method (TPWR, 1, Serialized)
{
^^^LPCB.EC0.ECTP = Arg0
}
}
}