lkml.org 
[lkml]   [2022]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 2/2] iio: humidity: si7020: Check device property for skipping reset in probe
Date
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
\
 
 \ /
  Last update: 2022-05-12 18:22    [W:0.162 / U:1.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site