hwmon/ltr502als: add shutdown method
authorHong Liu <hong.liu@intel.com>
Tue, 6 Mar 2012 09:04:29 +0000 (17:04 +0800)
committerbuildbot <buildbot@intel.com>
Thu, 15 Mar 2012 22:18:35 +0000 (15:18 -0700)
BZ: 10605

Shutdown the device during system reboot, in some circumstances if system
is doing reboot while device is power on, the device may enter into unknown
state, not acking any i2c transactions. Shutdowning the device seems help
to avoid this issue.

Change-Id: I2b6b6b5924a8aeffba06cabd32ac92984b1249e8
Signed-off-by: Hong Liu <hong.liu@intel.com>
Reviewed-on: http://android.intel.com:8080/37762
Reviewed-by: Wang, Zhifeng <zhifeng.wang@intel.com>
Reviewed-by: Du, Alek <alek.du@intel.com>
Tested-by: Wang, Zhifeng <zhifeng.wang@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/hwmon/ltr502als.c

index e868a02..b594e76 100644 (file)
@@ -837,6 +837,16 @@ fail_irq:
        return ret;
 }
 
+void ltr502als_shutdown(struct i2c_client *client)
+{
+       struct alsps_device *alsps = i2c_get_clientdata(client);
+
+       dev_info(&client->dev, "enter %s\n", __func__);
+
+       /* shutdown the device during system reboot */
+       alsps_write(alsps, CONFIGREG, POWER_DOWN);
+}
+
 static int __exit ltr502als_remove(struct i2c_client *client)
 {
        struct alsps_device *alsps = i2c_get_clientdata(client);
@@ -871,6 +881,7 @@ static struct i2c_driver ltr502als_driver = {
        .id_table = ltr502als_id,
        .probe = ltr502als_probe,
        .remove = ltr502als_remove,
+       .shutdown = ltr502als_shutdown,
 };
 
 static int __init ltr502als_i2c_init(void)