diff mbox series

[v2,3/4] dt-bindings: update google,cros-ec-pwm documentation

Message ID 20220331125818.3776912-4-fabiobaltieri@chromium.org (mailing list archive)
State Superseded
Headers show
Series Add channel type support to pwm-cros-ec | expand

Commit Message

Fabio Baltieri March 31, 2022, 12:58 p.m. UTC
Update google,cros-ec-pwm node documentation to mention the
google,use_pwm_type property.

Signed-off-by: Fabio Baltieri <fabiobaltieri@chromium.org>
---
 .../devicetree/bindings/pwm/google,cros-ec-pwm.yaml         | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Rob Herring (Arm) April 6, 2022, 3:41 p.m. UTC | #1
On Thu, Mar 31, 2022 at 12:58:17PM +0000, Fabio Baltieri wrote:
> Update google,cros-ec-pwm node documentation to mention the
> google,use_pwm_type property.
> 
> Signed-off-by: Fabio Baltieri <fabiobaltieri@chromium.org>
> ---
>  .../devicetree/bindings/pwm/google,cros-ec-pwm.yaml         | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml b/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
> index 4cfbffd8414a..9c895c990ed8 100644
> --- a/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
> +++ b/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
> @@ -19,6 +19,12 @@ description: |
>  properties:
>    compatible:
>      const: google,cros-ec-pwm
> +
> +  google,use-pwm-type:
> +    description:
> +      Use PWM types (CROS_EC_PWM_DT_<...>) instead of generic channels.
> +    type: boolean

Either do a new compatible string if the cell interpretation is mutually 
exclusive (channel number vs. type) or split the number space for the 
1st cell between type and channel number. IOW, set a bit (31?) to 
signify the number is a type, not a channel.

Rob
Fabio Baltieri April 7, 2022, 2:38 p.m. UTC | #2
Hi Rob,

On Wed, Apr 06, 2022 at 10:41:45AM -0500, Rob Herring wrote:
> On Thu, Mar 31, 2022 at 12:58:17PM +0000, Fabio Baltieri wrote:
> > Update google,cros-ec-pwm node documentation to mention the
> > google,use_pwm_type property.
> > 
> > Signed-off-by: Fabio Baltieri <fabiobaltieri@chromium.org>
> > ---
> >  .../devicetree/bindings/pwm/google,cros-ec-pwm.yaml         | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml b/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
> > index 4cfbffd8414a..9c895c990ed8 100644
> > --- a/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
> > +++ b/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
> > @@ -19,6 +19,12 @@ description: |
> >  properties:
> >    compatible:
> >      const: google,cros-ec-pwm
> > +
> > +  google,use-pwm-type:
> > +    description:
> > +      Use PWM types (CROS_EC_PWM_DT_<...>) instead of generic channels.
> > +    type: boolean
> 
> Either do a new compatible string if the cell interpretation is mutually 
> exclusive (channel number vs. type) or split the number space for the 
> 1st cell between type and channel number. IOW, set a bit (31?) to 
> signify the number is a type, not a channel.

Split the number space was my first (tentative) implementation as well,
but it turns out that the PWM subsystem really wants channels to be
zero-based[1], so I don't think flags or bitmasks are really an option.

New compatible sounds good though, I'll rework a v3 with that change.

Thanks!
Fabio

[1] https://elixir.bootlin.com/linux/v5.17/source/drivers/pwm/core.c#L423
Rob Herring (Arm) April 7, 2022, 4:49 p.m. UTC | #3
On Thu, Apr 07, 2022 at 02:38:55PM +0000, Fabio Baltieri wrote:
> Hi Rob,
> 
> On Wed, Apr 06, 2022 at 10:41:45AM -0500, Rob Herring wrote:
> > On Thu, Mar 31, 2022 at 12:58:17PM +0000, Fabio Baltieri wrote:
> > > Update google,cros-ec-pwm node documentation to mention the
> > > google,use_pwm_type property.
> > > 
> > > Signed-off-by: Fabio Baltieri <fabiobaltieri@chromium.org>
> > > ---
> > >  .../devicetree/bindings/pwm/google,cros-ec-pwm.yaml         | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml b/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
> > > index 4cfbffd8414a..9c895c990ed8 100644
> > > --- a/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
> > > +++ b/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
> > > @@ -19,6 +19,12 @@ description: |
> > >  properties:
> > >    compatible:
> > >      const: google,cros-ec-pwm
> > > +
> > > +  google,use-pwm-type:
> > > +    description:
> > > +      Use PWM types (CROS_EC_PWM_DT_<...>) instead of generic channels.
> > > +    type: boolean
> > 
> > Either do a new compatible string if the cell interpretation is mutually 
> > exclusive (channel number vs. type) or split the number space for the 
> > 1st cell between type and channel number. IOW, set a bit (31?) to 
> > signify the number is a type, not a channel.
> 
> Split the number space was my first (tentative) implementation as well,
> but it turns out that the PWM subsystem really wants channels to be
> zero-based[1], so I don't think flags or bitmasks are really an option.

Fix the PWM subsystem then...

> New compatible sounds good though, I'll rework a v3 with that change.
> 
> Thanks!
> Fabio
> 
> [1] https://elixir.bootlin.com/linux/v5.17/source/drivers/pwm/core.c#L423
> 
> -- 
> Fabio Baltieri
Fabio Baltieri April 7, 2022, 7:36 p.m. UTC | #4
On Thu, Apr 07, 2022 at 11:49:09AM -0500, Rob Herring wrote:
> On Thu, Apr 07, 2022 at 02:38:55PM +0000, Fabio Baltieri wrote:
> > Hi Rob,
> > 
> > On Wed, Apr 06, 2022 at 10:41:45AM -0500, Rob Herring wrote:
> > > On Thu, Mar 31, 2022 at 12:58:17PM +0000, Fabio Baltieri wrote:
> > > > Update google,cros-ec-pwm node documentation to mention the
> > > > google,use_pwm_type property.
> > > > 
> > > > Signed-off-by: Fabio Baltieri <fabiobaltieri@chromium.org>
> > > > ---
> > > >  .../devicetree/bindings/pwm/google,cros-ec-pwm.yaml         | 6 ++++++
> > > >  1 file changed, 6 insertions(+)
> > > > 
> > > > diff --git a/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml b/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
> > > > index 4cfbffd8414a..9c895c990ed8 100644
> > > > --- a/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
> > > > +++ b/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
> > > > @@ -19,6 +19,12 @@ description: |
> > > >  properties:
> > > >    compatible:
> > > >      const: google,cros-ec-pwm
> > > > +
> > > > +  google,use-pwm-type:
> > > > +    description:
> > > > +      Use PWM types (CROS_EC_PWM_DT_<...>) instead of generic channels.
> > > > +    type: boolean
> > > 
> > > Either do a new compatible string if the cell interpretation is mutually 
> > > exclusive (channel number vs. type) or split the number space for the 
> > > 1st cell between type and channel number. IOW, set a bit (31?) to 
> > > signify the number is a type, not a channel.
> > 
> > Split the number space was my first (tentative) implementation as well,
> > but it turns out that the PWM subsystem really wants channels to be
> > zero-based[1], so I don't think flags or bitmasks are really an option.
> 
> Fix the PWM subsystem then...

It's a good design decision, allows for probe time validation and a good
debugfs interface, I'm happy to have this feature comply with it.

> 
> > New compatible sounds good though, I'll rework a v3 with that change.
> > 
> > Thanks!
> > Fabio
> > 
> > [1] https://elixir.bootlin.com/linux/v5.17/source/drivers/pwm/core.c#L423
> > 
> > -- 
> > Fabio Baltieri
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml b/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
index 4cfbffd8414a..9c895c990ed8 100644
--- a/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
+++ b/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
@@ -19,6 +19,12 @@  description: |
 properties:
   compatible:
     const: google,cros-ec-pwm
+
+  google,use-pwm-type:
+    description:
+      Use PWM types (CROS_EC_PWM_DT_<...>) instead of generic channels.
+    type: boolean
+
   "#pwm-cells":
     description: The cell specifies the PWM index.
     const: 1