Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp455433lqp; Sun, 9 Jun 2024 04:08:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU9COKhpft3hyF0J1KmLHDdtNQCdz2EZCd8OwK4pvSJVjV7ixJZokEHJxLoukbfitoUpG0WAMEdu8S+vH3AD/Dr+BXCbkYvlo7i1kn3OQ== X-Google-Smtp-Source: AGHT+IFnno4i/YQXEFlvj73vc7Kqotq1dp5vMSKLHkFb063SXNHiWV7l3rypBQIvj2Mlo67MrQl1 X-Received: by 2002:a05:620a:2725:b0:795:60ba:76d2 with SMTP id af79cd13be357-79560ba7b91mr99548985a.53.1717931318418; Sun, 09 Jun 2024 04:08:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717931318; cv=pass; d=google.com; s=arc-20160816; b=kP/YgFB9P+rv94EfPe63LeoBtoK3fyeFzgmXcwnz8gadViEDQnIKaS53f+xor4EkzO oobol+OHWy0tCCLQJAH3DMGTEHVYhNj3WlIqt3yY51e1p9RCUNE8qCO4dSaYNH3p2WKy cH9ZKXUXFJ0gzL6qVlabR0Ed7g/BevNBG+L8AX4MR7jpwbqX2TrGt5/3pHRfXU4j6TFV bAq/51oUt/J/b9uKLDuhNOURy5nYvBwgm+xBSoUlBm8nFhqwecvkT6t2mNisMlvnVY2u x8Q/iGH7DKF8i0t99HsKVGbzxb2MUdnegebOzmkUX+/I8lgPoAaD9d1NXjhRdsIrb33H Fzqg== 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=GAYsDkpRUc9K6O/MaOgJmAFur/H7sVL8nDac0Zn+ljw=; fh=Cd8u3PZDjy+Y8BQ+XI/2jO6YK3iYo3PiYmPQg6yMRwM=; b=S8vBwcdENtTZVwPwJtADmCPLXLwtQSv6kUcoF019gCWk5UfJEaW+GPNRcak3tQGg8b hA0kudCwUqsZrUH+bfJHBaoi9FvdmJIulOgKtUGlzIHrSAgSv3InwoyD7YCKEPIs+82/ yC+od/dyKpQgz30C9M/YoFfsuSs2/ayoWg4ONBtmVQC9ocunWc713XNxObYwe2DDPddV z9W5LhlhWlRBnJeKQPEACv4MyOHSMxGVjM9oMsMj2oPNNV14TwkIeu5Xo6qN8PnMnvzU WmOYHe6o8jEqfpky01xJlnxidaRPDz4o56APcwZGZWt7MklMCmIGzn5iH+3hJi17J6Xf WVBg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NCtOHd8Z; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-207335-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207335-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-79532853873si864231385a.20.2024.06.09.04.08.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jun 2024 04:08:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207335-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NCtOHd8Z; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-207335-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207335-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 116671C21091 for ; Sun, 9 Jun 2024 11:08:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA3D02E63B; Sun, 9 Jun 2024 11:08:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NCtOHd8Z" 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 07E182E62D; Sun, 9 Jun 2024 11:08:31 +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=1717931311; cv=none; b=KFaGRDYnF9uqv9Vlr8cvPqcy3Xa0zOUAVo7qv3KJVhXBWUmR4hIy3NjbBUbHy1Yjr0Q0TrhAhQvcj/32/FspNQM+6WhxgOhx+JwA0I57oAopptpgmNWbJKdCRFYSDDaRHOHqgUWfUYkYxAfkgXr6zpoH1WvooLl8Fyaim/HaeDk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717931311; c=relaxed/simple; bh=3rrM6UaKFBrayBCDs0tBpYq461KVYa0w5TQdSkCmIvg=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IjbB0RR+GDgzKm4hOQd546PY93IkGhG3fx7DWElzd+a1EiU0Lkn1oXLkYLr4PeZr0l9Xn86sZxDiP3gZXg6I4VlH7UXW0WOK/c9rc23XdumtL87C3Esnhcsx2JAUi6y+/JxyVTfb2h0lr7G8++hl6KIjTezLykFGi8GHoxOKBvU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NCtOHd8Z; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80923C2BD10; Sun, 9 Jun 2024 11:08:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717931310; bh=3rrM6UaKFBrayBCDs0tBpYq461KVYa0w5TQdSkCmIvg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=NCtOHd8ZhSlQ/CBIfuHGytpP01xdEMjbTjGMO9Zeq8vcygBfiBXxdxU+KgIf1598O ObPqjVUGZOqE0JJTD/RUafcMm+MVCEe5QRXIIwJnZDkVd+WV8Z4MInu8yuDe66wEaU DFyhe+2mkja+fPjL9zGCvbYMxuV52JHeejPQoJYYu9rx+Nn4dJrEIa9GjMpmZvsgkW HLlirzsm9/3z+/Dr881mIRCJ2YOyBXnSOOxZ9b/CR7l3GQDrwmtG5VDOa0ariTkscp pFw2olRvz6Zquh+6AqI8MoxK/zZS9CiEi5tldnDBxITIJlPr9S7j5mmI6q26F0nInS Mz4ZWjUbm1RZQ== Date: Sun, 9 Jun 2024 12:07:56 +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 15/19] iio: chemical: bme680: Modify startup procedure Message-ID: <20240609120756.14c1eda1@jic23-huawei> In-Reply-To: <20240606212313.207550-18-vassilisamir@gmail.com> References: <20240606212313.207550-1-vassilisamir@gmail.com> <20240606212313.207550-18-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:23:09 +0200 Vasileios Amoiridis wrote: > Modify the startup procedure to reflect the procedure of > the Bosch BME68x Sensor API. The initial readings and > configuration of the sensor need to happen in the > following order: > > 1) Read calibration data [1,2] > 2) Chip general configuration [3] > 3) Gas configuration [4] > > After the chip configuration it is necessary to ensure that > the sensor is in sleeping mode, in order to apply the gas > configuration settings [5]. > Trivial but oddly short line wrapping. Target 75ish chars for commit messages > Also, after the soft reset, it is advised to wait for 5ms [6]. > > [1]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x.c#L162 > [2]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/examples/forced_mode/forced_mode.c#L44 > [3]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/examples/forced_mode/forced_mode.c#L53 > [4]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/examples/forced_mode/forced_mode.c#L60 > [5]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x.c#L640 > [6]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x.c#L294 Either make these Link tags or add a blank line here. I'd prefer link tags with # [1] etc after them for the cross references. > Signed-off-by: Vasileios Amoiridis > --- > drivers/iio/chemical/bme680.h | 2 ++ > drivers/iio/chemical/bme680_core.c | 21 ++++++++++++++------- > 2 files changed, 16 insertions(+), 7 deletions(-) > > diff --git a/drivers/iio/chemical/bme680.h b/drivers/iio/chemical/bme680.h > index 7d0ff294725a..b2c547ac8d34 100644 > --- a/drivers/iio/chemical/bme680.h > +++ b/drivers/iio/chemical/bme680.h > @@ -63,6 +63,8 @@ > > #define BME680_MEAS_TRIM_MASK GENMASK(24, 4) > > +#define BME680_STARTUP_TIME_US 5000 > + > /* Calibration Parameters */ > #define BME680_T2_LSB_REG 0x8A > #define BME680_H2_MSB_REG 0xE1 > diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c > index 25d128e1ddcf..e354eaa34d59 100644 > --- a/drivers/iio/chemical/bme680_core.c > +++ b/drivers/iio/chemical/bme680_core.c > @@ -531,6 +531,11 @@ static int bme680_gas_config(struct bme680_data *data) > int ret; > u8 heatr_res, heatr_dur; > > + /* Go to sleep */ > + ret = bme680_set_mode(data, false); > + if (ret < 0) > + return ret; > + > heatr_res = bme680_calc_heater_res(data, data->heater_temp); > > /* set target heater temperature */ > @@ -866,6 +871,8 @@ int bme680_core_probe(struct device *dev, struct regmap *regmap, > return ret; > } > > + usleep_range(BME680_STARTUP_TIME_US, BME680_STARTUP_TIME_US + 1000); > + > ret = regmap_read(regmap, BME680_REG_CHIP_ID, &data->check); > if (ret < 0) { > dev_err(dev, "Error reading chip ID\n"); > @@ -878,22 +885,22 @@ int bme680_core_probe(struct device *dev, struct regmap *regmap, > return -ENODEV; > } > > - ret = bme680_chip_config(data); > + ret = bme680_read_calib(data, &data->bme680); > if (ret < 0) { > - dev_err(dev, "failed to set chip_config data\n"); > + dev_err(dev, > + "failed to read calibration coefficients at probe\n"); > return ret; > } > > - ret = bme680_gas_config(data); > + ret = bme680_chip_config(data); > if (ret < 0) { > - dev_err(dev, "failed to set gas config data\n"); > + dev_err(dev, "failed to set chip_config data\n"); > return ret; > } > > - ret = bme680_read_calib(data, &data->bme680); > + ret = bme680_gas_config(data); > if (ret < 0) { > - dev_err(dev, > - "failed to read calibration coefficients at probe\n"); > + dev_err(dev, "failed to set gas config data\n"); > return ret; > } >