Beispiel #1
0
int owlPreClockChange(u32 SGXIndex)
{
	owl_gpu.ClockChangeCounter++;
	if(owl_gpu.ClockChangeCounter<=1 && owl_gpu.bSysInited)
		PVRSRVDevicePreClockSpeedChange(SGXIndex,1,NULL);
	return 0;
}
static int VDD2PreFunc(struct notifier_block *n, unsigned long event, IMG_VOID *ptr)
{
	PVR_UNREFERENCED_PARAMETER(n);
	PVR_UNREFERENCED_PARAMETER(event);
	PVR_UNREFERENCED_PARAMETER(ptr);

	if (in_interrupt())
	{
		PVR_DPF((PVR_DBG_WARNING, "%s Called in interrupt context.  Ignoring.", __FUNCTION__));
		return 0;
	}

	if (PowerLockWrappedOnCPU(gpsSysSpecificData))
	{
		PVR_DPF((PVR_DBG_WARNING, "%s Called from within a power transition.  Ignoring.", __FUNCTION__));
		return 0;
	}

	NotifyLock(gpsSysSpecificData);

	PVR_ASSERT(!gpsSysSpecificData->bCallVDD2PostFunc);

	if (ConstraintNotificationsEnabled(gpsSysSpecificData))
	{
		PVRSRV_ERROR eError;

		eError = PVRSRVDevicePreClockSpeedChange(gpsSysSpecificData->psSGXDevNode->sDevId.ui32DeviceIndex, IMG_TRUE, IMG_NULL);

		gpsSysSpecificData->bCallVDD2PostFunc = (eError == PVRSRV_OK);

	}

	return 0;
}
Beispiel #3
0
static IMG_VOID DvfsChange(int freq /* MHz */)
{
	PVRSRV_ERROR err;

	if(freq == GetCurrentFreq())
	{
		return;
	}

	mutex_lock(&private_data.dvfs_lock);
	err = PVRSRVDevicePreClockSpeedChange(0, IMG_TRUE, NULL);
	if(err == PVRSRV_OK)
	{
		if(GetCurrentFreq() <= vf_data.normal.freq)
		{
			if(freq <= vf_data.normal.freq)
			{
				if(GetCurrentVol() != vf_data.normal.vol)
				{
					SetGpuVol(vf_data.normal.vol);
				}
			}
			else
			{
				if(GetCurrentVol() != vf_data.extreme.vol)
				{
					SetGpuVol(vf_data.extreme.vol);
				}
			}
			SetClkVal(freq);
		}
		else
		{
			if(freq <= vf_data.normal.freq)
			{
				SetClkVal(freq);
				if(GetCurrentVol() != vf_data.normal.vol)
				{
					SetGpuVol(vf_data.normal.vol);
				}
			}
			else
			{
				if(GetCurrentVol() != vf_data.extreme.vol)
				{
					SetGpuVol(vf_data.extreme.vol);
				}
				SetClkVal(freq);
			}
		}

		PVRSRVDevicePostClockSpeedChange(0, IMG_TRUE, NULL);
	}
	mutex_unlock(&private_data.dvfs_lock);
}
unsigned int RGXPreClockSpeed(void){

	PVRSRV_ERROR	eError = PVRSRV_OK;
	PVRSRV_DEVICE_NODE* psDeviceNode = RGXGetDeviceNode();

	if(!psDeviceNode){
		eError = PVRSRV_ERROR_INVALID_DEVICE;
		goto out;
	}

	eError = PVRSRVDevicePreClockSpeedChange(psDeviceNode->sDevId.ui32DeviceIndex, IMG_FALSE, NULL);
out:
	return eError;
}
static IMG_VOID RgxDvfsChange(int vf_level, int up_flag)
{
	PVRSRVDevicePreClockSpeedChange(0, IMG_TRUE, NULL);
	printk(KERN_INFO "RGX DVFS begin\n");
	if(up_flag == 1)
	{
		SetGpuVol(vf_level);
		SetClkVal("pll", vf_table[vf_level][1]);
	}
	else
	{
		SetClkVal("pll", vf_table[vf_level][1]);
		SetGpuVol(vf_level);
	}
	printk(KERN_INFO "RGX DVFS end\n");
	PVRSRVDevicePostClockSpeedChange(0, IMG_TRUE, NULL);
}
Beispiel #6
0
static IMG_VOID SetGpuClkVal(int freq /* MHz */)
{
	PVRSRV_ERROR err;

	if(freq == GetCurrentFreq())
	{
		return;
	}

	mutex_lock(&private_data.dvfs_lock);
	err = PVRSRVDevicePreClockSpeedChange(0, IMG_TRUE, NULL);
	if(err == PVRSRV_OK)
	{
		SetClkVal(freq);
		PVRSRVDevicePostClockSpeedChange(0, IMG_TRUE, NULL);
	}
	mutex_unlock(&private_data.dvfs_lock);
}
Beispiel #7
0
static IMG_VOID RgxDvfsChange(int vf_level, int up_flag)
{
	PVRSRV_ERROR err;
	err = PVRSRVDevicePreClockSpeedChange(0, IMG_TRUE, NULL);
	if(err == PVRSRV_OK)
	{
		if(up_flag == 1)
		{
			SetGpuVol(vf_level);
			SetClkVal("pll", vf_table[vf_level][1]);
		}
		else
		{
			SetClkVal("pll", vf_table[vf_level][1]);
			SetGpuVol(vf_level);
		}
		PVRSRVDevicePostClockSpeedChange(0, IMG_TRUE, NULL);
	}
}
static void SGXDvfsChange(u32 vf_level)
{
	PVRSRV_ERROR err;
	err = PVRSRVDevicePreClockSpeedChange(0, IMG_TRUE, NULL);
	if(err == PVRSRV_OK)
	{
		if(vf_level < dvfs_level)
		{
			/* if changing to a lower level, reduce frequency firstly and then reduce voltage */
			if(SetGpuFreq(vf_level))
			{
				goto post;
			}
			if(SetGpuVol(vf_level))
			{
				SetGpuFreq(dvfs_level);
				goto post;
			}
		}
		else if(vf_level > dvfs_level)
		{
			/* if changing to a higher level, reduce voltage firstly and then reduce frequency */
			if(SetGpuVol(vf_level))
			{
				goto post;
			}
			if(SetGpuFreq(vf_level))
			{
				SetGpuVol(dvfs_level);
				goto post;
			}
		}
		else
		{
			/* here means the level to be is the same as dvfs_level, just do noting */
			goto post;
		}
		
		dvfs_level = vf_level;
	post:
		PVRSRVDevicePostClockSpeedChange(0, IMG_TRUE, NULL);		
	}
}
Beispiel #9
0
static ssize_t VoltageStore(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
	PVRSRV_ERROR err;
    unsigned long vol;
    err = strict_strtoul(buf, 10, &vol);
    if (err)
    {
		PVR_DPF((PVR_DBG_ERROR, "Invalid parameter!\n"));
        goto out;
    }

	mutex_lock(&private_data.dvfs_lock);
	err = PVRSRVDevicePreClockSpeedChange(0, IMG_TRUE, NULL);
	if(err == PVRSRV_OK)
	{
		SetGpuVol(vol);

		PVRSRVDevicePostClockSpeedChange(0, IMG_TRUE, NULL);
	}
	mutex_unlock(&private_data.dvfs_lock);

out:
    return count;
}