// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2011 Jonathan Cameron * * Buffer handling elements of industrial I/O reference driver. * Uses the kfifo buffer. * * To test without hardware use the sysfs trigger. */ #include <linux/kernel.h> #include <linux/export.h> #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/bitmap.h> #include <linux/iio/iio.h> #include <linux/iio/buffer.h> #include <linux/iio/trigger_consumer.h> #include <linux/iio/triggered_buffer.h> #include "iio_simple_dummy.h" /* Some fake data */ static const s16 fakedata[] = …; /** * iio_simple_dummy_trigger_h() - the trigger handler function * @irq: the interrupt number * @p: private data - always a pointer to the poll func. * * This is the guts of buffered capture. On a trigger event occurring, * if the pollfunc is attached then this handler is called as a threaded * interrupt (and hence may sleep). It is responsible for grabbing data * from the device and pushing it into the associated buffer. */ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p) { … } static const struct iio_buffer_setup_ops iio_simple_dummy_buffer_setup_ops = …; int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev) { … } /** * iio_simple_dummy_unconfigure_buffer() - release buffer resources * @indio_dev: device instance state */ void iio_simple_dummy_unconfigure_buffer(struct iio_dev *indio_dev) { … }