inline _mali_osk_errcode_t _mali_osk_profiling_stop(u32 * count)
{
    _mali_osk_lock_wait(lock, _MALI_OSK_LOCKMODE_RW);

    if (prof_state != MALI_PROFILING_STATE_RUNNING)
    {
        _mali_osk_lock_signal(lock, _MALI_OSK_LOCKMODE_RW);
        return _MALI_OSK_ERR_INVALID_ARGS; /* invalid to call this function in this state */
    }

    /* go into return state (user to retreive events), no more events will be added after this */
    prof_state = MALI_PROFILING_STATE_RETURN;

    _mali_osk_lock_signal(lock, _MALI_OSK_LOCKMODE_RW);

    /* wait for all elements to be completely inserted into array */
    while (_mali_osk_atomic_read(&profile_insert_index) != _mali_osk_atomic_read(&profile_entries_written))
    {
        /* do nothing */;
    }

    *count = _mali_osk_atomic_read(&profile_insert_index);

    return _MALI_OSK_ERR_OK;
}
/* Can run in atomic context */
mali_bool _mali_osk_pm_dev_ref_add_no_power_on(void)
{
#ifdef CONFIG_PM_RUNTIME
	u32 ref;
	MALI_DEBUG_ASSERT_POINTER(mali_platform_device);
	pm_runtime_get_noresume(&(mali_platform_device->dev));
	ref = _mali_osk_atomic_read(&mali_pm_ref_count);
	MALI_DEBUG_PRINT(4, ("Mali OSK PM: No-power ref taken (%u)\n", _mali_osk_atomic_read(&mali_pm_ref_count)));
	return ref > 0 ? MALI_TRUE : MALI_FALSE;
#else
	return MALI_TRUE;
#endif
}
Пример #3
0
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);
}
Пример #4
0
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);
}
Пример #5
0
u32 malipmm_subsystem_dump_state(char *buf, u32 size)
{
	int len = 0;
	_mali_pmm_internal_state_t *pmm = GET_PMM_STATE_PTR;

	if( !pmm )
	{
		len += _mali_osk_snprintf(buf + len, size + len, "PMM: Null state\n");
	}
	else
	{
		len += _mali_osk_snprintf(buf+len, size+len, "Locks:\n  PMM lock acquired: %s\n",
				pmm->mali_pmm_lock_acquired ? "true" : "false");
		len += _mali_osk_snprintf(buf+len, size+len,
				"PMM state:\n  Previous status: %s\n  Status: %s\n  Current event: %s\n  Policy: %s\n  Check policy: %s\n  State: %s\n",
				pmm_trace_status[pmm->mali_last_pmm_status], pmm_trace_status[pmm->status],
				pmm_trace_events[pmm->mali_new_event_status], pmm_trace_policy[pmm->policy],
				pmm->check_policy ? "true" : "false", pmm_trace_state[pmm->state]);
		len += _mali_osk_snprintf(buf+len, size+len,
				"PMM cores:\n  Cores registered: %d\n  Cores powered: %d\n  Cores idle: %d\n"
				"  Cores pending down: %d\n  Cores pending up: %d\n  Cores ack down: %d\n  Cores ack up: %d\n",
				pmm->cores_registered, pmm->cores_powered, pmm->cores_idle, pmm->cores_pend_down,
				pmm->cores_pend_up, pmm->cores_ack_down, pmm->cores_ack_up);
		len += _mali_osk_snprintf(buf+len, size+len, "PMM misc:\n  PMU init: %s\n  Messages queued: %d\n"
				"  Waiting: %d\n  No events: %d\n  Missed events: %d\n  Fatal power error: %s\n",
				pmm->pmu_initialized ? "true" : "false", _mali_osk_atomic_read(&(pmm->messages_queued)),
				pmm->waiting, pmm->no_events, pmm->missed, pmm->fatal_power_err ? "true" : "false");
	}
	return len;
}
static unsigned int decideNextStatus(unsigned int utilization)
{
	unsigned int level=0; // 0:stay, 1:up

	if (!mali_dvfs_control) {
#if MALI_GPU_BOTTOM_LOCK
		if (_mali_osk_atomic_read(&bottomlock_status) > 0)
			level = 1;	/* or bigger */
		else if (utilization > mali_dvfs_threshold[maliDvfsStatus.currentStep].upthreshold)
#else
		if (utilization > mali_dvfs_threshold[maliDvfsStatus.currentStep].upthreshold)
#endif
			level=1;
		else if (utilization < mali_dvfs_threshold[maliDvfsStatus.currentStep].downthreshold)
			level=0;
		else
			level = maliDvfsStatus.currentStep;
	} else	{
		if ((mali_dvfs_control > 0) && (mali_dvfs_control < mali_dvfs[1].clock))
			level=0;
		else
			level=1;
	}

	return level;
}
inline _mali_osk_errcode_t _mali_osk_profiling_get_event(u32 index, u64* timestamp, u32* event_id, u32 data[5])
{
    _mali_osk_lock_wait(lock, _MALI_OSK_LOCKMODE_RW);

    if (prof_state != MALI_PROFILING_STATE_RETURN)
    {
        _mali_osk_lock_signal(lock, _MALI_OSK_LOCKMODE_RW);
        return _MALI_OSK_ERR_INVALID_ARGS; /* invalid to call this function in this state */
    }

    if (index >= _mali_osk_atomic_read(&profile_entries_written))
    {
        _mali_osk_lock_signal(lock, _MALI_OSK_LOCKMODE_RW);
        return _MALI_OSK_ERR_FAULT;
    }

    *timestamp = profile_entries[index].timestamp;
    *event_id = profile_entries[index].event_id;
    data[0] = profile_entries[index].data[0];
    data[1] = profile_entries[index].data[1];
    data[2] = profile_entries[index].data[2];
    data[3] = profile_entries[index].data[3];
    data[4] = profile_entries[index].data[4];

    _mali_osk_lock_signal(lock, _MALI_OSK_LOCKMODE_RW);
    return _MALI_OSK_ERR_OK;
}
Пример #8
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;
}
Пример #9
0
static unsigned int decideNextStatus(unsigned int utilization)
{
	static unsigned int level = 0; // 0:stay, 1:up
	static int mali_dvfs_clk = 0;

	if (mali_runtime_resumed >= 0) {
		level = mali_runtime_resumed;
		mali_runtime_resumed = -1;
		return level;
	}

	if (mali_dvfs_threshold[maliDvfsStatus.currentStep].upthreshold
			<= mali_dvfs_threshold[maliDvfsStatus.currentStep].downthreshold) {
		MALI_PRINT(("upthreadshold is smaller than downthreshold: %d < %d\n",
				mali_dvfs_threshold[maliDvfsStatus.currentStep].upthreshold,
				mali_dvfs_threshold[maliDvfsStatus.currentStep].downthreshold));
		return level;
	}

	if (utilization > (int)(255 * mali_dvfs_threshold[maliDvfsStatus.currentStep].upthreshold / 100) &&
			level < MALI_DVFS_STEPS - 1) {
		level++;
	}
	if (utilization < (int)(255 * mali_dvfs_threshold[maliDvfsStatus.currentStep].downthreshold / 100) &&
			level > 0) {
		level--;
	}

	if (_mali_osk_atomic_read(&bottomlock_status) > 0) {
		if (level < bottom_lock_step)
			level = bottom_lock_step;
	}

	return level;
}
Пример #10
0
int mali_dvfs_bottom_lock_push(int lock_step)
{
	int prev_status = _mali_osk_atomic_read(&bottomlock_status);

	if (prev_status < 0) {
		MALI_PRINT(("gpu bottom lock status is not valid for push\n"));
		return -1;
	}
	// not a bad idea to limit locking to 4th step, so let's leave this -gm
	if (samsung_rev() < EXYNOS4412_REV_2_0)
		lock_step = min(lock_step, MALI_DVFS_STEPS - 2);
	else
		lock_step = min(lock_step, MALI_DVFS_STEPS - 1);

	if (bottom_lock_step < lock_step) {
		bottom_lock_step = lock_step;
		if (get_mali_dvfs_status() < lock_step) {
			mali_regulator_set_voltage(mali_dvfs[lock_step].vol,
						   mali_dvfs[lock_step].vol);
			mali_clk_set_rate(mali_dvfs[lock_step].clock,
					  mali_dvfs[lock_step].freq);
			set_mali_dvfs_current_step(lock_step);
		}
	}
	return _mali_osk_atomic_inc_return(&bottomlock_status);
}
Пример #11
0
int mali_voltage_lock_pop(void)
{
	if (_mali_osk_atomic_read(&voltage_lock_status) <= 0) {
		MALI_PRINT(("gpu voltage lock status is not valid for pop\n"));
		return -1;
	}
	return _mali_osk_atomic_dec_return(&voltage_lock_status);
}
int mali_dvfs_bottom_lock_pop(void)
{
	if (_mali_osk_atomic_read(&bottomlock_status) <= 0) {
		MALI_PRINT(("gpu bottom lock status is not valid for pop"));
		return -1;
	}

	return _mali_osk_atomic_dec_return(&bottomlock_status);
}
static unsigned int decideNextStatus(unsigned int utilization)
{
	unsigned int level=0; // 0:stay, 1:up

	if (!mali_dvfs_control) {
#if MALI_GPU_BOTTOM_LOCK
		if (_mali_osk_atomic_read(&bottomlock_status) > 0)
			level = 1;	/* or bigger */
		else
#endif
		switch(maliDvfsStatus.currentStep)
		{
			case 0:
				if( utilization > mali_dvfs_threshold[maliDvfsStatus.currentStep].upthreshold)
					level=1;
				else
					level = maliDvfsStatus.currentStep;
				break;
			case 1:
				if( utilization > mali_dvfs_threshold[maliDvfsStatus.currentStep].upthreshold)
					level=2;
				else if( utilization <
					 (mali_dvfs_threshold[maliDvfsStatus.currentStep].downthreshold*mali_dvfs[maliDvfsStatus.currentStep-1].clock)/
					 mali_dvfs[maliDvfsStatus.currentStep].clock)
					level=0;
				else
					level = maliDvfsStatus.currentStep;
				break;
			case 2:
				if( utilization <
				         (mali_dvfs_threshold[maliDvfsStatus.currentStep].downthreshold*mali_dvfs[maliDvfsStatus.currentStep-1].clock)/
					 mali_dvfs[maliDvfsStatus.currentStep].clock)
					level=1;
				else
					level = maliDvfsStatus.currentStep;
				break;
		}
	}
	else
	{
		if((mali_dvfs_control == 1)||(( mali_dvfs_control > 3) && (mali_dvfs_control < mali_dvfs[0].clock+1)))
		{
			level=0;
		}
		else if((mali_dvfs_control == 2)||(( mali_dvfs_control > mali_dvfs[0].clock) && (mali_dvfs_control < mali_dvfs[1].clock+1)))
		{
			level=1;
		}
		else
		{
			level=2;
		}
	}

	return level;
}
/* Can run in atomic context */
void _mali_osk_pm_dev_ref_dec(void)
{
#ifdef CONFIG_PM_RUNTIME
	MALI_DEBUG_ASSERT_POINTER(mali_platform_device);
	_mali_osk_atomic_dec(&mali_pm_ref_count);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
	pm_runtime_mark_last_busy(&(mali_platform_device->dev));
	pm_runtime_put_autosuspend(&(mali_platform_device->dev));
#else
	pm_runtime_put(&(mali_platform_device->dev));
#endif
	MALI_DEBUG_PRINT(4, ("Mali OSK PM: Power ref released (%u)\n", _mali_osk_atomic_read(&mali_pm_ref_count)));

#else /// CONFIG_PM_RUNTIME
      	
	if(_mali_osk_atomic_dec_return(&mali_pm_ref_count) == 0)
	{
	    if (NULL != pm_timer)
	    {
		    _mali_osk_timer_mod(pm_timer, _mali_osk_time_mstoticks(mali_pm_wq ? 15 : 3000));
		}
		else
		{
#if MALI_LICENSE_IS_GPL
            if (mali_pm_wq)
            {
                queue_work(mali_pm_wq, &mali_pm_wq_work_handle);
            }
            else
            {
                MALI_PRINTF(("mali_pm_wq is NULL !!!\n"));
                mali_bottom_half_pm(NULL);
            }
#else
            schedule_work(&mali_pm_wq_work_handle);
#endif
	    }
	}

	MALI_DEBUG_PRINT(4, ("Mali OSK PM: Power ref released (%u)\n", _mali_osk_atomic_read(&mali_pm_ref_count)));
#endif
}
Пример #15
0
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);
}
/* Can run in atomic context */
void _mali_osk_pm_dev_ref_dec_no_power_on(void)
{
#ifdef CONFIG_PM_RUNTIME
	MALI_DEBUG_ASSERT_POINTER(mali_platform_device);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
	pm_runtime_put_autosuspend(&(mali_platform_device->dev));
#else
	pm_runtime_put(&(mali_platform_device->dev));
#endif
	MALI_DEBUG_PRINT(4, ("Mali OSK PM: No-power ref released (%u)\n", _mali_osk_atomic_read(&mali_pm_ref_count)));
#endif
}
int mali_dvfs_bottom_lock_pop(void)
{
	int prev_status = _mali_osk_atomic_read(&bottomlock_status);
	if (prev_status <= 0) {
		MALI_PRINT(("gpu bottom lock status is not valid for pop\n"));
		return -1;
	} else if (prev_status == 1) {
		bottom_lock_step = 0;
		MALI_PRINT(("gpu bottom lock release\n"));
	}

	return _mali_osk_atomic_dec_return(&bottomlock_status);
}
u32 _mali_internal_profiling_get_count(void)
{
	u32 retval = 0;

	_mali_osk_mutex_wait(lock);
	if (MALI_PROFILING_STATE_RETURN == prof_state) {
		retval = _mali_osk_atomic_read(&profile_insert_index);
		if (retval > profile_mask) retval = profile_mask;
	}
	_mali_osk_mutex_signal(lock);

	return retval;
}
inline u32 _mali_osk_profiling_get_count(void)
{
    u32 retval = 0;

    _mali_osk_lock_wait(lock, _MALI_OSK_LOCKMODE_RW);
    if (prof_state == MALI_PROFILING_STATE_RETURN)
    {
        retval = _mali_osk_atomic_read(&profile_entries_written);
    }
    _mali_osk_lock_signal(lock, _MALI_OSK_LOCKMODE_RW);

    return retval;
}
void _mali_osk_profiling_term(void)
{
    prof_state = MALI_PROFILING_STATE_UNINITIALIZED;

    /* wait for all elements to be completely inserted into array */
    while (_mali_osk_atomic_read(&profile_insert_index) != _mali_osk_atomic_read(&profile_entries_written))
    {
        /* do nothing */;
    }

    if (NULL != profile_entries)
    {
        _mali_osk_vfree(profile_entries);
        profile_entries = NULL;
    }

    if (NULL != lock)
    {
        _mali_osk_lock_term(lock);
        lock = NULL;
    }
}
Пример #21
0
/* Can run in atomic context */
void _mali_osk_pm_dev_ref_dec(void)
{
#ifdef CONFIG_PM_RUNTIME
	MALI_DEBUG_ASSERT_POINTER(mali_platform_device);
	_mali_osk_atomic_dec(&mali_pm_ref_count);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
	pm_runtime_mark_last_busy(&(mali_platform_device->dev));
	pm_runtime_put_autosuspend(&(mali_platform_device->dev));
#else
	pm_runtime_put(&(mali_platform_device->dev));
#endif
	MALI_DEBUG_PRINT(4, ("Mali OSK PM: Power ref released (%u)\n", _mali_osk_atomic_read(&mali_pm_ref_count)));

#else /// CONFIG_PM_RUNTIME
      	
	if(_mali_osk_atomic_dec_return(&mali_pm_ref_count) == 0)
	{
		_mali_osk_timer_mod(pm_timer, _mali_osk_time_mstoticks(mali_pm_wq ? 15 : 3000));
	}

	MALI_DEBUG_PRINT(4, ("Mali OSK PM: Power ref released (%u)\n", _mali_osk_atomic_read(&mali_pm_ref_count)));
#endif
}
int mali_dvfs_bottom_lock_push(void)
{
	int prev_status = _mali_osk_atomic_read(&bottomlock_status);

	if (prev_status < 0) {
		MALI_PRINT(("gpu bottom lock status is not valid for push"));
		return -1;
	}

	if (prev_status == 0) {
		mali_regulator_set_voltage(mali_dvfs[1].vol, mali_dvfs[1].vol);
		mali_clk_set_rate(mali_dvfs[1].clock, mali_dvfs[1].freq);
		set_mali_dvfs_current_step(1);
	}

	return _mali_osk_atomic_inc_return(&bottomlock_status);
}
Пример #23
0
int mali_dvfs_bottom_lock_push(int lock_step)
{
	int prev_status = _mali_osk_atomic_read(&bottomlock_status);

	if (prev_status < 0) {
		MALI_PRINT(("gpu bottom lock status is not valid for push\n"));
		return -1;
	}
	if (bottom_lock_step < lock_step) {
		bottom_lock_step = lock_step;
		if (get_mali_dvfs_status() < lock_step) {
			mali_regulator_set_voltage(mali_dvfs[lock_step].vol, mali_dvfs[lock_step].vol);
			mali_clk_set_rate(mali_dvfs[lock_step].clock, mali_dvfs[lock_step].freq);
			set_mali_dvfs_current_step(lock_step);
		}
	}
	return _mali_osk_atomic_inc_return(&bottomlock_status);
}
/* Can NOT run in atomic context */
_mali_osk_errcode_t _mali_osk_pm_dev_ref_add(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;
	}
	_mali_osk_atomic_inc(&mali_pm_ref_count);
	MALI_DEBUG_PRINT(4, ("Mali OSK PM: Power ref taken (%u)\n", _mali_osk_atomic_read(&mali_pm_ref_count)));
#endif
	return _MALI_OSK_ERR_OK;
}
Пример #25
0
int mali_voltage_lock_push(int lock_vol)
{
	int prev_status = _mali_osk_atomic_read(&voltage_lock_status);

	if (prev_status < 0) {
		MALI_PRINT(("gpu voltage lock status is not valid for push\n"));
		return -1;
	}
	if (prev_status == 0) {
		mali_lock_vol = lock_vol;
		if (mali_gpu_vol < mali_lock_vol)
			mali_regulator_set_voltage(mali_lock_vol, mali_lock_vol);
	} else {
		MALI_PRINT(("gpu voltage lock status is already pushed, current lock voltage : %d\n", mali_lock_vol));
		return -1;
	}

	return _mali_osk_atomic_inc_return(&voltage_lock_status);
}
Пример #26
0
static unsigned int decideNextStatus(unsigned int utilization)
{
    static unsigned int level = 0; // 0:stay, 1:up

    if (mali_runtime_resumed >= 0) {
        level = mali_runtime_resumed;
        mali_runtime_resumed = -1;
        return level;
    }

    if (mali_dvfs_threshold[maliDvfsStatus.currentStep].upthreshold
            <= mali_dvfs_threshold[maliDvfsStatus.currentStep].downthreshold) {
        MALI_PRINT(("upthreadshold is smaller than downthreshold: %d < %d\n",
                    mali_dvfs_threshold[maliDvfsStatus.currentStep].upthreshold,
                    mali_dvfs_threshold[maliDvfsStatus.currentStep].downthreshold));
        return level;
    }

    if (utilization > (int)(255 * mali_dvfs_threshold[maliDvfsStatus.currentStep].upthreshold / 100) &&
            level < MALI_DVFS_STEPS - 1) {
        level++;
    }
    if (utilization < (int)(255 * mali_dvfs_threshold[maliDvfsStatus.currentStep].downthreshold / 100) &&
            level > 0) {
        level--;
    }

    if (_mali_osk_atomic_read(&bottomlock_status) > 0) {
        if (level < bottom_lock_step)
            level = bottom_lock_step;
    }
    /* lock/unlock CPU freq by Mali */
    if (mali_dvfs[level].clock >= 300)
        cpufreq_lock_by_mali(800);
    else {
        cpufreq_unlock_by_mali();
    }
    return level;
}
_mali_osk_errcode_t _mali_internal_profiling_stop(u32 * count)
{
	_mali_osk_mutex_wait(lock);

	if (MALI_PROFILING_STATE_RUNNING != prof_state) {
		_mali_osk_mutex_signal(lock);
		return _MALI_OSK_ERR_INVALID_ARGS; /* invalid to call this function in this state */
	}

	/* go into return state (user to retreive events), no more events will be added after this */
	prof_state = MALI_PROFILING_STATE_RETURN;

	unregister_trace_mali_timeline_event(probe_mali_timeline_event, NULL);

	_mali_osk_mutex_signal(lock);

	tracepoint_synchronize_unregister();

	*count = _mali_osk_atomic_read(&profile_insert_index);
	if (*count > profile_mask) *count = profile_mask;

	return _MALI_OSK_ERR_OK;
}
_mali_osk_errcode_t _mali_internal_profiling_get_event(u32 index, u64* timestamp, u32* event_id, u32 data[5])
{
	u32 raw_index = _mali_osk_atomic_read(&profile_insert_index);

	_mali_osk_mutex_wait(lock);

	if (index < profile_mask) {
		if ((raw_index & ~profile_mask) != 0) {
			index += raw_index;
			index &= profile_mask;
		}

		if (prof_state != MALI_PROFILING_STATE_RETURN) {
			_mali_osk_mutex_signal(lock);
			return _MALI_OSK_ERR_INVALID_ARGS; /* invalid to call this function in this state */
		}

		if(index >= raw_index) {
			_mali_osk_mutex_signal(lock);
			return _MALI_OSK_ERR_FAULT;
		}

		*timestamp = profile_entries[index].timestamp;
		*event_id = profile_entries[index].event_id;
		data[0] = profile_entries[index].data[0];
		data[1] = profile_entries[index].data[1];
		data[2] = profile_entries[index].data[2];
		data[3] = profile_entries[index].data[3];
		data[4] = profile_entries[index].data[4];
	} else {
		_mali_osk_mutex_signal(lock);
		return _MALI_OSK_ERR_FAULT;
	}

	_mali_osk_mutex_signal(lock);
	return _MALI_OSK_ERR_OK;
}
Пример #29
0
void mali_pegasus_regulator_set_voltage(int min_uV, int max_uV)
{
	int voltage;
#if !MALI_DVFS_ENABLED
	min_uV = mali_gpu_vol;
	max_uV = mali_gpu_vol;
#endif

#ifdef CONFIG_EXYNOS_TMU_TC
	if (mali_vol_lock_flag == MALI_FALSE) {
		if (min_uV < MALI_BOTTOMLOCK_VOL || max_uV < MALI_BOTTOMLOCK_VOL) {
			min_uV = MALI_BOTTOMLOCK_VOL;
			max_uV = MALI_BOTTOMLOCK_VOL;
		}
	} else if (_mali_osk_atomic_read(&voltage_lock_status) > 0 ) {
		if (min_uV < mali_lock_vol || max_uV < mali_lock_vol) {
#if MALI_DVFS_ENABLED
			int mali_vol_get;
			mali_vol_get = mali_vol_get_from_table(mali_lock_vol);
			if (mali_vol_get) {
				min_uV = mali_vol_get;
				max_uV = mali_vol_get;
			}
#else
			min_uV = mali_lock_vol;
			max_uV = mali_lock_vol;
#endif
		}
	}
#endif

	_mali_osk_lock_wait(mali_dvfs_lock, _MALI_OSK_LOCKMODE_RW);

	if( IS_ERR_OR_NULL(g3d_regulator) ) {
		MALI_DEBUG_PRINT(1, ("error on mali_regulator_set_voltage : g3d_regulator is null\n"));
		return;
	}

    MALI_DEBUG_PRINT(2, ("= regulator_set_voltage: %d, %d \n",min_uV, max_uV));

#if MALI_TIMELINE_PROFILING_ENABLED
    _mali_profiling_add_event( MALI_PROFILING_EVENT_TYPE_SINGLE |
                               MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
                               MALI_PROFILING_EVENT_REASON_SINGLE_SW_GPU_VOLTS,
                               min_uV, max_uV, 1, 0, 0);
#endif

    regulator_set_voltage(g3d_regulator,min_uV,max_uV);
	voltage = regulator_get_voltage(g3d_regulator);

#if MALI_TIMELINE_PROFILING_ENABLED
    _mali_profiling_add_event( MALI_PROFILING_EVENT_TYPE_SINGLE |
                               MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
                               MALI_PROFILING_EVENT_REASON_SINGLE_SW_GPU_VOLTS,
                               voltage, 0, 2, 0, 0);
#endif

	mali_gpu_vol = voltage;
	MALI_DEBUG_PRINT(1, ("= regulator_get_voltage: %d \n",mali_gpu_vol));

	_mali_osk_lock_signal(mali_dvfs_lock, _MALI_OSK_LOCKMODE_RW);
}
Пример #30
0
void malipmm_state_dump()
{
	_mali_pmm_internal_state_t *pmm = GET_PMM_STATE_PTR;

	if( !pmm )
	{
		MALI_PRINT(("PMM: Null state\n"));
	}
	else
	{
		MALI_PRINT(("PMM state:\nstatus=%d\npolicy=%d\ncheck_policy=%d\nstate=%d\n", pmm->status, pmm->policy, pmm->check_policy, pmm->state));
		MALI_PRINT(("PMM cores:\ncores_registered=%d\ncores_powered=%d\ncores_idle=%d\ncores_pend_down=%d\ncores_pend_up=%d\ncores_ack_down=%d\ncores_ack_up=%d\n", pmm->cores_registered, pmm->cores_powered, pmm->cores_idle, pmm->cores_pend_down, pmm->cores_pend_up, pmm->cores_ack_down, pmm->cores_ack_up));	
		MALI_PRINT(("PMM misc:\npmu_init=%d\nmessages_queued=%d\nwaiting=%d\nno_events=%d\nmissed=%d\nfatal_power_err=%d\n", pmm->pmu_initialized, _mali_osk_atomic_read( &(pmm->messages_queued) ), pmm->waiting, pmm->no_events, pmm->missed, pmm->fatal_power_err));
	}
}