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 API for oversampling

Add backend support for setting oversampling ratio.

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

authored by

Antoniu Miclaus and committed by
Jonathan Cameron
22894e0b fc3fdb83

+20
+15
drivers/iio/industrialio-backend.c
··· 682 682 EXPORT_SYMBOL_NS_GPL(iio_backend_data_size_set, "IIO_BACKEND"); 683 683 684 684 /** 685 + * iio_backend_oversampling_ratio_set - set the oversampling ratio 686 + * @back: Backend device 687 + * @ratio: The oversampling ratio - value 1 corresponds to no oversampling. 688 + * 689 + * Return: 690 + * 0 on success, negative error number on failure. 691 + */ 692 + int iio_backend_oversampling_ratio_set(struct iio_backend *back, 693 + unsigned int ratio) 694 + { 695 + return iio_backend_op_call(back, oversampling_ratio_set, ratio); 696 + } 697 + EXPORT_SYMBOL_NS_GPL(iio_backend_oversampling_ratio_set, "IIO_BACKEND"); 698 + 699 + /** 685 700 * iio_backend_extend_chan_spec - Extend an IIO channel 686 701 * @back: Backend device 687 702 * @chan: IIO channel
+5
include/linux/iio/backend.h
··· 96 96 * @ext_info_get: Extended info getter. 97 97 * @interface_type_get: Interface type. 98 98 * @data_size_set: Data size. 99 + * @oversampling_ratio_set: Set Oversampling ratio. 99 100 * @read_raw: Read a channel attribute from a backend device 100 101 * @debugfs_print_chan_status: Print channel status into a buffer. 101 102 * @debugfs_reg_access: Read or write register value of backend. ··· 140 139 int (*interface_type_get)(struct iio_backend *back, 141 140 enum iio_backend_interface_type *type); 142 141 int (*data_size_set)(struct iio_backend *back, unsigned int size); 142 + int (*oversampling_ratio_set)(struct iio_backend *back, 143 + unsigned int ratio); 143 144 int (*read_raw)(struct iio_backend *back, 144 145 struct iio_chan_spec const *chan, int *val, int *val2, 145 146 long mask); ··· 203 200 int iio_backend_interface_type_get(struct iio_backend *back, 204 201 enum iio_backend_interface_type *type); 205 202 int iio_backend_data_size_set(struct iio_backend *back, unsigned int size); 203 + int iio_backend_oversampling_ratio_set(struct iio_backend *back, 204 + unsigned int ratio); 206 205 int iio_backend_read_raw(struct iio_backend *back, 207 206 struct iio_chan_spec const *chan, int *val, int *val2, 208 207 long mask);