Re: [PATCH v3 6/8] iio: adc: add ti-ads112c14 driver

From: David Lechner

Date: Sun Jul 12 2026 - 12:30:42 EST


On 7/12/26 4:42 AM, Andy Shevchenko wrote:
> On Fri, Jul 10, 2026 at 05:50:39PM -0500, David Lechner (TI) wrote:
>> Add a new driver for the TI ADS112C14/ADS122C14 ADC chips.
>>
>> This first step is adding a very basic driver that only supports power
>> on/reset and reading the system monitor channels.
>>
>> ADS112C14_SYS_MON_CHANNEL_SHORT is the last channel rather than being in
>> logical order by address to keep the voltage channels together and in
>> case we find we need to add variants of this channel with different
>> voltage reference later.
>
> ...
>
>> +static int ads112c14_probe(struct i2c_client *client)
>> +{
>> + struct device *dev = &client->dev;
>> + const struct ads112c14_chip_info *info;
>> + struct iio_dev *indio_dev;
>> + struct ads112c14_data *data;
>> + u32 reg_val;
>> + int ret;
>> +
>> + info = i2c_get_match_data(client);
>> + if (!info)
>> + return dev_err_probe(dev, -EINVAL, "missing match data\n");
>
> I think -ENODEV suits better here.

Sure. I went with EINVAL because I thought it was more common, but we
have about the same number of both ENODEV and EINVAL at this point.

I also saw one ENOSYS, which we really should not be using. And one
ENODATA which actually makes sense too.

>
>> + indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
>> + if (!indio_dev)
>> + return -ENOMEM;
>> +
>> + data = iio_priv(indio_dev);
>> + data->chip_info = info;
>> +
>> + ret = devm_regulator_get_enable(dev, "dvdd");
>> + if (ret)
>> + return dev_err_probe(dev, ret, "failed to get dvdd regulator\n");
>> +
>> + ret = devm_regulator_get_enable(dev, "avdd");
>> + if (ret)
>> + return dev_err_probe(dev, ret, "failed to get avdd regulator\n");
>> +
>> + data->regmap = devm_regmap_init_i2c(client, &ads112c14_regmap_config);
>> + if (IS_ERR(data->regmap))
>> + return dev_err_probe(dev, PTR_ERR(data->regmap),
>> + "failed to init regmap\n");
>
> Do we have a guarantee that device is powered on here?

I guess you mean did I miss a 10 ms power up delay?