proprietary-open: jacinto6: add graphics binaries and kernel module sources
authorVishal Mahaveer <vishalm@ti.com>
Fri, 19 Jul 2013 21:52:33 +0000 (16:52 -0500)
committerVishal Mahaveer <vishalm@ti.com>
Fri, 19 Jul 2013 22:35:02 +0000 (17:35 -0500)
Adding graphics kernel module sources and DDK binaries.

 Branch: origin/1.9/2291151_k3.8
 Commit: e38b375eaf17d8eee431e5962a8c772d4a86bc3c

Change-Id: I946263ae1cd0205805d3ce6d345d240530f49e02
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
14 files changed:
jacinto6/README.SGX
jacinto6/sgx.tgz
jacinto6/sgx_src/eurasia_km/eurasiacon/build/linux2/omap4430_android/Makefile
jacinto6/sgx_src/eurasia_km/services4/srvkm/common/pvrsrv.c
jacinto6/sgx_src/eurasia_km/services4/srvkm/devices/sgx/sgxinit.c
jacinto6/sgx_src/eurasia_km/services4/srvkm/devices/sgx/sgxpower.c
jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/ion.c
jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/mm.c
jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/mmap.c
jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/module.c
jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/osfunc.c
jacinto6/sgx_src/eurasia_km/services4/system/omap4/sgxfreq.c
jacinto6/sgx_src/eurasia_km/services4/system/omap4/syslocal.h
jacinto6/sgx_src/eurasia_km/services4/system/omap4/sysutils_linux.c

index ead7052789122e4f3b780f89936495e23373ff87..839ab3af23f031df5a8367e3e61c6187bc914e73 100644 (file)
@@ -21,7 +21,7 @@ core specific pvrsrvinit.
 [DDK commit ID]
     6708c05 build: Add jacinto6 gralloc binary
 [Branch]
-    origin/1.9/j6-wip
+    origin/1.9/2291151_k3.8
 [Kernel modules built against]
     Kernel Version: 3.8.y with CONFIG_MODVERSIONS=y
 
index e4f613fb581cf9ff7c2cd98724bfe22f5e4c58c9..42da719f0c9137cd2186f069c63fa7261ab1253e 100644 (file)
Binary files a/jacinto6/sgx.tgz and b/jacinto6/sgx.tgz differ
index cf143fe46d077b6bd8f71085b41ae6976dbd218b..0d9ba11faad35d2e84e39031cf645f92cdf0eeea 100644 (file)
@@ -67,9 +67,10 @@ endif
 export SGXCORE
 export SGX_CORE_REV
 
-SGX_DYNAMIC_TIMING_INFO := 1
 SUPPORT_ACTIVE_POWER_MANAGEMENT := 0
 
+SGX_DYNAMIC_TIMING_INFO := 1
+
 SUPPORT_LINUX_USING_WORKQUEUES := 1
 
 DISPLAY_CONTROLLER := omaplfb
@@ -101,7 +102,7 @@ ifneq ($(strip $(KERNELDIR)),)
   ifeq ($(call kernel-version-at-least,3,0),true)
    SUPPORT_DC_CMDCOMPLETE_WHEN_NO_LONGER_DISPLAYED := 1
    PVR_ANDROID_NEEDS_ACCUM_SYNC_WORKAROUND := 1
-   SYS_OMAP4_HAS_DVFS_FRAMEWORK := 0
+   SYS_OMAP4_HAS_DVFS_FRAMEWORK := 1
   endif
  endif
 else
@@ -110,7 +111,7 @@ else
   $(warning "Assuming we want DVFS and dsscomp support.")
   SUPPORT_DC_CMDCOMPLETE_WHEN_NO_LONGER_DISPLAYED := 1
   PVR_ANDROID_NEEDS_ACCUM_SYNC_WORKAROUND := 1
-  SYS_OMAP4_HAS_DVFS_FRAMEWORK := 0
+  SYS_OMAP4_HAS_DVFS_FRAMEWORK := 1
  endif
 endif
 
index 1b5312c02d04abfb4fd0be6d941b9696a2e57069..ecad67de037500cbd5430e81a628de5f899ecb29 100644 (file)
@@ -61,7 +61,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "lists.h"
 
 IMG_UINT32     g_ui32InitFlags;
-extern int powering_down;
 
 /* mark which parts of Services were initialised */
 #define                INIT_DATA_ENABLE_PDUMPINIT      0x1U
@@ -1486,9 +1485,8 @@ IMG_BOOL IMG_CALLCONV PVRSRVDeviceLISR(PVRSRV_DEVICE_NODE *psDeviceNode)
                {
                        bStatus = (*psDeviceNode->pfnDeviceISR)(psDeviceNode->pvISRData);
                }
-               if(!powering_down) {
-                       SysClearInterrupts(psSysData, psDeviceNode->ui32SOCInterruptBit);
-               }
+
+               SysClearInterrupts(psSysData, psDeviceNode->ui32SOCInterruptBit);
        }
 
 out:
index cc86c4f30803a732d9e3a94265b7bc630dd4bf91..3162978903ce86cf51c602139bafc1e61ab45439 100644 (file)
@@ -69,7 +69,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "ttrace.h"
 
 IMG_UINT32 g_ui32HostIRQCountSample = 0;
-extern int powering_down;
 
 #if defined(PVRSRV_USSE_EDM_STATUS_DEBUG)
 
@@ -1252,7 +1251,9 @@ static INLINE IMG_UINT32 GetDirListBaseReg(IMG_UINT32 ui32Index)
 }
 #endif
 
+#if defined(CONFIG_DSSCOMP)
 void dsscomp_kdump(void);
+#endif
 /*!
 *******************************************************************************
 
@@ -1274,7 +1275,9 @@ IMG_VOID SGXDumpDebugInfo (PVRSRV_SGXDEV_INFO     *psDevInfo,
 {
        IMG_UINT32      ui32CoreNum;
 
+#if defined(CONFIG_DSSCOMP)
        dsscomp_kdump();
+#endif
 
        PVR_LOG(("SGX debug (%s)", PVRVERSION_STRING));
 
@@ -1816,7 +1819,7 @@ IMG_BOOL SGX_ISRHandler (IMG_VOID *pvData)
 
        /* Real Hardware */
        {
-               IMG_UINT32 ui32EventStatus = 0, ui32EventEnable = 0;
+               IMG_UINT32 ui32EventStatus, ui32EventEnable;
                IMG_UINT32 ui32EventClear = 0;
 #if defined(SGX_FEATURE_DATA_BREAKPOINTS)
                IMG_UINT32 ui32EventStatus2, ui32EventEnable2;
@@ -1835,19 +1838,15 @@ IMG_BOOL SGX_ISRHandler (IMG_VOID *pvData)
                psDeviceNode = (PVRSRV_DEVICE_NODE *)pvData;
                psDevInfo = (PVRSRV_SGXDEV_INFO *)psDeviceNode->pvDevice;
 
-               if(!powering_down) {
-                       ui32EventStatus = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_STATUS);
-                       ui32EventEnable = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_HOST_ENABLE);
-               }
+               ui32EventStatus = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_STATUS);
+               ui32EventEnable = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_HOST_ENABLE);
 
                /* test only the unmasked bits */
                ui32EventStatus &= ui32EventEnable;
 
 #if defined(SGX_FEATURE_DATA_BREAKPOINTS)
-               if(!powering_down) {
-                       ui32EventStatus2 = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_STATUS2);
-                       ui32EventEnable2 = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_HOST_ENABLE2);
-               }
+               ui32EventStatus2 = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_STATUS2);
+               ui32EventEnable2 = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_HOST_ENABLE2);
 
                /* test only the unmasked bits */
                ui32EventStatus2 &= ui32EventEnable2;
@@ -1882,10 +1881,8 @@ IMG_BOOL SGX_ISRHandler (IMG_VOID *pvData)
                        ui32EventClear |= EUR_CR_EVENT_HOST_CLEAR_MASTER_INTERRUPT_MASK;
 
                        /* clear the events */
-                       if(!powering_down) {
-                               OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_HOST_CLEAR, ui32EventClear);
-                               OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_HOST_CLEAR2, ui32EventClear2);
-                       }
+                       OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_HOST_CLEAR, ui32EventClear);
+                       OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_EVENT_HOST_CLEAR2, ui32EventClear2);
 
                        /*
                                Sample the current count from the uKernel _after_ we've cleared the
index 47f3f488b7470aaa4c07c4048e0d64c2ecaaff97..03647a06ab6173e8ca02d06f0cf8355583c8dde1 100644 (file)
@@ -49,7 +49,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "pdump_km.h"
 
 extern IMG_UINT32 g_ui32HostIRQCountSample;
-int powering_down = 0;
 
 #if defined(SUPPORT_HW_RECOVERY)
 static PVRSRV_ERROR SGXAddTimer(PVRSRV_DEVICE_NODE             *psDeviceNode,
@@ -333,8 +332,6 @@ PVRSRV_ERROR SGXPrePowerState (IMG_HANDLE                           hDevHandle,
                        PDUMPCOMMENT("SGX idle request");
                }
 
-               powering_down = 1;
-
                sCommand.ui32Data[1] = ui32PowerCmd;
 
                eError = SGXScheduleCCBCommand(psDeviceNode, SGXMKIF_CMD_POWER, &sCommand, KERNEL_ID, 0, IMG_NULL, IMG_FALSE);
@@ -377,7 +374,7 @@ PVRSRV_ERROR SGXPrePowerState (IMG_HANDLE                           hDevHandle,
                #endif /* PDUMP */
 
                /* Wait for the pending ukernel to host interrupts to come back. */
-               #if 0//!defined(NO_HARDWARE)
+               #if !defined(NO_HARDWARE)
                if (PollForValueKM(&g_ui32HostIRQCountSample,
                                                        psDevInfo->psSGXHostCtl->ui32InterruptCount,
                                                        0xffffffff,
@@ -497,7 +494,6 @@ PVRSRV_ERROR SGXPostPowerState (IMG_HANDLE                          hDevHandle,
                                PVR_DPF((PVR_DBG_ERROR,"SGXPostPowerState: SGXInitialise failed"));
                                return eError;
                        }
-                       powering_down = 0;
                }
                else
                {
index e84fdc4a2028f42c1629d7be719205ff8af954d1..5cb152111d7cefdba2edfa3d49e5e7d0e18fa7d8 100644 (file)
@@ -254,7 +254,7 @@ PVRSRV_ERROR IonImportBufferAndAquirePhysAddr(IMG_HANDLE hIonDev,
 {
        struct ion_client *psIonClient = hIonDev;
        struct ion_handle *psIonHandle;
-       struct scatterlist *psScatterList;
+       struct sg_table *psSgTable;
        struct scatterlist *psTemp;
        IMG_SYS_PHYADDR *pasSysPhysAddr = NULL;
        ION_IMPORT_DATA *psImportData;
@@ -282,8 +282,8 @@ PVRSRV_ERROR IonImportBufferAndAquirePhysAddr(IMG_HANDLE hIonDev,
        psImportData->psIonClient = psIonClient;
        psImportData->psIonHandle = psIonHandle;        
 
-       psScatterList = ion_map_dma(psIonClient, psIonHandle);
-       if (psScatterList == NULL)
+       psSgTable = ion_sg_table(psIonClient, psIonHandle);
+       if (psSgTable == NULL)
        {
                eError = PVRSRV_ERROR_INVALID_PARAMS;
                goto exitFailMap;
@@ -295,7 +295,7 @@ PVRSRV_ERROR IonImportBufferAndAquirePhysAddr(IMG_HANDLE hIonDev,
        */
        for (i=0;i<2;i++)
        {
-               psTemp = psScatterList;
+               psTemp = psSgTable->sgl;
                if (i == 1)
                {
                        pasSysPhysAddr = kmalloc(sizeof(IMG_SYS_PHYADDR) * ui32PageCount, GFP_KERNEL);
@@ -339,7 +339,6 @@ PVRSRV_ERROR IonImportBufferAndAquirePhysAddr(IMG_HANDLE hIonDev,
        return PVRSRV_OK;
 
 exitFailAlloc:
-       ion_unmap_dma(psIonClient, psIonHandle);
 exitFailMap:
        ion_free(psIonClient, psIonHandle);
 exitFailImport:
@@ -352,7 +351,6 @@ IMG_VOID IonUnimportBufferAndReleasePhysAddr(IMG_HANDLE hPriv)
 {
        ION_IMPORT_DATA *psImportData = hPriv;
 
-       ion_unmap_dma(psImportData->psIonClient, psImportData->psIonHandle);
        if (psImportData->pvKernAddr)
        {
                ion_unmap_kernel(psImportData->psIonClient, psImportData->psIonHandle);
index af8a72102cd6eeb447ad07b33fa8b75fbda0e956..b1947941ed6063e7f1955dc1269a850f87ab0522 100644 (file)
@@ -1566,7 +1566,7 @@ NewIONLinuxMemArea(IMG_UINT32 ui32Bytes, IMG_UINT32 ui32AreaFlags,
 
                        asAllocData[i].handle = ion_alloc (gpsIONClient,
                                ui32Bytes,
-                               PAGE_SIZE, (1 << OMAP_ION_HEAP_SYSTEM),0);
+                               PAGE_SIZE, (1 << OMAP_ION_HEAP_SYSTEM), 0);
 
                        if (asAllocData[i].handle == NULL)
                        {
@@ -1575,7 +1575,7 @@ NewIONLinuxMemArea(IMG_UINT32 ui32Bytes, IMG_UINT32 ui32AreaFlags,
                                goto err_free;
                        }
 
-                       sgtable = ion_sg_table (gpsIONClient, asAllocData[i].handle);
+                       sgtable = ion_sg_table(gpsIONClient, asAllocData[i].handle);
                        if (sgtable == NULL)
                        {
                                PVR_DPF((PVR_DBG_ERROR, "%s: Failed to compute pages",
@@ -1598,9 +1598,9 @@ NewIONLinuxMemArea(IMG_UINT32 ui32Bytes, IMG_UINT32 ui32AreaFlags,
                        }
 
                        iNumPages[i] = ui32Num1dPages;
-        }
-        else /* 2D DMM Buffers */
-        {
+       }
+       else /* 2D DMM Buffers */
+       {
                        if (omap_ion_tiler_alloc(gpsIONClient, &asAllocData[i]) < 0)
                        {
                                PVR_DPF((PVR_DBG_ERROR, "%s: Failed to allocate via ion_tiler",
index f6cbc3ffcd3ec5eaf6601cfe9515b49d280feb6d..e1a0c219e0ba3e8062bdb90ad326273374f3e646 100644 (file)
@@ -1077,6 +1077,9 @@ PVRMMap(struct file* pFile, struct vm_area_struct* ps_vma)
     PVR_DPF((PVR_DBG_MESSAGE, "%s: Mapped psLinuxMemArea 0x%p\n",
          __FUNCTION__, psOffsetStruct->psLinuxMemArea));
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
+    ps_vma->vm_flags |= VM_RESERVED;
+#endif
     ps_vma->vm_flags |= VM_IO;
 
     /*
index 714668f18cead56e0351aa59f53f6be4a15d6a00..e7b161f9d83ab7009e4254ea82cdea2cc0cbada5 100644 (file)
@@ -85,6 +85,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <linux/fs.h>
 #include <linux/proc_fs.h>
 
+#ifdef CONFIG_OF
+#include <linux/of.h>
+#endif
+
 #if defined(SUPPORT_DRI_DRM)
 #include <drm/drmP.h>
 #if defined(PVR_SECURE_DRM_AUTH_EXPORT)
@@ -256,16 +260,31 @@ MODULE_DEVICE_TABLE(pci, powervr_id_table);
 #endif
 
 #if defined(PVR_USE_PRE_REGISTERED_PLATFORM_DEV)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
+static struct platform_device_id powervr_id_table[] __devinitdata = {
+#else
 static struct platform_device_id powervr_id_table[] = {
+#endif
        {SYS_SGX_DEV_NAME, 0},
        {}
 };
 #endif
 
+#ifdef CONFIG_OF
+static const struct of_device_id omap_gpu_id_table[] = {
+        { .compatible = "ti,omap4-gpu" },
+        {}
+};
+MODULE_DEVICE_TABLE(of, omap_gpu_id_table);
+#endif
+
 static LDM_DRV powervr_driver = {
 #if defined(PVR_LDM_PLATFORM_MODULE)
        .driver = {
                .name           = DRVNAME,
+#ifdef CONFIG_OF
+               .of_match_table = of_match_ptr(omap_gpu_id_table),
+#endif
        },
 #endif
 #if defined(PVR_LDM_PCI_MODULE)
index 6cc9ec165c930d4472001ce8f33f394a2f9593c6..c508b09b13e99ca580ac0b7a603b13c84e1a674e 100644 (file)
@@ -3781,7 +3781,11 @@ PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr,
     }
 
     /* Does the region represent memory mapped I/O? */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38))
+    if ((psVMArea->vm_flags & (VM_IO | VM_RESERVED)) != (VM_IO | VM_RESERVED))
+#else
     if ((psVMArea->vm_flags & (VM_IO)) != (VM_IO))
+#endif
     {
         PVR_DPF((PVR_DBG_ERROR,
             "OSAcquirePhysPageAddr: Memory region does not represent memory mapped I/O (VMA flags: 0x%lx)", psVMArea->vm_flags));
index 7e8e8fd6a07d7d8b6392f6942d6a89b9d67f9d4f..11e1238fc7e76ff95ebcb8292b5fa84729ccab15 100644 (file)
@@ -15,7 +15,8 @@
  */
 
 #include <linux/opp.h>
-#include <plat/gpu.h>
+#include <linux/regulator/consumer.h>
+
 #include "sgxfreq.h"
 
 static struct sgxfreq_data {
@@ -32,7 +33,14 @@ static struct sgxfreq_data {
        struct mutex gov_mutex;
        struct sgxfreq_sgx_data sgx_data;
        struct device *dev;
-       struct gpu_platform_data *pdata;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
+       struct clk *core_clk;
+       struct clk *gpu_clk;
+       struct clk *per_clk;
+       struct clk *gpu_core_clk;
+       struct clk *gpu_hyd_clk;
+       struct regulator *gpu_reg;
+#endif
 } sfd;
 
 /* Governor init/deinit functions */
@@ -187,19 +195,101 @@ static const struct attribute *sgxfreq_attributes[] = {
 };
 
 /************************ end sysfs interface ************************/
+static int set_volt_for_freq(unsigned long freq)
+{
+       struct opp *opp;
+       unsigned long volt = 0;
+       int ret;
+
+       if (sfd.gpu_reg) {
+               opp = opp_find_freq_exact(sfd.dev, freq, true);
+               if(IS_ERR(opp))
+               {
+                       int r = PTR_ERR(opp);
+                       pr_err("sgxfreq: Couldn't find opp matching freq: %lu. Err: %d",
+                                       freq, r);
+                       return -1;
+               }
+
+               volt = opp_get_voltage(opp);
+               if (!volt)
+               {
+                       pr_err("sgxfreq: Could find volt corresponding to freq: %lu\n",
+                                       freq);
+                       return -1;
+               }
+
+               ret = regulator_set_voltage_tol(sfd.gpu_reg, volt , 6000);
+               if (ret) {
+                       pr_err("sgxfreq: Error(%d) setting volt: %lu for freq:%lu\n",
+                                       ret, volt, freq);
+                       return ret;
+               }
+       }
+
+       return 0;
+
+}
 
 static void __set_freq(void)
 {
        unsigned long freq;
+       int ret = 0;
 
        freq = min(sfd.freq_request, sfd.freq_limit);
        if (freq != sfd.freq) {
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
+               if (freq > sfd.freq) {
+                       /* Going up - must scale voltage before clocks */
+                       if (set_volt_for_freq(freq) != 0) {
+                               pr_err("sgxfreq: Error setting voltage for freq: %lu\n",
+                                               freq);
+                               goto err1;
+                       }
+               }
+
+               ret = clk_set_rate(sfd.gpu_core_clk, freq);
+               if (ret) {
+                       pr_err("sgxfreq: Error(%d) setting gpu core clock rate: %lu\n",
+                                       ret, freq);
+                       goto err2;
+               }
+
+               ret = clk_set_rate(sfd.gpu_hyd_clk, freq);
+               if (ret) {
+                       pr_err("sgxfreq: Error(%d) setting gpu hyd clock rate: %lu\n",
+                                       ret, freq);
+                       goto err3;
+               }
+
+               if (freq < sfd.freq) {
+                       /* Going down - must scale voltage after clocks */
+                       if(set_volt_for_freq(freq) != 0) {
+                               pr_err("sgxfreq: Error setting voltage for freq: %lu\n",
+                                               freq);
+                               goto err4;
+                       }
+               }
+
+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
                sfd.pdata->device_scale(sfd.dev, sfd.dev, freq);
 #else
                sfd.pdata->device_scale(sfd.dev, freq);
 #endif
                sfd.freq = freq;
+
+               goto noerr;
+err4:
+               ret |= clk_set_rate(sfd.gpu_hyd_clk, sfd.freq);
+
+err3:
+               ret |= clk_set_rate(sfd.gpu_core_clk, sfd.freq);
+err2:
+               if(freq > sfd.freq)
+                       ret |= set_volt_for_freq(sfd.freq);
+err1:
+noerr:
+               return;
        }
 }
 
@@ -278,17 +368,28 @@ int sgxfreq_init(struct device *dev)
        sfd.dev = dev;
        if (!sfd.dev)
                return -EINVAL;
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
        sfd.pdata = (struct gpu_platform_data *)dev->platform_data;
        if (!sfd.pdata ||
            !sfd.pdata->opp_get_opp_count ||
            !sfd.pdata->opp_find_freq_ceil ||
            !sfd.pdata->device_scale)
                return -EINVAL;
+#endif
 
        rcu_read_lock();
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
        sfd.freq_cnt = sfd.pdata->opp_get_opp_count(dev);
+#else
+        ret = of_init_opp_table(dev);
+        if (ret) {
+                pr_err("sgxfreq: failed to init OPP table: %d\n", ret);
+               return -EINVAL;
+        }
+
+       sfd.freq_cnt = opp_get_opp_count(dev);
+#endif
        if (sfd.freq_cnt < 1) {
                rcu_read_unlock();
                return -ENODEV;
@@ -302,7 +403,11 @@ int sgxfreq_init(struct device *dev)
 
        freq = 0;
        for (i = 0; i < sfd.freq_cnt; i++) {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
                opp = sfd.pdata->opp_find_freq_ceil(dev, &freq);
+#else
+               opp = opp_find_freq_ceil(dev, &freq);
+#endif
                if (IS_ERR_OR_NULL(opp)) {
                        rcu_read_unlock();
                        kfree(sfd.freq_list);
@@ -313,6 +418,63 @@ int sgxfreq_init(struct device *dev)
        }
        rcu_read_unlock();
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
+       sfd.core_clk = devm_clk_get(dev, "dpll_core_h14x2_ck");
+       if (IS_ERR(sfd.core_clk)) {
+               ret = PTR_ERR(sfd.core_clk);
+               pr_err("sgxfreq: failed to get core clock: %d\n", ret);
+               return ret;
+       }
+
+       sfd.gpu_clk = devm_clk_get(dev, "dpll_gpu_m2_ck");
+       if (IS_ERR(sfd.gpu_clk)) {
+               ret = PTR_ERR(sfd.gpu_clk);
+               pr_err("sgxfreq: failed to get gpu clock: %d\n", ret);
+               return ret;
+       }
+
+       sfd.per_clk = devm_clk_get(dev, "dpll_per_h14x2_ck");
+       if (IS_ERR(sfd.per_clk)) {
+               ret = PTR_ERR(sfd.per_clk);
+               pr_err("sgxfreq: failed to get per clock: %d\n", ret);
+               return ret;
+       }
+
+       sfd.gpu_core_clk = devm_clk_get(dev, "gpu_core_gclk_mux");
+       if (IS_ERR(sfd.gpu_core_clk)) {
+               ret = PTR_ERR(sfd.gpu_core_clk);
+               pr_err("sgxfreq: failed to get gpu core clock: %d\n", ret);
+               return ret;
+       }
+
+       sfd.gpu_hyd_clk = devm_clk_get(dev, "gpu_core_gclk_mux");
+       if (IS_ERR(sfd.gpu_hyd_clk)) {
+               ret = PTR_ERR(sfd.gpu_hyd_clk);
+               pr_err("sgxfreq: failed to get gpu hyd clock: %d\n", ret);
+               return ret;
+       }
+
+       sfd.gpu_reg = devm_regulator_get(dev, "gpu");
+       if (IS_ERR(sfd.gpu_reg)) {
+               if (PTR_ERR(sfd.gpu_reg) == -EPROBE_DEFER) {
+                       dev_err(dev, "gpu regulator not ready, retry\n");
+                       return -EPROBE_DEFER;
+               }
+               pr_err("sgxfreq: failed to get gpu regulator: %ld\n", PTR_ERR(sfd.gpu_reg));
+               sfd.gpu_reg = NULL;
+       }
+
+       ret = clk_set_parent(sfd.gpu_hyd_clk, sfd.core_clk);
+       if (ret != 0) {
+               pr_err("sgxfreq: failed to set gpu_hyd_clk parent: %d\n", ret);
+       }
+
+       ret = clk_set_parent(sfd.gpu_core_clk, sfd.core_clk);
+       if (ret != 0) {
+               pr_err("sgxfreq: failed to set gpu_core_clk parent: %d\n", ret);
+       }
+#endif
+
        mutex_init(&sfd.freq_mutex);
        sfd.freq_limit = sfd.freq_list[sfd.freq_cnt - 1];
        sgxfreq_set_freq_request(sfd.freq_list[sfd.freq_cnt - 1]);
@@ -330,7 +492,7 @@ int sgxfreq_init(struct device *dev)
        }
 
 #if defined(CONFIG_THERMAL_FRAMEWORK)
-       cool_init();
+       //cool_init();
 #endif
 
        for (i = 0; sgxfreq_gov_init[i] != NULL; i++)
index dc4d0d2f25b93efd5c2be1a1215bb941752bc8c0..da1bade8a65f9de61a748a7b9a71894ebd146f90 100644 (file)
@@ -84,7 +84,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #endif
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
-#include <linux/platform_data/omap-gpu.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
+#include <plat/gpu.h>
+#endif
 #if !defined(PVR_NO_OMAP_TIMER)
 #define        PVR_OMAP_USE_DM_TIMER_API
 #include <plat/dmtimer.h>
index 2817f8b12766e050971ba93e78cc01dac7108671..358e9f842962b9cd6bd8720198aef19c6d743c84 100644 (file)
@@ -721,14 +721,15 @@ SysDRMUnregisterPlugin(PVRSRV_DRM_PLUGIN *psDRMPlugin)
 
 int pvr_access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
 {
-
-return -1;
-#if 0
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
        struct gpu_platform_data *pdata;
        pdata = (struct gpu_platform_data *)gpsPVRLDMDev->dev.platform_data;
        if(!pdata || !pdata->access_process_vm)
                return -1;
        return pdata->access_process_vm(tsk, addr, buf, len, write);
+#else
+       /* FIXME: platform data not supported in 3.8 kernel */
+       return -1;
 #endif
 }