Вы находитесь на странице: 1из 35

EveryAissacred...

ADynamicVoltageandCurrentRegulator
ControlInterfacefortheLinuxKernel.
LiamGirdwood

www.wolfsonmicro.com

Outline

IntroductiontoRegulatorBasedSystems.

RealWorldExamples

Static&DynamicSystemPower

CPUfreq&CPUIdle

RegulatorBasics&PowerDomains

LCDBacklight

PMP/InternetTabletExample

Audio

KernelRegulatorFramework

NAND/NOR

ConsumerInterface

Resources&Status

RegulatorDriverInterface

Thanks

MachineInterface

sysfsInterface(ABI)

Q&A

www.wolfsonmicro.com

IntroductiontoRegulatorBasedSystems

www.wolfsonmicro.com

Static&DynamicSystemPower

Semiconductorpowerconsumptionhastwocomponentsstaticand
dynamic.
Power(Total)=P(static)+P(dynamic)

Staticpowerisleakagecurrent.
Smallerthandynamicpowerwhensystemisactive.
Mainpowerdraininsystemstandbystate.

Dynamicpowerisactivecurrent.
Signalsswitching.(e.g.clocks)
Analogcircuitschangingstate(e.g.audioplayback).
Power(dynamic)=CV2F

Regulatorscanbeusedtosavestaticanddynamicpower
4

www.wolfsonmicro.com

RegulatorBasics

Software
Control

InputPower
Battery
Line
USB
Regulator

OutputPower
Regulator

Device
Regulator

Regulatestheoutputpowerfrominputpower.
Voltagecontrolinputis5Voutputis1.8V
Currentlimitinglimitoutputcurrentto20mAmax
Simpleswitchswitchoutputpoweron/off
5

www.wolfsonmicro.com

PowerDomains

Domain1
Regulator1

Regulator2

Domain2

Domain3

Regulator3

ConsumerE

ConsumerA

ConsumerC

ConsumerB

ConsumerD

Regulator1suppliesDomain1
Regulator2suppliesDomain2
Regulator3suppliesDomain3

Powerdomainsuppliedpowerbytheoutputofa
regulator,
switch
orbyanotherpowerdomain.

Haspowerconstraintstoprotecthardware.
6

www.wolfsonmicro.com

SystemArchitecture(PMP,InternetTablet)
Key

DigPowerDyn
A/RFPowerDyn

Audio

Codec

Communications

FMTuner

BT

System
NOR/NAND

CPU(DVFS)

DDR

Touchscreen

TVOut
LCD
Backlight

WIFI
HDD
USB
PMIC

Display

Device

DigPowerStatic

Storage

Regulator

Battery
Mains
USB
www.wolfsonmicro.com

SystemArchitecture(PMP,InternetTablet)
Key
LDO1

DCDC1

DigPowerDyn

System

A/RFPowerDyn NOR/NAND

Codec

Audio

LDO2

LDO5

LDO12

Communications

LDO4

CPU(DVFS)

DDR

LDO8

LDO6
TVOut
LCD

BT
DCDC3

Backlight

WIFI
HDD
USB
PMIC

LDO7

Touchscreen

FMTuner

LDO3

DCDC2

Display

Device

DigPowerStatic

LDO11
LDO9
DCDC4

Storage

Regulator

DCDC5
Battery
Mains
USB
www.wolfsonmicro.com

KernelRegulatorFramework

www.wolfsonmicro.com

RegulatorFrameworkWhatisit?

Designedtoprovideastandardkernelinterfacetocontrolvoltageand
currentregulators.

Allowsystemstodynamicallycontrolregulatorpoweroutputinorder
tosavepowerandprolongbatterylife.

Appliestoboth
voltageregulators(wherevoltageoutputiscontrollable)
currentsinks(wherecurrentlimitiscontrollable)

Dividedintofourseparateinterfaces.
Consumerinterfacefordevicedrivers
Regulatordriversinterfaceforregulatordrivers
Machineinterfaceforboardconfiguration
sysfsinterfaceforuserspace

10

www.wolfsonmicro.com

RegulatorConsumerInterface

Consumersareclientdevicedriversthatuseregulator(s)tocontrol
theirpowersupply.

Consumersareconstrainedbytheconstraintsofthepowerdomain
theyareon
Consumerscan'trequestpowersettingsthatmaydamagethemselves,other
consumersorthesystem.

Classifiedintotwotypes
Static(onlyneedtoenable/disable)
Dynamic(needtochangevoltage/currentlimit)

11

www.wolfsonmicro.com

RegulatorConsumerInterfaceBasics

Accesstoregulatorisby
regulator = regulator_get(dev, "Vcc");
regulator_put(regulator);

Enableanddisable
int regulator_enable(regulator);
int regulator_disable(regulator);
int regulator_force_disable(regulator);

Status
int regulator_is_enabled(regulator);

12

www.wolfsonmicro.com

RegulatorConsumerInterfaceVoltage

Consumerscanrequesttheirsupplyvoltagewith
int regulator_set_voltage(struct regulator *regulator, int
min_uV, int max_uV);

Constraintsarecheckedbeforechangingvoltage.
regulator_set_voltage(regulator, 100000, 150000);

Supplyvoltagecanbefoundwith
int regulator_get_voltage(struct regulator *regulator);

13

www.wolfsonmicro.com

RegulatorConsumerInterfaceCurrentLimit

Consumerscanrequesttheirsupplycurrentlimitwith
int regulator_set_current_limit(struct regulator *regulator,
int min_uA, int max_uA);

Constraintsarecheckedbeforechangingcurrentlimit.
regulator_set_current_limit(regulator, 1000, 2000);

Supplycurrentlimitcanbefoundwith
int regulator_get_current_limit(struct regulator *regulator);

14

www.wolfsonmicro.com

RegulatorConsumerInterfaceOpMode

100

Regulatorsarenot100%
efficient.

Efficiencycanvarydepending
onload.

Regulatorscanchangeop
modetoincreaseefficiency.

90

Efficiency(%)

80
70
60
50
40
30

NormalMode

20
IdleMode

10
0
1

10

100

1000

Load(mA)

15

www.wolfsonmicro.com

RegulatorConsumerInterfaceOpMode

Consumerwith10mAload:

100
90

70%@Normal=~13mA

Efficiency(%)

80
70

60
50

Saving~2mA

40
30

90%@Idle=~11mA

NormalMode

20
IdleMode

10
0
1

10

100

1000

Load(mA)

Wesumtotalloadforregulators>1consumerbeforechangingmode.
Optimumefficiencycanberequestedbycalling
regulator_set_optimum_mode(regulator, 10000); // 10mA
16

www.wolfsonmicro.com

RegulatorConsumerInterfaceEvents

Regulatorhardwarecannotify
softwareofcertainevents.
Regulatorfailures.
Overtemperature.

17

Consumerscanthenhandleas
required.

www.wolfsonmicro.com

RegulatorConsumerInterfaceSummary

Consumerregistration
regulator_get(), regulator_put()

Regulatoroutputpowercontrolandstatus.
regulator_enable(), regulator_disable(), regulator_force_disable(),
regulator_is_enabled()

Regulatoroutputvoltagecontrolandstatus
regulator_set_voltage(), regulator_get_voltage()

Regulatoroutputcurrentlimitcontrolandstatus
regulator_set_current_limit(), regulator_get_current_limit()

Regulatoroperatingmodecontrolandstatus
regulator_set_mode(), regulator_get_mode(), regulator_set_optimum_mode()

Regulatorevents
regulator_register_notifier(), regulator_unregister_notifier()

18

www.wolfsonmicro.com

RegulatorDriverInterface

Regulatordriversmustberegisteredwiththeframeworkbeforethey
canbeusedbyconsumers.
struct regulator_dev *regulator_register(struct regulator_desc
*regulator_desc, void *reg_data);
void regulator_unregister(struct regulator_dev *rdev);

Eventscanbepropagatedtoconsumers
int regulator_notifier_call_chain(struct regulator_dev *rdev,
unsigned long event, void *data);

19

www.wolfsonmicro.com

RegulatorDriverInterfaceOperations
struct regulator_ops {
/* get/set regulator voltage */
int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV);
int (*get_voltage) (struct regulator_dev *);
/* get/set regulator current */
int (*set_current_limit) (struct regulator_dev *,
int min_uA, int max_uA);
int (*get_current_limit) (struct regulator_dev *);
/* enable/disable regulator */
int (*enable) (struct regulator_dev *);
int (*disable) (struct regulator_dev *);
int (*is_enabled) (struct regulator_dev *);
/* get/set regulator operating mode (defined in regulator.h) */
int (*set_mode) (struct regulator_dev *, unsigned int mode);
unsigned int (*get_mode) (struct regulator_dev *);
/* get most efficient regulator operating mode for load */
unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV,
int output_uV, int load_uA);
};

20

www.wolfsonmicro.com

RegulatorDriverInterfaceSummary

Regulatordriverscanregistertheirserviceswiththecore.
regulator_register(), regulator_unregister()

Regulatorscansendeventstothecoreandhencetoall
consumers.
regulator_notifier_call_chain()

Regulatordriverprivatedata.
rdev_get_drvdata()

21

www.wolfsonmicro.com

MachineDriverInterface

Fabricdriverthatismachinespecificanddescribes
Powerdomains
Regulator1suppliesconsumersx,y,z.
Powerdomainsuppliers
Regulator1issuppliedbydefault(Line/Battery/USB).OR
Regulator1issuppliedbyregulator2.
Powerdomainconstraints
Regulator1outputmustbe>=1.6Vand<=1.8V

22

www.wolfsonmicro.com

MachineDriverInterface

Fabricthatgluesregulatorstoconsumerdevices
e.g.NANDissuppliedbyLDO1
InputPower

LDO1

OutputPower
NAND

ThisattachesLDO1tosupplypowertotheNANDVccsupplypin(s).
regulator_set_device_supply (LDO1, dev, Vcc);

23

www.wolfsonmicro.com

MachineDriverInterfaceConstraints

Definessafeoperatinglimitsforpowerdomain.
Preventssystemdamagethroughunsafeconsumerrequests.
struct regulation_constraints audio_avdd = {
.min_uV = 3300000,
.max_uV = 3300000,
.valid_modes_mask = REGULATOR_MODE_NORMAL,
.apply_uV = 1,
};
regulator_set_platform_constraints(regulator, &audio_avdd);

24

www.wolfsonmicro.com

MachineDriverInterface(cont)
Domain1
Regulator1

Domain2

Regulator2

ConsumerA

ConsumerC

ConsumerB

ConsumerD

Someregulatorsaresuppliedpowerbyotherregulators.

Ensureregulator1isenabledbeforetryingtoenableregulator2.
regulator_set_supply(Regulator-2, Regulator-1);

25

www.wolfsonmicro.com

MachineInterfaceSummary

Regulator>consumerdevicemapping
regulator_set_device_supply()

Regulator>regulatormapping
regulator_set_supply(), regulator_get_supply()

RegulatorPowerDomainconstraints.
regulator_set_platform_constraints()

26

www.wolfsonmicro.com

ABIsysfsInterface

Exportsregulatorandconsumerinformationtouserspace
Isreadonly
Voltage
Currentlimit
State
OperatingMode
Constraints

Couldbeusedtoprovidemorepowerusageinfotopowertop

27

www.wolfsonmicro.com

RealWorldExamples

28

www.wolfsonmicro.com

UsecaseCPUfreq&CPUIdle

CPUfreqscalesCPUfrequencytomeetprocessingdemands
Voltagecanalsobescaledwithfrequency.
Increasedwithfrequencytoincreaseperformance/stability.
Decreasedwithfrequencytosavepower.
regulator_set_voltage(regulator, 1600000, 1600000); //1.6V

CPUIdlecanplacetheCPUinnumerouslowpoweridle
states.
Idlestatesdrawlesspowerandmaytakeadvantageofregulator
efficiencybychangingregulatoroperatingmode.
regulator_set_optimum_mode(regulator, 10000); // 10mA
29

www.wolfsonmicro.com

UseCaseLCDBacklight

LCDbacklightingisusuallyasignificantdrainofsystempower.
Powercanbesavedbyloweringbrightnesswhenit'spossible
todoso.
e.g.SomebacklightsarebasedonwhiteLED'sandcan
havebrightnesschangedbychangingcurrent.
regulator_set_current_limit(regulator, 10000, 10000);

30

www.wolfsonmicro.com

UseCaseAudio

Audiohardwareconsumesrequiresanalogpowerwhenthere
isnoaudioplaybackorcapture.
Powercouldbesavedwhenidlebyturningoffanalogsupplies
whennotinuse.
Powercouldadditionallybesavedbyturningoffcomponents
thatarenotbeingusedinthecurrentusecase
FMTunercouldbedisabledwhenMP3'sareplayed.
SpeakerAmpcanbedisabledwhenHeadphonesareused.
regulator_enable(regulator)
regulator_disable(regulator)

31

www.wolfsonmicro.com

UseCaseNAND/NOR

NAND&NORdevicesconsumemorepowerduringIOthan
idle.
NAND/NORconsumerdrivercanchangeregulatoroperating
modetogainefficiencysavingswhenidle.
regulator_set_optimum_mode(regulator, 1000); // 1mA
State

MaxLoad(mA)

Read/Write

35

Erase

40

Erase+rw

55

Idle

NAND/NORchipmaxload(fromdatasheet)

32

www.wolfsonmicro.com

Resources

Stablecorecodeworkingonseveralmachines.

CurrentlysupportsFreescaleMC13783,WolfsonWM8350&
WM8400.

WorkingwithmmkernelbyprovidingpatchestotheAndrewMorton.

Projectwebsite:http://opensource.wolfsonmicro.com/node/15

githttp://opensource.wolfsonmicro.com/cgibin/gitweb.cgi

33

www.wolfsonmicro.com

Thanks
LauraLawrence
RobHerring
NancyChen
MarkBrown
GregKroahHartman
AndrewMorton
DavidBrownell
SamRavnborg
KevinHillman
IanBrockbank
GrantMore

34

www.wolfsonmicro.com

Q&A

Questions&Answers

35

www.wolfsonmicro.com