Lines Matching +full:iio +full:- +full:consumer
1 // SPDX-License-Identifier: GPL-2.0-only
10 #include <linux/iio/iio.h>
11 #include <linux/iio/buffer_impl.h>
12 #include <linux/iio/consumer.h>
30 return cb_buff->cb(data, cb_buff->private); in iio_buffer_cb_store_to()
37 bitmap_free(cb_buff->buffer.scan_mask); in iio_buffer_cb_release()
59 return ERR_PTR(-EINVAL); in iio_channel_get_all_cb()
64 return ERR_PTR(-ENOMEM); in iio_channel_get_all_cb()
66 iio_buffer_init(&cb_buff->buffer); in iio_channel_get_all_cb()
68 cb_buff->private = private; in iio_channel_get_all_cb()
69 cb_buff->cb = cb; in iio_channel_get_all_cb()
70 cb_buff->buffer.access = &iio_cb_access; in iio_channel_get_all_cb()
71 INIT_LIST_HEAD(&cb_buff->buffer.demux_list); in iio_channel_get_all_cb()
73 cb_buff->channels = iio_channel_get_all(dev); in iio_channel_get_all_cb()
74 if (IS_ERR(cb_buff->channels)) { in iio_channel_get_all_cb()
75 ret = PTR_ERR(cb_buff->channels); in iio_channel_get_all_cb()
79 cb_buff->indio_dev = cb_buff->channels[0].indio_dev; in iio_channel_get_all_cb()
80 cb_buff->buffer.scan_mask = bitmap_zalloc(iio_get_masklength(cb_buff->indio_dev), in iio_channel_get_all_cb()
82 if (cb_buff->buffer.scan_mask == NULL) { in iio_channel_get_all_cb()
83 ret = -ENOMEM; in iio_channel_get_all_cb()
86 chan = &cb_buff->channels[0]; in iio_channel_get_all_cb()
87 while (chan->indio_dev) { in iio_channel_get_all_cb()
88 if (chan->indio_dev != cb_buff->indio_dev) { in iio_channel_get_all_cb()
89 ret = -EINVAL; in iio_channel_get_all_cb()
92 set_bit(chan->channel->scan_index, in iio_channel_get_all_cb()
93 cb_buff->buffer.scan_mask); in iio_channel_get_all_cb()
100 bitmap_free(cb_buff->buffer.scan_mask); in iio_channel_get_all_cb()
102 iio_channel_release_all(cb_buff->channels); in iio_channel_get_all_cb()
113 return -EINVAL; in iio_channel_cb_set_buffer_watermark()
114 cb_buff->buffer.watermark = watermark; in iio_channel_cb_set_buffer_watermark()
122 return iio_update_buffers(cb_buff->indio_dev, &cb_buff->buffer, in iio_channel_start_all_cb()
129 iio_update_buffers(cb_buff->indio_dev, NULL, &cb_buff->buffer); in iio_channel_stop_all_cb()
135 iio_channel_release_all(cb_buff->channels); in iio_channel_release_all_cb()
136 iio_buffer_put(&cb_buff->buffer); in iio_channel_release_all_cb()
143 return cb_buffer->channels; in iio_channel_cb_get_channels()
150 return cb_buffer->indio_dev; in iio_channel_cb_get_iio_dev()