All of lore.kernel.org
 help / color / mirror / Atom feed
From: thierry.reding@avionic-design.de (Thierry Reding)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] PWM: vt8500: Update vt8500 PWM driver support
Date: Tue, 23 Oct 2012 11:56:25 +0200	[thread overview]
Message-ID: <20121023095625.GA2062@avionic-0098.mockup.avionic-design.de> (raw)
In-Reply-To: <20121023093128.GR21164@n2100.arm.linux.org.uk>

On Tue, Oct 23, 2012 at 10:31:28AM +0100, Russell King - ARM Linux wrote:
> On Tue, Oct 23, 2012 at 11:22:47AM +0200, Thierry Reding wrote:
> > On Tue, Oct 23, 2012 at 09:41:46PM +1300, Tony Prisk wrote:
> > > Further to the discussion, my preference is still for of_clk_get()
> > > (although I've changed the patch anyway as you saw because it makes no
> > > difference in this case) :)
> > > 
> > > clk_get(x, NULL) and devm_clk_get(x, NULL) both seems like 'hacks' to
> > > allow platforms to convert to DT without having to update all their
> > > drivers first. It only allows the first (default) clock, as your pointed
> > > out. Getting a 2nd... clock relies on an optional property in DT (which
> > > again, seems like it is there to support 'old' drivers) which allows you
> > > to request clocks by name.
> > > 
> > > of_clk_get() on the other hand seems like a properly native DT function.
> > > You don't need to know anything about the clock, as long as the correct
> > > clock is specified in the correct order as documented by the binding.
> > > Relying on 'pre-OF' code for a OF-only driver also seems
> > > counter-intuitive.
> > 
> > I do agree with those arguments. What I was saying is that for drivers
> > which aren't DT only, of_clk_get() is not an option and that maybe
> > others would be encouraged by the example to not use the generic APIs
> > even if their driver could be used in non-DT setups. But maybe I'm
> > worrying needlessly.
> > 
> > That said, maybe somebody with a broader view of things like Arnd
> > (Cc'ed) could share his thoughts.
> 
> As I have already said, the way the DT bindings were done for the clk
> stuff was wrong.  A little thought put into it would've come up with
> a much better solution which wouldn't have needed of_clk_get() at all.
> 
> How?
> 
> The arguments for clk_get() are:
> 1. the struct device, which you can get the OF-node from.
> 2. a _device_ _specific_ _clock_ _input_ _name_ (or NULL if there's only
>    one.)
> 
> So, we have something that defines a hardware clock input name, which
> can be used to generate a property name for OF.  So, what _could_ have
> been done is this:
> 
> 	clock-<input-name> = <&provider-node clk-output-index>;
> 
> where the property name is generated by:
> 
> 	snprintf(prop, sizeof(prop), "clk-%s", name ? name : "default");

But we already have this, only with slightly different syntax:

	clocks = <&provider foo-index>, <&provider bar-index>;
	clock-names = "foo", "bar";

> So I continue to assert that our current design is wrong - and it will
> cause driver authors to pointlessly have to make a choice at every stage
> between DT and non-DT based systems.

I think the reason that Tony brought this up is that with this API, the
clock-names property becomes mandatory if you have more than one input
clock.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121023/49c2972a/attachment-0001.sig>

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@avionic-design.de>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Tony Prisk <linux@prisktech.co.nz>,
	devicetree-discuss@lists.ozlabs.org, arm@kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH 2/3] PWM: vt8500: Update vt8500 PWM driver support
Date: Tue, 23 Oct 2012 11:56:25 +0200	[thread overview]
Message-ID: <20121023095625.GA2062@avionic-0098.mockup.avionic-design.de> (raw)
In-Reply-To: <20121023093128.GR21164@n2100.arm.linux.org.uk>

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

On Tue, Oct 23, 2012 at 10:31:28AM +0100, Russell King - ARM Linux wrote:
> On Tue, Oct 23, 2012 at 11:22:47AM +0200, Thierry Reding wrote:
> > On Tue, Oct 23, 2012 at 09:41:46PM +1300, Tony Prisk wrote:
> > > Further to the discussion, my preference is still for of_clk_get()
> > > (although I've changed the patch anyway as you saw because it makes no
> > > difference in this case) :)
> > > 
> > > clk_get(x, NULL) and devm_clk_get(x, NULL) both seems like 'hacks' to
> > > allow platforms to convert to DT without having to update all their
> > > drivers first. It only allows the first (default) clock, as your pointed
> > > out. Getting a 2nd... clock relies on an optional property in DT (which
> > > again, seems like it is there to support 'old' drivers) which allows you
> > > to request clocks by name.
> > > 
> > > of_clk_get() on the other hand seems like a properly native DT function.
> > > You don't need to know anything about the clock, as long as the correct
> > > clock is specified in the correct order as documented by the binding.
> > > Relying on 'pre-OF' code for a OF-only driver also seems
> > > counter-intuitive.
> > 
> > I do agree with those arguments. What I was saying is that for drivers
> > which aren't DT only, of_clk_get() is not an option and that maybe
> > others would be encouraged by the example to not use the generic APIs
> > even if their driver could be used in non-DT setups. But maybe I'm
> > worrying needlessly.
> > 
> > That said, maybe somebody with a broader view of things like Arnd
> > (Cc'ed) could share his thoughts.
> 
> As I have already said, the way the DT bindings were done for the clk
> stuff was wrong.  A little thought put into it would've come up with
> a much better solution which wouldn't have needed of_clk_get() at all.
> 
> How?
> 
> The arguments for clk_get() are:
> 1. the struct device, which you can get the OF-node from.
> 2. a _device_ _specific_ _clock_ _input_ _name_ (or NULL if there's only
>    one.)
> 
> So, we have something that defines a hardware clock input name, which
> can be used to generate a property name for OF.  So, what _could_ have
> been done is this:
> 
> 	clock-<input-name> = <&provider-node clk-output-index>;
> 
> where the property name is generated by:
> 
> 	snprintf(prop, sizeof(prop), "clk-%s", name ? name : "default");

But we already have this, only with slightly different syntax:

	clocks = <&provider foo-index>, <&provider bar-index>;
	clock-names = "foo", "bar";

> So I continue to assert that our current design is wrong - and it will
> cause driver authors to pointlessly have to make a choice at every stage
> between DT and non-DT based systems.

I think the reason that Tony brought this up is that with this API, the
clock-names property becomes mandatory if you have more than one input
clock.

Thierry

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

  reply	other threads:[~2012-10-23  9:56 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-19 10:38 [PATCH 1/3] ARM: dts: Update board files for pwm support Tony Prisk
2012-10-19 10:38 ` Tony Prisk
2012-10-19 10:38 ` [PATCH 2/3] PWM: vt8500: Update vt8500 PWM driver support Tony Prisk
2012-10-19 10:38   ` Tony Prisk
2012-10-19 10:38   ` Tony Prisk
2012-10-22  6:34   ` Thierry Reding
2012-10-22  6:34     ` Thierry Reding
2012-10-22  6:51     ` Tony Prisk
2012-10-22  6:51       ` Tony Prisk
2012-10-22  7:09       ` Tony Prisk
2012-10-22  7:09         ` Tony Prisk
2012-10-22  7:09         ` Tony Prisk
2012-10-22  7:24         ` Thierry Reding
2012-10-22  7:24           ` Thierry Reding
2012-10-22  7:24           ` Thierry Reding
2012-10-22  7:36           ` Tony Prisk
2012-10-22  7:36             ` Tony Prisk
2012-10-22  8:04             ` Thierry Reding
2012-10-22  8:04               ` Thierry Reding
2012-10-22  8:13               ` [PATCH v2] pwm: " Tony Prisk
2012-10-22  8:13                 ` Tony Prisk
2012-10-22  8:13                 ` Tony Prisk
2012-10-22  8:40                 ` Thierry Reding
2012-10-22  8:40                   ` Thierry Reding
2012-10-22 18:10                   ` [PATCH v3] " Tony Prisk
2012-10-22 18:10                     ` Tony Prisk
2012-10-23 22:14                     ` Thierry Reding
2012-10-23 22:14                       ` Thierry Reding
2012-10-24  3:46                       ` Tony Prisk
2012-10-24  3:46                         ` Tony Prisk
2012-10-24  5:41                         ` Thierry Reding
2012-10-24  5:41                           ` Thierry Reding
2012-10-24 17:35                           ` Tony Prisk
2012-10-24 17:35                             ` Tony Prisk
2012-10-24  3:48                       ` Tony Prisk
2012-10-24  3:48                         ` Tony Prisk
2012-10-23  8:41               ` [PATCH 2/3] PWM: " Tony Prisk
2012-10-23  8:41                 ` Tony Prisk
2012-10-23  9:22                 ` Thierry Reding
2012-10-23  9:22                   ` Thierry Reding
2012-10-23  9:22                   ` Thierry Reding
2012-10-23  9:31                   ` Russell King - ARM Linux
2012-10-23  9:31                     ` Russell King - ARM Linux
2012-10-23  9:31                     ` Russell King - ARM Linux
2012-10-23  9:56                     ` Thierry Reding [this message]
2012-10-23  9:56                       ` Thierry Reding
2012-10-22  7:11       ` Thierry Reding
2012-10-22  7:11         ` Thierry Reding
2012-10-22 11:50         ` Arnd Bergmann
2012-10-22 11:50           ` Arnd Bergmann
2012-10-22 12:07           ` Thierry Reding
2012-10-22 12:07             ` Thierry Reding
2012-10-22 13:52             ` Arnd Bergmann
2012-10-22 13:52               ` Arnd Bergmann
2012-10-22 13:52               ` Arnd Bergmann
2012-10-22 15:08               ` Thierry Reding
2012-10-22 15:08                 ` Thierry Reding
2012-10-22 15:08                 ` Thierry Reding
2012-10-22 17:49                 ` Tony Prisk
2012-10-22 17:49                   ` Tony Prisk
2012-10-19 10:38 ` [PATCH 3/3] DOC: PWM: Adding binding document for via,vt8500-pwm Tony Prisk
2012-10-19 10:38   ` Tony Prisk
2012-10-19 10:38   ` Tony Prisk
2012-10-22  6:35   ` Thierry Reding
2012-10-22  6:35     ` Thierry Reding
2012-10-22  6:53     ` Tony Prisk
2012-10-22  6:53       ` Tony Prisk
2012-10-19 22:37 ` [PATCH 1/3] ARM: dts: Update board files for pwm support Tony Prisk
2012-10-19 22:37   ` Tony Prisk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121023095625.GA2062@avionic-0098.mockup.avionic-design.de \
    --to=thierry.reding@avionic-design.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.