From: Imre Deak Date: Mon, 18 Oct 2010 17:14:05 +0000 (+0300) Subject: gpu: pvr: split out setting power down delay into its own function X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d64f3f1b1c5e03092f710fbe3b9bc118d96084c4;p=sgx.git gpu: pvr: split out setting power down delay into its own function This will be needed by an upcoming patch setting the power-down delay dynamically. No functional change. Signed-off-by: Imre Deak Reviewed-by: Luc Verhaegen --- diff --git a/pvr/sgxinfokm.h b/pvr/sgxinfokm.h index 58f88a3..63dfcae 100644 --- a/pvr/sgxinfokm.h +++ b/pvr/sgxinfokm.h @@ -130,6 +130,8 @@ struct PVRSRV_SGXDEV_INFO { u32 ui32TimeStamp; u32 ui32NumResets; + int power_down_delay; + struct PVRSRV_KERNEL_MEM_INFO *psKernelSGXHostCtlMemInfo; struct SGXMKIF_HOST_CTL __iomem *psSGXHostCtl; diff --git a/pvr/sgxpower.c b/pvr/sgxpower.c index 79b6c61..f4cb52b 100644 --- a/pvr/sgxpower.c +++ b/pvr/sgxpower.c @@ -72,11 +72,24 @@ static enum PVR_DEVICE_POWER_STATE MapDevicePowerState(enum PVR_POWER_STATE return eDevicePowerState; } +static void sgx_set_pwrdown_delay(struct PVRSRV_DEVICE_NODE *node, + unsigned ukernel_freq, int msec) +{ + struct PVRSRV_SGXDEV_INFO *dev_info = node->pvDevice; + unsigned delay; + + delay = ukernel_freq * msec / 1000 + 1; + if (dev_info->power_down_delay != delay) { + writel(delay, + &dev_info->psSGXHostCtl->ui32ActivePowManSampleRate); + dev_info->power_down_delay = delay; + } +} + static void SGXGetTimingInfo(struct PVRSRV_DEVICE_NODE *psDeviceNode) { struct PVRSRV_SGXDEV_INFO *psDevInfo = psDeviceNode->pvDevice; struct SGX_TIMING_INFORMATION sSGXTimingInfo = { 0 }; - u32 ui32ActivePowManSampleRate; struct timer_work_data *data = psDevInfo->hTimer; SysGetSGXTimingInformation(&sSGXTimingInfo); @@ -103,12 +116,8 @@ static void SGXGetTimingInfo(struct PVRSRV_DEVICE_NODE *psDeviceNode) sSGXTimingInfo.ui32CoreClockSpeed / sSGXTimingInfo.ui32uKernelFreq; - ui32ActivePowManSampleRate = - sSGXTimingInfo.ui32uKernelFreq * - sSGXTimingInfo.ui32ActivePowManLatencyms / 1000; - ui32ActivePowManSampleRate += 1; - writel(ui32ActivePowManSampleRate, - &psDevInfo->psSGXHostCtl->ui32ActivePowManSampleRate); + sgx_set_pwrdown_delay(psDeviceNode, sSGXTimingInfo.ui32uKernelFreq, + sSGXTimingInfo.ui32ActivePowManLatencyms); } void SGXStartTimer(struct PVRSRV_SGXDEV_INFO *psDevInfo, IMG_BOOL bStartOSTimer)