From: Simon Horman <horms@verge.net.au>
To: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-sh@vger.kernel.org,
Mike Turquette <mturquette@linaro.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 01/12] clocksource: sh_cmt: Add clk_prepare/unprepare support
Date: Tue, 29 Oct 2013 14:55:35 +0900 [thread overview]
Message-ID: <20131029055534.GB11580@verge.net.au> (raw)
In-Reply-To: <1383000569-8916-2-git-send-email-laurent.pinchart+renesas@ideasonboard.com>
On Mon, Oct 28, 2013 at 11:49:18PM +0100, Laurent Pinchart wrote:
> Prepare the clock at probe time, as there is no other appropriate place
> in the driver where we're allowed to sleep.
>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Thanks Laurent,
I have queued this up in the clocksources branch of my renesas tree.
I will send a pull request to Mike once v3.13-rc1 has hit the shelves.
Mike, please let me know if you would prefer something earlier than that.
> ---
> drivers/clocksource/sh_cmt.c | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
> index 0965e98..940341a 100644
> --- a/drivers/clocksource/sh_cmt.c
> +++ b/drivers/clocksource/sh_cmt.c
> @@ -634,12 +634,18 @@ static int sh_cmt_clock_event_next(unsigned long delta,
>
> static void sh_cmt_clock_event_suspend(struct clock_event_device *ced)
> {
> - pm_genpd_syscore_poweroff(&ced_to_sh_cmt(ced)->pdev->dev);
> + struct sh_cmt_priv *p = ced_to_sh_cmt(ced);
> +
> + pm_genpd_syscore_poweroff(&p->pdev->dev);
> + clk_unprepare(p->clk);
> }
>
> static void sh_cmt_clock_event_resume(struct clock_event_device *ced)
> {
> - pm_genpd_syscore_poweron(&ced_to_sh_cmt(ced)->pdev->dev);
> + struct sh_cmt_priv *p = ced_to_sh_cmt(ced);
> +
> + clk_prepare(p->clk);
> + pm_genpd_syscore_poweron(&p->pdev->dev);
> }
>
> static void sh_cmt_register_clockevent(struct sh_cmt_priv *p,
> @@ -737,6 +743,10 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
> goto err2;
> }
>
> + ret = clk_prepare(p->clk);
> + if (ret < 0)
> + goto err3;
> +
> if (res2 && (resource_size(res2) == 4)) {
> /* assume both CMSTR and CMCSR to be 32-bit */
> p->read_control = sh_cmt_read32;
> @@ -773,19 +783,21 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
> cfg->clocksource_rating);
> if (ret) {
> dev_err(&p->pdev->dev, "registration failed\n");
> - goto err3;
> + goto err4;
> }
> p->cs_enabled = false;
>
> ret = setup_irq(irq, &p->irqaction);
> if (ret) {
> dev_err(&p->pdev->dev, "failed to request irq %d\n", irq);
> - goto err3;
> + goto err4;
> }
>
> platform_set_drvdata(pdev, p);
>
> return 0;
> +err4:
> + clk_unprepare(p->clk);
> err3:
> clk_put(p->clk);
> err2:
> --
> 1.8.1.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2013-10-29 5:55 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-28 22:49 [PATCH 00/12] Prepare various SH/R Mobile/Car drivers for CCF migration Laurent Pinchart
2013-10-28 22:49 ` [PATCH 01/12] clocksource: sh_cmt: Add clk_prepare/unprepare support Laurent Pinchart
2013-10-29 5:55 ` Simon Horman [this message]
2013-10-29 9:55 ` Laurent Pinchart
2013-10-30 0:10 ` Simon Horman
2013-10-30 0:13 ` Laurent Pinchart
2013-10-30 0:27 ` Simon Horman
2013-10-28 22:49 ` [PATCH 02/12] clocksource: sh_mtu2: " Laurent Pinchart
2013-10-29 5:55 ` Simon Horman
2013-10-29 11:15 ` Sergei Shtylyov
2013-10-29 13:24 ` Laurent Pinchart
2013-10-29 14:30 ` [PATCH v2 1/2] clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails Laurent Pinchart
2013-10-29 14:30 ` [PATCH v2 2/2] clocksource: sh_mtu2: Add clk_prepare/unprepare support Laurent Pinchart
2013-10-31 5:23 ` Simon Horman
2013-11-08 10:10 ` Daniel Lezcano
2013-10-31 5:23 ` [PATCH v2 1/2] clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails Simon Horman
2013-11-08 10:10 ` Daniel Lezcano
2013-10-28 22:49 ` [PATCH 03/12] clocksource: sh_tmu: Add clk_prepare/unprepare support Laurent Pinchart
2013-10-29 5:55 ` Simon Horman
2013-10-29 11:17 ` Sergei Shtylyov
2013-10-29 14:31 ` [PATCH v2 1/2] clocksource: sh_tmu: Release clock when sh_tmu_register() fails Laurent Pinchart
2013-10-29 14:31 ` [PATCH v2 2/2] clocksource: sh_tmu: Add clk_prepare/unprepare support Laurent Pinchart
2013-10-31 5:24 ` Simon Horman
2013-11-07 13:40 ` Daniel Lezcano
2013-11-08 5:22 ` Simon Horman
2013-11-08 10:10 ` Daniel Lezcano
2013-10-31 5:23 ` [PATCH v2 1/2] clocksource: sh_tmu: Release clock when sh_tmu_register() fails Simon Horman
2013-11-08 10:10 ` Daniel Lezcano
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=20131029055534.GB11580@verge.net.au \
--to=horms@verge.net.au \
--cc=daniel.lezcano@linaro.org \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=mturquette@linaro.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
all inboxes | Powered by JetHome®