add the capability to disable st_lsm6dsx sensor-hub
Subsystems (3)
Lorenzo Bianconi
maintainercover add the capability to disable st_lsm6dsx sensor-hub
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(-)
Signature · 1 line
2.31.1
Lorenzo Bianconi
maintainerPATCH 1/2 iio: imu: st_lsm6dsx: add dts property to disable sensor-hub
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.
--- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +3 -1
@@ -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;
Signature · 1 line
2.31.1
Lorenzo Bianconi
maintainerPATCH 2/2 Documentation: dt: iio: st_lsm6dsx: add disable-shub property
In reply to Lorenzo Bianconi--- Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml +4 -0
@@ -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:
Signature · 1 line
2.31.1
Jonathan Cameron
maintainerRe: [PATCH 1/2] iio: imu: st_lsm6dsx: add dts property to disable sensor-hub
In reply to Lorenzo BianconiQuoted 8 lines · On Wed, 10 Nov 2021 15:42:32 +0100 Lorenzo Bianconi <[email protected]> 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
Quoted 22 lines
Tested-by Mario Tesi <[email protected]>Signed-off-by Lorenzo Bianconi <[email protected]>--- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +3
-1@@ -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;
Jonathan Cameron
maintainerRe: [PATCH 2/2] Documentation: dt: iio: st_lsm6dsx: add disable-shub property
In reply to Lorenzo BianconiOn Wed, 10 Nov 2021 15:42:33 +0100
Lorenzo Bianconi <[email protected]> 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?
Quoted 20 lines
Signed-off-by Lorenzo Bianconi <[email protected]>--- Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml | 4 ++++ 1 file changed, 4 insertions(+)Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml +4
-0@@ -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:
Re: [PATCH 1/2] iio: imu: st_lsm6dsx: add dts property to disable sensor-hub
In reply to Jonathan CameronQuoted 12 lines
Quoted 8 lines · On Wed, 10 Nov 2021 15:42:32 +0100 Lorenzo Bianconi <[email protected]> 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.
Quoted 4 lines
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
Quoted 26 lines
Jonathan
Quoted 22 lines
Tested-by Mario Tesi <[email protected]>Signed-off-by Lorenzo Bianconi <[email protected]>--- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +3
-1@@ -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;
Re: [PATCH 2/2] Documentation: dt: iio: st_lsm6dsx: add disable-shub property
In reply to Jonathan CameronQuoted 7 lines
On Wed, 10 Nov 2021 15:42:33 +0100
Lorenzo Bianconi <[email protected]> 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
Quoted 22 lines
Quoted 21 lines
Signed-off-by Lorenzo Bianconi <[email protected]>--- Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml | 4 ++++ 1 file changed, 4 insertions(+)Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml +4
-0@@ -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: