From: Benjamin Tissoires <bentiss@kernel.org>
To: Hans de Goede <hansg@kernel.org>
Cc: "谢致邦 (XIE Zhibang)" <Yeking@red54.com>,
linux-input@vger.kernel.org, dmitry.torokhov@gmail.com,
dianders@chromium.org, jikos@kernel.org,
linux-kernel@vger.kernel.org, superm1@kernel.org,
"Pin-yen Lin" <treapking@chromium.org>,
"Xu Rao" <raoxu@uniontech.com>,
"Kwok Kin Ming" <kenkinming2002@gmail.com>,
"Dan Carpenter" <error27@gmail.com>
Subject: Re: [PATCH v2 2/3] HID: i2c-hid: Move common ACPI _DSM helper into core
Date: Wed, 3 Jun 2026 15:30:11 +0200 [thread overview]
Message-ID: <aiApE2WoVitHetQv@beelink> (raw)
In-Reply-To: <45b88710-7c67-414d-8ebc-2abafa80a760@kernel.org>
On Jun 03 2026, Hans de Goede wrote:
> Hi,
>
> On 3-Jun-26 1:59 PM, Benjamin Tissoires wrote:
> > On Jun 03 2026, Hans de Goede wrote:
> >> Hi Benjamin,
> >>
> >> On 3-Jun-26 11:43 AM, Benjamin Tissoires wrote:
> >>> On Jun 01 2026, 谢致邦 (XIE Zhibang) wrote:
> >>>> Move the _DSM call that gets the HID descriptor address from
> >>>> i2c-hid-acpi.c to a shared helper in i2c-hid-core.c so both
> >>>> i2c-hid-acpi.c and i2c-hid-of.c can use it.
> >>>>
> >>>> Signed-off-by: 谢致邦 (XIE Zhibang) <Yeking@Red54.com>
> >>>> ---
> >>>> drivers/hid/i2c-hid/i2c-hid-acpi.c | 32 ++++-----------------------
> >>>> drivers/hid/i2c-hid/i2c-hid-core.c | 35 ++++++++++++++++++++++++++++++
> >>>
> >>> I'm not a big fan of removing 25% of the i2c-hid-acpi.c code and inject
> >>> it in i2c-hid-core.c.
> >>
> >> It is only 35 new lines in i2c-hid-core.c, so it is not that big / much code.
> >
> > My concern is not so much about these 35 lines of code, but the fact
> > that i2c-hid-acpi.c is now down to only 3 functions:
> > - i2c_hid_acpi_probe()
> > - i2c_hid_acpi_shutdown_tail()
> > - i2c_hid_acpi_restore_sequence()
> >
> > So then, what's the point of keeping it as a separate driver? (more
> > rethorical question than anything).
> >
> >>
> >>> There's something I can't really understand in the problem:
> >>> - we are talking about non arm architecture, which should not have OF in
> >>> them
> >>> - the current compatible hid-over-i2c loads the OF version?
> >>> - how can you make the device working without the couple of ACPI
> >>> functions that are in the i2c-hid-acpi.c driver for powering up and
> >>> down the device?
> >>>
> >>> If the platform is indeed ACPI + x86(_64), then shouldn't we tackle the
> >>> problem in the i2c-hid-acpi driver, or add a secondary leaf driver for
> >>> this particular platform/device? Kind of what we have with
> >>> i2c-hid-of-elan.c
> >>
> >> As part of the work to use ACPI on ARM systems, it is possible now a days
> >> to inject DT snippets into ACPI tables.
> >>
> >> The problem on these Loongson laptops is that they have created this
> >> very ugly mixed-mode where they put a PRP0001 ACPI HID on the ACPI
> >> node for the touchscreen, which means it contains an embedded DT
> >> snippet and in that snipped out "compatible=hid-over-i2c" but NOT
> >> also "i2c-hid-descr-addr=x". To get the i2c-hid descriptor address
> >> the implemented the ACPI _DSM on the same ACPI device/fwnode.
> >>
> >> The ACPI core sees HID=PRP0001 so it creates an of-compatible
> >> modalias / match and not an ACPI one, so the i2c-hid-of driver will
> >> bind.
> >
> > But if this fix is for just one platform, why not keeping the design
> > clean and have a dmi_match instead in a separate driver, like the
> > i2c-hid-of-elan does for Elan touchpads/touchscreens?
> > i2c-hid-acpi-loongson.c for instance.
>
> Ok, so let me see if I've got this right:
>
> 1. We create a i2c-hid-acpi-loongson.c with a DMI
> MODULE_DEVICE_TABLE() for auto-module-loading
Yes
>
> 2. This will have a struct of_device_id table with
> the "hid-over-i2c" compatible. But *no* / without a
> MODULE_DEVICE_TABLE() for this so that it will not
> autoload on regular DT platforms with regular
> "hid-over-i2c" compatible touchscreens.
Yes
>
> 3. We will rely on i2c-hid-of.c error-ing out
> due to the missing "hid-descr-addr" and we are ok
> with the dev_err() this logs.
Yes, if we want the big fat warning that Dmitry was mentioning.
Otherwise we could also have a deny list table, but that's more work :)
>
> 4. The new i2c-hid-acpi-loongson.c will in essence
> be a copy of i2c-hid-acpi.c without the acpi_match
> and with the DMI id + of match as described above.
Sort of, yeah
>
> Yes I think that should work, do you want to just copy
> i2c_hid_acpi_get_descriptor() or do you want
> i2c-hid-acpi to export this and have i2c-hid-acpi-longsoon
> depend on i2c-hid-acpi for this ?
Export i2c_hid_acpi_get_descriptor() from i2c-hid-acpi and have
i2c-hid-acpi-longsoon depend on it.
Also, this would have the good side effect of being able to set the post
power and post reset delays based on the DMI. Kind of like a compatible
driver in the DT world.
>
> >> Note these "fixed" (as in we cannot fix them) ACPI tables use
> >> the generic i2c-over-hid OF/DT compatible _not_ something
> >> more specific so we can also not do a more specific driver like
> >> i2c-hid-of-elan.c.
> >
> > Do they use anything else than the compatible DT entry? regulators and
> > others? If not, then the device is pure ACPI, and should not be handled
> > by i2c-hid-of.c at all, no?
>
> No they don't use anything other then the compatible. This is
> really just a very bad / messy decision by whomever created
> the ACPI tables for these 2 laptops. But they are out there, so
> we somehow have to deal with them.
Yeah, so I think we better have this special driver for the Loongson
platform, and have device crap handled in this place without polluting
the rest.
Cheers,
Benjamin
>
> <snip>
>
> > so far :)
>
> True, see above.
>
> Regards,
>
> Hans
>
>
>
>
next prev parent reply other threads:[~2026-06-03 13:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 15:17 [PATCH] HID: i2c-hid-acpi: Add PRP0001 to match table and OF alias 谢致邦 (XIE Zhibang)
2026-05-27 15:44 ` Hans de Goede
2026-05-29 12:16 ` [PATCH] HID: i2c-hid-of: Fall back to ACPI _DSM when hid-descr-addr is missing 谢致邦 (XIE Zhibang)
2026-05-29 15:00 ` Hans de Goede
2026-05-29 19:36 ` Dmitry Torokhov
2026-06-01 17:37 ` [PATCH 0/3] HID: i2c-hid: Fix some PRP0001 touchpads probe after OF/ACPI split 谢致邦 (XIE Zhibang)
[not found] ` <20260601173722.38151-1-Yeking@Red54.com>
2026-06-01 17:37 ` [PATCH 1/3] HID: i2c-hid-acpi: Move blacklist check to probe() before devm_kzalloc() 谢致邦 (XIE Zhibang)
2026-06-01 17:37 ` [PATCH 2/3] HID: i2c-hid: Move common ACPI _DSM helper into core 谢致邦 (XIE Zhibang)
2026-06-01 17:37 ` [PATCH 3/3] HID: i2c-hid-of: Fall back to ACPI _DSM when hid-descr-addr is missing 谢致邦 (XIE Zhibang)
2026-06-01 18:15 ` [PATCH v2 0/3] HID: i2c-hid: Fix some PRP0001 touchpads probe after OF/ACPI split 谢致邦 (XIE Zhibang)
[not found] ` <20260601181510.38705-1-Yeking@Red54.com>
2026-06-01 18:15 ` [PATCH v2 1/3] HID: i2c-hid-acpi: Move blacklist check to probe() before devm_kzalloc() 谢致邦 (XIE Zhibang)
2026-06-01 18:15 ` [PATCH v2 2/3] HID: i2c-hid: Move common ACPI _DSM helper into core 谢致邦 (XIE Zhibang)
2026-06-03 9:43 ` Benjamin Tissoires
2026-06-03 10:25 ` Hans de Goede
2026-06-03 11:59 ` Benjamin Tissoires
2026-06-03 13:12 ` Hans de Goede
2026-06-03 13:30 ` Benjamin Tissoires [this message]
2026-06-01 18:15 ` [PATCH v2 3/3] HID: i2c-hid-of: Fall back to ACPI _DSM when hid-descr-addr is missing 谢致邦 (XIE Zhibang)
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=aiApE2WoVitHetQv@beelink \
--to=bentiss@kernel.org \
--cc=Yeking@red54.com \
--cc=dianders@chromium.org \
--cc=dmitry.torokhov@gmail.com \
--cc=error27@gmail.com \
--cc=hansg@kernel.org \
--cc=jikos@kernel.org \
--cc=kenkinming2002@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=raoxu@uniontech.com \
--cc=superm1@kernel.org \
--cc=treapking@chromium.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