summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>2025-12-30 09:34:36 +0100
committerHans Verkuil <hverkuil+cisco@kernel.org>2026-01-16 14:08:52 +0100
commit5152437f7610eb522fd233ab548a19d4601cbc2a (patch)
tree23cc440773006ed1982c4b678ab062d3068f0427
parent2f130245f2143fa8f4da77071f844911d2c69319 (diff)
downloadlinux-5152437f7610eb522fd233ab548a19d4601cbc2a.tar.gz
linux-5152437f7610eb522fd233ab548a19d4601cbc2a.zip
media: i2c: Add note to prevent buggy code re-use
adv7604 and et8ek8 sensor drivers have mixed up logical and line level for reset/powerdown signal. They call it a reset signal (it indeed behaves like that), but drivers assert the reset to operate which is clearly incorrect and relies on wrong ACTIVE_HIGH flag in the DTS. People in discussions copy existing poor code and claim they can repeat same mistake, so add a note to prevent that. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
-rw-r--r--drivers/media/i2c/adv7604.c8
-rw-r--r--drivers/media/i2c/et8ek8/et8ek8_driver.c4
2 files changed, 11 insertions, 1 deletions
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 516553fb17e9..67116a4ef134 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3453,7 +3453,13 @@ static int configure_regmaps(struct adv76xx_state *state)
static void adv76xx_reset(struct adv76xx_state *state)
{
if (state->reset_gpio) {
- /* ADV76XX can be reset by a low reset pulse of minimum 5 ms. */
+ /*
+ * Note: Misinterpretation of reset assertion - do not re-use
+ * this code. The reset pin is using incorrect (for a reset
+ * signal) logical level.
+ *
+ * ADV76XX can be reset by a low reset pulse of minimum 5 ms.
+ */
gpiod_set_value_cansleep(state->reset_gpio, 0);
usleep_range(5000, 10000);
gpiod_set_value_cansleep(state->reset_gpio, 1);
diff --git a/drivers/media/i2c/et8ek8/et8ek8_driver.c b/drivers/media/i2c/et8ek8/et8ek8_driver.c
index 2cb7b718782b..50121c3e5b48 100644
--- a/drivers/media/i2c/et8ek8/et8ek8_driver.c
+++ b/drivers/media/i2c/et8ek8/et8ek8_driver.c
@@ -835,6 +835,10 @@ static int et8ek8_power_on(struct et8ek8_sensor *sensor)
udelay(10); /* I wish this is a good value */
+ /*
+ * Note: Misinterpretation of reset assertion - do not re-use this code.
+ * The reset pin is using incorrect (for a reset signal) logical level.
+ */
gpiod_set_value(sensor->reset, 1);
msleep(5000 * 1000 / sensor->xclk_freq + 1); /* Wait 5000 cycles */