linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Use of the pwm-names DT property
@ 2012-07-04  6:53 Alex Courbot
  2012-07-04  7:39 ` Thierry Reding
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Courbot @ 2012-07-04  6:53 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel@vger.kernel.org, devicetree-discuss@lists.ozlabs.org

Hi Thierry,

Looking at your PWM/DT integration patches for linux-next, I was 
wondering what is the rationale behind using the pwm-names property. If 
I got it correctly, its purpose is to be able to reference different 
PWMs by name, e.g. by having

	pwms = <&pwm 0 5000000>, <&pwm 1 5000000>;
	pwm-names = "backlight", "flash";

You could get the first PWM in the driver code by calling pwm_get(dev, 
"backlight") and the second through pwm_get(dev, "flash").

While I am ok with this way of doing, why not having the form that is 
already used by the regulator and gpio frameworks, in which the consumer 
is part of the property name?

	vdd-supply = <&vdd_reg>;
	core-supply = <&core_reg>;

Both regulators are then accessed using regulator_get(dev, "vdd") and 
regulator_get(dev, "core").

Wouldn't it make more sense to follow the same scheme that has been 
popularized by other frameworks? It also has the advantage that you do 
not need to maintain two different properties which must be the same size.

Thanks,
Alex.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Use of the pwm-names DT property
  2012-07-04  6:53 Use of the pwm-names DT property Alex Courbot
@ 2012-07-04  7:39 ` Thierry Reding
  2012-07-04  7:48   ` Alex Courbot
  0 siblings, 1 reply; 3+ messages in thread
From: Thierry Reding @ 2012-07-04  7:39 UTC (permalink / raw)
  To: Alex Courbot
  Cc: linux-kernel@vger.kernel.org, devicetree-discuss@lists.ozlabs.org

[-- Attachment #1: Type: text/plain, Size: 1547 bytes --]

On Wed, Jul 04, 2012 at 03:53:22PM +0900, Alex Courbot wrote:
> Hi Thierry,
> 
> Looking at your PWM/DT integration patches for linux-next, I was
> wondering what is the rationale behind using the pwm-names property.
> If I got it correctly, its purpose is to be able to reference
> different PWMs by name, e.g. by having
> 
> 	pwms = <&pwm 0 5000000>, <&pwm 1 5000000>;
> 	pwm-names = "backlight", "flash";
> 
> You could get the first PWM in the driver code by calling
> pwm_get(dev, "backlight") and the second through pwm_get(dev,
> "flash").

Yes, that's the way it is supposed to work.

> While I am ok with this way of doing, why not having the form that
> is already used by the regulator and gpio frameworks, in which the
> consumer is part of the property name?
> 
> 	vdd-supply = <&vdd_reg>;
> 	core-supply = <&core_reg>;
> 
> Both regulators are then accessed using regulator_get(dev, "vdd")
> and regulator_get(dev, "core").
> 
> Wouldn't it make more sense to follow the same scheme that has been
> popularized by other frameworks? It also has the advantage that you
> do not need to maintain two different properties which must be the
> same size.

In fact the *-names properties are rather common. They are used for the
reg and interrupts properties. The pinctrl subsystem and the upcoming
clock bindings also use the *-names properties. So one could just as
well argue that the regulator and gpio bindings should have been using
regulator-names and gpio-names respectively instead.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Use of the pwm-names DT property
  2012-07-04  7:39 ` Thierry Reding
@ 2012-07-04  7:48   ` Alex Courbot
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Courbot @ 2012-07-04  7:48 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel@vger.kernel.org, devicetree-discuss@lists.ozlabs.org

On Wed 04 Jul 2012 04:39:42 PM JST, Thierry Reding wrote:
> In fact the *-names properties are rather common. They are used for the
> reg and interrupts properties. The pinctrl subsystem and the upcoming
> clock bindings also use the *-names properties. So one could just as
> well argue that the regulator and gpio bindings should have been using
> regulator-names and gpio-names respectively instead.

I was not aware of that, thanks for the explanation. Too bad the DT is 
already split in two different ways for naming things.

Alex.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-07-04  7:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-04  6:53 Use of the pwm-names DT property Alex Courbot
2012-07-04  7:39 ` Thierry Reding
2012-07-04  7:48   ` Alex Courbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).