Merge "target: msm8226: Set default panel for MTPs and CDPs"
diff --git a/dev/gcdb/display/include/panel_hx8394a_720p_video.h b/dev/gcdb/display/include/panel_hx8394a_720p_video.h
index 36a88bc..4ef0d4e 100644
--- a/dev/gcdb/display/include/panel_hx8394a_720p_video.h
+++ b/dev/gcdb/display/include/panel_hx8394a_720p_video.h
@@ -277,5 +277,6 @@
1, 1, 4095, 100, 1, "bl_ctrl_wled"
};
+#define HX8394A_720P_VIDEO_SIGNATURE 0xa0087
#endif /*_HX8394A_720P_VIDEO_H_*/
diff --git a/dev/gcdb/display/include/panel_nt35596_1080p_video.h b/dev/gcdb/display/include/panel_nt35596_1080p_video.h
index 3d35b61..0c32667 100644
--- a/dev/gcdb/display/include/panel_nt35596_1080p_video.h
+++ b/dev/gcdb/display/include/panel_nt35596_1080p_video.h
@@ -3263,5 +3263,6 @@
1, 1, 4095, 100, 1, "PMIC_8941"
};
+#define NT35596_1080P_VIDEO_SIGNATURE 0xFFFF
#endif /*_PANEL_NT35596_1080P_VIDEO_H_*/
diff --git a/platform/msm8226/acpuclock.c b/platform/msm8226/acpuclock.c
index 2496d8f..503ad7b 100755
--- a/platform/msm8226/acpuclock.c
+++ b/platform/msm8226/acpuclock.c
@@ -284,17 +284,18 @@
uint32_t reg = 0;
reg = readl(MDP_GDSCR);
if (enable) {
- if (reg & 0x1) {
+ if (!(reg & GDSC_POWER_ON_BIT)) {
reg &= ~(BIT(0) | GDSC_EN_FEW_WAIT_MASK);
reg |= GDSC_EN_FEW_WAIT_256_MASK;
writel(reg, MDP_GDSCR);
+ while(!(readl(MDP_GDSCR) & (GDSC_POWER_ON_BIT)));
+ } else {
+ dprintf(SPEW, "MDP GDSC already enabled\n");
}
-
- while(readl(MDP_GDSCR) & ((GDSC_POWER_ON_BIT) | (GDSC_POWER_ON_STATUS_BIT)));
} else {
- reg &= ~BIT(0);
+ reg |= BIT(0);
writel(reg, MDP_GDSCR);
- while(!(readl(MDP_GDSCR) & ((GDSC_POWER_ON_BIT))));
+ while(readl(MDP_GDSCR) & (GDSC_POWER_ON_BIT));
}
}
diff --git a/platform/msm_shared/include/partition_parser.h b/platform/msm_shared/include/partition_parser.h
index 25a73ca..bbd8422 100644
--- a/platform/msm_shared/include/partition_parser.h
+++ b/platform/msm_shared/include/partition_parser.h
@@ -72,7 +72,7 @@
#define MAX_GPT_NAME_SIZE 72
#define PARTITION_TYPE_GUID_SIZE 16
#define UNIQUE_PARTITION_GUID_SIZE 16
-#define NUM_PARTITIONS 32
+#define NUM_PARTITIONS 128
/* Some useful define used to access the MBR/EBR table */
#define BLOCK_SIZE 0x200
diff --git a/platform/msm_shared/mipi_dsi.c b/platform/msm_shared/mipi_dsi.c
index 9dfbd8b..1962081 100644
--- a/platform/msm_shared/mipi_dsi.c
+++ b/platform/msm_shared/mipi_dsi.c
@@ -114,6 +114,38 @@
return NULL;
}
+static uint32_t response_value = 0;
+
+uint32_t mdss_dsi_read_panel_signature(uint32_t panel_signature)
+{
+ uint32_t rec_buf[1];
+ uint32_t *lp = rec_buf, data;
+ int ret = response_value;
+
+#if (DISPLAY_TYPE_MDSS == 1)
+ if (ret && ret != panel_signature)
+ goto exit_read_signature;
+
+ ret = mipi_dsi_cmds_tx(&read_ddb_start_cmd, 1);
+ if (ret)
+ goto exit_read_signature;
+ if (!mdss_dsi_cmds_rx(&lp, 1, 1))
+ goto exit_read_signature;
+
+ data = ntohl(*lp);
+ data = data >> 8;
+ response_value = data;
+ if (response_value != panel_signature)
+ ret = response_value;
+
+exit_read_signature:
+ /* Keep the non detectable panel at the end and set panel signature 0xFFFF */
+ if (panel_signature == 0xFFFF)
+ ret = 0;
+#endif
+ return ret;
+}
+
int mdss_dual_dsi_cmd_dma_trigger_for_panel()
{
uint32_t ReadValue;
@@ -464,7 +496,7 @@
pinfo->num_of_panel_cmds);
if (!status && target_panel_auto_detect_enabled())
status =
- target_read_panel_signature(pinfo->signature);
+ mdss_dsi_read_panel_signature(pinfo->signature);
}
}
#endif
diff --git a/platform/msm_shared/partition_parser.c b/platform/msm_shared/partition_parser.c
index e2d548e..6facb93 100644
--- a/platform/msm_shared/partition_parser.c
+++ b/platform/msm_shared/partition_parser.c
@@ -58,7 +58,7 @@
unsigned int ext3_count = 0;
unsigned int vfat_count = 0;
-struct partition_entry partition_entries[NUM_PARTITIONS];
+struct partition_entry *partition_entries;
static unsigned gpt_partitions_exist = 0;
unsigned partition_count = 0;
@@ -69,6 +69,10 @@
block_size = mmc_get_device_blocksize();
+ /* Allocate partition entries array */
+ partition_entries = (struct partition_entry *) calloc(NUM_PARTITIONS, sizeof(struct partition_entry));
+ ASSERT(partition_entries);
+
/* Read MBR of the card */
ret = mmc_boot_read_mbr(block_size);
if (ret) {
diff --git a/platform/msm_shared/scm.c b/platform/msm_shared/scm.c
index 26e203e..8adc0d2 100644
--- a/platform/msm_shared/scm.c
+++ b/platform/msm_shared/scm.c
@@ -293,7 +293,7 @@
parse_req.md_len *= MULTIPLICATION_FACTOR;
- arch_clean_invalidate_cache_range((addr_t) *(img_ptr + prev_len),
+ arch_clean_invalidate_cache_range((addr_t) (*img_ptr + prev_len),
(parse_req.md_len - prev_len) );
continue;
diff --git a/target/init.c b/target/init.c
index 92bcf04..7875a4f 100644
--- a/target/init.c
+++ b/target/init.c
@@ -120,11 +120,6 @@
{
}
-__WEAK uint32_t target_read_panel_signature(uint32_t panel_signature)
-{
- return 0;
-}
-
/* Default target does not support continuous splash screen feature. */
__WEAK int target_cont_splash_screen()
{
diff --git a/target/msm8226/init.c b/target/msm8226/init.c
index d33aa95..4067a8c 100644
--- a/target/msm8226/init.c
+++ b/target/msm8226/init.c
@@ -410,21 +410,52 @@
writel(val, USB_USBCMD);
}
+uint8_t target_panel_auto_detect_enabled()
+{
+ uint8_t ret = 0;
+
+ switch(board_hardware_id())
+ {
+ case HW_PLATFORM_QRD:
+ /* Enable auto detect for DVT boards only */
+ if (((board_target_id() >> 16) & 0xFF) == 0x2)
+ ret = 1;
+ else
+ ret = 0;
+ break;
+ case HW_PLATFORM_SURF:
+ case HW_PLATFORM_MTP:
+ default:
+ ret = 0;
+ }
+ return ret;
+}
+
+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 252ab3b..9f3127b 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);
@@ -327,5 +363,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)
diff --git a/target/msm8974/target_display.c b/target/msm8974/target_display.c
index e877f27..5f79630 100644
--- a/target/msm8974/target_display.c
+++ b/target/msm8974/target_display.c
@@ -36,7 +36,6 @@
#include <pm8x41_wled.h>
#include <board.h>
#include <mdp5.h>
-#include <endian.h>
#include <platform/gpio.h>
#include <platform/clock.h>
#include <platform/iomap.h>
@@ -218,33 +217,6 @@
return NO_ERROR;
}
-static uint32_t response_value = 0;
-
-uint32_t target_read_panel_signature(uint32_t panel_signature)
-{
- uint32_t rec_buf[1];
- uint32_t *lp = rec_buf, data;
- int ret = response_value;
-
- if (ret && ret != panel_signature)
- goto exit_read_signature;
-
- ret = mipi_dsi_cmds_tx(&read_ddb_start_cmd, 1);
- if (ret)
- goto exit_read_signature;
- if (!mdss_dsi_cmds_rx(&lp, 1, 1))
- goto exit_read_signature;
-
- data = ntohl(*lp);
- data = data >> 8;
- response_value = data;
- if (response_value != panel_signature)
- ret = response_value;
-
-exit_read_signature:
- return ret;
-}
-
static int msm8974_mdss_edp_panel_clock(int enable)
{
if (enable) {