msm: board-8930: Add backlight control when using PM8917
Use PM8917 GPIO 24 to enable and disable the LCD backlight on
targets which use PM8917 as WLED is not available.
Change-Id: Id2fa1bb01d174d38ee9d846261750e971a96cfd2
Signed-off-by: David Collins <collinsd@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-8930-display.c b/arch/arm/mach-msm/board-8930-display.c
index 2a8e918..4b4a51a 100644
--- a/arch/arm/mach-msm/board-8930-display.c
+++ b/arch/arm/mach-msm/board-8930-display.c
@@ -135,6 +135,8 @@
static int mipi_dsi_cdp_panel_power(int on)
{
static struct regulator *reg_l8, *reg_l23, *reg_l2;
+ /* Control backlight GPIO (24) directly when using PM8917 */
+ int gpio24 = PM8917_GPIO_PM_TO_SYS(24);
int rc;
pr_debug("%s: state : %d\n", __func__, on);
@@ -190,13 +192,21 @@
rc);
gpio_free(DISP_3D_2D_MODE);
return -ENODEV;
- }
+ }
rc = gpio_direction_output(DISP_3D_2D_MODE, 0);
if (rc) {
pr_err("gpio_direction_output failed for %d gpio rc=%d\n",
DISP_3D_2D_MODE, rc);
return -ENODEV;
+ }
+ if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
+ rc = gpio_request(gpio24, "disp_bl");
+ if (rc) {
+ pr_err("request for gpio 24 failed, rc=%d\n",
+ rc);
+ return -ENODEV;
}
+ }
dsi_power_on = true;
}
if (on) {
@@ -238,6 +248,8 @@
gpio_set_value(DISP_RST_GPIO, 1);
gpio_set_value(DISP_3D_2D_MODE, 1);
usleep(20);
+ if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
+ gpio_set_value_cansleep(gpio24, 1);
} else {
gpio_set_value(DISP_RST_GPIO, 0);
@@ -274,6 +286,8 @@
}
gpio_set_value(DISP_3D_2D_MODE, 0);
usleep(20);
+ if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
+ gpio_set_value_cansleep(gpio24, 0);
}
return 0;
}
diff --git a/arch/arm/mach-msm/board-8930-pmic.c b/arch/arm/mach-msm/board-8930-pmic.c
index ec9d9a0..95f0bd7 100644
--- a/arch/arm/mach-msm/board-8930-pmic.c
+++ b/arch/arm/mach-msm/board-8930-pmic.c
@@ -165,6 +165,8 @@
/* Initial PM8917 GPIO configurations */
static struct pm8xxx_gpio_init pm8917_gpios[] __initdata = {
+ /* Backlight enable control */
+ PM8917_GPIO_OUTPUT(24, 1),
/* keys GPIOs */
PM8917_GPIO_INPUT(27, PM_GPIO_PULL_UP_30),
PM8917_GPIO_INPUT(28, PM_GPIO_PULL_UP_30),