* [PATCH v2] iio: accel: bmc150: check reset write error
@ 2026-09-24 14:48 Carlos Casadiego via B4 Relay
2026-09-25 3:05 ` Jonathan Cameron
0 siblings, 1 reply; 5+ messages in thread
From: Carlos Casadiego via B4 Relay @ 2026-09-24 14:48 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Srinivas Pandruvada, Olof Johansson
Cc: linux-iio, linux-kernel, Carlos Casadiego
From: Carlos Casadiego <cdcp206@gmail.com>
The software reset is required to bring the device into a known
state before reading the chip ID.
Check the return value of regmap_write() and abort initialization if
the reset command cannot be written.
Fixes: 1c500840934a ("iio: accel: bmc150: reset chip at init time")
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Carlos Casadiego <cdcp206@gmail.com>
---
Changes in v2:
- Remove the blank line in the tag block.
- Add Srinivas Pandruvada's Acked-by.
- Link to v1: https://patch.msgid.link/20260923-iio-bmc150-check-reset-error-v1-1-b8c1ebc4c947@gmail.com
---
drivers/iio/accel/bmc150-accel-core.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c
index 46bb36d9366e..43a39e1ccce5 100644
--- a/drivers/iio/accel/bmc150-accel-core.c
+++ b/drivers/iio/accel/bmc150-accel-core.c
@@ -1561,8 +1561,12 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data)
* Reset chip to get it in a known good state. A delay of 1.8ms after
* reset is required according to the data sheets of supported chips.
*/
- regmap_write(data->regmap, BMC150_ACCEL_REG_RESET,
- BMC150_ACCEL_RESET_VAL);
+ ret = regmap_write(data->regmap, BMC150_ACCEL_REG_RESET,
+ BMC150_ACCEL_RESET_VAL);
+ if (ret < 0) {
+ dev_err(dev, "Error writing reset register\n");
+ return ret;
+ }
usleep_range(1800, 2500);
ret = regmap_read(data->regmap, BMC150_ACCEL_REG_CHIP_ID, &val);
---
base-commit: d8c0f48f0b1583308a98401c0c7b1a65d1d43a6c
change-id: 20260923-iio-bmc150-check-reset-error-389b096b0ad4
Best regards,
--
Carlos Casadiego <cdcp206@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] iio: accel: bmc150: check reset write error
2026-09-24 14:48 [PATCH v2] iio: accel: bmc150: check reset write error Carlos Casadiego via B4 Relay
@ 2026-09-25 3:05 ` Jonathan Cameron
[not found] ` <CALnzk4Uz1ru-_u-SgQXszHW_PL5DbY20J38v1yGCnwBafcwgKQ@mail.gmail.com>
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Jonathan Cameron @ 2026-09-25 3:05 UTC (permalink / raw)
To: Carlos Casadiego via B4 Relay
Cc: cdcp206, David Lechner, Nuno Sá,
Andy Shevchenko, Srinivas Pandruvada, Olof Johansson, linux-iio,
linux-kernel
On Thu, 24 Sep 2026 09:48:45 -0500
Carlos Casadiego via B4 Relay <devnull+cdcp206.gmail.com@kernel.org> wrote:
> From: Carlos Casadiego <cdcp206@gmail.com>
>
> The software reset is required to bring the device into a known
> state before reading the chip ID.
>
> Check the return value of regmap_write() and abort initialization if
> the reset command cannot be written.
>
> Fixes: 1c500840934a ("iio: accel: bmc150: reset chip at init time")
> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Signed-off-by: Carlos Casadiego <cdcp206@gmail.com>
Just to check: Was this verified against actual hardware?
Quite a few devices get going on their resets before sending
acks on i2c which means you get an error on that particular
write. That is often why you don't see an error check on this
particular operation.
> ---
> Changes in v2:
> - Remove the blank line in the tag block.
> - Add Srinivas Pandruvada's Acked-by.
> - Link to v1: https://patch.msgid.link/20260923-iio-bmc150-check-reset-error-v1-1-b8c1ebc4c947@gmail.com
> ---
> drivers/iio/accel/bmc150-accel-core.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c
> index 46bb36d9366e..43a39e1ccce5 100644
> --- a/drivers/iio/accel/bmc150-accel-core.c
> +++ b/drivers/iio/accel/bmc150-accel-core.c
> @@ -1561,8 +1561,12 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data)
> * Reset chip to get it in a known good state. A delay of 1.8ms after
> * reset is required according to the data sheets of supported chips.
> */
> - regmap_write(data->regmap, BMC150_ACCEL_REG_RESET,
> - BMC150_ACCEL_RESET_VAL);
> + ret = regmap_write(data->regmap, BMC150_ACCEL_REG_RESET,
> + BMC150_ACCEL_RESET_VAL);
> + if (ret < 0) {
> + dev_err(dev, "Error writing reset register\n");
> + return ret;
> + }
> usleep_range(1800, 2500);
>
> ret = regmap_read(data->regmap, BMC150_ACCEL_REG_CHIP_ID, &val);
>
> ---
> base-commit: d8c0f48f0b1583308a98401c0c7b1a65d1d43a6c
> change-id: 20260923-iio-bmc150-check-reset-error-389b096b0ad4
>
> Best regards,
> --
> Carlos Casadiego <cdcp206@gmail.com>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread[parent not found: <CALnzk4Uz1ru-_u-SgQXszHW_PL5DbY20J38v1yGCnwBafcwgKQ@mail.gmail.com>]
* Re: [PATCH v2] iio: accel: bmc150: check reset write error
[not found] ` <CALnzk4Uz1ru-_u-SgQXszHW_PL5DbY20J38v1yGCnwBafcwgKQ@mail.gmail.com>
@ 2026-09-25 16:34 ` cdcp 206
0 siblings, 0 replies; 5+ messages in thread
From: cdcp 206 @ 2026-09-25 16:34 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Carlos Casadiego via B4 Relay, David Lechner, Nuno Sá,
Andy Shevchenko, Srinivas Pandruvada, Olof Johansson, linux-iio,
linux-kernel
I have not verified this on BMC150 hardware.
The datasheet documents the soft reset, but I could not find a guarantee
that the I2C write is acknowledged before the reset starts.
Given that, I agree that propagating this error could cause a regression,
so I think the patch should be dropped.
Thanks for pointing this out.
El vie, 25 sept 2026 a la(s) 11:26 a.m., cdcp 206 (cdcp206@gmail.com) escribió:
>
> I have not verified this on BMC150 hardware.
>
> The datasheet documents the soft reset, but I could not find a guarantee
> that the I2C write is acknowledged before the reset starts.
>
> Given that, I agree that propagating this error could cause a regression,
> so I think the patch should be dropped.
>
> Thanks for pointing this out.
>
>
>
> El jue, 24 sept 2026 a la(s) 10:05 p.m., Jonathan Cameron (jic23@kernel.org) escribió:
>>
>> On Thu, 24 Sep 2026 09:48:45 -0500
>> Carlos Casadiego via B4 Relay <devnull+cdcp206.gmail.com@kernel.org> wrote:
>>
>> > From: Carlos Casadiego <cdcp206@gmail.com>
>> >
>> > The software reset is required to bring the device into a known
>> > state before reading the chip ID.
>> >
>> > Check the return value of regmap_write() and abort initialization if
>> > the reset command cannot be written.
>> >
>> > Fixes: 1c500840934a ("iio: accel: bmc150: reset chip at init time")
>> > Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
>> > Signed-off-by: Carlos Casadiego <cdcp206@gmail.com>
>>
>> Just to check: Was this verified against actual hardware?
>>
>> Quite a few devices get going on their resets before sending
>> acks on i2c which means you get an error on that particular
>> write. That is often why you don't see an error check on this
>> particular operation.
>>
>>
>>
>>
>> > ---
>> > Changes in v2:
>> > - Remove the blank line in the tag block.
>> > - Add Srinivas Pandruvada's Acked-by.
>> > - Link to v1: https://patch.msgid.link/20260923-iio-bmc150-check-reset-error-v1-1-b8c1ebc4c947@gmail.com
>> > ---
>> > drivers/iio/accel/bmc150-accel-core.c | 8 ++++++--
>> > 1 file changed, 6 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c
>> > index 46bb36d9366e..43a39e1ccce5 100644
>> > --- a/drivers/iio/accel/bmc150-accel-core.c
>> > +++ b/drivers/iio/accel/bmc150-accel-core.c
>> > @@ -1561,8 +1561,12 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data)
>> > * Reset chip to get it in a known good state. A delay of 1.8ms after
>> > * reset is required according to the data sheets of supported chips.
>> > */
>> > - regmap_write(data->regmap, BMC150_ACCEL_REG_RESET,
>> > - BMC150_ACCEL_RESET_VAL);
>> > + ret = regmap_write(data->regmap, BMC150_ACCEL_REG_RESET,
>> > + BMC150_ACCEL_RESET_VAL);
>> > + if (ret < 0) {
>> > + dev_err(dev, "Error writing reset register\n");
>> > + return ret;
>> > + }
>> > usleep_range(1800, 2500);
>> >
>> > ret = regmap_read(data->regmap, BMC150_ACCEL_REG_CHIP_ID, &val);
>> >
>> > ---
>> > base-commit: d8c0f48f0b1583308a98401c0c7b1a65d1d43a6c
>> > change-id: 20260923-iio-bmc150-check-reset-error-389b096b0ad4
>> >
>> > Best regards,
>> > --
>> > Carlos Casadiego <cdcp206@gmail.com>
>> >
>> >
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] iio: accel: bmc150: check reset write error
2026-09-25 3:05 ` Jonathan Cameron
[not found] ` <CALnzk4Uz1ru-_u-SgQXszHW_PL5DbY20J38v1yGCnwBafcwgKQ@mail.gmail.com>
@ 2026-09-25 17:35 ` Carlos Casadiego
2026-09-25 18:14 ` Carlos Casadiego
2 siblings, 0 replies; 5+ messages in thread
From: Carlos Casadiego @ 2026-09-25 17:35 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Carlos Casadiego via B4 Relay, David Lechner, Nuno Sá,
Andy Shevchenko, Srinivas Pandruvada, Olof Johansson, linux-iio,
linux-kernel
I have not verified this on BMC150 hardware.
The datasheet documents the soft reset, but I could not find a guarantee
that the I2C write is acknowledged before the reset starts.
Given that, I agree that propagating this error could cause a regression,
so I think the patch should be dropped.
Thanks for pointing this out.
En Fri, Sep 25, 2026 at 04:05:00AM +0100, Jonathan Cameron escribió:
> On Thu, 24 Sep 2026 09:48:45 -0500
> Carlos Casadiego via B4 Relay <devnull+cdcp206.gmail.com@kernel.org> wrote:
>
> > From: Carlos Casadiego <cdcp206@gmail.com>
> >
> > The software reset is required to bring the device into a known
> > state before reading the chip ID.
> >
> > Check the return value of regmap_write() and abort initialization if
> > the reset command cannot be written.
> >
> > Fixes: 1c500840934a ("iio: accel: bmc150: reset chip at init time")
> > Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> > Signed-off-by: Carlos Casadiego <cdcp206@gmail.com>
>
> Just to check: Was this verified against actual hardware?
>
> Quite a few devices get going on their resets before sending
> acks on i2c which means you get an error on that particular
> write. That is often why you don't see an error check on this
> particular operation.
>
>
>
>
> > ---
> > Changes in v2:
> > - Remove the blank line in the tag block.
> > - Add Srinivas Pandruvada's Acked-by.
> > - Link to v1: https://patch.msgid.link/20260923-iio-bmc150-check-reset-error-v1-1-b8c1ebc4c947@gmail.com
> > ---
> > drivers/iio/accel/bmc150-accel-core.c | 8 ++++++--
> > 1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c
> > index 46bb36d9366e..43a39e1ccce5 100644
> > --- a/drivers/iio/accel/bmc150-accel-core.c
> > +++ b/drivers/iio/accel/bmc150-accel-core.c
> > @@ -1561,8 +1561,12 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data)
> > * Reset chip to get it in a known good state. A delay of 1.8ms after
> > * reset is required according to the data sheets of supported chips.
> > */
> > - regmap_write(data->regmap, BMC150_ACCEL_REG_RESET,
> > - BMC150_ACCEL_RESET_VAL);
> > + ret = regmap_write(data->regmap, BMC150_ACCEL_REG_RESET,
> > + BMC150_ACCEL_RESET_VAL);
> > + if (ret < 0) {
> > + dev_err(dev, "Error writing reset register\n");
> > + return ret;
> > + }
> > usleep_range(1800, 2500);
> >
> > ret = regmap_read(data->regmap, BMC150_ACCEL_REG_CHIP_ID, &val);
> >
> > ---
> > base-commit: d8c0f48f0b1583308a98401c0c7b1a65d1d43a6c
> > change-id: 20260923-iio-bmc150-check-reset-error-389b096b0ad4
> >
> > Best regards,
> > --
> > Carlos Casadiego <cdcp206@gmail.com>
> >
> >
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] iio: accel: bmc150: check reset write error
2026-09-25 3:05 ` Jonathan Cameron
[not found] ` <CALnzk4Uz1ru-_u-SgQXszHW_PL5DbY20J38v1yGCnwBafcwgKQ@mail.gmail.com>
2026-09-25 17:35 ` Carlos Casadiego
@ 2026-09-25 18:14 ` Carlos Casadiego
2 siblings, 0 replies; 5+ messages in thread
From: Carlos Casadiego @ 2026-09-25 18:14 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Carlos Casadiego via B4 Relay, David Lechner, Nuno Sá,
Andy Shevchenko, Srinivas Pandruvada, Olof Johansson, linux-iio,
linux-kernel
I have not verified this on BMC150 hardware.
The datasheet documents the soft reset, but I could not find a guarantee
that the I2C write is acknowledged before the reset starts.
Given that, I agree that propagating this error could cause a regression,
so I think the patch should be dropped.
Thanks for pointing this out.
En Fri, Sep 25, 2026 at 04:05:00AM +0100, Jonathan Cameron escribió:
> On Thu, 24 Sep 2026 09:48:45 -0500
> Carlos Casadiego via B4 Relay <devnull+cdcp206.gmail.com@kernel.org> wrote:
>
> > From: Carlos Casadiego <cdcp206@gmail.com>
> >
> > The software reset is required to bring the device into a known
> > state before reading the chip ID.
> >
> > Check the return value of regmap_write() and abort initialization if
> > the reset command cannot be written.
> >
> > Fixes: 1c500840934a ("iio: accel: bmc150: reset chip at init time")
> > Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> > Signed-off-by: Carlos Casadiego <cdcp206@gmail.com>
>
> Just to check: Was this verified against actual hardware?
>
> Quite a few devices get going on their resets before sending
> acks on i2c which means you get an error on that particular
> write. That is often why you don't see an error check on this
> particular operation.
>
>
>
>
> > ---
> > Changes in v2:
> > - Remove the blank line in the tag block.
> > - Add Srinivas Pandruvada's Acked-by.
> > - Link to v1: https://patch.msgid.link/20260923-iio-bmc150-check-reset-error-v1-1-b8c1ebc4c947@gmail.com
> > ---
> > drivers/iio/accel/bmc150-accel-core.c | 8 ++++++--
> > 1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c
> > index 46bb36d9366e..43a39e1ccce5 100644
> > --- a/drivers/iio/accel/bmc150-accel-core.c
> > +++ b/drivers/iio/accel/bmc150-accel-core.c
> > @@ -1561,8 +1561,12 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data)
> > * Reset chip to get it in a known good state. A delay of 1.8ms after
> > * reset is required according to the data sheets of supported chips.
> > */
> > - regmap_write(data->regmap, BMC150_ACCEL_REG_RESET,
> > - BMC150_ACCEL_RESET_VAL);
> > + ret = regmap_write(data->regmap, BMC150_ACCEL_REG_RESET,
> > + BMC150_ACCEL_RESET_VAL);
> > + if (ret < 0) {
> > + dev_err(dev, "Error writing reset register\n");
> > + return ret;
> > + }
> > usleep_range(1800, 2500);
> >
> > ret = regmap_read(data->regmap, BMC150_ACCEL_REG_CHIP_ID, &val);
> >
> > ---
> > base-commit: d8c0f48f0b1583308a98401c0c7b1a65d1d43a6c
> > change-id: 20260923-iio-bmc150-check-reset-error-389b096b0ad4
> >
> > Best regards,
> > --
> > Carlos Casadiego <cdcp206@gmail.com>
> >
> >
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-25 18:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-24 14:48 [PATCH v2] iio: accel: bmc150: check reset write error Carlos Casadiego via B4 Relay
2026-09-25 3:05 ` Jonathan Cameron
[not found] ` <CALnzk4Uz1ru-_u-SgQXszHW_PL5DbY20J38v1yGCnwBafcwgKQ@mail.gmail.com>
2026-09-25 16:34 ` cdcp 206
2026-09-25 17:35 ` Carlos Casadiego
2026-09-25 18:14 ` Carlos Casadiego
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®