dt-bindings: iio: proximity: move LIDAR-Lite out of trivial-devices
Subsystems (2)
PATCH v4 1/1 dt-bindings: iio: proximity: move LIDAR-Lite out of trivial-devices
The PulsedLight LIDAR-Lite v2 is currently described as a trivial device, but it is not one: besides the I2C interface it exposes a power-enable pin and a mode-control pin (the latter also used for the PWM distance output).
Move it to a dedicated binding file. While at it, document the LIDAR-Lite
v3: it is sold by Garmin, which acquired PulsedLight, and is pin-compatible with the v2, so add it with "pulsedlight,lidar-lite-v2" as a fallback compatible.
---
Hi, all,
This was on my plate and I didn't have a chance to send this before.
The vendor change is not a typo: see the discussion at [1]. Tks and regards.
[1] https://lore.kernel.org/all/[email protected]/
Changelog:
v4: unify patches rather than using a series to keep the tree bisectable;
rewrite the commit msg, naming the devices explicitly; v3: https://lore.kernel.org/all/[email protected]/ v2: https://lore.kernel.org/all/[email protected]/ v1: https://lore.kernel.org/all/[email protected]/ --- .../proximity/pulsedlight,lidar-lite-v2.yaml | 54 +++++++++++++++++++ .../devicetree/bindings/trivial-devices.yaml | 2 - 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml
Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml new file +54 -0
@@ -0,0 +1,54 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/proximity/pulsedlight,lidar-lite-v2.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Pulsedlight LIDAR-Lite v2 range-finding sensor + +maintainers: + - Matt Ranostay <[email protected]> + +description: | + Support for LIDAR-Lite v2 and v3 laser rangefinders. These devices + can use a simple I2C communication bus or can operate in a PWM mode using a + mode control pin to trigger acquisitions and return the measured distance. + They also have a power enable pin, which can be used to shut off the device. + +properties: + compatible: + oneOf: + - items: + - enum: + - grmn,lidar-lite-v3 + - const: pulsedlight,lidar-lite-v2 + - const: pulsedlight,lidar-lite-v2 + + reg: + maxItems: 1 + + powerdown-gpios: + description: GPIO that can be driven low to shut off power to the device. + maxItems: 1 + + vdd-supply: true + +required: + - compatible + - reg + - vdd-supply + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + lidar@62 { + compatible = "grmn,lidar-lite-v3", "pulsedlight,lidar-lite-v2"; + reg = <0x62>; + vdd-supply = <&vdd_5v0>; + }; + }; +...
Documentation/devicetree/bindings/trivial-devices.yaml +0 -2
@@ -396,8 +396,6 @@ properties: - onnn,adt7462 # 48-Lane, 12-Port PCI Express Gen 2 (5.0 GT/s) Switch - plx,pex8648 - # Pulsedlight LIDAR range-finding sensor - - pulsedlight,lidar-lite-v2 # Renesas HS3001 Temperature and Relative Humidity Sensors - renesas,hs3001 # Renesas ISL29501 time-of-flight sensor
Signature · 1 line
2.48.1
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] Making `vdd-supply` a strictly required property in the new schema breaks Device Tree validation…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Making vdd-supply a strictly required property in the new schema breaks Device Tree validation for existing valid device trees.
- [Medium] The binding schema omits the previously allowed interrupts property and fails to document the mode-control capabilities, contradicting the commit message and breaking compatibility. --
--- Patch [1]: [PATCH v4] dt-bindings: iio: proximity: move LIDAR-Lite out of trivial-devices --- commit 19408504da4434cc55f5f0ccb25c557b08078221
Author: Rodrigo Gobbi <[email protected]>
dt-bindings: iio: proximity: move LIDAR-Lite out of trivial-devices
The PulsedLight LIDAR-Lite v2 is moved out of trivial-devices into a dedicated binding file. Support for LIDAR-Lite v3 is also documented as a fallback compatible.
Quoted 4 lines
Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml new file +0
-0
[ ... ]
Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml line 39
Quoted 10 lines
Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml new file +10
-0+ powerdown-gpios: + description: GPIO that can be driven low to shut off power to the device. + maxItems: 1 + + vdd-supply: true + +required: + - compatible + - reg + - vdd-supply
[Severity: Medium]
Since the device was previously defined in trivial-devices.yaml, which explicitly disallowed vdd-supply, no existing valid device trees could have included this property. Does making vdd-supply strictly required here introduce a regression by breaking backward compatibility during dt_binding_check for legacy device trees?
Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml
Quoted 2 lines
Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml new file +2
-0+ +additionalProperties: false
[Severity: Medium]
The commit message mentions a mode-control pin used for PWM distance output, but there are no properties defined in the schema to describe it.
Additionally, trivial-devices.yaml previously permitted the interrupts property, but it is omitted from this new schema. Because additionalProperties is false, wouldn't legacy device trees specifying an interrupt fail validation?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
David Lechner
reviewerQuoted 3 lines · Rodrigo Gobbi
The PulsedLight LIDAR-Lite v2 is currently described as a trivial device, but it is not one: besides the I2C interface it exposes a power-enable pin and a mode-control pin (the latter also used for the PWM distance output).
IIRC, we are not adding the mode-control pin to the DT bindings because it would be an alternative to the I2C bus and not likely to be used (would require something like a PWM controller with a non-cyclic, bidirectional channel).
We should explain that in the commit message.
Quoted 2 lines
Move it to a dedicated binding file.
And add we are adding the missing properties, so should mention that too.
Quoted 4 lines
While at it, document the LIDAR-Lite
v3: it is sold by Garmin, which acquired PulsedLight, and is pin-compatible with the v2, so add it with "pulsedlight,lidar-lite-v2" as a fallback compatible.
This is a separate change, so deserves a separate patch.
The complaint in v3 was just that the removing .txt and adding .yaml should be in the same patch.
Quoted 8 lines
Signed-off-by Rodrigo Gobbi <[email protected]>---
Hi, all,
This was on my plate and I didn't have a chance to send this before.The vendor change is not a typo: see the discussion at [1]. Tks and regards.
Ideally, this would be explained well enough in the commit message that we don't need the link.
Quoted 6 lines
[1] https://lore.kernel.org/all/[email protected]/
Changelog:
v4: unify patches rather than using a series to keep the tree bisectable;rewrite the commit msg, naming the devices explicitly;
We lost the IIO driver patch though. The change adding a new compatible won't be accepted without it.
Quoted 15 lines
v3: https://lore.kernel.org/all/[email protected]/
v2: https://lore.kernel.org/all/[email protected]/
v1: https://lore.kernel.org/all/[email protected]/--- .../proximity/pulsedlight,lidar-lite-v2.yaml | 54 +++++++++++++++++++ .../devicetree/bindings/trivial-devices.yaml | 2 - 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yamlDocumentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml new file +0
-0
Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml line 7
Quoted 7 lines
Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml new file +7
-0@@ -0,0 +1,54 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/proximity/pulsedlight,lidar-lite-v2.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Pulsedlight LIDAR-Lite v2 range-finding sensor
Could make the title more general:
Pulsedlight/Garmin LIDAR-Lite range-finding sensors
Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml line 13
Quoted 7 lines
Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml new file +6
-0+ +maintainers: + - Matt Ranostay <[email protected]> + +description: | + Support for LIDAR-Lite v2 and v3 laser rangefinders. These devices
The title already says this.
Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml line 15
Quoted 2 lines
Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml new file +2
-0+ can use a simple I2C communication bus or can operate in a PWM mode using a + mode control pin to trigger acquisitions and return the measured distance.
Probably worth mentioning the bindings are just for I2C usage for now.
Links to datasheets are also useful.
Quoted 1 line
+ They also have a power enable pin, which can be used to shut off the device.
We can see this in the properties, so don't need to say it here.
Quoted 9 lines
Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml new file +9
-0+ +properties: + compatible: + oneOf: + - items: + - enum: + - grmn,lidar-lite-v3 + - const: pulsedlight,lidar-lite-v2 + - const: pulsedlight,lidar-lite-v2
Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml line 35
Quoted 10 lines
Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml new file +10
-0+ + reg: + maxItems: 1 + + powerdown-gpios: + description: GPIO that can be driven low to shut off power to the device. + maxItems: 1 + + vdd-supply: true +
interrupts:
description:
Mode control pin can be used as a status output to provide interrupt.
maxItems: 1
Mode control pin can also be clock output, so we could add:
'#clock-cells':
const: 0
if:
required:
interrupts
then:
'#clock-cells': false
I only checked Lidar Lite v3 docs, so we should see if these are available on v2 as well.
Quoted 32 lines
Documentation/devicetree/bindings/iio/proximity/pulsedlight,lidar-lite-v2.yaml new file +19
-0+required: + - compatible + - reg + - vdd-supply + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + lidar@62 { + compatible = "grmn,lidar-lite-v3", "pulsedlight,lidar-lite-v2"; + reg = <0x62>; + vdd-supply = <&vdd_5v0>; + }; + }; +...Documentation/devicetree/bindings/trivial-devices.yaml +0
-2@@ -396,8 +396,6 @@ properties: - onnn,adt7462 # 48-Lane, 12-Port PCI Express Gen 2 (5.0 GT/s) Switch - plx,pex8648 - # Pulsedlight LIDAR range-finding sensor - - pulsedlight,lidar-lite-v2 # Renesas HS3001 Temperature and Relative Humidity Sensors - renesas,hs3001 # Renesas ISL29501 time-of-flight sensor
Quoted 9 lines
Quoted 6 lines
[1] https://lore.kernel.org/all/[email protected]/
Changelog:
v4: unify patches rather than using a series to keep the tree bisectable;rewrite the commit msg, naming the devices explicitly;We lost the IIO driver patch though. The change adding a new compatible won't be accepted without it.
I think it is fully backwards compatible? If so we don't need to do anything in the driver. We could tweak the name, but perhaps not worth the bother in this case.
Quoted 11 lines · David Lechner
interrupts:
description:
Mode control pin can be used as a status output to provide interrupt.
maxItems: 1Mode control pin can also be clock output, so we could add:
'#clock-cells':
const: 0
Quoted 8 lines
if:
required:
interrupts
then:
'#clock-cells': falseI only checked Lidar Lite v3 docs, so we should see if these are available on v2 as well.
David, quick pushback on the #clock-cells suggestion:
The oscillator-output mode, per the Garmin datasheet, page 8 reg 0x4 from [1], isn't really meant to supply a clock for another device's logic. As I understand it, it exists so the host can measure it against its own reference and compute a compensation factor for the device's own distance readings, since the on-chip oscillator is only rated to ~1% accuracy.
That seems like a different relationship than what #clock-cells models: a provider is expected to report a rate that a consumer just uses to drive its own logic. Here it's the opposite — the rate itself is what's untrustworthy and needs an external measurement, and there's no consumer that would actually want to clock anything off of it.
Given that, maybe it's better to just describe this rather than model it as a clock property, or leave it out of the binding entirely for now until there's an actual consumer for it? My point is more about whether #clock-cells is the right semantics for potential consumers here.
Tks and regards.
[1] https://static.garmin.com/pumac/LIDAR_Lite_v3_Operation_Manual_and_Technical_Specifications.pdf
David Lechner
reviewerQuoted 27 lines · Rodrigo Gobbi
Quoted 11 lines · David Lechner
interrupts:
description:
Mode control pin can be used as a status output to provide interrupt.
maxItems: 1Mode control pin can also be clock output, so we could add:
'#clock-cells':
const: 0Quoted 8 lines
if:
required:
interrupts
then:
'#clock-cells': falseI only checked Lidar Lite v3 docs, so we should see if these are available on v2 as well.
David, quick pushback on the #clock-cells suggestion:
The oscillator-output mode, per the Garmin datasheet, page 8 reg
0x4from [1], isn't really meant to supply a clock for another device's logic. As I understand it, it exists so the host can measure it against its own reference and compute a compensation factor for the device's own distance readings, since the on-chip oscillator is only rated to ~1% accuracy.
Quoted 8 lines
That seems like a different relationship than what #clock-cells models: a provider is expected to report a rate that a consumer just uses to drive its own logic. Here it's the opposite — the rate itself is what's untrustworthy and needs an external measurement, and there's no consumer that would actually want to clock anything off of it.
Given that, maybe it's better to just describe this rather than model it as a clock property, or leave it out of the binding entirely for now until there's an actual consumer for it? My point is more about whether #clock-cells is the right semantics for potential consumers here.
Yes, this sounds like one of those cases where there isn't an obvious correct binding and we should leave it until there is an actual use case to make sure we get it right.
Quoted 4 lines
Tks and regards.
[1] https://static.garmin.com/pumac/LIDAR_Lite_v3_Operation_Manual_and_Technical_Specifications.pdf