target : msm8952: add helper function to check power key press

MSM8952 based platforms should read the PON bits in addition
to the Key Press bits to get the PON reason.
Added function to return the appropriate PON reason accordingly.

Change-Id: I68673d583afdf668ded9a4baf5eece84db6c3a08
diff --git a/include/target.h b/include/target.h
index 772afdf..2a3579a 100644
--- a/include/target.h
+++ b/include/target.h
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2008 Travis Geiselbrecht
  *
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files
@@ -79,6 +79,7 @@
 void target_usb_stop(void);
 uint32_t target_get_hlos_subtype(void);
 void shutdown_device();
+uint32_t target_is_pwrkey_pon_reason(void);
 bool target_warm_boot(void);
 bool target_use_signed_kernel(void);
 int _emmc_recovery_init(void);
diff --git a/target/msm8952/init.c b/target/msm8952/init.c
index 1f4f60c..c77cd39 100644
--- a/target/msm8952/init.c
+++ b/target/msm8952/init.c
@@ -194,6 +194,15 @@
 	return pm8x41_resin_status();
 }
 
+uint32_t target_is_pwrkey_pon_reason()
+{
+	uint8_t pon_reason = pm8950_get_pon_reason();
+	if (pm8x41_get_is_cold_boot() && ((pon_reason == KPDPWR_N) || (pon_reason == (KPDPWR_N|PON1))))
+		return 1;
+	else
+		return 0;
+}
+
 static void target_keystatus()
 {
 	keys_init();