int owlPostClockChange(u32 SGXIndex) { if(owl_gpu.ClockChangeCounter<=1 && owl_gpu.bSysInited) PVRSRVDevicePostClockSpeedChange(SGXIndex,1,NULL); owl_gpu.ClockChangeCounter--; return 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); }
static int VDD2PostFunc(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_ERROR, "%s Called in interrupt context. Ignoring.", __FUNCTION__)); return 0; } if (!NotifyLockedOnCPU(gpsSysSpecificData)) { return 0; } #if defined(DEBUG) if (ConstraintNotificationsEnabled(gpsSysSpecificData)) { IMG_UINT32 rate; rate = clk_get_rate(gpsSysSpecificData->psSGX_FCK); PVR_ASSERT(rate != 0); PVR_DPF((PVR_DBG_MESSAGE, "%s: SGX clock rate: %dMHz", __FUNCTION__, HZ_TO_MHZ(rate))); } #endif if (gpsSysSpecificData->bCallVDD2PostFunc) { PVRSRVDevicePostClockSpeedChange(gpsSysSpecificData->psSGXDevNode->sDevId.ui32DeviceIndex, IMG_TRUE, IMG_NULL); gpsSysSpecificData->bCallVDD2PostFunc = IMG_FALSE; } else { if (ConstraintNotificationsEnabled(gpsSysSpecificData)) { PVR_TRACE(("%s: Not calling PVR clock speed notification functions", __FUNCTION__)); } } NotifyUnlock(gpsSysSpecificData); return 0; }
unsigned int RGXPostClockSpeed(void){ PVRSRV_ERROR eError = PVRSRV_OK; PVRSRV_DEVICE_NODE* psDeviceNode = RGXGetDeviceNode(); if(!psDeviceNode){ eError = PVRSRV_ERROR_INVALID_DEVICE; goto out; } PVRSRVDevicePostClockSpeedChange(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); }
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); }
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); } }
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; }