From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: HoroTW <git@horotw.dev>
Cc: jikos@kernel.org, bentiss@kernel.org,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
mika.westerberg@linux.intel.com, andy@kernel.org
Subject: Re: [PATCH] HID: i2c-hid: acpi: Add Dell Latitude 7400 2-in-1 touchscreen power quirk
Date: Tue, 10 Nov 2026 19:20:00 +0200 [thread overview]
Message-ID: <avNSQJFlT96Qomkn@ashevche-desk.local> (raw)
In-Reply-To: <010201a1c63771e5-dbbba1f2-8a9f-4dbc-8901-c60927cf5a56-000000@eu-west-1.amazonses.com>
On Tue, Nov 10, 2026 at 04:08:04PM +0000, HoroTW wrote:
> On the Dell Latitude 7400 2-in-1, the Wacom touchscreen (WCOM48CA) does
> not work after resume from S3. Resume runs into I2C timeouts for 4 to 37
> seconds and then fails:
>
> [37928.985861] i2c_designware i2c_designware.0: controller timed out
> [37928.986100] i2c_hid_acpi i2c-WCOM48CA:00: failed to change power setting.
> [37928.986340] i2c_hid_acpi i2c-WCOM48CA:00: PM: dpm_run_callback(): acpi_subsys_resume returns -110
>
> The controller has a power enable on GPP_B21 and an active-low reset on
> GPP_B15.
Oh, cool! Do you have access to the schematics?
> The firmware sets both up at boot, but ACPI does not describe
> them: TPL0's _CRS only lists the I2C bus and the interrupt, and there is
> no _PS0, _PS3 or _PR0. After S3 the firmware leaves both pads low, so
> the controller stays unpowered and in reset. pinctrl-intel does not
> restore them either, as it only saves pads that the kernel has requested.
Oh, can you bring the excerpts from /sys/kernel/debug/pinctrl/*/pins file
for B21 and B15 before the suspend (working case) and after (non-working),
so we can see their configurations?
> Add a DMI quirk that provides the two GPIOs through a GPIO lookup table,
> and power_up()/power_down() callbacks that sequence them like i2c-hid-of
> does: power on, wait, release reset, wait. Holding the GPIOs from probe
> makes pinctrl-intel save and restore the pads, and power_down() drives
> them low first, so power_up() always starts from the powered-down state.
>
> As far as I can tell from the BIOS image, the firmware waits about 9 ms
> after enabling power before pulsing reset, so use 10 ms. Starting the
> first transfer less than 3 ms after releasing reset makes SET_POWER fail
> with -121, while 100 ms and 1000 ms both work; use 200 ms for some
> margin, as I could not find a datasheet value.
>
> As the touchscreen is not a wakeup source, the controller is now also
> powered down in s2idle and for hibernation.
> Tested on a Latitude 7400 2-in-1 (BIOS 1.39.1) in S3, s2idle and
> hibernation (pm_test=devices).
> AI notice: I threw an AI coding agent against it which wrote most of
> the initial patch, I reviewed everything, directed the investigation
> and ensured this is a minimal patch. The agent ran the initial tests
> (via a KVM switch), and I tested it on the device myself as well.
For now this paragraph should go after '---' line below.
> Signed-off-by: HoroTW <git@horotw.dev>
> ---
>
> Notes:
> This is my first kernel patch, so sorry in advance for anything I got
> wrong; I would be glad about any feedback.. I tried hard to match the
> required ettiquete.
>
> Background: the Latitude 7400 2-in-1 is a nice device, but it has
> issues with S3 sleep. As I did not have much time, I threw an AI coding
> agent on it and steered it in the directions that looked promising,
> until it found out what goes wrong and how it could be fixed.
> I reviewed all of the code and tried to keep the patch minimal,
> while keeping it readable and oriented me on how similar cases were
> handled before.
>
> - I looked at i2c-hid-dmi-quirks.c and tried to follow its pattern (DMI
> match, then device name), but kept the table in i2c-hid-acpi.c, as
> only this driver uses it, and did not add a bigger structure for a
> single device. My thought was that if more models need this, the
> delays could move into the DMI match data, as i2c-hid-of-elan keeps
> them per compatible. I'm happy to rework it if you would prefer it
> differently, e.g. in i2c-hid-dmi-quirks.c or drivers/platform/x86.
>
> - The GPIOs are only requested for the quirked device and with named
> con_ids, so as far as I understand, gpiolib-acpi will not fall back
> to _CRS and pick up the touchscreen's GpioInt.
>
> - I did not add checks for the return values of the GPIO writes in
> power_up(), following i2c-hid-of; i2c_hid_core_resume() ignores the
> return value of power_up() anyway.
>
> - Only the Wacom WCOM48CA panel was tested. The DSDT can also describe
> other panels in the TPL0 node; this quirk does not cover them.
>
> - Test setup: Latitude 7400 2-in-1 (SKU 08E2, board 0HCNR3, Core
> i5-8365U, touch controller 056A:48CA), BIOS 1.39.1. S3 works with the
> BIOS "Sleep Mode" set to "Force S3" as well as "OS Automatic
> Selection". Kernel v7.2.14 with i2c-hid.ko and i2c-hid-acpi.ko rebuilt
> with this patch: 7 S3 and 5 s2idle cycles, hibernation freeze/restore
> (pm_test=devices) and a driver reload. After every resume the touch
> resume callback returned 0 in about 315 ms and the controller answered
> HID GET_REPORT; finger input worked after S3. Without the patch, one
> S3 cycle reproduced the failure. The patch builds cleanly on v7.4-rc2
> with W=1 and sparse.
>
> - I was not sure whether this is suitable for stable... (I think it is?),
> so I did not add a Cc: stable tag and would leave that to you.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2026-11-10 17:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 16:08 HoroTW
2026-11-10 17:20 ` Andy Shevchenko [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=avNSQJFlT96Qomkn@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=bentiss@kernel.org \
--cc=git@horotw.dev \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/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
all inboxes | Powered by JetHome®