If you absolutely have to avoid PWM (and I don't think that you do), then there are a couple of ways that you could do so.
Here's the simplified answer to your question: a circuit that takes a 5V PWM and turns it into a smooth 12V output. It's a basic boost converter. The problem with this is that in order to be effective, you really need some sort of feedback like a tachometer or a voltage measurement. You also have to control the loop dynamics and watch out for a bunch of other things. It can be done, but it's more work than you'd think.
simulate this circuit – Schematic created using CircuitLab
Another approach would be to use an off-the shelf switching regulator module to boost from 5V to 12V. Then you could use your processor to inject current into the feedback node in order to adjust the output voltage the voltage, either through an analog output or through the filtered PWM approach you've suggested above. You could buy a boost regulator module (like this one) or design a custom PCB yourself.
Advantages
- Simple to understand and build
- Low cost
- More efficient than a linear solution
Disadvantages
- Voltages cannot get below your input voltage unless you use a buck-boost module (like this one).
- With most boost converters, there is always a DC path from your power supply to the load, unless you can find a module with output disconnect or enable/shut down, you will never be able to fully power down your fan.
- You have to select the resistors appropriately to allow yourself to have the range and resolution that you want.
- You have to make sure that you've got a really clean input voltage to the regulator's feedback node. Any noise pickup or ripple here could make the regulator very unstable.
Here's what the configuration would look like as an input to your module's feedback node. You would probably want to have a filter pretty close to R3 on the board below.
Again, I'm not sure that you need to avoid PWM here, but if you absolutely must you can give this a shot. It will probably be easier and more reliable than if you try to design a boost converter yourself.
simulate this circuit