devicetree-org / dt-schema

Devicetree schema tools
http://www.devicetree.org
BSD 2-Clause "Simplified" License
67 stars 67 forks source link

dtschema: add qcom,board-id to variable sized matrix property list #93

Closed krzk closed 1 year ago

krzk commented 1 year ago

Qualcomm DTS come with:

qcom,board-id = <8 3005>; qcom,board-id = <8 0 16859 23>; qcom,board-id = <8 0 15801 15>, <8 0 15801 16>;

Signed-off-by: Krzysztof Kozlowski krzk@kernel.org

krzk commented 1 year ago

Eh, I was happy too early... this also does not work for my case: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/arm/qcom.yaml#n879

I have no clues how to handle it properly. Generic case is: qcom,board-id = <8 3005>; but certain compatibles have one of:

qcom,board-id = <8 0 16859 23>;
qcom,board-id = <8 0 15801 15>, <8 0 15801 16>;

(or even three tupples) but I got the errors:

/home/krzk/dev/linux/linux/out/arch/arm64/boot/dts/qcom/msm8996-oneplus3.dtb: /: qcom,board-id: [[8, 0, 15801, 15, 8, 0, 15801, 16]] is not valid under any of the given schemas

Failed validating 'oneOf' in schema['properties']['qcom,board-id']:
    {'$ref': '/schemas/types.yaml#/definitions/uint32-matrix',
     'deprecated': True,
     'oneOf': [{'items': [{'maxItems': 2, 'minItems': 2, 'type': 'array'}],
                'maxItems': 1,
                'minItems': 1,
                'type': 'array'},
               {'items': {'items': [{'const': 8}, {'const': 0}, {}, {}],
                          'maxItems': 4,
                          'minItems': 4,
                          'type': 'array'},
                'maxItems': 8,
                'minItems': 1,
                'type': 'array'}]}

On instance['qcom,board-id']:
    [[8, 0, 15801, 15, 8, 0, 15801, 16]]
    From schema: /home/krzk/dev/linux/linux/Documentation/devicetree/bindings/arm/qcom.yaml
/home/krzk/dev/linux/linux/out/arch/arm64/boot/dts/qcom/msm8996-oneplus3.dtb: /: qcom,board-id:0: [8, 0, 15801, 15, 8, 0, 15801, 16] is too long

Failed validating 'maxItems' in schema['allOf'][1]['then']['properties']['qcom,board-id']['items']:
    {'maxItems': 4, 'minItems': 4}

On instance['qcom,board-id'][0]:
    [8, 0, 15801, 15, 8, 0, 15801, 16]
    From schema: /home/krzk/dev/linux/linux/Documentation/devicetree/bindings/arm/qcom.yaml
robherring commented 1 year ago

This should fix it for you: https://github.com/robherring/dt-schema/tree/variable-matrix-fixup

krzk commented 1 year ago

Thanks, yes, this fixes the issue, so the matrix-length checks are gone for such cases.