diff options
| author | Gregor Boirie <gregor.boirie@parrot.com> | 2016-04-20 13:23:43 -0400 |
|---|---|---|
| committer | Jonathan Cameron <jic23@kernel.org> | 2016-04-23 17:13:05 -0400 |
| commit | dfc57732ad38f93ae6232a3b4e64fd077383a0f1 (patch) | |
| tree | 180c004346687cc3d6204239a25bc630c30ea569 /include/linux/iio | |
| parent | dc2c57153ec5119eae7770042197eff627184d74 (diff) | |
iio:core: mounting matrix support
Expose a rotation matrix to indicate userspace the chip placement with
respect to the overall hardware system. This is needed to adjust
coordinates sampled from a sensor chip when its position deviates from the
main hardware system.
Final coordinates computation is delegated to userspace since:
* computation may involve floating point arithmetics ;
* it allows an application to combine adjustments with arbitrary
transformations.
This 3 dimentional space rotation matrix is expressed as 3x3 array of
strings to support floating point numbers. It may be retrieved from a
"[<dir>_][<type>_]mount_matrix" sysfs attribute file. It is declared into a
device / driver specific DTS property or platform data.
Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'include/linux/iio')
| -rw-r--r-- | include/linux/iio/iio.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index 0b2773ada0ba..7c29cb0124ae 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h | |||
| @@ -148,6 +148,37 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, | |||
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | /** | 150 | /** |
| 151 | * struct iio_mount_matrix - iio mounting matrix | ||
| 152 | * @rotation: 3 dimensional space rotation matrix defining sensor alignment with | ||
| 153 | * main hardware | ||
| 154 | */ | ||
| 155 | struct iio_mount_matrix { | ||
| 156 | const char *rotation[9]; | ||
| 157 | }; | ||
| 158 | |||
| 159 | ssize_t iio_show_mount_matrix(struct iio_dev *indio_dev, uintptr_t priv, | ||
| 160 | const struct iio_chan_spec *chan, char *buf); | ||
| 161 | int of_iio_read_mount_matrix(const struct device *dev, const char *propname, | ||
| 162 | struct iio_mount_matrix *matrix); | ||
| 163 | |||
| 164 | typedef const struct iio_mount_matrix * | ||
| 165 | (iio_get_mount_matrix_t)(const struct iio_dev *indio_dev, | ||
| 166 | const struct iio_chan_spec *chan); | ||
| 167 | |||
| 168 | /** | ||
| 169 | * IIO_MOUNT_MATRIX() - Initialize mount matrix extended channel attribute | ||
| 170 | * @_shared: Whether the attribute is shared between all channels | ||
| 171 | * @_get: Pointer to an iio_get_mount_matrix_t accessor | ||
| 172 | */ | ||
| 173 | #define IIO_MOUNT_MATRIX(_shared, _get) \ | ||
| 174 | { \ | ||
| 175 | .name = "mount_matrix", \ | ||
| 176 | .shared = (_shared), \ | ||
| 177 | .read = iio_show_mount_matrix, \ | ||
| 178 | .private = (uintptr_t)(_get), \ | ||
| 179 | } | ||
| 180 | |||
| 181 | /** | ||
| 151 | * struct iio_event_spec - specification for a channel event | 182 | * struct iio_event_spec - specification for a channel event |
| 152 | * @type: Type of the event | 183 | * @type: Type of the event |
| 153 | * @dir: Direction of the event | 184 | * @dir: Direction of the event |
