Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Justin Yeh <justin.yeh@mediatek.com>
To: Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <bentiss@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Douglas Anderson <dianders@chromium.org>,
	Maxime Ripard <mripard@kernel.org>
Cc: <Project_Global_Chrome_Upstream_Group@mediatek.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-input@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>,
	Justin Yeh <justin.yeh@mediatek.com>
Subject: [PATCH] HID: i2c-hid: Skip SET_POWER on shutdown for panel followers
Date: Fri, 4 Sep 2026 11:50:02 +0800	[thread overview]
Message-ID: <20260904035009.4114363-1-justin.yeh@mediatek.com> (raw)

When an i2c-hid device is a panel follower, drm_atomic_helper_shutdown()
unprepares the panel before device_shutdown() gets around to the i2c
client. The panel_unpreparing() callback already calls
i2c_hid_core_suspend() with force_poweroff set, which sends
SET_POWER(SLEEP) and then drops the device's regulators.

So by the time i2c_hid_core_shutdown() runs, the controller is unpowered
and can no longer complete a transfer. On MT8196 the SET_POWER(SLEEP)
issued there burns the full i2c-mt65xx bus timeout before failing,
adding two seconds to every reboot.

Skip the redundant SET_POWER for panel followers, matching how
i2c_hid_core_pm_suspend() and friends already bail out for them.
free_irq() and the shutdown_tail() hook are unaffected.

Fixes: 96a37bfd232a ("HID: i2c-hid: Support being a panel follower")
Signed-off-by: Justin Yeh <justin.yeh@mediatek.com>
---
 drivers/hid/i2c-hid/i2c-hid-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
index 0ff07fdab442..2e787c17256d 100644
--- a/drivers/hid/i2c-hid/i2c-hid-core.c
+++ b/drivers/hid/i2c-hid/i2c-hid-core.c
@@ -1355,7 +1355,9 @@ void i2c_hid_core_shutdown(struct i2c_client *client)
 {
 	struct i2c_hid *ihid = i2c_get_clientdata(client);
 
-	i2c_hid_set_power(ihid, I2C_HID_PWR_SLEEP);
+	if (!ihid->is_panel_follower)
+		i2c_hid_set_power(ihid, I2C_HID_PWR_SLEEP);
+
 	free_irq(client->irq, ihid);
 
 	i2c_hid_core_shutdown_tail(ihid);
-- 
2.45.2



             reply	other threads:[~2026-09-04  3:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04  3:50 Justin Yeh [this message]
2026-09-04 15:05 ` [PATCH] HID: i2c-hid: Skip SET_POWER on shutdown for panel followers Doug Anderson

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=20260904035009.4114363-1-justin.yeh@mediatek.com \
    --to=justin.yeh@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bentiss@kernel.org \
    --cc=dianders@chromium.org \
    --cc=jikos@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mripard@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