Regulating voltage or current