* [lm-sensors] [PATCH] adt7411: set reserved bit
@ 2010-10-21 13:44 Rini
2010-10-21 13:54 ` Jean Delvare
0 siblings, 1 reply; 2+ messages in thread
From: Rini @ 2010-10-21 13:44 UTC (permalink / raw)
To: lm-sensors
This patch set the reserved bit in cfg1 register.
This bit should be 1 at startup but it's not.
Signed-off-by: Rini <rini@arvoo.nl>
---
drivers/hwmon/adt7411.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/hwmon/adt7411.c b/drivers/hwmon/adt7411.c
index f13c843..c516876 100644
--- a/drivers/hwmon/adt7411.c
+++ b/drivers/hwmon/adt7411.c
@@ -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)
--
1.7.0.4
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [lm-sensors] [PATCH] adt7411: set reserved bit
2010-10-21 13:44 [lm-sensors] [PATCH] adt7411: set reserved bit Rini
@ 2010-10-21 13:54 ` Jean Delvare
0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2010-10-21 13:54 UTC (permalink / raw)
To: lm-sensors
On Thu, 21 Oct 2010 15:44:41 +0200, Rini wrote:
> 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?
>
> Signed-off-by: Rini <rini@arvoo.nl>
We need a full name for kernel contributions, sorry.
> ---
> drivers/hwmon/adt7411.c | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/hwmon/adt7411.c b/drivers/hwmon/adt7411.c
> index f13c843..c516876 100644
> --- a/drivers/hwmon/adt7411.c
> +++ b/drivers/hwmon/adt7411.c
> @@ -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)
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.
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-21 13:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-21 13:44 [lm-sensors] [PATCH] adt7411: set reserved bit Rini
2010-10-21 13:54 ` Jean Delvare
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.