AnsweredAssumed Answered

What functionality is required in an IIO device kernel module to support libiio's iio_buffer_push function?

Question asked by allsey87 on Jul 3, 2018
Latest reply on Jul 5, 2018 by mhennerich

If I have data stored in an iio_buffer that is written out using iio_buffer_push (for example, to a DAC), what functionality do I need to implement in the device's kernel module to get these samples to hardware?


By inspecting the code of libiio, I can see that when using the low speed interface the data in the buffer is copied out to what I am pretty sure is the /dev/iio:deviceX file (at least in the case of a local context).


However, looking at other kernel modules, the only function I can seem to find for routing the data out to the hardware is provided via the write_raw function pointer in the iio_info struct. From my understanding, this function is called when writing samples via in/out_channelX_raw files in sysfs. However, I am guessing that this function is not called when writing samples via /dev/iio:deviceX since using this path would require multiple invocations of the write_raw method for each channel that requires writing. This approach also wouldn't parallel the data path used for capturing data from hardware, where multiple channel can be read from the hardware within a function call.


What functionality is required in an IIO device kernel module to support libiio's iio_buffer_push function?