增加风扇自动调速

This commit is contained in:
kos 2023-09-13 02:18:58 +00:00
parent ec28293a45
commit aa56bc61ba
3 changed files with 121 additions and 5 deletions

View File

@ -25,7 +25,10 @@ rockchip_setup_interfaces()
generate_mac_from_mmc_cid()
{
local sd_hash=$(sha256sum /sys/class/block/mmcblk*/device/cid | head -n 1)
[ -d /sys/class/block/mmcblk0/mmcblk0boot0 ]&&mmcnb=mmcblk0
[ -d /sys/class/block/mmcblk1/mmcblk1boot0 ]&&mmcnb=mmcblk1
[ -d /sys/class/block/mmcblk2/mmcblk2boot0 ]&&mmcnb=mmcblk2
local sd_hash=$(sha256sum /sys/class/block/$mmcnb/device/cid)
local mac_base=$(macaddr_canonicalize "$(echo "${sd_hash}" | dd bs=1 count=12 2>/dev/null)")
echo "$(macaddr_unsetbit_mc "$(macaddr_setbit_la "${mac_base}")")"
}

View File

@ -403,6 +403,7 @@ CONFIG_SCSI_SAS_HOST_SMP=y
CONFIG_SCSI_SAS_LIBSAS=y
# CONFIG_SECURITY_DMESG_RESTRICT is not set
CONFIG_SENSORS_ARM_SCPI=y
CONFIG_SENSORS_PWM_FAN=y
CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
CONFIG_SERIAL_8250_DW=y
CONFIG_SERIAL_8250_DWLIB=y

View File

@ -14,6 +14,9 @@
led-failsafe = &user_led2;
led-running = &user_led1;
led-upgrade = &user_led2;
mmc0 = &sdio0;
mmc1 = &sdmmc;
mmc2 = &sdhci;
spi1 = &spi1;
};
@ -46,8 +49,9 @@
compatible = "pwm-fan";
#cooling-cells = <2>;
fan-supply = <&vcc12v_dcin>;
pwms = <&pwm0 0 50000 0>;
cooling-levels = <0 100 150 200 255>;
pwms = <&pwm0 0 10000 0>;
cooling-levels = <0 75 100 150 200 255>;
//rockchip,temp-trips = <40000 1 45000 2 50000 3 55000 4 60000 5>;
status = "okay";
};
@ -98,6 +102,7 @@
pinctrl-names = "default";
pinctrl-0 = <&wifi_reg_on_h>;
reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
post-power-on-delay-ms = <300>;
};
/*
@ -140,6 +145,34 @@
vin-supply = <&vcc5v0_sys>;
};
vcc3v3_ext1: vcc3v3-ext1 {
compatible = "regulator-fixed";
regulator-always-on;
regulator-boot-on;
enable-active-high;
gpio = <&gpio2 RK_PA1 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&ext_pon_switch_wifi>;
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-name = "vcc3v3_ext1";
vin-supply = <&vcc5v0_sys>;
};
vcc3v3_ext2: vcc3v3-ext2 {
compatible = "regulator-fixed";
regulator-always-on;
regulator-boot-on;
enable-active-high;
gpio = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&ext_jms561_m2>;
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-name = "vcc3v3_ext2";
vin-supply = <&vcc5v0_sys>;
};
vcc3v3_sys: vcc3v3-sys {
compatible = "regulator-fixed";
regulator-always-on;
@ -184,6 +217,20 @@
vin-supply = <&vcc3v3_ext>;
};
vcc3v3_jms561: vcc3v3-jms561 {
compatible = "regulator-fixed";
enable-active-high;
gpio = <&gpio2 RK_PA0 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&jms561_pw>;
startup-delay-us = <200000>;
regulator-always-on;
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-name = "vcc3v3_jms561";
vin-supply = <&vcc3v3_ext2>;
};
vcc5v0_host: vcc5v0-host-regulator {
compatible = "regulator-fixed";
regulator-name = "vcc5v0_host";
@ -226,6 +273,58 @@
};
};
&cpu_thermal {
trips {
cpu_cool: cpu_cool {
temperature = <38000>;
hysteresis = <2000>;
type = "active";
};
cpu_normal: cpu_normal {
temperature = <43000>;
hysteresis = <2000>;
type = "active";
};
cpu_warm: cpu_warm {
temperature = <46000>;
hysteresis = <2000>;
type = "active";
};
cpu_hot: cpu_hot {
temperature = <48000>;
hysteresis = <2000>;
type = "active";
};
cpu_max: cpu_max {
temperature = <50000>;
hysteresis = <2000>;
type = "active";
};
};
cooling-maps {
map2 {
trip = <&cpu_cool>;
cooling-device = <&fan 0 1>;
};
map3 {
trip = <&cpu_normal>;
cooling-device = <&fan 1 2>;
};
map4 {
trip = <&cpu_warm>;
cooling-device = <&fan 2 3>;
};
map5 {
trip = <&cpu_hot>;
cooling-device = <&fan 3 4>;
};
map6 {
trip = <&cpu_max>;
cooling-device = <&fan 4 5>;
};
};
};
&cpu_b0 {
cpu-supply = <&vdd_cpu_b>;
};
@ -652,6 +751,18 @@
};
};
power_ext{
ext_pon_switch_wifi: ext-pon-switch-wifi {
rockchip,pins = <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
};
ext_jms561_m2: ext-jms561-m2 {
rockchip,pins = <4 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
};
jms561_pw: jms561-pw {
rockchip,pins = <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
leds {
user_led1_pin: user-led1-pin {
rockchip,pins =
@ -869,6 +980,7 @@
bus-width = <4>;
//clock-frequency = <50000000>;
cap-sdio-irq;
supports-sdio;
cap-sd-highspeed;
keep-power-in-suspend;
mmc-pwrseq = <&sdio_pwrseq>;
@ -898,8 +1010,8 @@
pinctrl-names = "default";
pinctrl-0 = <&sdmmc_bus4 &sdmmc_clk &sdmmc_cmd &sdmmc0_det_l>;
status = "okay";
vmmc-supply = <&vcc3v3_sd>;
vqmmc-supply = <&vcc_sdio>;
//vmmc-supply = <&vcc3v3_sd>;
vqmmc-supply = <&vcc3v3_sd>;
};
&tcphy0 {