static int mali_driver_runtime_resume(struct device *dev) { /* MALI_SEC */ mali_platform_power_mode_change(MALI_POWER_MODE_ON); mali_pm_runtime_resume(); return 0; }
static int mali_driver_runtime_suspend(struct device *dev) { mali_pm_runtime_suspend(); /* MALI_SEC */ mali_platform_power_mode_change(MALI_POWER_MODE_LIGHT_SLEEP); return 0; }
/* Can NOT run in atomic context */ _mali_osk_errcode_t _mali_osk_pm_dev_ref_get_sync(void) { #ifdef CONFIG_PM_RUNTIME int err; MALI_DEBUG_ASSERT_POINTER(mali_platform_device); err = pm_runtime_get_sync(&(mali_platform_device->dev)); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) pm_runtime_mark_last_busy(&(mali_platform_device->dev)); #endif if (0 > err) { MALI_PRINT_ERROR(("Mali OSK PM: pm_runtime_get_sync() returned error code %d\n", err)); return _MALI_OSK_ERR_FAULT; } #else _mali_osk_mutex_wait(mtk_pm_lock); mali_platform_power_mode_change(MALI_POWER_MODE_ON); if(_mali_osk_atomic_read(&mtk_mali_suspend_called)) { mali_pm_runtime_resume(); _mali_osk_atomic_dec(&mtk_mali_suspend_called); } _mali_osk_atomic_inc(&mtk_mali_pm_ref_count); _mali_osk_mutex_signal(mtk_pm_lock); #endif return _MALI_OSK_ERR_OK; }
_mali_osk_errcode_t malipmm_powerup( u32 cores ) { _mali_osk_errcode_t err = _MALI_OSK_ERR_OK; _mali_pmm_internal_state_t *pmm = GET_PMM_STATE_PTR; /* If all the cores are powered down, power up the MALI */ if (pmm->cores_powered == 0) { mali_platform_power_mode_change(MALI_POWER_MODE_ON); #if MALI_PMM_RUNTIME_JOB_CONTROL_ON /* Initiate the power up */ if (_mali_osk_pmm_dev_activate() < 0) { MALI_PRINT(("PMM: Mali PMM device activate failed\n")); err = _MALI_OSK_ERR_FAULT; return err; } #endif } #if USING_MALI_PMU err = mali_pmm_pmu_powerup( cores ); #endif #if MALI_PMM_RUNTIME_JOB_CONTROL_ON mali_platform_powerup(cores); #endif return err; }
void mali_pmm_init(void) { MALI_DEBUG_PRINT(1, ("%s\n", __FUNCTION__)); mtk_thermal_get_gpu_loading_fp = gpu_get_current_utilization; atomic_set((atomic_t *)&bPoweroff, 1); mali_platform_power_mode_change(MALI_POWER_MODE_ON); }
static int mali_driver_suspend_scheduler(struct device *dev) { mali_pm_os_suspend(); /* MALI_SEC */ mali_platform_power_mode_change(MALI_POWER_MODE_DEEP_SLEEP); return 0; }
_mali_osk_errcode_t mali_platform_deinit(struct device *dev) { mali_platform_power_mode_change(dev, MALI_POWER_MODE_DEEP_SLEEP); deinit_mali_clock(); MALI_SUCCESS; }
_mali_osk_errcode_t mali_platform_init(struct device *dev) { MALI_CHECK(init_mali_clock(), _MALI_OSK_ERR_FAULT); mali_platform_power_mode_change(dev, MALI_POWER_MODE_ON); MALI_SUCCESS; }
_mali_osk_errcode_t mali_pp_stop_bus_wait(struct mali_pp_core *core) { int i; MALI_DEBUG_ASSERT_POINTER(core); MALI_DEBUG_PRINT(2,("mali_pp_stop_bus_wait: core->hw_core %s\n", core->hw_core.description)); /// try power on the mali driver for recovery mali_platform_power_mode_change(MALI_POWER_MODE_ON); /* Send the stop bus command. */ mali_pp_stop_bus(core); /* Wait for bus to be stopped */ for (i = 0; i < MALI_REG_POLL_COUNT_FAST; i++) { if (mali_hw_core_register_read(&core->hw_core, MALI200_REG_ADDR_MGMT_STATUS) & MALI200_REG_VAL_STATUS_BUS_STOPPED) break; } if (MALI_REG_POLL_COUNT_FAST == i) { MALI_PRINT_ERROR(("Mali PP: Failed to stop bus on %s. Status: 0x%08x\n", core->hw_core.description, mali_hw_core_register_read(&core->hw_core, MALI200_REG_ADDR_MGMT_STATUS))); return _MALI_OSK_ERR_FAULT; } return _MALI_OSK_ERR_OK; }
static void mali_pm_powerdown(mali_power_mode power_mode, enum mali_pm_level old_level) { if ( (MALI_PM_LEVEL_1_ON == old_level) || (MALI_PM_LEVEL_2_STANDBY == old_level) ) { mali_group_power_off(); } mali_platform_power_mode_change(power_mode); #if MALI_PMM_RUNTIME_JOB_CONTROL_ON _mali_osk_pm_dev_idle(); if (MALI_POWER_MODE_DEEP_SLEEP == power_mode) { mali_platform_power_mode_change(power_mode); } #endif }
static void MTK_mali_bottom_half_pm_resume ( struct work_struct *work ) { _mali_osk_mutex_wait(mtk_pm_lock); mali_platform_power_mode_change(MALI_POWER_MODE_ON); if(_mali_osk_atomic_read(&mtk_mali_suspend_called)) { mali_pm_runtime_resume(); _mali_osk_atomic_dec(&mtk_mali_suspend_called); } _mali_osk_mutex_signal(mtk_pm_lock); }
static void mali_pm_powerup(void) { MALI_DEBUG_PRINT(3, ("Mali PM: Setting GPU power mode to MALI_POWER_MODE_ON\n")); mali_platform_power_mode_change(MALI_POWER_MODE_ON); #if MALI_PMM_RUNTIME_JOB_CONTROL_ON /* Aquire our reference */ MALI_DEBUG_PRINT(4, ("Mali PM: Getting device PM reference (=> requesting MALI_POWER_MODE_ON)\n")); _mali_osk_pm_dev_activate(); #endif mali_group_power_on(); }
_mali_osk_errcode_t mali_platform_deinit(struct device *dev) { mali_platform_power_mode_change(dev, MALI_POWER_MODE_DEEP_SLEEP); deinit_mali_clock(); #ifdef CONFIG_MALI_DVFS if (clk_register_map) { _mali_osk_mem_unmapioregion(CLK_DIV_STAT_G3D, 0x20, clk_register_map); clk_register_map = NULL; } #endif MALI_SUCCESS; }
_mali_osk_errcode_t mali_platform_init(struct device *dev) { MALI_CHECK(init_mali_clock(), _MALI_OSK_ERR_FAULT); #ifdef CONFIG_MALI_DVFS if (!clk_register_map) clk_register_map = _mali_osk_mem_mapioregion(CLK_DIV_STAT_G3D, 0x20, CLK_DESC); maliDvfsStatus.currentStep = MALI_DVFS_DEFAULT_STEP; #endif mali_platform_power_mode_change(dev, MALI_POWER_MODE_ON); MALI_SUCCESS; }
static void MTK_mali_bottom_half_pm_suspend ( struct work_struct *work ) { _mali_osk_mutex_wait(mtk_pm_lock); if((_mali_osk_atomic_read(&mtk_mali_pm_ref_count) == 0) && (_mali_osk_atomic_read(&mtk_mali_suspend_called) == 0)) { if (MALI_TRUE == mali_pm_runtime_suspend()) { _mali_osk_atomic_inc(&mtk_mali_suspend_called); mali_platform_power_mode_change(MALI_POWER_MODE_DEEP_SLEEP); } } _mali_osk_mutex_signal(mtk_pm_lock); }
static void mali_bottom_half_pm ( struct work_struct *work ) { _mali_osk_lock_wait(pm_lock, _MALI_OSK_LOCKMODE_RW); if((_mali_osk_atomic_read(&mali_pm_ref_count) == 0) && (_mali_osk_atomic_read(&mali_suspend_called) == 0)) { mali_pm_runtime_suspend(); _mali_osk_atomic_inc(&mali_suspend_called); mali_platform_power_mode_change(MALI_POWER_MODE_DEEP_SLEEP); } _mali_osk_lock_signal(pm_lock, _MALI_OSK_LOCKMODE_RW); }
int mali_deep_suspend(struct device *device) { int ret = 0; if (NULL != device->driver && NULL != device->driver->pm && NULL != device->driver->pm->suspend) { /* Need to notify Mali driver about this event */ ret = device->driver->pm->suspend(device); } mali_platform_power_mode_change(MALI_POWER_MODE_DEEP_SLEEP); return ret; }
int mali_light_resume(struct device *device) { int ret = 0; mali_platform_power_mode_change(MALI_POWER_MODE_ON); if (NULL != device->driver && NULL != device->driver->pm && NULL != device->driver->pm->runtime_resume) { /* Need to notify Mali driver about this event */ ret = device->driver->pm->runtime_resume(device); } return ret; }
static int mali_runtime_resume(struct device *device) { int ret = 0; MALI_DEBUG_PRINT(4, ("mali_runtime_resume() called\n")); mali_platform_power_mode_change(device, MALI_POWER_MODE_ON); if (NULL != device->driver && NULL != device->driver->pm && NULL != device->driver->pm->runtime_resume) { /* Need to notify Mali driver about this event */ ret = device->driver->pm->runtime_resume(device); } return ret; }
static int mali_runtime_suspend(struct device *device) { int ret = 0; MALI_DEBUG_PRINT(4, ("mali_runtime_suspend() called\n")); if (NULL != device->driver && NULL != device->driver->pm && NULL != device->driver->pm->runtime_suspend) { /* Need to notify Mali driver about this event */ ret = device->driver->pm->runtime_suspend(device); } mali_platform_power_mode_change(MALI_POWER_MODE_LIGHT_SLEEP); return ret; }
static int mali_pm_resume(struct device *device) { int ret = 0; MALI_DEBUG_PRINT(1, ("Mali PM: %s\n", __FUNCTION__)); mali_platform_power_mode_change(MALI_POWER_MODE_ON); if (NULL != device->driver && NULL != device->driver->pm && NULL != device->driver->pm->resume) { /* Need to notify Mali driver about this event */ ret = device->driver->pm->resume(device); } return ret; }
static int mali_pm_suspend(struct device *device) { int ret = 0; MALI_DEBUG_PRINT(1, ("Mali PM:%s\n", __FUNCTION__)); if (NULL != device->driver && NULL != device->driver->pm && NULL != device->driver->pm->suspend) { /* Need to notify Mali driver about this event */ ret = device->driver->pm->suspend(device); } _mali_osk_pm_delete_callback_timer(); mali_platform_power_mode_change(MALI_POWER_MODE_DEEP_SLEEP); return ret; }
static int mali_os_resume(struct device *device) { int ret = 0; MALI_DEBUG_PRINT(4, ("mali_os_resume() called\n")); #ifdef CONFIG_REGULATOR mali_regulator_enable(); g3d_power_domain_control(1); #endif mali_platform_power_mode_change(device, MALI_POWER_MODE_ON); if (NULL != device && NULL != device->driver && NULL != device->driver->pm && NULL != device->driver->pm->resume) { /* Need to notify Mali driver about this event */ ret = device->driver->pm->resume(device); } return ret; }
static int mali_os_suspend(struct device *device) { int ret = 0; MALI_DEBUG_PRINT(4, ("mali_os_suspend() called\n")); #ifdef CONFIG_MALI_DVFS mali_utilization_suspend(); #endif if (NULL != device && NULL != device->driver && NULL != device->driver->pm && NULL != device->driver->pm->suspend) { /* Need to notify Mali driver about this event */ ret = device->driver->pm->suspend(device); } mali_platform_power_mode_change(device, MALI_POWER_MODE_DEEP_SLEEP); return ret; }
_mali_osk_errcode_t malipmm_powerdown( u32 cores, mali_power_mode power_mode ) { _mali_osk_errcode_t err = _MALI_OSK_ERR_OK; _mali_pmm_internal_state_t *pmm = GET_PMM_STATE_PTR; #if MALI_PMM_RUNTIME_JOB_CONTROL_ON mali_platform_powerdown(cores); #endif #if USING_MALI_PMU err = mali_pmm_pmu_powerdown( cores ); #endif /* If all cores are powered down, power off the MALI */ if (pmm->cores_powered == 0) { #if MALI_PMM_RUNTIME_JOB_CONTROL_ON /* Initiate the power down */ _mali_osk_pmm_dev_idle(); #endif mali_platform_power_mode_change(power_mode); } return err; }
void mali_pmm_deinit(void) { MALI_DEBUG_PRINT(1, ("%s\n", __FUNCTION__)); mali_platform_power_mode_change(MALI_POWER_MODE_DEEP_SLEEP); }
void mali_pmm_init(void) { MALI_DEBUG_PRINT(1, ("%s\n", __FUNCTION__)); atomic_set((atomic_t *)&bPoweroff, 1); mali_platform_power_mode_change(MALI_POWER_MODE_ON); }
int mali_platform_device_register(void) { int err = -1; int value; #ifdef CONFIG_OF struct device_node *np_efuse; np_efuse = of_find_compatible_node(NULL, NULL, efuse_of_match[0].compatible); if(!efuse_base) { efuse_base = of_iomap(np_efuse, 0); } #endif MALI_DEBUG_PRINT(1, ("%s\n", __FUNCTION__)); mali_gpu_data.shared_mem_size = get_max_DRAM_size(); if (efuse_base) { value = mali_pmm_reg_read(efuse_base + 0x040); if (value & 0x00020000) { MALI_DEBUG_ASSERT(0); return err; } else if (value & 0x00040000) { err = platform_device_register(&mali_gpu_device_mp1); core_count = 1; } else { err = platform_device_register(&mali_gpu_device_mp2); core_count = 2; } } else { err = platform_device_register(&mali_gpu_device_mp2); core_count = 2; } mali_platform_power_mode_change(MALI_POWER_MODE_ON); if (0 == err) { mali_pmm_init(); #ifdef CONFIG_PM_RUNTIME #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) if (coue_count == 2) { pm_runtime_set_autosuspend_delay(&(mali_gpu_device_mp2.dev), 1000); pm_runtime_use_autosuspend(&(mali_gpu_device_mp2.dev)); } else { pm_runtime_set_autosuspend_delay(&(mali_gpu_device_mp1.dev), 1000); pm_runtime_use_autosuspend(&(mali_gpu_device_mp1.dev)); } #endif if (coue_count == 2) { pm_runtime_enable(&(mali_gpu_device_mp2.dev)); } else { pm_runtime_enable(&(mali_gpu_device_mp1.dev)); } #endif return 0; } MALI_DEBUG_PRINT(1, ("%s err=%d\n",__FUNCTION__, err)); if (2 == core_count) { platform_device_unregister(&mali_gpu_device_mp2); } else { platform_device_unregister(&mali_gpu_device_mp1); } return err; }