Re: [PATCH 03/10] iio: st_sensors: make BDU optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jonathan, Linus,

Ops. It was my fault.


On 30/04/15 14:15, Linus Walleij wrote:
Not all sensors support BDU (block data update) and in fact a
bunch of the in-kernel sensor settings do not specify the
BDU address field. Make this optional.

Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
Applied, though I wonder if this causes any problems on the existing
devices that don't specify a BDU register?  If so perhaps
it should be going in quicker as a fix?

Or are we just lucky in that writing address 0 never does any
harm?
We were just lucky. Magnetomer sensors do not have BDU bit.


---
  drivers/iio/common/st_sensors/st_sensors_core.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 5a01093b29a2..cbeb5e01bc3a 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -344,11 +344,13 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
  		return err;
/* set BDU */
-	err = st_sensors_write_data_with_mask(indio_dev,
+	if (sdata->sensor_settings->bdu.addr) {
+		err = st_sensors_write_data_with_mask(indio_dev,
  					sdata->sensor_settings->bdu.addr,
  					sdata->sensor_settings->bdu.mask, true);
-	if (err < 0)
-		return err;
+		if (err < 0)
+			return err;
+	}
err = st_sensors_set_axis_enable(indio_dev, ST_SENSORS_ENABLE_ALL_AXIS);

Thanks,
Denis

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux