summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authordreieck2023-02-20 16:13:29 +0100
committerdreieck2023-02-20 16:13:29 +0100
commit3d8e774f1772b6961ba82e69c770a904c20c8c53 (patch)
treed4df909e79190396a35a13c3ef99d835287042f8
downloadaur-3d8e774f1772b6961ba82e69c770a904c20c8c53.tar.gz
Initial commit.
-rw-r--r--.SRCINFO25
-rw-r--r--PKGBUILD56
-rw-r--r--phc-intel-scripts.install11
-rw-r--r--phc-intel.conf.default4
-rw-r--r--phc-intel.sh55
-rw-r--r--phc-intel.sleep.pm-utils7
-rw-r--r--phc-intel.sleep.systemd5
7 files changed, 163 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..2e7f51b0584d
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,25 @@
+pkgbase = phc-intel-scripts
+ pkgdesc = Helper scripts for phc-intel, a frequency driver for Intel CPUs with undervolting feature.
+ pkgver = 0.2
+ pkgrel = 1
+ url = https://gitlab.com/linux-phc/phc-intel
+ install = phc-intel-scripts.install
+ arch = any
+ groups = linux-phc
+ groups = phc-intel
+ license = GPL2
+ depends = bash
+ depends = phc-intel
+ backup = etc/default/phc-intel
+ source = phc-intel.conf.default
+ source = phc-intel.sh
+ source = phc-intel.sleep.pm-utils
+ source = phc-intel.sleep.systemd
+ source = phc-intel-scripts.install
+ sha256sums = ce08a5a4107be1d5723f1f169d515e67b6c77893f3994fc2d0d2ccf611307ed3
+ sha256sums = b526f3e8e66f6495531f13f2e6867d3a07b2ec7a7c3b8aa061f22be1cd6e770f
+ sha256sums = 569b85988cb38380fec85c25688b76abc24a46601aa8f58eb24eaebf863eebef
+ sha256sums = 2e17c90d7bfae8f5070e46388e95d443188eaa7beb5ffdd418a0da090f2e7557
+ sha256sums = 3d7b7bd26e3bbd93eac8098fe8d688eecd7697fec345ef829b957680e0b4a360
+
+pkgname = phc-intel-scripts
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..2c1c500eb279
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,56 @@
+# Maintainer: dreieck (https://aur.archlinux.org/account/dreieck)
+# Contributor: adrien1018 (https://aur.archlinux.org/account/adrien1018)
+# Contributor: fs4000
+# Contributor: trapanator
+# Contributor: tomprogrammer
+
+_pkgbase=phc-intel-scripts
+pkgbase="${_pkgbase}"
+_pkgname="${_pkgbase}"
+pkgname="${pkgbase}"
+groups=(
+ 'linux-phc'
+ 'phc-intel'
+)
+pkgver=0.2
+# _phcver="$(pacman -Q phc-intel | awk '{print $2}')" # Version of the installed package `phc-intel`.
+pkgrel=1
+pkgdesc="Helper scripts for phc-intel, a frequency driver for Intel CPUs with undervolting feature."
+url="https://gitlab.com/linux-phc/phc-intel"
+arch=('any')
+license=('GPL2')
+depends=(
+ 'bash'
+ 'phc-intel'
+)
+makedepends=()
+optdepends=()
+provides=()
+conflicts=()
+backup=(
+ 'etc/default/phc-intel'
+)
+install='phc-intel-scripts.install'
+source=(
+ 'phc-intel.conf.default'
+ 'phc-intel.sh'
+ 'phc-intel.sleep.pm-utils'
+ 'phc-intel.sleep.systemd'
+ "${install}"
+)
+sha256sums=(
+ 'ce08a5a4107be1d5723f1f169d515e67b6c77893f3994fc2d0d2ccf611307ed3' # 'phc-intel.conf.default'
+ 'b526f3e8e66f6495531f13f2e6867d3a07b2ec7a7c3b8aa061f22be1cd6e770f' # 'phc-intel.sh'
+ '569b85988cb38380fec85c25688b76abc24a46601aa8f58eb24eaebf863eebef' # 'phc-intel.sleep.pm-utils'
+ '2e17c90d7bfae8f5070e46388e95d443188eaa7beb5ffdd418a0da090f2e7557' # 'phc-intel.sleep.systemd'
+ '3d7b7bd26e3bbd93eac8098fe8d688eecd7697fec345ef829b957680e0b4a360' # ${install}
+)
+
+package() {
+ cd "${srcdir}"
+
+ install -Dvm644 phc-intel.conf.default "${pkgdir}/etc/default/phc-intel"
+ install -Dvm755 phc-intel.sh "${pkgdir}/usr/bin/phc-intel"
+ install -Dvm755 phc-intel.sleep.pm-utils "${pkgdir}/usr/lib/pm-utils/sleep.d/00phc-intel"
+ install -Dvm755 phc-intel.sleep.systemd "${pkgdir}/usr/lib/systemd/system-sleep/phc-intel"
+}
diff --git a/phc-intel-scripts.install b/phc-intel-scripts.install
new file mode 100644
index 000000000000..3021e0083f7e
--- /dev/null
+++ b/phc-intel-scripts.install
@@ -0,0 +1,11 @@
+post_install() {
+ printf '\n'
+ printf '%s\n' 'You can enter the desired voltage IDs in /etc/default/phc-intel.'
+ printf '%s\n' 'The `phc-intel` command should apply them.'
+ printf '%s\n' 'Booting with the `nophc` kernel parameter skips setting of VIDs by that script; use it in case of failure.'
+ printf '\n'
+}
+
+post_upgrade() {
+ post_install "$@"
+}
diff --git a/phc-intel.conf.default b/phc-intel.conf.default
new file mode 100644
index 000000000000..4e390e7684a4
--- /dev/null
+++ b/phc-intel.conf.default
@@ -0,0 +1,4 @@
+# configuration for phc-intel
+
+# voltage IDs to be set for all CPUs
+VIDS=""
diff --git a/phc-intel.sh b/phc-intel.sh
new file mode 100644
index 000000000000..cce4bf96ad91
--- /dev/null
+++ b/phc-intel.sh
@@ -0,0 +1,55 @@
+#!/bin/bash -e
+shopt -s nullglob
+
+case "$1" in
+start)
+ . /etc/default/phc-intel
+ if [ -z "$VIDS" ]; then
+ echo '=> Please edit /etc/default/phc-intel'
+ exit 1
+ fi
+ echo ':: Setting PHC VIDs'
+ for i in /sys/devices/system/cpu/cpu*/cpufreq/phc_vids; do
+ echo $VIDS > "$i"
+ done
+ ;;
+stop)
+ echo ':: Resetting default PHC VIDs'
+ for i in /sys/devices/system/cpu/cpu*/cpufreq/phc_vids; do
+ cp "${i%vids}default_vids" "$i"
+ done
+ ;;
+status)
+ check_off () {
+ for i in /sys/devices/system/cpu/cpu*/cpufreq/phc_vids; do
+ [ "$(< "$i")" = "$(< "${i%vids}default_vids")" ] || return;
+ done
+ }
+ check_on () {
+ for i in /sys/devices/system/cpu/cpu*/cpufreq/phc_vids; do
+ [[ "$(< "$i")" =~ "$VIDS" ]] || return;
+ done
+ }
+ echo -n 'PHC status: '
+ . /etc/default/phc-intel
+ if check_off; then
+ echo 'inactive'
+ elif check_on; then
+ echo 'active'
+ else
+ echo 'unknown'
+ fi
+ ;;
+set)
+ . /etc/default/phc-intel
+ [ -z "$VIDS" ] && exit
+ for i in $(< /proc/cmdline); do
+ [ $i = nophc ] && exit
+ done
+ for i in /sys/devices/system/cpu/cpu*/cpufreq/phc_vids; do
+ echo $VIDS > "$i"
+ done
+ ;;
+*)
+ echo "usage: $0 {start|stop|status|set}"
+esac
diff --git a/phc-intel.sleep.pm-utils b/phc-intel.sleep.pm-utils
new file mode 100644
index 000000000000..342b81acf831
--- /dev/null
+++ b/phc-intel.sleep.pm-utils
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+case $1 in
+ resume|thaw)
+ . /usr/bin/phc-intel set
+ ;;
+esac
diff --git a/phc-intel.sleep.systemd b/phc-intel.sleep.systemd
new file mode 100644
index 000000000000..c76ea6aafda0
--- /dev/null
+++ b/phc-intel.sleep.systemd
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+if [ "$1" = post ]; then
+ . /usr/bin/phc-intel set
+fi