linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] add the capability to disable st_lsm6dsx sensor-hub
@ 2021-11-10 14:42 Lorenzo Bianconi
  2021-11-10 14:42 ` [PATCH 1/2] iio: imu: st_lsm6dsx: add dts property to disable sensor-hub Lorenzo Bianconi
  2021-11-10 14:42 ` [PATCH 2/2] Documentation: dt: iio: st_lsm6dsx: add disable-shub property Lorenzo Bianconi
  0 siblings, 2 replies; 7+ messages in thread
From: Lorenzo Bianconi @ 2021-11-10 14:42 UTC (permalink / raw)
  To: jic23; +Cc: lorenzo.bianconi, linux-iio, mario.tesi, devicetree

Introduce the capability to disable sensorhub through a device-tree property
since since there are some configurations where users want to
explicitly disable sensor-hub auto-probing at bootstrap.
A typical configuration is when the sensorhub clock/data lines are connected
to a pull-up resistor since no slave sensors are connected to the i2c master.
If SDO/SA0 line is connected to the same pull-up resistor, when the driver
tries to probe slave devices connected on sensor-hub, it will force SDO/SA0
line to low, modifying the device i2c address.

Lorenzo Bianconi (2):
  iio: imu: st_lsm6dsx: add dts property to disable sensor-hub
  Documentation: dt: iio: st_lsm6dsx: add disable-shub property

 Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml | 4 ++++
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c              | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] iio: imu: st_lsm6dsx: add dts property to disable sensor-hub
  2021-11-10 14:42 [PATCH 0/2] add the capability to disable st_lsm6dsx sensor-hub Lorenzo Bianconi
@ 2021-11-10 14:42 ` Lorenzo Bianconi
  2021-11-12 16:27   ` Jonathan Cameron
  2021-11-10 14:42 ` [PATCH 2/2] Documentation: dt: iio: st_lsm6dsx: add disable-shub property Lorenzo Bianconi
  1 sibling, 1 reply; 7+ messages in thread
From: Lorenzo Bianconi @ 2021-11-10 14:42 UTC (permalink / raw)
  To: jic23; +Cc: lorenzo.bianconi, linux-iio, mario.tesi, devicetree

Introduce the capability to disable sensorhub through a device-tree
property since there are some configurations where users want to
explicitly disable sensor-hub auto-probing at bootstrap.
A typical configuration is when the sensorhub clock/data lines are connected
to a pull-up resistor since no slave sensors are connected to the i2c master.
If SDO/SA0 line is connected to the same pull-up resistor, when the driver
tries to probe slave devices connected on sensor-hub, it will force SDO/SA0
line to low, modifying the device i2c address.

Tested-by: Mario Tesi <mario.tesi@st.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index f2cbbc756459..82ac6c59ca03 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -2244,7 +2244,9 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
 		return err;
 
 	hub_settings = &hw->settings->shub_settings;
-	if (hub_settings->master_en.addr) {
+	if (hub_settings->master_en.addr &&
+	    (!dev_fwnode(dev) ||
+	     !device_property_read_bool(dev, "st,disable-shub"))) {
 		err = st_lsm6dsx_shub_probe(hw, name);
 		if (err < 0)
 			return err;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] Documentation: dt: iio: st_lsm6dsx: add disable-shub property
  2021-11-10 14:42 [PATCH 0/2] add the capability to disable st_lsm6dsx sensor-hub Lorenzo Bianconi
  2021-11-10 14:42 ` [PATCH 1/2] iio: imu: st_lsm6dsx: add dts property to disable sensor-hub Lorenzo Bianconi
@ 2021-11-10 14:42 ` Lorenzo Bianconi
  2021-11-12 16:28   ` Jonathan Cameron
  1 sibling, 1 reply; 7+ messages in thread
From: Lorenzo Bianconi @ 2021-11-10 14:42 UTC (permalink / raw)
  To: jic23; +Cc: lorenzo.bianconi, linux-iio, mario.tesi, devicetree

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml b/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
index d9b3213318fb..502438f14e19 100644
--- a/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
+++ b/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
@@ -61,6 +61,10 @@ properties:
     type: boolean
     description: enable/disable internal i2c controller pullup resistors.
 
+  st,disable-shub:
+    type: boolean
+    description: enable/disable internal i2c controller.
+
   drive-open-drain:
     type: boolean
     description:
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] iio: imu: st_lsm6dsx: add dts property to disable sensor-hub
  2021-11-10 14:42 ` [PATCH 1/2] iio: imu: st_lsm6dsx: add dts property to disable sensor-hub Lorenzo Bianconi
@ 2021-11-12 16:27   ` Jonathan Cameron
  2021-11-12 17:50     ` Lorenzo Bianconi
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2021-11-12 16:27 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: lorenzo.bianconi, linux-iio, mario.tesi, devicetree

On Wed, 10 Nov 2021 15:42:32 +0100
Lorenzo Bianconi <lorenzo@kernel.org> wrote:

> Introduce the capability to disable sensorhub through a device-tree
> property since there are some configurations where users want to
> explicitly disable sensor-hub auto-probing at bootstrap.
> A typical configuration is when the sensorhub clock/data lines are connected
> to a pull-up resistor since no slave sensors are connected to the i2c master.
> If SDO/SA0 line is connected to the same pull-up resistor, when the driver
> tries to probe slave devices connected on sensor-hub, it will force SDO/SA0
> line to low, modifying the device i2c address.

That's some 'interesting' wiring...

My only suggestion here is perhaps expand on shub as disable-sensor-hub
would be easier for people not familiar with the abbreviation?

Jonathan

> 
> Tested-by: Mario Tesi <mario.tesi@st.com>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> index f2cbbc756459..82ac6c59ca03 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> @@ -2244,7 +2244,9 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
>  		return err;
>  
>  	hub_settings = &hw->settings->shub_settings;
> -	if (hub_settings->master_en.addr) {
> +	if (hub_settings->master_en.addr &&
> +	    (!dev_fwnode(dev) ||
> +	     !device_property_read_bool(dev, "st,disable-shub"))) {
>  		err = st_lsm6dsx_shub_probe(hw, name);
>  		if (err < 0)
>  			return err;


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] Documentation: dt: iio: st_lsm6dsx: add disable-shub property
  2021-11-10 14:42 ` [PATCH 2/2] Documentation: dt: iio: st_lsm6dsx: add disable-shub property Lorenzo Bianconi
@ 2021-11-12 16:28   ` Jonathan Cameron
  2021-11-12 17:50     ` Lorenzo Bianconi
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2021-11-12 16:28 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: lorenzo.bianconi, linux-iio, mario.tesi, devicetree

On Wed, 10 Nov 2021 15:42:33 +0100
Lorenzo Bianconi <lorenzo@kernel.org> wrote:

A bit more description here would be good.

Also suggestion from patch 1 carries through to maybe spell
out sensor-hub in the property name?

> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml b/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
> index d9b3213318fb..502438f14e19 100644
> --- a/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
> +++ b/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
> @@ -61,6 +61,10 @@ properties:
>      type: boolean
>      description: enable/disable internal i2c controller pullup resistors.
>  
> +  st,disable-shub:
> +    type: boolean
> +    description: enable/disable internal i2c controller.
> +
>    drive-open-drain:
>      type: boolean
>      description:


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] iio: imu: st_lsm6dsx: add dts property to disable sensor-hub
  2021-11-12 16:27   ` Jonathan Cameron
@ 2021-11-12 17:50     ` Lorenzo Bianconi
  0 siblings, 0 replies; 7+ messages in thread
From: Lorenzo Bianconi @ 2021-11-12 17:50 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Lorenzo Bianconi, linux-iio, mario.tesi, devicetree

[-- Attachment #1: Type: text/plain, Size: 1890 bytes --]

> On Wed, 10 Nov 2021 15:42:32 +0100
> Lorenzo Bianconi <lorenzo@kernel.org> wrote:
> 
> > Introduce the capability to disable sensorhub through a device-tree
> > property since there are some configurations where users want to
> > explicitly disable sensor-hub auto-probing at bootstrap.
> > A typical configuration is when the sensorhub clock/data lines are connected
> > to a pull-up resistor since no slave sensors are connected to the i2c master.
> > If SDO/SA0 line is connected to the same pull-up resistor, when the driver
> > tries to probe slave devices connected on sensor-hub, it will force SDO/SA0
> > line to low, modifying the device i2c address.
> 
> That's some 'interesting' wiring...
> 
> My only suggestion here is perhaps expand on shub as disable-sensor-hub
> would be easier for people not familiar with the abbreviation?

ack, sure. I will fix it in v2.

Regards,
Lorenzo

> 
> Jonathan
> 
> > 
> > Tested-by: Mario Tesi <mario.tesi@st.com>
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > ---
> >  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > index f2cbbc756459..82ac6c59ca03 100644
> > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > @@ -2244,7 +2244,9 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
> >  		return err;
> >  
> >  	hub_settings = &hw->settings->shub_settings;
> > -	if (hub_settings->master_en.addr) {
> > +	if (hub_settings->master_en.addr &&
> > +	    (!dev_fwnode(dev) ||
> > +	     !device_property_read_bool(dev, "st,disable-shub"))) {
> >  		err = st_lsm6dsx_shub_probe(hw, name);
> >  		if (err < 0)
> >  			return err;
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] Documentation: dt: iio: st_lsm6dsx: add disable-shub property
  2021-11-12 16:28   ` Jonathan Cameron
@ 2021-11-12 17:50     ` Lorenzo Bianconi
  0 siblings, 0 replies; 7+ messages in thread
From: Lorenzo Bianconi @ 2021-11-12 17:50 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Lorenzo Bianconi, linux-iio, mario.tesi, devicetree

[-- Attachment #1: Type: text/plain, Size: 1151 bytes --]

> On Wed, 10 Nov 2021 15:42:33 +0100
> Lorenzo Bianconi <lorenzo@kernel.org> wrote:
> 
> A bit more description here would be good.
> 
> Also suggestion from patch 1 carries through to maybe spell
> out sensor-hub in the property name?

ack, fine to me. I will fix it.

Regards,
Lorenzo

> 
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > ---
> >  Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml b/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
> > index d9b3213318fb..502438f14e19 100644
> > --- a/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
> > +++ b/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
> > @@ -61,6 +61,10 @@ properties:
> >      type: boolean
> >      description: enable/disable internal i2c controller pullup resistors.
> >  
> > +  st,disable-shub:
> > +    type: boolean
> > +    description: enable/disable internal i2c controller.
> > +
> >    drive-open-drain:
> >      type: boolean
> >      description:
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-11-12 17:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10 14:42 [PATCH 0/2] add the capability to disable st_lsm6dsx sensor-hub Lorenzo Bianconi
2021-11-10 14:42 ` [PATCH 1/2] iio: imu: st_lsm6dsx: add dts property to disable sensor-hub Lorenzo Bianconi
2021-11-12 16:27   ` Jonathan Cameron
2021-11-12 17:50     ` Lorenzo Bianconi
2021-11-10 14:42 ` [PATCH 2/2] Documentation: dt: iio: st_lsm6dsx: add disable-shub property Lorenzo Bianconi
2021-11-12 16:28   ` Jonathan Cameron
2021-11-12 17:50     ` Lorenzo Bianconi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).