Message ID | 78e0ba2979aca8cc1894fe4c99e784591ba681f1.1636552075.git.lorenzo@kernel.org (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | add the capability to disable st_lsm6dsx sensor-hub | expand |
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;
> 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; >
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;