From: "Nuno Sá" <noname.nuno@gmail.com>
To: "Angelo Dureghello" <adureghello@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Jonathan Corbet" <corbet@lwn.net>,
"Olivier Moysan" <olivier.moysan@foss.st.com>,
"Michael Hennerich" <Michael.Hennerich@analog.com>
Cc: linux-iio@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/5] iio: backend: add support for data source get
Date: Mon, 07 Apr 2025 17:12:55 +0100 [thread overview]
Message-ID: <3ac77217946c26069be967065b316c63e12d626b.camel@gmail.com> (raw)
In-Reply-To: <20250407-wip-bl-ad3552r-fixes-v3-3-61874065b60f@baylibre.com>
On Mon, 2025-04-07 at 10:52 +0200, Angelo Dureghello wrote:
> From: Angelo Dureghello <adureghello@baylibre.com>
>
> 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.
>
> Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
> ---
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
> drivers/iio/industrialio-backend.c | 28 ++++++++++++++++++++++++++++
> include/linux/iio/backend.h | 5 +++++
> 2 files changed, 33 insertions(+)
>
> diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-
> backend.c
> index
> a43c8d1bb3d0f4dda4277cac94b0ea9232c071e4..c1eb9ef9db08aec8437d0d00cf77914ad661
> 1b72 100644
> --- a/drivers/iio/industrialio-backend.c
> +++ b/drivers/iio/industrialio-backend.c
> @@ -380,6 +380,34 @@ int iio_backend_data_source_set(struct iio_backend *back,
> unsigned int chan,
> }
> EXPORT_SYMBOL_NS_GPL(iio_backend_data_source_set, "IIO_BACKEND");
>
> +/**
> + * iio_backend_data_source_get - Get current data source
> + * @back: Backend device
> + * @chan: Channel number
> + * @data: Pointer to receive the current source value
> + *
> + * A given backend may have different sources to stream/sync data. This
> allows
> + * to know what source is in use.
> + *
> + * RETURNS:
> + * 0 on success, negative error number on failure.
> + */
> +int iio_backend_data_source_get(struct iio_backend *back, unsigned int chan,
> + enum iio_backend_data_source *data)
> +{
> + int ret;
> +
> + ret = iio_backend_op_call(back, data_source_get, chan, data);
> + if (ret)
> + return ret;
> +
> + if (*data >= IIO_BACKEND_DATA_SOURCE_MAX)
> + return -EINVAL;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_NS_GPL(iio_backend_data_source_get, "IIO_BACKEND");
> +
> /**
> * iio_backend_set_sampling_freq - Set channel sampling rate
> * @back: Backend device
> diff --git a/include/linux/iio/backend.h b/include/linux/iio/backend.h
> index
> e45b7dfbec35c094942a3034fc6057a7960b9772..e59d909cb65924b4872cadd4b7e5e894c13c
> 189f 100644
> --- a/include/linux/iio/backend.h
> +++ b/include/linux/iio/backend.h
> @@ -84,6 +84,7 @@ enum iio_backend_interface_type {
> * @chan_disable: Disable one channel.
> * @data_format_set: Configure the data format for a specific channel.
> * @data_source_set: Configure the data source for a specific channel.
> + * @data_source_get: Data source getter for a specific channel.
> * @set_sample_rate: Configure the sampling rate for a specific channel.
> * @test_pattern_set: Configure a test pattern.
> * @chan_status: Get the channel status.
> @@ -115,6 +116,8 @@ struct iio_backend_ops {
> const struct iio_backend_data_fmt *data);
> int (*data_source_set)(struct iio_backend *back, unsigned int chan,
> enum iio_backend_data_source data);
> + int (*data_source_get)(struct iio_backend *back, unsigned int chan,
> + enum iio_backend_data_source *data);
> int (*set_sample_rate)(struct iio_backend *back, unsigned int chan,
> u64 sample_rate_hz);
> int (*test_pattern_set)(struct iio_backend *back,
> @@ -176,6 +179,8 @@ int iio_backend_data_format_set(struct iio_backend *back,
> unsigned int chan,
> const struct iio_backend_data_fmt *data);
> int iio_backend_data_source_set(struct iio_backend *back, unsigned int chan,
> enum iio_backend_data_source data);
> +int iio_backend_data_source_get(struct iio_backend *back, unsigned int chan,
> + enum iio_backend_data_source *data);
> int iio_backend_set_sampling_freq(struct iio_backend *back, unsigned int
> chan,
> u64 sample_rate_hz);
> int iio_backend_test_pattern_set(struct iio_backend *back,
next prev parent reply other threads:[~2025-04-07 16:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 8:52 [PATCH v3 0/5] iio: ad3552r-hs: add support for internal ramp generator Angelo Dureghello
2025-04-07 8:52 ` [PATCH v3 1/5] iio: dac: adi-axi-dac: add cntrl chan check Angelo Dureghello
2025-04-07 16:11 ` Nuno Sá
2025-04-07 8:52 ` [PATCH v3 2/5] docs: iio: add documentation for ad3552r driver Angelo Dureghello
2025-04-07 8:52 ` [PATCH v3 3/5] iio: backend: add support for data source get Angelo Dureghello
2025-04-07 16:12 ` Nuno Sá [this message]
2025-04-07 8:52 ` [PATCH v3 4/5] iio: dac: adi-axi-dac: add " Angelo Dureghello
2025-04-07 16:13 ` Nuno Sá
2025-04-07 8:52 ` [PATCH v3 5/5] iio: dac: ad3552r-hs: add support for internal ramp Angelo Dureghello
2025-04-07 16:21 ` Nuno Sá
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3ac77217946c26069be967065b316c63e12d626b.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=adureghello@baylibre.com \
--cc=corbet@lwn.net \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=olivier.moysan@foss.st.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.