[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZHG9bYO1PNuPJhWn@smile.fi.intel.com>
Date: Sat, 27 May 2023 11:21:01 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: George Stark <gnstark@...rdevices.ru>
Cc: jic23@...nel.org, lars@...afoo.de, neil.armstrong@...aro.org,
khilman@...libre.com, jbrunet@...libre.com,
martin.blumenstingl@...glemail.com, nuno.sa@...log.com,
linux-iio@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-amlogic@...ts.infradead.org,
kernel@...rdevices.ru
Subject: Re: [PATCH v1] meson saradc: add iio device attrib to switch channel
7 mux
On Wed, May 24, 2023 at 03:01:11AM +0300, George Stark wrote:
> Patch adds two sysfs nodes: chan7_mux to set mux state
> and chan7_mux_available to show available mux states.
> Mux can be used to debug and calibrate adc by
> switching and measuring well-known inputs like gnd, vdd etc.
GND
Vdd
...
> +static ssize_t chan7_mux_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(chan7_vol); i++)
> + if (!strcmp(chan7_vol[i], buf)) {
> + meson_sar_adc_set_chan7_mux(indio_dev, i);
> + return count;
> + }
> +
> + return -EINVAL;
NIH sysfs_match_string().
> +}
...
> +static IIO_DEVICE_ATTR_RW(chan7_mux, -1);
> +static IIO_DEVICE_ATTR_RO(chan7_mux_available, -1);
Place each of them near to the respective callback(s),
...
> +static struct attribute *meson_sar_adc_attrs[] = {
> + &iio_dev_attr_chan7_mux_available.dev_attr.attr,
> + &iio_dev_attr_chan7_mux.dev_attr.attr,
> + NULL,
No comma for the terminator entry.
> +};
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists