aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/pvr/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/pvr/module.c')
-rw-r--r--drivers/gpu/pvr/module.c71
1 files changed, 46 insertions, 25 deletions
diff --git a/drivers/gpu/pvr/module.c b/drivers/gpu/pvr/module.c
index cb05ea76cbf..f689f363d4c 100644
--- a/drivers/gpu/pvr/module.c
+++ b/drivers/gpu/pvr/module.c
@@ -28,7 +28,9 @@
28 #include <linux/config.h> 28 #include <linux/config.h>
29#endif 29#endif
30 30
31#if !defined(SUPPORT_DRI_DRM) 31#if defined(SUPPORT_DRI_DRM)
32#define PVR_MOD_STATIC
33#else
32 34
33 #if defined(LDM_PLATFORM) 35 #if defined(LDM_PLATFORM)
34 #define PVR_LDM_PLATFORM_MODULE 36 #define PVR_LDM_PLATFORM_MODULE
@@ -39,6 +41,13 @@
39 #define PVR_LDM_MODULE 41 #define PVR_LDM_MODULE
40 #endif 42 #endif
41 #endif 43 #endif
44#define PVR_MOD_STATIC static
45#endif
46
47#if defined(PVR_LDM_PLATFORM_PRE_REGISTERED)
48#if !defined(NO_HARDWARE)
49#define PVR_USE_PRE_REGISTERED_PLATFORM_DEV
50#endif
42#endif 51#endif
43 52
44#include <linux/init.h> 53#include <linux/init.h>
@@ -152,7 +161,6 @@ static IMG_UINT32 gPVRPowerLevel;
152#define LDM_DEV struct pci_dev 161#define LDM_DEV struct pci_dev
153#define LDM_DRV struct pci_driver 162#define LDM_DRV struct pci_driver
154#endif 163#endif
155
156#if defined(PVR_LDM_PLATFORM_MODULE) 164#if defined(PVR_LDM_PLATFORM_MODULE)
157static int PVRSRVDriverRemove(LDM_DEV *device); 165static int PVRSRVDriverRemove(LDM_DEV *device);
158static int PVRSRVDriverProbe(LDM_DEV *device); 166static int PVRSRVDriverProbe(LDM_DEV *device);
@@ -167,16 +175,23 @@ static int PVRSRVDriverResume(LDM_DEV *device);
167 175
168#if defined(PVR_LDM_PCI_MODULE) 176#if defined(PVR_LDM_PCI_MODULE)
169struct pci_device_id powervr_id_table[] __devinitdata = { 177struct pci_device_id powervr_id_table[] __devinitdata = {
170 { PCI_DEVICE(SYS_SGX_DEV_VENDOR_ID, SYS_SGX_DEV_DEVICE_ID) }, 178 {PCI_DEVICE(SYS_SGX_DEV_VENDOR_ID, SYS_SGX_DEV_DEVICE_ID)},
171#if defined (SYS_SGX_DEV1_DEVICE_ID) 179#if defined (SYS_SGX_DEV1_DEVICE_ID)
172 { PCI_DEVICE(SYS_SGX_DEV_VENDOR_ID, SYS_SGX_DEV1_DEVICE_ID) }, 180 {PCI_DEVICE(SYS_SGX_DEV_VENDOR_ID, SYS_SGX_DEV1_DEVICE_ID)},
173#endif 181#endif
174 { 0 } 182 {0}
175}; 183};
176 184
177MODULE_DEVICE_TABLE(pci, powervr_id_table); 185MODULE_DEVICE_TABLE(pci, powervr_id_table);
178#endif 186#endif
179 187
188#if defined(PVR_USE_PRE_REGISTERED_PLATFORM_DEV)
189static struct platform_device_id powervr_id_table[] __devinitdata = {
190 {SYS_SGX_DEV_NAME, 0},
191 {}
192};
193#endif
194
180static LDM_DRV powervr_driver = { 195static LDM_DRV powervr_driver = {
181#if defined(PVR_LDM_PLATFORM_MODULE) 196#if defined(PVR_LDM_PLATFORM_MODULE)
182 .driver = { 197 .driver = {
@@ -185,6 +200,8 @@ static LDM_DRV powervr_driver = {
185#endif 200#endif
186#if defined(PVR_LDM_PCI_MODULE) 201#if defined(PVR_LDM_PCI_MODULE)
187 .name = DRVNAME, 202 .name = DRVNAME,
203#endif
204#if defined(PVR_LDM_PCI_MODULE) || defined(PVR_USE_PRE_REGISTERED_PLATFORM_DEV)
188 .id_table = powervr_id_table, 205 .id_table = powervr_id_table,
189#endif 206#endif
190 .probe = PVRSRVDriverProbe, 207 .probe = PVRSRVDriverProbe,
@@ -201,9 +218,9 @@ static LDM_DRV powervr_driver = {
201 218
202LDM_DEV *gpsPVRLDMDev; 219LDM_DEV *gpsPVRLDMDev;
203 220
204#if defined(MODULE) && defined(PVR_LDM_PLATFORM_MODULE) 221#if defined(MODULE) && defined(PVR_LDM_PLATFORM_MODULE) && \
205 222 !defined(PVR_USE_PRE_REGISTERED_PLATFORM_DEV)
206static IMG_VOID PVRSRVDeviceRelease(struct device unref__ *pDevice) 223static void PVRSRVDeviceRelease(struct device unref__ *pDevice)
207{ 224{
208} 225}
209 226
@@ -214,8 +231,7 @@ static struct platform_device powervr_device = {
214 .release = PVRSRVDeviceRelease 231 .release = PVRSRVDeviceRelease
215 } 232 }
216}; 233};
217 234#endif
218#endif
219 235
220#if defined(PVR_LDM_PLATFORM_MODULE) 236#if defined(PVR_LDM_PLATFORM_MODULE)
221static int PVRSRVDriverProbe(LDM_DEV *pDevice) 237static int PVRSRVDriverProbe(LDM_DEV *pDevice)
@@ -273,7 +289,7 @@ static void __devexit PVRSRVDriverRemove(LDM_DEV *pDevice)
273 } 289 }
274 } 290 }
275#endif 291#endif
276 (IMG_VOID)SysDeinitialise(psSysData); 292 (void) SysDeinitialise(psSysData);
277 293
278 gpsPVRLDMDev = IMG_NULL; 294 gpsPVRLDMDev = IMG_NULL;
279 295
@@ -291,23 +307,25 @@ static void __devexit PVRSRVDriverRemove(LDM_DEV *pDevice)
291 return; 307 return;
292#endif 308#endif
293} 309}
310#endif
294 311
295 312
296static IMG_VOID PVRSRVDriverShutdown(LDM_DEV *pDevice) 313#if defined(PVR_LDM_MODULE) || defined(PVR_DRI_DRM_PLATFORM_DEV)
314PVR_MOD_STATIC void PVRSRVDriverShutdown(LDM_DEV *pDevice)
297{ 315{
298 PVR_TRACE(("PVRSRVDriverShutdown(pDevice=%p)", pDevice)); 316 PVR_TRACE(("PVRSRVDriverShutdown(pDevice=%p)", pDevice));
299 317
300 (IMG_VOID) PVRSRVSetPowerStateKM(PVRSRV_SYS_POWER_STATE_D3); 318 (void) PVRSRVSetPowerStateKM(PVRSRV_SYS_POWER_STATE_D3);
301} 319}
302 320
303#endif 321#endif
304 322
305 323
306#if defined(PVR_LDM_MODULE) || defined(SUPPORT_DRI_DRM) 324#if defined(PVR_LDM_MODULE) || defined(SUPPORT_DRI_DRM)
307#if defined(SUPPORT_DRI_DRM) 325#if defined(SUPPORT_DRI_DRM) && !defined(PVR_DRI_DRM_PLATFORM_DEV)
308int PVRSRVDriverSuspend(struct drm_device *pDevice, pm_message_t state) 326int PVRSRVDriverSuspend(struct drm_device *pDevice, pm_message_t state)
309#else 327#else
310static int PVRSRVDriverSuspend(LDM_DEV *pDevice, pm_message_t state) 328PVR_MOD_STATIC int PVRSRVDriverSuspend(LDM_DEV *pDevice, pm_message_t state)
311#endif 329#endif
312{ 330{
313#if !(defined(DEBUG) && defined(PVR_MANUAL_POWER_CONTROL) && !defined(SUPPORT_DRI_DRM)) 331#if !(defined(DEBUG) && defined(PVR_MANUAL_POWER_CONTROL) && !defined(SUPPORT_DRI_DRM))
@@ -322,10 +340,10 @@ static int PVRSRVDriverSuspend(LDM_DEV *pDevice, pm_message_t state)
322} 340}
323 341
324 342
325#if defined(SUPPORT_DRI_DRM) 343#if defined(SUPPORT_DRI_DRM) && !defined(PVR_DRI_DRM_PLATFORM_DEV)
326int PVRSRVDriverResume(struct drm_device *pDevice) 344int PVRSRVDriverResume(struct drm_device *pDevice)
327#else 345#else
328static int PVRSRVDriverResume(LDM_DEV *pDevice) 346PVR_MOD_STATIC int PVRSRVDriverResume(LDM_DEV *pDevice)
329#endif 347#endif
330{ 348{
331#if !(defined(DEBUG) && defined(PVR_MANUAL_POWER_CONTROL) && !defined(SUPPORT_DRI_DRM)) 349#if !(defined(DEBUG) && defined(PVR_MANUAL_POWER_CONTROL) && !defined(SUPPORT_DRI_DRM))
@@ -492,9 +510,9 @@ static int PVRSRVRelease(struct inode unref__ * pInode, struct file *pFile)
492 510
493 511
494#if defined(SUPPORT_DRI_DRM) 512#if defined(SUPPORT_DRI_DRM)
495int PVRCore_Init(IMG_VOID) 513int PVRCore_Init(void)
496#else 514#else
497static int __init PVRCore_Init(IMG_VOID) 515static int __init PVRCore_Init(void)
498#endif 516#endif
499{ 517{
500 int error; 518 int error;
@@ -546,7 +564,7 @@ static int __init PVRCore_Init(IMG_VOID)
546 goto init_failed; 564 goto init_failed;
547 } 565 }
548 566
549#if defined(MODULE) 567#if defined(MODULE) && !defined(PVR_USE_PRE_REGISTERED_PLATFORM_DEV)
550 if ((error = platform_device_register(&powervr_device)) != 0) 568 if ((error = platform_device_register(&powervr_device)) != 0)
551 { 569 {
552 platform_driver_unregister(&powervr_driver); 570 platform_driver_unregister(&powervr_driver);
@@ -638,7 +656,7 @@ sys_deinit:
638#endif 656#endif
639 657
640#if defined (PVR_LDM_PLATFORM_MODULE) 658#if defined (PVR_LDM_PLATFORM_MODULE)
641#if defined (MODULE) 659#if defined(MODULE) && !defined(PVR_USE_PRE_REGISTERED_PLATFORM_DEV)
642 platform_device_unregister(&powervr_device); 660 platform_device_unregister(&powervr_device);
643#endif 661#endif
644 platform_driver_unregister(&powervr_driver); 662 platform_driver_unregister(&powervr_driver);
@@ -652,7 +670,7 @@ sys_deinit:
652 psSysData = SysAcquireDataNoCheck(); 670 psSysData = SysAcquireDataNoCheck();
653 if (psSysData != IMG_NULL) 671 if (psSysData != IMG_NULL)
654 { 672 {
655 (IMG_VOID)SysDeinitialise(psSysData); 673 (void) SysDeinitialise(psSysData);
656 } 674 }
657 } 675 }
658#endif 676#endif
@@ -674,11 +692,14 @@ void PVRCore_Cleanup(void)
674static void __exit PVRCore_Cleanup(void) 692static void __exit PVRCore_Cleanup(void)
675#endif 693#endif
676{ 694{
695#if !defined(PVR_LDM_MODULE)
677 SYS_DATA *psSysData; 696 SYS_DATA *psSysData;
678 697#endif
679 PVR_TRACE(("PVRCore_Cleanup")); 698 PVR_TRACE(("PVRCore_Cleanup"));
680 699
700#if !defined(PVR_LDM_MODULE)
681 SysAcquireData(&psSysData); 701 SysAcquireData(&psSysData);
702#endif
682 703
683#if defined(PVR_LDM_MODULE) 704#if defined(PVR_LDM_MODULE)
684 device_destroy(psPvrClass, MKDEV(AssignedMajorNumber, 0)); 705 device_destroy(psPvrClass, MKDEV(AssignedMajorNumber, 0));
@@ -707,7 +728,7 @@ static void __exit PVRCore_Cleanup(void)
707#endif 728#endif
708 729
709#if defined (PVR_LDM_PLATFORM_MODULE) 730#if defined (PVR_LDM_PLATFORM_MODULE)
710#if defined (MODULE) 731#if defined(MODULE) && !defined(PVR_USE_PRE_REGISTERED_PLATFORM_DEV)
711 platform_device_unregister(&powervr_device); 732 platform_device_unregister(&powervr_device);
712#endif 733#endif
713 platform_driver_unregister(&powervr_driver); 734 platform_driver_unregister(&powervr_driver);
@@ -741,6 +762,6 @@ static void __exit PVRCore_Cleanup(void)
741} 762}
742 763
743#if !defined(SUPPORT_DRI_DRM) 764#if !defined(SUPPORT_DRI_DRM)
744late_initcall(PVRCore_Init); 765module_init(PVRCore_Init);
745module_exit(PVRCore_Cleanup); 766module_exit(PVRCore_Cleanup);
746#endif 767#endif