[v4,3/3] media: i2c: imx412: Fix power_off ordering

Message ID 20220414141108.1365476-4-bryan.odonoghue@linaro.org (mailing list archive)
State Superseded
Headers
Series media: i2c: imx412: Add regulator control to imx412 |

Commit Message

Bryan O'Donoghue April 14, 2022, 2:11 p.m. UTC
  The enable path does
- regulator
- gpio
- clock

The disable path does
- gpio
- clock
- regulator

Fix the order on the power-off path so that power-off and power-on have the
same ordering for regulator, clock and gpio.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/media/i2c/imx412.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/media/i2c/imx412.c b/drivers/media/i2c/imx412.c
index 6d0746d6c634..a9cdf4694d58 100644
--- a/drivers/media/i2c/imx412.c
+++ b/drivers/media/i2c/imx412.c
@@ -1066,10 +1066,10 @@  static int imx412_power_off(struct device *dev)
 	struct v4l2_subdev *sd = dev_get_drvdata(dev);
 	struct imx412 *imx412 = to_imx412(sd);
 
-	gpiod_set_value_cansleep(imx412->reset_gpio, 0);
-
 	clk_disable_unprepare(imx412->inclk);
 
+	gpiod_set_value_cansleep(imx412->reset_gpio, 0);
+
 	regulator_bulk_disable(imx412->num_supplies, imx412->supplies);
 
 	return 0;