[PATCH 3/4] iio: light: stk3310: add vdd regulator support
From: Roman Vivchar via B4 Relay
Date: Sat Nov 07 2026 - 17:17:23 EST
From: Roman Vivchar <rva333@xxxxxxxxxxxxxx>
On some boards, the sensor is powered by shared power rail. If the rail
is powered down, the chip can't function.
Add optional regulator support to ensure the power supply is enabled for
the chip.
Signed-off-by: Roman Vivchar <rva333@xxxxxxxxxxxxxx>
---
drivers/iio/light/stk3310.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c
index e751e7c97bc1..2f4747c06f43 100644
--- a/drivers/iio/light/stk3310.c
+++ b/drivers/iio/light/stk3310.c
@@ -18,6 +18,7 @@
#include <linux/pm.h>
#include <linux/property.h>
#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
#include <linux/sysfs.h>
#include <linux/types.h>
@@ -745,6 +746,10 @@ static int stk3310_probe(struct i2c_client *client)
device_property_read_u32(&client->dev, "proximity-near-level",
&data->ps_near_level);
+ ret = devm_regulator_get_enable(dev, "vdd");
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to get vdd supply\n");
+
mutex_init(&data->lock);
ret = stk3310_regmap_init(data);
--
2.56.0