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>
This commit is contained in:
parent
79a1a55cf8
commit
92172af176
5 changed files with 29 additions and 7 deletions
|
@ -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";
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue