Re: [PATCH v1 1/3] dt-bindings: iio: adc: convert rockchip saradc bindings to yaml
From: Johan Jonker
Date: Sun Mar 15 2020 - 10:11:58 EST
Hi Jonathan,
For compatible strings with identical fallback we use 'enum' to combine,
so instead of 3 only 1 additional line is needed for each new SoC patch.
properties:
compatible:
oneOf:
- const: rockchip,saradc
- const: rockchip,rk3066-tsadc
- const: rockchip,rk3399-saradc
- items:
- enum:
- rockchip,px30-saradc
- rockchip,rk3308-saradc
- rockchip,rk3328-saradc
- rockchip,rv1108-saradc
- const: rockchip,rk3399-saradc
[..]
vs
[..]
properties:
compatible:
oneOf:
- const: rockchip,saradc
- const: rockchip,rk3066-tsadc
- const: rockchip,rk3399-saradc
- items:
- const: rockchip,px30-saradc
- const: rockchip,rk3399-saradc
- items:
- const: rockchip,rk3308-saradc
- const: rockchip,rk3399-saradc
- items:
- const: rockchip,rk3328-saradc
- const: rockchip,rk3399-saradc
- items:
- const: rockchip,rv1108-saradc
- const: rockchip,rk3399-saradc
Check with:
make ARCH=arm menuconfig
# select Rockchip platform
make -k ARCH=arm64 dt_binding_check
DT_SCHEMA_FILES=Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml
make -k ARCH=arm dtbs_check
DT_SCHEMA_FILES=Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml
make ARCH=arm64 menuconfig
# select Rockchip platform
make -k ARCH=arm64 dtbs_check
DT_SCHEMA_FILES=Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml
Caution with:
'allOf' and 'additionalProperties: false'
does not completely validate DTS or examples!
On 3/15/20 12:22 PM, Jonathan Cameron wrote:
> On Fri, 13 Mar 2020 14:29:24 +0100
> Johan Jonker <jbx6244@xxxxxxxxx> wrote:
>
>> Current dts files with 'saradc' nodes are manually verified.
>> In order to automate this process rockchip-saradc.txt
>> has to be converted to yaml.
>>
>> Signed-off-by: Johan Jonker <jbx6244@xxxxxxxxx>
>
> Hi Johan,
>
> A question inline which may just be my lack of yaml knowledge
> showing itself!
>
> Jonathan
>
>> +properties:
>> + compatible:
>> + oneOf:
>> + - const: rockchip,saradc
>> + - const: rockchip,rk3066-tsadc
>> + - const: rockchip,rk3399-saradc
>> + - items:
>> + - enum:
>> + - rockchip,rk3328-saradc
>> + - rockchip,rv1108-saradc
>> + - const: rockchip,rk3399-saradc
>
> My yaml knowledge isn't great. Why do we have this nested
> structure rather than a straight forward list?
>