/* * Generic suspend userspace interface for Alchemy development boards. * This code exports a few sysfs nodes under /sys/power/db1x/ which * can be used by userspace to en/disable all au1x-provided wakeup * sources and configure the timeout after which the TOYMATCH2 irq * is to trigger a wakeup.
*/
/* wait for value to really hit the register */ while (alchemy_rdsys(AU1000_SYS_CNTRCTRL) & SYS_CNTRL_M20) asmvolatile ("nop");
/* ...and now the sandman can come! */
au_sleep();
/* restore CPLD regs */ for (i = BCSR_STATUS; i <= BCSR_SYSTEM; i++)
bcsr_write(i, bcsrs[i]);
/* restore CPLD int registers */ if (hasint) {
bcsr_write(BCSR_INTCLR, 0xffff);
bcsr_write(BCSR_MASKCLR, 0xffff);
bcsr_write(BCSR_INTSTAT, 0xffff);
bcsr_write(BCSR_INTSET, bcsrs[BCSR_INTSET]);
bcsr_write(BCSR_MASKSET, bcsrs[BCSR_MASKSET]);
}
/* light up hexleds */
bcsr_write(BCSR_HEXCLEAR, 0);
return 0;
}
staticint db1x_pm_begin(suspend_state_t state)
{ if (!db1x_pm_wakemsk) {
printk(KERN_ERR "db1x: no wakeup source activated!\n"); return -EINVAL;
}
return 0;
}
staticvoid db1x_pm_end(void)
{ /* read and store wakeup source, the clear the register. To * be able to clear it, WAKEMSK must be cleared first.
*/
db1x_pm_last_wakesrc = alchemy_rdsys(AU1000_SYS_WAKESRC);
/* * Initialize suspend interface
*/ staticint __init pm_init(void)
{ /* init TOY to tick at 1Hz if not already done. No need to wait * for confirmation since there's plenty of time from here to * the next suspend cycle.
*/ if (alchemy_rdsys(AU1000_SYS_TOYTRIM) != 32767)
alchemy_wrsys(32767, AU1000_SYS_TOYTRIM);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.