]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: mt9m114: Put sensor in reset on power down
authorHans de Goede <johannes.goede@oss.qualcomm.com>
Tue, 30 Dec 2025 17:03:04 +0000 (18:03 +0100)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Wed, 14 Jan 2026 22:33:04 +0000 (23:33 +0100)
Put the sensor back in reset on power down. Putting the sensor in reset
reduces power-consumption by putting all the data / ctrl pins in High-Z
mode. This helps save power on designs where the regulators may need to
stay on while the sensor is powered down.

This also ensures that the sensor is properly reset on power up,
since now the sensor will see a reset high to low transition after
the regulators have been turned on.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/i2c/mt9m114.c

index 910eefa915c7e2c24d52068ff5f855e4b774ca2b..ba7b3e9857c51db76f3881371a54a6923bbd2161 100644 (file)
@@ -2228,6 +2228,13 @@ error_regulator:
 
 static void mt9m114_power_off(struct mt9m114 *sensor)
 {
+       unsigned int duration;
+
+       gpiod_set_value(sensor->reset, 1);
+       /* Power off takes 10 clock cycles. Double it to be safe. */
+       duration = DIV_ROUND_UP(2 * 10 * 1000000, clk_get_rate(sensor->clk));
+       fsleep(duration);
+
        clk_disable_unprepare(sensor->clk);
        regulator_bulk_disable(ARRAY_SIZE(sensor->supplies), sensor->supplies);
 }