diff --git a/power-control/Makefile b/power-control/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..89d336ccfd42b2a3d07f43323d9ba7f579e9e3d8 --- /dev/null +++ b/power-control/Makefile @@ -0,0 +1,31 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=power-control +PKG_RELEASE:=1 +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) +PKG_LICENSE:=GPL-2.0-only + +include $(INCLUDE_DIR)/package.mk + +define Package/power-control + CATEGORY:=Utilities + TITLE:=Broadcom Power Control +endef + +define Package/power-control/description + Broadcom Power Control +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + $(CP) ./files/* $(PKG_BUILD_DIR)/ +endef + +define Build/Compile +endef + +define Package/power-control/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,power-control)) diff --git a/power-control/files/etc/config/pwrctl b/power-control/files/etc/config/pwrctl new file mode 100644 index 0000000000000000000000000000000000000000..3e3bc48b5615d142ff8da3ddb7332f6f04495a5e --- /dev/null +++ b/power-control/files/etc/config/pwrctl @@ -0,0 +1,6 @@ +config pwrctl 'config' + option avs '0' + option cpuspeed '0' + option cpuwait '0' + option eee '0' + diff --git a/power-control/files/etc/init.d/pwrctl b/power-control/files/etc/init.d/pwrctl new file mode 100755 index 0000000000000000000000000000000000000000..c5867f14eeda78b865f4f03b01d9fe8c9a4a4931 --- /dev/null +++ b/power-control/files/etc/init.d/pwrctl @@ -0,0 +1,39 @@ +#!/bin/sh /etc/rc.common + +START=13 +USE_PROCD=1 + +. /lib/functions.sh + +parsebool() { + [ "$1" = "1" ] && echo "on" || echo "off" +} + +start_service() { + config_load power_mgmt + + local cpuspeed + config_get speed config cpuspeed + pwrctl config --cpuspeed $(parsebool $cpuspeed) + + local cpuwait + config_get cpuwait config cpuwait + pwrctl config --cpuwait $(parsebool $cpuwait) + + local sr + config_get sr config sr + pwrctl config --sr $(parsebool $sr) + + local eee + config_get eee config eee + pwrctl config --eee $(parsebool $eee) + + local avs + config_get avs config avs + pwrctl config --avs $(parsebool $avs) +} + +service_triggers() { + procd_add_reload_trigger pwrctl +} +