Commit ad3eb9ab authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman

staging:iio:accel:adis16204 move to chan_spec based setup.

For clean drivers its easier to convert to chan_spec based
registration than to work around the scan_el attributes
going away.

Some minor cleanups done whilst here.

Untested.

V2: used IIO_CHAN macro
Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d37b24b3
......@@ -82,7 +82,7 @@ struct adis16204_state {
struct mutex buf_lock;
};
int adis16204_set_irq(struct device *dev, bool enable);
int adis16204_set_irq(struct iio_dev *indio_dev, bool enable);
#ifdef CONFIG_IIO_RING_BUFFER
enum adis16204_scan {
......@@ -103,8 +103,6 @@ ssize_t adis16204_read_data_from_ring(struct device *dev,
int adis16204_configure_ring(struct iio_dev *indio_dev);
void adis16204_unconfigure_ring(struct iio_dev *indio_dev);
int adis16204_initialize_ring(struct iio_ring_buffer *ring);
void adis16204_uninitialize_ring(struct iio_ring_buffer *ring);
#else /* CONFIG_IIO_RING_BUFFER */
static inline void adis16204_remove_trigger(struct iio_dev *indio_dev)
......@@ -133,14 +131,5 @@ static inline void adis16204_unconfigure_ring(struct iio_dev *indio_dev)
{
}
static inline int adis16204_initialize_ring(struct iio_ring_buffer *ring)
{
return 0;
}
static inline void adis16204_uninitialize_ring(struct iio_ring_buffer *ring)
{
}
#endif /* CONFIG_IIO_RING_BUFFER */
#endif /* SPI_ADIS16204_H_ */
This diff is collapsed.
......@@ -17,44 +17,6 @@
#include "../trigger.h"
#include "adis16204.h"
static IIO_SCAN_EL_C(in_supply, ADIS16204_SCAN_SUPPLY, ADIS16204_SUPPLY_OUT, NULL);
static IIO_CONST_ATTR_SCAN_EL_TYPE(in_supply, u, 12, 16);
static IIO_SCAN_EL_C(accel_x, ADIS16204_SCAN_ACC_X, ADIS16204_XACCL_OUT, NULL);
static IIO_SCAN_EL_C(accel_y, ADIS16204_SCAN_ACC_Y, ADIS16204_YACCL_OUT, NULL);
static IIO_CONST_ATTR_SCAN_EL_TYPE(accel, s, 14, 16);
static IIO_SCAN_EL_C(in0, ADIS16204_SCAN_AUX_ADC, ADIS16204_AUX_ADC, NULL);
static IIO_CONST_ATTR_SCAN_EL_TYPE(in0, u, 12, 16);
static IIO_SCAN_EL_C(temp, ADIS16204_SCAN_TEMP, ADIS16204_TEMP_OUT, NULL);
static IIO_CONST_ATTR_SCAN_EL_TYPE(temp, u, 12, 16);
static IIO_SCAN_EL_TIMESTAMP(5);
static IIO_CONST_ATTR_SCAN_EL_TYPE(timestamp, s, 64, 64);
static struct attribute *adis16204_scan_el_attrs[] = {
&iio_scan_el_in_supply.dev_attr.attr,
&iio_const_attr_in_supply_index.dev_attr.attr,
&iio_const_attr_in_supply_type.dev_attr.attr,
&iio_scan_el_accel_x.dev_attr.attr,
&iio_const_attr_accel_x_index.dev_attr.attr,
&iio_scan_el_accel_y.dev_attr.attr,
&iio_const_attr_accel_y_index.dev_attr.attr,
&iio_const_attr_accel_type.dev_attr.attr,
&iio_scan_el_in0.dev_attr.attr,
&iio_const_attr_in0_index.dev_attr.attr,
&iio_const_attr_in0_type.dev_attr.attr,
&iio_scan_el_temp.dev_attr.attr,
&iio_const_attr_temp_index.dev_attr.attr,
&iio_const_attr_temp_type.dev_attr.attr,
&iio_scan_el_timestamp.dev_attr.attr,
&iio_const_attr_timestamp_index.dev_attr.attr,
&iio_const_attr_timestamp_type.dev_attr.attr,
NULL,
};
static struct attribute_group adis16204_scan_el_group = {
.attrs = adis16204_scan_el_attrs,
.name = "scan_elements",
};
/**
* adis16204_read_ring_data() read data registers which will be placed into ring
* @dev: device associated with child of actual device (iio_dev or iio_trig)
......@@ -80,7 +42,8 @@ static int adis16204_read_ring_data(struct device *dev, u8 *rx)
xfers[i].len = 2;
xfers[i].delay_usecs = 20;
xfers[i].tx_buf = st->tx + 2 * i;
st->tx[2 * i] = ADIS16204_READ_REG(ADIS16204_SUPPLY_OUT + 2 * i);
st->tx[2 * i]
= ADIS16204_READ_REG(ADIS16204_SUPPLY_OUT + 2 * i);
st->tx[2 * i + 1] = 0;
if (i >= 1)
xfers[i].rx_buf = rx + 2 * (i - 1);
......@@ -154,7 +117,6 @@ int adis16204_configure_ring(struct iio_dev *indio_dev)
/* Effectively select the ring buffer implementation */
iio_ring_sw_register_funcs(&ring->access);
ring->bpe = 2;
ring->scan_el_attrs = &adis16204_scan_el_group;
ring->scan_timestamp = true;
ring->preenable = &iio_sw_ring_preenable;
ring->postenable = &iio_triggered_ring_postenable;
......@@ -162,11 +124,11 @@ int adis16204_configure_ring(struct iio_dev *indio_dev)
ring->owner = THIS_MODULE;
/* Set default scan mode */
iio_scan_mask_set(ring, iio_scan_el_in_supply.number);
iio_scan_mask_set(ring, iio_scan_el_accel_x.number);
iio_scan_mask_set(ring, iio_scan_el_accel_y.number);
iio_scan_mask_set(ring, iio_scan_el_temp.number);
iio_scan_mask_set(ring, iio_scan_el_in0.number);
iio_scan_mask_set(ring, ADIS16204_SCAN_SUPPLY);
iio_scan_mask_set(ring, ADIS16204_SCAN_ACC_X);
iio_scan_mask_set(ring, ADIS16204_SCAN_ACC_Y);
iio_scan_mask_set(ring, ADIS16204_SCAN_AUX_ADC);
iio_scan_mask_set(ring, ADIS16204_SCAN_TEMP);
indio_dev->pollfunc = kzalloc(sizeof(*indio_dev->pollfunc), GFP_KERNEL);
if (indio_dev->pollfunc == NULL) {
......@@ -193,13 +155,3 @@ int adis16204_configure_ring(struct iio_dev *indio_dev)
iio_sw_rb_free(indio_dev->ring);
return ret;
}
int adis16204_initialize_ring(struct iio_ring_buffer *ring)
{
return iio_ring_buffer_register(ring, 0);
}
void adis16204_uninitialize_ring(struct iio_ring_buffer *ring)
{
iio_ring_buffer_unregister(ring);
}
......@@ -33,7 +33,7 @@ static int adis16204_data_rdy_trigger_set_state(struct iio_trigger *trig,
struct iio_dev *indio_dev = st->indio_dev;
dev_dbg(&indio_dev->dev, "%s (%d)\n", __func__, state);
return adis16204_set_irq(&st->indio_dev->dev, state);
return adis16204_set_irq(st->indio_dev, state);
}
int adis16204_probe_trigger(struct iio_dev *indio_dev)
......
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