FYI, I use this script to control the fans on my AMD R9 Nano:
https://github.com/grmat/amdgpu-fancontrol/blob/master/amdgpu-fancontrol
I like that you can enter all the temp & pwm pairs in just two lines (7 & 8). OTOH it doesn't feature your auto-detection.
This just as food for thought. :-)
This how the script looks in action:
