Refactor power button module to support lid events
Refactor power button module to support lid events

This also significantly refactors the module in other ways.  Instead
of polling for changes every second, the power button task sleeps
until its next state transition or input.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7508
TEST=manual

1. Reboot EC with lid open.  System should NOT power on.
2. Close lid.  System should power on.
3. Open lid.  System should power on.
4. Press power button.  System should power off.

For now, EC debug messages should also indicate [PB task wait] only
when transitions are taking place; the task function should be
sleeping at other times.

Change-Id: I86ac420506cebcdf9ca62bdca342e86857d9e242

longsleep/ec,fourier49/BZ_DEV_EC,fourier49/BIZ_EC,gelraen/cros-ec,mtk09422/chromiumos-platform-ec,md5555/ec,coreboot/chrome-ec,fourier49/BIZ_EC,gelraen/cros-ec,akappy7/ChromeOS_EC_LED_Diagnostics,mtk09422/chromiumos-platform-ec,akappy7/ChromeOS_EC_LED_Diagnostics,coreboot/chrome-ec,fourier49/BIZ_EC,alterapraxisptyltd/chromium-ec,fourier49/BZ_DEV_EC,mtk09422/chromiumos-platform-ec,mtk09422/chromiumos-platform-ec,md5555/ec,thehobn/ec,fourier49/BZ_DEV_EC,akappy7/ChromeOS_EC_LED_Diagnostics,eatbyte/chromium-ec,fourier49/BIZ_EC,akappy7/ChromeOS_EC_LED_Diagnostics,eatbyte/chromium-ec,coreboot/chrome-ec,longsleep/ec,alterapraxisptyltd/chromium-ec,longsleep/ec,eatbyte/chromium-ec,md5555/ec,thehobn/ec,coreboot/chrome-ec,alterapraxisptyltd/chromium-ec,coreboot/chrome-ec,akappy7/ChromeOS_EC_LED_Diagnostics,alterapraxisptyltd/chromium-ec,thehobn/ec,longsleep/ec,fourier49/BZ_DEV_EC,md5555/ec,eatbyte/chromium-ec,gelraen/cros-ec,thehobn/ec,coreboot/chrome-ec,gelraen/cros-ec