Revert "Revert "msm: display: Backlight control on 8x25 EVB""
Enable backlight control on 8x25 EVB for WVGA panel.
This reverts commit 75cf6b84b36b054cb7b8074af165cb082112c7d7.
CRs-fixed: 339158
Change-Id: Ice8426442c9d82a7316dfd4d812e9f6301a97850
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-msm7627a-display.c b/arch/arm/mach-msm/board-msm7627a-display.c
index 33a46cc..e96284a 100644
--- a/arch/arm/mach-msm/board-msm7627a-display.c
+++ b/arch/arm/mach-msm/board-msm7627a-display.c
@@ -573,6 +573,93 @@
};
#endif
+static int evb_backlight_control(int level)
+{
+
+ int i = 0;
+ int remainder;
+ /* device address byte = 0x72 */
+ gpio_set_value_cansleep(96, 0);
+ udelay(67);
+ gpio_set_value_cansleep(96, 1);
+ udelay(33);
+ gpio_set_value_cansleep(96, 0);
+ udelay(33);
+ gpio_set_value_cansleep(96, 1);
+ udelay(67);
+ gpio_set_value_cansleep(96, 0);
+ udelay(33);
+ gpio_set_value_cansleep(96, 1);
+ udelay(67);
+ gpio_set_value_cansleep(96, 0);
+ udelay(33);
+ gpio_set_value_cansleep(96, 1);
+ udelay(67);
+ gpio_set_value_cansleep(96, 0);
+ udelay(67);
+ gpio_set_value_cansleep(96, 1);
+ udelay(33);
+ gpio_set_value_cansleep(96, 0);
+ udelay(67);
+ gpio_set_value_cansleep(96, 1);
+ udelay(33);
+ gpio_set_value_cansleep(96, 0);
+ udelay(33);
+ gpio_set_value_cansleep(96, 1);
+ udelay(67);
+ gpio_set_value_cansleep(96, 0);
+ udelay(67);
+ gpio_set_value_cansleep(96, 1);
+ udelay(33);
+
+ /* t-EOS and t-start */
+ gpio_set_value_cansleep(96, 0);
+ ndelay(4200);
+ gpio_set_value_cansleep(96, 1);
+ ndelay(9000);
+
+ /* data byte */
+ /* RFA = 0 */
+ gpio_set_value_cansleep(96, 0);
+ udelay(67);
+ gpio_set_value_cansleep(96, 1);
+ udelay(33);
+
+ /* Address bits */
+ gpio_set_value_cansleep(96, 0);
+ udelay(67);
+ gpio_set_value_cansleep(96, 1);
+ udelay(33);
+ gpio_set_value_cansleep(96, 0);
+ udelay(67);
+ gpio_set_value_cansleep(96, 1);
+ udelay(33);
+
+ /* Data bits */
+ for (i = 0; i < 5; i++) {
+ remainder = (level) & (16);
+ if (remainder) {
+ gpio_set_value_cansleep(96, 0);
+ udelay(33);
+ gpio_set_value_cansleep(96, 1);
+ udelay(67);
+ } else {
+ gpio_set_value_cansleep(96, 0);
+ udelay(67);
+ gpio_set_value_cansleep(96, 1);
+ udelay(33);
+ }
+ level = level << 1;
+ }
+
+ /* t-EOS */
+ gpio_set_value_cansleep(96, 0);
+ ndelay(12000);
+ gpio_set_value_cansleep(96, 1);
+ return 0;
+}
+
+
static struct msm_panel_common_pdata mipi_truly_pdata = {
.pmic_backlight = mipi_truly_set_bl,
};
@@ -586,7 +673,7 @@
};
static struct msm_panel_common_pdata mipi_NT35510_pdata = {
- .pmic_backlight = NULL,/*mipi_NT35510_set_bl,*/
+ .pmic_backlight = evb_backlight_control,
};
static struct platform_device mipi_dsi_NT35510_panel_device = {
@@ -1028,7 +1115,7 @@
return rc;
rc = gpio_tlmm_config(GPIO_CFG(GPIO_QRD3_LCD_BACKLIGHT_EN, 0,
- GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+ GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
GPIO_CFG_ENABLE);
if (rc < 0) {
pr_err("failed QRD3 GPIO_BACKLIGHT_EN tlmm config\n");
@@ -1084,7 +1171,17 @@
qrd3_dsi_gpio_initialized = 1;
}
- gpio_set_value_cansleep(GPIO_QRD3_LCD_BACKLIGHT_EN, !!on);
+ if (on) {
+ gpio_set_value_cansleep(GPIO_QRD3_LCD_BACKLIGHT_EN, 1);
+ udelay(190);
+ gpio_set_value_cansleep(GPIO_QRD3_LCD_BACKLIGHT_EN, 0);
+ udelay(286);
+ gpio_set_value_cansleep(GPIO_QRD3_LCD_BACKLIGHT_EN, 1);
+ /* 1 wire mode starts from this low to high transition */
+ udelay(50);
+ } else
+ gpio_set_value_cansleep(GPIO_QRD3_LCD_BACKLIGHT_EN, !!on);
+
gpio_set_value_cansleep(GPIO_QRD3_LCD_EXT_2V85_EN, !!on);
gpio_set_value_cansleep(GPIO_QRD3_LCD_EXT_1V8_EN, !!on);
@@ -1167,10 +1264,11 @@
if (machine_is_msm7627a_qrd1())
platform_add_devices(qrd_fb_devices,
ARRAY_SIZE(qrd_fb_devices));
- else if (machine_is_msm7627a_evb() || machine_is_msm8625_evb())
+ else if (machine_is_msm7627a_evb() || machine_is_msm8625_evb()) {
+ mipi_NT35510_pdata.bl_lock = 1;
platform_add_devices(evb_fb_devices,
ARRAY_SIZE(evb_fb_devices));
- else if (machine_is_msm7627a_qrd3() || machine_is_msm8625_qrd7()) {
+ } else if (machine_is_msm7627a_qrd3() || machine_is_msm8625_qrd7()) {
sku3_lcdc_lcd_camera_power_init();
platform_add_devices(qrd3_fb_devices,
ARRAY_SIZE(qrd3_fb_devices));
diff --git a/arch/arm/mach-msm/include/mach/board.h b/arch/arm/mach-msm/include/mach/board.h
index 5b3f297..82b1445 100644
--- a/arch/arm/mach-msm/include/mach/board.h
+++ b/arch/arm/mach-msm/include/mach/board.h
@@ -357,6 +357,7 @@
struct msm_panel_common_pdata {
uintptr_t hw_revision_addr;
int gpio;
+ bool bl_lock;
int (*backlight_level)(int level, int max, int min);
int (*pmic_backlight)(int level);
int (*panel_num)(void);
diff --git a/drivers/video/msm/mipi_NT35510.c b/drivers/video/msm/mipi_NT35510.c
index 930b4e9..c6f531e 100644
--- a/drivers/video/msm/mipi_NT35510.c
+++ b/drivers/video/msm/mipi_NT35510.c
@@ -18,6 +18,7 @@
static struct msm_panel_common_pdata *mipi_nt35510_pdata;
static struct dsi_buf nt35510_tx_buf;
static struct dsi_buf nt35510_rx_buf;
+spinlock_t bl_spinlock;
#define NT35510_SLEEP_OFF_DELAY 150
#define NT35510_DISPLAY_ON_DELAY 150
@@ -506,6 +507,8 @@
if (pdev->id == 0) {
mipi_nt35510_pdata = pdev->dev.platform_data;
+ if (mipi_nt35510_pdata->bl_lock)
+ spin_lock_init(&bl_spinlock);
return 0;
}
@@ -523,8 +526,16 @@
static void mipi_nt35510_set_backlight(struct msm_fb_data_type *mfd)
{
- /* Add backlight changes later*/
- return;
+ int bl_level;
+ unsigned long flags;
+ bl_level = mfd->bl_level;
+
+ if (mipi_nt35510_pdata->bl_lock) {
+ spin_lock_irqsave(&bl_spinlock, flags);
+ mipi_nt35510_pdata->pmic_backlight(bl_level);
+ spin_unlock_irqrestore(&bl_spinlock, flags);
+ } else
+ mipi_nt35510_pdata->pmic_backlight(bl_level);
}
static struct msm_fb_panel_data nt35510_panel_data = {
@@ -564,7 +575,6 @@
return -ENOMEM;
nt35510_panel_data.panel_info = *pinfo;
-
ret = platform_device_add_data(pdev, &nt35510_panel_data,
sizeof(nt35510_panel_data));
if (ret) {
diff --git a/drivers/video/msm/mipi_NT35510_cmd_wvga_pt.c b/drivers/video/msm/mipi_NT35510_cmd_wvga_pt.c
index 2c4ee3e..f052e93 100644
--- a/drivers/video/msm/mipi_NT35510_cmd_wvga_pt.c
+++ b/drivers/video/msm/mipi_NT35510_cmd_wvga_pt.c
@@ -56,7 +56,7 @@
pinfo.lcdc.border_clr = 0; /* blk */
pinfo.lcdc.underflow_clr = 0xff; /* blue */
pinfo.lcdc.hsync_skew = 0;
- pinfo.bl_max = 100;
+ pinfo.bl_max = 31;
pinfo.bl_min = 1;
pinfo.fb_num = 2;
diff --git a/drivers/video/msm/mipi_NT35510_video_wvga_pt.c b/drivers/video/msm/mipi_NT35510_video_wvga_pt.c
index 82e03b2..4e97d99 100644
--- a/drivers/video/msm/mipi_NT35510_video_wvga_pt.c
+++ b/drivers/video/msm/mipi_NT35510_video_wvga_pt.c
@@ -59,7 +59,7 @@
delayed from VSYNC active edge */
pinfo.lcdc.hsync_skew = 0;
pinfo.clk_rate = 499000000;
- pinfo.bl_max = 100; /*16; CHECK THIS!!!*/
+ pinfo.bl_max = 31;
pinfo.bl_min = 1;
pinfo.fb_num = 2;