[PORT FROM R2]Battery: ignore the LOWBATT INT in case of charger connected
authorsantosh <santoshx.gugwad@intel.com>
Thu, 23 Feb 2012 10:13:15 +0000 (15:43 +0530)
committerbuildbot <buildbot@intel.com>
Tue, 28 Feb 2012 07:15:38 +0000 (23:15 -0800)
BZ: 21057

This patch adds the logic to check for charger connection upon
LOWBATT INT. If the charger is connected LOWBATT INT will be
ignored else driver will set the battery health to Dead.

Change-Id: Ice88315c9f591ca977a5f79bf8604cb8552e8b0e
Orig-Change-Id: Ie35f9e9b1b42e8bac50b2a5c89e3b4053d8fecd8
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: santosh <santoshx.gugwad@intel.com>
Reviewed-on: http://android.intel.com:8080/36394
Reviewed-by: Kuppuswamy, Sathyanarayanan <sathyanarayanan.kuppuswamy@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/power/intel_mdf_battery.c

index 2f65d72..2741c55 100644 (file)
@@ -962,7 +962,8 @@ static void msic_handle_exception(struct msic_power_module_info *mbi,
        }
 
        if (CHRINT_reg_value & MSIC_BATT_CHR_LOWBATT_MASK) {
-               health = POWER_SUPPLY_HEALTH_DEAD;
+               if (!mbi->usb_chrg_props.charger_present)
+                       health = POWER_SUPPLY_HEALTH_DEAD;
                exception = MSIC_EVENT_LOWBATT_EXCPT;
                msic_log_exception_event(exception);
        }
@@ -2171,7 +2172,8 @@ static irqreturn_t msic_battery_thread_handler(int id, void *dev)
         * on LOWBATT INT, So no need to service LOWBATT INT
         * afterwards and increase the load on CPU.
         */
-       if (data[0] & MSIC_BATT_CHR_LOWBATT_MASK) {
+       if ((data[0] & MSIC_BATT_CHR_LOWBATT_MASK) &&
+                       !mbi->usb_chrg_props.charger_present) {
                dev_warn(msic_dev, "Masking LOWBATTINT\n");
                mbi->chrint_mask |= MSIC_BATT_CHR_LOWBATT_MASK;
                ret = intel_scu_ipc_iowrite8(MSIC_BATT_CHR_MCHRINT_ADDR,