~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/iio/backend.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 #ifndef _IIO_BACKEND_H_
  3 #define _IIO_BACKEND_H_
  4 
  5 #include <linux/types.h>
  6 
  7 struct iio_chan_spec;
  8 struct fwnode_handle;
  9 struct iio_backend;
 10 struct device;
 11 struct iio_dev;
 12 
 13 enum iio_backend_data_type {
 14         IIO_BACKEND_TWOS_COMPLEMENT,
 15         IIO_BACKEND_OFFSET_BINARY,
 16         IIO_BACKEND_DATA_TYPE_MAX
 17 };
 18 
 19 enum iio_backend_data_source {
 20         IIO_BACKEND_INTERNAL_CONTINUOS_WAVE,
 21         IIO_BACKEND_EXTERNAL,
 22         IIO_BACKEND_DATA_SOURCE_MAX
 23 };
 24 
 25 /**
 26  * IIO_BACKEND_EX_INFO - Helper for an IIO extended channel attribute
 27  * @_name: Attribute name
 28  * @_shared: Whether the attribute is shared between all channels
 29  * @_what: Data private to the driver
 30  */
 31 #define IIO_BACKEND_EX_INFO(_name, _shared, _what) {    \
 32         .name = (_name),                                \
 33         .shared = (_shared),                            \
 34         .read =  iio_backend_ext_info_get,              \
 35         .write = iio_backend_ext_info_set,              \
 36         .private = (_what),                             \
 37 }
 38 
 39 /**
 40  * struct iio_backend_data_fmt - Backend data format
 41  * @type: Data type.
 42  * @sign_extend: Bool to tell if the data is sign extended.
 43  * @enable: Enable/Disable the data format module. If disabled,
 44  *          not formatting will happen.
 45  */
 46 struct iio_backend_data_fmt {
 47         enum iio_backend_data_type type;
 48         bool sign_extend;
 49         bool enable;
 50 };
 51 
 52 /* vendor specific from 32 */
 53 enum iio_backend_test_pattern {
 54         IIO_BACKEND_NO_TEST_PATTERN,
 55         /* modified prbs9 */
 56         IIO_BACKEND_ADI_PRBS_9A = 32,
 57         IIO_BACKEND_TEST_PATTERN_MAX
 58 };
 59 
 60 enum iio_backend_sample_trigger {
 61         IIO_BACKEND_SAMPLE_TRIGGER_EDGE_FALLING,
 62         IIO_BACKEND_SAMPLE_TRIGGER_EDGE_RISING,
 63         IIO_BACKEND_SAMPLE_TRIGGER_MAX
 64 };
 65 
 66 /**
 67  * struct iio_backend_ops - operations structure for an iio_backend
 68  * @enable: Enable backend.
 69  * @disable: Disable backend.
 70  * @chan_enable: Enable one channel.
 71  * @chan_disable: Disable one channel.
 72  * @data_format_set: Configure the data format for a specific channel.
 73  * @data_source_set: Configure the data source for a specific channel.
 74  * @set_sample_rate: Configure the sampling rate for a specific channel.
 75  * @test_pattern_set: Configure a test pattern.
 76  * @chan_status: Get the channel status.
 77  * @iodelay_set: Set digital I/O delay.
 78  * @data_sample_trigger: Control when to sample data.
 79  * @request_buffer: Request an IIO buffer.
 80  * @free_buffer: Free an IIO buffer.
 81  * @extend_chan_spec: Extend an IIO channel.
 82  * @ext_info_set: Extended info setter.
 83  * @ext_info_get: Extended info getter.
 84  **/
 85 struct iio_backend_ops {
 86         int (*enable)(struct iio_backend *back);
 87         void (*disable)(struct iio_backend *back);
 88         int (*chan_enable)(struct iio_backend *back, unsigned int chan);
 89         int (*chan_disable)(struct iio_backend *back, unsigned int chan);
 90         int (*data_format_set)(struct iio_backend *back, unsigned int chan,
 91                                const struct iio_backend_data_fmt *data);
 92         int (*data_source_set)(struct iio_backend *back, unsigned int chan,
 93                                enum iio_backend_data_source data);
 94         int (*set_sample_rate)(struct iio_backend *back, unsigned int chan,
 95                                u64 sample_rate_hz);
 96         int (*test_pattern_set)(struct iio_backend *back,
 97                                 unsigned int chan,
 98                                 enum iio_backend_test_pattern pattern);
 99         int (*chan_status)(struct iio_backend *back, unsigned int chan,
100                            bool *error);
101         int (*iodelay_set)(struct iio_backend *back, unsigned int chan,
102                            unsigned int taps);
103         int (*data_sample_trigger)(struct iio_backend *back,
104                                    enum iio_backend_sample_trigger trigger);
105         struct iio_buffer *(*request_buffer)(struct iio_backend *back,
106                                              struct iio_dev *indio_dev);
107         void (*free_buffer)(struct iio_backend *back,
108                             struct iio_buffer *buffer);
109         int (*extend_chan_spec)(struct iio_backend *back,
110                                 struct iio_chan_spec *chan);
111         int (*ext_info_set)(struct iio_backend *back, uintptr_t private,
112                             const struct iio_chan_spec *chan,
113                             const char *buf, size_t len);
114         int (*ext_info_get)(struct iio_backend *back, uintptr_t private,
115                             const struct iio_chan_spec *chan, char *buf);
116 };
117 
118 int iio_backend_chan_enable(struct iio_backend *back, unsigned int chan);
119 int iio_backend_chan_disable(struct iio_backend *back, unsigned int chan);
120 int devm_iio_backend_enable(struct device *dev, struct iio_backend *back);
121 int iio_backend_data_format_set(struct iio_backend *back, unsigned int chan,
122                                 const struct iio_backend_data_fmt *data);
123 int iio_backend_data_source_set(struct iio_backend *back, unsigned int chan,
124                                 enum iio_backend_data_source data);
125 int iio_backend_set_sampling_freq(struct iio_backend *back, unsigned int chan,
126                                   u64 sample_rate_hz);
127 int iio_backend_test_pattern_set(struct iio_backend *back,
128                                  unsigned int chan,
129                                  enum iio_backend_test_pattern pattern);
130 int iio_backend_chan_status(struct iio_backend *back, unsigned int chan,
131                             bool *error);
132 int iio_backend_iodelay_set(struct iio_backend *back, unsigned int lane,
133                             unsigned int taps);
134 int iio_backend_data_sample_trigger(struct iio_backend *back,
135                                     enum iio_backend_sample_trigger trigger);
136 int devm_iio_backend_request_buffer(struct device *dev,
137                                     struct iio_backend *back,
138                                     struct iio_dev *indio_dev);
139 ssize_t iio_backend_ext_info_set(struct iio_dev *indio_dev, uintptr_t private,
140                                  const struct iio_chan_spec *chan,
141                                  const char *buf, size_t len);
142 ssize_t iio_backend_ext_info_get(struct iio_dev *indio_dev, uintptr_t private,
143                                  const struct iio_chan_spec *chan, char *buf);
144 
145 int iio_backend_extend_chan_spec(struct iio_dev *indio_dev,
146                                  struct iio_backend *back,
147                                  struct iio_chan_spec *chan);
148 void *iio_backend_get_priv(const struct iio_backend *conv);
149 struct iio_backend *devm_iio_backend_get(struct device *dev, const char *name);
150 struct iio_backend *
151 __devm_iio_backend_get_from_fwnode_lookup(struct device *dev,
152                                           struct fwnode_handle *fwnode);
153 
154 int devm_iio_backend_register(struct device *dev,
155                               const struct iio_backend_ops *ops, void *priv);
156 
157 #endif
158 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php