mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: hi556: Add support for powerdown GPIO
@ 2026-11-29 11:34 Ivaylo Ilchev
  0 siblings, 0 replies; only message in thread
From: Ivaylo Ilchev @ 2026-11-29 11:34 UTC (permalink / raw)
  To: linux-media, Sakari Ailus; +Cc: Hans de Goede, linux-kernel, Ivaylo Ilchev

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-29 11:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-29 11:34 [PATCH] media: hi556: Add support for powerdown GPIO Ivaylo Ilchev

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®