Merge remote-tracking branch master into MHB

* master:
  app: aboot: move display shutdown before uninit
  platform: msm8996: Add QUSB ref clock
  platform: msm_shared: Update SIGDET_LVL for qmp phy
  platform: msm_shared: Update phy sequence for qusb
  platform: msm_shared: Add support for pmic type API
  dev: pmi8994: Add support to read battery voltage from sram
  app: aboot: Add support for tests framework

Change-Id: I78dd0fb4e2006328dbf1449f102dca779d60f164
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 4911344..5067181 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;
@@ -1108,7 +1110,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))
@@ -1125,6 +1131,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
@@ -3439,6 +3448,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
 						};
 
@@ -3492,7 +3504,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())