diff --git a/package/firmware/bpir3_mini-properties/Makefile b/package/firmware/bpir3_mini-properties/Makefile index 700ec44159..c9ad8fde54 100644 --- a/package/firmware/bpir3_mini-properties/Makefile +++ b/package/firmware/bpir3_mini-properties/Makefile @@ -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)) diff --git a/package/firmware/bpir3_mini-properties/files/lib/firmware/EthMD32.DSP.bin b/package/firmware/bpir3_mini-properties/files/EthMD32.DSP.bin similarity index 100% rename from package/firmware/bpir3_mini-properties/files/lib/firmware/EthMD32.DSP.bin rename to package/firmware/bpir3_mini-properties/files/EthMD32.DSP.bin diff --git a/package/firmware/bpir3_mini-properties/files/lib/firmware/EthMD32.dm.bin b/package/firmware/bpir3_mini-properties/files/EthMD32.dm.bin similarity index 100% rename from package/firmware/bpir3_mini-properties/files/lib/firmware/EthMD32.dm.bin rename to package/firmware/bpir3_mini-properties/files/EthMD32.dm.bin diff --git a/package/firmware/bpir3_mini-properties/files/bpir3_fanspeed b/package/firmware/bpir3_mini-properties/files/bpir3_fanspeed new file mode 100755 index 0000000000..84d3676196 --- /dev/null +++ b/package/firmware/bpir3_mini-properties/files/bpir3_fanspeed @@ -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 diff --git a/package/firmware/bpir3_mini-properties/files/etc/init.d/fanspeed b/package/firmware/bpir3_mini-properties/files/etc/init.d/fanspeed deleted file mode 100755 index 521c9697b4..0000000000 --- a/package/firmware/bpir3_mini-properties/files/etc/init.d/fanspeed +++ /dev/null @@ -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 - diff --git a/package/firmware/bpir3_mini-properties/files/etc/init.d/ltecalling b/package/firmware/bpir3_mini-properties/files/etc/init.d/ltecalling deleted file mode 100755 index 3b7a292e94..0000000000 --- a/package/firmware/bpir3_mini-properties/files/etc/init.d/ltecalling +++ /dev/null @@ -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 diff --git a/package/firmware/bpir3_mini-properties/files/etc/rc.d/S25xltecalling b/package/firmware/bpir3_mini-properties/files/etc/rc.d/S25xltecalling deleted file mode 120000 index 9b3ac2eef0..0000000000 --- a/package/firmware/bpir3_mini-properties/files/etc/rc.d/S25xltecalling +++ /dev/null @@ -1 +0,0 @@ -../init.d/ltecalling \ No newline at end of file diff --git a/package/firmware/bpir3_mini-properties/files/etc/rc.d/S99xfanspeed b/package/firmware/bpir3_mini-properties/files/etc/rc.d/S99xfanspeed deleted file mode 120000 index 367db1fcdb..0000000000 --- a/package/firmware/bpir3_mini-properties/files/etc/rc.d/S99xfanspeed +++ /dev/null @@ -1 +0,0 @@ -../init.d/fanspeed \ No newline at end of file diff --git a/package/firmware/bpir3_mini-properties/files/fanspeed.init b/package/firmware/bpir3_mini-properties/files/fanspeed.init new file mode 100755 index 0000000000..47c7de0646 --- /dev/null +++ b/package/firmware/bpir3_mini-properties/files/fanspeed.init @@ -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 +} diff --git a/package/firmware/bpir3_mini-properties/files/ltecalling.init b/package/firmware/bpir3_mini-properties/files/ltecalling.init new file mode 100755 index 0000000000..b7a0125342 --- /dev/null +++ b/package/firmware/bpir3_mini-properties/files/ltecalling.init @@ -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 +}