Skip to contentSkip to conversation

iio: light: vcnl4000: add regulator support

PATCH Superseded Erikas Bitovtas 3 participants 17 messages Mar 16 – Mar 18

Subsystems (2)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover iio: light: vcnl4000: add regulator support

This patch series introduces support for voltage supply, I2C and cathode regulators. This fixes an issue where if a regulator is shared between the proximity sensor and some other device, and the other device is powered off, the proximity sensor would be powered off as well.

One of the commits includes a Reported-by: tag without a Closes: tag - the report was done outside of LKML.

---
Changes in v4:
- Reworded device tree bindings commit into imperative mood and
clarified where do supplies come from.
- Moved data->chip_spec->set_power_state() calls from init functions to
probe.
- Removed explicit less than 0 checks for ret where unnecessary.
- Moved the patch that adds regulators to the end of the series.
- Added an explanation for removing duplicate prints in probe.
- Fixed indentation for devm_regulator_bulk_get_enable() and i2c_smbus
writes in vcnl4200_init().
- Removed a redundant check for "proximity-near-level" device property.
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Added a more detailed description for supplies in the dt-bindings commit.
- Separated sorting includes into a commit of its own.
- Replaced all occurrences of mutex_init with its device-managed
counterpart.
- Moved client->dev variable declaration into a commit for adding
regulators.
- Removed redundant dev_err messages in probe function.
- Replaced all direct usages of client->dev and data->client into usages
by variable.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Removed double quotes in includes.
- Reordered includes alphabetically.
- Enabled regulators before the mutex is initialized.
- Replaced direct usage of &client->dev with a variable.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Erikas Bitovtas (7):
dt-bindings: iio: light: vcnl4000: add regulators
iio: light: vcnl4000: sort includes by their name
iio: light: vcnl4000: move power enablement from init to probe
iio: light: vcnl4000: replace mutex_init with devm_mutex_init
iio: light: vcnl4000: remove error messages for trigger and irq
iio: light: vcnl4000: use variables for I2C client and device instances
iio: light: vcnl4000: add support for regulators

 .../bindings/iio/light/vishay,vcnl4000.yaml        |  7 ++
 drivers/iio/light/vcnl4000.c                       | 90 ++++++++++++----------
 2 files changed, 56 insertions(+), 41 deletions(-)

---
base-commit: 6e03baeeb160e6cfd72f2c39f26c50bcd925c7a0
change-id: 20260310-vcnl4000-regulators-bcf1b8a01ce6

Best regards,

Signature · 1 line
Erikas Bitovtas <[email protected]>
#1 lore raw

PATCH v4 1/7 dt-bindings: iio: light: vcnl4000: add regulators

These sensors can accept 2 supplies - one for the sensor and one for IR LED [1]. Add supply properties for the sensor - 2 for the sensors and one external, for their I2C bus, to ensure the sensor is powered on before proceeding with setup.

[1] https://www.vishay.com/docs/84274/vcnl4040.pdf

---
 Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml +7 -0
index 2ba4d5de4ec4..a1b4c02db246 100644
@@ -33,6 +33,10 @@ properties:
   interrupts:
     maxItems: 1
 
+  vdd-supply: true
+  vddio-supply: true
+  vled-supply: true
+
   reg:
     maxItems: 1
 
@@ -54,6 +58,9 @@ examples:
             compatible = "vishay,vcnl4200";
             reg = <0x51>;
             proximity-near-level = <220>;
+            vdd-supply = <&reg_vdd>;
+            vddio-supply = <&reg_vddio>;
+            vled-supply = <&reg_vled>;
         };
     };
 ...
Signature · 1 line
2.53.0
#2 lore raw

Re: [PATCH v4 1/7] dt-bindings: iio: light: vcnl4000: add regulators

Quoted 18 lines · Erikas Bitovtas

These sensors can accept 2 supplies - one for the sensor and one for IR LED [1]. Add supply properties for the sensor - 2 for the sensors and one external, for their I2C bus, to ensure the sensor is powered on before proceeding with setup.

[1] https://www.vishay.com/docs/84274/vcnl4040.pdf

---
 Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml +0 -0
index 2ba4d5de4ec4..a1b4c02db246 100644

Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml properties: · line 38

Quoted 6 lines
Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml +3 -0
@@ -33,6 +33,10 @@ properties:
   interrupts:
     maxItems: 1
 
+  vdd-supply: true
+  vddio-supply: true
+  vled-supply: true

Same comments as before, I do not see improvements.

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH v4 1/7] dt-bindings: iio: light: vcnl4000: add regulators

Quoted 22 lines · Krzysztof Kozlowski
Quoted 21 lines · Erikas Bitovtas

These sensors can accept 2 supplies - one for the sensor and one for IR LED [1]. Add supply properties for the sensor - 2 for the sensors and one external, for their I2C bus, to ensure the sensor is powered on before proceeding with setup.

[1] https://www.vishay.com/docs/84274/vcnl4040.pdf

---
 Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml +0 -0
index 2ba4d5de4ec4..a1b4c02db246 100644
@@ -33,6 +33,10 @@ properties:
   interrupts:
     maxItems: 1
 
Quoted 9 lines

Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml properties: · line 38

Quoted 3 lines
Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml +3 -0
+  vdd-supply: true
+  vddio-supply: true
+  vled-supply: true

Same comments as before, I do not see improvements.

Best regards,
Krzysztof

I explained why in v3. The message can be found here:
https://lore.kernel.org/linux-iio/[email protected]/T/#m6da277894cf5c2b473fbeebd4b7bafc7519ebc26

#4 lore raw

Re: [PATCH v4 1/7] dt-bindings: iio: light: vcnl4000: add regulators

Quoted 4 lines · Erikas Bitovtas
Quoted 4 lines
Quoted 3 lines
Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml +3 -0
+  vdd-supply: true
+  vddio-supply: true
+  vled-supply: true
Quoted 8 lines
Quoted 5 lines

Same comments as before, I do not see improvements.

Best regards,
Krzysztof

I explained why in v3. The message can be found here:
https://lore.kernel.org/linux-iio/[email protected]/T/#m6da277894cf5c2b473fbeebd4b7bafc7519ebc26

Apologies, I missed that. VDD and VLED are fine, but I2C bus supply is a property of the I2C controller, not the device, therefore please drop VDDIO.

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH v4 1/7] dt-bindings: iio: light: vcnl4000: add regulators

Quoted 11 lines · Krzysztof Kozlowski
Quoted 10 lines · Erikas Bitovtas
Quoted 9 lines

Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml properties: · line 38

Quoted 3 lines
Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml +3 -0
+  vdd-supply: true
+  vddio-supply: true
+  vled-supply: true

Same comments as before, I do not see improvements.

Best regards,
Krzysztof

Quoted 8 lines
Quoted 2 lines

I explained why in v3. The message can be found here:
https://lore.kernel.org/linux-iio/[email protected]/T/#m6da277894cf5c2b473fbeebd4b7bafc7519ebc26

Apologies, I missed that. VDD and VLED are fine, but I2C bus supply is a property of the I2C controller, not the device, therefore please drop VDDIO.

Best regards,
Krzysztof

VDDIO supply is needed for the pull-up resistors for the open drain I2C and interrupt lines. Without them, the device will send spurious interrupts. Such cases are already present in mainline, for example Awinic AW2013 led driver [1]:

Quoted 6 lines

there is usually more than just the I2C I/O lines. For AW2013 there is at least also the open-drain interrupt line. On other ICs there could also be arbitrary GPIO lines that are used in open-drain mode. Those are completely unrelated to the I2C controller.

Do you have any suggestions how to handle the power supply for those?

From the looks of it, it was agreed upon to rename the supply from VDDIO to VIO. Has anything changed since then and now there is a better way to represent this relationship?

[1]: https://lore.kernel.org/all/[email protected]/#t

#6 lore raw

PATCH v4 2/7 iio: light: vcnl4000: sort includes by their name

In reply to Erikas Bitovtas

Sort include headers by file name for better readability.

---
 drivers/iio/light/vcnl4000.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iio/light/vcnl4000.c +4 -4
index 5e03c3d8874b..939ff2d65105 100644
@@ -18,12 +18,12 @@
  */
 
 #include <linux/bitfield.h>
-#include <linux/module.h>
-#include <linux/i2c.h>
-#include <linux/err.h>
 #include <linux/delay.h>
-#include <linux/pm_runtime.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
 #include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/pm_runtime.h>
 #include <linux/units.h>
 
 #include <linux/iio/buffer.h>
Signature · 1 line
2.53.0
#7 lore raw

PATCH v4 3/7 iio: light: vcnl4000: move power enablement from init to probe

In reply to Erikas Bitovtas

Given both vcnl4000_init and vcnl4200_init end with dev->chip_spec->set_power_state(), they can be called once from the probe to enable the sensors. Move the set_power_state function from init and call it after init function in probe.

---
 drivers/iio/light/vcnl4000.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/iio/light/vcnl4000.c +5 -5
index 939ff2d65105..287ccd89cfb2 100644
@@ -280,7 +280,7 @@ static int vcnl4000_init(struct vcnl4000_data *data)
 	data->rev = ret & 0xf;
 	data->al_scale = 250000;
 
-	return data->chip_spec->set_power_state(data, true);
+	return 0;
 };
 
 static ssize_t vcnl4000_write_als_enable(struct vcnl4000_data *data, bool en)
@@ -425,10 +425,6 @@ static int vcnl4200_init(struct vcnl4000_data *data)
 	if (ret < 0)
 		return ret;
 
-	ret = data->chip_spec->set_power_state(data, true);
-	if (ret < 0)
-		return ret;
-
 	return 0;
 };
 
@@ -2003,6 +1999,10 @@ static int vcnl4000_probe(struct i2c_client *client)
 	if (ret < 0)
 		return ret;
 
+	ret = data->chip_spec->set_power_state(data, true);
+	if (ret)
+		return ret;
+
 	dev_dbg(&client->dev, "%s Ambient light/proximity sensor, Rev: %02x\n",
 		data->chip_spec->prod, data->rev);
 
Signature · 1 line
2.53.0
#8 lore raw

PATCH v4 4/7 iio: light: vcnl4000: replace mutex_init with devm_mutex_init

In reply to Erikas Bitovtas

Replace mutex_init used across driver with its device-managed counterpart, so all assigned mutexes get destroyed.

---
 drivers/iio/light/vcnl4000.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/iio/light/vcnl4000.c +14 -3
index 287ccd89cfb2..cd7e6ee42cc5 100644
@@ -356,6 +356,8 @@ static int vcnl4200_set_power_state(struct vcnl4000_data *data, bool on)
 
 static int vcnl4200_init(struct vcnl4000_data *data)
 {
+	struct i2c_client *client = data->client;
+	struct device *dev = &client->dev;
 	int ret, id;
 	u16 regval;
 
@@ -400,8 +402,14 @@ static int vcnl4200_init(struct vcnl4000_data *data)
 	}
 	data->al_scale = data->chip_spec->ulux_step;
 	data->ps_scale = 16;
-	mutex_init(&data->vcnl4200_al.lock);
-	mutex_init(&data->vcnl4200_ps.lock);
+
+	ret = devm_mutex_init(dev, &data->vcnl4200_al.lock);
+	if (ret)
+		return ret;
+
+	ret = devm_mutex_init(dev, &data->vcnl4200_ps.lock);
+	if (ret)
+		return ret;
 
 	/* Use 16 bits proximity sensor readings */
 	ret = i2c_smbus_read_word_data(data->client, VCNL4200_PS_CONF1);
@@ -1979,6 +1987,7 @@ static int vcnl4010_probe_trigger(struct iio_dev *indio_dev)
 static int vcnl4000_probe(struct i2c_client *client)
 {
 	const struct i2c_device_id *id = i2c_client_get_device_id(client);
+	struct device *dev = &client->dev;
 	struct vcnl4000_data *data;
 	struct iio_dev *indio_dev;
 	int ret;
@@ -1993,7 +2002,9 @@ static int vcnl4000_probe(struct i2c_client *client)
 	data->id = id->driver_data;
 	data->chip_spec = &vcnl4000_chip_spec_cfg[data->id];
 
-	mutex_init(&data->vcnl4000_lock);
+	ret = devm_mutex_init(dev, &data->vcnl4000_lock);
+	if (ret)
+		return ret;
 
 	ret = data->chip_spec->init(data);
 	if (ret < 0)
Signature · 1 line
2.53.0
#9 lore raw

PATCH v4 5/7 iio: light: vcnl4000: remove error messages for trigger and irq

In reply to Erikas Bitovtas

The error code is available in the log after return. In our case, attaching a triggered buffer can only fail if we are out of memory, as no other buffer is being attached. Remove duplicate error messages to reduce noise in dmesg.

---
 drivers/iio/light/vcnl4000.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/iio/light/vcnl4000.c +2 -7
index cd7e6ee42cc5..76aee16d479b 100644
@@ -2033,11 +2033,8 @@ static int vcnl4000_probe(struct i2c_client *client)
 						      NULL,
 						      data->chip_spec->trig_buffer_func,
 						      data->chip_spec->buffer_setup_ops);
-		if (ret < 0) {
-			dev_err(&client->dev,
-				"unable to setup iio triggered buffer\n");
+		if (ret < 0)
 			return ret;
-		}
 	}
 
 	if (client->irq && data->chip_spec->irq_thread) {
@@ -2047,10 +2044,8 @@ static int vcnl4000_probe(struct i2c_client *client)
 						IRQF_ONESHOT,
 						"vcnl4000_irq",
 						indio_dev);
-		if (ret < 0) {
-			dev_err(&client->dev, "irq request failed\n");
+		if (ret < 0)
 			return ret;
-		}
 
 		ret = vcnl4010_probe_trigger(indio_dev);
 		if (ret < 0)
Signature · 1 line
2.53.0
#10 lore raw

PATCH v4 6/7 iio: light: vcnl4000: use variables for I2C client and device instances

In reply to Erikas Bitovtas

After moving data->client and client->dev into variables of their own, replace all instances of data->client and client->dev being used in vcnl4200_init and vcnl4000_probe by the said variables to reduce clutter.

---
 drivers/iio/light/vcnl4000.c | 39 +++++++++++++++++----------------------
 1 file changed, 17 insertions(+), 22 deletions(-)
drivers/iio/light/vcnl4000.c +17 -22
index 76aee16d479b..0a4d82679cfe 100644
@@ -361,14 +361,14 @@ static int vcnl4200_init(struct vcnl4000_data *data)
 	int ret, id;
 	u16 regval;
 
-	ret = i2c_smbus_read_word_data(data->client, VCNL4200_DEV_ID);
+	ret = i2c_smbus_read_word_data(client, VCNL4200_DEV_ID);
 	if (ret < 0)
 		return ret;
 
 	id = ret & 0xff;
 
 	if (id != VCNL4200_PROD_ID) {
-		ret = i2c_smbus_read_word_data(data->client, VCNL4040_DEV_ID);
+		ret = i2c_smbus_read_word_data(client, VCNL4040_DEV_ID);
 		if (ret < 0)
 			return ret;
 
@@ -378,7 +378,7 @@ static int vcnl4200_init(struct vcnl4000_data *data)
 			return -ENODEV;
 	}
 
-	dev_dbg(&data->client->dev, "device id 0x%x", id);
+	dev_dbg(dev, "device id 0x%x", id);
 
 	data->rev = (ret >> 8) & 0xf;
 	data->ps_int = 0;
@@ -412,24 +412,22 @@ static int vcnl4200_init(struct vcnl4000_data *data)
 		return ret;
 
 	/* Use 16 bits proximity sensor readings */
-	ret = i2c_smbus_read_word_data(data->client, VCNL4200_PS_CONF1);
+	ret = i2c_smbus_read_word_data(client, VCNL4200_PS_CONF1);
 	if (ret < 0)
 		return ret;
 
 	regval = ret | VCNL4040_PS_CONF2_PS_HD;
-	ret = i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1,
-					regval);
+	ret = i2c_smbus_write_word_data(client, VCNL4200_PS_CONF1, regval);
 	if (ret < 0)
 		return ret;
 
 	/* Align proximity sensor sample rate to 16 bits data width */
-	ret = i2c_smbus_read_word_data(data->client, VCNL4200_PS_CONF3);
+	ret = i2c_smbus_read_word_data(client, VCNL4200_PS_CONF3);
 	if (ret < 0)
 		return ret;
 
 	regval = ret | VCNL4040_CONF3_PS_SAMPLE_16BITS;
-	ret = i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF3,
-					regval);
+	ret = i2c_smbus_write_word_data(client, VCNL4200_PS_CONF3, regval);
 	if (ret < 0)
 		return ret;
 
@@ -1992,7 +1990,7 @@ static int vcnl4000_probe(struct i2c_client *client)
 	struct iio_dev *indio_dev;
 	int ret;
 
-	indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
+	indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
 	if (!indio_dev)
 		return -ENOMEM;
 
@@ -2014,12 +2012,10 @@ static int vcnl4000_probe(struct i2c_client *client)
 	if (ret)
 		return ret;
 
-	dev_dbg(&client->dev, "%s Ambient light/proximity sensor, Rev: %02x\n",
+	dev_dbg(dev, "%s Ambient light/proximity sensor, Rev: %02x\n",
 		data->chip_spec->prod, data->rev);
 
-	if (device_property_read_u32(&client->dev, "proximity-near-level",
-				     &data->near_level))
-		data->near_level = 0;
+	device_property_read_u32(dev, "proximity-near-level", &data->near_level);
 
 	indio_dev->info = data->chip_spec->info;
 	indio_dev->channels = data->chip_spec->channels;
@@ -2029,8 +2025,7 @@ static int vcnl4000_probe(struct i2c_client *client)
 
 	if (data->chip_spec->trig_buffer_func &&
 	    data->chip_spec->buffer_setup_ops) {
-		ret = devm_iio_triggered_buffer_setup(&client->dev, indio_dev,
-						      NULL,
+		ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL,
 						      data->chip_spec->trig_buffer_func,
 						      data->chip_spec->buffer_setup_ops);
 		if (ret < 0)
@@ -2038,8 +2033,8 @@ static int vcnl4000_probe(struct i2c_client *client)
 	}
 
 	if (client->irq && data->chip_spec->irq_thread) {
-		ret = devm_request_threaded_irq(&client->dev, client->irq,
-						NULL, data->chip_spec->irq_thread,
+		ret = devm_request_threaded_irq(dev, client->irq, NULL,
+						data->chip_spec->irq_thread,
 						IRQF_TRIGGER_FALLING |
 						IRQF_ONESHOT,
 						"vcnl4000_irq",
@@ -2052,7 +2047,7 @@ static int vcnl4000_probe(struct i2c_client *client)
 			return ret;
 	}
 
-	ret = pm_runtime_set_active(&client->dev);
+	ret = pm_runtime_set_active(dev);
 	if (ret < 0)
 		goto fail_poweroff;
 
@@ -2060,9 +2055,9 @@ static int vcnl4000_probe(struct i2c_client *client)
 	if (ret < 0)
 		goto fail_poweroff;
 
-	pm_runtime_enable(&client->dev);
-	pm_runtime_set_autosuspend_delay(&client->dev, VCNL4000_SLEEP_DELAY_MS);
-	pm_runtime_use_autosuspend(&client->dev);
+	pm_runtime_enable(dev);
+	pm_runtime_set_autosuspend_delay(dev, VCNL4000_SLEEP_DELAY_MS);
+	pm_runtime_use_autosuspend(dev);
 
 	return 0;
 fail_poweroff:
Signature · 1 line
2.53.0
#11 lore raw

Re: [PATCH v4 6/7] iio: light: vcnl4000: use variables for I2C client and device instances

Quoted 3 lines · Erikas Bitovtas

After moving data->client and client->dev into variables of their own, replace all instances of data->client and client->dev being used in vcnl4200_init and vcnl4000_probe by the said variables to reduce

vcnl4200_init()
vcnl4000_probe()

Quoted 1 line

clutter.

...

drivers/iio/light/vcnl4000.c static int vcnl4000_probe(struct i2c_client *client) · line 2018

Quoted 4 lines
drivers/iio/light/vcnl4000.c +1 -3
-	if (device_property_read_u32(&client->dev, "proximity-near-level",
-				     &data->near_level))
-		data->near_level = 0;
+	device_property_read_u32(dev, "proximity-near-level", &data->near_level);

I meant to see this change in a separate patch after the current one. This will be associated with a commit message explaining why it's okay because it looks like a potential behaviour change (but actually not).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#12 lore raw

PATCH v4 7/7 iio: light: vcnl4000: add support for regulators

In reply to Erikas Bitovtas

Add supply, I2C and cathode voltage regulators to the sensor and enable them. This keeps the sensor powered on even after its only supply shared by another device shuts down.

---
 drivers/iio/light/vcnl4000.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/iio/light/vcnl4000.c +7 -0
index 0a4d82679cfe..5d1408aca562 100644
@@ -24,6 +24,7 @@
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
+#include <linux/regulator/consumer.h>
 #include <linux/units.h>
 
 #include <linux/iio/buffer.h>
@@ -1985,6 +1986,7 @@ static int vcnl4010_probe_trigger(struct iio_dev *indio_dev)
 static int vcnl4000_probe(struct i2c_client *client)
 {
 	const struct i2c_device_id *id = i2c_client_get_device_id(client);
+	const char * const regulator_names[] = { "vdd", "vddio", "vled" };
 	struct device *dev = &client->dev;
 	struct vcnl4000_data *data;
 	struct iio_dev *indio_dev;
@@ -2000,6 +2002,11 @@ static int vcnl4000_probe(struct i2c_client *client)
 	data->id = id->driver_data;
 	data->chip_spec = &vcnl4000_chip_spec_cfg[data->id];
 
+	ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(regulator_names),
+					     regulator_names);
+	if (ret)
+		return ret;
+
 	ret = devm_mutex_init(dev, &data->vcnl4000_lock);
 	if (ret)
 		return ret;
Signature · 1 line
2.53.0
#13 lore raw

Re: [PATCH v4 7/7] iio: light: vcnl4000: add support for regulators

Quoted 3 lines · Erikas Bitovtas

Add supply, I2C and cathode voltage regulators to the sensor and enable them. This keeps the sensor powered on even after its only supply shared by another device shuts down.

...

drivers/iio/light/vcnl4000.c static int vcnl4000_probe(struct i2c_client *client) · line 2006

Quoted 2 lines
drivers/iio/light/vcnl4000.c +2 -0
+	ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(regulator_names),
+					     regulator_names);

I was suggesting just to fix an indentation in your original approach, but okay, this is not a big deal to have less logical split between lines.

Quoted 2 lines
drivers/iio/light/vcnl4000.c +2 -0
+	if (ret)
+		return ret;
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#14 lore raw
In reply to Erikas Bitovtas
Quoted 7 lines · Erikas Bitovtas

This patch series introduces support for voltage supply, I2C and cathode regulators. This fixes an issue where if a regulator is shared between the proximity sensor and some other device, and the other device is powered off, the proximity sensor would be powered off as well.

One of the commits includes a Reported-by: tag without a Closes: tag - the report was done outside of LKML.

You mean outside of public web access?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#15 lore raw
Quoted 11 lines · Andy Shevchenko
Quoted 7 lines · Erikas Bitovtas

This patch series introduces support for voltage supply, I2C and cathode regulators. This fixes an issue where if a regulator is shared between the proximity sensor and some other device, and the other device is powered off, the proximity sensor would be powered off as well.

One of the commits includes a Reported-by: tag without a Closes: tag - the report was done outside of LKML.

You mean outside of public web access?

The report was done in a Matrix channel. I could provide the link to the report for the Closes: tag, but it requires to sign-in to view it.

#16 lore raw
Quoted 2 lines · Erikas Bitovtas
Quoted 1 line · Andy Shevchenko

On Mon, Mar 16, 2026 at 07:19:44PM +0200, Erikas Bitovtas wrote:

...

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

One of the commits includes a Reported-by: tag without a Closes: tag - the report was done outside of LKML.

You mean outside of public web access?

The report was done in a Matrix channel. I could provide the link to the report for the Closes: tag, but it requires to sign-in to view it.

Okay, thanks for elaboration. In case of a new version, please mention this in the cover letter.

Signature · 2 lines
With Best Regards,
Andy Shevchenko