msm: mdss: refactor support for controlling LCD mode selection GPIO

For certain board configurations, the enable port on display
connector card needs to be controlled via LCD mode selection
GPIO. For example, for DSC/single DSI mode, the GPIO needs to
be driven high and for non-DSC/split DSI mode, the GPIO
needs to be driven low. Add support for this.

CRs-Fixed: 1000724
Change-Id: I3546fc2b5dacd77e9d2cd2ea843481dc34bfef54
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
This commit is contained in:
Padmanabhan Komanduru 2015-06-05 16:57:42 +05:30 committed by Jeevan Shriram
parent 7dcf51415c
commit d5faefb415
6 changed files with 48 additions and 46 deletions

View file

@ -275,10 +275,14 @@ Optional properties:
to the physical width in the framebuffer information.
- qcom,mdss-pan-physical-height-dimension: Specifies panel physical height in mm which corresponds
to the physical height in the framebuffer information.
- qcom,mdss-dsi-panel-mode-gpio-state: String that specifies the mode state for panel if it is defined
in dsi controller.
- qcom,mdss-dsi-mode-sel-gpio-state: String that specifies the lcd mode for panel
(such as single-port/dual-port), if qcom,panel-mode-gpio
binding is defined in dsi controller.
"dual_port" = Set GPIO to LOW
"single_port" = Set GPIO to HIGH
"high" = Set GPIO to HIGH
"low" = Set GPIO to LOW
The default value is "dual_port".
- qcom,mdss-tear-check-disable: Boolean to disable mdp tear check. Tear check is enabled by default to avoid
tearing. Other tear-check properties are ignored if this property is present.
The below tear check configuration properties can be individually tuned if
@ -575,7 +579,7 @@ Example:
qcom,5v-boost-gpio = <&pm8994_gpios 14 0>;
qcom,mdss-pan-physical-width-dimension = <60>;
qcom,mdss-pan-physical-height-dimension = <140>;
qcom,mdss-dsi-panel-mode-gpio-state = "low";
qcom,mdss-dsi-mode-sel-gpio-state = "dsc_mode";
qcom,mdss-tear-check-sync-cfg-height = <0xfff0>;
qcom,mdss-tear-check-sync-init-val = <1280>;
qcom,mdss-tear-check-sync-threshold-start = <4>;

View file

@ -103,8 +103,8 @@ 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-mode-gpio: Select video/command mode of panel through gpio when it supports
both modes.
- 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
Refer to pinctrl-bindings.txt
- pinctrl-<0..n>: Lists phandles each pointing to the pin configuration node within a pin
@ -245,7 +245,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-mode-gpio = <&msmgpio 7 0>;
qcom,panel-mode-gpio = <&msmgpio 107 0>;
qcom,dsi-irq-line;
qcom,lane-map = "lane_map_3012";
qcom,display-id = "primary";

View file

@ -3816,8 +3816,6 @@ static int mdss_dsi_parse_ctrl_params(struct platform_device *ctrl_pdev,
static int mdss_dsi_parse_gpio_params(struct platform_device *ctrl_pdev,
struct mdss_dsi_ctrl_pdata *ctrl_pdata)
{
struct mdss_panel_info *pinfo = &(ctrl_pdata->panel_data.panel_info);
/*
* If disp_en_gpio has been set previously (disp_en_gpio > 0)
* while parsing the panel node, then do not override it
@ -3850,16 +3848,11 @@ static int mdss_dsi_parse_gpio_params(struct platform_device *ctrl_pdev,
pr_err("%s:%d, reset gpio not specified\n",
__func__, __LINE__);
if (pinfo->mode_gpio_state != MODE_GPIO_NOT_VALID) {
ctrl_pdata->mode_gpio = of_get_named_gpio(
ctrl_pdev->dev.of_node,
"qcom,platform-mode-gpio", 0);
if (!gpio_is_valid(ctrl_pdata->mode_gpio))
pr_info("%s:%d, mode gpio not specified\n",
__func__, __LINE__);
} else {
ctrl_pdata->mode_gpio = -EINVAL;
ctrl_pdata->lcd_mode_sel_gpio = of_get_named_gpio(
ctrl_pdev->dev.of_node, "qcom,panel-mode-gpio", 0);
if (!gpio_is_valid(ctrl_pdata->lcd_mode_sel_gpio)) {
pr_debug("%s:%d mode gpio not specified\n", __func__, __LINE__);
ctrl_pdata->lcd_mode_sel_gpio = -EINVAL;
}
return 0;

View file

@ -426,7 +426,7 @@ struct mdss_dsi_ctrl_pdata {
int rst_gpio;
int disp_en_gpio;
int bklt_en_gpio;
int mode_gpio;
int lcd_mode_sel_gpio;
int bklt_ctrl; /* backlight ctrl */
bool pwm_pmi;
int pwm_period;

View file

@ -248,17 +248,19 @@ static int mdss_dsi_request_gpios(struct mdss_dsi_ctrl_pdata *ctrl_pdata)
goto bklt_en_gpio_err;
}
}
if (gpio_is_valid(ctrl_pdata->mode_gpio)) {
rc = gpio_request(ctrl_pdata->mode_gpio, "panel_mode");
if (gpio_is_valid(ctrl_pdata->lcd_mode_sel_gpio)) {
rc = gpio_request(ctrl_pdata->lcd_mode_sel_gpio, "mode_sel");
if (rc) {
pr_err("request panel mode gpio failed,rc=%d\n",
pr_err("request dsc/dual mode gpio failed,rc=%d\n",
rc);
goto mode_gpio_err;
goto lcd_mode_sel_gpio_err;
}
}
return rc;
mode_gpio_err:
lcd_mode_sel_gpio_err:
if (gpio_is_valid(ctrl_pdata->bklt_en_gpio))
gpio_free(ctrl_pdata->bklt_en_gpio);
bklt_en_gpio_err:
@ -351,21 +353,17 @@ int mdss_dsi_panel_reset(struct mdss_panel_data *pdata, int enable)
}
}
if (gpio_is_valid(ctrl_pdata->mode_gpio)) {
bool out;
if (pinfo->mode_gpio_state == MODE_GPIO_HIGH)
out = true;
else if (pinfo->mode_gpio_state == MODE_GPIO_LOW)
out = false;
rc = gpio_direction_output(ctrl_pdata->mode_gpio, out);
if (rc) {
pr_err("%s: unable to set dir for mode gpio\n",
__func__);
goto exit;
}
if (gpio_is_valid(ctrl_pdata->lcd_mode_sel_gpio)) {
if ((pinfo->mode_sel_state == MODE_SEL_SINGLE_PORT) ||
(pinfo->mode_sel_state == MODE_GPIO_HIGH))
gpio_set_value(
ctrl_pdata->lcd_mode_sel_gpio, 1);
else if ((pinfo->mode_sel_state == MODE_SEL_DUAL_PORT)
|| (pinfo->mode_sel_state == MODE_GPIO_LOW))
gpio_set_value(
ctrl_pdata->lcd_mode_sel_gpio, 0);
}
if (ctrl_pdata->ctrl_state & CTRL_STATE_PANEL_INIT) {
pr_debug("%s: Panel Not properly turned OFF\n",
__func__);
@ -383,8 +381,8 @@ int mdss_dsi_panel_reset(struct mdss_panel_data *pdata, int enable)
}
gpio_set_value((ctrl_pdata->rst_gpio), 0);
gpio_free(ctrl_pdata->rst_gpio);
if (gpio_is_valid(ctrl_pdata->mode_gpio))
gpio_free(ctrl_pdata->mode_gpio);
if (gpio_is_valid(ctrl_pdata->lcd_mode_sel_gpio))
gpio_free(ctrl_pdata->lcd_mode_sel_gpio);
}
exit:
@ -2372,14 +2370,19 @@ static int mdss_panel_parse_dt(struct device_node *np,
rc = of_property_read_u32(np, "qcom,mdss-dsi-stream", &tmp);
pinfo->mipi.stream = (!rc ? tmp : 0);
data = of_get_property(np, "qcom,mdss-dsi-panel-mode-gpio-state", NULL);
data = of_get_property(np, "qcom,mdss-dsi-mode-sel-gpio-state", NULL);
if (data) {
if (!strcmp(data, "high"))
pinfo->mode_gpio_state = MODE_GPIO_HIGH;
if (!strcmp(data, "single_port"))
pinfo->mode_sel_state = MODE_SEL_SINGLE_PORT;
else if (!strcmp(data, "dual_port"))
pinfo->mode_sel_state = MODE_SEL_DUAL_PORT;
else if (!strcmp(data, "high"))
pinfo->mode_sel_state = MODE_GPIO_HIGH;
else if (!strcmp(data, "low"))
pinfo->mode_gpio_state = MODE_GPIO_LOW;
pinfo->mode_sel_state = MODE_GPIO_LOW;
} else {
pinfo->mode_gpio_state = MODE_GPIO_NOT_VALID;
/* Set default mode as SPLIT mode */
pinfo->mode_sel_state = MODE_SEL_DUAL_PORT;
}
rc = of_property_read_u32(np, "qcom,mdss-mdp-transfer-time-us", &tmp);

View file

@ -114,6 +114,8 @@ enum {
enum {
MODE_GPIO_NOT_VALID = 0,
MODE_SEL_DUAL_PORT,
MODE_SEL_SINGLE_PORT,
MODE_GPIO_HIGH,
MODE_GPIO_LOW,
};
@ -588,7 +590,7 @@ struct mdss_panel_info {
int panel_max_fps;
int panel_max_vtotal;
u32 mode_gpio_state;
u32 mode_sel_state;
u32 xstart_pix_align;
u32 width_pix_align;
u32 ystart_pix_align;