diff options
Diffstat (limited to 'include/linux/iio/consumer.h')
-rw-r--r-- | include/linux/iio/consumer.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h index fad58671c49e..3d672f72e7ec 100644 --- a/include/linux/iio/consumer.h +++ b/include/linux/iio/consumer.h | |||
@@ -49,6 +49,33 @@ struct iio_channel *iio_channel_get(struct device *dev, | |||
49 | void iio_channel_release(struct iio_channel *chan); | 49 | void iio_channel_release(struct iio_channel *chan); |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * devm_iio_channel_get() - Resource managed version of iio_channel_get(). | ||
53 | * @dev: Pointer to consumer device. Device name must match | ||
54 | * the name of the device as provided in the iio_map | ||
55 | * with which the desired provider to consumer mapping | ||
56 | * was registered. | ||
57 | * @consumer_channel: Unique name to identify the channel on the consumer | ||
58 | * side. This typically describes the channels use within | ||
59 | * the consumer. E.g. 'battery_voltage' | ||
60 | * | ||
61 | * Returns a pointer to negative errno if it is not able to get the iio channel | ||
62 | * otherwise returns valid pointer for iio channel. | ||
63 | * | ||
64 | * The allocated iio channel is automatically released when the device is | ||
65 | * unbound. | ||
66 | */ | ||
67 | struct iio_channel *devm_iio_channel_get(struct device *dev, | ||
68 | const char *consumer_channel); | ||
69 | /** | ||
70 | * devm_iio_channel_release() - Resource managed version of | ||
71 | * iio_channel_release(). | ||
72 | * @dev: Pointer to consumer device for which resource | ||
73 | * is allocared. | ||
74 | * @chan: The channel to be released. | ||
75 | */ | ||
76 | void devm_iio_channel_release(struct device *dev, struct iio_channel *chan); | ||
77 | |||
78 | /** | ||
52 | * iio_channel_get_all() - get all channels associated with a client | 79 | * iio_channel_get_all() - get all channels associated with a client |
53 | * @dev: Pointer to consumer device. | 80 | * @dev: Pointer to consumer device. |
54 | * | 81 | * |
@@ -65,6 +92,32 @@ struct iio_channel *iio_channel_get_all(struct device *dev); | |||
65 | */ | 92 | */ |
66 | void iio_channel_release_all(struct iio_channel *chan); | 93 | void iio_channel_release_all(struct iio_channel *chan); |
67 | 94 | ||
95 | /** | ||
96 | * devm_iio_channel_get_all() - Resource managed version of | ||
97 | * iio_channel_get_all(). | ||
98 | * @dev: Pointer to consumer device. | ||
99 | * | ||
100 | * Returns a pointer to negative errno if it is not able to get the iio channel | ||
101 | * otherwise returns an array of iio_channel structures terminated with one with | ||
102 | * null iio_dev pointer. | ||
103 | * | ||
104 | * This function is used by fairly generic consumers to get all the | ||
105 | * channels registered as having this consumer. | ||
106 | * | ||
107 | * The allocated iio channels are automatically released when the device is | ||
108 | * unbounded. | ||
109 | */ | ||
110 | struct iio_channel *devm_iio_channel_get_all(struct device *dev); | ||
111 | |||
112 | /** | ||
113 | * devm_iio_channel_release_all() - Resource managed version of | ||
114 | * iio_channel_release_all(). | ||
115 | * @dev: Pointer to consumer device for which resource | ||
116 | * is allocared. | ||
117 | * @chan: Array channel to be released. | ||
118 | */ | ||
119 | void devm_iio_channel_release_all(struct device *dev, struct iio_channel *chan); | ||
120 | |||
68 | struct iio_cb_buffer; | 121 | struct iio_cb_buffer; |
69 | /** | 122 | /** |
70 | * iio_channel_get_all_cb() - register callback for triggered capture | 123 | * iio_channel_get_all_cb() - register callback for triggered capture |