Merge "app: aboot: Assert if devinfo is corrupted"
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index a746984..a20bb86 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -92,6 +92,7 @@
 #include "secapp_loader.h"
 #include <menu_keys_detect.h>
 #include <display_menu.h>
+#include "fastboot_test.h"
 
 extern  bool target_use_signed_kernel(void);
 extern void platform_uninit(void);
@@ -192,6 +193,7 @@
 static char *target_boot_params = NULL;
 static bool boot_reason_alarm;
 static bool devinfo_present = true;
+bool boot_into_fastboot = false;
 
 /* Assuming unauthorized kernel image by default */
 static int auth_kernel_img = 0;
@@ -734,14 +736,13 @@
 	}
 #endif
 
-	/* Perform target specific cleanup */
-	target_uninit();
-
 	/* Turn off splash screen if enabled */
 #if DISPLAY_SPLASH_SCREEN
 	target_display_shutdown();
 #endif
 
+	/* Perform target specific cleanup */
+	target_uninit();
 
 	dprintf(INFO, "booting linux @ %p, ramdisk @ %p (%d), tags/device tree @ %p\n",
 		entry, ramdisk, ramdisk_size, (void *)tags_phys);
@@ -1119,7 +1120,11 @@
 		device.is_unlocked,
 		device.is_tampered);
 
-	if(target_use_signed_kernel() && (!device.is_unlocked))
+	/* Change the condition a little bit to include the test framework support.
+	 * We would never reach this point if device is in fastboot mode, even if we did
+	 * that means we are in test mode, so execute kernel authentication part for the
+	 * tests */
+	if((target_use_signed_kernel() && (!device.is_unlocked)) || boot_into_fastboot)
 	{
 		offset = imagesize_actual;
 		if (check_aboot_addr_range_overlap((uint32_t)image_addr + offset, page_size))
@@ -1136,6 +1141,9 @@
 		}
 
 		verify_signed_bootimg((uint32_t)image_addr, imagesize_actual);
+		/* The purpose of our test is done here */
+		if (boot_into_fastboot && auth_kernel_img)
+			return 0;
 	} else {
 		second_actual  = ROUND_TO_PAGE(hdr->second_size,  page_mask);
 		#ifdef TZ_SAVE_KERNEL_HASH
@@ -2133,6 +2141,11 @@
 		return;
 	}
 
+	// Initialize boot state before trying to verify boot.img
+#if VERIFIED_BOOT
+		boot_verifier_init();
+#endif
+
 	/* Verify the boot image
 	 * device & page_size are initialized in aboot_init
 	 */
@@ -2140,9 +2153,6 @@
 		/* Pass size excluding signature size, otherwise we would try to
 		 * access signature beyond its length
 		 */
-#if VERIFIED_BOOT
-		boot_verifier_init();
-#endif
 		verify_signed_bootimg((uint32_t)data, (image_actual - sig_actual));
 	}
 #ifdef MDTP_SUPPORT
@@ -2164,6 +2174,12 @@
 	}
 #endif /* MDTP_SUPPORT */
 
+#if VERIFIED_BOOT
+	// send root of trust
+	if(!send_rot_command((uint32_t)device.is_unlocked))
+		ASSERT(0);
+#endif
+
 	/*
 	 * Check if the kernel image is a gzip package. If yes, need to decompress it.
 	 * If not, continue booting.
@@ -3442,6 +3458,9 @@
 						{"oem disable-charger-screen", cmd_oem_disable_charger_screen},
 						{"oem off-mode-charge", cmd_oem_off_mode_charger},
 						{"oem select-display-panel", cmd_oem_select_display_panel},
+#if UNITTEST_FW_SUPPORT
+						{"oem run-tests", cmd_oem_runtests},
+#endif
 #endif
 						};
 
@@ -3495,7 +3514,6 @@
 void aboot_init(const struct app_descriptor *app)
 {
 	unsigned reboot_mode = 0;
-	bool boot_into_fastboot = false;
 
 	/* Setup page size information for nv storage */
 	if (target_is_emmc_boot())
diff --git a/app/aboot/fastboot_test.c b/app/aboot/fastboot_test.c
new file mode 100644
index 0000000..f32435c
--- /dev/null
+++ b/app/aboot/fastboot_test.c
@@ -0,0 +1,92 @@
+/* Copyright (c) 2015, 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
+met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+    * Neither the name of The Linux Foundation nor the names of its
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include <stdlib.h>
+#include <debug.h>
+#include "devinfo.h"
+#include "fastboot.h"
+#include "fastboot_test.h"
+#include <app/tests.h>
+#if USE_RPMB_FOR_DEVINFO
+#include <rpmb.h>
+#endif
+/* main function that calls into the tests */
+
+extern void ramdump_table_map();
+extern void kauth_test();
+
+void cmd_oem_runtests()
+{
+	dprintf(INFO, "Running LK tests ... \n");
+#if LPAE
+	ramdump_table_map();
+#endif
+
+#if USE_RPMB_FOR_DEVINFO
+	dprintf(INFO, "Running RPMB test case, please make sure RPMB key is provisioned ...\n");
+	struct device_info *write_info = memalign(PAGE_SIZE, 4096);
+	struct device_info *read_info = memalign(PAGE_SIZE, 4096);
+	if((read_device_info_rpmb((void*) read_info, PAGE_SIZE)) < 0)
+		dprintf(INFO, "RPMB READ TEST : [ FAIL ]\n");
+
+	write_info->is_unlocked = !read_info->is_unlocked;
+
+	if((write_device_info_rpmb((void*) write_info, PAGE_SIZE)) < 0)
+		dprintf(INFO, "RPMB WRITE TEST : [ FAIL ]\n");
+
+	if((read_device_info_rpmb((void*) read_info, PAGE_SIZE)) < 0)
+		dprintf(INFO, "RPMB READ TEST : [ FAIL ]\n");
+
+	if (read_info->is_unlocked == write_info->is_unlocked)
+		dprintf(INFO, "RPMB READ/WRITE TEST: [ PASS ]\n");
+	else
+		dprintf(INFO, "RPMB READ/WRITE TEST: [ FAIL ]\n");
+
+	free(read_info);
+	free(write_info);
+#endif
+
+#if VERIFIED_BOOT
+	if (!boot_linux_from_mmc())
+		dprintf(INFO, "Verifid Boot authentication test: [ PASS ]\n");
+	else
+		dprintf(INFO, "Verifid Boot authentication test: [ FAIL ]\n");
+
+	kauth_test();
+#endif
+
+	if (!thread_tests())
+		dprintf(INFO, "Thread Test: [ PASS ]\n");
+	else
+		dprintf(INFO, "Thread Test: [ FAIL ]\n");
+
+	printf_tests();
+
+	fastboot_okay("");
+}
diff --git a/app/aboot/fastboot_test.h b/app/aboot/fastboot_test.h
new file mode 100644
index 0000000..005bfa7
--- /dev/null
+++ b/app/aboot/fastboot_test.h
@@ -0,0 +1,36 @@
+/* Copyright (c) 2015, 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
+met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+    * Neither the name of The Linux Foundation nor the names of its
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef __FASTBOOT_TEST_H__
+#define __FASTBOOT_TEST_H__
+#include <sys/types.h>
+extern void ramdump_table_map();
+void cmd_oem_runtests();
+extern int boot_linux_from_mmc();
+#endif
diff --git a/app/aboot/rules.mk b/app/aboot/rules.mk
index 24bca43..09a5152 100644
--- a/app/aboot/rules.mk
+++ b/app/aboot/rules.mk
@@ -11,6 +11,11 @@
 	$(LOCAL_DIR)/fastboot.o \
 	$(LOCAL_DIR)/recovery.o
 
+ifeq ($(ENABLE_UNITTEST_FW), 1)
+OBJS += \
+	$(LOCAL_DIR)/fastboot_test.o
+endif
+
 ifeq ($(ENABLE_MDTP_SUPPORT),1)
 OBJS += \
 	$(LOCAL_DIR)/mdtp.o \
diff --git a/app/mmutest/mmu_test.c b/app/mmutest/mmu_test.c
index 849a9e6..27ed628 100644
--- a/app/mmutest/mmu_test.c
+++ b/app/mmutest/mmu_test.c
@@ -29,6 +29,7 @@
 #include <sys/types.h>
 #include <debug.h>
 #include <arch/arm/mmu.h>
+#include <arch/ops.h>
 #include <mmu.h>
 #include <string.h>
 #include <smem.h>
diff --git a/app/mmutest/rules.mk b/app/mmutest/rules.mk
index 78918a1..5094f65 100644
--- a/app/mmutest/rules.mk
+++ b/app/mmutest/rules.mk
@@ -1,6 +1,6 @@
 LOCAL_DIR := $(GET_LOCAL_DIR)
 
-INCLUDES += -I$(LK_TOP_DIR)/platform/msm_shared/include
+INCLUDES += -I$(LOCAL_DIR)/include  -I$(LK_TOP_DIR)/platform/msm_shared/include
 
 OBJS += \
 	$(LOCAL_DIR)/mmu_test.o
diff --git a/app/rules.mk b/app/rules.mk
index e564fe0..0c06ce6 100644
--- a/app/rules.mk
+++ b/app/rules.mk
@@ -3,6 +3,11 @@
 MODULES += \
 	lib/openssl
 
+ifeq ($(ENABLE_UNITTEST_FW), 1)
+MODULES += \
+	app/tests
+endif
+
 OBJS += \
 	$(LOCAL_DIR)/app.o
 
diff --git a/app/tests/adc_tests.c b/app/tests/adc_tests.c
deleted file mode 100644
index 5f2d511..0000000
--- a/app/tests/adc_tests.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2012-2013, 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
- * met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- *       copyright notice, this list of conditions and the following
- *       disclaimer in the documentation and/or other materials provided
- *       with the distribution.
- *     * Neither the name of The Linux Foundation, Inc. nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pm8x41_adc.h>
-#include <debug.h>
-
-void adc_test()
-{
-	uint32_t vadc_chan1;
-	uint32_t vadc_chan2;
-	uint16_t iusb = 3250000;
-	uint16_t ibat = 2500000;
-	uint16_t batt_id_chan = 49;
-	uint16_t vbat_sns_chan = 6;
-
-	/*
-	 * TEST: Read the voltage on batt_id & vbat_sns channels
-	 */
-	vadc_chan1 = pm8x41_adc_channel_read(batt_id_chan);
-	dprintf(INFO, "The channel [%ud] voltage is :%ud\n",batt_id_chan, vadc_chan1);
-
-	vadc_chan2 = pm8x41_adc_channel_read(vbat_sns_chan);
-	dprintf(INFO, "The channel [%ud] voltage is :%ud\n",vbat_sns_chan, vadc_chan2);
-
-	/*
-	 * TEST: Set the IUSB & IBAT max values
-	 */
-
-	if (!pm8x41_iusb_max_config(iusb))
-		dprintf(INFO, "Iusb max current is set\n");
-
-	if (!pm8x41_ibat_max_config(ibat))
-		dprintf(INFO, "Ibat max current is set\n");
-
-}
diff --git a/app/tests/led_tests.c b/app/tests/led_tests.c
deleted file mode 100644
index 11ef9f2..0000000
--- a/app/tests/led_tests.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2011, 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
- * met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- *       copyright notice, this list of conditions and the following
- *       disclaimer in the documentation and/or other materials provided
- *       with the distribution.
- *     * Neither the name of The Linux Foundation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include<dev/pm8921_leds.h>
-#include<dev/pm8921.h>
-
-void led_tests()
-{
-uint32_t duty_us, period_us;
-
-    /* 50% Duty cycle */
-    duty_us = 500000;
-    period_us = 1000000;
-
-    /* Configure PM8921_ID_LED_0 from PWM2*/
-    pm8921_config_led_current(PM8921_ID_LED_0, 2, PWM2, 1);
-
-    /* PWM2 for PM8921_ID_LED_0 is LPG 5
-     * Configure and enable lpg5
-     */
-    pm_set_pwm_config(5, duty_us, period_us, &pmic);
-    pm_pwm_channel_enable(5, &pmic);
-
-    /* Configure and enable lpg0 for  panel backlight*/
-    pm_set_pwm_config(0, duty_us, period_us, &pmic);
-    pm_pwm_channel_enable(0, &pmic);
-
-    mdelay(10000);
-
-    /* Configure PM8921_ID_LED_1 also from PWM2*/
-    pm8921_config_led_current(PM8921_ID_LED_1, 2, PWM2, 1);
-    mdelay(10000);
-
-    /* Disable PM8921_ID_LED_0 */
-    pm8921_config_led_current(PM8921_ID_LED_0, 2, 2, 0);
-
-    /* Turn on GPIO 24 through LPG 0
-     * Will be reconfigured during display_init
-     */
-    panel_backlight_on_pwm();
-
-    mdelay(10000);
-
-    /* Disable PM8921_ID_LED_1 */
-    pm8921_config_led_current(PM8921_ID_LED_1, 2, 2, 0);
-}
diff --git a/app/tests/rules.mk b/app/tests/rules.mk
index f8151ac..ec79a7f 100644
--- a/app/tests/rules.mk
+++ b/app/tests/rules.mk
@@ -5,7 +5,9 @@
 OBJS += \
 	$(LOCAL_DIR)/tests.o \
 	$(LOCAL_DIR)/thread_tests.o \
-	$(LOCAL_DIR)/printf_tests.o \
-	$(LOCAL_DIR)/i2c_tests.o \
-	$(LOCAL_DIR)/adc_tests.o \
+	$(LOCAL_DIR)/printf_tests.o
+
+ifeq ($(VERIFIED_BOOT),1)
+OBJS += \
 	$(LOCAL_DIR)/kauth_test.o
+endif
diff --git a/dev/gcdb/display/include/panel_r69006_1080p_cmd.h b/dev/gcdb/display/include/panel_r69006_1080p_cmd.h
new file mode 100755
index 0000000..ed96942
--- /dev/null
+++ b/dev/gcdb/display/include/panel_r69006_1080p_cmd.h
@@ -0,0 +1,317 @@
+/* Copyright (c) 2015, 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 met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *  * Neither the name of The Linux Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*---------------------------------------------------------------------------
+ * This file is autogenerated file using gcdb parser. Please do not edit it.
+ * Update input XML file to add a new entry or update variable in this file
+ * VERSION = "1.0"
+ *---------------------------------------------------------------------------*/
+
+#ifndef _PANEL_R69006_1080P_CMD_H_
+#define _PANEL_R69006_1080P_CMD_H_
+/*---------------------------------------------------------------------------*/
+/* HEADER files                                                              */
+/*---------------------------------------------------------------------------*/
+#include "panel.h"
+
+/*---------------------------------------------------------------------------*/
+/* Panel configuration                                                       */
+/*---------------------------------------------------------------------------*/
+static struct panel_config r69006_1080p_cmd_panel_data = {
+	"qcom,mdss_dsi_r69006_1080p_cmd", "dsi:0:", "qcom,mdss-dsi-panel",
+	10, 1, "DISPLAY_1", 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel resolution                                                          */
+/*---------------------------------------------------------------------------*/
+static struct panel_resolution r69006_1080p_cmd_panel_res = {
+	1080, 1920, 100, 82, 20, 0, 3, 9, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel color information                                                   */
+/*---------------------------------------------------------------------------*/
+static struct color_info r69006_1080p_cmd_color = {
+	24, 0, 0xff, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel on/off command information                                          */
+/*---------------------------------------------------------------------------*/
+static char r69006_1080p_cmd_on_cmd0[] = {
+	0XB0, 0x00, 0x23, 0x80
+};
+
+static char r69006_1080p_cmd_on_cmd1[] = {
+	0x06, 0x00, 0x29, 0xC0,
+	0XB3, 0x04, 0x10, 0x00,
+	0x00, 0x00, 0xFF, 0xFF,
+};
+
+static char r69006_1080p_cmd_on_cmd2[] = {
+	0x03, 0x00, 0x29, 0xC0,
+	0XB4, 0x0c, 0x00, 0xFF,
+};
+
+static char r69006_1080p_cmd_on_cmd3[] = {
+	0x04, 0x00, 0x29, 0xC0,
+	0XB6, 0x3b, 0xc3, 0x00,
+};
+
+static char r69006_1080p_cmd_on_cmd4[] = {
+	0XC0, 0x00, 0x23, 0x80
+};
+
+static char r69006_1080p_cmd_on_cmd5[] = {
+	0X36, 0x90, 0x15, 0x80
+};
+
+static char r69006_1080p_cmd_on_cmd6[] = {
+	0XCC, 0x04, 0x23, 0x80
+};
+
+static char r69006_1080p_cmd_on_cmd7[] = {
+	0x20, 0x00, 0x29, 0xC0,
+	0xC1, 0x84, 0x00, 0x10,
+	0xEF, 0x8B, 0xF1, 0xFF,
+	0xFF, 0xDF, 0x9C, 0xC5,
+	0x9A, 0x73, 0x8D, 0xAD,
+	0x63, 0xFE, 0xFF, 0xFF,
+	0xCB, 0xF8, 0x01, 0x00,
+	0xAA, 0x40, 0x00, 0xC2,
+	0x01, 0x08, 0x00, 0x01,
+};
+
+static char r69006_1080p_cmd_on_cmd8[] = {
+	0x0A, 0x00, 0x29, 0xC0,
+	0xCB, 0x0D, 0xFE, 0x1F,
+	0x2C, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0xFF, 0xFF,
+};
+
+static char r69006_1080p_cmd_on_cmd9[] = {
+	0x0B, 0x00, 0x29, 0xC0,
+	0xC2, 0x01, 0xF7, 0x80,
+	0x04, 0x63, 0x00, 0x60,
+	0x00, 0x01, 0x30, 0xFF,
+};
+
+static char r69006_1080p_cmd_on_cmd10[] = {
+	0x07, 0x00, 0x29, 0xC0,
+	0XC3, 0x55, 0x01, 0x00,
+	0x01, 0x00, 0x00, 0xFF,
+};
+
+static char r69006_1080p_cmd_on_cmd11[] = {
+	0x12, 0x00, 0x29, 0xC0,
+	0XC4, 0x70, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x02, 0x01,
+	0x00, 0x05, 0x01, 0x00,
+	0x00, 0x00, 0xFF, 0xFF,
+};
+
+static char r69006_1080p_cmd_on_cmd12[] = {
+	0x0F, 0x00, 0x29, 0xC0,
+	0xC6, 0x59, 0x07, 0x4a,
+	0x07, 0x4a, 0x01, 0x0E,
+	0x01, 0x02, 0x01, 0x02,
+	0x09, 0x15, 0x07, 0xFF,
+};
+
+static char r69006_1080p_cmd_on_cmd13[] = {
+	0x1F, 0x00, 0x29, 0xC0,
+	0XC7, 0x00, 0x30, 0x32,
+	0x34, 0x42, 0x4E, 0x56,
+	0x62, 0x44, 0x4A, 0x54,
+	0x62, 0x6B, 0x73, 0x7F,
+	0x08, 0x30, 0x32, 0x34,
+	0x42, 0x4E, 0x56, 0x62,
+	0x44, 0x4A, 0x54, 0x62,
+	0x6B, 0x73, 0x7F, 0xFF,
+};
+
+static char r69006_1080p_cmd_on_cmd14[] = {
+	0x14, 0x00, 0x29, 0xC0,
+	0xC8, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0xFC, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0xFC, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0xFC, 0x00,
+};
+
+static char r69006_1080p_cmd_on_cmd15[] = {
+	0x09, 0x00, 0x29, 0xC0,
+	0xC9, 0x1F, 0x68, 0x1F,
+	0x68, 0x4C, 0x4C, 0xC4,
+	0x11, 0xFF, 0xFF, 0xFF,
+};
+
+static char r69006_1080p_cmd_on_cmd16[] = {
+	0x11, 0x00, 0x29, 0xC0,
+	0xD0, 0x33, 0x01, 0x91,
+	0x0B, 0xD9, 0x19, 0x19,
+	0x00, 0x00, 0x00, 0x19,
+	0x99, 0x00, 0x00, 0x00,
+	0x00, 0xFF, 0xFF, 0xFF,
+};
+
+static char r69006_1080p_cmd_on_cmd17[] = {
+	0x1D, 0x00, 0x29, 0xC0,
+	0xD3, 0x1B, 0x3B, 0xBB,
+	0xAD, 0xA5, 0x33, 0x33,
+	0x33, 0x00, 0x80, 0xAD,
+	0xA8, 0x6f, 0x6f, 0x33,
+	0x33, 0x33, 0xF7, 0xF2,
+	0x1F, 0x7D, 0x7C, 0xFF,
+	0x0F, 0x99, 0x00, 0xFF,
+	0xFF, 0xFF, 0xFF, 0xFF,
+};
+
+static char r69006_1080p_cmd_on_cmd18[] = {
+	0x04, 0x00, 0x29, 0xC0,
+	0xD4, 0x57, 0x33, 0x03,
+};
+
+static char r69006_1080p_cmd_on_cmd19[] = {
+	0x0C, 0x00, 0x29, 0xC0,
+	0XD5, 0x66, 0x00, 0x00,
+	0x01, 0x27, 0x01, 0x27,
+	0x00, 0x6D, 0x00, 0x6D,
+};
+
+static char r69006_1080p_cmd_on_cmd20[] = {
+	0xD6, 0x81, 0x23, 0x80
+};
+
+static char r69006_1080p_cmd_on_cmd21[] = {
+	0x29, 0x00, 0x05, 0x80
+};
+
+static char r69006_1080p_cmd_on_cmd22[] = {
+	0x11, 0x00, 0x05, 0x80
+};
+
+static struct mipi_dsi_cmd r69006_1080p_cmd_on_command[] = {
+	{0x4, r69006_1080p_cmd_on_cmd0, 0x00},
+	{0xc, r69006_1080p_cmd_on_cmd1, 0x00},
+	{0x8, r69006_1080p_cmd_on_cmd2, 0x00},
+	{0x8, r69006_1080p_cmd_on_cmd3, 0x00},
+	{0x4, r69006_1080p_cmd_on_cmd4, 0x00},
+	{0x4, r69006_1080p_cmd_on_cmd5, 0x00},
+	{0x4, r69006_1080p_cmd_on_cmd6, 0x00},
+	{0x24, r69006_1080p_cmd_on_cmd7, 0x00},
+	{0x10, r69006_1080p_cmd_on_cmd8, 0x00},
+	{0x10, r69006_1080p_cmd_on_cmd9, 0x00},
+	{0xc, r69006_1080p_cmd_on_cmd10, 0x00},
+	{0x18, r69006_1080p_cmd_on_cmd11, 0x00},
+	{0x14, r69006_1080p_cmd_on_cmd12, 0x00},
+	{0x24, r69006_1080p_cmd_on_cmd13, 0x00},
+	{0x18, r69006_1080p_cmd_on_cmd14, 0x00},
+	{0x10, r69006_1080p_cmd_on_cmd15, 0x00},
+	{0x18, r69006_1080p_cmd_on_cmd16, 0x00},
+	{0x24, r69006_1080p_cmd_on_cmd17, 0x00},
+	{0x8, r69006_1080p_cmd_on_cmd18, 0x00},
+	{0x10, r69006_1080p_cmd_on_cmd19, 0x00},
+	{0x4, r69006_1080p_cmd_on_cmd20, 0x00},
+	{0x4, r69006_1080p_cmd_on_cmd21, 0x78},
+	{0x4, r69006_1080p_cmd_on_cmd22, 0x78}
+};
+
+#define R69006_1080P_CMD_ON_COMMAND 23
+
+
+static char r69006_1080p_cmdoff_cmd0[] = {
+	0x28, 0x00, 0x05, 0x80
+};
+
+static char r69006_1080p_cmdoff_cmd1[] = {
+	0x10, 0x00, 0x05, 0x80
+};
+
+static struct mipi_dsi_cmd r69006_1080p_cmd_off_command[] = {
+	{0x4, r69006_1080p_cmdoff_cmd0, 0x78},
+	{0x4, r69006_1080p_cmdoff_cmd1, 0x96}
+};
+
+#define R69006_1080P_CMD_OFF_COMMAND 2
+
+
+static struct command_state r69006_1080p_cmd_state = {
+	0, 1
+};
+
+/*---------------------------------------------------------------------------*/
+/* Command mode panel information                                            */
+/*---------------------------------------------------------------------------*/
+static struct commandpanel_info r69006_1080p_cmd_command_panel = {
+	1, 1, 1, 0, 0, 0x2c, 0, 0, 0, 1, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Video mode panel information                                              */
+/*---------------------------------------------------------------------------*/
+static struct videopanel_info r69006_1080p_cmd_video_panel = {
+	1, 0, 0, 0, 1, 1, 2, 0, 0x9
+};
+
+/*---------------------------------------------------------------------------*/
+/* Lane configuration                                                        */
+/*---------------------------------------------------------------------------*/
+static struct lane_configuration r69006_1080p_cmd_lane_config = {
+	4, 0, 1, 1, 1, 1, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel timing                                                              */
+/*---------------------------------------------------------------------------*/
+static const uint32_t r69006_1080p_cmd_timings[] = {
+	0x7d, 0x25, 0x1d, 0x00, 0x37, 0x33, 0x22, 0x27, 0x1e, 0x03, 0x04, 0x00
+};
+
+static struct panel_timing r69006_1080p_cmd_timing_info = {
+	0, 4, 0x20, 0x2c
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel reset sequence                                                      */
+/*---------------------------------------------------------------------------*/
+static struct panel_reset_sequence r69006_1080p_cmd_reset_seq = {
+	{1, 0, 1, }, {20, 2, 20, }, 2
+};
+
+/*---------------------------------------------------------------------------*/
+/* Backlight setting                                                         */
+/*---------------------------------------------------------------------------*/
+static struct backlight r69006_1080p_cmd_backlight = {
+	1, 1, 4095, 100, 1, "PMIC_8941"
+};
+
+#endif /*_PANEL_R69006_1080P_CMD_H_*/
diff --git a/dev/gcdb/display/include/panel_r69006_1080p_video.h b/dev/gcdb/display/include/panel_r69006_1080p_video.h
new file mode 100755
index 0000000..205df55
--- /dev/null
+++ b/dev/gcdb/display/include/panel_r69006_1080p_video.h
@@ -0,0 +1,317 @@
+/* Copyright (c) 2015, 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 met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *  * Neither the name of The Linux Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*---------------------------------------------------------------------------
+ * This file is autogenerated file using gcdb parser. Please do not edit it.
+ * Update input XML file to add a new entry or update variable in this file
+ * VERSION = "1.0"
+ *---------------------------------------------------------------------------*/
+
+#ifndef _PANEL_R69006_1080P_VIDEO_H_
+#define _PANEL_R69006_1080P_VIDEO_H_
+/*---------------------------------------------------------------------------*/
+/* HEADER files                                                              */
+/*---------------------------------------------------------------------------*/
+#include "panel.h"
+
+/*---------------------------------------------------------------------------*/
+/* Panel configuration                                                       */
+/*---------------------------------------------------------------------------*/
+static struct panel_config r69006_1080p_video_panel_data = {
+	"qcom,mdss_dsi_r69006_1080p_video", "dsi:0:", "qcom,mdss-dsi-panel",
+	10, 0, "DISPLAY_1", 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel resolution                                                          */
+/*---------------------------------------------------------------------------*/
+static struct panel_resolution r69006_1080p_video_panel_res = {
+	1080, 1920, 100, 82, 20, 0, 3, 9, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel color information                                                   */
+/*---------------------------------------------------------------------------*/
+static struct color_info r69006_1080p_video_color = {
+	24, 0, 0xff, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel on/off command information                                          */
+/*---------------------------------------------------------------------------*/
+static char r69006_1080p_video_on_cmd0[] = {
+	0XB0, 0x00, 0x23, 0x80
+};
+
+static char r69006_1080p_video_on_cmd1[] = {
+	0x06, 0x00, 0x29, 0xC0,
+	0XB3, 0x05, 0x10, 0x00,
+	0x00, 0x00, 0xFF, 0xFF,
+};
+
+static char r69006_1080p_video_on_cmd2[] = {
+	0x03, 0x00, 0x29, 0xC0,
+	0XB4, 0x0c, 0x00, 0xFF,
+};
+
+static char r69006_1080p_video_on_cmd3[] = {
+	0x04, 0x00, 0x29, 0xC0,
+	0XB6, 0x3b, 0xc3, 0x00,
+};
+
+static char r69006_1080p_video_on_cmd4[] = {
+	0XC0, 0x00, 0x23, 0x80
+};
+
+static char r69006_1080p_video_on_cmd5[] = {
+	0X36, 0x90, 0x15, 0x80
+};
+
+static char r69006_1080p_video_on_cmd6[] = {
+	0XCC, 0x04, 0x23, 0x80
+};
+
+static char r69006_1080p_video_on_cmd7[] = {
+	0x20, 0x00, 0x29, 0xC0,
+	0xC1, 0x84, 0x00, 0x10,
+	0xEF, 0x8B, 0xF1, 0xFF,
+	0xFF, 0xDF, 0x9C, 0xC5,
+	0x9A, 0x73, 0x8D, 0xAD,
+	0x63, 0xFE, 0xFF, 0xFF,
+	0xCB, 0xF8, 0x01, 0x00,
+	0xAA, 0x40, 0x00, 0xC2,
+	0x01, 0x08, 0x00, 0x01,
+};
+
+static char r69006_1080p_video_on_cmd8[] = {
+	0x0A, 0x00, 0x29, 0xC0,
+	0xCB, 0x0D, 0xFE, 0x1F,
+	0x2C, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0xFF, 0xFF,
+};
+
+static char r69006_1080p_video_on_cmd9[] = {
+	0x0B, 0x00, 0x29, 0xC0,
+	0xC2, 0x01, 0xF7, 0x80,
+	0x04, 0x63, 0x00, 0x60,
+	0x00, 0x01, 0x30, 0xFF,
+};
+
+static char r69006_1080p_video_on_cmd10[] = {
+	0x07, 0x00, 0x29, 0xC0,
+	0XC3, 0x55, 0x01, 0x00,
+	0x01, 0x00, 0x00, 0xFF,
+};
+
+static char r69006_1080p_video_on_cmd11[] = {
+	0x12, 0x00, 0x29, 0xC0,
+	0XC4, 0x70, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x02, 0x01,
+	0x00, 0x05, 0x01, 0x00,
+	0x00, 0x00, 0xFF, 0xFF,
+};
+
+static char r69006_1080p_video_on_cmd12[] = {
+	0x0F, 0x00, 0x29, 0xC0,
+	0xC6, 0x59, 0x07, 0x4a,
+	0x07, 0x4a, 0x01, 0x0E,
+	0x01, 0x02, 0x01, 0x02,
+	0x09, 0x15, 0x07, 0xFF,
+};
+
+static char r69006_1080p_video_on_cmd13[] = {
+	0x1F, 0x00, 0x29, 0xC0,
+	0XC7, 0x00, 0x30, 0x32,
+	0x34, 0x42, 0x4E, 0x56,
+	0x62, 0x44, 0x4A, 0x54,
+	0x62, 0x6B, 0x73, 0x7F,
+	0x08, 0x30, 0x32, 0x34,
+	0x42, 0x4E, 0x56, 0x62,
+	0x44, 0x4A, 0x54, 0x62,
+	0x6B, 0x73, 0x7F, 0xFF,
+};
+
+static char r69006_1080p_video_on_cmd14[] = {
+	0x14, 0x00, 0x29, 0xC0,
+	0xC8, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0xFC, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0xFC, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0xFC, 0x00,
+};
+
+static char r69006_1080p_video_on_cmd15[] = {
+	0x09, 0x00, 0x29, 0xC0,
+	0xC9, 0x1F, 0x68, 0x1F,
+	0x68, 0x4C, 0x4C, 0xC4,
+	0x11, 0xFF, 0xFF, 0xFF,
+};
+
+static char r69006_1080p_video_on_cmd16[] = {
+	0x11, 0x00, 0x29, 0xC0,
+	0xD0, 0x33, 0x01, 0x91,
+	0x0B, 0xD9, 0x19, 0x19,
+	0x00, 0x00, 0x00, 0x19,
+	0x99, 0x00, 0x00, 0x00,
+	0x00, 0xFF, 0xFF, 0xFF,
+};
+
+static char r69006_1080p_video_on_cmd17[] = {
+	0x1D, 0x00, 0x29, 0xC0,
+	0xD3, 0x1B, 0x3B, 0xBB,
+	0xAD, 0xA5, 0x33, 0x33,
+	0x33, 0x00, 0x80, 0xAD,
+	0xA8, 0x6f, 0x6f, 0x33,
+	0x33, 0x33, 0xF7, 0xF2,
+	0x1F, 0x7D, 0x7C, 0xFF,
+	0x0F, 0x99, 0x00, 0xFF,
+	0xFF, 0xFF, 0xFF, 0xFF,
+};
+
+static char r69006_1080p_video_on_cmd18[] = {
+	0x04, 0x00, 0x29, 0xC0,
+	0xD4, 0x57, 0x33, 0x03,
+};
+
+static char r69006_1080p_video_on_cmd19[] = {
+	0x0C, 0x00, 0x29, 0xC0,
+	0XD5, 0x66, 0x00, 0x00,
+	0x01, 0x27, 0x01, 0x27,
+	0x00, 0x6D, 0x00, 0x6D,
+};
+
+static char r69006_1080p_video_on_cmd20[] = {
+	0xD6, 0x81, 0x23, 0x80
+};
+
+static char r69006_1080p_video_on_cmd21[] = {
+	0x29, 0x00, 0x05, 0x80
+};
+
+static char r69006_1080p_video_on_cmd22[] = {
+	0x11, 0x00, 0x05, 0x80
+};
+
+static struct mipi_dsi_cmd r69006_1080p_video_on_command[] = {
+	{0x4, r69006_1080p_video_on_cmd0, 0x00},
+	{0xc, r69006_1080p_video_on_cmd1, 0x00},
+	{0x8, r69006_1080p_video_on_cmd2, 0x00},
+	{0x8, r69006_1080p_video_on_cmd3, 0x00},
+	{0x4, r69006_1080p_video_on_cmd4, 0x00},
+	{0x4, r69006_1080p_video_on_cmd5, 0x00},
+	{0x4, r69006_1080p_video_on_cmd6, 0x00},
+	{0x24, r69006_1080p_video_on_cmd7, 0x00},
+	{0x10, r69006_1080p_video_on_cmd8, 0x00},
+	{0x10, r69006_1080p_video_on_cmd9, 0x00},
+	{0xc, r69006_1080p_video_on_cmd10, 0x00},
+	{0x18, r69006_1080p_video_on_cmd11, 0x00},
+	{0x14, r69006_1080p_video_on_cmd12, 0x00},
+	{0x24, r69006_1080p_video_on_cmd13, 0x00},
+	{0x18, r69006_1080p_video_on_cmd14, 0x00},
+	{0x10, r69006_1080p_video_on_cmd15, 0x00},
+	{0x18, r69006_1080p_video_on_cmd16, 0x00},
+	{0x24, r69006_1080p_video_on_cmd17, 0x00},
+	{0x8, r69006_1080p_video_on_cmd18, 0x00},
+	{0x10, r69006_1080p_video_on_cmd19, 0x00},
+	{0x4, r69006_1080p_video_on_cmd20, 0x00},
+	{0x4, r69006_1080p_video_on_cmd21, 0x78},
+	{0x4, r69006_1080p_video_on_cmd22, 0x78}
+};
+
+#define R69006_1080P_VIDEO_ON_COMMAND 23
+
+
+static char r69006_1080p_videooff_cmd0[] = {
+	0x28, 0x00, 0x05, 0x80
+};
+
+static char r69006_1080p_videooff_cmd1[] = {
+	0x10, 0x00, 0x05, 0x80
+};
+
+static struct mipi_dsi_cmd r69006_1080p_video_off_command[] = {
+	{0x4, r69006_1080p_videooff_cmd0, 0x78},
+	{0x4, r69006_1080p_videooff_cmd1, 0x96}
+};
+
+#define R69006_1080P_VIDEO_OFF_COMMAND 2
+
+
+static struct command_state r69006_1080p_video_state = {
+	0, 1
+};
+
+/*---------------------------------------------------------------------------*/
+/* Command mode panel information                                            */
+/*---------------------------------------------------------------------------*/
+static struct commandpanel_info r69006_1080p_video_command_panel = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Video mode panel information                                              */
+/*---------------------------------------------------------------------------*/
+static struct videopanel_info r69006_1080p_video_video_panel = {
+	1, 0, 0, 0, 1, 1, 2, 0, 0x9
+};
+
+/*---------------------------------------------------------------------------*/
+/* Lane configuration                                                        */
+/*---------------------------------------------------------------------------*/
+static struct lane_configuration r69006_1080p_video_lane_config = {
+	4, 0, 1, 1, 1, 1, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel timing                                                              */
+/*---------------------------------------------------------------------------*/
+static const uint32_t r69006_1080p_video_timings[] = {
+	0x7d, 0x25, 0x1d, 0x00, 0x37, 0x33, 0x22, 0x27, 0x1e, 0x03, 0x04, 0x00
+};
+
+static struct panel_timing r69006_1080p_video_timing_info = {
+	0, 4, 0x20, 0x2c
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel reset sequence                                                      */
+/*---------------------------------------------------------------------------*/
+static struct panel_reset_sequence r69006_1080p_video_reset_seq = {
+	{1, 0, 1, }, {20, 2, 20, }, 2
+};
+
+/*---------------------------------------------------------------------------*/
+/* Backlight setting                                                         */
+/*---------------------------------------------------------------------------*/
+static struct backlight r69006_1080p_video_backlight = {
+	1, 1, 4095, 100, 1, "PMIC_8941"
+};
+
+#endif /*_PANEL_R69006_1080P_VIDEO_H_*/
diff --git a/dev/pmic/pmi8994/pm_app_smbchg.c b/dev/pmic/pmi8994/pm_app_smbchg.c
index 4b9693b..c3a03be 100644
--- a/dev/pmic/pmi8994/pm_app_smbchg.c
+++ b/dev/pmic/pmi8994/pm_app_smbchg.c
@@ -46,6 +46,9 @@
 #include <sys/types.h>
 #include <target.h>
 #include <pm8x41.h>
+#include <bits.h>
+#include <board.h>
+#include <smem.h>
 
 /*===========================================================================
 
@@ -80,13 +83,15 @@
 static bool display_initialized;
 static bool charge_in_progress;
 static bool display_shutdown_in_prgs;
+static bool pm_app_read_from_sram;
 
 char panel_name[256];
 
 pm_err_flag_type pm_smbchg_get_charger_path(uint32 device_index, pm_smbchg_usb_chgpth_pwr_pth_type* charger_path);
 pm_err_flag_type pm_appsbl_chg_config_vbat_low_threshold(uint32 device_index, pm_smbchg_specific_data_type *chg_param_ptr);
 static void display_thread_initialize();
-
+static void pm_app_ima_read_voltage(uint32_t *);
+static void pm_app_pmi8994_read_voltage(uint32_t *voltage);
 /*===========================================================================
 
                      FUNCTION IMPLEMENTATION
@@ -179,6 +184,20 @@
          err_flag |= pm_fg_adc_usr_get_calibrated_vbat(device_index, &vbat_adc); //Read calibrated vbatt ADC
          if ( err_flag != PM_ERR_FLAG__SUCCESS )  { break;}
 
+		/* FG_ADC hardware reports values that are off by ~120 to 200 mV, this results in boot up failures
+		 * on devices that boot up with battery close to threshold value. If the FG_ADC voltage is less than
+		 * threshold then read the voltage from a more accurate source FG SRAM to ascertain the voltage is indeed low.
+		 */
+		if (!pm_app_read_from_sram && (vbat_adc <= bootup_threshold))
+		{
+			if (board_pmic_type(PMIC_IS_PMI8996))
+				pm_app_ima_read_voltage(&vbat_adc);
+			else
+				pm_app_pmi8994_read_voltage(&vbat_adc);
+
+			pm_app_read_from_sram = true;
+		}
+
          //Check if ADC reading is within limit
          if ( vbat_adc >=  bootup_threshold)  //Compaire it with SW bootup threshold
          {
@@ -674,3 +693,160 @@
 		is_thread_start = true;
 	}
 }
+
+static void pm_app_wait_for_iacs_ready(uint32_t sid)
+{
+	uint8_t iacs;
+	int max_retry = 100;
+
+	udelay(50);
+	pm_comm_read_byte(sid, 0x4454, &iacs, 0);
+	while ((iacs & 0x02) == 0)
+	{
+		max_retry--;
+		pm_comm_read_byte(2, 0x4454, &iacs, 0);
+		mdelay(5);
+		if (!max_retry)
+		{
+			dprintf(CRITICAL, "Error: IACS not ready, shutting down\n");
+			shutdown_device();
+		}
+	}
+}
+
+static int pm_app_check_for_ima_exception(uint32_t sid)
+{
+	uint8_t ima_err_sts;
+	uint8_t ima_exception_sts;
+
+	pm_comm_read_byte(sid, 0x445f, &ima_err_sts, 0);
+	pm_comm_read_byte(sid, 0x4455, &ima_exception_sts, 0);
+
+	if (ima_err_sts != 0 || (ima_exception_sts & 0x1) == 1)
+	{
+		uint8_t ima_hw_sts;
+		pm_comm_read_byte(sid, 0x4456, &ima_hw_sts, 0);
+		dprintf(CRITICAL, "ima_err_sts: %x\tima_exception_sts:%x\tima_hw_sts:%x\n", ima_err_sts, ima_exception_sts, ima_hw_sts);
+		return 1;
+	}
+
+	return 0;
+}
+
+static void pm_app_ima_read_voltage(uint32_t *voltage)
+{
+	uint8_t start_beat_count;
+	uint8_t end_beat_count;
+	uint8_t vbat;
+	uint64_t vbat_adc = 0;
+	uint32_t sid = 2; //sid for pmi8996
+	int max_retry = 5;
+
+retry:
+	//Request IMA access
+	pm_comm_write_byte(sid, 0x4450, 0xA0, 0);
+	// Single read configure
+	pm_comm_write_byte(sid, 0x4451, 0x00, 0);
+
+	pm_app_wait_for_iacs_ready(sid);
+
+	//configure SRAM access
+	pm_comm_write_byte(sid, 0x4461, 0xCC, 0);
+	pm_comm_write_byte(sid, 0x4462, 0x05, 0);
+
+	pm_app_wait_for_iacs_ready(sid);
+
+	pm_comm_read_byte(sid, 0x4457, &start_beat_count, 0);
+
+	//Read the voltage
+	pm_comm_read_byte(sid, 0x4467, &vbat, 0);
+	vbat_adc = vbat;
+	pm_comm_read_byte(sid, 0x4468, &vbat, 0);
+	vbat_adc |= (vbat << 8);
+	pm_comm_read_byte(sid, 0x4469, &vbat, 0);
+	vbat_adc |= (vbat << 16);
+	pm_comm_read_byte(sid, 0x446A, &vbat, 0);
+	vbat_adc |= (vbat << 24);
+
+	pm_app_wait_for_iacs_ready(sid);
+
+	//Look for any errors
+	if(pm_app_check_for_ima_exception(sid))
+		goto err;
+
+	pm_comm_read_byte(sid, 0x4457, &end_beat_count, 0);
+
+	if (start_beat_count != end_beat_count)
+	{
+		max_retry--;
+		if (!max_retry)
+			goto err;
+		goto retry;
+	}
+
+	//Release the ima access
+	pm_comm_write_byte(2, 0x4450, 0x00, 0);
+
+	//extract the byte1 & byte2 and convert to mv
+	vbat_adc = ((vbat_adc & 0x00ffff00) >> 8) * 152587;
+	*voltage = vbat_adc / 1000000;
+	return;
+
+err:
+	dprintf(CRITICAL, "Failed to Read the Voltage from IMA, shutting down\n");
+	shutdown_device();
+}
+
+static void pm_app_pmi8994_read_voltage(uint32_t *voltage)
+{
+	uint8_t val = 0;
+	uint8_t vbat;
+	uint64_t vbat_adc = 0;
+	uint32_t sid = 2; //sid for pmi8994
+	int max_retry = 100;
+
+	pm_comm_read_byte(sid, 0x4440, &val, 0);
+
+	//Request for FG access
+	if ((val & BIT(7)) != 1)
+		pm_comm_write_byte(sid, 0x4440, 0x80, 0);
+
+	pm_comm_read_byte(sid, 0x4410, &val, 0);
+	while((val & 0x1) == 0)
+	{
+		//sleep and retry again, this takes up to 1.5 seconds
+		max_retry--;
+		mdelay(100);
+		pm_comm_read_byte(sid, 0x4410, &val, 0);
+		if (!max_retry)
+		{
+		  dprintf(CRITICAL, "Error: Failed to read from Fuel Guage, Shutting down\n");
+		  shutdown_device();
+		}
+	}
+
+	//configure single read access
+	pm_comm_write_byte(sid, 0x4441, 0x00, 0);
+	//configure SRAM for voltage shadow
+	pm_comm_write_byte(sid, 0x4442, 0xCC, 0);
+	pm_comm_write_byte(sid, 0x4443, 0x05, 0);
+
+	//Read voltage from SRAM
+	pm_comm_read_byte(sid, 0x444c, &vbat, 0);
+	vbat_adc = vbat;
+	pm_comm_read_byte(sid, 0x444d, &vbat, 0);
+	vbat_adc |= (vbat << 8);
+	pm_comm_read_byte(sid, 0x444e, &vbat, 0);
+	vbat_adc |= (vbat << 16);
+	pm_comm_read_byte(sid, 0x444f, &vbat, 0);
+	vbat_adc |= (vbat << 24);
+
+	//clean up to relase sram access
+	pm_comm_write_byte(sid, 0x4440, 0x00, 0);
+	//extract byte 1 & byte 2
+	vbat_adc = ((vbat_adc & 0x00ffff00) >> 8) * 152587;
+
+	//convert the voltage to mv
+	*voltage = vbat_adc / 1000000;
+}
+
diff --git a/platform/msm8996/include/platform/iomap.h b/platform/msm8996/include/platform/iomap.h
index 8aa0fab..2a31c8f 100644
--- a/platform/msm8996/include/platform/iomap.h
+++ b/platform/msm8996/include/platform/iomap.h
@@ -80,6 +80,7 @@
 
 #define AHB2_PHY_BASE               0x7416000
 #define PERIPH_SS_AHB2PHY_TOP_CFG   (AHB2_PHY_BASE + 0x10)
+#define GCC_RX2_USB2_CLKREF_EN      0x00388014
 
 /* Clocks */
 #define CLK_CTL_BASE                0x300000
diff --git a/platform/msm_shared/board.c b/platform/msm_shared/board.c
index 1265f29..8839a8a 100644
--- a/platform/msm_shared/board.c
+++ b/platform/msm_shared/board.c
@@ -400,6 +400,21 @@
 	return 0;
 }
 
+bool board_pmic_type(uint32_t type)
+{
+	uint8_t i;
+	if (format_major == 0x0 && format_minor >= 0x0B)
+	{
+		for (i = 0; i < SMEM_MAX_PMIC_DEVICES; i++)
+		{
+			if (type == (board.pmic_info_array[i].pmic_type & 0x0000ffff))
+				return true;
+		}
+	}
+
+	return false;
+}
+
 uint32_t board_pmic_target(uint8_t num_ent)
 {
 	if (format_major == 0x0 && num_ent < SMEM_MAX_PMIC_DEVICES)
diff --git a/platform/msm_shared/include/board.h b/platform/msm_shared/include/board.h
index 4d4c7a9..9a5db02 100644
--- a/platform/msm_shared/include/board.h
+++ b/platform/msm_shared/include/board.h
@@ -90,5 +90,5 @@
 
 uint32_t board_foundry_id(void);
 void board_update_boot_dev(uint32_t);
-
+bool board_pmic_type(uint32_t type);
 #endif
diff --git a/platform/msm_shared/include/qusb2_phy.h b/platform/msm_shared/include/qusb2_phy.h
index 1d5199a..fc971c8 100644
--- a/platform/msm_shared/include/qusb2_phy.h
+++ b/platform/msm_shared/include/qusb2_phy.h
@@ -34,6 +34,7 @@
 
 #define QUSB2PHY_PORT_POWERDOWN     (QUSB2_PHY_BASE + 0x000000B4)
 #define QUSB2PHY_PORT_UTMI_CTRL2    (QUSB2_PHY_BASE + 0x000000C4)
+#define QUSB2PHY_PLL_TEST           (QUSB2_PHY_BASE + 0x00000004)
 #define QUSB2PHY_PLL_TUNE           (QUSB2_PHY_BASE + 0x00000008)
 #define QUSB2PHY_PLL_USER_CTL1      (QUSB2_PHY_BASE + 0x0000000C)
 #define QUSB2PHY_PLL_USER_CTL2      (QUSB2_PHY_BASE + 0x00000010)
@@ -42,6 +43,8 @@
 #define QUSB2PHY_PORT_TUNE3         (QUSB2_PHY_BASE + 0x00000088)
 #define QUSB2PHY_PORT_TUNE4         (QUSB2_PHY_BASE + 0x0000008C)
 #define QUSB2PHY_PORT_TEST2         (QUSB2_PHY_BASE + 0x0000009C)
+#define QUSB2PHY_PLL_PWR_CTL        (QUSB2_PHY_BASE + 0x00000018)
+#define QUSB2PHY_PLL_AUTOPGM_CTL1   (QUSB2_PHY_BASE + 0x0000001C)
 
 
 #endif
diff --git a/platform/msm_shared/include/rpmb.h b/platform/msm_shared/include/rpmb.h
index 58f40a6..8e9f148 100644
--- a/platform/msm_shared/include/rpmb.h
+++ b/platform/msm_shared/include/rpmb.h
@@ -136,5 +136,4 @@
 int rpmb_write(uint32_t *req_buf, uint32_t blk_cnt, uint32_t rel_wr_count, uint32_t *resp_buf, uint32_t *resp_len);
 int rpmb_read(uint32_t *req_buf, uint32_t blk_cnt, uint32_t *resp_buf, uint32_t *resp_len);
 struct rpmb_init_info *rpmb_get_init_info();
-int rpmb_get_app_handle();
 #endif
diff --git a/platform/msm_shared/qmp_usb30_phy.c b/platform/msm_shared/qmp_usb30_phy.c
index 91aed89..56b009a 100644
--- a/platform/msm_shared/qmp_usb30_phy.c
+++ b/platform/msm_shared/qmp_usb30_phy.c
@@ -107,7 +107,7 @@
 	{0x508, 0x77}, /* QSERDES_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1 */
 	{0x50c, 0x80}, /* QSERDES_RX_RX_OFFSET_ADAPTOR_CNTRL2 */
 	{0x514, 0x03}, /* QSERDES_RX_SIGDET_CNTRL */
-	{0x518, 0x1b}, /* QSERDES_RX_SIGDET_LVL */
+	{0x518, 0x18}, /* QSERDES_RX_SIGDET_LVL */
 	{0x51c, 0x16}, /* QSERDES_RX_SIGDET_DEGLITCH_CNTRL */
 
 	/* Tx settings */
@@ -135,6 +135,7 @@
 struct qmp_reg qmp_misc_settings_rev2[] =
 {
 	{0x178, 0x01}, /* QSERDES_COM_HSCLK_SEL */
+	{0x518, 0x1B}, /* QSERDES_RX_SIGDET_LVL */
 	{0xC4, 0x15}, /* USB3PHY_QSERDES_COM_RESCODE_DIV_NUM */
 	{0x1B8, 0x1F}, /* QSERDES_COM_CMN_MISC2 */
 };
diff --git a/platform/msm_shared/qusb2_phy.c b/platform/msm_shared/qusb2_phy.c
index 871bbcc..8981df7 100644
--- a/platform/msm_shared/qusb2_phy.c
+++ b/platform/msm_shared/qusb2_phy.c
@@ -77,12 +77,15 @@
 			tune2 = (tune2 & 0x0f) | (fuse_val << 4);
 #endif
 		writel(tune2, QUSB2PHY_PORT_TUNE2);
-		writel(0x93, QUSB2PHY_PORT_TUNE3);
+		writel(0x83, QUSB2PHY_PORT_TUNE3);
 		writel(0xC0, QUSB2PHY_PORT_TUNE4);
 		writel(0x30, QUSB2PHY_PLL_TUNE);
 		writel(0x79, QUSB2PHY_PLL_USER_CTL1);
 		writel(0x21, QUSB2PHY_PLL_USER_CTL2);
 		writel(0x14, QUSB2PHY_PORT_TEST2);
+		writel(0x80, QUSB2PHY_PLL_TEST);
+		writel(0x9F, QUSB2PHY_PLL_AUTOPGM_CTL1);
+		writel(0x00, QUSB2PHY_PLL_PWR_CTL);
 	}
 	else
 	{
diff --git a/platform/msm_shared/rpmb/rpmb.c b/platform/msm_shared/rpmb/rpmb.c
index 8ddfbd3..e0c94d3 100644
--- a/platform/msm_shared/rpmb/rpmb.c
+++ b/platform/msm_shared/rpmb/rpmb.c
@@ -36,7 +36,6 @@
 
 
 static void *dev;
-static int app_handle;
 struct rpmb_init_info info;
 
 int rpmb_init()
@@ -94,7 +93,6 @@
 		dprintf(CRITICAL, "Error registering the handler\n");
 		goto err;
 	}
-	rpmb_get_app_handle();
 
 err:
 	return ret;
@@ -142,7 +140,7 @@
 
 	/* Read the device info */
 	arch_clean_invalidate_cache_range((addr_t) info, sz);
-	ret = qseecom_send_command(app_handle, (void*) &read_req, sizeof(read_req), (void*) &read_rsp, sizeof(read_rsp));
+	ret = qseecom_send_command(get_secapp_handle(), (void*) &read_req, sizeof(read_req), (void*) &read_rsp, sizeof(read_rsp));
 	arch_invalidate_cache_range((addr_t) info, sz);
 
 	if (ret < 0 || read_rsp.status < 0)
@@ -167,7 +165,7 @@
 
 	/* Write the device info */
 	arch_clean_invalidate_cache_range((addr_t) info, sz);
-	ret = qseecom_send_command(app_handle, (void *)&write_req, sizeof(write_req), (void *)&write_rsp, sizeof(write_rsp));
+	ret = qseecom_send_command(get_secapp_handle(), (void *)&write_req, sizeof(write_req), (void *)&write_rsp, sizeof(write_rsp));
 	arch_invalidate_cache_range((addr_t) info, sz);
 
 	if (ret < 0 || write_rsp.status < 0)
@@ -179,12 +177,6 @@
 	return 0;
 }
 
-int rpmb_get_app_handle()
-{
-	app_handle = get_secapp_handle();
-	return app_handle;
-}
-
 int rpmb_uninit()
 {
 	int ret = 0;
diff --git a/platform/msm_shared/smem.h b/platform/msm_shared/smem.h
index 5e3ae4b..278a0eb 100644
--- a/platform/msm_shared/smem.h
+++ b/platform/msm_shared/smem.h
@@ -141,7 +141,6 @@
 	PMIC_IS_PMI8950   = 17,
 	PMIC_IS_PMI8994   = 10,
 	PMIC_IS_PMI8996   = 19,
-
 } pm_model_type_bfly;
 
 struct smem_board_info_v3 {
diff --git a/project/msm8996.mk b/project/msm8996.mk
index 6a3973f..4c5d6a1 100644
--- a/project/msm8996.mk
+++ b/project/msm8996.mk
@@ -103,3 +103,8 @@
 
 #enable battery voltage check
 DEFINES += CHECK_BAT_VOLTAGE=1
+# Enable unit test FW
+ENABLE_UNITTEST_FW=1
+ifeq ($(ENABLE_UNITTEST_FW),1)
+DEFINES += UNITTEST_FW_SUPPORT=1
+endif
diff --git a/target/msm8996/init.c b/target/msm8996/init.c
index 100e429..ff7fe0c 100644
--- a/target/msm8996/init.c
+++ b/target/msm8996/init.c
@@ -323,6 +323,12 @@
 		ASSERT(0);
 	}
 
+	if (rpmb_init() < 0)
+	{
+		dprintf(CRITICAL, "RPMB init failed\n");
+		ASSERT(0);
+	}
+
 	/*
 	 * Load the sec app for first time
 	 */
@@ -331,12 +337,6 @@
 		dprintf(CRITICAL, "Failed to load App for verified\n");
 		ASSERT(0);
 	}
-
-	if (rpmb_init() < 0)
-	{
-		dprintf(CRITICAL, "RPMB init failed\n");
-		ASSERT(0);
-	}
 }
 
 unsigned board_machtype(void)