mirror of
https://github.com/padavanonly/immortalwrt-mt798x.git
synced 2025-12-16 16:56:38 +00:00
sync
This commit is contained in:
parent
967b6b5211
commit
75d1781182
@ -14,10 +14,9 @@ PKG_LICENSE:=GPL-2.0
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/bpir3_mini-properties
|
||||
SECTION:=BPI-R3-MINI Properties
|
||||
CATEGORY:=BPI-R3-MINI Properties
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
TITLE:=PHYs firmware & fan control for BPI-R3-MINI
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/bpir3_mini-properties/description
|
||||
@ -31,16 +30,14 @@ define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/bpir3_mini-properties/install
|
||||
$(INSTALL_DIR) $(1)/etc/
|
||||
$(INSTALL_DIR) $(1)/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
$(INSTALL_DIR) $(1)/etc/rc.d/
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/fanspeed $(1)/etc/init.d/
|
||||
$(INSTALL_BIN) ./files/etc/rc.d/S99xfanspeed $(1)/etc/rc.d/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/ltecalling $(1)/etc/init.d/
|
||||
$(INSTALL_BIN) ./files/etc/rc.d/S25xltecalling $(1)/etc/rc.d/
|
||||
$(INSTALL_BIN) ./files/lib/firmware/EthMD32.dm.bin $(1)/lib/firmware/
|
||||
$(INSTALL_BIN) ./files/lib/firmware/EthMD32.DSP.bin $(1)/lib/firmware/
|
||||
$(INSTALL_BIN) ./files/bpir3_fanspeed $(1)/sbin/
|
||||
$(INSTALL_BIN) ./files/fanspeed.init $(1)/etc/init.d/fanspeed
|
||||
$(INSTALL_BIN) ./files/ltecalling.init $(1)/etc/init.d/ltecalling
|
||||
$(INSTALL_DATA) ./files/EthMD32.dm.bin $(1)/lib/firmware/
|
||||
$(INSTALL_DATA) ./files/EthMD32.DSP.bin $(1)/lib/firmware/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bpir3_mini-properties))
|
||||
|
||||
40
package/firmware/bpir3_mini-properties/files/bpir3_fanspeed
Executable file
40
package/firmware/bpir3_mini-properties/files/bpir3_fanspeed
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
### enable fan ###
|
||||
echo 0 > /sys/class/pwm/pwmchip0/export
|
||||
echo 10000 > /sys/class/pwm/pwmchip0/pwm0/period
|
||||
echo 7000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
|
||||
echo normal > /sys/class/pwm/pwmchip0/pwm0/polarity
|
||||
echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable
|
||||
|
||||
while :
|
||||
do
|
||||
sleep 20
|
||||
result=`cat /sys/class/thermal/thermal_zone0/temp`
|
||||
|
||||
temperature=$((result))
|
||||
#echo $temperature
|
||||
if [ ${temperature} -le 58000 ]; then
|
||||
echo 5000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
|
||||
fi
|
||||
|
||||
if [ ${temperature} -ge 58000 ]; then
|
||||
echo 5000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
|
||||
fi
|
||||
|
||||
if [ ${temperature} -ge 62000 ]; then
|
||||
echo 4500 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
|
||||
fi
|
||||
|
||||
if [ ${temperature} -ge 75000 ]; then
|
||||
echo 3700 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
|
||||
fi
|
||||
|
||||
if [ ${temperature} -ge 80000 ]; then
|
||||
echo 2500 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
|
||||
fi
|
||||
|
||||
if [ ${temperature} -ge 85000 ]; then
|
||||
echo 1000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
|
||||
fi
|
||||
done
|
||||
@ -1,45 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
if [ ! -f /sys/class/pwm/pwmchip0/export ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
### enable fan ###
|
||||
echo 0 > /sys/class/pwm/pwmchip0/export
|
||||
echo 10000 > /sys/class/pwm/pwmchip0/pwm0/period
|
||||
echo 7000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
|
||||
echo normal > /sys/class/pwm/pwmchip0/pwm0/polarity
|
||||
echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable
|
||||
|
||||
while :
|
||||
do
|
||||
sleep 20
|
||||
result=`cat /sys/class/thermal/thermal_zone0/temp`
|
||||
|
||||
temperature=$((result))
|
||||
#echo $temperature
|
||||
if [ ${temperature} -le 58000 ]; then
|
||||
echo 5000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
|
||||
fi
|
||||
|
||||
if [ ${temperature} -ge 58000 ]; then
|
||||
echo 5000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
|
||||
fi
|
||||
|
||||
if [ ${temperature} -ge 62000 ]; then
|
||||
echo 4500 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
|
||||
fi
|
||||
|
||||
if [ ${temperature} -ge 75000 ]; then
|
||||
echo 3700 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
|
||||
fi
|
||||
|
||||
if [ ${temperature} -ge 80000 ]; then
|
||||
echo 2500 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
|
||||
fi
|
||||
|
||||
if [ ${temperature} -ge 85000 ]; then
|
||||
echo 1000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
|
||||
fi
|
||||
done
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
if [ ! -f /sys/class/gpio/export ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
### enable M.2 5G RM500U-CN Module Power ###
|
||||
echo 431 > /sys/class/gpio/export
|
||||
echo out > /sys/class/gpio/gpio431/direction
|
||||
#echo 0 > /sys/class/gpio/gpio431/value
|
||||
@ -1 +0,0 @@
|
||||
../init.d/ltecalling
|
||||
@ -1 +0,0 @@
|
||||
../init.d/fanspeed
|
||||
16
package/firmware/bpir3_mini-properties/files/fanspeed.init
Executable file
16
package/firmware/bpir3_mini-properties/files/fanspeed.init
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
if [ ! -f /sys/class/pwm/pwmchip0/export ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param command "/sbin/bpir3_fanspeed"
|
||||
procd_close_instance
|
||||
}
|
||||
13
package/firmware/bpir3_mini-properties/files/ltecalling.init
Executable file
13
package/firmware/bpir3_mini-properties/files/ltecalling.init
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
if [ -f /sys/class/gpio/export ]; then
|
||||
### enable M.2 5G RM500U-CN Module Power ###
|
||||
echo 431 > /sys/class/gpio/export
|
||||
echo out > /sys/class/gpio/gpio431/direction
|
||||
#echo 0 > /sys/class/gpio/gpio431/value
|
||||
fi
|
||||
}
|
||||
@ -123,23 +123,56 @@
|
||||
};
|
||||
|
||||
&cpu_thermal {
|
||||
trips {
|
||||
cpu_trip_critical: critical {
|
||||
temperature = <85000>;
|
||||
hysteresis = <2000>;
|
||||
type = "critical";
|
||||
};
|
||||
|
||||
cpu_trip_hot: hot {
|
||||
temperature = <65000>;
|
||||
hysteresis = <2000>;
|
||||
type = "hot";
|
||||
};
|
||||
|
||||
cpu_trip_active: active {
|
||||
temperature = <50000>;
|
||||
hysteresis = <2000>;
|
||||
type = "active";
|
||||
};
|
||||
|
||||
cpu_trip_passive: passive {
|
||||
temperature = <40000>;
|
||||
hysteresis = <2000>;
|
||||
type = "passive";
|
||||
};
|
||||
};
|
||||
|
||||
cooling-maps {
|
||||
cpu-active-low {
|
||||
cooling-device = <&fan 1 1>;
|
||||
trip = <&cpu_trip_active_low>;
|
||||
};
|
||||
|
||||
cpu-active-med {
|
||||
cooling-device = <&fan 2 2>;
|
||||
trip = <&cpu_trip_active_med>;
|
||||
};
|
||||
|
||||
cpu-active-high {
|
||||
cooling-device = <&fan 3 3>;
|
||||
trip = <&cpu_trip_active_high>;
|
||||
trip = <&cpu_trip_critical>;
|
||||
};
|
||||
|
||||
cpu-active-low {
|
||||
cooling-device = <&fan 2 2>;
|
||||
trip = <&cpu_trip_hot>;
|
||||
};
|
||||
|
||||
cpu-active {
|
||||
cooling-device = <&fan 1 1>;
|
||||
trip = <&cpu_trip_active>;
|
||||
};
|
||||
|
||||
cpu-passive {
|
||||
cooling-device = <&fan 0 0>;
|
||||
trip = <&cpu_trip_passive>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
ð {
|
||||
status = "okay";
|
||||
|
||||
|
||||
@ -5,6 +5,32 @@
|
||||
/ {
|
||||
model = "Bananapi BPI-R3MINI";
|
||||
compatible = "bananapi,bpi-r3mini", "mediatek,mt7986a";
|
||||
|
||||
aliases {
|
||||
led-boot = &status_led;
|
||||
led-failsafe = &status_led;
|
||||
led-running = &status_led;
|
||||
led-upgrade = &status_led;
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
status_led: green {
|
||||
label = "r3mini:green";
|
||||
gpios = <&pio 19 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
};
|
||||
|
||||
fan: pwm-fan {
|
||||
compatible = "pwm-fan";
|
||||
#cooling-cells = <2>;
|
||||
cooling-levels = <255 128 80 0>;
|
||||
pwms = <&pwm 0 10000 0>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
||||
chosen {
|
||||
bootargs = "console=ttyS0,115200n1 loglevel=8 \
|
||||
earlycon=uart8250,mmio32,0x11002000";
|
||||
@ -154,6 +180,56 @@
|
||||
};
|
||||
};
|
||||
|
||||
&cpu_thermal {
|
||||
trips {
|
||||
cpu_trip_critical: critical {
|
||||
temperature = <85000>;
|
||||
hysteresis = <2000>;
|
||||
type = "critical";
|
||||
};
|
||||
|
||||
cpu_trip_hot: hot {
|
||||
temperature = <65000>;
|
||||
hysteresis = <2000>;
|
||||
type = "hot";
|
||||
};
|
||||
|
||||
cpu_trip_active: active {
|
||||
temperature = <50000>;
|
||||
hysteresis = <2000>;
|
||||
type = "active";
|
||||
};
|
||||
|
||||
cpu_trip_passive: passive {
|
||||
temperature = <40000>;
|
||||
hysteresis = <2000>;
|
||||
type = "passive";
|
||||
};
|
||||
};
|
||||
|
||||
cooling-maps {
|
||||
cpu-active-high {
|
||||
cooling-device = <&fan 3 3>;
|
||||
trip = <&cpu_trip_critical>;
|
||||
};
|
||||
|
||||
cpu-active-low {
|
||||
cooling-device = <&fan 2 2>;
|
||||
trip = <&cpu_trip_hot>;
|
||||
};
|
||||
|
||||
cpu-active {
|
||||
cooling-device = <&fan 1 1>;
|
||||
trip = <&cpu_trip_active>;
|
||||
};
|
||||
|
||||
cpu-passive {
|
||||
cooling-device = <&fan 0 0>;
|
||||
trip = <&cpu_trip_passive>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&hnat {
|
||||
mtketh-wan = "eth1";
|
||||
mtketh-lan = "eth0";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user