All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Tomasz Figa <t.figa@samsung.com>
Cc: mark.rutland@arm.com, heiko@sntech.de,
	Tomasz Figa <tomasz.figa@gmail.com>,
	buserror@gmail.com, jacmet@sunsite.dk, augulis.darius@gmail.com,
	christer@weinigel.se, sylvester.nawrocki@gmail.com,
	m.szyprowski@samsung.com, kgene.kim@samsung.com,
	linux@arm.linux.org.uk, Samuel Ortiz <sameo@linux.intel.com>,
	kwangwoo.lee@gmail.com, mcuelenaere@gmail.com,
	devicetree-discuss@lists.ozlabs.org,
	linux-samsung-soc@vger.kernel.org, john.stultz@linaro.org,
	ghcstop@gmail.com, linux@simtec.co.uk,
	linux-arm-kernel@lists.infradead.org,
	broonie@opensource.wolfsonmicro.com, jekhor@gmail.com,
	kyungmin.park@samsung.com, tglx@linutronix.de
Subject: Re: [PATCH v4 04/14] mfd: Add Samsung PWM/timer master driver
Date: Thu, 11 Apr 2013 23:08:13 +0200	[thread overview]
Message-ID: <201304112308.14181.arnd@arndb.de> (raw)
In-Reply-To: <1718887.H9vPuvORKd@amdc1227>

On Thursday 11 April 2013, Tomasz Figa wrote:
> On Thursday 11 of April 2013 00:35:47 Arnd Bergmann wrote:
> > On Monday 08 April 2013, Tomasz Figa wrote:
> > > On Saturday 06 of April 2013 00:24:18 Tomasz Figa wrote:
> > > > On Friday 05 of April 2013 21:54:21 Arnd Bergmann wrote:
> > > > > On Friday 05 April 2013, Tomasz Figa wrote:
> > 
> > Sorry for not replying earlier. My idea for the register level interface
> > was to create a platform_device for each PWM, e.g. using the mfd_cell
> > infrastructure. You can then pass a "struct regmap" as the platform
> > data for each child of the timer node, and all the DT handling code
> > can stay in the parent driver.
> 
> Hmm. As I said, I'm completely fine with using a regmap for sharing registers 
> between subdrivers. However the clocksource can not be registered as an MFD 
> cell, because it's needed very early.
> 
> I can imagine a solution alternative to my original one, where the MFD cells 
> would be registered from the clocksource driver. This would mean that 
> platforms that don't need (and can't use) the PWM clocksource would have to 
> enable the driver anyway.

Sounds ok to me. The main part I want to avoid is having two separate device
nodes in the DT for one physical device, but there are multiple ways to get
there.

> Another thing is that I don't see a need to create one cell per PWM channel. 
> The PWM core is designed in a way that supports multiple channels per PWM 
> controller and so is the generic PWM DT specifier (<&controller channel period 
> flags>), so I'd rather see a single cell for all PWM channels.

Sure, no problem with that.

> So, to summarize this alternative concept:
>  - two drivers:
>    1) clocksource driver - registering clocksource and PWM MFD cell
>    2) PWM driver - handling the PWM MFD cell

Ok. Don't be too tied to the MFD concept though if it causes problems.
In many cases calling platform_device_register_resndata or similar is
actually easier than MFD, especially if you only want a single child
device. Either way is fine though.

>  - both drivers would share registers using a regmap with custom lock/unlock 
>    callbacks (using spin_lock_irqsave/spin_unlock_irqrestore, because the 
>    clocksource needs to access PWM registers in IRQ context)

Ok.

>  - the clocksource/master driver would have a samsung_time_init function which 
>    would set up the driver early and initialize the clocksource

Right. If you want to use the clocksource_of_init() infratstructure for this
(which is probably a good idea), please base your series on top of the
clksrc/cleanup branch in arm-soc.

>  - a platform driver would be registered by the clocksource/master driver
>    which would register the PWM MFD cell in its probe.

This seems unnecessary, if the only purpose of the platform driver is to
export the MFD cell. In that case, I would actually suggest a simpler model
where the PWM driver registers the main platform driver directly and
calls a function exported by the clocksource driver to get the regmap
structure and anything else it may need (possibly initializing the driver
in the case where it is not used as the clocksource but only provides
the registers for PWM).

>  - MFD cell platform data would contain struct regmap * and variant data
>    (parsed from DT or received from platform code - as in my original version)

Yes, either the MFD cell, or the exported symbol, whichever ends up easier.

> This should indeed work, assuming that I find a solution to make 
> clocksource_of_init not initialize the PWM clocksource (from PWM DT node) on 
> platforms that can't use it.

Right. If anything else comes up, I'd suggest we discuss it on IRC (#armlinux
on irc.freenode.net) tomorrow for faster round-trip, or I can call you on
the phone if you like. I'm available all day tomorrow, just send me your
(landline) phone number by private email.

	Arnd.

WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 04/14] mfd: Add Samsung PWM/timer master driver
Date: Thu, 11 Apr 2013 23:08:13 +0200	[thread overview]
Message-ID: <201304112308.14181.arnd@arndb.de> (raw)
In-Reply-To: <1718887.H9vPuvORKd@amdc1227>

On Thursday 11 April 2013, Tomasz Figa wrote:
> On Thursday 11 of April 2013 00:35:47 Arnd Bergmann wrote:
> > On Monday 08 April 2013, Tomasz Figa wrote:
> > > On Saturday 06 of April 2013 00:24:18 Tomasz Figa wrote:
> > > > On Friday 05 of April 2013 21:54:21 Arnd Bergmann wrote:
> > > > > On Friday 05 April 2013, Tomasz Figa wrote:
> > 
> > Sorry for not replying earlier. My idea for the register level interface
> > was to create a platform_device for each PWM, e.g. using the mfd_cell
> > infrastructure. You can then pass a "struct regmap" as the platform
> > data for each child of the timer node, and all the DT handling code
> > can stay in the parent driver.
> 
> Hmm. As I said, I'm completely fine with using a regmap for sharing registers 
> between subdrivers. However the clocksource can not be registered as an MFD 
> cell, because it's needed very early.
> 
> I can imagine a solution alternative to my original one, where the MFD cells 
> would be registered from the clocksource driver. This would mean that 
> platforms that don't need (and can't use) the PWM clocksource would have to 
> enable the driver anyway.

Sounds ok to me. The main part I want to avoid is having two separate device
nodes in the DT for one physical device, but there are multiple ways to get
there.

> Another thing is that I don't see a need to create one cell per PWM channel. 
> The PWM core is designed in a way that supports multiple channels per PWM 
> controller and so is the generic PWM DT specifier (<&controller channel period 
> flags>), so I'd rather see a single cell for all PWM channels.

Sure, no problem with that.

> So, to summarize this alternative concept:
>  - two drivers:
>    1) clocksource driver - registering clocksource and PWM MFD cell
>    2) PWM driver - handling the PWM MFD cell

Ok. Don't be too tied to the MFD concept though if it causes problems.
In many cases calling platform_device_register_resndata or similar is
actually easier than MFD, especially if you only want a single child
device. Either way is fine though.

>  - both drivers would share registers using a regmap with custom lock/unlock 
>    callbacks (using spin_lock_irqsave/spin_unlock_irqrestore, because the 
>    clocksource needs to access PWM registers in IRQ context)

Ok.

>  - the clocksource/master driver would have a samsung_time_init function which 
>    would set up the driver early and initialize the clocksource

Right. If you want to use the clocksource_of_init() infratstructure for this
(which is probably a good idea), please base your series on top of the
clksrc/cleanup branch in arm-soc.

>  - a platform driver would be registered by the clocksource/master driver
>    which would register the PWM MFD cell in its probe.

This seems unnecessary, if the only purpose of the platform driver is to
export the MFD cell. In that case, I would actually suggest a simpler model
where the PWM driver registers the main platform driver directly and
calls a function exported by the clocksource driver to get the regmap
structure and anything else it may need (possibly initializing the driver
in the case where it is not used as the clocksource but only provides
the registers for PWM).

>  - MFD cell platform data would contain struct regmap * and variant data
>    (parsed from DT or received from platform code - as in my original version)

Yes, either the MFD cell, or the exported symbol, whichever ends up easier.

> This should indeed work, assuming that I find a solution to make 
> clocksource_of_init not initialize the PWM clocksource (from PWM DT node) on 
> platforms that can't use it.

Right. If anything else comes up, I'd suggest we discuss it on IRC (#armlinux
on irc.freenode.net) tomorrow for faster round-trip, or I can call you on
the phone if you like. I'm available all day tomorrow, just send me your
(landline) phone number by private email.

	Arnd.

  reply	other threads:[~2013-04-11 21:08 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-04 16:36 [PATCH v4 00/14] ARM: samsung-time: Prepare for multiplatform support Tomasz Figa
2013-04-04 16:36 ` Tomasz Figa
2013-04-04 16:36 ` [PATCH v4 01/14] ARM: SAMSUNG: Move samsung-time to drivers/clocksource Tomasz Figa
2013-04-04 16:36   ` Tomasz Figa
2013-04-04 16:36 ` [PATCH v4 02/14] clocksource: samsung-time: Drop useless defines from public header Tomasz Figa
2013-04-04 16:36   ` Tomasz Figa
2013-04-04 16:37 ` [PATCH v4 03/14] clocksource: samsung-time: Use local register definitions Tomasz Figa
2013-04-04 16:37   ` Tomasz Figa
2013-04-04 16:37 ` [PATCH v4 04/14] mfd: Add Samsung PWM/timer master driver Tomasz Figa
2013-04-04 16:37   ` Tomasz Figa
2013-04-05 16:39   ` Samuel Ortiz
2013-04-05 16:39     ` Samuel Ortiz
2013-04-05 16:53     ` Tomasz Figa
2013-04-05 16:53       ` Tomasz Figa
2013-04-05 17:05       ` Arnd Bergmann
2013-04-05 17:05         ` Arnd Bergmann
2013-04-05 17:35         ` Tomasz Figa
2013-04-05 17:35           ` Tomasz Figa
2013-04-05 19:54           ` Arnd Bergmann
2013-04-05 19:54             ` Arnd Bergmann
2013-04-05 22:24             ` Tomasz Figa
2013-04-05 22:24               ` Tomasz Figa
2013-04-08 16:53               ` Tomasz Figa
2013-04-08 16:53                 ` Tomasz Figa
2013-04-10 22:35                 ` Arnd Bergmann
2013-04-10 22:35                   ` Arnd Bergmann
2013-04-11 16:28                   ` Mark Brown
2013-04-11 16:28                     ` Mark Brown
2013-04-11 16:44                   ` Tomasz Figa
2013-04-11 16:44                     ` Tomasz Figa
2013-04-11 21:08                     ` Arnd Bergmann [this message]
2013-04-11 21:08                       ` Arnd Bergmann
2013-04-04 16:37 ` [PATCH v4 05/14] ARM: SAMSUNG: Unify base address definitions of timer block Tomasz Figa
2013-04-04 16:37   ` Tomasz Figa
2013-04-04 16:37 ` [PATCH v4 06/14] ARM: SAMSUNG: Add new PWM platform device Tomasz Figa
2013-04-04 16:37   ` Tomasz Figa
2013-04-04 16:37 ` [PATCH v4 07/14] ARM: SAMSUNG: Set PWM platform data Tomasz Figa
2013-04-04 16:37   ` Tomasz Figa
2013-04-04 16:37 ` [PATCH v4 08/14] clocksource: samsung-time: Use Samsung PWM/timer master driver Tomasz Figa
2013-04-04 16:37   ` Tomasz Figa
2013-04-04 16:37 ` [PATCH v4 09/14] clocksource: samsung-time: Use variant data to get SoC-specific bits Tomasz Figa
2013-04-04 16:37   ` Tomasz Figa
2013-04-04 16:37 ` [PATCH v4 10/14] clocksource: samsung-time: Use master driver to configure dividers Tomasz Figa
2013-04-04 16:37   ` Tomasz Figa
2013-04-04 16:37 ` [PATCH v4 11/14] clocksource: samsung-time: Use clk_prepare_enable Tomasz Figa
2013-04-04 16:37   ` Tomasz Figa
2013-04-04 16:37 ` [PATCH v4 12/14] clocksource: samsung-time: Use master driver to control PWM channels Tomasz Figa
2013-04-04 16:37   ` Tomasz Figa
2013-04-04 16:37 ` [PATCH v4 13/14] clocksource: samsung-time: Move IRQ mask/ack handling to the driver Tomasz Figa
2013-04-04 16:37   ` Tomasz Figa
2013-04-04 16:37 ` [PATCH v4 14/14] ARM: SAMSUNG: Remove unused PWM timer IRQ chip code Tomasz Figa
2013-04-04 16:37   ` Tomasz Figa
2013-04-04 23:15 ` [PATCH v4 00/14] ARM: samsung-time: Prepare for multiplatform support Heiko Stübner
2013-04-04 23:15   ` Heiko Stübner
2013-04-05 10:33   ` Tomasz Figa
2013-04-05 10:33     ` Tomasz Figa
2013-04-05 22:57 ` Tomasz Figa
2013-04-05 22:57   ` Tomasz Figa

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=201304112308.14181.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=augulis.darius@gmail.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=buserror@gmail.com \
    --cc=christer@weinigel.se \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=ghcstop@gmail.com \
    --cc=heiko@sntech.de \
    --cc=jacmet@sunsite.dk \
    --cc=jekhor@gmail.com \
    --cc=john.stultz@linaro.org \
    --cc=kgene.kim@samsung.com \
    --cc=kwangwoo.lee@gmail.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=linux@simtec.co.uk \
    --cc=m.szyprowski@samsung.com \
    --cc=mark.rutland@arm.com \
    --cc=mcuelenaere@gmail.com \
    --cc=sameo@linux.intel.com \
    --cc=sylvester.nawrocki@gmail.com \
    --cc=t.figa@samsung.com \
    --cc=tglx@linutronix.de \
    --cc=tomasz.figa@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.