staging:iio: Add support for multiple buffers (testing required!)
Subsystems (7)
Jonathan Cameron
maintainerv6 cover staging:iio: Add support for multiple buffers (testing required!)
Same as V5 but with the changes from Lars-Peter's review to close some memory leaks and catch up with some changes in the subsystem that had passed this by. It should also now be possible to disable the timestamp! (oops).
Thanks to Lars for his work reviewing my patches and also for his excellent work reviewing in general! Without him the whole subsystem would be moving a lot slower.
Again, more testing would be good (thanks for those who already have).
In quick summary this is needed to do interrupt driven in kernel clients as it adds the option to push to multiple 'buffer' interfaces. Note that some of these may not actually do any buffering but rather push directly into another subsytem (the example is input).
I would like to merge at least the first 3 patches early in this cycle. What I need is some testing across a reasonable range of devices. Review is welcome of course as well!
The complexity in this set is entirely in the changes to industrialio-buffer.c concerning how we go about adding and removing client buffers. To do this we need to work out which scan mask is appropriate given the requests of all the given buffers (and whether we can satisfy it). I've been testing with the max1363 driver which probably has the most complex set of available scan masks. Thus when a new buffer is added or one is removed the whole buffer set are torn down and built up again. This may be undesirable for some applications but should occur only rarely.
The example driver is for bridging to the input subsystem and still needs some work, but that can occur later in this merge cycle whereas the changes to the core really want to go in asap.
Changes since v3
Rebased and added other drivers that have occured whilst this patch series has been languishing in my local tree.
Changes since V2.
Improved handling of error conditions in the buffer insertion and removal code. (suggested by Lars-Peter). I want to take another look at these, but didn't want to keep people from testing this in the meantime.
Also a number of minor fixes that came up during testing.
Thanks,
Jonathan
Jonathan Cameron (4):
staging:iio: Add support for multiple buffers staging:iio:in kernel users: Add a data field for channel specific
info.
staging:iio: add a callback buffer for in kernel push interface staging:iio: Proof of concept input driver.
drivers/iio/Kconfig | 6 + drivers/iio/Makefile | 1 + drivers/iio/accel/hid-sensor-accel-3d.c | 15 +- drivers/iio/adc/ad7266.c | 3 +- drivers/iio/adc/ad7476.c | 2 +- drivers/iio/adc/ad_sigma_delta.c | 2 +- drivers/iio/adc/at91_adc.c | 3 +- drivers/iio/buffer_cb.c | 113 +++++++ drivers/iio/gyro/hid-sensor-gyro-3d.c | 15 +- drivers/iio/industrialio-buffer.c | 380 ++++++++++++++++-------- drivers/iio/industrialio-core.c | 1 + drivers/iio/inkern.c | 1 + drivers/iio/light/adjd_s311.c | 3 +- drivers/iio/light/hid-sensor-als.c | 15 +- drivers/iio/magnetometer/hid-sensor-magn-3d.c | 15 +- drivers/staging/iio/Kconfig | 11 + drivers/staging/iio/Makefile | 1 + drivers/staging/iio/accel/adis16201_ring.c | 2 +- drivers/staging/iio/accel/adis16203_ring.c | 2 +- drivers/staging/iio/accel/adis16204_ring.c | 2 +- drivers/staging/iio/accel/adis16209_ring.c | 2 +- drivers/staging/iio/accel/adis16240_ring.c | 2 +- drivers/staging/iio/accel/lis3l02dq_ring.c | 2 +- drivers/staging/iio/adc/ad7298_ring.c | 2 +- drivers/staging/iio/adc/ad7606_ring.c | 2 +- drivers/staging/iio/adc/ad7887_ring.c | 2 +- drivers/staging/iio/adc/ad799x_ring.c | 2 +- drivers/staging/iio/adc/max1363_ring.c | 2 +- drivers/staging/iio/gyro/adis16260_ring.c | 2 +- drivers/staging/iio/iio_input.c | 225 ++++++++++++++ drivers/staging/iio/iio_input.h | 23 ++ drivers/staging/iio/iio_simple_dummy_buffer.c | 5 +- drivers/staging/iio/impedance-analyzer/ad5933.c | 4 +- drivers/staging/iio/imu/adis16400_ring.c | 5 +- drivers/staging/iio/meter/ade7758_ring.c | 2 +- include/linux/iio/buffer.h | 24 +- include/linux/iio/consumer.h | 48 +++ include/linux/iio/iio.h | 2 + include/linux/iio/machine.h | 2 + 39 files changed, 743 insertions(+), 208 deletions(-) create mode 100644 drivers/iio/buffer_cb.c create mode 100644 drivers/staging/iio/iio_input.c create mode 100644 drivers/staging/iio/iio_input.h
Signature · 1 line
1.7.12.4
Jonathan Cameron
maintainerPATCH v6 1/4 staging:iio: Add support for multiple buffers
Route all buffer writes through the demux. Addition or removal of a buffer results in tear down and setup of all the buffers for a given device.
--- drivers/iio/accel/hid-sensor-accel-3d.c | 15 +- drivers/iio/adc/ad7266.c | 3 +- drivers/iio/adc/ad7476.c | 2 +- drivers/iio/adc/ad_sigma_delta.c | 2 +- drivers/iio/adc/at91_adc.c | 3 +- drivers/iio/gyro/hid-sensor-gyro-3d.c | 15 +- drivers/iio/industrialio-buffer.c | 380 ++++++++++++++++-------- drivers/iio/industrialio-core.c | 1 + drivers/iio/light/adjd_s311.c | 3 +- drivers/iio/light/hid-sensor-als.c | 15 +- drivers/iio/magnetometer/hid-sensor-magn-3d.c | 15 +- drivers/staging/iio/accel/adis16201_ring.c | 2 +- drivers/staging/iio/accel/adis16203_ring.c | 2 +- drivers/staging/iio/accel/adis16204_ring.c | 2 +- drivers/staging/iio/accel/adis16209_ring.c | 2 +- drivers/staging/iio/accel/adis16240_ring.c | 2 +- drivers/staging/iio/accel/lis3l02dq_ring.c | 2 +- drivers/staging/iio/adc/ad7298_ring.c | 2 +- drivers/staging/iio/adc/ad7606_ring.c | 2 +- drivers/staging/iio/adc/ad7887_ring.c | 2 +- drivers/staging/iio/adc/ad799x_ring.c | 2 +- drivers/staging/iio/adc/max1363_ring.c | 2 +- drivers/staging/iio/gyro/adis16260_ring.c | 2 +- drivers/staging/iio/iio_simple_dummy_buffer.c | 5 +- drivers/staging/iio/impedance-analyzer/ad5933.c | 4 +- drivers/staging/iio/imu/adis16400_ring.c | 5 +- drivers/staging/iio/meter/ade7758_ring.c | 2 +- include/linux/iio/buffer.h | 24 +- include/linux/iio/iio.h | 2 + 29 files changed, 312 insertions(+), 208 deletions(-)
drivers/iio/accel/hid-sensor-accel-3d.c +1 -14
@@ -197,21 +197,8 @@ static const struct iio_info accel_3d_info = {/* Function to push data to buffer */ static void hid_sensor_push_data (struct iio_dev *indio_dev,u8 *data,int len) { -struct iio_buffer *buffer = indio_dev->buffer; -int datum_sz; -dev_dbg (&indio_dev->dev,"hid_sensor_push_data\n" ); -if (!buffer) { -dev_err (&indio_dev->dev,"Buffer == NULL\n" ); -return ; - } - datum_sz = buffer->access->get_bytes_per_datum (buffer); -if (len > datum_sz) { -dev_err (&indio_dev->dev,"Datum size mismatch %d:%d\n" , len, - datum_sz); -return ; - } -iio_push_to_buffer (buffer, (u8 *)data); +iio_push_to_buffers (indio_dev, (u8 *)data); }/* Callback handler to send event after all samples are received and captured */
drivers/iio/adc/ad7266.c +1 -2
@@ -91,7 +91,6 @@ static irqreturn_t ad7266_trigger_handler(int irq, void *p) {struct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev; -struct iio_buffer *buffer = indio_dev->buffer;struct ad7266_state *st =iio_priv (indio_dev);int ret;
@@ -99,7 +98,7 @@ static irqreturn_t ad7266_trigger_handler(int irq, void *p)if (ret ==0 ) {if (indio_dev->scan_timestamp) ((s64 *)st->data)[1 ] = pf->timestamp; -iio_push_to_buffer (buffer, (u8 *)st->data); +iio_push_to_buffers (indio_dev, (u8 *)st->data); }iio_trigger_notify_done (indio_dev->trig);
drivers/iio/adc/ad7476.c +1 -1
@@ -76,7 +76,7 @@ static irqreturn_t ad7476_trigger_handler(int irq, void *p)if (indio_dev->scan_timestamp) ((s64 *)st->data)[1 ] = time_ns; -iio_push_to_buffer (indio_dev->buffer, st->data); +iio_push_to_buffers (indio_dev, st->data); done:iio_trigger_notify_done (indio_dev->trig);
drivers/iio/adc/ad_sigma_delta.c +1 -1
@@ -391,7 +391,7 @@ static irqreturn_t ad_sd_trigger_handler(int irq, void *p)break ; } -iio_push_to_buffer (indio_dev->buffer, (uint8_t *)data); +iio_push_to_buffers (indio_dev, (uint8_t *)data);iio_trigger_notify_done (indio_dev->trig); sigma_delta->irq_dis = false;
drivers/iio/adc/at91_adc.c +1 -2
@@ -65,7 +65,6 @@ static irqreturn_t at91_adc_trigger_handler(int irq, void *p)struct iio_poll_func *pf = p;struct iio_dev *idev = pf->indio_dev;struct at91_adc_state *st =iio_priv (idev); -struct iio_buffer *buffer = idev->buffer;int i, j =0 ;for (i =0 ; i < idev->masklength; i++) {
@@ -81,7 +80,7 @@ static irqreturn_t at91_adc_trigger_handler(int irq, void *p) *timestamp = pf->timestamp; } -iio_push_to_buffer (buffer, st->buffer); +iio_push_to_buffers (indio_dev, (u8 *)st->buffer);iio_trigger_notify_done (idev->trig);
drivers/iio/gyro/hid-sensor-gyro-3d.c +1 -14
@@ -197,21 +197,8 @@ static const struct iio_info gyro_3d_info = {/* Function to push data to buffer */ static void hid_sensor_push_data (struct iio_dev *indio_dev,u8 *data,int len) { -struct iio_buffer *buffer = indio_dev->buffer; -int datum_sz; -dev_dbg (&indio_dev->dev,"hid_sensor_push_data\n" ); -if (!buffer) { -dev_err (&indio_dev->dev,"Buffer == NULL\n" ); -return ; - } - datum_sz = buffer->access->get_bytes_per_datum (buffer); -if (len > datum_sz) { -dev_err (&indio_dev->dev,"Datum size mismatch %d:%d\n" , len, - datum_sz); -return ; - } -iio_push_to_buffer (buffer, (u8 *)data); +iio_push_to_buffers (indio_dev, (u8 *)data); }/* Callback handler to send event after all samples are received and captured */
drivers/iio/industrialio-buffer.c +263 -117
466 lines not on this page · raw message
drivers/iio/industrialio-core.c +1 -0
@@ -856,6 +856,7 @@ struct iio_dev *iio_device_alloc(int sizeof_priv)return NULL ; }dev_set_name (&dev->dev,"iio:device%d" , dev->id); +INIT_LIST_HEAD (&dev->buffer_list); }return dev;
drivers/iio/light/adjd_s311.c +1 -2
@@ -164,7 +164,6 @@ static irqreturn_t adjd_s311_trigger_handler(int irq, void *p)struct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev;struct adjd_s311_data *data =iio_priv (indio_dev); -struct iio_buffer *buffer = indio_dev->buffer;s64 time_ns =iio_get_time_ns ();int len =0 ;int i, j =0 ;
@@ -187,7 +186,7 @@ static irqreturn_t adjd_s311_trigger_handler(int irq, void *p)if (indio_dev->scan_timestamp) *(s64 *)((u8 *)data->buffer +ALIGN (len,sizeof (s64))) = time_ns; -iio_push_to_buffer (buffer, (u8 *)data->buffer); +iio_push_to_buffers (indio_dev, (u8 *)data->buffer); done:iio_trigger_notify_done (indio_dev->trig);
drivers/iio/light/hid-sensor-als.c +1 -14
@@ -176,21 +176,8 @@ static const struct iio_info als_info = {/* Function to push data to buffer */ static void hid_sensor_push_data (struct iio_dev *indio_dev,u8 *data,int len) { -struct iio_buffer *buffer = indio_dev->buffer; -int datum_sz; -dev_dbg (&indio_dev->dev,"hid_sensor_push_data\n" ); -if (!buffer) { -dev_err (&indio_dev->dev,"Buffer == NULL\n" ); -return ; - } - datum_sz = buffer->access->get_bytes_per_datum (buffer); -if (len > datum_sz) { -dev_err (&indio_dev->dev,"Datum size mismatch %d:%d\n" , len, - datum_sz); -return ; - } -iio_push_to_buffer (buffer, (u8 *)data); +iio_push_to_buffers (indio_dev, (u8 *)data); }/* Callback handler to send event after all samples are received and captured */
drivers/iio/magnetometer/hid-sensor-magn-3d.c +1 -14
@@ -198,21 +198,8 @@ static const struct iio_info magn_3d_info = {/* Function to push data to buffer */ static void hid_sensor_push_data (struct iio_dev *indio_dev,u8 *data,int len) { -struct iio_buffer *buffer = indio_dev->buffer; -int datum_sz; -dev_dbg (&indio_dev->dev,"hid_sensor_push_data\n" ); -if (!buffer) { -dev_err (&indio_dev->dev,"Buffer == NULL\n" ); -return ; - } - datum_sz = buffer->access->get_bytes_per_datum (buffer); -if (len > datum_sz) { -dev_err (&indio_dev->dev,"Datum size mismatch %d:%d\n" , len, - datum_sz); -return ; - } -iio_push_to_buffer (buffer, (u8 *)data); +iio_push_to_buffers (indio_dev, (u8 *)data); }/* Callback handler to send event after all samples are received and captured */
drivers/staging/iio/accel/adis16201_ring.c +1 -1
@@ -82,7 +82,7 @@ static irqreturn_t adis16201_trigger_handler(int irq, void *p)if (indio_dev->scan_timestamp) *((s64 *)(data + ((i +3 )/4 )*4 )) = pf->timestamp; -iio_push_to_buffer (indio_dev->buffer, (u8 *)data); +iio_push_to_buffers (indio_dev, (u8 *)data);kfree (data); done:
drivers/staging/iio/accel/adis16203_ring.c +1 -1
@@ -81,7 +81,7 @@ static irqreturn_t adis16203_trigger_handler(int irq, void *p)if (indio_dev->scan_timestamp) *((s64 *)(data + ((i +3 )/4 )*4 )) = pf->timestamp; -iio_push_to_buffer (indio_dev->buffer, (u8 *)data); +iio_push_to_buffers (indio_dev, (u8 *)data);kfree (data); done:
drivers/staging/iio/accel/adis16204_ring.c +1 -1
@@ -78,7 +78,7 @@ static irqreturn_t adis16204_trigger_handler(int irq, void *p)if (indio_dev->scan_timestamp) *((s64 *)(data + ((i +3 )/4 )*4 )) = pf->timestamp; -iio_push_to_buffer (indio_dev->buffer, (u8 *)data); +iio_push_to_buffers (indio_dev, (u8 *)data);kfree (data); done:
drivers/staging/iio/accel/adis16209_ring.c +1 -1
@@ -78,7 +78,7 @@ static irqreturn_t adis16209_trigger_handler(int irq, void *p)if (indio_dev->scan_timestamp) *((s64 *)(data + ((i +3 )/4 )*4 )) = pf->timestamp; -iio_push_to_buffer (indio_dev->buffer, (u8 *)data); +iio_push_to_buffers (indio_dev, (u8 *)data);kfree (data); done:
drivers/staging/iio/accel/adis16240_ring.c +1 -1
@@ -76,7 +76,7 @@ static irqreturn_t adis16240_trigger_handler(int irq, void *p)if (indio_dev->scan_timestamp) *((s64 *)(data + ((i +3 )/4 )*4 )) = pf->timestamp; -iio_push_to_buffer (indio_dev->buffer, (u8 *)data); +iio_push_to_buffers (indio_dev, (u8 *)data);kfree (data); done:
drivers/staging/iio/accel/lis3l02dq_ring.c +1 -1
@@ -154,7 +154,7 @@ static irqreturn_t lis3l02dq_trigger_handler(int irq, void *p)if (indio_dev->scan_timestamp) *(s64 *)((u8 *)data +ALIGN (len,sizeof (s64))) = pf->timestamp; -iio_push_to_buffer (indio_dev->buffer, (u8 *)data); +iio_push_to_buffers (indio_dev, (u8 *)data);kfree (data); done:
drivers/staging/iio/adc/ad7298_ring.c +1 -1
@@ -93,7 +93,7 @@ static irqreturn_t ad7298_trigger_handler(int irq, void *p) indio_dev->masklength); i++) buf[i] =be16_to_cpu (st->rx_buf[i]); -iio_push_to_buffer (indio_dev->buffer, (u8 *)buf); +iio_push_to_buffers (indio_dev, (u8 *)buf); done:iio_trigger_notify_done (indio_dev->trig);
drivers/staging/iio/adc/ad7606_ring.c +1 -1
@@ -83,7 +83,7 @@ static void ad7606_poll_bh_to_ring(struct work_struct *work_s)if (indio_dev->scan_timestamp) *((s64 *)(buf + indio_dev->scan_bytes -sizeof (s64))) = time_ns; -iio_push_to_buffer (indio_dev->buffer, buf); +iio_push_to_buffers (indio_dev, buf); done:gpio_set_value (st->pdata->gpio_convst,0 );iio_trigger_notify_done (indio_dev->trig);
drivers/staging/iio/adc/ad7887_ring.c +1 -1
@@ -95,7 +95,7 @@ static irqreturn_t ad7887_trigger_handler(int irq, void *p)memcpy (buf + indio_dev->scan_bytes -sizeof (s64), &time_ns,sizeof (time_ns)); -iio_push_to_buffer (indio_dev->buffer, buf); +iio_push_to_buffers (indio_dev, buf); done:kfree (buf);iio_trigger_notify_done (indio_dev->trig);
drivers/staging/iio/adc/ad799x_ring.c +1 -1
@@ -77,7 +77,7 @@ static irqreturn_t ad799x_trigger_handler(int irq, void *p)memcpy (rxbuf + indio_dev->scan_bytes -sizeof (s64), &time_ns,sizeof (time_ns)); -iio_push_to_buffer (indio_dev->buffer, rxbuf); +iio_push_to_buffers (indio_dev, rxbuf); done:kfree (rxbuf); out:
drivers/staging/iio/adc/max1363_ring.c +1 -1
@@ -80,7 +80,7 @@ static irqreturn_t max1363_trigger_handler(int irq, void *p)if (indio_dev->scan_timestamp)memcpy (rxbuf + d_size -sizeof (s64), &time_ns,sizeof (time_ns)); -iio_push_to_buffer (indio_dev->buffer, rxbuf); +iio_push_to_buffers (indio_dev, rxbuf); done_free:kfree (rxbuf);
drivers/staging/iio/gyro/adis16260_ring.c +1 -1
@@ -81,7 +81,7 @@ static irqreturn_t adis16260_trigger_handler(int irq, void *p)if (indio_dev->scan_timestamp) *((s64 *)(data + ((i +3 )/4 )*4 )) = pf->timestamp; -iio_push_to_buffer (indio_dev->buffer, (u8 *)data); +iio_push_to_buffers (indio_dev, (u8 *)data);kfree (data); done:
drivers/staging/iio/iio_simple_dummy_buffer.c +2 -3
@@ -46,7 +46,6 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p) {struct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev; -struct iio_buffer *buffer = indio_dev->buffer;int len =0 ;u16 *data;
@@ -76,7 +75,7 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p) i <bitmap_weight (indio_dev->active_scan_mask, indio_dev->masklength); i++, j++) { - j =find_next_bit (buffer->scan_mask, + j =find_next_bit (indio_dev->active_scan_mask, indio_dev->masklength, j);/* random access read from the 'device' */ data[i] = fakedata[j];
@@ -87,7 +86,7 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p)if (indio_dev->scan_timestamp) *(s64 *)((u8 *)data +ALIGN (len,sizeof (s64))) =iio_get_time_ns (); -iio_push_to_buffer (buffer, (u8 *)data); +iio_push_to_buffers (indio_dev, (u8 *)data);kfree (data);
drivers/staging/iio/impedance-analyzer/ad5933.c +1 -3
@@ -647,7 +647,6 @@ static void ad5933_work(struct work_struct *work)struct ad5933_state *st =container_of (work, struct ad5933_state, work.work);struct iio_dev *indio_dev =i2c_get_clientdata (st->client); -struct iio_buffer *ring = indio_dev->buffer;signed short buf[2 ];unsigned char status;
@@ -677,8 +676,7 @@ static void ad5933_work(struct work_struct *work) }else { buf[0 ] =be16_to_cpu (buf[0 ]); } -/* save datum to the ring */ -iio_push_to_buffer (ring, (u8 *)buf); +iio_push_to_buffers (indio_dev, (u8 *)buf); }else {/* no data available - try again later */ schedule_delayed_work (&st->work, st->poll_time_jiffies);
drivers/staging/iio/imu/adis16400_ring.c +2 -3
@@ -114,7 +114,6 @@ static irqreturn_t adis16400_trigger_handler(int irq, void *p)struct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev;struct adis16400_state *st =iio_priv (indio_dev); -struct iio_buffer *ring = indio_dev->buffer;int i =0 , j, ret =0 ;s16 *data;
@@ -148,9 +147,9 @@ static irqreturn_t adis16400_trigger_handler(int irq, void *p) } }/* Guaranteed to be aligned with 8 byte boundary */ -if (ring->scan_timestamp) +if (indio_dev->scan_timestamp) *((s64 *)(data + ((i +3 )/4 )*4 )) = pf->timestamp; -iio_push_to_buffer (ring, (u8 *) data); +iio_push_to_buffers (indio_dev, (u8 *) data); done:kfree (data);
drivers/staging/iio/meter/ade7758_ring.c +1 -1
@@ -73,7 +73,7 @@ static irqreturn_t ade7758_trigger_handler(int irq, void *p)if (indio_dev->scan_timestamp) dat64[1 ] = pf->timestamp; -iio_push_to_buffer (indio_dev->buffer, (u8 *)dat64); +iio_push_to_buffers (indio_dev, (u8 *)dat64);iio_trigger_notify_done (indio_dev->trig);
include/linux/iio/buffer.h +19 -5
@@ -66,7 +66,8 @@ struct iio_buffer_access_funcs {* @stufftoread: [INTERN] flag to indicate new data. * @demux_list: [INTERN] list of operations required to demux the scan. * @demux_bounce: [INTERN] buffer for doing gather from incoming scan. -**/ +* @buffer_list: [INTERN] entry in the devices list of current buffers. +*/ struct iio_buffer {int length;int bytes_per_datum;
@@ -81,9 +82,22 @@ struct iio_buffer {const struct attribute_group *attrs;struct list_head demux_list;unsigned char *demux_bounce; +struct list_head buffer_list; };/** +* iio_update_buffers() - add or remove buffer from active list +* @indio_dev: device to add buffer to +* @insert_buffer: buffer to insert +* @remove_buffer: buffer_to_remove +* +* Note this will tear down the all buffering and build it up again +*/ +int iio_update_buffers (struct iio_dev *indio_dev, +struct iio_buffer *insert_buffer, +struct iio_buffer *remove_buffer); + +/** * iio_buffer_init() - Initialize the buffer structure * @buffer: buffer to be initialized **/
@@ -115,11 +129,11 @@ int iio_scan_mask_set(struct iio_dev *indio_dev, struct iio_buffer *buffer, int bit);/** -* iio_push_to_buffer() - push to a registered buffer. -* @buffer: IIO buffer structure for device -* @data: the data to push to the buffer +* iio_push_to_buffers() - push to a registered buffer. +* @indio_dev: iio_dev structure for device. +* @data: Full scan. */ -int iio_push_to_buffer (struct iio_buffer *buffer,unsigned char *data); +int iio_push_to_buffers (struct iio_dev *indio_dev,unsigned char *data);int iio_update_demux (struct iio_dev *indio_dev);
include/linux/iio/iio.h +2 -0
@@ -410,6 +410,7 @@ struct iio_buffer_setup_ops {* and owner * @event_interface: [INTERN] event chrdevs associated with interrupt lines * @buffer: [DRIVER] any buffer present +* @buffer_list: [INTERN] list of all buffers currently attached * @scan_bytes: [INTERN] num bytes captured to be fed to buffer demux * @mlock: [INTERN] lock used to prevent simultaneous device state * changes
@@ -448,6 +449,7 @@ struct iio_dev {struct iio_event_interface *event_interface;struct iio_buffer *buffer; +struct list_head buffer_list;int scan_bytes;struct mutex mlock;
Signature · 1 line
1.7.12.4
Jonathan Cameron
maintainerPATCH v6 2/4 staging:iio:in kernel users: Add a data field for channel specific info.
In reply to Jonathan CameronUsed to allow information about a given channel mapping to be passed through from board files to the consumer drivers.
--- drivers/iio/inkern.c | 1 + include/linux/iio/consumer.h | 2 ++ include/linux/iio/machine.h | 2 ++ 3 files changed, 5 insertions(+)
drivers/iio/inkern.c +1 -0
@@ -203,6 +203,7 @@ struct iio_channel *iio_channel_get_all(const char *name)if (name &&strcmp (name, c->map->consumer_dev_name) !=0 )continue ; chans[mapind].indio_dev = c->indio_dev; + chans[mapind].data = c->map->consumer_data; chans[mapind].channel =iio_chan_spec_from_name (chans[mapind].indio_dev, c->map->adc_channel_label);
include/linux/iio/consumer.h +2 -0
@@ -18,10 +18,12 @@ struct iio_chan_spec;* struct iio_channel - everything needed for a consumer to use a channel * @indio_dev: Device on which the channel exists. * @channel: Full description of the channel. +* @data: Data about the channel used by consumer. */ struct iio_channel {struct iio_dev *indio_dev;const struct iio_chan_spec *channel; +void *data; };/**
include/linux/iio/machine.h +2 -0
@@ -19,11 +19,13 @@* @consumer_dev_name: Name to uniquely identify the consumer device. * @consumer_channel: Unique name used to identify the channel on the * consumer side. +* @consumer_data: Data about the channel for use by the consumer driver. */ struct iio_map {const char *adc_channel_label;const char *consumer_dev_name;const char *consumer_channel; +void *consumer_data; };#endif
Signature · 1 line
1.7.12.4
Jonathan Cameron
maintainerPATCH v6 3/4 staging:iio: add a callback buffer for in kernel push interface
In reply to Jonathan CameronThis callback buffer is meant to be opaque to users, but basically adds a very simple pass through buffer to which data may be pushed when it is inserted into the buffer list.
--- drivers/iio/Kconfig | 6 +++ drivers/iio/Makefile | 1 + drivers/iio/buffer_cb.c | 113 +++++++++++++++++++++++++++++++++++++++++++ include/linux/iio/consumer.h | 46 ++++++++++++++++++ 4 files changed, 166 insertions(+)
drivers/iio/Kconfig +6 -0
@@ -20,6 +20,12 @@ config IIO_BUFFER if IIO_BUFFER +config IIO_BUFFER_CB + boolean "IIO callback buffer used for push in kernel interfaces" + help + Should be selected by any drivers that do inkernel push + usage. That is, those where the data is pushed to the consumer. + config IIO_KFIFO_BUF select IIO_TRIGGER tristate "Industrial I/O buffering based on kfifo"
drivers/iio/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_IIO) += industrialio.o industrialio-y := industrialio-core.o industrialio-event.o inkern.o industrialio-$(CONFIG_IIO_BUFFER) += industrialio-buffer.o industrialio-$(CONFIG_IIO_TRIGGER) += industrialio-trigger.o +industrialio-$(CONFIG_IIO_BUFFER_CB) += buffer_cb.o obj-$(CONFIG_IIO_TRIGGERED_BUFFER) += industrialio-triggered-buffer.o obj-$(CONFIG_IIO_KFIFO_BUF) += kfifo_buf.o
drivers/iio/buffer_cb.c new file +113 -0
113 lines not on this page · raw message
include/linux/iio/consumer.h +46 -0
52 lines not on this page · raw message
Signature · 1 line
1.7.12.4
Re: [PATCH 3/4] staging:iio: add a callback buffer for in kernel push interface
Hi,
I'm sure you missed my spellchecking :)
drivers/iio/Kconfig config IIO_BUFFER · line 28
Quoted 6 lines
drivers/iio/Kconfig +6
-0+config IIO_BUFFER_CB + boolean "IIO callback buffer used for push in kernel interfaces" + help + Should be selected by any drivers that do inkernel push + usage. That is, those where the data is pushed to the consumer. +
is it 'in kernel' or 'inkernel'? I'd prefer in-kernel :) indentation seems inconsistent
Quoted 4 lines
+/**
+ *iio_channel_cb_get_channels()- get access to the underlying channels.
+ * @cb_buff: The callback buffers from whom we want the channel
+ * information.
buffers from which?
Signature · 2 lines
Peter Meerwald +43-664-2444418 (mobile)
Jonathan Cameron
maintainerRe: [PATCH 3/4] staging:iio: add a callback buffer for in kernel push interface
Quoted 3 lines · Peter Meerwald
Hi,
I'm sure you missed my spellchecking :)
I am always happy to accept fixes like this that mean I don't look as much of an idiot when patches hit mainline ;)
Quoted 10 lines
drivers/iio/Kconfig config IIO_BUFFER · line 28
Quoted 7 lines
drivers/iio/Kconfig +6
-0+config IIO_BUFFER_CB + boolean "IIO callback buffer used for push in kernel interfaces" + help + Should be selected by any drivers that do inkernel push + usage. That is, those where the data is pushed to the consumer. +is it 'in kernel' or 'inkernel'? I'd prefer in-kernel :) indentation seems inconsistent
in-kernel is indeed nicer. I'll do that here and maybe clean up the other uses later.
Quoted 7 lines
Quoted 5 lines
+/**
+ *iio_channel_cb_get_channels()- get access to the underlying channels.
+ * @cb_buff: The callback buffers from whom we want the channel
+ * information.buffers from which?
actually should be 'buffer from whom'.
Good catch though - I could have read that 100 times and never noticed.
I'm lazy so won't repost the patch with these changes but will wait a little longer then merge it if no one shouts loudly that I shouldn't. (they'll be in the wip branch if anyone actually cares enough to look)
Jonathan Cameron
maintainerPATCH v6 4/4 staging:iio: Proof of concept input driver.
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
This is no where near ready to merge. Lots of stuff missing.
--- drivers/staging/iio/Kconfig | 11 ++ drivers/staging/iio/Makefile | 1 + drivers/staging/iio/iio_input.c | 225 ++++++++++++++++++++++++++++++++++++++++ drivers/staging/iio/iio_input.h | 23 ++++ 4 files changed, 260 insertions(+)
drivers/staging/iio/Kconfig +11 -0
@@ -4,6 +4,17 @@ menu "IIO staging drivers" depends on IIO +config IIO_ST_INPUT + tristate "Input driver that uses channels specified via iio maps" + depends on INPUT + depends on IIO_BUFFER + select IIO_BUFFER_CB + help + Client driver for IIO via the push interfaces. Used to provide + and input interface for IIO devices that can feed a buffer on + a trigger interrupt. Note that all channels must come from a + single IIO supported device. + config IIO_ST_HWMON tristate "Hwmon driver that uses channels specified via iio maps" depends on HWMON
drivers/staging/iio/Makefile +1 -0
@@ -12,6 +12,7 @@ iio_dummy-$(CONFIG_IIO_SIMPLE_DUMMY_BUFFER) += iio_simple_dummy_buffer.o obj-$(CONFIG_IIO_DUMMY_EVGEN) += iio_dummy_evgen.o obj-$(CONFIG_IIO_ST_HWMON) += iio_hwmon.o +obj-$(CONFIG_IIO_ST_INPUT) += iio_input.o obj-y += accel/ obj-y += adc/
drivers/staging/iio/iio_input.c new file +225 -0
225 lines not on this page · raw message
drivers/staging/iio/iio_input.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* The industrial I/O input client driver +* +* Copyright (c) 2011 Jonathan Cameron +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 as published by +* the Free Software Foundation. +*/ + +/** +* iio_input_channel_data - description of the channel for input subsystem +* @code: Absolute axis. +* @min: Minimum value. +* @max: Maximum value. +* @fuzz: Used to filter noise from the event stream. +* @flat: Values within this value will be discarded by joydev +* and reported as 0 instead. +*/ +struct iio_input_channel_data { +unsigned int code; +int min, max, fuzz, flat; +};
Signature · 1 line
1.7.12.4
Re: [PATCH 4/4] staging:iio: Proof of concept input driver.
drivers/staging/iio/Kconfig line 14
Quoted 9 lines
drivers/staging/iio/Kconfig +8
-0+config IIO_ST_INPUT + tristate "Input driver that uses channels specified via iio maps" + depends on INPUT + depends on IIO_BUFFER + select IIO_BUFFER_CB + help + Client driver for IIO via the push interfaces. Used to provide + and input interface for IIO devices that can feed a buffer on
an input interface
Quoted 1 line
+ * Copyright (c) 2011 Jonathan Cameron
2012 is almost over
drivers/staging/iio/iio_input.c line 60
Quoted 11 lines
drivers/staging/iio/iio_input.c new file +11
-0+case 32 : +switch (chan->scan_type.endianness) { +case IIO_CPU : + value = *(s32 *)(data); +break ; +case IIO_BE : + value =be32_to_cpu (*(__be32 *)data); +break ; +case IIO_LE : + value =le32_to_cpu (*(__le32 *)data); +break ;
here's an extra space between le32 and *
Quoted 20 lines
drivers/staging/iio/iio_input.c new file +14
-0+static struct platform_driver iio_input_driver = { + .driver = { + .name ="iio_input_bridge" , + .owner =THIS_MODULE , + }, + .probe = iio_input_probe, + .remove =__devexit_p (iio_input_remove), +}; + +module_platform_driver (iio_input_driver); + +MODULE_AUTHOR ("Jonathan Cameron <[email protected]>" ); +MODULE_DESCRIPTION ("IIO input buffer driver" ); +MODULE_LICENSE ("GPL v2" );drivers/staging/iio/iio_input.h new file +0
-0
drivers/staging/iio/iio_input.h line 2
Quoted 2 lines
drivers/staging/iio/iio_input.h new file +2
-0@@ -0,0 +1,23 @@ +/* +* The industrial I/O input client driver
this thing is callediio_input_bridge,
IIO input buffer_driver,
instrustrial I/O input client driver
within a few lines of code -- now is the time to christen the driver :)
Quoted 6 lines
drivers/staging/iio/iio_input.h new file +6
-0+* +* Copyright (c) 2011 Jonathan Cameron +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 as published by +* the Free Software Foundation.
drivers/staging/iio/iio_input.h line 18
Quoted 10 lines
drivers/staging/iio/iio_input.h new file +10
-0+*/ + +/** +* iio_input_channel_data - description of the channel for input subsystem +* @code: Absolute axis. +* @min: Minimum value. +* @max: Maximum value. +* @fuzz: Used to filter noise from the event stream. +* @flat: Values within this value will be discarded by joydev +* and reported as 0 instead.
@flat: Values within the range [-flat, flat] will be discarded ...
this is at least what I would guess it does; input.h is equally vague
Quoted 6 lines
drivers/staging/iio/iio_input.h new file +5
-0+*/ +struct iio_input_channel_data { +unsigned int code; +int min, max, fuzz, flat; +};
Signature · 2 lines
Peter Meerwald +43-664-2444418 (mobile)
Jonathan Cameron
maintainerRe: [PATCH 4/4] staging:iio: Proof of concept input driver.
I actually forgot to say in this posting - I'm not really intending to merge this driver just yet. It needs a fair bit of blugeoning then a bit of time to be hammered by the input list before it's ready. For now its just acting as an example user (and a means of testing the other patches).
Still the review is obviously most welcome!
Jonathan
Quoted 11 lines
drivers/staging/iio/Kconfig line 14
Quoted 9 lines
drivers/staging/iio/Kconfig +8
-0+config IIO_ST_INPUT + tristate "Input driver that uses channels specified via iio maps" + depends on INPUT + depends on IIO_BUFFER + select IIO_BUFFER_CB + help + Client driver for IIO via the push interfaces. Used to provide + and input interface for IIO devices that can feed a buffer onan input interface
good catch.
Quoted 4 lines
Quoted 2 lines
+ * Copyright (c) 2011 Jonathan Cameron
2012 is almost over
I've not changed much in here since 2011 though so will leave it be. Did this whilst still in accademia. Been doing a real job for a year and this patch is still kicking around... hohum. It's been a busy year.
Quoted 14 lines
drivers/staging/iio/iio_input.c line 60
Quoted 12 lines
drivers/staging/iio/iio_input.c new file +11
-0+case 32 : +switch (chan->scan_type.endianness) { +case IIO_CPU : + value = *(s32 *)(data); +break ; +case IIO_BE : + value =be32_to_cpu (*(__be32 *)data); +break ; +case IIO_LE : + value =le32_to_cpu (*(__le32 *)data); +break ;here's an extra space between le32 and *
eagle eyes :)
Quoted 21 lines
Quoted 21 lines
drivers/staging/iio/iio_input.c new file +14
-0+static struct platform_driver iio_input_driver = { + .driver = { + .name ="iio_input_bridge" , + .owner =THIS_MODULE , + }, + .probe = iio_input_probe, + .remove =__devexit_p (iio_input_remove), +}; + +module_platform_driver (iio_input_driver); + +MODULE_AUTHOR ("Jonathan Cameron <[email protected]>" ); +MODULE_DESCRIPTION ("IIO input buffer driver" ); +MODULE_LICENSE ("GPL v2" );drivers/staging/iio/iio_input.h new file +0
-0@@ -0,0 +1,23 @@
Quoted 8 lines
drivers/staging/iio/iio_input.h line 2
Quoted 2 lines
drivers/staging/iio/iio_input.h new file +2
-0+/* +* The industrial I/O input client driver this thing is called
iio_input_bridge,
IIO inputbuffer_driver,
instrustrial I/O input client driver
within a few lines of code -- now is the time to christen the driver :)
Fair point.
iio client driver for the input subsystem
(iio_to_input for driver name)
Quoted 20 lines
Quoted 7 lines
drivers/staging/iio/iio_input.h new file +6
-0+* +* Copyright (c) 2011 Jonathan Cameron +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 as published by +* the Free Software Foundation. drivers/staging/iio/iio_input.h line 18
Quoted 10 lines
drivers/staging/iio/iio_input.h new file +10
-0+*/ + +/** +* iio_input_channel_data - description of the channel for input subsystem +* @code: Absolute axis. +* @min: Minimum value. +* @max: Maximum value. +* @fuzz: Used to filter noise from the event stream. +* @flat: Values within this value will be discarded by joydev +* and reported as 0 instead. @flat: Values within the range [-flat, flat] will be discarded ...
Quoted 2 lines
this is at least what I would guess it does;
input.his equally vague
I'll be honest - I'm not all that sure what it does either... Gone with your description. We'll see what Dmitry et al say when I post it to linux-input.
Quoted 7 lines
Quoted 6 lines
drivers/staging/iio/iio_input.h new file +5
-0+*/ +struct iio_input_channel_data { +unsigned int code; +int min, max, fuzz, flat; +};
Jonathan Cameron
maintainerI've let this sit for nearly long enough I think. If no one shouts in the next few days (or asks for more time to take a look). I'll add patches 1-3 of this the togreg branch of iio.git and send a pull request for it to Greg. The input client driver can wait for a bit.
I'm really really keen to get this lot in place in time to have a few weeks of testing in linux-next before the merge window opens.
(it's over a year old now as Peter noticed, and I'm getting serriously bored of it ;)
Quoted 105 lines
Same as V5 but with the changes from Lars-Peter's review to close some memory leaks and catch up with some changes in the subsystem that had passed this by. It should also now be possible to disable the timestamp! (oops).
Thanks to Lars for his work reviewing my patches and also for his excellent work reviewing in general! Without him the whole subsystem would be moving a lot slower.
Again, more testing would be good (thanks for those who already have).
In quick summary this is needed to do interrupt driven in kernel clients as it adds the option to push to multiple 'buffer' interfaces. Note that some of these may not actually do any buffering but rather push directly into another subsytem (the example is input).
I would like to merge at least the first 3 patches early in this cycle. What I need is some testing across a reasonable range of devices. Review is welcome of course as well!
The complexity in this set is entirely in the changes to
industrialio-buffer.cconcerning how we go about adding and removing client buffers. To do this we need to work out which scan mask is appropriate given the requests of all the given buffers (and whether we can satisfy it). I've been testing with the max1363 driver which probably has the most complex set of available scan masks. Thus when a new buffer is added or one is removed the whole buffer set are torn down and built up again. This may be undesirable for some applications but should occur only rarely.The example driver is for bridging to the input subsystem and still needs some work, but that can occur later in this merge cycle whereas the changes to the core really want to go in asap.
Changes since v3
Rebased and added other drivers that have occured whilst this patch series has been languishing in my local tree.
Changes since V2.
Improved handling of error conditions in the buffer insertion and removal code. (suggested by Lars-Peter). I want to take another look at these, but didn't want to keep people from testing this in the meantime.
Also a number of minor fixes that came up during testing.
Thanks,
Jonathan
Jonathan Cameron (4):
staging:iio: Add support for multiple buffers staging:iio:in kernel users: Add a data field for channel specific
info.
staging:iio: add a callback buffer for in kernel push interface staging:iio: Proof of concept input driver.drivers/iio/Kconfig | 6 + drivers/iio/Makefile | 1 + drivers/iio/accel/hid-sensor-accel-3d.c | 15 +- drivers/iio/adc/ad7266.c | 3 +- drivers/iio/adc/ad7476.c | 2 +- drivers/iio/adc/ad_sigma_delta.c | 2 +- drivers/iio/adc/at91_adc.c | 3 +- drivers/iio/buffer_cb.c | 113 +++++++ drivers/iio/gyro/hid-sensor-gyro-3d.c | 15 +- drivers/iio/industrialio-buffer.c | 380 ++++++++++++++++-------- drivers/iio/industrialio-core.c | 1 + drivers/iio/inkern.c | 1 + drivers/iio/light/adjd_s311.c | 3 +- drivers/iio/light/hid-sensor-als.c | 15 +- drivers/iio/magnetometer/hid-sensor-magn-3d.c | 15 +- drivers/staging/iio/Kconfig | 11 + drivers/staging/iio/Makefile | 1 + drivers/staging/iio/accel/adis16201_ring.c | 2 +- drivers/staging/iio/accel/adis16203_ring.c | 2 +- drivers/staging/iio/accel/adis16204_ring.c | 2 +- drivers/staging/iio/accel/adis16209_ring.c | 2 +- drivers/staging/iio/accel/adis16240_ring.c | 2 +- drivers/staging/iio/accel/lis3l02dq_ring.c | 2 +- drivers/staging/iio/adc/ad7298_ring.c | 2 +- drivers/staging/iio/adc/ad7606_ring.c | 2 +- drivers/staging/iio/adc/ad7887_ring.c | 2 +- drivers/staging/iio/adc/ad799x_ring.c | 2 +- drivers/staging/iio/adc/max1363_ring.c | 2 +- drivers/staging/iio/gyro/adis16260_ring.c | 2 +- drivers/staging/iio/iio_input.c | 225 ++++++++++++++ drivers/staging/iio/iio_input.h | 23 ++ drivers/staging/iio/iio_simple_dummy_buffer.c | 5 +- drivers/staging/iio/impedance-analyzer/ad5933.c | 4 +- drivers/staging/iio/imu/adis16400_ring.c | 5 +- drivers/staging/iio/meter/ade7758_ring.c | 2 +- include/linux/iio/buffer.h | 24 +- include/linux/iio/consumer.h | 48 +++ include/linux/iio/iio.h | 2 + include/linux/iio/machine.h | 2 + 39 files changed, 743 insertions(+), 208 deletions(-) create mode 100644 drivers/iio/buffer_cb.c create mode 100644 drivers/staging/iio/iio_input.c create mode 100644 drivers/staging/iio/iio_input.h
Jonathan Cameron
maintainerNo one shouted so off it goes.
I did miss the imx driver previously so I've just made the trivial change from iio_push_to_buffer -> iio_push_to_buffers for that one. Picked that up in a final sanity check pass of the code.
Also a trivial merge with the ad7887 move out of staging.
Hopefully this won't cause too much trouble *fingers crossed*
Jonathan
Quoted 116 lines · Jonathan Cameron
I've let this sit for nearly long enough I think. If no one shouts in the next few days (or asks for more time to take a look). I'll add patches 1-3 of this the togreg branch of iio.git and send a pull request for it to Greg. The input client driver can wait for a bit.
I'm really really keen to get this lot in place in time to have a few weeks of testing in linux-next before the merge window opens.
(it's over a year old now as Peter noticed, and I'm getting serriously bored of it ;)
Quoted 105 lines
Same as V5 but with the changes from Lars-Peter's review to close some memory leaks and catch up with some changes in the subsystem that had passed this by. It should also now be possible to disable the timestamp! (oops).
Thanks to Lars for his work reviewing my patches and also for his excellent work reviewing in general! Without him the whole subsystem would be moving a lot slower.
Again, more testing would be good (thanks for those who already have).
In quick summary this is needed to do interrupt driven in kernel clients as it adds the option to push to multiple 'buffer' interfaces. Note that some of these may not actually do any buffering but rather push directly into another subsytem (the example is input).
I would like to merge at least the first 3 patches early in this cycle. What I need is some testing across a reasonable range of devices. Review is welcome of course as well!
The complexity in this set is entirely in the changes to
industrialio-buffer.cconcerning how we go about adding and removing client buffers. To do this we need to work out which scan mask is appropriate given the requests of all the given buffers (and whether we can satisfy it). I've been testing with the max1363 driver which probably has the most complex set of available scan masks. Thus when a new buffer is added or one is removed the whole buffer set are torn down and built up again. This may be undesirable for some applications but should occur only rarely.The example driver is for bridging to the input subsystem and still needs some work, but that can occur later in this merge cycle whereas the changes to the core really want to go in asap.
Changes since v3
Rebased and added other drivers that have occured whilst this patch series has been languishing in my local tree.
Changes since V2.
Improved handling of error conditions in the buffer insertion and removal code. (suggested by Lars-Peter). I want to take another look at these, but didn't want to keep people from testing this in the meantime.
Also a number of minor fixes that came up during testing.
Thanks,
Jonathan
Jonathan Cameron (4):
staging:iio: Add support for multiple buffers staging:iio:in kernel users: Add a data field for channel specific
info.
staging:iio: add a callback buffer for in kernel push interface staging:iio: Proof of concept input driver.drivers/iio/Kconfig | 6 + drivers/iio/Makefile | 1 + drivers/iio/accel/hid-sensor-accel-3d.c | 15 +- drivers/iio/adc/ad7266.c | 3 +- drivers/iio/adc/ad7476.c | 2 +- drivers/iio/adc/ad_sigma_delta.c | 2 +- drivers/iio/adc/at91_adc.c | 3 +- drivers/iio/buffer_cb.c | 113 +++++++ drivers/iio/gyro/hid-sensor-gyro-3d.c | 15 +- drivers/iio/industrialio-buffer.c | 380 ++++++++++++++++-------- drivers/iio/industrialio-core.c | 1 + drivers/iio/inkern.c | 1 + drivers/iio/light/adjd_s311.c | 3 +- drivers/iio/light/hid-sensor-als.c | 15 +- drivers/iio/magnetometer/hid-sensor-magn-3d.c | 15 +- drivers/staging/iio/Kconfig | 11 + drivers/staging/iio/Makefile | 1 + drivers/staging/iio/accel/adis16201_ring.c | 2 +- drivers/staging/iio/accel/adis16203_ring.c | 2 +- drivers/staging/iio/accel/adis16204_ring.c | 2 +- drivers/staging/iio/accel/adis16209_ring.c | 2 +- drivers/staging/iio/accel/adis16240_ring.c | 2 +- drivers/staging/iio/accel/lis3l02dq_ring.c | 2 +- drivers/staging/iio/adc/ad7298_ring.c | 2 +- drivers/staging/iio/adc/ad7606_ring.c | 2 +- drivers/staging/iio/adc/ad7887_ring.c | 2 +- drivers/staging/iio/adc/ad799x_ring.c | 2 +- drivers/staging/iio/adc/max1363_ring.c | 2 +- drivers/staging/iio/gyro/adis16260_ring.c | 2 +- drivers/staging/iio/iio_input.c | 225 ++++++++++++++ drivers/staging/iio/iio_input.h | 23 ++ drivers/staging/iio/iio_simple_dummy_buffer.c | 5 +- drivers/staging/iio/impedance-analyzer/ad5933.c | 4 +- drivers/staging/iio/imu/adis16400_ring.c | 5 +- drivers/staging/iio/meter/ade7758_ring.c | 2 +- include/linux/iio/buffer.h | 24 +- include/linux/iio/consumer.h | 48 +++ include/linux/iio/iio.h | 2 + include/linux/iio/machine.h | 2 + 39 files changed, 743 insertions(+), 208 deletions(-) create mode 100644 drivers/iio/buffer_cb.c create mode 100644 drivers/staging/iio/iio_input.c create mode 100644 drivers/staging/iio/iio_input.h