devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Turquette <mturquette@linaro.org>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	Mark Rutland <mark.rutland@arm.com>
Cc: Tomasz Figa <tomasz.figa@gmail.com>,
	Nicolin Chen <b42378@freescale.com>,
	"ian.campbell@citrix.com" <ian.campbell@citrix.com>,
	Pawel Moll <Pawel.Moll@arm.com>,
	"galak@codeaurora.org" <galak@codeaurora.org>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"lars@metafoo.de" <lars@metafoo.de>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"timur@tabi.org" <timur@tabi.org>,
	"rob.herring@calxeda.com" <rob.herring@calxeda.com>,
	"shawn.guo@linaro.org" <shawn.guo@linaro.org>,
	"festevam@gmail.com" <festevam@gmail.com>,
	"swarren@wwwdotorg.org" <swarren@wwwdotorg.org>
Subject: Re: [PATCH v5 1/2] ASoC: fsl: Add S/PDIF CPU DAI driver
Date: Thu, 22 Aug 2013 15:43:31 -0700	[thread overview]
Message-ID: <20130822224331.8231.75743@quantum> (raw)
In-Reply-To: <20130822210035.GB31036@pengutronix.de>

Quoting Sascha Hauer (2013-08-22 14:00:35)
> On Thu, Aug 22, 2013 at 01:09:31PM +0100, Mark Rutland wrote:
> > On Thu, Aug 22, 2013 at 08:19:10AM +0100, Mike Turquette wrote:
> > > Quoting Tomasz Figa (2013-08-21 14:34:55)
> > > > On Wednesday 21 of August 2013 09:50:15 Mark Rutland wrote:
> > > > > On Tue, Aug 20, 2013 at 01:06:25AM +0100, Mike Turquette wrote:
> > > > > > Quoting Mark Rutland (2013-08-19 02:35:43)
> > > > > > 
> > > > > > > On Sat, Aug 17, 2013 at 04:17:18PM +0100, Tomasz Figa wrote:
> > > > > > > > On Saturday 17 of August 2013 16:53:16 Sascha Hauer wrote:
> > > > > > > > > On Sat, Aug 17, 2013 at 02:28:04PM +0200, Tomasz Figa wrote:
> > > > > > > > > > > > > Also I would make this option required. Use a dummy
> > > > > > > > > > > > > clock for
> > > > > > > > > > > > > mux
> > > > > > > > > > > > > inputs that are grounded for a specific SoC.
> > > > > > > > > > > > 
> > > > > > > > > > > > Some clocks are not from CCM and we haven't defined in
> > > > > > > > > > > > imx6q-clk.txt,
> > > > > > > > > > > > so in most cases we can't provide a phandle for them, eg:
> > > > > > > > > > > > spdif_ext.
> > > > > > > > > > > > I think it's a bit hard to force it to be 'required'. An
> > > > > > > > > > > > 'optional'
> > > > > > > > > > > > looks more flexible to me and a default one is ensured
> > > > > > > > > > > > even if
> > > > > > > > > > > > it's
> > > > > > > > > > > > missing.
> > > > > > > > > > > 
> > > > > > > > > > > <&clks 0> is the dummy clock. This can be used for all input
> > > > > > > > > > > clocks
> > > > > > > > > > > not
> > > > > > > > > > > defined by the SoC.
> > > > > > > > > > 
> > > > > > > > > > Where does this assumption come from? Is it documented
> > > > > > > > > > anywhere?
> > > > > > > > > 
> > > > > > > > > This is how all i.MX clock bindings currently are. See
> > > > > > > > > Documentation/devicetree/bindings/clock/imx*-clock.txt
> > > > > > > > 
> > > > > > > > OK, thanks.
> > > > > > > > 
> > > > > > > > I guess we need some discussion on dummy clocks vs skipped clocks.
> > > > > > > > I think we want some consistency on this, don't we?
> > > > > > > > 
> > > > > > > > If we really need a dummy clock, then we might also want a generic
> > > > > > > > way to specify it.
> > > > > > > 
> > > > > > > What do we actually mean by a "dummy clock"? We already have
> > > > > > > bindings
> > > > > > > for "fixed-clock" and co friends describe relatively simple
> > > > > > > preconfigured clocks.
> > > > > > 
> > > > > > Some platforms have a fake clock which defines noops callbacks and
> > > > > > basically doesn't do anything. This is analogous to the dummy
> > > > > > regulator
> > > > > > implementation. A central one could be registered by the clock core,
> > > > > > as
> > > > > > is done by the regulator core.
> > > > > 
> > > > > When you say some platforms, you presumably mean the platform code in
> > > > > Linux? A dummy clock sounds like a completely Linux-specific abstraction
> > > > > rather than a description of the hardware, and I don't see why we need
> > > > > that in the DT:
> > > > > 
> > > > > * If a clock is wired up and running (as presumably the dummy clock is),
> > > > > then surely it's a fixed-clock (it's running, we and we have no control
> > > > > over it, but we presumably know its rate) and can be described as such?
> > > > > 
> > > > > * If no clock is wired up, then we should be able to describe that. If a
> > > > > driver believes that a clock is required when it isn't (for some level
> > > > > of functionality), then that driver should be fixed up to support the
> > > > > clock as being optional.
> > > > > 
> > > > > Am I missing something?
> > > > 
> > > > I second that.
> > > > 
> > > > Moreover, I don't think that device tree should deal with dummy anything. 
> > > > It should be able to describe hardware that is available on given system, 
> > > > not list what hardware is not available.
> > > 
> > > I wasn't clear. The dummy clock IS a completely Linux-specific
> > > abstraction.
> > > 
> > > I'm not advocating a dummy clock in DT. I am advocating consolidation of
> > > the implementation of a clock that does nothing into the clock core.
> > > This code could easily live in drivers/clk/clk.c instead of having
> > > everyone open-code it.
> > > 
> > > As far as specifying a dummy clock in DT? I dunno. DT should describe
> > > real hardware so there isn't much use for a dummy clock.
> > 
> > 
> > Sorry, I misunderstood. Good to hear we're on the same page :)
> > 
> > > 
> > > I'm guessing one of the reasons for such a clock are drivers do not
> > > honor the clk.h api and they freak out when clk_get gives them a NULL
> > > pointer?
> > 
> > I'm not sure. Sascha, could you shed some light on the matter?
> 
> The original reason introducing the dummy clocks in the i.MX dtbs
> was to provide devices a clock which the driver requests but is
> not software controllable. We often have the case where the same
> devices are on several SoCs, but not on all of them all clocks have
> a bit to en/disable them.
> 
> Anyway, to accomplish this we don't need dummy clocks. We can just
> describe the real clocks.

You could use a dummy clk for the Linux implementation, but the downside
is that a dummy clock has a rate of 0 always and a your clocks likely
have non-zero rates.

It is probably better for you define a clock which only implements the
.recalc_rate callback. If the rate of this clock changes without Linux
having knowledge of it you can use the CLK_GET_RATE_NOCACHE flag.

> 
> BTW with the S/PDIF core on which not all mux inputs are connected
> to actual clocks we could also describe the unconnected inputs as
> ground clocks with rate 0. This way we describe something which
> is really there instead of dummy clocks ;)

Again you could use a dummy clock for this OR a fixed-rate clock with a
rate of zero from the perspective of the Linux implementation.

Do you think it worthwhile to have a DT binding for a grounded clock?
That is not an entirely uncommon case.

> 
> Background to why it might be a good idea to connect a ground clock
> to the unconnected input pins is that a driver has a chance to
> successfully grab all clocks. Otherwise how does the driver distinguish
> between an unconnected and an erroneous clock?

Sorry, I don't follow this last question. Do you mean how to distinguish
based on the value returned from clk_get?

Regards,
Mike

> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2013-08-22 22:43 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-15 11:26 [PATCH v5 0/2] Add freescale S/PDIF CPU DAI and machine drivers Nicolin Chen
2013-08-15 11:26 ` [PATCH v5 1/2] ASoC: fsl: Add S/PDIF CPU DAI driver Nicolin Chen
2013-08-15 12:18   ` Tomasz Figa
     [not found]     ` <20130816044330.GD1846@MrMyself>
2013-08-17 12:56       ` Tomasz Figa
2013-08-17 15:14         ` Sascha Hauer
2013-08-17 15:38           ` Tomasz Figa
2013-08-15 11:26 ` [PATCH v5 2/2] ASoC: fsl: Add S/PDIF machine driver Nicolin Chen
     [not found] ` <20130816080124.GE1846@MrMyself>
     [not found]   ` <20130816085632.GO26614@pengutronix.de>
2013-08-17 12:26     ` [PATCH v5 1/2] ASoC: fsl: Add S/PDIF CPU DAI driver Tomasz Figa
2013-08-17 15:00       ` Sascha Hauer
2013-08-17 15:13         ` Tomasz Figa
2013-08-17 15:14           ` Sascha Hauer
     [not found] ` <20130816095357.GA4694@MrMyself>
     [not found]   ` <20130816101151.GQ26614@pengutronix.de>
2013-08-17 12:28     ` Tomasz Figa
2013-08-17 14:53       ` Sascha Hauer
2013-08-17 15:17         ` Tomasz Figa
2013-08-19  9:35           ` Mark Rutland
2013-08-20  0:06             ` Mike Turquette
2013-08-21  8:50               ` Mark Rutland
2013-08-21 21:34                 ` Tomasz Figa
2013-08-22  7:19                   ` Mike Turquette
2013-08-22 12:09                     ` Mark Rutland
2013-08-22 21:00                       ` Sascha Hauer
2013-08-22 22:43                         ` Mike Turquette [this message]
2013-08-22 22:49                           ` Tomasz Figa
2013-08-23  6:34                             ` Sascha Hauer
2013-08-23 12:58                               ` Mark Rutland
2013-08-23 14:01                                 ` [alsa-devel] " Sascha Hauer
2013-08-23 14:57                                   ` Mark Rutland
2013-08-23 21:41                                   ` Mike Turquette
2013-08-24  0:20                                     ` Mark Brown
2013-08-23 12:44                         ` Mark Rutland

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=20130822224331.8231.75743@quantum \
    --to=mturquette@linaro.org \
    --cc=Pawel.Moll@arm.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=b42378@freescale.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=galak@codeaurora.org \
    --cc=ian.campbell@citrix.com \
    --cc=lars@metafoo.de \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mark.rutland@arm.com \
    --cc=p.zabel@pengutronix.de \
    --cc=rob.herring@calxeda.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawn.guo@linaro.org \
    --cc=swarren@wwwdotorg.org \
    --cc=timur@tabi.org \
    --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 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).