/** This function is called when Operating system wants to power down * the mali GPU device. */ static int mali_pm_suspend(struct device *dev) { int err = 0; _mali_osk_lock_wait(lock, _MALI_OSK_LOCKMODE_RW); if ((mali_device_state == _MALI_DEVICE_SUSPEND)) { _mali_osk_lock_signal(lock, _MALI_OSK_LOCKMODE_RW); return err; } #if MALI_DVFS_ENABLED mali_utilization_suspend(); #endif err = mali_device_suspend(MALI_PMM_EVENT_OS_POWER_DOWN, &pm_thread); mali_device_state = _MALI_DEVICE_SUSPEND; _mali_osk_lock_signal(lock, _MALI_OSK_LOCKMODE_RW); return err; }
/* Mali Pause Resume APIs */ int mali_dev_pause() { int err = 0; _mali_osk_lock_wait(lock, _MALI_OSK_LOCKMODE_RW); if ((mali_dvfs_device_state == _MALI_DEVICE_SUSPEND) || (mali_device_state == _MALI_DEVICE_SUSPEND) ) { err = -EPERM; } if ((mali_dvfs_device_state == _MALI_DEVICE_RESUME) && (!err)) { mali_device_suspend(MALI_PMM_EVENT_DVFS_PAUSE, &dvfs_pm_thread); mali_dvfs_device_state = _MALI_DEVICE_SUSPEND; } _mali_osk_lock_signal(lock, _MALI_OSK_LOCKMODE_RW); return err; }