diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/dvb-usb/af9005-fe.c | 47 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dvb-pll.c | 2 | ||||
-rw-r--r-- | drivers/media/video/Kconfig | 4 | ||||
-rw-r--r-- | drivers/media/video/bt8xx/bttv-cards.c | 238 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-driver.h | 1 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-fileops.c | 10 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-firmware.c | 2 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 11 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-mailbox.c | 14 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-streams.c | 11 | ||||
-rw-r--r-- | drivers/media/video/usbvision/usbvision-video.c | 5 | ||||
-rw-r--r-- | drivers/media/video/zoran.h | 5 | ||||
-rw-r--r-- | drivers/media/video/zoran_device.c | 50 | ||||
-rw-r--r-- | drivers/media/video/zoran_driver.c | 233 |
14 files changed, 342 insertions, 291 deletions
diff --git a/drivers/media/dvb/dvb-usb/af9005-fe.c b/drivers/media/dvb/dvb-usb/af9005-fe.c index 7195c9461524..b1a9c4cdec93 100644 --- a/drivers/media/dvb/dvb-usb/af9005-fe.c +++ b/drivers/media/dvb/dvb-usb/af9005-fe.c | |||
@@ -29,8 +29,6 @@ | |||
29 | 29 | ||
30 | struct af9005_fe_state { | 30 | struct af9005_fe_state { |
31 | struct dvb_usb_device *d; | 31 | struct dvb_usb_device *d; |
32 | struct dvb_frontend *tuner; | ||
33 | |||
34 | fe_status_t stat; | 32 | fe_status_t stat; |
35 | 33 | ||
36 | /* retraining parameters */ | 34 | /* retraining parameters */ |
@@ -345,8 +343,8 @@ static int af9005_reset_pre_viterbi(struct dvb_frontend *fe) | |||
345 | 1 & 0xff); | 343 | 1 & 0xff); |
346 | if (ret) | 344 | if (ret) |
347 | return ret; | 345 | return ret; |
348 | af9005_write_ofdm_register(state->d, xd_p_fec_super_frm_unit_15_8, | 346 | ret = af9005_write_ofdm_register(state->d, xd_p_fec_super_frm_unit_15_8, |
349 | 1 >> 8); | 347 | 1 >> 8); |
350 | if (ret) | 348 | if (ret) |
351 | return ret; | 349 | return ret; |
352 | /* reset pre viterbi error count */ | 350 | /* reset pre viterbi error count */ |
@@ -447,7 +445,7 @@ static int af9005_fe_read_status(struct dvb_frontend *fe, fe_status_t * stat) | |||
447 | u8 temp; | 445 | u8 temp; |
448 | int ret; | 446 | int ret; |
449 | 447 | ||
450 | if (state->tuner == NULL) | 448 | if (fe->ops.tuner_ops.release == NULL) |
451 | return -ENODEV; | 449 | return -ENODEV; |
452 | 450 | ||
453 | *stat = 0; | 451 | *stat = 0; |
@@ -493,7 +491,7 @@ static int af9005_fe_read_status(struct dvb_frontend *fe, fe_status_t * stat) | |||
493 | static int af9005_fe_read_ber(struct dvb_frontend *fe, u32 * ber) | 491 | static int af9005_fe_read_ber(struct dvb_frontend *fe, u32 * ber) |
494 | { | 492 | { |
495 | struct af9005_fe_state *state = fe->demodulator_priv; | 493 | struct af9005_fe_state *state = fe->demodulator_priv; |
496 | if (state->tuner == NULL) | 494 | if (fe->ops.tuner_ops.release == NULL) |
497 | return -ENODEV; | 495 | return -ENODEV; |
498 | af9005_fe_refresh_state(fe); | 496 | af9005_fe_refresh_state(fe); |
499 | *ber = state->ber; | 497 | *ber = state->ber; |
@@ -503,7 +501,7 @@ static int af9005_fe_read_ber(struct dvb_frontend *fe, u32 * ber) | |||
503 | static int af9005_fe_read_unc_blocks(struct dvb_frontend *fe, u32 * unc) | 501 | static int af9005_fe_read_unc_blocks(struct dvb_frontend *fe, u32 * unc) |
504 | { | 502 | { |
505 | struct af9005_fe_state *state = fe->demodulator_priv; | 503 | struct af9005_fe_state *state = fe->demodulator_priv; |
506 | if (state->tuner == NULL) | 504 | if (fe->ops.tuner_ops.release == NULL) |
507 | return -ENODEV; | 505 | return -ENODEV; |
508 | af9005_fe_refresh_state(fe); | 506 | af9005_fe_refresh_state(fe); |
509 | *unc = state->unc; | 507 | *unc = state->unc; |
@@ -517,7 +515,7 @@ static int af9005_fe_read_signal_strength(struct dvb_frontend *fe, | |||
517 | int ret; | 515 | int ret; |
518 | u8 if_gain, rf_gain; | 516 | u8 if_gain, rf_gain; |
519 | 517 | ||
520 | if (state->tuner == NULL) | 518 | if (fe->ops.tuner_ops.release == NULL) |
521 | return -ENODEV; | 519 | return -ENODEV; |
522 | ret = | 520 | ret = |
523 | af9005_read_ofdm_register(state->d, xd_r_reg_aagc_rf_gain, | 521 | af9005_read_ofdm_register(state->d, xd_r_reg_aagc_rf_gain, |
@@ -881,10 +879,8 @@ static int af9005_fe_init(struct dvb_frontend *fe) | |||
881 | af9005_write_register_bits(state->d, xd_I2C_reg_ofdm_rst, | 879 | af9005_write_register_bits(state->d, xd_I2C_reg_ofdm_rst, |
882 | reg_ofdm_rst_pos, reg_ofdm_rst_len, 1))) | 880 | reg_ofdm_rst_pos, reg_ofdm_rst_len, 1))) |
883 | return ret; | 881 | return ret; |
884 | if ((ret = | 882 | ret = af9005_write_register_bits(state->d, xd_I2C_reg_ofdm_rst, |
885 | af9005_write_register_bits(state->d, xd_I2C_reg_ofdm_rst, | 883 | reg_ofdm_rst_pos, reg_ofdm_rst_len, 0); |
886 | reg_ofdm_rst_pos, reg_ofdm_rst_len, 0))) | ||
887 | return ret; | ||
888 | 884 | ||
889 | if (ret) | 885 | if (ret) |
890 | return ret; | 886 | return ret; |
@@ -1041,7 +1037,7 @@ static int af9005_fe_init(struct dvb_frontend *fe) | |||
1041 | return ret; | 1037 | return ret; |
1042 | 1038 | ||
1043 | /* attach tuner and init */ | 1039 | /* attach tuner and init */ |
1044 | if (state->tuner == NULL) { | 1040 | if (fe->ops.tuner_ops.release == NULL) { |
1045 | /* read tuner and board id from eeprom */ | 1041 | /* read tuner and board id from eeprom */ |
1046 | ret = af9005_read_eeprom(adap->dev, 0xc6, buf, 2); | 1042 | ret = af9005_read_eeprom(adap->dev, 0xc6, buf, 2); |
1047 | if (ret) { | 1043 | if (ret) { |
@@ -1058,20 +1054,16 @@ static int af9005_fe_init(struct dvb_frontend *fe) | |||
1058 | return ret; | 1054 | return ret; |
1059 | } | 1055 | } |
1060 | if1 = (u16) (buf[0] << 8) + buf[1]; | 1056 | if1 = (u16) (buf[0] << 8) + buf[1]; |
1061 | state->tuner = | 1057 | if (dvb_attach(mt2060_attach, fe, &adap->dev->i2c_adap, |
1062 | dvb_attach(mt2060_attach, fe, &adap->dev->i2c_adap, | 1058 | &af9005_mt2060_config, if1) == NULL) { |
1063 | &af9005_mt2060_config, if1); | ||
1064 | if (state->tuner == NULL) { | ||
1065 | deb_info("MT2060 attach failed\n"); | 1059 | deb_info("MT2060 attach failed\n"); |
1066 | return -ENODEV; | 1060 | return -ENODEV; |
1067 | } | 1061 | } |
1068 | break; | 1062 | break; |
1069 | case 3: /* QT1010 */ | 1063 | case 3: /* QT1010 */ |
1070 | case 9: /* QT1010B */ | 1064 | case 9: /* QT1010B */ |
1071 | state->tuner = | 1065 | if (dvb_attach(qt1010_attach, fe, &adap->dev->i2c_adap, |
1072 | dvb_attach(qt1010_attach, fe, &adap->dev->i2c_adap, | 1066 | &af9005_qt1010_config) ==NULL) { |
1073 | &af9005_qt1010_config); | ||
1074 | if (state->tuner == NULL) { | ||
1075 | deb_info("QT1010 attach failed\n"); | 1067 | deb_info("QT1010 attach failed\n"); |
1076 | return -ENODEV; | 1068 | return -ENODEV; |
1077 | } | 1069 | } |
@@ -1080,7 +1072,7 @@ static int af9005_fe_init(struct dvb_frontend *fe) | |||
1080 | err("Unsupported tuner type %d", buf[0]); | 1072 | err("Unsupported tuner type %d", buf[0]); |
1081 | return -ENODEV; | 1073 | return -ENODEV; |
1082 | } | 1074 | } |
1083 | ret = state->tuner->ops.tuner_ops.init(state->tuner); | 1075 | ret = fe->ops.tuner_ops.init(fe); |
1084 | if (ret) | 1076 | if (ret) |
1085 | return ret; | 1077 | return ret; |
1086 | } | 1078 | } |
@@ -1118,7 +1110,7 @@ static int af9005_fe_set_frontend(struct dvb_frontend *fe, | |||
1118 | 1110 | ||
1119 | deb_info("af9005_fe_set_frontend freq %d bw %d\n", fep->frequency, | 1111 | deb_info("af9005_fe_set_frontend freq %d bw %d\n", fep->frequency, |
1120 | fep->u.ofdm.bandwidth); | 1112 | fep->u.ofdm.bandwidth); |
1121 | if (state->tuner == NULL) { | 1113 | if (fe->ops.tuner_ops.release == NULL) { |
1122 | err("Tuner not attached"); | 1114 | err("Tuner not attached"); |
1123 | return -ENODEV; | 1115 | return -ENODEV; |
1124 | } | 1116 | } |
@@ -1199,7 +1191,7 @@ static int af9005_fe_set_frontend(struct dvb_frontend *fe, | |||
1199 | return ret; | 1191 | return ret; |
1200 | /* set tuner */ | 1192 | /* set tuner */ |
1201 | deb_info("set tuner\n"); | 1193 | deb_info("set tuner\n"); |
1202 | ret = state->tuner->ops.tuner_ops.set_params(state->tuner, fep); | 1194 | ret = fe->ops.tuner_ops.set_params(fe, fep); |
1203 | if (ret) | 1195 | if (ret) |
1204 | return ret; | 1196 | return ret; |
1205 | 1197 | ||
@@ -1435,12 +1427,6 @@ static void af9005_fe_release(struct dvb_frontend *fe) | |||
1435 | { | 1427 | { |
1436 | struct af9005_fe_state *state = | 1428 | struct af9005_fe_state *state = |
1437 | (struct af9005_fe_state *)fe->demodulator_priv; | 1429 | (struct af9005_fe_state *)fe->demodulator_priv; |
1438 | if (state->tuner != NULL && state->tuner->ops.tuner_ops.release != NULL) { | ||
1439 | state->tuner->ops.tuner_ops.release(state->tuner); | ||
1440 | #ifdef CONFIG_DVB_CORE_ATTACH | ||
1441 | symbol_put_addr(state->tuner->ops.tuner_ops.release); | ||
1442 | #endif | ||
1443 | } | ||
1444 | kfree(state); | 1430 | kfree(state); |
1445 | } | 1431 | } |
1446 | 1432 | ||
@@ -1458,7 +1444,6 @@ struct dvb_frontend *af9005_fe_attach(struct dvb_usb_device *d) | |||
1458 | deb_info("attaching frontend af9005\n"); | 1444 | deb_info("attaching frontend af9005\n"); |
1459 | 1445 | ||
1460 | state->d = d; | 1446 | state->d = d; |
1461 | state->tuner = NULL; | ||
1462 | state->opened = 0; | 1447 | state->opened = 0; |
1463 | 1448 | ||
1464 | memcpy(&state->frontend.ops, &af9005_fe_ops, | 1449 | memcpy(&state->frontend.ops, &af9005_fe_ops, |
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index 0c0b94767bc1..ca99e439c97c 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c | |||
@@ -501,7 +501,7 @@ static struct dvb_pll_desc dvb_pll_opera1 = { | |||
501 | 501 | ||
502 | /* Philips FCV1236D | 502 | /* Philips FCV1236D |
503 | */ | 503 | */ |
504 | struct dvb_pll_desc dvb_pll_fcv1236d = { | 504 | static struct dvb_pll_desc dvb_pll_fcv1236d = { |
505 | /* Bit_0: RF Input select | 505 | /* Bit_0: RF Input select |
506 | * Bit_1: 0=digital, 1=analog | 506 | * Bit_1: 0=digital, 1=analog |
507 | */ | 507 | */ |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 9dcbffd0aa15..e204e7b4028a 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -509,7 +509,7 @@ config VIDEO_VINO | |||
509 | 509 | ||
510 | config VIDEO_STRADIS | 510 | config VIDEO_STRADIS |
511 | tristate "Stradis 4:2:2 MPEG-2 video driver (EXPERIMENTAL)" | 511 | tristate "Stradis 4:2:2 MPEG-2 video driver (EXPERIMENTAL)" |
512 | depends on EXPERIMENTAL && PCI && VIDEO_V4L1 && !PPC64 | 512 | depends on EXPERIMENTAL && PCI && VIDEO_V4L1 && VIRT_TO_BUS |
513 | help | 513 | help |
514 | Say Y here to enable support for the Stradis 4:2:2 MPEG-2 video | 514 | Say Y here to enable support for the Stradis 4:2:2 MPEG-2 video |
515 | driver for PCI. There is a product page at | 515 | driver for PCI. There is a product page at |
@@ -520,7 +520,7 @@ config VIDEO_ZORAN_ZR36060 | |||
520 | 520 | ||
521 | config VIDEO_ZORAN | 521 | config VIDEO_ZORAN |
522 | tristate "Zoran ZR36057/36067 Video For Linux" | 522 | tristate "Zoran ZR36057/36067 Video For Linux" |
523 | depends on PCI && I2C_ALGOBIT && VIDEO_V4L1 && !PPC64 | 523 | depends on PCI && I2C_ALGOBIT && VIDEO_V4L1 && VIRT_TO_BUS |
524 | help | 524 | help |
525 | Say Y for support for MJPEG capture cards based on the Zoran | 525 | Say Y for support for MJPEG capture cards based on the Zoran |
526 | 36057/36067 PCI controller chipset. This includes the Iomega | 526 | 36057/36067 PCI controller chipset. This includes the Iomega |
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index 387cb2122d4f..f6715007d409 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
34 | #include <linux/vmalloc.h> | 34 | #include <linux/vmalloc.h> |
35 | #include <linux/firmware.h> | 35 | #include <linux/firmware.h> |
36 | #include <net/checksum.h> | ||
36 | 37 | ||
37 | #include <asm/io.h> | 38 | #include <asm/io.h> |
38 | 39 | ||
@@ -45,7 +46,7 @@ static void boot_msp34xx(struct bttv *btv, int pin); | |||
45 | static void boot_bt832(struct bttv *btv); | 46 | static void boot_bt832(struct bttv *btv); |
46 | static void hauppauge_eeprom(struct bttv *btv); | 47 | static void hauppauge_eeprom(struct bttv *btv); |
47 | static void avermedia_eeprom(struct bttv *btv); | 48 | static void avermedia_eeprom(struct bttv *btv); |
48 | static void osprey_eeprom(struct bttv *btv); | 49 | static void osprey_eeprom(struct bttv *btv, const u8 ee[256]); |
49 | static void modtec_eeprom(struct bttv *btv); | 50 | static void modtec_eeprom(struct bttv *btv); |
50 | static void init_PXC200(struct bttv *btv); | 51 | static void init_PXC200(struct bttv *btv); |
51 | static void init_RTV24(struct bttv *btv); | 52 | static void init_RTV24(struct bttv *btv); |
@@ -2843,13 +2844,28 @@ struct tvcard bttv_tvcards[] = { | |||
2843 | .has_remote = 1, | 2844 | .has_remote = 1, |
2844 | }, | 2845 | }, |
2845 | /* ---- card 0x8c ---------------------------------- */ | 2846 | /* ---- card 0x8c ---------------------------------- */ |
2847 | /* Has four Bt878 chips behind a PCI bridge, each chip has: | ||
2848 | one external BNC composite input (mux 2) | ||
2849 | three internal composite inputs (unknown muxes) | ||
2850 | an 18-bit stereo A/D (CS5331A), which has: | ||
2851 | one external stereo unblanced (RCA) audio connection | ||
2852 | one (or 3?) internal stereo balanced (XLR) audio connection | ||
2853 | input is selected via gpio to a 14052B mux | ||
2854 | (mask=0x300, unbal=0x000, bal=0x100, ??=0x200,0x300) | ||
2855 | gain is controlled via an X9221A chip on the I2C bus @0x28 | ||
2856 | sample rate is controlled via gpio to an MK1413S | ||
2857 | (mask=0x3, 32kHz=0x0, 44.1kHz=0x1, 48kHz=0x2, ??=0x3) | ||
2858 | There is neither a tuner nor an svideo input. */ | ||
2846 | [BTTV_BOARD_OSPREY440] = { | 2859 | [BTTV_BOARD_OSPREY440] = { |
2847 | .name = "Osprey 440", | 2860 | .name = "Osprey 440", |
2848 | .video_inputs = 1, | 2861 | .video_inputs = 4, |
2849 | .audio_inputs = 1, | 2862 | .audio_inputs = 2, /* this is meaningless */ |
2850 | .tuner = UNSET, | 2863 | .tuner = UNSET, |
2851 | .svhs = 1, | 2864 | .svhs = UNSET, |
2852 | .muxsel = { 2 }, | 2865 | .muxsel = { 2, 3, 0, 1 }, /* 3,0,1 are guesses */ |
2866 | .gpiomask = 0x303, | ||
2867 | .gpiomute = 0x000, /* int + 32kHz */ | ||
2868 | .gpiomux = { 0, 0, 0x000, 0x100}, | ||
2853 | .pll = PLL_28, | 2869 | .pll = PLL_28, |
2854 | .tuner_type = UNSET, | 2870 | .tuner_type = UNSET, |
2855 | .tuner_addr = ADDR_UNSET, | 2871 | .tuner_addr = ADDR_UNSET, |
@@ -3453,11 +3469,12 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3453 | case BTTV_BOARD_OSPREY2xx: | 3469 | case BTTV_BOARD_OSPREY2xx: |
3454 | case BTTV_BOARD_OSPREY2x0_SVID: | 3470 | case BTTV_BOARD_OSPREY2x0_SVID: |
3455 | case BTTV_BOARD_OSPREY2x0: | 3471 | case BTTV_BOARD_OSPREY2x0: |
3472 | case BTTV_BOARD_OSPREY440: | ||
3456 | case BTTV_BOARD_OSPREY500: | 3473 | case BTTV_BOARD_OSPREY500: |
3457 | case BTTV_BOARD_OSPREY540: | 3474 | case BTTV_BOARD_OSPREY540: |
3458 | case BTTV_BOARD_OSPREY2000: | 3475 | case BTTV_BOARD_OSPREY2000: |
3459 | bttv_readee(btv,eeprom_data,0xa0); | 3476 | bttv_readee(btv,eeprom_data,0xa0); |
3460 | osprey_eeprom(btv); | 3477 | osprey_eeprom(btv, eeprom_data); |
3461 | break; | 3478 | break; |
3462 | case BTTV_BOARD_IDS_EAGLE: | 3479 | case BTTV_BOARD_IDS_EAGLE: |
3463 | init_ids_eagle(btv); | 3480 | init_ids_eagle(btv); |
@@ -3748,106 +3765,119 @@ static int __devinit pvr_boot(struct bttv *btv) | |||
3748 | /* ----------------------------------------------------------------------- */ | 3765 | /* ----------------------------------------------------------------------- */ |
3749 | /* some osprey specific stuff */ | 3766 | /* some osprey specific stuff */ |
3750 | 3767 | ||
3751 | static void __devinit osprey_eeprom(struct bttv *btv) | 3768 | static void __devinit osprey_eeprom(struct bttv *btv, const u8 ee[256]) |
3752 | { | 3769 | { |
3753 | int i = 0; | 3770 | int i; |
3754 | unsigned char *ee = eeprom_data; | 3771 | u32 serial = 0; |
3755 | unsigned long serial = 0; | 3772 | int cardid = -1; |
3756 | 3773 | ||
3757 | if (btv->c.type == 0) { | 3774 | /* This code will nevery actually get called in this case.... */ |
3758 | /* this might be an antique... check for MMAC label in eeprom */ | 3775 | if (btv->c.type == BTTV_BOARD_UNKNOWN) { |
3759 | if ((ee[0]=='M') && (ee[1]=='M') && (ee[2]=='A') && (ee[3]=='C')) { | 3776 | /* this might be an antique... check for MMAC label in eeprom */ |
3760 | unsigned char checksum = 0; | 3777 | if (!strncmp(ee, "MMAC", 4)) { |
3761 | for (i = 0; i < 21; i++) | 3778 | u8 checksum = 0; |
3762 | checksum += ee[i]; | 3779 | for (i = 0; i < 21; i++) |
3763 | if (checksum != ee[21]) | 3780 | checksum += ee[i]; |
3764 | return; | 3781 | if (checksum != ee[21]) |
3765 | btv->c.type = BTTV_BOARD_OSPREY1x0_848; | 3782 | return; |
3766 | for (i = 12; i < 21; i++) | 3783 | cardid = BTTV_BOARD_OSPREY1x0_848; |
3767 | serial *= 10, serial += ee[i] - '0'; | 3784 | for (i = 12; i < 21; i++) |
3768 | } | 3785 | serial *= 10, serial += ee[i] - '0'; |
3786 | } | ||
3769 | } else { | 3787 | } else { |
3770 | unsigned short type; | 3788 | unsigned short type; |
3771 | int offset = 4*16; | 3789 | |
3772 | 3790 | for (i = 4*16; i < 8*16; i += 16) { | |
3773 | for (; offset < 8*16; offset += 16) { | 3791 | u16 checksum = ip_compute_csum(ee + i, 16); |
3774 | unsigned short checksum = 0; | 3792 | |
3775 | /* verify the checksum */ | 3793 | if ((checksum&0xff) + (checksum>>8) == 0xff) |
3776 | for (i = 0; i < 14; i++) | 3794 | break; |
3777 | checksum += ee[i+offset]; | 3795 | } |
3778 | checksum = ~checksum; /* no idea why */ | 3796 | if (i >= 8*16) |
3779 | if ((((checksum>>8)&0x0FF) == ee[offset+14]) && | 3797 | return; |
3780 | ((checksum & 0x0FF) == ee[offset+15])) { | 3798 | ee += i; |
3781 | break; | 3799 | |
3782 | } | 3800 | /* found a valid descriptor */ |
3783 | } | 3801 | type = be16_to_cpup((u16*)(ee+4)); |
3784 | 3802 | ||
3785 | if (offset >= 8*16) | 3803 | switch(type) { |
3786 | return; | 3804 | /* 848 based */ |
3787 | 3805 | case 0x0004: | |
3788 | /* found a valid descriptor */ | 3806 | cardid = BTTV_BOARD_OSPREY1x0_848; |
3789 | type = (ee[offset+4]<<8) | (ee[offset+5]); | 3807 | break; |
3790 | 3808 | case 0x0005: | |
3791 | switch(type) { | 3809 | cardid = BTTV_BOARD_OSPREY101_848; |
3792 | /* 848 based */ | 3810 | break; |
3793 | case 0x0004: | 3811 | |
3794 | btv->c.type = BTTV_BOARD_OSPREY1x0_848; | 3812 | /* 878 based */ |
3795 | break; | 3813 | case 0x0012: |
3796 | case 0x0005: | 3814 | case 0x0013: |
3797 | btv->c.type = BTTV_BOARD_OSPREY101_848; | 3815 | cardid = BTTV_BOARD_OSPREY1x0; |
3798 | break; | 3816 | break; |
3799 | 3817 | case 0x0014: | |
3800 | /* 878 based */ | 3818 | case 0x0015: |
3801 | case 0x0012: | 3819 | cardid = BTTV_BOARD_OSPREY1x1; |
3802 | case 0x0013: | 3820 | break; |
3803 | btv->c.type = BTTV_BOARD_OSPREY1x0; | 3821 | case 0x0016: |
3804 | break; | 3822 | case 0x0017: |
3805 | case 0x0014: | 3823 | case 0x0020: |
3806 | case 0x0015: | 3824 | cardid = BTTV_BOARD_OSPREY1x1_SVID; |
3807 | btv->c.type = BTTV_BOARD_OSPREY1x1; | 3825 | break; |
3808 | break; | 3826 | case 0x0018: |
3809 | case 0x0016: | 3827 | case 0x0019: |
3810 | case 0x0017: | 3828 | case 0x001E: |
3811 | case 0x0020: | 3829 | case 0x001F: |
3812 | btv->c.type = BTTV_BOARD_OSPREY1x1_SVID; | 3830 | cardid = BTTV_BOARD_OSPREY2xx; |
3813 | break; | 3831 | break; |
3814 | case 0x0018: | 3832 | case 0x001A: |
3815 | case 0x0019: | 3833 | case 0x001B: |
3816 | case 0x001E: | 3834 | cardid = BTTV_BOARD_OSPREY2x0_SVID; |
3817 | case 0x001F: | 3835 | break; |
3818 | btv->c.type = BTTV_BOARD_OSPREY2xx; | 3836 | case 0x0040: |
3819 | break; | 3837 | cardid = BTTV_BOARD_OSPREY500; |
3820 | case 0x001A: | 3838 | break; |
3821 | case 0x001B: | 3839 | case 0x0050: |
3822 | btv->c.type = BTTV_BOARD_OSPREY2x0_SVID; | 3840 | case 0x0056: |
3823 | break; | 3841 | cardid = BTTV_BOARD_OSPREY540; |
3824 | case 0x0040: | 3842 | /* bttv_osprey_540_init(btv); */ |
3825 | btv->c.type = BTTV_BOARD_OSPREY500; | 3843 | break; |
3826 | break; | 3844 | case 0x0060: |
3827 | case 0x0050: | 3845 | case 0x0070: |
3828 | case 0x0056: | 3846 | case 0x00A0: |
3829 | btv->c.type = BTTV_BOARD_OSPREY540; | 3847 | cardid = BTTV_BOARD_OSPREY2x0; |
3830 | /* bttv_osprey_540_init(btv); */ | 3848 | /* enable output on select control lines */ |
3831 | break; | 3849 | gpio_inout(0xffffff,0x000303); |
3832 | case 0x0060: | 3850 | break; |
3833 | case 0x0070: | 3851 | case 0x00D8: |
3834 | case 0x00A0: | 3852 | cardid = BTTV_BOARD_OSPREY440; |
3835 | btv->c.type = BTTV_BOARD_OSPREY2x0; | 3853 | break; |
3836 | /* enable output on select control lines */ | 3854 | default: |
3837 | gpio_inout(0xffffff,0x000303); | 3855 | /* unknown...leave generic, but get serial # */ |
3838 | break; | 3856 | printk(KERN_INFO "bttv%d: " |
3839 | default: | 3857 | "osprey eeprom: unknown card type 0x%04x\n", |
3840 | /* unknown...leave generic, but get serial # */ | 3858 | btv->c.nr, type); |
3841 | break; | 3859 | break; |
3842 | } | 3860 | } |
3843 | serial = (ee[offset+6] << 24) | 3861 | serial = be32_to_cpup((u32*)(ee+6)); |
3844 | | (ee[offset+7] << 16) | 3862 | } |
3845 | | (ee[offset+8] << 8) | 3863 | |
3846 | | (ee[offset+9]); | 3864 | printk(KERN_INFO "bttv%d: osprey eeprom: card=%d '%s' serial=%u\n", |
3847 | } | 3865 | btv->c.nr, cardid, |
3848 | 3866 | cardid>0 ? bttv_tvcards[cardid].name : "Unknown", serial); | |
3849 | printk(KERN_INFO "bttv%d: osprey eeprom: card=%d name=%s serial=%ld\n", | 3867 | |
3850 | btv->c.nr, btv->c.type, bttv_tvcards[btv->c.type].name,serial); | 3868 | if (cardid<0 || btv->c.type == cardid) |
3869 | return; | ||
3870 | |||
3871 | /* card type isn't set correctly */ | ||
3872 | if (card[btv->c.nr] < bttv_num_tvcards) { | ||
3873 | printk(KERN_WARNING "bttv%d: osprey eeprom: " | ||
3874 | "Not overriding user specified card type\n", btv->c.nr); | ||
3875 | } else { | ||
3876 | printk(KERN_INFO "bttv%d: osprey eeprom: " | ||
3877 | "Changing card type from %d to %d\n", btv->c.nr, | ||
3878 | btv->c.type, cardid); | ||
3879 | btv->c.type = cardid; | ||
3880 | } | ||
3851 | } | 3881 | } |
3852 | 3882 | ||
3853 | /* ----------------------------------------------------------------------- */ | 3883 | /* ----------------------------------------------------------------------- */ |
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h index 91b588d261ae..8abb34a35816 100644 --- a/drivers/media/video/ivtv/ivtv-driver.h +++ b/drivers/media/video/ivtv/ivtv-driver.h | |||
@@ -417,6 +417,7 @@ struct ivtv_mailbox_data { | |||
417 | #define IVTV_F_I_WORK_HANDLER_YUV 17 /* there is work to be done for YUV */ | 417 | #define IVTV_F_I_WORK_HANDLER_YUV 17 /* there is work to be done for YUV */ |
418 | #define IVTV_F_I_WORK_HANDLER_PIO 18 /* there is work to be done for PIO */ | 418 | #define IVTV_F_I_WORK_HANDLER_PIO 18 /* there is work to be done for PIO */ |
419 | #define IVTV_F_I_PIO 19 /* PIO in progress */ | 419 | #define IVTV_F_I_PIO 19 /* PIO in progress */ |
420 | #define IVTV_F_I_DEC_PAUSED 20 /* the decoder is paused */ | ||
420 | 421 | ||
421 | /* Event notifications */ | 422 | /* Event notifications */ |
422 | #define IVTV_F_I_EV_DEC_STOPPED 28 /* decoder stopped event */ | 423 | #define IVTV_F_I_EV_DEC_STOPPED 28 /* decoder stopped event */ |
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c index 8e97a938398f..5dd519caf81d 100644 --- a/drivers/media/video/ivtv/ivtv-fileops.c +++ b/drivers/media/video/ivtv/ivtv-fileops.c | |||
@@ -757,6 +757,7 @@ static void ivtv_stop_decoding(struct ivtv_open_id *id, int flags, u64 pts) | |||
757 | itv->output_mode = OUT_NONE; | 757 | itv->output_mode = OUT_NONE; |
758 | 758 | ||
759 | itv->speed = 0; | 759 | itv->speed = 0; |
760 | clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags); | ||
760 | ivtv_release_stream(s); | 761 | ivtv_release_stream(s); |
761 | } | 762 | } |
762 | 763 | ||
@@ -799,7 +800,16 @@ int ivtv_v4l2_close(struct inode *inode, struct file *filp) | |||
799 | ivtv_unmute(itv); | 800 | ivtv_unmute(itv); |
800 | ivtv_release_stream(s); | 801 | ivtv_release_stream(s); |
801 | } else if (s->type >= IVTV_DEC_STREAM_TYPE_MPG) { | 802 | } else if (s->type >= IVTV_DEC_STREAM_TYPE_MPG) { |
803 | struct ivtv_stream *s_vout = &itv->streams[IVTV_DEC_STREAM_TYPE_VOUT]; | ||
804 | |||
802 | ivtv_stop_decoding(id, VIDEO_CMD_STOP_TO_BLACK | VIDEO_CMD_STOP_IMMEDIATELY, 0); | 805 | ivtv_stop_decoding(id, VIDEO_CMD_STOP_TO_BLACK | VIDEO_CMD_STOP_IMMEDIATELY, 0); |
806 | |||
807 | /* If all output streams are closed, and if the user doesn't have | ||
808 | IVTV_DEC_STREAM_TYPE_VOUT open, then disable VBI on TV-out. */ | ||
809 | if (itv->output_mode == OUT_NONE && !test_bit(IVTV_F_S_APPL_IO, &s_vout->s_flags)) { | ||
810 | /* disable VBI on TV-out */ | ||
811 | ivtv_disable_vbi(itv); | ||
812 | } | ||
803 | } else { | 813 | } else { |
804 | ivtv_stop_capture(id, 0); | 814 | ivtv_stop_capture(id, 0); |
805 | } | 815 | } |
diff --git a/drivers/media/video/ivtv/ivtv-firmware.c b/drivers/media/video/ivtv/ivtv-firmware.c index d0feabf93080..425eb1063904 100644 --- a/drivers/media/video/ivtv/ivtv-firmware.c +++ b/drivers/media/video/ivtv/ivtv-firmware.c | |||
@@ -72,8 +72,8 @@ retry: | |||
72 | dst++; | 72 | dst++; |
73 | src++; | 73 | src++; |
74 | } | 74 | } |
75 | release_firmware(fw); | ||
76 | IVTV_INFO("Loaded %s firmware (%zd bytes)\n", fn, fw->size); | 75 | IVTV_INFO("Loaded %s firmware (%zd bytes)\n", fn, fw->size); |
76 | release_firmware(fw); | ||
77 | return size; | 77 | return size; |
78 | } | 78 | } |
79 | IVTV_ERR("Unable to open firmware %s (must be %ld bytes)\n", fn, size); | 79 | IVTV_ERR("Unable to open firmware %s (must be %ld bytes)\n", fn, size); |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 4773453e8dab..047624b9e271 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -285,6 +285,10 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id, | |||
285 | 285 | ||
286 | if (ivtv_set_output_mode(itv, OUT_MPG) != OUT_MPG) | 286 | if (ivtv_set_output_mode(itv, OUT_MPG) != OUT_MPG) |
287 | return -EBUSY; | 287 | return -EBUSY; |
288 | if (test_and_clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags)) { | ||
289 | /* forces ivtv_set_speed to be called */ | ||
290 | itv->speed = 0; | ||
291 | } | ||
288 | return ivtv_start_decoding(id, vc->play.speed); | 292 | return ivtv_start_decoding(id, vc->play.speed); |
289 | } | 293 | } |
290 | 294 | ||
@@ -309,6 +313,7 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id, | |||
309 | if (atomic_read(&itv->decoding) > 0) { | 313 | if (atomic_read(&itv->decoding) > 0) { |
310 | ivtv_vapi(itv, CX2341X_DEC_PAUSE_PLAYBACK, 1, | 314 | ivtv_vapi(itv, CX2341X_DEC_PAUSE_PLAYBACK, 1, |
311 | (vc->flags & VIDEO_CMD_FREEZE_TO_BLACK) ? 1 : 0); | 315 | (vc->flags & VIDEO_CMD_FREEZE_TO_BLACK) ? 1 : 0); |
316 | set_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags); | ||
312 | } | 317 | } |
313 | break; | 318 | break; |
314 | 319 | ||
@@ -317,8 +322,10 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id, | |||
317 | if (try) break; | 322 | if (try) break; |
318 | if (itv->output_mode != OUT_MPG) | 323 | if (itv->output_mode != OUT_MPG) |
319 | return -EBUSY; | 324 | return -EBUSY; |
320 | if (atomic_read(&itv->decoding) > 0) { | 325 | if (test_and_clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags)) { |
321 | ivtv_vapi(itv, CX2341X_DEC_START_PLAYBACK, 2, 0, 0); | 326 | int speed = itv->speed; |
327 | itv->speed = 0; | ||
328 | return ivtv_start_decoding(id, speed); | ||
322 | } | 329 | } |
323 | break; | 330 | break; |
324 | 331 | ||
diff --git a/drivers/media/video/ivtv/ivtv-mailbox.c b/drivers/media/video/ivtv/ivtv-mailbox.c index 814a673712b3..5e3b679202ae 100644 --- a/drivers/media/video/ivtv/ivtv-mailbox.c +++ b/drivers/media/video/ivtv/ivtv-mailbox.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #define API_HIGH_VOL (1 << 5) /* High volume command (i.e. called during encoding or decoding) */ | 40 | #define API_HIGH_VOL (1 << 5) /* High volume command (i.e. called during encoding or decoding) */ |
41 | #define API_NO_WAIT_MB (1 << 4) /* Command may not wait for a free mailbox */ | 41 | #define API_NO_WAIT_MB (1 << 4) /* Command may not wait for a free mailbox */ |
42 | #define API_NO_WAIT_RES (1 << 5) /* Command may not wait for the result */ | 42 | #define API_NO_WAIT_RES (1 << 5) /* Command may not wait for the result */ |
43 | #define API_NO_POLL (1 << 6) /* Avoid pointless polling */ | ||
43 | 44 | ||
44 | struct ivtv_api_info { | 45 | struct ivtv_api_info { |
45 | int flags; /* Flags, see above */ | 46 | int flags; /* Flags, see above */ |
@@ -51,7 +52,7 @@ struct ivtv_api_info { | |||
51 | static const struct ivtv_api_info api_info[256] = { | 52 | static const struct ivtv_api_info api_info[256] = { |
52 | /* MPEG encoder API */ | 53 | /* MPEG encoder API */ |
53 | API_ENTRY(CX2341X_ENC_PING_FW, API_FAST_RESULT), | 54 | API_ENTRY(CX2341X_ENC_PING_FW, API_FAST_RESULT), |
54 | API_ENTRY(CX2341X_ENC_START_CAPTURE, API_RESULT), | 55 | API_ENTRY(CX2341X_ENC_START_CAPTURE, API_RESULT | API_NO_POLL), |
55 | API_ENTRY(CX2341X_ENC_STOP_CAPTURE, API_RESULT), | 56 | API_ENTRY(CX2341X_ENC_STOP_CAPTURE, API_RESULT), |
56 | API_ENTRY(CX2341X_ENC_SET_AUDIO_ID, API_CACHE), | 57 | API_ENTRY(CX2341X_ENC_SET_AUDIO_ID, API_CACHE), |
57 | API_ENTRY(CX2341X_ENC_SET_VIDEO_ID, API_CACHE), | 58 | API_ENTRY(CX2341X_ENC_SET_VIDEO_ID, API_CACHE), |
@@ -96,7 +97,7 @@ static const struct ivtv_api_info api_info[256] = { | |||
96 | 97 | ||
97 | /* MPEG decoder API */ | 98 | /* MPEG decoder API */ |
98 | API_ENTRY(CX2341X_DEC_PING_FW, API_FAST_RESULT), | 99 | API_ENTRY(CX2341X_DEC_PING_FW, API_FAST_RESULT), |
99 | API_ENTRY(CX2341X_DEC_START_PLAYBACK, API_RESULT), | 100 | API_ENTRY(CX2341X_DEC_START_PLAYBACK, API_RESULT | API_NO_POLL), |
100 | API_ENTRY(CX2341X_DEC_STOP_PLAYBACK, API_RESULT), | 101 | API_ENTRY(CX2341X_DEC_STOP_PLAYBACK, API_RESULT), |
101 | API_ENTRY(CX2341X_DEC_SET_PLAYBACK_SPEED, API_RESULT), | 102 | API_ENTRY(CX2341X_DEC_SET_PLAYBACK_SPEED, API_RESULT), |
102 | API_ENTRY(CX2341X_DEC_STEP_VIDEO, API_RESULT), | 103 | API_ENTRY(CX2341X_DEC_STEP_VIDEO, API_RESULT), |
@@ -290,6 +291,13 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[]) | |||
290 | /* Get results */ | 291 | /* Get results */ |
291 | then = jiffies; | 292 | then = jiffies; |
292 | 293 | ||
294 | if (!(flags & API_NO_POLL)) { | ||
295 | /* First try to poll, then switch to delays */ | ||
296 | for (i = 0; i < 100; i++) { | ||
297 | if (readl(&mbox->flags) & IVTV_MBOX_FIRMWARE_DONE) | ||
298 | break; | ||
299 | } | ||
300 | } | ||
293 | while (!(readl(&mbox->flags) & IVTV_MBOX_FIRMWARE_DONE)) { | 301 | while (!(readl(&mbox->flags) & IVTV_MBOX_FIRMWARE_DONE)) { |
294 | if (jiffies - then > api_timeout) { | 302 | if (jiffies - then > api_timeout) { |
295 | IVTV_DEBUG_WARN("Could not get result (%s)\n", api_info[cmd].name); | 303 | IVTV_DEBUG_WARN("Could not get result (%s)\n", api_info[cmd].name); |
@@ -301,7 +309,7 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[]) | |||
301 | if (flags & API_NO_WAIT_RES) | 309 | if (flags & API_NO_WAIT_RES) |
302 | mdelay(1); | 310 | mdelay(1); |
303 | else | 311 | else |
304 | ivtv_msleep_timeout(10, 0); | 312 | ivtv_msleep_timeout(1, 0); |
305 | } | 313 | } |
306 | if (jiffies - then > msecs_to_jiffies(100)) | 314 | if (jiffies - then > msecs_to_jiffies(100)) |
307 | IVTV_DEBUG_WARN("%s took %u jiffies\n", | 315 | IVTV_DEBUG_WARN("%s took %u jiffies\n", |
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index 322b347b67c2..51df3f855031 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c | |||
@@ -603,10 +603,6 @@ static int ivtv_setup_v4l2_decode_stream(struct ivtv_stream *s) | |||
603 | 603 | ||
604 | IVTV_DEBUG_INFO("Setting some initial decoder settings\n"); | 604 | IVTV_DEBUG_INFO("Setting some initial decoder settings\n"); |
605 | 605 | ||
606 | /* disable VBI signals, if the MPEG stream contains VBI data, | ||
607 | then that data will be processed automatically for you. */ | ||
608 | ivtv_disable_vbi(itv); | ||
609 | |||
610 | /* set audio mode to left/stereo for dual/stereo mode. */ | 606 | /* set audio mode to left/stereo for dual/stereo mode. */ |
611 | ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode); | 607 | ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode); |
612 | 608 | ||
@@ -639,7 +635,7 @@ static int ivtv_setup_v4l2_decode_stream(struct ivtv_stream *s) | |||
639 | } | 635 | } |
640 | if (ivtv_vapi(itv, CX2341X_DEC_SET_DECODER_SOURCE, 4, datatype, | 636 | if (ivtv_vapi(itv, CX2341X_DEC_SET_DECODER_SOURCE, 4, datatype, |
641 | itv->params.width, itv->params.height, itv->params.audio_properties)) { | 637 | itv->params.width, itv->params.height, itv->params.audio_properties)) { |
642 | IVTV_DEBUG_WARN("COULDN'T INITIALIZE DECODER SOURCE\n"); | 638 | IVTV_DEBUG_WARN("Couldn't initialize decoder source\n"); |
643 | } | 639 | } |
644 | return 0; | 640 | return 0; |
645 | } | 641 | } |
@@ -909,11 +905,6 @@ int ivtv_stop_v4l2_decode_stream(struct ivtv_stream *s, int flags, u64 pts) | |||
909 | clear_bit(IVTV_F_S_STREAMING, &s->s_flags); | 905 | clear_bit(IVTV_F_S_STREAMING, &s->s_flags); |
910 | ivtv_flush_queues(s); | 906 | ivtv_flush_queues(s); |
911 | 907 | ||
912 | if (!test_bit(IVTV_F_S_PASSTHROUGH, &s->s_flags)) { | ||
913 | /* disable VBI on TV-out */ | ||
914 | ivtv_disable_vbi(itv); | ||
915 | } | ||
916 | |||
917 | /* decrement decoding */ | 908 | /* decrement decoding */ |
918 | atomic_dec(&itv->decoding); | 909 | atomic_dec(&itv->decoding); |
919 | 910 | ||
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 868b6886fe7f..e3371f972240 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -517,6 +517,7 @@ static int vidioc_g_register (struct file *file, void *priv, | |||
517 | __FUNCTION__, errCode); | 517 | __FUNCTION__, errCode); |
518 | return errCode; | 518 | return errCode; |
519 | } | 519 | } |
520 | reg->val = errCode; | ||
520 | return 0; | 521 | return 0; |
521 | } | 522 | } |
522 | 523 | ||
@@ -531,8 +532,8 @@ static int vidioc_s_register (struct file *file, void *priv, | |||
531 | if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) | 532 | if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) |
532 | return -EINVAL; | 533 | return -EINVAL; |
533 | /* NT100x has a 8-bit register space */ | 534 | /* NT100x has a 8-bit register space */ |
534 | reg->val = (u8)usbvision_write_reg(usbvision, reg->reg&0xff, reg->val); | 535 | errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val); |
535 | if (reg->val < 0) { | 536 | if (errCode < 0) { |
536 | err("%s: VIDIOC_DBG_S_REGISTER failed: error %d", | 537 | err("%s: VIDIOC_DBG_S_REGISTER failed: error %d", |
537 | __FUNCTION__, errCode); | 538 | __FUNCTION__, errCode); |
538 | return errCode; | 539 | return errCode; |
diff --git a/drivers/media/video/zoran.h b/drivers/media/video/zoran.h index 8fb4a3414e0a..937c4a616c0e 100644 --- a/drivers/media/video/zoran.h +++ b/drivers/media/video/zoran.h | |||
@@ -240,11 +240,16 @@ enum gpcs_type { | |||
240 | 240 | ||
241 | struct zoran_format { | 241 | struct zoran_format { |
242 | char *name; | 242 | char *name; |
243 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
243 | int palette; | 244 | int palette; |
245 | #endif | ||
246 | #ifdef CONFIG_VIDEO_V4L2 | ||
244 | __u32 fourcc; | 247 | __u32 fourcc; |
245 | int colorspace; | 248 | int colorspace; |
249 | #endif | ||
246 | int depth; | 250 | int depth; |
247 | __u32 flags; | 251 | __u32 flags; |
252 | __u32 vfespfr; | ||
248 | }; | 253 | }; |
249 | /* flags */ | 254 | /* flags */ |
250 | #define ZORAN_FORMAT_COMPRESSED 1<<0 | 255 | #define ZORAN_FORMAT_COMPRESSED 1<<0 |
diff --git a/drivers/media/video/zoran_device.c b/drivers/media/video/zoran_device.c index b0752767ee4f..ba2f4ed29483 100644 --- a/drivers/media/video/zoran_device.c +++ b/drivers/media/video/zoran_device.c | |||
@@ -429,8 +429,6 @@ zr36057_set_vfe (struct zoran *zr, | |||
429 | reg |= (HorDcm << ZR36057_VFESPFR_HorDcm); | 429 | reg |= (HorDcm << ZR36057_VFESPFR_HorDcm); |
430 | reg |= (VerDcm << ZR36057_VFESPFR_VerDcm); | 430 | reg |= (VerDcm << ZR36057_VFESPFR_VerDcm); |
431 | reg |= (DispMode << ZR36057_VFESPFR_DispMode); | 431 | reg |= (DispMode << ZR36057_VFESPFR_DispMode); |
432 | if (format->palette != VIDEO_PALETTE_YUV422 && format->palette != VIDEO_PALETTE_YUYV) | ||
433 | reg |= ZR36057_VFESPFR_LittleEndian; | ||
434 | /* RJ: I don't know, why the following has to be the opposite | 432 | /* RJ: I don't know, why the following has to be the opposite |
435 | * of the corresponding ZR36060 setting, but only this way | 433 | * of the corresponding ZR36060 setting, but only this way |
436 | * we get the correct colors when uncompressing to the screen */ | 434 | * we get the correct colors when uncompressing to the screen */ |
@@ -439,36 +437,6 @@ zr36057_set_vfe (struct zoran *zr, | |||
439 | if (zr->norm != VIDEO_MODE_NTSC) | 437 | if (zr->norm != VIDEO_MODE_NTSC) |
440 | reg |= ZR36057_VFESPFR_ExtFl; // NEEDED!!!!!!! Wolfgang | 438 | reg |= ZR36057_VFESPFR_ExtFl; // NEEDED!!!!!!! Wolfgang |
441 | reg |= ZR36057_VFESPFR_TopField; | 439 | reg |= ZR36057_VFESPFR_TopField; |
442 | switch (format->palette) { | ||
443 | |||
444 | case VIDEO_PALETTE_YUYV: | ||
445 | case VIDEO_PALETTE_YUV422: | ||
446 | reg |= ZR36057_VFESPFR_YUV422; | ||
447 | break; | ||
448 | |||
449 | case VIDEO_PALETTE_RGB555: | ||
450 | reg |= ZR36057_VFESPFR_RGB555 | ZR36057_VFESPFR_ErrDif; | ||
451 | break; | ||
452 | |||
453 | case VIDEO_PALETTE_RGB565: | ||
454 | reg |= ZR36057_VFESPFR_RGB565 | ZR36057_VFESPFR_ErrDif; | ||
455 | break; | ||
456 | |||
457 | case VIDEO_PALETTE_RGB24: | ||
458 | reg |= ZR36057_VFESPFR_RGB888 | ZR36057_VFESPFR_Pack24; | ||
459 | break; | ||
460 | |||
461 | case VIDEO_PALETTE_RGB32: | ||
462 | reg |= ZR36057_VFESPFR_RGB888; | ||
463 | break; | ||
464 | |||
465 | default: | ||
466 | dprintk(1, | ||
467 | KERN_INFO "%s: set_vfe() - unknown color_fmt=%x\n", | ||
468 | ZR_DEVNAME(zr), format->palette); | ||
469 | return; | ||
470 | |||
471 | } | ||
472 | if (HorDcm >= 48) { | 440 | if (HorDcm >= 48) { |
473 | reg |= 3 << ZR36057_VFESPFR_HFilter; /* 5 tap filter */ | 441 | reg |= 3 << ZR36057_VFESPFR_HFilter; /* 5 tap filter */ |
474 | } else if (HorDcm >= 32) { | 442 | } else if (HorDcm >= 32) { |
@@ -476,6 +444,7 @@ zr36057_set_vfe (struct zoran *zr, | |||
476 | } else if (HorDcm >= 16) { | 444 | } else if (HorDcm >= 16) { |
477 | reg |= 1 << ZR36057_VFESPFR_HFilter; /* 3 tap filter */ | 445 | reg |= 1 << ZR36057_VFESPFR_HFilter; /* 3 tap filter */ |
478 | } | 446 | } |
447 | reg |= format->vfespfr; | ||
479 | btwrite(reg, ZR36057_VFESPFR); | 448 | btwrite(reg, ZR36057_VFESPFR); |
480 | 449 | ||
481 | /* display configuration */ | 450 | /* display configuration */ |
@@ -651,11 +620,17 @@ zr36057_set_memgrab (struct zoran *zr, | |||
651 | int mode) | 620 | int mode) |
652 | { | 621 | { |
653 | if (mode) { | 622 | if (mode) { |
654 | if (btread(ZR36057_VSSFGR) & | 623 | /* We only check SnapShot and not FrameGrab here. SnapShot==1 |
655 | (ZR36057_VSSFGR_SnapShot | ZR36057_VSSFGR_FrameGrab)) | 624 | * means a capture is already in progress, but FrameGrab==1 |
625 | * doesn't necessary mean that. It's more correct to say a 1 | ||
626 | * to 0 transition indicates a capture completed. If a | ||
627 | * capture is pending when capturing is tuned off, FrameGrab | ||
628 | * will be stuck at 1 until capturing is turned back on. | ||
629 | */ | ||
630 | if (btread(ZR36057_VSSFGR) & ZR36057_VSSFGR_SnapShot) | ||
656 | dprintk(1, | 631 | dprintk(1, |
657 | KERN_WARNING | 632 | KERN_WARNING |
658 | "%s: zr36057_set_memgrab(1) with SnapShot or FrameGrab on!?\n", | 633 | "%s: zr36057_set_memgrab(1) with SnapShot on!?\n", |
659 | ZR_DEVNAME(zr)); | 634 | ZR_DEVNAME(zr)); |
660 | 635 | ||
661 | /* switch on VSync interrupts */ | 636 | /* switch on VSync interrupts */ |
@@ -672,11 +647,12 @@ zr36057_set_memgrab (struct zoran *zr, | |||
672 | 647 | ||
673 | zr->v4l_memgrab_active = 1; | 648 | zr->v4l_memgrab_active = 1; |
674 | } else { | 649 | } else { |
675 | zr->v4l_memgrab_active = 0; | ||
676 | |||
677 | /* switch off VSync interrupts */ | 650 | /* switch off VSync interrupts */ |
678 | btand(~zr->card.vsync_int, ZR36057_ICR); // SW | 651 | btand(~zr->card.vsync_int, ZR36057_ICR); // SW |
679 | 652 | ||
653 | zr->v4l_memgrab_active = 0; | ||
654 | zr->v4l_grab_frame = NO_GRAB_ACTIVE; | ||
655 | |||
680 | /* reenable grabbing to screen if it was running */ | 656 | /* reenable grabbing to screen if it was running */ |
681 | if (zr->v4l_overlay_active) { | 657 | if (zr->v4l_overlay_active) { |
682 | zr36057_overlay(zr, 1); | 658 | zr36057_overlay(zr, 1); |
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index 17118a490f81..72a037b75d63 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c | |||
@@ -99,88 +99,103 @@ | |||
99 | 99 | ||
100 | #include <asm/byteorder.h> | 100 | #include <asm/byteorder.h> |
101 | 101 | ||
102 | const struct zoran_format zoran_formats[] = { | 102 | #if defined(CONFIG_VIDEO_V4L2) && defined(CONFIG_VIDEO_V4L1_COMPAT) |
103 | { | 103 | #define ZFMT(pal, fcc, cs) \ |
104 | .name = "15-bit RGB", | 104 | .palette = (pal), .fourcc = (fcc), .colorspace = (cs) |
105 | .palette = VIDEO_PALETTE_RGB555, | 105 | #elif defined(CONFIG_VIDEO_V4L2) |
106 | #ifdef CONFIG_VIDEO_V4L2 | 106 | #define ZFMT(pal, fcc, cs) \ |
107 | #ifdef __LITTLE_ENDIAN | 107 | .fourcc = (fcc), .colorspace = (cs) |
108 | .fourcc = V4L2_PIX_FMT_RGB555, | ||
109 | #else | 108 | #else |
110 | .fourcc = V4L2_PIX_FMT_RGB555X, | 109 | #define ZFMT(pal, fcc, cs) \ |
111 | #endif | 110 | .palette = (pal) |
112 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
113 | #endif | 111 | #endif |
112 | |||
113 | const struct zoran_format zoran_formats[] = { | ||
114 | { | ||
115 | .name = "15-bit RGB LE", | ||
116 | ZFMT(VIDEO_PALETTE_RGB555, | ||
117 | V4L2_PIX_FMT_RGB555, V4L2_COLORSPACE_SRGB), | ||
114 | .depth = 15, | 118 | .depth = 15, |
115 | .flags = ZORAN_FORMAT_CAPTURE | | 119 | .flags = ZORAN_FORMAT_CAPTURE | |
116 | ZORAN_FORMAT_OVERLAY, | 120 | ZORAN_FORMAT_OVERLAY, |
121 | .vfespfr = ZR36057_VFESPFR_RGB555|ZR36057_VFESPFR_ErrDif| | ||
122 | ZR36057_VFESPFR_LittleEndian, | ||
117 | }, { | 123 | }, { |
118 | .name = "16-bit RGB", | 124 | .name = "15-bit RGB BE", |
119 | .palette = VIDEO_PALETTE_RGB565, | 125 | ZFMT(-1, |
120 | #ifdef CONFIG_VIDEO_V4L2 | 126 | V4L2_PIX_FMT_RGB555X, V4L2_COLORSPACE_SRGB), |
121 | #ifdef __LITTLE_ENDIAN | 127 | .depth = 15, |
122 | .fourcc = V4L2_PIX_FMT_RGB565, | 128 | .flags = ZORAN_FORMAT_CAPTURE | |
123 | #else | 129 | ZORAN_FORMAT_OVERLAY, |
124 | .fourcc = V4L2_PIX_FMT_RGB565X, | 130 | .vfespfr = ZR36057_VFESPFR_RGB555|ZR36057_VFESPFR_ErrDif, |
125 | #endif | 131 | }, { |
126 | .colorspace = V4L2_COLORSPACE_SRGB, | 132 | .name = "16-bit RGB LE", |
127 | #endif | 133 | ZFMT(VIDEO_PALETTE_RGB565, |
134 | V4L2_PIX_FMT_RGB565, V4L2_COLORSPACE_SRGB), | ||
128 | .depth = 16, | 135 | .depth = 16, |
129 | .flags = ZORAN_FORMAT_CAPTURE | | 136 | .flags = ZORAN_FORMAT_CAPTURE | |
130 | ZORAN_FORMAT_OVERLAY, | 137 | ZORAN_FORMAT_OVERLAY, |
138 | .vfespfr = ZR36057_VFESPFR_RGB565|ZR36057_VFESPFR_ErrDif| | ||
139 | ZR36057_VFESPFR_LittleEndian, | ||
140 | }, { | ||
141 | .name = "16-bit RGB BE", | ||
142 | ZFMT(-1, | ||
143 | V4L2_PIX_FMT_RGB565, V4L2_COLORSPACE_SRGB), | ||
144 | .depth = 16, | ||
145 | .flags = ZORAN_FORMAT_CAPTURE | | ||
146 | ZORAN_FORMAT_OVERLAY, | ||
147 | .vfespfr = ZR36057_VFESPFR_RGB565|ZR36057_VFESPFR_ErrDif, | ||
131 | }, { | 148 | }, { |
132 | .name = "24-bit RGB", | 149 | .name = "24-bit RGB", |
133 | .palette = VIDEO_PALETTE_RGB24, | 150 | ZFMT(VIDEO_PALETTE_RGB24, |
134 | #ifdef CONFIG_VIDEO_V4L2 | 151 | V4L2_PIX_FMT_BGR24, V4L2_COLORSPACE_SRGB), |
135 | #ifdef __LITTLE_ENDIAN | ||
136 | .fourcc = V4L2_PIX_FMT_BGR24, | ||
137 | #else | ||
138 | .fourcc = V4L2_PIX_FMT_RGB24, | ||
139 | #endif | ||
140 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
141 | #endif | ||
142 | .depth = 24, | 152 | .depth = 24, |
143 | .flags = ZORAN_FORMAT_CAPTURE | | 153 | .flags = ZORAN_FORMAT_CAPTURE | |
144 | ZORAN_FORMAT_OVERLAY, | 154 | ZORAN_FORMAT_OVERLAY, |
155 | .vfespfr = ZR36057_VFESPFR_RGB888|ZR36057_VFESPFR_Pack24, | ||
145 | }, { | 156 | }, { |
146 | .name = "32-bit RGB", | 157 | .name = "32-bit RGB LE", |
147 | .palette = VIDEO_PALETTE_RGB32, | 158 | ZFMT(VIDEO_PALETTE_RGB32, |
148 | #ifdef CONFIG_VIDEO_V4L2 | 159 | V4L2_PIX_FMT_BGR32, V4L2_COLORSPACE_SRGB), |
149 | #ifdef __LITTLE_ENDIAN | 160 | .depth = 32, |
150 | .fourcc = V4L2_PIX_FMT_BGR32, | 161 | .flags = ZORAN_FORMAT_CAPTURE | |
151 | #else | 162 | ZORAN_FORMAT_OVERLAY, |
152 | .fourcc = V4L2_PIX_FMT_RGB32, | 163 | .vfespfr = ZR36057_VFESPFR_RGB888|ZR36057_VFESPFR_LittleEndian, |
153 | #endif | 164 | }, { |
154 | .colorspace = V4L2_COLORSPACE_SRGB, | 165 | .name = "32-bit RGB BE", |
155 | #endif | 166 | ZFMT(-1, |
167 | V4L2_PIX_FMT_RGB32, V4L2_COLORSPACE_SRGB), | ||
156 | .depth = 32, | 168 | .depth = 32, |
157 | .flags = ZORAN_FORMAT_CAPTURE | | 169 | .flags = ZORAN_FORMAT_CAPTURE | |
158 | ZORAN_FORMAT_OVERLAY, | 170 | ZORAN_FORMAT_OVERLAY, |
171 | .vfespfr = ZR36057_VFESPFR_RGB888, | ||
159 | }, { | 172 | }, { |
160 | .name = "4:2:2, packed, YUYV", | 173 | .name = "4:2:2, packed, YUYV", |
161 | .palette = VIDEO_PALETTE_YUV422, | 174 | ZFMT(VIDEO_PALETTE_YUV422, |
162 | #ifdef CONFIG_VIDEO_V4L2 | 175 | V4L2_PIX_FMT_YUYV, V4L2_COLORSPACE_SMPTE170M), |
163 | .fourcc = V4L2_PIX_FMT_YUYV, | 176 | .depth = 16, |
164 | .colorspace = V4L2_COLORSPACE_SMPTE170M, | 177 | .flags = ZORAN_FORMAT_CAPTURE | |
165 | #endif | 178 | ZORAN_FORMAT_OVERLAY, |
179 | .vfespfr = ZR36057_VFESPFR_YUV422, | ||
180 | }, { | ||
181 | .name = "4:2:2, packed, UYVY", | ||
182 | ZFMT(VIDEO_PALETTE_UYVY, | ||
183 | V4L2_PIX_FMT_UYVY, V4L2_COLORSPACE_SMPTE170M), | ||
166 | .depth = 16, | 184 | .depth = 16, |
167 | .flags = ZORAN_FORMAT_CAPTURE | | 185 | .flags = ZORAN_FORMAT_CAPTURE | |
168 | ZORAN_FORMAT_OVERLAY, | 186 | ZORAN_FORMAT_OVERLAY, |
187 | .vfespfr = ZR36057_VFESPFR_YUV422|ZR36057_VFESPFR_LittleEndian, | ||
169 | }, { | 188 | }, { |
170 | .name = "Hardware-encoded Motion-JPEG", | 189 | .name = "Hardware-encoded Motion-JPEG", |
171 | .palette = -1, | 190 | ZFMT(-1, |
172 | #ifdef CONFIG_VIDEO_V4L2 | 191 | V4L2_PIX_FMT_MJPEG, V4L2_COLORSPACE_SMPTE170M), |
173 | .fourcc = V4L2_PIX_FMT_MJPEG, | ||
174 | .colorspace = V4L2_COLORSPACE_SMPTE170M, | ||
175 | #endif | ||
176 | .depth = 0, | 192 | .depth = 0, |
177 | .flags = ZORAN_FORMAT_CAPTURE | | 193 | .flags = ZORAN_FORMAT_CAPTURE | |
178 | ZORAN_FORMAT_PLAYBACK | | 194 | ZORAN_FORMAT_PLAYBACK | |
179 | ZORAN_FORMAT_COMPRESSED, | 195 | ZORAN_FORMAT_COMPRESSED, |
180 | } | 196 | } |
181 | }; | 197 | }; |
182 | static const int zoran_num_formats = | 198 | #define NUM_FORMATS ARRAY_SIZE(zoran_formats) |
183 | (sizeof(zoran_formats) / sizeof(struct zoran_format)); | ||
184 | 199 | ||
185 | // RJ: Test only - want to test BUZ_USE_HIMEM even when CONFIG_BIGPHYS_AREA is defined | 200 | // RJ: Test only - want to test BUZ_USE_HIMEM even when CONFIG_BIGPHYS_AREA is defined |
186 | 201 | ||
@@ -768,13 +783,13 @@ v4l_grab (struct file *file, | |||
768 | struct zoran *zr = fh->zr; | 783 | struct zoran *zr = fh->zr; |
769 | int res = 0, i; | 784 | int res = 0, i; |
770 | 785 | ||
771 | for (i = 0; i < zoran_num_formats; i++) { | 786 | for (i = 0; i < NUM_FORMATS; i++) { |
772 | if (zoran_formats[i].palette == mp->format && | 787 | if (zoran_formats[i].palette == mp->format && |
773 | zoran_formats[i].flags & ZORAN_FORMAT_CAPTURE && | 788 | zoran_formats[i].flags & ZORAN_FORMAT_CAPTURE && |
774 | !(zoran_formats[i].flags & ZORAN_FORMAT_COMPRESSED)) | 789 | !(zoran_formats[i].flags & ZORAN_FORMAT_COMPRESSED)) |
775 | break; | 790 | break; |
776 | } | 791 | } |
777 | if (i == zoran_num_formats || zoran_formats[i].depth == 0) { | 792 | if (i == NUM_FORMATS || zoran_formats[i].depth == 0) { |
778 | dprintk(1, | 793 | dprintk(1, |
779 | KERN_ERR | 794 | KERN_ERR |
780 | "%s: v4l_grab() - wrong bytes-per-pixel format\n", | 795 | "%s: v4l_grab() - wrong bytes-per-pixel format\n", |
@@ -1173,10 +1188,14 @@ zoran_close_end_session (struct file *file) | |||
1173 | 1188 | ||
1174 | /* v4l capture */ | 1189 | /* v4l capture */ |
1175 | if (fh->v4l_buffers.active != ZORAN_FREE) { | 1190 | if (fh->v4l_buffers.active != ZORAN_FREE) { |
1191 | long flags; | ||
1192 | |||
1193 | spin_lock_irqsave(&zr->spinlock, flags); | ||
1176 | zr36057_set_memgrab(zr, 0); | 1194 | zr36057_set_memgrab(zr, 0); |
1177 | zr->v4l_buffers.allocated = 0; | 1195 | zr->v4l_buffers.allocated = 0; |
1178 | zr->v4l_buffers.active = fh->v4l_buffers.active = | 1196 | zr->v4l_buffers.active = fh->v4l_buffers.active = |
1179 | ZORAN_FREE; | 1197 | ZORAN_FREE; |
1198 | spin_unlock_irqrestore(&zr->spinlock, flags); | ||
1180 | } | 1199 | } |
1181 | 1200 | ||
1182 | /* v4l buffers */ | 1201 | /* v4l buffers */ |
@@ -2107,7 +2126,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2107 | vpict->colour, vpict->contrast, vpict->depth, | 2126 | vpict->colour, vpict->contrast, vpict->depth, |
2108 | vpict->palette); | 2127 | vpict->palette); |
2109 | 2128 | ||
2110 | for (i = 0; i < zoran_num_formats; i++) { | 2129 | for (i = 0; i < NUM_FORMATS; i++) { |
2111 | const struct zoran_format *fmt = &zoran_formats[i]; | 2130 | const struct zoran_format *fmt = &zoran_formats[i]; |
2112 | 2131 | ||
2113 | if (fmt->palette != -1 && | 2132 | if (fmt->palette != -1 && |
@@ -2116,7 +2135,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2116 | fmt->depth == vpict->depth) | 2135 | fmt->depth == vpict->depth) |
2117 | break; | 2136 | break; |
2118 | } | 2137 | } |
2119 | if (i == zoran_num_formats) { | 2138 | if (i == NUM_FORMATS) { |
2120 | dprintk(1, | 2139 | dprintk(1, |
2121 | KERN_ERR | 2140 | KERN_ERR |
2122 | "%s: VIDIOCSPICT - Invalid palette %d\n", | 2141 | "%s: VIDIOCSPICT - Invalid palette %d\n", |
@@ -2220,10 +2239,10 @@ zoran_do_ioctl (struct inode *inode, | |||
2220 | ZR_DEVNAME(zr), vbuf->base, vbuf->width, | 2239 | ZR_DEVNAME(zr), vbuf->base, vbuf->width, |
2221 | vbuf->height, vbuf->depth, vbuf->bytesperline); | 2240 | vbuf->height, vbuf->depth, vbuf->bytesperline); |
2222 | 2241 | ||
2223 | for (i = 0; i < zoran_num_formats; i++) | 2242 | for (i = 0; i < NUM_FORMATS; i++) |
2224 | if (zoran_formats[i].depth == vbuf->depth) | 2243 | if (zoran_formats[i].depth == vbuf->depth) |
2225 | break; | 2244 | break; |
2226 | if (i == zoran_num_formats) { | 2245 | if (i == NUM_FORMATS) { |
2227 | dprintk(1, | 2246 | dprintk(1, |
2228 | KERN_ERR | 2247 | KERN_ERR |
2229 | "%s: VIDIOCSFBUF - invalid fbuf depth %d\n", | 2248 | "%s: VIDIOCSFBUF - invalid fbuf depth %d\n", |
@@ -2672,14 +2691,14 @@ zoran_do_ioctl (struct inode *inode, | |||
2672 | return -EINVAL; | 2691 | return -EINVAL; |
2673 | } | 2692 | } |
2674 | 2693 | ||
2675 | for (i = 0; i < zoran_num_formats; i++) { | 2694 | for (i = 0; i < NUM_FORMATS; i++) { |
2676 | if (zoran_formats[i].flags & flag) | 2695 | if (zoran_formats[i].flags & flag) |
2677 | num++; | 2696 | num++; |
2678 | if (num == fmt->index) | 2697 | if (num == fmt->index) |
2679 | break; | 2698 | break; |
2680 | } | 2699 | } |
2681 | if (fmt->index < 0 /* late, but not too late */ || | 2700 | if (fmt->index < 0 /* late, but not too late */ || |
2682 | i == zoran_num_formats) | 2701 | i == NUM_FORMATS) |
2683 | return -EINVAL; | 2702 | return -EINVAL; |
2684 | 2703 | ||
2685 | memset(fmt, 0, sizeof(*fmt)); | 2704 | memset(fmt, 0, sizeof(*fmt)); |
@@ -2737,7 +2756,8 @@ zoran_do_ioctl (struct inode *inode, | |||
2737 | fmt->fmt.pix.height = | 2756 | fmt->fmt.pix.height = |
2738 | fh->v4l_settings.height; | 2757 | fh->v4l_settings.height; |
2739 | fmt->fmt.pix.sizeimage = | 2758 | fmt->fmt.pix.sizeimage = |
2740 | fh->v4l_buffers.buffer_size; | 2759 | fh->v4l_settings.bytesperline * |
2760 | fh->v4l_settings.height; | ||
2741 | fmt->fmt.pix.pixelformat = | 2761 | fmt->fmt.pix.pixelformat = |
2742 | fh->v4l_settings.format->fourcc; | 2762 | fh->v4l_settings.format->fourcc; |
2743 | fmt->fmt.pix.colorspace = | 2763 | fmt->fmt.pix.colorspace = |
@@ -2941,11 +2961,11 @@ zoran_do_ioctl (struct inode *inode, | |||
2941 | sfmtjpg_unlock_and_return: | 2961 | sfmtjpg_unlock_and_return: |
2942 | mutex_unlock(&zr->resource_lock); | 2962 | mutex_unlock(&zr->resource_lock); |
2943 | } else { | 2963 | } else { |
2944 | for (i = 0; i < zoran_num_formats; i++) | 2964 | for (i = 0; i < NUM_FORMATS; i++) |
2945 | if (fmt->fmt.pix.pixelformat == | 2965 | if (fmt->fmt.pix.pixelformat == |
2946 | zoran_formats[i].fourcc) | 2966 | zoran_formats[i].fourcc) |
2947 | break; | 2967 | break; |
2948 | if (i == zoran_num_formats) { | 2968 | if (i == NUM_FORMATS) { |
2949 | dprintk(1, | 2969 | dprintk(1, |
2950 | KERN_ERR | 2970 | KERN_ERR |
2951 | "%s: VIDIOC_S_FMT - unknown/unsupported format 0x%x (%4.4s)\n", | 2971 | "%s: VIDIOC_S_FMT - unknown/unsupported format 0x%x (%4.4s)\n", |
@@ -2984,8 +3004,9 @@ zoran_do_ioctl (struct inode *inode, | |||
2984 | 3004 | ||
2985 | /* tell the user the | 3005 | /* tell the user the |
2986 | * results/missing stuff */ | 3006 | * results/missing stuff */ |
2987 | fmt->fmt.pix.sizeimage = fh->v4l_buffers.buffer_size /*zr->gbpl * zr->gheight */ | 3007 | fmt->fmt.pix.sizeimage = |
2988 | ; | 3008 | fh->v4l_settings.height * |
3009 | fh->v4l_settings.bytesperline; | ||
2989 | if (BUZ_MAX_HEIGHT < | 3010 | if (BUZ_MAX_HEIGHT < |
2990 | (fh->v4l_settings.height * 2)) | 3011 | (fh->v4l_settings.height * 2)) |
2991 | fmt->fmt.pix.field = | 3012 | fmt->fmt.pix.field = |
@@ -3053,10 +3074,10 @@ zoran_do_ioctl (struct inode *inode, | |||
3053 | fb->fmt.bytesperline, fb->fmt.pixelformat, | 3074 | fb->fmt.bytesperline, fb->fmt.pixelformat, |
3054 | (char *) &printformat); | 3075 | (char *) &printformat); |
3055 | 3076 | ||
3056 | for (i = 0; i < zoran_num_formats; i++) | 3077 | for (i = 0; i < NUM_FORMATS; i++) |
3057 | if (zoran_formats[i].fourcc == fb->fmt.pixelformat) | 3078 | if (zoran_formats[i].fourcc == fb->fmt.pixelformat) |
3058 | break; | 3079 | break; |
3059 | if (i == zoran_num_formats) { | 3080 | if (i == NUM_FORMATS) { |
3060 | dprintk(1, | 3081 | dprintk(1, |
3061 | KERN_ERR | 3082 | KERN_ERR |
3062 | "%s: VIDIOC_S_FBUF - format=0x%x (%4.4s) not allowed\n", | 3083 | "%s: VIDIOC_S_FBUF - format=0x%x (%4.4s) not allowed\n", |
@@ -3439,8 +3460,13 @@ zoran_do_ioctl (struct inode *inode, | |||
3439 | goto strmoff_unlock_and_return; | 3460 | goto strmoff_unlock_and_return; |
3440 | 3461 | ||
3441 | /* unload capture */ | 3462 | /* unload capture */ |
3442 | if (zr->v4l_memgrab_active) | 3463 | if (zr->v4l_memgrab_active) { |
3464 | long flags; | ||
3465 | |||
3466 | spin_lock_irqsave(&zr->spinlock, flags); | ||
3443 | zr36057_set_memgrab(zr, 0); | 3467 | zr36057_set_memgrab(zr, 0); |
3468 | spin_unlock_irqrestore(&zr->spinlock, flags); | ||
3469 | } | ||
3444 | 3470 | ||
3445 | for (i = 0; i < fh->v4l_buffers.num_buffers; i++) | 3471 | for (i = 0; i < fh->v4l_buffers.num_buffers; i++) |
3446 | zr->v4l_buffers.buffer[i].state = | 3472 | zr->v4l_buffers.buffer[i].state = |
@@ -3704,11 +3730,11 @@ zoran_do_ioctl (struct inode *inode, | |||
3704 | dprintk(3, KERN_DEBUG "%s: VIDIOC_S_STD - norm=0x%llx\n", | 3730 | dprintk(3, KERN_DEBUG "%s: VIDIOC_S_STD - norm=0x%llx\n", |
3705 | ZR_DEVNAME(zr), (unsigned long long)*std); | 3731 | ZR_DEVNAME(zr), (unsigned long long)*std); |
3706 | 3732 | ||
3707 | if (*std == V4L2_STD_PAL) | 3733 | if ((*std & V4L2_STD_PAL) && !(*std & ~V4L2_STD_PAL)) |
3708 | norm = VIDEO_MODE_PAL; | 3734 | norm = VIDEO_MODE_PAL; |
3709 | else if (*std == V4L2_STD_NTSC) | 3735 | else if ((*std & V4L2_STD_NTSC) && !(*std & ~V4L2_STD_NTSC)) |
3710 | norm = VIDEO_MODE_NTSC; | 3736 | norm = VIDEO_MODE_NTSC; |
3711 | else if (*std == V4L2_STD_SECAM) | 3737 | else if ((*std & V4L2_STD_SECAM) && !(*std & ~V4L2_STD_SECAM)) |
3712 | norm = VIDEO_MODE_SECAM; | 3738 | norm = VIDEO_MODE_SECAM; |
3713 | else if (*std == V4L2_STD_ALL) | 3739 | else if (*std == V4L2_STD_ALL) |
3714 | norm = VIDEO_MODE_AUTO; | 3740 | norm = VIDEO_MODE_AUTO; |
@@ -4149,11 +4175,11 @@ zoran_do_ioctl (struct inode *inode, | |||
4149 | V4L2_BUF_TYPE_VIDEO_CAPTURE) { | 4175 | V4L2_BUF_TYPE_VIDEO_CAPTURE) { |
4150 | int i; | 4176 | int i; |
4151 | 4177 | ||
4152 | for (i = 0; i < zoran_num_formats; i++) | 4178 | for (i = 0; i < NUM_FORMATS; i++) |
4153 | if (zoran_formats[i].fourcc == | 4179 | if (zoran_formats[i].fourcc == |
4154 | fmt->fmt.pix.pixelformat) | 4180 | fmt->fmt.pix.pixelformat) |
4155 | break; | 4181 | break; |
4156 | if (i == zoran_num_formats) { | 4182 | if (i == NUM_FORMATS) { |
4157 | res = -EINVAL; | 4183 | res = -EINVAL; |
4158 | goto tryfmt_unlock_and_return; | 4184 | goto tryfmt_unlock_and_return; |
4159 | } | 4185 | } |
@@ -4213,8 +4239,8 @@ zoran_poll (struct file *file, | |||
4213 | { | 4239 | { |
4214 | struct zoran_fh *fh = file->private_data; | 4240 | struct zoran_fh *fh = file->private_data; |
4215 | struct zoran *zr = fh->zr; | 4241 | struct zoran *zr = fh->zr; |
4216 | wait_queue_head_t *queue = NULL; | ||
4217 | int res = 0, frame; | 4242 | int res = 0, frame; |
4243 | unsigned long flags; | ||
4218 | 4244 | ||
4219 | /* we should check whether buffers are ready to be synced on | 4245 | /* we should check whether buffers are ready to be synced on |
4220 | * (w/o waits - O_NONBLOCK) here | 4246 | * (w/o waits - O_NONBLOCK) here |
@@ -4228,51 +4254,58 @@ zoran_poll (struct file *file, | |||
4228 | 4254 | ||
4229 | switch (fh->map_mode) { | 4255 | switch (fh->map_mode) { |
4230 | case ZORAN_MAP_MODE_RAW: | 4256 | case ZORAN_MAP_MODE_RAW: |
4231 | if (fh->v4l_buffers.active == ZORAN_FREE || | 4257 | poll_wait(file, &zr->v4l_capq, wait); |
4232 | zr->v4l_pend_head == zr->v4l_pend_tail) { | 4258 | frame = zr->v4l_pend[zr->v4l_sync_tail & V4L_MASK_FRAME]; |
4233 | dprintk(1, | 4259 | |
4234 | "%s: zoran_poll() - no buffers queued\n", | 4260 | spin_lock_irqsave(&zr->spinlock, flags); |
4235 | ZR_DEVNAME(zr)); | 4261 | dprintk(3, |
4236 | res = POLLNVAL; | 4262 | KERN_DEBUG |
4237 | goto poll_unlock_and_return; | 4263 | "%s: %s() raw - active=%c, sync_tail=%lu/%c, pend_tail=%lu, pend_head=%lu\n", |
4238 | } | 4264 | ZR_DEVNAME(zr), __FUNCTION__, |
4239 | queue = &zr->v4l_capq; | 4265 | "FAL"[fh->v4l_buffers.active], zr->v4l_sync_tail, |
4240 | frame = zr->v4l_pend[zr->v4l_pend_tail & V4L_MASK_FRAME]; | 4266 | "UPMD"[zr->v4l_buffers.buffer[frame].state], |
4241 | poll_wait(file, queue, wait); | 4267 | zr->v4l_pend_tail, zr->v4l_pend_head); |
4242 | if (fh->v4l_buffers.buffer[frame].state == BUZ_STATE_DONE) | 4268 | /* Process is the one capturing? */ |
4269 | if (fh->v4l_buffers.active != ZORAN_FREE && | ||
4270 | /* Buffer ready to DQBUF? */ | ||
4271 | zr->v4l_buffers.buffer[frame].state == BUZ_STATE_DONE) | ||
4243 | res = POLLIN | POLLRDNORM; | 4272 | res = POLLIN | POLLRDNORM; |
4273 | spin_unlock_irqrestore(&zr->spinlock, flags); | ||
4274 | |||
4244 | break; | 4275 | break; |
4245 | 4276 | ||
4246 | case ZORAN_MAP_MODE_JPG_REC: | 4277 | case ZORAN_MAP_MODE_JPG_REC: |
4247 | case ZORAN_MAP_MODE_JPG_PLAY: | 4278 | case ZORAN_MAP_MODE_JPG_PLAY: |
4248 | if (fh->jpg_buffers.active == ZORAN_FREE || | 4279 | poll_wait(file, &zr->jpg_capq, wait); |
4249 | zr->jpg_que_head == zr->jpg_que_tail) { | ||
4250 | dprintk(1, | ||
4251 | "%s: zoran_poll() - no buffers queued\n", | ||
4252 | ZR_DEVNAME(zr)); | ||
4253 | res = POLLNVAL; | ||
4254 | goto poll_unlock_and_return; | ||
4255 | } | ||
4256 | queue = &zr->jpg_capq; | ||
4257 | frame = zr->jpg_pend[zr->jpg_que_tail & BUZ_MASK_FRAME]; | 4280 | frame = zr->jpg_pend[zr->jpg_que_tail & BUZ_MASK_FRAME]; |
4258 | poll_wait(file, queue, wait); | 4281 | |
4259 | if (fh->jpg_buffers.buffer[frame].state == BUZ_STATE_DONE) { | 4282 | spin_lock_irqsave(&zr->spinlock, flags); |
4283 | dprintk(3, | ||
4284 | KERN_DEBUG | ||
4285 | "%s: %s() jpg - active=%c, que_tail=%lu/%c, que_head=%lu, dma=%lu/%lu\n", | ||
4286 | ZR_DEVNAME(zr), __FUNCTION__, | ||
4287 | "FAL"[fh->jpg_buffers.active], zr->jpg_que_tail, | ||
4288 | "UPMD"[zr->jpg_buffers.buffer[frame].state], | ||
4289 | zr->jpg_que_head, zr->jpg_dma_tail, zr->jpg_dma_head); | ||
4290 | if (fh->jpg_buffers.active != ZORAN_FREE && | ||
4291 | zr->jpg_buffers.buffer[frame].state == BUZ_STATE_DONE) { | ||
4260 | if (fh->map_mode == ZORAN_MAP_MODE_JPG_REC) | 4292 | if (fh->map_mode == ZORAN_MAP_MODE_JPG_REC) |
4261 | res = POLLIN | POLLRDNORM; | 4293 | res = POLLIN | POLLRDNORM; |
4262 | else | 4294 | else |
4263 | res = POLLOUT | POLLWRNORM; | 4295 | res = POLLOUT | POLLWRNORM; |
4264 | } | 4296 | } |
4297 | spin_unlock_irqrestore(&zr->spinlock, flags); | ||
4298 | |||
4265 | break; | 4299 | break; |
4266 | 4300 | ||
4267 | default: | 4301 | default: |
4268 | dprintk(1, | 4302 | dprintk(1, |
4303 | KERN_ERR | ||
4269 | "%s: zoran_poll() - internal error, unknown map_mode=%d\n", | 4304 | "%s: zoran_poll() - internal error, unknown map_mode=%d\n", |
4270 | ZR_DEVNAME(zr), fh->map_mode); | 4305 | ZR_DEVNAME(zr), fh->map_mode); |
4271 | res = POLLNVAL; | 4306 | res = POLLNVAL; |
4272 | goto poll_unlock_and_return; | ||
4273 | } | 4307 | } |
4274 | 4308 | ||
4275 | poll_unlock_and_return: | ||
4276 | mutex_unlock(&zr->resource_lock); | 4309 | mutex_unlock(&zr->resource_lock); |
4277 | 4310 | ||
4278 | return res; | 4311 | return res; |
@@ -4368,11 +4401,15 @@ zoran_vm_close (struct vm_area_struct *vma) | |||
4368 | mutex_lock(&zr->resource_lock); | 4401 | mutex_lock(&zr->resource_lock); |
4369 | 4402 | ||
4370 | if (fh->v4l_buffers.active != ZORAN_FREE) { | 4403 | if (fh->v4l_buffers.active != ZORAN_FREE) { |
4404 | long flags; | ||
4405 | |||
4406 | spin_lock_irqsave(&zr->spinlock, flags); | ||
4371 | zr36057_set_memgrab(zr, 0); | 4407 | zr36057_set_memgrab(zr, 0); |
4372 | zr->v4l_buffers.allocated = 0; | 4408 | zr->v4l_buffers.allocated = 0; |
4373 | zr->v4l_buffers.active = | 4409 | zr->v4l_buffers.active = |
4374 | fh->v4l_buffers.active = | 4410 | fh->v4l_buffers.active = |
4375 | ZORAN_FREE; | 4411 | ZORAN_FREE; |
4412 | spin_unlock_irqrestore(&zr->spinlock, flags); | ||
4376 | } | 4413 | } |
4377 | //v4l_fbuffer_free(file); | 4414 | //v4l_fbuffer_free(file); |
4378 | fh->v4l_buffers.allocated = 0; | 4415 | fh->v4l_buffers.allocated = 0; |