diff mbox series

[linux,dev-5.15] iio: si7020: Remove reset in probe

Message ID 20220525011138.5882-1-eajames@linux.ibm.com
State New
Headers show
Series [linux,dev-5.15] iio: si7020: Remove reset in probe | expand

Commit Message

Eddie James May 25, 2022, 1:11 a.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, remove the device
reset in the probe function.

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

Comments

Joel Stanley May 25, 2022, 1:21 a.m. UTC | #1
On Wed, 25 May 2022 at 01:11, Eddie James <eajames@linux.ibm.com> wrote:
>
> 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, remove the device
> reset in the probe function.

Reviewed-by: Joel Stanley <joel@jms.id.au>

Following the upstream discussion, I think this is the way forward.
Send this out to the upstream list when you have time.

https://lore.kernel.org/all/20220518204119.38943-1-eajames@linux.ibm.com/

>
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
> ---
>  drivers/iio/humidity/si7020.c | 7 -------
>  1 file changed, 7 deletions(-)
>
> diff --git a/drivers/iio/humidity/si7020.c b/drivers/iio/humidity/si7020.c
> index ab6537f136ba..3c55b81ce984 100644
> --- a/drivers/iio/humidity/si7020.c
> +++ b/drivers/iio/humidity/si7020.c
> @@ -115,13 +115,6 @@ 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);
> -
>         indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
>         if (!indio_dev)
>                 return -ENOMEM;
> --
> 2.27.0
>
Joel Stanley May 25, 2022, 1:29 a.m. UTC | #2
On Wed, 25 May 2022 at 01:11, Eddie James <eajames@linux.ibm.com> wrote:
>
> 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, remove the device
> reset in the probe function.
>
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
> ---
>  drivers/iio/humidity/si7020.c | 7 -------
>  1 file changed, 7 deletions(-)
>
> diff --git a/drivers/iio/humidity/si7020.c b/drivers/iio/humidity/si7020.c
> index ab6537f136ba..3c55b81ce984 100644
> --- a/drivers/iio/humidity/si7020.c
> +++ b/drivers/iio/humidity/si7020.c
> @@ -115,13 +115,6 @@ 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);


../drivers/iio/humidity/si7020.c:111:13: warning: unused variable
‘ret’ [-Wunused-variable]
  111 |         int ret;
      |             ^~~

I have fixed it up when applying, but keep that in mind for when you
send upstream.
> -
>         indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
>         if (!indio_dev)
>                 return -ENOMEM;
> --
> 2.27.0
>
diff mbox series

Patch

diff --git a/drivers/iio/humidity/si7020.c b/drivers/iio/humidity/si7020.c
index ab6537f136ba..3c55b81ce984 100644
--- a/drivers/iio/humidity/si7020.c
+++ b/drivers/iio/humidity/si7020.c
@@ -115,13 +115,6 @@  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);
-
 	indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
 	if (!indio_dev)
 		return -ENOMEM;