summaryrefslogtreecommitdiffstats
path: root/drivers/iio/common
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-05-09 18:15:50 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-05-09 18:15:50 +0200
commit5ccca155675a5a2d491257a441306dd8547695c2 (patch)
tree6dd32e67c98f00e4d302f2550c03529f97238d35 /drivers/iio/common
parent7192a5dd54488b6fa81f071b2ae93e00b25f0ddd (diff)
parent1038a6872802bb4a07f627162ff989bf49e2e5cc (diff)
downloadop-kernel-dev-5ccca155675a5a2d491257a441306dd8547695c2.zip
op-kernel-dev-5ccca155675a5a2d491257a441306dd8547695c2.tar.gz
Merge tag 'iio-for-v4.2a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes: First round of new drivers, functionality and cleanups for the 4.2 cycle New drivers / device support * st sensors driver, lsm303dlh magnetometer support. * ltr501 - support ltr301 and ltr559 chips. New functionality * IIO_CHAN_INFO_CALIBEMISSIVITY for thermopile sensors. * kxcjk1013 - make driver operational with external trigger. * Add iio targets to the tools Makefile. Cleanups * st sensors - more helpful error message if device id wrong or irq request fails, explicitly make the Block Data Update optional rather than relying on writes to address 0 not doing anything, make interrupt support optional (Not always wired, and not all devices actually have an interrupt line.) * kxcjk-1013 white space additions for readability, add the KXCJ9000 ACPI id as seen in the wild. * sx9500 - GPIO reset support, refactor the GPIO interrupt code, add power management, optimize power usage by powering down when possible, rename the gpio interrupt pin to be more useful, trivial return path simplification, trivial formatting fixes. * isl29018 - move towards ABI compliance with a view to moving this driver out of staging, add some brackets to ensure code works as expected. Note there is no actual bug as the condition being tested is always true (with current devices). * ltr501 - add regmap support to get caching etc for later patches, fix a parameter sanity check that always fails (bug introduced earlier in this series), ACPI enumeration support, interrupt rate control support, interrupt support in general and integration time control support, code alignment cleanups. * mma9553 - a number of little cleanups following a review from Hartmut after I'd already applied the original driver patch. * tmp006 - prefix some defines with TMP006 for consistency. * tsl4531 - cleanup some wrong prefixes, presumably from copy and paste. * mlx90614 - check for errors in read values, add power management, add emissivity setting, add device tree binding documentation, fix a duplicate const warning. * ti_am335x_adc - refactor the DT parsing into a separate function.
Diffstat (limited to 'drivers/iio/common')
-rw-r--r--drivers/iio/common/st_sensors/st_sensors_core.c23
-rw-r--r--drivers/iio/common/st_sensors/st_sensors_trigger.c4
2 files changed, 21 insertions, 6 deletions
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index edd13d2..1255b15 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -245,6 +245,16 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
{
struct st_sensor_data *sdata = iio_priv(indio_dev);
+ /* Sensor does not support interrupts */
+ if (sdata->sensor_settings->drdy_irq.addr == 0) {
+ if (pdata->drdy_int_pin)
+ dev_info(&indio_dev->dev,
+ "DRDY on pin INT%d specified, but sensor "
+ "does not support interrupts\n",
+ pdata->drdy_int_pin);
+ return 0;
+ }
+
switch (pdata->drdy_int_pin) {
case 1:
if (sdata->sensor_settings->drdy_irq.mask_int1 == 0) {
@@ -285,7 +295,7 @@ static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev,
if (!of_property_read_u32(np, "st,drdy-int-pin", &val) && (val <= 2))
pdata->drdy_int_pin = (u8) val;
else
- pdata->drdy_int_pin = defdata ? defdata->drdy_int_pin : 1;
+ pdata->drdy_int_pin = defdata ? defdata->drdy_int_pin : 0;
return pdata;
}
@@ -334,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);
@@ -491,7 +503,8 @@ int st_sensors_check_device_support(struct iio_dev *indio_dev,
break;
}
if (n == ARRAY_SIZE(sensor_settings[i].sensors_supported)) {
- dev_err(&indio_dev->dev, "device name and WhoAmI mismatch.\n");
+ dev_err(&indio_dev->dev, "device name \"%s\" and WhoAmI (0x%02x) mismatch",
+ indio_dev->name, wai);
goto sensor_name_mismatch;
}
diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c b/drivers/iio/common/st_sensors/st_sensors_trigger.c
index 8d8ca6f..3e90704 100644
--- a/drivers/iio/common/st_sensors/st_sensors_trigger.c
+++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c
@@ -37,8 +37,10 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
IRQF_TRIGGER_RISING,
sdata->trig->name,
sdata->trig);
- if (err)
+ if (err) {
+ dev_err(&indio_dev->dev, "failed to request trigger IRQ.\n");
goto request_irq_error;
+ }
iio_trigger_set_drvdata(sdata->trig, indio_dev);
sdata->trig->ops = trigger_ops;
OpenPOWER on IntegriCloud