Devicetree
 help / color / mirror / Atom feed
* [PATCH 0/2] iio: light: vcnl4000: add regulator support
@ 2026-03-11 11:38 Erikas Bitovtas
  2026-03-11 11:38 ` [PATCH 1/2] dt-bindings: iio: light: vcnl4000: add regulators Erikas Bitovtas
  2026-03-11 11:38 ` [PATCH 2/2] iio: light: vcnl4000: add regulator support Erikas Bitovtas
  0 siblings, 2 replies; 7+ messages in thread
From: Erikas Bitovtas @ 2026-03-11 11:38 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Meerwald
  Cc: linux-iio, devicetree, linux-kernel, ~postmarketos/upstreaming,
	phone-devel, Erikas Bitovtas, Raymond Hackley

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.

Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
---
Erikas Bitovtas (2):
      dt-bindings: iio: light: vcnl4000: add regulators
      iio: light: vcnl4000: add regulator support

 Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml | 7 +++++++
 drivers/iio/light/vcnl4000.c                                     | 8 ++++++++
 2 files changed, 15 insertions(+)
---
base-commit: 7109a2155340cc7b21f27e832ece6df03592f2e8
change-id: 20260310-vcnl4000-regulators-bcf1b8a01ce6

Best regards,
-- 
Erikas Bitovtas <xerikasxx@gmail.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] dt-bindings: iio: light: vcnl4000: add regulators
  2026-03-11 11:38 [PATCH 0/2] iio: light: vcnl4000: add regulator support Erikas Bitovtas
@ 2026-03-11 11:38 ` Erikas Bitovtas
  2026-03-11 11:38 ` [PATCH 2/2] iio: light: vcnl4000: add regulator support Erikas Bitovtas
  1 sibling, 0 replies; 7+ messages in thread
From: Erikas Bitovtas @ 2026-03-11 11:38 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Meerwald
  Cc: linux-iio, devicetree, linux-kernel, ~postmarketos/upstreaming,
	phone-devel, Erikas Bitovtas

This commit adds regulator properties for vcnl4000 ambient light and
proximity sensors.

Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
---
 Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
index 2ba4d5de4ec4..a1b4c02db246 100644
--- a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
+++ b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
@@ -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>;
         };
     };
 ...

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] iio: light: vcnl4000: add regulator support
  2026-03-11 11:38 [PATCH 0/2] iio: light: vcnl4000: add regulator support Erikas Bitovtas
  2026-03-11 11:38 ` [PATCH 1/2] dt-bindings: iio: light: vcnl4000: add regulators Erikas Bitovtas
@ 2026-03-11 11:38 ` Erikas Bitovtas
  2026-03-11 12:22   ` Andy Shevchenko
  1 sibling, 1 reply; 7+ messages in thread
From: Erikas Bitovtas @ 2026-03-11 11:38 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Meerwald
  Cc: linux-iio, devicetree, linux-kernel, ~postmarketos/upstreaming,
	phone-devel, Erikas Bitovtas, Raymond Hackley

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.

Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
Reported-by: Raymond Hackley <raymondhackley@protonmail.com>
---
 drivers/iio/light/vcnl4000.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index 5e03c3d8874b..967589d5f246 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -17,6 +17,8 @@
  *   interrupts (VCNL4040, VCNL4200)
  */
 
+#include "linux/array_size.h"
+#include "linux/regulator/consumer.h"
 #include <linux/bitfield.h>
 #include <linux/module.h>
 #include <linux/i2c.h>
@@ -1983,6 +1985,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 vcnl4000_data *data;
 	struct iio_dev *indio_dev;
 	int ret;
@@ -1998,6 +2001,11 @@ static int vcnl4000_probe(struct i2c_client *client)
 	data->chip_spec = &vcnl4000_chip_spec_cfg[data->id];
 
 	mutex_init(&data->vcnl4000_lock);
+	ret = devm_regulator_bulk_get_enable(&client->dev,
+				      ARRAY_SIZE(regulator_names),
+				      regulator_names);
+	if (ret < 0)
+		return ret;
 
 	ret = data->chip_spec->init(data);
 	if (ret < 0)

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] iio: light: vcnl4000: add regulator support
  2026-03-11 11:38 ` [PATCH 2/2] iio: light: vcnl4000: add regulator support Erikas Bitovtas
@ 2026-03-11 12:22   ` Andy Shevchenko
  2026-03-11 12:40     ` Erikas Bitovtas
  2026-03-15 18:16     ` Jonathan Cameron
  0 siblings, 2 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-03-11 12:22 UTC (permalink / raw)
  To: Erikas Bitovtas
  Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Meerwald,
	linux-iio, devicetree, linux-kernel, ~postmarketos/upstreaming,
	phone-devel, Raymond Hackley

On Wed, Mar 11, 2026 at 01:38:03PM +0200, Erikas Bitovtas wrote:
> 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.

> Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
> Reported-by: Raymond Hackley <raymondhackley@protonmail.com>

Where was it reported? Do you need Closes tag?

...

> +#include "linux/array_size.h"
> +#include "linux/regulator/consumer.h"

Double quotes, huh?!

>  #include <linux/bitfield.h>
>  #include <linux/module.h>
>  #include <linux/i2c.h>

Also, please keep the list ordered.

...

>  	mutex_init(&data->vcnl4000_lock);
> +	ret = devm_regulator_bulk_get_enable(&client->dev,
> +				      ARRAY_SIZE(regulator_names),
> +				      regulator_names);
> +	if (ret < 0)
> +		return ret;

You can't add devm_ after non-devm calls.
Also it would help you to have

	struct device *dev = &client->dev;

at the top of the function.

...

With the above being said, I expect a series out of two patches at least.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] iio: light: vcnl4000: add regulator support
  2026-03-11 12:22   ` Andy Shevchenko
@ 2026-03-11 12:40     ` Erikas Bitovtas
  2026-03-11 15:54       ` Andy Shevchenko
  2026-03-15 18:16     ` Jonathan Cameron
  1 sibling, 1 reply; 7+ messages in thread
From: Erikas Bitovtas @ 2026-03-11 12:40 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Meerwald,
	linux-iio, devicetree, linux-kernel, ~postmarketos/upstreaming,
	phone-devel, Raymond Hackley



On 3/11/26 2:22 PM, Andy Shevchenko wrote:
> On Wed, Mar 11, 2026 at 01:38:03PM +0200, Erikas Bitovtas wrote:
>> 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.
> 
>> Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
>> Reported-by: Raymond Hackley <raymondhackley@protonmail.com>
> 
> Where was it reported? Do you need Closes tag?
> 
> ...
The report was done outside of LKML, in a Matrix channel.

Respectfully,
Erikas Bitovtas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] iio: light: vcnl4000: add regulator support
  2026-03-11 12:40     ` Erikas Bitovtas
@ 2026-03-11 15:54       ` Andy Shevchenko
  0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-03-11 15:54 UTC (permalink / raw)
  To: Erikas Bitovtas
  Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Meerwald,
	linux-iio, devicetree, linux-kernel, ~postmarketos/upstreaming,
	phone-devel, Raymond Hackley

On Wed, Mar 11, 2026 at 02:40:00PM +0200, Erikas Bitovtas wrote:
> On 3/11/26 2:22 PM, Andy Shevchenko wrote:
> > On Wed, Mar 11, 2026 at 01:38:03PM +0200, Erikas Bitovtas wrote:
> >> 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.
> > 
> >> Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
> >> Reported-by: Raymond Hackley <raymondhackley@protonmail.com>
> > 
> > Where was it reported? Do you need Closes tag?

> The report was done outside of LKML, in a Matrix channel.

Good, next time don't forget to add this type of information in the comments
block, so we will know why Closes is not accompanied with the Reported-by.
But if that channel has web-available archives, it will be good to have a link
to it in the Closes tag.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] iio: light: vcnl4000: add regulator support
  2026-03-11 12:22   ` Andy Shevchenko
  2026-03-11 12:40     ` Erikas Bitovtas
@ 2026-03-15 18:16     ` Jonathan Cameron
  1 sibling, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2026-03-15 18:16 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Erikas Bitovtas, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Meerwald,
	linux-iio, devicetree, linux-kernel, ~postmarketos/upstreaming,
	phone-devel, Raymond Hackley

On Wed, 11 Mar 2026 14:22:36 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Wed, Mar 11, 2026 at 01:38:03PM +0200, Erikas Bitovtas wrote:
> > 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.  
> 
> > Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
> > Reported-by: Raymond Hackley <raymondhackley@protonmail.com>  
> 
> Where was it reported? Do you need Closes tag?
> 
> ...
> 
> > +#include "linux/array_size.h"
> > +#include "linux/regulator/consumer.h"  
> 
> Double quotes, huh?!
> 
> >  #include <linux/bitfield.h>
> >  #include <linux/module.h>
> >  #include <linux/i2c.h>  
> 
> Also, please keep the list ordered.
> 
> ...
> 
> >  	mutex_init(&data->vcnl4000_lock);
> > +	ret = devm_regulator_bulk_get_enable(&client->dev,
> > +				      ARRAY_SIZE(regulator_names),
> > +				      regulator_names);
> > +	if (ret < 0)
> > +		return ret;  
> 
> You can't add devm_ after non-devm calls.

This one happens to be fine because there is no cleanup of the
mutex_init(), so it is sort of not mixing devm and non devm.
That is kind of a historical thing where I for one wasn't convinced
it was worth the annoyance of mutex_destroy() until the devm
easy way of doing it came along.

Now, as the code is being touched anyway, I would
like that moved to
ret = devm_mutex_init();
if (ret)
	return ret;
as a precursor patch both as it makes it obvious we are still devm and
to get the advantage when lock debugging is turned on.

Thanks

Jonathan

> Also it would help you to have
> 
> 	struct device *dev = &client->dev;
> 
> at the top of the function.
> 
> ...
> 
> With the above being said, I expect a series out of two patches at least.
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-15 18:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-11 11:38 [PATCH 0/2] iio: light: vcnl4000: add regulator support Erikas Bitovtas
2026-03-11 11:38 ` [PATCH 1/2] dt-bindings: iio: light: vcnl4000: add regulators Erikas Bitovtas
2026-03-11 11:38 ` [PATCH 2/2] iio: light: vcnl4000: add regulator support Erikas Bitovtas
2026-03-11 12:22   ` Andy Shevchenko
2026-03-11 12:40     ` Erikas Bitovtas
2026-03-11 15:54       ` Andy Shevchenko
2026-03-15 18:16     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox