Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40afdf24 authored by Dhaval Patel's avatar Dhaval Patel
Browse files

msm: mdss: Support panel mode selection through GPIO



Some panel supports video mode and command mode selection
through GPIO pin state. These dtsi entries allow to
configure such panel mode. GPIO high or low value
can be associated with any mode of panel.

Change-Id: Idf073279e2f039fa07ad2449a327eab14a0142c7
Signed-off-by: default avatarDhaval Patel <pdhaval@codeaurora.org>
parent b8da527f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -45,6 +45,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,platform-reset-sequence:		An array that lists the
					sequence of reset gpio values and sleeps
					Each command will have the format defined
@@ -76,6 +78,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,platform-reset-sequence = <1 25 0 20 1 10>;
		qcom,platform-supply-entry1 {
			qcom,supply-name = "vdd";
+5 −0
Original line number Diff line number Diff line
@@ -234,6 +234,10 @@ 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.
					"high" = Set GPIO to HIGH
					"low" = Set GPIO to LOW


Note, if a given optional qcom,* binding is not present, then the driver will configure
@@ -324,5 +328,6 @@ Example:
		qcom,mdss-dsi-pwm-gpio = <&pm8941_mpps 5 0>;
		qcom,mdss-pan-physical-width-dimension = <60>;
		qcom,mdss-pan-physical-height-dimension = <140>;
		qcom,mdss-dsi-panel-mode-gpio-state = "low";
	};
};
+25 −0
Original line number Diff line number Diff line
@@ -1249,6 +1249,31 @@ int dsi_panel_device_register(struct device_node *pan_node,
		}
	}

	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 {
			rc = gpio_request(ctrl_pdata->mode_gpio, "panel_mode");
			if (rc) {
				pr_err("request panel mode gpio failed,rc=%d\n",
									rc);
				gpio_free(ctrl_pdata->mode_gpio);
				if (gpio_is_valid(ctrl_pdata->disp_en_gpio))
					gpio_free(ctrl_pdata->disp_en_gpio);
				if (gpio_is_valid(ctrl_pdata->rst_gpio))
					gpio_free(ctrl_pdata->rst_gpio);
				if (gpio_is_valid(ctrl_pdata->disp_te_gpio))
					gpio_free(ctrl_pdata->disp_te_gpio);
				return -ENODEV;
			}
		}
	}

	if (mdss_dsi_clk_init(ctrl_pdev, ctrl_pdata)) {
		pr_err("%s: unable to initialize Dsi ctrl clks\n", __func__);
		return -EPERM;
+1 −0
Original line number Diff line number Diff line
@@ -331,6 +331,7 @@ struct mdss_dsi_ctrl_pdata {
	int disp_en_gpio;
	int disp_te_gpio;
	int bklt_en_gpio;
	int mode_gpio;
	int bklt_ctrl;	/* backlight ctrl */
	int pwm_period;
	int pwm_pmic_gpio;
+18 −0
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@ static void mdss_dsi_panel_bklt_dcs(struct mdss_dsi_ctrl_pdata *ctrl, int level)
void mdss_dsi_panel_reset(struct mdss_panel_data *pdata, int enable)
{
	struct mdss_dsi_ctrl_pdata *ctrl_pdata = NULL;
	struct mdss_panel_info *pinfo = NULL;
	int i;

	if (pdata == NULL) {
@@ -178,6 +179,7 @@ void mdss_dsi_panel_reset(struct mdss_panel_data *pdata, int enable)
	}

	pr_debug("%s: enable = %d\n", __func__, enable);
	pinfo = &(ctrl_pdata->panel_data.panel_info);

	if (enable) {
		for (i = 0; i < MDSS_DSI_RST_SEQ_LEN; ++i) {
@@ -192,6 +194,12 @@ void mdss_dsi_panel_reset(struct mdss_panel_data *pdata, int enable)
		if (gpio_is_valid(ctrl_pdata->bklt_en_gpio))
			gpio_set_value((ctrl_pdata->bklt_en_gpio), 1);

		if (gpio_is_valid(ctrl_pdata->mode_gpio)) {
			if (pinfo->mode_gpio_state == MODE_GPIO_HIGH)
				gpio_set_value((ctrl_pdata->mode_gpio), 1);
			else if (pinfo->mode_gpio_state == MODE_GPIO_LOW)
				gpio_set_value((ctrl_pdata->mode_gpio), 0);
		}
		if (ctrl_pdata->ctrl_state & CTRL_STATE_PANEL_INIT) {
			pr_debug("%s: Panel Not properly turned OFF\n",
						__func__);
@@ -715,6 +723,16 @@ static int mdss_panel_parse_dt(struct device_node *np,
		pinfo->mipi.dma_trigger =
					DSI_CMD_TRIGGER_SW;
	}
	data = of_get_property(np, "qcom,mdss-dsi-panel-mode-gpio-state", &tmp);
	if (data) {
		if (!strcmp(data, "high"))
			pinfo->mode_gpio_state = MODE_GPIO_HIGH;
		else if (!strcmp(data, "low"))
			pinfo->mode_gpio_state = MODE_GPIO_LOW;
	} else {
		pinfo->mode_gpio_state = MODE_GPIO_NOT_VALID;
	}

	rc = of_property_read_u32(np, "qcom,mdss-dsi-panel-frame-rate", &tmp);
	pinfo->mipi.frame_rate = (!rc ? tmp : 60);
	rc = of_property_read_u32(np, "qcom,mdss-dsi-panel-clock-rate", &tmp);
Loading