Merge tag 'iio-for-3.17a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes: First round of new drivers, cleanups and functionality for the 3.17 cycle. New drivers * t5403 barometric pressure sensor * kxcjk1013 accelerometer (with a locking followup fix). * ak09911 digital compass Documentation * ABI docs for proximity added (interface has been there a long time but somehow snuck through without being documented) * Move iio-trig-sysfs documentation out of staging (got left behind when the driver moved some time ago). Cleanups * drop the timestamp argument from iio_trigger_poll(_chained) as nothing has been done with it for some time. * ad799x kerneldoc for ad799x_chip brought up to date. * replace a number of reimplementations of the GENMASK macro and use the BIT macro to cleanup a few locations. * bring the iio_event_monitor example program up to date with new device types. * fix some incorrect function prototypes in iio_utils.h example code. * INDIO_RING_TRIGGERED to INDIO_BUFFER_TRIGGERED fix in docs. This got left behind after we renamed it a long time back. * fix error handling in the generic_buffer example program. * small tidy ups in the iio-trig-periodic-rtc driver. * Allow reseting iio-trig-periodic-rtc frequency to 0 (default) after it has changed. * Trivial tidy ups in coding style in iio_simply_dummy
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/bitops.h>
|
||||
|
||||
#include <linux/iio/iio.h>
|
||||
#include <linux/iio/sysfs.h>
|
||||
@@ -25,23 +26,19 @@
|
||||
|
||||
#include <linux/platform_data/ad7298.h>
|
||||
|
||||
#define AD7298_WRITE (1 << 15) /* write to the control register */
|
||||
#define AD7298_REPEAT (1 << 14) /* repeated conversion enable */
|
||||
#define AD7298_CH(x) (1 << (13 - (x))) /* channel select */
|
||||
#define AD7298_TSENSE (1 << 5) /* temperature conversion enable */
|
||||
#define AD7298_EXTREF (1 << 2) /* external reference enable */
|
||||
#define AD7298_TAVG (1 << 1) /* temperature sensor averaging enable */
|
||||
#define AD7298_PDD (1 << 0) /* partial power down enable */
|
||||
#define AD7298_WRITE BIT(15) /* write to the control register */
|
||||
#define AD7298_REPEAT BIT(14) /* repeated conversion enable */
|
||||
#define AD7298_CH(x) BIT(13 - (x)) /* channel select */
|
||||
#define AD7298_TSENSE BIT(5) /* temperature conversion enable */
|
||||
#define AD7298_EXTREF BIT(2) /* external reference enable */
|
||||
#define AD7298_TAVG BIT(1) /* temperature sensor averaging enable */
|
||||
#define AD7298_PDD BIT(0) /* partial power down enable */
|
||||
|
||||
#define AD7298_MAX_CHAN 8
|
||||
#define AD7298_BITS 12
|
||||
#define AD7298_STORAGE_BITS 16
|
||||
#define AD7298_INTREF_mV 2500
|
||||
|
||||
#define AD7298_CH_TEMP 9
|
||||
|
||||
#define RES_MASK(bits) ((1 << (bits)) - 1)
|
||||
|
||||
struct ad7298_state {
|
||||
struct spi_device *spi;
|
||||
struct regulator *reg;
|
||||
@@ -257,7 +254,7 @@ static int ad7298_read_raw(struct iio_dev *indio_dev,
|
||||
return ret;
|
||||
|
||||
if (chan->address != AD7298_CH_TEMP)
|
||||
*val = ret & RES_MASK(AD7298_BITS);
|
||||
*val = ret & GENMASK(chan->scan_type.realbits - 1, 0);
|
||||
|
||||
return IIO_VAL_INT;
|
||||
case IIO_CHAN_INFO_SCALE:
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/bitops.h>
|
||||
|
||||
#include <linux/iio/iio.h>
|
||||
#include <linux/iio/sysfs.h>
|
||||
@@ -21,8 +22,6 @@
|
||||
#include <linux/iio/trigger_consumer.h>
|
||||
#include <linux/iio/triggered_buffer.h>
|
||||
|
||||
#define RES_MASK(bits) ((1 << (bits)) - 1)
|
||||
|
||||
struct ad7476_state;
|
||||
|
||||
struct ad7476_chip_info {
|
||||
@@ -117,7 +116,7 @@ static int ad7476_read_raw(struct iio_dev *indio_dev,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
*val = (ret >> st->chip_info->channel[0].scan_type.shift) &
|
||||
RES_MASK(st->chip_info->channel[0].scan_type.realbits);
|
||||
GENMASK(st->chip_info->channel[0].scan_type.realbits - 1, 0);
|
||||
return IIO_VAL_INT;
|
||||
case IIO_CHAN_INFO_SCALE:
|
||||
if (!st->chip_info->int_vref_uv) {
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include <linux/err.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/bitops.h>
|
||||
|
||||
#include <linux/iio/iio.h>
|
||||
#include <linux/iio/sysfs.h>
|
||||
@@ -25,14 +26,14 @@
|
||||
|
||||
#include <linux/platform_data/ad7887.h>
|
||||
|
||||
#define AD7887_REF_DIS (1 << 5) /* on-chip reference disable */
|
||||
#define AD7887_DUAL (1 << 4) /* dual-channel mode */
|
||||
#define AD7887_CH_AIN1 (1 << 3) /* convert on channel 1, DUAL=1 */
|
||||
#define AD7887_CH_AIN0 (0 << 3) /* convert on channel 0, DUAL=0,1 */
|
||||
#define AD7887_PM_MODE1 (0) /* CS based shutdown */
|
||||
#define AD7887_PM_MODE2 (1) /* full on */
|
||||
#define AD7887_PM_MODE3 (2) /* auto shutdown after conversion */
|
||||
#define AD7887_PM_MODE4 (3) /* standby mode */
|
||||
#define AD7887_REF_DIS BIT(5) /* on-chip reference disable */
|
||||
#define AD7887_DUAL BIT(4) /* dual-channel mode */
|
||||
#define AD7887_CH_AIN1 BIT(3) /* convert on channel 1, DUAL=1 */
|
||||
#define AD7887_CH_AIN0 0 /* convert on channel 0, DUAL=0,1 */
|
||||
#define AD7887_PM_MODE1 0 /* CS based shutdown */
|
||||
#define AD7887_PM_MODE2 1 /* full on */
|
||||
#define AD7887_PM_MODE3 2 /* auto shutdown after conversion */
|
||||
#define AD7887_PM_MODE4 3 /* standby mode */
|
||||
|
||||
enum ad7887_channels {
|
||||
AD7887_CH0,
|
||||
@@ -40,8 +41,6 @@ enum ad7887_channels {
|
||||
AD7887_CH1,
|
||||
};
|
||||
|
||||
#define RES_MASK(bits) ((1 << (bits)) - 1)
|
||||
|
||||
/**
|
||||
* struct ad7887_chip_info - chip specifc information
|
||||
* @int_vref_mv: the internal reference voltage
|
||||
@@ -167,7 +166,7 @@ static int ad7887_read_raw(struct iio_dev *indio_dev,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
*val = ret >> chan->scan_type.shift;
|
||||
*val &= RES_MASK(chan->scan_type.realbits);
|
||||
*val &= GENMASK(chan->scan_type.realbits - 1, 0);
|
||||
return IIO_VAL_INT;
|
||||
case IIO_CHAN_INFO_SCALE:
|
||||
if (st->reg) {
|
||||
|
@@ -105,9 +105,8 @@ enum {
|
||||
* struct ad799x_chip_info - chip specific information
|
||||
* @channel: channel specification
|
||||
* @num_channels: number of channels
|
||||
* @monitor_mode: whether the chip supports monitor interrupts
|
||||
* @default_config: device default configuration
|
||||
* @event_attrs: pointer to the monitor event attribute group
|
||||
* @info: pointer to iio_info struct
|
||||
*/
|
||||
struct ad799x_chip_info {
|
||||
struct iio_chan_spec channel[9];
|
||||
|
@@ -410,7 +410,7 @@ static irqreturn_t ad_sd_data_rdy_trig_poll(int irq, void *private)
|
||||
complete(&sigma_delta->completion);
|
||||
disable_irq_nosync(irq);
|
||||
sigma_delta->irq_dis = true;
|
||||
iio_trigger_poll(sigma_delta->trig, iio_get_time_ns());
|
||||
iio_trigger_poll(sigma_delta->trig);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
@@ -272,7 +272,7 @@ void handle_adc_eoc_trigger(int irq, struct iio_dev *idev)
|
||||
|
||||
if (iio_buffer_enabled(idev)) {
|
||||
disable_irq_nosync(irq);
|
||||
iio_trigger_poll(idev->trig, iio_get_time_ns());
|
||||
iio_trigger_poll(idev->trig);
|
||||
} else {
|
||||
st->last_value = at91_adc_readl(st, AT91_ADC_LCDR);
|
||||
st->done = true;
|
||||
|
@@ -486,7 +486,7 @@ static irqreturn_t xadc_axi_interrupt_handler(int irq, void *devid)
|
||||
return IRQ_NONE;
|
||||
|
||||
if ((status & XADC_AXI_INT_EOS) && xadc->trigger)
|
||||
iio_trigger_poll(xadc->trigger, 0);
|
||||
iio_trigger_poll(xadc->trigger);
|
||||
|
||||
if (status & XADC_AXI_INT_ALARM_MASK) {
|
||||
/*
|
||||
|
Reference in New Issue
Block a user