Re: [PATCH] pinctrl: tegra: add suspend-resume support

From: Linus Walleij
Date: Wed Apr 03 2013 - 12:21:47 EST


On Thu, Mar 28, 2013 at 6:11 PM, Bibek Basu <bbasu@xxxxxxxxxx> wrote:

Hm I recognize this name :-)

> This patch adds suspend and resume callbacks to the pinctrl-tegra driver.

Please be more verbose. How is this achieved? I have to
guess what the code is doing..

> +#ifdef CONFIG_PM_SLEEP
> +
> +static int pinctrl_suspend(void)
> +{
> + int i, j;
> + u32 *pg_data = pmx->pg_data;
> + u32 *regs;
> +
> + for (i = 0; i < pmx->nbanks; i++) {
> + regs = pmx->regs[i];
> + for (j = 0; j < pmx->regs_size[i] / 4; j++)
> + *pg_data++ = readl(regs++);
> + }
> + return 0;
> +}
> +
> +static void pinctrl_resume(void)
> +{
> + int i, j;
> + u32 *pg_data = pmx->pg_data;
> + u32 *regs;
> +
> + for (i = 0; i < pmx->nbanks; i++) {
> + regs = pmx->regs[i];
> + for (j = 0; j < pmx->regs_size[i] / 4; j++)
> + writel(*pg_data++, regs++);
> + }
> +}
> +
> +static struct syscore_ops pinctrl_syscore_ops = {
> + .suspend = pinctrl_suspend,
> + .resume = pinctrl_resume,
> +};
> +
> +#endif
(...)
> +#ifdef CONFIG_PM_SLEEP
> + register_syscore_ops(&pinctrl_syscore_ops);
> +#endif

So Stephen already commented that syscore ops is maybe too big
a sledgehammer for a fine-granular problem.

I mainly want to know what is happening above, it looks like
a state save/restore for all registers or something like this?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/