Browse Source

disp: msm: dsi: add a new PWM pinctrl configure

The default PWM gpio pin mode was not right for PWM backlight
control. If needs to use PWM backlight, must config the
gpio pinctrl.

Change-Id: I5fd6b947d379b53ef4c358be1b935a2ad4970f99
Signed-off-by: Yuan Zhao <[email protected]>
Yuan Zhao 5 years ago
parent
commit
b54107cfa3
2 changed files with 17 additions and 0 deletions
  1. 16 0
      msm/dsi/dsi_panel.c
  2. 1 0
      msm/dsi/dsi_panel.h

+ 16 - 0
msm/dsi/dsi_panel.c

@@ -477,6 +477,14 @@ static int dsi_panel_pinctrl_init(struct dsi_panel *panel)
 		goto error;
 	}
 
+	panel->pinctrl.pwm_pin =
+		pinctrl_lookup_state(panel->pinctrl.pinctrl, "pwm_pin");
+
+	if (IS_ERR_OR_NULL(panel->pinctrl.pwm_pin)) {
+		panel->pinctrl.pwm_pin = NULL;
+		DSI_DEBUG("failed to get pinctrl pwm_pin");
+	}
+
 error:
 	return rc;
 }
@@ -649,6 +657,14 @@ static int dsi_panel_pwm_register(struct dsi_panel *panel)
 		return rc;
 	}
 
+	if (panel->pinctrl.pwm_pin) {
+		rc = pinctrl_select_state(panel->pinctrl.pinctrl,
+			panel->pinctrl.pwm_pin);
+		if (rc)
+			DSI_ERR("[%s] failed to set pwm pinctrl, rc=%d\n",
+				panel->name, rc);
+	}
+
 	return 0;
 }
 

+ 1 - 0
msm/dsi/dsi_panel.h

@@ -97,6 +97,7 @@ struct dsi_pinctrl_info {
 	struct pinctrl *pinctrl;
 	struct pinctrl_state *active;
 	struct pinctrl_state *suspend;
+	struct pinctrl_state *pwm_pin;
 };
 
 struct dsi_panel_phy_props {