Patent ID: 8787039

Claim:
A switching power converter comprising: a transformer including a primary winding coupled to an input voltage and a secondary winding coupled to an output of the switching power converter; a switch coupled to the primary winding of the transformer, current through the primary winding being generated while the switch is turned on and not being generated while the switch is turned off; and a controller configured to generate a control signal to turn on or turn off the switch at each of a plurality of switching cycles of the switch; wherein the controller is further configured to generate the control signal to turn on the switch in a constant on-time mode of the switching power converter during each of the plurality of switching cycles for a first duration that is constant during each of the plurality of switching cycles corresponding to a first part of at least a single one of AC cycles of the input voltage responsive to the input voltage being less than a threshold voltage; and wherein the controller is further configured to generate the control signal to turn on the switch in a constant power mode of the switching power converter during each of the plurality of switching cycles for a second duration that varies during at least some of the plurality of switching cycles corresponding to a second part of said at least the single one of the AC cycles of the input voltage responsive to the input voltage being greater than the threshold voltage; wherein the controller does not receive a level of the input voltage and is further configured to determine whether the input voltage is less than or greater than the threshold voltage based on a slope of the current through the primary winding that is used by the controller as a proxy for the level of the input voltage.