Skip to content

Commit

Permalink
different patching mechanism, battery and thermal zones
Browse files Browse the repository at this point in the history
  • Loading branch information
Krystian Lewandowski committed Sep 7, 2019
1 parent 44651aa commit db91f66
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 29 deletions.
11 changes: 11 additions & 0 deletions overlays/axp803-battery.dtso
@@ -0,0 +1,11 @@
/ {
compatible = "allwinner,sun50i-a64";
};

&axp803 {
battery_power_supply: battery-power-supply {
compatible = "x-powers,axp803-battery-power-supply",
"x-powers,axp813-battery-power-supply";
status = "disabled";
};
};
4 changes: 1 addition & 3 deletions overlays/sun50i-a64-opp.dtso
@@ -1,6 +1,3 @@
/dts-v1/;
/plugin/;

/ {
compatible = "allwinner,sun50i-a64";
};
Expand Down Expand Up @@ -63,6 +60,7 @@
clocks = <&ccu 21>;
clock-names = "cpu";
cpu-supply = <&reg_dcdc2>;
#cooling-cells = <2>;
};

&{/cpus/cpu@1} {
Expand Down
7 changes: 7 additions & 0 deletions overlays/sun50i-a64-pinebook-battery.dtso
@@ -0,0 +1,7 @@
/ {
compatible = "allwinner,sun50i-a64";
};

&battery_power_supply {
status = "okay";
};
3 changes: 0 additions & 3 deletions overlays/sun50i-a64-pwm.dtso
@@ -1,6 +1,3 @@
/dts-v1/;
/plugin/;

/ {
compatible = "allwinner,sun50i-a64";
};
Expand Down
3 changes: 0 additions & 3 deletions overlays/sun50i-a64-rpwm.dtso
@@ -1,6 +1,3 @@
/dts-v1/;
/plugin/;

/ {
compatible = "allwinner,sun50i-a64";
};
Expand Down
3 changes: 0 additions & 3 deletions overlays/sun50i-a64-sid.dtso
@@ -1,6 +1,3 @@
/dts-v1/;
/plugin/;

/ {
compatible = "allwinner,sun50i-a64";
};
Expand Down
69 changes: 69 additions & 0 deletions overlays/sun50i-a64-thermal_zones.dtso
@@ -0,0 +1,69 @@
#include <dt-bindings/thermal/thermal.h>

/ {
compatible = "allwinner,sun50i-a64";
};

&{/} {
thermal-zones {
cpu-thermal {
/* milliseconds */
polling-delay-passive = <250>;
polling-delay = <1000>;
thermal-sensors = <&ths 0>;

trips {
cpu_warm: cpu_warm {
temperature = <65000000>;
hysteresis = <2000000>;
type = "passive";
};

cpu_hot_pre: cpu_hot_pre {
temperature = <70000000>;
hysteresis = <2000000>;
type = "passive";
};

cpu_hot: cpu_hot {
temperature = <75000000>;
hysteresis = <2000000>;
type = "passive";
};

cpu_very_hot: cpu_very_hot {
temperature = <90000000>;
hysteresis = <2000000>;
type = "passive";
};
};

cooling-maps {
cpu_warm_limit_cpu {
trip = <&cpu_warm>;
cooling-device = <&cpu0 THERMAL_NO_LIMIT 2>;
};

cpu_hot_pre_limit_cpu {
trip = <&cpu_hot_pre>;
cooling-device = <&cpu0 2 3>;
};

cpu_hot_limit_cpu {
trip = <&cpu_hot>;
cooling-device = <&cpu0 3 4>;
};

cpu_very_hot_pre_limit_cpu {
trip = <&cpu_very_hot>;
cooling-device = <&cpu0 5 6>;
};

cpu_very_hot_limit_cpu {
trip = <&cpu_very_hot>;
cooling-device = <&cpu0 7 THERMAL_NO_LIMIT>;
};
};
};
};
};
5 changes: 1 addition & 4 deletions overlays/sun50i-a64-ths.dtso
@@ -1,6 +1,3 @@
/dts-v1/;
/plugin/;

#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/clock/sun50i-a64-ccu.h>
#include <dt-bindings/reset/sun50i-a64-ccu.h>
Expand All @@ -18,7 +15,7 @@
clock-names = "apb", "ths";
resets = <&ccu RST_BUS_THS>;
reset-names = "apb";
#thermal-sensor-cells = <2>;
#thermal-sensor-cells = <1>;
status = "okay";

nvmem-cells = <&ths_calib>;
Expand Down
3 changes: 0 additions & 3 deletions overlays/sun50i-a64-timer.dtso
@@ -1,6 +1,3 @@
/dts-v1/;
/plugin/;

#include <dt-bindings/interrupt-controller/arm-gic.h>
/ {
compatible = "allwinner,sun50i-a64";
Expand Down
45 changes: 35 additions & 10 deletions prepare.sh
@@ -1,27 +1,52 @@
#!/usr/bin/env ksh

FLAVOR=aarch64
export FLAVOR=aarch64
UBOOT_OVERLAYS_PATH=$(pwd)/overlays

cd /usr/ports/sysutils/u-boot
WRKDIST=$(make show=WRKDIST)
echo ${WRKDIST}
make uninstall
make clean=all
make patch
cd -

WRKDIST_OVERLAYS_PATH=${WRKDIST}/arch/arm/dts/overlays/arm64
WRKDIST_DTS_PATH="${WRKDIST}/arch/arm/dts/"
WRKDIST_OVERLAYS_PATH="${WRKDIST}/arch/arm/dts/overlays/"

if [ -z "${WRKDIST}" ]; then
echo "no WRKDIST"
exit 1
echo "no WRKDIST"
exit 1
fi

cd ${WRKDIST}
cd "${WRKDIST}"

rm -rf ${WRKDIST_OVERLAYS_PATH}
mkdir -p ${WRKDIST_OVERLAYS_PATH}
rm -rf "${WRKDIST_OVERLAYS_PATH}"
mkdir -p "${WRKDIST_OVERLAYS_PATH}"

for F in $(find ${UBOOT_OVERLAYS_PATH} -name "sun50i-a64*.dtso"); do
tail -n+3 ${F} > ${WRKDIST_OVERLAYS_PATH}/$(basename ${F}.updated)
echo "#include <overlays/arm64/$(basename ${F}).updated>" >> ${WRKDIST}/arch/arm/dts/sun50i-a64.dtsi
for P in $(find "${UBOOT_OVERLAYS_PATH}" -name "*.dtso"); do
F=$(basename "${P}")
SUFFIX=${F##*-}
TARGET_DTS=${WRKDIST_DTS_PATH}${F%-"${SUFFIX}"}.dts
TARGET_DTSI=${WRKDIST_DTS_PATH}${F%-"${SUFFIX}"}.dtsi
TARGET=""

if [ -f "${TARGET_DTS}" ]; then
TARGET="${TARGET_DTS}"
elif [ -f "${TARGET_DTSI}" ]; then
TARGET="${TARGET_DTSI}"
fi

if [ ! -z "${TARGET}" ]; then
cp "${P}" "${WRKDIST_OVERLAYS_PATH}/${F}"
echo -n "Adding ${F} include to $(basename ${TARGET})... "
echo "#include <overlays/${F}>" >> ${TARGET}
echo "OK"
else
echo "Couldn't fid target for ${P} overlay!"
fi
done

cd /usr/ports/sysutils/u-boot
make install
cd -

0 comments on commit db91f66

Please sign in to comment.