Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 209421
b: refs/heads/master
c: 9914518
h: refs/heads/master
i:
  209419: 852a331
v: v3
  • Loading branch information
Shubhrajyoti Datta authored and Jean Delvare committed Aug 14, 2010
1 parent a7a0c51 commit 6dcf1bb
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 960f12f4d1eb5ba3c76dc6b57a909a65dd59e1c2
refs/heads/master: 9914518e79800c977e20eda1335d43a4df813e3d
39 changes: 39 additions & 0 deletions trunk/drivers/hwmon/lm75.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,49 @@ static int lm75_detect(struct i2c_client *new_client,
return 0;
}

#ifdef CONFIG_PM
static int lm75_suspend(struct device *dev)
{
int status;
struct i2c_client *client = to_i2c_client(dev);
status = lm75_read_value(client, LM75_REG_CONF);
if (status < 0) {
dev_dbg(&client->dev, "Can't read config? %d\n", status);
return status;
}
status = status | LM75_SHUTDOWN;
lm75_write_value(client, LM75_REG_CONF, status);
return 0;
}

static int lm75_resume(struct device *dev)
{
int status;
struct i2c_client *client = to_i2c_client(dev);
status = lm75_read_value(client, LM75_REG_CONF);
if (status < 0) {
dev_dbg(&client->dev, "Can't read config? %d\n", status);
return status;
}
status = status & ~LM75_SHUTDOWN;
lm75_write_value(client, LM75_REG_CONF, status);
return 0;
}

static const struct dev_pm_ops lm75_dev_pm_ops = {
.suspend = lm75_suspend,
.resume = lm75_resume,
};
#define LM75_DEV_PM_OPS (&lm75_dev_pm_ops)
#else
#define LM75_DEV_PM_OPS NULL
#endif /* CONFIG_PM */

static struct i2c_driver lm75_driver = {
.class = I2C_CLASS_HWMON,
.driver = {
.name = "lm75",
.pm = LM75_DEV_PM_OPS,
},
.probe = lm75_probe,
.remove = lm75_remove,
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/hwmon/lm75.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
/* straight from the datasheet */
#define LM75_TEMP_MIN (-55000)
#define LM75_TEMP_MAX 125000
#define LM75_SHUTDOWN 0x01

/* TEMP: 0.001C/bit (-55C to +125C)
REG: (0.5C/bit, two's complement) << 7 */
Expand Down

0 comments on commit 6dcf1bb

Please sign in to comment.