From f6e892bda3d14c9b634e72ef1abf9f3eaff27f8c Mon Sep 17 00:00:00 2001 From: "mason.huo" Date: Fri, 14 Oct 2022 13:08:20 +0800 Subject: [PATCH] package: starfive: Add power management package The package is for power management. Currently adjust the cpufreq paramenters. Signed-off-by: mason.huo --- package/starfive/Config.in | 1 + package/starfive/pm/Config.in | 6 ++++++ package/starfive/pm/S90cpufreq | 22 ++++++++++++++++++++++ package/starfive/pm/pm.mk | 12 ++++++++++++ 4 files changed, 41 insertions(+) mode change 100755 => 100644 package/starfive/Config.in create mode 100644 package/starfive/pm/Config.in create mode 100644 package/starfive/pm/S90cpufreq create mode 100644 package/starfive/pm/pm.mk diff --git a/package/starfive/Config.in b/package/starfive/Config.in old mode 100755 new mode 100644 index adf32f61..19bfee17 --- a/package/starfive/Config.in +++ b/package/starfive/Config.in @@ -12,3 +12,4 @@ source "package/starfive/e24-test/Config.in" source "package/starfive/stfisp_setfile/Config.in.host" source "package/starfive/img-gpu-powervr/Config.in" source "package/starfive/drm_test/Config.in" +source "package/starfive/pm/Config.in" diff --git a/package/starfive/pm/Config.in b/package/starfive/pm/Config.in new file mode 100644 index 00000000..2dd1181d --- /dev/null +++ b/package/starfive/pm/Config.in @@ -0,0 +1,6 @@ +comment "pm package" + +config BR2_PACKAGE_PM + bool "pm" + help + Utility for pm initialization & configuration. diff --git a/package/starfive/pm/S90cpufreq b/package/starfive/pm/S90cpufreq new file mode 100644 index 00000000..a6f121a7 --- /dev/null +++ b/package/starfive/pm/S90cpufreq @@ -0,0 +1,22 @@ +#!/bin/sh +# +# cpufreq This shell script to config cpufreq parameters. + +case "$1" in + start) + # Set the ondemand governor sampling_rate to 100ms. + SYS_CPUFREQ_GOVERNOR=/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + if [ -e $SYS_CPUFREQ_GOVERNOR ]; then + echo "ondemand" > $SYS_CPUFREQ_GOVERNOR + echo 100000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate + fi + ;; + stop) + ;; + *) + echo "Usage: $0 {start|stop}" + exit 1 +esac + +exit 0 + diff --git a/package/starfive/pm/pm.mk b/package/starfive/pm/pm.mk new file mode 100644 index 00000000..2b5eb0e1 --- /dev/null +++ b/package/starfive/pm/pm.mk @@ -0,0 +1,12 @@ +################################################################################ +# +# pm +# +################################################################################ +PM_LICENSE = GPL-2.0+ + +define PM_INSTALL_TARGET_CMDS + install -m 0755 -D package/starfive/pm/S90cpufreq $(TARGET_DIR)/etc/init.d/ +endef + +$(eval $(generic-package))