diff mbox series

[2/3] tmp105: OS (one-shot) bit in configuration register always returns 0

Message ID 20240906132912.3826089-3-linux@roeck-us.net (mailing list archive)
State New, archived
Headers show
Series tmp105: Improvements and fixes | expand

Commit Message

Guenter Roeck Sept. 6, 2024, 1:29 p.m. UTC
Per datasheet, "ONE-SHOT (OS)", the OS bit always returns 0 when reading
the configuration register.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 hw/sensor/tmp105.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé Sept. 6, 2024, 3:48 p.m. UTC | #1
Hi Guenter,

On 6/9/24 15:29, Guenter Roeck wrote:
> Per datasheet, "ONE-SHOT (OS)", the OS bit always returns 0 when reading
> the configuration register.
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>   hw/sensor/tmp105.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c
> index 77fbf2f8d3..22728798f7 100644
> --- a/hw/sensor/tmp105.c
> +++ b/hw/sensor/tmp105.c
> @@ -133,7 +133,7 @@ static void tmp105_read(TMP105State *s)
>           break;
>   
>       case TMP105_REG_CONFIG:
> -        s->buf[s->len++] = s->config;
> +        s->buf[s->len++] = s->config & 0x7f;

LGTM but I'll post an alternative v2 clearing the bit in
the WRITE path.

>           break;
>   
>       case TMP105_REG_T_LOW:
diff mbox series

Patch

diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c
index 77fbf2f8d3..22728798f7 100644
--- a/hw/sensor/tmp105.c
+++ b/hw/sensor/tmp105.c
@@ -133,7 +133,7 @@  static void tmp105_read(TMP105State *s)
         break;
 
     case TMP105_REG_CONFIG:
-        s->buf[s->len++] = s->config;
+        s->buf[s->len++] = s->config & 0x7f;
         break;
 
     case TMP105_REG_T_LOW: