Thesuccess'sroadCELinuxPM远见品质WhatWe’llTalkPMTheoryandHardwareSupport2.6kernelPM_SubsystemCELFPMSpecificationAppendixCurrentPMImplementation远见品质Hardwarecomponents远见品质HardwarecomponentsPowerControlledComponentsinclude:IntelPXAXscaleCPU,real-timeclock,DRAM,Flash,LCD,frontlight,UART,audiocodec,touchscreen,keysandpowerbutton,etc.TheXscalePXA27XCPUsupportsseveralpower-savingfeatures.远见品质XscaleCPUPMFeaturesPXA27XPMfeatures,includingfrequencyscalingandCPUcorevoltagescaling.Andseveralmodesofoperation:RunmodeAllpowersuppliesenabled,allclocksrunningandeveryon-chipresourceisfunctional.IdlemodeCPUclockstopped.otheron-chipresourcesareactive.Whenaninterruptoccurs,theCPUisreactivated.SleepmodePowerisswitchedofftothemajorityoftheprocessor.Somepreprogrammedevent,suchasapowerbuttonpress,wakesuptheCPUfromthismode远见品质HandheldEnergyBudgets远见品质PMTheoryOSPMfocusesonactivepowerconsumptionModulatemethods:Voltage/clockmodulateClockselectedPowersupplyselected远见品质KernelPM_Subsystem远见品质KernelPM_SubsystemWhatwewilltalkCoversthetwobroadareasofpowermanagement:SystemPowerManagement(SPM)DevicePowerManagement(DPM)Andmore……远见品质DevicePowerManagement(DPM)DevicePMDealswiththeprocessofplacingindividualdevicesintolow-powerstateswhilethesystemisrunning.Invokedexplicitlyondevices,ormayhappenautomaticallyafteradevicehasbeenidleforasetofamountoftime.远见品质SystemPowerManagement(SPM)SystemPMTheentiresystemisplacedintoalow-powerstate.runningsystemissavedbeforepowereddown,andrestoredoncethesystemhasregainedpower.Automaticallyenteralow-powerstateafterithasbeenidleforsomeamountoftime,orwhensomecriticalstatehasbeenreached.Alsopolicydecisionsthatareuptotheusertoconfigureandrequiresomeglobalmechanismforcontrolling.远见品质DevicePowerManagementNewdrivermodel(LDM)inthe2.6kernel,whichprovidesahierarchicalrepresentationofthedevicesinthesystem.Devicepowerstatesaredescribedas'D'states,andconsistofstatesD0-D3,inclusive.(InfluencedbyACPISpec)远见品质DevicePMDataStructsAdevice'sPMinforstoredinstructdevice_pm,structdevicecontainsadevice_pmobject.structdevice_pm{dev_power_tpower_state;u8*saved_state;atomic_tdepend;atomic_tdisable;structkobjectkobj;};远见品质DevicePMDataStructstypedefenum{DEVICE_PM_ON,DEVICE_PM_INT1,DEVICE_PM_INT2,DEVICE_PM_OFF,DEVICE_PM_UNKNOWN,//Device’sinitialpowerstate}dev_power_t;enum{SUSPEND_SAVE_STATE,SUSPEND_POWER_DOWN,};enum{RESUME_POWER_ON,RESUME_RESTORE_STATE,};远见品质PowerDependenciesTwostepstosuspenddeviceonetosavestateanothertopowerthedevicedownConversely,onecallismadetotheresume()methodtopowerthedeviceupanothertorestoredevicestate.allchildrendevicesmustbepowereddownbeforetheirparentcanbepowereddown.Conversely,theparentdevicemustbepoweredupbeforeanychildrendevicesmaybeaccessed.Onlywhenadevice'sdependcount(structdevice_pm::dependfield.)is0mayitbepowereddown.intdevice_pm_get/put(structdevice*);远见品质RegisterPMhandlersstaticint__initi2c_init(void){retval=bus_register(&i2c_bus_type);retval=driver_register(&i2c_adapter_driver);returnclass_register(&i2c_adapter_class);}structbus_typei2c_bus_type={.name=i2c,.match=i2c_device_match,.suspend=i2c_bus_suspend,.resume=i2c_bus_resume,};staticinti2c_bus_suspend(structdevice*dev,u32state){if(dev-driver&&dev-driver-suspend)rc=dev-driver-suspend(dev,state,0);}//DeviceSpecifieddriver,explainlater远见品质RegisterPMhandlersstaticstructdevice_driveri2c_adapter_driver={.name=i2c_adapter,.bus=&i2c_bus_type,.probe=i2c_device_probe,.remove=i2c_device_remove,};staticstructclassi2c_adapter_class={.name=i2c-adapter,.release=&i2c_adapter_class_dev_release,};远见品质RegisterPMhandlersstaticstructdevice_driveri2c_pxa_driver={.name=pxa2xx-i2c,.bus=&platform_bus_type,.probe=i2c_pxa_probe,.remove=i2c_pxa_remove,.suspend=i2c_pxa_controller_suspend,.resume=i2c_pxa_controller_resume,};staticint__initi2c_adap_pxa_init(void){returndriver_register(&i2c_pxa_driver);}远见品质RegisterPMhandlersstaticinti2c_pxa_controller_suspend(structdevice*dev,u32state,u32level){#ifdefCONFIG_PMi2c_pxa_wait_bus_not_busy();i2c_pxa_stop();#endifreturn0;}远见品质InternalSequenceofDevicePMechon/sys/bus/i2c/devices/1-1/power/state(ncanbe“0~3”)Whenn==0(resumestepssimilar)state_store()[drivers/base/power/sysfs.c]-dpm_runtime_suspend()[drivers/base/power/runtime.c]-suspend_device()[drivers/base/power/suspend.c]-•callsuspendhandlerofthebuswhichthespecifieddevicebelongsto.-•callsuspendhandlerforthespecifieddevice远见品质SystemPowerManagementPowerStates:KernelsupportsstatesareStandby,Suspend,andHibernate.typedefenum{POWER_ON=0,POWER_STANDBY=0x01,POWER_SUSPEND=0x02,POWER_HIBERNATE=0x04,}pm_system_state_t;远见品质SystemPMStatesStandbylow-latencypoweras'power-onsuspend'.systemconservespowerbyplacingtheCPUinahaltstateandthedevicesintheD1state.Thepowersavingsarenotsignificant,buttheresponselatencyisminimal.SuspendAs'suspend-to-RAM'.alldevicesareplacedintheD3stateandtheentiresystem,exceptmainmemory,isexpectedtolosepower.Memoryisplacedinself-refreshmode,soitscontentsarenotlost.ResponselatencyishigherthanStandby.Hibernateconservest