moved sysfs code to its own file

- new function write_powerstate()
- sw_sleep() and sw_hiber() moved to powermgmt.c