_mali_osk_errcode_t mali_platform_powerup(u32 cores)
{
	MALI_DEBUG_PRINT(3,("power up is called in mali_platform_powerup state %x core %x \n", gpu_power_state, cores));

	if (gpu_power_state == 0) // power up only before state is 0
	{
		gpu_power_state = gpu_power_state | cores;

		if (gpu_power_state != 0)
		{
			g3d_power_domain_control(1);
			MALI_DEBUG_PRINT(4,("enable clock \n"));
			enable_mali_clocks();
		}
	}
	else
	{
		gpu_power_state = gpu_power_state | cores;
	}
	
  	bPoweroff=0;


	MALI_SUCCESS;
}
_mali_osk_errcode_t mali_platform_power_mode_change(struct device *dev, mali_power_mode power_mode)
{
	switch (power_mode)
	{
	case MALI_POWER_MODE_ON:
		MALI_DEBUG_PRINT(3, ("Mali platform: Got MALI_POWER_MODE_ON event, %s\n",
					nPowermode ? "powering on" : "already on"));
		if (nPowermode == MALI_POWER_MODE_LIGHT_SLEEP || nPowermode == MALI_POWER_MODE_DEEP_SLEEP)	{
			MALI_DEBUG_PRINT(4, ("enable clock\n"));
			enable_mali_clocks(dev);
			nPowermode = power_mode;
		}
		break;
	case MALI_POWER_MODE_DEEP_SLEEP:
	case MALI_POWER_MODE_LIGHT_SLEEP:
		MALI_DEBUG_PRINT(3, ("Mali platform: Got %s event, %s\n", power_mode == MALI_POWER_MODE_LIGHT_SLEEP ?
					"MALI_POWER_MODE_LIGHT_SLEEP" : "MALI_POWER_MODE_DEEP_SLEEP",
					nPowermode ? "already off" : "powering off"));
		if (nPowermode == MALI_POWER_MODE_ON)	{
			disable_mali_clocks();
			nPowermode = power_mode;
		}
		break;
	}
	MALI_SUCCESS;
}
_mali_osk_errcode_t mali_platform_power_mode_change(struct device *dev, mali_power_mode power_mode)
{
	switch (power_mode)
	{
	case MALI_POWER_MODE_ON:
		MALI_DEBUG_PRINT(3, ("Mali platform: Got MALI_POWER_MODE_ON event, %s\n",
					nPowermode ? "powering on" : "already on"));
		if (nPowermode == MALI_POWER_MODE_LIGHT_SLEEP || nPowermode == MALI_POWER_MODE_DEEP_SLEEP)	{
#if !defined(CONFIG_PM_RUNTIME)
			g3d_power_domain_control(1);
#endif
			MALI_DEBUG_PRINT(4, ("enable clock\n"));
			enable_mali_clocks(dev);

			if (nPowermode == MALI_POWER_MODE_DEEP_SLEEP)	{
#ifdef CONFIG_MALI_DVFS
				mali_devfreq = NULL;
				if (!mali_devfreq_add(dev))
					MALI_PRINTF(("failed to mali_devfreq_add()\n"));
#endif
			}
#if defined(CONFIG_MALI400_PROFILING)
			_mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE |
			MALI_PROFILING_EVENT_CHANNEL_GPU |
			MALI_PROFILING_EVENT_REASON_SINGLE_GPU_FREQ_VOLT_CHANGE,
			mali_gpu_clk, mali_gpu_vol/1000, 0, 0, 0);
#endif
			nPowermode = power_mode;
		}
		break;
	case MALI_POWER_MODE_DEEP_SLEEP:
#ifdef CONFIG_MALI_DVFS
		mali_devfreq_remove();
#endif
	case MALI_POWER_MODE_LIGHT_SLEEP:
		MALI_DEBUG_PRINT(3, ("Mali platform: Got %s event, %s\n", power_mode == MALI_POWER_MODE_LIGHT_SLEEP ?
					"MALI_POWER_MODE_LIGHT_SLEEP" : "MALI_POWER_MODE_DEEP_SLEEP",
					nPowermode ? "already off" : "powering off"));
		if (nPowermode == MALI_POWER_MODE_ON)	{
			disable_mali_clocks();

#if defined(CONFIG_MALI400_PROFILING)
			_mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE |
			MALI_PROFILING_EVENT_CHANNEL_GPU |
			MALI_PROFILING_EVENT_REASON_SINGLE_GPU_FREQ_VOLT_CHANGE,
			0, 0, 0, 0, 0);
#endif
#if !defined(CONFIG_PM_RUNTIME)
			g3d_power_domain_control(0);
#endif
			nPowermode = power_mode;
		}
		break;
	}
	MALI_SUCCESS;
}
static mali_bool init_mali_clock(void)
{
	
	mali_bool ret = MALI_TRUE;
	
	if (mali_clock != 0 || mali_clock_pd != 0)
		return ret; 
	
	mali_clock_pd = mali_clk_get(GPUCLK_PD_NAME);
	if (IS_ERR(mali_clock_pd))
	{
		MALI_PRINT( ("MALI Error : failed to get source mali pd\n"));
		ret = MALI_FALSE;
		goto err_gpu_clk;
	}
	enable_mali_clocks(mali_clock_pd);
	
	mali_clock = mali_clk_get(GPUCLK_NAME);
	if (IS_ERR(mali_clock))
	{
		MALI_PRINT( ("MALI Error : failed to get source mali clock\n"));
		ret = MALI_FALSE;
		goto err_gpu_clk;
	}

	enable_mali_clocks(mali_clock);
	mali_clk_set_rate(mali_clock, mali_init_clock);

	MALI_PRINT(("init mali clock success\n"));	
	return MALI_TRUE;

err_gpu_clk:
	MALI_PRINT(("::clk_put:: %s mali_clock\n", __FUNCTION__));
	clk_put(mali_clock_pd);
	clk_put(mali_clock);
	mali_clock = 0;
	mali_clock_pd = 0;

	return ret;
}
_mali_osk_errcode_t mali_platform_power_mode_change(mali_power_mode power_mode)
{
        switch (power_mode)
        {
                case MALI_POWER_MODE_ON:
			MALI_DEBUG_PRINT(1, ("Mali platform: Got MALI_POWER_MODE_ON event, %s\n", bPoweroff ? "powering on" : "already on"));
			if (bPoweroff == 1)
			{
				/** If run time power management is used, donot call this function */
#ifndef CONFIG_PM_RUNTIME 
				g3d_power_domain_control(1);
#endif 

				MALI_DEBUG_PRINT(4,("enable clock \n"));
				enable_mali_clocks();
#if MALI_INTERNAL_TIMELINE_PROFILING_ENABLED
				_mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE| MALI_PROFILING_EVENT_CHANNEL_GPU|MALI_PROFILING_EVENT_REASON_SINGLE_GPU_FREQ_VOLT_CHANGE, mali_gpu_clk, mali_gpu_vol/1000, 0, 0, 0);
#endif
				//MALI_PRINTF(("Mali Platform powered up"));
				gpu_power_state=1;
				bPoweroff=0;
			}
			break;
		case MALI_POWER_MODE_LIGHT_SLEEP:
		case MALI_POWER_MODE_DEEP_SLEEP:
			MALI_DEBUG_PRINT(1, ("Mali platform: Got %s event, %s\n",
	                     power_mode == MALI_POWER_MODE_LIGHT_SLEEP ? "MALI_POWER_MODE_LIGHT_SLEEP" : "MALI_POWER_MODE_DEEP_SLEEP",
	                     bPoweroff ? "already off" : "powering off"));
			if (bPoweroff == 0)
			{
				disable_mali_clocks();
#if MALI_INTERNAL_TIMELINE_PROFILING_ENABLED
				_mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE| MALI_PROFILING_EVENT_CHANNEL_GPU|MALI_PROFILING_EVENT_REASON_SINGLE_GPU_FREQ_VOLT_CHANGE, 0, 0, 0, 0, 0);
#endif

#ifndef CONFIG_PM_RUNTIME
				g3d_power_domain_control(0);
#endif

				//MALI_PRINTF(("Mali Platform powered down"));
				gpu_power_state=0;
				bPoweroff=1;
			}

		break;
	}
	MALI_SUCCESS;
}
示例#6
0
_mali_osk_errcode_t mali_platform_powerup(u32 cores)
{
	MALI_DEBUG_PRINT(3,("power up is called in mali_platform_powerup state %x core %x \n", gpu_power_state, cores));

	/* power up only before state is */
	if (gpu_power_state == 0) {
		gpu_power_state = gpu_power_state | cores;

		if (gpu_power_state != 0) {
			MALI_DEBUG_PRINT(4,("enable clock \n"));
			enable_mali_clocks();
		}
	} else {
		gpu_power_state = gpu_power_state | cores;
	}

	MALI_SUCCESS;
}
示例#7
0
_mali_osk_errcode_t mali_platform_powerup(u32 cores)
{
	trace_printk("SPI_GPU_PWR Start\n");
	MALI_DEBUG_PRINT(3,("power up is called in mali_platform_powerup state %x core %x \n", gpu_power_state, cores));

	if (gpu_power_state == 0) // power up only before state is 0
	{
		gpu_power_state = gpu_power_state | cores;

		if (gpu_power_state != 0)
		{
			MALI_DEBUG_PRINT(4,("enable clock \n"));
			enable_mali_clocks();
		}
	}
	else
	{
		gpu_power_state = gpu_power_state | cores;
	}

	MALI_SUCCESS;
}