diff mbox series

[v3,15/16] ASoC: dt-bindings: cs35l41: Document CS35l41 External Boost

Message ID 20220308171730.454587-16-tanureal@opensource.cirrus.com (mailing list archive)
State Superseded
Headers show
Series Support external boost at CS35l41 ASoC driver | expand

Commit Message

Lucas Tanure March 8, 2022, 5:17 p.m. UTC
From: David Rhodes <drhodes@opensource.cirrus.com>

Document internal and external boost feature for ASoC CS35L41.
For internal boost the following properties are required:
- cirrus,boost-peak-milliamp
- cirrus,boost-ind-nanohenry
- cirrus,boost-cap-microfarad

For external boost, the GPIO1 must be configured as output,
so the following properties are required:
- cirrus,gpio1-src-select = <1>
- cirrus,gpio1-output-enable

Signed-off-by: David Rhodes <drhodes@opensource.cirrus.com>
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
---
 .../bindings/sound/cirrus,cs35l41.yaml        | 44 +++++++++++++++++--
 1 file changed, 41 insertions(+), 3 deletions(-)

Comments

Rob Herring (Arm) March 8, 2022, 9:24 p.m. UTC | #1
On Tue, 08 Mar 2022 17:17:29 +0000, Lucas Tanure wrote:
> From: David Rhodes <drhodes@opensource.cirrus.com>
> 
> Document internal and external boost feature for ASoC CS35L41.
> For internal boost the following properties are required:
> - cirrus,boost-peak-milliamp
> - cirrus,boost-ind-nanohenry
> - cirrus,boost-cap-microfarad
> 
> For external boost, the GPIO1 must be configured as output,
> so the following properties are required:
> - cirrus,gpio1-src-select = <1>
> - cirrus,gpio1-output-enable
> 
> Signed-off-by: David Rhodes <drhodes@opensource.cirrus.com>
> Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
> ---
>  .../bindings/sound/cirrus,cs35l41.yaml        | 44 +++++++++++++++++--
>  1 file changed, 41 insertions(+), 3 deletions(-)
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:
./Documentation/devicetree/bindings/sound/cirrus,cs35l41.yaml:152:13: [warning] wrong indentation: expected 10 but found 12 (indentation)

dtschema/dtc warnings/errors:

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1603100

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
Rob Herring (Arm) March 9, 2022, 1:20 a.m. UTC | #2
On Tue, Mar 08, 2022 at 05:17:29PM +0000, Lucas Tanure wrote:
> From: David Rhodes <drhodes@opensource.cirrus.com>
> 
> Document internal and external boost feature for ASoC CS35L41.
> For internal boost the following properties are required:
> - cirrus,boost-peak-milliamp
> - cirrus,boost-ind-nanohenry
> - cirrus,boost-cap-microfarad
> 
> For external boost, the GPIO1 must be configured as output,
> so the following properties are required:
> - cirrus,gpio1-src-select = <1>
> - cirrus,gpio1-output-enable
> 
> Signed-off-by: David Rhodes <drhodes@opensource.cirrus.com>
> Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
> ---
>  .../bindings/sound/cirrus,cs35l41.yaml        | 44 +++++++++++++++++--
>  1 file changed, 41 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/sound/cirrus,cs35l41.yaml b/Documentation/devicetree/bindings/sound/cirrus,cs35l41.yaml
> index 3235702ce402..09b515924c59 100644
> --- a/Documentation/devicetree/bindings/sound/cirrus,cs35l41.yaml
> +++ b/Documentation/devicetree/bindings/sound/cirrus,cs35l41.yaml
> @@ -75,6 +75,19 @@ properties:
>      maximum: 3
>      default: 2
>  
> +  cirrus,boost-type:
> +    description:
> +      Configures the type of Boost being used.
> +      Internal boost requires boost-peak-milliamp, boost-ind-nanohenry and
> +      boost-cap-microfarad.
> +      External Boost must have GPIO1 as GPIO output. GPIO1 will be set high to
> +      enable boost voltage.
> +      0 = Internal Boost
> +      1 = External Boost
> +    $ref: "/schemas/types.yaml#/definitions/uint32"
> +    minimum: 0
> +    maximum: 1

What does not present mean? Might be better to make this boolean depending
on what you are trying to accomplish.

> +
>    cirrus,gpio1-polarity-invert:
>      description:
>        Boolean which specifies whether the GPIO1
> @@ -131,9 +144,32 @@ required:
>    - compatible
>    - reg
>    - "#sound-dai-cells"
> -  - cirrus,boost-peak-milliamp
> -  - cirrus,boost-ind-nanohenry
> -  - cirrus,boost-cap-microfarad
> +
> +allOf:
> +  - if:
> +      properties:
> +        cirrus,boost-type:
> +            const: 0

Note that this will be true if cirrus,boost-type is not present. You 
probably want to add 'required'.

> +    then:
> +      required:
> +        - cirrus,boost-peak-milliamp
> +        - cirrus,boost-ind-nanohenry
> +        - cirrus,boost-cap-microfarad
> +    else:
> +      if:
> +        properties:
> +          cirrus,boost-type:
> +            const: 1
> +      then:
> +        required:
> +          - cirrus,gpio1-output-enable
> +          - cirrus,gpio1-src-select
> +        properties:
> +          cirrus,boost-peak-milliamp: false
> +          cirrus,boost-ind-nanohenry: false
> +          cirrus,boost-cap-microfarad: false
> +          cirrus,gpio1-src-select:
> +            enum: [1]
>  
>  additionalProperties: false
>  
> @@ -150,6 +186,8 @@ examples:
>            VA-supply = <&dummy_vreg>;
>            VP-supply = <&dummy_vreg>;
>            reset-gpios = <&gpio 110 0>;
> +
> +          cirrus,boost-type = <0>;
>            cirrus,boost-peak-milliamp = <4500>;
>            cirrus,boost-ind-nanohenry = <1000>;
>            cirrus,boost-cap-microfarad = <15>;
> -- 
> 2.35.1
> 
>
Lucas Tanure March 9, 2022, 9:28 a.m. UTC | #3
On 3/9/22 01:20, Rob Herring wrote:
> On Tue, Mar 08, 2022 at 05:17:29PM +0000, Lucas Tanure wrote:
>> From: David Rhodes <drhodes@opensource.cirrus.com>
>>
>> Document internal and external boost feature for ASoC CS35L41.
>> For internal boost the following properties are required:
>> - cirrus,boost-peak-milliamp
>> - cirrus,boost-ind-nanohenry
>> - cirrus,boost-cap-microfarad
>>
>> For external boost, the GPIO1 must be configured as output,
>> so the following properties are required:
>> - cirrus,gpio1-src-select = <1>
>> - cirrus,gpio1-output-enable
>>
>> Signed-off-by: David Rhodes <drhodes@opensource.cirrus.com>
>> Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
>> ---
>>   .../bindings/sound/cirrus,cs35l41.yaml        | 44 +++++++++++++++++--
>>   1 file changed, 41 insertions(+), 3 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/sound/cirrus,cs35l41.yaml b/Documentation/devicetree/bindings/sound/cirrus,cs35l41.yaml
>> index 3235702ce402..09b515924c59 100644
>> --- a/Documentation/devicetree/bindings/sound/cirrus,cs35l41.yaml
>> +++ b/Documentation/devicetree/bindings/sound/cirrus,cs35l41.yaml
>> @@ -75,6 +75,19 @@ properties:
>>       maximum: 3
>>       default: 2
>>   
>> +  cirrus,boost-type:
>> +    description:
>> +      Configures the type of Boost being used.
>> +      Internal boost requires boost-peak-milliamp, boost-ind-nanohenry and
>> +      boost-cap-microfarad.
>> +      External Boost must have GPIO1 as GPIO output. GPIO1 will be set high to
>> +      enable boost voltage.
>> +      0 = Internal Boost
>> +      1 = External Boost
>> +    $ref: "/schemas/types.yaml#/definitions/uint32"
>> +    minimum: 0
>> +    maximum: 1
> 
> What does not present mean? Might be better to make this boolean depending
> on what you are trying to accomplish.
Not present means Internal boost. There will be other types of boost in 
the future, so I would like to keep it as is.

> 
>> +
>>     cirrus,gpio1-polarity-invert:
>>       description:
>>         Boolean which specifies whether the GPIO1
>> @@ -131,9 +144,32 @@ required:
>>     - compatible
>>     - reg
>>     - "#sound-dai-cells"
>> -  - cirrus,boost-peak-milliamp
>> -  - cirrus,boost-ind-nanohenry
>> -  - cirrus,boost-cap-microfarad
>> +
>> +allOf:
>> +  - if:
>> +      properties:
>> +        cirrus,boost-type:
>> +            const: 0
> 
> Note that this will be true if cirrus,boost-type is not present. You
> probably want to add 'required'.
Yes, that's expected. We want to continue to support old device trees 
without boost type, and for that case it sets to internal boost.

> 
>> +    then:
>> +      required:
>> +        - cirrus,boost-peak-milliamp
>> +        - cirrus,boost-ind-nanohenry
>> +        - cirrus,boost-cap-microfarad
>> +    else:
>> +      if:
>> +        properties:
>> +          cirrus,boost-type:
>> +            const: 1
>> +      then:
>> +        required:
>> +          - cirrus,gpio1-output-enable
>> +          - cirrus,gpio1-src-select
>> +        properties:
>> +          cirrus,boost-peak-milliamp: false
>> +          cirrus,boost-ind-nanohenry: false
>> +          cirrus,boost-cap-microfarad: false
>> +          cirrus,gpio1-src-select:
>> +            enum: [1]
>>   
>>   additionalProperties: false
>>   
>> @@ -150,6 +186,8 @@ examples:
>>             VA-supply = <&dummy_vreg>;
>>             VP-supply = <&dummy_vreg>;
>>             reset-gpios = <&gpio 110 0>;
>> +
>> +          cirrus,boost-type = <0>;
>>             cirrus,boost-peak-milliamp = <4500>;
>>             cirrus,boost-ind-nanohenry = <1000>;
>>             cirrus,boost-cap-microfarad = <15>;
>> -- 
>> 2.35.1
>>
>>
Charles Keepax March 9, 2022, 9:37 a.m. UTC | #4
On Tue, Mar 08, 2022 at 05:17:29PM +0000, Lucas Tanure wrote:
> From: David Rhodes <drhodes@opensource.cirrus.com>
> 
> Document internal and external boost feature for ASoC CS35L41.
> For internal boost the following properties are required:
> - cirrus,boost-peak-milliamp
> - cirrus,boost-ind-nanohenry
> - cirrus,boost-cap-microfarad
> 
> For external boost, the GPIO1 must be configured as output,
> so the following properties are required:
> - cirrus,gpio1-src-select = <1>
> - cirrus,gpio1-output-enable
> 
> Signed-off-by: David Rhodes <drhodes@opensource.cirrus.com>
> Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/cirrus,cs35l41.yaml b/Documentation/devicetree/bindings/sound/cirrus,cs35l41.yaml
index 3235702ce402..09b515924c59 100644
--- a/Documentation/devicetree/bindings/sound/cirrus,cs35l41.yaml
+++ b/Documentation/devicetree/bindings/sound/cirrus,cs35l41.yaml
@@ -75,6 +75,19 @@  properties:
     maximum: 3
     default: 2
 
+  cirrus,boost-type:
+    description:
+      Configures the type of Boost being used.
+      Internal boost requires boost-peak-milliamp, boost-ind-nanohenry and
+      boost-cap-microfarad.
+      External Boost must have GPIO1 as GPIO output. GPIO1 will be set high to
+      enable boost voltage.
+      0 = Internal Boost
+      1 = External Boost
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+    minimum: 0
+    maximum: 1
+
   cirrus,gpio1-polarity-invert:
     description:
       Boolean which specifies whether the GPIO1
@@ -131,9 +144,32 @@  required:
   - compatible
   - reg
   - "#sound-dai-cells"
-  - cirrus,boost-peak-milliamp
-  - cirrus,boost-ind-nanohenry
-  - cirrus,boost-cap-microfarad
+
+allOf:
+  - if:
+      properties:
+        cirrus,boost-type:
+            const: 0
+    then:
+      required:
+        - cirrus,boost-peak-milliamp
+        - cirrus,boost-ind-nanohenry
+        - cirrus,boost-cap-microfarad
+    else:
+      if:
+        properties:
+          cirrus,boost-type:
+            const: 1
+      then:
+        required:
+          - cirrus,gpio1-output-enable
+          - cirrus,gpio1-src-select
+        properties:
+          cirrus,boost-peak-milliamp: false
+          cirrus,boost-ind-nanohenry: false
+          cirrus,boost-cap-microfarad: false
+          cirrus,gpio1-src-select:
+            enum: [1]
 
 additionalProperties: false
 
@@ -150,6 +186,8 @@  examples:
           VA-supply = <&dummy_vreg>;
           VP-supply = <&dummy_vreg>;
           reset-gpios = <&gpio 110 0>;
+
+          cirrus,boost-type = <0>;
           cirrus,boost-peak-milliamp = <4500>;
           cirrus,boost-ind-nanohenry = <1000>;
           cirrus,boost-cap-microfarad = <15>;