int mali_platform_device_register(void)
{
    int err = -1;

    MALI_DEBUG_PRINT(1, ("%s\n", __FUNCTION__));

    err = platform_device_register(&mali_gpu_device);
            
    if (0 == err) 
    {         
        mali_pmm_init();
        
#ifdef CONFIG_PM_RUNTIME
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
				pm_runtime_set_autosuspend_delay(&(mali_gpu_device.dev), 1000);
				pm_runtime_use_autosuspend(&(mali_gpu_device.dev));
#endif
				pm_runtime_enable(&(mali_gpu_device.dev));
#endif
        
#if defined(__MALI_CORE_SCALING_ENABLE__)
        mali_core_scaling_init(num_pp_cores);
#endif        
        return 0;
    }

    MALI_DEBUG_PRINT(1, ("%s err=%d\n",__FUNCTION__, err));

    platform_device_unregister(&mali_gpu_device);

    return err;
}
Ejemplo n.º 2
0
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;
}