I have been trying to get suspend working well on my laptop (a very plain Dell Inspiron n4030), and gpio(4) is the only thing standing in my way :-) it's currently enabled by default for GENERIC on amd64: gpio0 at ichlpcib0: 64 pins
the behaviour is that on first resume, it'll work fine, but second one crashes (just powers down). currently, on resume, we restore the previous gpio values. by disabling this (with the attached diff), I am able to suspend/resume repeatedly, or by disabling gpio with userconf. apparently, in amd64 systems, it's probably bound to random undocumented system things, and messing with it is a bad idea. I haven't played with many embedded systems, but I wouldn't be surprised if some non-amd64 machines do the same. could we do something about this problem? thanks.
Index: gpio/gpio.c =================================================================== RCS file: /cvsroot/src/sys/dev/gpio/gpio.c,v retrieving revision 1.58 diff -u -r1.58 gpio.c --- gpio/gpio.c 11 May 2016 18:33:40 -0000 1.58 +++ gpio/gpio.c 5 Aug 2016 18:13:45 -0000 @@ -136,13 +136,14 @@ static bool gpio_resume(device_t self, const pmf_qual_t *qual) { +#if 0 struct gpio_softc *sc = device_private(self); int pin; - for (pin = 0; pin < sc->sc_npins; pin++) { gpiobus_pin_ctl(sc->sc_gc, pin, sc->sc_pins[pin].pin_flags); gpiobus_pin_write(sc->sc_gc, pin, sc->sc_pins[pin].pin_state); } +#endif return true; }