Re: [PATCH v3 6/9] iio: adc: ti-ads1262: support excitation currents
David Lechner <[email protected]>
| Newsgroups | org.kernel.vger.linux-gpio,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 8/7/26 10:58 PM, Kurt Borja wrote: > Support the two IDAC excitation current sources. Each channel can route > its IDAC1/IDAC2 outputs to a pin via the "excitation-channels" property > and select a magnitude via "excitation-current-nanoamp". > Reviewed-by: David Lechner <[email protected]> > @@ -1150,7 +1192,58 @@ static int ads1262_parse_channel_node(struct ads1262 *st, > } > } > > + if (fwnode_property_present(node, "excitation-channels")) { > + count = fwnode_property_count_u32(node, "excitation-channels"); > + if (count < 0) > + return dev_err_probe(dev, count, > + "%s: failed to count excitation-channels\n", > + fwnode_get_name(node)); > + > + pins[0] = ADS1262_IDACMUX_NO_CONN; > + pins[1] = ADS1262_IDACMUX_NO_CONN; > + ret = fwnode_property_read_u32_array(node, "excitation-channels", > + pins, min(count, ARRAY_SIZE(pins))); > + if (ret) > + return dev_err_probe(dev, ret, "%s: failed to read excitation-channels\n", > + fwnode_get_name(node)); > + if (pins[0] > ADS1262_IDACMUX_NO_CONN || pins[1] > ADS1262_IDACMUX_NO_CONN) > + return dev_err_probe(dev, -EINVAL, "%s: excitation-channels not in range\n", > + fwnode_get_name(node)); > + chan->idac_mux[0] = pins[0]; > + chan->idac_mux[1] = pins[1]; > + > + mags[0] = 0; > + mags[1] = 0; > + ret = fwnode_property_read_u32_array(node, "excitation-current-nanoamp", > + mags, min(count, ARRAY_SIZE(mags))); > + if (ret == -EOVERFLOW) > + return dev_err_probe(dev, ret, > + "%s: excitation-current-nanoamp size mismatch\n", > + fwnode_get_name(node)); I don't think we need a special error message for this case. The error code will already be printed. > + if (ret) > + return dev_err_probe(dev, ret, > + "%s: failed to read excitation-current-nanoamp\n", > + fwnode_get_name(node)); > +