Welche PWM-Frequenz?
Ein LM317 lässt sich mit einem Widerstand als Konstantstromquelle schalten.
https://www.roboternetz.de/phpBB2/konstantstrom.php