Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp453401lqp; Sun, 9 Jun 2024 04:04:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVD07sI9Nq2XuGbOIFkKHW6/wxaSv9UIdzFyQclarkmG4JTFcPl2OjyIY9B+hr4WEx2O4WPqcJ4gvStgc/l1FekGPodz+vljnJWLJLr0w== X-Google-Smtp-Source: AGHT+IE5JnlqNxqCZJ8QDEz75f3+idQ+VyL/CTN+UvfrA/weoy9ymVHujD7Os/Ylt0qKdlzIQWCl X-Received: by 2002:a05:6a20:7fa0:b0:1ac:c8dc:3e5e with SMTP id adf61e73a8af0-1b2f9a37826mr8447470637.24.1717931043308; Sun, 09 Jun 2024 04:04:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717931043; cv=pass; d=google.com; s=arc-20160816; b=nFxGUQUNKJMCaC2w5RAZ0X1vWR+WlsljuBjfbNdc6OhRgCdyWD/XbUSKB/8a8P7uML LeWkdb3Ssx2l+bYeyTGjPxUgrIzPsL0/VjAZptBS20HOdc4xAly/qiVKAU8FGDP830Mf QSU2n/U0JxlMpE6UoViMq167OVTyOtnfwupafYimUnC0/I5m+wkXBqgb8Hr877Lk7Hw+ ygbQoMe8ejyscY6ceYDCz5LKmVcOFKmdR8eJaGLFUB1/RxHhGloagfCKuab+wvC4s/uX Atu4SKRlA7N2RMCwrTfekJswNXxpegdTpmKXJE6PZl90o8x5iNBld30V/lGwmw4G+doG F7yQ== 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=g5zV5wRaPtMIyfwFCF2839Gr0imN5H6oEkICR5hbfAE=; fh=Cd8u3PZDjy+Y8BQ+XI/2jO6YK3iYo3PiYmPQg6yMRwM=; b=UD/f/J/njpNT2Rx69VgGWDRCX/TbV19jLGK2Ia00plYPe+1lbOkEjY42jrhJ4y6Ioz fj9SCDzZ4461DQJ2REv2fL999hBPr1Lbu54C4Ny19gNud/4sESFCqHDdNR3v616Rv6t4 xUkq+ff+bL7H4Xv2iovQrVC6mupwkTv91lCHNR03oriwCQv0+r05jHXclSge4Fqne+/m y/ifAaEH2dC9+ueAp82+8Dva3RvRoGkAVF2SQUp/G1ZA4B414BCPYkVvLUa6P6NX/syt BsofMJkDPbaq7SX9Of+LhGHW1yJXTFP49O66NptPLKel68EAv6v+TWjd3sxAem7Y4Wja HJnw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EsyFl8Hu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-207333-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207333-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. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de261c9992si2066640a12.418.2024.06.09.04.04.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jun 2024 04:04:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207333-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EsyFl8Hu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-207333-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207333-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 E5DF2281195 for ; Sun, 9 Jun 2024 11:04:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 831D22D030; Sun, 9 Jun 2024 11:03:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EsyFl8Hu" 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 AB9483E47E; Sun, 9 Jun 2024 11:03:56 +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=1717931036; cv=none; b=P6aSMWU+qHVyvDv2PtwI3cU9SyHVoggi9FonmRXYyDOfL91R5BTHTE+fqGbOe2msF+x1wotn0b/2LEHItns7g+D4ZMP/Zro+xfn3r7W3FCr99A/Y6oF+stZwhV521J9NL3SXqRyNADdd0Eor5vC8qJnXGXN6unjG39/Yf2rd9Ho= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717931036; c=relaxed/simple; bh=/gQ4V+QthXnYDKIfhkUCXxBGPmP4SuV90qZ+VPFImC4=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=d1SW1wOL9dxMkIY1AuxV3x7stE6yhGdWHWRfh7baCbMdpX3BARkCby36Ilu6eaxKRqtomq1R78lLkxmiRGWO6E3IaKp+KW1rDVig4Svgu070GwlbLKGUkXibxXBDnIDvdhk1kQdSx5D+etOPSaK58W1bbrsq8obyGfCz9WvkaoY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EsyFl8Hu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F555C2BD10; Sun, 9 Jun 2024 11:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717931036; bh=/gQ4V+QthXnYDKIfhkUCXxBGPmP4SuV90qZ+VPFImC4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EsyFl8HujZq7TAVA23h6YA+p61I6oPYxLzCfRaERTJ0Bx0hVhIzgIihOfzhQDJkmz sVLa/tDWRqNwG7xTUB+50H7dFaoVTNKXbBT6JmOM37fHGUTlVOF/8YrzoSLX54eFkE YdqS8fxX9fY4P4LiKc1hMyrLnom8P+pJVywAfH0w2xQcz/R5DRFCdbsbYzgQ534xA8 Wa97ZiCbPAjWP8EIPU9kXd3MOGixYMImoXwhE5ptlDAAqcsopLg9NO64EqhEcPrNPF UkNNJ/5FTwD7m/RbIOiK+aYTC0Ebf8ABQUJZ5r+78HB6+x8+HtF4JkGV8T7xSFaR52 xh8JUK1DtKyjw== Date: Sun, 9 Jun 2024 12:03:23 +0100 From: Jonathan Cameron To: Vasileios Amoiridis Cc: dpfrey@gmail.com, himanshujha199640@gmail.com, lars@metafoo.de, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, mike.looijmans@topic.nl Subject: Re: [PATCH v2 04/19] iio: chemical: bme680: Fix sensor data read operation Message-ID: <20240609120323.5af232f9@jic23-huawei> In-Reply-To: <20240606212313.207550-5-vassilisamir@gmail.com> References: <20240606212313.207550-1-vassilisamir@gmail.com> <20240606212313.207550-5-vassilisamir@gmail.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.42; 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 Thu, 6 Jun 2024 23:22:56 +0200 Vasileios Amoiridis wrote: > A read operation is happening as follows: > > a) Set sensor to forced mode > b) Sensor measures values and update data registers and sleeps again > c) Read data registers > > In the current implementation the read operation happens immediately > after the sensor is set to forced mode so the sensor does not have > the time to update properly the registers. This leads to the following > 2 problems: > > 1) The first ever value which is read by the register is always wrong > 2) Every read operation, puts the register into forced mode and reads > the data that were calculated in the previous conversion. > > This behaviour was tested in 2 ways: > > 1) The internal meas_status_0 register was read before and after every > read operation in order to verify that the data were ready even before > the register was set to forced mode and also to check that after the > forced mode was set the new data were not yet ready. > > 2) Physically changing the temperature and measuring the temperature > > This commit adds the waiting time in between the set of the forced mode > and the read of the data. The function is taken from the Bosch BME68x > Sensor API [1]. > > [1]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x.c#L490 > Fixes: 1b3bd8592780 ("iio: chemical: Add support for Bosch BME680 sensor") > Signed-off-by: Vasileios Amoiridis Applied and marked for stable.