I'm using the sysfs API with those steps:
To switch to manual fan control from automatic, run
# echo "1" > /sys/class/drm/card0/device/hwmon/hwmon0/pwm1_enable
Set up fan speed to e.g. 50% (100% are 255 PWM cycles, thus calculate desired
fan speed percentage by multiplying its value by 2.55):
# echo "128" > /sys/class/drm/card0/device/hwmon/hwmon0/pwm1
To reset to automatic fan control, run
# echo "2" > /sys/class/drm/card0/device/hwmon/hwmon0/pwm1_enable
My RX580 Nitro+ starts beeping a constant high pitched weird noise until I set
it back to a fixed value or until reboot. It doesn't happen if start on auto,
only after switching to a value then back to auto.