From: linus.walleij@linaro.org (Linus Walleij)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] pinctrl: sirf: save the status in suspend and restore after resuming
Date: Mon, 20 May 2013 10:16:35 +0200 [thread overview]
Message-ID: <CACRpkdaSTC8cLi-C_gwZEk8iF=bnAce920DbKvxN6S-=75xbnA@mail.gmail.com> (raw)
In-Reply-To: <1368674229-11813-1-git-send-email-Baohua.Song@csr.com>
On Thu, May 16, 2013 at 5:17 AM, Barry Song <Baohua.Song@csr.com> wrote:
> this patch saves the status of pinctrl registers and restore them while
> resuming. this makes all drivers have coherent status for pinmux after
> suspending and resuming.
>
> Signed-off-by: Barry Song <Baohua.Song@csr.com>
Applied, but a quick remark that you may want to fix up:
(...)
> +#ifdef CONFIG_PM_SLEEP
> +static int sirfsoc_pinmux_suspend_noirq(struct device *dev)
> +{
> + int i, j;
> + struct sirfsoc_pmx *spmx = dev_get_drvdata(dev);
> +
> + for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) {
> + for (j = 0; j < SIRFSOC_GPIO_BANK_SIZE; j++) {
> + spmx->gpio_regs[i][j] = readl(spmx->gpio_virtbase +
> + SIRFSOC_GPIO_CTRL(i, j));
> + }
> + spmx->ints_regs[i] = readl(spmx->gpio_virtbase +
> + SIRFSOC_GPIO_INT_STATUS(i));
> + spmx->paden_regs[i] = readl(spmx->gpio_virtbase +
> + SIRFSOC_GPIO_PAD_EN(i));
> + }
> + spmx->dspen_regs = readl(spmx->gpio_virtbase + SIRFSOC_GPIO_DSP_EN0);
> +
> + for (i = 0; i < 3; i++)
Why are you hard-coding 3 here? It looks fragile.
> + spmx->rsc_regs[i] = readl(spmx->rsc_virtbase + 4 * i);
> +
> + return 0;
> +}
> +
> +static int sirfsoc_pinmux_resume_noirq(struct device *dev)
> +{
> + int i, j;
> + struct sirfsoc_pmx *spmx = dev_get_drvdata(dev);
> +
> + for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) {
> + for (j = 0; j < SIRFSOC_GPIO_BANK_SIZE; j++) {
> + writel(spmx->gpio_regs[i][j], spmx->gpio_virtbase +
> + SIRFSOC_GPIO_CTRL(i, j));
> + }
> + writel(spmx->ints_regs[i], spmx->gpio_virtbase +
> + SIRFSOC_GPIO_INT_STATUS(i));
> + writel(spmx->paden_regs[i], spmx->gpio_virtbase +
> + SIRFSOC_GPIO_PAD_EN(i));
> + }
> + writel(spmx->dspen_regs, spmx->gpio_virtbase + SIRFSOC_GPIO_DSP_EN0);
> +
> + for (i = 0; i < 3; i++)
Dito.
Yours,
Linus Walleij
next prev parent reply other threads:[~2013-05-20 8:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-16 3:17 [PATCH] pinctrl: sirf: save the status in suspend and restore after resuming Barry Song
2013-05-20 8:16 ` Linus Walleij [this message]
2013-05-22 16:28 ` Barry Song
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='CACRpkdaSTC8cLi-C_gwZEk8iF=bnAce920DbKvxN6S-=75xbnA@mail.gmail.com' \
--to=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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).