void _mali_osk_pm_dev_enable(void)
{
	_mali_osk_atomic_init(&mali_pm_ref_count, 0);
	_mali_osk_atomic_init(&mali_suspend_called, 0);
	if (NULL == pm_timer)
	{
	    pm_timer = _mali_osk_timer_init();
	}
	
    if (NULL != pm_timer)
    {
	    _mali_osk_timer_setcallback(pm_timer, _mali_pm_callback, NULL);	
	}

    pm_lock = _mali_osk_mutex_init(_MALI_OSK_LOCKFLAG_ORDERED, 0);

#if MALI_LICENSE_IS_GPL
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
    mali_pm_wq = alloc_workqueue("mali_pm", WQ_UNBOUND, 0);
#else
    mali_pm_wq = create_workqueue("mali_pm");
#endif
    if(NULL == mali_pm_wq)
    {
        MALI_PRINT_ERROR(("Unable to create Mali pm workqueue\n"));
    }
#endif
    INIT_WORK( &mali_pm_wq_work_handle, mali_bottom_half_pm );
}
Beispiel #2
0
void power_test_start()
{
	power_test_timer = _mali_osk_timer_init();
	_mali_osk_timer_setcallback( power_test_timer, power_test_callback, NULL );
	
	/* First event is power down */
	power_test_event = MALI_PMM_EVENT_OS_POWER_DOWN;
	_mali_osk_timer_add( power_test_timer, 10000 );
}
/* Init a timer (for now it is used for GPU utilization and dvfs) */
_mali_osk_errcode_t mali_control_timer_init(void)
{
	_mali_osk_device_data data;

	if (_MALI_OSK_ERR_OK == _mali_osk_device_data_get(&data)) {
		/* Use device specific settings (if defined) */
		if (0 != data.control_interval) {
			mali_control_timeout = data.control_interval;
			MALI_DEBUG_PRINT(2, ("Mali GPU Timer: %u\n", mali_control_timeout));
		}
	}

	mali_control_timer = _mali_osk_timer_init();
	if (NULL == mali_control_timer) {
		return _MALI_OSK_ERR_FAULT;
	}
	_mali_osk_timer_setcallback(mali_control_timer, mali_control_timer_callback, NULL);

	return _MALI_OSK_ERR_OK;
}
Beispiel #4
0
void _mali_osk_pm_dev_enable(void) /* @@@@ todo: change to init of some kind.. or change the way or where atomics are initialized? */
{
	_mali_osk_atomic_init(&mali_pm_ref_count, 0);
	_mali_osk_atomic_init(&mali_suspend_called, 0);
	pm_timer = _mali_osk_timer_init();
	_mali_osk_timer_setcallback(pm_timer, _mali_pm_callback, NULL);	
	
    pm_lock = _mali_osk_lock_init(_MALI_OSK_LOCKFLAG_NONINTERRUPTABLE | _MALI_OSK_LOCKFLAG_ORDERED, 0, 0);

#if MALI_LICENSE_IS_GPL
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
    mali_pm_wq = alloc_workqueue("mali_pm", WQ_UNBOUND, 0);
#else
    mali_pm_wq = create_workqueue("mali_pm");
#endif
    if(NULL == mali_pm_wq)
    {
        MALI_PRINT_ERROR(("Unable to create Mali pm workqueue\n"));
    }
#endif
    INIT_WORK( &mali_pm_wq_work_handle, mali_bottom_half_pm );
}
Beispiel #5
0
struct mali_pp_core *mali_pp_create(const _mali_osk_resource_t *resource, struct mali_group *group)
{
	struct mali_pp_core* core = NULL;

	MALI_DEBUG_PRINT(2, ("Mali PP: Creating Mali PP core: %s\n", resource->description));
	MALI_DEBUG_PRINT(2, ("Mali PP: Base address of PP core: 0x%x\n", resource->base));

	if (mali_global_num_pp_cores >= MALI_MAX_NUMBER_OF_PP_CORES)
	{
		MALI_PRINT_ERROR(("Mali PP: Too many PP core objects created\n"));
		return NULL;
	}

	core = _mali_osk_malloc(sizeof(struct mali_pp_core));
	if (NULL != core)
	{
		core->group = group;
		core->core_id = mali_global_num_pp_cores;
		core->running_job = NULL;
		core->counter_src0 = MALI_HW_CORE_NO_COUNTER;
		core->counter_src1 = MALI_HW_CORE_NO_COUNTER;
		core->counter_src0_used = MALI_HW_CORE_NO_COUNTER;
		core->counter_src1_used = MALI_HW_CORE_NO_COUNTER;
		if (_MALI_OSK_ERR_OK == mali_hw_core_create(&core->hw_core, resource, MALI200_REG_SIZEOF_REGISTER_BANK))
		{
			_mali_osk_errcode_t ret;

			mali_group_lock(group);
			ret = mali_pp_reset(core);
			mali_group_unlock(group);

			if (_MALI_OSK_ERR_OK == ret)
			{
				/* Setup IRQ handlers (which will do IRQ probing if needed) */
				core->irq = _mali_osk_irq_init(resource->irq,
				                               mali_pp_upper_half,
				                               mali_pp_bottom_half,
				                               mali_pp_irq_probe_trigger,
				                               mali_pp_irq_probe_ack,
				                               core,
				                               "mali_pp_irq_handlers");
				if (NULL != core->irq)
				{
					/* Initialise the timeout timer */
					core->timeout_timer = _mali_osk_timer_init();
					if(NULL != core->timeout_timer)
					{
						_mali_osk_timer_setcallback(core->timeout_timer, mali_pp_timeout, (void *)core);

						mali_global_pp_cores[mali_global_num_pp_cores] = core;
						mali_global_num_pp_cores++;

						return core;
					}
					else
					{
						MALI_PRINT_ERROR(("Failed to setup timeout timer for PP core %s\n", core->hw_core.description));
						/* Release IRQ handlers */
						_mali_osk_irq_term(core->irq);
					}
				}
				else
				{
					MALI_PRINT_ERROR(("Mali PP: Failed to setup interrupt handlers for PP core %s\n", core->hw_core.description));
				}
			}
			mali_hw_core_delete(&core->hw_core);
		}

		_mali_osk_free(core);
	}
	else
	{
		MALI_PRINT_ERROR(("Mali PP: Failed to allocate memory for PP core\n"));
	}

	return NULL;
}
Beispiel #6
0
struct mali_gp_core *mali_gp_create(const _mali_osk_resource_t * resource, struct mali_group *group)
{
    struct mali_gp_core* core = NULL;

    MALI_DEBUG_ASSERT(NULL == mali_global_gp_core);
    MALI_DEBUG_PRINT(2, ("Mali GP: Creating Mali GP core: %s\n", resource->description));

    core = _mali_osk_malloc(sizeof(struct mali_gp_core));
    if (NULL != core)
    {
        core->group = group;
        core->running_job = NULL;
        core->counter_src0 = MALI_HW_CORE_NO_COUNTER;
        core->counter_src1 = MALI_HW_CORE_NO_COUNTER;
        core->counter_src0_used = MALI_HW_CORE_NO_COUNTER;
        core->counter_src1_used = MALI_HW_CORE_NO_COUNTER;
        if (_MALI_OSK_ERR_OK == mali_hw_core_create(&core->hw_core, resource, MALIGP2_REGISTER_ADDRESS_SPACE_SIZE))
        {
            _mali_osk_errcode_t ret;

            mali_group_lock(group);
            ret = mali_gp_reset(core);
            mali_group_unlock(group);

            if (_MALI_OSK_ERR_OK == ret)
            {

                core->irq = _mali_osk_irq_init(resource->irq,
                                               mali_gp_upper_half,
                                               mali_gp_bottom_half,
                                               mali_gp_irq_probe_trigger,
                                               mali_gp_irq_probe_ack,
                                               core,
                                               "mali_gp_irq_handlers");
                if (NULL != core->irq)
                {

                    core->timeout_timer = _mali_osk_timer_init();
                    if(NULL != core->timeout_timer)
                    {
                        _mali_osk_timer_setcallback(core->timeout_timer, mali_gp_timeout, (void *)core);
                        MALI_DEBUG_PRINT(4, ("Mali GP: set global gp core from 0x%08X to 0x%08X\n", mali_global_gp_core, core));
                        mali_global_gp_core = core;

                        return core;
                    }
                    else
                    {
                        MALI_PRINT_ERROR(("Failed to setup timeout timer for GP core %s\n", core->hw_core.description));

                        _mali_osk_irq_term(core->irq);
                    }
                }
                else
                {
                    MALI_PRINT_ERROR(("Failed to setup interrupt handlers for GP core %s\n", core->hw_core.description));
                }
            }
            mali_hw_core_delete(&core->hw_core);
        }

        _mali_osk_free(core);
    }
    else
    {
        MALI_PRINT_ERROR(("Failed to allocate memory for GP core\n"));
    }

    return NULL;
}