aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/via_map.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/via_map.c')
-rw-r--r--drivers/char/drm/via_map.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/drivers/char/drm/via_map.c b/drivers/char/drm/via_map.c
index 6bd6ac52ad1b..c6a08e96285b 100644
--- a/drivers/char/drm/via_map.c
+++ b/drivers/char/drm/via_map.c
@@ -27,16 +27,10 @@
27 27
28static int via_do_init_map(drm_device_t * dev, drm_via_init_t * init) 28static int via_do_init_map(drm_device_t * dev, drm_via_init_t * init)
29{ 29{
30 drm_via_private_t *dev_priv; 30 drm_via_private_t *dev_priv = dev->dev_private;
31 31
32 DRM_DEBUG("%s\n", __FUNCTION__); 32 DRM_DEBUG("%s\n", __FUNCTION__);
33 33
34 dev_priv = drm_alloc(sizeof(drm_via_private_t), DRM_MEM_DRIVER);
35 if (dev_priv == NULL)
36 return -ENOMEM;
37
38 memset(dev_priv, 0, sizeof(drm_via_private_t));
39
40 DRM_GETSAREA(); 34 DRM_GETSAREA();
41 if (!dev_priv->sarea) { 35 if (!dev_priv->sarea) {
42 DRM_ERROR("could not find sarea!\n"); 36 DRM_ERROR("could not find sarea!\n");
@@ -67,7 +61,8 @@ static int via_do_init_map(drm_device_t * dev, drm_via_init_t * init)
67 dev_priv->agpAddr = init->agpAddr; 61 dev_priv->agpAddr = init->agpAddr;
68 62
69 via_init_futex(dev_priv); 63 via_init_futex(dev_priv);
70 dev_priv->pro_group_a = (dev->pdev->device == 0x3118); 64
65 via_init_dmablit(dev);
71 66
72 dev->dev_private = (void *)dev_priv; 67 dev->dev_private = (void *)dev_priv;
73 return 0; 68 return 0;
@@ -75,15 +70,7 @@ static int via_do_init_map(drm_device_t * dev, drm_via_init_t * init)
75 70
76int via_do_cleanup_map(drm_device_t * dev) 71int via_do_cleanup_map(drm_device_t * dev)
77{ 72{
78 if (dev->dev_private) { 73 via_dma_cleanup(dev);
79
80 drm_via_private_t *dev_priv = dev->dev_private;
81
82 via_dma_cleanup(dev);
83
84 drm_free(dev_priv, sizeof(drm_via_private_t), DRM_MEM_DRIVER);
85 dev->dev_private = NULL;
86 }
87 74
88 return 0; 75 return 0;
89} 76}
@@ -107,3 +94,29 @@ int via_map_init(DRM_IOCTL_ARGS)
107 94
108 return -EINVAL; 95 return -EINVAL;
109} 96}
97
98int via_driver_load(drm_device_t *dev, unsigned long chipset)
99{
100 drm_via_private_t *dev_priv;
101
102 dev_priv = drm_calloc(1, sizeof(drm_via_private_t), DRM_MEM_DRIVER);
103 if (dev_priv == NULL)
104 return DRM_ERR(ENOMEM);
105
106 dev->dev_private = (void *)dev_priv;
107
108 if (chipset == VIA_PRO_GROUP_A)
109 dev_priv->pro_group_a = 1;
110
111 return 0;
112}
113
114int via_driver_unload(drm_device_t *dev)
115{
116 drm_via_private_t *dev_priv = dev->dev_private;
117
118 drm_free(dev_priv, sizeof(drm_via_private_t), DRM_MEM_DRIVER);
119
120 return 0;
121}
122