linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input <linux-input@vger.kernel.org>,
	Manyi Li <limanyi@uniontech.com>
Subject: Re: Detecting if a laptop is using a i2c/smbus or a ps/2 attached touchpad?
Date: Mon, 7 Nov 2022 13:21:02 +0100	[thread overview]
Message-ID: <a804b4e1-4a17-96f8-671b-4da0dad149b1@redhat.com> (raw)
In-Reply-To: <CAO-hwJJUdXb1iBN7AVushaJz9LawuaO5hP8GWKucWuxzDpnCTg@mail.gmail.com>

Hi,

On 11/7/22 11:52, Benjamin Tissoires wrote:
> Hi Hans,
> 
> On Mon, Nov 7, 2022 at 11:10 AM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> Hi Benjamin, et. al.,
>>
>> I have just merged a patch which adds a couple of DMI quirks to disable
>> the touchpad on/off functionality of the ideapad-laptop module on some models,
>> because it is causing issues there.
>>
>> Patch:      https://lore.kernel.org/platform-driver-x86/20221018095323.14591-1-limanyi@uniontech.com/
>> Discussion: https://lore.kernel.org/platform-driver-x86/fdceb6d2-c38c-e8ff-4c19-b01521ca46c0@redhat.com/
>>
>> Rather then using DMI quirks I would prefer to just disable it everywhere
>> where a i2c-attached touchpad is used. Be it either one only attached to
>> i2c, or one of the synaptics intertouch thingies. I'm still trying to
>> figure out why the ideapad-laptop module's touchpad control (which
>> uses the EC + enabling/disabling the i8042 aux-port) matters for
>> i2c-attached touchpads at all, so I suspect that intertouch might be
>> a part of it.
>>
>> So now I'm wondering if there is some nice way for the ideapad-laptop
>> code to check if the touchpad is intertouch and/or if it is i2c-attached
>> only ...
>>
>> Any ideas?
> 
> TL;DR: it's a complete mess.
> 
> For mostly UEFI/BIOS compatibility, all touchpads on modern laptops
> have a PS/2 interface.
> 
> But then, most of the touchpads (and of course not all) can also use
> I2C or SMBus to communicate.
> 
> And this is where things are bad:
> 
> - when using i2c-hid, there is a DT entry that enumerates the
> touchpad, but sometimes the manufacturers like to reuse the same DT
> and just enable/disable devices in it, so it's not easy to do.
> In the i2c-hid case, the PS/2 node has no idea it is not used anymore,
> and thus is kept up forever
> 
> - for touchpads using SMBus (on Intel platforms only currently), the
> enumeration is done at the PS/2 level: there is a byte that says that
> the touchpad supports another bus or not.
> This is valid for both Synaptics, and Elan, as you figured out.
> 
> But in the SMBus case there are many cases where it is not working: if
> the SMBus doesn't support Host Notify (AMD platforms), or if the
> enumeration is not working because the touchpad is not happy, etc...
> 
> So again, in SMBus, we can not disable the PS/2 nodes, because there
> is a high chance the touchpad will not work. Not to mention that the
> specific bit to enable the touchpad might also be required when coming
> back from suspend (not entirely sure though).
> 
> However, in the Synaptics SMbus case, we took a safer approach
> (because the SMBus driver is not standard and sometimes breaks on new
> hardware), so we are using the PnP ID to selectively enable the
> devices (see smbus_pnp_ids[] in drivers/input/mouse/synaptics.c)
> 
> In the Elan case, if the touchpad exports the magic bit, we forward it
> to SMBus as the driver is behaving better with new devices.
> 
> As a result, from user space, it's easier to know if the device uses
> smbus/i2c, simply because you can enumerate all devices.
> But from the kernel, either you have to look for the ACPI tables, and
> hope that the I2C bus is correctly supported in the system, or you
> have to talk over PS/2 and hope that the platform supports
> HostNotify...
> 
>>
>> Regards,
>>
>> Hans
>>
>> p.s.
>>
>> Is it possible that Elan touchpads use something similar to intertouch,
>> or is that a synaptics thing only (under Linux)  ?
>>
> 
> Yep, see above. If the touchpad says it can be driven through SMBus,
> we forward it.

Ok, thank you for the long answer.

I will try to find some generic solution on the ideapad-laptop driver
side. First of all we need to root cause which call in that driver
is exactly causing the touchpad to not work.

Regards,

hans


      reply	other threads:[~2022-11-07 12:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 10:10 Detecting if a laptop is using a i2c/smbus or a ps/2 attached touchpad? Hans de Goede
2022-11-07 10:52 ` Benjamin Tissoires
2022-11-07 12:21   ` Hans de Goede [this message]

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=a804b4e1-4a17-96f8-671b-4da0dad149b1@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=limanyi@uniontech.com \
    --cc=linux-input@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).