RE: [PATCH v6 2/2] iio: amplifiers: adl8113: add driver support

From: Miclaus, Antoniu

Date: Fri Dec 12 2025 - 05:41:31 EST


Hi,
>
> Could do this as something like:
>
> st->gain_configs[i++] = (struct adl8113_gain_config) {
> .path = ADL8113_INTERNAL_AMP,
> .gain_db = 14,
> };
>
> st->gain_configs[i++] = (struct adl8113_gain_config) {
> .path = ADL8113_INTERNAL_BYPASS,
> .gain_db = -2,
> };
>
> etc.
>
> > + i++;
> > +
> > + /* Always include internal bypass (-2dB insertion loss) */
> > + st->gain_configs[i].path = ADL8113_INTERNAL_BYPASS;
> > + st->gain_configs[i].gain_db = -2;
> > + i++;
> > +
> > + /* Add external bypass A if configured */
> > + if (!device_property_read_u32(dev, "adi,external-bypass-a-gain-db",
> > + &external_a_gain)) {
> > + st->gain_configs[i].path = ADL8113_EXTERNAL_A;
> > + st->gain_configs[i].gain_db = external_a_gain;
> > + i++;
> > + }
> > +
> > + /* Add external bypass B if configured */
> > + if (!device_property_read_u32(dev, "adi,external-bypass-b-gain-db",
> > + &external_b_gain)) {
> > + st->gain_configs[i].path = ADL8113_EXTERNAL_B;
> > + st->gain_configs[i].gain_db = external_b_gain;
> > + i++;
> > + }
> > +
> > + /*
> > + * If there's a free external bypass path, add one with INT_MIN gain
> > + * to represent "nothing connected" for testing purposes
>
> I don't follow this one. What sort of testing purpose? Something we want
> in a real system?
This addition was suggested by David in v4. But I can revert it in the next series.

Regards,
Antoniu