All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: Takashi Iwai <tiwai@suse.de>, Hans De Goede <hdegoede@redhat.com>,
	"open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: Wrongly bound Elantech touchpad on Lenovo Yoga Slim 7
Date: Fri, 4 Feb 2022 13:02:32 -0800	[thread overview]
Message-ID: <Yf2UaMp8ttjrBjU0@google.com> (raw)
In-Reply-To: <CAO-hwJK-7migm7VWkwvTPHwxgTZEbNX0XYpk0A1pr6N2jkYrxw@mail.gmail.com>

Hi Benjamin,

On Fri, Feb 04, 2022 at 06:39:40PM +0100, Benjamin Tissoires wrote:
> Hi,
> 
> [adding Dmitry, the maintainer of the input tree and Hans, a colleague of mine]
> 
> On Fri, Feb 4, 2022 at 5:57 PM Takashi Iwai <tiwai@suse.de> wrote:
> >
> > Hi,
> >
> > we've got a bug report on openSUSE Bugzilla about the broken touchpad
> > on Lenovo Yoga Slim 7:
> >   https://bugzilla.opensuse.org/show_bug.cgi?id=1193064
> >
> > The touchpad is an Elantech one, connected over i2c, and there are two
> > drivers supporting it.  Unfortunately, the default one the system
> > binds, elan-i2c input driver, doesn't seem working properly, while
> > i2c-hid driver works.
> 
> Hans, we do have a similar bug on RHEL at
> https://bugzilla.redhat.com/show_bug.cgi?id=2029078 (sorry, private
> bug).
> 
> IIRC you worked on the discrimination between i2c-hid and elan_i2c (I
> might be completely wrong though).
> Would this patch be OK with you?

I would prefer avoid DMI if possible.

I believe we need to do what Hans did for Elan Touch*screen* driver and
avoid binding to the device if it has i2c-hid-specific _DMS in ACPI.
I.e. we need to replicate elants_acpi_is_hid_device().

Even better would be to factor it out, maybe not into a shared module
but simply shared header with static inline function that we could share
between elan drivers and maybe others as well.

Thanks.

> 
> Cheers,
> Benjamin
> 
> >
> > I'm not sure what's the best fix for this, but below a quick
> > workaround using a deny list with DMI matching.
> > If this is OK, I can resubmit the patch for merging.
> >
> > Any comments appreciated.
> >
> >
> > thanks,
> >
> > Takashi
> >
> > -- 8< --
> > From: Takashi Iwai <tiwai@suse.de>
> > Subject: [PATCH] Input: elan_i2c: Add deny list for Lenovo Yoga Slim 7
> >
> > The touchpad on Lenovo Yoga Slim 7 doesn't work well with elan-i2c but
> > rather better with i2c-hid.  Add a deny list for avoiding to bind with
> > elan-i2c.
> >
> > BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1193064
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > ---
> >  drivers/input/mouse/elan_i2c_core.c | 19 +++++++++++++++++++
> >  1 file changed, 19 insertions(+)
> >
> > diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
> > index 47af62c12267..fd08481f7aea 100644
> > --- a/drivers/input/mouse/elan_i2c_core.c
> > +++ b/drivers/input/mouse/elan_i2c_core.c
> > @@ -18,6 +18,7 @@
> >  #include <linux/acpi.h>
> >  #include <linux/delay.h>
> >  #include <linux/device.h>
> > +#include <linux/dmi.h>
> >  #include <linux/firmware.h>
> >  #include <linux/i2c.h>
> >  #include <linux/init.h>
> > @@ -1222,6 +1223,20 @@ static void elan_disable_regulator(void *_data)
> >         regulator_disable(data->vcc);
> >  }
> >
> > +static const struct dmi_system_id elan_i2c_denylist[] __initconst = {
> > +#if IS_ENABLED(CONFIG_I2C_HID_ACPI)
> > +       {
> > +               /* Lenovo Yoga Slim 7 is better supported by i2c-hid */
> > +               .matches = {
> > +                       DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
> > +                       DMI_MATCH(DMI_PRODUCT_NAME, "82A3"),
> > +                       DMI_MATCH(DMI_PRODUCT_VERSION, "Yoga Slim 7 14ITL05"),
> > +               },
> > +       },
> > +#endif
> > +       { }
> > +};
> > +
> >  static int elan_probe(struct i2c_client *client,
> >                       const struct i2c_device_id *dev_id)
> >  {
> > @@ -1233,6 +1248,10 @@ static int elan_probe(struct i2c_client *client,
> >
> >         if (IS_ENABLED(CONFIG_MOUSE_ELAN_I2C_I2C) &&
> >             i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
> > +               if (dmi_check_system(elan_i2c_denylist)) {
> > +                       dev_info(dev, "Hits deny list, skipping\n");
> > +                       return -ENODEV;
> > +               }
> >                 transport_ops = &elan_i2c_ops;
> >         } else if (IS_ENABLED(CONFIG_MOUSE_ELAN_I2C_SMBUS) &&
> >                    i2c_check_functionality(client->adapter,
> > --
> > 2.31.1
> >
> >
> >
> >
> >
> >
> >
> 

-- 
Dmitry

  reply	other threads:[~2022-02-04 21:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-04 16:57 Wrongly bound Elantech touchpad on Lenovo Yoga Slim 7 Takashi Iwai
2022-02-04 17:39 ` Benjamin Tissoires
2022-02-04 21:02   ` Dmitry Torokhov [this message]
2022-02-05 11:12   ` Hans de Goede
2022-02-04 23:04 ` kernel test robot
2022-02-04 23:04   ` kernel test robot
2022-02-07  7:49 ` kernel test robot
2022-02-07  7:49   ` kernel test robot

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=Yf2UaMp8ttjrBjU0@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.