diff mbox series

[2/2] iio: humidity: si7020: Check device property for skipping reset in probe

Message ID 20220511190835.51046-3-eajames@linux.ibm.com (mailing list archive)
State Changes Requested
Headers show
Series iio: humidity: si7020: Check device property for skipping reset in probe | expand

Commit Message

Eddie James May 11, 2022, 7:08 p.m. UTC
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 mbox series

Patch

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)