Skip to content

Commit

Permalink
Merge pull request #334 from tb59427/OV-stability-fixes
Browse files Browse the repository at this point in the history
OV stability fixes
  • Loading branch information
linuxianer99 authored Oct 31, 2022
2 parents 0f5ac0e + 9d3ffa0 commit 5108189
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 40 deletions.
1 change: 1 addition & 0 deletions meta-ov/recipes-core/images/openvario-base-image.bb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ IMAGE_INSTALL = " \
ts-uinput-service \
${COMMON_WIFI_FIRMWARE_PACKAGES} \
${LOCALE_PACKAGES} \
fix-cpu-freq\
"

# packagegroup-base packagegroup-core-ssh-openssh
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
From 7d460400702a323c3dc796f95ce5e155767c0aca Mon Sep 17 00:00:00 2001
From: Torsten Beyer <[email protected]>
Date: Sun, 28 Aug 2022 20:04:45 +0200
Subject: [PATCH] Set minimum CPU voltage to 1.2V

The cubieboard2 dev spec says minimum voltage for lower frequencies should be 1.0iV and 1.1V respectively. Usage of cubieboards in OpenVarion
show instable behaviour with voltages of 1.0V and 1.1V. Hence this change increases CPU voltage to 1.2V for the lowest CPU speeds.
---
arch/arm/boot/dts/sun7i-a20.dtsi | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 5574299685ab..6902621d806f 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -112,9 +112,9 @@
<912000 1400000>,
<864000 1300000>,
<720000 1200000>,
- <528000 1100000>,
- <312000 1000000>,
- <144000 1000000>;
+ <528000 1200000>,
+ <312000 1200000>,
+ <144000 1200000>;
#cooling-cells = <2>;
};

@@ -130,9 +130,9 @@
<912000 1400000>,
<864000 1300000>,
<720000 1200000>,
- <528000 1100000>,
- <312000 1000000>,
- <144000 1000000>;
+ <528000 1200000>,
+ <312000 1200000>,
+ <144000 1200000>;
#cooling-cells = <2>;
};
};
--
2.15.0

2 changes: 1 addition & 1 deletion meta-ov/recipes-kernel/linux/linux-openvario_6.0.5.bb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ SRC_URI = " \
"

SRC_URI:append:sunxi = " \
file://0004-1.1V-fix-for-sun7i-a20.dtsi.patch\
file://0004-Set-minimum-CPU-voltage-to-1.2V.patch\
\
file://openvario-common.dts \
file://openvario-43-rgb.dts \
Expand Down
10 changes: 10 additions & 0 deletions meta-ov/recipes-support/fix-cpu-freq/files/fix_cpu_freq.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Script to fix cpu_freq_min=cpu_freq_max for cpu0/1 to stop cpu_freq from switching frequencies

[Service]
Type=simple
RemainAfterExit=yes
ExecStart=/opt/bin/fix_cpu_freq.sh

[Install]
WantedBy=default.target
14 changes: 14 additions & 0 deletions meta-ov/recipes-support/fix-cpu-freq/files/fix_cpu_freq.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

#
# This script fixes CPU frequency thus effectively stopping the kernel from changing cpu frequency
# You can change the frequency if you wish. To do so just change the value of CPU_FIX_FREQ to a different
# number. Beware: it must be a supported frequency
#

CPU_FIX_FREQ=720000

echo $CPU_FIX_FREQ > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo $CPU_FIX_FREQ > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo $CPU_FIX_FREQ > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo $CPU_FIX_FREQ > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
38 changes: 38 additions & 0 deletions meta-ov/recipes-support/fix-cpu-freq/fix-cpu-freq_0.1.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# install fix_cpu_freq service into systemd
# this this service runs /opt/bin/fix_cpu_freq.sh which fixes the CPU frequency at 720MHz
# this has proven to make OV very stable and reliable
# if you like to fix CPU speed at higher frequencies or want to allow frequency hopping for certain frequencies, change the settings in fix_cpu_freq.sh
#

SUMMARY = "Set CPU frequency to fixed value"
LICENSE = "GPL-3.0-only"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/${LICENSE};md5=c79ff39f19dfec6d293b95dea7b07891"

PR = "r1"

inherit allarch systemd

RDEPENDS:${PN} = " \
bash \
"

SRC_URI = " \
file://fix_cpu_freq.service \
file://fix_cpu_freq.sh \
"

do_install() {
install -d ${D}/${systemd_unitdir}/system
install -d ${D}/opt/bin
install -m 0644 ${WORKDIR}/fix_cpu_freq.service ${D}/${systemd_unitdir}/system
install -m 0755 ${WORKDIR}/fix_cpu_freq.sh ${D}/opt/bin
}

SYSTEMD_AUTO_ENABLE = "enable"
SYSTEMD_SERVICE:${PN} = "fix_cpu_freq.service"

FILES:${PN} += " \
${systemd_unitdir}/system/fix_cpu_freq.service \
/opt/bin/fix_cpu_freq.sh \
"

0 comments on commit 5108189

Please sign in to comment.