ELAN touchpad i2c_hid bugs fix
Hi Vladislav,
I really appreciate the contribution, there are a few issues with the formatting of the patch, thanks for taking care of those (I'll inline the problems).
Quoted 8 lines · On Wed, Mar 20, 2019 at 2:28 PM <[email protected]> wrote:
Desciption: This patch add's additional quirk to force
IRQ_TRIGGER_FALLINGflag which resolves issues with ELAN1200:04F3:303E touchpad. Issues are the next:
- Journalctl floods with next report:i2c_hidi2c-ELAN1200:00:i2c_hid_get_input: incomplete report (16/65535)
- Five finger tap killsi2c_hid
- When you scroll anything, and release one finger, driver thought you are still scrolling
You don't need to be that "formal" in the commit message. The "description" part describes too much what the patch is (while we can just read the code), the important part is the issues you are fixing.
I'd like you to rewrite this in a way that doesn't feel like you are writing a bug report.
For instance, you could write (but you can change this too):
---
The ELAN1200:04F3:303E touchpad exposes several issues, all caused by an error setting the correct IRQ_TRIGGER flag:
- ...
- ...
- ...
Fix all of these with a new quirk that corrects the trigger flag announced by the ACPI tables.
---
I know writing good commit message is a tricky part :)
Quoted 4 lines
The reason why
i2c_hid_init_irqwas moved is told by Hans De Goede
<[email protected]>:i2c_hid_init_irqnow checks for a quirk, so we must setup the quirks before we init the irq, and we cannot setup the quirk earlier, so we must init the irq later.
I am pretty sure you can paraphrase Hans in your commit message without having to formally quote him (Hans, please shout if you disagree).
But this is a definitively good point to raise: your patch touches a general path, so it might have unexpected issues if not carefully reviewed by us.
Quoted 3 lines
Patch is created by help of ELANTECH and RedHat guys (Hans De Goede <[email protected]>, Benjamin Tissoires <[email protected]>, Andy Shevchenko <[email protected]>) and me (Vladislav Dalechyn <[email protected]>.
Don't take it wrong, but that's not how we give credit in a patch. In your case, if you do not have any Elantech engineer who agreed to sign off the patch, you can definitively mention them this way. But the other guys (Hans, Andy and myself) are well known kernel developers in the input and HID subsystems, so we usually take the fame by adding our Reviewed-by or Signed-off-by tag at the end of the commit message. (Also note that Andy is working for Intel ;-P )
If you feel that these persons have an equal participation in the creation of the patch, you should ask for their Signed-off-by in the patch. My gut feelings tell me they would gladly give a Reviewed-by because they helped you on the patch, but they are not the "author", so the Signed-off-by should be you only.
And yes, you should sign your work here saying that you wrote this code in accordance to the Developer's Certificate of Origin 1.1
(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst)
Then, either Jiri or myself will have a special role, and we will add our own signed-of-by as the maintainers of the HID tree certifying that this patch has been accepted by one of us.
Quoted 11 lines
---
drivers/hid/hid-ids.h| 1 +drivers/hid/i2c-hid/i2c-hid-core.c| 17 +++++++++++------2 files changed, 12 insertions(+), 6 deletions(-)drivers/hid/hid-ids.h +0
-0
drivers/hid/hid-ids.h line 392
Quoted 4 lines
drivers/hid/hid-ids.h +1
-0@@ -389,6 +389,7 @@#define USB_DEVICE_ID_TOSHIBA_CLICK_L9W 0x0401#define USB_DEVICE_ID_HP_X2 0x074d#define USB_DEVICE_ID_HP_X2_10_COVER 0x0755 +#define USB_DEVICE_ID_ELAN_TOUCHPAD 0x303e
I know Hans wanted you to use USB here, but I'd think we should have a I2C_DEVICE_ID_*
There is no guarantees that this same PID will be used in a different chip over USB.
We tend to not car about USB/I2C for the vendor IDs: the vendors decided to reuse their USB VID, which makes our life easier.
drivers/hid/i2c-hid/i2c-hid-core.c line 53
Quoted 13 lines
drivers/hid/hid-ids.h +0
-0#define USB_VENDOR_ID_ELECOM 0x056e#define USB_DEVICE_ID_ELECOM_BM084 0x0061drivers/hid/i2c-hid/i2c-hid-core.c +1
-1@@ -50,7 +50,8 @@#define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1)#define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2)#define I2C_HID_QUIRK_DELAY_AFTER_SLEEP BIT(3) -#define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) +#define I2C_HID_QUIRK_BOGUS_IRQ BIT(4)
your mail client is playing with tabs and spaces, but I don't expect the line above to be changed at all.
drivers/hid/i2c-hid/i2c-hid-core.c static const struct i2c_hid_quirks { · line 189
Quoted 13 lines
drivers/hid/i2c-hid/i2c-hid-core.c +4
-1+#define I2C_HID_QUIRK_FORCE_TRIGGER_FALLING BIT(5)/* flags */ #define I2C_HID_STARTED 0@@ -182,8 +183,10 @@ static const struct i2c_hid_quirks { I2C_HID_QUIRK_NO_RUNTIME_PM }, {I2C_VENDOR_ID_GOODIX ,I2C_DEVICE_ID_GOODIX_01F0 , I2C_HID_QUIRK_NO_RUNTIME_PM }, + { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHPAD, + I2C_HID_QUIRK_BOGUS_IRQ | I2C_HID_QUIRK_FORCE_TRIGGER_FALLING }, { USB_VENDOR_ID_ELAN, HID_ANY_ID, - I2C_HID_QUIRK_BOGUS_IRQ }, + I2C_HID_QUIRK_BOGUS_IRQ },
same here, this line should not be changed.
drivers/hid/i2c-hid/i2c-hid-core.c static int i2c_hid_init_irq(struct i2c_client *client) · line 861
Quoted 9 lines
drivers/hid/i2c-hid/i2c-hid-core.c +2
-0{ 0, 0 } };@@ -854,6 +857,8 @@ static int i2c_hid_init_irq(struct i2c_client *client)if (!irq_get_trigger_type (client->irq)) irqflags =IRQF_TRIGGER_LOW ; +if (ihid->quirks &I2C_HID_QUIRK_FORCE_TRIGGER_FALLING ) + irqflags =IRQF_TRIGGER_FALLING ;
again, indentation problems, tabs are missing
Quoted 4 lines
drivers/hid/i2c-hid/i2c-hid-core.c +0
-0ret =request_threaded_irq (client->irq,NULL , i2c_hid_irq, irqflags |IRQF_ONESHOT , client->name, ihid);
drivers/hid/i2c-hid/i2c-hid-core.c static int i2c_hid_probe(struct i2c_client *client, · line 1133
Quoted 10 lines
drivers/hid/i2c-hid/i2c-hid-core.c +0
-4@@ -1123,10 +1128,6 @@ static int i2c_hid_probe(struct i2c_client *client,if (ret <0 ) goto err_pm; - ret =i2c_hid_init_irq (client); -if (ret <0 ) - goto err_pm; - hid =hid_allocate_device ();if (IS_ERR (hid)) { ret =PTR_ERR (hid);
the next call is "goto err_irq", which should be changed to "goto err_pm"
drivers/hid/i2c-hid/i2c-hid-core.c static int i2c_hid_probe(struct i2c_client *client, · line 1155
Quoted 7 lines
drivers/hid/i2c-hid/i2c-hid-core.c +3
-0@@ -1149,6 +1150,10 @@ static int i2c_hid_probe(struct i2c_client *client, ihid->quirks =i2c_hid_lookup_quirk (hid->vendor, hid->product); + ret =i2c_hid_init_irq (client); +if (ret <0 ) + goto err_pm;
this should be "err_mem_free"
drivers/hid/i2c-hid/i2c-hid-core.c static int i2c_hid_probe(struct i2c_client *client, · line 1159
Quoted 4 lines
drivers/hid/i2c-hid/i2c-hid-core.c +1
-0+ ret =hid_add_device (hid);if (ret) {if (ret != -ENODEV )
next one should be "err_irq"
and the err_irq and err_mem_free should be inverted at the end of probe.
Cheers,
Benjamin
Quoted 3 lines
--
2.20.1
H,
On 3/20/19 3:37 PM, Benjamin Tissoires wrote:
<snip>
Quoted 7 lines
Quoted 3 lines
The reason why
i2c_hid_init_irqwas moved is told by Hans De Goede
<[email protected]>:i2c_hid_init_irqnow checks for a quirk, so we must setup the quirks before we init the irq, and we cannot setup the quirk earlier, so we must init the irq later.I am pretty sure you can paraphrase Hans in your commit message without having to formally quote him (Hans, please shout if you disagree).
Right, it is fine to explain why the irq init is moved without quoting or even referring to me.
Quoted 6 lines
Quoted 6 lines
drivers/hid/hid-ids.h +0
-0@@ -389,6 +389,7 @@#define USB_DEVICE_ID_TOSHIBA_CLICK_L9W 0x0401#define USB_DEVICE_ID_HP_X2 0x074d#define USB_DEVICE_ID_HP_X2_10_COVER 0x0755
Quoted 8 lines
drivers/hid/hid-ids.h line 392
Quoted 1 line
drivers/hid/hid-ids.h +1
-0+#define USB_DEVICE_ID_ELAN_TOUCHPAD 0x303eI know Hans wanted you to use USB here, but I'd think we should have a I2C_DEVICE_ID_*
There is no guarantees that this same PID will be used in a different chip over USB.
We tend to not car about USB/I2C for the vendor IDs: the vendors decided to reuse their USB VID, which makes our life easier.
Ok, no objection from me to use an I2C_DEVICE_ID prefix, here it is after all an I2C device.
Quoted 14 lines
Quoted 14 lines
drivers/hid/hid-ids.h +0
-0#define USB_VENDOR_ID_ELECOM 0x056e#define USB_DEVICE_ID_ELECOM_BM084 0x0061drivers/hid/i2c-hid/i2c-hid-core.c +2
-1@@ -50,7 +50,8 @@#define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1)#define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2)#define I2C_HID_QUIRK_DELAY_AFTER_SLEEP BIT(3) -#define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) +#define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) +#define I2C_HID_QUIRK_FORCE_TRIGGER_FALLING BIT(5)
Quoted 11 lines
drivers/hid/i2c-hid/i2c-hid-core.c static const struct i2c_hid_quirks { · line 189
Quoted 11 lines
drivers/hid/i2c-hid/i2c-hid-core.c +3
-1/* flags */ #define I2C_HID_STARTED 0@@ -182,8 +183,10 @@ static const struct i2c_hid_quirks { I2C_HID_QUIRK_NO_RUNTIME_PM }, {I2C_VENDOR_ID_GOODIX ,I2C_DEVICE_ID_GOODIX_01F0 , I2C_HID_QUIRK_NO_RUNTIME_PM }, + { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHPAD, + I2C_HID_QUIRK_BOGUS_IRQ | I2C_HID_QUIRK_FORCE_TRIGGER_FALLING }, { USB_VENDOR_ID_ELAN, HID_ANY_ID, - I2C_HID_QUIRK_BOGUS_IRQ }, + I2C_HID_QUIRK_BOGUS_IRQ },
Benjamin, what I find interesting here is that the BOGUS_IRQ quirk is also used on Elan devices, I suspect that these Elan devices likely also need the I2C_HID_QUIRK_FORCE_TRIGGER_FALLING quirk and then they probably will no longer need the bogus IRQ flag, if you know about bugreports with an acpidump for any of the devices needing the bogus IRQ quirk, then I (or you) can check how the IRQ is declared there, I suspect it will be declared as level-low, just like with the laptop this patch was written for. And it probably need to be edge-falling instead of level-low just like this case.
Regards,
Hans
Hi Hans,
Quoted 60 lines · Hans de Goede
H,
On 3/20/19 3:37 PM, Benjamin Tissoires wrote:
<snip>
Quoted 6 lines
Quoted 3 lines
The reason why
i2c_hid_init_irqwas moved is told by Hans De Goede
<[email protected]>:i2c_hid_init_irqnow checks for a quirk, so we must setup the quirks before we init the irq, and we cannot setup the quirk earlier, so we must init the irq later.I am pretty sure you can paraphrase Hans in your commit message without having to formally quote him (Hans, please shout if you disagree).
Right, it is fine to explain why the irq init is moved without quoting or even referring to me.
Quoted 5 lines
Quoted 5 lines
drivers/hid/hid-ids.h +0
-0@@ -389,6 +389,7 @@#define USB_DEVICE_ID_TOSHIBA_CLICK_L9W 0x0401#define USB_DEVICE_ID_HP_X2 0x074dQuoted 8 lines
drivers/hid/hid-ids.h line 392
Quoted 2 lines
drivers/hid/hid-ids.h +1
-0#define USB_DEVICE_ID_HP_X2_10_COVER 0x0755 +#define USB_DEVICE_ID_ELAN_TOUCHPAD 0x303eI know Hans wanted you to use USB here, but I'd think we should have a I2C_DEVICE_ID_*
There is no guarantees that this same PID will be used in a different chip over USB.
We tend to not car about USB/I2C for the vendor IDs: the vendors decided to reuse their USB VID, which makes our life easier.Ok, no objection from me to use an
I2C_DEVICE_IDprefix, here it is after all an I2C device.Quoted 14 lines
Quoted 14 lines
drivers/hid/hid-ids.h +0
-0#define USB_VENDOR_ID_ELECOM 0x056e#define USB_DEVICE_ID_ELECOM_BM084 0x0061drivers/hid/i2c-hid/i2c-hid-core.c +2
-1@@ -50,7 +50,8 @@#define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1)#define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2)#define I2C_HID_QUIRK_DELAY_AFTER_SLEEP BIT(3) -#define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) +#define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) +#define I2C_HID_QUIRK_FORCE_TRIGGER_FALLING BIT(5)Quoted 11 lines
drivers/hid/i2c-hid/i2c-hid-core.c static const struct i2c_hid_quirks { · line 189
Quoted 11 lines
drivers/hid/i2c-hid/i2c-hid-core.c +3
-1/* flags */ #define I2C_HID_STARTED 0@@ -182,8 +183,10 @@ static const struct i2c_hid_quirks { I2C_HID_QUIRK_NO_RUNTIME_PM }, {I2C_VENDOR_ID_GOODIX ,I2C_DEVICE_ID_GOODIX_01F0 , I2C_HID_QUIRK_NO_RUNTIME_PM }, + { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHPAD, + I2C_HID_QUIRK_BOGUS_IRQ | I2C_HID_QUIRK_FORCE_TRIGGER_FALLING }, { USB_VENDOR_ID_ELAN, HID_ANY_ID, - I2C_HID_QUIRK_BOGUS_IRQ }, + I2C_HID_QUIRK_BOGUS_IRQ },Benjamin, what I find interesting here is that the
BOGUS_IRQquirk
Quoted 8 lines
is also used on Elan devices, I suspect that these Elan devices likely also need the
I2C_HID_QUIRK_FORCE_TRIGGER_FALLINGquirk and then they probably will no longer need the bogus IRQ flag, if you know about bugreports with an acpidump for any of the devices needing the bogus IRQ quirk, then I (or you) can check how the IRQ is declared there, I suspect it will be declared as level-low, just like with the laptop this patch was written for. And it probably need to be edge-falling instead of level-low just like this case.
First, I’ve already tried using IRQF_TRIGGER_FALLING, unfortunately it doesn’t solve the issue for me.
I talked to Elan once, and they confirm the correct IRQ trigger is level low. So forcing falling trigger may break other platforms.
Recently we found that Elan touchpad doesn’t like GpioInt() from its _CRS. Once the Interrupt() is used instead, the issue goes away.
But I am not sure how to patch its DSDT/SSDT in i2c-hid.
Kai-Heng
Quoted 4 lines
Regards,
Hans
Quoted 12 lines · Benjamin Tissoires
Quoted 1 line · On Wed, Mar 20, 2019 at 2:28 PM <[email protected]> wrote:
Patch is created by help of ELANTECH and RedHat guys (Hans De Goede <[email protected]>, Benjamin Tissoires <[email protected]>, Andy Shevchenko <[email protected]>) and me (Vladislav Dalechyn <[email protected]>.
Don't take it wrong, but that's not how we give credit in a patch. In your case, if you do not have any Elantech engineer who agreed to sign off the patch, you can definitively mention them this way. But the other guys (Hans, Andy and myself) are well known kernel developers in the input and HID subsystems, so we usually take the fame by adding our Reviewed-by or Signed-off-by tag at the end of the commit message. (Also note that Andy is working for Intel ;-P )
Quoted 5 lines
If you feel that these persons have an equal participation in the creation of the patch, you should ask for their Signed-off-by in the patch. My gut feelings tell me they would gladly give a Reviewed-by because they helped you on the patch, but they are not the "author", so the Signed-off-by should be you only.
Just in case, we have Co-developed-by: tag and for my opinion Hans' name should go under this category.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 13 lines · Kai-Heng Feng
Quoted 11 lines · Hans de Goede
On 3/20/19 3:37 PM, Benjamin Tissoires wrote:
Benjamin, what I find interesting here is that the
BOGUS_IRQquirk is also used on Elan devices, I suspect that these Elan devices likely also need theI2C_HID_QUIRK_FORCE_TRIGGER_FALLINGquirk and then they probably will no longer need the bogus IRQ flag, if you know about bugreports with an acpidump for any of the devices needing the bogus IRQ quirk, then I (or you) can check how the IRQ is declared there, I suspect it will be declared as level-low, just like with the laptop this patch was written for. And it probably need to be edge-falling instead of level-low just like this case.
Quoted 5 lines
First, I’ve already tried using
IRQF_TRIGGER_FALLING, unfortunately it doesn’t solve the issue for me.I talked to Elan once, and they confirm the correct IRQ trigger is level low. So forcing falling trigger may break other platforms.
As far as I understood Vladislav the quirk he got from Elan as well.
Quoted 2 lines
Recently we found that Elan touchpad doesn’t like
GpioInt()from its_CRS. Once theInterrupt()is used instead, the issue goes away.
IIRC i2c core tries to get interrupt from Interrupt() resource and then falls back to GpioInt().
See i2c_acpi_get_info() and i2c_device_probe().
Quoted 1 line
But I am not sure how to patch its DSDT/SSDT in i2c-hid.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 15 lines · Andy Shevchenko
Quoted 13 lines · Kai-Heng Feng
Quoted 11 lines · Hans de Goede
On 3/20/19 3:37 PM, Benjamin Tissoires wrote:
Benjamin, what I find interesting here is that the
BOGUS_IRQquirk is also used on Elan devices, I suspect that these Elan devices likely also need theI2C_HID_QUIRK_FORCE_TRIGGER_FALLINGquirk and then they probably will no longer need the bogus IRQ flag, if you know about bugreports with an acpidump for any of the devices needing the bogus IRQ quirk, then I (or you) can check how the IRQ is declared there, I suspect it will be declared as level-low, just like with the laptop this patch was written for. And it probably need to be edge-falling instead of level-low just like this case.
Quoted 7 lines
Quoted 5 lines
First, I’ve already tried using
IRQF_TRIGGER_FALLING, unfortunately it doesn’t solve the issue for me.I talked to Elan once, and they confirm the correct IRQ trigger is level low. So forcing falling trigger may break other platforms.
As far as I understood Vladislav the quirk he got from Elan as well.
Ok, then this is really weird.
Quoted 7 lines
Quoted 3 lines
Recently we found that Elan touchpad doesn’t like
GpioInt()from its_CRS. Once theInterrupt()is used instead, the issue goes away.IIRC i2c core tries to get interrupt from
Interrupt()resource and then falls back toGpioInt().
Seei2c_acpi_get_info()andi2c_device_probe().
Here’s its ASL:
Scope (\_SB.PCI0.I2C4)
{
Device (TPD0)
{
Name (_ADR, One) // _ADR: Address
Name (_HID, "DELL08AE") // _HID: Hardware ID
Name (_CID, "PNP0C50" /* HID Protocol Device (I2C bus) */) // _CID: Compatible ID
Name (_UID, One) // _UID: Unique ID
Name (_S0W, 0x04) // _S0W: S0 Device Wake State
Name (SBFB, ResourceTemplate ()
{
I2cSerialBusV2 (0x002C, ControllerInitiated, 0x00061A80,
AddressingMode7Bit, "\\_SB.PCI0.I2C4",
0x00, ResourceConsumer, , Exclusive,
)
})
Name (SBFG, ResourceTemplate ()
{
GpioInt (Level, ActiveLow, ExclusiveAndWake, PullUp, 0x0000,
"\\_SB.GPO1", 0x00, ResourceConsumer, ,
)
{ // Pin list
0x0012
}
})
Name (SBFI, ResourceTemplate ()
{
Interrupt (ResourceConsumer, Level, ActiveLow, ExclusiveAndWake, ,, )
{
0x0000003C,
}
})
Method (_INI, 0, NotSerialized) // _INI: Initialize
{
}
Method (_STA, 0, NotSerialized) // _STA: Status
{
If ((TCPD == One))
{
Return (0x0F)
}
Return (Zero)
}
Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
{
If ((OSYS < 0x07DC))
{
Return (SBFI) /* \_SB_.PCI0.I2C4.TPD0.SBFI */
}
Return (ConcatenateResTemplate (SBFB, SBFG))
}
Method (_DSM, 4, NotSerialized) // _DSM: Device-Specific Method
{
If ((Arg0 == ToUUID ("3cdff6f7-4267-4555-ad05-b30a3d8938de") /* HID I2C Device */))
{
If ((Arg2 == Zero))
{
If ((Arg1 == One))
{
Return (Buffer (One)
{
0x03 // .
})
}
Else
{
Return (Buffer (One)
{
0x00 // .
})
}
}
ElseIf ((Arg2 == One))
{
Return (0x20)
}
Else
{
Return (Buffer (One)
{
0x00 // .
})
}
}
ElseIf ((Arg0 == ToUUID ("ef87eb82-f951-46da-84ec-14871ac6f84b")))
{
If ((Arg2 == Zero))
{
If ((Arg1 == One))
{
Return (Buffer (One)
{
0x03 // .
})
}
}
If ((Arg2 == One))
{
Return (ConcatenateResTemplate (SBFB, SBFG))
}
Return (Buffer (One)
{
0x00 // .
})
}
}
Else
{
Return (Buffer (One)
{
0x00 // .
})
}
}
}
}Change SBFG to SBFI in its _CRS can workaround the issue. Is ASL in this form possible to do the flow you described?
Kai-Heng
Quoted 6 lines
Quoted 2 lines
But I am not sure how to patch its DSDT/SSDT in i2c-hid.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 39 lines · Kai-Heng Feng
Quoted 11 lines · Andy Shevchenko
Quoted 5 lines · Kai-Heng Feng
Quoted 1 line · Hans de Goede
On 3/20/19 3:37 PM, Benjamin Tissoires wrote:
Recently we found that Elan touchpad doesn’t like
GpioInt()from its_CRS. Once theInterrupt()is used instead, the issue goes away.IIRC i2c core tries to get interrupt from
Interrupt()resource and then falls back toGpioInt().
Seei2c_acpi_get_info()andi2c_device_probe().Here’s its ASL:
Name (SBFB, ResourceTemplate () { I2cSerialBusV2 (0x002C, ControllerInitiated, 0x00061A80, AddressingMode7Bit, "\\_SB.PCI0.I2C4", 0x00, ResourceConsumer, , Exclusive, ) }) Name (SBFG, ResourceTemplate () { GpioInt (Level, ActiveLow, ExclusiveAndWake, PullUp, 0x0000, "\\_SB.GPO1", 0x00, ResourceConsumer, , ) { // Pin list 0x0012 } }) Name (SBFI, ResourceTemplate () { Interrupt (ResourceConsumer, Level, ActiveLow, ExclusiveAndWake, ,, ) { 0x0000003C, } })
Quoted 7 lines
Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
{
If ((OSYS < 0x07DC))
{
Return (SBFI) /* \_SB_.PCI0.I2C4.TPD0.SBFI */
}This will return only Interrupt() resource
Quoted 2 lines
Return (ConcatenateResTemplate (SBFB, SBFG))
This one I2cSerialBus() and GpioInt().
Quoted 8 lines
} } }Change SBFG to SBFI in its
_CRScan workaround the issue. Is ASL in this form possible to do the flow you described?
Since it's enumerated in Linux as I2C device, it means it gets I2C and GPIO resources.
So, no, it's not possible.
What are you describing might tell us about one of the following:
- touchpad should be switched to PS/2 mode in order to get working
- GPIO resource is not correct / bug in GPIO driver
I don't believe the first one is a case here.
If GPIO resource is not correct and main OS has some quirks, we need to do similar in Linux.
Otherwise, debugging GPIO driver, starting from what exactly (pin number, pin settings, etc) gets i2c-hid module.
Note, ACPICA and related stuff is done in order to be Windows compatible. If you have settings in BIOS that defines OS to boot, it should be chosen Windows.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Hi,
Quoted 61 lines · Kai-Heng Feng
Quoted 15 lines · Andy Shevchenko
Quoted 13 lines · Kai-Heng Feng
Quoted 11 lines · Hans de Goede
On 3/20/19 3:37 PM, Benjamin Tissoires wrote:
Benjamin, what I find interesting here is that the
BOGUS_IRQquirk is also used on Elan devices, I suspect that these Elan devices likely also need theI2C_HID_QUIRK_FORCE_TRIGGER_FALLINGquirk and then they probably will no longer need the bogus IRQ flag, if you know about bugreports with an acpidump for any of the devices needing the bogus IRQ quirk, then I (or you) can check how the IRQ is declared there, I suspect it will be declared as level-low, just like with the laptop this patch was written for. And it probably need to be edge-falling instead of level-low just like this case.Quoted 7 lines
Quoted 5 lines
First, I’ve already tried using
IRQF_TRIGGER_FALLING, unfortunately it doesn’t solve the issue for me.I talked to Elan once, and they confirm the correct IRQ trigger is level low. So forcing falling trigger may break other platforms.
As far as I understood Vladislav the quirk he got from Elan as well.
Ok, then this is really weird.
Quoted 7 lines
Quoted 3 lines
Recently we found that Elan touchpad doesn’t like
GpioInt()from its_CRS. Once theInterrupt()is used instead, the issue goes away.IIRC i2c core tries to get interrupt from
Interrupt()resource and then falls back toGpioInt().
Seei2c_acpi_get_info()andi2c_device_probe().Here’s its ASL:
Scope (\_SB.PCI0.I2C4)
{
Device (TPD0)
{
Name (_ADR, One) //_ADR: Address
Name (_HID, "DELL08AE") //_HID: Hardware ID
Name (_CID, "PNP0C50" /* HID Protocol Device (I2C bus) */) //_CID: Compatible ID Name (_UID, One) //_UID: Unique ID
Name (_S0W, 0x04) //_S0W: S0 Device Wake State
Name (SBFB, ResourceTemplate ()
{
I2cSerialBusV2 (0x002C, ControllerInitiated,0x00061A80, AddressingMode7Bit, "\\_SB.PCI0.I2C4",
0x00, ResourceConsumer, , Exclusive,
)
})
Name (SBFG, ResourceTemplate ()
{
GpioInt (Level, ActiveLow, ExclusiveAndWake, PullUp,0x0000, "\\_SB.GPO1",0x00, ResourceConsumer, ,
)
{ // Pin list
0x0012
}
Quoted 8 lines
})
Name (SBFI, ResourceTemplate ()
{
Interrupt (ResourceConsumer, Level, ActiveLow, ExclusiveAndWake, ,, ) {
0x0000003C,
}
})
OK, so both interrupt definitions declare the interrupt as Level, ActiveLow, so forcing falling-edge here *might* help too.
Regards,
Hans
Quoted 73 lines · Andy Shevchenko
Quoted 39 lines · Kai-Heng Feng
Quoted 11 lines · Andy Shevchenko
Quoted 5 lines · Kai-Heng Feng
Quoted 1 line · Hans de Goede
On 3/20/19 3:37 PM, Benjamin Tissoires wrote:
Recently we found that Elan touchpad doesn’t like
GpioInt()from its_CRS. Once theInterrupt()is used instead, the issue goes away.IIRC i2c core tries to get interrupt from
Interrupt()resource and then falls back toGpioInt().
Seei2c_acpi_get_info()andi2c_device_probe().Here’s its ASL:
Name (SBFB, ResourceTemplate () { I2cSerialBusV2 (0x002C, ControllerInitiated, 0x00061A80, AddressingMode7Bit, "\\_SB.PCI0.I2C4", 0x00, ResourceConsumer, , Exclusive, ) }) Name (SBFG, ResourceTemplate () { GpioInt (Level, ActiveLow, ExclusiveAndWake, PullUp, 0x0000, "\\_SB.GPO1", 0x00, ResourceConsumer, , ) { // Pin list 0x0012 } }) Name (SBFI, ResourceTemplate () { Interrupt (ResourceConsumer, Level, ActiveLow, ExclusiveAndWake, ,, ) { 0x0000003C, } })Quoted 7 lines
Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings { If ((OSYS < 0x07DC)) { Return (SBFI) /* \_SB_.PCI0.I2C4.TPD0.SBFI */ }This will return only
Interrupt()resourceQuoted 2 lines
Return (ConcatenateResTemplate (SBFB, SBFG))
This one
I2cSerialBus()andGpioInt().Quoted 8 lines
} } }Change SBFG to SBFI in its
_CRScan workaround the issue. Is ASL in this form possible to do the flow you described?Since it's enumerated in Linux as I2C device, it means it gets I2C and GPIO resources.
So, no, it's not possible.
Quoted 7 lines
What are you describing might tell us about one of the following:
- touchpad should be switched to PS/2 mode in order to get working
- GPIO resource is not correct / bug in GPIO driverI don't believe the first one is a case here.
If GPIO resource is not correct and main OS has some quirks, we need to do similar in Linux.
How do I check quirks on Windows?
Quoted 2 lines
Otherwise, debugging GPIO driver, starting from what exactly (pin number, pin settings, etc) gets i2c-hid module.
Ok, please let me know where should I start looking into.
Quoted 4 lines
Note, ACPICA and related stuff is done in order to be Windows compatible. If you have settings in BIOS that defines OS to boot, it should be chosen Windows.
Yes, it’s Windows.
Kai-Heng
Quoted 4 lines
Signature · 3 lines
-- With Best Regards, Andy Shevchenko
+Cc: Mario
Mario, do you have any insights about the issue with touchpad on Dell system described below?
Quoted 172 lines · Kai-Heng Feng
Quoted 15 lines · Andy Shevchenko
Quoted 13 lines · Kai-Heng Feng
Quoted 11 lines · Hans de Goede
On 3/20/19 3:37 PM, Benjamin Tissoires wrote:
Benjamin, what I find interesting here is that the
BOGUS_IRQquirk is also used on Elan devices, I suspect that these Elan devices likely also need theI2C_HID_QUIRK_FORCE_TRIGGER_FALLINGquirk and then they probably will no longer need the bogus IRQ flag, if you know about bugreports with an acpidump for any of the devices needing the bogus IRQ quirk, then I (or you) can check how the IRQ is declared there, I suspect it will be declared as level-low, just like with the laptop this patch was written for. And it probably need to be edge-falling instead of level-low just like this case.Quoted 7 lines
Quoted 5 lines
First, I’ve already tried using
IRQF_TRIGGER_FALLING, unfortunately it doesn’t solve the issue for me.I talked to Elan once, and they confirm the correct IRQ trigger is level low. So forcing falling trigger may break other platforms.
As far as I understood Vladislav the quirk he got from Elan as well.
Ok, then this is really weird.
Quoted 7 lines
Quoted 3 lines
Recently we found that Elan touchpad doesn’t like
GpioInt()from its_CRS. Once theInterrupt()is used instead, the issue goes away.IIRC i2c core tries to get interrupt from
Interrupt()resource and then falls back toGpioInt().
Seei2c_acpi_get_info()andi2c_device_probe().Here’s its ASL:
Scope (\_SB.PCI0.I2C4) { Device (TPD0) { Name (_ADR, One) // _ADR: Address Name (_HID, "DELL08AE") // _HID: Hardware ID Name (_CID, "PNP0C50" /* HID Protocol Device (I2C bus) */) // _CID: Compatible ID Name (_UID, One) // _UID: Unique ID Name (_S0W, 0x04) // _S0W: S0 Device Wake State Name (SBFB, ResourceTemplate () { I2cSerialBusV2 (0x002C, ControllerInitiated, 0x00061A80, AddressingMode7Bit, "\\_SB.PCI0.I2C4", 0x00, ResourceConsumer, , Exclusive, ) }) Name (SBFG, ResourceTemplate () { GpioInt (Level, ActiveLow, ExclusiveAndWake, PullUp, 0x0000, "\\_SB.GPO1", 0x00, ResourceConsumer, , ) { // Pin list 0x0012 } }) Name (SBFI, ResourceTemplate () { Interrupt (ResourceConsumer, Level, ActiveLow, ExclusiveAndWake, ,, ) { 0x0000003C, } }) Method (_INI, 0, NotSerialized) // _INI: Initialize { } Method (_STA, 0, NotSerialized) // _STA: Status { If ((TCPD == One)) { Return (0x0F) } Return (Zero) } Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings { If ((OSYS < 0x07DC)) { Return (SBFI) /* \_SB_.PCI0.I2C4.TPD0.SBFI */ } Return (ConcatenateResTemplate (SBFB, SBFG)) } Method (_DSM, 4, NotSerialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("3cdff6f7-4267-4555-ad05-b30a3d8938de") /* HID I2C Device */)) { If ((Arg2 == Zero)) { If ((Arg1 == One)) { Return (Buffer (One) { 0x03 // . }) } Else { Return (Buffer (One) { 0x00 // . }) } } ElseIf ((Arg2 == One)) { Return (0x20) } Else { Return (Buffer (One) { 0x00 // . }) } } ElseIf ((Arg0 == ToUUID ("ef87eb82-f951-46da-84ec-14871ac6f84b"))) { If ((Arg2 == Zero)) { If ((Arg1 == One)) { Return (Buffer (One) { 0x03 // . }) } } If ((Arg2 == One)) { Return (ConcatenateResTemplate (SBFB, SBFG)) } Return (Buffer (One) { 0x00 // . }) } } Else { Return (Buffer (One) { 0x00 // . }) } } } }Change SBFG to SBFI in its
_CRScan workaround the issue. Is ASL in this form possible to do the flow you described?Kai-Heng
Quoted 6 lines
Quoted 2 lines
But I am not sure how to patch its DSDT/SSDT in i2c-hid.
--
With Best Regards,
Andy Shevchenko
Signature · 2 lines
With Best Regards, Andy Shevchenko
Hi,
Quoted 1 line · On 23-03-19 12:18, [email protected] wrote:
Guys, I am a little bit confused. Do you mean that it is not kernel related issue, and it's the issue of ASUS BIOS?
Technically this is a BIOS bug, the BIOS should properly declare the IRQ as edge-falling and then everything would just work.
But BIOS bugs is what quirks are for (unfortunately)
Quoted 1 line
And why do you think that triggering edge-falling quirk for this exactly this touchpad and exactly ELAN vendor can somehow break other systems?
I'm not seeing anything about breaking other systems in the discussion (but I may have missed this) what we were discussing is also applying the quirk to other systems with an Elan touchpad to see if it also helps with issues on other systems.
Summarizing: Your patch is fine (minus the style issues and the goto error_foo stuff) please fix those issues and submit a new version.
Regards,
Hans
Quoted 198 lines
Regards,
VladislavMar 21, 2019, 12:38 PM by [email protected]:
Hello! Thank you for an answer and for helping me with the patch. It is my very first contribution. About some indent problems: I am sorry, it was mainly caused by my .vimrc, and I will edit these errors and send a new patch. Though, there is one typo: +#define I2C_HID_QUIRK_FORCE_TRIGGER_FALLING BIT(5) /* flags */ #define I2C_HID_STARTED 0 @@ -182,8 +183,10 @@ static const struct i2c_hid_quirks { I2C_HID_QUIRK_NO_RUNTIME_PM }, { I2C_VENDOR_ID_GOODIX, I2C_DEVICE_ID_GOODIX_01F0, I2C_HID_QUIRK_NO_RUNTIME_PM }, + { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHPAD, + I2C_HID_QUIRK_BOGUS_IRQ | I2C_HID_QUIRK_FORCE_TRIGGER_FALLING }, { USB_VENDOR_ID_ELAN, HID_ANY_ID, - I2C_HID_QUIRK_BOGUS_IRQ }, + I2C_HID_QUIRK_BOGUS_IRQ }, same here, this line should not be changed. If you take a look at original file, you can notice extra space there. In your case, if you do not have any Elantech engineer who agreed to sign off the patch, you can definitively mention them this way. I don't have any. ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq, irqflags | IRQF_ONESHOT, client->name, ihid); @@ -1123,10 +1128,6 @@ static int i2c_hid_probe(struct i2c_client *client, if (ret < 0) goto err_pm; - ret = i2c_hid_init_irq(client); - if (ret < 0) - goto err_pm; - hid = hid_allocate_device(); if (IS_ERR(hid)) { ret = PTR_ERR(hid); the next call is "goto err_irq", which should be changed to "goto err_pm" @@ -1149,6 +1150,10 @@ static int i2c_hid_probe(struct i2c_client *client, ihid->quirks = i2c_hid_lookup_quirk(hid->vendor, hid->product); + ret = i2c_hid_init_irq(client); + if (ret < 0) + goto err_pm; this should be "err_mem_free" + ret = hid_add_device(hid); if (ret) { if (ret != -ENODEV) next one should be "err_irq" and the err_irq and err_mem_free should be inverted at the end of probe. I tried to understand this as hard as I could, but there may be some errors, so please review my latest patch: From 80576dd7ac193548ba747d287b5ab5606f642d00 Mon Sep 17 00:00:00 2001 From: h0tw4t3r <[email protected] <mailto:[email protected]>> Date: Wed, 20 Mar 2019 00:41:22 +0200 Subject: [PATCH] ELAN touchpad i2c_hid bugs fix Description: The ELAN1200:04F3:303E touchpad exposes several issues, all caused by an error setting the correct IRQ_TRIGGER flag: - i2c_hid incoplete error flood in journalctl; - Five finger tap kill's module so you have to restart it; - Two finger scoll is working incorrect and sometimes even when you raised one of two finger still thinks that you are scrolling Fix all of these with a new quirk that corrects the trigger flag announced by the ACPI tables. (edge-falling). Reason behind moving i2c_hid_init_irq section described below: i2c_hid_init_irq now checks for a quirk, so we must setup the quirks before we init the irq, and we cannot setup the quirk earlier, so we must init the irq later. Signed-off-by: Vladislav Dalechyn <[email protected] <mailto:[email protected]>> --- drivers/hid/hid-ids.h | 1 + drivers/hid/i2c-hid/i2c-hid-core.c | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index b6d93f4ad037..660b4e0e912e 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -389,6 +389,7 @@ #define USB_DEVICE_ID_TOSHIBA_CLICK_L9W 0x0401 #define USB_DEVICE_ID_HP_X2 0x074d #define USB_DEVICE_ID_HP_X2_10_COVER 0x0755 +#define I2C_DEVICE_ID_ELAN_TOUCHPAD 0x303e #define USB_VENDOR_ID_ELECOM 0x056e #define USB_DEVICE_ID_ELECOM_BM084 0x0061 diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c index 90164fed08d3..9b417914411f 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -51,6 +51,7 @@ #define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2) #define I2C_HID_QUIRK_DELAY_AFTER_SLEEP BIT(3) #define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) +#define I2C_HID_QUIRK_FORCE_TRIGGER_FALLING BIT(5) /* flags */ #define I2C_HID_STARTED 0 @@ -182,8 +183,10 @@ static const struct i2c_hid_quirks { I2C_HID_QUIRK_NO_RUNTIME_PM }, { I2C_VENDOR_ID_GOODIX, I2C_DEVICE_ID_GOODIX_01F0, I2C_HID_QUIRK_NO_RUNTIME_PM }, + { USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_ELAN_TOUCHPAD, + I2C_HID_QUIRK_BOGUS_IRQ | I2C_HID_QUIRK_FORCE_TRIGGER_FALLING }, { USB_VENDOR_ID_ELAN, HID_ANY_ID, - I2C_HID_QUIRK_BOGUS_IRQ }, + I2C_HID_QUIRK_BOGUS_IRQ }, { 0, 0 } }; @@ -854,6 +857,8 @@ static int i2c_hid_init_irq(struct i2c_client *client) if (!irq_get_trigger_type(client->irq)) irqflags = IRQF_TRIGGER_LOW; + if (ihid->quirks & I2C_HID_QUIRK_FORCE_TRIGGER_FALLING) + irqflags = IRQF_TRIGGER_FALLING; ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq, irqflags | IRQF_ONESHOT, client->name, ihid); @@ -1123,14 +1128,10 @@ static int i2c_hid_probe(struct i2c_client *client, if (ret < 0) goto err_pm; - ret = i2c_hid_init_irq(client); - if (ret < 0) - goto err_pm; - hid = hid_allocate_device(); if (IS_ERR(hid)) { ret = PTR_ERR(hid); - goto err_irq; + goto err_pm; } ihid->hid = hid; @@ -1149,11 +1150,15 @@ static int i2c_hid_probe(struct i2c_client *client, ihid->quirks = i2c_hid_lookup_quirk(hid->vendor, hid->product); + ret = i2c_hid_init_irq(client); + if (ret < 0) + goto err_mem_free; + ret = hid_add_device(hid); if (ret) { if (ret != -ENODEV) hid_err(client, "can't add hid device: %d\n", ret); - goto err_mem_free; + goto err_irq; } if (!(ihid->quirks & I2C_HID_QUIRK_NO_RUNTIME_PM)) @@ -1161,12 +1166,12 @@ static int i2c_hid_probe(struct i2c_client *client, return 0; +err_irq: + free_irq(client->irq, ihid); + err_mem_free: hid_destroy_device(hid); -err_irq: - free_irq(client->irq, ihid); - err_pm: pm_runtime_put_noidle(&client->dev); pm_runtime_disable(&client->dev); -- 2.20.1 Regards, Vladislav.
Hi,
Quoted 21 lines · On 24-03-19 18:15, [email protected] wrote:
Hi,
Sorry, I forgot to put the description.
goto
err_foostuff changes were requested by Benjamin. Please tell if you think something is wrong.Regards, Vladislav.
Here's the final patch:
From
80576dd7ac193548ba747d287b5ab5606f642d00Mon Sep 17 00:00:00 2001
From: h0tw4t3r <[email protected] <mailto:[email protected]>>
Date: Wed, 24 Mar 2019 19:14:22 +0200
Subject: [PATCH] ELAN touchpadi2c_hidbugs fixDescription: The ELAN1200:04F3:303E touchpad exposes several issues, all caused by
an error setting the correctIRQ_TRIGGERflag:
-i2c_hidincoplete error flood in journalctl;
- Five finger tap kill's module so you have to restart it;
- Two finger scoll is working incorrect and sometimes even when you raised one of two finger still thinks that you are scrolling
Quoted 5 lines
Fix all of these with a new quirk that corrects the trigger flag announced by the ACPI tables. (edge-falling).
Reason behind moving
i2c_hid_init_irqsection described below:
i2c_hid_init_irqnow checks for a quirk, so we must setup the quirks before we init the irq, and we cannot setup the quirk earlier, so we must init the irq later.
Some lines in your commit messages are longer then 75 chars, please add an enter after aprox. 75 chars so that you have no lines longer then 75 chars.
Quoted 43 lines
Signed-off-by Vladislav Dalechyn <[email protected] <mailto:[email protected]>>---
drivers/hid/hid-ids.h | 1 +drivers/hid/i2c-hid/i2c-hid-core.c| 25 +++++++++++++++----------2 files changed, 16 insertions(+), 10 deletions(-)drivers/hid/hid-ids.h +1
-0@@ -389,6 +389,7 @@#define USB_DEVICE_ID_TOSHIBA_CLICK_L9W 0x0401#define USB_DEVICE_ID_HP_X2 0x074d#define USB_DEVICE_ID_HP_X2_10_COVER 0x0755 +#define I2C_DEVICE_ID_ELAN_TOUCHPAD 0x303e#define USB_VENDOR_ID_ELECOM 0x056e#define USB_DEVICE_ID_ELECOM_BM084 0x0061drivers/hid/i2c-hid/i2c-hid-core.c +4
-1@@ -51,6 +51,7 @@#define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2)#define I2C_HID_QUIRK_DELAY_AFTER_SLEEP BIT(3)#define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) +#define I2C_HID_QUIRK_FORCE_TRIGGER_FALLING BIT(5)/* flags */ #define I2C_HID_STARTED 0@@ -182,8 +183,10 @@ static const struct i2c_hid_quirks { I2C_HID_QUIRK_NO_RUNTIME_PM }, {I2C_VENDOR_ID_GOODIX ,I2C_DEVICE_ID_GOODIX_01F0 , I2C_HID_QUIRK_NO_RUNTIME_PM }, + { USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_ELAN_TOUCHPAD, + I2C_HID_QUIRK_BOGUS_IRQ | I2C_HID_QUIRK_FORCE_TRIGGER_FALLING }, { USB_VENDOR_ID_ELAN, HID_ANY_ID, - I2C_HID_QUIRK_BOGUS_IRQ }, + I2C_HID_QUIRK_BOGUS_IRQ }, { 0, 0 } };
drivers/hid/i2c-hid/i2c-hid-core.c static int i2c_hid_init_irq(struct i2c_client *client) · line 861
Quoted 5 lines
drivers/hid/i2c-hid/i2c-hid-core.c +2
-0@@ -854,6 +857,8 @@ static int i2c_hid_init_irq(struct i2c_client *client)if (!irq_get_trigger_type (client->irq)) irqflags =IRQF_TRIGGER_LOW ; +if (ihid->quirks &I2C_HID_QUIRK_FORCE_TRIGGER_FALLING ) + irqflags =IRQF_TRIGGER_FALLING ;
The patch has been completely mangled by your mail client, please use "git send-email" to send a new version of the patch without it getting mangled by your email client.
Regards,
Hans
Quoted 10 lines
-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Thursday, March 21, 2019 4:48 AM
To: Kai-Heng Feng; Limonciello, Mario
Cc: Hans de Goede; Benjamin Tissoires; [email protected]; Jiri Kosina; Stephen Boyd; Sebastian Andrzej Siewior; Dmitry Torokhov; open list:HID CORE LAYER; lkml
Subject: Re: [PATCH] ELAN touchpadi2c_hidbugs fix
Quoted 6 lines
[EXTERNAL EMAIL]
+Cc: Mario
Mario, do you have any insights about the issue with touchpad on Dell system described below?
My apologies, this got lost while I was on vacation.
Quoted 93 lines
Quoted 38 lines · Kai-Heng Feng
Quoted 15 lines · Andy Shevchenko
Quoted 13 lines · Kai-Heng Feng
Quoted 11 lines · Hans de Goede
On 3/20/19 3:37 PM, Benjamin Tissoires wrote:
Benjamin, what I find interesting here is that the
BOGUS_IRQquirk is also used on Elan devices, I suspect that these Elan devices likely also need theI2C_HID_QUIRK_FORCE_TRIGGER_FALLINGquirk and then they probably will no longer need the bogus IRQ flag, if you know about bugreports with an acpidump for any of the devices needing the bogus IRQ quirk, then I (or you) can check how the IRQ is declared there, I suspect it will be declared as level-low, just like with the laptop this patch was written for. And it probably need to be edge-falling instead of level-low just like this case.Quoted 7 lines
Quoted 5 lines
First, I’ve already tried using
IRQF_TRIGGER_FALLING, unfortunately it doesn’t solve the issue for me.I talked to Elan once, and they confirm the correct IRQ trigger is level low. So forcing falling trigger may break other platforms.
As far as I understood Vladislav the quirk he got from Elan as well.
Ok, then this is really weird.
Quoted 7 lines
Quoted 3 lines
Recently we found that Elan touchpad doesn’t like
GpioInt()from its_CRS. Once theInterrupt()is used instead, the issue goes away.IIRC i2c core tries to get interrupt from
Interrupt()resource and then falls back toGpioInt().
Seei2c_acpi_get_info()andi2c_device_probe().Here’s its ASL:
Quoted 7 lines
Scope (\_SB.PCI0.I2C4) { Device (TPD0) { Name (_ADR, One) // _ADR: Address Name (_HID, "DELL08AE") // _HID: Hardware ID Name (_CID, "PNP0C50" /* HID Protocol Device (I2C bus) */) // _CID:Compatible ID
Quoted 44 lines
Name (_UID, One) // _UID: Unique ID Name (_S0W, 0x04) // _S0W: S0 Device Wake State Name (SBFB, ResourceTemplate () { I2cSerialBusV2 (0x002C, ControllerInitiated, 0x00061A80, AddressingMode7Bit, "\\_SB.PCI0.I2C4", 0x00, ResourceConsumer, , Exclusive, ) }) Name (SBFG, ResourceTemplate () { GpioInt (Level, ActiveLow, ExclusiveAndWake, PullUp, 0x0000, "\\_SB.GPO1", 0x00, ResourceConsumer, , ) { // Pin list 0x0012 } }) Name (SBFI, ResourceTemplate () { Interrupt (ResourceConsumer, Level, ActiveLow, ExclusiveAndWake, ,, ) { 0x0000003C, } }) Method (_INI, 0, NotSerialized) // _INI: Initialize { } Method (_STA, 0, NotSerialized) // _STA: Status { If ((TCPD == One)) { Return (0x0F) } Return (Zero) } Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings { If ((OSYS < 0x07DC)) { Return (SBFI) /* \_SB_.PCI0.I2C4.TPD0.SBFI */ }
Quoted 78 lines
Quoted 5 lines
Return (ConcatenateResTemplate (SBFB, SBFG)) } Method (_DSM, 4, NotSerialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("3cdff6f7-4267-4555-ad05-b30a3d8938de") /* HIDI2C Device */))
Quoted 72 lines
{ If ((Arg2 == Zero)) { If ((Arg1 == One)) { Return (Buffer (One) { 0x03 // . }) } Else { Return (Buffer (One) { 0x00 // . }) } } ElseIf ((Arg2 == One)) { Return (0x20) } Else { Return (Buffer (One) { 0x00 // . }) } } ElseIf ((Arg0 == ToUUID ("ef87eb82-f951-46da-84ec-14871ac6f84b"))) { If ((Arg2 == Zero)) { If ((Arg1 == One)) { Return (Buffer (One) { 0x03 // . }) } } If ((Arg2 == One)) { Return (ConcatenateResTemplate (SBFB, SBFG)) } Return (Buffer (One) { 0x00 // . }) } } Else { Return (Buffer (One) { 0x00 // . }) } } } }Change SBFG to SBFI in its
_CRScan workaround the issue. Is ASL in this form possible to do the flow you described?Kai-Heng
Quoted 2 lines
Quoted 2 lines
But I am not sure how to patch its DSDT/SSDT in i2c-hid.
Is this pre-production HW? If so, maybe this is a case that we should talk about custom OSI string to run the ASL differently.
The other option would be to create a new ASL method in FW and from Linux side a quirk that calls this new ASL method.
Quoted 190 lines · On Apr 2, 2019, at 5:37 AM, <[email protected]>…
Quoted 11 lines
-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Thursday, March 21, 2019 4:48 AM
To: Kai-Heng Feng; Limonciello, Mario
Cc: Hans de Goede; Benjamin Tissoires; [email protected]; Jiri Kosina; Stephen Boyd; Sebastian Andrzej Siewior; Dmitry Torokhov; open list:HID CORE LAYER; lkml
Subject: Re: [PATCH] ELAN touchpadi2c_hidbugs fixQuoted 6 lines
[EXTERNAL EMAIL]
+Cc: Mario
Mario, do you have any insights about the issue with touchpad on Dell system described below?
My apologies, this got lost while I was on vacation.
Quoted 167 lines
Quoted 38 lines · Kai-Heng Feng
Quoted 15 lines · Andy Shevchenko
Quoted 13 lines · Kai-Heng Feng
Quoted 11 lines · Hans de Goede
On 3/20/19 3:37 PM, Benjamin Tissoires wrote:
Benjamin, what I find interesting here is that the
BOGUS_IRQquirk is also used on Elan devices, I suspect that these Elan devices likely also need theI2C_HID_QUIRK_FORCE_TRIGGER_FALLINGquirk and then they probably will no longer need the bogus IRQ flag, if you know about bugreports with an acpidump for any of the devices needing the bogus IRQ quirk, then I (or you) can check how the IRQ is declared there, I suspect it will be declared as level-low, just like with the laptop this patch was written for. And it probably need to be edge-falling instead of level-low just like this case.Quoted 7 lines
Quoted 5 lines
First, I’ve already tried using
IRQF_TRIGGER_FALLING, unfortunately it doesn’t solve the issue for me.I talked to Elan once, and they confirm the correct IRQ trigger is level low. So forcing falling trigger may break other platforms.
As far as I understood Vladislav the quirk he got from Elan as well.
Ok, then this is really weird.
Quoted 7 lines
Quoted 3 lines
Recently we found that Elan touchpad doesn’t like
GpioInt()from its_CRS. Once theInterrupt()is used instead, the issue goes away.IIRC i2c core tries to get interrupt from
Interrupt()resource and then falls back toGpioInt().
Seei2c_acpi_get_info()andi2c_device_probe().Here’s its ASL:
Quoted 7 lines
Scope (\_SB.PCI0.I2C4) { Device (TPD0) { Name (_ADR, One) // _ADR: Address Name (_HID, "DELL08AE") // _HID: Hardware ID Name (_CID, "PNP0C50" /* HID Protocol Device (I2C bus) */) // _CID:Compatible ID
Quoted 41 lines
Name (_UID, One) // _UID: Unique ID Name (_S0W, 0x04) // _S0W: S0 Device Wake State Name (SBFB, ResourceTemplate () { I2cSerialBusV2 (0x002C, ControllerInitiated, 0x00061A80, AddressingMode7Bit, "\\_SB.PCI0.I2C4", 0x00, ResourceConsumer, , Exclusive, ) }) Name (SBFG, ResourceTemplate () { GpioInt (Level, ActiveLow, ExclusiveAndWake, PullUp, 0x0000, "\\_SB.GPO1", 0x00, ResourceConsumer, , ) { // Pin list 0x0012 } }) Name (SBFI, ResourceTemplate () { Interrupt (ResourceConsumer, Level, ActiveLow, ExclusiveAndWake, ,, ) { 0x0000003C, } }) Method (_INI, 0, NotSerialized) // _INI: Initialize { } Method (_STA, 0, NotSerialized) // _STA: Status { If ((TCPD == One)) { Return (0x0F) } Return (Zero) } Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings { If ((OSYS < 0x07DC)) {Quoted 8 lines
Return (SBFI) /* \_SB_.PCI0.I2C4.TPD0.SBFI */ } Return (ConcatenateResTemplate (SBFB, SBFG)) } Method (_DSM, 4, NotSerialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("3cdff6f7-4267-4555-ad05-b30a3d8938de") /* HIDI2C Device */))
Quoted 68 lines
{ If ((Arg2 == Zero)) { If ((Arg1 == One)) { Return (Buffer (One) { 0x03 // . }) } Else { Return (Buffer (One) { 0x00 // . }) } } ElseIf ((Arg2 == One)) { Return (0x20) } Else { Return (Buffer (One) { 0x00 // . }) } } ElseIf ((Arg0 == ToUUID ("ef87eb82-f951-46da-84ec-14871ac6f84b"))) { If ((Arg2 == Zero)) { If ((Arg1 == One)) { Return (Buffer (One) { 0x03 // . }) } } If ((Arg2 == One)) { Return (ConcatenateResTemplate (SBFB, SBFG)) } Return (Buffer (One) { 0x00 // . }) } } Else { Return (Buffer (One) { 0x00 // . }) } } } }Change SBFG to SBFI in its
_CRScan workaround the issue. Is ASL in this form possible to do the flow you described?
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Kai-Heng
Quoted 2 lines
Quoted 2 lines
But I am not sure how to patch its DSDT/SSDT in i2c-hid.
Is this pre-production HW? If so, maybe this is a case that we should talk about custom OSI string to run the ASL differently.
Some are already shipped.
Quoted 4 lines
The other option would be to create a new ASL method in FW and from Linux side a quirk that calls this new ASL method.
Since this patch is for ASUS Laptop, I think a more generic solution from driver layer is preferred.
Kai-Heng
Quoted 221 lines
-----Original Message-----
From: Kai Heng Feng <[email protected]>
Sent: Monday, April 1, 2019 11:18 PM
To: Limonciello, Mario
Cc: Andy Shevchenko; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH] ELAN touchpadi2c_hidbugs fix[EXTERNAL EMAIL]
Quoted 15 lines
Quoted 12 lines · On Apr 2, 2019, at 5:37 AM, <[email protected]>…
-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Thursday, March 21, 2019 4:48 AM
To: Kai-Heng Feng; Limonciello, Mario
Cc: Hans de Goede; Benjamin Tissoires; [email protected]; Jiri Kosina;
Stephen Boyd; Sebastian Andrzej Siewior; Dmitry Torokhov; open list:HID CORE
LAYER; lkml
Subject: Re: [PATCH] ELAN touchpadi2c_hidbugs fixQuoted 109 lines
Quoted 6 lines
[EXTERNAL EMAIL]
+Cc: Mario
Mario, do you have any insights about the issue with touchpad on Dell system described below?
My apologies, this got lost while I was on vacation.
Quoted 100 lines
Quoted 40 lines · Kai-Heng Feng
Quoted 15 lines · Andy Shevchenko
Quoted 13 lines · Kai-Heng Feng
Quoted 11 lines · Hans de Goede
On 3/20/19 3:37 PM, Benjamin Tissoires wrote:
Benjamin, what I find interesting here is that the
BOGUS_IRQquirk is also used on Elan devices, I suspect that these Elan devices likely also need theI2C_HID_QUIRK_FORCE_TRIGGER_FALLINGquirk and then they probably will no longer need the bogus IRQ flag, if you know about bugreports with an acpidump for any of the devices needing the bogus IRQ quirk, then I (or you) can check how the IRQ is declared there, I suspect it will be declared as level-low, just like with the laptop this patch was written for. And it probably need to be edge-falling instead of level-low just like this case.Quoted 8 lines
Quoted 6 lines
First, I’ve already tried using
IRQF_TRIGGER_FALLING, unfortunately it doesn’t solve the issue for me.I talked to Elan once, and they confirm the correct IRQ trigger is level
low. So forcing falling trigger may break other platforms.As far as I understood Vladislav the quirk he got from Elan as well.
Ok, then this is really weird.
Quoted 8 lines
Quoted 4 lines
Recently we found that Elan touchpad doesn’t like
GpioInt()from its_CRS.
Once theInterrupt()is used instead, the issue goes away.IIRC i2c core tries to get interrupt from
Interrupt()resource and then falls back toGpioInt().
Seei2c_acpi_get_info()andi2c_device_probe().Here’s its ASL:
Quoted 7 lines
Scope (\_SB.PCI0.I2C4) { Device (TPD0) { Name (_ADR, One) // _ADR: Address Name (_HID, "DELL08AE") // _HID: Hardware ID Name (_CID, "PNP0C50" /* HID Protocol Device (I2C bus) */) // _CID:Compatible ID
Quoted 49 lines
Name (_UID, One) // _UID: Unique ID Name (_S0W, 0x04) // _S0W: S0 Device Wake State Name (SBFB, ResourceTemplate () { I2cSerialBusV2 (0x002C, ControllerInitiated, 0x00061A80, AddressingMode7Bit, "\\_SB.PCI0.I2C4", 0x00, ResourceConsumer, , Exclusive, ) }) Name (SBFG, ResourceTemplate () { GpioInt (Level, ActiveLow, ExclusiveAndWake, PullUp, 0x0000, "\\_SB.GPO1", 0x00, ResourceConsumer, , ) { // Pin list 0x0012 } }) Name (SBFI, ResourceTemplate () { Interrupt (ResourceConsumer, Level, ActiveLow, ExclusiveAndWake, ,, ) { 0x0000003C, } }) Method (_INI, 0, NotSerialized) // _INI: Initialize { } Method (_STA, 0, NotSerialized) // _STA: Status { If ((TCPD == One)) { Return (0x0F) } Return (Zero) } Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings { If ((OSYS < 0x07DC)) { Return (SBFI) /* \_SB_.PCI0.I2C4.TPD0.SBFI */ } Return (ConcatenateResTemplate (SBFB, SBFG)) } Method (_DSM, 4, NotSerialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("3cdff6f7-4267-4555-ad05-b30a3d8938de") /*HID
Quoted 69 lines
Quoted 69 lines
I2C Device */))
Quoted 68 lines
{ If ((Arg2 == Zero)) { If ((Arg1 == One)) { Return (Buffer (One) { 0x03 // . }) } Else { Return (Buffer (One) { 0x00 // . }) } } ElseIf ((Arg2 == One)) { Return (0x20) } Else { Return (Buffer (One) { 0x00 // . }) } } ElseIf ((Arg0 == ToUUID ("ef87eb82-f951-46da-84ec-14871ac6f84b"))) { If ((Arg2 == Zero)) { If ((Arg1 == One)) { Return (Buffer (One) { 0x03 // . }) } } If ((Arg2 == One)) { Return (ConcatenateResTemplate (SBFB, SBFG)) } Return (Buffer (One) { 0x00 // . }) } } Else { Return (Buffer (One) { 0x00 // . }) } } } }Change SBFG to SBFI in its
_CRScan workaround the issue. Is ASL in this form possible to do the flow you described?Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Kai-Heng
Quoted 2 lines
Quoted 2 lines
But I am not sure how to patch its DSDT/SSDT in i2c-hid.
Is this pre-production HW? If so, maybe this is a case that we should talk about custom OSI string to run the ASL differently.
Some are already shipped.
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
The other option would be to create a new ASL method in FW and from Linux side a quirk that calls this new ASL method.
Since this patch is for ASUS Laptop, I think a more generic solution from driver layer is preferred.
I thought this ASL was from Dell laptop. The HID make it looks like it at least.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Name (_HID, "DELL08AE") // _HID: Hardware ID
In general more generic solution from driver layer is preferred I agree. You might need to check with ACPI guys to see if they have some ideas on situations that GpioInt fail.
Quoted 216 lines · at 22:08, <[email protected]> <[email protected]> wrote:
Quoted 216 lines
-----Original Message-----
From: Kai Heng Feng <[email protected]>
Sent: Monday, April 1, 2019 11:18 PM
To: Limonciello, Mario
Cc: Andy Shevchenko; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH] ELAN touchpadi2c_hidbugs fix[EXTERNAL EMAIL]
Quoted 15 lines
Quoted 12 lines · On Apr 2, 2019, at 5:37 AM, <[email protected]>…
-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Thursday, March 21, 2019 4:48 AM
To: Kai-Heng Feng; Limonciello, Mario
Cc: Hans de Goede; Benjamin Tissoires; [email protected]; Jiri Kosina;
Stephen Boyd; Sebastian Andrzej Siewior; Dmitry Torokhov; open list:HID CORE
LAYER; lkml
Subject: Re: [PATCH] ELAN touchpadi2c_hidbugs fixQuoted 106 lines
Quoted 6 lines
[EXTERNAL EMAIL]
+Cc: Mario
Mario, do you have any insights about the issue with touchpad on Dell system described below?
My apologies, this got lost while I was on vacation.
Quoted 97 lines
Quoted 38 lines · Kai-Heng Feng
Quoted 15 lines · Andy Shevchenko
Quoted 13 lines · Kai-Heng Feng
Quoted 11 lines · Hans de Goede
On 3/20/19 3:37 PM, Benjamin Tissoires wrote:
Benjamin, what I find interesting here is that the
BOGUS_IRQquirk is also used on Elan devices, I suspect that these Elan devices likely also need theI2C_HID_QUIRK_FORCE_TRIGGER_FALLINGquirk and then they probably will no longer need the bogus IRQ flag, if you know about bugreports with an acpidump for any of the devices needing the bogus IRQ quirk, then I (or you) can check how the IRQ is declared there, I suspect it will be declared as level-low, just like with the laptop this patch was written for. And it probably need to be edge-falling instead of level-low just like this case.Quoted 8 lines
Quoted 6 lines
First, I’ve already tried using
IRQF_TRIGGER_FALLING, unfortunately it doesn’t solve the issue for me.I talked to Elan once, and they confirm the correct IRQ trigger is level
low. So forcing falling trigger may break other platforms.As far as I understood Vladislav the quirk he got from Elan as well.
Ok, then this is really weird.
Quoted 7 lines
Quoted 3 lines
Recently we found that Elan touchpad doesn’t like
GpioInt()from its_CRS.
Once theInterrupt()is used instead, the issue goes away.IIRC i2c core tries to get interrupt from
Interrupt()resource and then falls back toGpioInt().
Seei2c_acpi_get_info()andi2c_device_probe().Here’s its ASL:
Quoted 7 lines
Scope (\_SB.PCI0.I2C4) { Device (TPD0) { Name (_ADR, One) // _ADR: Address Name (_HID, "DELL08AE") // _HID: Hardware ID Name (_CID, "PNP0C50" /* HID Protocol Device (I2C bus) */) // _CID:Compatible ID
Quoted 49 lines
Name (_UID, One) // _UID: Unique ID Name (_S0W, 0x04) // _S0W: S0 Device Wake State Name (SBFB, ResourceTemplate () { I2cSerialBusV2 (0x002C, ControllerInitiated, 0x00061A80, AddressingMode7Bit, "\\_SB.PCI0.I2C4", 0x00, ResourceConsumer, , Exclusive, ) }) Name (SBFG, ResourceTemplate () { GpioInt (Level, ActiveLow, ExclusiveAndWake, PullUp, 0x0000, "\\_SB.GPO1", 0x00, ResourceConsumer, , ) { // Pin list 0x0012 } }) Name (SBFI, ResourceTemplate () { Interrupt (ResourceConsumer, Level, ActiveLow, ExclusiveAndWake, ,, ) { 0x0000003C, } }) Method (_INI, 0, NotSerialized) // _INI: Initialize { } Method (_STA, 0, NotSerialized) // _STA: Status { If ((TCPD == One)) { Return (0x0F) } Return (Zero) } Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings { If ((OSYS < 0x07DC)) { Return (SBFI) /* \_SB_.PCI0.I2C4.TPD0.SBFI */ } Return (ConcatenateResTemplate (SBFB, SBFG)) } Method (_DSM, 4, NotSerialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("3cdff6f7-4267-4555-ad05-b30a3d8938de") /*HID
Quoted 69 lines
Quoted 69 lines
I2C Device */))
Quoted 68 lines
{ If ((Arg2 == Zero)) { If ((Arg1 == One)) { Return (Buffer (One) { 0x03 // . }) } Else { Return (Buffer (One) { 0x00 // . }) } } ElseIf ((Arg2 == One)) { Return (0x20) } Else { Return (Buffer (One) { 0x00 // . }) } } ElseIf ((Arg0 == ToUUID ("ef87eb82-f951-46da-84ec-14871ac6f84b"))) { If ((Arg2 == Zero)) { If ((Arg1 == One)) { Return (Buffer (One) { 0x03 // . }) } } If ((Arg2 == One)) { Return (ConcatenateResTemplate (SBFB, SBFG)) } Return (Buffer (One) { 0x00 // . }) } } Else { Return (Buffer (One) { 0x00 // . }) } } } }Change SBFG to SBFI in its
_CRScan workaround the issue. Is ASL in this form possible to do the flow you described?Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Kai-Heng
Quoted 1 line
Quoted 1 line
But I am not sure how to patch its DSDT/SSDT in i2c-hid.
Is this pre-production HW? If so, maybe this is a case that we should talk about custom OSI string to run the ASL differently.
Some are already shipped.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
The other option would be to create a new ASL method in FW and from Linux side a quirk that calls this new ASL method.
Since this patch is for ASUS Laptop, I think a more generic solution from driver layer is preferred.
I thought this ASL was from Dell laptop. The HID make it looks like it at least.
Yes this ASL is from a Dell system.
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Name (_HID, "DELL08AE") // _HID: Hardware IDIn general more generic solution from driver layer is preferred I agree. You might need to check with ACPI guys to see if they have some ideas on situations that GpioInt fail.
I’ve filed a bug here but we don’t find any proper solution:
https://bugzilla.kernel.org/show_bug.cgi?id=201311
Kai-Heng