[PATCH v2 1/2] dt-bindings: pinctrl: mt8192: Switch drive-strength-adv for -microamp

Nícolas F. R. A. Prado posted 2 patches 2 years, 3 months ago
[PATCH v2 1/2] dt-bindings: pinctrl: mt8192: Switch drive-strength-adv for -microamp
Posted by Nícolas F. R. A. Prado 2 years, 3 months ago
Commit e5fabbe43f3f ("pinctrl: mediatek: paris: Support generic
PIN_CONFIG_DRIVE_STRENGTH_UA") added support for using
drive-strength-microamp instead of mediatek,drive-strength-adv.

Since there aren't any users of mediatek,drive-strength-adv on mt8192
yet, remove this property and add drive-strength-microamp in its place,
which has a clearer meaning.

While at it, add a new 'if' block to validate that drive-strength and
drive-strength-microamp aren't used together, since they're mutually
exclusive.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogiocchino.delregno@collabora.com>

---

Changes in v2:
- Added 'if' block to make drive-strength and drive-strength-microamp
  mutually exclusive
- Changed commit title to be more precise
- Dropped Fixes tag

 .../bindings/pinctrl/pinctrl-mt8192.yaml      | 35 ++++++-------------
 1 file changed, 10 insertions(+), 25 deletions(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml
index c90a132fbc79..c8092b218f2f 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml
@@ -80,31 +80,8 @@ patternProperties:
               dt-bindings/pinctrl/mt65xx.h. It can only support 2/4/6/8/10/12/14/16mA in mt8192.
             enum: [2, 4, 6, 8, 10, 12, 14, 16]
 
-          mediatek,drive-strength-adv:
-            description: |
-              Describe the specific driving setup property.
-              For I2C pins, the existing generic driving setup can only support
-              2/4/6/8/10/12/14/16mA driving. But in specific driving setup, they
-              can support 0.125/0.25/0.5/1mA adjustment. If we enable specific
-              driving setup, the existing generic setup will be disabled.
-              The specific driving setup is controlled by E1E0EN.
-              When E1=0/E0=0, the strength is 0.125mA.
-              When E1=0/E0=1, the strength is 0.25mA.
-              When E1=1/E0=0, the strength is 0.5mA.
-              When E1=1/E0=1, the strength is 1mA.
-              EN is used to enable or disable the specific driving setup.
-              Valid arguments are described as below:
-              0: (E1, E0, EN) = (0, 0, 0)
-              1: (E1, E0, EN) = (0, 0, 1)
-              2: (E1, E0, EN) = (0, 1, 0)
-              3: (E1, E0, EN) = (0, 1, 1)
-              4: (E1, E0, EN) = (1, 0, 0)
-              5: (E1, E0, EN) = (1, 0, 1)
-              6: (E1, E0, EN) = (1, 1, 0)
-              7: (E1, E0, EN) = (1, 1, 1)
-              So the valid arguments are from 0 to 7.
-            $ref: /schemas/types.yaml#/definitions/uint32
-            enum: [0, 1, 2, 3, 4, 5, 6, 7]
+          drive-strength-microamp:
+            enum: [125, 250, 500, 1000]
 
           mediatek,pull-up-adv:
             description: |
@@ -138,6 +115,14 @@ patternProperties:
         required:
           - pinmux
 
+        allOf:
+          - if:
+              required:
+                - drive-strength-microamp
+            then:
+              properties:
+                drive-strength: false
+
         additionalProperties: false
 
 allOf:
-- 
2.36.1

Re: [PATCH v2 1/2] dt-bindings: pinctrl: mt8192: Switch drive-strength-adv for -microamp
Posted by Guodong Liu 2 years, 3 months ago
-----Original Message-----
From: Nícolas F. R. A. Prado <nfraprado@collabora.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com
>, kernel@collabora.com, Nícolas F. R. A. Prado <
nfraprado@collabora.com>, Krzysztof Kozlowski <
krzysztof.kozlowski+dt@linaro.org>, Matthias Brugger <
matthias.bgg@gmail.com>, Rob Herring <robh+dt@kernel.org>, Sean Wang <
sean.wang@mediatek.com>, devicetree@vger.kernel.org, 
linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, 
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org
Subject: [PATCH v2 1/2] dt-bindings: pinctrl: mt8192: Switch drive-
strength-adv for -microamp
Date: Tue, 31 May 2022 18:19:53 -0400

Commit e5fabbe43f3f ("pinctrl: mediatek: paris: Support generic
PIN_CONFIG_DRIVE_STRENGTH_UA") added support for using
drive-strength-microamp instead of mediatek,drive-strength-adv.

Since there aren't any users of mediatek,drive-strength-adv on mt8192
yet, remove this property and add drive-strength-microamp in its place,
which has a clearer meaning.

While at it, add a new 'if' block to validate that drive-strength and
drive-strength-microamp aren't used together, since they're mutually
exclusive.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <
angelogiocchino.delregno@collabora.com>
---

Changes in v2:
- Added 'if' block to make drive-strength and drive-strength-microamp
  mutually exclusive
- Changed commit title to be more precise
- Dropped Fixes tag

 .../bindings/pinctrl/pinctrl-mt8192.yaml      | 35 ++++++-------------
 1 file changed, 10 insertions(+), 25 deletions(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-
mt8192.yaml b/Documentation/devicetree/bindings/pinctrl/pinctrl-
mt8192.yaml
index c90a132fbc79..c8092b218f2f 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml
@@ -80,31 +80,8 @@ patternProperties:
               dt-bindings/pinctrl/mt65xx.h. It can only support
2/4/6/8/10/12/14/16mA in mt8192.
             enum: [2, 4, 6, 8, 10, 12, 14, 16]
 
-          mediatek,drive-strength-adv:
-            description: |
-              Describe the specific driving setup property.
-              For I2C pins, the existing generic driving setup can
only support
-              2/4/6/8/10/12/14/16mA driving. But in specific driving
setup, they
-              can support 0.125/0.25/0.5/1mA adjustment. If we enable
specific
-              driving setup, the existing generic setup will be
disabled.
-              The specific driving setup is controlled by E1E0EN.
-              When E1=0/E0=0, the strength is 0.125mA.
-              When E1=0/E0=1, the strength is 0.25mA.
-              When E1=1/E0=0, the strength is 0.5mA.
-              When E1=1/E0=1, the strength is 1mA.
-              EN is used to enable or disable the specific driving
setup.
-              Valid arguments are described as below:
-              0: (E1, E0, EN) = (0, 0, 0)
-              1: (E1, E0, EN) = (0, 0, 1)
-              2: (E1, E0, EN) = (0, 1, 0)
-              3: (E1, E0, EN) = (0, 1, 1)
-              4: (E1, E0, EN) = (1, 0, 0)
-              5: (E1, E0, EN) = (1, 0, 1)
-              6: (E1, E0, EN) = (1, 1, 0)
-              7: (E1, E0, EN) = (1, 1, 1)
-              So the valid arguments are from 0 to 7.
-            $ref: /schemas/types.yaml#/definitions/uint32
-            enum: [0, 1, 2, 3, 4, 5, 6, 7]

Can't remove mediatek,drive-strength-adv property, I2C pins will ofter
use this property

+          drive-strength-microamp:
+            enum: [125, 250, 500, 1000]
 
           mediatek,pull-up-adv:
             description: |
@@ -138,6 +115,14 @@ patternProperties:
         required:
           - pinmux
 
+        allOf:
+          - if:
+              required:
+                - drive-strength-microamp
+            then:
+              properties:
+                drive-strength: false
+
         additionalProperties: false
 
Property drive-strength-microamp and drive-strength aren't exclusive,
just i2c pins support drive-strength-microamp property .

 allOf:

Re: [PATCH v2 1/2] dt-bindings: pinctrl: mt8192: Switch drive-strength-adv for -microamp
Posted by Nícolas F. R. A. Prado 2 years, 3 months ago
Hi Guodong,

On Wed, Jun 08, 2022 at 04:08:13PM +0800, Guodong Liu wrote:
> -----Original Message-----
> From: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> To: Linus Walleij <linus.walleij@linaro.org>
> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com
> >, kernel@collabora.com, Nícolas F. R. A. Prado <
> nfraprado@collabora.com>, Krzysztof Kozlowski <
> krzysztof.kozlowski+dt@linaro.org>, Matthias Brugger <
> matthias.bgg@gmail.com>, Rob Herring <robh+dt@kernel.org>, Sean Wang <
> sean.wang@mediatek.com>, devicetree@vger.kernel.org, 
> linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, 
> linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org
> Subject: [PATCH v2 1/2] dt-bindings: pinctrl: mt8192: Switch drive-
> strength-adv for -microamp
> Date: Tue, 31 May 2022 18:19:53 -0400
> 
> Commit e5fabbe43f3f ("pinctrl: mediatek: paris: Support generic
> PIN_CONFIG_DRIVE_STRENGTH_UA") added support for using
> drive-strength-microamp instead of mediatek,drive-strength-adv.
> 
> Since there aren't any users of mediatek,drive-strength-adv on mt8192
> yet, remove this property and add drive-strength-microamp in its place,
> which has a clearer meaning.
> 
> While at it, add a new 'if' block to validate that drive-strength and
> drive-strength-microamp aren't used together, since they're mutually
> exclusive.
> 
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> Reviewed-by: Rob Herring <robh@kernel.org>
> Reviewed-by: AngeloGioacchino Del Regno <
> angelogiocchino.delregno@collabora.com>
> ---
> 
> Changes in v2:
> - Added 'if' block to make drive-strength and drive-strength-microamp
>   mutually exclusive
> - Changed commit title to be more precise
> - Dropped Fixes tag
> 
>  .../bindings/pinctrl/pinctrl-mt8192.yaml      | 35 ++++++-------------
>  1 file changed, 10 insertions(+), 25 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-
> mt8192.yaml b/Documentation/devicetree/bindings/pinctrl/pinctrl-
> mt8192.yaml
> index c90a132fbc79..c8092b218f2f 100644
> --- a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml
> +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml
> @@ -80,31 +80,8 @@ patternProperties:
>                dt-bindings/pinctrl/mt65xx.h. It can only support
> 2/4/6/8/10/12/14/16mA in mt8192.
>              enum: [2, 4, 6, 8, 10, 12, 14, 16]
>  
> -          mediatek,drive-strength-adv:
> -            description: |
> -              Describe the specific driving setup property.
> -              For I2C pins, the existing generic driving setup can
> only support
> -              2/4/6/8/10/12/14/16mA driving. But in specific driving
> setup, they
> -              can support 0.125/0.25/0.5/1mA adjustment. If we enable
> specific
> -              driving setup, the existing generic setup will be
> disabled.
> -              The specific driving setup is controlled by E1E0EN.
> -              When E1=0/E0=0, the strength is 0.125mA.
> -              When E1=0/E0=1, the strength is 0.25mA.
> -              When E1=1/E0=0, the strength is 0.5mA.
> -              When E1=1/E0=1, the strength is 1mA.
> -              EN is used to enable or disable the specific driving
> setup.
> -              Valid arguments are described as below:
> -              0: (E1, E0, EN) = (0, 0, 0)
> -              1: (E1, E0, EN) = (0, 0, 1)
> -              2: (E1, E0, EN) = (0, 1, 0)
> -              3: (E1, E0, EN) = (0, 1, 1)
> -              4: (E1, E0, EN) = (1, 0, 0)
> -              5: (E1, E0, EN) = (1, 0, 1)
> -              6: (E1, E0, EN) = (1, 1, 0)
> -              7: (E1, E0, EN) = (1, 1, 1)
> -              So the valid arguments are from 0 to 7.
> -            $ref: /schemas/types.yaml#/definitions/uint32
> -            enum: [0, 1, 2, 3, 4, 5, 6, 7]
> 
> Can't remove mediatek,drive-strength-adv property, I2C pins will ofter
> use this property

Yes, the point is that they should use drive-strength-microamp instead, which
does the exact same thing while also having a clearer meaning.

> 
> +          drive-strength-microamp:
> +            enum: [125, 250, 500, 1000]
>  
>            mediatek,pull-up-adv:
>              description: |
> @@ -138,6 +115,14 @@ patternProperties:
>          required:
>            - pinmux
>  
> +        allOf:
> +          - if:
> +              required:
> +                - drive-strength-microamp
> +            then:
> +              properties:
> +                drive-strength: false
> +
>          additionalProperties: false
>  
> Property drive-strength-microamp and drive-strength aren't exclusive,
> just i2c pins support drive-strength-microamp property .

They are exclusive in the sense that both drive-strength-microamp and
drive-strength shouldn't be used on the same pin configuration. The fact that
only i2c pins use drive-strength-microamp doesn't have to do with this, and is
perfectly fine.

Thanks,
Nícolas