intel_mdf_battery: move .suspend/.resume to .prepare/.complete
authorIllyas Mansoor <illyas.mansoor@intel.com>
Mon, 18 Jun 2012 17:58:51 +0000 (23:28 +0530)
committerbuildbot <buildbot@intel.com>
Wed, 27 Jun 2012 19:07:59 +0000 (12:07 -0700)
BZ: 42523

Medfield battery driver stops and starts the charger health monitoring
workqueue, this issues a lot of IPC commands and interferes with D0ix
transitions that are happening during system suspend/resume, causing
SCU contention and in rare cases d0ix transition timeouts.

Fixing this by moving the .suspend/.resume callbacks to .prepare/.complete

Added a delay during scheduling the workqueue in complete().

Change-Id: Iab4ce37e12bc1f3c3b4b530692bfe129fa64bb8f
Signed-off-by: Illyas Mansoor <illyas.mansoor@intel.com>
Reviewed-on: http://android.intel.com:8080/53244
Reviewed-by: Tc, Jenny <jenny.tc@intel.com>
Reviewed-by: Tang, Richard <richard.tang@intel.com>
Reviewed-by: Hogander, Jouni <jouni.hogander@intel.com>
Reviewed-by: Jena, TapanX <tapanx.jena@intel.com>
Reviewed-by: Pallala, Ramakrishna <ramakrishna.pallala@intel.com>
Tested-by: Kallappa Manjanna, MadhukumarX <madhukumarx.kallappa.manjanna@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/power/intel_mdf_battery.c

index 8440d24..191c0c9 100644 (file)
@@ -3040,7 +3040,7 @@ static int battery_reboot_notifier_callback(struct notifier_block *notifier,
 }
 
 #ifdef CONFIG_PM
-static int msic_battery_suspend(struct device *dev)
+static int msic_battery_prepare(struct device *dev)
 {
        struct msic_power_module_info *mbi = dev_get_drvdata(dev);
        int event;
@@ -3061,7 +3061,7 @@ static int msic_battery_suspend(struct device *dev)
        return 0;
 }
 
-static int msic_battery_resume(struct device *dev)
+static void msic_battery_complete(struct device *dev)
 {
        int retval = 0;
        struct msic_power_module_info *mbi = dev_get_drvdata(dev);
@@ -3079,12 +3079,12 @@ static int msic_battery_resume(struct device *dev)
                        dev_warn(msic_dev, "check_charger_conn failed\n");
        }
 
-       schedule_delayed_work(&mbi->chr_status_monitor, 0);
-       return retval;
+       schedule_delayed_work(&mbi->chr_status_monitor, msecs_to_jiffies(1000));
+       return;
 }
 #else
-#define msic_battery_suspend    NULL
-#define msic_battery_resume     NULL
+#define msic_battery_prepare   NULL
+#define msic_battery_complete  NULL
 #endif
 
 #ifdef CONFIG_PM_RUNTIME
@@ -3140,8 +3140,8 @@ static const struct ipc_device_id battery_id_table[] = {
 };
 
 static const struct dev_pm_ops msic_batt_pm_ops = {
-       .suspend = msic_battery_suspend,
-       .resume = msic_battery_resume,
+       .prepare = msic_battery_prepare,
+       .complete = msic_battery_complete,
        .runtime_suspend = msic_runtime_suspend,
        .runtime_resume = msic_runtime_resume,
        .runtime_idle = msic_runtime_idle,