On 11/25/23 19:21, Jonathan Cameron wrote: > On Thu, 23 Nov 2023 17:23:22 +0200 > mitrutzceclan <mitrutzceclan@xxxxxxxxx> wrote: > >> From: Dumitru Ceclan <mitrutzceclan@xxxxxxxxx> ... >> + st->regulators[0].supply = ad7173_ref_sel_str[AD7173_SETUP_REF_SEL_EXT_REF]; >> + st->regulators[1].supply = ad7173_ref_sel_str[AD7173_SETUP_REF_SEL_EXT_REF2]; >> + st->regulators[2].supply = ad7173_ref_sel_str[AD7173_SETUP_REF_SEL_AVDD1_AVSS]; >> + >> + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(st->regulators), >> + st->regulators); > > If only some of them are supplied, the driver works fine as long as no channel is using them? > If so should probably get the optionally then check for availability of the ones you > want. I'm sure someone will just wire up ref. Incidentally, ref2 isn't there for all chips > I think, so we should not get it on the ones where it can't exist. > This sets a dummy regulator in place if no proper supply is found. Then the call regulator_get_voltage() on the dummy will fail. About getting ref2, sure, I'll set the string only with the right ID. ... >> + ret = ad7173_get_ref_voltage_milli(st, (u8)ref_sel); >> + if (ret < 0) >> + return dev_err_probe(dev, ret, >> + "Cannot use reference %u", ref_sel); Here the probe would not continue if a channel selects a supply that is not available in the DT.