All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: Thierry Reding
	<thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	Matthias Kaehlcke
	<matthias-RprLehDfhQ3k1uMJSBkQmQ@public.gmane.org>,
	Kurt Van Dijck <kurt.van.dijck-/BeEPy95v10@public.gmane.org>,
	Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
	Grant Likely
	<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
	Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
	Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
	Richard Purdie <rpurdie-Fm38FmjxZ/leoWH0uzbU5w@public.gmane.org>,
	Mark Brown
	<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
	Mitch Bradley <wmb-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>,
	Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>,
	Eric Miao <eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>,
	Ryan Mallon <rmallon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH v3 03/10] of: Add PWM support.
Date: Fri, 24 Feb 2012 16:58:31 +0000	[thread overview]
Message-ID: <201202241658.32062.arnd@arndb.de> (raw)
In-Reply-To: <20120224064749.GB18786-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>

On Friday 24 February 2012, Thierry Reding wrote:
> * Arnd Bergmann wrote:
> > On Thursday 23 February 2012, Thierry Reding wrote:
> > > * Arnd Bergmann wrote:

> [...]
> > > > * Why not include the pwm_request() call in this and return the
> > > >   pwm_device directly? You said that you want to get rid of the
> > > >   pwm_id eventually, which is a good idea, but this interface still
> > > >   forces one to use it.
> > > 
> > > Okay, that sounds sensible. I propose to rename the function to something like
> > > of_request_pwm().
> > 
> > Sounds good.

On second thought, I would actually prefer starting the name with pwm_ and
making it independent of device tree. There might be other ways how to
find the pwm_device from a struct device in the future, but it should always
be possible using a device together with a string and/or numeric identifier,
much in the same way that we can get a resource from a platform_device.

Ideally, there would be a common theme behind finding a memory region,
irq, gpio pin, clock, regulator, dma-channel and pwm or anything else
that requires a link between two device nodes.

> > > It would of course need an additional parameter (name) to
> > > forward to pwm_request().
> > 
> > Not necessarily, it could use the dev_name(device) or the name
> > of the property, or a combination of the two.
> 
> The problem with that is that usually the device would be named something
> generic like "pwm", while in case where the PWM is used for the backlight
> it makes sense to label the PWM device "backlight".
> 
> Looking at debugfs and seeing an entry "backlight" is much more straight-
> forward than "pwm.0". I mean "pwm.0" doesn't carry any useful information
> really, does it?

But the device name would be from the device using the pwm, not the
pwm controller, so it should be something more helpful, no?

> > > > > +EXPORT_SYMBOL(of_get_named_pwm);
> > > > 
> > > > EXPORT_SYMBOL_GPL?
> > > 
> > > It was brought up at some point that it might be nice to allow non-GPL
> > > drivers to use the PWM framework as well. I don't remember any discussion
> > > resulting from the comment. Perhaps we should have that discussion now and
> > > decide whether or not we want to keep it GPL-only or not.
> > 
> > I would definitely use EXPORT_SYMBOL_GPL for all new code unless it
> > replaces an earlier interface that was available as EXPORT_SYMBOL.
> 
> I just grepped the code and noticed this:
> 
> 	$ $ git grep -n 'EXPORT_SYMBOL.*(pwm_request)'
> 	arch/arm/mach-vt8500/pwm.c:139:EXPORT_SYMBOL(pwm_request);
> 	arch/arm/plat-mxc/pwm.c:183:EXPORT_SYMBOL(pwm_request);
> 	arch/arm/plat-samsung/pwm.c:83:EXPORT_SYMBOL(pwm_request);
> 	arch/unicore32/kernel/pwm.c:132:EXPORT_SYMBOL(pwm_request);
> 	drivers/mfd/twl6030-pwm.c:156:EXPORT_SYMBOL(pwm_request);
> 	drivers/misc/ab8500-pwm.c:108:EXPORT_SYMBOL(pwm_request);
> 	drivers/pwm/core.c:262:EXPORT_SYMBOL_GPL(pwm_request);
> 
> It seems like the legacy PWM API used to be non-GPL. Should I switch it back?
> Also does it make sense to have something like of_request_pwm() GPL when the
> rest of the API isn't?

I guess the choice is to make between you and Sascha. The implementation is
new, so you could pick EXPORT_SYMBOL_GPL, but you could also try to
keep to the current API.

	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 03/10] of: Add PWM support.
Date: Fri, 24 Feb 2012 16:58:31 +0000	[thread overview]
Message-ID: <201202241658.32062.arnd@arndb.de> (raw)
In-Reply-To: <20120224064749.GB18786@avionic-0098.mockup.avionic-design.de>

On Friday 24 February 2012, Thierry Reding wrote:
> * Arnd Bergmann wrote:
> > On Thursday 23 February 2012, Thierry Reding wrote:
> > > * Arnd Bergmann wrote:

> [...]
> > > > * Why not include the pwm_request() call in this and return the
> > > >   pwm_device directly? You said that you want to get rid of the
> > > >   pwm_id eventually, which is a good idea, but this interface still
> > > >   forces one to use it.
> > > 
> > > Okay, that sounds sensible. I propose to rename the function to something like
> > > of_request_pwm().
> > 
> > Sounds good.

On second thought, I would actually prefer starting the name with pwm_ and
making it independent of device tree. There might be other ways how to
find the pwm_device from a struct device in the future, but it should always
be possible using a device together with a string and/or numeric identifier,
much in the same way that we can get a resource from a platform_device.

Ideally, there would be a common theme behind finding a memory region,
irq, gpio pin, clock, regulator, dma-channel and pwm or anything else
that requires a link between two device nodes.

> > > It would of course need an additional parameter (name) to
> > > forward to pwm_request().
> > 
> > Not necessarily, it could use the dev_name(device) or the name
> > of the property, or a combination of the two.
> 
> The problem with that is that usually the device would be named something
> generic like "pwm", while in case where the PWM is used for the backlight
> it makes sense to label the PWM device "backlight".
> 
> Looking at debugfs and seeing an entry "backlight" is much more straight-
> forward than "pwm.0". I mean "pwm.0" doesn't carry any useful information
> really, does it?

But the device name would be from the device using the pwm, not the
pwm controller, so it should be something more helpful, no?

> > > > > +EXPORT_SYMBOL(of_get_named_pwm);
> > > > 
> > > > EXPORT_SYMBOL_GPL?
> > > 
> > > It was brought up at some point that it might be nice to allow non-GPL
> > > drivers to use the PWM framework as well. I don't remember any discussion
> > > resulting from the comment. Perhaps we should have that discussion now and
> > > decide whether or not we want to keep it GPL-only or not.
> > 
> > I would definitely use EXPORT_SYMBOL_GPL for all new code unless it
> > replaces an earlier interface that was available as EXPORT_SYMBOL.
> 
> I just grepped the code and noticed this:
> 
> 	$ $ git grep -n 'EXPORT_SYMBOL.*(pwm_request)'
> 	arch/arm/mach-vt8500/pwm.c:139:EXPORT_SYMBOL(pwm_request);
> 	arch/arm/plat-mxc/pwm.c:183:EXPORT_SYMBOL(pwm_request);
> 	arch/arm/plat-samsung/pwm.c:83:EXPORT_SYMBOL(pwm_request);
> 	arch/unicore32/kernel/pwm.c:132:EXPORT_SYMBOL(pwm_request);
> 	drivers/mfd/twl6030-pwm.c:156:EXPORT_SYMBOL(pwm_request);
> 	drivers/misc/ab8500-pwm.c:108:EXPORT_SYMBOL(pwm_request);
> 	drivers/pwm/core.c:262:EXPORT_SYMBOL_GPL(pwm_request);
> 
> It seems like the legacy PWM API used to be non-GPL. Should I switch it back?
> Also does it make sense to have something like of_request_pwm() GPL when the
> rest of the API isn't?

I guess the choice is to make between you and Sascha. The implementation is
new, so you could pick EXPORT_SYMBOL_GPL, but you could also try to
keep to the current API.

	Arnd

  parent reply	other threads:[~2012-02-24 16:58 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-22 15:17 [PATCH v3 00/10] Add PWM framework and device tree support Thierry Reding
2012-02-22 15:17 ` Thierry Reding
     [not found] ` <1329923841-32017-1-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-02-22 15:17   ` [PATCH v3 01/10] PWM: add pwm framework support Thierry Reding
2012-02-22 15:17     ` Thierry Reding
2012-02-22 15:17   ` [PATCH v3 02/10] pwm: Allow chips to support multiple PWMs Thierry Reding
2012-02-22 15:17     ` Thierry Reding
     [not found]     ` <1329923841-32017-3-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-02-22 16:34       ` Arnd Bergmann
2012-02-22 16:34         ` Arnd Bergmann
     [not found]         ` <201202221634.45159.arnd-r2nGTMty4D4@public.gmane.org>
2012-02-23  8:12           ` Thierry Reding
2012-02-23  8:12             ` Thierry Reding
     [not found]             ` <20120223081235.GC8621-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-02-23 14:07               ` Arnd Bergmann
2012-02-23 14:07                 ` Arnd Bergmann
     [not found]                 ` <201202231407.12981.arnd-r2nGTMty4D4@public.gmane.org>
2012-02-23 16:04                   ` Thierry Reding
2012-02-23 16:04                     ` Thierry Reding
     [not found]                     ` <20120223160420.GA9899-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-03-03 19:32                       ` Thierry Reding
2012-03-03 19:32                         ` Thierry Reding
     [not found]                         ` <20120303193249.GA22021-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-03-06 15:38                           ` Arnd Bergmann
2012-03-06 15:38                             ` Arnd Bergmann
     [not found]                             ` <201203061538.11709.arnd-r2nGTMty4D4@public.gmane.org>
2012-03-06 19:17                               ` Thierry Reding
2012-03-06 19:17                                 ` Thierry Reding
2012-02-22 15:17   ` [PATCH v3 03/10] of: Add PWM support Thierry Reding
2012-02-22 15:17     ` Thierry Reding
     [not found]     ` <1329923841-32017-4-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-02-22 16:15       ` Arnd Bergmann
2012-02-22 16:15         ` Arnd Bergmann
     [not found]         ` <201202221615.11605.arnd-r2nGTMty4D4@public.gmane.org>
2012-02-23  7:55           ` Thierry Reding
2012-02-23  7:55             ` Thierry Reding
     [not found]             ` <20120223075537.GB8621-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-02-23 14:03               ` Arnd Bergmann
2012-02-23 14:03                 ` Arnd Bergmann
     [not found]                 ` <201202231403.01614.arnd-r2nGTMty4D4@public.gmane.org>
2012-02-24  6:47                   ` Thierry Reding
2012-02-24  6:47                     ` Thierry Reding
     [not found]                     ` <20120224064749.GB18786-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-02-24 16:58                       ` Arnd Bergmann [this message]
2012-02-24 16:58                         ` Arnd Bergmann
     [not found]                         ` <201202241658.32062.arnd-r2nGTMty4D4@public.gmane.org>
2012-02-25 12:33                           ` Sascha Hauer
2012-02-25 12:33                             ` Sascha Hauer
     [not found]                             ` <20120225123357.GU3852-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-02-25 23:08                               ` Ryan Mallon
2012-02-25 23:08                                 ` Ryan Mallon
2012-02-22 15:17   ` [PATCH v3 04/10] arm/tegra: Fix PWM clock programming Thierry Reding
2012-02-22 15:17     ` Thierry Reding
     [not found]     ` <1329923841-32017-5-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-02-28 21:01       ` Stephen Warren
2012-02-28 21:01         ` Stephen Warren
     [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF17BDDF1E52-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2012-03-03 22:47           ` Thierry Reding
2012-03-03 22:47             ` Thierry Reding
     [not found]             ` <20120303224751.GB6661-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-03-05 17:33               ` Stephen Warren
2012-03-05 17:33                 ` Stephen Warren
2012-02-22 15:17   ` [PATCH v3 05/10] arm/tegra: Provide clock for only one PWM controller Thierry Reding
2012-02-22 15:17     ` Thierry Reding
2012-02-22 15:17   ` [PATCH v3 06/10] pwm: Add NVIDIA Tegra SoC support Thierry Reding
2012-02-22 15:17     ` Thierry Reding
     [not found]     ` <1329923841-32017-7-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-02-23  1:47       ` Ryan Mallon
2012-02-23  1:47         ` Ryan Mallon
     [not found]         ` <4F459A94.4030104-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-02-23  8:14           ` Thierry Reding
2012-02-23  8:14             ` Thierry Reding
     [not found]             ` <20120223081459.GD8621-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-02-23  9:25               ` Ryan Mallon
2012-02-23  9:25                 ` Ryan Mallon
     [not found]                 ` <4F460616.3080400-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-02-24  6:48                   ` Thierry Reding
2012-02-24  6:48                     ` Thierry Reding
2012-02-28 21:14       ` Stephen Warren
2012-02-28 21:14         ` Stephen Warren
     [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF17BDDF1E63-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2012-03-03 22:42           ` Thierry Reding
2012-03-03 22:42             ` Thierry Reding
     [not found]             ` <20120303224212.GA6661-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-03-05  3:39               ` Olof Johansson
2012-03-05  3:39                 ` Olof Johansson
     [not found]                 ` <20120305033935.GA32675-O5ziIzlqnXUVNXGz7ipsyg@public.gmane.org>
2012-03-05  7:00                   ` Thierry Reding
2012-03-05  7:00                     ` Thierry Reding
2012-02-22 15:17   ` [PATCH v3 08/10] pwm: Add Blackfin support Thierry Reding
2012-02-22 15:17     ` Thierry Reding
2012-02-22 15:17   ` [PATCH v3 09/10] pwm: Add PXA support Thierry Reding
2012-02-22 15:17     ` Thierry Reding
     [not found]     ` <1329923841-32017-10-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-02-22 15:40       ` Arnd Bergmann
2012-02-22 15:40         ` Arnd Bergmann
     [not found]         ` <201202221540.16897.arnd-r2nGTMty4D4@public.gmane.org>
2012-02-23  6:10           ` Thierry Reding
2012-02-23  6:10             ` Thierry Reding
2012-02-22 15:17   ` [PATCH v3 10/10] pwm-backlight: Add rudimentary device tree support Thierry Reding
2012-02-22 15:17     ` Thierry Reding
2012-02-22 16:02   ` [PATCH v3 00/10] Add PWM framework and " Arnd Bergmann
2012-02-22 16:02     ` Arnd Bergmann
     [not found]     ` <201202221602.09116.arnd-r2nGTMty4D4@public.gmane.org>
2012-02-23  7:29       ` Thierry Reding
2012-02-23  7:29         ` Thierry Reding
2012-02-22 15:17 ` [PATCH v3 07/10] arm/tegra: Add PWFM controller device tree probing Thierry Reding
2012-02-22 15:17   ` Thierry Reding
     [not found]   ` <1329923841-32017-8-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-02-28 21:20     ` Stephen Warren
2012-02-28 21:20       ` Stephen Warren
     [not found]       ` <74CDBE0F657A3D45AFBB94109FB122FF17BDDF1E67-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2012-03-03 22:54         ` Thierry Reding
2012-03-03 22:54           ` Thierry Reding
     [not found]           ` <20120303225404.GC6661-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-03-04 20:39             ` Arnd Bergmann
2012-03-04 20:39               ` Arnd Bergmann
2012-03-05 17:51             ` Stephen Warren
2012-03-05 17:51               ` Stephen Warren
     [not found]               ` <74CDBE0F657A3D45AFBB94109FB122FF17BE861C46-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2012-03-05 18:15                 ` Thierry Reding
2012-03-05 18:15                   ` Thierry Reding
     [not found]                   ` <20120305181555.GA22459-RM9K5IK7kjIyiCvfTdI0JKcOhU4Rzj621B7CTYaBSLdn68oJJulU0Q@public.gmane.org>
2012-03-05 18:39                     ` Stephen Warren
2012-03-05 18:39                       ` Stephen Warren

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=201202241658.32062.arnd@arndb.de \
    --to=arnd-r2ngtmty4d4@public.gmane.org \
    --cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
    --cc=ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=kurt.van.dijck-/BeEPy95v10@public.gmane.org \
    --cc=lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matthias-RprLehDfhQ3k1uMJSBkQmQ@public.gmane.org \
    --cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
    --cc=rmallon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
    --cc=rpurdie-Fm38FmjxZ/leoWH0uzbU5w@public.gmane.org \
    --cc=s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org \
    --cc=vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org \
    --cc=wmb-D5eQfiDGL7eakBO8gow8eQ@public.gmane.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.