Jump to content

DzubyBB

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by DzubyBB

  1. Ok, i'm managed to do this using pwm on pin gpiox-5, overlay : /dts-v1/; /plugin/; / { compatible = "amlogic,a311d\0amlogic,g12a\0amlogic,g12b\0amlogic,sm1"; fragment@0 { target = <&pwm_cd>; __overlay__ { status = "okay"; pinctrl-0 = <&pwm_c_x5_pins>; pinctrl-names = "default"; }; }; fragment@1 { target-path = "/"; __overlay__ { fan0: pwm-fan { compatible = "pwm-fan"; pwms = <&pwm_cd 0 40000 0>; /* 25kHz frequency (40000ns period) */ cooling-min-state = <0>; cooling-max-state = <4>; #cooling-cells = <2>; cooling-levels = <26 52 102 153 204>; /* 10%, 20%, 40%, 60%, 80% duty cycles (out of 255) */ }; }; }; fragment@2 { target = <&cpu_thermal>; __overlay__ { polling-delay = <1000>; /* 1 second polling */ trips { cpu_fan_low: cpu-fan-low { temperature = <35000>; /* 35°C */ hysteresis = <2000>; /* 2°C */ type = "active"; }; cpu_fan_mid1: cpu-fan-mid1 { temperature = <40000>; /* 40°C */ hysteresis = <2000>; type = "active"; }; cpu_fan_mid2: cpu-fan-mid2 { temperature = <45000>; /* 45°C */ hysteresis = <2000>; type = "active"; }; cpu_fan_mid3: cpu-fan-mid3 { temperature = <50000>; /* 50°C */ hysteresis = <2000>; type = "active"; }; cpu_fan_high: cpu-fan-high { temperature = <55000>; /* 55°C */ hysteresis = <2000>; type = "active"; }; }; cooling-maps { map0 { trip = <&cpu_fan_low>; cooling-device = <&fan0 0 0>; /* 10% speed */ }; map1 { trip = <&cpu_fan_mid1>; cooling-device = <&fan0 1 1>; /* 20% speed */ }; map2 { trip = <&cpu_fan_mid2>; cooling-device = <&fan0 2 2>; /* 40% speed */ }; map3 { trip = <&cpu_fan_mid3>; cooling-device = <&fan0 3 3>; /* 60% speed */ }; map4 { trip = <&cpu_fan_high>; cooling-device = <&fan0 4 4>; /* 80% speed */ }; }; }; }; }; It has 5 levels of fan speed (10%, 20%, 40%, 60%, 80%) that depends on cpu temperature
  2. It looks that it kicks in on 100% at 55C, and it's shuts the fan on 44C. I will try the one You sent, thanks.
  3. Well, with `meson-g12-pwm-gpiox-5-fan` something works, but very strangely. The fan turns on at 100% when I start the load and runs until the CPU temperature drops below 46°C. Then it stops working, there is no smooth fan speed control in between.
  4. Hi everyone, I'm trying to control an 5v PWM Fan using hardware PWM pins of Banana Pi M5. I'm not able to output any pwm signal on any pin. It looks like there is an pwm controller visible at `/proc/device-tree/soc/bus@ffd00000/pwm@19000`. File `/proc/device-tree/soc/bus@ffd00000/pwm@19000/status` has content `okay` and file `/proc/device-tree/soc/bus@ffd00000/pwm@19000/pinctrl-0` has content `&`. When i run script: echo 0 | tee /sys/class/pwm/pwmchip0/export echo 40000 | tee /sys/class/pwm/pwmchip0/pwm0/period echo 20000 | tee /sys/class/pwm/pwmchip0/pwm0/duty_cycle echo 1 | tee /sys/class/pwm/pwmchip0/pwm0/enable echo 1 | tee /sys/class/pwm/pwmchip1/export echo 40000 | tee /sys/class/pwm/pwmchip1/pwm1/period echo 20000 | tee /sys/class/pwm/pwmchip1/pwm1/duty_cycle echo 1 | tee /sys/class/pwm/pwmchip1/pwm1/enable (only those 2 pins of PWMs are free, script runs without any errors) i cannot detect any pwm signals on any of 40-pin connector. Additionally after that : #: cat /sys/kernel/debug/pinctrl/*/pinmux-pins | grep pwm pin 81 (GPIOX_16): ffd19000.pwm (GPIO UNCLAIMED) function pwm_e group pwm_e pin 13 (GPIOE_1): ff802000.pwm (GPIO UNCLAIMED) function pwm_ao_d group pwm_ao_d_e #: cat /sys/kernel/debug/pwm 0: platform/ff802000.pwm, 2 PWM devices pwm-0 (sysfs ): requested enabled period: 100000 ns duty: 50000 ns polarity: normal pwm-1 (regulator-vddcpu ): requested enabled period: 1250 ns duty: 100 ns polarity: normal 1: platform/ffd19000.pwm, 2 PWM devices pwm-0 (wifi32k ): requested period: 30518 ns duty: 15259 ns polarity: normal pwm-1 (sysfs ): requested enabled period: 100000 ns duty: 50000 ns polarity: normal So looks like pwm signals are not routed to IO pins. I tried to add overlay : /dts-v1/; /plugin/; / { compatible = "bananapi,m5", "amlogic,meson-sm1"; fragment@0 { target-path = <&pwm_ef>; _overlay__ { status = "okay"; pinctrl-0 = <&pwm_e_pins>; pinctrl-names = "default"; }; }; fragment@1 { target-path = "/"; __overlay__ { pwm_e_pins: pwm_e_pins { compatible = "pwm-gpio"; pinctrl-names = "default"; pinctrl-0 = <&pwm_e>; }; }; }; }; which i compiled with dtc and added to `/boot/overlay-user`, after that i added a line user_overlays=meson-m5-custom-pwm to `/boot/armbianEnv.txt` But it didn't worked. I'm not surprised because it was generated by AI, and i don't now anything about overlays. Is there anybody that can help me with writing this overlay ? Or maybe there is simpler solution ?
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines