Ejemplo n.º 1
0
static int pm_callback_power_on(kbase_device *kbdev)
{
	int result;
	int ret_val;
	struct kbase_os_device *osdev = &kbdev->osdev;
	struct exynos_context *platform;

	platform = (struct exynos_context *) kbdev->platform_context;

	if (pm_runtime_status_suspended(osdev->dev))
		ret_val = 1;
	else
		ret_val = 0;

	if(osdev->dev->power.disable_depth > 0) {
		if(platform->cmu_pmu_status == 0)
			kbase_platform_cmu_pmu_control(kbdev, 1);
		return ret_val;
	}
	result = pm_runtime_resume(osdev->dev);

	if(result < 0 && result == -EAGAIN)
		kbase_platform_cmu_pmu_control(kbdev, 1);
	else if(result < 0)
		OSK_PRINT_ERROR(OSK_BASE_PM, "pm_runtime_get_sync failed (%d)\n", result);

	return ret_val;
}
Ejemplo n.º 2
0
static void pm_callback_runtime_power_off(kbase_device *kbdev)
{
#if MALI_RTPM_DEBUG
    printk(KERN_DEBUG "kbase_device_runtime_suspend\n");
#endif	/* MALI_RTPM_DEBUG */
    kbase_platform_cmu_pmu_control(kbdev, 0);
}
Ejemplo n.º 3
0
static int pm_callback_runtime_power_on(kbase_device *kbdev)
{
#if MALI_RTPM_DEBUG
    printk(KERN_DEBUG "kbase_device_runtime_resume\n");
#endif	/* MALI_RTPM_DEBUG */
    return kbase_platform_cmu_pmu_control(kbdev, 1);
}
Ejemplo n.º 4
0
void kbase_device_runtime_get_sync(struct device *dev)
{
    int result;
    struct kbase_device *kbdev;
    struct exynos_context *platform;
    kbdev = dev_get_drvdata(dev);

    platform = (struct exynos_context *) kbdev->platform_context;
    if(!platform)
        return;

    /********************************************
     *
     *  This is workaround about occurred kernel panic when you turn off the system.
     *
     *  System kernel will call the "__pm_runtime_disable" when you turn off the system.
     *  After that function, System kernel do not run the runtimePM API more.
     *
     *  So, this code is check the "dev->power.disable_depth" value is not zero.
     *
    ********************************************/

    if(dev->power.disable_depth > 0) {
        if(platform->cmu_pmu_status == 0)
            kbase_platform_cmu_pmu_control(kbdev, 1);
        return;
    }

    if(delayed_work_pending(&kbdev->runtime_pm_workqueue)) {
        cancel_delayed_work_sync(&kbdev->runtime_pm_workqueue);
    }

    mutex_lock(&runtime_pm_lock);
    kbase_platform_clock_on(kbdev);
    pm_runtime_get_noresume(dev);
    result = pm_runtime_resume(dev);
    mutex_unlock(&runtime_pm_lock);

#if MALI_GATOR_SUPPORT
    kbase_trace_mali_timeline_event(GATOR_MAKE_EVENT(ACTIVITY_RTPM_CHANGED, ACTIVITY_RTPM) | 1);
#endif
#if MALI_RTPM_DEBUG
    printk( "kbase_device_runtime_get_sync, usage_count=%d\n", atomic_read(&dev->power.usage_count));
#endif

    /********************************************
     *
     *  This check is re-confirm about maybe context switch by another cpu when turn off the system.
     *
     *  runtimePM put_sync -------- runtimePM get_sync -------- runtimePM put_sync          : CPU 0
     *                                      \
     *                                       \ ( context running by another core. )
     *                                        \
     *                                         - (turn off the system) runtimePM disable    : CPU 1
     *                                                                    \
     *                                                                     \
     *                                                                      => do not success implement runtimePM API
    ********************************************/
    if(result < 0 && result == -EAGAIN)
        kbase_platform_cmu_pmu_control(kbdev, 1);
    else if(result < 0)
        printk(KERN_ERR "pm_runtime_get_sync failed (%d)\n", result);
}