aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/common
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@kernel.org>2016-05-22 15:39:29 -0400
committerJonathan Cameron <jic23@kernel.org>2016-07-04 13:07:44 -0400
commit4e68cfbf345c3b9109242483cd56d551d38c8b85 (patch)
tree9f306d3a47044d32f3d365cd7f2e494ede7a00ce /drivers/iio/common
parentb541eaff4917a7429cd0e83cb3962383276db357 (diff)
iio: accel: st_accel: Add lis3l02dq support
Time to finally kill off the venerable (it was one of my first drivers) lis3l02dq driver in favour of adding support in the st sensors framework. This does loose us the event support that driver always had, but I think that will reappear at some point and in the meantime the maintenance advantages of dropping the 'special' driver for this one part outweigh the issues. It's worth noting this part is ancient and I may well be the only person who still has any on hardware running recent kernels. It has a few 'quirks'. - No WAI register so that just became optional. - A BDU option that really does block updates. Completely. Whatever you do, you don't get any more data with it set. It is documented the same as more modern parts but I presume they are actually clearing for updates after a read of both bytes! - Fixed scale. - It's too quick. Even at slowest rate (280Hz) I can't read out fast enough on my board (stargate 2) to beat new data coming in. Linus' repeat read patch doesn't help in this case. It just means I get 10 readings before dying... So in reality this will get used with software triggers only unless someone has this long out of production device on a quick board. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Cc: Denis CIOCCA <denis.ciocca@st.com> Cc: Crestez Dan Leonard <leonard.crestez@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/common')
-rw-r--r--drivers/iio/common/st_sensors/st_sensors_core.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 6db12ea034d3..26ce32552448 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -550,7 +550,7 @@ int st_sensors_check_device_support(struct iio_dev *indio_dev,
550 int num_sensors_list, 550 int num_sensors_list,
551 const struct st_sensor_settings *sensor_settings) 551 const struct st_sensor_settings *sensor_settings)
552{ 552{
553 int i, n, err; 553 int i, n, err = 0;
554 u8 wai; 554 u8 wai;
555 struct st_sensor_data *sdata = iio_priv(indio_dev); 555 struct st_sensor_data *sdata = iio_priv(indio_dev);
556 556
@@ -570,17 +570,21 @@ int st_sensors_check_device_support(struct iio_dev *indio_dev,
570 return -ENODEV; 570 return -ENODEV;
571 } 571 }
572 572
573 err = sdata->tf->read_byte(&sdata->tb, sdata->dev, 573 if (sensor_settings[i].wai_addr) {
574 sensor_settings[i].wai_addr, &wai); 574 err = sdata->tf->read_byte(&sdata->tb, sdata->dev,
575 if (err < 0) { 575 sensor_settings[i].wai_addr, &wai);
576 dev_err(&indio_dev->dev, "failed to read Who-Am-I register.\n"); 576 if (err < 0) {
577 return err; 577 dev_err(&indio_dev->dev,
578 } 578 "failed to read Who-Am-I register.\n");
579 return err;
580 }
579 581
580 if (sensor_settings[i].wai != wai) { 582 if (sensor_settings[i].wai != wai) {
581 dev_err(&indio_dev->dev, "%s: WhoAmI mismatch (0x%x).\n", 583 dev_err(&indio_dev->dev,
582 indio_dev->name, wai); 584 "%s: WhoAmI mismatch (0x%x).\n",
583 return -EINVAL; 585 indio_dev->name, wai);
586 return -EINVAL;
587 }
584 } 588 }
585 589
586 sdata->sensor_settings = 590 sdata->sensor_settings =