My Project
Functions
mali_kbase_pm.c File Reference
#include <mali_kbase.h>
#include <mali_midg_regmap.h>
#include <mali_kbase_vinstr.h>
#include <mali_kbase_pm.h>

Functions

int kbase_pm_powerup (struct kbase_device *kbdev, unsigned int flags)
 
void kbase_pm_halt (struct kbase_device *kbdev)
 
void kbase_pm_context_active (struct kbase_device *kbdev)
 
int kbase_pm_context_active_handle_suspend (struct kbase_device *kbdev, enum kbase_pm_suspend_handler suspend_handler)
 
 KBASE_EXPORT_TEST_API (kbase_pm_context_active)
 
void kbase_pm_context_idle (struct kbase_device *kbdev)
 
 KBASE_EXPORT_TEST_API (kbase_pm_context_idle)
 
void kbase_pm_suspend (struct kbase_device *kbdev)
 
void kbase_pm_resume (struct kbase_device *kbdev)
 

Detailed Description

Base kernel power management APIs

Function Documentation

◆ kbase_pm_context_active()

void kbase_pm_context_active ( struct kbase_device kbdev)

Increment the count of active contexts.

This function should be called when a context is about to submit a job. It informs the active power policy that the GPU is going to be in use shortly and the policy is expected to start turning on the GPU.

This function will block until the GPU is available.

This function ASSERTS if a suspend is occuring/has occurred whilst this is in use. Use kbase_pm_contect_active_unless_suspending() instead.

Note
a Suspend is only visible to Kernel threads; user-space threads in a syscall cannot witness a suspend, because they are frozen before the suspend begins.
Parameters
kbdevThe kbase device structure for the device (must be a valid pointer)

◆ kbase_pm_context_active_handle_suspend()

int kbase_pm_context_active_handle_suspend ( struct kbase_device kbdev,
enum kbase_pm_suspend_handler  suspend_handler 
)

Suspend 'safe' variant of kbase_pm_context_active()

If a suspend is in progress, this allows for various different ways of handling the suspend. Refer to enum kbase_pm_suspend_handler for details.

We returns a status code indicating whether we're allowed to keep the GPU active during the suspend, depending on the handler code. If the status code indicates a failure, the caller must abort whatever operation it was attempting, and potentially queue it up for after the OS has resumed.

Parameters
kbdevThe kbase device structure for the device (must be a valid pointer)
suspend_handlerThe handler code for how to handle a suspend that might occur
Returns
zero Indicates success
non-zero Indicates failure due to the system being suspending/suspended.

◆ kbase_pm_context_idle()

void kbase_pm_context_idle ( struct kbase_device kbdev)

Decrement the reference count of active contexts.

This function should be called when a context becomes idle. After this call the GPU may be turned off by the power policy so the calling code should ensure that it does not access the GPU's registers.

Parameters
kbdevThe kbase device structure for the device (must be a valid pointer)

◆ kbase_pm_halt()

void kbase_pm_halt ( struct kbase_device kbdev)

Halt the power management framework. Should ensure that no new interrupts are generated, but allow any currently running interrupt handlers to complete successfully. The GPU is forced off by the time this function returns, regardless of whether or not the active power policy asks for the GPU to be powered off.

Parameters
kbdevThe kbase device structure for the device (must be a valid pointer)

◆ kbase_pm_powerup()

int kbase_pm_powerup ( struct kbase_device kbdev,
unsigned int  flags 
)

Power up GPU after all modules have been initialized and interrupt handlers installed.

Parameters
kbdevThe kbase device structure for the device (must be a valid pointer)
flagsFlags to pass on to kbase_pm_init_hw
Returns
0 if powerup was successful.

◆ kbase_pm_resume()

void kbase_pm_resume ( struct kbase_device kbdev)

Resume the GPU, allow register accesses to it, and resume running atoms on the GPU.

This is called in response to an OS resume event, and calls into the various kbase components to complete the resume.

Parameters
kbdevThe kbase device structure for the device (must be a valid pointer)

◆ kbase_pm_suspend()

void kbase_pm_suspend ( struct kbase_device kbdev)

Suspend the GPU and prevent any further register accesses to it from Kernel threads.

This is called in response to an OS suspend event, and calls into the various kbase components to complete the suspend.

Note
the mechanisms used here rely on all user-space threads being frozen by the OS before we suspend. Otherwise, an IOCTL could occur that powers up the GPU e.g. via atom submission.
Parameters
kbdevThe kbase device structure for the device (must be a valid pointer)