summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandor Yu <Sandor.yu@nxp.com>2018-01-04 17:19:51 +0800
committerSandor Yu <Sandor.yu@nxp.com>2018-01-08 17:30:35 +0800
commit1d1f404e219c3335ff0e0dd23e8a5885c9166a81 (patch)
treeff8e62d6c30fac3280d4c4c2fd1a6bbb587714f7
parent225e34c5422db1612e50446afb93deb51308e2ba (diff)
MLK-17341-1: max9286: Add power up pin setting
Add power up pin setting for max9286 driver. Acked-by: Fugang Duan <fugang.duan@nxp.com> Signed-off-by: Sandor Yu <Sandor.yu@nxp.com> (cherry picked from commit 3e1fee31a6fc31783c1ab68db1e1aed5ef3db994)
-rw-r--r--drivers/media/platform/imx8/max9286.c13
-rw-r--r--drivers/media/platform/imx8/max9286.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/drivers/media/platform/imx8/max9286.c b/drivers/media/platform/imx8/max9286.c
index d3b83fcf423a..73841a8ce8eb 100644
--- a/drivers/media/platform/imx8/max9286.c
+++ b/drivers/media/platform/imx8/max9286.c
@@ -2821,6 +2821,17 @@ static int max9286_probe(struct i2c_client *client,
return retval;
}
+ /* request power down pin */
+ max9286_data->pwn_gpio = of_get_named_gpio(dev->of_node, "pwn-gpios", 0);
+ if (!gpio_is_valid(max9286_data->pwn_gpio)) {
+ dev_err(dev, "no sensor pwdn pin available\n");
+ return -ENODEV;
+ }
+ retval = devm_gpio_request_one(dev, max9286_data->pwn_gpio, GPIOF_OUT_INIT_HIGH,
+ "max9286_pwd");
+ if (retval < 0)
+ return retval;
+
clk_prepare_enable(max9286_data->sensor_clk);
max9286_data->i2c_client = client;
@@ -2844,6 +2855,7 @@ static int max9286_probe(struct i2c_client *client,
if (retval != 0x40) {
pr_warning("max9286 is not found, chip id reg 0x1e = 0x%x.\n", retval);
clk_disable_unprepare(max9286_data->sensor_clk);
+ devm_gpio_free(dev, max9286_data->pwn_gpio);
return -ENODEV;
}
@@ -2852,6 +2864,7 @@ static int max9286_probe(struct i2c_client *client,
if (max9286_data->sensor_num == 0) {
pr_warning("cameras are not found,\n");
clk_disable_unprepare(max9286_data->sensor_clk);
+ devm_gpio_free(dev, max9286_data->pwn_gpio);
return -ENODEV;
}
diff --git a/drivers/media/platform/imx8/max9286.h b/drivers/media/platform/imx8/max9286.h
index bf4bf98ad5fd..8688b869e45a 100644
--- a/drivers/media/platform/imx8/max9286.h
+++ b/drivers/media/platform/imx8/max9286.h
@@ -84,5 +84,6 @@ struct sensor_data {
unsigned int sensor_num; /* sensor num connect max9271 */
unsigned char sensor_is_there; /* Bit 0~3 for 4 cameras, 0b1= is there; 0b0 = is not there */
+ int pwn_gpio;
};
#endif