MLK-20403: max9286: add hardware reset for max9286
authorGuoniu.Zhou <guoniu.zhou@nxp.com>
Wed, 14 Nov 2018 05:53:38 +0000 (13:53 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
Add hardware reset for max9286 before initialization

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
drivers/media/platform/imx8/max9286.c

index 85fc971..1b71c65 100644 (file)
@@ -2470,6 +2470,14 @@ static void max9271_dump_registers(struct sensor_data *max9286_data, int index)
 }
 #endif
 
+static void max9286_hw_reset(struct sensor_data *max9286_data)
+{
+       gpio_set_value(max9286_data->pwn_gpio, 0);
+       udelay(200);
+       gpio_set_value(max9286_data->pwn_gpio, 1);
+       msleep(1);
+}
+
 static int max9286_hardware_preinit(struct sensor_data *max9286_data)
 {
        u8 reg;
@@ -3216,6 +3224,8 @@ static int max9286_probe(struct i2c_client *client,
        if (retval < 0)
                return retval;
 
+       max9286_hw_reset(max9286_data);
+
        clk_prepare_enable(max9286_data->sensor_clk);
 
        max9286_data->i2c_client = client;