static int mali_kbase_get_dev_status(struct device *dev, struct devfreq_dev_status *stat) { struct kbase_device *kbdev = (struct kbase_device *)dev->platform_data; (void)kbase_pm_get_dvfs_action(kbdev); stat->busy_time = kbdev->pm.metrics.utilisation; stat->total_time = 100; stat->private_data = (void *)(long)kbdev->pm.metrics.vsync_hit; stat->current_frequency = kbdev->devfreq->previous_freq; return 0; }
static void dvfs_callback(void *data) { kbase_device *kbdev; kbase_pm_dvfs_action action; osk_error ret; OSK_ASSERT(data != NULL); kbdev = (kbase_device*)data; #ifdef CONFIG_VITHAR_DVFS CSTD_UNUSED(action); kbase_platform_dvfs_event(kbdev, kbase_pm_get_dvfs_utilisation(kbdev)); #else action = kbase_pm_get_dvfs_action(kbdev); switch(action) { case KBASE_PM_DVFS_NOP: break; case KBASE_PM_DVFS_CLOCK_UP: /* Do whatever is required to increase the clock frequency */ break; case KBASE_PM_DVFS_CLOCK_DOWN: /* Do whatever is required to decrease the clock frequency */ break; } #endif osk_spinlock_irq_lock(&kbdev->pm.metrics.lock); if (kbdev->pm.metrics.timer_active) { ret = osk_timer_start(&kbdev->pm.metrics.timer, KBASE_PM_DVFS_FREQUENCY); if (ret != OSK_ERR_NONE) { /* Handle the situation where the timer cannot be restarted */ } } osk_spinlock_irq_unlock(&kbdev->pm.metrics.lock); }