Re: [PATCH RFC 4/8] iio: frequency: ad9910: expose sysclk_frequency device attribute

From: Jonathan Cameron

Date: Sun Mar 01 2026 - 08:24:01 EST


On Fri, 20 Feb 2026 16:46:08 +0000
Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@xxxxxxxxxx> wrote:

> From: Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx>
>
> Add read-only sysclk_frequency sysfs attribute. This value is important
> for userspace to calculate values to populate the Parallel Port or the
> RAM data buffer.
>
> Signed-off-by: Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx>
Can we not use sampling_frequency (kind of backwards but IIRC we've done it
before) to provide information on what the frequency of the DAC updating is?

Jonathan

> ---
> drivers/iio/frequency/ad9910.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/iio/frequency/ad9910.c b/drivers/iio/frequency/ad9910.c
> index bb280972e84c..a72e3685f676 100644
> --- a/drivers/iio/frequency/ad9910.c
> +++ b/drivers/iio/frequency/ad9910.c
> @@ -789,10 +789,31 @@ static int ad9910_reg_access(struct iio_dev *indio_dev,
> return ret;
> }
>
> +static ssize_t sysclk_frequency_show(struct device *dev,
> + struct device_attribute *attr,
> + char *buf)
> +{
> + struct ad9910_state *st = iio_priv(dev_to_iio_dev(dev));
> +
> + return sysfs_emit(buf, "%u\n", st->data.sysclk_freq_hz);
> +}
> +
> +static IIO_DEVICE_ATTR_RO(sysclk_frequency, 0);
> +
> +static struct attribute *ad9910_attrs[] = {
> + &iio_dev_attr_sysclk_frequency.dev_attr.attr,
> + NULL
> +};
> +
> +static const struct attribute_group ad9910_attrs_group = {
> + .attrs = ad9910_attrs,
> +};
> +
> static const struct iio_info ad9910_info = {
> .read_raw = ad9910_read_raw,
> .write_raw = ad9910_write_raw,
> .write_raw_get_fmt = ad9910_write_raw_get_fmt,
> + .attrs = &ad9910_attrs_group,
> .debugfs_reg_access = &ad9910_reg_access,
> };
>
>