RE: [PATCH] pinctrl: tegra: add suspend-resume support
From: Bibek Basu
Date: Tue Apr 23 2013 - 13:52:44 EST
On 23/04/2013 11:25 PM, Bibek Basu wrote:
> -----Original Message-----
> From: Linus Walleij [mailto:linus.walleij@xxxxxxxxxx]
> Sent: Wednesday, April 03, 2013 9:52 PM
> To: Bibek Basu
> Cc: linux-kernel@xxxxxxxxxxxxxxx; Pritesh Raithatha
> Subject: Re: [PATCH] pinctrl: tegra: add suspend-resume support
>
> On Thu, Mar 28, 2013 at 6:11 PM, Bibek Basu <bbasu@xxxxxxxxxx> wrote:
>
> Hm I recognize this name :-)
>
You recognized me correctly. After all it's a small world:-)
> > 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?
>
Yeah, patch mainly saves and restores the registers.
I am re-pushing the patch after incorporating stephen's changes.
regards
Bibek
> 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/