diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2010-08-12 14:47:24 +0530 |
---|---|---|
committer | Gary King <gking@nvidia.com> | 2010-08-29 14:45:54 -0700 |
commit | 7741beea207d8c45514ebb27e71056a672efbd84 (patch) | |
tree | 96e37ed1f8cfc6ea7aef619e41956c5b35ccf9fa /drivers | |
parent | 91c5af5df99b5c5753998fb2e3b4ea07af23ef07 (diff) |
[driver/sensor] lm90: Adding suspend-resume for nct1008.
Suspending the device nct1008 before going to suspend
and reconfiguring at the time of system resume.
This is implemneted for the nct1008 which is adt7461 type
device.
Change-Id: Iecfb33819d0427e2ab2bb1f8eed0066222e5793f
Reviewed-on: http://git-master/r/4800
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Tested-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Suresh Mangipudi <smangipudi@nvidia.com>
Tested-by: Suresh Mangipudi <smangipudi@nvidia.com>
Reviewed-by: Gary King <gking@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hwmon/lm90.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index ba920feb9aca..2968b4b35a0c 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c @@ -159,6 +159,9 @@ static int lm90_probe(struct i2c_client *client, static void lm90_init_client(struct i2c_client *client); static int lm90_remove(struct i2c_client *client); static struct lm90_data *lm90_update_device(struct device *dev); +static int lm90_suspend(struct i2c_client *client, pm_message_t mesg); +static int lm90_resume(struct i2c_client *client); + /* * Driver data (common to all clients) @@ -191,6 +194,8 @@ static struct i2c_driver lm90_driver = { }, .probe = lm90_probe, .remove = lm90_remove, + .resume = lm90_resume, + .suspend = lm90_suspend, .id_table = lm90_id, .detect = lm90_detect, .address_data = &addr_data, @@ -220,6 +225,7 @@ struct lm90_data { 4: local input */ u8 temp_hyst; u8 alarms; /* bitvector */ + u8 config; }; /* @@ -905,6 +911,7 @@ static void lm90_init_client(struct i2c_client *client) config &= 0xBF; /* run */ if (config != config_orig) /* Only write if changed */ i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1, config); + data->config = config; } static int lm90_remove(struct i2c_client *client) @@ -922,6 +929,23 @@ static int lm90_remove(struct i2c_client *client) return 0; } +static int lm90_suspend(struct i2c_client *client, pm_message_t mesg) +{ + struct lm90_data *data = i2c_get_clientdata(client); + /* Configure to suspend if it is adt7461 type device */ + if (data->kind == adt7461) + i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1, 40); + return 0; +} + +static int lm90_resume(struct i2c_client *client) +{ + struct lm90_data *data = i2c_get_clientdata(client); + if (data->kind == adt7461) + i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1, data->config); + return 0; +} + static int lm90_read16(struct i2c_client *client, u8 regh, u8 regl, u16 *value) { int err; |