summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-01-15 04:30:20 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-01-15 04:30:20 -0800
commit1e39ee97a8a79aebdefbf443771d281682565121 (patch)
tree0440563d789d125b22d8829e2bf71c39cf6b207b
parent2d63dc3518c19f179bec9fa8b25803fa59433253 (diff)
parentc5f47d924feaa9408b5c45828472289b6d99c114 (diff)
Merge "dev:pmi, target: check Usb connection for power off charging"
-rw-r--r--dev/pmic/pmi8994/include/pm_app_smbchg.h1
-rw-r--r--dev/pmic/pmi8994/pm_app_smbchg.c1
-rw-r--r--target/msm8996/init.c13
3 files changed, 11 insertions, 4 deletions
diff --git a/dev/pmic/pmi8994/include/pm_app_smbchg.h b/dev/pmic/pmi8994/include/pm_app_smbchg.h
index 81a7b39f..0a55b992 100644
--- a/dev/pmic/pmi8994/include/pm_app_smbchg.h
+++ b/dev/pmic/pmi8994/include/pm_app_smbchg.h
@@ -202,5 +202,6 @@ bool pm_appsbl_display_init_done();
bool pm_appsbl_charging_in_progress();
pm_err_flag_type pm_appsbl_set_dcin_suspend();
bool pm_app_display_shutdown_in_prgs();
+pm_err_flag_type pm_smbchg_get_charger_path(uint32 device_index, pm_smbchg_usb_chgpth_pwr_pth_type* charger_path);
#endif //PM_APP_SMBCHG__H
diff --git a/dev/pmic/pmi8994/pm_app_smbchg.c b/dev/pmic/pmi8994/pm_app_smbchg.c
index c3a03be0..7ee25d97 100644
--- a/dev/pmic/pmi8994/pm_app_smbchg.c
+++ b/dev/pmic/pmi8994/pm_app_smbchg.c
@@ -87,7 +87,6 @@ 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 *);
diff --git a/target/msm8996/init.c b/target/msm8996/init.c
index cae6c326..70edc282 100644
--- a/target/msm8996/init.c
+++ b/target/msm8996/init.c
@@ -73,6 +73,8 @@
#define VIBRATE_TIME 250
#endif
+#include <pm_smbchg_usb_chgpth.h>
+
#define CE_INSTANCE 1
#define CE_EE 0
#define CE_FIFO_SIZE 64
@@ -565,17 +567,22 @@ unsigned target_pause_for_battery_charge(void)
{
uint8_t pon_reason = pm8x41_get_pon_reason();
uint8_t is_cold_boot = pm8x41_get_is_cold_boot();
- dprintf(INFO, "%s : pon_reason is %d cold_boot:%d\n", __func__,
- pon_reason, is_cold_boot);
+ pm_smbchg_usb_chgpth_pwr_pth_type charger_path = PM_SMBCHG_USB_CHGPTH_PWR_PATH__INVALID;
+ dprintf(INFO, "%s : pon_reason is %d cold_boot:%d charger path: %d\n", __func__,
+ pon_reason, is_cold_boot, charger_path);
/* In case of fastboot reboot,adb reboot or if we see the power key
* pressed we do not want go into charger mode.
* fastboot reboot is warm boot with PON hard reset bit not set
* adb reboot is a cold boot with PON hard reset bit set
*/
+ pm_smbchg_get_charger_path(1, &charger_path);
if (is_cold_boot &&
(!(pon_reason & HARD_RST)) &&
(!(pon_reason & KPDPWR_N)) &&
- ((pon_reason & PON1)))
+ ((pon_reason & PON1)) &&
+ ((charger_path == PM_SMBCHG_USB_CHGPTH_PWR_PATH__DC_CHARGER) ||
+ (charger_path == PM_SMBCHG_USB_CHGPTH_PWR_PATH__USB_CHARGER)))
+
return 1;
else
return 0;