intel_mid_power_off: modified charger detection
authorGabriel Touzeau <gabrielx.touzeau@intel.com>
Thu, 26 Apr 2012 07:53:11 +0000 (09:53 +0200)
committerbuildbot <buildbot@intel.com>
Mon, 30 Apr 2012 23:25:42 +0000 (16:25 -0700)
BZ: 31318

Shutdown with SDP/CDP/DCP cable connected shall NOT RESET the system and enter
in Charging MODE
This shall be done ONLY with ACDC Charger
Signed-off-by: Gabriel Touzeau <gabrielx.touzeau@intel.com>
Change-Id: If6c8fc667930bd94f26493755eab36648182ec2e
Reviewed-on: http://android.intel.com:8080/46358
Reviewed-by: Pallala, Ramakrishna <ramakrishna.pallala@intel.com>
Tested-by: Romieu, Benoit <benoit.romieu@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
arch/x86/platform/intel-mid/mfld.c

index e25cc6e..1d3e61d 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/module.h>
 #include <linux/notifier.h>
 #include <linux/intel_mid_pm.h>
-#include <linux/usb/penwell_otg.h>
+#include <linux/power_supply.h>
 #include <linux/intel_pmic_gpio.h>
 #include <linux/lnw_gpio.h>
 #include <linux/gpio.h>
 #include <asm/reboot.h>
 
 
-#define MSIC_POWER_SRC_STAT 0x192
-#define MSIC_POWER_BATT (1 << 0)
-#define MSIC_POWER_USB  (1 << 1)
-
-static bool check_charger_conn(void)
-{
-       int ret;
-       struct otg_bc_cap cap;
-       u8 data;
-
-       ret = intel_scu_ipc_ioread8(MSIC_POWER_SRC_STAT, &data);
-       if (ret)
-               return false;
-
-       if (!((data & MSIC_POWER_BATT) && (data & MSIC_POWER_USB)))
-               return false;
-
-       ret = penwell_otg_query_charging_cap(&cap);
-       if (ret)
-               return false;
-
-       if (cap.chrg_type == CHRG_UNKNOWN)
-               return false;
-
-       return true;
-}
-
 void intel_mid_power_off(void)
 {
 #ifdef CONFIG_INTEL_MID_OSIP
-       bool charger_conn = check_charger_conn();
-       if (!get_force_shutdown_occured() && charger_conn) {
+       if (!get_force_shutdown_occured() &&
+       power_supply_is_system_supplied()) {
                /*
                 * Do a cold reset to let bootloader bring up the
                 * platform into acting dead mode to continue