* [PATCH] iio: imu: bno555: Fix reset pin operation
@ 2026-12-03 10:49 Jochen Henneberg
2026-12-03 14:26 ` Andy Shevchenko
2026-12-03 14:45 ` Arnav Kapoor
0 siblings, 2 replies; 6+ messages in thread
From: Jochen Henneberg @ 2026-12-03 10:49 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Maoyi Xie, Jochen Henneberg, linux-iio
The reset input is low-active and this is how the dt bindinds example
configures it. However, the driver code treats it as high-active
because the gpio functions set the logical state not the physical
state.
Signed-off-by: Jochen Henneberg <jh@henneberg-systemdesign.com>
---
drivers/iio/imu/bno055/bno055.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/imu/bno055/bno055.c b/drivers/iio/imu/bno055/bno055.c
index c64c155db4f5..3791fe718b16 100644
--- a/drivers/iio/imu/bno055/bno055.c
+++ b/drivers/iio/imu/bno055/bno055.c
@@ -355,9 +355,9 @@ static int bno055_system_reset(struct bno055_priv *priv)
int ret;
if (priv->reset_gpio) {
- gpiod_set_value_cansleep(priv->reset_gpio, 0);
- usleep_range(5000, 10000);
gpiod_set_value_cansleep(priv->reset_gpio, 1);
+ usleep_range(5000, 10000);
+ gpiod_set_value_cansleep(priv->reset_gpio, 0);
} else if (priv->sw_reset) {
ret = regmap_write(priv->regmap, BNO055_SYS_TRIGGER_REG,
BNO055_SYS_TRIGGER_RST_SYS);
@@ -1603,7 +1603,7 @@ int bno055_probe(struct device *dev, struct regmap *regmap,
priv->xfer_burst_break_thr = xfer_burst_break_thr;
priv->sw_reset = sw_reset;
- priv->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+ priv->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(priv->reset_gpio))
return dev_err_probe(dev, PTR_ERR(priv->reset_gpio), "Failed to get reset GPIO\n");
@@ -1613,7 +1613,7 @@ int bno055_probe(struct device *dev, struct regmap *regmap,
if (priv->reset_gpio) {
usleep_range(5000, 10000);
- gpiod_set_value_cansleep(priv->reset_gpio, 1);
+ gpiod_set_value_cansleep(priv->reset_gpio, 0);
usleep_range(650000, 750000);
} else if (!sw_reset) {
dev_warn(dev, "No usable reset method; IMU may be unreliable\n");
--
2.56.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] iio: imu: bno555: Fix reset pin operation
2026-12-03 10:49 [PATCH] iio: imu: bno555: Fix reset pin operation Jochen Henneberg
@ 2026-12-03 14:26 ` Andy Shevchenko
2026-12-04 9:02 ` Jochen Henneberg
2026-12-03 14:45 ` Arnav Kapoor
1 sibling, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2026-12-03 14:26 UTC (permalink / raw)
To: Jochen Henneberg
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Maoyi Xie, linux-iio
On Thu, Dec 03, 2026 at 11:49:43AM +0100, Jochen Henneberg wrote:
> The reset input is low-active and this is how the dt bindinds example
> configures it. However, the driver code treats it as high-active
> because the gpio functions set the logical state not the physical
> state.
Please, just convert this to use reset-gpio driver and reset APIs.
It will be better and might allow shared signals in the future
(if ever required).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] iio: imu: bno555: Fix reset pin operation
2026-12-03 10:49 [PATCH] iio: imu: bno555: Fix reset pin operation Jochen Henneberg
2026-12-03 14:26 ` Andy Shevchenko
@ 2026-12-03 14:45 ` Arnav Kapoor
1 sibling, 0 replies; 6+ messages in thread
From: Arnav Kapoor @ 2026-12-03 14:45 UTC (permalink / raw)
To: Jochen Henneberg
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Maoyi Xie, linux-iio
On Thu, Dec 03, 2026 at 11:49:43AM +0100, Jochen Henneberg wrote:
> The reset input is low-active and this is how the dt bindinds example
> configures it. However, the driver code treats it as high-active
> because the gpio functions set the logical state not the physical
> state.
The change itself looks right to me: with GPIO_ACTIVE_LOW as in the
binding, probe currently ends up holding the chip in reset. A few
comments on the patch:
- Subject: s/bno555/bno055/. Also s/bindinds/bindings/ above.
- This needs a Fixes: tag, I think:
Fixes: 4aefe1c2bd0c ("iio: imu: add Bosch Sensortec BNO055 core driver")
- Any DT that worked around the old behaviour by describing the line
as GPIO_ACTIVE_HIGH will stop working after this. There is no such
user in-tree (the only in-tree bno055 node, omap3-gta04a5.dts, has
no reset-gpios), but please say that in the commit message so it is
clear the behaviour change was considered.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] iio: imu: bno555: Fix reset pin operation
2026-12-03 14:26 ` Andy Shevchenko
@ 2026-12-04 9:02 ` Jochen Henneberg
2026-12-04 9:25 ` Arnav Kapoor
2026-12-04 16:34 ` Andy Shevchenko
0 siblings, 2 replies; 6+ messages in thread
From: Jochen Henneberg @ 2026-12-04 9:02 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Maoyi Xie, linux-iio
Andy Shevchenko <andriy.shevchenko@intel.com> writes:
> On Thu, Dec 03, 2026 at 11:49:43AM +0100, Jochen Henneberg wrote:
>> The reset input is low-active and this is how the dt bindinds example
>> configures it. However, the driver code treats it as high-active
>> because the gpio functions set the logical state not the physical
>> state.
>
> Please, just convert this to use reset-gpio driver and reset APIs.
> It will be better and might allow shared signals in the future
> (if ever required).
Just pushed v2 with the reset controller but after thinking about this
again it raised a question. The Kconfig does not enable
RESET_CONTROLLER, however, the fallback function if the reset subsystem
is not enabled returns ENOTSUPP which in case of this driver would cause
a probe error. Is this intended even though the reset is optional? Or
would it be better to select RESET_CONTROLLER from Kconfig? But then, in
case RESET_GPIO is not selected it will silently fail to setup the reset
controller because that does not cause an error (GPIO lookup does simply
not happen). This could also be confusing if everything looks good from
the device tree and no errors but no reset available.
I'm a bit confused here. Sorry that I have send the patch update before
asking the question but that came to my mind right after sending.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] iio: imu: bno555: Fix reset pin operation
2026-12-04 9:02 ` Jochen Henneberg
@ 2026-12-04 9:25 ` Arnav Kapoor
2026-12-04 16:34 ` Andy Shevchenko
1 sibling, 0 replies; 6+ messages in thread
From: Arnav Kapoor @ 2026-12-04 9:25 UTC (permalink / raw)
To: Jochen Henneberg
Cc: Andy Shevchenko, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Maoyi Xie, linux-iio
On Fri, Dec 04, 2026 at 10:02:24AM +0100, Jochen Henneberg wrote:
> Just pushed v2 with the reset controller but after thinking about this
> again it raised a question. The Kconfig does not enable
> RESET_CONTROLLER, however, the fallback function if the reset subsystem
> is not enabled returns ENOTSUPP which in case of this driver would cause
> a probe error. Is this intended even though the reset is optional? Or
> would it be better to select RESET_CONTROLLER from Kconfig?
I don't think the probe error can happen. With RESET_CONTROLLER=n,
the stubs in include/linux/reset.h only return -ENOTSUPP for the
non-optional getters. For the _optional_ ones they return NULL:
return optional ? NULL : ERR_PTR(-ENOTSUPP);
So devm_reset_control_get_optional_exclusive() gives NULL, and the
driver falls back to the register reset as before. I built v2 with
RESET_CONTROLLER=n and it is fine. ad8366 did the same conversion
recently (ee4f8c56e46a, "iio: amplifiers: ad8366: replace reset-gpio
with reset controller") without touching Kconfig.
> But then, in
> case RESET_GPIO is not selected it will silently fail to setup the reset
> controller because that does not cause an error (GPIO lookup does simply
> not happen).
Right, __fwnode_reset_control_get() only looks at reset-gpios when
CONFIG_RESET_GPIO is enabled, and otherwise returns NULL for an
optional reset. If you want to cover that, "imply RESET_GPIO" in the
BOSCH_BNO055 Kconfig entry would enable it by default without forcing
it (drivers/net/dsa/lantiq/Kconfig does this). I'll leave it to Andy
and Jonathan whether they want that.
I have a few more comments on v2 itself, which I'll send there.
Thanks,
Arnav
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] iio: imu: bno555: Fix reset pin operation
2026-12-04 9:02 ` Jochen Henneberg
2026-12-04 9:25 ` Arnav Kapoor
@ 2026-12-04 16:34 ` Andy Shevchenko
1 sibling, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2026-12-04 16:34 UTC (permalink / raw)
To: Jochen Henneberg
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Maoyi Xie, linux-iio
On Fri, Dec 04, 2026 at 10:02:24AM +0100, Jochen Henneberg wrote:
> Andy Shevchenko <andriy.shevchenko@intel.com> writes:
>
> > On Thu, Dec 03, 2026 at 11:49:43AM +0100, Jochen Henneberg wrote:
> >> The reset input is low-active and this is how the dt bindinds example
> >> configures it. However, the driver code treats it as high-active
> >> because the gpio functions set the logical state not the physical
> >> state.
> >
> > Please, just convert this to use reset-gpio driver and reset APIs.
> > It will be better and might allow shared signals in the future
> > (if ever required).
>
> Just pushed v2 with the reset controller but after thinking about this
> again it raised a question. The Kconfig does not enable
> RESET_CONTROLLER, however, the fallback function if the reset subsystem
> is not enabled returns ENOTSUPP which in case of this driver would cause
> a probe error. Is this intended even though the reset is optional? Or
> would it be better to select RESET_CONTROLLER from Kconfig? But then, in
> case RESET_GPIO is not selected it will silently fail to setup the reset
> controller because that does not cause an error (GPIO lookup does simply
> not happen). This could also be confusing if everything looks good from
> the device tree and no errors but no reset available.
All of these are good questions. TBH, I don't know the answer. It may or
may not be a good use. We probably need a common voice (as IIO subsystem)
on such a conversion. Sorry if I missed the one we already have (if any).
Jonathan, others?
> I'm a bit confused here. Sorry that I have send the patch update before
> asking the question but that came to my mind right after sending.
No problem, it's good that you asked!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-12-04 16:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 10:49 [PATCH] iio: imu: bno555: Fix reset pin operation Jochen Henneberg
2026-12-03 14:26 ` Andy Shevchenko
2026-12-04 9:02 ` Jochen Henneberg
2026-12-04 9:25 ` Arnav Kapoor
2026-12-04 16:34 ` Andy Shevchenko
2026-12-03 14:45 ` Arnav Kapoor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox