Re: [PATCH v9,2/7] dt-bindings: thermal: Add dt-binding document for LVTS thermal controllers

From: Krzysztof Kozlowski
Date: Wed Sep 21 2022 - 02:20:15 EST


On 14/09/2022 14:19, AngeloGioacchino Del Regno wrote:
>
>> +
>> + nvmem-cell-names:
>> + minItems: 1
>> + maxItems: 2
>> + description: Calibration efuse cell names for LVTS
>
> Actually, maxItems is not really two, but it depends on how many
> eFuse arrays / nvmem cells we have for each SoC, so I was thinking...
>
> ...what about doing something like
>
> nvmem-cell-names:
> minItems: 1
> items:
> pattern: 'lvts-calib-data[0-9]+$'
>
> and then,
> if:
> properties:
> compatible:
> contains:
> enum:
> - mediatek,blahblah-something
> then:
> properties:
> nvmem-cell-names:
> maxItems: 2 (or 3, 4, 5...)
>
> P.S.: I haven't tried any binding check on the proposed lines.
>

Should work, but does not enforce the order, so I would rather propose
something longer:

properties:
nvmem-cell-names:
items:
- lvts-calib-data0
- lvts-calib-data1
minItems: 1


and then in allOf:if:then set minItems:2 or maxItems:1




Best regards,
Krzysztof