summaryrefslogtreecommitdiffstats
path: root/include/linux/iio/consumer.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman2012-11-12 03:39:17 +0100
committerGreg Kroah-Hartman2012-11-12 03:39:17 +0100
commit045020e77684721e4a29e0225be99adc01cfa735 (patch)
treecdd3ee1eb39c80767ee807ebbddab9edabb249a7 /include/linux/iio/consumer.h
parentMerge tag 'iio-for-3.8c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic... (diff)
parentiio:adc:max1363 move from staging. (diff)
downloadkernel-qcow2-linux-045020e77684721e4a29e0225be99adc01cfa735.tar.gz
kernel-qcow2-linux-045020e77684721e4a29e0225be99adc01cfa735.tar.xz
kernel-qcow2-linux-045020e77684721e4a29e0225be99adc01cfa735.zip
Merge tag 'iio-for-3.8d' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
IIO cleanups and fixes from Jonathan: "4th set of IIO driver updates and new functionality for the 3.8 cycle. 2 drivers going through final cleanup and moving out of staging. Addition to the core of support for multiple buffers from a single datastream. This functionality is core in allowing multiple users of interrupt driven data streams from the devices. First user will shortly be an input bridge driver. This has been in review / revision for over a year resulting in a far cleaner result. Much of the work had been in precursor patches. Here we just add the buffer set tear up and down support + switch to multiple buffer pushing in the drivers (a one line change in all users). Thanks to those who have tested / reviewed this set."
Diffstat (limited to 'include/linux/iio/consumer.h')
-rw-r--r--include/linux/iio/consumer.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
index e875bcf0478f..126c0a9375f2 100644
--- a/include/linux/iio/consumer.h
+++ b/include/linux/iio/consumer.h
@@ -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;
};
/**
@@ -59,6 +61,52 @@ struct iio_channel *iio_channel_get_all(const char *name);
*/
void iio_channel_release_all(struct iio_channel *chan);
+struct iio_cb_buffer;
+/**
+ * iio_channel_get_all_cb() - register callback for triggered capture
+ * @name: Name of client device.
+ * @cb: Callback function.
+ * @private: Private data passed to callback.
+ *
+ * NB right now we have no ability to mux data from multiple devices.
+ * So if the channels requested come from different devices this will
+ * fail.
+ */
+struct iio_cb_buffer *iio_channel_get_all_cb(const char *name,
+ int (*cb)(u8 *data,
+ void *private),
+ void *private);
+/**
+ * iio_channel_release_all_cb() - release and unregister the callback.
+ * @cb_buffer: The callback buffer that was allocated.
+ */
+void iio_channel_release_all_cb(struct iio_cb_buffer *cb_buffer);
+
+/**
+ * iio_channel_start_all_cb() - start the flow of data through callback.
+ * @cb_buff: The callback buffer we are starting.
+ */
+int iio_channel_start_all_cb(struct iio_cb_buffer *cb_buff);
+
+/**
+ * iio_channel_stop_all_cb() - stop the flow of data through the callback.
+ * @cb_buff: The callback buffer we are stopping.
+ */
+void iio_channel_stop_all_cb(struct iio_cb_buffer *cb_buff);
+
+/**
+ * iio_channel_cb_get_channels() - get access to the underlying channels.
+ * @cb_buff: The callback buffer from whom we want the channel
+ * information.
+ *
+ * This function allows one to obtain information about the channels.
+ * Whilst this may allow direct reading if all buffers are disabled, the
+ * primary aim is to allow drivers that are consuming a channel to query
+ * things like scaling of the channel.
+ */
+struct iio_channel
+*iio_channel_cb_get_channels(const struct iio_cb_buffer *cb_buffer);
+
/**
* iio_read_channel_raw() - read from a given channel
* @chan: The channel being queried.