Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chen-Yu Tsai" <wenst@chromium.org>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com,
	conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v6 3/8] HID: i2c-hid-of: skip post-power-on delay if powered on sufficiently long
Date: Tue, 01 Sep 2026 08:01:17 +0000	[thread overview]
Message-ID: <20260901080118.5C6B21F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260901074930.764550-4-wenst@chromium.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Skipping the post-power delay when regulators are already enabled removes the implicit minimum reset pulse width (T_reset), which can leave devices in an undefined hardware state.
--

commit b221f2dda3539367a70e306f0fab88390cca40e7
Author: Chen-Yu Tsai <wenst@chromium.org>

HID: i2c-hid-of: skip post-power-on delay if powered on sufficiently long

This commit replaces regulator_bulk_enable() and an unconditional sleep with
regulator_bulk_enable_and_wait(). This skips the post-power delay if the
regulators have been enabled long enough.

> diff --git a/drivers/hid/i2c-hid/i2c-hid-of.c b/drivers/hid/i2c-hid/i2c-hid-of.c
> index 59393d71ddb9d..fdaad451e7102 100644
> --- a/drivers/hid/i2c-hid/i2c-hid-of.c
> +++ b/drivers/hid/i2c-hid/i2c-hid-of.c
[ ... ]
> @@ -48,16 +49,14 @@ static int i2c_hid_of_power_up(struct i2chid_ops *ops)
>  	struct device *dev = &ihid_of->client->dev;
>  	int ret;
>  
> -	ret = regulator_bulk_enable(ARRAY_SIZE(ihid_of->supplies),
> -				    ihid_of->supplies);
> +	ret = regulator_bulk_enable_and_wait(ARRAY_SIZE(ihid_of->supplies),
> +					     ihid_of->supplies,
> +					     ihid_of->post_power_delay_ms * USEC_PER_MSEC);
>  	if (ret) {
>  		dev_warn(dev, "Failed to enable supplies: %d\n", ret);
>  		return ret;
>  	}
>  
> -	if (ihid_of->post_power_delay_ms)
> -		msleep(ihid_of->post_power_delay_ms);
> -
>  	gpiod_set_value_cansleep(ihid_of->reset_gpio, 0);

[Severity: High]
Does skipping the post-power delay when regulators are already enabled remove
the implicit minimum reset pulse width (T_reset)?

The driver unconditionally asserts the reset line initially in
i2c_hid_of_probe():

    ihid_of->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);

If a device's regulator is shared or left enabled by the bootloader,
regulator_bulk_enable_and_wait() skips the delay. This causes the reset line
to be de-asserted immediately here, creating an extremely short pulse.

Could this regression leave the HID device in an undefined hardware state and
cause it to fail to probe or become unresponsive?

>  	if (ihid_of->post_reset_delay_ms)
>  		msleep(ihid_of->post_reset_delay_ms);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260901074930.764550-1-wenst@chromium.org?part=3

  reply	other threads:[~2026-09-01  8:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  7:49 [PATCH v6 0/8] arm64: mediatek: Chromebook trackpad supply fixes Chen-Yu Tsai
2026-09-01  7:49 ` [PATCH v6 1/8] regulator: core: Add "enable and wait" functions Chen-Yu Tsai
2026-09-01  8:03   ` sashiko-bot
2026-09-01  7:49 ` [PATCH v6 2/8] Input: elan_i2c - Wait for initialization after enabling regulator supply Chen-Yu Tsai
2026-09-01  7:49 ` [PATCH v6 3/8] HID: i2c-hid-of: skip post-power-on delay if powered on sufficiently long Chen-Yu Tsai
2026-09-01  8:01   ` sashiko-bot [this message]
2026-09-01  7:49 ` [PATCH v6 4/8] i2c: of-prober: " Chen-Yu Tsai
2026-09-01  8:02   ` sashiko-bot
2026-09-01  7:49 ` [PATCH v6 5/8] i2c: of-prober: Let cleanup op know if a device was found Chen-Yu Tsai
2026-09-01  7:49 ` [PATCH v6 6/8] i2c: of-prober: Defer regulator_disable() on successful probe in simple helper Chen-Yu Tsai
2026-09-01  7:49 ` [PATCH v6 7/8] arm64: dts: mediatek: mt8173-elm-hana: Unmark trackpad supply as always-on Chen-Yu Tsai
2026-09-01  7:49 ` [PATCH v6 8/8] arm64: dts: mediatek: mt8192-asurada-spherion: Add Synaptics trackpad's supply Chen-Yu Tsai

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=20260901080118.5C6B21F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wenst@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