misc: nct: re enable suspend/resume with proper power on delay
Sri Krishna chowdary [Tue, 8 Jan 2013 05:44:07 +0000 (10:44 +0530)]
Bug 1205034
Bug 1219601

Change-Id: I66581a022f42517bb9cd08ca49cdf57a28deb322
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/189429
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Jinyoung Park <jinyoungp@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>

drivers/misc/nct1008.c

index 58f7499..fd0c997 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Driver for NCT1008, temperature monitoring device from ON Semiconductors
  *
- * Copyright (c) 2010-2012, NVIDIA Corporation.
+ * Copyright (c) 2010-2013, NVIDIA CORPORATION. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -79,6 +79,8 @@
 #define CELSIUS_TO_MILLICELSIUS(x) ((x)*1000)
 #define MILLICELSIUS_TO_CELSIUS(x) ((x)/1000)
 
+#define POWER_ON_DELAY 20 /*ms*/
+
 struct nct1008_data {
        struct workqueue_struct *workqueue;
        struct work_struct work;
@@ -890,7 +892,7 @@ static void nct1008_power_control(struct nct1008_data *data, bool is_enable)
        }
        if (is_enable) {
                ret = regulator_enable(data->nct_reg);
-               usleep_range(100, 1000);
+               msleep(POWER_ON_DELAY);
        } else {
                ret = regulator_disable(data->nct_reg);
        }
@@ -1207,7 +1209,7 @@ static void nct1008_shutdown(struct i2c_client *client)
        data->shutdown_complete = 1;
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int nct1008_suspend(struct device *dev)
 {
        struct i2c_client *client = to_i2c_client(dev);
@@ -1257,6 +1259,9 @@ MODULE_DEVICE_TABLE(i2c, nct1008_id);
 static struct i2c_driver nct1008_driver = {
        .driver = {
                .name   = "nct1008_nct72",
+#ifdef CONFIG_PM_SLEEP
+               .pm = &nct1008_pm_ops,
+#endif
        },
        .probe          = nct1008_probe,
        .remove         = __devexit_p(nct1008_remove),