With the Pi 4b+ being such "hot property" - quite literally speaking, I found the need to run a cooling fan. Given that my Pi4 still spends a lot of time doing very little, I don't want the fan running full tilt all the time. That led me to start working on controlling the fan using PWM.
The result is the beginnings of a daemon which provides PWM control of a fan which can be controlled via hardware PWM on GPIO 18 (pin 12).
I have now uploaded the code to GitHub: https://github.com/gmrza/picfan.
Please keep in mind that this is very much alpha code. If it blows up your Pi, don't blame me!
You can set the target temperature and a few other things either via a config file in /etc (picfan.conf) or using command line options.
Documentation is pretty much non-existent at the moment.