dt-bindings: misc: convert lis302.txt to YAML
Subsystems (2)
PATCH v5 1/1 dt-bindings: misc: convert lis302.txt to YAML
Replace the old lis302.txt with a YAML binding covering all four compatibles (st,lis3lv02d, st,lis302dl-spi, st,lis331dlh, st,lis33de) and their ~35 DT properties.
The old txt documented st,click-thresh-* and st,click-click-time-limit but the code reads st,click-threshold-* and st,click-time-limit. Keep the old names as deprecated so existing DTBs don't break.
Tested: dt_binding_check. dtbs_check against 7 omap/am335x DTBs (am335x-evm, am335x-evmsk, am335x-pepper, am437x-sk-evm, omap3-n900, omap3-n950, omap3-gta04a3) — no misc schema errors. Pre-existing IIO schema errors on paired compatible nodes unchanged.
---
v5:
- Remove Vdd-supply/Vdd_IO-supply: false from SPI branch (hardware needs power regardless of bus)
- Split if/then into two branches: SPI requires spi-max-frequency + interrupts, I2C requires Vdd-supply + Vdd_IO-supply (both optional on the other bus)
v4:
- Drop explicit select block (redundant)
- Fix commit message: select does not prevent IIO validation
v3:
- Add st,lis3lv02d to select block
- Drop Patch 2 entirely, single patch, no IIO changes
v2:
- Rebase onto Linux 7.1-rc6, drop IIO changes
.../devicetree/bindings/iio/accel/lis302.txt | 119 ------ .../bindings/misc/st,lis3lv02d.yaml | 400 ++++++++++++++++++ MAINTAINERS | 1 + 3 files changed, 401 insertions(+), 119 deletions(-) delete mode 100644 Documentation/devicetree/bindings/iio/accel/lis302.txt create mode 100644 Documentation/devicetree/bindings/misc/st,lis3lv02d.yaml
Documentation/devicetree/bindings/iio/accel/lis302.txt deleted +0 -119
@@ -1,119 +0,0 @@ -LIS302 accelerometer devicetree bindings - -This device is matched via its bus drivers, and has a number of properties -that apply in on the generic device (independent from the bus). - - -Required properties for the SPI bindings: - - compatible: should be set to "st,lis3lv02d-spi" - - reg: the chipselect index - - spi-max-frequency: maximal bus speed, should be set to 1000000 unless - constrained by external circuitry - - interrupts: the interrupt generated by the device - -Required properties for the I2C bindings: - - compatible: should be set to "st,lis3lv02d" - - reg: i2c slave address - - Vdd-supply: The input supply for Vdd - - Vdd_IO-supply: The input supply for Vdd_IO - - -Optional properties for all bus drivers: - - - st,click-single-{x,y,z}: if present, tells the device to issue an - interrupt on single click events on the - x/y/z axis. - - st,click-double-{x,y,z}: if present, tells the device to issue an - interrupt on double click events on the - x/y/z axis. - - st,click-thresh-{x,y,z}: set the x/y/z axis threshold - - st,click-click-time-limit: click time limit, from 0 to 127.5msec - with step of 0.5 msec - - st,click-latency: click latency, from 0 to 255 msec with - step of 1 msec. - - st,click-window: click window, from 0 to 255 msec with - step of 1 msec. - - st,irq{1,2}-disable: disable IRQ 1/2 - - st,irq{1,2}-ff-wu-1: raise IRQ 1/2 on FF_WU_1 condition - - st,irq{1,2}-ff-wu-2: raise IRQ 1/2 on FF_WU_2 condition - - st,irq{1,2}-data-ready: raise IRQ 1/2 on data ready condition - - st,irq{1,2}-click: raise IRQ 1/2 on click condition - - st,irq-open-drain: consider IRQ lines open-drain - - st,irq-active-low: make IRQ lines active low - - st,wu-duration-1: duration register for Free-Fall/Wake-Up - interrupt 1 - - st,wu-duration-2: duration register for Free-Fall/Wake-Up - interrupt 2 - - st,wakeup-{x,y,z}-{lo,hi}: set wakeup condition on x/y/z axis for - upper/lower limit - - st,wakeup-threshold: set wakeup threshold - - st,wakeup2-{x,y,z}-{lo,hi}: set wakeup condition on x/y/z axis for - upper/lower limit for second wakeup - engine. - - st,wakeup2-threshold: set wakeup threshold for second wakeup - engine. - - st,highpass-cutoff-hz=: 1, 2, 4 or 8 for 1Hz, 2Hz, 4Hz or 8Hz of - highpass cut-off frequency - - st,hipass{1,2}-disable: disable highpass 1/2. - - st,default-rate=: set the default rate - - st,axis-{x,y,z}=: set the axis to map to the three coordinates. - Negative values can be used for inverted axis. - - st,{min,max}-limit-{x,y,z} set the min/max limits for x/y/z axis - (used by self-test) - - -Example for a SPI device node: - - accelerometer@0 { - compatible = "st,lis302dl-spi"; - reg = <0>; - spi-max-frequency = <1000000>; - interrupt-parent = <&gpio>; - interrupts = <104 0>; - - st,click-single-x; - st,click-single-y; - st,click-single-z; - st,click-thresh-x = <10>; - st,click-thresh-y = <10>; - st,click-thresh-z = <10>; - st,irq1-click; - st,irq2-click; - st,wakeup-x-lo; - st,wakeup-x-hi; - st,wakeup-y-lo; - st,wakeup-y-hi; - st,wakeup-z-lo; - st,wakeup-z-hi; - }; - -Example for a I2C device node: - - lis331dlh: accelerometer@18 { - compatible = "st,lis331dlh", "st,lis3lv02d"; - reg = <0x18>; - Vdd-supply = <&lis3_reg>; - Vdd_IO-supply = <&lis3_reg>; - - st,click-single-x; - st,click-single-y; - st,click-single-z; - st,click-thresh-x = <10>; - st,click-thresh-y = <10>; - st,click-thresh-z = <10>; - st,irq1-click; - st,irq2-click; - st,wakeup-x-lo; - st,wakeup-x-hi; - st,wakeup-y-lo; - st,wakeup-y-hi; - st,wakeup-z-lo; - st,wakeup-z-hi; - st,min-limit-x = <120>; - st,min-limit-y = <120>; - st,min-limit-z = <140>; - st,max-limit-x = <550>; - st,max-limit-y = <550>; - st,max-limit-z = <750>; - }; -
Documentation/devicetree/bindings/misc/st,lis3lv02d.yaml new file +400 -0
400 lines not on this page · raw message
MAINTAINERS +1 -0
@@ -14858,6 +14858,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/ LIS3LV02D ACCELEROMETER DRIVER M: Eric Piel <[email protected]> S: Maintained +F: Documentation/devicetree/bindings/misc/st,lis3lv02d.yaml F: Documentation/misc-devices/lis3lv02d.rst F: drivers/misc/lis3lv02d/ F: drivers/platform/x86/hp/hp_accel.c
Signature · 1 line
2.54.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The YAML schema incorrectly forbids the `Vdd-supply` and `Vdd_IO-supply` properties for the SPI…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The YAML schema incorrectly forbids the Vdd-supply and Vdd_IO-supply properties for the SPI variant and contains a redundant select block. --
commit 124e32c58b0e195eb97adbc2880712f6df5eb1b2
Author: Jad Keskes <[email protected]>
dt-bindings: misc: convert lis302.txt to YAML
This commit converts the old lis302.txt dt-binding to YAML format, supporting the st,lis3lv02d, st,lis302dl-spi, st,lis331dlh, and st,lis33de compatibles. It retains old property names as deprecated to maintain backward compatibility with existing device trees.
Quoted 5 lines
Documentation/devicetree/bindings/misc/st,lis3lv02d.yaml new file +0
-0
[ ... ]
Quoted 20 lines
Documentation/devicetree/bindings/misc/st,lis3lv02d.yaml new file +20
-0+description: + This binding describes the STMicroelectronics accelerometers supported by + the misc/lis3lv02d driver. This driver provides input (joystick) and + hardware monitoring support, in contrast to the IIO st-accel driver which + also supports some of these devices. + Refer to Documentation/devicetree/bindings/iio/st,st-sensors.yaml for the + IIO binding. + +select: + anyOf: + - properties: + compatible: + contains: + const: st,lis302dl-spi + - properties: + compatible: + contains: + const: st,lis331dlh + - properties: + compatible:
Documentation/devicetree/bindings/misc/st,lis3lv02d.yaml line 41
Quoted 10 lines
Documentation/devicetree/bindings/misc/st,lis3lv02d.yaml new file +10
-0+ contains: + const: st,lis33de + - properties: + compatible: + contains: + const: st,lis3lv02d + required: + - compatible + +properties:
[Severity: Medium]
Is this explicit select block necessary? The dt-schema tooling automatically selects bindings based on the top-level compatible property definition, making this manual select block redundant.
[ ... ]
Quoted 5 lines
Documentation/devicetree/bindings/misc/st,lis3lv02d.yaml new file +5
-0+allOf: + - if: + properties: + compatible: + not:
Documentation/devicetree/bindings/misc/st,lis3lv02d.yaml line 325
Quoted 10 lines
Documentation/devicetree/bindings/misc/st,lis3lv02d.yaml new file +10
-0+ contains: + const: st,lis302dl-spi + then: + required: + - Vdd-supply + - Vdd_IO-supply + else: + properties: + Vdd-supply: false + Vdd_IO-supply: false
[Severity: Medium]
Does setting these properties to false incorrectly enforce a hardware abstraction violation? The physical chip requires power to operate regardless of whether it uses the SPI bus or I2C. Device tree bindings should describe the hardware, not the current limitations of the driver code.
Quoted 5 lines
Documentation/devicetree/bindings/misc/st,lis3lv02d.yaml new file +5
-0+ required: + - spi-max-frequency + - interrupts + +required:
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 10 lines · Jad Keskes
Replace the old lis302.txt with a YAML binding covering all four compatibles (st,lis3lv02d, st,lis302dl-spi, st,lis331dlh, st,lis33de) and their ~35 DT properties.
The old txt documented st,click-thresh-* and st,click-click-time-limit but the code reads st,click-threshold-* and st,click-time-limit. Keep the old names as deprecated so existing DTBs don't break.
Tested:
dt_binding_check.dtbs_checkagainst 7 omap/am335x DTBs (am335x-evm, am335x-evmsk, am335x-pepper, am437x-sk-evm, omap3-n900,
How can you test binding on a device? This is not possible.
Quoted 5 lines
omap3-n950, omap3-gta04a3) — no misc schema errors. Pre-existing IIO schema errors on paired compatible nodes unchanged.
Signed-off-by Jad Keskes <[email protected]>---
Slow down. You sent five versions within one hour. You did not even wait for any feedback, so what is the point?
This is already being done by other people.
https://lore.kernel.org/all/?q=dfn%3Alis302
Best regards,
Krzysztof