aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-20 12:37:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-20 12:37:45 -0400
commitfb091be08d1acf184e8801dfdcace6e0cb19b1fe (patch)
treecbd0c4200fd8628d592167589ca790e36fc4ae26 /drivers/media/video/em28xx
parentbd7fc2f2d807fdb254f7efc542f8eec3f23e289e (diff)
parente8d0416796d43a950ec7b65629e53419b2e22453 (diff)
Merge branch 'v4l_for_2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'v4l_for_2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (534 commits) V4L/DVB (13554a): v4l: Use the video_drvdata function in drivers V4L/DVB: vivi and mem2mem_testdev need slab.h to build V4L/DVB: tm6000: bugfix image position V4L/DVB: IR/imon: remove dead IMON_KEY_RELEASE_OFFSET V4L/DVB: tm6000: README - add vbi V4L/DVB: Fix unlock logic at medusa_video_init V4L/DVB: fix dvb frontend lockup V4L/DVB: s2255drv: remove dead code V4L/DVB: s2255drv: return if vdev not found V4L/DVB: ov511: cleanup: remove unneeded null check V4L/DVB: media/mem2mem: dereferencing free memory V4L/DVB: media/IR: Add missing include file to rc-map.c V4L/DVB: dvb/stv6110x: cleanup error handling V4L/DVB: ngene: Add lgdt3303 and mt2131 deps to Kconfig V4L/DVB: ngene: start separating out DVB functions into separate file V4L/DVB: ngene: split out card specific code into a separate file V4L/DVB: ngene: split out i2c code into a separate file V4L/DVB: ngene: add initial support for digital side of Avermedia m780 V4L/DVB: ngene: properly support boards where channel 0 isn't a TS input V4L-DVB: ngene: make sure that tuner headers are included ...
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r--drivers/media/video/em28xx/em28xx-audio.c2
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c56
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c25
-rw-r--r--drivers/media/video/em28xx/em28xx-dvb.c11
-rw-r--r--drivers/media/video/em28xx/em28xx-input.c29
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c66
-rw-r--r--drivers/media/video/em28xx/em28xx.h7
7 files changed, 124 insertions, 72 deletions
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c
index bd783387b37d..e182abf476c9 100644
--- a/drivers/media/video/em28xx/em28xx-audio.c
+++ b/drivers/media/video/em28xx/em28xx-audio.c
@@ -491,7 +491,7 @@ static int em28xx_audio_init(struct em28xx *dev)
491 strcpy(pcm->name, "Empia 28xx Capture"); 491 strcpy(pcm->name, "Empia 28xx Capture");
492 492
493 snd_card_set_dev(card, &dev->udev->dev); 493 snd_card_set_dev(card, &dev->udev->dev);
494 strcpy(card->driver, "Empia Em28xx Audio"); 494 strcpy(card->driver, "Em28xx-Audio");
495 strcpy(card->shortname, "Em28xx Audio"); 495 strcpy(card->shortname, "Em28xx Audio");
496 strcpy(card->longname, "Empia Em28xx Audio"); 496 strcpy(card->longname, "Empia Em28xx Audio");
497 497
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index b0fb08337710..3a4fd8514511 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -602,7 +602,7 @@ struct em28xx_board em28xx_boards[] = {
602 .name = "Gadmei UTV330+", 602 .name = "Gadmei UTV330+",
603 .tuner_type = TUNER_TNF_5335MF, 603 .tuner_type = TUNER_TNF_5335MF,
604 .tda9887_conf = TDA9887_PRESENT, 604 .tda9887_conf = TDA9887_PRESENT,
605 .ir_codes = &ir_codes_gadmei_rm008z_table, 605 .ir_codes = RC_MAP_GADMEI_RM008Z,
606 .decoder = EM28XX_SAA711X, 606 .decoder = EM28XX_SAA711X,
607 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, 607 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
608 .input = { { 608 .input = { {
@@ -681,6 +681,20 @@ struct em28xx_board em28xx_boards[] = {
681 .amux = EM28XX_AMUX_LINE_IN, 681 .amux = EM28XX_AMUX_LINE_IN,
682 } }, 682 } },
683 }, 683 },
684 [EM2860_BOARD_TVP5150_REFERENCE_DESIGN] = {
685 .name = "EM2860/TVP5150 Reference Design",
686 .tuner_type = TUNER_ABSENT, /* Capture only device */
687 .decoder = EM28XX_TVP5150,
688 .input = { {
689 .type = EM28XX_VMUX_COMPOSITE1,
690 .vmux = TVP5150_COMPOSITE1,
691 .amux = EM28XX_AMUX_LINE_IN,
692 }, {
693 .type = EM28XX_VMUX_SVIDEO,
694 .vmux = TVP5150_SVIDEO,
695 .amux = EM28XX_AMUX_LINE_IN,
696 } },
697 },
684 [EM2861_BOARD_PLEXTOR_PX_TV100U] = { 698 [EM2861_BOARD_PLEXTOR_PX_TV100U] = {
685 .name = "Plextor ConvertX PX-TV100U", 699 .name = "Plextor ConvertX PX-TV100U",
686 .tuner_type = TUNER_TNF_5335MF, 700 .tuner_type = TUNER_TNF_5335MF,
@@ -777,7 +791,7 @@ struct em28xx_board em28xx_boards[] = {
777 .mts_firmware = 1, 791 .mts_firmware = 1,
778 .has_dvb = 1, 792 .has_dvb = 1,
779 .dvb_gpio = hauppauge_wintv_hvr_900_digital, 793 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
780 .ir_codes = &ir_codes_hauppauge_new_table, 794 .ir_codes = RC_MAP_HAUPPAUGE_NEW,
781 .decoder = EM28XX_TVP5150, 795 .decoder = EM28XX_TVP5150,
782 .input = { { 796 .input = { {
783 .type = EM28XX_VMUX_TELEVISION, 797 .type = EM28XX_VMUX_TELEVISION,
@@ -802,7 +816,7 @@ struct em28xx_board em28xx_boards[] = {
802 .tuner_type = TUNER_XC2028, 816 .tuner_type = TUNER_XC2028,
803 .tuner_gpio = default_tuner_gpio, 817 .tuner_gpio = default_tuner_gpio,
804 .mts_firmware = 1, 818 .mts_firmware = 1,
805 .ir_codes = &ir_codes_hauppauge_new_table, 819 .ir_codes = RC_MAP_HAUPPAUGE_NEW,
806 .decoder = EM28XX_TVP5150, 820 .decoder = EM28XX_TVP5150,
807 .input = { { 821 .input = { {
808 .type = EM28XX_VMUX_TELEVISION, 822 .type = EM28XX_VMUX_TELEVISION,
@@ -828,7 +842,7 @@ struct em28xx_board em28xx_boards[] = {
828 .mts_firmware = 1, 842 .mts_firmware = 1,
829 .has_dvb = 1, 843 .has_dvb = 1,
830 .dvb_gpio = hauppauge_wintv_hvr_900_digital, 844 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
831 .ir_codes = &ir_codes_hauppauge_new_table, 845 .ir_codes = RC_MAP_HAUPPAUGE_NEW,
832 .decoder = EM28XX_TVP5150, 846 .decoder = EM28XX_TVP5150,
833 .input = { { 847 .input = { {
834 .type = EM28XX_VMUX_TELEVISION, 848 .type = EM28XX_VMUX_TELEVISION,
@@ -854,7 +868,7 @@ struct em28xx_board em28xx_boards[] = {
854 .mts_firmware = 1, 868 .mts_firmware = 1,
855 .has_dvb = 1, 869 .has_dvb = 1,
856 .dvb_gpio = hauppauge_wintv_hvr_900_digital, 870 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
857 .ir_codes = &ir_codes_rc5_hauppauge_new_table, 871 .ir_codes = RC_MAP_RC5_HAUPPAUGE_NEW,
858 .decoder = EM28XX_TVP5150, 872 .decoder = EM28XX_TVP5150,
859 .input = { { 873 .input = { {
860 .type = EM28XX_VMUX_TELEVISION, 874 .type = EM28XX_VMUX_TELEVISION,
@@ -880,7 +894,7 @@ struct em28xx_board em28xx_boards[] = {
880 .mts_firmware = 1, 894 .mts_firmware = 1,
881 .has_dvb = 1, 895 .has_dvb = 1,
882 .dvb_gpio = hauppauge_wintv_hvr_900_digital, 896 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
883 .ir_codes = &ir_codes_pinnacle_pctv_hd_table, 897 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
884 .decoder = EM28XX_TVP5150, 898 .decoder = EM28XX_TVP5150,
885 .input = { { 899 .input = { {
886 .type = EM28XX_VMUX_TELEVISION, 900 .type = EM28XX_VMUX_TELEVISION,
@@ -906,7 +920,7 @@ struct em28xx_board em28xx_boards[] = {
906 .mts_firmware = 1, 920 .mts_firmware = 1,
907 .has_dvb = 1, 921 .has_dvb = 1,
908 .dvb_gpio = hauppauge_wintv_hvr_900_digital, 922 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
909 .ir_codes = &ir_codes_ati_tv_wonder_hd_600_table, 923 .ir_codes = RC_MAP_ATI_TV_WONDER_HD_600,
910 .decoder = EM28XX_TVP5150, 924 .decoder = EM28XX_TVP5150,
911 .input = { { 925 .input = { {
912 .type = EM28XX_VMUX_TELEVISION, 926 .type = EM28XX_VMUX_TELEVISION,
@@ -932,7 +946,7 @@ struct em28xx_board em28xx_boards[] = {
932 .decoder = EM28XX_TVP5150, 946 .decoder = EM28XX_TVP5150,
933 .has_dvb = 1, 947 .has_dvb = 1,
934 .dvb_gpio = default_digital, 948 .dvb_gpio = default_digital,
935 .ir_codes = &ir_codes_terratec_cinergy_xs_table, 949 .ir_codes = RC_MAP_TERRATEC_CINERGY_XS,
936 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */ 950 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
937 .input = { { 951 .input = { {
938 .type = EM28XX_VMUX_TELEVISION, 952 .type = EM28XX_VMUX_TELEVISION,
@@ -1282,7 +1296,7 @@ struct em28xx_board em28xx_boards[] = {
1282 .decoder = EM28XX_SAA711X, 1296 .decoder = EM28XX_SAA711X,
1283 .has_dvb = 1, 1297 .has_dvb = 1,
1284 .dvb_gpio = em2882_kworld_315u_digital, 1298 .dvb_gpio = em2882_kworld_315u_digital,
1285 .ir_codes = &ir_codes_kworld_315u_table, 1299 .ir_codes = RC_MAP_KWORLD_315U,
1286 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, 1300 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1287 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE, 1301 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE,
1288 /* Analog mode - still not ready */ 1302 /* Analog mode - still not ready */
@@ -1404,10 +1418,14 @@ struct em28xx_board em28xx_boards[] = {
1404 }, 1418 },
1405 [EM2882_BOARD_KWORLD_VS_DVBT] = { 1419 [EM2882_BOARD_KWORLD_VS_DVBT] = {
1406 .name = "Kworld VS-DVB-T 323UR", 1420 .name = "Kworld VS-DVB-T 323UR",
1407 .valid = EM28XX_BOARD_NOT_VALIDATED,
1408 .tuner_type = TUNER_XC2028, 1421 .tuner_type = TUNER_XC2028,
1409 .tuner_gpio = default_tuner_gpio, 1422 .tuner_gpio = default_tuner_gpio,
1410 .decoder = EM28XX_TVP5150, 1423 .decoder = EM28XX_TVP5150,
1424 .mts_firmware = 1,
1425 .has_dvb = 1,
1426 .dvb_gpio = kworld_330u_digital,
1427 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
1428 .ir_codes = RC_MAP_KWORLD_315U,
1411 .input = { { 1429 .input = { {
1412 .type = EM28XX_VMUX_TELEVISION, 1430 .type = EM28XX_VMUX_TELEVISION,
1413 .vmux = TVP5150_COMPOSITE0, 1431 .vmux = TVP5150_COMPOSITE0,
@@ -1430,7 +1448,7 @@ struct em28xx_board em28xx_boards[] = {
1430 .decoder = EM28XX_TVP5150, 1448 .decoder = EM28XX_TVP5150,
1431 .has_dvb = 1, 1449 .has_dvb = 1,
1432 .dvb_gpio = hauppauge_wintv_hvr_900_digital, 1450 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
1433 .ir_codes = &ir_codes_terratec_cinergy_xs_table, 1451 .ir_codes = RC_MAP_TERRATEC_CINERGY_XS,
1434 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, 1452 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1435 .input = { { 1453 .input = { {
1436 .type = EM28XX_VMUX_TELEVISION, 1454 .type = EM28XX_VMUX_TELEVISION,
@@ -1523,7 +1541,7 @@ struct em28xx_board em28xx_boards[] = {
1523 .mts_firmware = 1, 1541 .mts_firmware = 1,
1524 .decoder = EM28XX_TVP5150, 1542 .decoder = EM28XX_TVP5150,
1525 .tuner_gpio = default_tuner_gpio, 1543 .tuner_gpio = default_tuner_gpio,
1526 .ir_codes = &ir_codes_kaiomy_table, 1544 .ir_codes = RC_MAP_KAIOMY,
1527 .input = { { 1545 .input = { {
1528 .type = EM28XX_VMUX_TELEVISION, 1546 .type = EM28XX_VMUX_TELEVISION,
1529 .vmux = TVP5150_COMPOSITE0, 1547 .vmux = TVP5150_COMPOSITE0,
@@ -1623,7 +1641,7 @@ struct em28xx_board em28xx_boards[] = {
1623 .mts_firmware = 1, 1641 .mts_firmware = 1,
1624 .has_dvb = 1, 1642 .has_dvb = 1,
1625 .dvb_gpio = evga_indtube_digital, 1643 .dvb_gpio = evga_indtube_digital,
1626 .ir_codes = &ir_codes_evga_indtube_table, 1644 .ir_codes = RC_MAP_EVGA_INDTUBE,
1627 .input = { { 1645 .input = { {
1628 .type = EM28XX_VMUX_TELEVISION, 1646 .type = EM28XX_VMUX_TELEVISION,
1629 .vmux = TVP5150_COMPOSITE0, 1647 .vmux = TVP5150_COMPOSITE0,
@@ -1672,6 +1690,8 @@ struct usb_device_id em28xx_id_table[] = {
1672 .driver_info = EM2820_BOARD_UNKNOWN }, 1690 .driver_info = EM2820_BOARD_UNKNOWN },
1673 { USB_DEVICE(0xeb1a, 0x2862), 1691 { USB_DEVICE(0xeb1a, 0x2862),
1674 .driver_info = EM2820_BOARD_UNKNOWN }, 1692 .driver_info = EM2820_BOARD_UNKNOWN },
1693 { USB_DEVICE(0xeb1a, 0x2863),
1694 .driver_info = EM2820_BOARD_UNKNOWN },
1675 { USB_DEVICE(0xeb1a, 0x2870), 1695 { USB_DEVICE(0xeb1a, 0x2870),
1676 .driver_info = EM2820_BOARD_UNKNOWN }, 1696 .driver_info = EM2820_BOARD_UNKNOWN },
1677 { USB_DEVICE(0xeb1a, 0x2881), 1697 { USB_DEVICE(0xeb1a, 0x2881),
@@ -1792,6 +1812,7 @@ static struct em28xx_hash_table em28xx_i2c_hash[] = {
1792 {0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC}, 1812 {0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC},
1793 {0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC}, 1813 {0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC},
1794 {0x1ba50080, EM2860_BOARD_SAA711X_REFERENCE_DESIGN, TUNER_ABSENT}, 1814 {0x1ba50080, EM2860_BOARD_SAA711X_REFERENCE_DESIGN, TUNER_ABSENT},
1815 {0x77800080, EM2860_BOARD_TVP5150_REFERENCE_DESIGN, TUNER_ABSENT},
1795 {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC}, 1816 {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC},
1796 {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF}, 1817 {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF},
1797}; 1818};
@@ -2138,6 +2159,7 @@ static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
2138 break; 2159 break;
2139 case EM2883_BOARD_KWORLD_HYBRID_330U: 2160 case EM2883_BOARD_KWORLD_HYBRID_330U:
2140 case EM2882_BOARD_DIKOM_DK300: 2161 case EM2882_BOARD_DIKOM_DK300:
2162 case EM2882_BOARD_KWORLD_VS_DVBT:
2141 ctl->demod = XC3028_FE_CHINA; 2163 ctl->demod = XC3028_FE_CHINA;
2142 ctl->fname = XC2028_DEFAULT_FIRMWARE; 2164 ctl->fname = XC2028_DEFAULT_FIRMWARE;
2143 break; 2165 break;
@@ -2313,21 +2335,21 @@ void em28xx_register_i2c_ir(struct em28xx *dev)
2313 switch (dev->model) { 2335 switch (dev->model) {
2314 case EM2800_BOARD_TERRATEC_CINERGY_200: 2336 case EM2800_BOARD_TERRATEC_CINERGY_200:
2315 case EM2820_BOARD_TERRATEC_CINERGY_250: 2337 case EM2820_BOARD_TERRATEC_CINERGY_250:
2316 dev->init_data.ir_codes = &ir_codes_em_terratec_table; 2338 dev->init_data.ir_codes = RC_MAP_EM_TERRATEC;
2317 dev->init_data.get_key = em28xx_get_key_terratec; 2339 dev->init_data.get_key = em28xx_get_key_terratec;
2318 dev->init_data.name = "i2c IR (EM28XX Terratec)"; 2340 dev->init_data.name = "i2c IR (EM28XX Terratec)";
2319 break; 2341 break;
2320 case EM2820_BOARD_PINNACLE_USB_2: 2342 case EM2820_BOARD_PINNACLE_USB_2:
2321 dev->init_data.ir_codes = &ir_codes_pinnacle_grey_table; 2343 dev->init_data.ir_codes = RC_MAP_PINNACLE_GREY;
2322 dev->init_data.get_key = em28xx_get_key_pinnacle_usb_grey; 2344 dev->init_data.get_key = em28xx_get_key_pinnacle_usb_grey;
2323 dev->init_data.name = "i2c IR (EM28XX Pinnacle PCTV)"; 2345 dev->init_data.name = "i2c IR (EM28XX Pinnacle PCTV)";
2324 break; 2346 break;
2325 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2: 2347 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
2326 dev->init_data.ir_codes = &ir_codes_rc5_hauppauge_new_table; 2348 dev->init_data.ir_codes = RC_MAP_RC5_HAUPPAUGE_NEW;
2327 dev->init_data.get_key = em28xx_get_key_em_haup; 2349 dev->init_data.get_key = em28xx_get_key_em_haup;
2328 dev->init_data.name = "i2c IR (EM2840 Hauppauge)"; 2350 dev->init_data.name = "i2c IR (EM2840 Hauppauge)";
2329 case EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE: 2351 case EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE:
2330 dev->init_data.ir_codes = &ir_codes_winfast_usbii_deluxe_table;; 2352 dev->init_data.ir_codes = RC_MAP_WINFAST_USBII_DELUXE;;
2331 dev->init_data.get_key = em28xx_get_key_winfast_usbii_deluxe; 2353 dev->init_data.get_key = em28xx_get_key_winfast_usbii_deluxe;
2332 dev->init_data.name = "i2c IR (EM2820 Winfast TV USBII Deluxe)"; 2354 dev->init_data.name = "i2c IR (EM2820 Winfast TV USBII Deluxe)";
2333 break; 2355 break;
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index a41cc5566778..d3813ed789d9 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -782,11 +782,15 @@ int em28xx_resolution_set(struct em28xx *dev)
782 782
783 em28xx_accumulator_set(dev, 1, (width - 4) >> 2, 1, (height - 4) >> 2); 783 em28xx_accumulator_set(dev, 1, (width - 4) >> 2, 1, (height - 4) >> 2);
784 784
785 /* If we don't set the start position to 4 in VBI mode, we end up 785 /* If we don't set the start position to 2 in VBI mode, we end up
786 with line 21 being YUYV encoded instead of being in 8-bit 786 with line 20/21 being YUYV encoded instead of being in 8-bit
787 greyscale */ 787 greyscale. The core of the issue is that line 21 (and line 23 for
788 PAL WSS) are inside of active video region, and as a result they
789 get the pixelformatting associated with that area. So by cropping
790 it out, we end up with the same format as the rest of the VBI
791 region */
788 if (em28xx_vbi_supported(dev) == 1) 792 if (em28xx_vbi_supported(dev) == 1)
789 em28xx_capture_area_set(dev, 0, 4, width >> 2, height >> 2); 793 em28xx_capture_area_set(dev, 0, 2, width >> 2, height >> 2);
790 else 794 else
791 em28xx_capture_area_set(dev, 0, 0, width >> 2, height >> 2); 795 em28xx_capture_area_set(dev, 0, 0, width >> 2, height >> 2);
792 796
@@ -1174,21 +1178,18 @@ void em28xx_add_into_devlist(struct em28xx *dev)
1174 */ 1178 */
1175 1179
1176static LIST_HEAD(em28xx_extension_devlist); 1180static LIST_HEAD(em28xx_extension_devlist);
1177static DEFINE_MUTEX(em28xx_extension_devlist_lock);
1178 1181
1179int em28xx_register_extension(struct em28xx_ops *ops) 1182int em28xx_register_extension(struct em28xx_ops *ops)
1180{ 1183{
1181 struct em28xx *dev = NULL; 1184 struct em28xx *dev = NULL;
1182 1185
1183 mutex_lock(&em28xx_devlist_mutex); 1186 mutex_lock(&em28xx_devlist_mutex);
1184 mutex_lock(&em28xx_extension_devlist_lock);
1185 list_add_tail(&ops->next, &em28xx_extension_devlist); 1187 list_add_tail(&ops->next, &em28xx_extension_devlist);
1186 list_for_each_entry(dev, &em28xx_devlist, devlist) { 1188 list_for_each_entry(dev, &em28xx_devlist, devlist) {
1187 if (dev) 1189 if (dev)
1188 ops->init(dev); 1190 ops->init(dev);
1189 } 1191 }
1190 printk(KERN_INFO "Em28xx: Initialized (%s) extension\n", ops->name); 1192 printk(KERN_INFO "Em28xx: Initialized (%s) extension\n", ops->name);
1191 mutex_unlock(&em28xx_extension_devlist_lock);
1192 mutex_unlock(&em28xx_devlist_mutex); 1193 mutex_unlock(&em28xx_devlist_mutex);
1193 return 0; 1194 return 0;
1194} 1195}
@@ -1204,10 +1205,8 @@ void em28xx_unregister_extension(struct em28xx_ops *ops)
1204 ops->fini(dev); 1205 ops->fini(dev);
1205 } 1206 }
1206 1207
1207 mutex_lock(&em28xx_extension_devlist_lock);
1208 printk(KERN_INFO "Em28xx: Removed (%s) extension\n", ops->name); 1208 printk(KERN_INFO "Em28xx: Removed (%s) extension\n", ops->name);
1209 list_del(&ops->next); 1209 list_del(&ops->next);
1210 mutex_unlock(&em28xx_extension_devlist_lock);
1211 mutex_unlock(&em28xx_devlist_mutex); 1210 mutex_unlock(&em28xx_devlist_mutex);
1212} 1211}
1213EXPORT_SYMBOL(em28xx_unregister_extension); 1212EXPORT_SYMBOL(em28xx_unregister_extension);
@@ -1216,26 +1215,26 @@ void em28xx_init_extension(struct em28xx *dev)
1216{ 1215{
1217 struct em28xx_ops *ops = NULL; 1216 struct em28xx_ops *ops = NULL;
1218 1217
1219 mutex_lock(&em28xx_extension_devlist_lock); 1218 mutex_lock(&em28xx_devlist_mutex);
1220 if (!list_empty(&em28xx_extension_devlist)) { 1219 if (!list_empty(&em28xx_extension_devlist)) {
1221 list_for_each_entry(ops, &em28xx_extension_devlist, next) { 1220 list_for_each_entry(ops, &em28xx_extension_devlist, next) {
1222 if (ops->init) 1221 if (ops->init)
1223 ops->init(dev); 1222 ops->init(dev);
1224 } 1223 }
1225 } 1224 }
1226 mutex_unlock(&em28xx_extension_devlist_lock); 1225 mutex_unlock(&em28xx_devlist_mutex);
1227} 1226}
1228 1227
1229void em28xx_close_extension(struct em28xx *dev) 1228void em28xx_close_extension(struct em28xx *dev)
1230{ 1229{
1231 struct em28xx_ops *ops = NULL; 1230 struct em28xx_ops *ops = NULL;
1232 1231
1233 mutex_lock(&em28xx_extension_devlist_lock); 1232 mutex_lock(&em28xx_devlist_mutex);
1234 if (!list_empty(&em28xx_extension_devlist)) { 1233 if (!list_empty(&em28xx_extension_devlist)) {
1235 list_for_each_entry(ops, &em28xx_extension_devlist, next) { 1234 list_for_each_entry(ops, &em28xx_extension_devlist, next) {
1236 if (ops->fini) 1235 if (ops->fini)
1237 ops->fini(dev); 1236 ops->fini(dev);
1238 } 1237 }
1239 } 1238 }
1240 mutex_unlock(&em28xx_extension_devlist_lock); 1239 mutex_unlock(&em28xx_devlist_mutex);
1241} 1240}
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c
index bcd3c371009b..cf1d8c3655fc 100644
--- a/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/drivers/media/video/em28xx/em28xx-dvb.c
@@ -467,6 +467,7 @@ static int dvb_init(struct em28xx *dev)
467 } 467 }
468 dev->dvb = dvb; 468 dev->dvb = dvb;
469 469
470 mutex_lock(&dev->lock);
470 em28xx_set_mode(dev, EM28XX_DIGITAL_MODE); 471 em28xx_set_mode(dev, EM28XX_DIGITAL_MODE);
471 /* init frontend */ 472 /* init frontend */
472 switch (dev->model) { 473 switch (dev->model) {
@@ -506,6 +507,7 @@ static int dvb_init(struct em28xx *dev)
506 case EM2880_BOARD_TERRATEC_HYBRID_XS_FR: 507 case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
507 case EM2881_BOARD_PINNACLE_HYBRID_PRO: 508 case EM2881_BOARD_PINNACLE_HYBRID_PRO:
508 case EM2882_BOARD_DIKOM_DK300: 509 case EM2882_BOARD_DIKOM_DK300:
510 case EM2882_BOARD_KWORLD_VS_DVBT:
509 dvb->frontend = dvb_attach(zl10353_attach, 511 dvb->frontend = dvb_attach(zl10353_attach,
510 &em28xx_zl10353_xc3028_no_i2c_gate, 512 &em28xx_zl10353_xc3028_no_i2c_gate,
511 &dev->i2c_adap); 513 &dev->i2c_adap);
@@ -589,15 +591,16 @@ static int dvb_init(struct em28xx *dev)
589 if (result < 0) 591 if (result < 0)
590 goto out_free; 592 goto out_free;
591 593
592 em28xx_set_mode(dev, EM28XX_SUSPEND);
593 em28xx_info("Successfully loaded em28xx-dvb\n"); 594 em28xx_info("Successfully loaded em28xx-dvb\n");
594 return 0; 595ret:
596 em28xx_set_mode(dev, EM28XX_SUSPEND);
597 mutex_unlock(&dev->lock);
598 return result;
595 599
596out_free: 600out_free:
597 em28xx_set_mode(dev, EM28XX_SUSPEND);
598 kfree(dvb); 601 kfree(dvb);
599 dev->dvb = NULL; 602 dev->dvb = NULL;
600 return result; 603 goto ret;
601} 604}
602 605
603static int dvb_fini(struct em28xx *dev) 606static int dvb_fini(struct em28xx *dev)
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c
index 20a0001e8885..5c3fd9411b1f 100644
--- a/drivers/media/video/em28xx/em28xx-input.c
+++ b/drivers/media/video/em28xx/em28xx-input.c
@@ -39,6 +39,8 @@ static unsigned int ir_debug;
39module_param(ir_debug, int, 0644); 39module_param(ir_debug, int, 0644);
40MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); 40MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
41 41
42#define MODULE_NAME "em28xx"
43
42#define i2cdprintk(fmt, arg...) \ 44#define i2cdprintk(fmt, arg...) \
43 if (ir_debug) { \ 45 if (ir_debug) { \
44 printk(KERN_DEBUG "%s/ir: " fmt, ir->name , ## arg); \ 46 printk(KERN_DEBUG "%s/ir: " fmt, ir->name , ## arg); \
@@ -360,14 +362,20 @@ static void em28xx_ir_work(struct work_struct *work)
360 schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling)); 362 schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling));
361} 363}
362 364
363static void em28xx_ir_start(struct em28xx_IR *ir) 365static int em28xx_ir_start(void *priv)
364{ 366{
367 struct em28xx_IR *ir = priv;
368
365 INIT_DELAYED_WORK(&ir->work, em28xx_ir_work); 369 INIT_DELAYED_WORK(&ir->work, em28xx_ir_work);
366 schedule_delayed_work(&ir->work, 0); 370 schedule_delayed_work(&ir->work, 0);
371
372 return 0;
367} 373}
368 374
369static void em28xx_ir_stop(struct em28xx_IR *ir) 375static void em28xx_ir_stop(void *priv)
370{ 376{
377 struct em28xx_IR *ir = priv;
378
371 cancel_delayed_work_sync(&ir->work); 379 cancel_delayed_work_sync(&ir->work);
372} 380}
373 381
@@ -380,7 +388,6 @@ int em28xx_ir_change_protocol(void *priv, u64 ir_type)
380 388
381 /* Adjust xclk based o IR table for RC5/NEC tables */ 389 /* Adjust xclk based o IR table for RC5/NEC tables */
382 390
383 dev->board.ir_codes->ir_type = IR_TYPE_OTHER;
384 if (ir_type == IR_TYPE_RC5) { 391 if (ir_type == IR_TYPE_RC5) {
385 dev->board.xclk |= EM28XX_XCLK_IR_RC5_MODE; 392 dev->board.xclk |= EM28XX_XCLK_IR_RC5_MODE;
386 ir->full_code = 1; 393 ir->full_code = 1;
@@ -388,11 +395,9 @@ int em28xx_ir_change_protocol(void *priv, u64 ir_type)
388 dev->board.xclk &= ~EM28XX_XCLK_IR_RC5_MODE; 395 dev->board.xclk &= ~EM28XX_XCLK_IR_RC5_MODE;
389 ir_config = EM2874_IR_NEC; 396 ir_config = EM2874_IR_NEC;
390 ir->full_code = 1; 397 ir->full_code = 1;
391 } else 398 } else if (ir_type != IR_TYPE_UNKNOWN)
392 rc = -EINVAL; 399 rc = -EINVAL;
393 400
394 dev->board.ir_codes->ir_type = ir_type;
395
396 em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, dev->board.xclk, 401 em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, dev->board.xclk,
397 EM28XX_XCLK_IR_RC5_MODE); 402 EM28XX_XCLK_IR_RC5_MODE);
398 403
@@ -443,6 +448,13 @@ int em28xx_ir_init(struct em28xx *dev)
443 ir->props.allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; 448 ir->props.allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC;
444 ir->props.priv = ir; 449 ir->props.priv = ir;
445 ir->props.change_protocol = em28xx_ir_change_protocol; 450 ir->props.change_protocol = em28xx_ir_change_protocol;
451 ir->props.open = em28xx_ir_start;
452 ir->props.close = em28xx_ir_stop;
453
454 /* By default, keep protocol field untouched */
455 err = em28xx_ir_change_protocol(ir, IR_TYPE_UNKNOWN);
456 if (err)
457 goto err_out_free;
446 458
447 /* This is how often we ask the chip for IR information */ 459 /* This is how often we ask the chip for IR information */
448 ir->polling = 100; /* ms */ 460 ir->polling = 100; /* ms */
@@ -455,7 +467,6 @@ int em28xx_ir_init(struct em28xx *dev)
455 strlcat(ir->phys, "/input0", sizeof(ir->phys)); 467 strlcat(ir->phys, "/input0", sizeof(ir->phys));
456 468
457 /* Set IR protocol */ 469 /* Set IR protocol */
458 em28xx_ir_change_protocol(ir, dev->board.ir_codes->ir_type);
459 err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER); 470 err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER);
460 if (err < 0) 471 if (err < 0)
461 goto err_out_free; 472 goto err_out_free;
@@ -470,17 +481,15 @@ int em28xx_ir_init(struct em28xx *dev)
470 input_dev->dev.parent = &dev->udev->dev; 481 input_dev->dev.parent = &dev->udev->dev;
471 482
472 483
473 em28xx_ir_start(ir);
474 484
475 /* all done */ 485 /* all done */
476 err = ir_input_register(ir->input, dev->board.ir_codes, 486 err = ir_input_register(ir->input, dev->board.ir_codes,
477 &ir->props); 487 &ir->props, MODULE_NAME);
478 if (err) 488 if (err)
479 goto err_out_stop; 489 goto err_out_stop;
480 490
481 return 0; 491 return 0;
482 err_out_stop: 492 err_out_stop:
483 em28xx_ir_stop(ir);
484 dev->ir = NULL; 493 dev->ir = NULL;
485 err_out_free: 494 err_out_free:
486 kfree(ir); 495 kfree(ir);
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 0fe20110bfd6..20090e34173a 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -203,12 +203,6 @@ static void em28xx_copy_video(struct em28xx *dev,
203 if (dma_q->pos + len > buf->vb.size) 203 if (dma_q->pos + len > buf->vb.size)
204 len = buf->vb.size - dma_q->pos; 204 len = buf->vb.size - dma_q->pos;
205 205
206 if (p[0] != 0x88 && p[0] != 0x22) {
207 em28xx_isocdbg("frame is not complete\n");
208 len += 4;
209 } else
210 p += 4;
211
212 startread = p; 206 startread = p;
213 remain = len; 207 remain = len;
214 208
@@ -309,14 +303,6 @@ static void em28xx_copy_vbi(struct em28xx *dev,
309 if (dma_q->pos + len > buf->vb.size) 303 if (dma_q->pos + len > buf->vb.size)
310 len = buf->vb.size - dma_q->pos; 304 len = buf->vb.size - dma_q->pos;
311 305
312 if ((p[0] == 0x33 && p[1] == 0x95) ||
313 (p[0] == 0x88 && p[1] == 0x88)) {
314 /* Header field, advance past it */
315 p += 4;
316 } else {
317 len += 4;
318 }
319
320 startread = p; 306 startread = p;
321 307
322 startwrite = outp + dma_q->pos; 308 startwrite = outp + dma_q->pos;
@@ -507,8 +493,15 @@ static inline int em28xx_isoc_copy(struct em28xx *dev, struct urb *urb)
507 493
508 dma_q->pos = 0; 494 dma_q->pos = 0;
509 } 495 }
510 if (buf != NULL) 496 if (buf != NULL) {
497 if (p[0] != 0x88 && p[0] != 0x22) {
498 em28xx_isocdbg("frame is not complete\n");
499 len += 4;
500 } else {
501 p += 4;
502 }
511 em28xx_copy_video(dev, dma_q, buf, p, outp, len); 503 em28xx_copy_video(dev, dma_q, buf, p, outp, len);
504 }
512 } 505 }
513 return rc; 506 return rc;
514} 507}
@@ -555,8 +548,7 @@ static inline int em28xx_isoc_copy_vbi(struct em28xx *dev, struct urb *urb)
555 continue; 548 continue;
556 } 549 }
557 550
558 len = urb->iso_frame_desc[i].actual_length - 4; 551 len = urb->iso_frame_desc[i].actual_length;
559
560 if (urb->iso_frame_desc[i].actual_length <= 0) { 552 if (urb->iso_frame_desc[i].actual_length <= 0) {
561 /* em28xx_isocdbg("packet %d is empty",i); - spammy */ 553 /* em28xx_isocdbg("packet %d is empty",i); - spammy */
562 continue; 554 continue;
@@ -577,6 +569,17 @@ static inline int em28xx_isoc_copy_vbi(struct em28xx *dev, struct urb *urb)
577 dev->vbi_read = 0; 569 dev->vbi_read = 0;
578 em28xx_isocdbg("VBI START HEADER!!!\n"); 570 em28xx_isocdbg("VBI START HEADER!!!\n");
579 dev->cur_field = p[2]; 571 dev->cur_field = p[2];
572 p += 4;
573 len -= 4;
574 } else if (p[0] == 0x88 && p[1] == 0x88 &&
575 p[2] == 0x88 && p[3] == 0x88) {
576 /* continuation */
577 p += 4;
578 len -= 4;
579 } else if (p[0] == 0x22 && p[1] == 0x5a) {
580 /* start video */
581 p += 4;
582 len -= 4;
580 } 583 }
581 584
582 vbi_size = dev->vbi_width * dev->vbi_height; 585 vbi_size = dev->vbi_width * dev->vbi_height;
@@ -631,9 +634,6 @@ static inline int em28xx_isoc_copy_vbi(struct em28xx *dev, struct urb *urb)
631 634
632 if (dev->capture_type == 1) { 635 if (dev->capture_type == 1) {
633 dev->capture_type = 2; 636 dev->capture_type = 2;
634 em28xx_isocdbg("Video frame %d, length=%i, %s\n", p[2],
635 len, (p[2] & 1) ? "odd" : "even");
636
637 if (dev->progressive || !(dev->cur_field & 1)) { 637 if (dev->progressive || !(dev->cur_field & 1)) {
638 if (buf != NULL) 638 if (buf != NULL)
639 buffer_filled(dev, dma_q, buf); 639 buffer_filled(dev, dma_q, buf);
@@ -652,8 +652,25 @@ static inline int em28xx_isoc_copy_vbi(struct em28xx *dev, struct urb *urb)
652 652
653 dma_q->pos = 0; 653 dma_q->pos = 0;
654 } 654 }
655 if (buf != NULL && dev->capture_type == 2) 655
656 em28xx_copy_video(dev, dma_q, buf, p, outp, len); 656 if (buf != NULL && dev->capture_type == 2) {
657 if (len > 4 && p[0] == 0x88 && p[1] == 0x88 &&
658 p[2] == 0x88 && p[3] == 0x88) {
659 p += 4;
660 len -= 4;
661 }
662 if (len > 4 && p[0] == 0x22 && p[1] == 0x5a) {
663 em28xx_isocdbg("Video frame %d, len=%i, %s\n",
664 p[2], len, (p[2] & 1) ?
665 "odd" : "even");
666 p += 4;
667 len -= 4;
668 }
669
670 if (len > 0)
671 em28xx_copy_video(dev, dma_q, buf, p, outp,
672 len);
673 }
657 } 674 }
658 return rc; 675 return rc;
659} 676}
@@ -1483,6 +1500,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
1483 return -EINVAL; 1500 return -EINVAL;
1484 1501
1485 strcpy(t->name, "Tuner"); 1502 strcpy(t->name, "Tuner");
1503 t->type = V4L2_TUNER_ANALOG_TV;
1486 1504
1487 mutex_lock(&dev->lock); 1505 mutex_lock(&dev->lock);
1488 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t); 1506 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t);
@@ -1814,7 +1832,7 @@ static int vidioc_g_fmt_sliced_vbi_cap(struct file *file, void *priv,
1814 mutex_lock(&dev->lock); 1832 mutex_lock(&dev->lock);
1815 1833
1816 f->fmt.sliced.service_set = 0; 1834 f->fmt.sliced.service_set = 0;
1817 v4l2_device_call_all(&dev->v4l2_dev, 0, video, g_fmt, f); 1835 v4l2_device_call_all(&dev->v4l2_dev, 0, vbi, g_sliced_fmt, &f->fmt.sliced);
1818 1836
1819 if (f->fmt.sliced.service_set == 0) 1837 if (f->fmt.sliced.service_set == 0)
1820 rc = -EINVAL; 1838 rc = -EINVAL;
@@ -1836,7 +1854,7 @@ static int vidioc_try_set_sliced_vbi_cap(struct file *file, void *priv,
1836 return rc; 1854 return rc;
1837 1855
1838 mutex_lock(&dev->lock); 1856 mutex_lock(&dev->lock);
1839 v4l2_device_call_all(&dev->v4l2_dev, 0, video, g_fmt, f); 1857 v4l2_device_call_all(&dev->v4l2_dev, 0, vbi, g_sliced_fmt, &f->fmt.sliced);
1840 mutex_unlock(&dev->lock); 1858 mutex_unlock(&dev->lock);
1841 1859
1842 if (f->fmt.sliced.service_set == 0) 1860 if (f->fmt.sliced.service_set == 0)
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index ba6fe5daff84..b252d1b1b2a7 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -68,6 +68,7 @@
68#define EM2820_BOARD_HERCULES_SMART_TV_USB2 26 68#define EM2820_BOARD_HERCULES_SMART_TV_USB2 26
69#define EM2820_BOARD_PINNACLE_USB_2_FM1216ME 27 69#define EM2820_BOARD_PINNACLE_USB_2_FM1216ME 27
70#define EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE 28 70#define EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE 28
71#define EM2860_BOARD_TVP5150_REFERENCE_DESIGN 29
71#define EM2820_BOARD_VIDEOLOGY_20K14XUSB 30 72#define EM2820_BOARD_VIDEOLOGY_20K14XUSB 30
72#define EM2821_BOARD_USBGEAR_VD204 31 73#define EM2821_BOARD_USBGEAR_VD204 31
73#define EM2821_BOARD_SUPERCOMP_USB_2 32 74#define EM2821_BOARD_SUPERCOMP_USB_2 32
@@ -140,10 +141,10 @@
140#define EM28XX_NUM_BUFS 5 141#define EM28XX_NUM_BUFS 5
141 142
142/* number of packets for each buffer 143/* number of packets for each buffer
143 windows requests only 40 packets .. so we better do the same 144 windows requests only 64 packets .. so we better do the same
144 this is what I found out for all alternate numbers there! 145 this is what I found out for all alternate numbers there!
145 */ 146 */
146#define EM28XX_NUM_PACKETS 40 147#define EM28XX_NUM_PACKETS 64
147 148
148#define EM28XX_INTERLACED_DEFAULT 1 149#define EM28XX_INTERLACED_DEFAULT 1
149 150
@@ -411,7 +412,7 @@ struct em28xx_board {
411 412
412 struct em28xx_input input[MAX_EM28XX_INPUT]; 413 struct em28xx_input input[MAX_EM28XX_INPUT];
413 struct em28xx_input radio; 414 struct em28xx_input radio;
414 struct ir_scancode_table *ir_codes; 415 char *ir_codes;
415}; 416};
416 417
417struct em28xx_eeprom { 418struct em28xx_eeprom {