Commit d22fd9c5 authored by Michael Hennerich's avatar Michael Hennerich Committed by Greg Kroah-Hartman

staging:iio:adc:ad799x: Convert to new channel registration method.

Convert to new channel registration method
Update copyright header
Add missing call to iio_trigger_notify_done()

V2: IIO_CHAN macro updates
Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Acked-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f39e086a
/*
* Copyright (C) 2010 Michael Hennerich, Analog Devices Inc.
* Copyright (C) 2010-2011 Michael Hennerich, Analog Devices Inc.
* Copyright (C) 2008-2010 Jonathan Cameron
*
* This program is free software; you can redistribute it and/or modify
......@@ -67,6 +67,8 @@
#define AD7997_8_READ_SINGLE 0x80
#define AD7997_8_READ_SEQUENCE 0x70
/* TODO: move this into a common header */
#define RES_MASK(bits) ((1 << (bits)) - 1)
enum {
ad7991,
......@@ -83,30 +85,21 @@ struct ad799x_state;
/**
* struct ad799x_chip_info - chip specifc information
* @num_inputs: number of physical inputs on chip
* @bits: accuracy of the adc in bits
* @channel: channel specification
* @num_channels: number of channels
* @int_vref_mv: the internal reference voltage
* @monitor_mode: whether the chip supports monitor interrupts
* @default_config: device default configuration
* @dev_attrs: pointer to the device attribute group
* @scan_attrs: pointer to the scan element attribute group
* @event_attrs: pointer to the monitor event attribute group
* @ad799x_set_scan_mode: function pointer to the device specific mode function
*/
struct ad799x_chip_info {
u8 num_inputs;
u8 bits;
u8 storagebits;
char sign;
struct iio_chan_spec channel[9];
int num_channels;
u16 int_vref_mv;
bool monitor_mode;
u16 default_config;
struct attribute_group *dev_attrs;
struct attribute_group *scan_attrs;
struct attribute_group *event_attrs;
int (*ad799x_set_scan_mode) (struct ad799x_state *st,
unsigned mask);
};
struct ad799x_state {
......@@ -130,7 +123,7 @@ struct ad799x_platform_data {
u16 vref_mv;
};
int ad799x_set_scan_mode(struct ad799x_state *st, unsigned mask);
int ad7997_8_set_scan_mode(struct ad799x_state *st, unsigned mask);
#ifdef CONFIG_AD799X_RING_BUFFER
int ad799x_single_channel_from_ring(struct ad799x_state *st, long mask);
......
This diff is collapsed.
......@@ -80,7 +80,7 @@ static int ad799x_ring_preenable(struct iio_dev *indio_dev)
*/
if (st->id == ad7997 || st->id == ad7998)
ad799x_set_scan_mode(st, ring->scan_mask);
ad7997_8_set_scan_mode(st, ring->scan_mask);
st->d_size = ring->scan_count * 2;
......@@ -119,7 +119,7 @@ static irqreturn_t ad799x_trigger_handler(int irq, void *p)
rxbuf = kmalloc(st->d_size, GFP_KERNEL);
if (rxbuf == NULL)
return -ENOMEM;
goto out;
switch (st->id) {
case ad7991:
......@@ -157,6 +157,9 @@ static irqreturn_t ad799x_trigger_handler(int irq, void *p)
kfree(rxbuf);
if (b_sent < 0)
return b_sent;
out:
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
}
......@@ -195,8 +198,6 @@ int ad799x_register_ring_funcs_and_init(struct iio_dev *indio_dev)
indio_dev->ring->predisable = &iio_triggered_ring_predisable;
indio_dev->ring->scan_timestamp = true;
indio_dev->ring->scan_el_attrs = st->chip_info->scan_attrs;
/* Flag that polled ring buffering is possible */
indio_dev->modes |= INDIO_RING_TRIGGERED;
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment