mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ivaylo Ilchev <iltchevi@gmail.com>
To: linux-media@vger.kernel.org, Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Hans de Goede <hansg@kernel.org>,
	linux-kernel@vger.kernel.org, Ivaylo Ilchev <ivaylo@iltchev.com>
Subject: [PATCH] media: hi556: Add support for powerdown GPIO
Date: Sun, 29 Nov 2026 11:34:33 +0000	[thread overview]
Message-ID: <20261129113433.15279-1-iltchevi@gmail.com> (raw)

From: Ivaylo Ilchev <ivaylo@iltchev.com>

On the Lenovo IdeaPad Duet 3 11IAN8 the INT3472 discrete power
controller for the Hi-556 sensor describes a powerdown GPIO (type 0x01)
in addition to the reset GPIO. The int3472 driver maps it to the
"powerdown" con_id, but the hi556 driver never requests it, so the line
stays asserted. The sensor then does not respond on I2C and probe fails:

  hi556 i2c-INT3537:00: failed to find sensor: -5

Request the optional powerdown GPIO, deassert it on power-up before
releasing reset and assert it again on power-down.

Tested on a Lenovo IdeaPad Duet 3 11IAN8 (82XK): with this change the
sensor is detected (chip ID 0x0556) and streams through libcamera.

Signed-off-by: Ivaylo Ilchev <ivaylo@iltchev.com>
---
 drivers/media/i2c/hi556.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/media/i2c/hi556.c b/drivers/media/i2c/hi556.c
index 8750786..e4353ab 100644
--- a/drivers/media/i2c/hi556.c
+++ b/drivers/media/i2c/hi556.c
@@ -647,6 +647,7 @@ struct hi556 {
 
 	/* GPIOs, clocks, etc. */
 	struct gpio_desc *reset_gpio;
+	struct gpio_desc *powerdown_gpio;
 	struct clk *clk;
 	struct regulator_bulk_data supplies[ARRAY_SIZE(hi556_supply_names)];
 
@@ -1284,6 +1285,7 @@ static int hi556_suspend(struct device *dev)
 	struct hi556 *hi556 = to_hi556(sd);
 
 	gpiod_set_value_cansleep(hi556->reset_gpio, 1);
+	gpiod_set_value_cansleep(hi556->powerdown_gpio, 1);
 	regulator_bulk_disable(ARRAY_SIZE(hi556_supply_names),
 			       hi556->supplies);
 	clk_disable_unprepare(hi556->clk);
@@ -1308,6 +1310,11 @@ static int hi556_resume(struct device *dev)
 		return ret;
 	}
 
+	if (hi556->powerdown_gpio) {
+		gpiod_set_value_cansleep(hi556->powerdown_gpio, 0);
+		usleep_range(2000, 2200);
+	}
+
 	if (hi556->reset_gpio) {
 		/* Assert reset for at least 2ms on back to back off-on */
 		usleep_range(2000, 2200);
@@ -1343,6 +1350,12 @@ static int hi556_probe(struct i2c_client *client)
 		return dev_err_probe(hi556->dev, PTR_ERR(hi556->reset_gpio),
 				     "failed to get reset GPIO\n");
 
+	hi556->powerdown_gpio = devm_gpiod_get_optional(hi556->dev, "powerdown",
+							GPIOD_OUT_HIGH);
+	if (IS_ERR(hi556->powerdown_gpio))
+		return dev_err_probe(hi556->dev, PTR_ERR(hi556->powerdown_gpio),
+				     "failed to get powerdown GPIO\n");
+
 	hi556->clk = devm_v4l2_sensor_clk_get(hi556->dev, "clk");
 	if (IS_ERR(hi556->clk))
 		return dev_err_probe(hi556->dev, PTR_ERR(hi556->clk),
-- 
2.53.0


                 reply	other threads:[~2026-11-29 11:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261129113433.15279-1-iltchevi@gmail.com \
    --to=iltchevi@gmail.com \
    --cc=hansg@kernel.org \
    --cc=ivaylo@iltchev.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@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®