Re: [RFC PATCH] one-bit-adc-dac: Add initial version of one bit ADC, DAC

From: Jonathan Cameron
Date: Sun Jul 26 2020 - 08:51:05 EST


..
> >
> > > > + if (ret < 0)
> > > > + return ret;
> > > > +
> > > > + for (i = 0; i < num_ch; i++) {
> > > > + channels[i] = (struct
> > iio_chan_spec)ONE_BIT_ADC_DAC_CHANNEL(i +
> > > > + offset,
> > > > + direction);
> > > > + channels[i].extend_name = gpio_names[i];
> > > I think we want to avoid using extend_name in new drivers because it
> > > makes for a very clumsy ABI. We should add a label property like we
> > > have for the device for channels to have a symbolic name of the channel.
> The current dts looks like this:
> one-bit-adc-dac@0 {
> in-gpios = <&gpio 17 0>, <&gpio 27 0>;
> in-gpio-names = "i_17", "i_27";
> out-gpios = <&gpio 23 0>, <&gpio 24 0>;
> out-gpio-names = "o_23", "o_24";
> };
> Resulting in channels:
> in_voltage0_i_17_raw
> in_voltage1_i_27_raw
> out_voltage2_o_23_raw
> out_voltage3_o_24_raw
> If we want to lose extend_name, please provide an example for using labels.
> How the dts should look like, how do I use it in the driver?

Doesn't exist yet :) Proposal was to add support for a label attribute
to the iio core.

If we were going to do a generic binding it would have to be part of the
existing channel bindings. e.g.
Documentation/devicetree/bindings/iio/adc/adc.txt

But here it might be fine to use the gpio-names to fill one in.
Alternative would be to use a binding where the gpio was specified
as part of the per channel child nodes rather than as a single entry.