Added support for weakVIN handling during charger unplug. Summary of Changes: When we receive weakVIN we are setting the charger_health to DEAD, But we may get weakVIN in case of USB mass storage also. if we get weakVIN in case of charger we are considering this as unplug. So for weakVIN we dont need to set the charger health to DEAD.
Sometimes if we do usb charger unplug we are getting weakVIN interrupt instead of USBDET unplug interrupt. So as SW workaround we check charging mode and USB Status bit and stop the charging cycle Signed-off-by: Ramakrishna Pallala <[email protected]> --- drivers/power/intel_mdf_battery.c | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/power/intel_mdf_battery.c b/drivers/power/intel_mdf_battery.c index 45821c2..5ad78c2 100644 --- a/drivers/power/intel_mdf_battery.c +++ b/drivers/power/intel_mdf_battery.c @@ -1350,8 +1350,6 @@ static void msic_handle_exception(struct msic_power_module_info *mbi, msic_log_exception_event(exception); } if (CHRINT1_reg_value & MSIC_BATT_CHR_WKVINDET_MASK) { - mbi->usb_chrg_props.charger_health = - POWER_SUPPLY_HEALTH_DEAD; exception = MSIC_EVENT_WEAKVIN_EXCPT; msic_log_exception_event(exception); } @@ -2095,6 +2093,7 @@ static irqreturn_t msic_battery_thread_handler(int id, void *dev) unsigned char data[2]; struct msic_power_module_info *mbi = dev; u32 tmp; + unsigned char intr_stat; /* We have only one concurrent fifo reader * and only one concurrent writer, we are not @@ -2123,6 +2122,26 @@ static irqreturn_t msic_battery_thread_handler(int id, void *dev) if (data[1] & MSIC_BATT_CHR_CHRCMPLT_MASK) dev_dbg(msic_dev, "CHRG COMPLT\n"); + if (data[1] & MSIC_BATT_CHR_WKVINDET_MASK) { + dev_dbg(msic_dev, "CHRG WeakVIN Detected\n"); + + spin_lock(&mbi->event_lock); + tmp = mbi->charging_mode; + spin_unlock(&mbi->event_lock); + /* Somtimes for USB unplug we are recieving WeakVIN + * interrupts,So as SW work around we will check the + * SPWRSRCINT SUSBDET bit to know teh USB connection. + */ + ret = intel_scu_ipc_ioread8(MSIC_BATT_CHR_SPWRSRCINT_ADDR, + &intr_stat); + if (!(intr_stat & MSIC_BATT_CHR_USBDET_MASK) && + (tmp != BATT_CHARGING_MODE_NONE)) { + data[1] &= ~MSIC_BATT_CHR_WKVINDET_MASK; + dev_dbg(msic_dev, "force disconnect event\n"); + msic_charger_callback(mbi, USBCHRG_EVENT_DISCONN, NULL); + } + } + /* Check if an exception occured */ if (data[0] || (data[1] & ~(MSIC_BATT_CHR_CHRCMPLT_MASK))) { msic_handle_exception(mbi, data[0], data[1]); -- 1.7.2.3
0003-Patch-3-3-MSIC-Battery-Added-support-for-weakVIN-han.patch
Description: 0003-Patch-3-3-MSIC-Battery-Added-support-for-weakVIN-han.patch
_______________________________________________ MeeGo-kernel mailing list [email protected] http://lists.meego.com/listinfo/meego-kernel
