linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Sa, Nuno" <Nuno.Sa@analog.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "Miclaus, Antoniu" <Antoniu.Miclaus@analog.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v3 1/2] iio: frequency: admv1013: add support for ADMV1013
Date: Thu, 4 Nov 2021 08:11:12 +0000	[thread overview]
Message-ID: <SJ0PR03MB6359234D6DA5D0CC58DB1113998D9@SJ0PR03MB6359.namprd03.prod.outlook.com> (raw)
In-Reply-To: <20211103200325.3416988c@jic23-huawei>


> From: Jonathan Cameron <jic23@kernel.org>
> Sent: Wednesday, November 3, 2021 9:04 PM
> To: Sa, Nuno <Nuno.Sa@analog.com>
> Cc: Miclaus, Antoniu <Antoniu.Miclaus@analog.com>;
> robh+dt@kernel.org; linux-iio@vger.kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v3 1/2] iio: frequency: admv1013: add support for
> ADMV1013
> 
> [External]
> 
> On Tue, 2 Nov 2021 10:09:15 +0000
> "Sa, Nuno" <Nuno.Sa@analog.com> wrote:
> 
> > > +#define ADMV1013_CHAN_PHASE(_channel, rf_comp) {		\
> > > +	.type = IIO_ALTVOLTAGE,					\
> > > +	.modified = 1,						\
> > > +	.output = 1,						\
> > > +	.indexed = 1,						\
> > > +	.channel2 = IIO_MOD_##rf_comp,				\
> > > +	.channel = _channel,					\
> > > +	.info_mask_separate = BIT(IIO_CHAN_INFO_PHASE)		\
> > > +	}
> > > +
> > > +#define ADMV1013_CHAN_CALIB(_channel, rf_comp) {		\
> > > +	.type = IIO_ALTVOLTAGE,					\
> > > +	.modified = 1,						\
> > > +	.output = 1,						\
> > > +	.indexed = 1,						\
> > > +	.channel2 = IIO_MOD_##rf_comp,				\
> > > +	.channel = _channel,					\
> > > +	.info_mask_separate = BIT(IIO_CHAN_INFO_CALIBBIAS)	\
> > > +	}
> > > +
> > > +static const struct iio_chan_spec admv1013_channels[] = {
> > > +	ADMV1013_CHAN_PHASE(0, I),
> > > +	ADMV1013_CHAN_PHASE(0, Q),
> > > +	ADMV1013_CHAN_CALIB(0, I),
> > > +	ADMV1013_CHAN_CALIB(0, Q),
> > > +	ADMV1013_CHAN_CALIB(1, I),
> > > +	ADMV1013_CHAN_CALIB(1, Q),
> > > +};
> > > +
> >
> > Hmm, If I'm not missing nothing this leads to something like:
> >
> > out_altvoltage0_i_phase
> > out_altvoltage0_q_phase
> > out_altvoltage0_i_calibbias
> > out_altvoltage0_q_calibbias
> > out_altvoltage1_i_calibbias
> > out_altvoltage1_q_calibbias
> >
> > To me it is really non obvious that index 1 also applies to the same
> > channel. I see that we have this like this probably because we
> > can't use modified and differential at the same time, right?
> >
> 
> Indeed, this is the problem you mentioned in the discussion on v2
> My suggestion of making it clear it is a differential channel and then
> applying calibbias to the parts doesn't work as it would need to
> have both modifiers and a second channel index.
> As for why that is an issue, it comes down to trying to keep the
> event interface descriptive, but still minimal.  We basically ran
> out of bits and at the time I couldn't think of a reason we'd want
> both differential and a modifier...

I'm not really seeing the issue with the event interface but that is mostly
because I still never had to deal with it, so I never looked that deeply into
the code. Might be a good time know :)

> > Jonathan, I'm not sure what should be the done here... From the top
> of my
> > head  I guess we can either:
> >
> > * drop the modifiers (not perfect but also not that bad IMO)
> > * tweak something adding extended info (not really neat)
> True, it's not neat but might be the way forwards for 'now'.. We don't
> have
> events or anything on this driver, so we could make it look right
> without any
> risk of not being able to extend it.  However it will probably come back
> to bite
> us and userspace may not expect whatever we do.
> Horrible though it is you could use extend_name - which was originally
> intended
> to let us 'label special purpose channels'.  It was a bad idea, but is there
> and
> not going way any time soon.
> 
> If you did the differential thing and set extend_name = "i" etc that
> might get us around the internal issue of reusing channel2 for mod and
> differential
> channel.

Couldn't we use the label to achieve kind of the same? Or do you think
that having the "i" and "q" in the filenames is really mandatory? I can
understand if you think they are as they are valid modifiers. OTOH,
IIRC, with the latest patches from Paul, adding the extended_name will
automatically get us the label sysfs file which might be a little odd but I
guess that's already true for all the legacy drivers using it... So yeah,
between this or extended info, we might have our "band aid" for this.

> > * or handling this in the core with a new variable. Of course, we
> would need
> > to be careful to not break existing drivers...
> 
> We would end up something hardly ever used so I'm doubtful that's a
> good
> idea until we have some visibility of how common it would be.

True, most likely we would end up with a public variable only used in
this use case... Better to wait if some users like this pop up.

- Nuno Sá

  reply	other threads:[~2021-11-04  8:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 10:04 [PATCH v3 1/2] iio: frequency: admv1013: add support for ADMV1013 Antoniu Miclaus
2021-11-01 10:04 ` [PATCH v3 2/2] dt-bindings: iio: frequency: add admv1013 doc Antoniu Miclaus
2021-11-02 17:50   ` Rob Herring
2021-11-03  8:09     ` Miclaus, Antoniu
2021-11-03 14:30       ` Miclaus, Antoniu
2021-11-04 18:26         ` Jonathan Cameron
2021-11-05  8:38           ` Miclaus, Antoniu
2021-11-05 17:10             ` Jonathan Cameron
2021-11-08 10:01               ` Miclaus, Antoniu
2021-11-13 16:24                 ` Jonathan Cameron
2021-11-02 10:09 ` [PATCH v3 1/2] iio: frequency: admv1013: add support for ADMV1013 Sa, Nuno
2021-11-03 20:03   ` Jonathan Cameron
2021-11-04  8:11     ` Sa, Nuno [this message]
2021-11-04 18:23       ` Jonathan Cameron
2021-11-05  9:11         ` Sa, Nuno

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=SJ0PR03MB6359234D6DA5D0CC58DB1113998D9@SJ0PR03MB6359.namprd03.prod.outlook.com \
    --to=nuno.sa@analog.com \
    --cc=Antoniu.Miclaus@analog.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).