From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
linux-sh@vger.kernel.org, linux-leds@vger.kernel.org,
linux-kernel@vger.kernel.org, Magnus Damm <magnus.damm@gmail.com>,
Paul Mundt <lethal@linux-sh.org>
Subject: Re: [PATCH v2 04/11] pwm: Add Renesas TPU PWM driver
Date: Thu, 13 Jun 2013 15:32:22 +0000 [thread overview]
Message-ID: <6125284.6vELCtAL9N@avalon> (raw)
In-Reply-To: <20130612100647.GA30841@mithrandir>
[-- Attachment #1: Type: text/plain, Size: 2204 bytes --]
Hi Thierry,
On Wednesday 12 June 2013 12:06:49 Thierry Reding wrote:
> On Wed, May 29, 2013 at 05:48:50PM +0200, Laurent Pinchart wrote:
> > On Thursday 23 May 2013 23:45:17 Thierry Reding wrote:
> > > On Wed, Apr 24, 2013 at 10:50:09PM +0200, Laurent Pinchart wrote:
> [...]
>
> > > > +struct tpu_device {
> > > > + struct platform_device *pdev;
> > > > + struct pwm_chip chip;
> > > > + spinlock_t lock;
> > > > +
> > > > + void __iomem *base;
> > > > + struct clk *clk;
> > > > +
> > > > + struct tpu_pwm_device pwms[TPU_CHANNEL_MAX];
> > > > +};
> > >
> > > Can't you reuse the infrastructure built into the PWM subsystem? You can
> > > associate chip-specific data with each PWM device. You can look at the
> > > pwm-atmel-tcb and pwm-bfin drivers for usage examples. In a nutshell you
> > > hook the .request() function and setup the driver-specific structure and
> > > associate them with the PWM using pwm_set_chip_data().
> > >
> > > This has the advantage that you don't need the pwms array in tpu_device
> > > and you also don't need TPU_CHANNEL_MAX because only the pwm_chip.npwm
> > > field needs to contain the number of channels.
> >
> > I've actually thought about that, but decided not to do so. It looked
> > pretty weird to allocate PWM devices at .request() time, so I decided to
> > allocate the devices once only at probe time. Is it considered better to
> > allocate/free PWM devices every time they're requested/released ?
>
> Well, I consider it better because it postpones memory allocation until
> it is actually used. Typically requesting a PWM device happens at probe
> time of other drivers so it isn't actually as bad as it may sound. Also
> allocating at request time allows you to easily associate the data with
> the PWM device using pwm_set_chip_data(), which was intended to be used
> for exactly this purpose.
>
> Doing so will keep the driver-specific data in a well-defined location
> instead of putting it somewhere driver-specific.
OK, I'll try to fix that. For now I'll still need to expose TPU_CHANNEL_MAX to
boards for polarity configuration in platform data. That will go away when all
users will be converted to DT.
--
Regards,
Laurent Pinchart
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
linux-sh@vger.kernel.org, linux-leds@vger.kernel.org,
linux-kernel@vger.kernel.org, Magnus Damm <magnus.damm@gmail.com>,
Paul Mundt <lethal@linux-sh.org>
Subject: Re: [PATCH v2 04/11] pwm: Add Renesas TPU PWM driver
Date: Thu, 13 Jun 2013 17:32:22 +0200 [thread overview]
Message-ID: <6125284.6vELCtAL9N@avalon> (raw)
In-Reply-To: <20130612100647.GA30841@mithrandir>
[-- Attachment #1: Type: text/plain, Size: 2204 bytes --]
Hi Thierry,
On Wednesday 12 June 2013 12:06:49 Thierry Reding wrote:
> On Wed, May 29, 2013 at 05:48:50PM +0200, Laurent Pinchart wrote:
> > On Thursday 23 May 2013 23:45:17 Thierry Reding wrote:
> > > On Wed, Apr 24, 2013 at 10:50:09PM +0200, Laurent Pinchart wrote:
> [...]
>
> > > > +struct tpu_device {
> > > > + struct platform_device *pdev;
> > > > + struct pwm_chip chip;
> > > > + spinlock_t lock;
> > > > +
> > > > + void __iomem *base;
> > > > + struct clk *clk;
> > > > +
> > > > + struct tpu_pwm_device pwms[TPU_CHANNEL_MAX];
> > > > +};
> > >
> > > Can't you reuse the infrastructure built into the PWM subsystem? You can
> > > associate chip-specific data with each PWM device. You can look at the
> > > pwm-atmel-tcb and pwm-bfin drivers for usage examples. In a nutshell you
> > > hook the .request() function and setup the driver-specific structure and
> > > associate them with the PWM using pwm_set_chip_data().
> > >
> > > This has the advantage that you don't need the pwms array in tpu_device
> > > and you also don't need TPU_CHANNEL_MAX because only the pwm_chip.npwm
> > > field needs to contain the number of channels.
> >
> > I've actually thought about that, but decided not to do so. It looked
> > pretty weird to allocate PWM devices at .request() time, so I decided to
> > allocate the devices once only at probe time. Is it considered better to
> > allocate/free PWM devices every time they're requested/released ?
>
> Well, I consider it better because it postpones memory allocation until
> it is actually used. Typically requesting a PWM device happens at probe
> time of other drivers so it isn't actually as bad as it may sound. Also
> allocating at request time allows you to easily associate the data with
> the PWM device using pwm_set_chip_data(), which was intended to be used
> for exactly this purpose.
>
> Doing so will keep the driver-specific data in a well-defined location
> instead of putting it somewhere driver-specific.
OK, I'll try to fix that. For now I'll still need to expose TPU_CHANNEL_MAX to
boards for polarity configuration in platform data. That will go away when all
users will be converted to DT.
--
Regards,
Laurent Pinchart
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
next prev parent reply other threads:[~2013-06-13 15:32 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-24 20:50 [PATCH v2 00/11] Renesas TPU PWM support Laurent Pinchart
2013-04-24 20:50 ` Laurent Pinchart
2013-04-24 20:50 ` [PATCH v2 01/11] sh-pfc: sh73a0: Add TPU pin groups and functions Laurent Pinchart
2013-04-24 20:50 ` Laurent Pinchart
2013-04-24 20:50 ` [PATCH v2 02/11] sh-pfc: r8a7740: " Laurent Pinchart
2013-04-24 20:50 ` Laurent Pinchart
2013-04-24 20:50 ` [PATCH v2 03/11] sh-pfc: r8a7790: " Laurent Pinchart
2013-04-24 20:50 ` Laurent Pinchart
2013-04-24 20:50 ` [PATCH v2 04/11] pwm: Add Renesas TPU PWM driver Laurent Pinchart
2013-04-24 20:50 ` Laurent Pinchart
2013-05-23 21:45 ` Thierry Reding
2013-05-23 21:45 ` Thierry Reding
2013-05-29 15:48 ` Laurent Pinchart
2013-05-29 15:48 ` Laurent Pinchart
2013-06-12 10:06 ` Thierry Reding
2013-06-12 10:06 ` Thierry Reding
2013-06-13 15:32 ` Laurent Pinchart [this message]
2013-06-13 15:32 ` Laurent Pinchart
2013-04-24 20:50 ` [PATCH v2 05/11] ARM: mach-shmobile: clock-r8a7740: add TPU PWM support Laurent Pinchart
2013-04-24 20:50 ` Laurent Pinchart
2013-04-24 20:50 ` [PATCH v2 06/11] ARM: mach-shmobile: clock-r8a7790: " Laurent Pinchart
2013-04-24 20:50 ` Laurent Pinchart
2013-04-24 20:50 ` [PATCH v2 07/11] ARM: mach-shmobile: armadillo800eva: Add backlight support Laurent Pinchart
2013-04-24 20:50 ` Laurent Pinchart
2013-04-24 20:50 ` [PATCH v2 08/11] ARM: mach-shmobile: kota2: Use leds-pwm + pwm-rmob Laurent Pinchart
2013-04-24 20:50 ` Laurent Pinchart
2013-04-24 20:50 ` [PATCH v2 09/11] sh-pfc: sh73a0: Remove function GPIOs Laurent Pinchart
2013-04-24 20:50 ` Laurent Pinchart
2013-04-24 20:50 ` [PATCH v2 10/11] ARM: shmobile: sh73a0: Remove all GPIOs Laurent Pinchart
2013-04-24 20:50 ` Laurent Pinchart
2013-04-24 20:50 ` [PATCH v2 11/11] leds: Remove leds-renesas-tpu driver Laurent Pinchart
2013-04-24 20:50 ` Laurent Pinchart
2013-04-24 20:59 ` Bryan Wu
2013-04-24 20:59 ` Bryan Wu
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=6125284.6vELCtAL9N@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=thierry.reding@gmail.com \
/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.