From patchwork Fri Sep 6 13:29:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 13794184 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3120CE7B10 for ; Fri, 6 Sep 2024 13:30:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smZ1l-0003rl-4x; Fri, 06 Sep 2024 09:29:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smZ1f-0003eQ-7S for qemu-devel@nongnu.org; Fri, 06 Sep 2024 09:29:23 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smZ1d-0008NI-4c for qemu-devel@nongnu.org; Fri, 06 Sep 2024 09:29:22 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-718d6ad6050so562897b3a.0 for ; Fri, 06 Sep 2024 06:29:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725629359; x=1726234159; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=SYphLTmWYoD1OpVt2MG2OURnM5QTnUzwhzadnnyJCxk=; b=KyUlsfwYzJybqf7C8KLyNYayFIQmdZMdzgKWQpmXSwgQUc9v+AUiwoIg1OleeF5brp lsffrX8LqIFDoEFhcKZvYlAN2DYVH5gzbfTW6+PsESMzD0a2Ws/xaNV2owQUNUHv0puY zxwebX2P+MJlfjhmaMy+DlLsYm9BjXx1eccNsLnp9zaYG63LNQz1eLPxFtrk2y5cnQca UVL2blJJAUN1TUpaJVEuYMhjJKA0b5QV49Idi0tOD85/MHOorClqaMhpYBOScxfkEtP1 T49/4ggOWI2VYVdWXCAgmX4Vh08JbNkYWTjK6O0vpdPE7G68v20A+Mw17bgo6wPU6R++ 5vYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629359; x=1726234159; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=SYphLTmWYoD1OpVt2MG2OURnM5QTnUzwhzadnnyJCxk=; b=XcsM50WB4JZxVI9Qug0AV9/kjE6EmRnaelZN8HyDkX5Ruprsl1DarjVxGoIrHo/s0P hx86Ln3baJrLpjoCfN07aUHVDxkPN0QmsjO+7Skak4Eu5Ja8y4DKGKjT59Us3ONtinjc h04RbBV/Gy33KRQkcezjH5QS9FQF7W+TInUK7P7wC4q/ZoA4S4hmHTZL8pHU08rVcPI4 lygqkimvWwreupYAChXe4I+5JaNcSNc8be69gc0QZfiCHhPLSvlKPFlH1+kT4/PN8Jou PTeH+VKLAwlC/AbjCNMSd8UJk+XUfC/cVWzAplTPiF5Tubs7hc8IsDmw3M9uTRc4avrI mS7w== X-Gm-Message-State: AOJu0YwvpXB2Z/IFXvs/7KDsPxRXRIOiY3IFGQ4IUqIpo202q1q9QkZc 6qtKqaDPCQ6HGhmCBNJGdFgiLdAImi3F2v7ngw/lhr7NNzduxHtUEGtEOQ== X-Google-Smtp-Source: AGHT+IED6bX7w+elN5FYsoj1ZU1cMFPM3Yw71A497bvjLCZYMB7MKPYk6l5s3UA3rwDtURMWcDnRuA== X-Received: by 2002:a05:6a20:ac44:b0:1cc:9ff8:eb3a with SMTP id adf61e73a8af0-1cf1d059a66mr2526143637.4.1725629359236; Fri, 06 Sep 2024 06:29:19 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-718dd6461fasm605341b3a.202.2024.09.06.06.29.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:29:18 -0700 (PDT) From: Guenter Roeck To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Guenter Roeck Subject: [PATCH 1/3] tmp105: Coding style fixes Date: Fri, 6 Sep 2024 06:29:10 -0700 Message-ID: <20240906132912.3826089-2-linux@roeck-us.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240906132912.3826089-1-linux@roeck-us.net> References: <20240906132912.3826089-1-linux@roeck-us.net> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=groeck7@gmail.com; helo=mail-pf1-x42f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Coding style asks for no space between variable and "++". The next patch in this series will change one of those assignments. Instead of changing just one with that patch, change all of them for consistency. While at it, also fix other coding style problems reported by checkpatch. Signed-off-by: Guenter Roeck --- hw/sensor/tmp105.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index a8730d0b7f..77fbf2f8d3 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -29,16 +29,17 @@ static void tmp105_interrupt_update(TMP105State *s) { - qemu_set_irq(s->pin, s->alarm ^ ((~s->config >> 2) & 1)); /* POL */ + qemu_set_irq(s->pin, s->alarm ^ ((~s->config >> 2) & 1)); /* POL */ } static void tmp105_alarm_update(TMP105State *s) { - if ((s->config >> 0) & 1) { /* SD */ - if ((s->config >> 7) & 1) /* OS */ - s->config &= ~(1 << 7); /* OS */ - else + if ((s->config >> 0) & 1) { /* SD */ + if ((s->config >> 7) & 1) { /* OS */ + s->config &= ~(1 << 7); /* OS */ + } else { return; + } } if (s->config >> 1 & 1) { @@ -89,7 +90,8 @@ static void tmp105_get_temperature(Object *obj, Visitor *v, const char *name, visit_type_int(v, name, &value, errp); } -/* Units are 0.001 centigrades relative to 0 C. s->temperature is 8.8 +/* + * Units are 0.001 centigrades relative to 0 C. s->temperature is 8.8 * fixed point, so units are 1/256 centigrades. A simple ratio will do. */ static void tmp105_set_temperature(Object *obj, Visitor *v, const char *name, @@ -118,30 +120,30 @@ static void tmp105_read(TMP105State *s) { s->len = 0; - if ((s->config >> 1) & 1) { /* TM */ + if ((s->config >> 1) & 1) { /* TM */ s->alarm = 0; tmp105_interrupt_update(s); } switch (s->pointer & 3) { case TMP105_REG_TEMPERATURE: - s->buf[s->len ++] = (((uint16_t) s->temperature) >> 8); - s->buf[s->len ++] = (((uint16_t) s->temperature) >> 0) & - (0xf0 << ((~s->config >> 5) & 3)); /* R */ + s->buf[s->len++] = (((uint16_t) s->temperature) >> 8); + s->buf[s->len++] = (((uint16_t) s->temperature) >> 0) & + (0xf0 << ((~s->config >> 5) & 3)); /* R */ break; case TMP105_REG_CONFIG: - s->buf[s->len ++] = s->config; + s->buf[s->len++] = s->config; break; case TMP105_REG_T_LOW: - s->buf[s->len ++] = ((uint16_t) s->limit[0]) >> 8; - s->buf[s->len ++] = ((uint16_t) s->limit[0]) >> 0; + s->buf[s->len++] = ((uint16_t) s->limit[0]) >> 8; + s->buf[s->len++] = ((uint16_t) s->limit[0]) >> 0; break; case TMP105_REG_T_HIGH: - s->buf[s->len ++] = ((uint16_t) s->limit[1]) >> 8; - s->buf[s->len ++] = ((uint16_t) s->limit[1]) >> 0; + s->buf[s->len++] = ((uint16_t) s->limit[1]) >> 8; + s->buf[s->len++] = ((uint16_t) s->limit[1]) >> 0; break; } } @@ -153,10 +155,10 @@ static void tmp105_write(TMP105State *s) break; case TMP105_REG_CONFIG: - if (s->buf[0] & ~s->config & (1 << 0)) /* SD */ + if (s->buf[0] & ~s->config & (1 << 0)) /* SD */ printf("%s: TMP105 shutdown\n", __func__); s->config = s->buf[0]; - s->faults = tmp105_faultq[(s->config >> 3) & 3]; /* F */ + s->faults = tmp105_faultq[(s->config >> 3) & 3]; /* F */ tmp105_alarm_update(s); break; @@ -175,7 +177,7 @@ static uint8_t tmp105_rx(I2CSlave *i2c) TMP105State *s = TMP105(i2c); if (s->len < 2) { - return s->buf[s->len ++]; + return s->buf[s->len++]; } else { return 0xff; } @@ -215,7 +217,7 @@ static int tmp105_post_load(void *opaque, int version_id) { TMP105State *s = opaque; - s->faults = tmp105_faultq[(s->config >> 3) & 3]; /* F */ + s->faults = tmp105_faultq[(s->config >> 3) & 3]; /* F */ tmp105_interrupt_update(s); return 0; From patchwork Fri Sep 6 13:29:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 13794193 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2F7C9CE7B10 for ; Fri, 6 Sep 2024 13:31:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smZ25-0004Pn-9g; Fri, 06 Sep 2024 09:29:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smZ1g-0003gu-G0 for qemu-devel@nongnu.org; Fri, 06 Sep 2024 09:29:24 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smZ1e-0008Nb-V9 for qemu-devel@nongnu.org; Fri, 06 Sep 2024 09:29:24 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-71798a15ce5so1037381b3a.0 for ; Fri, 06 Sep 2024 06:29:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725629361; x=1726234161; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=Ua6iXDxKUBr7o/WWA42XxNhrwoqsmd6/uR8lhmhMlkc=; b=afaqDZVQIzXjjIezdVBoTQITvinnTnMtMP1Fs5UdJTY+IEMxjfd0j4r9jXEwtFuOe1 FCMz4Sxpfl/EbA1GBgjMsdX6soLKatYIzGAFj+Pwb1Mi4n3truSKuE+Kf2ghdoHzwUh0 kpHgTpw252Q/CEBGVcNWneN065e8fPiP6Iao0LfjbfCPtmMWlBRwbL0Eq5kE6RhrD2h+ 8nbyk4W6T9ZnVPwRYex06JbT7fEAaqiIceNxXE+r7lazpm3igYLQL0J+u4bOVStaP2Wg PQ3msvf1gnXE/IKAhWMe4y+ihxx885qeZTqDOTHXBTo5MzzBYo6TKTJNH6FXV0R/cYfP fcnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629361; x=1726234161; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Ua6iXDxKUBr7o/WWA42XxNhrwoqsmd6/uR8lhmhMlkc=; b=w0SC75+NT3jDpMnobGylh7b1oRF0fvsuBjGuEHAYju3PlQEldZ3vWeHCpoYKvqaxqQ jlneAt39r1HIUbMVmRXlGluh6kTzr5hYd0mthYuFoOWUOw8reNxgBpgwtsLJ5BuC5ZQW CBmdASycWTMaaoyhNdmwI5Px7rTlHXaMf8VrPL+GnO5pDiNeahcVBWcPUdyCbTWYJFpE Xc5fVoVv0QPz4W62embZNXMRzzaw87KABkz2kLSA6YWAfOW2ENIZWWCCOujjVAq1eJQ0 1+gwUCdEzmsijkTYKWkwIp5oX5zFXcVQq0upRZKu25cAFrh8MvPnGT3r0wObThnhN2RK 7Vbw== X-Gm-Message-State: AOJu0Yxe8irm29WNJ1mL1/HESoXQLiXB2ktKpS2Fe1LJqBKh9vMRLvmy txe1dEKfMp9oG2+RQWQHvfoAb3UHkccp+o05zQQvkRDJ+tVkJtDECDNDvg== X-Google-Smtp-Source: AGHT+IFdHX1kl7apzhRu8xyY/loiKYdL/v4L0AGPm/Ze+Hgzjq/oJ0RZOXaeunsXYH0Rc8X40J4dHg== X-Received: by 2002:a05:6a21:e8c:b0:1cf:126c:3b77 with SMTP id adf61e73a8af0-1cf1c12aa84mr4118403637.25.1725629360990; Fri, 06 Sep 2024 06:29:20 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-718d516444csm1438199b3a.149.2024.09.06.06.29.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:29:20 -0700 (PDT) From: Guenter Roeck To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Guenter Roeck Subject: [PATCH 2/3] tmp105: OS (one-shot) bit in configuration register always returns 0 Date: Fri, 6 Sep 2024 06:29:11 -0700 Message-ID: <20240906132912.3826089-3-linux@roeck-us.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240906132912.3826089-1-linux@roeck-us.net> References: <20240906132912.3826089-1-linux@roeck-us.net> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=groeck7@gmail.com; helo=mail-pf1-x432.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Per datasheet, "ONE-SHOT (OS)", the OS bit always returns 0 when reading the configuration register. Signed-off-by: Guenter Roeck --- 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; break; case TMP105_REG_T_LOW: From patchwork Fri Sep 6 13:29:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 13794194 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45A66CE7B10 for ; Fri, 6 Sep 2024 13:31:57 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smZ1t-0004IT-7j; Fri, 06 Sep 2024 09:29:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smZ1j-0003oB-2M for qemu-devel@nongnu.org; Fri, 06 Sep 2024 09:29:28 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smZ1h-0008O0-FO for qemu-devel@nongnu.org; Fri, 06 Sep 2024 09:29:26 -0400 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2d87a1f0791so1432638a91.2 for ; Fri, 06 Sep 2024 06:29:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725629363; x=1726234163; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=MJiwXDwz+nyTyxWqXsY+0vn8Yh51cYsH0PxbsAp2eNI=; b=KTWAdBNt4HZ+8bFQEQ/LL+UtH1nTig3OYtpfmG5cwPFnDhYPWnAM9tRxKGXD4O7wCH IPQVC6z9FLX5moqSZx4HCIM84FMwyfn8uJKjq9txNSj9aNWrgpN2PO8mh3Mw/IAtllOE zAoOOuOT3jj5d+przxloQprFb4lKuYpVeRaDNZvWm9Dusc2e2rFbWvf7kFpVlHZ8iN1b LOfTjZK2IeimeKUqcENNnLybDe+kO0OOQs5YluhDXkvivOgIzpHrEbr6Ey0ZmWpeX5td P8FkKhfSFoEqOKofQfeQCrRqYOcbKWu1o9zECylg+VSAGLde8baWAT4uxsmkePZgQXL5 sU5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629363; x=1726234163; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=MJiwXDwz+nyTyxWqXsY+0vn8Yh51cYsH0PxbsAp2eNI=; b=qd4H1qtR6dDJs1Znd3glx+lU4RuFuSmFJMXxcDE2NMQEzzJKKDLiog2b1P2WXzObgE vS5FzFzn+1O08hU6SJU16bpNL0EWd0BD69TsIUD0AnRJj6ltl05F2rjmt7/elCeuue7R D/eC6arPVMDkWLJ86dBBS+L2nw7tRU3tBxgCBGztgO9qdfj0G8rCFpib1p1nVzYKcF/s CYABjscy6ItXsWWcKf+hCHDUXFtpvGGQtA+TdRDv+prv/qhhA75YN8IIRUtIht75edtW eW5KShE2vQT9aJ67QhBPoVYx/i7GCgda04MZ1ssiZqDgnzJVjGvGCuDGrTukLSwFPRXM q/ww== X-Gm-Message-State: AOJu0YynHl4vE/q3xUGjsqQtH0hHjMMK16GD4X81obmOgZqaoiUex5bD Ss0h9mCIifTJ31Rf5eIDnzT1Kjrd7+bpG5Qv9NFpSgEXPp+Yzy/uE35XpQ== X-Google-Smtp-Source: AGHT+IHXUM4+mIx95aGi23jUKm5KMGhSUMSXBUuTM3Ra51fhTBXzNCLZU9OG+34RyUZGq46D8Fh6BQ== X-Received: by 2002:a17:90b:390f:b0:2d3:de40:d767 with SMTP id 98e67ed59e1d1-2dad5022ae7mr3156645a91.24.1725629363074; Fri, 06 Sep 2024 06:29:23 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2dadc03d1f5sm1520384a91.26.2024.09.06.06.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:29:22 -0700 (PDT) From: Guenter Roeck To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Guenter Roeck Subject: [PATCH 3/3] tmp105: Lower 4 bit of limit registers are always 0 Date: Fri, 6 Sep 2024 06:29:12 -0700 Message-ID: <20240906132912.3826089-4-linux@roeck-us.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240906132912.3826089-1-linux@roeck-us.net> References: <20240906132912.3826089-1-linux@roeck-us.net> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=groeck7@gmail.com; helo=mail-pj1-x102e.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Per datasheet, "HIGH AND LOW LIMIT REGISTERS", the lower 4 bit of the limit registers are unused and always report 0. The lower 4 bit should not be used for temperature comparisons, so mask the unused bits before storing the limits. Signed-off-by: Guenter Roeck --- 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 22728798f7..5fd30f8d50 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -166,7 +166,7 @@ static void tmp105_write(TMP105State *s) case TMP105_REG_T_HIGH: if (s->len >= 3) s->limit[s->pointer & 1] = (int16_t) - ((((uint16_t) s->buf[0]) << 8) | s->buf[1]); + ((((uint16_t) s->buf[0]) << 8) | (s->buf[1] & 0xf0)); tmp105_alarm_update(s); break; }