diff options
author | Benjamin Mugnier <benjamin.mugnier@foss.st.com> | 2022-11-07 15:00:00 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2022-11-25 08:40:21 +0000 |
commit | 74b681bd24eefe0d240ef7e5e99aff5b12fd021a (patch) | |
tree | 165b3b81f19de5ad6f828d0a0d1315bea9ff1f22 /drivers | |
parent | e645289459edd9415d3d657b5fc84034d34fecb3 (diff) | |
download | linux-stable-74b681bd24eefe0d240ef7e5e99aff5b12fd021a.tar.gz linux-stable-74b681bd24eefe0d240ef7e5e99aff5b12fd021a.tar.bz2 linux-stable-74b681bd24eefe0d240ef7e5e99aff5b12fd021a.zip |
media: i2c: st-vgxy61: Fix regulator counter underflow
Previously regulators were enabled on probe and never again.
However, as regulators are disabled on power off. After a second power off
the regulator counter will underflow. Plus regulators are not required
for probing the sensor, but for streaming.
Fix this by enabling regulators on power on to balance regulator counter
properly.
Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/i2c/st-vgxy61.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/media/i2c/st-vgxy61.c b/drivers/media/i2c/st-vgxy61.c index dfbf25338160..771a495c716d 100644 --- a/drivers/media/i2c/st-vgxy61.c +++ b/drivers/media/i2c/st-vgxy61.c @@ -1711,6 +1711,13 @@ static int vgxy61_power_on(struct device *dev) struct vgxy61_dev *sensor = to_vgxy61_dev(sd); int ret; + ret = regulator_bulk_enable(ARRAY_SIZE(vgxy61_supply_name), + sensor->supplies); + if (ret) { + dev_err(&client->dev, "failed to enable regulators %d\n", ret); + return ret; + } + ret = clk_prepare_enable(sensor->xclk); if (ret) { dev_err(&client->dev, "failed to enable clock %d\n", ret); @@ -1847,13 +1854,6 @@ static int vgxy61_probe(struct i2c_client *client) return ret; } - ret = regulator_bulk_enable(ARRAY_SIZE(vgxy61_supply_name), - sensor->supplies); - if (ret) { - dev_err(&client->dev, "failed to enable regulators %d\n", ret); - return ret; - } - ret = vgxy61_power_on(dev); if (ret) return ret; |