From 0be996e85a48c133fae60014636e3f4c19486293 Mon Sep 17 00:00:00 2001 From: Hong Liu Date: Tue, 6 Mar 2012 17:04:29 +0800 Subject: [PATCH] hwmon/ltr502als: add shutdown method 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 Reviewed-on: http://android.intel.com:8080/37762 Reviewed-by: Wang, Zhifeng Reviewed-by: Du, Alek Tested-by: Wang, Zhifeng Reviewed-by: buildbot Tested-by: buildbot --- drivers/hwmon/ltr502als.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/hwmon/ltr502als.c b/drivers/hwmon/ltr502als.c index e868a02..b594e76 100644 --- a/drivers/hwmon/ltr502als.c +++ b/drivers/hwmon/ltr502als.c @@ -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) -- 2.7.4