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 source get

Add backend support for getting the data source used.

The ad3552r HDL implements an internal ramp generator, so adding the
getter to allow data source get/set by debugfs.

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Link: https://patch.msgid.link/20250409-wip-bl-ad3552r-fixes-v5-3-fb429c3a6515@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Angelo Dureghello and committed by
Jonathan Cameron
20863215 ede84c45

+33
+28
drivers/iio/industrialio-backend.c
··· 381 381 EXPORT_SYMBOL_NS_GPL(iio_backend_data_source_set, "IIO_BACKEND"); 382 382 383 383 /** 384 + * iio_backend_data_source_get - Get current data source 385 + * @back: Backend device 386 + * @chan: Channel number 387 + * @data: Pointer to receive the current source value 388 + * 389 + * A given backend may have different sources to stream/sync data. This allows 390 + * to know what source is in use. 391 + * 392 + * RETURNS: 393 + * 0 on success, negative error number on failure. 394 + */ 395 + int iio_backend_data_source_get(struct iio_backend *back, unsigned int chan, 396 + enum iio_backend_data_source *data) 397 + { 398 + int ret; 399 + 400 + ret = iio_backend_op_call(back, data_source_get, chan, data); 401 + if (ret) 402 + return ret; 403 + 404 + if (*data >= IIO_BACKEND_DATA_SOURCE_MAX) 405 + return -EINVAL; 406 + 407 + return 0; 408 + } 409 + EXPORT_SYMBOL_NS_GPL(iio_backend_data_source_get, "IIO_BACKEND"); 410 + 411 + /** 384 412 * iio_backend_set_sampling_freq - Set channel sampling rate 385 413 * @back: Backend device 386 414 * @chan: Channel number
+5
include/linux/iio/backend.h
··· 84 84 * @chan_disable: Disable one channel. 85 85 * @data_format_set: Configure the data format for a specific channel. 86 86 * @data_source_set: Configure the data source for a specific channel. 87 + * @data_source_get: Data source getter for a specific channel. 87 88 * @set_sample_rate: Configure the sampling rate for a specific channel. 88 89 * @test_pattern_set: Configure a test pattern. 89 90 * @chan_status: Get the channel status. ··· 116 115 const struct iio_backend_data_fmt *data); 117 116 int (*data_source_set)(struct iio_backend *back, unsigned int chan, 118 117 enum iio_backend_data_source data); 118 + int (*data_source_get)(struct iio_backend *back, unsigned int chan, 119 + enum iio_backend_data_source *data); 119 120 int (*set_sample_rate)(struct iio_backend *back, unsigned int chan, 120 121 u64 sample_rate_hz); 121 122 int (*test_pattern_set)(struct iio_backend *back, ··· 179 176 const struct iio_backend_data_fmt *data); 180 177 int iio_backend_data_source_set(struct iio_backend *back, unsigned int chan, 181 178 enum iio_backend_data_source data); 179 + int iio_backend_data_source_get(struct iio_backend *back, unsigned int chan, 180 + enum iio_backend_data_source *data); 182 181 int iio_backend_set_sampling_freq(struct iio_backend *back, unsigned int chan, 183 182 u64 sample_rate_hz); 184 183 int iio_backend_test_pattern_set(struct iio_backend *back,