diff options
Diffstat (limited to 'drivers/media/video/bttv-driver.c')
-rw-r--r-- | drivers/media/video/bttv-driver.c | 68 |
1 files changed, 30 insertions, 38 deletions
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 1ddf9ba613ef..0e6970346788 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c | |||
@@ -34,13 +34,14 @@ | |||
34 | #include <linux/sched.h> | 34 | #include <linux/sched.h> |
35 | #include <linux/interrupt.h> | 35 | #include <linux/interrupt.h> |
36 | #include <linux/kdev_t.h> | 36 | #include <linux/kdev_t.h> |
37 | #include "bttvp.h" | ||
38 | #include <media/v4l2-common.h> | ||
39 | |||
37 | #include <linux/dma-mapping.h> | 40 | #include <linux/dma-mapping.h> |
38 | 41 | ||
39 | #include <asm/io.h> | 42 | #include <asm/io.h> |
40 | #include <asm/byteorder.h> | 43 | #include <asm/byteorder.h> |
41 | 44 | ||
42 | #include "bttvp.h" | ||
43 | |||
44 | #include "rds.h" | 45 | #include "rds.h" |
45 | 46 | ||
46 | 47 | ||
@@ -210,6 +211,9 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
210 | .vdelay = 0x20, | 211 | .vdelay = 0x20, |
211 | .vbipack = 255, | 212 | .vbipack = 255, |
212 | .sram = 0, | 213 | .sram = 0, |
214 | /* ITU-R frame line number of the first VBI line | ||
215 | we can capture, of the first and second field. */ | ||
216 | .vbistart = { 7,320 }, | ||
213 | },{ | 217 | },{ |
214 | .v4l2_id = V4L2_STD_NTSC_M, | 218 | .v4l2_id = V4L2_STD_NTSC_M, |
215 | .name = "NTSC", | 219 | .name = "NTSC", |
@@ -226,6 +230,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
226 | .vdelay = 0x1a, | 230 | .vdelay = 0x1a, |
227 | .vbipack = 144, | 231 | .vbipack = 144, |
228 | .sram = 1, | 232 | .sram = 1, |
233 | .vbistart = { 10, 273 }, | ||
229 | },{ | 234 | },{ |
230 | .v4l2_id = V4L2_STD_SECAM, | 235 | .v4l2_id = V4L2_STD_SECAM, |
231 | .name = "SECAM", | 236 | .name = "SECAM", |
@@ -242,6 +247,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
242 | .vdelay = 0x20, | 247 | .vdelay = 0x20, |
243 | .vbipack = 255, | 248 | .vbipack = 255, |
244 | .sram = 0, /* like PAL, correct? */ | 249 | .sram = 0, /* like PAL, correct? */ |
250 | .vbistart = { 7, 320 }, | ||
245 | },{ | 251 | },{ |
246 | .v4l2_id = V4L2_STD_PAL_Nc, | 252 | .v4l2_id = V4L2_STD_PAL_Nc, |
247 | .name = "PAL-Nc", | 253 | .name = "PAL-Nc", |
@@ -258,6 +264,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
258 | .vdelay = 0x1a, | 264 | .vdelay = 0x1a, |
259 | .vbipack = 144, | 265 | .vbipack = 144, |
260 | .sram = -1, | 266 | .sram = -1, |
267 | .vbistart = { 7, 320 }, | ||
261 | },{ | 268 | },{ |
262 | .v4l2_id = V4L2_STD_PAL_M, | 269 | .v4l2_id = V4L2_STD_PAL_M, |
263 | .name = "PAL-M", | 270 | .name = "PAL-M", |
@@ -274,6 +281,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
274 | .vdelay = 0x1a, | 281 | .vdelay = 0x1a, |
275 | .vbipack = 144, | 282 | .vbipack = 144, |
276 | .sram = -1, | 283 | .sram = -1, |
284 | .vbistart = { 10, 273 }, | ||
277 | },{ | 285 | },{ |
278 | .v4l2_id = V4L2_STD_PAL_N, | 286 | .v4l2_id = V4L2_STD_PAL_N, |
279 | .name = "PAL-N", | 287 | .name = "PAL-N", |
@@ -290,6 +298,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
290 | .vdelay = 0x20, | 298 | .vdelay = 0x20, |
291 | .vbipack = 144, | 299 | .vbipack = 144, |
292 | .sram = -1, | 300 | .sram = -1, |
301 | .vbistart = { 7, 320}, | ||
293 | },{ | 302 | },{ |
294 | .v4l2_id = V4L2_STD_NTSC_M_JP, | 303 | .v4l2_id = V4L2_STD_NTSC_M_JP, |
295 | .name = "NTSC-JP", | 304 | .name = "NTSC-JP", |
@@ -306,6 +315,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
306 | .vdelay = 0x16, | 315 | .vdelay = 0x16, |
307 | .vbipack = 144, | 316 | .vbipack = 144, |
308 | .sram = -1, | 317 | .sram = -1, |
318 | .vbistart = {10, 273}, | ||
309 | },{ | 319 | },{ |
310 | /* that one hopefully works with the strange timing | 320 | /* that one hopefully works with the strange timing |
311 | * which video recorders produce when playing a NTSC | 321 | * which video recorders produce when playing a NTSC |
@@ -326,6 +336,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
326 | .vbipack = 255, | 336 | .vbipack = 255, |
327 | .vtotal = 524, | 337 | .vtotal = 524, |
328 | .sram = -1, | 338 | .sram = -1, |
339 | .vbistart = { 10, 273 }, | ||
329 | } | 340 | } |
330 | }; | 341 | }; |
331 | static const unsigned int BTTV_TVNORMS = ARRAY_SIZE(bttv_tvnorms); | 342 | static const unsigned int BTTV_TVNORMS = ARRAY_SIZE(bttv_tvnorms); |
@@ -1510,14 +1521,6 @@ static struct videobuf_queue_ops bttv_video_qops = { | |||
1510 | .buf_release = buffer_release, | 1521 | .buf_release = buffer_release, |
1511 | }; | 1522 | }; |
1512 | 1523 | ||
1513 | static const char *v4l1_ioctls[] = { | ||
1514 | "?", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", "GPICT", "SPICT", | ||
1515 | "CCAPTURE", "GWIN", "SWIN", "GFBUF", "SFBUF", "KEY", "GFREQ", | ||
1516 | "SFREQ", "GAUDIO", "SAUDIO", "SYNC", "MCAPTURE", "GMBUF", "GUNIT", | ||
1517 | "GCAPTURE", "SCAPTURE", "SPLAYMODE", "SWRITEMODE", "GPLAYINFO", | ||
1518 | "SMICROCODE", "GVBIFMT", "SVBIFMT" }; | ||
1519 | #define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls) | ||
1520 | |||
1521 | static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) | 1524 | static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) |
1522 | { | 1525 | { |
1523 | switch (cmd) { | 1526 | switch (cmd) { |
@@ -2206,22 +2209,9 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2206 | unsigned long flags; | 2209 | unsigned long flags; |
2207 | int retval = 0; | 2210 | int retval = 0; |
2208 | 2211 | ||
2209 | if (bttv_debug > 1) { | 2212 | if (bttv_debug > 1) |
2210 | switch (_IOC_TYPE(cmd)) { | 2213 | v4l_print_ioctl(btv->c.name, cmd); |
2211 | case 'v': | 2214 | |
2212 | printk("bttv%d: ioctl 0x%x (v4l1, VIDIOC%s)\n", | ||
2213 | btv->c.nr, cmd, (_IOC_NR(cmd) < V4L1_IOCTLS) ? | ||
2214 | v4l1_ioctls[_IOC_NR(cmd)] : "???"); | ||
2215 | break; | ||
2216 | case 'V': | ||
2217 | printk("bttv%d: ioctl 0x%x (v4l2, %s)\n", | ||
2218 | btv->c.nr, cmd, v4l2_ioctl_names[_IOC_NR(cmd)]); | ||
2219 | break; | ||
2220 | default: | ||
2221 | printk("bttv%d: ioctl 0x%x (???)\n", | ||
2222 | btv->c.nr, cmd); | ||
2223 | } | ||
2224 | } | ||
2225 | if (btv->errors) | 2215 | if (btv->errors) |
2226 | bttv_reinit_bt848(btv); | 2216 | bttv_reinit_bt848(btv); |
2227 | 2217 | ||
@@ -2570,10 +2560,10 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2570 | fmt->count[0] = fmt2.fmt.vbi.count[0]; | 2560 | fmt->count[0] = fmt2.fmt.vbi.count[0]; |
2571 | fmt->start[1] = fmt2.fmt.vbi.start[1]; | 2561 | fmt->start[1] = fmt2.fmt.vbi.start[1]; |
2572 | fmt->count[1] = fmt2.fmt.vbi.count[1]; | 2562 | fmt->count[1] = fmt2.fmt.vbi.count[1]; |
2573 | if (fmt2.fmt.vbi.flags & VBI_UNSYNC) | 2563 | if (fmt2.fmt.vbi.flags & V4L2_VBI_UNSYNC) |
2574 | fmt->flags |= V4L2_VBI_UNSYNC; | 2564 | fmt->flags |= VBI_UNSYNC; |
2575 | if (fmt2.fmt.vbi.flags & VBI_INTERLACED) | 2565 | if (fmt2.fmt.vbi.flags & V4L2_VBI_INTERLACED) |
2576 | fmt->flags |= V4L2_VBI_INTERLACED; | 2566 | fmt->flags |= VBI_INTERLACED; |
2577 | return 0; | 2567 | return 0; |
2578 | } | 2568 | } |
2579 | case VIDIOCSVBIFMT: | 2569 | case VIDIOCSVBIFMT: |
@@ -3120,6 +3110,7 @@ static struct file_operations bttv_fops = | |||
3120 | .open = bttv_open, | 3110 | .open = bttv_open, |
3121 | .release = bttv_release, | 3111 | .release = bttv_release, |
3122 | .ioctl = bttv_ioctl, | 3112 | .ioctl = bttv_ioctl, |
3113 | .compat_ioctl = v4l_compat_ioctl32, | ||
3123 | .llseek = no_llseek, | 3114 | .llseek = no_llseek, |
3124 | .read = bttv_read, | 3115 | .read = bttv_read, |
3125 | .mmap = bttv_mmap, | 3116 | .mmap = bttv_mmap, |
@@ -3229,6 +3220,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
3229 | case VIDIOCSFREQ: | 3220 | case VIDIOCSFREQ: |
3230 | case VIDIOCGAUDIO: | 3221 | case VIDIOCGAUDIO: |
3231 | case VIDIOCSAUDIO: | 3222 | case VIDIOCSAUDIO: |
3223 | case VIDIOC_LOG_STATUS: | ||
3232 | return bttv_common_ioctls(btv,cmd,arg); | 3224 | return bttv_common_ioctls(btv,cmd,arg); |
3233 | 3225 | ||
3234 | default: | 3226 | default: |
@@ -3701,8 +3693,8 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs) | |||
3701 | 3693 | ||
3702 | btv=(struct bttv *)dev_id; | 3694 | btv=(struct bttv *)dev_id; |
3703 | 3695 | ||
3704 | if (btv->any_irq) | 3696 | if (btv->custom_irq) |
3705 | handled = bttv_any_irq(&btv->c); | 3697 | handled = btv->custom_irq(btv); |
3706 | 3698 | ||
3707 | count=0; | 3699 | count=0; |
3708 | while (1) { | 3700 | while (1) { |
@@ -3738,9 +3730,9 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs) | |||
3738 | if (astat&BT848_INT_VSYNC) | 3730 | if (astat&BT848_INT_VSYNC) |
3739 | btv->field_count++; | 3731 | btv->field_count++; |
3740 | 3732 | ||
3741 | if (astat & BT848_INT_GPINT) { | 3733 | if ((astat & BT848_INT_GPINT) && btv->remote) { |
3742 | wake_up(&btv->gpioq); | 3734 | wake_up(&btv->gpioq); |
3743 | bttv_gpio_irq(&btv->c); | 3735 | bttv_input_irq(btv); |
3744 | } | 3736 | } |
3745 | 3737 | ||
3746 | if (astat & BT848_INT_I2CDONE) { | 3738 | if (astat & BT848_INT_I2CDONE) { |
@@ -3946,7 +3938,6 @@ static int __devinit bttv_probe(struct pci_dev *dev, | |||
3946 | 3938 | ||
3947 | btv->i2c_rc = -1; | 3939 | btv->i2c_rc = -1; |
3948 | btv->tuner_type = UNSET; | 3940 | btv->tuner_type = UNSET; |
3949 | btv->pinnacle_id = UNSET; | ||
3950 | btv->new_input = UNSET; | 3941 | btv->new_input = UNSET; |
3951 | btv->has_radio=radio[btv->c.nr]; | 3942 | btv->has_radio=radio[btv->c.nr]; |
3952 | 3943 | ||
@@ -4065,11 +4056,11 @@ static int __devinit bttv_probe(struct pci_dev *dev, | |||
4065 | } | 4056 | } |
4066 | 4057 | ||
4067 | /* add subdevices */ | 4058 | /* add subdevices */ |
4068 | if (btv->has_remote) | ||
4069 | bttv_sub_add_device(&btv->c, "remote"); | ||
4070 | if (bttv_tvcards[btv->c.type].has_dvb) | 4059 | if (bttv_tvcards[btv->c.type].has_dvb) |
4071 | bttv_sub_add_device(&btv->c, "dvb"); | 4060 | bttv_sub_add_device(&btv->c, "dvb"); |
4072 | 4061 | ||
4062 | bttv_input_init(btv); | ||
4063 | |||
4073 | /* everything is fine */ | 4064 | /* everything is fine */ |
4074 | bttv_num++; | 4065 | bttv_num++; |
4075 | return 0; | 4066 | return 0; |
@@ -4104,6 +4095,7 @@ static void __devexit bttv_remove(struct pci_dev *pci_dev) | |||
4104 | /* tell gpio modules we are leaving ... */ | 4095 | /* tell gpio modules we are leaving ... */ |
4105 | btv->shutdown=1; | 4096 | btv->shutdown=1; |
4106 | wake_up(&btv->gpioq); | 4097 | wake_up(&btv->gpioq); |
4098 | bttv_input_fini(btv); | ||
4107 | bttv_sub_del_devices(&btv->c); | 4099 | bttv_sub_del_devices(&btv->c); |
4108 | 4100 | ||
4109 | /* unregister i2c_bus + input */ | 4101 | /* unregister i2c_bus + input */ |
@@ -4253,7 +4245,7 @@ static int bttv_init_module(void) | |||
4253 | bttv_check_chipset(); | 4245 | bttv_check_chipset(); |
4254 | 4246 | ||
4255 | bus_register(&bttv_sub_bus_type); | 4247 | bus_register(&bttv_sub_bus_type); |
4256 | return pci_module_init(&bttv_pci_driver); | 4248 | return pci_register_driver(&bttv_pci_driver); |
4257 | } | 4249 | } |
4258 | 4250 | ||
4259 | static void bttv_cleanup_module(void) | 4251 | static void bttv_cleanup_module(void) |