annotate drivers/sis_vid.c @ 7162:c672c79cb396

fixed faad detection. without this it detects my older version of the library witch isn't compatible with current ad_faad.c
author alex
date Fri, 30 Aug 2002 11:28:43 +0000
parents d62aa0b7fd68
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 * sis_vid.c
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 * Copyright (C) 2000 Aaron Holtzman
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 * This software has been released under the terms of the GNU Public
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 * license. See http://www.gnu.org/copyleft/gpl.html for details.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 // video4linux interface disabled by A'rpi/ESP-team
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 //It's entirely possible this major conflicts with something else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 /* mknod /dev/mga_vid c 178 0 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 #include <linux/config.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 #include <linux/version.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 #include <linux/module.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 #include <linux/types.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 #include <linux/kernel.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 #include <linux/sched.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 #include <linux/mm.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 #include <linux/string.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 #include <linux/errno.h>
3125
d62aa0b7fd68 use <linux/slab.h> instead of <linux/malloc.h> for kernels 2.4.9+
szabi
parents: 62
diff changeset
26
d62aa0b7fd68 use <linux/slab.h> instead of <linux/malloc.h> for kernels 2.4.9+
szabi
parents: 62
diff changeset
27 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 #include <linux/malloc.h>
3125
d62aa0b7fd68 use <linux/slab.h> instead of <linux/malloc.h> for kernels 2.4.9+
szabi
parents: 62
diff changeset
29 #else
d62aa0b7fd68 use <linux/slab.h> instead of <linux/malloc.h> for kernels 2.4.9+
szabi
parents: 62
diff changeset
30 #include <linux/slab.h>
d62aa0b7fd68 use <linux/slab.h> instead of <linux/malloc.h> for kernels 2.4.9+
szabi
parents: 62
diff changeset
31 #endif
d62aa0b7fd68 use <linux/slab.h> instead of <linux/malloc.h> for kernels 2.4.9+
szabi
parents: 62
diff changeset
32
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 #include <linux/pci.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 #include <linux/init.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 //#include <linux/videodev.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 #include "sis_vid.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 #ifdef CONFIG_MTRR
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 #include <asm/mtrr.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 #include <asm/uaccess.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 #include <asm/system.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 #include <asm/io.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 #define TRUE 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 #define FALSE 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 #define MGA_VID_MAJOR 178
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 #ifndef PCI_DEVICE_ID_SI_6323
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 #define PCI_DEVICE_ID_SI_6323 0x6326
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 MODULE_AUTHOR("Aaron Holtzman <aholtzma@engr.uvic.ca>");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 typedef struct bes_registers_s
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 //base address of yuv framebuffer
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 uint32_t yuv_base;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 uint32_t u_base;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 uint32_t v_base;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 uint32_t fb_end;;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 //frame buffer pitch
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 uint32_t pitch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 //window boundaries
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 uint32_t left;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 uint32_t right;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 uint32_t top;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 uint32_t bottom;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 //control registers
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 uint32_t misc_0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 uint32_t misc_1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 uint32_t misc_3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 uint32_t misc_4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 //key overlay mode
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 uint32_t key_mode;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 } bes_registers_t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 static bes_registers_t regs;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 static uint32_t mga_vid_in_use = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 static uint32_t vid_src_ready = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 static uint32_t vid_overlay_on = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94 static uint8_t *mga_mmio_base = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 static uint32_t mga_mem_base = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 static uint32_t mga_src_base = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 static uint32_t mga_ram_size = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 static struct pci_dev *pci_dev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 //static struct video_window mga_win;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 static mga_vid_config_t mga_config;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 // Backend Scaler registers
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 #define MISC_0 0x98
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 #define MISC_1 0x99
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 #define MISC_3 0x9d
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 #define MISC_4 0xb6
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117 static void mga_vid_frame_sel(int frame)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 //we don't need the vcount protection as we're only hitting
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120 //one register (and it doesn't seem to be double buffered)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121 //regs.besctl = (regs.besctl & ~0x07000000) + (frame << 25);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 //writel( regs.besctl, mga_mmio_base + BESCTL );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
124
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126 #define WRITE_REG(x,y,z) {outb((y),(x));outb((z),(x+1));}
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 #define READ_REG(x,y) (outb((y),(x)),inb(x+1))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128 #define VIDEO_ACCEL 0x3d4
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
130 static void mga_vid_write_regs(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
131 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132 uint32_t foo;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
133
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
134 //unlock the video accel registers
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
135 WRITE_REG(VIDEO_ACCEL,0x80,0x86);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
136 foo = READ_REG(VIDEO_ACCEL,0x80);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
138 if(foo != 0xa1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139 return; //something bad happened
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141 //setup the horizontal window bounds
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142 WRITE_REG(VIDEO_ACCEL,0x81,regs.left & 0xff);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143 WRITE_REG(VIDEO_ACCEL,0x82,regs.right & 0xff);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144 WRITE_REG(VIDEO_ACCEL,0x83,(regs.left >> 8) | ((regs.right>>4) & 0x70));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146 //setup the vertical window bounds
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 WRITE_REG(VIDEO_ACCEL,0x84,regs.top & 0xff);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148 WRITE_REG(VIDEO_ACCEL,0x85,regs.bottom & 0xff);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149 WRITE_REG(VIDEO_ACCEL,0x86,(regs.top >> 8) | ((regs.bottom>>4) & 0x70));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
150
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
151 //setup the framebuffer base addresses
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152 WRITE_REG(VIDEO_ACCEL,0x8a,regs.yuv_base & 0xff);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 WRITE_REG(VIDEO_ACCEL,0x8b,(regs.yuv_base >> 8) & 0xff);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154 WRITE_REG(VIDEO_ACCEL,0x89,(regs.yuv_base >> 12) & 0xf0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
155
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
156 WRITE_REG(VIDEO_ACCEL,0xb7,regs.u_base & 0xff);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157 WRITE_REG(VIDEO_ACCEL,0xb8,(regs.u_base >> 8) & 0xff);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
158
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159 WRITE_REG(VIDEO_ACCEL,0xba,regs.v_base & 0xff);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160 WRITE_REG(VIDEO_ACCEL,0xbb,(regs.v_base >> 8) & 0xff);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161 WRITE_REG(VIDEO_ACCEL,0xb9,((regs.v_base >> 12) & 0xf0) + ((regs.u_base >> 16) & 0xf));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
162
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
163 WRITE_REG(VIDEO_ACCEL,0x8d,regs.fb_end);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165 //setup framebuffer pitch
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166 WRITE_REG(VIDEO_ACCEL,0x8c,regs.pitch & 0xff);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167 WRITE_REG(VIDEO_ACCEL,0x8e,(regs.pitch >> 8) & 0x0f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168 WRITE_REG(VIDEO_ACCEL,0xbc,(regs.pitch) & 0xff);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169 WRITE_REG(VIDEO_ACCEL,0xbd,((regs.pitch) >> 8) & 0x0f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
172 //write key overlay register
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
173 WRITE_REG(VIDEO_ACCEL,0xa9,regs.key_mode);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
175 WRITE_REG(VIDEO_ACCEL,0x93,0x40);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176 WRITE_REG(VIDEO_ACCEL,0x94,1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177 WRITE_REG(VIDEO_ACCEL,0x9e,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178 WRITE_REG(VIDEO_ACCEL,0x9f,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180 //write config registers
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181 WRITE_REG(VIDEO_ACCEL,MISC_0,regs.misc_0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 WRITE_REG(VIDEO_ACCEL,MISC_1,regs.misc_1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 WRITE_REG(VIDEO_ACCEL,MISC_3,regs.misc_3);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 WRITE_REG(VIDEO_ACCEL,MISC_4,regs.misc_4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 //setup the video line buffer
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 WRITE_REG(VIDEO_ACCEL,0xa0,(regs.right - regs.left)/ 8);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191 static int mga_vid_set_config(mga_vid_config_t *config)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193 uint32_t x, y, frame_size;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195 x = config->x_org;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
196 y = config->y_org;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 regs.left = x;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199 regs.right= config->src_width + x;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 regs.top = y;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 regs.bottom = config->src_height + y;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
203 printk(KERN_DEBUG "mga_vid: Setting up a %dx%d+%d+%d video window (src %dx%d)\n",
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204 config->dest_width, config->dest_height, config->x_org, config->y_org,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 config->src_width, config->src_height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208 regs.pitch = ((config->src_width + 31) & ~31) / 4 ;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 //frame size in pixels
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 frame_size = regs.pitch * config->src_height * 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 regs.yuv_base = (mga_src_base) >> 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 regs.u_base = (mga_src_base + frame_size) >> 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215 regs.v_base = (mga_src_base + frame_size/4) >> 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 regs.fb_end = (mga_src_base + (3*frame_size)/2) >> 14;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218 //disable video capture, enable video display, enable graphics display,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219 //select yuv format, odd parity
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220 regs.misc_0 = (1 << 1) + (1<<6) + (1<<4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 //disable dithering, no filtering, no interrupts
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223 regs.misc_1 = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225 //select 2's complement format YUV for playback
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
226 regs.misc_3 = (1<<1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
227
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
228 //select 4:2:0 video format, + yuv4:2:2 cpu writes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229 regs.misc_4 = (1<<2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
231 //disable keying
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232 regs.key_mode = 0xf;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234 mga_vid_write_regs();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
235 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
238
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
239 static int mga_vid_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
240 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 int frame;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
242
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
243 switch(cmd)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
244 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
245 case MGA_VID_CONFIG:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
246 //FIXME remove
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
247 printk(KERN_DEBUG "mga_mmio_base = %p\n",mga_mmio_base);
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
248 printk(KERN_DEBUG "mga_mem_base = %08x\n",mga_mem_base);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
249 //FIXME remove
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
250
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
251 printk(KERN_DEBUG "mga_vid: Received configuration\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
252
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
253 if(copy_from_user(&mga_config,(mga_vid_config_t*) arg,sizeof(mga_vid_config_t)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
254 {
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
255 printk(KERN_ERR "mga_vid: failed copy from userspace\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
256 return(-EFAULT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
257 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
258
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
259 mga_config.ram_size = mga_ram_size;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
260 //XXX make it look like a g400
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
261 mga_config.card_type = MGA_G400;;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
262
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
263 if (copy_to_user((mga_vid_config_t *) arg, &mga_config, sizeof(mga_vid_config_t)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
264 {
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
265 printk(KERN_ERR "mga_vid: failed copy to userspace\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
266 return(-EFAULT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
267 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
268 return mga_vid_set_config(&mga_config);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
269 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
270
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
271 case MGA_VID_ON:
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
272 printk(KERN_DEBUG "mga_vid: Video ON\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
273 vid_src_ready = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
274 if(vid_overlay_on)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
275 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
276 //regs.besctl |= 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
277 mga_vid_write_regs();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
278 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
279 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
280
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
281 case MGA_VID_OFF:
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
282 printk(KERN_DEBUG "mga_vid: Video OFF\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
283 vid_src_ready = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
284 //regs.besctl &= ~1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
285 mga_vid_write_regs();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
286 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
287
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
288 case MGA_VID_FSEL:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
289 if(copy_from_user(&frame,(int *) arg,sizeof(int)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
290 {
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
291 printk(KERN_ERR "mga_vid: FSEL failed copy from userspace\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
292 return(-EFAULT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
293 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
294
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
295 mga_vid_frame_sel(frame);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
296 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
297
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
298 default:
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
299 printk(KERN_ERR "mga_vid: Invalid ioctl\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
300 return (-EINVAL);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
301 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
302
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
303 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
304 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
305
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
306
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
307 static int mga_vid_find_card(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
308 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
309 struct pci_dev *dev = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
310
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
311 if((dev = pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_6323, NULL)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
312 {
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
313 printk(KERN_DEBUG "sis_vid: Found SiS 6326\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
314 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
315 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
316 {
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
317 printk(KERN_ERR "sis_vid: No supported cards found\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
318 return FALSE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
319 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
320
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
321 pci_dev = dev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
322
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
323 #if LINUX_VERSION_CODE >= 0x020300
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
324 mga_mmio_base = ioremap_nocache(dev->resource[1].start,0x10000);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
325 mga_mem_base = dev->resource[0].start;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
326 #else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
327 mga_mmio_base = ioremap_nocache(dev->base_address[1] & PCI_BASE_ADDRESS_MEM_MASK,0x10000);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
328 mga_mem_base = dev->base_address[0] & PCI_BASE_ADDRESS_MEM_MASK;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
329 #endif
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
330 printk(KERN_DEBUG "mga_vid: MMIO at 0x%p\n", mga_mmio_base);
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
331 printk(KERN_DEBUG "mga_vid: Frame Buffer at 0x%08x\n", mga_mem_base);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
332
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
333 //FIXME set ram size properly
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
334 mga_ram_size = 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
335 mga_src_base = (mga_ram_size - 1) * 0x100000;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
336
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
337 //FIXME remove
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
338 if(1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
339 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
340 mga_vid_config_t config ={0,0,256,256,256,256,10,10,0,0,0,0};
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
341
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
342 mga_vid_set_config(&config);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
343 mga_vid_write_regs();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
344 //regs.misc_0 ^= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
345 //mga_vid_write_regs();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
346 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
347 //FIXME remove
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
348
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
349 return TRUE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
350 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
351
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
352
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
353 static ssize_t mga_vid_read(struct file *file, char *buf, size_t count, loff_t *ppos)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
354 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
355 return -EINVAL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
356 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
357
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
358 static ssize_t mga_vid_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
359 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
360 return -EINVAL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
361 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
362
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
363 static int mga_vid_mmap(struct file *file, struct vm_area_struct *vma)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
364 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
365
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
366 printk(KERN_DEBUG "mga_vid: mapping video memory into userspace\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
367 if(remap_page_range(vma->vm_start, mga_mem_base + mga_src_base,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
368 vma->vm_end - vma->vm_start, vma->vm_page_prot))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
369 {
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
370 printk(KERN_ERR "mga_vid: error mapping video memory\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
371 return(-EAGAIN);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
372 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
373
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
374 return(0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
375 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
376
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
377 static int mga_vid_release(struct inode *inode, struct file *file)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
378 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
379 //Close the window just in case
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
380 vid_src_ready = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
381 regs.misc_0 &= 0xed;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
382 mga_vid_write_regs();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
383 mga_vid_in_use = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
384
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
385 //FIXME put back in!
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
386 //MOD_DEC_USE_COUNT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
387 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
388 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
389
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
390 static long long mga_vid_lseek(struct file *file, long long offset, int origin)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
391 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
392 return -ESPIPE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
393 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
394
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
395 static int mga_vid_open(struct inode *inode, struct file *file)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
396 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
397 int minor = MINOR(inode->i_rdev);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
398
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
399 if(minor != 0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
400 return(-ENXIO);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
401
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
402 if(mga_vid_in_use == 1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
403 return(-EBUSY);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
404
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
405 mga_vid_in_use = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
406 //FIXME turn me back on!
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
407 //MOD_INC_USE_COUNT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
408 return(0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
409 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
410
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
411 #if LINUX_VERSION_CODE >= 0x020400
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
412 static struct file_operations mga_vid_fops =
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
413 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
414 llseek: mga_vid_lseek,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
415 read: mga_vid_read,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
416 write: mga_vid_write,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
417 ioctl: mga_vid_ioctl,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
418 mmap: mga_vid_mmap,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
419 open: mga_vid_open,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
420 release: mga_vid_release
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
421 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
422 #else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
423 static struct file_operations mga_vid_fops =
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
424 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
425 mga_vid_lseek,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
426 mga_vid_read,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
427 mga_vid_write,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
428 NULL,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
429 NULL,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
430 mga_vid_ioctl,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
431 mga_vid_mmap,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
432 mga_vid_open,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
433 NULL,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
434 mga_vid_release
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
435 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
436 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
437
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
438 #if 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
439 static long mga_v4l_read(struct video_device *v, char *buf, unsigned long count,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
440 int noblock)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
441 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
442 return -EINVAL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
443 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
444
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
445 static long mga_v4l_write(struct video_device *v, const char *buf, unsigned long count, int noblock)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
446 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
447 return -EINVAL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
448 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
449
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
450 static int mga_v4l_open(struct video_device *dev, int mode)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
451 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
452 MOD_INC_USE_COUNT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
453 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
454 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
455
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
456 static void mga_v4l_close(struct video_device *dev)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
457 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
458 //regs.besctl &= ~1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
459 mga_vid_write_regs();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
460 vid_overlay_on = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
461 MOD_DEC_USE_COUNT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
462 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
463 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
464
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
465 static int mga_v4l_init_done(struct video_device *dev)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
466 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
467 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
468 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
469
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
470 static int mga_v4l_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
471 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
472 switch(cmd)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
473 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
474 case VIDIOCGCAP:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
475 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
476 struct video_capability b;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
477 strcpy(b.name, "Matrox G200/400");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
478 b.type = VID_TYPE_SCALES|VID_TYPE_OVERLAY|VID_TYPE_CHROMAKEY;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
479 b.channels = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
480 b.audios = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
481 b.maxwidth = 1024; /* GUESS ?? */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
482 b.maxheight = 768;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
483 b.minwidth = 32;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
484 b.minheight = 16; /* GUESS ?? */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
485 if(copy_to_user(arg,&b,sizeof(b)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
486 return -EFAULT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
487 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
488 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
489 case VIDIOCGPICT:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
490 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
491 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
492 * Default values.. if we can change this we
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
493 * can add the feature later
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
494 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
495 struct video_picture vp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
496 vp.brightness = 0x8000;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
497 vp.hue = 0x8000;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
498 vp.colour = 0x8000;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
499 vp.whiteness = 0x8000;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
500 vp.depth = 8;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
501 /* Format is a guess */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
502 vp.palette = VIDEO_PALETTE_YUV420P;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
503 if(copy_to_user(arg, &vp, sizeof(vp)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
504 return -EFAULT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
505 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
506 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
507 case VIDIOCSPICT:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
508 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
509 return -EINVAL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
510 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
511 case VIDIOCSWIN:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
512 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
513 struct video_window vw;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
514 if(copy_from_user(&vw, arg, sizeof(vw)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
515 return -EFAULT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
516 if(vw.x <0 || vw.y <0 || vw.width < 32
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
517 || vw.height < 16)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
518 return -EINVAL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
519 memcpy(&mga_win, &vw, sizeof(mga_win));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
520
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
521 mga_config.x_org = vw.x;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
522 mga_config.y_org = vw.y;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
523 mga_config.dest_width = vw.width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
524 mga_config.dest_height = vw.height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
525
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
526 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
527 * May have to add
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
528 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
529 * #define VIDEO_WINDOW_CHROMAKEY 16
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
530 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
531 * to <linux/videodev.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
532 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
533
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
534 //add it here for now
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
535 #define VIDEO_WINDOW_CHROMAKEY 16
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
536
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
537 if (vw.flags & VIDEO_WINDOW_CHROMAKEY)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
538 mga_config.colkey_on = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
539 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
540 mga_config.colkey_on = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
541
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
542 mga_config.colkey_red = (vw.chromakey >> 24) & 0xFF;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
543 mga_config.colkey_green = (vw.chromakey >> 16) & 0xFF;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
544 mga_config.colkey_blue = (vw.chromakey >> 8) & 0xFF;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
545 mga_vid_set_config(&mga_config);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
546 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
547
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
548 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
549 case VIDIOCGWIN:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
550 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
551 if(copy_to_user(arg, &mga_win, sizeof(mga_win)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
552 return -EFAULT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
553 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
554 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
555 case VIDIOCCAPTURE:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
556 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
557 int v;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
558 if(copy_from_user(&v, arg, sizeof(v)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
559 return -EFAULT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
560 vid_overlay_on = v;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
561 if(vid_overlay_on && vid_src_ready)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
562 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
563 //regs.besctl |= 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
564 mga_vid_write_regs();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
565 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
566 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
567 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
568 //regs.besctl &= ~1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
569 mga_vid_write_regs();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
570 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
571 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
572 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
573 default:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
574 return -ENOIOCTLCMD;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
575 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
576 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
577
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
578 static struct video_device mga_v4l_dev =
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
579 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
580 "Matrox G200/G400",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
581 VID_TYPE_CAPTURE,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
582 VID_HARDWARE_BT848, /* This is a lie for now */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
583 mga_v4l_open,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
584 mga_v4l_close,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
585 mga_v4l_read,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
586 mga_v4l_write,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
587 NULL,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
588 mga_v4l_ioctl,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
589 NULL,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
590 mga_v4l_init_done,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
591 NULL,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
592 0,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
593 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
594 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
595
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
596 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
597
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
598 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
599 * Main Initialization Function
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
600 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
601
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
602
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
603 static int mga_vid_initialize(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
604 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
605 mga_vid_in_use = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
606
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
607 printk(KERN_DEBUG "SiS 6326 YUV Video interface v0.01 (c) Aaron Holtzman \n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
608 if(register_chrdev(MGA_VID_MAJOR, "mga_vid", &mga_vid_fops))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
609 {
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
610 printk(KERN_ERR "sis_vid: unable to get major: %d\n", MGA_VID_MAJOR);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
611 return -EIO;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
612 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
613
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
614 if (!mga_vid_find_card())
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
615 {
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
616 printk(KERN_ERR "sis_vid: no supported devices found\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
617 unregister_chrdev(MGA_VID_MAJOR, "mga_vid");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
618 return -EINVAL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
619 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
620
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
621 #if 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
622 if (video_register_device(&mga_v4l_dev, VFL_TYPE_GRABBER)<0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
623 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
624 printk("sis_vid: unable to register.\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
625 unregister_chrdev(MGA_VID_MAJOR, "mga_vid");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
626 if(mga_mmio_base)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
627 iounmap(mga_mmio_base);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
628 mga_mmio_base = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
629 return -EINVAL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
630 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
631 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
632
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
633 return(0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
634 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
635
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
636 int init_module(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
637 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
638 return mga_vid_initialize();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
639 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
640
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
641 void cleanup_module(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
642 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
643 // video_unregister_device(&mga_v4l_dev);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
644 if(mga_mmio_base)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
645 iounmap(mga_mmio_base);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
646
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
647 //FIXME turn off BES
62
dc0424327084 printk() loglevel fix
szabii
parents: 1
diff changeset
648 printk(KERN_DEBUG "mga_vid: Cleaning up module\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
649 unregister_chrdev(MGA_VID_MAJOR, "mga_vid");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
650 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
651