Messages in this thread | | | Date | Tue, 19 Jun 2007 11:31:37 -0700 | From | Andrew Morton <> | Subject | Re: [patch #2 1/6] SM501: suspend support |
| |
On Mon, 18 Jun 2007 21:56:21 +0100 ben@fluff.org.uk wrote:
> +/* power management support */ > + > +static int sm501_plat_suspend(struct platform_device *pdev, pm_message_t state) > +{ > + struct sm501_devdata *sm = platform_get_drvdata(pdev); > + > + sm->in_suspend = 1; > + sm->pm_misc = readl(sm->regs + SM501_MISC_CONTROL); > + > + sm501_dump_regs(sm); > + return 0; > +} > + > +static int sm501_plat_resume(struct platform_device *pdev) > +{ > + struct sm501_devdata *sm = platform_get_drvdata(pdev); > + > + sm501_dump_regs(sm); > + sm501_dump_gate(sm); > + sm501_dump_clk(sm); > + > + /* check to see if we are in the same state as when suspended */ > + > + if (readl(sm->regs + SM501_MISC_CONTROL) != sm->pm_misc) { > + dev_info(sm->dev, "SM501_MISC_CONTROL changed over sleep\n"); > + writel(sm->pm_misc, sm->regs + SM501_MISC_CONTROL); > + > + /* our suspend causes the controller state to change, > + * either by something attempting setup, power loss, > + * or an external reset event on power change */ > + > + if (sm->platdata && sm->platdata->init) { > + sm501_init_regs(sm, sm->platdata->init); > + } > + } > + > + /* dump our state from resume */ > + > + sm501_dump_regs(sm); > + sm501_dump_clk(sm); > + > + sm->in_suspend = 0; > + > + return 0; > +} > + > + > /* Initialisation data for PCI devices */ > > static struct sm501_initdata sm501_pci_initdata = { > @@ -1126,6 +1207,8 @@ static struct platform_driver sm501_plat > }, > .probe = sm501_plat_probe, > .remove = sm501_plat_remove, > + .suspend = sm501_plat_suspend, > + .resume = sm501_plat_resume, > };
Do we want to compile this in if CONFIG_PM=n? - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |