From: Javier Carrasco Date: Tue, 1 Oct 2024 20:21:17 +0000 (+0200) Subject: iio: light: veml6030: add support for a regulator X-Git-Tag: v6.13-rc1~28^2~41^2~33 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=c8823425af28873bf61633ee37adaa40c1615752;p=linux-block.git iio: light: veml6030: add support for a regulator Use the device managed function from the regulator API to get and enable a regulator powering the device. Use "vdd" as the ID to account for the provided name in the datasheet. Signed-off-by: Javier Carrasco Link: https://patch.msgid.link/20241001-veml6035-v3-4-d789f6ff147c@gmail.com Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/light/veml6030.c b/drivers/iio/light/veml6030.c index 6646fe2e74a7..72c1988e48e6 100644 --- a/drivers/iio/light/veml6030.c +++ b/drivers/iio/light/veml6030.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -807,6 +808,11 @@ static int veml6030_probe(struct i2c_client *client) data->client = client; data->regmap = regmap; + ret = devm_regulator_get_enable(&client->dev, "vdd"); + if (ret) + return dev_err_probe(&client->dev, ret, + "failed to enable regulator\n"); + indio_dev->name = "veml6030"; indio_dev->channels = veml6030_channels; indio_dev->num_channels = ARRAY_SIZE(veml6030_channels);