adt7411: set reserved bit
PATCH 1/1 adt7411: set reserved bit
This patch set the reserved bit in cfg1 register.
This bit should be 1 at startup but it's not.
Signed-off-by Rini <[email protected]>
--- drivers/hwmon/adt7411.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/hwmon/adt7411.c +10 -0
@@ -31,6 +31,7 @@#define ADT7411_REG_CFG1 0x18#define ADT7411_CFG1_START_MONITOR (1 << 0) +#define ADT7411_CFG1_RESERVED (1 << 3)#define ADT7411_REG_CFG2 0x19#define ADT7411_CFG2_DISABLE_AVG (1 << 5)
@@ -291,6 +292,15 @@ static int __devinit adt7411_probe(struct i2c_client *client,mutex_init (&data->device_lock);mutex_init (&data->update_lock); +/* +* reserved bit should be 1, despite document say it's 1 at powerup +* it's not. Gives bad values at input3 when 0 +*/ + ret =adt7411_modify_bit (client,ADT7411_REG_CFG1 , +ADT7411_CFG1_RESERVED ,1 ); +if (ret <0 ) + goto exit_free; + ret =adt7411_modify_bit (client,ADT7411_REG_CFG1 ,ADT7411_CFG1_START_MONITOR ,1 );if (ret <0 )
Signature · 7 lines
1.7.0.4 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 2 lines · Rini
This patch set the reserved bit in cfg1 register.
This bit should be 1 at startup but it's not.
And what is the problem with this? And what's your hardware?
Quoted 2 lines
Signed-off-by Rini <[email protected]>
We need a full name for kernel contributions, sorry.
Quoted 22 lines
--- drivers/hwmon/adt7411.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)drivers/hwmon/adt7411.c +3
-0@@ -31,6 +31,7 @@#define ADT7411_REG_CFG1 0x18#define ADT7411_CFG1_START_MONITOR (1 << 0) +#define ADT7411_CFG1_RESERVED (1 << 3)#define ADT7411_REG_CFG2 0x19#define ADT7411_CFG2_DISABLE_AVG (1 << 5)@@ -291,6 +292,15 @@ static int __devinit adt7411_probe(struct i2c_client *client,mutex_init (&data->device_lock);mutex_init (&data->update_lock); +/* +* reserved bit should be 1, despite document say it's 1 at powerup
drivers/hwmon/adt7411.c static int __devinit adt7411_probe(struct i2c_client *client, · line 306
Quoted 10 lines
drivers/hwmon/adt7411.c +7
-0+* it's not. Gives bad values at input3 when 0 +*/ + ret =adt7411_modify_bit (client,ADT7411_REG_CFG1 , +ADT7411_CFG1_RESERVED ,1 ); +if (ret <0 ) + goto exit_free; + ret =adt7411_modify_bit (client,ADT7411_REG_CFG1 ,ADT7411_CFG1_START_MONITOR ,1 );if (ret <0 )
This is inefficient: you read and write the same register twice in a row. It would be much better to read it once, modify all bits and write it once.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors