The current pwmout_api of the stm devices sets the prescaler in such a way that the clock of the timers is 1MHz.
We need to have an output frequency above the hearing range (so 25kHz and up) which is still possible but we lose a lot of resolution this way. In the case of 25kHz the timers auto reload register is set to 40 which means we only have 2.5% steps left in duty cycle.
Since most devices have internal clock speeds which are way higher than 1MHz, why not start with a higher base clock for the timer and let the while loop in pwmout_period_us() increase the prescaler if necessary.