0001 ===========
0002 HW consumer
0003 ===========
0004 An IIO device can be directly connected to another device in hardware. In this
0005 case the buffers between IIO provider and IIO consumer are handled by hardware.
0006 The Industrial I/O HW consumer offers a way to bond these IIO devices without
0007 software buffer for data. The implementation can be found under
0008 :file:`drivers/iio/buffer/hw-consumer.c`
0009
0010
0011 * struct iio_hw_consumer — Hardware consumer structure
0012 * :c:func:`iio_hw_consumer_alloc` — Allocate IIO hardware consumer
0013 * :c:func:`iio_hw_consumer_free` — Free IIO hardware consumer
0014 * :c:func:`iio_hw_consumer_enable` — Enable IIO hardware consumer
0015 * :c:func:`iio_hw_consumer_disable` — Disable IIO hardware consumer
0016
0017
0018 HW consumer setup
0019 =================
0020
0021 As standard IIO device the implementation is based on IIO provider/consumer.
0022 A typical IIO HW consumer setup looks like this::
0023
0024 static struct iio_hw_consumer *hwc;
0025
0026 static const struct iio_info adc_info = {
0027 .read_raw = adc_read_raw,
0028 };
0029
0030 static int adc_read_raw(struct iio_dev *indio_dev,
0031 struct iio_chan_spec const *chan, int *val,
0032 int *val2, long mask)
0033 {
0034 ret = iio_hw_consumer_enable(hwc);
0035
0036 /* Acquire data */
0037
0038 ret = iio_hw_consumer_disable(hwc);
0039 }
0040
0041 static int adc_probe(struct platform_device *pdev)
0042 {
0043 hwc = devm_iio_hw_consumer_alloc(&iio->dev);
0044 }
0045
0046 More details
0047 ============
0048 .. kernel-doc:: drivers/iio/buffer/industrialio-hw-consumer.c
0049 :export:
0050