From patchwork Thu Sep 12 06:52:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 827777 Delivered-To: patch@linaro.org Received: by 2002:adf:ab1c:0:b0:367:895a:4699 with SMTP id q28csp1127609wrc; Wed, 11 Sep 2024 23:52:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX/aFpS7QO83u+nielpb6+7j6OaRbs0wdvPxuvAnjUp2RjXPUV5rvbn2/xFE8GPm5Z0z/wmSA==@linaro.org X-Google-Smtp-Source: AGHT+IEHuiyTSDzk1lBpimaiPH1PEr2EHFrWcNV9QY+Y3EKzilWMGfTOQ6oe03+qJhllVwoLQVZt X-Received: by 2002:a05:620a:1917:b0:7a9:ba49:8b25 with SMTP id af79cd13be357-7a9e5f934d2mr319172385a.42.1726123978553; Wed, 11 Sep 2024 23:52:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726123978; cv=none; d=google.com; s=arc-20240605; b=GRW3fwMJpe8XeGSFIy2hYRTh9VJvS9VEWH66zq0lVWek7Bv3iC7wLqRPvKA/axU8YE YCXnOnKpyhkbFDPMGkqBAP6aM5sQ1aqBnSOUehG/9MOWLfCpblIrQ20/fepqfV05FCgN sLkIKwjGGVrDiIOTmpk42GWs+jHse7OAwWKEbgKF9LXbAYccCM/bv4ROkLA1/EdNy/rj DPt3WAsk/LNK/cwmxKRIwDNUCTjDON6rpZDXmdDCCQZJvAfEyhaVcAyillZ53N1w00bD dHJFLco1t9DYY+jqpqg9ky12GlDuIByiGxbOoeFDT/erVceHxF7FbZSi7gZ+SrhuRDil ncgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=V5BN+QwDDBigOpVAkHKfRD9kl52tOEsyOrGfIU6uf3I=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=SGGk2DMSmhjCRjWr3eFjkLof/ZMkq4r7xif2QKe9cyeOEdExhX/NZLDRtPcKVea/gr eS5CmKNfgIHl8sUg0HZDTgc31Lgxg3FIH6tthM00BxscdOG+bj+OShdf76CzZfUsJWGu lWFToKstpv4Yz112VkrHjKjPEs2728nDUnWII4ko0GE/98R/HMkASQodi4cEsIiqYUFW WOULfoYCEVJnsjpbVEBbiFHOziT+8JX/13s8hQbEdkstD5uLuwphlirEw/VV+qo6juK5 zcjqu6TNrD7vZIZcl3xzbRbuXZIDJXMiQll+4Gp/WUWBO1acBM400CaVRA5p+L3u4q2Z xHOQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="fgD/Ppqm"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a9a79c65acsi1245907185a.25.2024.09.11.23.52.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Sep 2024 23:52:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="fgD/Ppqm"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sodhG-0004VY-8N; Thu, 12 Sep 2024 02:52:54 -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 1sodhE-0004Py-S4 for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:52:52 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sodhC-0003R3-IH for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:52:52 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-42cb6f3a5bcso6203995e9.2 for ; Wed, 11 Sep 2024 23:52:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726123968; x=1726728768; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=V5BN+QwDDBigOpVAkHKfRD9kl52tOEsyOrGfIU6uf3I=; b=fgD/Ppqm2kWBOy2kW376Ib9pzFf5aj5jWbob5uuZ8Ec5tvcsznAD0ahaz81yC8FO3i zbKME9gB46Vq1rridUA7sov3OxkdIdJVRZGAcXOtpqU+rFX3mNRzXdk5iOJBdrZdXOJM UBdSmzzSiUDCYQunwLGmlU6Rsw1ek16bMd2SKURpj/ygOyaU6qtS54pk+AoDC2jfCC7Q TkPnWTuHgp6jYMTWQp67T1exkGJM+VexWFkBHaZUc38jN2A+7WWYNyTXKMFUcWaYkdsg UuYbmh7NtqwySYoG8nKfmOAQgLXnbcVseM1uoxQapCShMzV0g5vHHOsNSuu0nIqalQXC AuJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726123968; x=1726728768; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V5BN+QwDDBigOpVAkHKfRD9kl52tOEsyOrGfIU6uf3I=; b=o3ht71DMfeDzxf3Cmd8w9fzgm8r7vrrKK2n8/MXY5qzjnToHZEPWyR6ko5SppjvPRJ 1JYaxFNk2cG4FVw5YVPlKwSEvp9Eqn7HyFoFk5bRWXqVj64hspnoUDC4Vn45e7z6untR KzpzFs9QeY10EvM4sWt+qYVxxDZpyM12q0F8RsBEgUU0nAWAUxafzCPVKn/TDAq7cU/x VSVjsJV5Rx5WDrS/uaGoBCZacgnkPpp64fOduaflA3+2mMPlhmopwetio+C9MUM4it24 L1vrn/8rMW5oHg2vowYYLX0O7MZy3YdiQicc4AQT9HTcxsxnXCiy1I/tS5JbzkJmWA6t oraw== X-Gm-Message-State: AOJu0Yyb6tfY4msLmMR3KxbCEvUKX0vljY1VZDWjaYUqUg3Gt2yeVaxa ZZsFTBjmkWByrbrMXtxX+yKssXbxYgg760VpDaJEZUNdRFaP5UN8sDHRIEWxknXTzgFc2psEtcF w X-Received: by 2002:a05:600c:154c:b0:42c:b950:6821 with SMTP id 5b1f17b1804b1-42cdb5495e8mr13462905e9.19.1726123968162; Wed, 11 Sep 2024 23:52:48 -0700 (PDT) Received: from m1x-phil.lan (mic92-h03-176-184-33-210.dsl.sta.abo.bbox.fr. [176.184.33.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378956e8700sm13401232f8f.116.2024.09.11.23.52.47 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 23:52:47 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL v2 46/61] hw/sensor/tmp105: Pass 'oneshot' argument to tmp105_alarm_update() Date: Thu, 12 Sep 2024 08:52:17 +0200 Message-ID: <20240912065227.67848-4-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240912065227.67848-1-philmd@linaro.org> References: <20240912065227.67848-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The next commit will clear the ONE_SHOT bit in the WRITE path (to keep the READ path trivial). As a preliminary step, pass the 'oneshot' value as argument to tmp105_alarm_update(). No logical change intended. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Guenter Roeck Message-Id: <20240906154911.86803-4-philmd@linaro.org> --- hw/sensor/tmp105.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index 150d09b278..6740200aea 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -40,10 +40,10 @@ static void tmp105_interrupt_update(TMP105State *s) qemu_set_irq(s->pin, s->alarm ^ FIELD_EX8(~s->config, CONFIG, POLARITY)); } -static void tmp105_alarm_update(TMP105State *s) +static void tmp105_alarm_update(TMP105State *s, bool one_shot) { if (FIELD_EX8(s->config, CONFIG, SHUTDOWN_MODE)) { - if (FIELD_EX8(s->config, CONFIG, ONE_SHOT)) { + if (one_shot) { s->config = FIELD_DP8(s->config, CONFIG, ONE_SHOT, 0); } else { return; @@ -119,7 +119,7 @@ static void tmp105_set_temperature(Object *obj, Visitor *v, const char *name, s->temperature = (int16_t) (temp * 256 / 1000); - tmp105_alarm_update(s); + tmp105_alarm_update(s, false); } static const int tmp105_faultq[4] = { 1, 2, 4, 6 }; @@ -168,7 +168,7 @@ static void tmp105_write(TMP105State *s) } s->config = s->buf[0]; s->faults = tmp105_faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)]; - tmp105_alarm_update(s); + tmp105_alarm_update(s, FIELD_EX8(s->buf[0], CONFIG, ONE_SHOT)); break; case TMP105_REG_T_LOW: @@ -177,7 +177,7 @@ static void tmp105_write(TMP105State *s) s->limit[s->pointer & 1] = (int16_t) ((((uint16_t) s->buf[0]) << 8) | s->buf[1]); } - tmp105_alarm_update(s); + tmp105_alarm_update(s, false); break; } }