Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: backend: add support for data size set

Add backend support for setting the data size used.
This setting can be adjusted within the IP cores interfacing devices.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://patch.msgid.link/20250214131955.31973-3-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Antoniu Miclaus and committed by
Jonathan Cameron
fc3fdb83 4018ab42

+24
+21
drivers/iio/industrialio-backend.c
··· 661 661 EXPORT_SYMBOL_NS_GPL(iio_backend_interface_type_get, "IIO_BACKEND"); 662 662 663 663 /** 664 + * iio_backend_data_size_set - set the data width/size in the data bus. 665 + * @back: Backend device 666 + * @size: Size in bits 667 + * 668 + * Some frontend devices can dynamically control the word/data size on the 669 + * interface/data bus. Hence, the backend device needs to be aware of it so 670 + * data can be correctly transferred. 671 + * 672 + * Return: 673 + * 0 on success, negative error number on failure. 674 + */ 675 + int iio_backend_data_size_set(struct iio_backend *back, unsigned int size) 676 + { 677 + if (!size) 678 + return -EINVAL; 679 + 680 + return iio_backend_op_call(back, data_size_set, size); 681 + } 682 + EXPORT_SYMBOL_NS_GPL(iio_backend_data_size_set, "IIO_BACKEND"); 683 + 684 + /** 664 685 * iio_backend_extend_chan_spec - Extend an IIO channel 665 686 * @back: Backend device 666 687 * @chan: IIO channel
+3
include/linux/iio/backend.h
··· 95 95 * @ext_info_set: Extended info setter. 96 96 * @ext_info_get: Extended info getter. 97 97 * @interface_type_get: Interface type. 98 + * @data_size_set: Data size. 98 99 * @read_raw: Read a channel attribute from a backend device 99 100 * @debugfs_print_chan_status: Print channel status into a buffer. 100 101 * @debugfs_reg_access: Read or write register value of backend. ··· 138 137 const struct iio_chan_spec *chan, char *buf); 139 138 int (*interface_type_get)(struct iio_backend *back, 140 139 enum iio_backend_interface_type *type); 140 + int (*data_size_set)(struct iio_backend *back, unsigned int size); 141 141 int (*read_raw)(struct iio_backend *back, 142 142 struct iio_chan_spec const *chan, int *val, int *val2, 143 143 long mask); ··· 199 197 const struct iio_chan_spec *chan, char *buf); 200 198 int iio_backend_interface_type_get(struct iio_backend *back, 201 199 enum iio_backend_interface_type *type); 200 + int iio_backend_data_size_set(struct iio_backend *back, unsigned int size); 202 201 int iio_backend_read_raw(struct iio_backend *back, 203 202 struct iio_chan_spec const *chan, int *val, int *val2, 204 203 long mask);