diff mbox series

[v3,1/2] dt-bindings: pwm: Allow decimal format in addition to hex format

Message ID 20221122123225.59106-1-tony@atomide.com (mailing list archive)
State New, archived
Headers show
Series [v3,1/2] dt-bindings: pwm: Allow decimal format in addition to hex format | expand

Commit Message

Tony Lindgren Nov. 22, 2022, 12:32 p.m. UTC
Let's allow node numbering in decimal format too.

Simple human-readable increments/IDs are usually decimal, hex is only for
addresses as noted by Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>.

Let's use an improved match suggested by Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> and improved a bit by Uwe Kleine-König
<u.kleine-koenig@pengutronix.de>.

Cc: linux-pwm@vger.kernel.org
Cc: Thierry Reding <thierry.reding@gmail.com>
Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---

Changes since v2:

- Use pattern suggested by Krzysztof and Uwe

Changes since v1:

- New patch added to deal with pwm-omap-dmtimer binding

---
 Documentation/devicetree/bindings/pwm/pwm.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Krzysztof Kozlowski Nov. 22, 2022, 12:49 p.m. UTC | #1
On 22/11/2022 13:32, Tony Lindgren wrote:
> Let's allow node numbering in decimal format too.
> 
> Simple human-readable increments/IDs are usually decimal, hex is only for
> addresses as noted by Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>.
> 
> Let's use an improved match suggested by Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> and improved a bit by Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de>.
> 


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
Uwe Kleine-König Nov. 22, 2022, 1:38 p.m. UTC | #2
On Tue, Nov 22, 2022 at 02:32:24PM +0200, Tony Lindgren wrote:
> Let's allow node numbering in decimal format too.
> 
> Simple human-readable increments/IDs are usually decimal, hex is only for
> addresses as noted by Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>.
> 
> Let's use an improved match suggested by Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> and improved a bit by Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de>.
> 
> Cc: linux-pwm@vger.kernel.org
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Which tree should this merged through? The obvious candidates are pwm,
dt and omap.

Best regards
Uwe
Tony Lindgren Nov. 22, 2022, 1:41 p.m. UTC | #3
* Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [221122 13:28]:
> On Tue, Nov 22, 2022 at 02:32:24PM +0200, Tony Lindgren wrote:
> > Let's allow node numbering in decimal format too.
> > 
> > Simple human-readable increments/IDs are usually decimal, hex is only for
> > addresses as noted by Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>.
> > 
> > Let's use an improved match suggested by Krzysztof Kozlowski
> > <krzysztof.kozlowski@linaro.org> and improved a bit by Uwe Kleine-König
> > <u.kleine-koenig@pengutronix.de>.
> > 
> > Cc: linux-pwm@vger.kernel.org
> > Cc: Thierry Reding <thierry.reding@gmail.com>
> > Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> Which tree should this merged through? The obvious candidates are pwm,
> dt and omap.

The dt folks usually queue the binding patches separately.

Regards,

Tony
Uwe Kleine-König Nov. 22, 2022, 8:26 p.m. UTC | #4
Hello Tony,

On Tue, Nov 22, 2022 at 03:41:58PM +0200, Tony Lindgren wrote:
> * Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [221122 13:28]:
> > On Tue, Nov 22, 2022 at 02:32:24PM +0200, Tony Lindgren wrote:
> > > Let's allow node numbering in decimal format too.
> > > 
> > > Simple human-readable increments/IDs are usually decimal, hex is only for
> > > addresses as noted by Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>.
> > > 
> > > Let's use an improved match suggested by Krzysztof Kozlowski
> > > <krzysztof.kozlowski@linaro.org> and improved a bit by Uwe Kleine-König
> > > <u.kleine-koenig@pengutronix.de>.
> > > 
> > > Cc: linux-pwm@vger.kernel.org
> > > Cc: Thierry Reding <thierry.reding@gmail.com>
> > > Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > > Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > 
> > Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > 
> > Which tree should this merged through? The obvious candidates are pwm,
> > dt and omap.
> 
> The dt folks usually queue the binding patches separately.

fine, so I marked your series in the PWM patchwork as "handled-elsewhere".

Best regards
Uwe
Rob Herring (Arm) Nov. 23, 2022, 2:38 a.m. UTC | #5
On Tue, Nov 22, 2022 at 03:41:58PM +0200, Tony Lindgren wrote:
> * Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [221122 13:28]:
> > On Tue, Nov 22, 2022 at 02:32:24PM +0200, Tony Lindgren wrote:
> > > Let's allow node numbering in decimal format too.
> > > 
> > > Simple human-readable increments/IDs are usually decimal, hex is only for
> > > addresses as noted by Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>.
> > > 
> > > Let's use an improved match suggested by Krzysztof Kozlowski
> > > <krzysztof.kozlowski@linaro.org> and improved a bit by Uwe Kleine-König
> > > <u.kleine-koenig@pengutronix.de>.
> > > 
> > > Cc: linux-pwm@vger.kernel.org
> > > Cc: Thierry Reding <thierry.reding@gmail.com>
> > > Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > > Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > 
> > Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > 
> > Which tree should this merged through? The obvious candidates are pwm,
> > dt and omap.
> 
> The dt folks usually queue the binding patches separately.

The default is they go thru the subsystem trees, and I mainly pickup 
what has not after some time (and is standalone binding change).

Rob
Rob Herring (Arm) Nov. 23, 2022, 2:41 a.m. UTC | #6
On Tue, Nov 22, 2022 at 02:32:24PM +0200, Tony Lindgren wrote:
> Let's allow node numbering in decimal format too.
> 
> Simple human-readable increments/IDs are usually decimal, hex is only for
> addresses as noted by Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>.
> 
> Let's use an improved match suggested by Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> and improved a bit by Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de>.
> 
> Cc: linux-pwm@vger.kernel.org
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
> 
> Changes since v2:
> 
> - Use pattern suggested by Krzysztof and Uwe
> 
> Changes since v1:
> 
> - New patch added to deal with pwm-omap-dmtimer binding
> 
> ---
>  Documentation/devicetree/bindings/pwm/pwm.yaml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/pwm/pwm.yaml b/Documentation/devicetree/bindings/pwm/pwm.yaml
> --- a/Documentation/devicetree/bindings/pwm/pwm.yaml
> +++ b/Documentation/devicetree/bindings/pwm/pwm.yaml
> @@ -13,7 +13,7 @@ select: false
>  
>  properties:
>    $nodename:
> -    pattern: "^pwm(@.*|-[0-9a-f])*$"
> +    pattern: "^pwm(@.+|-[0-9a-f]+)?$"

So now pwm-10 could be either?

I'm fine with decimal, but can we do that everywhere we do this -N 
naming?

>  
>    "#pwm-cells":
>      description:
> -- 
> 2.38.1
>
Tony Lindgren Nov. 23, 2022, 6:58 a.m. UTC | #7
* Rob Herring <robh@kernel.org> [221123 02:31]:
> On Tue, Nov 22, 2022 at 02:32:24PM +0200, Tony Lindgren wrote:
> > Let's allow node numbering in decimal format too.
> > 
> > Simple human-readable increments/IDs are usually decimal, hex is only for
> > addresses as noted by Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>.
> > 
> > Let's use an improved match suggested by Krzysztof Kozlowski
> > <krzysztof.kozlowski@linaro.org> and improved a bit by Uwe Kleine-König
> > <u.kleine-koenig@pengutronix.de>.
> > 
> > Cc: linux-pwm@vger.kernel.org
> > Cc: Thierry Reding <thierry.reding@gmail.com>
> > Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > ---
> > 
> > Changes since v2:
> > 
> > - Use pattern suggested by Krzysztof and Uwe
> > 
> > Changes since v1:
> > 
> > - New patch added to deal with pwm-omap-dmtimer binding
> > 
> > ---
> >  Documentation/devicetree/bindings/pwm/pwm.yaml | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/pwm/pwm.yaml b/Documentation/devicetree/bindings/pwm/pwm.yaml
> > --- a/Documentation/devicetree/bindings/pwm/pwm.yaml
> > +++ b/Documentation/devicetree/bindings/pwm/pwm.yaml
> > @@ -13,7 +13,7 @@ select: false
> >  
> >  properties:
> >    $nodename:
> > -    pattern: "^pwm(@.*|-[0-9a-f])*$"
> > +    pattern: "^pwm(@.+|-[0-9a-f]+)?$"
> 
> So now pwm-10 could be either?

Yes.

> I'm fine with decimal, but can we do that everywhere we do this -N 
> naming?

Do you mean the '[0-9a-f]' users that don't use '[0-9af]+'?

These can be found with:

$ find Documentation/devicetree/bindings/ -name \*.yaml | \
	xargs grep pattern: | grep '\[0-9a-f\]' | grep -v '\[0-9a-f\]+'

Not sure if some of these need to intentionally limit the node numbering
to 15.

If you have some other criteria in mind, let me know :)

That sounds like a separate patch though.

Regards,

Tony
Rob Herring (Arm) Nov. 27, 2022, 6:22 p.m. UTC | #8
On Wed, Nov 23, 2022 at 08:58:54AM +0200, Tony Lindgren wrote:
> * Rob Herring <robh@kernel.org> [221123 02:31]:
> > On Tue, Nov 22, 2022 at 02:32:24PM +0200, Tony Lindgren wrote:
> > > Let's allow node numbering in decimal format too.
> > > 
> > > Simple human-readable increments/IDs are usually decimal, hex is only for
> > > addresses as noted by Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>.
> > > 
> > > Let's use an improved match suggested by Krzysztof Kozlowski
> > > <krzysztof.kozlowski@linaro.org> and improved a bit by Uwe Kleine-König
> > > <u.kleine-koenig@pengutronix.de>.
> > > 
> > > Cc: linux-pwm@vger.kernel.org
> > > Cc: Thierry Reding <thierry.reding@gmail.com>
> > > Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > > Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > > ---
> > > 
> > > Changes since v2:
> > > 
> > > - Use pattern suggested by Krzysztof and Uwe
> > > 
> > > Changes since v1:
> > > 
> > > - New patch added to deal with pwm-omap-dmtimer binding
> > > 
> > > ---
> > >  Documentation/devicetree/bindings/pwm/pwm.yaml | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/pwm/pwm.yaml b/Documentation/devicetree/bindings/pwm/pwm.yaml
> > > --- a/Documentation/devicetree/bindings/pwm/pwm.yaml
> > > +++ b/Documentation/devicetree/bindings/pwm/pwm.yaml
> > > @@ -13,7 +13,7 @@ select: false
> > >  
> > >  properties:
> > >    $nodename:
> > > -    pattern: "^pwm(@.*|-[0-9a-f])*$"
> > > +    pattern: "^pwm(@.+|-[0-9a-f]+)?$"
> > 
> > So now pwm-10 could be either?
> 
> Yes.
> 
> > I'm fine with decimal, but can we do that everywhere we do this -N 
> > naming?
> 
> Do you mean the '[0-9a-f]' users that don't use '[0-9af]+'?

No, I mean for all cases of <nodename>-N, can be we consistent. Either 
we use hex or we use decimal.
 
> 
> These can be found with:
> 
> $ find Documentation/devicetree/bindings/ -name \*.yaml | \
> 	xargs grep pattern: | grep '\[0-9a-f\]' | grep -v '\[0-9a-f\]+'

Not quite. It's just cases of '-N':

$ find Documentation/devicetree/bindings/ -name \*.yaml |         xargs grep pattern: | grep '\-\[0-9a-f\]' | grep -v '\[0-9a-f\]+'
Documentation/devicetree/bindings/phy/intel,combo-phy.yaml:    pattern: "combophy(@.*|-[0-9a-f])*$"
Documentation/devicetree/bindings/pwm/pwm.yaml:    pattern: "^pwm(@.*|-[0-9a-f])*$"
Documentation/devicetree/bindings/timestamp/hardware-timestamps-common.yaml:    pattern: "^timestamp(@.*|-[0-9a-f])?$"
Documentation/devicetree/bindings/watchdog/watchdog.yaml:    pattern: "^watchdog(@.*|-[0-9a-f])?$"
Documentation/devicetree/bindings/spi/spi-controller.yaml:    pattern: "^spi(@.*|-[0-9a-f])*$"
Documentation/devicetree/bindings/rtc/rtc.yaml:    pattern: "^rtc(@.*|-[0-9a-f])*$"


And there's probably some more in dtschema.

> 
> Not sure if some of these need to intentionally limit the node numbering
> to 15.

No, I think it was all just cases of 15 should be enough for anyone.

> 
> If you have some other criteria in mind, let me know :)

If the numbering is hex, then it is as you have it. (Though we can't 
enforce that.

If it is decimal, then the regex should be ([0-9]|[1-9][0-9]+). 

Rob
Tony Lindgren Jan. 13, 2023, 7:06 a.m. UTC | #9
Hi Rob,

* Rob Herring <robh@kernel.org> [221127 18:22]:
> On Wed, Nov 23, 2022 at 08:58:54AM +0200, Tony Lindgren wrote:
> > * Rob Herring <robh@kernel.org> [221123 02:31]:
> > > On Tue, Nov 22, 2022 at 02:32:24PM +0200, Tony Lindgren wrote:
> > > > --- a/Documentation/devicetree/bindings/pwm/pwm.yaml
> > > > +++ b/Documentation/devicetree/bindings/pwm/pwm.yaml
> > > > @@ -13,7 +13,7 @@ select: false
> > > >  
> > > >  properties:
> > > >    $nodename:
> > > > -    pattern: "^pwm(@.*|-[0-9a-f])*$"
> > > > +    pattern: "^pwm(@.+|-[0-9a-f]+)?$"
> > > 
> > > So now pwm-10 could be either?
> > 
> > Yes.
> > 
> > > I'm fine with decimal, but can we do that everywhere we do this -N 
> > > naming?
> > 
> > Do you mean the '[0-9a-f]' users that don't use '[0-9af]+'?
> 
> No, I mean for all cases of <nodename>-N, can be we consistent. Either 
> we use hex or we use decimal.
>  
> > 
> > These can be found with:
> > 
> > $ find Documentation/devicetree/bindings/ -name \*.yaml | \
> > 	xargs grep pattern: | grep '\[0-9a-f\]' | grep -v '\[0-9a-f\]+'
> 
> Not quite. It's just cases of '-N':
> 
> $ find Documentation/devicetree/bindings/ -name \*.yaml |         xargs grep pattern: | grep '\-\[0-9a-f\]' | grep -v '\[0-9a-f\]+'
> Documentation/devicetree/bindings/phy/intel,combo-phy.yaml:    pattern: "combophy(@.*|-[0-9a-f])*$"
> Documentation/devicetree/bindings/pwm/pwm.yaml:    pattern: "^pwm(@.*|-[0-9a-f])*$"
> Documentation/devicetree/bindings/timestamp/hardware-timestamps-common.yaml:    pattern: "^timestamp(@.*|-[0-9a-f])?$"
> Documentation/devicetree/bindings/watchdog/watchdog.yaml:    pattern: "^watchdog(@.*|-[0-9a-f])?$"
> Documentation/devicetree/bindings/spi/spi-controller.yaml:    pattern: "^spi(@.*|-[0-9a-f])*$"
> Documentation/devicetree/bindings/rtc/rtc.yaml:    pattern: "^rtc(@.*|-[0-9a-f])*$"
> 
> 
> And there's probably some more in dtschema.

Looking at this again, not exactly sure still what you want..

Can you please post some initial patch maybe, verbal patches are
a bit tricky :)

Regards,

Tony
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/pwm/pwm.yaml b/Documentation/devicetree/bindings/pwm/pwm.yaml
--- a/Documentation/devicetree/bindings/pwm/pwm.yaml
+++ b/Documentation/devicetree/bindings/pwm/pwm.yaml
@@ -13,7 +13,7 @@  select: false
 
 properties:
   $nodename:
-    pattern: "^pwm(@.*|-[0-9a-f])*$"
+    pattern: "^pwm(@.+|-[0-9a-f]+)?$"
 
   "#pwm-cells":
     description: