Merge "makefile : Change to add MEMRWOFF for targets this is not declared."
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 10cae72..62cc67a 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -205,6 +205,9 @@
 static const char *verity_params = " none ro,0 1 android-verity /dev/mmcblk0p";
 #else
 static const char *sys_path = " root=/dev/mmcblk0p";
+
+#define MAX_DTBO_IDX_STR 64
+static const char *android_boot_dtbo_idx = " androidboot.dtbo_idx=";
 #endif
 
 #if VERIFIED_BOOT
@@ -398,7 +401,9 @@
 				+ strlen(verity_system_part) + (sizeof(char) * 2) + 2
 				+ strlen(verity_params) + sizeof(int) + 2;
 #else
-        int syspath_buflen = strlen(sys_path) + sizeof(int) + 2; /*allocate buflen for largest possible string*/
+	int syspath_buflen = strlen(sys_path) + sizeof(int) + 2; /*allocate buflen for largest possible string*/
+	char dtbo_idx_str[MAX_DTBO_IDX_STR] = "\0";
+	int dtbo_idx = INVALID_PTN;
 #endif
 	char syspath_buf[syspath_buflen];
 #if HIBERNATION_SUPPORT
@@ -483,7 +488,7 @@
 	} else if (boot_reason_alarm) {
 		cmdline_len += strlen(alarmboot_cmdline);
 	} else if ((target_build_variant_user() || device.charger_screen_enabled)
-			&& target_pause_for_battery_charge()) {
+			&& target_pause_for_battery_charge() && !boot_into_recovery) {
 		pause_at_bootup = 1;
 		cmdline_len += strlen(battchg_pause);
 	}
@@ -641,6 +646,15 @@
 	cmdline_len += target_cmd_line_len;
 #endif
 
+#if !VERITY_LE
+	dtbo_idx = get_dtbo_idx ();
+	if (dtbo_idx != INVALID_PTN) {
+		snprintf(dtbo_idx_str, sizeof(dtbo_idx_str), "%s%d",
+			android_boot_dtbo_idx, dtbo_idx);
+		cmdline_len += strlen (dtbo_idx_str);
+	}
+#endif
+
 	if (cmdline_len > 0) {
 		const char *src;
 		unsigned char *dst;
@@ -898,6 +912,14 @@
 			free(target_cmdline_buf);
 		}
 #endif
+
+#if !VERITY_LE
+		if (dtbo_idx != INVALID_PTN) {
+			src = dtbo_idx_str;
+			--dst;
+			while ((*dst++ = *src++));
+		}
+#endif
 	}
 
 
diff --git a/dev/gcdb/display/include/panel_hx8399c_hd_plus_video.h b/dev/gcdb/display/include/panel_hx8399c_hd_plus_video.h
index 679c7d5..4a32b0f 100644
--- a/dev/gcdb/display/include/panel_hx8399c_hd_plus_video.h
+++ b/dev/gcdb/display/include/panel_hx8399c_hd_plus_video.h
@@ -47,7 +47,7 @@
 /* Panel resolution                                                          */
 /*---------------------------------------------------------------------------*/
 static struct panel_resolution hx8399c_hd_plus_video_panel_res = {
-	720, 1440, 48, 48, 16, 0, 60, 40, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	720, 1440, 48, 48, 16, 0, 36, 40, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
 
 /*---------------------------------------------------------------------------*/
diff --git a/dev/gcdb/display/include/panel_truly_1080p_cmd.h b/dev/gcdb/display/include/panel_truly_1080p_cmd.h
index 16b8e3a..428417f 100644
--- a/dev/gcdb/display/include/panel_truly_1080p_cmd.h
+++ b/dev/gcdb/display/include/panel_truly_1080p_cmd.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2016, 2018 The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -323,6 +323,14 @@
 	0x23, 0x18, 0x7, 0x8, 0x5, 0x3, 0x4, 0xa0,
 };
 
+static const uint32_t truly_1080p_cmd_12nm_timings[] = {
+  0x17, 0x0A, 0x0F, 0x06, 0x02, 0x08, 0x06, 0x0E
+};
+
+struct labibb_desc truly_1080p_cmd_labibb = {
+  0, 0, 5700000, 5700000, 5700000, 5700000, 3, 3, 1, 0
+};
+
 static struct panel_reset_sequence truly_1080p_cmd_panel_reset_seq = {
 	{ 1, 0, 1, }, { 200, 200, 200, }, 2
 };
diff --git a/dev/gcdb/display/include/panel_truly_1080p_video.h b/dev/gcdb/display/include/panel_truly_1080p_video.h
index d535f68..f92d655 100755
--- a/dev/gcdb/display/include/panel_truly_1080p_video.h
+++ b/dev/gcdb/display/include/panel_truly_1080p_video.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2016, 2018 The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -282,6 +282,10 @@
   0xE6, 0x38, 0x26, 0x00, 0x68, 0x6e, 0x2A, 0x3c, 0x44, 0x03, 0x04, 0x00
 };
 
+static const uint32_t truly_1080p_video_12nm_timings[] = {
+  0x17, 0x0A, 0x0F, 0x06, 0x02, 0x08, 0x06, 0x0E
+};
+
 static const uint32_t truly_1080p_14nm_video_timings[] = {
 	0x23, 0x1e, 0x8, 0x9, 0x5, 0x3, 0x4, 0xa0,
 	0x23, 0x1e, 0x8, 0x9, 0x5, 0x3, 0x4, 0xa0,
@@ -294,6 +298,10 @@
   0, 4, 0x02, 0x2d
 };
 
+struct labibb_desc truly_1080p_video_labibb = {
+  0, 0, 5700000, 5700000, 5700000, 5700000, 3, 3, 1, 0
+};
+
 static struct panel_reset_sequence truly_1080p_video_panel_reset_seq = {
 { 1, 0, 1, }, { 200, 200, 200, }, 2
 };
diff --git a/platform/msm_shared/dev_tree.c b/platform/msm_shared/dev_tree.c
index d6b3970..2b146cc 100644
--- a/platform/msm_shared/dev_tree.c
+++ b/platform/msm_shared/dev_tree.c
@@ -109,6 +109,12 @@
  */
 extern int check_aboot_addr_range_overlap(uintptr_t start, uint32_t size);
 
+static int dtbo_idx = INVALID_PTN;
+int get_dtbo_idx (void)
+{
+   return dtbo_idx;
+}
+
 int fdt_check_header_ext(const void *fdt)
 {
 	uintptr_t fdt_start, fdt_end;
@@ -332,7 +338,7 @@
   |     |               | PmicVariantRev  | N     | Y    | N       |
 */
 
-static void dtb_read_find_match(dt_info *current_dtb_info, dt_info *best_dtb_info, uint32_t exact_match)
+static boolean dtb_read_find_match(dt_info *current_dtb_info, dt_info *best_dtb_info, uint32_t exact_match)
 {
 	int board_id_len;
 	int platform_id_len = 0;
@@ -343,12 +349,13 @@
 	const char *platform_prop = NULL;
 	const char *board_prop = NULL;
 	const char *pmic_prop = NULL;
+	boolean find_best_match = false;
 
 	current_dtb_info->dt_match_val = 0;
 	root_offset = fdt_path_offset(dtb, "/");
 	if (root_offset < 0) {
 		dprintf(CRITICAL, "ERROR: Unable to locate root node\n");
-		return;
+		return false;
 	}
 
 	/* Get the msm-id prop from DTB and find best match */
@@ -547,9 +554,11 @@
 
 cleanup:
 	if (current_dtb_info->dt_match_val & BIT(exact_match)) {
-		if (best_dtb_info->dt_match_val < current_dtb_info->dt_match_val)
+		if (best_dtb_info->dt_match_val < current_dtb_info->dt_match_val) {
 			memscpy(best_dtb_info, sizeof(dt_info), current_dtb_info, sizeof(dt_info));
-		else if (best_dtb_info->dt_match_val == current_dtb_info->dt_match_val) {
+			find_best_match = true;
+		} else if (best_dtb_info->dt_match_val == current_dtb_info->dt_match_val) {
+			find_best_match = true;
 			if (best_dtb_info->dt_soc_rev < current_dtb_info->dt_soc_rev)
 				memscpy(best_dtb_info, sizeof(dt_info), current_dtb_info, sizeof(dt_info));
 			else if (best_dtb_info->dt_variant_major < current_dtb_info->dt_variant_major)
@@ -564,8 +573,12 @@
 				memscpy(best_dtb_info, sizeof(dt_info), current_dtb_info, sizeof(dt_info));
 			else if (best_dtb_info->dt_pmic_rev[3] < current_dtb_info->dt_pmic_rev[3])
 				memscpy(best_dtb_info, sizeof(dt_info), current_dtb_info, sizeof(dt_info));
+			else
+				find_best_match = false;
 		}
 	}
+
+	return find_best_match;
 }
 
 void *get_soc_dtb(void *kernel, uint32_t kernel_size, uint32_t dtb_offset)
@@ -628,6 +641,7 @@
 	uint32_t dtb_size = 0;
 	dt_info cur_dtb_info = {0};
 	dt_info best_dtb_info = {0};
+	boolean find_best_dtb = false;
 
 	if (!dtbo_image_buf) {
 		dprintf(CRITICAL, "dtbo image buffer is NULL\n");
@@ -656,9 +670,13 @@
 		}
 		dprintf(SPEW, "Valid board dtb is found\n");
 		cur_dtb_info.dtb = board_dtb;
-		dtb_read_find_match(&cur_dtb_info, &best_dtb_info, VARIANT_MATCH);
+		find_best_dtb = dtb_read_find_match(&cur_dtb_info, &best_dtb_info, VARIANT_MATCH);
 		dprintf(SPEW, "dtbo count = %u local_board_dt_match =%x\n",dtbo_count, cur_dtb_info.dt_match_val);
 		dtb_table_entry++;
+
+		if (find_best_dtb) {
+			dtbo_idx = dtbo_count;
+		}
 	}
 	if (!best_dtb_info.dtb) {
 		dprintf(CRITICAL, "Unable to find the board dtb\n");
diff --git a/platform/msm_shared/include/dev_tree.h b/platform/msm_shared/include/dev_tree.h
old mode 100755
new mode 100644
index 6457525..6c06b44
--- a/platform/msm_shared/include/dev_tree.h
+++ b/platform/msm_shared/include/dev_tree.h
@@ -244,4 +244,5 @@
 int update_device_tree(void *fdt, const char *, void *, unsigned);
 int dev_tree_add_mem_info(void *fdt, uint32_t offset, uint64_t size, uint64_t addr);
 void *dev_tree_appended(void *kernel, uint32_t kernel_size, uint32_t dtb_offset, void *tags);
+int get_dtbo_idx (void);
 #endif
diff --git a/platform/msm_shared/partition_parser.c b/platform/msm_shared/partition_parser.c
old mode 100644
new mode 100755
index 3752ba8..d8df054
--- a/platform/msm_shared/partition_parser.c
+++ b/platform/msm_shared/partition_parser.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -83,6 +83,8 @@
 struct partition_entry *partition_entries;
 static unsigned gpt_partitions_exist = 0;
 static unsigned partition_count;
+/* this is a pointer to ptn_entries_buffer */
+static unsigned char *new_buffer = NULL;
 
 unsigned partition_get_partition_count()
 {
@@ -273,10 +275,12 @@
 	unsigned int n = 0;	/* Counter for UTF-16 -> 8 conversion */
 	unsigned char UTF16_name[MAX_GPT_NAME_SIZE];
 	/* LBA of first partition -- 1 Block after Protected MBR + 1 for PT */
-	unsigned long long partition_0;
 	uint64_t device_density;
 	uint8_t *data = NULL;
+	uint8_t *data_org_ptr = NULL;
 	uint32_t part_entry_cnt = block_size / ENTRY_SIZE;
+	uint32_t blocks_for_entries =
+			(NUM_PARTITIONS * PARTITION_ENTRY_SIZE)/block_size;
 
 	/* Get the density of the mmc device */
 
@@ -289,6 +293,7 @@
 		ret = -1;
 		goto end;
 	}
+	data_org_ptr = data;
 
 	/* Print out the GPT first */
 	ret = mmc_read(block_size, (unsigned int *)data, block_size);
@@ -330,19 +335,11 @@
 		}
 		parse_secondary_gpt = 0;
 	}
-	partition_0 = GET_LLWORD_FROM_BYTE(&data[PARTITION_ENTRIES_OFFSET]);
 	/* Read GPT Entries */
 	for (i = 0; i < (ROUNDUP(max_partition_count, part_entry_cnt)) / part_entry_cnt; i++) {
 		ASSERT(partition_count < NUM_PARTITIONS);
-		ret = mmc_read((partition_0 * block_size) + (i * block_size),
-						(uint32_t *) data, block_size);
-
-		if (ret) {
-			dprintf(CRITICAL,
-				"GPT: mmc read card failed reading partition entries.\n");
-			goto end;
-		}
-
+		
+		data = (new_buffer + (i * block_size));
 		for (j = 0; j < part_entry_cnt; j++) {
 			memcpy(&(partition_entries[partition_count].type_guid),
 			       &data[(j * partition_entry_size)],
@@ -368,13 +365,28 @@
 			    GET_LLWORD_FROM_BYTE(&data
 						 [(j * partition_entry_size) +
 						  LAST_LBA_OFFSET]);
+
+			/* If partition entry LBA is not valid, skip this entry
+				and parse next entry */
+			if (partition_entries[partition_count].first_lba < first_usable_lba
+				|| partition_entries[partition_count].last_lba >
+						(device_density/block_size -
+						(blocks_for_entries + GPT_HEADER_BLOCKS + 1))
+				|| partition_entries[partition_count].first_lba >
+					partition_entries[partition_count].last_lba)
+			{
+				dprintf(CRITICAL, "Partition entry(%d), lba not valid\n", j);
+				partition_count++;
+				continue;
+			}
+
 			partition_entries[partition_count].size =
 			    partition_entries[partition_count].last_lba -
 			    partition_entries[partition_count].first_lba + 1;
 			partition_entries[partition_count].attribute_flag =
 			    GET_LLWORD_FROM_BYTE(&data
 						 [(j * partition_entry_size) +
-						  ATTRIBUTE_FLAG_OFFSET]);
+				 		  ATTRIBUTE_FLAG_OFFSET]);
 
 			memset(&UTF16_name, 0x00, MAX_GPT_NAME_SIZE);
 			memcpy(UTF16_name, &data[(j * partition_entry_size) +
@@ -394,8 +406,10 @@
 		}
 	}
 end:
-	if (data)
-		free(data);
+	if (data_org_ptr)
+		free(data_org_ptr);
+	if (new_buffer)
+		free(new_buffer);
 
 	return ret;
 }
@@ -589,6 +603,8 @@
 	unsigned int partition_entry_array_start;
 	unsigned char *primary_gpt_header;
 	unsigned char *secondary_gpt_header;
+	//define as 64 bit unsigned int
+	unsigned long long *last_partition_entry;
 	unsigned int offset;
 	unsigned long long card_size_sec;
 	int total_part = 0;
@@ -624,9 +640,14 @@
 					(ptn_entries_blocks + GPT_HEADER_BLOCKS))));
 
 	/* Find last partition */
-	while (*(primary_gpt_header + block_size + total_part * ENTRY_SIZE) !=
-	       0) {
+	last_partition_entry = (unsigned long long *)
+		(primary_gpt_header + block_size + total_part * ENTRY_SIZE);
+	//need check 128 bit for GUID
+	while (*last_partition_entry != 0 ||
+		*(last_partition_entry + 1) != 0 ) {
 		total_part++;
+		last_partition_entry = (unsigned long long *)
+			(primary_gpt_header + block_size + total_part * ENTRY_SIZE);
 	}
 
 	/* Patching last partition */
@@ -1163,11 +1184,12 @@
 	uint32_t ret = 0;
 	uint32_t partitions_for_block = 0;
 	uint32_t blocks_to_read = 0;
-	unsigned char *new_buffer = NULL;
 	unsigned long long last_usable_lba = 0;
 	unsigned long long partition_0 = 0;
 	unsigned long long current_lba = 0;
 	uint32_t block_size = mmc_get_device_blocksize();
+	uint32_t blocks_for_entries =
+			(NUM_PARTITIONS * PARTITION_ENTRY_SIZE)/ block_size;
 	/* Get the density of the mmc device */
 	uint64_t device_density = mmc_get_device_capacity();
 
@@ -1215,10 +1237,23 @@
 	/*current lba and GPT lba should be same*/
 	if (!parse_secondary_gpt) {
 		if (current_lba != GPT_LBA) {
-			dprintf(CRITICAL,"GPT first usable LBA mismatch\n");
+			dprintf(CRITICAL,"Primary GPT first usable LBA mismatch\n");
 			return 1;
 		}
 	}
+	else
+	{
+		/*
+		  Check only in case of reading, skip for flashing as this is patched
+		  in patch_gpt() later in flow.
+		*/
+		if (!flashing_gpt && (current_lba != ((device_density/block_size) - 1)))
+		{
+			dprintf(CRITICAL,"Secondary GPT first usable LBA mismatch\n");
+			return 1;
+		}
+	}
+
 	/*check for first lba should be with in the valid range*/
 	if (*first_usable_lba > (device_density/block_size)) {
 		dprintf(CRITICAL,"Invalid first_usable_lba\n");
@@ -1258,11 +1293,24 @@
 	if (!flashing_gpt) {
 		partition_0 = GET_LLWORD_FROM_BYTE(&buffer[PARTITION_ENTRIES_OFFSET]);
 		/*start LBA should always be 2 in primary GPT*/
-		if(partition_0 != 0x2 && !parse_secondary_gpt) {
-			dprintf(CRITICAL, "Starting LBA mismatch\n");
-			ret = 1;
-			goto fail;
-
+		if (!parse_secondary_gpt)
+		{
+			if (partition_0 != 0x2)
+			{
+				dprintf(CRITICAL, "PrimaryGPT starting LBA mismatch\n");
+				ret = 1;
+				goto fail;
+			}
+		}
+		else
+		{
+			if (partition_0 != ((device_density/block_size) -
+						(blocks_for_entries + GPT_HEADER_BLOCKS)))
+			{
+				dprintf(CRITICAL, "BackupGPT starting LBA mismatch\n");
+				ret = 1;
+				goto fail;
+			}
 		}
 		/*read the partition entries to new_buffer*/
 		ret = mmc_read((partition_0) * (block_size), (unsigned int *)new_buffer, (blocks_to_read * block_size));
@@ -1278,6 +1326,7 @@
 			dprintf(CRITICAL,"Partition entires crc mismatch crc_val= %u with crc_val_org= %u\n",crc_val,crc_val_org);
 			ret = 1;
 		}
+		return ret;
 	}
 fail:
 	free(new_buffer);
diff --git a/platform/msm_shared/qpic_nand.c b/platform/msm_shared/qpic_nand.c
index 146f809..7fe25f9 100644
--- a/platform/msm_shared/qpic_nand.c
+++ b/platform/msm_shared/qpic_nand.c
@@ -885,6 +885,10 @@
 		 * Bad block value is stored in the first page of the block.
 		 */
 		/* Read the first page in the block. */
+		/* Ensure we always read first page of block */
+		if (page & flash.num_pages_per_blk_mask)
+			page = page - (page & flash.num_pages_per_blk_mask);
+
 		cwperpage = flash.cws_per_page;
 
 		/* Read page cmd */
diff --git a/target/init.c b/target/init.c
index 72ae157..2358438 100644
--- a/target/init.c
+++ b/target/init.c
@@ -347,6 +347,7 @@
 	switch(platform)
 	{
 		case APQ8053:
+		case APQ8009:
 			return verified_boot_le;
 		default:
 			break;
diff --git a/target/msm8952/oem_panel.c b/target/msm8952/oem_panel.c
index 7c869e1..b0a1536 100644
--- a/target/msm8952/oem_panel.c
+++ b/target/msm8952/oem_panel.c
@@ -176,7 +176,13 @@
 	switch (panel_id) {
 	case TRULY_1080P_VIDEO_PANEL:
 		panelstruct->paneldata    = &truly_1080p_video_panel_data;
-		panelstruct->paneldata->panel_with_enable_gpio = 1;
+		panelstruct->backlightinfo = &truly_1080p_video_backlight;
+		if (platform_is_sdm439() || platform_is_sdm429()) {
+			panelstruct->paneldata->panel_with_enable_gpio = 0;
+			panelstruct->backlightinfo->bl_interface_type = 0;
+		} else {
+			panelstruct->paneldata->panel_with_enable_gpio = 1;
+		}
 		panelstruct->panelres     = &truly_1080p_video_panel_res;
 		panelstruct->color        = &truly_1080p_video_color;
 		panelstruct->videopanel   = &truly_1080p_video_video_panel;
@@ -187,7 +193,7 @@
 			= &truly_1080p_video_timing_info;
 		panelstruct->panelresetseq
 					 = &truly_1080p_video_panel_reset_seq;
-		panelstruct->backlightinfo = &truly_1080p_video_backlight;
+		pinfo->labibb = &truly_1080p_video_labibb;
 		pinfo->mipi.panel_on_cmds
 			= truly_1080p_video_on_command;
 		pinfo->mipi.num_of_panel_on_cmds
@@ -196,13 +202,24 @@
 			= truly_1080p_video_off_command;
 		pinfo->mipi.num_of_panel_off_cmds
 			= TRULY_1080P_VIDEO_OFF_COMMAND;
-		memcpy(phy_db->timing,
-			truly_1080p_video_timings, TIMING_SIZE);
+		if (phy_db->pll_type == DSI_PLL_TYPE_12NM)
+			memcpy(phy_db->timing,
+				truly_1080p_video_12nm_timings,
+				TIMING_SIZE_12NM);
+		else
+			memcpy(phy_db->timing,
+				truly_1080p_video_timings, TIMING_SIZE);
 		pinfo->mipi.signature 	= TRULY_1080P_VIDEO_SIGNATURE;
 		break;
 	case TRULY_1080P_CMD_PANEL:
 		panelstruct->paneldata    = &truly_1080p_cmd_panel_data;
-		panelstruct->paneldata->panel_with_enable_gpio = 1;
+		panelstruct->backlightinfo = &truly_1080p_cmd_backlight;
+		if (platform_is_sdm439() || platform_is_sdm429()) {
+			panelstruct->paneldata->panel_with_enable_gpio = 0;
+			panelstruct->backlightinfo->bl_interface_type = 0;
+		} else {
+			panelstruct->paneldata->panel_with_enable_gpio = 1;
+		}
 		panelstruct->panelres     = &truly_1080p_cmd_panel_res;
 		panelstruct->color        = &truly_1080p_cmd_color;
 		panelstruct->videopanel   = &truly_1080p_cmd_video_panel;
@@ -213,7 +230,7 @@
 			= &truly_1080p_cmd_timing_info;
 		panelstruct->panelresetseq
 					 = &truly_1080p_cmd_panel_reset_seq;
-		panelstruct->backlightinfo = &truly_1080p_cmd_backlight;
+		pinfo->labibb = &truly_1080p_cmd_labibb;
 		pinfo->mipi.panel_on_cmds
 			= truly_1080p_cmd_on_command;
 		pinfo->mipi.num_of_panel_on_cmds
@@ -222,8 +239,13 @@
 			= truly_1080p_cmd_off_command;
 		pinfo->mipi.num_of_panel_off_cmds
 			= TRULY_1080P_CMD_OFF_COMMAND;
-		memcpy(phy_db->timing,
-			truly_1080p_cmd_timings, TIMING_SIZE);
+		if (phy_db->pll_type == DSI_PLL_TYPE_12NM)
+			memcpy(phy_db->timing,
+				truly_1080p_cmd_12nm_timings,
+				TIMING_SIZE_12NM);
+		else
+			memcpy(phy_db->timing,
+				truly_1080p_cmd_timings, TIMING_SIZE);
 		pinfo->mipi.signature 	= TRULY_1080P_CMD_SIGNATURE;
 		break;
 	case OTM1906C_1080P_CMD_PANEL:
@@ -585,7 +607,9 @@
 		memcpy(phy_db->timing,
 						hx8394f_720p_video_timings, TIMING_SIZE);
 		pinfo->mipi.signature = HX8394F_720P_VIDEO_SIGNATURE;
-		pinfo->disable_wled_labibb = true;
+		if ((board_platform_id() == SDM429) || (board_platform_id() == SDM439) ||
+				(board_platform_id() == SDA429) || (board_platform_id() == SDA439))
+			pinfo->disable_wled_labibb = true;
 		break;
 	case BYD_1200P_VIDEO_PANEL:
 		panelstruct->paneldata    = &byd_1200p_video_panel_data;
diff --git a/target/msm8953/oem_panel.c b/target/msm8953/oem_panel.c
index 8bb0c47..4de8664 100644
--- a/target/msm8953/oem_panel.c
+++ b/target/msm8953/oem_panel.c
@@ -51,6 +51,7 @@
 #include "include/panel_r69006_1080p_cmd.h"
 #include "include/panel_truly_wuxga_video.h"
 #include "include/panel_hx8399c_fhd_pluse_video.h"
+#include "include/panel_hx8399c_hd_plus_video.h"
 
 /*---------------------------------------------------------------------------*/
 /* static panel selection variable                                           */
@@ -62,6 +63,7 @@
 	R69006_1080P_CMD_PANEL,
 	TRULY_WUXGA_VIDEO_PANEL,
 	HX8399C_FHD_PLUSE_VIDEO_PANEL,
+	HX8399C_HD_PLUS_VIDEO_PANEL,
 	UNKNOWN_PANEL
 };
 
@@ -76,6 +78,7 @@
 	{"r69006_1080p_cmd", R69006_1080P_CMD_PANEL},
 	{"truly_wuxga_video", TRULY_WUXGA_VIDEO_PANEL},
 	{"hx8399c_fhd_pluse_video", HX8399C_FHD_PLUSE_VIDEO_PANEL},
+	{"hx8399c_hd_plus_video", HX8399C_HD_PLUS_VIDEO_PANEL},
 };
 
 static uint32_t panel_id;
@@ -254,6 +257,12 @@
 	case HX8399C_FHD_PLUSE_VIDEO_PANEL:
 		panelstruct->paneldata    = &hx8399c_fhd_pluse_video_panel_data;
 		panelstruct->panelres     = &hx8399c_fhd_pluse_video_panel_res;
+		panelstruct->panelres->hfront_porch = 52;
+		panelstruct->panelres->hback_porch = 48;
+		panelstruct->panelres->hpulse_width = 8;
+		panelstruct->panelres->vfront_porch = 8;
+		panelstruct->panelres->vback_porch = 8;
+		panelstruct->panelres->vpulse_width = 4;
 		panelstruct->color        = &hx8399c_fhd_pluse_video_color;
 		panelstruct->videopanel   =
 				&hx8399c_fhd_pluse_video_video_panel;
@@ -280,6 +289,35 @@
 			hx8399c_fhd_pluse_14nm_video_timings, MAX_TIMING_CONFIG * sizeof(uint32_t));
 		pinfo->mipi.signature    = HX8399C_FHD_PLUSE_VIDEO_SIGNATURE;
 		break;
+	case HX8399C_HD_PLUS_VIDEO_PANEL:
+		panelstruct->paneldata    = &hx8399c_hd_plus_video_panel_data;
+		panelstruct->panelres     = &hx8399c_hd_plus_video_panel_res;
+		panelstruct->color        = &hx8399c_hd_plus_video_color;
+		panelstruct->videopanel   =
+				&hx8399c_hd_plus_video_video_panel;
+		panelstruct->commandpanel =
+				&hx8399c_hd_plus_video_command_panel;
+		panelstruct->state        = &hx8399c_hd_plus_video_state;
+		panelstruct->laneconfig   =
+				&hx8399c_hd_plus_video_lane_config;
+		panelstruct->paneltiminginfo
+				= &hx8399c_hd_plus_video_timing_info;
+		panelstruct->panelresetseq
+				= &hx8399c_hd_plus_video_panel_reset_seq;
+		panelstruct->backlightinfo = &hx8399c_hd_plus_video_backlight;
+		pinfo->labibb = &hx8399c_hd_plus_video_labibb;
+		pinfo->mipi.panel_on_cmds
+				= hx8399c_hd_plus_video_on_command;
+		pinfo->mipi.num_of_panel_on_cmds
+				= HX8399C_HD_PLUS_VIDEO_ON_COMMAND;
+		pinfo->mipi.panel_off_cmds
+				= hx8399c_hd_plus_video_off_command;
+		pinfo->mipi.num_of_panel_off_cmds
+				= HX8399C_HD_PLUS_VIDEO_OFF_COMMAND;
+		memcpy(phy_db->timing,
+			hx8399c_hd_plus_14nm_video_timings, MAX_TIMING_CONFIG * sizeof(uint32_t));
+		pinfo->mipi.signature    = HX8399C_HD_PLUS_VIDEO_SIGNATURE;
+		break;
 	case UNKNOWN_PANEL:
 	default:
 		memset(panelstruct, 0, sizeof(struct panel_struct));