From 4d365cf1bdf2c5ceeea6ea3d39cdb87ff3c2b416 Mon Sep 17 00:00:00 2001 From: wangdw10 Date: Mon, 28 Jan 2019 21:38:48 +0800 Subject: [PATCH] [COMMON] fimc-is2: cis: update sensor_module_5e9_power_setpin_0 for troika Change-Id: Ie47b1430bbc25c7e6b314b1f505f86c3fdbb25a5 Signed-off-by: wangdw10 --- .../modules/fimc-is-device-module-5e9.c | 77 ++++++++++++++++--- 1 file changed, 65 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/modules/fimc-is-device-module-5e9.c b/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/modules/fimc-is-device-module-5e9.c index 59d47fef1783..4255057f639d 100644 --- a/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/modules/fimc-is-device-module-5e9.c +++ b/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/modules/fimc-is-device-module-5e9.c @@ -81,7 +81,8 @@ static int sensor_module_5e9_power_setpin_0(struct device *dev, struct device_node *dnode; int gpio_reset = 0; int gpio_none = 0; - int gpio_cam_ldo_en = 0; + int gpio_avdd_en = 0; + int gpio_iovdd_en = 0; struct fimc_is_core *core; FIMC_BUG(!dev); @@ -104,34 +105,86 @@ static int sensor_module_5e9_power_setpin_0(struct device *dev, gpio_free(gpio_reset); } - gpio_cam_ldo_en = of_get_named_gpio(dnode, "gpio_cam_ldo_en", 0); - if (!gpio_is_valid(gpio_cam_ldo_en)) { - dev_err(dev, "failed to get PIN_POWER_EN\n"); + gpio_avdd_en = of_get_named_gpio(dnode, "gpio_avdd_en", 0); + if (gpio_is_valid(gpio_avdd_en)) { + if (gpio_request_one(gpio_avdd_en, GPIOF_OUT_INIT_LOW, "CAM_AVDD_EN_LOW")) { + dev_err(dev, "%s: failed to gpio request avdd_en\n", __func__); + return -ENODEV; + } + gpio_free(gpio_avdd_en); + } else { + dev_err(dev, "%s: failed to get avdd_en\n", __func__); return -EINVAL; } - gpio_request_one(gpio_cam_ldo_en, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpio_cam_ldo_en); + gpio_iovdd_en = of_get_named_gpio(dnode, "gpio_iovdd_en", 0); + if (gpio_is_valid(gpio_iovdd_en)) { + if (gpio_request_one(gpio_iovdd_en, GPIOF_OUT_INIT_LOW, "CAM_IOVDD_EN_LOW")) { + dev_err(dev, "%s: failed to gpio request iovdd_en\n", __func__); + return -ENODEV; + } + gpio_free(gpio_iovdd_en); + } else { + dev_err(dev, "%s: failed to get iovdd_en\n", __func__); + return -EINVAL; + } SET_PIN_INIT(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON); SET_PIN_INIT(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF); + SET_PIN_INIT(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON); + SET_PIN_INIT(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF); /* Normal On */ SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_reset, "sen_rst low", PIN_OUTPUT, 0, 0); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_cam_ldo_en, "sensor_ldos_en", PIN_OUTPUT, 1, 0); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_reset, "sen_rst high", PIN_OUTPUT, 1, 0); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_none, "pin", PIN_FUNCTION, 2, 1000); + + SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_none, "VLDO44_PMIC_DCAM_DVDD_1P2", PIN_REGULATOR, 1, 0); + SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_none, "VLDO41_PMIC_FCAM_AVDD_2P8", PIN_REGULATOR, 1, 0); + SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_avdd_en, "avdd_en", PIN_OUTPUT, 1, 0); + SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_iovdd_en, "iovdd_en", PIN_OUTPUT, 1, 0); SET_PIN_SHARED(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, SRT_ACQUIRE, &core->shared_rsc_slock[SHARED_PIN0], &core->shared_rsc_count[SHARED_PIN0], 1); + SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_reset, "sen_rst high", PIN_OUTPUT, 1, 0); + SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, gpio_none, "pin", PIN_FUNCTION, 2, 1000); + /* Normal Off */ SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_none, "pin", PIN_FUNCTION, 0, 0); SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_none, "pin", PIN_FUNCTION, 1, 0); - SET_PIN_SHARED(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, SRT_RELEASE, - &core->shared_rsc_slock[SHARED_PIN0], &core->shared_rsc_count[SHARED_PIN0], 0); SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_none, "pin", PIN_FUNCTION, 0, 0); SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_reset, "sen_rst", PIN_OUTPUT, 0, 0); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_cam_ldo_en, "sensor_ldos_en", PIN_INPUT, 0, 0); + SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_none, "VLDO44_PMIC_DCAM_DVDD_1P2", PIN_REGULATOR, 0, 0); + SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_avdd_en, "avdd_en", PIN_OUTPUT, 0, 0); + + SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_none, "VLDO41_PMIC_FCAM_AVDD_2P8", PIN_REGULATOR, 0, 0); + SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, gpio_iovdd_en, "iovdd_en", PIN_OUTPUT, 0, 0); + SET_PIN_SHARED(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, SRT_RELEASE, + &core->shared_rsc_slock[SHARED_PIN0], &core->shared_rsc_count[SHARED_PIN0], 0); + + /* SENSOR FACTORY TEST - POWER ON */ + SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON, gpio_reset, "sen_rst low", PIN_OUTPUT, 0, 0); + + SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON, gpio_none, "VLDO44_PMIC_DCAM_DVDD_1P2", PIN_REGULATOR, 1, 0); + SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON, gpio_none, "VLDO41_PMIC_FCAM_AVDD_2P8", PIN_REGULATOR, 1, 0); + SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON, gpio_avdd_en, "avdd_en", PIN_OUTPUT, 1, 0); + SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON, gpio_iovdd_en, "iovdd_en", PIN_OUTPUT, 1, 0); + SET_PIN_SHARED(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON, SRT_ACQUIRE, + &core->shared_rsc_slock[SHARED_PIN0], &core->shared_rsc_count[SHARED_PIN0], 1); + + SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON, gpio_reset, "sen_rst high", PIN_OUTPUT, 1, 0); + SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_ON, gpio_none, "pin", PIN_FUNCTION, 2, 1000); + + /* SENSOR FACTORY TEST - POWER Off */ + SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, gpio_none, "pin", PIN_FUNCTION, 0, 0); + SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, gpio_none, "pin", PIN_FUNCTION, 1, 0); + SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, gpio_none, "pin", PIN_FUNCTION, 0, 0); + SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, gpio_reset, "sen_rst", PIN_OUTPUT, 0, 0); + SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, gpio_none, "VLDO44_PMIC_DCAM_DVDD_1P2", PIN_REGULATOR, 0, 0); + SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, gpio_avdd_en, "avdd_en", PIN_OUTPUT, 0, 0); + + SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, gpio_none, "VLDO41_PMIC_FCAM_AVDD_2P8", PIN_REGULATOR, 0, 0); + SET_PIN(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, gpio_iovdd_en, "iovdd_en", PIN_OUTPUT, 0, 0); + SET_PIN_SHARED(pdata, SENSOR_SCENARIO_FACTORY, GPIO_SCENARIO_OFF, SRT_RELEASE, + &core->shared_rsc_slock[SHARED_PIN0], &core->shared_rsc_count[SHARED_PIN0], 0); dev_info(dev, "%s X v4\n", __func__); -- 2.20.1