devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: mturquette@baylibre.com, cw00.choi@samsung.com,
	lee.jones@linaro.org, myungjoo.ham@samsung.com,
	devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	patches@opensource.wolfsonmicro.com
Subject: Re: [PATCH v3 2/4] clk: arizona: Add clock driver for the Arizona devices
Date: Mon, 9 May 2016 11:47:28 +0100	[thread overview]
Message-ID: <20160509104728.GG1646@localhost.localdomain> (raw)
In-Reply-To: <20160507005501.GN3492@codeaurora.org>

On Fri, May 06, 2016 at 05:55:01PM -0700, Stephen Boyd wrote:
> I've applied this to clk-next but still have a question, see
> below.
> 
> On 01/08, Charles Keepax wrote:
> > diff --git a/drivers/clk/clk-arizona.c b/drivers/clk/clk-arizona.c
> > new file mode 100644
> > index 0000000..eaf2877
> > --- /dev/null
> > +++ b/drivers/clk/clk-arizona.c
> > +
> > +static int arizona_clk_of_get_pdata(struct arizona *arizona)
> > +{
> > +	const char * const pins[] = { "mclk1", "mclk2" };
> > +	struct clk *mclk;
> > +	int i;
> > +
> > +	if (!of_property_read_bool(arizona->dev->of_node, "clocks"))
> > +		return 0;
> > +
> > +	for (i = 0; i < ARRAY_SIZE(pins); ++i) {
> > +		mclk = of_clk_get_by_name(arizona->dev->of_node, pins[i]);
> > +		if (IS_ERR(mclk))
> > +			return PTR_ERR(mclk);
> > +
> > +		if (clk_get_rate(mclk) == CLK32K_RATE) {
> > +			arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK1 + i;
> > +			arizona->pdata.clk32k_parent = __clk_get_name(mclk);
> > +		}
> > +
> > +		clk_put(mclk);
> 
> Could this be done through assigned parents instead of this rate
> checking stuff? Presumably DT could tell us how the clk tree
> should be configured.
> 

Apologies, I have been working on a v4 that includes these
improvements. It does indeed look much nicer using assigned
parents etc. I think it might be best to drop these for now until
those are ready to send.

The only problem I really have left to sort out before I can send
it are some locking issues. It is quite tricky to get interaction
between the clocking and SPI frameworks to play nicely. The SPI
framework will sometimes punt the actually processing for the
transfer to a worker thread which will often perform operations
on clocks required for the SPI. Because this is a seperate
thread it isn't handled by the re-enterant locking in the clock
framework. I had been working around this using async transfers
for the SPI, but even then I have since found you can get lockdep
warnings because of the potential mutex inversion (SPI mutex and
the clock one).

Any suggestions on this front would be greatly appreciated?

Thanks, Charles

  reply	other threads:[~2016-05-09 10:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08 11:29 [PATCH v3 1/4] extcon: arizona: Remove enable/disable of 32k clock Charles Keepax
     [not found] ` <1452252582-20834-1-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2016-01-08 11:29   ` [PATCH v3 2/4] clk: arizona: Add clock driver for the Arizona devices Charles Keepax
     [not found]     ` <1452252582-20834-2-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2016-05-07  0:55       ` Stephen Boyd
2016-05-09 10:47         ` Charles Keepax [this message]
2016-05-09 21:48           ` Stephen Boyd
2016-05-10  9:58             ` Charles Keepax
2016-01-08 11:29 ` [PATCH v3 3/4] mfd: arizona: Switch to using clock driver for 32k clock Charles Keepax
2016-01-11 10:25   ` Lee Jones
2016-01-11 11:03     ` Charles Keepax
2016-05-07  0:55   ` Stephen Boyd
2016-05-09  7:44     ` Lee Jones
2016-05-09 19:34       ` Stephen Boyd
2016-05-10  7:41         ` Lee Jones
2016-01-08 11:29 ` [PATCH v3 4/4] mfd: arizona: Add device tree binding documentation for new clock driver Charles Keepax
2016-01-11 10:23   ` Lee Jones
2016-05-07  0:47   ` Stephen Boyd
2016-05-07  0:49     ` Stephen Boyd
2016-01-25  6:24 ` [PATCH v3 1/4] extcon: arizona: Remove enable/disable of 32k clock Chanwoo Choi
2016-05-07  0:50 ` Stephen Boyd

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=20160509104728.GG1646@localhost.localdomain \
    --to=ckeepax@opensource.wolfsonmicro.com \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=sboyd@codeaurora.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 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).