# Power Management Service

- [API reference](https://docs.qualcomm.com/doc/80-41102-2/topic/_doxygen_rst_file__doxygen_sources_taf_pm_interface_h.html#file-taf-pm-interface-h)

Components need access to the TelAF Power Manager to control the system’s wake-up state. Operations that need fast response times (e.g., maintaining call state or playing/recording a media stream) result in high interrupt rates; keeping the system awake results in better performance and power efficiency.

TelAF Power Manager keeps the system awake when at least one of the registered components requests a wakeup source to be held. When all wakeup sources are released, the system may enter a suspend state depending on the status of other (unrelated) wakeup sources.

## IPC interfaces binding

The functions of this API are provided by the **tafPMSvc** application service.

The following example illustrates how to bind to PM services.

bindings:
    {
        clientExe.clientComponent.taf_pm -> tafPMSvc.taf_pm
    }
    Copy to clipboard

## Requesting and releasing a wakeup source

TelAF Power Manager service provides basic APIs for requesting and releasing a wakeup source. TelAF Power Manager’s clients call [taf\_pm\_NewWakeupSource()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00635_1a988c14ff867cc970b34f1fb8b45715a5.html#Documentationa00635_1a988c14ff867cc970b34f1fb8b45715a5) to create a wakeup source. This function returns a [taf\_pm\_WakeupSourceRef\_t](https://docs.qualcomm.com/doc/80-41102-2/topic/typedef_a00632_1a00ad079602fa3aa84292f27a95a60ee6.html#Documentationa00632_1a00ad079602fa3aa84292f27a95a60ee6) type that can later be used to acquire and release a wakeup source through [taf\_pm\_StayAwake()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00635_1a1cfe42b42322e69594ba74e0c074eab8.html#Documentationa00635_1a1cfe42b42322e69594ba74e0c074eab8) and [taf\_pm\_Relax()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00635_1ae420048e4b0f69107a343523f7827277.html#Documentationa00635_1ae420048e4b0f69107a343523f7827277), respectively. Wakeup sources are not reference-counted, which means multiple calls to [taf\_pm\_StayAwake()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00635_1a1cfe42b42322e69594ba74e0c074eab8.html#Documentationa00635_1a1cfe42b42322e69594ba74e0c074eab8) can be canceled by a single call to [taf\_pm\_Relax()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00635_1ae420048e4b0f69107a343523f7827277.html#Documentationa00635_1ae420048e4b0f69107a343523f7827277).

To have a reference-counted wakeup-source, set the TAF\_PM\_REF\_COUNT bit in the opts argument. When this bit is set, each [taf\_pm\_StayAwake()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00635_1a1cfe42b42322e69594ba74e0c074eab8.html#Documentationa00635_1a1cfe42b42322e69594ba74e0c074eab8) increments a counter and multiple calls to [taf\_pm\_Relax()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00635_1ae420048e4b0f69107a343523f7827277.html#Documentationa00635_1ae420048e4b0f69107a343523f7827277) are necessary to release the wakeup source.

char tag[10];
    
    snprintf(tag, sizeof(tag), "testpm");
    taf_pm_WakeupSourceRef_t ref = taf_pm_NewWakeupSource(1, tag);
    
    for(int i = 0; i < 5; i++) {
        tafPMTest_acquire(ref);
    }
    for(int i = 0; i < 5; i++) {
        tafPMTest_release(ref);
    }
    Copy to clipboard

TelAF Power Manager service will automatically release and delete all wakeup sources held on. behalf of an exiting or disconnecting client.

Use the StateChange to register a notification callback function to be called before device state triggers.

stateChangehandlerRef = taf_pm_AddStateChangeHandler(TestStateChangeHandler, NULL);
    Copy to clipboard

Use the StateChangeEx to register a notification callback function to be called for every state change trigger.

handlerExRef = taf_pm_AddStateChangeExHandler(TestStateChangeExHandler, NULL);
    Copy to clipboard

## Get available Virtual Machines

TelAF Power Manager Service provides APIs to know the available machines on the device. TelAF Power Manager’s client calls [taf\_pm\_GetMachineList()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00635_1a126e13ac1bc98610d6d509edd00c19a4.html#Documentationa00635_1a126e13ac1bc98610d6d509edd00c19a4) to get the machine available reference. This function returns a [taf\_pm\_VMListRef\_t](https://docs.qualcomm.com/doc/80-41102-2/topic/typedef_a00632_1a0e62f3d628939b2925991d5ed0a3cc79.html#Documentationa00632_1a0e62f3d628939b2925991d5ed0a3cc79) that can be later used to get the name of each machine, and also to delete the list reference using [taf\_pm\_DeleteMachineList()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00635_1a39da321c6a8432e488d818a2398b028a.html#Documentationa00635_1a39da321c6a8432e488d818a2398b028a).

taf_pm_VMListRef_t vmListRef = taf_pm_GetMachineList( );
    char name[32] = {0};
    if(!vmListRef) {
        LE_ERROR("List is null");
    }
    le_result_t res = taf_pm_GetFirstMachineName(vmListRef, name, 32);
    while(res == LE_OK)
    {
        LE_INFO("vm name : %s",name);
        res = taf_pm_GetNextMachineName(vmListRef, name, 32);
    }
    res = taf_pm_DeleteMachineList(vmListRef);
    Copy to clipboard

## State change acknowledgement notification

TelAF Power Manager Service should know the acknowledgement of clients to proceed with the state change. TelAF Power Manager’s client calls [taf\_pm\_SendStateChangeAck()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00635_1a53c078b02b6adb4b601d621a9bb10967.html#Documentationa00635_1a53c078b02b6adb4b601d621a9bb10967) to send the acknowledgement for state change.

taf_pm_SendStateChangeAck(powerStateRef, state, TAF_PM_PVM, TAF_PM_READY);
    Copy to clipboard

Last Published: Jun 09, 2026

[Previous Topic
Flash Access Service](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/page_c_tafFlash.md) [Next Topic
Radio Service](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/page_c_tafRadio.md)