Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp592194lqp; Sat, 13 Apr 2024 09:56:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXLPqGi16Cn1h+rRVbOiQOPKbv6SA/5/zFXM/e3Cq/UUr1wjTWp/AE664anMlleTA0nLUWYqR2QU1X6QK1WKQV+VwB2iEgrlC9Hh46Dhg== X-Google-Smtp-Source: AGHT+IGfVQVOcFGBtkEMcb3M2TJjoSsG7C5D+ZN502pTWZxGtzbanvIv2ayjfI2N7q2jTGheqxcI X-Received: by 2002:a05:6e02:b49:b0:36a:a6c4:a with SMTP id f9-20020a056e020b4900b0036aa6c4000amr6876807ilu.8.1713027397873; Sat, 13 Apr 2024 09:56:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713027397; cv=pass; d=google.com; s=arc-20160816; b=w7guCklMKDvf33jdeOuHleRzP1bVDbnAj0ttGs4LhFdqjVaIY0WsKdg9l+yrF2FEdX 9a6SLasaN1IatCC/1qOmlpl5oCBDYfUKHpVLF8/xpNj+yABTvP6Mt8sqhXtNKLFBemrc ip/deCgHa2JlNfHFEAou8Mk3lCwbGYynG/A5bKYf+FD3wx0KjTnJeYrDAOHwyWUDD8q9 /4gR0RFL7E2JeCkLwrs4pb5+MrXwe+vZuNiOEwSr6YS9gsKGyvTSMZJ6d5zaLVOPl3Vm udNt47PxmwFSPB01nzkmc+8s+ZLwsY8nfF+92kLbeOTXIjAXzyhXPsce3o423X114Lra JGTg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=wXRzqWsa5I3lTZihFlRjZ8z8BA/m90oP4hdjxA8yMfE=; fh=QOo/yt/OkESGDalaU5QlkfrbKKthXTAyOlhKEhI1tzs=; b=eUQMB2izqZimZZUTwb1T9wqltqgExRzkBbdZ3J+HGX2n6RKo+z2xqcM7OASvtM/ug0 5X5Sl+84Bdo07Yu9CuUcjlV2vazd6YEllKEyyNHOtdTk+4/IItm1xsRP2mVHLgplb9+j oPkkIPZHf/Z3yf8mKGYTjnKQMH0Xlug4GkZHXA/vnQZv8glDDKKvoo0bpvQkDvxPHp9g 8wFIhantbqQujL/JMy3eKYcTbO/rc7gODG8EgHd9S0l+rw9zpmqq0sP+EUqDRPrRS3yq mAz9zIiUUT3E8b0d9O5eH4r6n2Ipa9H9efhv08OWE77vDmbUqo+l6Gvq/G5YKBF8HMdk JgrQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cp396N8j; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143816-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143816-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q22-20020a656256000000b005dbec19cdd1si5027216pgv.511.2024.04.13.09.56.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Apr 2024 09:56:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143816-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cp396N8j; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143816-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143816-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 83F7A2820FB for ; Sat, 13 Apr 2024 16:56:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9694145C1C; Sat, 13 Apr 2024 16:56:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Cp396N8j" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC15940BE7; Sat, 13 Apr 2024 16:56:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713027390; cv=none; b=ifrpWJ846l3PCz1UCOoQcVw/PR1/FNoUOxcOV/1xYdDSZInk7GRCRg7p1yF3YYND0c9Qb4B6szMaDHvRBE/ChLb7vWuIO74ObOS8nndpWmOVT3/LRG919dsbnp3Tn34oKtobaKyqkEAT8a5OinJePMYDL2Gx2yL01hF7JIJMj1o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713027390; c=relaxed/simple; bh=qzvK0Qurx8h2LspWlfqXLUZ91F02Tbnhx9bl1BVWd6s=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=o8Uhh1rgt4kCRa5rCtSHQ1mSjzwu4q07aaxMkDYp2evbHXTxD2AuTDqZS1GSFq4SoZo2I/Cjuo4XPd1XzP75q3o3+ldi+PPHfZHdtuXp+YqxtJszswE5DsZKUV+Hnzm8CmNmxvVQxXyLkRQm/29R9G96FhRdjSmgX/kzMoR66xY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Cp396N8j; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A7B5C113CD; Sat, 13 Apr 2024 16:56:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713027390; bh=qzvK0Qurx8h2LspWlfqXLUZ91F02Tbnhx9bl1BVWd6s=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Cp396N8jBULseNyax/L6pcWQidvMyQeO6KRmcJUJuC8rzJt22Nzyo04bV9G00dnJt Vem2Ur6h3WvAinYb8GPoboknsnwVoMy8jb/BXM6lFjztbNvjYnqVMjubY7oBgrmdFw ur2eplJzzdFdQ7jssEoRPPYaX3996/nLR1LZpAYkCmUUg1FsRXviwQxO8zsMg2+n9q 567cZbZ+pmfUKE5F9dT47Z7KOu7ioVCoDqWq08ZibpMEtgR1IL+zfZ5JGXEr48072F Ih2M2yMA/QMhoLMVdY15opD/wJhgJnq3/jIOAXCpbR0tkLZM7PIVkqybZgTHufF031 MkySW50pe1dRw== Date: Sat, 13 Apr 2024 17:56:12 +0100 From: Jonathan Cameron To: Vasileios Amoiridis Cc: lars@metafoo.de, andriy.shevchenko@linux.intel.com, ang.iglesiasg@gmail.com, mazziesaccount@gmail.com, ak@it-klinger.de, petre.rodan@subdimension.ro, phil@raspberrypi.com, 579lpy@gmail.com, u.kleine-koenig@pengutronix.de, biju.das.jz@bp.renesas.com, linus.walleij@linaro.org, semen.protsenko@linaro.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Cameron Subject: Re: [PATCH v4 2/6] iio: pressure: bmp280: Refactorize reading functions Message-ID: <20240413175612.5b117573@jic23-huawei> In-Reply-To: <20240407172920.264282-3-vassilisamir@gmail.com> References: <20240407172920.264282-1-vassilisamir@gmail.com> <20240407172920.264282-3-vassilisamir@gmail.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sun, 7 Apr 2024 19:29:16 +0200 Vasileios Amoiridis wrote: > For BMP18x, BMP28x, BME280, BMP38x the reading of the pressure > value requires an update of the t_fine variable which happens > through reading the temperature value. > > So all the bmpxxx_read_press() functions of the above sensors > are internally calling the equivalent bmpxxx_read_temp() function > in order to update the t_fine value. By just looking at the code > this functionality is a bit hidden and is not easy to understand > why those channels are not independent. > > This commit tries to clear these things a bit by splitting the > bmpxxx_{read/compensate}_{temp/press/humid}() to the following: > > i. bmpxxx_read_{temp/press/humid}_adc(): read the raw value from > the sensor. > > ii. bmpxx_calc_t_fine(): calculate the t_fine variable. > > iii. bmpxxx_get_t_fine(): get the t_fine variable. > > iv. bmpxxx_compensate_{temp/press/humid}(): compensate the adc > values and return the calculated value. > > v. bmpxxx_read_{temp/press/humid}(): combine calls of the > aforementioned functions to return the requested value. > > Suggested-by: Jonathan Cameron > Signed-off-by: Vasileios Amoiridis Looks good to me. Thanks for tidying this up.