Re: [PATCH v4 2/2] iio: adc: ltc2309: add support for ltc2305
From: Kyle Hsieh
Date: Tue Mar 24 2026 - 22:06:24 EST
On Wed, Mar 11, 2026 at 3:11 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxx> wrote:
>
> On Wed, Mar 11, 2026 at 09:43:02AM +0800, Kyle Hsieh wrote:
> > Add support for the 2-channel LTC2305 ADC in the existing LTC2309 driver.
> > The LTC2305 and LTC2309 share similar features: both are 12-bit,
> > low-noise, low-power SAR ADCs with an I2C interface.
> > The main difference is the number of channels: LTC2305 has 2 channels,
> > while LTC2309 has 8 channels.
>
> ...
>
> > /* Order matches expected channel address, See datasheet Table 1. */
>
> This comment now confusing, it should be kept at the initial enum, but the
> better idea is...
>
> > +enum ltc2305_channels {
> > + LTC2305_CH0_CH1 = 0x0,
> > + LTC2305_CH1_CH0 = 0x4,
> > + LTC2305_CH0 = 0x8,
> > + LTC2305_CH1 = 0xc,
> > +};
> > +
> > enum ltc2309_channels {
> > LTC2309_CH0_CH1 = 0,
> > LTC2309_CH2_CH3,
>
> ...to assign proper values (in necessary order) explicitly and adjust comment.
> Then add this patch on top.
>
Thanks for your suggestion.
It makes sense to have explicit values for both chips to avoid
confusion with array indices.
I will split this into a series in v5:
1. A preparation patch to refactor ltc2309_channels using explicit hex
values from the datasheet.
2. The patch to add ltc2305 support on top of that.
> > }
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
Best Regards,
Kyle Hsieh