[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220511190835.51046-3-eajames@linux.ibm.com>
Date: Wed, 11 May 2022 14:08:35 -0500
From: Eddie James <eajames@...ux.ibm.com>
To: linux-iio@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
jic23@...nel.org, lars@...afoo.de, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, dbarksdale@...ogix.com,
eajames@...ux.ibm.com
Subject: [PATCH 2/2] iio: humidity: si7020: Check device property for skipping reset in probe
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@...ux.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
Powered by blists - more mailing lists