diff options
| author | Yahui Wang <yahuiw@codeaurora.org> | 2016-12-12 22:43:20 +0800 |
|---|---|---|
| committer | Yahui Wang <yahuiw@codeaurora.org> | 2017-01-10 14:51:52 +0800 |
| commit | 92172af1769b28d41258a9b48e987676353aa16c (patch) | |
| tree | abb1e4dbc35dbfda01c959479aeebcea9150d225 | |
| parent | 79a1a55cf8ff6e4db05ff13ce5ab6fc2c0ce9dd9 (diff) | |
msm: mdss: add backlight gpio invert support for display
Some platforms may use external gpio to enable and disable backlight,
and we may need to invert this gpio according to HW design,
so add support for that.
CRs-Fixed: 1109294
Change-Id: Ib5e895eebcc38d185e8b703c3d895781b43c58c7
Signed-off-by: Yahui Wang <yahuiw@codeaurora.org>
| -rw-r--r-- | Documentation/devicetree/bindings/fb/mdss-dsi.txt | 2 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/dsi_v2.c | 6 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_dsi.c | 6 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_dsi.h | 3 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_dsi_panel.c | 19 |
5 files changed, 29 insertions, 7 deletions
diff --git a/Documentation/devicetree/bindings/fb/mdss-dsi.txt b/Documentation/devicetree/bindings/fb/mdss-dsi.txt index 31994cf28b27..6c20d22f98b4 100644 --- a/Documentation/devicetree/bindings/fb/mdss-dsi.txt +++ b/Documentation/devicetree/bindings/fb/mdss-dsi.txt @@ -103,6 +103,7 @@ Optional properties: - qcom,platform-reset-gpio: Specifies the panel reset gpio. - qcom,platform-te-gpio: Specifies the gpio used for TE. - qcom,platform-bklight-en-gpio: Specifies the gpio used to enable display back-light +- qcom,platform-bklight-en-gpio-invert: Invert the gpio used to enable display back-light - qcom,panel-mode-gpio: Specifies the GPIO to select video/command/single-port/dual-port mode of panel through gpio when it supports these modes. - pinctrl-names: List of names to assign mdss pin states defined in pinctrl device node @@ -267,6 +268,7 @@ Example: qcom,platform-te-gpio = <&msmgpio 24 0>; qcom,platform-enable-gpio = <&msmgpio 58 1>; qcom,platform-bklight-en-gpio = <&msmgpio 86 0>; + qcom,platform-bklight-en-gpio-invert; qcom,panel-mode-gpio = <&msmgpio 107 0>; qcom,dsi-irq-line; qcom,lane-map = "lane_map_3012"; diff --git a/drivers/video/fbdev/msm/dsi_v2.c b/drivers/video/fbdev/msm/dsi_v2.c index c6e079e26c56..6b6fdbdbd2dd 100644 --- a/drivers/video/fbdev/msm/dsi_v2.c +++ b/drivers/video/fbdev/msm/dsi_v2.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2015, 2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -232,6 +232,10 @@ static int dsi_parse_gpio(struct platform_device *pdev, pr_err("%s:%d, bklt_en gpio not specified\n", __func__, __LINE__); + ctrl_pdata->bklt_en_gpio_invert = + of_property_read_bool(ctrl_pdev->dev.of_node, + "qcom,platform-bklight-en-gpio-invert"); + return 0; } diff --git a/drivers/video/fbdev/msm/mdss_dsi.c b/drivers/video/fbdev/msm/mdss_dsi.c index 423a15d82679..69d8ca4f4a22 100644 --- a/drivers/video/fbdev/msm/mdss_dsi.c +++ b/drivers/video/fbdev/msm/mdss_dsi.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -4098,6 +4098,10 @@ static int mdss_dsi_parse_gpio_params(struct platform_device *ctrl_pdev, if (!gpio_is_valid(ctrl_pdata->bklt_en_gpio)) pr_info("%s: bklt_en gpio not specified\n", __func__); + ctrl_pdata->bklt_en_gpio_invert = + of_property_read_bool(ctrl_pdev->dev.of_node, + "qcom,platform-bklight-en-gpio-invert"); + ctrl_pdata->rst_gpio = of_get_named_gpio(ctrl_pdev->dev.of_node, "qcom,platform-reset-gpio", 0); if (!gpio_is_valid(ctrl_pdata->rst_gpio)) diff --git a/drivers/video/fbdev/msm/mdss_dsi.h b/drivers/video/fbdev/msm/mdss_dsi.h index 6c840c8459ae..367dcbda5296 100644 --- a/drivers/video/fbdev/msm/mdss_dsi.h +++ b/drivers/video/fbdev/msm/mdss_dsi.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -449,6 +449,7 @@ struct mdss_dsi_ctrl_pdata { int rst_gpio; int disp_en_gpio; int bklt_en_gpio; + bool bklt_en_gpio_invert; int lcd_mode_sel_gpio; int bklt_ctrl; /* backlight ctrl */ bool pwm_pmi; diff --git a/drivers/video/fbdev/msm/mdss_dsi_panel.c b/drivers/video/fbdev/msm/mdss_dsi_panel.c index c3ae4c1f8c17..7f6cad3de18e 100644 --- a/drivers/video/fbdev/msm/mdss_dsi_panel.c +++ b/drivers/video/fbdev/msm/mdss_dsi_panel.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -343,8 +343,14 @@ int mdss_dsi_panel_reset(struct mdss_panel_data *pdata, int enable) } if (gpio_is_valid(ctrl_pdata->bklt_en_gpio)) { - rc = gpio_direction_output( - ctrl_pdata->bklt_en_gpio, 1); + + if (ctrl_pdata->bklt_en_gpio_invert) + rc = gpio_direction_output( + ctrl_pdata->bklt_en_gpio, 0); + else + rc = gpio_direction_output( + ctrl_pdata->bklt_en_gpio, 1); + if (rc) { pr_err("%s: unable to set dir for bklt gpio\n", __func__); @@ -380,7 +386,12 @@ int mdss_dsi_panel_reset(struct mdss_panel_data *pdata, int enable) } } else { if (gpio_is_valid(ctrl_pdata->bklt_en_gpio)) { - gpio_set_value((ctrl_pdata->bklt_en_gpio), 0); + + if (ctrl_pdata->bklt_en_gpio_invert) + gpio_set_value((ctrl_pdata->bklt_en_gpio), 1); + else + gpio_set_value((ctrl_pdata->bklt_en_gpio), 0); + gpio_free(ctrl_pdata->bklt_en_gpio); } if (gpio_is_valid(ctrl_pdata->disp_en_gpio)) { |
