Re: [PATCH] iio: magnetometer: mag3110: add optional vcc regulator operation support

From: Fabio Estevam
Date: Fri Dec 07 2018 - 05:26:52 EST


Hi Anson,

On Thu, Dec 6, 2018 at 3:05 AM Anson Huang <anson.huang@xxxxxxx> wrote:

> static int mag3110_request(struct mag3110_data *data)
> @@ -469,17 +471,27 @@ static int mag3110_probe(struct i2c_client *client,
> struct iio_dev *indio_dev;
> int ret;
>
> + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
> + if (!indio_dev)
> + return -ENOMEM;
> +
> + data = iio_priv(indio_dev);
> +
> + data->vcc_reg = devm_regulator_get_optional(&client->dev, "vcc");
> + if (!IS_ERR(data->vcc_reg)) {
> + ret = regulator_enable(data->vcc_reg);
> + if (ret) {
> + dev_err(&client->dev, "failed to enable VCC regulator\n");

Same comment as in the previous patch.

There is no VCC regulator as per the datasheet. There are VDD and
VDDIO power supplies, so better represent both and with the same name
they appear in the datasheet.