* [PATCH v3 1/4] dt-bindings: iio: vcnl4000: convert bindings to YAML format
2020-03-25 11:09 [PATCH v3 0/4] iio: vcnl4000: Export near level property for proximity sensor Guido Günther
@ 2020-03-25 11:09 ` Guido Günther
2020-03-31 21:43 ` Rob Herring
2020-03-25 11:09 ` [PATCH v3 2/4] dt-bindings: iio: light: vcnl4000: Add near-level Guido Günther
` (2 subsequent siblings)
3 siblings, 1 reply; 12+ messages in thread
From: Guido Günther @ 2020-03-25 11:09 UTC (permalink / raw)
To: Tomas Novotny, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler,
Angus Ainslie (Purism),
Guido Günther, Marco Felsch, Thomas Gleixner, linux-iio,
linux-kernel, devicetree, Andy Shevchenko, Nishant Malpani
Convert the vcnl4000 device tree bindings to the new YAML format.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
.../bindings/iio/light/vcnl4000.txt | 24 ----------
.../bindings/iio/light/vishay,vcnl4000.yaml | 45 +++++++++++++++++++
2 files changed, 45 insertions(+), 24 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/iio/light/vcnl4000.txt
create mode 100644 Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
diff --git a/Documentation/devicetree/bindings/iio/light/vcnl4000.txt b/Documentation/devicetree/bindings/iio/light/vcnl4000.txt
deleted file mode 100644
index 955af4555c90..000000000000
--- a/Documentation/devicetree/bindings/iio/light/vcnl4000.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-VISHAY VCNL4000 - Ambient Light and proximity sensor
-
-This driver supports the VCNL4000/10/20/40 and VCNL4200 chips
-
-Required properties:
-
- -compatible: must be one of :
- vishay,vcnl4000
- vishay,vcnl4010
- vishay,vcnl4020
- vishay,vcnl4040
- vishay,vcnl4200
-
- -reg: I2C address of the sensor, should be one from below based on the model:
- 0x13
- 0x51
- 0x60
-
-Example:
-
-light-sensor@51 {
- compatible = "vishay,vcnl4200";
- reg = <0x51>;
-};
diff --git a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
new file mode 100644
index 000000000000..21ef2eb7a205
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/light/vishay,vcnl4000.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: VISHAY VCNL4000 ambient light and proximity sensor
+
+maintainers:
+ - Peter Meerwald <pmeerw@pmeerw.net>
+
+description: |
+ Ambient light sensing with proximity detection over an i2c
+ interface.
+
+properties:
+ compatible:
+ enum:
+ - vishay,vcnl4000
+ - vishay,vcnl4010
+ - vishay,vcnl4020
+ - vishay,vcnl4040
+ - vishay,vcnl4200
+
+ reg:
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+
+additionalProperties: false
+
+examples:
+- |
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ light-sensor@51 {
+ compatible = "vishay,vcnl4200";
+ reg = <0x51>;
+ };
+ };
+...
--
2.23.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/4] dt-bindings: iio: vcnl4000: convert bindings to YAML format
2020-03-25 11:09 ` [PATCH v3 1/4] dt-bindings: iio: vcnl4000: convert bindings to YAML format Guido Günther
@ 2020-03-31 21:43 ` Rob Herring
0 siblings, 0 replies; 12+ messages in thread
From: Rob Herring @ 2020-03-31 21:43 UTC (permalink / raw)
To: Guido Günther
Cc: Tomas Novotny, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler,
Angus Ainslie (Purism),
Guido Günther, Marco Felsch, Thomas Gleixner, linux-iio,
linux-kernel, devicetree, Andy Shevchenko, Nishant Malpani
On Wed, 25 Mar 2020 12:09:05 +0100, =?UTF-8?q?Guido=20G=C3=BCnther?= wrote:
> Convert the vcnl4000 device tree bindings to the new YAML format.
>
> Signed-off-by: Guido Günther <agx@sigxcpu.org>
> ---
> .../bindings/iio/light/vcnl4000.txt | 24 ----------
> .../bindings/iio/light/vishay,vcnl4000.yaml | 45 +++++++++++++++++++
> 2 files changed, 45 insertions(+), 24 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/iio/light/vcnl4000.txt
> create mode 100644 Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 2/4] dt-bindings: iio: light: vcnl4000: Add near-level
2020-03-25 11:09 [PATCH v3 0/4] iio: vcnl4000: Export near level property for proximity sensor Guido Günther
2020-03-25 11:09 ` [PATCH v3 1/4] dt-bindings: iio: vcnl4000: convert bindings to YAML format Guido Günther
@ 2020-03-25 11:09 ` Guido Günther
2020-03-29 9:25 ` Jonathan Cameron
2020-03-25 11:09 ` [PATCH v3 3/4] iio: vcnl4000: Export near level property for proximity sensor Guido Günther
2020-03-25 11:09 ` [PATCH v3 4/4] Documentation: ABI: document IIO in_proximity_near_level file Guido Günther
3 siblings, 1 reply; 12+ messages in thread
From: Guido Günther @ 2020-03-25 11:09 UTC (permalink / raw)
To: Tomas Novotny, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler,
Angus Ainslie (Purism),
Guido Günther, Marco Felsch, Thomas Gleixner, linux-iio,
linux-kernel, devicetree, Andy Shevchenko, Nishant Malpani
This value indicates when userspace should consider an object
near to the sensor/device.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
.../devicetree/bindings/iio/light/vishay,vcnl4000.yaml | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
index 21ef2eb7a205..ac9e3bb6a505 100644
--- a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
+++ b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
@@ -25,6 +25,13 @@ properties:
reg:
maxItems: 1
+ near-level:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ Raw proximity values equal or above this level should be
+ considered 'near' to the device (an object is near to the
+ sensor).
+
required:
- compatible
- reg
@@ -40,6 +47,7 @@ examples:
light-sensor@51 {
compatible = "vishay,vcnl4200";
reg = <0x51>;
+ near-level = <220>;
};
};
...
--
2.23.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 2/4] dt-bindings: iio: light: vcnl4000: Add near-level
2020-03-25 11:09 ` [PATCH v3 2/4] dt-bindings: iio: light: vcnl4000: Add near-level Guido Günther
@ 2020-03-29 9:25 ` Jonathan Cameron
2020-03-31 21:45 ` Rob Herring
0 siblings, 1 reply; 12+ messages in thread
From: Jonathan Cameron @ 2020-03-29 9:25 UTC (permalink / raw)
To: Guido Günther
Cc: Tomas Novotny, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, Angus Ainslie (Purism),
Marco Felsch, Thomas Gleixner, linux-iio, linux-kernel,
devicetree, Andy Shevchenko, Nishant Malpani
On Wed, 25 Mar 2020 12:09:06 +0100
Guido Günther <agx@sigxcpu.org> wrote:
> This value indicates when userspace should consider an object
> near to the sensor/device.
>
> Signed-off-by: Guido Günther <agx@sigxcpu.org>
I'm fine with this. Note for Rob or other DT people.
This is a new generic binding hence no vendor prefix.
I will ideally want review of both the dt patches though
before applying. As we've missed the merge window anyway
there is no particular rush.
Thanks,
Jonathan
> ---
> .../devicetree/bindings/iio/light/vishay,vcnl4000.yaml | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
> index 21ef2eb7a205..ac9e3bb6a505 100644
> --- a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
> +++ b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
> @@ -25,6 +25,13 @@ properties:
> reg:
> maxItems: 1
>
> + near-level:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description:
> + Raw proximity values equal or above this level should be
> + considered 'near' to the device (an object is near to the
> + sensor).
> +
> required:
> - compatible
> - reg
> @@ -40,6 +47,7 @@ examples:
> light-sensor@51 {
> compatible = "vishay,vcnl4200";
> reg = <0x51>;
> + near-level = <220>;
> };
> };
> ...
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 2/4] dt-bindings: iio: light: vcnl4000: Add near-level
2020-03-29 9:25 ` Jonathan Cameron
@ 2020-03-31 21:45 ` Rob Herring
2020-04-04 15:01 ` Jonathan Cameron
0 siblings, 1 reply; 12+ messages in thread
From: Rob Herring @ 2020-03-31 21:45 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Guido Günther, Tomas Novotny, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler,
Angus Ainslie (Purism),
Marco Felsch, Thomas Gleixner, linux-iio, linux-kernel,
devicetree, Andy Shevchenko, Nishant Malpani
On Sun, Mar 29, 2020 at 10:25:26AM +0100, Jonathan Cameron wrote:
> On Wed, 25 Mar 2020 12:09:06 +0100
> Guido Günther <agx@sigxcpu.org> wrote:
>
> > This value indicates when userspace should consider an object
> > near to the sensor/device.
> >
> > Signed-off-by: Guido Günther <agx@sigxcpu.org>
>
> I'm fine with this. Note for Rob or other DT people.
>
> This is a new generic binding hence no vendor prefix.
Then document in a common place.
>
> I will ideally want review of both the dt patches though
> before applying. As we've missed the merge window anyway
> there is no particular rush.
>
> Thanks,
>
> Jonathan
>
> > ---
> > .../devicetree/bindings/iio/light/vishay,vcnl4000.yaml | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
> > index 21ef2eb7a205..ac9e3bb6a505 100644
> > --- a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
> > +++ b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
> > @@ -25,6 +25,13 @@ properties:
> > reg:
> > maxItems: 1
> >
> > + near-level:
Perhaps proximity-near-level instead.
> > + $ref: /schemas/types.yaml#/definitions/uint32
> > + description:
> > + Raw proximity values equal or above this level should be
> > + considered 'near' to the device (an object is near to the
> > + sensor).
> > +
> > required:
> > - compatible
> > - reg
> > @@ -40,6 +47,7 @@ examples:
> > light-sensor@51 {
> > compatible = "vishay,vcnl4200";
> > reg = <0x51>;
> > + near-level = <220>;
> > };
> > };
> > ...
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 2/4] dt-bindings: iio: light: vcnl4000: Add near-level
2020-03-31 21:45 ` Rob Herring
@ 2020-04-04 15:01 ` Jonathan Cameron
2020-04-04 17:45 ` Guido Günther
0 siblings, 1 reply; 12+ messages in thread
From: Jonathan Cameron @ 2020-04-04 15:01 UTC (permalink / raw)
To: Rob Herring
Cc: Guido Günther, Tomas Novotny, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler,
Angus Ainslie (Purism),
Marco Felsch, Thomas Gleixner, linux-iio, linux-kernel,
devicetree, Andy Shevchenko, Nishant Malpani
On Tue, 31 Mar 2020 15:45:17 -0600
Rob Herring <robh@kernel.org> wrote:
> On Sun, Mar 29, 2020 at 10:25:26AM +0100, Jonathan Cameron wrote:
> > On Wed, 25 Mar 2020 12:09:06 +0100
> > Guido Günther <agx@sigxcpu.org> wrote:
> >
> > > This value indicates when userspace should consider an object
> > > near to the sensor/device.
> > >
> > > Signed-off-by: Guido Günther <agx@sigxcpu.org>
> >
> > I'm fine with this. Note for Rob or other DT people.
> >
> > This is a new generic binding hence no vendor prefix.
>
> Then document in a common place.
Ok.
I guess we need to create a proximity specific binding file.
Documentation/devicetree/bindings/iio/proximity.yaml
Guido, could you do a v4 adding such a file. For now I think
this is pretty much all that is proximity specific.
At somepoint we should convert the subsystem wide iio-bindings.txt
but not today!
Thanks,
Jonathan
>
> >
> > I will ideally want review of both the dt patches though
> > before applying. As we've missed the merge window anyway
> > there is no particular rush.
> >
> > Thanks,
> >
> > Jonathan
> >
> > > ---
> > > .../devicetree/bindings/iio/light/vishay,vcnl4000.yaml | 8 ++++++++
> > > 1 file changed, 8 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
> > > index 21ef2eb7a205..ac9e3bb6a505 100644
> > > --- a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
> > > +++ b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
> > > @@ -25,6 +25,13 @@ properties:
> > > reg:
> > > maxItems: 1
> > >
> > > + near-level:
>
> Perhaps proximity-near-level instead.
Makes sense.
>
> > > + $ref: /schemas/types.yaml#/definitions/uint32
> > > + description:
> > > + Raw proximity values equal or above this level should be
> > > + considered 'near' to the device (an object is near to the
> > > + sensor).
> > > +
> > > required:
> > > - compatible
> > > - reg
> > > @@ -40,6 +47,7 @@ examples:
> > > light-sensor@51 {
> > > compatible = "vishay,vcnl4200";
> > > reg = <0x51>;
> > > + near-level = <220>;
> > > };
> > > };
> > > ...
> >
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 2/4] dt-bindings: iio: light: vcnl4000: Add near-level
2020-04-04 15:01 ` Jonathan Cameron
@ 2020-04-04 17:45 ` Guido Günther
2020-04-05 9:29 ` Jonathan Cameron
0 siblings, 1 reply; 12+ messages in thread
From: Guido Günther @ 2020-04-04 17:45 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Rob Herring, Tomas Novotny, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, Angus Ainslie (Purism),
Marco Felsch, Thomas Gleixner, linux-iio, linux-kernel,
devicetree, Andy Shevchenko, Nishant Malpani
Hi,
On Sat, Apr 04, 2020 at 04:01:27PM +0100, Jonathan Cameron wrote:
> On Tue, 31 Mar 2020 15:45:17 -0600
> Rob Herring <robh@kernel.org> wrote:
>
> > On Sun, Mar 29, 2020 at 10:25:26AM +0100, Jonathan Cameron wrote:
> > > On Wed, 25 Mar 2020 12:09:06 +0100
> > > Guido Günther <agx@sigxcpu.org> wrote:
> > >
> > > > This value indicates when userspace should consider an object
> > > > near to the sensor/device.
> > > >
> > > > Signed-off-by: Guido Günther <agx@sigxcpu.org>
> > >
> > > I'm fine with this. Note for Rob or other DT people.
> > >
> > > This is a new generic binding hence no vendor prefix.
> >
> > Then document in a common place.
>
> Ok.
>
> I guess we need to create a proximity specific binding file.
>
> Documentation/devicetree/bindings/iio/proximity.yaml
>
> Guido, could you do a v4 adding such a file. For now I think
> this is pretty much all that is proximity specific.
I did a Documentation/devicetree/bindings/iio/common.yaml:
https://source.puri.sm/guido.gunther/linux-imx8/commit/8b91f0b7fa76ca4b2f3cdc251411829f71f8d810
so we can add new properties there and move iio-bindings.txt over.
Does that work as well? If so I'll send out a v4.
Cheers,
-- Guido
>
> At somepoint we should convert the subsystem wide iio-bindings.txt
> but not today!
>
> Thanks,
>
> Jonathan
>
> >
> > >
> > > I will ideally want review of both the dt patches though
> > > before applying. As we've missed the merge window anyway
> > > there is no particular rush.
> > >
> > > Thanks,
> > >
> > > Jonathan
> > >
> > > > ---
> > > > .../devicetree/bindings/iio/light/vishay,vcnl4000.yaml | 8 ++++++++
> > > > 1 file changed, 8 insertions(+)
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
> > > > index 21ef2eb7a205..ac9e3bb6a505 100644
> > > > --- a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
> > > > +++ b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
> > > > @@ -25,6 +25,13 @@ properties:
> > > > reg:
> > > > maxItems: 1
> > > >
> > > > + near-level:
> >
> > Perhaps proximity-near-level instead.
>
> Makes sense.
>
> >
> > > > + $ref: /schemas/types.yaml#/definitions/uint32
> > > > + description:
> > > > + Raw proximity values equal or above this level should be
> > > > + considered 'near' to the device (an object is near to the
> > > > + sensor).
> > > > +
> > > > required:
> > > > - compatible
> > > > - reg
> > > > @@ -40,6 +47,7 @@ examples:
> > > > light-sensor@51 {
> > > > compatible = "vishay,vcnl4200";
> > > > reg = <0x51>;
> > > > + near-level = <220>;
> > > > };
> > > > };
> > > > ...
> > >
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 2/4] dt-bindings: iio: light: vcnl4000: Add near-level
2020-04-04 17:45 ` Guido Günther
@ 2020-04-05 9:29 ` Jonathan Cameron
0 siblings, 0 replies; 12+ messages in thread
From: Jonathan Cameron @ 2020-04-05 9:29 UTC (permalink / raw)
To: Guido Günther
Cc: Rob Herring, Tomas Novotny, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, Angus Ainslie (Purism),
Marco Felsch, Thomas Gleixner, linux-iio, linux-kernel,
devicetree, Andy Shevchenko, Nishant Malpani
On Sat, 4 Apr 2020 19:45:21 +0200
Guido Günther <agx@sigxcpu.org> wrote:
> Hi,
> On Sat, Apr 04, 2020 at 04:01:27PM +0100, Jonathan Cameron wrote:
> > On Tue, 31 Mar 2020 15:45:17 -0600
> > Rob Herring <robh@kernel.org> wrote:
> >
> > > On Sun, Mar 29, 2020 at 10:25:26AM +0100, Jonathan Cameron wrote:
> > > > On Wed, 25 Mar 2020 12:09:06 +0100
> > > > Guido Günther <agx@sigxcpu.org> wrote:
> > > >
> > > > > This value indicates when userspace should consider an object
> > > > > near to the sensor/device.
> > > > >
> > > > > Signed-off-by: Guido Günther <agx@sigxcpu.org>
> > > >
> > > > I'm fine with this. Note for Rob or other DT people.
> > > >
> > > > This is a new generic binding hence no vendor prefix.
> > >
> > > Then document in a common place.
> >
> > Ok.
> >
> > I guess we need to create a proximity specific binding file.
> >
> > Documentation/devicetree/bindings/iio/proximity.yaml
> >
> > Guido, could you do a v4 adding such a file. For now I think
> > this is pretty much all that is proximity specific.
>
> I did a Documentation/devicetree/bindings/iio/common.yaml:
>
> https://source.puri.sm/guido.gunther/linux-imx8/commit/8b91f0b7fa76ca4b2f3cdc251411829f71f8d810
>
> so we can add new properties there and move iio-bindings.txt over.
>
> Does that work as well? If so I'll send out a v4.
I can't find any real precedence for naming of such files.
So I guess this is still evolving. Send it out and we'll see what Rob thinks.
Jonathan
> Cheers,
> -- Guido
>
>
> >
> > At somepoint we should convert the subsystem wide iio-bindings.txt
> > but not today!
> >
> > Thanks,
> >
> > Jonathan
> >
> > >
> > > >
> > > > I will ideally want review of both the dt patches though
> > > > before applying. As we've missed the merge window anyway
> > > > there is no particular rush.
> > > >
> > > > Thanks,
> > > >
> > > > Jonathan
> > > >
> > > > > ---
> > > > > .../devicetree/bindings/iio/light/vishay,vcnl4000.yaml | 8 ++++++++
> > > > > 1 file changed, 8 insertions(+)
> > > > >
> > > > > diff --git a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
> > > > > index 21ef2eb7a205..ac9e3bb6a505 100644
> > > > > --- a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
> > > > > +++ b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
> > > > > @@ -25,6 +25,13 @@ properties:
> > > > > reg:
> > > > > maxItems: 1
> > > > >
> > > > > + near-level:
> > >
> > > Perhaps proximity-near-level instead.
> >
> > Makes sense.
> >
> > >
> > > > > + $ref: /schemas/types.yaml#/definitions/uint32
> > > > > + description:
> > > > > + Raw proximity values equal or above this level should be
> > > > > + considered 'near' to the device (an object is near to the
> > > > > + sensor).
> > > > > +
> > > > > required:
> > > > > - compatible
> > > > > - reg
> > > > > @@ -40,6 +47,7 @@ examples:
> > > > > light-sensor@51 {
> > > > > compatible = "vishay,vcnl4200";
> > > > > reg = <0x51>;
> > > > > + near-level = <220>;
> > > > > };
> > > > > };
> > > > > ...
> > > >
> >
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 3/4] iio: vcnl4000: Export near level property for proximity sensor
2020-03-25 11:09 [PATCH v3 0/4] iio: vcnl4000: Export near level property for proximity sensor Guido Günther
2020-03-25 11:09 ` [PATCH v3 1/4] dt-bindings: iio: vcnl4000: convert bindings to YAML format Guido Günther
2020-03-25 11:09 ` [PATCH v3 2/4] dt-bindings: iio: light: vcnl4000: Add near-level Guido Günther
@ 2020-03-25 11:09 ` Guido Günther
2020-03-25 11:09 ` [PATCH v3 4/4] Documentation: ABI: document IIO in_proximity_near_level file Guido Günther
3 siblings, 0 replies; 12+ messages in thread
From: Guido Günther @ 2020-03-25 11:09 UTC (permalink / raw)
To: Tomas Novotny, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler,
Angus Ainslie (Purism),
Guido Günther, Marco Felsch, Thomas Gleixner, linux-iio,
linux-kernel, devicetree, Andy Shevchenko, Nishant Malpani
When an object can be considered close to the sensor is hardware
dependent. Allowing to configure the property via device tree
allows to configure this device specific value.
This is useful for e.g. iio-sensor-proxy to indicate to userspace
if an object is close to the sensor.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
drivers/iio/light/vcnl4000.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index ec803c1e81df..a4bac101549e 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -83,6 +83,7 @@ struct vcnl4000_data {
struct mutex vcnl4000_lock;
struct vcnl4200_channel vcnl4200_al;
struct vcnl4200_channel vcnl4200_ps;
+ uint32_t near_level;
};
struct vcnl4000_chip_spec {
@@ -343,6 +344,25 @@ static const struct vcnl4000_chip_spec vcnl4000_chip_spec_cfg[] = {
},
};
+static ssize_t vcnl4000_read_near_level(struct iio_dev *indio_dev,
+ uintptr_t priv,
+ const struct iio_chan_spec *chan,
+ char *buf)
+{
+ struct vcnl4000_data *data = iio_priv(indio_dev);
+
+ return sprintf(buf, "%u\n", data->near_level);
+}
+
+static const struct iio_chan_spec_ext_info vcnl4000_ext_info[] = {
+ {
+ .name = "nearlevel",
+ .shared = IIO_SEPARATE,
+ .read = vcnl4000_read_near_level,
+ },
+ { /* sentinel */ }
+};
+
static const struct iio_chan_spec vcnl4000_channels[] = {
{
.type = IIO_LIGHT,
@@ -351,6 +371,7 @@ static const struct iio_chan_spec vcnl4000_channels[] = {
}, {
.type = IIO_PROXIMITY,
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+ .ext_info = vcnl4000_ext_info,
}
};
@@ -440,6 +461,10 @@ static int vcnl4000_probe(struct i2c_client *client,
dev_dbg(&client->dev, "%s Ambient light/proximity sensor, Rev: %02x\n",
data->chip_spec->prod, data->rev);
+ if (device_property_read_u32(&client->dev, "near-level",
+ &data->near_level))
+ data->near_level = 0;
+
indio_dev->dev.parent = &client->dev;
indio_dev->info = &vcnl4000_info;
indio_dev->channels = vcnl4000_channels;
--
2.23.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 4/4] Documentation: ABI: document IIO in_proximity_near_level file
2020-03-25 11:09 [PATCH v3 0/4] iio: vcnl4000: Export near level property for proximity sensor Guido Günther
` (2 preceding siblings ...)
2020-03-25 11:09 ` [PATCH v3 3/4] iio: vcnl4000: Export near level property for proximity sensor Guido Günther
@ 2020-03-25 11:09 ` Guido Günther
2020-03-29 9:27 ` Jonathan Cameron
3 siblings, 1 reply; 12+ messages in thread
From: Guido Günther @ 2020-03-25 11:09 UTC (permalink / raw)
To: Tomas Novotny, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler,
Angus Ainslie (Purism),
Guido Günther, Marco Felsch, Thomas Gleixner, linux-iio,
linux-kernel, devicetree, Andy Shevchenko, Nishant Malpani
The vcnl4000 IIO driver introduced a new attribute
"in_proximity_near_level". This adds it to the list of documented ABI
for sysfs-bus-iio.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
Documentation/ABI/testing/sysfs-bus-iio-proximity | 10 ++++++++++
1 file changed, 10 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-proximity
diff --git a/Documentation/ABI/testing/sysfs-bus-iio-proximity b/Documentation/ABI/testing/sysfs-bus-iio-proximity
new file mode 100644
index 000000000000..2172f3bb9c64
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-iio-proximity
@@ -0,0 +1,10 @@
+What: /sys/bus/iio/devices/iio:deviceX/in_proximity_nearlevel
+Date: March 2020
+KernelVersion: 5.7
+Contact: linux-iio@vger.kernel.org
+Description:
+ Near level for proximity sensors. This is a single integer
+ value that tells user space when an object should be
+ considered close to the device. If the value read from the
+ sensor is above or equal to the value in this file an object
+ should typically be considered near.
--
2.23.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 4/4] Documentation: ABI: document IIO in_proximity_near_level file
2020-03-25 11:09 ` [PATCH v3 4/4] Documentation: ABI: document IIO in_proximity_near_level file Guido Günther
@ 2020-03-29 9:27 ` Jonathan Cameron
0 siblings, 0 replies; 12+ messages in thread
From: Jonathan Cameron @ 2020-03-29 9:27 UTC (permalink / raw)
To: Guido Günther
Cc: Tomas Novotny, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, Angus Ainslie (Purism),
Marco Felsch, Thomas Gleixner, linux-iio, linux-kernel,
devicetree, Andy Shevchenko, Nishant Malpani
On Wed, 25 Mar 2020 12:09:08 +0100
Guido Günther <agx@sigxcpu.org> wrote:
> The vcnl4000 IIO driver introduced a new attribute
> "in_proximity_near_level". This adds it to the list of documented ABI
> for sysfs-bus-iio.
Description and patch title are now wrong due to dropping the _
I can fix that up whilst applying if nothing else comes up.
The rest of the series looks good to me, just giving time
for others to comment before taking this.
Thanks,
Jonathan
>
> Signed-off-by: Guido Günther <agx@sigxcpu.org>
> ---
> Documentation/ABI/testing/sysfs-bus-iio-proximity | 10 ++++++++++
> 1 file changed, 10 insertions(+)
> create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-proximity
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-iio-proximity b/Documentation/ABI/testing/sysfs-bus-iio-proximity
> new file mode 100644
> index 000000000000..2172f3bb9c64
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-bus-iio-proximity
> @@ -0,0 +1,10 @@
> +What: /sys/bus/iio/devices/iio:deviceX/in_proximity_nearlevel
> +Date: March 2020
> +KernelVersion: 5.7
> +Contact: linux-iio@vger.kernel.org
> +Description:
> + Near level for proximity sensors. This is a single integer
> + value that tells user space when an object should be
> + considered close to the device. If the value read from the
> + sensor is above or equal to the value in this file an object
> + should typically be considered near.
^ permalink raw reply [flat|nested] 12+ messages in thread