devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomasz Figa <tomasz.figa@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: mark.rutland@arm.com, heiko@sntech.de,
	Tomasz Figa <t.figa@samsung.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: Sat, 06 Apr 2013 00:24:18 +0200	[thread overview]
Message-ID: <2359597.ofbj7Kvioz@flatron> (raw)
In-Reply-To: <201304052154.21361.arnd@arndb.de>

On Friday 05 of April 2013 21:54:21 Arnd Bergmann wrote:
> On Friday 05 April 2013, Tomasz Figa wrote:
> > > I don't think anyone ever suggested using a private API though.
> > 
> > I must have gotten the last paragraph of
> > http://article.gmane.org/gmane.linux.kernel.samsung-soc/16638
> > wrong then. For me it seemed like the timer driver would expose a
> > private API to the PWM driver.
> 
> Yes, sorry I wasn't clear enough. I meant a register-level interface
> exposed from the base driver, not a high-level interface like you
> did.

I'm not sure what you mean by a register-level interface. Something like 
samsung_pwm_update_reg(reg, mask, val), which modifies bitfields according 
to the mask and value with appropriate synchronization? If yes, this 
solves only the problem of access to shared registers.

The other problems that remain:

- negotiation of PWM channels to use for clock source and clock events,
  because each board can use different channels for PWM outputs,

- code duplication caused by both of the drivers doing mostly the same
  things and or having to parse the same data from device tree,

- both non-DT and DT platforms must be supported,

- how to keep the ability to load PWM driver as a module (or not load it
  at all when PWM is not used on particular board), while retaining
  everything that is needed for the clocksource driver in kernel,

- some platforms can't use PWM timers as system clocksources, while on
  others this is the only timekeeping hardware available.

> > > I think
> > > it's ok if the driver lives in drivers/mfd when it doesn't fit
> > > anywhere
> > > else easily, but you should really register it to the pwm subsystem
> > > to
> > > expose that functionality, not export functions that can be used by
> > > a pwm shim driver, which even seems to be missing from the series.
> > 
> > Anyway, using PWM API in a clocksource driver that needs to be running
> > very early (before any initcalls get called) seems a bit weird for
> > me, especially when PWM API doesn't provide such fine grained control
> > over PWM timers that is required in the clocksource drivers.
> 
> Exactly, that's why you should have a regular PWM driver that gets
> loaded at a convenient time and just uses an interface exported by the
> base driver to access the common registers.

Well, this is basically what my patches do, except that the PWM driver 
isn't reworked to use the base driver yet.

The private API exported to the samsung-time and pwm-samsung drivers isn't 
maybe the most fortunate one, but it clearly has the advantage of solving 
all the problems I mentioned before.

Same goes for calling this an MFD driver. It doesn't even use the MFD 
core, but there seems to be no better place to put it. Maybe 
drivers/platform/arm would be better, if it existed, just as currently 
available drivers/platform/x86?

Best regards,
Tomasz

  reply	other threads:[~2013-04-05 22:24 UTC|newest]

Thread overview: 29+ 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 ` [PATCH v4 01/14] ARM: SAMSUNG: Move samsung-time to drivers/clocksource 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:37 ` [PATCH v4 03/14] clocksource: samsung-time: Use local register definitions Tomasz Figa
2013-04-04 16:37 ` [PATCH v4 04/14] mfd: Add Samsung PWM/timer master driver Tomasz Figa
2013-04-05 16:39   ` Samuel Ortiz
2013-04-05 16:53     ` Tomasz Figa
2013-04-05 17:05       ` Arnd Bergmann
2013-04-05 17:35         ` Tomasz Figa
2013-04-05 19:54           ` Arnd Bergmann
2013-04-05 22:24             ` Tomasz Figa [this message]
2013-04-08 16:53               ` Tomasz Figa
2013-04-10 22:35                 ` Arnd Bergmann
2013-04-11 16:28                   ` Mark Brown
2013-04-11 16:44                   ` Tomasz Figa
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 ` [PATCH v4 06/14] ARM: SAMSUNG: Add new PWM platform device Tomasz Figa
2013-04-04 16:37 ` [PATCH v4 07/14] ARM: SAMSUNG: Set PWM platform data 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 ` [PATCH v4 09/14] clocksource: samsung-time: Use variant data to get SoC-specific bits 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 ` [PATCH v4 11/14] clocksource: samsung-time: Use clk_prepare_enable 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 ` [PATCH v4 13/14] clocksource: samsung-time: Move IRQ mask/ack handling to the driver 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 23:15 ` [PATCH v4 00/14] ARM: samsung-time: Prepare for multiplatform support Heiko Stübner
2013-04-05 10:33   ` 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=2359597.ofbj7Kvioz@flatron \
    --to=tomasz.figa@gmail.com \
    --cc=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 \
    /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 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).