Re: [PATCH v3 2/2] iio: dac: support the ad8460 Waveform DAC

From: David Lechner
Date: Mon Sep 09 2024 - 10:42:04 EST


On 9/9/24 3:22 AM, Tinaco, Mariel wrote:
>
>

...

>>> + if (IS_ERR(state->regmap))
>>> + return dev_err_probe(dev, PTR_ERR(state->regmap),
>>> + "Failed to initialize regmap");
>>> +
>>> + state->sync_clk = devm_clk_get_enabled(dev, NULL);
>>> + if (IS_ERR(state->sync_clk))
>>> + return dev_err_probe(dev, PTR_ERR(state->sync_clk),
>>> + "Failed to get sync clk\n");
>>> +
>>> + state->tmp_adc_channel = devm_iio_channel_get(dev, "ad8460-
>> tmp");
>>> + if (IS_ERR_OR_NULL(state->tmp_adc_channel)) {
>>> + indio_dev->channels = ad8460_channels;
>>> + indio_dev->num_channels = ARRAY_SIZE(ad8460_channels);
>>> + } else {
>>> + indio_dev->channels = ad8460_channels_with_tmp_adc;
>>> + indio_dev->num_channels =
>> ARRAY_SIZE(ad8460_channels_with_tmp_adc);
>>> + }
>>> +
>> Add and enable the various other supplies. They are probably always on in
>> which case the regulator framework will work it's magic to avoid use having to
>> care that they aren't in the dts.
>
> If the other supplies are added, do they need to be tied up as well to the
> Private structure just like ref_1p2v? Or do I just apply the
> devm_regulator_get_enable_read_voltage to it?
>
> ret = devm_regulator_get_enable_read_voltage(&client->dev, "vdd");
> If (ret < 0 && ret != -ENODEV)
> return dev_err_probe(ltc2309->dev, ret,
> "failed to get vref voltage\n");
>

For supplies that just supply power, we usually don't worry
about the voltage, so just use devm_regulator_get_enable().
Or if there are lots of supplies, you can use
devm_regulator_bulk_get_enable() to do them all at once.

They don't need to be added to the private structure.

Also, lots of chips have to have supplies turned on in a
certain order. This one is no exception, so be sure to
have a look at the "POWER SUPPLY SEQUENCING" section in
the datasheet to make sure the driver turns things on in
the right order.