From 8b2f5711adcd72c658c023f376e29b0c6da00fba Mon Sep 17 00:00:00 2001 From: wangjiao Date: Thu, 27 Dec 2018 20:55:43 +0800 Subject: [PATCH] EKKANE-343:[Kane]:[factory]Modfiy panel into the DTSB mode Change-Id: I77f1676dae79fa573a98d9f87ddddb234c5354a8 Signed-off-by: wangjiao --- .../exynos/exynos9609-robusta2_common.dtsi | 11 ++++ drivers/video/fbdev/exynos/dpu20/dsim.h | 2 + drivers/video/fbdev/exynos/dpu20/dsim_drv.c | 50 ++++++++++++++++--- 3 files changed, 56 insertions(+), 7 deletions(-) mode change 100644 => 100755 drivers/video/fbdev/exynos/dpu20/dsim.h diff --git a/arch/arm64/boot/dts/exynos/exynos9609-robusta2_common.dtsi b/arch/arm64/boot/dts/exynos/exynos9609-robusta2_common.dtsi index 702310354c57..839d1cab0e78 100755 --- a/arch/arm64/boot/dts/exynos/exynos9609-robusta2_common.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos9609-robusta2_common.dtsi @@ -1486,6 +1486,15 @@ samsung,pin-pud = <1>; }; + lcd_reset: lcd_reset { + samsung,pins = "gpg1-4"; + samsung,pin-function = <1>; + samsung,pin-pud = <3>; + samsung,pin-val = <1>; + samsung,pin-con-pdn =<3>; + samsung,pin-pud-pdn = <3>; + }; + codec_reset: codec-reset { samsung,pins ="gpg3-2"; samsung,pin-pud = <0>; @@ -1541,6 +1550,8 @@ lcd_info = <&nt36672a>; /* reset, lcd_bias_enp, lcd_bias_enn, lcd_bl_en*/ gpios = <&gpg1 4 0x1>, <&gpg3 1 0x1>, <&gpg3 0 0x1>, <&gpg2 1 0x1>; + pinctrl-names = "lcd_reset"; + pinctrl-0 = <&lcd_reset>; }; /* USI_0_SHUB */ diff --git a/drivers/video/fbdev/exynos/dpu20/dsim.h b/drivers/video/fbdev/exynos/dpu20/dsim.h old mode 100644 new mode 100755 index 9ecff2f49f73..45d5c07ba590 --- a/drivers/video/fbdev/exynos/dpu20/dsim.h +++ b/drivers/video/fbdev/exynos/dpu20/dsim.h @@ -197,6 +197,8 @@ struct dsim_resources { void __iomem *phy_regs_ex; struct regulator *regulator_1p8v; struct regulator *regulator_3p3v; + struct pinctrl *pinctrl; + struct pinctrl_state *lcd_reset_sleep; }; struct dsim_device { diff --git a/drivers/video/fbdev/exynos/dpu20/dsim_drv.c b/drivers/video/fbdev/exynos/dpu20/dsim_drv.c index 8407e9548343..5d4565434cc3 100755 --- a/drivers/video/fbdev/exynos/dpu20/dsim_drv.c +++ b/drivers/video/fbdev/exynos/dpu20/dsim_drv.c @@ -656,6 +656,15 @@ int dsim_set_panel_power(struct dsim_device *dsim, bool on) if (on) { + ret = gpio_request_one(res->lcd_reset, GPIOF_OUT_INIT_LOW, + "lcd_reset"); + if (ret < 0) { + dsim_err("failed LCD reset off\n"); + return -EINVAL; + } + gpio_free(res->lcd_reset); + usleep_range(30000, 35000); + if (res->lcd_power[0] > 0) { ret = gpio_request_one(res->lcd_power[0], GPIOF_OUT_INIT_HIGH, "lcd_power0"); @@ -717,14 +726,12 @@ int dsim_set_panel_power(struct dsim_device *dsim, bool on) usleep_range(5000, 6000); } - ret = gpio_request_one(res->lcd_reset, GPIOF_OUT_INIT_LOW, - "lcd_reset"); - if (ret < 0) { - dsim_err("failed LCD reset off\n"); - return -EINVAL; + if (dsim->res.pinctrl && dsim->res.lcd_reset_sleep) { + if (pinctrl_select_state(dsim->res.pinctrl, + dsim->res.lcd_reset_sleep)) { + decon_err("failed to turn off dism reset\n"); + } } - gpio_free(res->lcd_reset); - usleep_range(1000, 2000); if (res->lcd_power[1] > 0) { ret = gpio_request_one(res->lcd_power[1], @@ -1962,6 +1969,29 @@ static int dsim_init_resources(struct dsim_device *dsim, struct platform_device return 0; } +int dsim_init_pinctrl(struct dsim_device *dsim) +{ + int ret = 0; + + dsim->res.pinctrl = devm_pinctrl_get(dsim->dev); + if (IS_ERR(dsim->res.pinctrl)) { + decon_err("failed to get dsim-%d pinctrl\n", dsim->id); + ret = PTR_ERR(dsim->res.pinctrl); + dsim->res.pinctrl = NULL; + goto err; + } + + dsim->res.lcd_reset_sleep = pinctrl_lookup_state(dsim->res.pinctrl, "lcd_reset"); + if (IS_ERR(dsim->res.lcd_reset_sleep)) { + decon_err("failed to get hw_te_on pin state\n"); + ret = PTR_ERR(dsim->res.lcd_reset_sleep); + dsim->res.lcd_reset_sleep = NULL; + goto err; + } + +err: + return ret; +} static int dsim_probe(struct platform_device *pdev) { @@ -2002,6 +2032,12 @@ static int dsim_probe(struct platform_device *pdev) setup_timer(&dsim->cmd_timer, dsim_cmd_fail_detector, (unsigned long)dsim); + dsim_err("%s: dsim_init_pinctrl\n", __func__); + ret = dsim_init_pinctrl(dsim); + if (ret) { + dsim_err("%s: failed to get pin resources\n", __func__); + } + #if defined(CONFIG_CPU_IDLE) dsim->idle_ip_index = exynos_get_idle_ip_index(dev_name(&pdev->dev)); dsim_info("dsim idle_ip_index[%d]\n", dsim->idle_ip_index); -- 2.20.1