target: msm8x26: Add panel autodetection for 8x26
Adding support for autodetecting 720p/1080p panel
for 8x26 platform. This allows either panel to be
attached/replaced without any code change. Support
is currently added for DVT panels.
Change-Id: I115383a33fea2d49eee8023d2045b17bb2d663a7
diff --git a/target/msm8226/init.c b/target/msm8226/init.c
index d33aa95..342c9eb 100644
--- a/target/msm8226/init.c
+++ b/target/msm8226/init.c
@@ -410,21 +410,45 @@
writel(val, USB_USBCMD);
}
+uint8_t target_panel_auto_detect_enabled()
+{
+ switch(board_hardware_id())
+ {
+ case HW_PLATFORM_QRD:
+ return 1;
+ case HW_PLATFORM_SURF:
+ case HW_PLATFORM_MTP:
+ default:
+ return 0;
+ }
+ return 0;
+}
+
+static uint8_t splash_override;
/* Returns 1 if target supports continuous splash screen. */
int target_cont_splash_screen()
{
- switch(board_hardware_id())
- {
- case HW_PLATFORM_MTP:
- case HW_PLATFORM_QRD:
- case HW_PLATFORM_SURF:
- dprintf(SPEW, "Target_cont_splash=1\n");
- return 1;
- break;
- default:
- dprintf(SPEW, "Target_cont_splash=0\n");
- return 0;
- }
+ uint8_t splash_screen = 0;
+ if(!splash_override) {
+ switch(board_hardware_id())
+ {
+ case HW_PLATFORM_MTP:
+ case HW_PLATFORM_QRD:
+ case HW_PLATFORM_SURF:
+ dprintf(SPEW, "Target_cont_splash=1\n");
+ splash_screen = 1;
+ break;
+ default:
+ dprintf(SPEW, "Target_cont_splash=0\n");
+ splash_screen = 0;
+ }
+ }
+ return splash_screen;
+}
+
+void target_force_cont_splash_disable(uint8_t override)
+{
+ splash_override = override;
}
unsigned target_pause_for_battery_charge(void)
diff --git a/target/msm8226/oem_panel.c b/target/msm8226/oem_panel.c
index 5dcfdbf..e32499a 100755
--- a/target/msm8226/oem_panel.c
+++ b/target/msm8226/oem_panel.c
@@ -49,6 +49,8 @@
#include "include/panel_ssd2080m_720p_video.h"
#include "include/panel_jdi_1080p_video.h"
+#define DISPLAY_MAX_PANEL_DETECTION 2
+
/*---------------------------------------------------------------------------*/
/* static panel selection variable */
/*---------------------------------------------------------------------------*/
@@ -60,7 +62,8 @@
HX8394A_720P_VIDEO_PANEL,
NT35521_720P_VIDEO_PANEL,
SSD2080M_720P_VIDEO_PANEL,
-JDI_1080P_VIDEO_PANEL
+JDI_1080P_VIDEO_PANEL,
+UNKNOWN_PANEL
};
enum target_subtype {
@@ -214,6 +217,7 @@
= HX8394A_720P_VIDEO_ON_COMMAND;
memcpy(phy_db->timing,
hx8394a_720p_video_timings, TIMING_SIZE);
+ pinfo->mipi.signature = HX8394A_720P_VIDEO_SIGNATURE;
break;
case NT35590_720P_CMD_PANEL:
@@ -255,6 +259,7 @@
= NT35596_1080P_VIDEO_ON_COMMAND;
memcpy(phy_db->timing,
nt35596_1080p_video_timings, TIMING_SIZE);
+ pinfo->mipi.signature = NT35596_1080P_VIDEO_SIGNATURE;
break;
case JDI_1080P_VIDEO_PANEL:
panelstruct->paneldata = &jdi_1080p_video_panel_data;
@@ -277,9 +282,24 @@
memcpy(phy_db->timing,
jdi_1080p_video_timings, TIMING_SIZE);
break;
+ case UNKNOWN_PANEL:
+ memset(panelstruct, 0, sizeof(struct panel_struct));
+ memset(pinfo->mipi.panel_cmds, 0, sizeof(struct mipi_dsi_cmd));
+ pinfo->mipi.num_of_panel_cmds = 0;
+ memset(phy_db->timing, 0, TIMING_SIZE);
+ pinfo->mipi.signature = 0;
+ break;
}
}
+uint32_t oem_panel_max_auto_detect_panels()
+{
+ return target_panel_auto_detect_enabled() ?
+ DISPLAY_MAX_PANEL_DETECTION : 0;
+}
+
+static uint32_t auto_pan_loop = 0;
+
bool oem_panel_select(struct panel_struct *panelstruct,
struct msm_panel_info *pinfo,
struct mdss_dsi_phy_ctrl *phy_db)
@@ -288,6 +308,7 @@
uint32_t target_id = board_target_id();
uint32_t nt35590_panel_id = NT35590_720P_VIDEO_PANEL;
uint32_t hw_subtype = board_hardware_subtype();
+ bool ret = true;
#if DISPLAY_TYPE_CMD_MODE
nt35590_panel_id = NT35590_720P_CMD_PANEL;
@@ -302,8 +323,23 @@
} else {
if (((target_id >> 16) & 0xFF) == 0x1 || ((target_id >> 16) & 0xFF) == 0x3) //EVT || PVT
panel_id = nt35590_panel_id;
- else if (((target_id >> 16) & 0xFF) == 0x2) //DVT
+ else if (((target_id >> 16) & 0xFF) == 0x2) { //DVT
panel_id = HX8394A_720P_VIDEO_PANEL;
+ switch (auto_pan_loop) {
+ case 0:
+ panel_id = HX8394A_720P_VIDEO_PANEL;
+ break;
+ case 1:
+ panel_id = NT35596_1080P_VIDEO_PANEL;
+ break;
+ default:
+ panel_id = UNKNOWN_PANEL;
+ ret = false;
+ dprintf(CRITICAL, "Unknown panel\n");
+ return ret;
+ }
+ auto_pan_loop++;
+ }
else {
dprintf(CRITICAL, "Not supported device, target_id=%x\n"
, target_id);
@@ -331,5 +367,5 @@
init_panel_data(panelstruct, pinfo, phy_db);
- return true;
+ return ret;
}
diff --git a/target/msm8226/target_display.c b/target/msm8226/target_display.c
index d63352a..9b594e6 100755
--- a/target/msm8226/target_display.c
+++ b/target/msm8226/target_display.c
@@ -328,7 +328,20 @@
void display_init(void)
{
- gcdb_display_init(MDP_REV_50, MIPI_FB_ADDR);
+ uint32_t panel_loop = 0;
+ uint32_t ret = 0;
+
+ do {
+ ret = gcdb_display_init(MDP_REV_50, MIPI_FB_ADDR);
+ if (!ret || ret == ERR_NOT_SUPPORTED) {
+ break;
+ } else {
+ target_force_cont_splash_disable(true);
+ msm_display_off();
+ target_force_cont_splash_disable(false);
+ }
+ } while (++panel_loop <= oem_panel_max_auto_detect_panels());
+
}
void display_shutdown(void)