Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139057
b: refs/heads/master
c: e4879e2
h: refs/heads/master
i:
  139055: 969b7d4
v: v3
  • Loading branch information
Jean Delvare committed Mar 30, 2009
1 parent df39634 commit f11227f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 594592dc6f68356a3b7278eb4d260a50a66f0a06
refs/heads/master: e4879e28abd67b894fb9d2db0afd08f1945670ba
15 changes: 9 additions & 6 deletions trunk/drivers/hwmon/ds1621.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,20 @@ static int ds1621_write_temp(struct i2c_client *client, u8 reg, u16 value)

static void ds1621_init_client(struct i2c_client *client)
{
int reg = i2c_smbus_read_byte_data(client, DS1621_REG_CONF);
u8 conf, new_conf;

new_conf = conf = i2c_smbus_read_byte_data(client, DS1621_REG_CONF);
/* switch to continuous conversion mode */
reg &= ~ DS1621_REG_CONFIG_1SHOT;
new_conf &= ~DS1621_REG_CONFIG_1SHOT;

/* setup output polarity */
if (polarity == 0)
reg &= ~DS1621_REG_CONFIG_POLARITY;
new_conf &= ~DS1621_REG_CONFIG_POLARITY;
else if (polarity == 1)
reg |= DS1621_REG_CONFIG_POLARITY;
new_conf |= DS1621_REG_CONFIG_POLARITY;

i2c_smbus_write_byte_data(client, DS1621_REG_CONF, reg);
if (conf != new_conf)
i2c_smbus_write_byte_data(client, DS1621_REG_CONF, new_conf);

/* start conversion */
i2c_smbus_write_byte(client, DS1621_COM_START);
Expand Down Expand Up @@ -170,7 +173,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct i2c_client *client = to_i2c_client(dev);
struct ds1621_data *data = ds1621_update_client(dev);
struct ds1621_data *data = i2c_get_clientdata(client);
u16 val = LM75_TEMP_TO_REG(simple_strtol(buf, NULL, 10));

mutex_lock(&data->update_lock);
Expand Down

0 comments on commit f11227f

Please sign in to comment.