linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Sukrut Bellary <sbellary@baylibre.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Matti Vaittinen" <mazziesaccount@gmail.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Angelo Compagnucci" <angelo.compagnucci@gmail.com>,
	"Nishanth Menon" <nm@ti.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/5] iio: adc: ti-adc128s052: Use shift and realbits
Date: Sun, 29 Jun 2025 17:26:55 +0100	[thread overview]
Message-ID: <20250629172655.209e2bd2@jic23-huawei> (raw)
In-Reply-To: <aGBKMcZGYOcXmKdB@dev-linux>

On Sat, 28 Jun 2025 13:01:53 -0700

> > > +		.type = IIO_VOLTAGE,					\
> > > +		.indexed = 1,						\
> > > +		.channel = (num),					\
> > > +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),		\
> > > +		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),	\
> > > +		.scan_index = (num),					\
> > > +		.scan_type = {						\
> > > +			.sign = 'u',					\
> > > +			.realbits = (real_bits),			\
> > > +			.storagebits = 16,				\
> > > +			.shift = (12 - real_bits),			\
> > > +		},							\
> > >  	}
> > >  
> > > +#define ADC128_VOLTAGE_CHANNEL(num) _ADC128_VOLTAGE_CHANNEL(num, 12)  
> > 
> > I wonder if it would be clearer to just have the 12 explicit in each entry
> > and skip this two levels of macro thing?
> >  
> Do you mean to pass realbits to
> ADC128_VOLTAGE_CHANNEL/_ADC128_VOLTAGE_CHANNEL as e.g.,
> 
> static const struct iio_chan_spec adc122s021_channels[] = {
>         ADC128_VOLTAGE_CHANNEL(0, 12),
>         ADC128_VOLTAGE_CHANNEL(1, 12),
> };
> 
> I think we added 2nd level macros as ADC082_VOLTAGE_CHANNEL,
> ADC102_VOLTAGE_CHANNEL, etc., to have a visual distinction for a different
> part nos.

I think as we can have lots of parts with each resolution that will
end up confusing.

> But I am ok if you prefer ADC128_VOLTAGE_CHANNEL with a second parameter
> as real_bits.

I think that's going to be easier to follow.

Jonathan


  reply	other threads:[~2025-06-29 16:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-14  9:14 [PATCH v4 0/5] iio: adc: ti-adc128s052: Add support for adc102s051 Sukrut Bellary
2025-06-14  9:15 ` [PATCH v4 1/5] dt-bindings: iio: adc: ti,adc128s052: Add adc08c and adc10c family Sukrut Bellary
2025-06-16  7:19   ` Krzysztof Kozlowski
2025-06-28 19:34     ` Sukrut Bellary
2025-06-14  9:15 ` [PATCH v4 2/5] iio: adc: ti-adc128s052: Use shift and realbits Sukrut Bellary
2025-06-14 13:27   ` Jonathan Cameron
2025-06-28 20:01     ` Sukrut Bellary
2025-06-29 16:26       ` Jonathan Cameron [this message]
2025-06-30  1:10         ` Sukrut Bellary
2025-06-14  9:15 ` [PATCH v4 3/5] iio: adc: ti-adc128s052: cleanup changes Sukrut Bellary
2025-06-16  5:56   ` Matti Vaittinen
2025-06-14  9:15 ` [PATCH v4 4/5] iio: adc: ti-adc128s052: Add lower resolution devices support Sukrut Bellary
2025-06-14 18:45   ` Andy Shevchenko
2025-06-28 23:09     ` Sukrut Bellary
2025-06-28 23:30       ` David Lechner
2025-06-29  6:06         ` Andy Shevchenko
2025-06-30  1:02           ` Sukrut Bellary
2025-06-14  9:15 ` [PATCH v4 5/5] MAINTAINERS: maintainer for TI's ADCs' driver ti-adc128s052 Sukrut Bellary

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=20250629172655.209e2bd2@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=angelo.compagnucci@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mazziesaccount@gmail.com \
    --cc=nm@ti.com \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=sbellary@baylibre.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 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).