diff mbox series

[3/6] dt-bindings: opp: Add compatible for H616

Message ID 20230904-cpufreq-h616-v1-3-b8842e525c43@somainline.org (mailing list archive)
State New
Delegated to: viresh kumar
Headers show
Series cpufreq for H616 | expand

Commit Message

Martin Botka Sept. 4, 2023, 3:57 p.m. UTC
We need to add compatible for H616 to H6 cpufreq driver bindings.

Also enable opp_supported_hw property that will be needed for H616.

Signed-off-by: Martin Botka <martin.botka@somainline.org>
---
 .../bindings/opp/allwinner,sun50i-h6-operating-points.yaml          | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Krzysztof Kozlowski Sept. 4, 2023, 7:31 p.m. UTC | #1
On 04/09/2023 17:57, Martin Botka wrote:
> We need to add compatible for H616 to H6 cpufreq driver bindings.

Please describe the hardware, not what is needed for drivers.

> 
> Also enable opp_supported_hw property that will be needed for H616.
> 
> Signed-off-by: Martin Botka <martin.botka@somainline.org>
> ---
>  .../bindings/opp/allwinner,sun50i-h6-operating-points.yaml          | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
> index 51f62c3ae194..2fa1199f2d23 100644
> --- a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
> +++ b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
> @@ -23,7 +23,10 @@ allOf:
>  
>  properties:
>    compatible:
> -    const: allwinner,sun50i-h6-operating-points
> +    contains:

This does not look like part of allOf, so contains is no correct here.
This must be specific, so drop contains.

> +      enum:
> +        - allwinner,sun50i-h6-operating-points
> +        - allwinner,sun50i-h616-operating-points
>  
>    nvmem-cells:
>      description: |
> @@ -47,6 +50,7 @@ patternProperties:
>      properties:
>        opp-hz: true
>        clock-latency-ns: true
> +      opp-supported-hw: true

Why? It is already allowed. You should rather explain the values.

> 

Best regards,
Krzysztof
Krzysztof Kozlowski Sept. 4, 2023, 7:32 p.m. UTC | #2
On 04/09/2023 21:31, Krzysztof Kozlowski wrote:
> On 04/09/2023 17:57, Martin Botka wrote:
>> We need to add compatible for H616 to H6 cpufreq driver bindings.
> 
> Please describe the hardware, not what is needed for drivers.
> 
>>
>> Also enable opp_supported_hw property that will be needed for H616.
>>
>> Signed-off-by: Martin Botka <martin.botka@somainline.org>
>> ---
>>  .../bindings/opp/allwinner,sun50i-h6-operating-points.yaml          | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>> index 51f62c3ae194..2fa1199f2d23 100644
>> --- a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>> +++ b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>> @@ -23,7 +23,10 @@ allOf:
>>  
>>  properties:
>>    compatible:
>> -    const: allwinner,sun50i-h6-operating-points
>> +    contains:
> 
> This does not look like part of allOf, so contains is no correct here.
> This must be specific, so drop contains.

BTW, I also do no see it used by the driver at all.

Best regards,
Krzysztof
Martin Botka Sept. 4, 2023, 7:48 p.m. UTC | #3
On Mon, Sep 4 2023 at 09:32:44 PM +02:00:00, Krzysztof Kozlowski 
<krzysztof.kozlowski@linaro.org> wrote:
> On 04/09/2023 21:31, Krzysztof Kozlowski wrote:
>>  On 04/09/2023 17:57, Martin Botka wrote:
>>>  We need to add compatible for H616 to H6 cpufreq driver bindings.
>> 
>>  Please describe the hardware, not what is needed for drivers.
>> 
>>> 
>>>  Also enable opp_supported_hw property that will be needed for H616.
>>> 
>>>  Signed-off-by: Martin Botka <martin.botka@somainline.org>
>>>  ---
>>>   .../bindings/opp/allwinner,sun50i-h6-operating-points.yaml        
>>>   | 6 +++++-
>>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>> 
>>>  diff --git 
>>> a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml 
>>> b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>>  index 51f62c3ae194..2fa1199f2d23 100644
>>>  --- 
>>> a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>>  +++ 
>>> b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>>  @@ -23,7 +23,10 @@ allOf:
>>> 
>>>   properties:
>>>     compatible:
>>>  -    const: allwinner,sun50i-h6-operating-points
>>>  +    contains:
>> 
>>  This does not look like part of allOf, so contains is no correct 
>> here.
>>  This must be specific, so drop contains.
> 
> BTW, I also do no see it used by the driver at all.
Function sun50i_cpufreq_get_efuse uses it. It checks for H6 compatible 
and if that fails we check for H616 compatible.
Also im double checking for H6. Nice screwup on my side :)

Cheers,
Martin
> 
> Best regards,
> Krzysztof
>
Martin Botka Sept. 4, 2023, 7:52 p.m. UTC | #4
On Mon, Sep 4 2023 at 09:31:34 PM +02:00:00, Krzysztof Kozlowski 
<krzysztof.kozlowski@linaro.org> wrote:
> On 04/09/2023 17:57, Martin Botka wrote:
>>  We need to add compatible for H616 to H6 cpufreq driver bindings.
> 
> Please describe the hardware, not what is needed for drivers.
Got it. Sorry.
> 
>> 
>>  Also enable opp_supported_hw property that will be needed for H616.
>> 
>>  Signed-off-by: Martin Botka <martin.botka@somainline.org>
>>  ---
>>   .../bindings/opp/allwinner,sun50i-h6-operating-points.yaml         
>>  | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>> 
>>  diff --git 
>> a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml 
>> b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>  index 51f62c3ae194..2fa1199f2d23 100644
>>  --- 
>> a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>  +++ 
>> b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>  @@ -23,7 +23,10 @@ allOf:
>> 
>>   properties:
>>     compatible:
>>  -    const: allwinner,sun50i-h6-operating-points
>>  +    contains:
> 
> This does not look like part of allOf, so contains is no correct here.
> This must be specific, so drop contains.
ack.
> 
>>  +      enum:
>>  +        - allwinner,sun50i-h6-operating-points
>>  +        - allwinner,sun50i-h616-operating-points
>> 
>>     nvmem-cells:
>>       description: |
>>  @@ -47,6 +50,7 @@ patternProperties:
>>       properties:
>>         opp-hz: true
>>         clock-latency-ns: true
>>  +      opp-supported-hw: true
> 
> Why? It is already allowed. You should rather explain the values.
Yea this can be dropped. I forgot to remove it. My bad.
Also the values i think are very clear ? The values converted to binary 
represent which chip revision is allowed to use the specified frequency.
1 bit for each revision.
> 
>> 
> 
> Best regards,
> Krzysztof
>
Krzysztof Kozlowski Sept. 4, 2023, 7:53 p.m. UTC | #5
On 04/09/2023 21:48, Martin Botka wrote:
> 
> 
> On Mon, Sep 4 2023 at 09:32:44 PM +02:00:00, Krzysztof Kozlowski 
> <krzysztof.kozlowski@linaro.org> wrote:
>> On 04/09/2023 21:31, Krzysztof Kozlowski wrote:
>>>  On 04/09/2023 17:57, Martin Botka wrote:
>>>>  We need to add compatible for H616 to H6 cpufreq driver bindings.
>>>
>>>  Please describe the hardware, not what is needed for drivers.
>>>
>>>>
>>>>  Also enable opp_supported_hw property that will be needed for H616.
>>>>
>>>>  Signed-off-by: Martin Botka <martin.botka@somainline.org>
>>>>  ---
>>>>   .../bindings/opp/allwinner,sun50i-h6-operating-points.yaml        
>>>>   | 6 +++++-
>>>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>>>
>>>>  diff --git 
>>>> a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml 
>>>> b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>>>  index 51f62c3ae194..2fa1199f2d23 100644
>>>>  --- 
>>>> a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>>>  +++ 
>>>> b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>>>  @@ -23,7 +23,10 @@ allOf:
>>>>
>>>>   properties:
>>>>     compatible:
>>>>  -    const: allwinner,sun50i-h6-operating-points
>>>>  +    contains:
>>>
>>>  This does not look like part of allOf, so contains is no correct 
>>> here.
>>>  This must be specific, so drop contains.
>>
>> BTW, I also do no see it used by the driver at all.
> Function sun50i_cpufreq_get_efuse uses it. It checks for H6 compatible 
> and if that fails we check for H616 compatible.

Such code does no scale. It also does not look reasonable - you cannot
have different compatible there. Device binds to h6 or h616, so you
cannot have OPP table from other devices.

Best regards,
Krzysztof
Martin Botka Sept. 4, 2023, 8:06 p.m. UTC | #6
On Mon, Sep 4 2023 at 09:53:05 PM +02:00:00, Krzysztof Kozlowski 
<krzysztof.kozlowski@linaro.org> wrote:
> On 04/09/2023 21:48, Martin Botka wrote:
>> 
>> 
>>  On Mon, Sep 4 2023 at 09:32:44 PM +02:00:00, Krzysztof Kozlowski
>>  <krzysztof.kozlowski@linaro.org> wrote:
>>>  On 04/09/2023 21:31, Krzysztof Kozlowski wrote:
>>>>   On 04/09/2023 17:57, Martin Botka wrote:
>>>>>   We need to add compatible for H616 to H6 cpufreq driver 
>>>>> bindings.
>>>> 
>>>>   Please describe the hardware, not what is needed for drivers.
>>>> 
>>>>> 
>>>>>   Also enable opp_supported_hw property that will be needed for 
>>>>> H616.
>>>>> 
>>>>>   Signed-off-by: Martin Botka <martin.botka@somainline.org>
>>>>>   ---
>>>>>    .../bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>>>>    | 6 +++++-
>>>>>    1 file changed, 5 insertions(+), 1 deletion(-)
>>>>> 
>>>>>   diff --git
>>>>>  
>>>>> a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>>>>  
>>>>> b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>>>>   index 51f62c3ae194..2fa1199f2d23 100644
>>>>>   ---
>>>>>  
>>>>> a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>>>>   +++
>>>>>  
>>>>> b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>>>>   @@ -23,7 +23,10 @@ allOf:
>>>>> 
>>>>>    properties:
>>>>>      compatible:
>>>>>   -    const: allwinner,sun50i-h6-operating-points
>>>>>   +    contains:
>>>> 
>>>>   This does not look like part of allOf, so contains is no correct
>>>>  here.
>>>>   This must be specific, so drop contains.
>>> 
>>>  BTW, I also do no see it used by the driver at all.
>>  Function sun50i_cpufreq_get_efuse uses it. It checks for H6 
>> compatible
>>  and if that fails we check for H616 compatible.
> 
> Such code does no scale. It also does not look reasonable - you cannot
> have different compatible there. Device binds to h6 or h616, so you
> cannot have OPP table from other devices.
> 
Heya. I checked how qcom nvmem driver does it. And yea this indeed does 
not scale. matchlist should have SoC compatible and driver needs to 
have single compatible. Thus also dropping this patch :)

Will do in V2. Thanks Krzystof for pointing me to the right way of 
doing it :)

Cheers,
Martin
> Best regards,
> Krzysztof
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
index 51f62c3ae194..2fa1199f2d23 100644
--- a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
+++ b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
@@ -23,7 +23,10 @@  allOf:
 
 properties:
   compatible:
-    const: allwinner,sun50i-h6-operating-points
+    contains:
+      enum:
+        - allwinner,sun50i-h6-operating-points
+        - allwinner,sun50i-h616-operating-points
 
   nvmem-cells:
     description: |
@@ -47,6 +50,7 @@  patternProperties:
     properties:
       opp-hz: true
       clock-latency-ns: true
+      opp-supported-hw: true
 
     patternProperties:
       "^opp-microvolt-speed[0-9]$": true