devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eddie James <eajames@linux.ibm.com>
To: linux-iio@vger.kernel.org
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org,
	lars@metafoo.de, jic23@kernel.org, miltonm@us.ibm.com,
	eajames@linux.ibm.com
Subject: [PATCH v2 2/2] iio: humidity: si7020: Check device property for skipping reset in probe
Date: Thu, 12 May 2022 11:20:20 -0500	[thread overview]
Message-ID: <20220512162020.33450-3-eajames@linux.ibm.com> (raw)
In-Reply-To: <20220512162020.33450-1-eajames@linux.ibm.com>

I2C commands issued after the SI7020 is starting up or after reset
can potentially upset the startup sequence. Therefore, the host
needs to wait for the startup sequence to finish before issuing
further i2c commands. This is impractical in cases where the SI7020
is on a shared bus or behind a mux, which may switch channels at
any time (generating I2C traffic). Therefore, check for a device
property that indicates that the driver should skip resetting the
device when probing.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
 drivers/iio/humidity/si7020.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/humidity/si7020.c b/drivers/iio/humidity/si7020.c
index ab6537f136ba..49f6a1b1f5c4 100644
--- a/drivers/iio/humidity/si7020.c
+++ b/drivers/iio/humidity/si7020.c
@@ -115,12 +115,14 @@ static int si7020_probe(struct i2c_client *client,
 				     I2C_FUNC_SMBUS_READ_WORD_DATA))
 		return -EOPNOTSUPP;
 
-	/* Reset device, loads default settings. */
-	ret = i2c_smbus_write_byte(client, SI7020CMD_RESET);
-	if (ret < 0)
-		return ret;
-	/* Wait the maximum power-up time after software reset. */
-	msleep(15);
+	if (!device_property_read_bool(&client->dev, "silabs,skip-reset")) {
+		/* Reset device, loads default settings. */
+		ret = i2c_smbus_write_byte(client, SI7020CMD_RESET);
+		if (ret < 0)
+			return ret;
+		/* Wait the maximum power-up time after software reset. */
+		msleep(15);
+	}
 
 	indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
 	if (!indio_dev)
-- 
2.27.0


  parent reply	other threads:[~2022-05-12 16:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-12 16:20 [PATCH v2 0/2] iio: humidity: si7020: Check device property for skipping reset in probe Eddie James
2022-05-12 16:20 ` [PATCH v2 1/2] dt-bindings: iio: humidity: Add si7020 bindings Eddie James
2022-05-12 16:51   ` Jonathan Cameron
2022-05-12 17:08     ` Eddie James
2022-05-13 16:47       ` Jonathan Cameron
2022-05-13  8:55   ` Krzysztof Kozlowski
2022-05-12 16:20 ` Eddie James [this message]
2022-05-12 16:48 ` [PATCH v2 0/2] iio: humidity: si7020: Check device property for skipping reset in probe Jonathan Cameron
2022-05-12 17:08   ` Eddie James
2022-05-13 16:45     ` Jonathan Cameron
2022-05-13 22:48       ` Peter Rosin
2022-05-14 13:43         ` Jonathan Cameron
2022-05-14 15:02           ` Peter Rosin
2022-05-18 15:28             ` Eddie James
2022-05-18 15:51               ` Eddie James
2022-05-12 19:11   ` Eddie James
2022-05-14 13:40     ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220512162020.33450-3-eajames@linux.ibm.com \
    --to=eajames@linux.ibm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miltonm@us.ibm.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).