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

Mika Westerberg
2025-01-08T05:51:54Z

Hi,

On Tue, Jan 07, 2025 at 06:16:09AM -0600, R Ha wrote:
> Hi,
>
> Thanks for clarifying the speed. Seems like this bug is different than
> I thought.
>
> In my ACPI table there were no references to HCNT or LCNT
> specifically. I'm not sure if this is normal.
>
> In addition, I noticed that there were debug messages in dmesg
> relating to the HCNT and LCNT.
> I'm not sure if they'll be useful, but here they are (taken from an
> unmodified kernel):
> [ 3.543648] i2c i2c-14: Successfully instantiated SPD at 0x50
> [ 3.543790] Standard Mode HCNT:LCNT = 552:652
> [ 3.543794] Fast Mode HCNT:LCNT = 100:200

I'm adding Jarkko who is expert in the designware I2C maybe he has some
ideas. IIRC we expect the HCNT/LCNT values to be passed from ACPI tables to
the driver.

@Jarkko, it seems that standard I2C HID touchpad does not work properly
with the 400 kHz as passed in I2CSerialBusV2() resource but it works with
either 100 kHz and 1 MHz. It also works fine in Windows. To me it sounds
like that we may have wrong/missing HCNT/LCNT values?

> Here's what I have found with the string "\\_SB.PC00.I2C1" in my ACPI table:
> #1

There should be Device() node for that too. The ones you listed are just
child devices connected to that bus.

> Scope (_SB)
> {
> Device (PEPD)
> {
> Name (_HID, "INT33A1" /* Intel Power Engine */) // _HID: Hardware ID
> Name (_CID, EisaId ("PNP0D80") /* Windows-compatible System
> Power Management Controller */) // _CID: Compatible ID
> Name (_UID, One) // _UID: Unique ID
> Name (LBUF, Buffer (0xC0){})
> Name (PPD0, Package (0x03)
> {
> "\\_SB.PC00.SAT0",
> Zero,
> Package (0x02)
> {
> Zero,
> Package (0x03)
> {
> 0xFF,
> Zero,
> 0x81
> }
> }
> })
> Name (PPD3, Package (0x03)
> {
> "\\_SB.PC00.SAT0",
> Zero,
> Package (0x02)
> {
> Zero,
> Package (0x02)
> {
> 0xFF,
> 0x03
> }
> }
> })
> Name (WWD3, Package (0x03)
> {
> "\\_SB.PC00.RP04",
> Zero,
> Package (0x02)
> {
> Zero,
> Package (0x02)
> {
> 0xFF,
> 0x03
> }
> }
> })
> Name (PKD0, Package (0x02)
> {
> Zero,
> Package (0x03)
> {
> 0xFF,
> Zero,
> 0x81
> }
> })
> Name (PKD3, Package (0x02)
> {
> Zero,
> Package (0x02)
> {
> 0xFF,
> 0x03
> }
> })
> Name (DEVY, Package (0x77)
> {
> [...]
> Package (0x03)
> {
> "\\_SB.PC00.I2C0",
> One,
> Package (0x02)
> {
> Zero,
> Package (0x02)
> {
> 0xFF,
> 0x03
> }
> }
> },
>
> Package (0x03)
> {
> "\\_SB.PC00.I2C1",
> One,
> Package (0x02)
> {
> Zero,
> Package (0x02)
> {
> 0xFF,
> 0x03
> }
> }
> },
>
> Package (0x03)
> {
> "\\_SB.PC00.XHCI",
> One,
> Package (0x02)
> {
> Zero,
> Package (0x02)
> {
> 0xFF,
> 0x03
> }
> }
> },
>
> Package (0x03)
> {
> "\\_SB.PC00.HDAS",
> One,
> Package (0x02)
> {
> Zero,
> Package (0x03)
> {
> 0xFF,
> Zero,
> 0x81
> }
> }
> },
> [...The rest are similar, only changinng the strings]
> })
> }
> }
>
> #2 (seems related to another device)
> Scope (_SB.PC00.I2C1)
> {
> Device (PA06)
> {
> Name (_HID, "MCHP1930") // _HID: Hardware ID
> Name (_UID, "I2C1&PA06") // _UID: Unique ID
> Name (_S0W, 0x03) // _S0W: S0 Device Wake State
> Method (_STA, 0, Serialized) // _STA: Status
> {
> If (POME)
> {
> Switch (ToInteger (PLID))
> {
> Case (Package (0x01)
> {
> 0x0C
> }
>
> )
> {
> Return (0x0F)
> }
> Default
> {
> Return (Zero)
> }
>
> }
> }
>
> Return (Zero)
> }
>
> Method (_CRS, 0, Serialized) // _CRS: Current Resource Settings
> {
> Name (RBUF, ResourceTemplate ()
> {
> I2cSerialBusV2 (0x0000, ControllerInitiated, 0x00061A80,
> AddressingMode7Bit, "\\_SB.PC00.I2C1",
> 0x00, ResourceConsumer, _Y3A, Exclusive,
> )
> })
> CreateWordField (RBUF, \_SB.PC00.I2C1.PA06._CRS._Y3A._ADR,
> BADR) // _ADR: Address
> Switch (ToInteger (PLID))
> {
> Case (Package (0x01)
> {
> 0x0C
> }
>
> )
> {
> BADR = 0x17
> }
> Default
> {
> BADR = Zero
> }
>
> }
>
> Return (RBUF) /* \_SB_.PC00.I2C1.PA06._CRS.RBUF */
> }
>
> Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method
> {
> If ((Arg0 != ToUUID
> ("033771e0-1705-47b4-9535-d1bbe14d9a09") /* Unknown UUID */))
> {
> Return (Buffer (One)
> {
> 0x00 // .
> })
> }
>
> Switch (ToInteger (Arg2))
> {
> Case (Zero)
> {
> Switch (ToInteger (Arg1))
> {
> Case (Zero)
> {
> Return (Buffer (One)
> {
> 0x03
> // .
> })
> }
> Case (One)
> {
> Return (Buffer (One)
> {
> 0x7F
> // .
> })
> }
>
> }
>
> Break
> }
> Case (One)
> {
> Name (PKG1, Package (0x02)
> {
> Package (0x08)
> {
> "",
> Zero,
> "",
> Zero,
> "",
> Zero,
> "",
> Zero
> },
>
> Package (0x08)
> {
> "",
> Zero,
> "VBAT_IN_ELPMIC",
> 0x32,
> "V3P3DX_EDP",
> 0x0A,
> "VCC_EDP_BKLT",
> 0x32
> }
> })
> Switch (ToInteger (PLID))
> {
> Case (Package (0x01)
> {
> 0x0C
> }
>
> )
> {
> Return (DerefOf (PKG1 [One]))
> }
> Default
> {
> Return (DerefOf (PKG1 [Zero]))
> }
>
> }
> }
> Case (0x02)
> {
> If ((Arg1 < One))
> {
> Break
> }
>
> Name (PKG2, Package (0x02)
> {
> Package (0x04)
> {
> Zero,
> Zero,
> Zero,
> Zero
> },
>
> Package (0x04)
> {
> Zero,
> 0xC350,
> 0x2710,
> 0xC350
> }
> })
> Switch (ToInteger (PLID))
> {
> Case (Package (0x01)
> {
> 0x0C
> }
>
> )
> {
> Return (DerefOf (PKG2 [One]))
> }
> Default
> {
> Return (DerefOf (PKG2 [Zero]))
> }
>
> }
> }
> Case (0x03)
> {
> If ((Arg1 < One))
> {
> Break
> }
>
> Name (BUF3, Package (0x01)
> {
> 0x0F
> })
> Return (BUF3) /* \_SB_.PC00.I2C1.PA06._DSM.BUF3 */
> }
> Case (0x04)
> {
> If ((Arg1 < One))
> {
> Break
> }
>
> Name (BUF4, Package (0x01)
> {
> Zero
> })
> Return (BUF4) /* \_SB_.PC00.I2C1.PA06._DSM.BUF4 */
> }
> Case (0x05)
> {
> If ((Arg1 < One))
> {
> Break
> }
>
> Name (BUF5, Package (0x02)
> {
> 0x0400,
> 0x08
> })
> Return (BUF5) /* \_SB_.PC00.I2C1.PA06._DSM.BUF5 */
> }
> Case (0x06)
> {
> If ((Arg1 < One))
> {
> Break
> }
>
> Name (BUF6, Package (0x01)
> {
> 0x0384
> })
> Return (BUF6) /* \_SB_.PC00.I2C1.PA06._DSM.BUF6 */
> }
>
> }
>
> Return (Buffer (One)
> {
> 0x00 // .
> })
> }
> }
> }
>
> #3 (also seems related to another device)
> ElseIf ((I2SB == One))
> {
> Scope (_SB.PC00.I2C1)
> {
> Device (HDAC)
> {
> Name (_HID, "INT00000") // _HID: Hardware ID
> Name (_DDN, "Intel(R) Smart Sound Technology Audio Codec")
> // _DDN: DOS Device Name
> Name (_UID, One) // _UID: Unique ID
> Name (CADR, Zero)
> Name (CDIS, Zero)
> Method (_INI, 0, NotSerialized) // _INI: Initialize
> {
> If ((I2SC == One))
> {
> _HID = "INT34C2"
> _CID = "INT34C2"
> CADR = 0x1C
> }
> ElseIf ((I2SC == 0x02))
> {
> _HID = "10EC1308"
> _CID = "10EC1308"
> CADR = 0x10
> }
> ElseIf ((I2SC == 0x03))
> {
> _HID = "ESSX8326"
> _CID = "ESSX8326"
> _DDN = "ESSX Codec Controller 8326 "
> }
> }
>
> Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
> {
> If ((I2SC == 0x03))
> {
> Name (SBFB, ResourceTemplate ()
> {
> I2cSerialBusV2 (0x0018, ControllerInitiated, 0x00061A80,
> AddressingMode7Bit, "\\_SB.PC00.I2C0",
> 0x00, ResourceConsumer, , Exclusive,
> )
> I2cSerialBusV2 (0x0009, ControllerInitiated, 0x00061A80,
> AddressingMode7Bit, "\\_SB.PC00.I2C0",
> 0x00, ResourceConsumer, , Exclusive,
> )
> })
> Name (PBUF, ResourceTemplate ()
> {
> GpioIo (Exclusive, PullDefault, 0x0000,
> 0x0000, IoRestrictionOutputOnly,
> "\\_SB.GPI0", 0x00, ResourceConsumer, ,
> )
> { // Pin list
> 0x0000
> }
> })
> Name (SBFG, ResourceTemplate ()
> {
> GpioInt (Edge, ActiveBoth, ExclusiveAndWake,
> PullNone, 0x0000,
> "\\_SB.GPI0", 0x00, ResourceConsumer, ,
> )
> { // Pin list
> 0x0000
> }
> })
> CreateWordField (PBUF, 0x17, PWRP)
> PWRP = GNUM (0x09030006)
> CreateWordField (SBFG, 0x17, INTP)
> INTP = GNUM (0x09030007)
> Return (ConcatenateResTemplate (SBFB,
> ConcatenateResTemplate (PBUF, SBFG)))
> }
> Else
> {
> Return (ConcatenateResTemplate (IICB (CADR, I2SB),
> INTB (I2SI, Zero, Zero)))
> }
> }
>
> Method (_STA, 0, NotSerialized) // _STA: Status
> {
> If (((I2SC != Zero) && (CDIS != One)))
> {
> Return (0x0F)
> }
>
> If ((CDIS == One))
> {
> Return (0x0D)
> }
>
> Return (Zero)
> }
>
> Method (_SRS, 1, Serialized) // _SRS: Set Resource Settings
> {
> CDIS = Zero
> }
>
> Method (_DIS, 0, NotSerialized) // _DIS: Disable Device
> {
> CDIS = One
> }
>
> Method (_DSM, 4, NotSerialized) // _DSM: Device-Specific Method
> {
> If ((Arg0 == Buffer (0x10)
> {
> /* 0000 */ 0x04, 0x0C, 0x80, 0xA9, 0x16,
> 0xE0, 0x3E, 0x34, // ......>4
> /* 0008 */ 0x41, 0xF4, 0x6B, 0xCC, 0xE7,
> 0x0F, 0x43, 0x32 // A.k...C2
> }))
> {
> If ((Arg2 == Zero))
> {
> Return (0x55)
> }
>
> [...Rest are similar to above, for values of Arg2
> from 0 to DF]
> }
>
> Return (0xFF)
> }
> }
> }
> }