Esempio n. 1
0
void
zapm_poweroff(void)
{
	struct pxa2x0_apm_softc *sc;

	KASSERT(apm_cd.cd_ndevs > 0 && apm_cd.cd_devs[0] != NULL);
	sc = apm_cd.cd_devs[0];

	dopowerhooks(PWR_SUSPEND);

	/* XXX enable charging during suspend */

	/* XXX keep power LED state during suspend */

	/* XXX do the same thing for GPIO 43 (BTTXD) */

	/* XXX scoop power down */

	/* XXX set PGSRn and GPDRn */

	pxa2x0_wakeup_config(PXA2X0_WAKEUP_ALL, 1);

	do {
		pxa2x0_apm_sleep(sc);
	}
	while (!zapm_resume(sc));

	zapm_restart();

	/* NOTREACHED */
	dopowerhooks(PWR_RESUME);
}
Esempio n. 2
0
void
zapm_poweroff(void)
{
    struct pxa2x0_apm_softc *sc;
    int s;

    KASSERT(apm_cd.cd_ndevs > 0 && apm_cd.cd_devs[0] != NULL);
    sc = apm_cd.cd_devs[0];

#if NWSDISPLAY > 0
    wsdisplay_suspend();
#endif /* NWSDISPLAY > 0 */

    s = splhigh();
    config_suspend_all(DVACT_SUSPEND);

    suspend_randomness();

    /* XXX
     * Flag to disk drivers that they should "power down" the disk
     * when we get to DVACT_POWERDOWN.
     */
    boothowto |= RB_POWERDOWN;
    config_suspend_all(DVACT_POWERDOWN);
    boothowto &= ~RB_POWERDOWN;

    /* XXX enable charging during suspend */

    /* XXX keep power LED state during suspend */

    /* XXX do the same thing for GPIO 43 (BTTXD) */

    /* XXX scoop power down */

    /* XXX set PGSRn and GPDRn */

    pxa2x0_wakeup_config(PXA2X0_WAKEUP_ALL, 1);

    do {
        pxa2x0_apm_sleep(sc);
    } while (!zapm_resume(sc));

    zapm_restart();

    /* NOTREACHED */
    config_suspend_all(DVACT_RESUME);
    splx(s);

    resume_randomness(NULL, 0);	/* force RNG upper level reseed */
    bufq_restart();

    config_suspend_all(DVACT_WAKEUP);

#if NWSDISPLAY > 0
    wsdisplay_resume();
#endif /* NWSDISPLAY > 0 */
}
Esempio n. 3
0
/*
 * Called before suspending when all powerhooks are done.
 */
void
zapm_suspend(struct pxa2x0_apm_softc *pxa_sc)
{
	struct zapm_softc *sc = (struct zapm_softc *)pxa_sc;

	/* Poll in suspended mode and forget the discharge timeout. */
	sc->sc_suspended = 1;
	timeout_del(&sc->sc_poll);

	/* Make sure charging is enabled and RTC alarm is set. */
	timerclear(&sc->sc_lastbattchk);

	zapm_poll(sc);

#if 0
	pxa2x0_rtc_setalarm(pxa2x0_rtc_getsecs() + 5);
#endif
	pxa2x0_wakeup_config(PXA2X0_WAKEUP_ALL, 1);
}
Esempio n. 4
0
void
apm_suspend(struct pxa2x0_apm_softc *sc)
{
	int s;

#if NWSDISPLAY > 0
	wsdisplay_suspend();
#endif /* NWSDISPLAY > 0 */

	resettodr();

	if (sc->sc_suspend == NULL)
		pxa2x0_wakeup_config(PXA2X0_WAKEUP_ALL, 1);
	else
		sc->sc_suspend(sc);

	s = splhigh();
	config_suspend(TAILQ_FIRST(&alldevs), DVACT_SUSPEND);
	splx(s);

	pxa2x0_apm_sleep(sc);
}