diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-18 14:25:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-18 14:25:58 -0400 |
commit | a267c0a887064720dfab5775a4f09b20b4f8ec37 (patch) | |
tree | 25de1f109ff6ef7f0967c22755604cc667944afd /drivers/media/video | |
parent | d756d10e246a01515d07f8161181b8a14afba7cc (diff) | |
parent | 97989ada7628da262eafb4bebce0a319c7cb0f5f (diff) |
Merge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (126 commits)
V4L/DVB (5847): Clean up schedule_timeout calls in cpia2 and ivtv code
V4L/DVB (5846): Clean up setting state and scheduling timeouts
V4L/DVB (5844): ivtv: add high volume debugging flag
V4L/DVB (5843): ivtv: fix missing signal_pending check.
V4L/DVB (5842): ivtv: Add locking to ensure stream setup is atomic.
V4L/DVB (5841): tveeprom: add support for Philips FQ1216LME MK3 tuner.
V4L/DVB (5840): fix dst and cx24123: tune() callback changed signess for delay
V4L/DVB (5838): dvb-core: Fix signedness warnings (gcc 4.1.1, kernel 2.6.22)
V4L/DVB (5837): stv0299: Fix signedness warning (gcc 4.1.1, kernel 2.6.22)
V4L/DVB (5836): dvb-ttpci: re-initialize aspect ratio and pan scan after arm crash
V4L/DVB (5835): saa7146/dvb-ttpci: Fix signedness warnings (gcc 4.1.1, kernel 2.6.22)
V4L/DVB (5834): dvb-core: fix signedness warnings and const stripping
V4L/DVB (5832): ir-common: optimize bit extract function
V4L/DVB (5831): stradis: use ARRAY_SIZE
V4L/DVB (5829): Firmware extract and loading for opera dvb-usb update
V4L/DVB (5828): Kconfig: Added GemTek USB radio and removed experimental dependency.
V4L/DVB (5826): Usbvision: video mux cleanup
V4L/DVB (5825): Alter the tuner type for the WinTV USB UK PAL model.
V4L/DVB (5824): Usbvision: Hauppauge WinTV USB SECAM_L fix
V4L/DVB (5821): Saa7134: add remote control support for LifeView FlyDVB-S LR300
...
Diffstat (limited to 'drivers/media/video')
87 files changed, 2677 insertions, 2431 deletions
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 4d45a40016de..9dcbffd0aa15 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -489,6 +489,15 @@ config TUNER_3036 | |||
489 | Say Y here to include support for Philips SAB3036 compatible tuners. | 489 | Say Y here to include support for Philips SAB3036 compatible tuners. |
490 | If in doubt, say N. | 490 | If in doubt, say N. |
491 | 491 | ||
492 | config TUNER_TEA5761 | ||
493 | bool "TEA 5761 radio tuner (EXPERIMENTAL)" | ||
494 | depends on EXPERIMENTAL | ||
495 | depends on I2C | ||
496 | select VIDEO_TUNER | ||
497 | help | ||
498 | Say Y here to include support for Philips TEA5761 radio tuner. | ||
499 | If in doubt, say N. | ||
500 | |||
492 | config VIDEO_VINO | 501 | config VIDEO_VINO |
493 | tristate "SGI Vino Video For Linux (EXPERIMENTAL)" | 502 | tristate "SGI Vino Video For Linux (EXPERIMENTAL)" |
494 | depends on I2C && SGI_IP22 && EXPERIMENTAL && VIDEO_V4L2 | 503 | depends on I2C && SGI_IP22 && EXPERIMENTAL && VIDEO_V4L2 |
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 9c2de501612f..10b4d4469016 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
@@ -7,6 +7,8 @@ zr36067-objs := zoran_procfs.o zoran_device.o \ | |||
7 | tuner-objs := tuner-core.o tuner-types.o tuner-simple.o \ | 7 | tuner-objs := tuner-core.o tuner-types.o tuner-simple.o \ |
8 | mt20xx.o tda8290.o tea5767.o tda9887.o | 8 | mt20xx.o tda8290.o tea5767.o tda9887.o |
9 | 9 | ||
10 | tuner-$(CONFIG_TUNER_TEA5761) += tea5761.o | ||
11 | |||
10 | msp3400-objs := msp3400-driver.o msp3400-kthreads.o | 12 | msp3400-objs := msp3400-driver.o msp3400-kthreads.o |
11 | 13 | ||
12 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o compat_ioctl32.o | 14 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o compat_ioctl32.o |
@@ -16,7 +18,7 @@ ifeq ($(CONFIG_VIDEO_V4L1_COMPAT),y) | |||
16 | endif | 18 | endif |
17 | 19 | ||
18 | obj-$(CONFIG_VIDEO_BT848) += bt8xx/ | 20 | obj-$(CONFIG_VIDEO_BT848) += bt8xx/ |
19 | obj-$(CONFIG_VIDEO_BT848) += ir-kbd-i2c.o | 21 | obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o |
20 | obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o | 22 | obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o |
21 | obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o | 23 | obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o |
22 | obj-$(CONFIG_VIDEO_TDA9875) += tda9875.o | 24 | obj-$(CONFIG_VIDEO_TDA9875) += tda9875.o |
@@ -59,7 +61,7 @@ obj-$(CONFIG_VIDEO_CPIA) += cpia.o | |||
59 | obj-$(CONFIG_VIDEO_CPIA_PP) += cpia_pp.o | 61 | obj-$(CONFIG_VIDEO_CPIA_PP) += cpia_pp.o |
60 | obj-$(CONFIG_VIDEO_CPIA_USB) += cpia_usb.o | 62 | obj-$(CONFIG_VIDEO_CPIA_USB) += cpia_usb.o |
61 | obj-$(CONFIG_VIDEO_MEYE) += meye.o | 63 | obj-$(CONFIG_VIDEO_MEYE) += meye.o |
62 | obj-$(CONFIG_VIDEO_SAA7134) += ir-kbd-i2c.o saa7134/ | 64 | obj-$(CONFIG_VIDEO_SAA7134) += saa7134/ |
63 | obj-$(CONFIG_VIDEO_CX88) += cx88/ | 65 | obj-$(CONFIG_VIDEO_CX88) += cx88/ |
64 | obj-$(CONFIG_VIDEO_IVTV) += ivtv/ | 66 | obj-$(CONFIG_VIDEO_IVTV) += ivtv/ |
65 | obj-$(CONFIG_VIDEO_EM28XX) += em28xx/ | 67 | obj-$(CONFIG_VIDEO_EM28XX) += em28xx/ |
diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c index 823cd6cc471e..cbab53fc6243 100644 --- a/drivers/media/video/adv7170.c +++ b/drivers/media/video/adv7170.c | |||
@@ -38,23 +38,23 @@ | |||
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
40 | #include <linux/signal.h> | 40 | #include <linux/signal.h> |
41 | #include <linux/types.h> | ||
42 | #include <linux/i2c.h> | ||
41 | #include <asm/io.h> | 43 | #include <asm/io.h> |
42 | #include <asm/pgtable.h> | 44 | #include <asm/pgtable.h> |
43 | #include <asm/page.h> | 45 | #include <asm/page.h> |
44 | #include <linux/types.h> | 46 | #include <asm/uaccess.h> |
45 | 47 | ||
46 | #include <linux/videodev.h> | 48 | #include <linux/videodev.h> |
47 | #include <asm/uaccess.h> | 49 | #include <linux/video_encoder.h> |
48 | 50 | ||
49 | MODULE_DESCRIPTION("Analog Devices ADV7170 video encoder driver"); | 51 | MODULE_DESCRIPTION("Analog Devices ADV7170 video encoder driver"); |
50 | MODULE_AUTHOR("Maxim Yevtyushkin"); | 52 | MODULE_AUTHOR("Maxim Yevtyushkin"); |
51 | MODULE_LICENSE("GPL"); | 53 | MODULE_LICENSE("GPL"); |
52 | 54 | ||
53 | #include <linux/i2c.h> | ||
54 | 55 | ||
55 | #define I2C_NAME(x) (x)->name | 56 | #define I2C_NAME(x) (x)->name |
56 | 57 | ||
57 | #include <linux/video_encoder.h> | ||
58 | 58 | ||
59 | static int debug = 0; | 59 | static int debug = 0; |
60 | module_param(debug, int, 0); | 60 | module_param(debug, int, 0); |
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c index 05c7820fe53e..0d0c554bfdf7 100644 --- a/drivers/media/video/adv7175.c +++ b/drivers/media/video/adv7175.c | |||
@@ -34,23 +34,23 @@ | |||
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/mm.h> | 35 | #include <linux/mm.h> |
36 | #include <linux/signal.h> | 36 | #include <linux/signal.h> |
37 | #include <linux/types.h> | ||
38 | #include <linux/i2c.h> | ||
37 | #include <asm/io.h> | 39 | #include <asm/io.h> |
38 | #include <asm/pgtable.h> | 40 | #include <asm/pgtable.h> |
39 | #include <asm/page.h> | 41 | #include <asm/page.h> |
40 | #include <linux/types.h> | 42 | #include <asm/uaccess.h> |
41 | 43 | ||
42 | #include <linux/videodev.h> | 44 | #include <linux/videodev.h> |
43 | #include <asm/uaccess.h> | 45 | #include <linux/video_encoder.h> |
44 | 46 | ||
45 | MODULE_DESCRIPTION("Analog Devices ADV7175 video encoder driver"); | 47 | MODULE_DESCRIPTION("Analog Devices ADV7175 video encoder driver"); |
46 | MODULE_AUTHOR("Dave Perks"); | 48 | MODULE_AUTHOR("Dave Perks"); |
47 | MODULE_LICENSE("GPL"); | 49 | MODULE_LICENSE("GPL"); |
48 | 50 | ||
49 | #include <linux/i2c.h> | ||
50 | 51 | ||
51 | #define I2C_NAME(s) (s)->name | 52 | #define I2C_NAME(s) (s)->name |
52 | 53 | ||
53 | #include <linux/video_encoder.h> | ||
54 | 54 | ||
55 | static int debug = 0; | 55 | static int debug = 0; |
56 | module_param(debug, int, 0); | 56 | module_param(debug, int, 0); |
diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c index 59a43603b5cb..12d1b9248be5 100644 --- a/drivers/media/video/bt819.c +++ b/drivers/media/video/bt819.c | |||
@@ -38,23 +38,24 @@ | |||
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
40 | #include <linux/signal.h> | 40 | #include <linux/signal.h> |
41 | #include <linux/types.h> | ||
42 | #include <linux/i2c.h> | ||
41 | #include <asm/io.h> | 43 | #include <asm/io.h> |
42 | #include <asm/pgtable.h> | 44 | #include <asm/pgtable.h> |
43 | #include <asm/page.h> | 45 | #include <asm/page.h> |
44 | #include <linux/types.h> | 46 | #include <asm/uaccess.h> |
45 | 47 | ||
46 | #include <linux/videodev.h> | 48 | #include <linux/videodev.h> |
47 | #include <asm/uaccess.h> | 49 | #include <linux/video_decoder.h> |
50 | |||
48 | 51 | ||
49 | MODULE_DESCRIPTION("Brooktree-819 video decoder driver"); | 52 | MODULE_DESCRIPTION("Brooktree-819 video decoder driver"); |
50 | MODULE_AUTHOR("Mike Bernson & Dave Perks"); | 53 | MODULE_AUTHOR("Mike Bernson & Dave Perks"); |
51 | MODULE_LICENSE("GPL"); | 54 | MODULE_LICENSE("GPL"); |
52 | 55 | ||
53 | #include <linux/i2c.h> | ||
54 | 56 | ||
55 | #define I2C_NAME(s) (s)->name | 57 | #define I2C_NAME(s) (s)->name |
56 | 58 | ||
57 | #include <linux/video_decoder.h> | ||
58 | 59 | ||
59 | static int debug = 0; | 60 | static int debug = 0; |
60 | module_param(debug, int, 0); | 61 | module_param(debug, int, 0); |
diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c index 853b1a3d6a1d..e1028a76c042 100644 --- a/drivers/media/video/bt856.c +++ b/drivers/media/video/bt856.c | |||
@@ -38,23 +38,23 @@ | |||
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
40 | #include <linux/signal.h> | 40 | #include <linux/signal.h> |
41 | #include <linux/types.h> | ||
42 | #include <linux/i2c.h> | ||
43 | #include <linux/video_encoder.h> | ||
41 | #include <asm/io.h> | 44 | #include <asm/io.h> |
42 | #include <asm/pgtable.h> | 45 | #include <asm/pgtable.h> |
43 | #include <asm/page.h> | 46 | #include <asm/page.h> |
44 | #include <linux/types.h> | 47 | #include <asm/uaccess.h> |
45 | 48 | ||
46 | #include <linux/videodev.h> | 49 | #include <linux/videodev.h> |
47 | #include <asm/uaccess.h> | ||
48 | 50 | ||
49 | MODULE_DESCRIPTION("Brooktree-856A video encoder driver"); | 51 | MODULE_DESCRIPTION("Brooktree-856A video encoder driver"); |
50 | MODULE_AUTHOR("Mike Bernson & Dave Perks"); | 52 | MODULE_AUTHOR("Mike Bernson & Dave Perks"); |
51 | MODULE_LICENSE("GPL"); | 53 | MODULE_LICENSE("GPL"); |
52 | 54 | ||
53 | #include <linux/i2c.h> | ||
54 | 55 | ||
55 | #define I2C_NAME(s) (s)->name | 56 | #define I2C_NAME(s) (s)->name |
56 | 57 | ||
57 | #include <linux/video_encoder.h> | ||
58 | 58 | ||
59 | static int debug = 0; | 59 | static int debug = 0; |
60 | module_param(debug, int, 0); | 60 | module_param(debug, int, 0); |
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index 6b31e50fb951..2aea09c72093 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
@@ -178,8 +178,8 @@ static struct CARD { | |||
178 | /* this seems to happen as well ... */ | 178 | /* this seems to happen as well ... */ |
179 | { 0xff1211bd, BTTV_BOARD_PINNACLE, "Pinnacle PCTV" }, | 179 | { 0xff1211bd, BTTV_BOARD_PINNACLE, "Pinnacle PCTV" }, |
180 | 180 | ||
181 | { 0x3000121a, BTTV_BOARD_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" }, | 181 | { 0x3000121a, BTTV_BOARD_VOODOOTV_200, "3Dfx VoodooTV 200" }, |
182 | { 0x263710b4, BTTV_BOARD_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" }, | 182 | { 0x263710b4, BTTV_BOARD_VOODOOTV_FM, "3Dfx VoodooTV FM" }, |
183 | { 0x3060121a, BTTV_BOARD_STB2, "3Dfx VoodooTV 100/ STB OEM" }, | 183 | { 0x3060121a, BTTV_BOARD_STB2, "3Dfx VoodooTV 100/ STB OEM" }, |
184 | 184 | ||
185 | { 0x3000144f, BTTV_BOARD_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" }, | 185 | { 0x3000144f, BTTV_BOARD_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" }, |
@@ -313,6 +313,7 @@ static struct CARD { | |||
313 | { 0xdb1118ac, BTTV_BOARD_DVICO_DVBT_LITE, "Ultraview DVB-T Lite" }, | 313 | { 0xdb1118ac, BTTV_BOARD_DVICO_DVBT_LITE, "Ultraview DVB-T Lite" }, |
314 | { 0xd50018ac, BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE, "DViCO FusionHDTV 5 Lite" }, | 314 | { 0xd50018ac, BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE, "DViCO FusionHDTV 5 Lite" }, |
315 | { 0x00261822, BTTV_BOARD_TWINHAN_DST, "DNTV Live! Mini "}, | 315 | { 0x00261822, BTTV_BOARD_TWINHAN_DST, "DNTV Live! Mini "}, |
316 | { 0xd200dbc0, BTTV_BOARD_DVICO_FUSIONHDTV_2, "DViCO FusionHDTV 2" }, | ||
316 | 317 | ||
317 | { 0, -1, NULL } | 318 | { 0, -1, NULL } |
318 | }; | 319 | }; |
@@ -329,7 +330,7 @@ struct tvcard bttv_tvcards[] = { | |||
329 | .tuner = 0, | 330 | .tuner = 0, |
330 | .svhs = 2, | 331 | .svhs = 2, |
331 | .muxsel = { 2, 3, 1, 0 }, | 332 | .muxsel = { 2, 3, 1, 0 }, |
332 | .tuner_type = -1, | 333 | .tuner_type = UNSET, |
333 | .tuner_addr = ADDR_UNSET, | 334 | .tuner_addr = ADDR_UNSET, |
334 | .radio_addr = ADDR_UNSET, | 335 | .radio_addr = ADDR_UNSET, |
335 | }, | 336 | }, |
@@ -344,7 +345,7 @@ struct tvcard bttv_tvcards[] = { | |||
344 | .gpiomux = { 2, 0, 0, 0 }, | 345 | .gpiomux = { 2, 0, 0, 0 }, |
345 | .gpiomute = 10, | 346 | .gpiomute = 10, |
346 | .needs_tvaudio = 1, | 347 | .needs_tvaudio = 1, |
347 | .tuner_type = -1, | 348 | .tuner_type = UNSET, |
348 | .tuner_addr = ADDR_UNSET, | 349 | .tuner_addr = ADDR_UNSET, |
349 | .radio_addr = ADDR_UNSET, | 350 | .radio_addr = ADDR_UNSET, |
350 | }, | 351 | }, |
@@ -359,7 +360,7 @@ struct tvcard bttv_tvcards[] = { | |||
359 | .gpiomux = { 0, 1, 2, 3 }, | 360 | .gpiomux = { 0, 1, 2, 3 }, |
360 | .gpiomute = 4, | 361 | .gpiomute = 4, |
361 | .needs_tvaudio = 1, | 362 | .needs_tvaudio = 1, |
362 | .tuner_type = -1, | 363 | .tuner_type = UNSET, |
363 | .tuner_addr = ADDR_UNSET, | 364 | .tuner_addr = ADDR_UNSET, |
364 | .radio_addr = ADDR_UNSET, | 365 | .radio_addr = ADDR_UNSET, |
365 | }, | 366 | }, |
@@ -387,13 +388,13 @@ struct tvcard bttv_tvcards[] = { | |||
387 | .name = "Intel Create and Share PCI/ Smart Video Recorder III", | 388 | .name = "Intel Create and Share PCI/ Smart Video Recorder III", |
388 | .video_inputs = 4, | 389 | .video_inputs = 4, |
389 | .audio_inputs = 0, | 390 | .audio_inputs = 0, |
390 | .tuner = -1, | 391 | .tuner = UNSET, |
391 | .svhs = 2, | 392 | .svhs = 2, |
392 | .gpiomask = 0, | 393 | .gpiomask = 0, |
393 | .muxsel = { 2, 3, 1, 1 }, | 394 | .muxsel = { 2, 3, 1, 1 }, |
394 | .gpiomux = { 0 }, | 395 | .gpiomux = { 0 }, |
395 | .needs_tvaudio = 0, | 396 | .needs_tvaudio = 0, |
396 | .tuner_type = 4, | 397 | .tuner_type = TUNER_ABSENT, |
397 | .tuner_addr = ADDR_UNSET, | 398 | .tuner_addr = ADDR_UNSET, |
398 | .radio_addr = ADDR_UNSET, | 399 | .radio_addr = ADDR_UNSET, |
399 | }, | 400 | }, |
@@ -408,7 +409,7 @@ struct tvcard bttv_tvcards[] = { | |||
408 | .gpiomux = { 0, 1, 0, 1 }, | 409 | .gpiomux = { 0, 1, 0, 1 }, |
409 | .gpiomute = 3, | 410 | .gpiomute = 3, |
410 | .needs_tvaudio = 1, | 411 | .needs_tvaudio = 1, |
411 | .tuner_type = -1, | 412 | .tuner_type = UNSET, |
412 | .tuner_addr = ADDR_UNSET, | 413 | .tuner_addr = ADDR_UNSET, |
413 | .radio_addr = ADDR_UNSET, | 414 | .radio_addr = ADDR_UNSET, |
414 | }, | 415 | }, |
@@ -423,7 +424,7 @@ struct tvcard bttv_tvcards[] = { | |||
423 | .gpiomux = { 0x0c, 0x04, 0x08, 0x04 }, | 424 | .gpiomux = { 0x0c, 0x04, 0x08, 0x04 }, |
424 | /* 0x04 for some cards ?? */ | 425 | /* 0x04 for some cards ?? */ |
425 | .needs_tvaudio = 1, | 426 | .needs_tvaudio = 1, |
426 | .tuner_type = -1, | 427 | .tuner_type = UNSET, |
427 | .tuner_addr = ADDR_UNSET, | 428 | .tuner_addr = ADDR_UNSET, |
428 | .radio_addr = ADDR_UNSET, | 429 | .radio_addr = ADDR_UNSET, |
429 | .audio_hook = avermedia_tvphone_audio, | 430 | .audio_hook = avermedia_tvphone_audio, |
@@ -433,13 +434,13 @@ struct tvcard bttv_tvcards[] = { | |||
433 | .name = "MATRIX-Vision MV-Delta", | 434 | .name = "MATRIX-Vision MV-Delta", |
434 | .video_inputs = 5, | 435 | .video_inputs = 5, |
435 | .audio_inputs = 1, | 436 | .audio_inputs = 1, |
436 | .tuner = -1, | 437 | .tuner = UNSET, |
437 | .svhs = 3, | 438 | .svhs = 3, |
438 | .gpiomask = 0, | 439 | .gpiomask = 0, |
439 | .muxsel = { 2, 3, 1, 0, 0 }, | 440 | .muxsel = { 2, 3, 1, 0, 0 }, |
440 | .gpiomux = { 0 }, | 441 | .gpiomux = { 0 }, |
441 | .needs_tvaudio = 1, | 442 | .needs_tvaudio = 1, |
442 | .tuner_type = -1, | 443 | .tuner_type = UNSET, |
443 | .tuner_addr = ADDR_UNSET, | 444 | .tuner_addr = ADDR_UNSET, |
444 | .radio_addr = ADDR_UNSET, | 445 | .radio_addr = ADDR_UNSET, |
445 | }, | 446 | }, |
@@ -457,7 +458,7 @@ struct tvcard bttv_tvcards[] = { | |||
457 | .gpiomute = 0xc00, | 458 | .gpiomute = 0xc00, |
458 | .needs_tvaudio = 1, | 459 | .needs_tvaudio = 1, |
459 | .pll = PLL_28, | 460 | .pll = PLL_28, |
460 | .tuner_type = -1, | 461 | .tuner_type = UNSET, |
461 | .tuner_addr = ADDR_UNSET, | 462 | .tuner_addr = ADDR_UNSET, |
462 | .radio_addr = ADDR_UNSET, | 463 | .radio_addr = ADDR_UNSET, |
463 | }, | 464 | }, |
@@ -488,7 +489,7 @@ struct tvcard bttv_tvcards[] = { | |||
488 | .gpiomute = 4, | 489 | .gpiomute = 4, |
489 | .needs_tvaudio = 1, | 490 | .needs_tvaudio = 1, |
490 | .pll = PLL_28, | 491 | .pll = PLL_28, |
491 | .tuner_type = -1, | 492 | .tuner_type = UNSET, |
492 | .tuner_addr = ADDR_UNSET, | 493 | .tuner_addr = ADDR_UNSET, |
493 | .radio_addr = ADDR_UNSET, | 494 | .radio_addr = ADDR_UNSET, |
494 | }, | 495 | }, |
@@ -503,7 +504,7 @@ struct tvcard bttv_tvcards[] = { | |||
503 | .gpiomux = { 0x20001,0x10001, 0, 0 }, | 504 | .gpiomux = { 0x20001,0x10001, 0, 0 }, |
504 | .gpiomute = 10, | 505 | .gpiomute = 10, |
505 | .needs_tvaudio = 1, | 506 | .needs_tvaudio = 1, |
506 | .tuner_type = -1, | 507 | .tuner_type = UNSET, |
507 | .tuner_addr = ADDR_UNSET, | 508 | .tuner_addr = ADDR_UNSET, |
508 | .radio_addr = ADDR_UNSET, | 509 | .radio_addr = ADDR_UNSET, |
509 | }, | 510 | }, |
@@ -519,7 +520,7 @@ struct tvcard bttv_tvcards[] = { | |||
519 | .muxsel = { 2, 3, 1, 1 }, | 520 | .muxsel = { 2, 3, 1, 1 }, |
520 | .gpiomux = { 13, 14, 11, 7 }, | 521 | .gpiomux = { 13, 14, 11, 7 }, |
521 | .needs_tvaudio = 1, | 522 | .needs_tvaudio = 1, |
522 | .tuner_type = -1, | 523 | .tuner_type = UNSET, |
523 | .tuner_addr = ADDR_UNSET, | 524 | .tuner_addr = ADDR_UNSET, |
524 | .radio_addr = ADDR_UNSET, | 525 | .radio_addr = ADDR_UNSET, |
525 | }, | 526 | }, |
@@ -553,7 +554,7 @@ struct tvcard bttv_tvcards[] = { | |||
553 | .gpiomute = 4, | 554 | .gpiomute = 4, |
554 | .needs_tvaudio = 1, | 555 | .needs_tvaudio = 1, |
555 | .pll = PLL_28, | 556 | .pll = PLL_28, |
556 | .tuner_type = -1, | 557 | .tuner_type = UNSET, |
557 | .tuner_addr = ADDR_UNSET, | 558 | .tuner_addr = ADDR_UNSET, |
558 | .radio_addr = ADDR_UNSET, | 559 | .radio_addr = ADDR_UNSET, |
559 | }, | 560 | }, |
@@ -568,7 +569,7 @@ struct tvcard bttv_tvcards[] = { | |||
568 | .gpiomux = { 0, 0, 1, 0 }, | 569 | .gpiomux = { 0, 0, 1, 0 }, |
569 | .gpiomute = 10, | 570 | .gpiomute = 10, |
570 | .needs_tvaudio = 1, | 571 | .needs_tvaudio = 1, |
571 | .tuner_type = -1, | 572 | .tuner_type = UNSET, |
572 | .tuner_addr = ADDR_UNSET, | 573 | .tuner_addr = ADDR_UNSET, |
573 | .radio_addr = ADDR_UNSET, | 574 | .radio_addr = ADDR_UNSET, |
574 | }, | 575 | }, |
@@ -587,7 +588,7 @@ struct tvcard bttv_tvcards[] = { | |||
587 | .gpiomute = 0x002000, | 588 | .gpiomute = 0x002000, |
588 | .needs_tvaudio = 1, | 589 | .needs_tvaudio = 1, |
589 | .pll = PLL_28, | 590 | .pll = PLL_28, |
590 | .tuner_type = -1, | 591 | .tuner_type = UNSET, |
591 | }, | 592 | }, |
592 | [BTTV_BOARD_WINVIEW_601] = { | 593 | [BTTV_BOARD_WINVIEW_601] = { |
593 | .name = "Leadtek WinView 601", | 594 | .name = "Leadtek WinView 601", |
@@ -600,7 +601,7 @@ struct tvcard bttv_tvcards[] = { | |||
600 | .gpiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007 }, | 601 | .gpiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007 }, |
601 | .gpiomute = 0xcfa007, | 602 | .gpiomute = 0xcfa007, |
602 | .needs_tvaudio = 1, | 603 | .needs_tvaudio = 1, |
603 | .tuner_type = -1, | 604 | .tuner_type = UNSET, |
604 | .tuner_addr = ADDR_UNSET, | 605 | .tuner_addr = ADDR_UNSET, |
605 | .radio_addr = ADDR_UNSET, | 606 | .radio_addr = ADDR_UNSET, |
606 | .audio_hook = winview_audio, | 607 | .audio_hook = winview_audio, |
@@ -616,7 +617,7 @@ struct tvcard bttv_tvcards[] = { | |||
616 | .muxsel = { 2, 3, 1, 1 }, | 617 | .muxsel = { 2, 3, 1, 1 }, |
617 | .gpiomux = { 1, 0, 0, 0 }, | 618 | .gpiomux = { 1, 0, 0, 0 }, |
618 | .needs_tvaudio = 1, | 619 | .needs_tvaudio = 1, |
619 | .tuner_type = -1, | 620 | .tuner_type = UNSET, |
620 | .tuner_addr = ADDR_UNSET, | 621 | .tuner_addr = ADDR_UNSET, |
621 | .radio_addr = ADDR_UNSET, | 622 | .radio_addr = ADDR_UNSET, |
622 | }, | 623 | }, |
@@ -624,13 +625,13 @@ struct tvcard bttv_tvcards[] = { | |||
624 | .name = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)", | 625 | .name = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)", |
625 | .video_inputs = 4, | 626 | .video_inputs = 4, |
626 | .audio_inputs = 1, | 627 | .audio_inputs = 1, |
627 | .tuner = -1, | 628 | .tuner = UNSET, |
628 | .svhs = -1, | 629 | .svhs = UNSET, |
629 | .gpiomask = 0x8dff00, | 630 | .gpiomask = 0x8dff00, |
630 | .muxsel = { 2, 3, 1, 1 }, | 631 | .muxsel = { 2, 3, 1, 1 }, |
631 | .gpiomux = { 0 }, | 632 | .gpiomux = { 0 }, |
632 | .no_msp34xx = 1, | 633 | .no_msp34xx = 1, |
633 | .tuner_type = -1, | 634 | .tuner_type = UNSET, |
634 | .tuner_addr = ADDR_UNSET, | 635 | .tuner_addr = ADDR_UNSET, |
635 | .radio_addr = ADDR_UNSET, | 636 | .radio_addr = ADDR_UNSET, |
636 | }, | 637 | }, |
@@ -643,7 +644,7 @@ struct tvcard bttv_tvcards[] = { | |||
643 | .tuner = 0, | 644 | .tuner = 0, |
644 | .svhs = 2, | 645 | .svhs = 2, |
645 | .muxsel = { 2, 3, 1, 1 }, | 646 | .muxsel = { 2, 3, 1, 1 }, |
646 | .tuner_type = -1, | 647 | .tuner_type = UNSET, |
647 | .tuner_addr = ADDR_UNSET, | 648 | .tuner_addr = ADDR_UNSET, |
648 | .radio_addr = ADDR_UNSET, | 649 | .radio_addr = ADDR_UNSET, |
649 | }, | 650 | }, |
@@ -674,7 +675,7 @@ struct tvcard bttv_tvcards[] = { | |||
674 | .gpiomute = 0xc00, | 675 | .gpiomute = 0xc00, |
675 | .needs_tvaudio = 1, | 676 | .needs_tvaudio = 1, |
676 | .pll = PLL_28, | 677 | .pll = PLL_28, |
677 | .tuner_type = -1, | 678 | .tuner_type = UNSET, |
678 | .tuner_addr = ADDR_UNSET, | 679 | .tuner_addr = ADDR_UNSET, |
679 | .radio_addr = ADDR_UNSET, | 680 | .radio_addr = ADDR_UNSET, |
680 | }, | 681 | }, |
@@ -683,7 +684,7 @@ struct tvcard bttv_tvcards[] = { | |||
683 | .video_inputs = 3, | 684 | .video_inputs = 3, |
684 | .audio_inputs = 1, | 685 | .audio_inputs = 1, |
685 | .tuner = 0, | 686 | .tuner = 0, |
686 | .svhs = -1, | 687 | .svhs = UNSET, |
687 | .gpiomask = 7, | 688 | .gpiomask = 7, |
688 | .muxsel = { 2, 3, -1 }, | 689 | .muxsel = { 2, 3, -1 }, |
689 | .digital_mode = DIGITAL_MODE_CAMERA, | 690 | .digital_mode = DIGITAL_MODE_CAMERA, |
@@ -708,7 +709,7 @@ struct tvcard bttv_tvcards[] = { | |||
708 | .gpiomute = 0xc00, | 709 | .gpiomute = 0xc00, |
709 | .needs_tvaudio = 1, | 710 | .needs_tvaudio = 1, |
710 | .pll = PLL_28, | 711 | .pll = PLL_28, |
711 | .tuner_type = -1, | 712 | .tuner_type = UNSET, |
712 | .tuner_addr = ADDR_UNSET, | 713 | .tuner_addr = ADDR_UNSET, |
713 | .radio_addr = ADDR_UNSET, | 714 | .radio_addr = ADDR_UNSET, |
714 | .has_remote = 1, | 715 | .has_remote = 1, |
@@ -740,7 +741,7 @@ struct tvcard bttv_tvcards[] = { | |||
740 | .gpiomux = { 0, 1, 2, 3 }, | 741 | .gpiomux = { 0, 1, 2, 3 }, |
741 | .gpiomute = 4, | 742 | .gpiomute = 4, |
742 | .needs_tvaudio = 1, | 743 | .needs_tvaudio = 1, |
743 | .tuner_type = -1, | 744 | .tuner_type = UNSET, |
744 | .tuner_addr = ADDR_UNSET, | 745 | .tuner_addr = ADDR_UNSET, |
745 | .radio_addr = ADDR_UNSET, | 746 | .radio_addr = ADDR_UNSET, |
746 | }, | 747 | }, |
@@ -813,13 +814,13 @@ struct tvcard bttv_tvcards[] = { | |||
813 | .name = "Imagenation PXC200", | 814 | .name = "Imagenation PXC200", |
814 | .video_inputs = 5, | 815 | .video_inputs = 5, |
815 | .audio_inputs = 1, | 816 | .audio_inputs = 1, |
816 | .tuner = -1, | 817 | .tuner = UNSET, |
817 | .svhs = 1, /* was: 4 */ | 818 | .svhs = 1, /* was: 4 */ |
818 | .gpiomask = 0, | 819 | .gpiomask = 0, |
819 | .muxsel = { 2, 3, 1, 0, 0}, | 820 | .muxsel = { 2, 3, 1, 0, 0}, |
820 | .gpiomux = { 0 }, | 821 | .gpiomux = { 0 }, |
821 | .needs_tvaudio = 1, | 822 | .needs_tvaudio = 1, |
822 | .tuner_type = -1, | 823 | .tuner_type = UNSET, |
823 | .tuner_addr = ADDR_UNSET, | 824 | .tuner_addr = ADDR_UNSET, |
824 | .radio_addr = ADDR_UNSET, | 825 | .radio_addr = ADDR_UNSET, |
825 | .muxsel_hook = PXC200_muxsel, | 826 | .muxsel_hook = PXC200_muxsel, |
@@ -836,7 +837,7 @@ struct tvcard bttv_tvcards[] = { | |||
836 | .gpiomux = { 0, 0x0800, 0x1000, 0x1000 }, | 837 | .gpiomux = { 0, 0x0800, 0x1000, 0x1000 }, |
837 | .gpiomute = 0x1800, | 838 | .gpiomute = 0x1800, |
838 | .pll = PLL_28, | 839 | .pll = PLL_28, |
839 | .tuner_type = -1, | 840 | .tuner_type = UNSET, |
840 | .tuner_addr = ADDR_UNSET, | 841 | .tuner_addr = ADDR_UNSET, |
841 | .radio_addr = ADDR_UNSET, | 842 | .radio_addr = ADDR_UNSET, |
842 | }, | 843 | }, |
@@ -860,13 +861,13 @@ struct tvcard bttv_tvcards[] = { | |||
860 | .name = "Intel Create and Share PCI/ Smart Video Recorder III", | 861 | .name = "Intel Create and Share PCI/ Smart Video Recorder III", |
861 | .video_inputs = 4, | 862 | .video_inputs = 4, |
862 | .audio_inputs = 0, | 863 | .audio_inputs = 0, |
863 | .tuner = -1, | 864 | .tuner = UNSET, |
864 | .svhs = 2, | 865 | .svhs = 2, |
865 | .gpiomask = 0, | 866 | .gpiomask = 0, |
866 | .muxsel = { 2, 3, 1, 1 }, | 867 | .muxsel = { 2, 3, 1, 1 }, |
867 | .gpiomux = { 0 }, | 868 | .gpiomux = { 0 }, |
868 | .needs_tvaudio = 0, | 869 | .needs_tvaudio = 0, |
869 | .tuner_type = 4, | 870 | .tuner_type = TUNER_ABSENT, |
870 | .tuner_addr = ADDR_UNSET, | 871 | .tuner_addr = ADDR_UNSET, |
871 | .radio_addr = ADDR_UNSET, | 872 | .radio_addr = ADDR_UNSET, |
872 | }, | 873 | }, |
@@ -911,7 +912,7 @@ struct tvcard bttv_tvcards[] = { | |||
911 | .needs_tvaudio = 0, | 912 | .needs_tvaudio = 0, |
912 | .pll = PLL_28, | 913 | .pll = PLL_28, |
913 | .has_radio = 1, | 914 | .has_radio = 1, |
914 | .tuner_type = 5, /* default for now, gpio reads BFFF06 for Pal bg+dk */ | 915 | .tuner_type = TUNER_PHILIPS_PAL, /* default for now, gpio reads BFFF06 for Pal bg+dk */ |
915 | .tuner_addr = ADDR_UNSET, | 916 | .tuner_addr = ADDR_UNSET, |
916 | .radio_addr = ADDR_UNSET, | 917 | .radio_addr = ADDR_UNSET, |
917 | .audio_hook = winfast2000_audio, | 918 | .audio_hook = winfast2000_audio, |
@@ -928,7 +929,7 @@ struct tvcard bttv_tvcards[] = { | |||
928 | .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, | 929 | .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, |
929 | .gpiomute = 0x1800, | 930 | .gpiomute = 0x1800, |
930 | .pll = PLL_28, | 931 | .pll = PLL_28, |
931 | .tuner_type = -1, | 932 | .tuner_type = UNSET, |
932 | .tuner_addr = ADDR_UNSET, | 933 | .tuner_addr = ADDR_UNSET, |
933 | .radio_addr = ADDR_UNSET, | 934 | .radio_addr = ADDR_UNSET, |
934 | }, | 935 | }, |
@@ -945,7 +946,7 @@ struct tvcard bttv_tvcards[] = { | |||
945 | .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, | 946 | .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, |
946 | .gpiomute = 0x1800, | 947 | .gpiomute = 0x1800, |
947 | .pll = PLL_28, | 948 | .pll = PLL_28, |
948 | .tuner_type = -1, | 949 | .tuner_type = UNSET, |
949 | .tuner_addr = ADDR_UNSET, | 950 | .tuner_addr = ADDR_UNSET, |
950 | .radio_addr = ADDR_UNSET, | 951 | .radio_addr = ADDR_UNSET, |
951 | .has_radio = 1, | 952 | .has_radio = 1, |
@@ -962,7 +963,7 @@ struct tvcard bttv_tvcards[] = { | |||
962 | .gpiomute = 0x29, | 963 | .gpiomute = 0x29, |
963 | .no_msp34xx = 1, | 964 | .no_msp34xx = 1, |
964 | .pll = PLL_28, | 965 | .pll = PLL_28, |
965 | .tuner_type = -1, | 966 | .tuner_type = UNSET, |
966 | .tuner_addr = ADDR_UNSET, | 967 | .tuner_addr = ADDR_UNSET, |
967 | .radio_addr = ADDR_UNSET, | 968 | .radio_addr = ADDR_UNSET, |
968 | }, | 969 | }, |
@@ -978,7 +979,7 @@ struct tvcard bttv_tvcards[] = { | |||
978 | .gpiomute = 0x551c00, | 979 | .gpiomute = 0x551c00, |
979 | .needs_tvaudio = 1, | 980 | .needs_tvaudio = 1, |
980 | .pll = PLL_28, | 981 | .pll = PLL_28, |
981 | .tuner_type = 1, | 982 | .tuner_type = TUNER_PHILIPS_PAL_I, |
982 | .tuner_addr = ADDR_UNSET, | 983 | .tuner_addr = ADDR_UNSET, |
983 | .radio_addr = ADDR_UNSET, | 984 | .radio_addr = ADDR_UNSET, |
984 | .has_remote = 1, | 985 | .has_remote = 1, |
@@ -995,7 +996,7 @@ struct tvcard bttv_tvcards[] = { | |||
995 | .gpiomute = 1, | 996 | .gpiomute = 1, |
996 | .needs_tvaudio = 0, | 997 | .needs_tvaudio = 0, |
997 | .pll = PLL_28, | 998 | .pll = PLL_28, |
998 | .tuner_type = -1, | 999 | .tuner_type = UNSET, |
999 | .tuner_addr = ADDR_UNSET, | 1000 | .tuner_addr = ADDR_UNSET, |
1000 | .radio_addr = ADDR_UNSET, | 1001 | .radio_addr = ADDR_UNSET, |
1001 | }, | 1002 | }, |
@@ -1030,7 +1031,7 @@ struct tvcard bttv_tvcards[] = { | |||
1030 | .gpiomux = { 13, 4, 11, 7 }, | 1031 | .gpiomux = { 13, 4, 11, 7 }, |
1031 | .needs_tvaudio = 1, | 1032 | .needs_tvaudio = 1, |
1032 | .pll = PLL_28, | 1033 | .pll = PLL_28, |
1033 | .tuner_type = -1, | 1034 | .tuner_type = UNSET, |
1034 | .tuner_addr = ADDR_UNSET, | 1035 | .tuner_addr = ADDR_UNSET, |
1035 | .radio_addr = ADDR_UNSET, | 1036 | .radio_addr = ADDR_UNSET, |
1036 | .has_radio = 1, | 1037 | .has_radio = 1, |
@@ -1048,7 +1049,7 @@ struct tvcard bttv_tvcards[] = { | |||
1048 | .needs_tvaudio = 1, | 1049 | .needs_tvaudio = 1, |
1049 | .no_msp34xx = 1, | 1050 | .no_msp34xx = 1, |
1050 | .pll = PLL_28, | 1051 | .pll = PLL_28, |
1051 | .tuner_type = 1, | 1052 | .tuner_type = TUNER_PHILIPS_PAL_I, |
1052 | .tuner_addr = ADDR_UNSET, | 1053 | .tuner_addr = ADDR_UNSET, |
1053 | .radio_addr = ADDR_UNSET, | 1054 | .radio_addr = ADDR_UNSET, |
1054 | }, | 1055 | }, |
@@ -1063,7 +1064,7 @@ struct tvcard bttv_tvcards[] = { | |||
1063 | .gpiomux = { 0xff9ff6, 0xff9ff6, 0xff1ff7, 0 }, | 1064 | .gpiomux = { 0xff9ff6, 0xff9ff6, 0xff1ff7, 0 }, |
1064 | .gpiomute = 0xff3ffc, | 1065 | .gpiomute = 0xff3ffc, |
1065 | .no_msp34xx = 1, | 1066 | .no_msp34xx = 1, |
1066 | .tuner_type = -1, | 1067 | .tuner_type = UNSET, |
1067 | .tuner_addr = ADDR_UNSET, | 1068 | .tuner_addr = ADDR_UNSET, |
1068 | .radio_addr = ADDR_UNSET, | 1069 | .radio_addr = ADDR_UNSET, |
1069 | }, | 1070 | }, |
@@ -1074,14 +1075,14 @@ struct tvcard bttv_tvcards[] = { | |||
1074 | .video_inputs = 2, | 1075 | .video_inputs = 2, |
1075 | .audio_inputs = 1, | 1076 | .audio_inputs = 1, |
1076 | .tuner = 0, | 1077 | .tuner = 0, |
1077 | .svhs = -1, | 1078 | .svhs = UNSET, |
1078 | .gpiomask = 3, | 1079 | .gpiomask = 3, |
1079 | .muxsel = { 2, 3, 1, 1 }, | 1080 | .muxsel = { 2, 3, 1, 1 }, |
1080 | .gpiomux = { 1, 1, 0, 2 }, | 1081 | .gpiomux = { 1, 1, 0, 2 }, |
1081 | .gpiomute = 3, | 1082 | .gpiomute = 3, |
1082 | .no_msp34xx = 1, | 1083 | .no_msp34xx = 1, |
1083 | .pll = PLL_NONE, | 1084 | .pll = PLL_NONE, |
1084 | .tuner_type = -1, | 1085 | .tuner_type = UNSET, |
1085 | .tuner_addr = ADDR_UNSET, | 1086 | .tuner_addr = ADDR_UNSET, |
1086 | .radio_addr = ADDR_UNSET, | 1087 | .radio_addr = ADDR_UNSET, |
1087 | }, | 1088 | }, |
@@ -1089,14 +1090,14 @@ struct tvcard bttv_tvcards[] = { | |||
1089 | .name = "MATRIX-Vision MV-Delta 2", | 1090 | .name = "MATRIX-Vision MV-Delta 2", |
1090 | .video_inputs = 5, | 1091 | .video_inputs = 5, |
1091 | .audio_inputs = 1, | 1092 | .audio_inputs = 1, |
1092 | .tuner = -1, | 1093 | .tuner = UNSET, |
1093 | .svhs = 3, | 1094 | .svhs = 3, |
1094 | .gpiomask = 0, | 1095 | .gpiomask = 0, |
1095 | .muxsel = { 2, 3, 1, 0, 0 }, | 1096 | .muxsel = { 2, 3, 1, 0, 0 }, |
1096 | .gpiomux = { 0 }, | 1097 | .gpiomux = { 0 }, |
1097 | .no_msp34xx = 1, | 1098 | .no_msp34xx = 1, |
1098 | .pll = PLL_28, | 1099 | .pll = PLL_28, |
1099 | .tuner_type = -1, | 1100 | .tuner_type = UNSET, |
1100 | .tuner_addr = ADDR_UNSET, | 1101 | .tuner_addr = ADDR_UNSET, |
1101 | .radio_addr = ADDR_UNSET, | 1102 | .radio_addr = ADDR_UNSET, |
1102 | }, | 1103 | }, |
@@ -1112,7 +1113,7 @@ struct tvcard bttv_tvcards[] = { | |||
1112 | .gpiomute = 0xbcb03f, | 1113 | .gpiomute = 0xbcb03f, |
1113 | .no_msp34xx = 1, | 1114 | .no_msp34xx = 1, |
1114 | .pll = PLL_28, | 1115 | .pll = PLL_28, |
1115 | .tuner_type = 21, | 1116 | .tuner_type = TUNER_TEMIC_4039FR5_NTSC, |
1116 | .tuner_addr = ADDR_UNSET, | 1117 | .tuner_addr = ADDR_UNSET, |
1117 | .radio_addr = ADDR_UNSET, | 1118 | .radio_addr = ADDR_UNSET, |
1118 | }, | 1119 | }, |
@@ -1129,7 +1130,7 @@ struct tvcard bttv_tvcards[] = { | |||
1129 | .needs_tvaudio = 1, | 1130 | .needs_tvaudio = 1, |
1130 | .no_msp34xx = 1, | 1131 | .no_msp34xx = 1, |
1131 | .pll = PLL_35, | 1132 | .pll = PLL_35, |
1132 | .tuner_type = 1, | 1133 | .tuner_type = TUNER_PHILIPS_PAL_I, |
1133 | .tuner_addr = ADDR_UNSET, | 1134 | .tuner_addr = ADDR_UNSET, |
1134 | .radio_addr = ADDR_UNSET, | 1135 | .radio_addr = ADDR_UNSET, |
1135 | .has_radio = 1, | 1136 | .has_radio = 1, |
@@ -1148,7 +1149,7 @@ struct tvcard bttv_tvcards[] = { | |||
1148 | .gpiomute = 1, | 1149 | .gpiomute = 1, |
1149 | .needs_tvaudio = 1, | 1150 | .needs_tvaudio = 1, |
1150 | .pll = PLL_28, | 1151 | .pll = PLL_28, |
1151 | .tuner_type = -1, | 1152 | .tuner_type = UNSET, |
1152 | .tuner_addr = ADDR_UNSET, | 1153 | .tuner_addr = ADDR_UNSET, |
1153 | .radio_addr = ADDR_UNSET, | 1154 | .radio_addr = ADDR_UNSET, |
1154 | }, | 1155 | }, |
@@ -1206,7 +1207,7 @@ struct tvcard bttv_tvcards[] = { | |||
1206 | .gpiomux = { 0, 1, 2, 3 }, | 1207 | .gpiomux = { 0, 1, 2, 3 }, |
1207 | .gpiomute = 4, | 1208 | .gpiomute = 4, |
1208 | .pll = PLL_28, | 1209 | .pll = PLL_28, |
1209 | .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */, | 1210 | .tuner_type = UNSET /* TUNER_ALPS_TMDH2_NTSC */, |
1210 | .tuner_addr = ADDR_UNSET, | 1211 | .tuner_addr = ADDR_UNSET, |
1211 | .radio_addr = ADDR_UNSET, | 1212 | .radio_addr = ADDR_UNSET, |
1212 | }, | 1213 | }, |
@@ -1234,7 +1235,7 @@ struct tvcard bttv_tvcards[] = { | |||
1234 | 1= FM stereo Radio from Tuner */ | 1235 | 1= FM stereo Radio from Tuner */ |
1235 | .needs_tvaudio = 0, | 1236 | .needs_tvaudio = 0, |
1236 | .pll = PLL_28, | 1237 | .pll = PLL_28, |
1237 | .tuner_type = -1, | 1238 | .tuner_type = UNSET, |
1238 | .tuner_addr = ADDR_UNSET, | 1239 | .tuner_addr = ADDR_UNSET, |
1239 | .radio_addr = ADDR_UNSET, | 1240 | .radio_addr = ADDR_UNSET, |
1240 | }, | 1241 | }, |
@@ -1277,7 +1278,7 @@ struct tvcard bttv_tvcards[] = { | |||
1277 | 0x0080: Tuner A2 SAP (second audio program = Zweikanalton) | 1278 | 0x0080: Tuner A2 SAP (second audio program = Zweikanalton) |
1278 | 0x0880: Tuner A2 stereo */ | 1279 | 0x0880: Tuner A2 stereo */ |
1279 | .pll = PLL_28, | 1280 | .pll = PLL_28, |
1280 | .tuner_type = -1, | 1281 | .tuner_type = UNSET, |
1281 | .tuner_addr = ADDR_UNSET, | 1282 | .tuner_addr = ADDR_UNSET, |
1282 | .radio_addr = ADDR_UNSET, | 1283 | .radio_addr = ADDR_UNSET, |
1283 | }, | 1284 | }, |
@@ -1313,7 +1314,7 @@ struct tvcard bttv_tvcards[] = { | |||
1313 | .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, | 1314 | .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, |
1314 | .gpiomute = 0x1800, | 1315 | .gpiomute = 0x1800, |
1315 | .pll = PLL_28, | 1316 | .pll = PLL_28, |
1316 | .tuner_type = 5, | 1317 | .tuner_type = TUNER_PHILIPS_PAL, |
1317 | .tuner_addr = ADDR_UNSET, | 1318 | .tuner_addr = ADDR_UNSET, |
1318 | .radio_addr = ADDR_UNSET, | 1319 | .radio_addr = ADDR_UNSET, |
1319 | }, | 1320 | }, |
@@ -1324,7 +1325,7 @@ struct tvcard bttv_tvcards[] = { | |||
1324 | .name = "GrandTec 'Grand Video Capture' (Bt848)", | 1325 | .name = "GrandTec 'Grand Video Capture' (Bt848)", |
1325 | .video_inputs = 2, | 1326 | .video_inputs = 2, |
1326 | .audio_inputs = 0, | 1327 | .audio_inputs = 0, |
1327 | .tuner = -1, | 1328 | .tuner = UNSET, |
1328 | .svhs = 1, | 1329 | .svhs = 1, |
1329 | .gpiomask = 0, | 1330 | .gpiomask = 0, |
1330 | .muxsel = { 3, 1 }, | 1331 | .muxsel = { 3, 1 }, |
@@ -1332,7 +1333,7 @@ struct tvcard bttv_tvcards[] = { | |||
1332 | .needs_tvaudio = 0, | 1333 | .needs_tvaudio = 0, |
1333 | .no_msp34xx = 1, | 1334 | .no_msp34xx = 1, |
1334 | .pll = PLL_35, | 1335 | .pll = PLL_35, |
1335 | .tuner_type = -1, | 1336 | .tuner_type = UNSET, |
1336 | .tuner_addr = ADDR_UNSET, | 1337 | .tuner_addr = ADDR_UNSET, |
1337 | .radio_addr = ADDR_UNSET, | 1338 | .radio_addr = ADDR_UNSET, |
1338 | }, | 1339 | }, |
@@ -1365,7 +1366,7 @@ struct tvcard bttv_tvcards[] = { | |||
1365 | .gpiomux = { 2, 0, 0, 0 }, | 1366 | .gpiomux = { 2, 0, 0, 0 }, |
1366 | .gpiomute = 1, | 1367 | .gpiomute = 1, |
1367 | .pll = PLL_28, | 1368 | .pll = PLL_28, |
1368 | .tuner_type = 0, | 1369 | .tuner_type = TUNER_TEMIC_PAL, |
1369 | .tuner_addr = ADDR_UNSET, | 1370 | .tuner_addr = ADDR_UNSET, |
1370 | .radio_addr = ADDR_UNSET, | 1371 | .radio_addr = ADDR_UNSET, |
1371 | }, | 1372 | }, |
@@ -1377,7 +1378,7 @@ struct tvcard bttv_tvcards[] = { | |||
1377 | .video_inputs = 2, | 1378 | .video_inputs = 2, |
1378 | .audio_inputs = 2, | 1379 | .audio_inputs = 2, |
1379 | .tuner = 0, | 1380 | .tuner = 0, |
1380 | .svhs = -1, | 1381 | .svhs = UNSET, |
1381 | .gpiomask = 11, | 1382 | .gpiomask = 11, |
1382 | .muxsel = { 2, 3, 1, 1 }, | 1383 | .muxsel = { 2, 3, 1, 1 }, |
1383 | .gpiomux = { 2, 0, 0, 1 }, | 1384 | .gpiomux = { 2, 0, 0, 1 }, |
@@ -1392,7 +1393,7 @@ struct tvcard bttv_tvcards[] = { | |||
1392 | .name = "AG Electronics GMV1", | 1393 | .name = "AG Electronics GMV1", |
1393 | .video_inputs = 2, | 1394 | .video_inputs = 2, |
1394 | .audio_inputs = 0, | 1395 | .audio_inputs = 0, |
1395 | .tuner = -1, | 1396 | .tuner = UNSET, |
1396 | .svhs = 1, | 1397 | .svhs = 1, |
1397 | .gpiomask = 0xF, | 1398 | .gpiomask = 0xF, |
1398 | .muxsel = { 2, 2 }, | 1399 | .muxsel = { 2, 2 }, |
@@ -1400,7 +1401,7 @@ struct tvcard bttv_tvcards[] = { | |||
1400 | .no_msp34xx = 1, | 1401 | .no_msp34xx = 1, |
1401 | .needs_tvaudio = 0, | 1402 | .needs_tvaudio = 0, |
1402 | .pll = PLL_28, | 1403 | .pll = PLL_28, |
1403 | .tuner_type = -1, | 1404 | .tuner_type = UNSET, |
1404 | .tuner_addr = ADDR_UNSET, | 1405 | .tuner_addr = ADDR_UNSET, |
1405 | .radio_addr = ADDR_UNSET, | 1406 | .radio_addr = ADDR_UNSET, |
1406 | }, | 1407 | }, |
@@ -1447,7 +1448,7 @@ struct tvcard bttv_tvcards[] = { | |||
1447 | .video_inputs = 2, | 1448 | .video_inputs = 2, |
1448 | .audio_inputs = 1, | 1449 | .audio_inputs = 1, |
1449 | .tuner = 0, | 1450 | .tuner = 0, |
1450 | .svhs = -1, | 1451 | .svhs = UNSET, |
1451 | .gpiomask = 1, | 1452 | .gpiomask = 1, |
1452 | .muxsel = { 2, 3, 0, 1 }, | 1453 | .muxsel = { 2, 3, 0, 1 }, |
1453 | .gpiomux = { 0, 0, 1, 0 }, | 1454 | .gpiomux = { 0, 0, 1, 0 }, |
@@ -1476,7 +1477,7 @@ struct tvcard bttv_tvcards[] = { | |||
1476 | .no_tda9875 = 1, | 1477 | .no_tda9875 = 1, |
1477 | .needs_tvaudio = 1, | 1478 | .needs_tvaudio = 1, |
1478 | .pll = PLL_28, | 1479 | .pll = PLL_28, |
1479 | .tuner_type = 5, | 1480 | .tuner_type = TUNER_PHILIPS_PAL, |
1480 | .tuner_addr = ADDR_UNSET, | 1481 | .tuner_addr = ADDR_UNSET, |
1481 | .radio_addr = ADDR_UNSET, | 1482 | .radio_addr = ADDR_UNSET, |
1482 | }, | 1483 | }, |
@@ -1517,13 +1518,35 @@ struct tvcard bttv_tvcards[] = { | |||
1517 | 1518 | ||
1518 | /* ---- card 0x44 ---------------------------------- */ | 1519 | /* ---- card 0x44 ---------------------------------- */ |
1519 | [BTTV_BOARD_VOODOOTV_FM] = { | 1520 | [BTTV_BOARD_VOODOOTV_FM] = { |
1520 | .name = "3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA)", | 1521 | .name = "3Dfx VoodooTV FM (Euro)", |
1522 | /* try "insmod msp3400 simple=0" if you have | ||
1523 | * sound problems with this card. */ | ||
1524 | .video_inputs = 4, | ||
1525 | .audio_inputs = 1, | ||
1526 | .tuner = 0, | ||
1527 | .svhs = UNSET, | ||
1528 | .gpiomask = 0x4f8a00, | ||
1529 | /* 0x100000: 1=MSP enabled (0=disable again) | ||
1530 | * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */ | ||
1531 | .gpiomux = {0x947fff, 0x987fff,0x947fff,0x947fff }, | ||
1532 | .gpiomute = 0x947fff, | ||
1533 | /* tvtuner, radio, external,internal, mute, stereo | ||
1534 | * tuner, Composit, SVid, Composit-on-Svid-adapter */ | ||
1535 | .muxsel = { 2, 3 ,0 ,1 }, | ||
1536 | .tuner_type = TUNER_MT2032, | ||
1537 | .tuner_addr = ADDR_UNSET, | ||
1538 | .radio_addr = ADDR_UNSET, | ||
1539 | .pll = PLL_28, | ||
1540 | .has_radio = 1, | ||
1541 | }, | ||
1542 | [BTTV_BOARD_VOODOOTV_200] = { | ||
1543 | .name = "VoodooTV 200 (USA)", | ||
1521 | /* try "insmod msp3400 simple=0" if you have | 1544 | /* try "insmod msp3400 simple=0" if you have |
1522 | * sound problems with this card. */ | 1545 | * sound problems with this card. */ |
1523 | .video_inputs = 4, | 1546 | .video_inputs = 4, |
1524 | .audio_inputs = 1, | 1547 | .audio_inputs = 1, |
1525 | .tuner = 0, | 1548 | .tuner = 0, |
1526 | .svhs = -1, | 1549 | .svhs = UNSET, |
1527 | .gpiomask = 0x4f8a00, | 1550 | .gpiomask = 0x4f8a00, |
1528 | /* 0x100000: 1=MSP enabled (0=disable again) | 1551 | /* 0x100000: 1=MSP enabled (0=disable again) |
1529 | * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */ | 1552 | * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */ |
@@ -1543,8 +1566,8 @@ struct tvcard bttv_tvcards[] = { | |||
1543 | .name = "Active Imaging AIMMS", | 1566 | .name = "Active Imaging AIMMS", |
1544 | .video_inputs = 1, | 1567 | .video_inputs = 1, |
1545 | .audio_inputs = 0, | 1568 | .audio_inputs = 0, |
1546 | .tuner = -1, | 1569 | .tuner = UNSET, |
1547 | .tuner_type = -1, | 1570 | .tuner_type = UNSET, |
1548 | .tuner_addr = ADDR_UNSET, | 1571 | .tuner_addr = ADDR_UNSET, |
1549 | .radio_addr = ADDR_UNSET, | 1572 | .radio_addr = ADDR_UNSET, |
1550 | .pll = PLL_28, | 1573 | .pll = PLL_28, |
@@ -1564,7 +1587,7 @@ struct tvcard bttv_tvcards[] = { | |||
1564 | .gpiomute = 13, | 1587 | .gpiomute = 13, |
1565 | .needs_tvaudio = 1, | 1588 | .needs_tvaudio = 1, |
1566 | .pll = PLL_28, | 1589 | .pll = PLL_28, |
1567 | .tuner_type = 25, | 1590 | .tuner_type = TUNER_LG_PAL_I_FM, |
1568 | .tuner_addr = ADDR_UNSET, | 1591 | .tuner_addr = ADDR_UNSET, |
1569 | .radio_addr = ADDR_UNSET, | 1592 | .radio_addr = ADDR_UNSET, |
1570 | .has_remote = 1, | 1593 | .has_remote = 1, |
@@ -1580,7 +1603,7 @@ struct tvcard bttv_tvcards[] = { | |||
1580 | .name = "Lifeview FlyVideo 98EZ (capture only) LR51", | 1603 | .name = "Lifeview FlyVideo 98EZ (capture only) LR51", |
1581 | .video_inputs = 4, | 1604 | .video_inputs = 4, |
1582 | .audio_inputs = 0, | 1605 | .audio_inputs = 0, |
1583 | .tuner = -1, | 1606 | .tuner = UNSET, |
1584 | .svhs = 2, | 1607 | .svhs = 2, |
1585 | .muxsel = { 2, 3, 1, 1 }, /* AV1, AV2, SVHS, CVid adapter on SVHS */ | 1608 | .muxsel = { 2, 3, 1, 1 }, /* AV1, AV2, SVHS, CVid adapter on SVHS */ |
1586 | .pll = PLL_28, | 1609 | .pll = PLL_28, |
@@ -1606,7 +1629,7 @@ struct tvcard bttv_tvcards[] = { | |||
1606 | .no_msp34xx = 1, | 1629 | .no_msp34xx = 1, |
1607 | .no_tda9875 = 1, | 1630 | .no_tda9875 = 1, |
1608 | .pll = PLL_28, | 1631 | .pll = PLL_28, |
1609 | .tuner_type = 5, | 1632 | .tuner_type = TUNER_PHILIPS_PAL, |
1610 | .tuner_addr = ADDR_UNSET, | 1633 | .tuner_addr = ADDR_UNSET, |
1611 | .radio_addr = ADDR_UNSET, | 1634 | .radio_addr = ADDR_UNSET, |
1612 | .audio_hook = pvbt878p9b_audio, /* Note: not all cards have stereo */ | 1635 | .audio_hook = pvbt878p9b_audio, /* Note: not all cards have stereo */ |
@@ -1626,13 +1649,13 @@ struct tvcard bttv_tvcards[] = { | |||
1626 | .name = "Sensoray 311", | 1649 | .name = "Sensoray 311", |
1627 | .video_inputs = 5, | 1650 | .video_inputs = 5, |
1628 | .audio_inputs = 0, | 1651 | .audio_inputs = 0, |
1629 | .tuner = -1, | 1652 | .tuner = UNSET, |
1630 | .svhs = 4, | 1653 | .svhs = 4, |
1631 | .gpiomask = 0, | 1654 | .gpiomask = 0, |
1632 | .muxsel = { 2, 3, 1, 0, 0 }, | 1655 | .muxsel = { 2, 3, 1, 0, 0 }, |
1633 | .gpiomux = { 0 }, | 1656 | .gpiomux = { 0 }, |
1634 | .needs_tvaudio = 0, | 1657 | .needs_tvaudio = 0, |
1635 | .tuner_type = -1, | 1658 | .tuner_type = UNSET, |
1636 | .tuner_addr = ADDR_UNSET, | 1659 | .tuner_addr = ADDR_UNSET, |
1637 | .radio_addr = ADDR_UNSET, | 1660 | .radio_addr = ADDR_UNSET, |
1638 | }, | 1661 | }, |
@@ -1641,15 +1664,15 @@ struct tvcard bttv_tvcards[] = { | |||
1641 | .name = "RemoteVision MX (RV605)", | 1664 | .name = "RemoteVision MX (RV605)", |
1642 | .video_inputs = 16, | 1665 | .video_inputs = 16, |
1643 | .audio_inputs = 0, | 1666 | .audio_inputs = 0, |
1644 | .tuner = -1, | 1667 | .tuner = UNSET, |
1645 | .svhs = -1, | 1668 | .svhs = UNSET, |
1646 | .gpiomask = 0x00, | 1669 | .gpiomask = 0x00, |
1647 | .gpiomask2 = 0x07ff, | 1670 | .gpiomask2 = 0x07ff, |
1648 | .muxsel = { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03, | 1671 | .muxsel = { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03, |
1649 | 0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 }, | 1672 | 0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 }, |
1650 | .no_msp34xx = 1, | 1673 | .no_msp34xx = 1, |
1651 | .no_tda9875 = 1, | 1674 | .no_tda9875 = 1, |
1652 | .tuner_type = -1, | 1675 | .tuner_type = UNSET, |
1653 | .tuner_addr = ADDR_UNSET, | 1676 | .tuner_addr = ADDR_UNSET, |
1654 | .radio_addr = ADDR_UNSET, | 1677 | .radio_addr = ADDR_UNSET, |
1655 | .muxsel_hook = rv605_muxsel, | 1678 | .muxsel_hook = rv605_muxsel, |
@@ -1693,15 +1716,15 @@ struct tvcard bttv_tvcards[] = { | |||
1693 | .name = "GrandTec Multi Capture Card (Bt878)", | 1716 | .name = "GrandTec Multi Capture Card (Bt878)", |
1694 | .video_inputs = 4, | 1717 | .video_inputs = 4, |
1695 | .audio_inputs = 0, | 1718 | .audio_inputs = 0, |
1696 | .tuner = -1, | 1719 | .tuner = UNSET, |
1697 | .svhs = -1, | 1720 | .svhs = UNSET, |
1698 | .gpiomask = 0, | 1721 | .gpiomask = 0, |
1699 | .muxsel = { 2, 3, 1, 0 }, | 1722 | .muxsel = { 2, 3, 1, 0 }, |
1700 | .gpiomux = { 0 }, | 1723 | .gpiomux = { 0 }, |
1701 | .needs_tvaudio = 0, | 1724 | .needs_tvaudio = 0, |
1702 | .no_msp34xx = 1, | 1725 | .no_msp34xx = 1, |
1703 | .pll = PLL_28, | 1726 | .pll = PLL_28, |
1704 | .tuner_type = -1, | 1727 | .tuner_type = UNSET, |
1705 | .tuner_addr = ADDR_UNSET, | 1728 | .tuner_addr = ADDR_UNSET, |
1706 | .radio_addr = ADDR_UNSET, | 1729 | .radio_addr = ADDR_UNSET, |
1707 | }, | 1730 | }, |
@@ -1724,7 +1747,7 @@ struct tvcard bttv_tvcards[] = { | |||
1724 | .needs_tvaudio = 0, | 1747 | .needs_tvaudio = 0, |
1725 | .no_msp34xx = 1, | 1748 | .no_msp34xx = 1, |
1726 | .pll = PLL_28, | 1749 | .pll = PLL_28, |
1727 | .tuner_type = 5, | 1750 | .tuner_type = TUNER_PHILIPS_PAL, |
1728 | .tuner_addr = ADDR_UNSET, | 1751 | .tuner_addr = ADDR_UNSET, |
1729 | .radio_addr = ADDR_UNSET, | 1752 | .radio_addr = ADDR_UNSET, |
1730 | /* Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and | 1753 | /* Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and |
@@ -1744,10 +1767,10 @@ struct tvcard bttv_tvcards[] = { | |||
1744 | /* Arthur Tetzlaff-Deas, DSP Design Ltd <software@dspdesign.com> */ | 1767 | /* Arthur Tetzlaff-Deas, DSP Design Ltd <software@dspdesign.com> */ |
1745 | .name = "DSP Design TCVIDEO", | 1768 | .name = "DSP Design TCVIDEO", |
1746 | .video_inputs = 4, | 1769 | .video_inputs = 4, |
1747 | .svhs = -1, | 1770 | .svhs = UNSET, |
1748 | .muxsel = { 2, 3, 1, 0 }, | 1771 | .muxsel = { 2, 3, 1, 0 }, |
1749 | .pll = PLL_28, | 1772 | .pll = PLL_28, |
1750 | .tuner_type = -1, | 1773 | .tuner_type = UNSET, |
1751 | .tuner_addr = ADDR_UNSET, | 1774 | .tuner_addr = ADDR_UNSET, |
1752 | .radio_addr = ADDR_UNSET, | 1775 | .radio_addr = ADDR_UNSET, |
1753 | }, | 1776 | }, |
@@ -1762,7 +1785,7 @@ struct tvcard bttv_tvcards[] = { | |||
1762 | .muxsel = { 2, 0, 1, 1 }, | 1785 | .muxsel = { 2, 0, 1, 1 }, |
1763 | .needs_tvaudio = 1, | 1786 | .needs_tvaudio = 1, |
1764 | .pll = PLL_28, | 1787 | .pll = PLL_28, |
1765 | .tuner_type = -1, | 1788 | .tuner_type = UNSET, |
1766 | .tuner_addr = ADDR_UNSET, | 1789 | .tuner_addr = ADDR_UNSET, |
1767 | .radio_addr = ADDR_UNSET, | 1790 | .radio_addr = ADDR_UNSET, |
1768 | 1791 | ||
@@ -1791,11 +1814,11 @@ struct tvcard bttv_tvcards[] = { | |||
1791 | .name = "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */ | 1814 | .name = "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */ |
1792 | .video_inputs = 4, /* id-inputs-clock */ | 1815 | .video_inputs = 4, /* id-inputs-clock */ |
1793 | .audio_inputs = 0, | 1816 | .audio_inputs = 0, |
1794 | .tuner = -1, | 1817 | .tuner = UNSET, |
1795 | .svhs = 3, | 1818 | .svhs = 3, |
1796 | .muxsel = { 3, 2, 0, 1 }, | 1819 | .muxsel = { 3, 2, 0, 1 }, |
1797 | .pll = PLL_28, | 1820 | .pll = PLL_28, |
1798 | .tuner_type = -1, | 1821 | .tuner_type = UNSET, |
1799 | .tuner_addr = ADDR_UNSET, | 1822 | .tuner_addr = ADDR_UNSET, |
1800 | .radio_addr = ADDR_UNSET, | 1823 | .radio_addr = ADDR_UNSET, |
1801 | .no_msp34xx = 1, | 1824 | .no_msp34xx = 1, |
@@ -1806,11 +1829,11 @@ struct tvcard bttv_tvcards[] = { | |||
1806 | .name = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */ | 1829 | .name = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */ |
1807 | .video_inputs = 3, | 1830 | .video_inputs = 3, |
1808 | .audio_inputs = 0, | 1831 | .audio_inputs = 0, |
1809 | .tuner = -1, | 1832 | .tuner = UNSET, |
1810 | .svhs = 2, | 1833 | .svhs = 2, |
1811 | .muxsel = { 2, 3, 1 }, | 1834 | .muxsel = { 2, 3, 1 }, |
1812 | .pll = PLL_28, | 1835 | .pll = PLL_28, |
1813 | .tuner_type = -1, | 1836 | .tuner_type = UNSET, |
1814 | .tuner_addr = ADDR_UNSET, | 1837 | .tuner_addr = ADDR_UNSET, |
1815 | .radio_addr = ADDR_UNSET, | 1838 | .radio_addr = ADDR_UNSET, |
1816 | .no_msp34xx = 1, | 1839 | .no_msp34xx = 1, |
@@ -1823,11 +1846,11 @@ struct tvcard bttv_tvcards[] = { | |||
1823 | .name = "Osprey 101 (848)", /* 0x05-40C0-C1 */ | 1846 | .name = "Osprey 101 (848)", /* 0x05-40C0-C1 */ |
1824 | .video_inputs = 2, | 1847 | .video_inputs = 2, |
1825 | .audio_inputs = 0, | 1848 | .audio_inputs = 0, |
1826 | .tuner = -1, | 1849 | .tuner = UNSET, |
1827 | .svhs = 1, | 1850 | .svhs = 1, |
1828 | .muxsel = { 3, 1 }, | 1851 | .muxsel = { 3, 1 }, |
1829 | .pll = PLL_28, | 1852 | .pll = PLL_28, |
1830 | .tuner_type = -1, | 1853 | .tuner_type = UNSET, |
1831 | .tuner_addr = ADDR_UNSET, | 1854 | .tuner_addr = ADDR_UNSET, |
1832 | .radio_addr = ADDR_UNSET, | 1855 | .radio_addr = ADDR_UNSET, |
1833 | .no_msp34xx = 1, | 1856 | .no_msp34xx = 1, |
@@ -1838,11 +1861,11 @@ struct tvcard bttv_tvcards[] = { | |||
1838 | .name = "Osprey 101/151", /* 0x1(4|5)-0004-C4 */ | 1861 | .name = "Osprey 101/151", /* 0x1(4|5)-0004-C4 */ |
1839 | .video_inputs = 1, | 1862 | .video_inputs = 1, |
1840 | .audio_inputs = 0, | 1863 | .audio_inputs = 0, |
1841 | .tuner = -1, | 1864 | .tuner = UNSET, |
1842 | .svhs = -1, | 1865 | .svhs = UNSET, |
1843 | .muxsel = { 0 }, | 1866 | .muxsel = { 0 }, |
1844 | .pll = PLL_28, | 1867 | .pll = PLL_28, |
1845 | .tuner_type = -1, | 1868 | .tuner_type = UNSET, |
1846 | .tuner_addr = ADDR_UNSET, | 1869 | .tuner_addr = ADDR_UNSET, |
1847 | .radio_addr = ADDR_UNSET, | 1870 | .radio_addr = ADDR_UNSET, |
1848 | .no_msp34xx = 1, | 1871 | .no_msp34xx = 1, |
@@ -1853,11 +1876,11 @@ struct tvcard bttv_tvcards[] = { | |||
1853 | .name = "Osprey 101/151 w/ svid", /* 0x(16|17|20)-00C4-C1 */ | 1876 | .name = "Osprey 101/151 w/ svid", /* 0x(16|17|20)-00C4-C1 */ |
1854 | .video_inputs = 2, | 1877 | .video_inputs = 2, |
1855 | .audio_inputs = 0, | 1878 | .audio_inputs = 0, |
1856 | .tuner = -1, | 1879 | .tuner = UNSET, |
1857 | .svhs = 1, | 1880 | .svhs = 1, |
1858 | .muxsel = { 0, 1 }, | 1881 | .muxsel = { 0, 1 }, |
1859 | .pll = PLL_28, | 1882 | .pll = PLL_28, |
1860 | .tuner_type = -1, | 1883 | .tuner_type = UNSET, |
1861 | .tuner_addr = ADDR_UNSET, | 1884 | .tuner_addr = ADDR_UNSET, |
1862 | .radio_addr = ADDR_UNSET, | 1885 | .radio_addr = ADDR_UNSET, |
1863 | .no_msp34xx = 1, | 1886 | .no_msp34xx = 1, |
@@ -1868,8 +1891,8 @@ struct tvcard bttv_tvcards[] = { | |||
1868 | .name = "Osprey 200/201/250/251", /* 0x1(8|9|E|F)-0004-C4 */ | 1891 | .name = "Osprey 200/201/250/251", /* 0x1(8|9|E|F)-0004-C4 */ |
1869 | .video_inputs = 1, | 1892 | .video_inputs = 1, |
1870 | .audio_inputs = 1, | 1893 | .audio_inputs = 1, |
1871 | .tuner = -1, | 1894 | .tuner = UNSET, |
1872 | .svhs = -1, | 1895 | .svhs = UNSET, |
1873 | .muxsel = { 0 }, | 1896 | .muxsel = { 0 }, |
1874 | .pll = PLL_28, | 1897 | .pll = PLL_28, |
1875 | .tuner_type = UNSET, | 1898 | .tuner_type = UNSET, |
@@ -1885,7 +1908,7 @@ struct tvcard bttv_tvcards[] = { | |||
1885 | .name = "Osprey 200/250", /* 0x1(A|B)-00C4-C1 */ | 1908 | .name = "Osprey 200/250", /* 0x1(A|B)-00C4-C1 */ |
1886 | .video_inputs = 2, | 1909 | .video_inputs = 2, |
1887 | .audio_inputs = 1, | 1910 | .audio_inputs = 1, |
1888 | .tuner = -1, | 1911 | .tuner = UNSET, |
1889 | .svhs = 1, | 1912 | .svhs = 1, |
1890 | .muxsel = { 0, 1 }, | 1913 | .muxsel = { 0, 1 }, |
1891 | .pll = PLL_28, | 1914 | .pll = PLL_28, |
@@ -1900,7 +1923,7 @@ struct tvcard bttv_tvcards[] = { | |||
1900 | .name = "Osprey 210/220/230", /* 0x1(A|B)-04C0-C1 */ | 1923 | .name = "Osprey 210/220/230", /* 0x1(A|B)-04C0-C1 */ |
1901 | .video_inputs = 2, | 1924 | .video_inputs = 2, |
1902 | .audio_inputs = 1, | 1925 | .audio_inputs = 1, |
1903 | .tuner = -1, | 1926 | .tuner = UNSET, |
1904 | .svhs = 1, | 1927 | .svhs = 1, |
1905 | .muxsel = { 2, 3 }, | 1928 | .muxsel = { 2, 3 }, |
1906 | .pll = PLL_28, | 1929 | .pll = PLL_28, |
@@ -1915,11 +1938,11 @@ struct tvcard bttv_tvcards[] = { | |||
1915 | .name = "Osprey 500", /* 500 */ | 1938 | .name = "Osprey 500", /* 500 */ |
1916 | .video_inputs = 2, | 1939 | .video_inputs = 2, |
1917 | .audio_inputs = 1, | 1940 | .audio_inputs = 1, |
1918 | .tuner = -1, | 1941 | .tuner = UNSET, |
1919 | .svhs = 1, | 1942 | .svhs = 1, |
1920 | .muxsel = { 2, 3 }, | 1943 | .muxsel = { 2, 3 }, |
1921 | .pll = PLL_28, | 1944 | .pll = PLL_28, |
1922 | .tuner_type = -1, | 1945 | .tuner_type = UNSET, |
1923 | .tuner_addr = ADDR_UNSET, | 1946 | .tuner_addr = ADDR_UNSET, |
1924 | .radio_addr = ADDR_UNSET, | 1947 | .radio_addr = ADDR_UNSET, |
1925 | .no_msp34xx = 1, | 1948 | .no_msp34xx = 1, |
@@ -1930,9 +1953,9 @@ struct tvcard bttv_tvcards[] = { | |||
1930 | .name = "Osprey 540", /* 540 */ | 1953 | .name = "Osprey 540", /* 540 */ |
1931 | .video_inputs = 4, | 1954 | .video_inputs = 4, |
1932 | .audio_inputs = 1, | 1955 | .audio_inputs = 1, |
1933 | .tuner = -1, | 1956 | .tuner = UNSET, |
1934 | .pll = PLL_28, | 1957 | .pll = PLL_28, |
1935 | .tuner_type = -1, | 1958 | .tuner_type = UNSET, |
1936 | .tuner_addr = ADDR_UNSET, | 1959 | .tuner_addr = ADDR_UNSET, |
1937 | .radio_addr = ADDR_UNSET, | 1960 | .radio_addr = ADDR_UNSET, |
1938 | .no_msp34xx = 1, | 1961 | .no_msp34xx = 1, |
@@ -1945,7 +1968,7 @@ struct tvcard bttv_tvcards[] = { | |||
1945 | .name = "Osprey 2000", /* 2000 */ | 1968 | .name = "Osprey 2000", /* 2000 */ |
1946 | .video_inputs = 2, | 1969 | .video_inputs = 2, |
1947 | .audio_inputs = 1, | 1970 | .audio_inputs = 1, |
1948 | .tuner = -1, | 1971 | .tuner = UNSET, |
1949 | .svhs = 1, | 1972 | .svhs = 1, |
1950 | .muxsel = { 2, 3 }, | 1973 | .muxsel = { 2, 3 }, |
1951 | .pll = PLL_28, | 1974 | .pll = PLL_28, |
@@ -1961,11 +1984,11 @@ struct tvcard bttv_tvcards[] = { | |||
1961 | .name = "IDS Eagle", | 1984 | .name = "IDS Eagle", |
1962 | .video_inputs = 4, | 1985 | .video_inputs = 4, |
1963 | .audio_inputs = 0, | 1986 | .audio_inputs = 0, |
1964 | .tuner = -1, | 1987 | .tuner = UNSET, |
1965 | .tuner_type = -1, | 1988 | .tuner_type = UNSET, |
1966 | .tuner_addr = ADDR_UNSET, | 1989 | .tuner_addr = ADDR_UNSET, |
1967 | .radio_addr = ADDR_UNSET, | 1990 | .radio_addr = ADDR_UNSET, |
1968 | .svhs = -1, | 1991 | .svhs = UNSET, |
1969 | .gpiomask = 0, | 1992 | .gpiomask = 0, |
1970 | .muxsel = { 0, 1, 2, 3 }, | 1993 | .muxsel = { 0, 1, 2, 3 }, |
1971 | .muxsel_hook = eagle_muxsel, | 1994 | .muxsel_hook = eagle_muxsel, |
@@ -1978,8 +2001,8 @@ struct tvcard bttv_tvcards[] = { | |||
1978 | .video_inputs = 2, | 2001 | .video_inputs = 2, |
1979 | .audio_inputs = 0, | 2002 | .audio_inputs = 0, |
1980 | .svhs = 1, | 2003 | .svhs = 1, |
1981 | .tuner = -1, | 2004 | .tuner = UNSET, |
1982 | .tuner_type = -1, | 2005 | .tuner_type = UNSET, |
1983 | .tuner_addr = ADDR_UNSET, | 2006 | .tuner_addr = ADDR_UNSET, |
1984 | .radio_addr = ADDR_UNSET, | 2007 | .radio_addr = ADDR_UNSET, |
1985 | .no_msp34xx = 1, | 2008 | .no_msp34xx = 1, |
@@ -2020,13 +2043,13 @@ struct tvcard bttv_tvcards[] = { | |||
2020 | .video_inputs = 3, | 2043 | .video_inputs = 3, |
2021 | .audio_inputs = 1, | 2044 | .audio_inputs = 1, |
2022 | .tuner = 0, | 2045 | .tuner = 0, |
2023 | .svhs = -1, | 2046 | .svhs = UNSET, |
2024 | .gpiomask = 7, | 2047 | .gpiomask = 7, |
2025 | .muxsel = { 2, 3, 1, 1}, | 2048 | .muxsel = { 2, 3, 1, 1}, |
2026 | .gpiomux = { 0, 1, 2, 3}, | 2049 | .gpiomux = { 0, 1, 2, 3}, |
2027 | .gpiomute = 4, | 2050 | .gpiomute = 4, |
2028 | .needs_tvaudio = 1, | 2051 | .needs_tvaudio = 1, |
2029 | .tuner_type = 5, | 2052 | .tuner_type = TUNER_PHILIPS_PAL, |
2030 | .tuner_addr = ADDR_UNSET, | 2053 | .tuner_addr = ADDR_UNSET, |
2031 | .radio_addr = ADDR_UNSET, | 2054 | .radio_addr = ADDR_UNSET, |
2032 | .pll = PLL_28, | 2055 | .pll = PLL_28, |
@@ -2035,7 +2058,7 @@ struct tvcard bttv_tvcards[] = { | |||
2035 | .name = "Euresys Picolo", | 2058 | .name = "Euresys Picolo", |
2036 | .video_inputs = 3, | 2059 | .video_inputs = 3, |
2037 | .audio_inputs = 0, | 2060 | .audio_inputs = 0, |
2038 | .tuner = -1, | 2061 | .tuner = UNSET, |
2039 | .svhs = 2, | 2062 | .svhs = 2, |
2040 | .gpiomask = 0, | 2063 | .gpiomask = 0, |
2041 | .no_msp34xx = 1, | 2064 | .no_msp34xx = 1, |
@@ -2052,8 +2075,8 @@ struct tvcard bttv_tvcards[] = { | |||
2052 | .name = "ProVideo PV150", /* 0x4f */ | 2075 | .name = "ProVideo PV150", /* 0x4f */ |
2053 | .video_inputs = 2, | 2076 | .video_inputs = 2, |
2054 | .audio_inputs = 0, | 2077 | .audio_inputs = 0, |
2055 | .tuner = -1, | 2078 | .tuner = UNSET, |
2056 | .svhs = -1, | 2079 | .svhs = UNSET, |
2057 | .gpiomask = 0, | 2080 | .gpiomask = 0, |
2058 | .muxsel = { 2, 3 }, | 2081 | .muxsel = { 2, 3 }, |
2059 | .gpiomux = { 0 }, | 2082 | .gpiomux = { 0 }, |
@@ -2080,7 +2103,7 @@ struct tvcard bttv_tvcards[] = { | |||
2080 | .needs_tvaudio = 0, | 2103 | .needs_tvaudio = 0, |
2081 | .no_msp34xx = 1, | 2104 | .no_msp34xx = 1, |
2082 | .pll = PLL_28, | 2105 | .pll = PLL_28, |
2083 | .tuner_type = 2, | 2106 | .tuner_type = TUNER_PHILIPS_NTSC, |
2084 | .tuner_addr = ADDR_UNSET, | 2107 | .tuner_addr = ADDR_UNSET, |
2085 | .radio_addr = ADDR_UNSET, | 2108 | .radio_addr = ADDR_UNSET, |
2086 | .audio_hook = adtvk503_audio, | 2109 | .audio_hook = adtvk503_audio, |
@@ -2098,7 +2121,7 @@ struct tvcard bttv_tvcards[] = { | |||
2098 | .needs_tvaudio = 1, | 2121 | .needs_tvaudio = 1, |
2099 | .no_msp34xx = 1, | 2122 | .no_msp34xx = 1, |
2100 | .pll = PLL_28, | 2123 | .pll = PLL_28, |
2101 | .tuner_type = 5, | 2124 | .tuner_type = TUNER_PHILIPS_PAL, |
2102 | .tuner_addr = ADDR_UNSET, | 2125 | .tuner_addr = ADDR_UNSET, |
2103 | .radio_addr = ADDR_UNSET, | 2126 | .radio_addr = ADDR_UNSET, |
2104 | /* Notes: | 2127 | /* Notes: |
@@ -2121,7 +2144,7 @@ struct tvcard bttv_tvcards[] = { | |||
2121 | .gpiomask = 0, | 2144 | .gpiomask = 0, |
2122 | .no_tda9875 = 1, | 2145 | .no_tda9875 = 1, |
2123 | .no_tda7432 = 1, | 2146 | .no_tda7432 = 1, |
2124 | .tuner_type = 1, | 2147 | .tuner_type = TUNER_PHILIPS_PAL_I, |
2125 | .tuner_addr = ADDR_UNSET, | 2148 | .tuner_addr = ADDR_UNSET, |
2126 | .radio_addr = ADDR_UNSET, | 2149 | .radio_addr = ADDR_UNSET, |
2127 | .has_radio = 1, | 2150 | .has_radio = 1, |
@@ -2138,11 +2161,11 @@ struct tvcard bttv_tvcards[] = { | |||
2138 | .name = "IVC-200", | 2161 | .name = "IVC-200", |
2139 | .video_inputs = 1, | 2162 | .video_inputs = 1, |
2140 | .audio_inputs = 0, | 2163 | .audio_inputs = 0, |
2141 | .tuner = -1, | 2164 | .tuner = UNSET, |
2142 | .tuner_type = -1, | 2165 | .tuner_type = UNSET, |
2143 | .tuner_addr = ADDR_UNSET, | 2166 | .tuner_addr = ADDR_UNSET, |
2144 | .radio_addr = ADDR_UNSET, | 2167 | .radio_addr = ADDR_UNSET, |
2145 | .svhs = -1, | 2168 | .svhs = UNSET, |
2146 | .gpiomask = 0xdf, | 2169 | .gpiomask = 0xdf, |
2147 | .muxsel = { 2 }, | 2170 | .muxsel = { 2 }, |
2148 | .pll = PLL_28, | 2171 | .pll = PLL_28, |
@@ -2151,9 +2174,9 @@ struct tvcard bttv_tvcards[] = { | |||
2151 | .name = "Grand X-Guard / Trust 814PCI", | 2174 | .name = "Grand X-Guard / Trust 814PCI", |
2152 | .video_inputs = 16, | 2175 | .video_inputs = 16, |
2153 | .audio_inputs = 0, | 2176 | .audio_inputs = 0, |
2154 | .tuner = -1, | 2177 | .tuner = UNSET, |
2155 | .svhs = -1, | 2178 | .svhs = UNSET, |
2156 | .tuner_type = 4, | 2179 | .tuner_type = TUNER_ABSENT, |
2157 | .tuner_addr = ADDR_UNSET, | 2180 | .tuner_addr = ADDR_UNSET, |
2158 | .radio_addr = ADDR_UNSET, | 2181 | .radio_addr = ADDR_UNSET, |
2159 | .gpiomask2 = 0xff, | 2182 | .gpiomask2 = 0xff, |
@@ -2169,14 +2192,14 @@ struct tvcard bttv_tvcards[] = { | |||
2169 | [BTTV_BOARD_NEBULA_DIGITV] = { | 2192 | [BTTV_BOARD_NEBULA_DIGITV] = { |
2170 | .name = "Nebula Electronics DigiTV", | 2193 | .name = "Nebula Electronics DigiTV", |
2171 | .video_inputs = 1, | 2194 | .video_inputs = 1, |
2172 | .tuner = -1, | 2195 | .tuner = UNSET, |
2173 | .svhs = -1, | 2196 | .svhs = UNSET, |
2174 | .muxsel = { 2, 3, 1, 0 }, | 2197 | .muxsel = { 2, 3, 1, 0 }, |
2175 | .no_msp34xx = 1, | 2198 | .no_msp34xx = 1, |
2176 | .no_tda9875 = 1, | 2199 | .no_tda9875 = 1, |
2177 | .no_tda7432 = 1, | 2200 | .no_tda7432 = 1, |
2178 | .pll = PLL_28, | 2201 | .pll = PLL_28, |
2179 | .tuner_type = -1, | 2202 | .tuner_type = UNSET, |
2180 | .tuner_addr = ADDR_UNSET, | 2203 | .tuner_addr = ADDR_UNSET, |
2181 | .radio_addr = ADDR_UNSET, | 2204 | .radio_addr = ADDR_UNSET, |
2182 | .has_dvb = 1, | 2205 | .has_dvb = 1, |
@@ -2189,15 +2212,15 @@ struct tvcard bttv_tvcards[] = { | |||
2189 | .name = "ProVideo PV143", | 2212 | .name = "ProVideo PV143", |
2190 | .video_inputs = 4, | 2213 | .video_inputs = 4, |
2191 | .audio_inputs = 0, | 2214 | .audio_inputs = 0, |
2192 | .tuner = -1, | 2215 | .tuner = UNSET, |
2193 | .svhs = -1, | 2216 | .svhs = UNSET, |
2194 | .gpiomask = 0, | 2217 | .gpiomask = 0, |
2195 | .muxsel = { 2, 3, 1, 0 }, | 2218 | .muxsel = { 2, 3, 1, 0 }, |
2196 | .gpiomux = { 0 }, | 2219 | .gpiomux = { 0 }, |
2197 | .needs_tvaudio = 0, | 2220 | .needs_tvaudio = 0, |
2198 | .no_msp34xx = 1, | 2221 | .no_msp34xx = 1, |
2199 | .pll = PLL_28, | 2222 | .pll = PLL_28, |
2200 | .tuner_type = -1, | 2223 | .tuner_type = UNSET, |
2201 | .tuner_addr = ADDR_UNSET, | 2224 | .tuner_addr = ADDR_UNSET, |
2202 | .radio_addr = ADDR_UNSET, | 2225 | .radio_addr = ADDR_UNSET, |
2203 | }, | 2226 | }, |
@@ -2206,14 +2229,14 @@ struct tvcard bttv_tvcards[] = { | |||
2206 | .name = "PHYTEC VD-009-X1 MiniDIN (bt878)", | 2229 | .name = "PHYTEC VD-009-X1 MiniDIN (bt878)", |
2207 | .video_inputs = 4, | 2230 | .video_inputs = 4, |
2208 | .audio_inputs = 0, | 2231 | .audio_inputs = 0, |
2209 | .tuner = -1, /* card has no tuner */ | 2232 | .tuner = UNSET, /* card has no tuner */ |
2210 | .svhs = 3, | 2233 | .svhs = 3, |
2211 | .gpiomask = 0x00, | 2234 | .gpiomask = 0x00, |
2212 | .muxsel = { 2, 3, 1, 0 }, | 2235 | .muxsel = { 2, 3, 1, 0 }, |
2213 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ | 2236 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
2214 | .needs_tvaudio = 1, | 2237 | .needs_tvaudio = 1, |
2215 | .pll = PLL_28, | 2238 | .pll = PLL_28, |
2216 | .tuner_type = -1, | 2239 | .tuner_type = UNSET, |
2217 | .tuner_addr = ADDR_UNSET, | 2240 | .tuner_addr = ADDR_UNSET, |
2218 | .radio_addr = ADDR_UNSET, | 2241 | .radio_addr = ADDR_UNSET, |
2219 | }, | 2242 | }, |
@@ -2221,14 +2244,14 @@ struct tvcard bttv_tvcards[] = { | |||
2221 | .name = "PHYTEC VD-009-X1 Combi (bt878)", | 2244 | .name = "PHYTEC VD-009-X1 Combi (bt878)", |
2222 | .video_inputs = 4, | 2245 | .video_inputs = 4, |
2223 | .audio_inputs = 0, | 2246 | .audio_inputs = 0, |
2224 | .tuner = -1, /* card has no tuner */ | 2247 | .tuner = UNSET, /* card has no tuner */ |
2225 | .svhs = 3, | 2248 | .svhs = 3, |
2226 | .gpiomask = 0x00, | 2249 | .gpiomask = 0x00, |
2227 | .muxsel = { 2, 3, 1, 1 }, | 2250 | .muxsel = { 2, 3, 1, 1 }, |
2228 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ | 2251 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
2229 | .needs_tvaudio = 1, | 2252 | .needs_tvaudio = 1, |
2230 | .pll = PLL_28, | 2253 | .pll = PLL_28, |
2231 | .tuner_type = -1, | 2254 | .tuner_type = UNSET, |
2232 | .tuner_addr = ADDR_UNSET, | 2255 | .tuner_addr = ADDR_UNSET, |
2233 | .radio_addr = ADDR_UNSET, | 2256 | .radio_addr = ADDR_UNSET, |
2234 | }, | 2257 | }, |
@@ -2238,7 +2261,7 @@ struct tvcard bttv_tvcards[] = { | |||
2238 | .name = "PHYTEC VD-009 MiniDIN (bt878)", | 2261 | .name = "PHYTEC VD-009 MiniDIN (bt878)", |
2239 | .video_inputs = 10, | 2262 | .video_inputs = 10, |
2240 | .audio_inputs = 0, | 2263 | .audio_inputs = 0, |
2241 | .tuner = -1, /* card has no tuner */ | 2264 | .tuner = UNSET, /* card has no tuner */ |
2242 | .svhs = 9, | 2265 | .svhs = 9, |
2243 | .gpiomask = 0x00, | 2266 | .gpiomask = 0x00, |
2244 | .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio | 2267 | .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio |
@@ -2248,7 +2271,7 @@ struct tvcard bttv_tvcards[] = { | |||
2248 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ | 2271 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
2249 | .needs_tvaudio = 1, | 2272 | .needs_tvaudio = 1, |
2250 | .pll = PLL_28, | 2273 | .pll = PLL_28, |
2251 | .tuner_type = -1, | 2274 | .tuner_type = UNSET, |
2252 | .tuner_addr = ADDR_UNSET, | 2275 | .tuner_addr = ADDR_UNSET, |
2253 | .radio_addr = ADDR_UNSET, | 2276 | .radio_addr = ADDR_UNSET, |
2254 | }, | 2277 | }, |
@@ -2256,7 +2279,7 @@ struct tvcard bttv_tvcards[] = { | |||
2256 | .name = "PHYTEC VD-009 Combi (bt878)", | 2279 | .name = "PHYTEC VD-009 Combi (bt878)", |
2257 | .video_inputs = 10, | 2280 | .video_inputs = 10, |
2258 | .audio_inputs = 0, | 2281 | .audio_inputs = 0, |
2259 | .tuner = -1, /* card has no tuner */ | 2282 | .tuner = UNSET, /* card has no tuner */ |
2260 | .svhs = 9, | 2283 | .svhs = 9, |
2261 | .gpiomask = 0x00, | 2284 | .gpiomask = 0x00, |
2262 | .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio | 2285 | .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio |
@@ -2266,7 +2289,7 @@ struct tvcard bttv_tvcards[] = { | |||
2266 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ | 2289 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
2267 | .needs_tvaudio = 1, | 2290 | .needs_tvaudio = 1, |
2268 | .pll = PLL_28, | 2291 | .pll = PLL_28, |
2269 | .tuner_type = -1, | 2292 | .tuner_type = UNSET, |
2270 | .tuner_addr = ADDR_UNSET, | 2293 | .tuner_addr = ADDR_UNSET, |
2271 | .radio_addr = ADDR_UNSET, | 2294 | .radio_addr = ADDR_UNSET, |
2272 | }, | 2295 | }, |
@@ -2274,11 +2297,11 @@ struct tvcard bttv_tvcards[] = { | |||
2274 | .name = "IVC-100", | 2297 | .name = "IVC-100", |
2275 | .video_inputs = 4, | 2298 | .video_inputs = 4, |
2276 | .audio_inputs = 0, | 2299 | .audio_inputs = 0, |
2277 | .tuner = -1, | 2300 | .tuner = UNSET, |
2278 | .tuner_type = -1, | 2301 | .tuner_type = UNSET, |
2279 | .tuner_addr = ADDR_UNSET, | 2302 | .tuner_addr = ADDR_UNSET, |
2280 | .radio_addr = ADDR_UNSET, | 2303 | .radio_addr = ADDR_UNSET, |
2281 | .svhs = -1, | 2304 | .svhs = UNSET, |
2282 | .gpiomask = 0xdf, | 2305 | .gpiomask = 0xdf, |
2283 | .muxsel = { 2, 3, 1, 0 }, | 2306 | .muxsel = { 2, 3, 1, 0 }, |
2284 | .pll = PLL_28, | 2307 | .pll = PLL_28, |
@@ -2288,11 +2311,11 @@ struct tvcard bttv_tvcards[] = { | |||
2288 | .name = "IVC-120G", | 2311 | .name = "IVC-120G", |
2289 | .video_inputs = 16, | 2312 | .video_inputs = 16, |
2290 | .audio_inputs = 0, /* card has no audio */ | 2313 | .audio_inputs = 0, /* card has no audio */ |
2291 | .tuner = -1, /* card has no tuner */ | 2314 | .tuner = UNSET, /* card has no tuner */ |
2292 | .tuner_type = -1, | 2315 | .tuner_type = UNSET, |
2293 | .tuner_addr = ADDR_UNSET, | 2316 | .tuner_addr = ADDR_UNSET, |
2294 | .radio_addr = ADDR_UNSET, | 2317 | .radio_addr = ADDR_UNSET, |
2295 | .svhs = -1, /* card has no svhs */ | 2318 | .svhs = UNSET, /* card has no svhs */ |
2296 | .needs_tvaudio = 0, | 2319 | .needs_tvaudio = 0, |
2297 | .no_msp34xx = 1, | 2320 | .no_msp34xx = 1, |
2298 | .no_tda9875 = 1, | 2321 | .no_tda9875 = 1, |
@@ -2333,7 +2356,7 @@ struct tvcard bttv_tvcards[] = { | |||
2333 | .video_inputs = 3, | 2356 | .video_inputs = 3, |
2334 | .audio_inputs = 0, | 2357 | .audio_inputs = 0, |
2335 | .svhs = 1, | 2358 | .svhs = 1, |
2336 | .tuner = -1, | 2359 | .tuner = UNSET, |
2337 | .muxsel = { 3, 1, 1, 3 }, /* Vid In, SVid In, Vid over SVid in connector */ | 2360 | .muxsel = { 3, 1, 1, 3 }, /* Vid In, SVid In, Vid over SVid in connector */ |
2338 | .no_msp34xx = 1, | 2361 | .no_msp34xx = 1, |
2339 | .no_tda9875 = 1, | 2362 | .no_tda9875 = 1, |
@@ -2364,9 +2387,9 @@ struct tvcard bttv_tvcards[] = { | |||
2364 | .name = "SIMUS GVC1100", | 2387 | .name = "SIMUS GVC1100", |
2365 | .video_inputs = 4, | 2388 | .video_inputs = 4, |
2366 | .audio_inputs = 0, | 2389 | .audio_inputs = 0, |
2367 | .tuner = -1, | 2390 | .tuner = UNSET, |
2368 | .svhs = -1, | 2391 | .svhs = UNSET, |
2369 | .tuner_type = -1, | 2392 | .tuner_type = UNSET, |
2370 | .tuner_addr = ADDR_UNSET, | 2393 | .tuner_addr = ADDR_UNSET, |
2371 | .radio_addr = ADDR_UNSET, | 2394 | .radio_addr = ADDR_UNSET, |
2372 | .pll = PLL_28, | 2395 | .pll = PLL_28, |
@@ -2395,14 +2418,14 @@ struct tvcard bttv_tvcards[] = { | |||
2395 | .name = "LMLBT4", | 2418 | .name = "LMLBT4", |
2396 | .video_inputs = 4, /* IN1,IN2,IN3,IN4 */ | 2419 | .video_inputs = 4, /* IN1,IN2,IN3,IN4 */ |
2397 | .audio_inputs = 0, | 2420 | .audio_inputs = 0, |
2398 | .tuner = -1, | 2421 | .tuner = UNSET, |
2399 | .svhs = -1, | 2422 | .svhs = UNSET, |
2400 | .muxsel = { 2, 3, 1, 0 }, | 2423 | .muxsel = { 2, 3, 1, 0 }, |
2401 | .no_msp34xx = 1, | 2424 | .no_msp34xx = 1, |
2402 | .no_tda9875 = 1, | 2425 | .no_tda9875 = 1, |
2403 | .no_tda7432 = 1, | 2426 | .no_tda7432 = 1, |
2404 | .needs_tvaudio = 0, | 2427 | .needs_tvaudio = 0, |
2405 | .tuner_type = -1, | 2428 | .tuner_type = UNSET, |
2406 | .tuner_addr = ADDR_UNSET, | 2429 | .tuner_addr = ADDR_UNSET, |
2407 | .radio_addr = ADDR_UNSET, | 2430 | .radio_addr = ADDR_UNSET, |
2408 | }, | 2431 | }, |
@@ -2452,8 +2475,8 @@ struct tvcard bttv_tvcards[] = { | |||
2452 | .name = "Euresys Picolo Tetra", | 2475 | .name = "Euresys Picolo Tetra", |
2453 | .video_inputs = 4, | 2476 | .video_inputs = 4, |
2454 | .audio_inputs = 0, | 2477 | .audio_inputs = 0, |
2455 | .tuner = -1, | 2478 | .tuner = UNSET, |
2456 | .svhs = -1, | 2479 | .svhs = UNSET, |
2457 | .gpiomask = 0, | 2480 | .gpiomask = 0, |
2458 | .gpiomask2 = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/ | 2481 | .gpiomask2 = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/ |
2459 | .no_msp34xx = 1, | 2482 | .no_msp34xx = 1, |
@@ -2464,7 +2487,7 @@ struct tvcard bttv_tvcards[] = { | |||
2464 | .pll = PLL_28, | 2487 | .pll = PLL_28, |
2465 | .needs_tvaudio = 0, | 2488 | .needs_tvaudio = 0, |
2466 | .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/ | 2489 | .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/ |
2467 | .tuner_type = -1, | 2490 | .tuner_type = UNSET, |
2468 | .tuner_addr = ADDR_UNSET, | 2491 | .tuner_addr = ADDR_UNSET, |
2469 | .radio_addr = ADDR_UNSET, | 2492 | .radio_addr = ADDR_UNSET, |
2470 | }, | 2493 | }, |
@@ -2490,7 +2513,7 @@ struct tvcard bttv_tvcards[] = { | |||
2490 | .name = "AVerMedia AVerTV DVB-T 771", | 2513 | .name = "AVerMedia AVerTV DVB-T 771", |
2491 | .video_inputs = 2, | 2514 | .video_inputs = 2, |
2492 | .svhs = 1, | 2515 | .svhs = 1, |
2493 | .tuner = -1, | 2516 | .tuner = UNSET, |
2494 | .tuner_type = TUNER_ABSENT, | 2517 | .tuner_type = TUNER_ABSENT, |
2495 | .tuner_addr = ADDR_UNSET, | 2518 | .tuner_addr = ADDR_UNSET, |
2496 | .radio_addr = ADDR_UNSET, | 2519 | .radio_addr = ADDR_UNSET, |
@@ -2509,14 +2532,14 @@ struct tvcard bttv_tvcards[] = { | |||
2509 | /* Based on the Nebula card data - added remote and new card number - BTTV_BOARD_AVDVBT_761, see also ir-kbd-gpio.c */ | 2532 | /* Based on the Nebula card data - added remote and new card number - BTTV_BOARD_AVDVBT_761, see also ir-kbd-gpio.c */ |
2510 | .name = "AverMedia AverTV DVB-T 761", | 2533 | .name = "AverMedia AverTV DVB-T 761", |
2511 | .video_inputs = 2, | 2534 | .video_inputs = 2, |
2512 | .tuner = -1, | 2535 | .tuner = UNSET, |
2513 | .svhs = 1, | 2536 | .svhs = 1, |
2514 | .muxsel = { 3, 1, 2, 0 }, /* Comp0, S-Video, ?, ? */ | 2537 | .muxsel = { 3, 1, 2, 0 }, /* Comp0, S-Video, ?, ? */ |
2515 | .no_msp34xx = 1, | 2538 | .no_msp34xx = 1, |
2516 | .no_tda9875 = 1, | 2539 | .no_tda9875 = 1, |
2517 | .no_tda7432 = 1, | 2540 | .no_tda7432 = 1, |
2518 | .pll = PLL_28, | 2541 | .pll = PLL_28, |
2519 | .tuner_type = -1, | 2542 | .tuner_type = UNSET, |
2520 | .tuner_addr = ADDR_UNSET, | 2543 | .tuner_addr = ADDR_UNSET, |
2521 | .radio_addr = ADDR_UNSET, | 2544 | .radio_addr = ADDR_UNSET, |
2522 | .has_dvb = 1, | 2545 | .has_dvb = 1, |
@@ -2528,8 +2551,8 @@ struct tvcard bttv_tvcards[] = { | |||
2528 | .name = "MATRIX Vision Sigma-SQ", | 2551 | .name = "MATRIX Vision Sigma-SQ", |
2529 | .video_inputs = 16, | 2552 | .video_inputs = 16, |
2530 | .audio_inputs = 0, | 2553 | .audio_inputs = 0, |
2531 | .tuner = -1, | 2554 | .tuner = UNSET, |
2532 | .svhs = -1, | 2555 | .svhs = UNSET, |
2533 | .gpiomask = 0x0, | 2556 | .gpiomask = 0x0, |
2534 | .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, | 2557 | .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, |
2535 | 3, 3, 3, 3, 3, 3, 3, 3 }, | 2558 | 3, 3, 3, 3, 3, 3, 3, 3 }, |
@@ -2537,7 +2560,7 @@ struct tvcard bttv_tvcards[] = { | |||
2537 | .gpiomux = { 0 }, | 2560 | .gpiomux = { 0 }, |
2538 | .no_msp34xx = 1, | 2561 | .no_msp34xx = 1, |
2539 | .pll = PLL_28, | 2562 | .pll = PLL_28, |
2540 | .tuner_type = -1, | 2563 | .tuner_type = UNSET, |
2541 | .tuner_addr = ADDR_UNSET, | 2564 | .tuner_addr = ADDR_UNSET, |
2542 | .radio_addr = ADDR_UNSET, | 2565 | .radio_addr = ADDR_UNSET, |
2543 | }, | 2566 | }, |
@@ -2546,15 +2569,15 @@ struct tvcard bttv_tvcards[] = { | |||
2546 | .name = "MATRIX Vision Sigma-SLC", | 2569 | .name = "MATRIX Vision Sigma-SLC", |
2547 | .video_inputs = 4, | 2570 | .video_inputs = 4, |
2548 | .audio_inputs = 0, | 2571 | .audio_inputs = 0, |
2549 | .tuner = -1, | 2572 | .tuner = UNSET, |
2550 | .svhs = -1, | 2573 | .svhs = UNSET, |
2551 | .gpiomask = 0x0, | 2574 | .gpiomask = 0x0, |
2552 | .muxsel = { 2, 2, 2, 2 }, | 2575 | .muxsel = { 2, 2, 2, 2 }, |
2553 | .muxsel_hook = sigmaSLC_muxsel, | 2576 | .muxsel_hook = sigmaSLC_muxsel, |
2554 | .gpiomux = { 0 }, | 2577 | .gpiomux = { 0 }, |
2555 | .no_msp34xx = 1, | 2578 | .no_msp34xx = 1, |
2556 | .pll = PLL_28, | 2579 | .pll = PLL_28, |
2557 | .tuner_type = -1, | 2580 | .tuner_type = UNSET, |
2558 | .tuner_addr = ADDR_UNSET, | 2581 | .tuner_addr = ADDR_UNSET, |
2559 | .radio_addr = ADDR_UNSET, | 2582 | .radio_addr = ADDR_UNSET, |
2560 | }, | 2583 | }, |
@@ -2566,7 +2589,7 @@ struct tvcard bttv_tvcards[] = { | |||
2566 | .video_inputs = 2, | 2589 | .video_inputs = 2, |
2567 | .audio_inputs = 1, | 2590 | .audio_inputs = 1, |
2568 | .tuner = 0, | 2591 | .tuner = 0, |
2569 | .svhs = -1, | 2592 | .svhs = UNSET, |
2570 | .gpiomask = 0xFF, | 2593 | .gpiomask = 0xFF, |
2571 | .muxsel = { 2, 3, 1, 1 }, | 2594 | .muxsel = { 2, 3, 1, 1 }, |
2572 | .gpiomux = { 2, 0, 0, 0 }, | 2595 | .gpiomux = { 2, 0, 0, 0 }, |
@@ -2584,14 +2607,14 @@ struct tvcard bttv_tvcards[] = { | |||
2584 | [BTTV_BOARD_DVICO_DVBT_LITE] = { | 2607 | [BTTV_BOARD_DVICO_DVBT_LITE] = { |
2585 | /* Chris Pascoe <c.pascoe@itee.uq.edu.au> */ | 2608 | /* Chris Pascoe <c.pascoe@itee.uq.edu.au> */ |
2586 | .name = "DViCO FusionHDTV DVB-T Lite", | 2609 | .name = "DViCO FusionHDTV DVB-T Lite", |
2587 | .tuner = -1, | 2610 | .tuner = UNSET, |
2588 | .no_msp34xx = 1, | 2611 | .no_msp34xx = 1, |
2589 | .no_tda9875 = 1, | 2612 | .no_tda9875 = 1, |
2590 | .no_tda7432 = 1, | 2613 | .no_tda7432 = 1, |
2591 | .pll = PLL_28, | 2614 | .pll = PLL_28, |
2592 | .no_video = 1, | 2615 | .no_video = 1, |
2593 | .has_dvb = 1, | 2616 | .has_dvb = 1, |
2594 | .tuner_type = -1, | 2617 | .tuner_type = UNSET, |
2595 | .tuner_addr = ADDR_UNSET, | 2618 | .tuner_addr = ADDR_UNSET, |
2596 | .radio_addr = ADDR_UNSET, | 2619 | .radio_addr = ADDR_UNSET, |
2597 | }, | 2620 | }, |
@@ -2634,14 +2657,14 @@ struct tvcard bttv_tvcards[] = { | |||
2634 | .name = "Tibet Systems 'Progress DVR' CS16", | 2657 | .name = "Tibet Systems 'Progress DVR' CS16", |
2635 | .video_inputs = 16, | 2658 | .video_inputs = 16, |
2636 | .audio_inputs = 0, | 2659 | .audio_inputs = 0, |
2637 | .tuner = -1, | 2660 | .tuner = UNSET, |
2638 | .svhs = -1, | 2661 | .svhs = UNSET, |
2639 | .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, | 2662 | .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, |
2640 | .pll = PLL_28, | 2663 | .pll = PLL_28, |
2641 | .no_msp34xx = 1, | 2664 | .no_msp34xx = 1, |
2642 | .no_tda9875 = 1, | 2665 | .no_tda9875 = 1, |
2643 | .no_tda7432 = 1, | 2666 | .no_tda7432 = 1, |
2644 | .tuner_type = -1, | 2667 | .tuner_type = UNSET, |
2645 | .tuner_addr = ADDR_UNSET, | 2668 | .tuner_addr = ADDR_UNSET, |
2646 | .radio_addr = ADDR_UNSET, | 2669 | .radio_addr = ADDR_UNSET, |
2647 | .muxsel_hook = tibetCS16_muxsel, | 2670 | .muxsel_hook = tibetCS16_muxsel, |
@@ -2661,11 +2684,11 @@ struct tvcard bttv_tvcards[] = { | |||
2661 | .name = "Kodicom 4400R (master)", | 2684 | .name = "Kodicom 4400R (master)", |
2662 | .video_inputs = 16, | 2685 | .video_inputs = 16, |
2663 | .audio_inputs = 0, | 2686 | .audio_inputs = 0, |
2664 | .tuner = -1, | 2687 | .tuner = UNSET, |
2665 | .tuner_type = -1, | 2688 | .tuner_type = UNSET, |
2666 | .tuner_addr = ADDR_UNSET, | 2689 | .tuner_addr = ADDR_UNSET, |
2667 | .radio_addr = ADDR_UNSET, | 2690 | .radio_addr = ADDR_UNSET, |
2668 | .svhs = -1, | 2691 | .svhs = UNSET, |
2669 | /* GPIO bits 0-9 used for analog switch: | 2692 | /* GPIO bits 0-9 used for analog switch: |
2670 | * 00 - 03: camera selector | 2693 | * 00 - 03: camera selector |
2671 | * 04 - 06: channel (controller) selector | 2694 | * 04 - 06: channel (controller) selector |
@@ -2693,11 +2716,11 @@ struct tvcard bttv_tvcards[] = { | |||
2693 | .name = "Kodicom 4400R (slave)", | 2716 | .name = "Kodicom 4400R (slave)", |
2694 | .video_inputs = 16, | 2717 | .video_inputs = 16, |
2695 | .audio_inputs = 0, | 2718 | .audio_inputs = 0, |
2696 | .tuner = -1, | 2719 | .tuner = UNSET, |
2697 | .tuner_type = -1, | 2720 | .tuner_type = UNSET, |
2698 | .tuner_addr = ADDR_UNSET, | 2721 | .tuner_addr = ADDR_UNSET, |
2699 | .radio_addr = ADDR_UNSET, | 2722 | .radio_addr = ADDR_UNSET, |
2700 | .svhs = -1, | 2723 | .svhs = UNSET, |
2701 | .gpiomask = 0x010000, | 2724 | .gpiomask = 0x010000, |
2702 | .no_gpioirq = 1, | 2725 | .no_gpioirq = 1, |
2703 | .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, | 2726 | .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, |
@@ -2717,7 +2740,7 @@ struct tvcard bttv_tvcards[] = { | |||
2717 | .tuner = 0, | 2740 | .tuner = 0, |
2718 | .svhs = 2, | 2741 | .svhs = 2, |
2719 | .muxsel = { 2, 3, 1, 0 }, | 2742 | .muxsel = { 2, 3, 1, 0 }, |
2720 | .tuner_type = -1, | 2743 | .tuner_type = UNSET, |
2721 | .tuner_addr = ADDR_UNSET, | 2744 | .tuner_addr = ADDR_UNSET, |
2722 | .radio_addr = ADDR_UNSET, | 2745 | .radio_addr = ADDR_UNSET, |
2723 | .pll = PLL_28, | 2746 | .pll = PLL_28, |
@@ -2824,7 +2847,7 @@ struct tvcard bttv_tvcards[] = { | |||
2824 | .name = "Osprey 440", | 2847 | .name = "Osprey 440", |
2825 | .video_inputs = 1, | 2848 | .video_inputs = 1, |
2826 | .audio_inputs = 1, | 2849 | .audio_inputs = 1, |
2827 | .tuner = -1, | 2850 | .tuner = UNSET, |
2828 | .svhs = 1, | 2851 | .svhs = 1, |
2829 | .muxsel = { 2 }, | 2852 | .muxsel = { 2 }, |
2830 | .pll = PLL_28, | 2853 | .pll = PLL_28, |
@@ -2848,7 +2871,7 @@ struct tvcard bttv_tvcards[] = { | |||
2848 | .gpiomute = 1, | 2871 | .gpiomute = 1, |
2849 | .needs_tvaudio = 1, | 2872 | .needs_tvaudio = 1, |
2850 | .pll = PLL_28, | 2873 | .pll = PLL_28, |
2851 | .tuner_type = 2, | 2874 | .tuner_type = TUNER_PHILIPS_NTSC, |
2852 | .tuner_addr = ADDR_UNSET, | 2875 | .tuner_addr = ADDR_UNSET, |
2853 | .radio_addr = ADDR_UNSET, | 2876 | .radio_addr = ADDR_UNSET, |
2854 | }, | 2877 | }, |
@@ -2875,14 +2898,14 @@ struct tvcard bttv_tvcards[] = { | |||
2875 | .name = "Hauppauge ImpactVCB (bt878)", | 2898 | .name = "Hauppauge ImpactVCB (bt878)", |
2876 | .video_inputs = 4, | 2899 | .video_inputs = 4, |
2877 | .audio_inputs = 0, | 2900 | .audio_inputs = 0, |
2878 | .tuner = -1, | 2901 | .tuner = UNSET, |
2879 | .svhs = -1, | 2902 | .svhs = UNSET, |
2880 | .gpiomask = 0x0f, /* old: 7 */ | 2903 | .gpiomask = 0x0f, /* old: 7 */ |
2881 | .muxsel = { 0, 1, 3, 2 }, /* Composite 0-3 */ | 2904 | .muxsel = { 0, 1, 3, 2 }, /* Composite 0-3 */ |
2882 | .no_msp34xx = 1, | 2905 | .no_msp34xx = 1, |
2883 | .no_tda9875 = 1, | 2906 | .no_tda9875 = 1, |
2884 | .no_tda7432 = 1, | 2907 | .no_tda7432 = 1, |
2885 | .tuner_type = -1, | 2908 | .tuner_type = UNSET, |
2886 | .tuner_addr = ADDR_UNSET, | 2909 | .tuner_addr = ADDR_UNSET, |
2887 | .radio_addr = ADDR_UNSET, | 2910 | .radio_addr = ADDR_UNSET, |
2888 | }, | 2911 | }, |
@@ -2914,10 +2937,10 @@ struct tvcard bttv_tvcards[] = { | |||
2914 | .name = "SSAI Security Video Interface", | 2937 | .name = "SSAI Security Video Interface", |
2915 | .video_inputs = 4, | 2938 | .video_inputs = 4, |
2916 | .audio_inputs = 0, | 2939 | .audio_inputs = 0, |
2917 | .tuner = -1, | 2940 | .tuner = UNSET, |
2918 | .svhs = -1, | 2941 | .svhs = UNSET, |
2919 | .muxsel = { 0, 1, 2, 3 }, | 2942 | .muxsel = { 0, 1, 2, 3 }, |
2920 | .tuner_type = -1, | 2943 | .tuner_type = UNSET, |
2921 | .tuner_addr = ADDR_UNSET, | 2944 | .tuner_addr = ADDR_UNSET, |
2922 | .radio_addr = ADDR_UNSET, | 2945 | .radio_addr = ADDR_UNSET, |
2923 | }, | 2946 | }, |
@@ -2925,13 +2948,31 @@ struct tvcard bttv_tvcards[] = { | |||
2925 | .name = "SSAI Ultrasound Video Interface", | 2948 | .name = "SSAI Ultrasound Video Interface", |
2926 | .video_inputs = 2, | 2949 | .video_inputs = 2, |
2927 | .audio_inputs = 0, | 2950 | .audio_inputs = 0, |
2928 | .tuner = -1, | 2951 | .tuner = UNSET, |
2929 | .svhs = 1, | 2952 | .svhs = 1, |
2930 | .muxsel = { 2, 0, 1, 3 }, | 2953 | .muxsel = { 2, 0, 1, 3 }, |
2931 | .tuner_type = -1, | 2954 | .tuner_type = UNSET, |
2932 | .tuner_addr = ADDR_UNSET, | 2955 | .tuner_addr = ADDR_UNSET, |
2933 | .radio_addr = ADDR_UNSET, | 2956 | .radio_addr = ADDR_UNSET, |
2934 | }, | 2957 | }, |
2958 | /* ---- card 0x94---------------------------------- */ | ||
2959 | [BTTV_BOARD_DVICO_FUSIONHDTV_2] = { | ||
2960 | .name = "DViCO FusionHDTV 2", | ||
2961 | .tuner = 0, | ||
2962 | .tuner_type = TUNER_PHILIPS_ATSC, /* FCV1236D */ | ||
2963 | .tuner_addr = ADDR_UNSET, | ||
2964 | .radio_addr = ADDR_UNSET, | ||
2965 | .video_inputs = 3, | ||
2966 | .audio_inputs = 1, | ||
2967 | .svhs = 2, | ||
2968 | .muxsel = { 2, 3, 1 }, | ||
2969 | .gpiomask = 0x00e00007, | ||
2970 | .gpiomux = { 0x00400005, 0, 0x00000001, 0 }, | ||
2971 | .gpiomute = 0x00c00007, | ||
2972 | .no_msp34xx = 1, | ||
2973 | .no_tda9875 = 1, | ||
2974 | .no_tda7432 = 1, | ||
2975 | }, | ||
2935 | }; | 2976 | }; |
2936 | 2977 | ||
2937 | static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); | 2978 | static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); |
@@ -3040,7 +3081,7 @@ static void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256]) | |||
3040 | static void flyvideo_gpio(struct bttv *btv) | 3081 | static void flyvideo_gpio(struct bttv *btv) |
3041 | { | 3082 | { |
3042 | int gpio,has_remote,has_radio,is_capture_only,is_lr90,has_tda9820_tda9821; | 3083 | int gpio,has_remote,has_radio,is_capture_only,is_lr90,has_tda9820_tda9821; |
3043 | int tuner=-1,ttype; | 3084 | int tuner=UNSET,ttype; |
3044 | 3085 | ||
3045 | gpio_inout(0xffffff, 0); | 3086 | gpio_inout(0xffffff, 0); |
3046 | udelay(8); /* without this we would see the 0x1800 mask */ | 3087 | udelay(8); /* without this we would see the 0x1800 mask */ |
@@ -3085,7 +3126,7 @@ static void flyvideo_gpio(struct bttv *btv) | |||
3085 | * gpio & 0x001000 output bit for audio routing */ | 3126 | * gpio & 0x001000 output bit for audio routing */ |
3086 | 3127 | ||
3087 | if(is_capture_only) | 3128 | if(is_capture_only) |
3088 | tuner=4; /* No tuner present */ | 3129 | tuner = TUNER_ABSENT; /* No tuner present */ |
3089 | 3130 | ||
3090 | printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n", | 3131 | printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n", |
3091 | btv->c.nr, has_radio? "yes":"no ", has_remote? "yes":"no ", tuner, gpio); | 3132 | btv->c.nr, has_radio? "yes":"no ", has_remote? "yes":"no ", tuner, gpio); |
@@ -3093,7 +3134,7 @@ static void flyvideo_gpio(struct bttv *btv) | |||
3093 | btv->c.nr, is_lr90?"yes":"no ", has_tda9820_tda9821?"yes":"no ", | 3134 | btv->c.nr, is_lr90?"yes":"no ", has_tda9820_tda9821?"yes":"no ", |
3094 | is_capture_only?"yes":"no "); | 3135 | is_capture_only?"yes":"no "); |
3095 | 3136 | ||
3096 | if(tuner!= -1) /* only set if known tuner autodetected, else let insmod option through */ | 3137 | if (tuner != UNSET) /* only set if known tuner autodetected, else let insmod option through */ |
3097 | btv->tuner_type = tuner; | 3138 | btv->tuner_type = tuner; |
3098 | btv->has_radio = has_radio; | 3139 | btv->has_radio = has_radio; |
3099 | 3140 | ||
@@ -3302,6 +3343,7 @@ void __devinit bttv_init_card1(struct bttv *btv) | |||
3302 | case BTTV_BOARD_HAUPPAUGE878: | 3343 | case BTTV_BOARD_HAUPPAUGE878: |
3303 | boot_msp34xx(btv,5); | 3344 | boot_msp34xx(btv,5); |
3304 | break; | 3345 | break; |
3346 | case BTTV_BOARD_VOODOOTV_200: | ||
3305 | case BTTV_BOARD_VOODOOTV_FM: | 3347 | case BTTV_BOARD_VOODOOTV_FM: |
3306 | boot_msp34xx(btv,20); | 3348 | boot_msp34xx(btv,20); |
3307 | break; | 3349 | break; |
@@ -3328,10 +3370,9 @@ void __devinit bttv_init_card1(struct bttv *btv) | |||
3328 | /* initialization part two -- after registering i2c bus */ | 3370 | /* initialization part two -- after registering i2c bus */ |
3329 | void __devinit bttv_init_card2(struct bttv *btv) | 3371 | void __devinit bttv_init_card2(struct bttv *btv) |
3330 | { | 3372 | { |
3331 | int tda9887; | ||
3332 | int addr=ADDR_UNSET; | 3373 | int addr=ADDR_UNSET; |
3333 | 3374 | ||
3334 | btv->tuner_type = -1; | 3375 | btv->tuner_type = UNSET; |
3335 | 3376 | ||
3336 | if (BTTV_BOARD_UNKNOWN == btv->c.type) { | 3377 | if (BTTV_BOARD_UNKNOWN == btv->c.type) { |
3337 | bttv_readee(btv,eeprom_data,0xa0); | 3378 | bttv_readee(btv,eeprom_data,0xa0); |
@@ -3479,7 +3520,15 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3479 | btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type; | 3520 | btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type; |
3480 | if (UNSET != tuner[btv->c.nr]) | 3521 | if (UNSET != tuner[btv->c.nr]) |
3481 | btv->tuner_type = tuner[btv->c.nr]; | 3522 | btv->tuner_type = tuner[btv->c.nr]; |
3482 | printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type); | 3523 | |
3524 | if (btv->tuner_type == TUNER_ABSENT || | ||
3525 | bttv_tvcards[btv->c.type].tuner == UNSET) | ||
3526 | printk(KERN_INFO "bttv%d: tuner absent\n", btv->c.nr); | ||
3527 | else if(btv->tuner_type == UNSET) | ||
3528 | printk(KERN_WARNING "bttv%d: tuner type unset\n", btv->c.nr); | ||
3529 | else | ||
3530 | printk(KERN_INFO "bttv%d: tuner type=%d\n", btv->c.nr, | ||
3531 | btv->tuner_type); | ||
3483 | 3532 | ||
3484 | if (btv->tuner_type != UNSET) { | 3533 | if (btv->tuner_type != UNSET) { |
3485 | struct tuner_setup tun_setup; | 3534 | struct tuner_setup tun_setup; |
@@ -3521,6 +3570,9 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3521 | if (!autoload) | 3570 | if (!autoload) |
3522 | return; | 3571 | return; |
3523 | 3572 | ||
3573 | if (bttv_tvcards[btv->c.type].tuner == UNSET) | ||
3574 | return; /* no tuner or related drivers to load */ | ||
3575 | |||
3524 | /* try to detect audio/fader chips */ | 3576 | /* try to detect audio/fader chips */ |
3525 | if (!bttv_tvcards[btv->c.type].no_msp34xx && | 3577 | if (!bttv_tvcards[btv->c.type].no_msp34xx && |
3526 | bttv_I2CRead(btv, I2C_ADDR_MSP3400, "MSP34xx") >=0) | 3578 | bttv_I2CRead(btv, I2C_ADDR_MSP3400, "MSP34xx") >=0) |
@@ -3541,17 +3593,7 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3541 | if (bttv_tvcards[btv->c.type].needs_tvaudio) | 3593 | if (bttv_tvcards[btv->c.type].needs_tvaudio) |
3542 | request_module("tvaudio"); | 3594 | request_module("tvaudio"); |
3543 | 3595 | ||
3544 | /* tuner modules */ | 3596 | if (btv->tuner_type != UNSET && btv->tuner_type != TUNER_ABSENT) |
3545 | tda9887 = 0; | ||
3546 | if (btv->tda9887_conf) | ||
3547 | tda9887 = 1; | ||
3548 | if (0 == tda9887 && 0 == bttv_tvcards[btv->c.type].has_dvb && | ||
3549 | bttv_I2CRead(btv, I2C_ADDR_TDA9887, "TDA9887") >=0) | ||
3550 | tda9887 = 1; | ||
3551 | /* Hybrid DVB card, DOES have a tda9887 */ | ||
3552 | if (btv->c.type == BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE) | ||
3553 | tda9887 = 1; | ||
3554 | if (btv->tuner_type != UNSET) | ||
3555 | request_module("tuner"); | 3597 | request_module("tuner"); |
3556 | } | 3598 | } |
3557 | 3599 | ||
@@ -3865,11 +3907,15 @@ void bttv_tda9880_setnorm(struct bttv *btv, int norm) | |||
3865 | if(norm==VIDEO_MODE_NTSC) { | 3907 | if(norm==VIDEO_MODE_NTSC) { |
3866 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x957fff; | 3908 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x957fff; |
3867 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x957fff; | 3909 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x957fff; |
3910 | bttv_tvcards[BTTV_BOARD_VOODOOTV_200].gpiomux[TVAUDIO_INPUT_TUNER]=0x957fff; | ||
3911 | bttv_tvcards[BTTV_BOARD_VOODOOTV_200].gpiomute=0x957fff; | ||
3868 | dprintk("bttv_tda9880_setnorm to NTSC\n"); | 3912 | dprintk("bttv_tda9880_setnorm to NTSC\n"); |
3869 | } | 3913 | } |
3870 | else { | 3914 | else { |
3871 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x947fff; | 3915 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x947fff; |
3872 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x947fff; | 3916 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x947fff; |
3917 | bttv_tvcards[BTTV_BOARD_VOODOOTV_200].gpiomux[TVAUDIO_INPUT_TUNER]=0x947fff; | ||
3918 | bttv_tvcards[BTTV_BOARD_VOODOOTV_200].gpiomute=0x947fff; | ||
3873 | dprintk("bttv_tda9880_setnorm to PAL\n"); | 3919 | dprintk("bttv_tda9880_setnorm to PAL\n"); |
3874 | } | 3920 | } |
3875 | /* set GPIO according */ | 3921 | /* set GPIO according */ |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index b1fedb0f6431..cb555f2c40f9 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -1218,7 +1218,14 @@ audio_mux(struct bttv *btv, int input, int mute) | |||
1218 | break; | 1218 | break; |
1219 | case TVAUDIO_INPUT_TUNER: | 1219 | case TVAUDIO_INPUT_TUNER: |
1220 | default: | 1220 | default: |
1221 | route.input = MSP_INPUT_DEFAULT; | 1221 | /* This is the only card that uses TUNER2, and afaik, |
1222 | is the only difference between the VOODOOTV_FM | ||
1223 | and VOODOOTV_200 */ | ||
1224 | if (btv->c.type == BTTV_BOARD_VOODOOTV_200) | ||
1225 | route.input = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER2, \ | ||
1226 | MSP_DSP_IN_TUNER, MSP_DSP_IN_TUNER); | ||
1227 | else | ||
1228 | route.input = MSP_INPUT_DEFAULT; | ||
1222 | break; | 1229 | break; |
1223 | } | 1230 | } |
1224 | route.output = MSP_OUTPUT_DEFAULT; | 1231 | route.output = MSP_OUTPUT_DEFAULT; |
@@ -1253,7 +1260,7 @@ i2c_vidiocschan(struct bttv *btv) | |||
1253 | v4l2_std_id std = bttv_tvnorms[btv->tvnorm].v4l2_id; | 1260 | v4l2_std_id std = bttv_tvnorms[btv->tvnorm].v4l2_id; |
1254 | 1261 | ||
1255 | bttv_call_i2c_clients(btv, VIDIOC_S_STD, &std); | 1262 | bttv_call_i2c_clients(btv, VIDIOC_S_STD, &std); |
1256 | if (btv->c.type == BTTV_BOARD_VOODOOTV_FM) | 1263 | if (btv->c.type == BTTV_BOARD_VOODOOTV_FM || btv->c.type == BTTV_BOARD_VOODOOTV_200) |
1257 | bttv_tda9880_setnorm(btv,btv->tvnorm); | 1264 | bttv_tda9880_setnorm(btv,btv->tvnorm); |
1258 | } | 1265 | } |
1259 | 1266 | ||
@@ -1323,6 +1330,7 @@ set_tvnorm(struct bttv *btv, unsigned int norm) | |||
1323 | 1330 | ||
1324 | switch (btv->c.type) { | 1331 | switch (btv->c.type) { |
1325 | case BTTV_BOARD_VOODOOTV_FM: | 1332 | case BTTV_BOARD_VOODOOTV_FM: |
1333 | case BTTV_BOARD_VOODOOTV_200: | ||
1326 | bttv_tda9880_setnorm(btv,norm); | 1334 | bttv_tda9880_setnorm(btv,norm); |
1327 | break; | 1335 | break; |
1328 | } | 1336 | } |
@@ -2251,6 +2259,24 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) | |||
2251 | printk(KERN_INFO "bttv%d: ================== END STATUS CARD #%d ==================\n", btv->c.nr, btv->c.nr); | 2259 | printk(KERN_INFO "bttv%d: ================== END STATUS CARD #%d ==================\n", btv->c.nr, btv->c.nr); |
2252 | return 0; | 2260 | return 0; |
2253 | } | 2261 | } |
2262 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
2263 | case VIDIOC_DBG_G_REGISTER: | ||
2264 | case VIDIOC_DBG_S_REGISTER: | ||
2265 | { | ||
2266 | struct v4l2_register *reg = arg; | ||
2267 | if (!capable(CAP_SYS_ADMIN)) | ||
2268 | return -EPERM; | ||
2269 | if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) | ||
2270 | return -EINVAL; | ||
2271 | /* bt848 has a 12-bit register space */ | ||
2272 | reg->reg &= 0xfff; | ||
2273 | if (cmd == VIDIOC_DBG_G_REGISTER) | ||
2274 | reg->val = btread(reg->reg); | ||
2275 | else | ||
2276 | btwrite(reg->val, reg->reg); | ||
2277 | return 0; | ||
2278 | } | ||
2279 | #endif | ||
2254 | 2280 | ||
2255 | default: | 2281 | default: |
2256 | return -ENOIOCTLCMD; | 2282 | return -ENOIOCTLCMD; |
@@ -3561,6 +3587,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
3561 | case VIDIOC_G_FREQUENCY: | 3587 | case VIDIOC_G_FREQUENCY: |
3562 | case VIDIOC_S_FREQUENCY: | 3588 | case VIDIOC_S_FREQUENCY: |
3563 | case VIDIOC_LOG_STATUS: | 3589 | case VIDIOC_LOG_STATUS: |
3590 | case VIDIOC_DBG_G_REGISTER: | ||
3591 | case VIDIOC_DBG_S_REGISTER: | ||
3564 | return bttv_common_ioctls(btv,cmd,arg); | 3592 | return bttv_common_ioctls(btv,cmd,arg); |
3565 | 3593 | ||
3566 | default: | 3594 | default: |
@@ -3943,6 +3971,8 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
3943 | case VIDIOCGAUDIO: | 3971 | case VIDIOCGAUDIO: |
3944 | case VIDIOCSAUDIO: | 3972 | case VIDIOCSAUDIO: |
3945 | case VIDIOC_LOG_STATUS: | 3973 | case VIDIOC_LOG_STATUS: |
3974 | case VIDIOC_DBG_G_REGISTER: | ||
3975 | case VIDIOC_DBG_S_REGISTER: | ||
3946 | return bttv_common_ioctls(btv,cmd,arg); | 3976 | return bttv_common_ioctls(btv,cmd,arg); |
3947 | 3977 | ||
3948 | default: | 3978 | default: |
diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index 6f74c8042bc3..94a13d0ee614 100644 --- a/drivers/media/video/bt8xx/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c | |||
@@ -313,7 +313,7 @@ int bttv_input_init(struct bttv *btv) | |||
313 | input_dev->id.vendor = btv->c.pci->vendor; | 313 | input_dev->id.vendor = btv->c.pci->vendor; |
314 | input_dev->id.product = btv->c.pci->device; | 314 | input_dev->id.product = btv->c.pci->device; |
315 | } | 315 | } |
316 | input_dev->cdev.dev = &btv->c.pci->dev; | 316 | input_dev->dev.parent = &btv->c.pci->dev; |
317 | 317 | ||
318 | btv->remote = ir; | 318 | btv->remote = ir; |
319 | bttv_ir_start(btv, ir); | 319 | bttv_ir_start(btv, ir); |
diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h index f821ba69db99..dcc847dc2486 100644 --- a/drivers/media/video/bt8xx/bttv.h +++ b/drivers/media/video/bt8xx/bttv.h | |||
@@ -170,6 +170,8 @@ | |||
170 | #define BTTV_BOARD_MACHTV_MAGICTV 0x90 | 170 | #define BTTV_BOARD_MACHTV_MAGICTV 0x90 |
171 | #define BTTV_BOARD_SSAI_SECURITY 0x91 | 171 | #define BTTV_BOARD_SSAI_SECURITY 0x91 |
172 | #define BTTV_BOARD_SSAI_ULTRASOUND 0x92 | 172 | #define BTTV_BOARD_SSAI_ULTRASOUND 0x92 |
173 | #define BTTV_BOARD_VOODOOTV_200 0x93 | ||
174 | #define BTTV_BOARD_DVICO_FUSIONHDTV_2 0x94 | ||
173 | 175 | ||
174 | /* more card-specific defines */ | 176 | /* more card-specific defines */ |
175 | #define PT2254_L_CHANNEL 0x10 | 177 | #define PT2254_L_CHANNEL 0x10 |
diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index 8f44f02029be..bd85f6d0fbe3 100644 --- a/drivers/media/video/bt8xx/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h | |||
@@ -33,12 +33,12 @@ | |||
33 | #include <linux/i2c.h> | 33 | #include <linux/i2c.h> |
34 | #include <linux/i2c-algo-bit.h> | 34 | #include <linux/i2c-algo-bit.h> |
35 | #include <linux/videodev.h> | 35 | #include <linux/videodev.h> |
36 | #include <media/v4l2-common.h> | ||
37 | #include <linux/pci.h> | 36 | #include <linux/pci.h> |
38 | #include <linux/input.h> | 37 | #include <linux/input.h> |
39 | #include <linux/mutex.h> | 38 | #include <linux/mutex.h> |
40 | #include <asm/scatterlist.h> | 39 | #include <asm/scatterlist.h> |
41 | #include <asm/io.h> | 40 | #include <asm/io.h> |
41 | #include <media/v4l2-common.h> | ||
42 | 42 | ||
43 | #include <linux/device.h> | 43 | #include <linux/device.h> |
44 | #include <media/video-buf.h> | 44 | #include <media/video-buf.h> |
diff --git a/drivers/media/video/cpia2/cpia2_core.c b/drivers/media/video/cpia2/cpia2_core.c index fd771c7a2fe2..55aab8d38880 100644 --- a/drivers/media/video/cpia2/cpia2_core.c +++ b/drivers/media/video/cpia2/cpia2_core.c | |||
@@ -663,15 +663,13 @@ int cpia2_reset_camera(struct camera_data *cam) | |||
663 | cpia2_send_command(cam, &cmd); | 663 | cpia2_send_command(cam, &cmd); |
664 | } | 664 | } |
665 | 665 | ||
666 | current->state = TASK_INTERRUPTIBLE; | 666 | schedule_timeout_interruptible(msecs_to_jiffies(100)); |
667 | schedule_timeout(100 * HZ / 1000); /* wait for 100 msecs */ | ||
668 | 667 | ||
669 | if (cam->params.pnp_id.device_type == DEVICE_STV_672) | 668 | if (cam->params.pnp_id.device_type == DEVICE_STV_672) |
670 | retval = apply_vp_patch(cam); | 669 | retval = apply_vp_patch(cam); |
671 | 670 | ||
672 | /* wait for vp to go to sleep */ | 671 | /* wait for vp to go to sleep */ |
673 | current->state = TASK_INTERRUPTIBLE; | 672 | schedule_timeout_interruptible(msecs_to_jiffies(100)); |
674 | schedule_timeout(100 * HZ / 1000); /* wait for 100 msecs */ | ||
675 | 673 | ||
676 | /*** | 674 | /*** |
677 | * If this is a 676, apply VP5 fixes before we start streaming | 675 | * If this is a 676, apply VP5 fixes before we start streaming |
@@ -720,8 +718,7 @@ int cpia2_reset_camera(struct camera_data *cam) | |||
720 | set_default_user_mode(cam); | 718 | set_default_user_mode(cam); |
721 | 719 | ||
722 | /* Give VP time to wake up */ | 720 | /* Give VP time to wake up */ |
723 | current->state = TASK_INTERRUPTIBLE; | 721 | schedule_timeout_interruptible(msecs_to_jiffies(100)); |
724 | schedule_timeout(100 * HZ / 1000); /* wait for 100 msecs */ | ||
725 | 722 | ||
726 | set_all_properties(cam); | 723 | set_all_properties(cam); |
727 | 724 | ||
diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index 1bda7ad9de11..92778cd1d735 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c | |||
@@ -105,7 +105,7 @@ static struct control_menu_info framerate_controls[] = | |||
105 | { CPIA2_VP_FRAMERATE_25, "25 fps" }, | 105 | { CPIA2_VP_FRAMERATE_25, "25 fps" }, |
106 | { CPIA2_VP_FRAMERATE_30, "30 fps" }, | 106 | { CPIA2_VP_FRAMERATE_30, "30 fps" }, |
107 | }; | 107 | }; |
108 | #define NUM_FRAMERATE_CONTROLS (sizeof(framerate_controls)/sizeof(framerate_controls[0])) | 108 | #define NUM_FRAMERATE_CONTROLS (ARRAY_SIZE(framerate_controls)) |
109 | 109 | ||
110 | static struct control_menu_info flicker_controls[] = | 110 | static struct control_menu_info flicker_controls[] = |
111 | { | 111 | { |
@@ -113,7 +113,7 @@ static struct control_menu_info flicker_controls[] = | |||
113 | { FLICKER_50, "50 Hz" }, | 113 | { FLICKER_50, "50 Hz" }, |
114 | { FLICKER_60, "60 Hz" }, | 114 | { FLICKER_60, "60 Hz" }, |
115 | }; | 115 | }; |
116 | #define NUM_FLICKER_CONTROLS (sizeof(flicker_controls)/sizeof(flicker_controls[0])) | 116 | #define NUM_FLICKER_CONTROLS (ARRAY_SIZE(flicker_controls)) |
117 | 117 | ||
118 | static struct control_menu_info lights_controls[] = | 118 | static struct control_menu_info lights_controls[] = |
119 | { | 119 | { |
@@ -122,7 +122,7 @@ static struct control_menu_info lights_controls[] = | |||
122 | { 128, "Bottom" }, | 122 | { 128, "Bottom" }, |
123 | { 192, "Both" }, | 123 | { 192, "Both" }, |
124 | }; | 124 | }; |
125 | #define NUM_LIGHTS_CONTROLS (sizeof(lights_controls)/sizeof(lights_controls[0])) | 125 | #define NUM_LIGHTS_CONTROLS (ARRAY_SIZE(lights_controls)) |
126 | #define GPIO_LIGHTS_MASK 192 | 126 | #define GPIO_LIGHTS_MASK 192 |
127 | 127 | ||
128 | static struct v4l2_queryctrl controls[] = { | 128 | static struct v4l2_queryctrl controls[] = { |
@@ -235,7 +235,7 @@ static struct v4l2_queryctrl controls[] = { | |||
235 | .default_value = 0, | 235 | .default_value = 0, |
236 | }, | 236 | }, |
237 | }; | 237 | }; |
238 | #define NUM_CONTROLS (sizeof(controls)/sizeof(controls[0])) | 238 | #define NUM_CONTROLS (ARRAY_SIZE(controls)) |
239 | 239 | ||
240 | 240 | ||
241 | /****************************************************************************** | 241 | /****************************************************************************** |
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index 0f9d96963618..f750a543c961 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig | |||
@@ -47,7 +47,7 @@ config VIDEO_CX88_DVB | |||
47 | tristate "DVB/ATSC Support for cx2388x based TV cards" | 47 | tristate "DVB/ATSC Support for cx2388x based TV cards" |
48 | depends on VIDEO_CX88 && DVB_CORE | 48 | depends on VIDEO_CX88 && DVB_CORE |
49 | select VIDEO_BUF_DVB | 49 | select VIDEO_BUF_DVB |
50 | select DVB_PLL | 50 | select DVB_PLL if !DVB_FE_CUSTOMISE |
51 | select DVB_MT352 if !DVB_FE_CUSTOMISE | 51 | select DVB_MT352 if !DVB_FE_CUSTOMISE |
52 | select DVB_ZL10353 if !DVB_FE_CUSTOMISE | 52 | select DVB_ZL10353 if !DVB_FE_CUSTOMISE |
53 | select DVB_OR51132 if !DVB_FE_CUSTOMISE | 53 | select DVB_OR51132 if !DVB_FE_CUSTOMISE |
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index a80b1cb1abe8..f2fcdb92ecce 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -56,8 +56,7 @@ MODULE_PARM_DESC(debug,"enable debug messages [blackbird]"); | |||
56 | 56 | ||
57 | /* ------------------------------------------------------------------ */ | 57 | /* ------------------------------------------------------------------ */ |
58 | 58 | ||
59 | #define OLD_BLACKBIRD_FIRM_IMAGE_SIZE 262144 | 59 | #define BLACKBIRD_FIRM_IMAGE_SIZE 376836 |
60 | #define BLACKBIRD_FIRM_IMAGE_SIZE 376836 | ||
61 | 60 | ||
62 | /* defines below are from ivtv-driver.h */ | 61 | /* defines below are from ivtv-driver.h */ |
63 | 62 | ||
@@ -405,7 +404,7 @@ static int blackbird_find_mailbox(struct cx8802_dev *dev) | |||
405 | u32 value; | 404 | u32 value; |
406 | int i; | 405 | int i; |
407 | 406 | ||
408 | for (i = 0; i < dev->fw_size; i++) { | 407 | for (i = 0; i < BLACKBIRD_FIRM_IMAGE_SIZE; i++) { |
409 | memory_read(dev->core, i, &value); | 408 | memory_read(dev->core, i, &value); |
410 | if (value == signature[signaturecnt]) | 409 | if (value == signature[signaturecnt]) |
411 | signaturecnt++; | 410 | signaturecnt++; |
@@ -453,15 +452,12 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) | |||
453 | return -1; | 452 | return -1; |
454 | } | 453 | } |
455 | 454 | ||
456 | if ((firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) && | 455 | if (firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) { |
457 | (firmware->size != OLD_BLACKBIRD_FIRM_IMAGE_SIZE)) { | 456 | dprintk(0, "ERROR: Firmware size mismatch (have %zd, expected %d)\n", |
458 | dprintk(0, "ERROR: Firmware size mismatch (have %zd, expected %d or %d)\n", | 457 | firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE); |
459 | firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE, | ||
460 | OLD_BLACKBIRD_FIRM_IMAGE_SIZE); | ||
461 | release_firmware(firmware); | 458 | release_firmware(firmware); |
462 | return -1; | 459 | return -1; |
463 | } | 460 | } |
464 | dev->fw_size = firmware->size; | ||
465 | 461 | ||
466 | if (0 != memcmp(firmware->data, magic, 8)) { | 462 | if (0 != memcmp(firmware->data, magic, 8)) { |
467 | dprintk(0, "ERROR: Firmware magic mismatch, wrong file?\n"); | 463 | dprintk(0, "ERROR: Firmware magic mismatch, wrong file?\n"); |
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index e61102dc8ad7..6a136ddbccf8 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -1335,6 +1335,26 @@ struct cx88_board cx88_boards[] = { | |||
1335 | /* fixme: Add radio support */ | 1335 | /* fixme: Add radio support */ |
1336 | .mpeg = CX88_MPEG_DVB | CX88_MPEG_BLACKBIRD, | 1336 | .mpeg = CX88_MPEG_DVB | CX88_MPEG_BLACKBIRD, |
1337 | }, | 1337 | }, |
1338 | [CX88_BOARD_ADSTECH_PTV_390] = { | ||
1339 | .name = "ADS Tech Instant Video PCI", | ||
1340 | .tuner_type = TUNER_ABSENT, | ||
1341 | .radio_type = UNSET, | ||
1342 | .tuner_addr = ADDR_UNSET, | ||
1343 | .radio_addr = ADDR_UNSET, | ||
1344 | .input = {{ | ||
1345 | .type = CX88_VMUX_DEBUG, | ||
1346 | .vmux = 3, | ||
1347 | .gpio0 = 0x04ff, | ||
1348 | },{ | ||
1349 | .type = CX88_VMUX_COMPOSITE1, | ||
1350 | .vmux = 1, | ||
1351 | .gpio0 = 0x07fa, | ||
1352 | },{ | ||
1353 | .type = CX88_VMUX_SVIDEO, | ||
1354 | .vmux = 2, | ||
1355 | .gpio0 = 0x07fa, | ||
1356 | }}, | ||
1357 | }, | ||
1338 | }; | 1358 | }; |
1339 | const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); | 1359 | const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); |
1340 | 1360 | ||
@@ -1641,6 +1661,10 @@ struct cx88_subid cx88_subids[] = { | |||
1641 | .subvendor = 0x1421, | 1661 | .subvendor = 0x1421, |
1642 | .subdevice = 0x0341, /* ADS Tech InstantTV DVB-S */ | 1662 | .subdevice = 0x0341, /* ADS Tech InstantTV DVB-S */ |
1643 | .card = CX88_BOARD_KWORLD_DVBS_100, | 1663 | .card = CX88_BOARD_KWORLD_DVBS_100, |
1664 | },{ | ||
1665 | .subvendor = 0x1421, | ||
1666 | .subdevice = 0x0390, | ||
1667 | .card = CX88_BOARD_ADSTECH_PTV_390, | ||
1644 | }, | 1668 | }, |
1645 | }; | 1669 | }; |
1646 | const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); | 1670 | const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); |
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index dbfe4dc9cf8c..1773b40467dc 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -35,9 +35,7 @@ | |||
35 | 35 | ||
36 | #include "mt352.h" | 36 | #include "mt352.h" |
37 | #include "mt352_priv.h" | 37 | #include "mt352_priv.h" |
38 | #if defined(CONFIG_VIDEO_CX88_VP3054) || defined(CONFIG_VIDEO_CX88_VP3054_MODULE) | 38 | #include "cx88-vp3054-i2c.h" |
39 | # include "cx88-vp3054-i2c.h" | ||
40 | #endif | ||
41 | #include "zl10353.h" | 39 | #include "zl10353.h" |
42 | #include "cx22702.h" | 40 | #include "cx22702.h" |
43 | #include "or51132.h" | 41 | #include "or51132.h" |
@@ -199,7 +197,7 @@ static struct mt352_config dvico_fusionhdtv_dual = { | |||
199 | .demod_init = dvico_dual_demod_init, | 197 | .demod_init = dvico_dual_demod_init, |
200 | }; | 198 | }; |
201 | 199 | ||
202 | #if defined(CONFIG_VIDEO_CX88_VP3054) || defined(CONFIG_VIDEO_CX88_VP3054_MODULE) | 200 | #if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE)) |
203 | static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe) | 201 | static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe) |
204 | { | 202 | { |
205 | static u8 clock_config [] = { 0x89, 0x38, 0x38 }; | 203 | static u8 clock_config [] = { 0x89, 0x38, 0x38 }; |
@@ -223,64 +221,6 @@ static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe) | |||
223 | return 0; | 221 | return 0; |
224 | } | 222 | } |
225 | 223 | ||
226 | static int philips_fmd1216_pll_init(struct dvb_frontend *fe) | ||
227 | { | ||
228 | struct cx8802_dev *dev= fe->dvb->priv; | ||
229 | |||
230 | /* this message is to set up ATC and ALC */ | ||
231 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0xa0 }; | ||
232 | struct i2c_msg msg = | ||
233 | { .addr = dev->core->pll_addr, .flags = 0, | ||
234 | .buf = fmd1216_init, .len = sizeof(fmd1216_init) }; | ||
235 | int err; | ||
236 | |||
237 | if (fe->ops.i2c_gate_ctrl) | ||
238 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
239 | if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { | ||
240 | if (err < 0) | ||
241 | return err; | ||
242 | else | ||
243 | return -EREMOTEIO; | ||
244 | } | ||
245 | |||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | static int dntv_live_dvbt_pro_tuner_set_params(struct dvb_frontend* fe, | ||
250 | struct dvb_frontend_parameters* params) | ||
251 | { | ||
252 | struct cx8802_dev *dev= fe->dvb->priv; | ||
253 | u8 buf[4]; | ||
254 | struct i2c_msg msg = | ||
255 | { .addr = dev->core->pll_addr, .flags = 0, | ||
256 | .buf = buf, .len = 4 }; | ||
257 | int err; | ||
258 | |||
259 | /* Switch PLL to DVB mode */ | ||
260 | err = philips_fmd1216_pll_init(fe); | ||
261 | if (err) | ||
262 | return err; | ||
263 | |||
264 | /* Tune PLL */ | ||
265 | dvb_pll_configure(dev->core->pll_desc, buf, | ||
266 | params->frequency, | ||
267 | params->u.ofdm.bandwidth); | ||
268 | if (fe->ops.i2c_gate_ctrl) | ||
269 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
270 | if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { | ||
271 | |||
272 | printk(KERN_WARNING "cx88-dvb: %s error " | ||
273 | "(addr %02x <- %02x, err = %i)\n", | ||
274 | __FUNCTION__, dev->core->pll_addr, buf[0], err); | ||
275 | if (err < 0) | ||
276 | return err; | ||
277 | else | ||
278 | return -EREMOTEIO; | ||
279 | } | ||
280 | |||
281 | return 0; | ||
282 | } | ||
283 | |||
284 | static struct mt352_config dntv_live_dvbt_pro_config = { | 224 | static struct mt352_config dntv_live_dvbt_pro_config = { |
285 | .demod_address = 0x0f, | 225 | .demod_address = 0x0f, |
286 | .no_tuner = 1, | 226 | .no_tuner = 1, |
@@ -370,18 +310,8 @@ static int nxt200x_set_ts_param(struct dvb_frontend* fe, int is_punctured) | |||
370 | return 0; | 310 | return 0; |
371 | } | 311 | } |
372 | 312 | ||
373 | static int nxt200x_set_pll_input(u8* buf, int input) | ||
374 | { | ||
375 | if (input) | ||
376 | buf[3] |= 0x08; | ||
377 | else | ||
378 | buf[3] &= ~0x08; | ||
379 | return 0; | ||
380 | } | ||
381 | |||
382 | static struct nxt200x_config ati_hdtvwonder = { | 313 | static struct nxt200x_config ati_hdtvwonder = { |
383 | .demod_address = 0x0a, | 314 | .demod_address = 0x0a, |
384 | .set_pll_input = nxt200x_set_pll_input, | ||
385 | .set_ts_params = nxt200x_set_ts_param, | 315 | .set_ts_params = nxt200x_set_ts_param, |
386 | }; | 316 | }; |
387 | 317 | ||
@@ -456,7 +386,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
456 | if (dev->dvb.frontend != NULL) { | 386 | if (dev->dvb.frontend != NULL) { |
457 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 387 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
458 | &dev->core->i2c_adap, | 388 | &dev->core->i2c_adap, |
459 | &dvb_pll_thomson_dtt759x); | 389 | DVB_PLL_THOMSON_DTT759X); |
460 | } | 390 | } |
461 | break; | 391 | break; |
462 | case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: | 392 | case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: |
@@ -469,7 +399,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
469 | if (dev->dvb.frontend != NULL) { | 399 | if (dev->dvb.frontend != NULL) { |
470 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, | 400 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, |
471 | &dev->core->i2c_adap, | 401 | &dev->core->i2c_adap, |
472 | &dvb_pll_thomson_dtt7579); | 402 | DVB_PLL_THOMSON_DTT7579); |
473 | } | 403 | } |
474 | break; | 404 | break; |
475 | case CX88_BOARD_WINFAST_DTV2000H: | 405 | case CX88_BOARD_WINFAST_DTV2000H: |
@@ -482,7 +412,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
482 | &dev->core->i2c_adap); | 412 | &dev->core->i2c_adap); |
483 | if (dev->dvb.frontend != NULL) { | 413 | if (dev->dvb.frontend != NULL) { |
484 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 414 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
485 | &dev->core->i2c_adap, &dvb_pll_fmd1216me); | 415 | &dev->core->i2c_adap, DVB_PLL_FMD1216ME); |
486 | } | 416 | } |
487 | break; | 417 | break; |
488 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: | 418 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: |
@@ -491,7 +421,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
491 | &dev->core->i2c_adap); | 421 | &dev->core->i2c_adap); |
492 | if (dev->dvb.frontend != NULL) { | 422 | if (dev->dvb.frontend != NULL) { |
493 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, | 423 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, |
494 | NULL, &dvb_pll_thomson_dtt7579); | 424 | NULL, DVB_PLL_THOMSON_DTT7579); |
495 | break; | 425 | break; |
496 | } | 426 | } |
497 | /* ZL10353 replaces MT352 on later cards */ | 427 | /* ZL10353 replaces MT352 on later cards */ |
@@ -500,7 +430,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
500 | &dev->core->i2c_adap); | 430 | &dev->core->i2c_adap); |
501 | if (dev->dvb.frontend != NULL) { | 431 | if (dev->dvb.frontend != NULL) { |
502 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, | 432 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, |
503 | NULL, &dvb_pll_thomson_dtt7579); | 433 | NULL, DVB_PLL_THOMSON_DTT7579); |
504 | } | 434 | } |
505 | break; | 435 | break; |
506 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: | 436 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: |
@@ -511,7 +441,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
511 | &dev->core->i2c_adap); | 441 | &dev->core->i2c_adap); |
512 | if (dev->dvb.frontend != NULL) { | 442 | if (dev->dvb.frontend != NULL) { |
513 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 443 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
514 | NULL, &dvb_pll_thomson_dtt7579); | 444 | NULL, DVB_PLL_THOMSON_DTT7579); |
515 | break; | 445 | break; |
516 | } | 446 | } |
517 | /* ZL10353 replaces MT352 on later cards */ | 447 | /* ZL10353 replaces MT352 on later cards */ |
@@ -520,7 +450,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
520 | &dev->core->i2c_adap); | 450 | &dev->core->i2c_adap); |
521 | if (dev->dvb.frontend != NULL) { | 451 | if (dev->dvb.frontend != NULL) { |
522 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 452 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
523 | NULL, &dvb_pll_thomson_dtt7579); | 453 | NULL, DVB_PLL_THOMSON_DTT7579); |
524 | } | 454 | } |
525 | break; | 455 | break; |
526 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: | 456 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: |
@@ -529,7 +459,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
529 | &dev->core->i2c_adap); | 459 | &dev->core->i2c_adap); |
530 | if (dev->dvb.frontend != NULL) { | 460 | if (dev->dvb.frontend != NULL) { |
531 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 461 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
532 | NULL, &dvb_pll_lg_z201); | 462 | NULL, DVB_PLL_LG_Z201); |
533 | } | 463 | } |
534 | break; | 464 | break; |
535 | case CX88_BOARD_KWORLD_DVB_T: | 465 | case CX88_BOARD_KWORLD_DVB_T: |
@@ -540,17 +470,16 @@ static int dvb_register(struct cx8802_dev *dev) | |||
540 | &dev->core->i2c_adap); | 470 | &dev->core->i2c_adap); |
541 | if (dev->dvb.frontend != NULL) { | 471 | if (dev->dvb.frontend != NULL) { |
542 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 472 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
543 | NULL, &dvb_pll_unknown_1); | 473 | NULL, DVB_PLL_UNKNOWN_1); |
544 | } | 474 | } |
545 | break; | 475 | break; |
546 | case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: | 476 | case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: |
547 | #if defined(CONFIG_VIDEO_CX88_VP3054) || defined(CONFIG_VIDEO_CX88_VP3054_MODULE) | 477 | #if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE)) |
548 | dev->core->pll_addr = 0x61; | ||
549 | dev->core->pll_desc = &dvb_pll_fmd1216me; | ||
550 | dev->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config, | 478 | dev->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config, |
551 | &((struct vp3054_i2c_state *)dev->card_priv)->adap); | 479 | &((struct vp3054_i2c_state *)dev->card_priv)->adap); |
552 | if (dev->dvb.frontend != NULL) { | 480 | if (dev->dvb.frontend != NULL) { |
553 | dev->dvb.frontend->ops.tuner_ops.set_params = dntv_live_dvbt_pro_tuner_set_params; | 481 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
482 | &dev->core->i2c_adap, DVB_PLL_FMD1216ME); | ||
554 | } | 483 | } |
555 | #else | 484 | #else |
556 | printk("%s: built without vp3054 support\n", dev->core->name); | 485 | printk("%s: built without vp3054 support\n", dev->core->name); |
@@ -563,7 +492,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
563 | if (dev->dvb.frontend != NULL) { | 492 | if (dev->dvb.frontend != NULL) { |
564 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 493 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
565 | &dev->core->i2c_adap, | 494 | &dev->core->i2c_adap, |
566 | &dvb_pll_thomson_fe6600); | 495 | DVB_PLL_THOMSON_FE6600); |
567 | } | 496 | } |
568 | break; | 497 | break; |
569 | case CX88_BOARD_PCHDTV_HD3000: | 498 | case CX88_BOARD_PCHDTV_HD3000: |
@@ -572,7 +501,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
572 | if (dev->dvb.frontend != NULL) { | 501 | if (dev->dvb.frontend != NULL) { |
573 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 502 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
574 | &dev->core->i2c_adap, | 503 | &dev->core->i2c_adap, |
575 | &dvb_pll_thomson_dtt761x); | 504 | DVB_PLL_THOMSON_DTT761X); |
576 | } | 505 | } |
577 | break; | 506 | break; |
578 | case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: | 507 | case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: |
@@ -594,7 +523,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
594 | if (dev->dvb.frontend != NULL) { | 523 | if (dev->dvb.frontend != NULL) { |
595 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 524 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
596 | &dev->core->i2c_adap, | 525 | &dev->core->i2c_adap, |
597 | &dvb_pll_microtune_4042); | 526 | DVB_PLL_MICROTUNE_4042); |
598 | } | 527 | } |
599 | } | 528 | } |
600 | break; | 529 | break; |
@@ -614,7 +543,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
614 | if (dev->dvb.frontend != NULL) { | 543 | if (dev->dvb.frontend != NULL) { |
615 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 544 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
616 | &dev->core->i2c_adap, | 545 | &dev->core->i2c_adap, |
617 | &dvb_pll_thomson_dtt761x); | 546 | DVB_PLL_THOMSON_DTT761X); |
618 | } | 547 | } |
619 | } | 548 | } |
620 | break; | 549 | break; |
@@ -634,7 +563,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
634 | if (dev->dvb.frontend != NULL) { | 563 | if (dev->dvb.frontend != NULL) { |
635 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 564 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
636 | &dev->core->i2c_adap, | 565 | &dev->core->i2c_adap, |
637 | &dvb_pll_lg_tdvs_h06xf); | 566 | DVB_PLL_LG_TDVS_H06XF); |
638 | } | 567 | } |
639 | } | 568 | } |
640 | break; | 569 | break; |
@@ -654,7 +583,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
654 | if (dev->dvb.frontend != NULL) { | 583 | if (dev->dvb.frontend != NULL) { |
655 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 584 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
656 | &dev->core->i2c_adap, | 585 | &dev->core->i2c_adap, |
657 | &dvb_pll_lg_tdvs_h06xf); | 586 | DVB_PLL_LG_TDVS_H06XF); |
658 | } | 587 | } |
659 | } | 588 | } |
660 | break; | 589 | break; |
@@ -664,7 +593,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
664 | &dev->core->i2c_adap); | 593 | &dev->core->i2c_adap); |
665 | if (dev->dvb.frontend != NULL) { | 594 | if (dev->dvb.frontend != NULL) { |
666 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 595 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
667 | NULL, &dvb_pll_tuv1236d); | 596 | NULL, DVB_PLL_TUV1236D); |
668 | } | 597 | } |
669 | break; | 598 | break; |
670 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: | 599 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: |
@@ -705,10 +634,6 @@ static int dvb_register(struct cx8802_dev *dev) | |||
705 | return -1; | 634 | return -1; |
706 | } | 635 | } |
707 | 636 | ||
708 | if (dev->core->pll_desc) { | ||
709 | dev->dvb.frontend->ops.info.frequency_min = dev->core->pll_desc->min; | ||
710 | dev->dvb.frontend->ops.info.frequency_max = dev->core->pll_desc->max; | ||
711 | } | ||
712 | /* Ensure all frontends negotiate bus access */ | 637 | /* Ensure all frontends negotiate bus access */ |
713 | dev->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl; | 638 | dev->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl; |
714 | 639 | ||
@@ -778,11 +703,10 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv) | |||
778 | if (!(cx88_boards[core->board].mpeg & CX88_MPEG_DVB)) | 703 | if (!(cx88_boards[core->board].mpeg & CX88_MPEG_DVB)) |
779 | goto fail_core; | 704 | goto fail_core; |
780 | 705 | ||
781 | #if defined(CONFIG_VIDEO_CX88_VP3054) || defined(CONFIG_VIDEO_CX88_VP3054_MODULE) | 706 | /* If vp3054 isn't enabled, a stub will just return 0 */ |
782 | err = vp3054_i2c_probe(dev); | 707 | err = vp3054_i2c_probe(dev); |
783 | if (0 != err) | 708 | if (0 != err) |
784 | goto fail_core; | 709 | goto fail_core; |
785 | #endif | ||
786 | 710 | ||
787 | /* dvb stuff */ | 711 | /* dvb stuff */ |
788 | printk("%s/2: cx2388x based dvb card\n", core->name); | 712 | printk("%s/2: cx2388x based dvb card\n", core->name); |
@@ -807,9 +731,7 @@ static int cx8802_dvb_remove(struct cx8802_driver *drv) | |||
807 | /* dvb */ | 731 | /* dvb */ |
808 | videobuf_dvb_unregister(&dev->dvb); | 732 | videobuf_dvb_unregister(&dev->dvb); |
809 | 733 | ||
810 | #if defined(CONFIG_VIDEO_CX88_VP3054) || defined(CONFIG_VIDEO_CX88_VP3054_MODULE) | ||
811 | vp3054_i2c_remove(dev); | 734 | vp3054_i2c_remove(dev); |
812 | #endif | ||
813 | 735 | ||
814 | return 0; | 736 | return 0; |
815 | } | 737 | } |
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c index 7919a1f9da06..78bbcfab9670 100644 --- a/drivers/media/video/cx88/cx88-i2c.c +++ b/drivers/media/video/cx88/cx88-i2c.c | |||
@@ -160,7 +160,7 @@ void cx88_call_i2c_clients(struct cx88_core *core, unsigned int cmd, void *arg) | |||
160 | i2c_clients_command(&core->i2c_adap, cmd, arg); | 160 | i2c_clients_command(&core->i2c_adap, cmd, arg); |
161 | } | 161 | } |
162 | 162 | ||
163 | static struct i2c_algo_bit_data cx8800_i2c_algo_template = { | 163 | static const struct i2c_algo_bit_data cx8800_i2c_algo_template = { |
164 | .setsda = cx8800_bit_setsda, | 164 | .setsda = cx8800_bit_setsda, |
165 | .setscl = cx8800_bit_setscl, | 165 | .setscl = cx8800_bit_setscl, |
166 | .getsda = cx8800_bit_getsda, | 166 | .getsda = cx8800_bit_getsda, |
@@ -171,18 +171,6 @@ static struct i2c_algo_bit_data cx8800_i2c_algo_template = { | |||
171 | 171 | ||
172 | /* ----------------------------------------------------------------------- */ | 172 | /* ----------------------------------------------------------------------- */ |
173 | 173 | ||
174 | static struct i2c_adapter cx8800_i2c_adap_template = { | ||
175 | .name = "cx2388x", | ||
176 | .owner = THIS_MODULE, | ||
177 | .id = I2C_HW_B_CX2388x, | ||
178 | .client_register = attach_inform, | ||
179 | .client_unregister = detach_inform, | ||
180 | }; | ||
181 | |||
182 | static struct i2c_client cx8800_i2c_client_template = { | ||
183 | .name = "cx88xx internal", | ||
184 | }; | ||
185 | |||
186 | static char *i2c_devs[128] = { | 174 | static char *i2c_devs[128] = { |
187 | [ 0x1c >> 1 ] = "lgdt330x", | 175 | [ 0x1c >> 1 ] = "lgdt330x", |
188 | [ 0x86 >> 1 ] = "tda9887/cx22702", | 176 | [ 0x86 >> 1 ] = "tda9887/cx22702", |
@@ -212,14 +200,9 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci) | |||
212 | /* Prevents usage of invalid delay values */ | 200 | /* Prevents usage of invalid delay values */ |
213 | if (i2c_udelay<5) | 201 | if (i2c_udelay<5) |
214 | i2c_udelay=5; | 202 | i2c_udelay=5; |
215 | cx8800_i2c_algo_template.udelay=i2c_udelay; | ||
216 | 203 | ||
217 | memcpy(&core->i2c_adap, &cx8800_i2c_adap_template, | ||
218 | sizeof(core->i2c_adap)); | ||
219 | memcpy(&core->i2c_algo, &cx8800_i2c_algo_template, | 204 | memcpy(&core->i2c_algo, &cx8800_i2c_algo_template, |
220 | sizeof(core->i2c_algo)); | 205 | sizeof(core->i2c_algo)); |
221 | memcpy(&core->i2c_client, &cx8800_i2c_client_template, | ||
222 | sizeof(core->i2c_client)); | ||
223 | 206 | ||
224 | if (core->tuner_type != TUNER_ABSENT) | 207 | if (core->tuner_type != TUNER_ABSENT) |
225 | core->i2c_adap.class |= I2C_CLASS_TV_ANALOG; | 208 | core->i2c_adap.class |= I2C_CLASS_TV_ANALOG; |
@@ -228,10 +211,16 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci) | |||
228 | 211 | ||
229 | core->i2c_adap.dev.parent = &pci->dev; | 212 | core->i2c_adap.dev.parent = &pci->dev; |
230 | strlcpy(core->i2c_adap.name,core->name,sizeof(core->i2c_adap.name)); | 213 | strlcpy(core->i2c_adap.name,core->name,sizeof(core->i2c_adap.name)); |
214 | core->i2c_adap.owner = THIS_MODULE; | ||
215 | core->i2c_adap.id = I2C_HW_B_CX2388x; | ||
216 | core->i2c_adap.client_register = attach_inform; | ||
217 | core->i2c_adap.client_unregister = detach_inform; | ||
218 | core->i2c_algo.udelay = i2c_udelay; | ||
231 | core->i2c_algo.data = core; | 219 | core->i2c_algo.data = core; |
232 | i2c_set_adapdata(&core->i2c_adap,core); | 220 | i2c_set_adapdata(&core->i2c_adap,core); |
233 | core->i2c_adap.algo_data = &core->i2c_algo; | 221 | core->i2c_adap.algo_data = &core->i2c_algo; |
234 | core->i2c_client.adapter = &core->i2c_adap; | 222 | core->i2c_client.adapter = &core->i2c_adap; |
223 | strlcpy(core->i2c_client.name, "cx88xx internal", I2C_NAME_SIZE); | ||
235 | 224 | ||
236 | cx8800_bit_setscl(core,1); | 225 | cx8800_bit_setscl(core,1); |
237 | cx8800_bit_setsda(core,1); | 226 | cx8800_bit_setsda(core,1); |
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 8136673fe9e8..f5d4a565346e 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c | |||
@@ -74,7 +74,8 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) | |||
74 | 74 | ||
75 | /* read gpio value */ | 75 | /* read gpio value */ |
76 | gpio = cx_read(ir->gpio_addr); | 76 | gpio = cx_read(ir->gpio_addr); |
77 | if (core->board == CX88_BOARD_NPGTECH_REALTV_TOP10FM) { | 77 | switch (core->board) { |
78 | case CX88_BOARD_NPGTECH_REALTV_TOP10FM: | ||
78 | /* This board apparently uses a combination of 2 GPIO | 79 | /* This board apparently uses a combination of 2 GPIO |
79 | to represent the keys. Additionally, the second GPIO | 80 | to represent the keys. Additionally, the second GPIO |
80 | can be used for parity. | 81 | can be used for parity. |
@@ -90,9 +91,14 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) | |||
90 | auxgpio = cx_read(MO_GP1_IO); | 91 | auxgpio = cx_read(MO_GP1_IO); |
91 | /* Take out the parity part */ | 92 | /* Take out the parity part */ |
92 | gpio=(gpio & 0x7fd) + (auxgpio & 0xef); | 93 | gpio=(gpio & 0x7fd) + (auxgpio & 0xef); |
93 | } else | 94 | break; |
95 | case CX88_BOARD_WINFAST_DTV1000: | ||
96 | gpio = (gpio & 0x6ff) | ((cx_read(MO_GP1_IO) << 8) & 0x900); | ||
94 | auxgpio = gpio; | 97 | auxgpio = gpio; |
95 | 98 | break; | |
99 | default: | ||
100 | auxgpio = gpio; | ||
101 | } | ||
96 | if (ir->polling) { | 102 | if (ir->polling) { |
97 | if (ir->last_gpio == auxgpio) | 103 | if (ir->last_gpio == auxgpio) |
98 | return; | 104 | return; |
@@ -148,20 +154,16 @@ static void ir_timer(unsigned long data) | |||
148 | static void cx88_ir_work(struct work_struct *work) | 154 | static void cx88_ir_work(struct work_struct *work) |
149 | { | 155 | { |
150 | struct cx88_IR *ir = container_of(work, struct cx88_IR, work); | 156 | struct cx88_IR *ir = container_of(work, struct cx88_IR, work); |
151 | unsigned long timeout; | ||
152 | 157 | ||
153 | cx88_ir_handle_key(ir); | 158 | cx88_ir_handle_key(ir); |
154 | timeout = jiffies + (ir->polling * HZ / 1000); | 159 | mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling)); |
155 | mod_timer(&ir->timer, timeout); | ||
156 | } | 160 | } |
157 | 161 | ||
158 | static void cx88_ir_start(struct cx88_core *core, struct cx88_IR *ir) | 162 | static void cx88_ir_start(struct cx88_core *core, struct cx88_IR *ir) |
159 | { | 163 | { |
160 | if (ir->polling) { | 164 | if (ir->polling) { |
165 | setup_timer(&ir->timer, ir_timer, (unsigned long)ir); | ||
161 | INIT_WORK(&ir->work, cx88_ir_work); | 166 | INIT_WORK(&ir->work, cx88_ir_work); |
162 | init_timer(&ir->timer); | ||
163 | ir->timer.function = ir_timer; | ||
164 | ir->timer.data = (unsigned long)ir; | ||
165 | schedule_work(&ir->work); | 167 | schedule_work(&ir->work); |
166 | } | 168 | } |
167 | if (ir->sampling) { | 169 | if (ir->sampling) { |
@@ -222,7 +224,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
222 | case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: | 224 | case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: |
223 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: | 225 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: |
224 | case CX88_BOARD_HAUPPAUGE_HVR1100: | 226 | case CX88_BOARD_HAUPPAUGE_HVR1100: |
225 | case CX88_BOARD_HAUPPAUGE_HVR1300: | ||
226 | case CX88_BOARD_HAUPPAUGE_HVR3000: | 227 | case CX88_BOARD_HAUPPAUGE_HVR3000: |
227 | ir_codes = ir_codes_hauppauge_new; | 228 | ir_codes = ir_codes_hauppauge_new; |
228 | ir_type = IR_TYPE_RC5; | 229 | ir_type = IR_TYPE_RC5; |
@@ -236,6 +237,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
236 | ir->polling = 50; /* ms */ | 237 | ir->polling = 50; /* ms */ |
237 | break; | 238 | break; |
238 | case CX88_BOARD_WINFAST2000XP_EXPERT: | 239 | case CX88_BOARD_WINFAST2000XP_EXPERT: |
240 | case CX88_BOARD_WINFAST_DTV1000: | ||
239 | ir_codes = ir_codes_winfast; | 241 | ir_codes = ir_codes_winfast; |
240 | ir->gpio_addr = MO_GP0_IO; | 242 | ir->gpio_addr = MO_GP0_IO; |
241 | ir->mask_keycode = 0x8f8; | 243 | ir->mask_keycode = 0x8f8; |
@@ -328,7 +330,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
328 | input_dev->id.vendor = pci->vendor; | 330 | input_dev->id.vendor = pci->vendor; |
329 | input_dev->id.product = pci->device; | 331 | input_dev->id.product = pci->device; |
330 | } | 332 | } |
331 | input_dev->cdev.dev = &pci->dev; | 333 | input_dev->dev.parent = &pci->dev; |
332 | /* record handles to ourself */ | 334 | /* record handles to ourself */ |
333 | ir->core = core; | 335 | ir->core = core; |
334 | core->ir = ir; | 336 | core->ir = ir; |
@@ -442,7 +444,6 @@ void cx88_ir_irq(struct cx88_core *core) | |||
442 | case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: | 444 | case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: |
443 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: | 445 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: |
444 | case CX88_BOARD_HAUPPAUGE_HVR1100: | 446 | case CX88_BOARD_HAUPPAUGE_HVR1100: |
445 | case CX88_BOARD_HAUPPAUGE_HVR1300: | ||
446 | case CX88_BOARD_HAUPPAUGE_HVR3000: | 447 | case CX88_BOARD_HAUPPAUGE_HVR3000: |
447 | ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); | 448 | ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); |
448 | ir_dprintk("biphase decoded: %x\n", ircode); | 449 | ir_dprintk("biphase decoded: %x\n", ircode); |
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index 543b05ebc0e7..317a2a3f9cc1 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c | |||
@@ -336,7 +336,7 @@ static void cx8802_timeout(unsigned long data) | |||
336 | { | 336 | { |
337 | struct cx8802_dev *dev = (struct cx8802_dev*)data; | 337 | struct cx8802_dev *dev = (struct cx8802_dev*)data; |
338 | 338 | ||
339 | dprintk(0, "%s\n",__FUNCTION__); | 339 | dprintk(1, "%s\n",__FUNCTION__); |
340 | 340 | ||
341 | if (debug) | 341 | if (debug) |
342 | cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]); | 342 | cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]); |
diff --git a/drivers/media/video/cx88/cx88-vp3054-i2c.c b/drivers/media/video/cx88/cx88-vp3054-i2c.c index 82bc3a28aa22..cd0877636a32 100644 --- a/drivers/media/video/cx88/cx88-vp3054-i2c.c +++ b/drivers/media/video/cx88/cx88-vp3054-i2c.c | |||
@@ -94,7 +94,7 @@ static int vp3054_bit_getsda(void *data) | |||
94 | 94 | ||
95 | /* ----------------------------------------------------------------------- */ | 95 | /* ----------------------------------------------------------------------- */ |
96 | 96 | ||
97 | static struct i2c_algo_bit_data vp3054_i2c_algo_template = { | 97 | static const struct i2c_algo_bit_data vp3054_i2c_algo_template = { |
98 | .setsda = vp3054_bit_setsda, | 98 | .setsda = vp3054_bit_setsda, |
99 | .setscl = vp3054_bit_setscl, | 99 | .setscl = vp3054_bit_setscl, |
100 | .getsda = vp3054_bit_getsda, | 100 | .getsda = vp3054_bit_getsda, |
@@ -105,12 +105,6 @@ static struct i2c_algo_bit_data vp3054_i2c_algo_template = { | |||
105 | 105 | ||
106 | /* ----------------------------------------------------------------------- */ | 106 | /* ----------------------------------------------------------------------- */ |
107 | 107 | ||
108 | static struct i2c_adapter vp3054_i2c_adap_template = { | ||
109 | .name = "cx2388x", | ||
110 | .owner = THIS_MODULE, | ||
111 | .id = I2C_HW_B_CX2388x, | ||
112 | }; | ||
113 | |||
114 | int vp3054_i2c_probe(struct cx8802_dev *dev) | 108 | int vp3054_i2c_probe(struct cx8802_dev *dev) |
115 | { | 109 | { |
116 | struct cx88_core *core = dev->core; | 110 | struct cx88_core *core = dev->core; |
@@ -125,8 +119,6 @@ int vp3054_i2c_probe(struct cx8802_dev *dev) | |||
125 | return -ENOMEM; | 119 | return -ENOMEM; |
126 | vp3054_i2c = dev->card_priv; | 120 | vp3054_i2c = dev->card_priv; |
127 | 121 | ||
128 | memcpy(&vp3054_i2c->adap, &vp3054_i2c_adap_template, | ||
129 | sizeof(vp3054_i2c->adap)); | ||
130 | memcpy(&vp3054_i2c->algo, &vp3054_i2c_algo_template, | 122 | memcpy(&vp3054_i2c->algo, &vp3054_i2c_algo_template, |
131 | sizeof(vp3054_i2c->algo)); | 123 | sizeof(vp3054_i2c->algo)); |
132 | 124 | ||
@@ -135,6 +127,8 @@ int vp3054_i2c_probe(struct cx8802_dev *dev) | |||
135 | vp3054_i2c->adap.dev.parent = &dev->pci->dev; | 127 | vp3054_i2c->adap.dev.parent = &dev->pci->dev; |
136 | strlcpy(vp3054_i2c->adap.name, core->name, | 128 | strlcpy(vp3054_i2c->adap.name, core->name, |
137 | sizeof(vp3054_i2c->adap.name)); | 129 | sizeof(vp3054_i2c->adap.name)); |
130 | vp3054_i2c->adap.owner = THIS_MODULE; | ||
131 | vp3054_i2c->adap.id = I2C_HW_B_CX2388x; | ||
138 | vp3054_i2c->algo.data = dev; | 132 | vp3054_i2c->algo.data = dev; |
139 | i2c_set_adapdata(&vp3054_i2c->adap, dev); | 133 | i2c_set_adapdata(&vp3054_i2c->adap, dev); |
140 | vp3054_i2c->adap.algo_data = &vp3054_i2c->algo; | 134 | vp3054_i2c->adap.algo_data = &vp3054_i2c->algo; |
diff --git a/drivers/media/video/cx88/cx88-vp3054-i2c.h b/drivers/media/video/cx88/cx88-vp3054-i2c.h index 637a7d232238..be99c931dc3e 100644 --- a/drivers/media/video/cx88/cx88-vp3054-i2c.h +++ b/drivers/media/video/cx88/cx88-vp3054-i2c.h | |||
@@ -30,5 +30,12 @@ struct vp3054_i2c_state { | |||
30 | }; | 30 | }; |
31 | 31 | ||
32 | /* ----------------------------------------------------------------------- */ | 32 | /* ----------------------------------------------------------------------- */ |
33 | #if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE)) | ||
33 | int vp3054_i2c_probe(struct cx8802_dev *dev); | 34 | int vp3054_i2c_probe(struct cx8802_dev *dev); |
34 | void vp3054_i2c_remove(struct cx8802_dev *dev); | 35 | void vp3054_i2c_remove(struct cx8802_dev *dev); |
36 | #else | ||
37 | static inline int vp3054_i2c_probe(struct cx8802_dev *dev) | ||
38 | { return 0; } | ||
39 | static inline void vp3054_i2c_remove(struct cx8802_dev *dev) | ||
40 | { } | ||
41 | #endif | ||
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 738d4f20c580..c4f656ec46b0 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h | |||
@@ -209,6 +209,7 @@ extern struct sram_channel cx88_sram_channels[]; | |||
209 | #define CX88_BOARD_NORWOOD_MICRO 54 | 209 | #define CX88_BOARD_NORWOOD_MICRO 54 |
210 | #define CX88_BOARD_TE_DTV_250_OEM_SWANN 55 | 210 | #define CX88_BOARD_TE_DTV_250_OEM_SWANN 55 |
211 | #define CX88_BOARD_HAUPPAUGE_HVR1300 56 | 211 | #define CX88_BOARD_HAUPPAUGE_HVR1300 56 |
212 | #define CX88_BOARD_ADSTECH_PTV_390 57 | ||
212 | 213 | ||
213 | enum cx88_itype { | 214 | enum cx88_itype { |
214 | CX88_VMUX_COMPOSITE1 = 1, | 215 | CX88_VMUX_COMPOSITE1 = 1, |
@@ -316,8 +317,6 @@ struct cx88_core { | |||
316 | 317 | ||
317 | /* config info -- dvb */ | 318 | /* config info -- dvb */ |
318 | #if defined(CONFIG_VIDEO_BUF_DVB) || defined(CONFIG_VIDEO_BUF_DVB_MODULE) | 319 | #if defined(CONFIG_VIDEO_BUF_DVB) || defined(CONFIG_VIDEO_BUF_DVB_MODULE) |
319 | struct dvb_pll_desc *pll_desc; | ||
320 | unsigned int pll_addr; | ||
321 | int (*prev_set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage); | 320 | int (*prev_set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage); |
322 | #endif | 321 | #endif |
323 | 322 | ||
@@ -463,13 +462,10 @@ struct cx8802_dev { | |||
463 | u32 mailbox; | 462 | u32 mailbox; |
464 | int width; | 463 | int width; |
465 | int height; | 464 | int height; |
466 | int fw_size; | ||
467 | 465 | ||
468 | #if defined(CONFIG_VIDEO_BUF_DVB) || defined(CONFIG_VIDEO_BUF_DVB_MODULE) | 466 | #if defined(CONFIG_VIDEO_BUF_DVB) || defined(CONFIG_VIDEO_BUF_DVB_MODULE) |
469 | /* for dvb only */ | 467 | /* for dvb only */ |
470 | struct videobuf_dvb dvb; | 468 | struct videobuf_dvb dvb; |
471 | void* fe_handle; | ||
472 | int (*fe_release)(void *handle); | ||
473 | 469 | ||
474 | void *card_priv; | 470 | void *card_priv; |
475 | #endif | 471 | #endif |
diff --git a/drivers/media/video/et61x251/Kconfig b/drivers/media/video/et61x251/Kconfig index 664676f44068..dcc1a0335440 100644 --- a/drivers/media/video/et61x251/Kconfig +++ b/drivers/media/video/et61x251/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config USB_ET61X251 | 1 | config USB_ET61X251 |
2 | tristate "USB ET61X[12]51 PC Camera Controller support" | 2 | tristate "USB ET61X[12]51 PC Camera Controller support" |
3 | depends on VIDEO_V4L1 | 3 | depends on VIDEO_V4L2 |
4 | ---help--- | 4 | ---help--- |
5 | Say Y here if you want support for cameras based on Etoms ET61X151 | 5 | Say Y here if you want support for cameras based on Etoms ET61X151 |
6 | or ET61X251 PC Camera Controllers. | 6 | or ET61X251 PC Camera Controllers. |
diff --git a/drivers/media/video/et61x251/et61x251.h b/drivers/media/video/et61x251/et61x251.h index 262f98e12409..02c741d8f85a 100644 --- a/drivers/media/video/et61x251/et61x251.h +++ b/drivers/media/video/et61x251/et61x251.h | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | #include <linux/stddef.h> | 37 | #include <linux/stddef.h> |
38 | #include <linux/string.h> | 38 | #include <linux/string.h> |
39 | #include <linux/kref.h> | ||
39 | 40 | ||
40 | #include "et61x251_sensor.h" | 41 | #include "et61x251_sensor.h" |
41 | 42 | ||
@@ -134,7 +135,7 @@ struct et61x251_module_param { | |||
134 | }; | 135 | }; |
135 | 136 | ||
136 | static DEFINE_MUTEX(et61x251_sysfs_lock); | 137 | static DEFINE_MUTEX(et61x251_sysfs_lock); |
137 | static DECLARE_RWSEM(et61x251_disconnect); | 138 | static DECLARE_RWSEM(et61x251_dev_lock); |
138 | 139 | ||
139 | struct et61x251_device { | 140 | struct et61x251_device { |
140 | struct video_device* v4ldev; | 141 | struct video_device* v4ldev; |
@@ -158,12 +159,14 @@ struct et61x251_device { | |||
158 | struct et61x251_sysfs_attr sysfs; | 159 | struct et61x251_sysfs_attr sysfs; |
159 | struct et61x251_module_param module_param; | 160 | struct et61x251_module_param module_param; |
160 | 161 | ||
162 | struct kref kref; | ||
161 | enum et61x251_dev_state state; | 163 | enum et61x251_dev_state state; |
162 | u8 users; | 164 | u8 users; |
163 | 165 | ||
164 | struct mutex dev_mutex, fileop_mutex; | 166 | struct completion probe; |
167 | struct mutex open_mutex, fileop_mutex; | ||
165 | spinlock_t queue_lock; | 168 | spinlock_t queue_lock; |
166 | wait_queue_head_t open, wait_frame, wait_stream; | 169 | wait_queue_head_t wait_open, wait_frame, wait_stream; |
167 | }; | 170 | }; |
168 | 171 | ||
169 | /*****************************************************************************/ | 172 | /*****************************************************************************/ |
@@ -177,7 +180,7 @@ et61x251_match_id(struct et61x251_device* cam, const struct usb_device_id *id) | |||
177 | 180 | ||
178 | void | 181 | void |
179 | et61x251_attach_sensor(struct et61x251_device* cam, | 182 | et61x251_attach_sensor(struct et61x251_device* cam, |
180 | struct et61x251_sensor* sensor) | 183 | const struct et61x251_sensor* sensor) |
181 | { | 184 | { |
182 | memcpy(&cam->sensor, sensor, sizeof(struct et61x251_sensor)); | 185 | memcpy(&cam->sensor, sensor, sizeof(struct et61x251_sensor)); |
183 | } | 186 | } |
@@ -195,8 +198,8 @@ do { \ | |||
195 | else if ((level) == 2) \ | 198 | else if ((level) == 2) \ |
196 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ | 199 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ |
197 | else if ((level) >= 3) \ | 200 | else if ((level) >= 3) \ |
198 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 201 | dev_info(&cam->usbdev->dev, "[%s:%s:%d] " fmt "\n", \ |
199 | __FUNCTION__, __LINE__ , ## args); \ | 202 | __FILE__, __FUNCTION__, __LINE__ , ## args); \ |
200 | } \ | 203 | } \ |
201 | } while (0) | 204 | } while (0) |
202 | # define KDBG(level, fmt, args...) \ | 205 | # define KDBG(level, fmt, args...) \ |
@@ -205,8 +208,8 @@ do { \ | |||
205 | if ((level) == 1 || (level) == 2) \ | 208 | if ((level) == 1 || (level) == 2) \ |
206 | pr_info("et61x251: " fmt "\n", ## args); \ | 209 | pr_info("et61x251: " fmt "\n", ## args); \ |
207 | else if ((level) == 3) \ | 210 | else if ((level) == 3) \ |
208 | pr_debug("et61x251: [%s:%d] " fmt "\n", __FUNCTION__, \ | 211 | pr_debug("sn9c102: [%s:%s:%d] " fmt "\n", __FILE__, \ |
209 | __LINE__ , ## args); \ | 212 | __FUNCTION__, __LINE__ , ## args); \ |
210 | } \ | 213 | } \ |
211 | } while (0) | 214 | } while (0) |
212 | # define V4LDBG(level, name, cmd) \ | 215 | # define V4LDBG(level, name, cmd) \ |
@@ -222,8 +225,8 @@ do { \ | |||
222 | 225 | ||
223 | #undef PDBG | 226 | #undef PDBG |
224 | #define PDBG(fmt, args...) \ | 227 | #define PDBG(fmt, args...) \ |
225 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 228 | dev_info(&cam->usbdev->dev, "[%s:%s:%d] " fmt "\n", __FILE__, __FUNCTION__, \ |
226 | __FUNCTION__, __LINE__ , ## args) | 229 | __LINE__ , ## args) |
227 | 230 | ||
228 | #undef PDBGG | 231 | #undef PDBGG |
229 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ | 232 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ |
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c index a6525513cd1e..585bd1fe0765 100644 --- a/drivers/media/video/et61x251/et61x251_core.c +++ b/drivers/media/video/et61x251/et61x251_core.c | |||
@@ -45,11 +45,11 @@ | |||
45 | 45 | ||
46 | #define ET61X251_MODULE_NAME "V4L2 driver for ET61X[12]51 " \ | 46 | #define ET61X251_MODULE_NAME "V4L2 driver for ET61X[12]51 " \ |
47 | "PC Camera Controllers" | 47 | "PC Camera Controllers" |
48 | #define ET61X251_MODULE_AUTHOR "(C) 2006 Luca Risolia" | 48 | #define ET61X251_MODULE_AUTHOR "(C) 2006-2007 Luca Risolia" |
49 | #define ET61X251_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" | 49 | #define ET61X251_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" |
50 | #define ET61X251_MODULE_LICENSE "GPL" | 50 | #define ET61X251_MODULE_LICENSE "GPL" |
51 | #define ET61X251_MODULE_VERSION "1:1.04" | 51 | #define ET61X251_MODULE_VERSION "1:1.09" |
52 | #define ET61X251_MODULE_VERSION_CODE KERNEL_VERSION(1, 1, 4) | 52 | #define ET61X251_MODULE_VERSION_CODE KERNEL_VERSION(1, 1, 9) |
53 | 53 | ||
54 | /*****************************************************************************/ | 54 | /*****************************************************************************/ |
55 | 55 | ||
@@ -245,7 +245,8 @@ int et61x251_read_reg(struct et61x251_device* cam, u16 index) | |||
245 | 245 | ||
246 | 246 | ||
247 | static int | 247 | static int |
248 | et61x251_i2c_wait(struct et61x251_device* cam, struct et61x251_sensor* sensor) | 248 | et61x251_i2c_wait(struct et61x251_device* cam, |
249 | const struct et61x251_sensor* sensor) | ||
249 | { | 250 | { |
250 | int i, r; | 251 | int i, r; |
251 | 252 | ||
@@ -270,7 +271,7 @@ et61x251_i2c_wait(struct et61x251_device* cam, struct et61x251_sensor* sensor) | |||
270 | 271 | ||
271 | int | 272 | int |
272 | et61x251_i2c_try_read(struct et61x251_device* cam, | 273 | et61x251_i2c_try_read(struct et61x251_device* cam, |
273 | struct et61x251_sensor* sensor, u8 address) | 274 | const struct et61x251_sensor* sensor, u8 address) |
274 | { | 275 | { |
275 | struct usb_device* udev = cam->usbdev; | 276 | struct usb_device* udev = cam->usbdev; |
276 | u8* data = cam->control_buffer; | 277 | u8* data = cam->control_buffer; |
@@ -303,7 +304,8 @@ et61x251_i2c_try_read(struct et61x251_device* cam, | |||
303 | 304 | ||
304 | int | 305 | int |
305 | et61x251_i2c_try_write(struct et61x251_device* cam, | 306 | et61x251_i2c_try_write(struct et61x251_device* cam, |
306 | struct et61x251_sensor* sensor, u8 address, u8 value) | 307 | const struct et61x251_sensor* sensor, u8 address, |
308 | u8 value) | ||
307 | { | 309 | { |
308 | struct usb_device* udev = cam->usbdev; | 310 | struct usb_device* udev = cam->usbdev; |
309 | u8* data = cam->control_buffer; | 311 | u8* data = cam->control_buffer; |
@@ -615,7 +617,7 @@ static int et61x251_start_transfer(struct et61x251_device* cam) | |||
615 | return 0; | 617 | return 0; |
616 | 618 | ||
617 | free_urbs: | 619 | free_urbs: |
618 | for (i = 0; (i < ET61X251_URBS) && cam->urb[i]; i++) | 620 | for (i = 0; (i < ET61X251_URBS) && cam->urb[i]; i++) |
619 | usb_free_urb(cam->urb[i]); | 621 | usb_free_urb(cam->urb[i]); |
620 | 622 | ||
621 | free_buffers: | 623 | free_buffers: |
@@ -682,7 +684,7 @@ static u8 et61x251_strtou8(const char* buff, size_t len, ssize_t* count) | |||
682 | 684 | ||
683 | if (len < 4) { | 685 | if (len < 4) { |
684 | strncpy(str, buff, len); | 686 | strncpy(str, buff, len); |
685 | str[len+1] = '\0'; | 687 | str[len] = '\0'; |
686 | } else { | 688 | } else { |
687 | strncpy(str, buff, 4); | 689 | strncpy(str, buff, 4); |
688 | str[4] = '\0'; | 690 | str[4] = '\0'; |
@@ -977,30 +979,30 @@ static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, | |||
977 | 979 | ||
978 | static int et61x251_create_sysfs(struct et61x251_device* cam) | 980 | static int et61x251_create_sysfs(struct et61x251_device* cam) |
979 | { | 981 | { |
980 | struct video_device *v4ldev = cam->v4ldev; | 982 | struct class_device *classdev = &(cam->v4ldev->class_dev); |
981 | int err = 0; | 983 | int err = 0; |
982 | 984 | ||
983 | if ((err = video_device_create_file(v4ldev, &class_device_attr_reg))) | 985 | if ((err = class_device_create_file(classdev, &class_device_attr_reg))) |
984 | goto err_out; | 986 | goto err_out; |
985 | if ((err = video_device_create_file(v4ldev, &class_device_attr_val))) | 987 | if ((err = class_device_create_file(classdev, &class_device_attr_val))) |
986 | goto err_reg; | 988 | goto err_reg; |
987 | 989 | ||
988 | if (cam->sensor.sysfs_ops) { | 990 | if (cam->sensor.sysfs_ops) { |
989 | if ((err = video_device_create_file(v4ldev, | 991 | if ((err = class_device_create_file(classdev, |
990 | &class_device_attr_i2c_reg))) | 992 | &class_device_attr_i2c_reg))) |
991 | goto err_val; | 993 | goto err_val; |
992 | if ((err = video_device_create_file(v4ldev, | 994 | if ((err = class_device_create_file(classdev, |
993 | &class_device_attr_i2c_val))) | 995 | &class_device_attr_i2c_val))) |
994 | goto err_i2c_reg; | 996 | goto err_i2c_reg; |
995 | } | 997 | } |
996 | 998 | ||
997 | err_i2c_reg: | 999 | err_i2c_reg: |
998 | if (cam->sensor.sysfs_ops) | 1000 | if (cam->sensor.sysfs_ops) |
999 | video_device_remove_file(v4ldev, &class_device_attr_i2c_reg); | 1001 | class_device_remove_file(classdev, &class_device_attr_i2c_reg); |
1000 | err_val: | 1002 | err_val: |
1001 | video_device_remove_file(v4ldev, &class_device_attr_val); | 1003 | class_device_remove_file(classdev, &class_device_attr_val); |
1002 | err_reg: | 1004 | err_reg: |
1003 | video_device_remove_file(v4ldev, &class_device_attr_reg); | 1005 | class_device_remove_file(classdev, &class_device_attr_reg); |
1004 | err_out: | 1006 | err_out: |
1005 | return err; | 1007 | return err; |
1006 | } | 1008 | } |
@@ -1103,7 +1105,8 @@ static int et61x251_init(struct et61x251_device* cam) | |||
1103 | int err = 0; | 1105 | int err = 0; |
1104 | 1106 | ||
1105 | if (!(cam->state & DEV_INITIALIZED)) { | 1107 | if (!(cam->state & DEV_INITIALIZED)) { |
1106 | init_waitqueue_head(&cam->open); | 1108 | mutex_init(&cam->open_mutex); |
1109 | init_waitqueue_head(&cam->wait_open); | ||
1107 | qctrl = s->qctrl; | 1110 | qctrl = s->qctrl; |
1108 | rect = &(s->cropcap.defrect); | 1111 | rect = &(s->cropcap.defrect); |
1109 | cam->compression.quality = ET61X251_COMPRESSION_QUALITY; | 1112 | cam->compression.quality = ET61X251_COMPRESSION_QUALITY; |
@@ -1177,64 +1180,80 @@ static int et61x251_init(struct et61x251_device* cam) | |||
1177 | return 0; | 1180 | return 0; |
1178 | } | 1181 | } |
1179 | 1182 | ||
1183 | /*****************************************************************************/ | ||
1180 | 1184 | ||
1181 | static void et61x251_release_resources(struct et61x251_device* cam) | 1185 | static void et61x251_release_resources(struct kref *kref) |
1182 | { | 1186 | { |
1187 | struct et61x251_device *cam; | ||
1188 | |||
1183 | mutex_lock(&et61x251_sysfs_lock); | 1189 | mutex_lock(&et61x251_sysfs_lock); |
1184 | 1190 | ||
1191 | cam = container_of(kref, struct et61x251_device, kref); | ||
1192 | |||
1185 | DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor); | 1193 | DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor); |
1186 | video_set_drvdata(cam->v4ldev, NULL); | 1194 | video_set_drvdata(cam->v4ldev, NULL); |
1187 | video_unregister_device(cam->v4ldev); | 1195 | video_unregister_device(cam->v4ldev); |
1196 | usb_put_dev(cam->usbdev); | ||
1197 | kfree(cam->control_buffer); | ||
1198 | kfree(cam); | ||
1188 | 1199 | ||
1189 | mutex_unlock(&et61x251_sysfs_lock); | 1200 | mutex_unlock(&et61x251_sysfs_lock); |
1190 | |||
1191 | kfree(cam->control_buffer); | ||
1192 | } | 1201 | } |
1193 | 1202 | ||
1194 | /*****************************************************************************/ | ||
1195 | 1203 | ||
1196 | static int et61x251_open(struct inode* inode, struct file* filp) | 1204 | static int et61x251_open(struct inode* inode, struct file* filp) |
1197 | { | 1205 | { |
1198 | struct et61x251_device* cam; | 1206 | struct et61x251_device* cam; |
1199 | int err = 0; | 1207 | int err = 0; |
1200 | 1208 | ||
1201 | /* | 1209 | if (!down_read_trylock(&et61x251_dev_lock)) |
1202 | This is the only safe way to prevent race conditions with | ||
1203 | disconnect | ||
1204 | */ | ||
1205 | if (!down_read_trylock(&et61x251_disconnect)) | ||
1206 | return -ERESTARTSYS; | 1210 | return -ERESTARTSYS; |
1207 | 1211 | ||
1208 | cam = video_get_drvdata(video_devdata(filp)); | 1212 | cam = video_get_drvdata(video_devdata(filp)); |
1209 | 1213 | ||
1210 | if (mutex_lock_interruptible(&cam->dev_mutex)) { | 1214 | if (wait_for_completion_interruptible(&cam->probe)) { |
1211 | up_read(&et61x251_disconnect); | 1215 | up_read(&et61x251_dev_lock); |
1212 | return -ERESTARTSYS; | 1216 | return -ERESTARTSYS; |
1213 | } | 1217 | } |
1214 | 1218 | ||
1219 | kref_get(&cam->kref); | ||
1220 | |||
1221 | if (mutex_lock_interruptible(&cam->open_mutex)) { | ||
1222 | kref_put(&cam->kref, et61x251_release_resources); | ||
1223 | up_read(&et61x251_dev_lock); | ||
1224 | return -ERESTARTSYS; | ||
1225 | } | ||
1226 | |||
1227 | if (cam->state & DEV_DISCONNECTED) { | ||
1228 | DBG(1, "Device not present"); | ||
1229 | err = -ENODEV; | ||
1230 | goto out; | ||
1231 | } | ||
1232 | |||
1215 | if (cam->users) { | 1233 | if (cam->users) { |
1216 | DBG(2, "Device /dev/video%d is busy...", cam->v4ldev->minor); | 1234 | DBG(2, "Device /dev/video%d is already in use", |
1235 | cam->v4ldev->minor); | ||
1236 | DBG(3, "Simultaneous opens are not supported"); | ||
1217 | if ((filp->f_flags & O_NONBLOCK) || | 1237 | if ((filp->f_flags & O_NONBLOCK) || |
1218 | (filp->f_flags & O_NDELAY)) { | 1238 | (filp->f_flags & O_NDELAY)) { |
1219 | err = -EWOULDBLOCK; | 1239 | err = -EWOULDBLOCK; |
1220 | goto out; | 1240 | goto out; |
1221 | } | 1241 | } |
1222 | mutex_unlock(&cam->dev_mutex); | 1242 | DBG(2, "A blocking open() has been requested. Wait for the " |
1223 | err = wait_event_interruptible_exclusive(cam->open, | 1243 | "device to be released..."); |
1224 | cam->state & DEV_DISCONNECTED | 1244 | up_read(&et61x251_dev_lock); |
1245 | err = wait_event_interruptible_exclusive(cam->wait_open, | ||
1246 | (cam->state & DEV_DISCONNECTED) | ||
1225 | || !cam->users); | 1247 | || !cam->users); |
1226 | if (err) { | 1248 | down_read(&et61x251_dev_lock); |
1227 | up_read(&et61x251_disconnect); | 1249 | if (err) |
1228 | return err; | 1250 | goto out; |
1229 | } | ||
1230 | if (cam->state & DEV_DISCONNECTED) { | 1251 | if (cam->state & DEV_DISCONNECTED) { |
1231 | up_read(&et61x251_disconnect); | 1252 | err = -ENODEV; |
1232 | return -ENODEV; | 1253 | goto out; |
1233 | } | 1254 | } |
1234 | mutex_lock(&cam->dev_mutex); | ||
1235 | } | 1255 | } |
1236 | 1256 | ||
1237 | |||
1238 | if (cam->state & DEV_MISCONFIGURED) { | 1257 | if (cam->state & DEV_MISCONFIGURED) { |
1239 | err = et61x251_init(cam); | 1258 | err = et61x251_init(cam); |
1240 | if (err) { | 1259 | if (err) { |
@@ -1259,36 +1278,32 @@ static int et61x251_open(struct inode* inode, struct file* filp) | |||
1259 | DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor); | 1278 | DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor); |
1260 | 1279 | ||
1261 | out: | 1280 | out: |
1262 | mutex_unlock(&cam->dev_mutex); | 1281 | mutex_unlock(&cam->open_mutex); |
1263 | up_read(&et61x251_disconnect); | 1282 | if (err) |
1283 | kref_put(&cam->kref, et61x251_release_resources); | ||
1284 | up_read(&et61x251_dev_lock); | ||
1264 | return err; | 1285 | return err; |
1265 | } | 1286 | } |
1266 | 1287 | ||
1267 | 1288 | ||
1268 | static int et61x251_release(struct inode* inode, struct file* filp) | 1289 | static int et61x251_release(struct inode* inode, struct file* filp) |
1269 | { | 1290 | { |
1270 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); | 1291 | struct et61x251_device* cam; |
1271 | 1292 | ||
1272 | mutex_lock(&cam->dev_mutex); /* prevent disconnect() to be called */ | 1293 | down_write(&et61x251_dev_lock); |
1273 | 1294 | ||
1274 | et61x251_stop_transfer(cam); | 1295 | cam = video_get_drvdata(video_devdata(filp)); |
1275 | 1296 | ||
1297 | et61x251_stop_transfer(cam); | ||
1276 | et61x251_release_buffers(cam); | 1298 | et61x251_release_buffers(cam); |
1277 | |||
1278 | if (cam->state & DEV_DISCONNECTED) { | ||
1279 | et61x251_release_resources(cam); | ||
1280 | usb_put_dev(cam->usbdev); | ||
1281 | mutex_unlock(&cam->dev_mutex); | ||
1282 | kfree(cam); | ||
1283 | return 0; | ||
1284 | } | ||
1285 | |||
1286 | cam->users--; | 1299 | cam->users--; |
1287 | wake_up_interruptible_nr(&cam->open, 1); | 1300 | wake_up_interruptible_nr(&cam->wait_open, 1); |
1288 | 1301 | ||
1289 | DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor); | 1302 | DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor); |
1290 | 1303 | ||
1291 | mutex_unlock(&cam->dev_mutex); | 1304 | kref_put(&cam->kref, et61x251_release_resources); |
1305 | |||
1306 | up_write(&et61x251_dev_lock); | ||
1292 | 1307 | ||
1293 | return 0; | 1308 | return 0; |
1294 | } | 1309 | } |
@@ -1324,7 +1339,7 @@ et61x251_read(struct file* filp, char __user * buf, | |||
1324 | DBG(3, "Close and open the device again to choose the read " | 1339 | DBG(3, "Close and open the device again to choose the read " |
1325 | "method"); | 1340 | "method"); |
1326 | mutex_unlock(&cam->fileop_mutex); | 1341 | mutex_unlock(&cam->fileop_mutex); |
1327 | return -EINVAL; | 1342 | return -EBUSY; |
1328 | } | 1343 | } |
1329 | 1344 | ||
1330 | if (cam->io == IO_NONE) { | 1345 | if (cam->io == IO_NONE) { |
@@ -1504,7 +1519,12 @@ static int et61x251_mmap(struct file* filp, struct vm_area_struct *vma) | |||
1504 | return -EIO; | 1519 | return -EIO; |
1505 | } | 1520 | } |
1506 | 1521 | ||
1507 | if (cam->io != IO_MMAP || !(vma->vm_flags & VM_WRITE) || | 1522 | if (!(vma->vm_flags & (VM_WRITE | VM_READ))) { |
1523 | mutex_unlock(&cam->fileop_mutex); | ||
1524 | return -EACCES; | ||
1525 | } | ||
1526 | |||
1527 | if (cam->io != IO_MMAP || | ||
1508 | size != PAGE_ALIGN(cam->frame[0].buf.length)) { | 1528 | size != PAGE_ALIGN(cam->frame[0].buf.length)) { |
1509 | mutex_unlock(&cam->fileop_mutex); | 1529 | mutex_unlock(&cam->fileop_mutex); |
1510 | return -EINVAL; | 1530 | return -EINVAL; |
@@ -1535,7 +1555,6 @@ static int et61x251_mmap(struct file* filp, struct vm_area_struct *vma) | |||
1535 | 1555 | ||
1536 | vma->vm_ops = &et61x251_vm_ops; | 1556 | vma->vm_ops = &et61x251_vm_ops; |
1537 | vma->vm_private_data = &cam->frame[i]; | 1557 | vma->vm_private_data = &cam->frame[i]; |
1538 | |||
1539 | et61x251_vm_open(vma); | 1558 | et61x251_vm_open(vma); |
1540 | 1559 | ||
1541 | mutex_unlock(&cam->fileop_mutex); | 1560 | mutex_unlock(&cam->fileop_mutex); |
@@ -1764,7 +1783,7 @@ et61x251_vidioc_s_crop(struct et61x251_device* cam, void __user * arg) | |||
1764 | if (cam->frame[i].vma_use_count) { | 1783 | if (cam->frame[i].vma_use_count) { |
1765 | DBG(3, "VIDIOC_S_CROP failed. " | 1784 | DBG(3, "VIDIOC_S_CROP failed. " |
1766 | "Unmap the buffers first."); | 1785 | "Unmap the buffers first."); |
1767 | return -EINVAL; | 1786 | return -EBUSY; |
1768 | } | 1787 | } |
1769 | 1788 | ||
1770 | /* Preserve R,G or B origin */ | 1789 | /* Preserve R,G or B origin */ |
@@ -1921,6 +1940,8 @@ et61x251_vidioc_g_fmt(struct et61x251_device* cam, void __user * arg) | |||
1921 | if (format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 1940 | if (format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1922 | return -EINVAL; | 1941 | return -EINVAL; |
1923 | 1942 | ||
1943 | pfmt->colorspace = (pfmt->pixelformat == V4L2_PIX_FMT_ET61X251) ? | ||
1944 | 0 : V4L2_COLORSPACE_SRGB; | ||
1924 | pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_ET61X251) | 1945 | pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_ET61X251) |
1925 | ? 0 : (pfmt->width * pfmt->priv) / 8; | 1946 | ? 0 : (pfmt->width * pfmt->priv) / 8; |
1926 | pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); | 1947 | pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); |
@@ -1996,6 +2017,8 @@ et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, | |||
1996 | pix->pixelformat != V4L2_PIX_FMT_SBGGR8) | 2017 | pix->pixelformat != V4L2_PIX_FMT_SBGGR8) |
1997 | pix->pixelformat = pfmt->pixelformat; | 2018 | pix->pixelformat = pfmt->pixelformat; |
1998 | pix->priv = pfmt->priv; /* bpp */ | 2019 | pix->priv = pfmt->priv; /* bpp */ |
2020 | pix->colorspace = (pix->pixelformat == V4L2_PIX_FMT_ET61X251) ? | ||
2021 | 0 : V4L2_COLORSPACE_SRGB; | ||
1999 | pix->colorspace = pfmt->colorspace; | 2022 | pix->colorspace = pfmt->colorspace; |
2000 | pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_ET61X251) | 2023 | pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_ET61X251) |
2001 | ? 0 : (pix->width * pix->priv) / 8; | 2024 | ? 0 : (pix->width * pix->priv) / 8; |
@@ -2013,7 +2036,7 @@ et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, | |||
2013 | if (cam->frame[i].vma_use_count) { | 2036 | if (cam->frame[i].vma_use_count) { |
2014 | DBG(3, "VIDIOC_S_FMT failed. " | 2037 | DBG(3, "VIDIOC_S_FMT failed. " |
2015 | "Unmap the buffers first."); | 2038 | "Unmap the buffers first."); |
2016 | return -EINVAL; | 2039 | return -EBUSY; |
2017 | } | 2040 | } |
2018 | 2041 | ||
2019 | if (cam->stream == STREAM_ON) | 2042 | if (cam->stream == STREAM_ON) |
@@ -2129,14 +2152,14 @@ et61x251_vidioc_reqbufs(struct et61x251_device* cam, void __user * arg) | |||
2129 | if (cam->io == IO_READ) { | 2152 | if (cam->io == IO_READ) { |
2130 | DBG(3, "Close and open the device again to choose the mmap " | 2153 | DBG(3, "Close and open the device again to choose the mmap " |
2131 | "I/O method"); | 2154 | "I/O method"); |
2132 | return -EINVAL; | 2155 | return -EBUSY; |
2133 | } | 2156 | } |
2134 | 2157 | ||
2135 | for (i = 0; i < cam->nbuffers; i++) | 2158 | for (i = 0; i < cam->nbuffers; i++) |
2136 | if (cam->frame[i].vma_use_count) { | 2159 | if (cam->frame[i].vma_use_count) { |
2137 | DBG(3, "VIDIOC_REQBUFS failed. " | 2160 | DBG(3, "VIDIOC_REQBUFS failed. " |
2138 | "Previous buffers are still mapped."); | 2161 | "Previous buffers are still mapped."); |
2139 | return -EINVAL; | 2162 | return -EBUSY; |
2140 | } | 2163 | } |
2141 | 2164 | ||
2142 | if (cam->stream == STREAM_ON) | 2165 | if (cam->stream == STREAM_ON) |
@@ -2284,9 +2307,6 @@ et61x251_vidioc_streamon(struct et61x251_device* cam, void __user * arg) | |||
2284 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) | 2307 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) |
2285 | return -EINVAL; | 2308 | return -EINVAL; |
2286 | 2309 | ||
2287 | if (list_empty(&cam->inqueue)) | ||
2288 | return -EINVAL; | ||
2289 | |||
2290 | cam->stream = STREAM_ON; | 2310 | cam->stream = STREAM_ON; |
2291 | 2311 | ||
2292 | DBG(3, "Stream on"); | 2312 | DBG(3, "Stream on"); |
@@ -2535,8 +2555,6 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
2535 | goto fail; | 2555 | goto fail; |
2536 | } | 2556 | } |
2537 | 2557 | ||
2538 | mutex_init(&cam->dev_mutex); | ||
2539 | |||
2540 | DBG(2, "ET61X[12]51 PC Camera Controller detected " | 2558 | DBG(2, "ET61X[12]51 PC Camera Controller detected " |
2541 | "(vid/pid 0x%04X:0x%04X)",id->idVendor, id->idProduct); | 2559 | "(vid/pid 0x%04X:0x%04X)",id->idVendor, id->idProduct); |
2542 | 2560 | ||
@@ -2568,7 +2586,7 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
2568 | cam->v4ldev->release = video_device_release; | 2586 | cam->v4ldev->release = video_device_release; |
2569 | video_set_drvdata(cam->v4ldev, cam); | 2587 | video_set_drvdata(cam->v4ldev, cam); |
2570 | 2588 | ||
2571 | mutex_lock(&cam->dev_mutex); | 2589 | init_completion(&cam->probe); |
2572 | 2590 | ||
2573 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, | 2591 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, |
2574 | video_nr[dev_nr]); | 2592 | video_nr[dev_nr]); |
@@ -2578,7 +2596,7 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
2578 | DBG(1, "Free /dev/videoX node not found"); | 2596 | DBG(1, "Free /dev/videoX node not found"); |
2579 | video_nr[dev_nr] = -1; | 2597 | video_nr[dev_nr] = -1; |
2580 | dev_nr = (dev_nr < ET61X251_MAX_DEVICES-1) ? dev_nr+1 : 0; | 2598 | dev_nr = (dev_nr < ET61X251_MAX_DEVICES-1) ? dev_nr+1 : 0; |
2581 | mutex_unlock(&cam->dev_mutex); | 2599 | complete_all(&cam->probe); |
2582 | goto fail; | 2600 | goto fail; |
2583 | } | 2601 | } |
2584 | 2602 | ||
@@ -2599,11 +2617,15 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
2599 | "device controlling. Error #%d", err); | 2617 | "device controlling. Error #%d", err); |
2600 | #else | 2618 | #else |
2601 | DBG(2, "Optional device control through 'sysfs' interface disabled"); | 2619 | DBG(2, "Optional device control through 'sysfs' interface disabled"); |
2620 | DBG(3, "Compile the kernel with the 'CONFIG_VIDEO_ADV_DEBUG' " | ||
2621 | "configuration option to enable it."); | ||
2602 | #endif | 2622 | #endif |
2603 | 2623 | ||
2604 | usb_set_intfdata(intf, cam); | 2624 | usb_set_intfdata(intf, cam); |
2625 | kref_init(&cam->kref); | ||
2626 | usb_get_dev(cam->usbdev); | ||
2605 | 2627 | ||
2606 | mutex_unlock(&cam->dev_mutex); | 2628 | complete_all(&cam->probe); |
2607 | 2629 | ||
2608 | return 0; | 2630 | return 0; |
2609 | 2631 | ||
@@ -2620,40 +2642,31 @@ fail: | |||
2620 | 2642 | ||
2621 | static void et61x251_usb_disconnect(struct usb_interface* intf) | 2643 | static void et61x251_usb_disconnect(struct usb_interface* intf) |
2622 | { | 2644 | { |
2623 | struct et61x251_device* cam = usb_get_intfdata(intf); | 2645 | struct et61x251_device* cam; |
2624 | |||
2625 | if (!cam) | ||
2626 | return; | ||
2627 | 2646 | ||
2628 | down_write(&et61x251_disconnect); | 2647 | down_write(&et61x251_dev_lock); |
2629 | 2648 | ||
2630 | mutex_lock(&cam->dev_mutex); | 2649 | cam = usb_get_intfdata(intf); |
2631 | 2650 | ||
2632 | DBG(2, "Disconnecting %s...", cam->v4ldev->name); | 2651 | DBG(2, "Disconnecting %s...", cam->v4ldev->name); |
2633 | 2652 | ||
2634 | wake_up_interruptible_all(&cam->open); | ||
2635 | |||
2636 | if (cam->users) { | 2653 | if (cam->users) { |
2637 | DBG(2, "Device /dev/video%d is open! Deregistration and " | 2654 | DBG(2, "Device /dev/video%d is open! Deregistration and " |
2638 | "memory deallocation are deferred on close.", | 2655 | "memory deallocation are deferred.", |
2639 | cam->v4ldev->minor); | 2656 | cam->v4ldev->minor); |
2640 | cam->state |= DEV_MISCONFIGURED; | 2657 | cam->state |= DEV_MISCONFIGURED; |
2641 | et61x251_stop_transfer(cam); | 2658 | et61x251_stop_transfer(cam); |
2642 | cam->state |= DEV_DISCONNECTED; | 2659 | cam->state |= DEV_DISCONNECTED; |
2643 | wake_up_interruptible(&cam->wait_frame); | 2660 | wake_up_interruptible(&cam->wait_frame); |
2644 | wake_up(&cam->wait_stream); | 2661 | wake_up(&cam->wait_stream); |
2645 | usb_get_dev(cam->usbdev); | 2662 | } else |
2646 | } else { | ||
2647 | cam->state |= DEV_DISCONNECTED; | 2663 | cam->state |= DEV_DISCONNECTED; |
2648 | et61x251_release_resources(cam); | ||
2649 | } | ||
2650 | 2664 | ||
2651 | mutex_unlock(&cam->dev_mutex); | 2665 | wake_up_interruptible_all(&cam->wait_open); |
2652 | 2666 | ||
2653 | if (!cam->users) | 2667 | kref_put(&cam->kref, et61x251_release_resources); |
2654 | kfree(cam); | ||
2655 | 2668 | ||
2656 | up_write(&et61x251_disconnect); | 2669 | up_write(&et61x251_dev_lock); |
2657 | } | 2670 | } |
2658 | 2671 | ||
2659 | 2672 | ||
diff --git a/drivers/media/video/et61x251/et61x251_sensor.h b/drivers/media/video/et61x251/et61x251_sensor.h index 5fadb5de68bf..e14586330623 100644 --- a/drivers/media/video/et61x251/et61x251_sensor.h +++ b/drivers/media/video/et61x251/et61x251_sensor.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #define _ET61X251_SENSOR_H_ | 22 | #define _ET61X251_SENSOR_H_ |
23 | 23 | ||
24 | #include <linux/usb.h> | 24 | #include <linux/usb.h> |
25 | #include <linux/videodev.h> | 25 | #include <linux/videodev2.h> |
26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
27 | #include <linux/stddef.h> | 27 | #include <linux/stddef.h> |
28 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
@@ -47,7 +47,7 @@ et61x251_match_id(struct et61x251_device* cam, const struct usb_device_id *id); | |||
47 | 47 | ||
48 | extern void | 48 | extern void |
49 | et61x251_attach_sensor(struct et61x251_device* cam, | 49 | et61x251_attach_sensor(struct et61x251_device* cam, |
50 | struct et61x251_sensor* sensor); | 50 | const struct et61x251_sensor* sensor); |
51 | 51 | ||
52 | /*****************************************************************************/ | 52 | /*****************************************************************************/ |
53 | 53 | ||
@@ -56,10 +56,10 @@ extern int et61x251_read_reg(struct et61x251_device*, u16 index); | |||
56 | extern int et61x251_i2c_write(struct et61x251_device*, u8 address, u8 value); | 56 | extern int et61x251_i2c_write(struct et61x251_device*, u8 address, u8 value); |
57 | extern int et61x251_i2c_read(struct et61x251_device*, u8 address); | 57 | extern int et61x251_i2c_read(struct et61x251_device*, u8 address); |
58 | extern int et61x251_i2c_try_write(struct et61x251_device*, | 58 | extern int et61x251_i2c_try_write(struct et61x251_device*, |
59 | struct et61x251_sensor*, u8 address, | 59 | const struct et61x251_sensor*, u8 address, |
60 | u8 value); | 60 | u8 value); |
61 | extern int et61x251_i2c_try_read(struct et61x251_device*, | 61 | extern int et61x251_i2c_try_read(struct et61x251_device*, |
62 | struct et61x251_sensor*, u8 address); | 62 | const struct et61x251_sensor*, u8 address); |
63 | extern int et61x251_i2c_raw_write(struct et61x251_device*, u8 n, u8 data1, | 63 | extern int et61x251_i2c_raw_write(struct et61x251_device*, u8 n, u8 data1, |
64 | u8 data2, u8 data3, u8 data4, u8 data5, | 64 | u8 data2, u8 data3, u8 data4, u8 data5, |
65 | u8 data6, u8 data7, u8 data8, u8 address); | 65 | u8 data6, u8 data7, u8 data8, u8 address); |
diff --git a/drivers/media/video/et61x251/et61x251_tas5130d1b.c b/drivers/media/video/et61x251/et61x251_tas5130d1b.c index b06643409842..04b7fbb310a8 100644 --- a/drivers/media/video/et61x251/et61x251_tas5130d1b.c +++ b/drivers/media/video/et61x251/et61x251_tas5130d1b.c | |||
@@ -69,7 +69,7 @@ static int tas5130d1b_set_ctrl(struct et61x251_device* cam, | |||
69 | } | 69 | } |
70 | 70 | ||
71 | 71 | ||
72 | static struct et61x251_sensor tas5130d1b = { | 72 | static const struct et61x251_sensor tas5130d1b = { |
73 | .name = "TAS5130D1B", | 73 | .name = "TAS5130D1B", |
74 | .interface = ET61X251_I2C_3WIRES, | 74 | .interface = ET61X251_I2C_3WIRES, |
75 | .rsta = ET61X251_I2C_RSTA_STOP, | 75 | .rsta = ET61X251_I2C_RSTA_STOP, |
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index ed92b6f7187a..2d709e064679 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/errno.h> | 37 | #include <linux/errno.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/i2c.h> | 39 | #include <linux/i2c.h> |
40 | #include <linux/i2c-id.h> | ||
40 | #include <linux/workqueue.h> | 41 | #include <linux/workqueue.h> |
41 | #include <asm/semaphore.h> | 42 | #include <asm/semaphore.h> |
42 | 43 | ||
@@ -60,21 +61,22 @@ MODULE_PARM_DESC(hauppauge, "Specify Hauppauge remote: 0=black, 1=grey (defaults | |||
60 | 61 | ||
61 | /* ----------------------------------------------------------------------- */ | 62 | /* ----------------------------------------------------------------------- */ |
62 | 63 | ||
63 | static int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | 64 | static int get_key_haup_common(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw, |
65 | int size, int offset) | ||
64 | { | 66 | { |
65 | unsigned char buf[3]; | 67 | unsigned char buf[6]; |
66 | int start, range, toggle, dev, code; | 68 | int start, range, toggle, dev, code; |
67 | 69 | ||
68 | /* poll IR chip */ | 70 | /* poll IR chip */ |
69 | if (3 != i2c_master_recv(&ir->c,buf,3)) | 71 | if (size != i2c_master_recv(&ir->c,buf,size)) |
70 | return -EIO; | 72 | return -EIO; |
71 | 73 | ||
72 | /* split rc5 data block ... */ | 74 | /* split rc5 data block ... */ |
73 | start = (buf[0] >> 7) & 1; | 75 | start = (buf[offset] >> 7) & 1; |
74 | range = (buf[0] >> 6) & 1; | 76 | range = (buf[offset] >> 6) & 1; |
75 | toggle = (buf[0] >> 5) & 1; | 77 | toggle = (buf[offset] >> 5) & 1; |
76 | dev = buf[0] & 0x1f; | 78 | dev = buf[offset] & 0x1f; |
77 | code = (buf[1] >> 2) & 0x3f; | 79 | code = (buf[offset+1] >> 2) & 0x3f; |
78 | 80 | ||
79 | /* rc5 has two start bits | 81 | /* rc5 has two start bits |
80 | * the first bit must be one | 82 | * the first bit must be one |
@@ -96,6 +98,16 @@ static int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |||
96 | return 1; | 98 | return 1; |
97 | } | 99 | } |
98 | 100 | ||
101 | static inline int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | ||
102 | { | ||
103 | return get_key_haup_common (ir, ir_key, ir_raw, 3, 0); | ||
104 | } | ||
105 | |||
106 | static inline int get_key_haup_xvr(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | ||
107 | { | ||
108 | return get_key_haup_common (ir, ir_key, ir_raw, 6, 3); | ||
109 | } | ||
110 | |||
99 | static int get_key_pixelview(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | 111 | static int get_key_pixelview(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) |
100 | { | 112 | { |
101 | unsigned char b; | 113 | unsigned char b; |
@@ -270,8 +282,9 @@ static void ir_timer(unsigned long data) | |||
270 | static void ir_work(struct work_struct *work) | 282 | static void ir_work(struct work_struct *work) |
271 | { | 283 | { |
272 | struct IR_i2c *ir = container_of(work, struct IR_i2c, work); | 284 | struct IR_i2c *ir = container_of(work, struct IR_i2c, work); |
285 | |||
273 | ir_key_poll(ir); | 286 | ir_key_poll(ir); |
274 | mod_timer(&ir->timer, jiffies+HZ/10); | 287 | mod_timer(&ir->timer, jiffies + msecs_to_jiffies(100)); |
275 | } | 288 | } |
276 | 289 | ||
277 | /* ----------------------------------------------------------------------- */ | 290 | /* ----------------------------------------------------------------------- */ |
@@ -354,9 +367,21 @@ static int ir_attach(struct i2c_adapter *adap, int addr, | |||
354 | case 0x7a: | 367 | case 0x7a: |
355 | case 0x47: | 368 | case 0x47: |
356 | case 0x71: | 369 | case 0x71: |
357 | /* Handled by saa7134-input */ | 370 | if (adap->id == I2C_HW_B_CX2388x) { |
358 | name = "SAA713x remote"; | 371 | /* Handled by cx88-input */ |
359 | ir_type = IR_TYPE_OTHER; | 372 | name = "CX2388x remote"; |
373 | ir_type = IR_TYPE_RC5; | ||
374 | ir->get_key = get_key_haup_xvr; | ||
375 | if (hauppauge == 1) { | ||
376 | ir_codes = ir_codes_hauppauge_new; | ||
377 | } else { | ||
378 | ir_codes = ir_codes_rc5_tv; | ||
379 | } | ||
380 | } else { | ||
381 | /* Handled by saa7134-input */ | ||
382 | name = "SAA713x remote"; | ||
383 | ir_type = IR_TYPE_OTHER; | ||
384 | } | ||
360 | break; | 385 | break; |
361 | default: | 386 | default: |
362 | /* shouldn't happen */ | 387 | /* shouldn't happen */ |
@@ -450,6 +475,7 @@ static int ir_probe(struct i2c_adapter *adap) | |||
450 | static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1}; | 475 | static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1}; |
451 | static const int probe_saa7134[] = { 0x7a, 0x47, 0x71, -1 }; | 476 | static const int probe_saa7134[] = { 0x7a, 0x47, 0x71, -1 }; |
452 | static const int probe_em28XX[] = { 0x30, 0x47, -1 }; | 477 | static const int probe_em28XX[] = { 0x30, 0x47, -1 }; |
478 | static const int probe_cx88[] = { 0x18, 0x71, -1 }; | ||
453 | const int *probe = NULL; | 479 | const int *probe = NULL; |
454 | struct i2c_client c; | 480 | struct i2c_client c; |
455 | unsigned char buf; | 481 | unsigned char buf; |
@@ -468,6 +494,9 @@ static int ir_probe(struct i2c_adapter *adap) | |||
468 | case I2C_HW_B_EM28XX: | 494 | case I2C_HW_B_EM28XX: |
469 | probe = probe_em28XX; | 495 | probe = probe_em28XX; |
470 | break; | 496 | break; |
497 | case I2C_HW_B_CX2388x: | ||
498 | probe = probe_cx88; | ||
499 | break; | ||
471 | } | 500 | } |
472 | if (NULL == probe) | 501 | if (NULL == probe) |
473 | return 0; | 502 | return 0; |
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index efc66355339a..4c93466a89e5 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
@@ -181,7 +181,7 @@ MODULE_PARM_DESC(secam, "Set SECAM standard: B, G, H, D, K, L, LC"); | |||
181 | MODULE_PARM_DESC(ntsc, "Set NTSC standard: M, J, K"); | 181 | MODULE_PARM_DESC(ntsc, "Set NTSC standard: M, J, K"); |
182 | MODULE_PARM_DESC(debug, | 182 | MODULE_PARM_DESC(debug, |
183 | "Debug level (bitmask). Default: errors only\n" | 183 | "Debug level (bitmask). Default: errors only\n" |
184 | "\t\t\t(debug = 511 gives full debugging)"); | 184 | "\t\t\t(debug = 1023 gives full debugging)"); |
185 | MODULE_PARM_DESC(ivtv_pci_latency, | 185 | MODULE_PARM_DESC(ivtv_pci_latency, |
186 | "Change the PCI latency to 64 if lower: 0 = No, 1 = Yes,\n" | 186 | "Change the PCI latency to 64 if lower: 0 = No, 1 = Yes,\n" |
187 | "\t\t\tDefault: Yes"); | 187 | "\t\t\tDefault: Yes"); |
@@ -339,6 +339,7 @@ static void ivtv_process_eeprom(struct ivtv *itv) | |||
339 | /* In a few cases the PCI subsystem IDs do not correctly | 339 | /* In a few cases the PCI subsystem IDs do not correctly |
340 | identify the card. A better method is to check the | 340 | identify the card. A better method is to check the |
341 | model number from the eeprom instead. */ | 341 | model number from the eeprom instead. */ |
342 | case 30012 ... 30039: /* Low profile PVR250 */ | ||
342 | case 32000 ... 32999: | 343 | case 32000 ... 32999: |
343 | case 48000 ... 48099: /* 48??? range are PVR250s with a cx23415 */ | 344 | case 48000 ... 48099: /* 48??? range are PVR250s with a cx23415 */ |
344 | case 48400 ... 48599: | 345 | case 48400 ... 48599: |
@@ -622,6 +623,7 @@ static int __devinit ivtv_init_struct1(struct ivtv *itv) | |||
622 | itv->enc_mbox.max_mbox = 2; /* the encoder has 3 mailboxes (0-2) */ | 623 | itv->enc_mbox.max_mbox = 2; /* the encoder has 3 mailboxes (0-2) */ |
623 | itv->dec_mbox.max_mbox = 1; /* the decoder has 2 mailboxes (0-1) */ | 624 | itv->dec_mbox.max_mbox = 1; /* the decoder has 2 mailboxes (0-1) */ |
624 | 625 | ||
626 | mutex_init(&itv->serialize_lock); | ||
625 | mutex_init(&itv->i2c_bus_lock); | 627 | mutex_init(&itv->i2c_bus_lock); |
626 | mutex_init(&itv->udma.lock); | 628 | mutex_init(&itv->udma.lock); |
627 | 629 | ||
@@ -1288,10 +1290,7 @@ static void ivtv_remove(struct pci_dev *pci_dev) | |||
1288 | 1290 | ||
1289 | IVTV_DEBUG_INFO(" Releasing irq.\n"); | 1291 | IVTV_DEBUG_INFO(" Releasing irq.\n"); |
1290 | free_irq(itv->dev->irq, (void *)itv); | 1292 | free_irq(itv->dev->irq, (void *)itv); |
1291 | 1293 | ivtv_iounmap(itv); | |
1292 | if (itv->dev) { | ||
1293 | ivtv_iounmap(itv); | ||
1294 | } | ||
1295 | 1294 | ||
1296 | IVTV_DEBUG_INFO(" Releasing mem.\n"); | 1295 | IVTV_DEBUG_INFO(" Releasing mem.\n"); |
1297 | release_mem_region(itv->base_addr, IVTV_ENCODER_SIZE); | 1296 | release_mem_region(itv->base_addr, IVTV_ENCODER_SIZE); |
@@ -1326,9 +1325,9 @@ static int module_start(void) | |||
1326 | return -1; | 1325 | return -1; |
1327 | } | 1326 | } |
1328 | 1327 | ||
1329 | if (ivtv_debug < 0 || ivtv_debug > 511) { | 1328 | if (ivtv_debug < 0 || ivtv_debug > 1023) { |
1330 | ivtv_debug = 0; | 1329 | ivtv_debug = 0; |
1331 | printk(KERN_INFO "ivtv: debug value must be >= 0 and <= 511!\n"); | 1330 | printk(KERN_INFO "ivtv: debug value must be >= 0 and <= 1023!\n"); |
1332 | } | 1331 | } |
1333 | 1332 | ||
1334 | if (pci_register_driver(&ivtv_pci_driver)) { | 1333 | if (pci_register_driver(&ivtv_pci_driver)) { |
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h index e6e56f175f3f..6c1a85f1ee1b 100644 --- a/drivers/media/video/ivtv/ivtv-driver.h +++ b/drivers/media/video/ivtv/ivtv-driver.h | |||
@@ -268,6 +268,8 @@ extern const u32 yuv_offset[4]; | |||
268 | #define IVTV_DBGFLG_IRQ (1 << 6) | 268 | #define IVTV_DBGFLG_IRQ (1 << 6) |
269 | #define IVTV_DBGFLG_DEC (1 << 7) | 269 | #define IVTV_DBGFLG_DEC (1 << 7) |
270 | #define IVTV_DBGFLG_YUV (1 << 8) | 270 | #define IVTV_DBGFLG_YUV (1 << 8) |
271 | /* Flag to turn on high volume debugging */ | ||
272 | #define IVTV_DBGFLG_HIGHVOL (1 << 9) | ||
271 | 273 | ||
272 | /* NOTE: extra space before comma in 'itv->num , ## args' is required for | 274 | /* NOTE: extra space before comma in 'itv->num , ## args' is required for |
273 | gcc-2.95, otherwise it won't compile. */ | 275 | gcc-2.95, otherwise it won't compile. */ |
@@ -286,6 +288,21 @@ extern const u32 yuv_offset[4]; | |||
286 | #define IVTV_DEBUG_DEC(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_DEC, "dec", fmt , ## args) | 288 | #define IVTV_DEBUG_DEC(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_DEC, "dec", fmt , ## args) |
287 | #define IVTV_DEBUG_YUV(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_YUV, "yuv", fmt , ## args) | 289 | #define IVTV_DEBUG_YUV(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_YUV, "yuv", fmt , ## args) |
288 | 290 | ||
291 | #define IVTV_DEBUG_HIGH_VOL(x, type, fmt, args...) \ | ||
292 | do { \ | ||
293 | if (((x) & ivtv_debug) && (ivtv_debug & IVTV_DBGFLG_HIGHVOL)) \ | ||
294 | printk(KERN_INFO "ivtv%d " type ": " fmt, itv->num , ## args); \ | ||
295 | } while (0) | ||
296 | #define IVTV_DEBUG_HI_WARN(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_WARN, "warning", fmt , ## args) | ||
297 | #define IVTV_DEBUG_HI_INFO(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_INFO, "info",fmt , ## args) | ||
298 | #define IVTV_DEBUG_HI_API(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_API, "api", fmt , ## args) | ||
299 | #define IVTV_DEBUG_HI_DMA(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_DMA, "dma", fmt , ## args) | ||
300 | #define IVTV_DEBUG_HI_IOCTL(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_IOCTL, "ioctl", fmt , ## args) | ||
301 | #define IVTV_DEBUG_HI_I2C(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_I2C, "i2c", fmt , ## args) | ||
302 | #define IVTV_DEBUG_HI_IRQ(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_IRQ, "irq", fmt , ## args) | ||
303 | #define IVTV_DEBUG_HI_DEC(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_DEC, "dec", fmt , ## args) | ||
304 | #define IVTV_DEBUG_HI_YUV(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_YUV, "yuv", fmt , ## args) | ||
305 | |||
289 | #define IVTV_FB_DEBUG(x, type, fmt, args...) \ | 306 | #define IVTV_FB_DEBUG(x, type, fmt, args...) \ |
290 | do { \ | 307 | do { \ |
291 | if ((x) & ivtv_debug) \ | 308 | if ((x) & ivtv_debug) \ |
@@ -650,7 +667,6 @@ struct vbi_info { | |||
650 | /* convenience pointer to sliced struct in vbi_in union */ | 667 | /* convenience pointer to sliced struct in vbi_in union */ |
651 | struct v4l2_sliced_vbi_format *sliced_in; | 668 | struct v4l2_sliced_vbi_format *sliced_in; |
652 | u32 service_set_in; | 669 | u32 service_set_in; |
653 | u32 service_set_out; | ||
654 | int insert_mpeg; | 670 | int insert_mpeg; |
655 | 671 | ||
656 | /* Buffer for the maximum of 2 * 18 * packet_size sliced VBI lines. | 672 | /* Buffer for the maximum of 2 * 18 * packet_size sliced VBI lines. |
@@ -723,6 +739,7 @@ struct ivtv { | |||
723 | int search_pack_header; | 739 | int search_pack_header; |
724 | 740 | ||
725 | spinlock_t dma_reg_lock; /* lock access to DMA engine registers */ | 741 | spinlock_t dma_reg_lock; /* lock access to DMA engine registers */ |
742 | struct mutex serialize_lock; /* lock used to serialize starting streams */ | ||
726 | 743 | ||
727 | /* User based DMA for OSD */ | 744 | /* User based DMA for OSD */ |
728 | struct ivtv_user_dma udma; | 745 | struct ivtv_user_dma udma; |
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c index 555d5e6369c3..ee7e884e9c4f 100644 --- a/drivers/media/video/ivtv/ivtv-fileops.c +++ b/drivers/media/video/ivtv/ivtv-fileops.c | |||
@@ -406,7 +406,7 @@ static ssize_t ivtv_read_pos(struct ivtv_stream *s, char __user *ubuf, size_t co | |||
406 | ssize_t rc = count ? ivtv_read(s, ubuf, count, non_block) : 0; | 406 | ssize_t rc = count ? ivtv_read(s, ubuf, count, non_block) : 0; |
407 | struct ivtv *itv = s->itv; | 407 | struct ivtv *itv = s->itv; |
408 | 408 | ||
409 | IVTV_DEBUG_INFO("read %zd from %s, got %zd\n", count, s->name, rc); | 409 | IVTV_DEBUG_HI_INFO("read %zd from %s, got %zd\n", count, s->name, rc); |
410 | if (rc > 0) | 410 | if (rc > 0) |
411 | pos += rc; | 411 | pos += rc; |
412 | return rc; | 412 | return rc; |
@@ -497,7 +497,7 @@ ssize_t ivtv_v4l2_read(struct file * filp, char __user *buf, size_t count, loff_ | |||
497 | struct ivtv_stream *s = &itv->streams[id->type]; | 497 | struct ivtv_stream *s = &itv->streams[id->type]; |
498 | int rc; | 498 | int rc; |
499 | 499 | ||
500 | IVTV_DEBUG_IOCTL("read %zd bytes from %s\n", count, s->name); | 500 | IVTV_DEBUG_HI_IOCTL("read %zd bytes from %s\n", count, s->name); |
501 | 501 | ||
502 | rc = ivtv_start_capture(id); | 502 | rc = ivtv_start_capture(id); |
503 | if (rc) | 503 | if (rc) |
@@ -535,7 +535,7 @@ ssize_t ivtv_v4l2_write(struct file *filp, const char __user *user_buf, size_t c | |||
535 | int rc; | 535 | int rc; |
536 | DEFINE_WAIT(wait); | 536 | DEFINE_WAIT(wait); |
537 | 537 | ||
538 | IVTV_DEBUG_IOCTL("write %zd bytes to %s\n", count, s->name); | 538 | IVTV_DEBUG_HI_IOCTL("write %zd bytes to %s\n", count, s->name); |
539 | 539 | ||
540 | if (s->type != IVTV_DEC_STREAM_TYPE_MPG && | 540 | if (s->type != IVTV_DEC_STREAM_TYPE_MPG && |
541 | s->type != IVTV_DEC_STREAM_TYPE_YUV && | 541 | s->type != IVTV_DEC_STREAM_TYPE_YUV && |
@@ -643,7 +643,7 @@ retry: | |||
643 | to transfer the rest. */ | 643 | to transfer the rest. */ |
644 | if (count && !(filp->f_flags & O_NONBLOCK)) | 644 | if (count && !(filp->f_flags & O_NONBLOCK)) |
645 | goto retry; | 645 | goto retry; |
646 | IVTV_DEBUG_INFO("Wrote %d bytes to %s (%d)\n", bytes_written, s->name, s->q_full.bytesused); | 646 | IVTV_DEBUG_HI_INFO("Wrote %d bytes to %s (%d)\n", bytes_written, s->name, s->q_full.bytesused); |
647 | return bytes_written; | 647 | return bytes_written; |
648 | } | 648 | } |
649 | 649 | ||
diff --git a/drivers/media/video/ivtv/ivtv-firmware.c b/drivers/media/video/ivtv/ivtv-firmware.c index d4c910b782af..2b6208a6a108 100644 --- a/drivers/media/video/ivtv/ivtv-firmware.c +++ b/drivers/media/video/ivtv/ivtv-firmware.c | |||
@@ -56,9 +56,7 @@ retry: | |||
56 | volatile u32 __iomem *dst = (volatile u32 __iomem *)mem; | 56 | volatile u32 __iomem *dst = (volatile u32 __iomem *)mem; |
57 | const u32 *src = (const u32 *)fw->data; | 57 | const u32 *src = (const u32 *)fw->data; |
58 | 58 | ||
59 | /* temporarily allow 256 KB encoding firmwares as well for | 59 | if (fw->size != size) { |
60 | compatibility with blackbird cards */ | ||
61 | if (fw->size != size && fw->size != 256 * 1024) { | ||
62 | /* Due to race conditions in firmware loading (esp. with udev <0.95) | 60 | /* Due to race conditions in firmware loading (esp. with udev <0.95) |
63 | the wrong file was sometimes loaded. So we check filesizes to | 61 | the wrong file was sometimes loaded. So we check filesizes to |
64 | see if at least the right-sized file was loaded. If not, then we | 62 | see if at least the right-sized file was loaded. If not, then we |
diff --git a/drivers/media/video/ivtv/ivtv-gpio.c b/drivers/media/video/ivtv/ivtv-gpio.c index bc8f8ca2961f..676418cbaaad 100644 --- a/drivers/media/video/ivtv/ivtv-gpio.c +++ b/drivers/media/video/ivtv/ivtv-gpio.c | |||
@@ -115,8 +115,7 @@ void ivtv_reset_ir_gpio(struct ivtv *itv) | |||
115 | curout = (curout & ~0xF) | 1; | 115 | curout = (curout & ~0xF) | 1; |
116 | write_reg(curout, IVTV_REG_GPIO_OUT); | 116 | write_reg(curout, IVTV_REG_GPIO_OUT); |
117 | /* We could use something else for smaller time */ | 117 | /* We could use something else for smaller time */ |
118 | current->state = TASK_INTERRUPTIBLE; | 118 | schedule_timeout_interruptible(msecs_to_jiffies(1)); |
119 | schedule_timeout(1); | ||
120 | curout |= 2; | 119 | curout |= 2; |
121 | write_reg(curout, IVTV_REG_GPIO_OUT); | 120 | write_reg(curout, IVTV_REG_GPIO_OUT); |
122 | curdir &= ~0x80; | 121 | curdir &= ~0x80; |
@@ -138,13 +137,11 @@ int ivtv_reset_tuner_gpio(enum v4l2_tuner_type mode, void *priv, int ptr) | |||
138 | 137 | ||
139 | curout &= ~(1 << 12); | 138 | curout &= ~(1 << 12); |
140 | write_reg(curout, IVTV_REG_GPIO_OUT); | 139 | write_reg(curout, IVTV_REG_GPIO_OUT); |
141 | current->state = TASK_INTERRUPTIBLE; | 140 | schedule_timeout_interruptible(msecs_to_jiffies(1)); |
142 | schedule_timeout(1); | ||
143 | 141 | ||
144 | curout |= (1 << 12); | 142 | curout |= (1 << 12); |
145 | write_reg(curout, IVTV_REG_GPIO_OUT); | 143 | write_reg(curout, IVTV_REG_GPIO_OUT); |
146 | current->state = TASK_INTERRUPTIBLE; | 144 | schedule_timeout_interruptible(msecs_to_jiffies(1)); |
147 | schedule_timeout(1); | ||
148 | 145 | ||
149 | return 0; | 146 | return 0; |
150 | } | 147 | } |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 57af1762de1f..4773453e8dab 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -1159,7 +1159,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void | |||
1159 | 1159 | ||
1160 | memset(fb, 0, sizeof(*fb)); | 1160 | memset(fb, 0, sizeof(*fb)); |
1161 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) | 1161 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
1162 | break; | 1162 | return -EINVAL; |
1163 | fb->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_CHROMAKEY | | 1163 | fb->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_CHROMAKEY | |
1164 | V4L2_FBUF_CAP_LOCAL_ALPHA | V4L2_FBUF_CAP_GLOBAL_ALPHA; | 1164 | V4L2_FBUF_CAP_LOCAL_ALPHA | V4L2_FBUF_CAP_GLOBAL_ALPHA; |
1165 | fb->fmt.pixelformat = itv->osd_pixelformat; | 1165 | fb->fmt.pixelformat = itv->osd_pixelformat; |
@@ -1179,7 +1179,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void | |||
1179 | struct v4l2_framebuffer *fb = arg; | 1179 | struct v4l2_framebuffer *fb = arg; |
1180 | 1180 | ||
1181 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) | 1181 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
1182 | break; | 1182 | return -EINVAL; |
1183 | itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0; | 1183 | itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0; |
1184 | itv->osd_local_alpha_state = (fb->flags & V4L2_FBUF_FLAG_LOCAL_ALPHA) != 0; | 1184 | itv->osd_local_alpha_state = (fb->flags & V4L2_FBUF_FLAG_LOCAL_ALPHA) != 0; |
1185 | itv->osd_color_key_state = (fb->flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0; | 1185 | itv->osd_color_key_state = (fb->flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0; |
diff --git a/drivers/media/video/ivtv/ivtv-irq.c b/drivers/media/video/ivtv/ivtv-irq.c index ba98bf054f2e..1a3ee464a826 100644 --- a/drivers/media/video/ivtv/ivtv-irq.c +++ b/drivers/media/video/ivtv/ivtv-irq.c | |||
@@ -48,7 +48,7 @@ static void ivtv_pio_work_handler(struct ivtv *itv) | |||
48 | struct list_head *p; | 48 | struct list_head *p; |
49 | int i = 0; | 49 | int i = 0; |
50 | 50 | ||
51 | IVTV_DEBUG_DMA("ivtv_pio_work_handler\n"); | 51 | IVTV_DEBUG_HI_DMA("ivtv_pio_work_handler\n"); |
52 | if (itv->cur_pio_stream < 0 || itv->cur_pio_stream >= IVTV_MAX_STREAMS || | 52 | if (itv->cur_pio_stream < 0 || itv->cur_pio_stream >= IVTV_MAX_STREAMS || |
53 | s->v4l2dev == NULL || !ivtv_use_pio(s)) { | 53 | s->v4l2dev == NULL || !ivtv_use_pio(s)) { |
54 | itv->cur_pio_stream = -1; | 54 | itv->cur_pio_stream = -1; |
@@ -56,7 +56,7 @@ static void ivtv_pio_work_handler(struct ivtv *itv) | |||
56 | write_reg(IVTV_IRQ_ENC_PIO_COMPLETE, 0x44); | 56 | write_reg(IVTV_IRQ_ENC_PIO_COMPLETE, 0x44); |
57 | return; | 57 | return; |
58 | } | 58 | } |
59 | IVTV_DEBUG_DMA("Process PIO %s\n", s->name); | 59 | IVTV_DEBUG_HI_DMA("Process PIO %s\n", s->name); |
60 | buf = list_entry(s->q_dma.list.next, struct ivtv_buffer, list); | 60 | buf = list_entry(s->q_dma.list.next, struct ivtv_buffer, list); |
61 | list_for_each(p, &s->q_dma.list) { | 61 | list_for_each(p, &s->q_dma.list) { |
62 | struct ivtv_buffer *buf = list_entry(p, struct ivtv_buffer, list); | 62 | struct ivtv_buffer *buf = list_entry(p, struct ivtv_buffer, list); |
@@ -187,7 +187,7 @@ static int stream_enc_dma_append(struct ivtv_stream *s, u32 data[CX2341X_MBOX_MA | |||
187 | bytes_needed += UVsize; | 187 | bytes_needed += UVsize; |
188 | } | 188 | } |
189 | 189 | ||
190 | IVTV_DEBUG_DMA("%s %s: 0x%08x bytes at 0x%08x\n", | 190 | IVTV_DEBUG_HI_DMA("%s %s: 0x%08x bytes at 0x%08x\n", |
191 | ivtv_use_pio(s) ? "PIO" : "DMA", s->name, bytes_needed, offset); | 191 | ivtv_use_pio(s) ? "PIO" : "DMA", s->name, bytes_needed, offset); |
192 | 192 | ||
193 | rc = ivtv_queue_move(s, &s->q_free, &s->q_full, &s->q_predma, bytes_needed); | 193 | rc = ivtv_queue_move(s, &s->q_free, &s->q_full, &s->q_predma, bytes_needed); |
@@ -242,7 +242,7 @@ static void dma_post(struct ivtv_stream *s) | |||
242 | u32 *u32buf; | 242 | u32 *u32buf; |
243 | int x = 0; | 243 | int x = 0; |
244 | 244 | ||
245 | IVTV_DEBUG_DMA("%s %s completed (%x)\n", ivtv_use_pio(s) ? "PIO" : "DMA", | 245 | IVTV_DEBUG_HI_DMA("%s %s completed (%x)\n", ivtv_use_pio(s) ? "PIO" : "DMA", |
246 | s->name, s->dma_offset); | 246 | s->name, s->dma_offset); |
247 | list_for_each(p, &s->q_dma.list) { | 247 | list_for_each(p, &s->q_dma.list) { |
248 | buf = list_entry(p, struct ivtv_buffer, list); | 248 | buf = list_entry(p, struct ivtv_buffer, list); |
@@ -321,7 +321,7 @@ void ivtv_dma_stream_dec_prepare(struct ivtv_stream *s, u32 offset, int lock) | |||
321 | unsigned long flags = 0; | 321 | unsigned long flags = 0; |
322 | int idx = 0; | 322 | int idx = 0; |
323 | 323 | ||
324 | IVTV_DEBUG_DMA("DEC PREPARE DMA %s: %08x %08x\n", s->name, s->q_predma.bytesused, offset); | 324 | IVTV_DEBUG_HI_DMA("DEC PREPARE DMA %s: %08x %08x\n", s->name, s->q_predma.bytesused, offset); |
325 | buf = list_entry(s->q_predma.list.next, struct ivtv_buffer, list); | 325 | buf = list_entry(s->q_predma.list.next, struct ivtv_buffer, list); |
326 | list_for_each(p, &s->q_predma.list) { | 326 | list_for_each(p, &s->q_predma.list) { |
327 | struct ivtv_buffer *buf = list_entry(p, struct ivtv_buffer, list); | 327 | struct ivtv_buffer *buf = list_entry(p, struct ivtv_buffer, list); |
@@ -368,7 +368,7 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s) | |||
368 | struct ivtv_stream *s_vbi = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; | 368 | struct ivtv_stream *s_vbi = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; |
369 | int i; | 369 | int i; |
370 | 370 | ||
371 | IVTV_DEBUG_DMA("start %s for %s\n", ivtv_use_dma(s) ? "DMA" : "PIO", s->name); | 371 | IVTV_DEBUG_HI_DMA("start %s for %s\n", ivtv_use_dma(s) ? "DMA" : "PIO", s->name); |
372 | 372 | ||
373 | if (s->q_predma.bytesused) | 373 | if (s->q_predma.bytesused) |
374 | ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused); | 374 | ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused); |
@@ -397,7 +397,7 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s) | |||
397 | itv->vbi.dma_offset = s_vbi->dma_offset; | 397 | itv->vbi.dma_offset = s_vbi->dma_offset; |
398 | s_vbi->SG_length = 0; | 398 | s_vbi->SG_length = 0; |
399 | set_bit(IVTV_F_S_DMA_HAS_VBI, &s->s_flags); | 399 | set_bit(IVTV_F_S_DMA_HAS_VBI, &s->s_flags); |
400 | IVTV_DEBUG_DMA("include DMA for %s\n", s->name); | 400 | IVTV_DEBUG_HI_DMA("include DMA for %s\n", s->name); |
401 | } | 401 | } |
402 | 402 | ||
403 | /* Mark last buffer size for Interrupt flag */ | 403 | /* Mark last buffer size for Interrupt flag */ |
@@ -431,7 +431,7 @@ static void ivtv_dma_dec_start(struct ivtv_stream *s) | |||
431 | 431 | ||
432 | if (s->q_predma.bytesused) | 432 | if (s->q_predma.bytesused) |
433 | ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused); | 433 | ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused); |
434 | IVTV_DEBUG_DMA("start DMA for %s\n", s->name); | 434 | IVTV_DEBUG_HI_DMA("start DMA for %s\n", s->name); |
435 | /* put SG Handle into register 0x0c */ | 435 | /* put SG Handle into register 0x0c */ |
436 | write_reg(s->SG_handle, IVTV_REG_DECDMAADDR); | 436 | write_reg(s->SG_handle, IVTV_REG_DECDMAADDR); |
437 | write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x01, IVTV_REG_DMAXFER); | 437 | write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x01, IVTV_REG_DMAXFER); |
@@ -447,7 +447,7 @@ static void ivtv_irq_dma_read(struct ivtv *itv) | |||
447 | struct ivtv_buffer *buf; | 447 | struct ivtv_buffer *buf; |
448 | int hw_stream_type; | 448 | int hw_stream_type; |
449 | 449 | ||
450 | IVTV_DEBUG_IRQ("DEC DMA READ\n"); | 450 | IVTV_DEBUG_HI_IRQ("DEC DMA READ\n"); |
451 | del_timer(&itv->dma_timer); | 451 | del_timer(&itv->dma_timer); |
452 | if (read_reg(IVTV_REG_DMASTATUS) & 0x14) { | 452 | if (read_reg(IVTV_REG_DMASTATUS) & 0x14) { |
453 | IVTV_DEBUG_WARN("DEC DMA ERROR %x\n", read_reg(IVTV_REG_DMASTATUS)); | 453 | IVTV_DEBUG_WARN("DEC DMA ERROR %x\n", read_reg(IVTV_REG_DMASTATUS)); |
@@ -462,7 +462,7 @@ static void ivtv_irq_dma_read(struct ivtv *itv) | |||
462 | s = &itv->streams[IVTV_DEC_STREAM_TYPE_MPG]; | 462 | s = &itv->streams[IVTV_DEC_STREAM_TYPE_MPG]; |
463 | hw_stream_type = 0; | 463 | hw_stream_type = 0; |
464 | } | 464 | } |
465 | IVTV_DEBUG_DMA("DEC DATA READ %s: %d\n", s->name, s->q_dma.bytesused); | 465 | IVTV_DEBUG_HI_DMA("DEC DATA READ %s: %d\n", s->name, s->q_dma.bytesused); |
466 | 466 | ||
467 | ivtv_stream_sync_for_cpu(s); | 467 | ivtv_stream_sync_for_cpu(s); |
468 | 468 | ||
@@ -495,7 +495,7 @@ static void ivtv_irq_enc_dma_complete(struct ivtv *itv) | |||
495 | 495 | ||
496 | del_timer(&itv->dma_timer); | 496 | del_timer(&itv->dma_timer); |
497 | ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, data); | 497 | ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, data); |
498 | IVTV_DEBUG_IRQ("ENC DMA COMPLETE %x %d\n", data[0], data[1]); | 498 | IVTV_DEBUG_HI_IRQ("ENC DMA COMPLETE %x %d\n", data[0], data[1]); |
499 | if (test_and_clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags)) | 499 | if (test_and_clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags)) |
500 | data[1] = 3; | 500 | data[1] = 3; |
501 | else if (data[1] > 2) | 501 | else if (data[1] > 2) |
@@ -532,7 +532,7 @@ static void ivtv_irq_enc_pio_complete(struct ivtv *itv) | |||
532 | return; | 532 | return; |
533 | } | 533 | } |
534 | s = &itv->streams[itv->cur_pio_stream]; | 534 | s = &itv->streams[itv->cur_pio_stream]; |
535 | IVTV_DEBUG_IRQ("ENC PIO COMPLETE %s\n", s->name); | 535 | IVTV_DEBUG_HI_IRQ("ENC PIO COMPLETE %s\n", s->name); |
536 | s->SG_length = 0; | 536 | s->SG_length = 0; |
537 | clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags); | 537 | clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags); |
538 | clear_bit(IVTV_F_I_PIO, &itv->i_flags); | 538 | clear_bit(IVTV_F_I_PIO, &itv->i_flags); |
@@ -590,7 +590,7 @@ static void ivtv_irq_enc_start_cap(struct ivtv *itv) | |||
590 | 590 | ||
591 | /* Get DMA destination and size arguments from card */ | 591 | /* Get DMA destination and size arguments from card */ |
592 | ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA, data); | 592 | ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA, data); |
593 | IVTV_DEBUG_IRQ("ENC START CAP %d: %08x %08x\n", data[0], data[1], data[2]); | 593 | IVTV_DEBUG_HI_IRQ("ENC START CAP %d: %08x %08x\n", data[0], data[1], data[2]); |
594 | 594 | ||
595 | if (data[0] > 2 || data[1] == 0 || data[2] == 0) { | 595 | if (data[0] > 2 || data[1] == 0 || data[2] == 0) { |
596 | IVTV_DEBUG_WARN("Unknown input: %08x %08x %08x\n", | 596 | IVTV_DEBUG_WARN("Unknown input: %08x %08x %08x\n", |
@@ -610,7 +610,7 @@ static void ivtv_irq_enc_vbi_cap(struct ivtv *itv) | |||
610 | u32 data[CX2341X_MBOX_MAX_DATA]; | 610 | u32 data[CX2341X_MBOX_MAX_DATA]; |
611 | struct ivtv_stream *s; | 611 | struct ivtv_stream *s; |
612 | 612 | ||
613 | IVTV_DEBUG_IRQ("ENC START VBI CAP\n"); | 613 | IVTV_DEBUG_HI_IRQ("ENC START VBI CAP\n"); |
614 | s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; | 614 | s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; |
615 | 615 | ||
616 | /* If more than two VBI buffers are pending, then | 616 | /* If more than two VBI buffers are pending, then |
@@ -644,7 +644,7 @@ static void ivtv_irq_dec_vbi_reinsert(struct ivtv *itv) | |||
644 | u32 data[CX2341X_MBOX_MAX_DATA]; | 644 | u32 data[CX2341X_MBOX_MAX_DATA]; |
645 | struct ivtv_stream *s = &itv->streams[IVTV_DEC_STREAM_TYPE_VBI]; | 645 | struct ivtv_stream *s = &itv->streams[IVTV_DEC_STREAM_TYPE_VBI]; |
646 | 646 | ||
647 | IVTV_DEBUG_IRQ("DEC VBI REINSERT\n"); | 647 | IVTV_DEBUG_HI_IRQ("DEC VBI REINSERT\n"); |
648 | if (test_bit(IVTV_F_S_CLAIMED, &s->s_flags) && | 648 | if (test_bit(IVTV_F_S_CLAIMED, &s->s_flags) && |
649 | !stream_enc_dma_append(s, data)) { | 649 | !stream_enc_dma_append(s, data)) { |
650 | set_bit(IVTV_F_S_PIO_PENDING, &s->s_flags); | 650 | set_bit(IVTV_F_S_PIO_PENDING, &s->s_flags); |
@@ -669,7 +669,7 @@ static void ivtv_irq_dec_data_req(struct ivtv *itv) | |||
669 | itv->dma_data_req_offset = data[1]; | 669 | itv->dma_data_req_offset = data[1]; |
670 | s = &itv->streams[IVTV_DEC_STREAM_TYPE_MPG]; | 670 | s = &itv->streams[IVTV_DEC_STREAM_TYPE_MPG]; |
671 | } | 671 | } |
672 | IVTV_DEBUG_IRQ("DEC DATA REQ %s: %d %08x %u\n", s->name, s->q_full.bytesused, | 672 | IVTV_DEBUG_HI_IRQ("DEC DATA REQ %s: %d %08x %u\n", s->name, s->q_full.bytesused, |
673 | itv->dma_data_req_offset, itv->dma_data_req_size); | 673 | itv->dma_data_req_offset, itv->dma_data_req_size); |
674 | if (itv->dma_data_req_size == 0 || s->q_full.bytesused < itv->dma_data_req_size) { | 674 | if (itv->dma_data_req_size == 0 || s->q_full.bytesused < itv->dma_data_req_size) { |
675 | set_bit(IVTV_F_S_NEEDS_DATA, &s->s_flags); | 675 | set_bit(IVTV_F_S_NEEDS_DATA, &s->s_flags); |
@@ -791,10 +791,10 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id) | |||
791 | /* Exclude interrupts noted below from the output, otherwise the log is flooded with | 791 | /* Exclude interrupts noted below from the output, otherwise the log is flooded with |
792 | these messages */ | 792 | these messages */ |
793 | if (combo & ~0xff6d0400) | 793 | if (combo & ~0xff6d0400) |
794 | IVTV_DEBUG_IRQ("======= valid IRQ bits: 0x%08x ======\n", combo); | 794 | IVTV_DEBUG_HI_IRQ("======= valid IRQ bits: 0x%08x ======\n", combo); |
795 | 795 | ||
796 | if (combo & IVTV_IRQ_DEC_DMA_COMPLETE) { | 796 | if (combo & IVTV_IRQ_DEC_DMA_COMPLETE) { |
797 | IVTV_DEBUG_IRQ("DEC DMA COMPLETE\n"); | 797 | IVTV_DEBUG_HI_IRQ("DEC DMA COMPLETE\n"); |
798 | } | 798 | } |
799 | 799 | ||
800 | if (combo & IVTV_IRQ_DMA_READ) { | 800 | if (combo & IVTV_IRQ_DMA_READ) { |
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index 6af88ae9295f..287117187499 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c | |||
@@ -446,6 +446,9 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) | |||
446 | if (s->v4l2dev == NULL) | 446 | if (s->v4l2dev == NULL) |
447 | return -EINVAL; | 447 | return -EINVAL; |
448 | 448 | ||
449 | /* Big serialization lock to ensure no two streams are started | ||
450 | simultaneously: that can give all sorts of weird results. */ | ||
451 | mutex_lock(&itv->serialize_lock); | ||
449 | IVTV_DEBUG_INFO("Start encoder stream %s\n", s->name); | 452 | IVTV_DEBUG_INFO("Start encoder stream %s\n", s->name); |
450 | 453 | ||
451 | switch (s->type) { | 454 | switch (s->type) { |
@@ -487,6 +490,7 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) | |||
487 | 0, sizeof(itv->vbi.sliced_mpeg_size)); | 490 | 0, sizeof(itv->vbi.sliced_mpeg_size)); |
488 | break; | 491 | break; |
489 | default: | 492 | default: |
493 | mutex_unlock(&itv->serialize_lock); | ||
490 | return -EINVAL; | 494 | return -EINVAL; |
491 | } | 495 | } |
492 | s->subtype = subtype; | 496 | s->subtype = subtype; |
@@ -568,6 +572,7 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) | |||
568 | if (ivtv_vapi(itv, CX2341X_ENC_START_CAPTURE, 2, captype, subtype)) | 572 | if (ivtv_vapi(itv, CX2341X_ENC_START_CAPTURE, 2, captype, subtype)) |
569 | { | 573 | { |
570 | IVTV_DEBUG_WARN( "Error starting capture!\n"); | 574 | IVTV_DEBUG_WARN( "Error starting capture!\n"); |
575 | mutex_unlock(&itv->serialize_lock); | ||
571 | return -EINVAL; | 576 | return -EINVAL; |
572 | } | 577 | } |
573 | 578 | ||
@@ -583,6 +588,7 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) | |||
583 | 588 | ||
584 | /* you're live! sit back and await interrupts :) */ | 589 | /* you're live! sit back and await interrupts :) */ |
585 | atomic_inc(&itv->capturing); | 590 | atomic_inc(&itv->capturing); |
591 | mutex_unlock(&itv->serialize_lock); | ||
586 | return 0; | 592 | return 0; |
587 | } | 593 | } |
588 | 594 | ||
@@ -762,17 +768,6 @@ int ivtv_stop_v4l2_encode_stream(struct ivtv_stream *s, int gop_end) | |||
762 | /* when: 0 = end of GOP 1 = NOW!, type: 0 = mpeg, subtype: 3 = video+audio */ | 768 | /* when: 0 = end of GOP 1 = NOW!, type: 0 = mpeg, subtype: 3 = video+audio */ |
763 | ivtv_vapi(itv, CX2341X_ENC_STOP_CAPTURE, 3, stopmode, cap_type, s->subtype); | 769 | ivtv_vapi(itv, CX2341X_ENC_STOP_CAPTURE, 3, stopmode, cap_type, s->subtype); |
764 | 770 | ||
765 | /* only run these if we're shutting down the last cap */ | ||
766 | if (atomic_read(&itv->capturing) - 1 == 0) { | ||
767 | /* event notification (off) */ | ||
768 | if (test_and_clear_bit(IVTV_F_I_DIG_RST, &itv->i_flags)) { | ||
769 | /* type: 0 = refresh */ | ||
770 | /* on/off: 0 = off, intr: 0x10000000, mbox_id: -1: none */ | ||
771 | ivtv_vapi(itv, CX2341X_ENC_SET_EVENT_NOTIFICATION, 4, 0, 0, IVTV_IRQ_ENC_VIM_RST, -1); | ||
772 | ivtv_set_irq_mask(itv, IVTV_IRQ_ENC_VIM_RST); | ||
773 | } | ||
774 | } | ||
775 | |||
776 | then = jiffies; | 771 | then = jiffies; |
777 | 772 | ||
778 | if (!test_bit(IVTV_F_S_PASSTHROUGH, &s->s_flags)) { | 773 | if (!test_bit(IVTV_F_S_PASSTHROUGH, &s->s_flags)) { |
@@ -812,7 +807,6 @@ int ivtv_stop_v4l2_encode_stream(struct ivtv_stream *s, int gop_end) | |||
812 | then = jiffies; | 807 | then = jiffies; |
813 | /* Make sure DMA is complete */ | 808 | /* Make sure DMA is complete */ |
814 | add_wait_queue(&s->waitq, &wait); | 809 | add_wait_queue(&s->waitq, &wait); |
815 | set_current_state(TASK_INTERRUPTIBLE); | ||
816 | do { | 810 | do { |
817 | /* check if DMA is pending */ | 811 | /* check if DMA is pending */ |
818 | if ((s->type == IVTV_ENC_STREAM_TYPE_MPG) && /* MPG Only */ | 812 | if ((s->type == IVTV_ENC_STREAM_TYPE_MPG) && /* MPG Only */ |
@@ -827,9 +821,7 @@ int ivtv_stop_v4l2_encode_stream(struct ivtv_stream *s, int gop_end) | |||
827 | } else if (read_reg(IVTV_REG_DMASTATUS) & 0x02) { | 821 | } else if (read_reg(IVTV_REG_DMASTATUS) & 0x02) { |
828 | break; | 822 | break; |
829 | } | 823 | } |
830 | 824 | } while (!ivtv_sleep_timeout(HZ / 100, 1) && then + HZ * 2 > jiffies); | |
831 | ivtv_sleep_timeout(HZ / 100, 1); | ||
832 | } while (then + HZ * 2 > jiffies); | ||
833 | 825 | ||
834 | set_current_state(TASK_RUNNING); | 826 | set_current_state(TASK_RUNNING); |
835 | remove_wait_queue(&s->waitq, &wait); | 827 | remove_wait_queue(&s->waitq, &wait); |
@@ -840,17 +832,30 @@ int ivtv_stop_v4l2_encode_stream(struct ivtv_stream *s, int gop_end) | |||
840 | /* Clear capture and no-read bits */ | 832 | /* Clear capture and no-read bits */ |
841 | clear_bit(IVTV_F_S_STREAMING, &s->s_flags); | 833 | clear_bit(IVTV_F_S_STREAMING, &s->s_flags); |
842 | 834 | ||
835 | /* ensure these global cleanup actions are done only once */ | ||
836 | mutex_lock(&itv->serialize_lock); | ||
837 | |||
843 | if (s->type == IVTV_ENC_STREAM_TYPE_VBI) | 838 | if (s->type == IVTV_ENC_STREAM_TYPE_VBI) |
844 | ivtv_set_irq_mask(itv, IVTV_IRQ_ENC_VBI_CAP); | 839 | ivtv_set_irq_mask(itv, IVTV_IRQ_ENC_VBI_CAP); |
845 | 840 | ||
846 | if (atomic_read(&itv->capturing) > 0) { | 841 | if (atomic_read(&itv->capturing) > 0) { |
842 | mutex_unlock(&itv->serialize_lock); | ||
847 | return 0; | 843 | return 0; |
848 | } | 844 | } |
849 | 845 | ||
850 | /* Set the following Interrupt mask bits for capture */ | 846 | /* Set the following Interrupt mask bits for capture */ |
851 | ivtv_set_irq_mask(itv, IVTV_IRQ_MASK_CAPTURE); | 847 | ivtv_set_irq_mask(itv, IVTV_IRQ_MASK_CAPTURE); |
852 | 848 | ||
849 | /* event notification (off) */ | ||
850 | if (test_and_clear_bit(IVTV_F_I_DIG_RST, &itv->i_flags)) { | ||
851 | /* type: 0 = refresh */ | ||
852 | /* on/off: 0 = off, intr: 0x10000000, mbox_id: -1: none */ | ||
853 | ivtv_vapi(itv, CX2341X_ENC_SET_EVENT_NOTIFICATION, 4, 0, 0, IVTV_IRQ_ENC_VIM_RST, -1); | ||
854 | ivtv_set_irq_mask(itv, IVTV_IRQ_ENC_VIM_RST); | ||
855 | } | ||
856 | |||
853 | wake_up(&s->waitq); | 857 | wake_up(&s->waitq); |
858 | mutex_unlock(&itv->serialize_lock); | ||
854 | 859 | ||
855 | return 0; | 860 | return 0; |
856 | } | 861 | } |
diff --git a/drivers/media/video/ivtv/ivtv-vbi.c b/drivers/media/video/ivtv/ivtv-vbi.c index 3ba46e07ea1f..a7282a91bd97 100644 --- a/drivers/media/video/ivtv/ivtv-vbi.c +++ b/drivers/media/video/ivtv/ivtv-vbi.c | |||
@@ -219,31 +219,23 @@ ssize_t ivtv_write_vbi(struct ivtv *itv, const char __user *ubuf, size_t count) | |||
219 | int found_cc = 0; | 219 | int found_cc = 0; |
220 | int cc_pos = itv->vbi.cc_pos; | 220 | int cc_pos = itv->vbi.cc_pos; |
221 | 221 | ||
222 | if (itv->vbi.service_set_out == 0) | ||
223 | return -EPERM; | ||
224 | |||
225 | while (count >= sizeof(struct v4l2_sliced_vbi_data)) { | 222 | while (count >= sizeof(struct v4l2_sliced_vbi_data)) { |
226 | switch (p->id) { | 223 | switch (p->id) { |
227 | case V4L2_SLICED_CAPTION_525: | 224 | case V4L2_SLICED_CAPTION_525: |
228 | if (p->id == V4L2_SLICED_CAPTION_525 && | 225 | if (p->line == 21) { |
229 | p->line == 21 && | 226 | found_cc = 1; |
230 | (itv->vbi.service_set_out & | 227 | if (p->field) { |
231 | V4L2_SLICED_CAPTION_525) == 0) { | 228 | cc[2] = p->data[0]; |
232 | break; | 229 | cc[3] = p->data[1]; |
233 | } | 230 | } else { |
234 | found_cc = 1; | 231 | cc[0] = p->data[0]; |
235 | if (p->field) { | 232 | cc[1] = p->data[1]; |
236 | cc[2] = p->data[0]; | 233 | } |
237 | cc[3] = p->data[1]; | ||
238 | } else { | ||
239 | cc[0] = p->data[0]; | ||
240 | cc[1] = p->data[1]; | ||
241 | } | 234 | } |
242 | break; | 235 | break; |
243 | 236 | ||
244 | case V4L2_SLICED_VPS: | 237 | case V4L2_SLICED_VPS: |
245 | if (p->line == 16 && p->field == 0 && | 238 | if (p->line == 16 && p->field == 0) { |
246 | (itv->vbi.service_set_out & V4L2_SLICED_VPS)) { | ||
247 | itv->vbi.vps[0] = p->data[2]; | 239 | itv->vbi.vps[0] = p->data[2]; |
248 | itv->vbi.vps[1] = p->data[8]; | 240 | itv->vbi.vps[1] = p->data[8]; |
249 | itv->vbi.vps[2] = p->data[9]; | 241 | itv->vbi.vps[2] = p->data[9]; |
@@ -255,8 +247,7 @@ ssize_t ivtv_write_vbi(struct ivtv *itv, const char __user *ubuf, size_t count) | |||
255 | break; | 247 | break; |
256 | 248 | ||
257 | case V4L2_SLICED_WSS_625: | 249 | case V4L2_SLICED_WSS_625: |
258 | if (p->line == 23 && p->field == 0 && | 250 | if (p->line == 23 && p->field == 0) { |
259 | (itv->vbi.service_set_out & V4L2_SLICED_WSS_625)) { | ||
260 | /* No lock needed for WSS */ | 251 | /* No lock needed for WSS */ |
261 | itv->vbi.wss = p->data[0] | (p->data[1] << 8); | 252 | itv->vbi.wss = p->data[0] | (p->data[1] << 8); |
262 | itv->vbi.wss_found = 1; | 253 | itv->vbi.wss_found = 1; |
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index 3bb7d6634862..507b1d4260ed 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -157,8 +157,7 @@ static int msp_read(struct i2c_client *client, int dev, int addr) | |||
157 | break; | 157 | break; |
158 | v4l_warn(client, "I/O error #%d (read 0x%02x/0x%02x)\n", err, | 158 | v4l_warn(client, "I/O error #%d (read 0x%02x/0x%02x)\n", err, |
159 | dev, addr); | 159 | dev, addr); |
160 | current->state = TASK_INTERRUPTIBLE; | 160 | schedule_timeout_interruptible(msecs_to_jiffies(10)); |
161 | schedule_timeout(msecs_to_jiffies(10)); | ||
162 | } | 161 | } |
163 | if (err == 3) { | 162 | if (err == 3) { |
164 | v4l_warn(client, "giving up, resetting chip. Sound will go off, sorry folks :-|\n"); | 163 | v4l_warn(client, "giving up, resetting chip. Sound will go off, sorry folks :-|\n"); |
@@ -197,8 +196,7 @@ static int msp_write(struct i2c_client *client, int dev, int addr, int val) | |||
197 | break; | 196 | break; |
198 | v4l_warn(client, "I/O error #%d (write 0x%02x/0x%02x)\n", err, | 197 | v4l_warn(client, "I/O error #%d (write 0x%02x/0x%02x)\n", err, |
199 | dev, addr); | 198 | dev, addr); |
200 | current->state = TASK_INTERRUPTIBLE; | 199 | schedule_timeout_interruptible(msecs_to_jiffies(10)); |
201 | schedule_timeout(msecs_to_jiffies(10)); | ||
202 | } | 200 | } |
203 | if (err == 3) { | 201 | if (err == 3) { |
204 | v4l_warn(client, "giving up, resetting chip. Sound will go off, sorry folks :-|\n"); | 202 | v4l_warn(client, "giving up, resetting chip. Sound will go off, sorry folks :-|\n"); |
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c index c7c9f3f8715c..7549114aaaca 100644 --- a/drivers/media/video/mt20xx.c +++ b/drivers/media/video/mt20xx.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <linux/i2c.h> | 7 | #include <linux/i2c.h> |
8 | #include <linux/videodev.h> | 8 | #include <linux/videodev.h> |
9 | #include <linux/moduleparam.h> | 9 | #include <linux/moduleparam.h> |
10 | #include <media/tuner.h> | 10 | #include "tuner-driver.h" |
11 | 11 | ||
12 | /* ---------------------------------------------------------------------- */ | 12 | /* ---------------------------------------------------------------------- */ |
13 | 13 | ||
@@ -37,6 +37,19 @@ static char *microtune_part[] = { | |||
37 | [ MT2050 ] = "MT2050", | 37 | [ MT2050 ] = "MT2050", |
38 | }; | 38 | }; |
39 | 39 | ||
40 | struct microtune_priv { | ||
41 | unsigned int xogc; | ||
42 | unsigned int radio_if2; | ||
43 | }; | ||
44 | |||
45 | static void microtune_release(struct i2c_client *c) | ||
46 | { | ||
47 | struct tuner *t = i2c_get_clientdata(c); | ||
48 | |||
49 | kfree(t->priv); | ||
50 | t->priv = NULL; | ||
51 | } | ||
52 | |||
40 | // IsSpurInBand()? | 53 | // IsSpurInBand()? |
41 | static int mt2032_spurcheck(struct i2c_client *c, | 54 | static int mt2032_spurcheck(struct i2c_client *c, |
42 | int f1, int f2, int spectrum_from,int spectrum_to) | 55 | int f1, int f2, int spectrum_from,int spectrum_to) |
@@ -218,6 +231,7 @@ static void mt2032_set_if_freq(struct i2c_client *c, unsigned int rfin, | |||
218 | unsigned char buf[21]; | 231 | unsigned char buf[21]; |
219 | int lint_try,ret,sel,lock=0; | 232 | int lint_try,ret,sel,lock=0; |
220 | struct tuner *t = i2c_get_clientdata(c); | 233 | struct tuner *t = i2c_get_clientdata(c); |
234 | struct microtune_priv *priv = t->priv; | ||
221 | 235 | ||
222 | tuner_dbg("mt2032_set_if_freq rfin=%d if1=%d if2=%d from=%d to=%d\n", | 236 | tuner_dbg("mt2032_set_if_freq rfin=%d if1=%d if2=%d from=%d to=%d\n", |
223 | rfin,if1,if2,from,to); | 237 | rfin,if1,if2,from,to); |
@@ -227,7 +241,7 @@ static void mt2032_set_if_freq(struct i2c_client *c, unsigned int rfin, | |||
227 | i2c_master_recv(c,buf,21); | 241 | i2c_master_recv(c,buf,21); |
228 | 242 | ||
229 | buf[0]=0; | 243 | buf[0]=0; |
230 | ret=mt2032_compute_freq(c,rfin,if1,if2,from,to,&buf[1],&sel,t->xogc); | 244 | ret=mt2032_compute_freq(c,rfin,if1,if2,from,to,&buf[1],&sel,priv->xogc); |
231 | if (ret<0) | 245 | if (ret<0) |
232 | return; | 246 | return; |
233 | 247 | ||
@@ -251,10 +265,10 @@ static void mt2032_set_if_freq(struct i2c_client *c, unsigned int rfin, | |||
251 | 265 | ||
252 | tuner_dbg("mt2032: re-init PLLs by LINT\n"); | 266 | tuner_dbg("mt2032: re-init PLLs by LINT\n"); |
253 | buf[0]=7; | 267 | buf[0]=7; |
254 | buf[1]=0x80 +8+t->xogc; // set LINT to re-init PLLs | 268 | buf[1]=0x80 +8+priv->xogc; // set LINT to re-init PLLs |
255 | i2c_master_send(c,buf,2); | 269 | i2c_master_send(c,buf,2); |
256 | mdelay(10); | 270 | mdelay(10); |
257 | buf[1]=8+t->xogc; | 271 | buf[1]=8+priv->xogc; |
258 | i2c_master_send(c,buf,2); | 272 | i2c_master_send(c,buf,2); |
259 | } | 273 | } |
260 | 274 | ||
@@ -294,17 +308,25 @@ static void mt2032_set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
294 | static void mt2032_set_radio_freq(struct i2c_client *c, unsigned int freq) | 308 | static void mt2032_set_radio_freq(struct i2c_client *c, unsigned int freq) |
295 | { | 309 | { |
296 | struct tuner *t = i2c_get_clientdata(c); | 310 | struct tuner *t = i2c_get_clientdata(c); |
297 | int if2 = t->radio_if2; | 311 | struct microtune_priv *priv = t->priv; |
312 | int if2 = priv->radio_if2; | ||
298 | 313 | ||
299 | // per Manual for FM tuning: first if center freq. 1085 MHz | 314 | // per Manual for FM tuning: first if center freq. 1085 MHz |
300 | mt2032_set_if_freq(c, freq * 1000 / 16, | 315 | mt2032_set_if_freq(c, freq * 1000 / 16, |
301 | 1085*1000*1000,if2,if2,if2); | 316 | 1085*1000*1000,if2,if2,if2); |
302 | } | 317 | } |
303 | 318 | ||
319 | static struct tuner_operations mt2032_tuner_ops = { | ||
320 | .set_tv_freq = mt2032_set_tv_freq, | ||
321 | .set_radio_freq = mt2032_set_radio_freq, | ||
322 | .release = microtune_release, | ||
323 | }; | ||
324 | |||
304 | // Initalization as described in "MT203x Programming Procedures", Rev 1.2, Feb.2001 | 325 | // Initalization as described in "MT203x Programming Procedures", Rev 1.2, Feb.2001 |
305 | static int mt2032_init(struct i2c_client *c) | 326 | static int mt2032_init(struct i2c_client *c) |
306 | { | 327 | { |
307 | struct tuner *t = i2c_get_clientdata(c); | 328 | struct tuner *t = i2c_get_clientdata(c); |
329 | struct microtune_priv *priv = t->priv; | ||
308 | unsigned char buf[21]; | 330 | unsigned char buf[21]; |
309 | int ret,xogc,xok=0; | 331 | int ret,xogc,xok=0; |
310 | 332 | ||
@@ -351,23 +373,23 @@ static int mt2032_init(struct i2c_client *c) | |||
351 | if (ret!=2) | 373 | if (ret!=2) |
352 | tuner_warn("i2c i/o error: rc == %d (should be 2)\n",ret); | 374 | tuner_warn("i2c i/o error: rc == %d (should be 2)\n",ret); |
353 | } while (xok != 1 ); | 375 | } while (xok != 1 ); |
354 | t->xogc=xogc; | 376 | priv->xogc=xogc; |
377 | |||
378 | memcpy(&t->ops, &mt2032_tuner_ops, sizeof(struct tuner_operations)); | ||
355 | 379 | ||
356 | t->set_tv_freq = mt2032_set_tv_freq; | ||
357 | t->set_radio_freq = mt2032_set_radio_freq; | ||
358 | return(1); | 380 | return(1); |
359 | } | 381 | } |
360 | 382 | ||
361 | static void mt2050_set_antenna(struct i2c_client *c, unsigned char antenna) | 383 | static void mt2050_set_antenna(struct i2c_client *c, unsigned char antenna) |
362 | { | 384 | { |
363 | struct tuner *t = i2c_get_clientdata(c); | 385 | struct tuner *t = i2c_get_clientdata(c); |
364 | unsigned char buf[2]; | 386 | unsigned char buf[2]; |
365 | int ret; | 387 | int ret; |
366 | 388 | ||
367 | buf[0] = 6; | 389 | buf[0] = 6; |
368 | buf[1] = antenna ? 0x11 : 0x10; | 390 | buf[1] = antenna ? 0x11 : 0x10; |
369 | ret=i2c_master_send(c,buf,2); | 391 | ret=i2c_master_send(c,buf,2); |
370 | tuner_dbg("mt2050: enabled antenna connector %d\n", antenna); | 392 | tuner_dbg("mt2050: enabled antenna connector %d\n", antenna); |
371 | } | 393 | } |
372 | 394 | ||
373 | static void mt2050_set_if_freq(struct i2c_client *c,unsigned int freq, unsigned int if2) | 395 | static void mt2050_set_if_freq(struct i2c_client *c,unsigned int freq, unsigned int if2) |
@@ -456,12 +478,19 @@ static void mt2050_set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
456 | static void mt2050_set_radio_freq(struct i2c_client *c, unsigned int freq) | 478 | static void mt2050_set_radio_freq(struct i2c_client *c, unsigned int freq) |
457 | { | 479 | { |
458 | struct tuner *t = i2c_get_clientdata(c); | 480 | struct tuner *t = i2c_get_clientdata(c); |
459 | int if2 = t->radio_if2; | 481 | struct microtune_priv *priv = t->priv; |
482 | int if2 = priv->radio_if2; | ||
460 | 483 | ||
461 | mt2050_set_if_freq(c, freq * 1000 / 16, if2); | 484 | mt2050_set_if_freq(c, freq * 1000 / 16, if2); |
462 | mt2050_set_antenna(c, radio_antenna); | 485 | mt2050_set_antenna(c, radio_antenna); |
463 | } | 486 | } |
464 | 487 | ||
488 | static struct tuner_operations mt2050_tuner_ops = { | ||
489 | .set_tv_freq = mt2050_set_tv_freq, | ||
490 | .set_radio_freq = mt2050_set_radio_freq, | ||
491 | .release = microtune_release, | ||
492 | }; | ||
493 | |||
465 | static int mt2050_init(struct i2c_client *c) | 494 | static int mt2050_init(struct i2c_client *c) |
466 | { | 495 | { |
467 | struct tuner *t = i2c_get_clientdata(c); | 496 | struct tuner *t = i2c_get_clientdata(c); |
@@ -481,28 +510,35 @@ static int mt2050_init(struct i2c_client *c) | |||
481 | i2c_master_recv(c,buf,1); | 510 | i2c_master_recv(c,buf,1); |
482 | 511 | ||
483 | tuner_dbg("mt2050: sro is %x\n",buf[0]); | 512 | tuner_dbg("mt2050: sro is %x\n",buf[0]); |
484 | t->set_tv_freq = mt2050_set_tv_freq; | 513 | |
485 | t->set_radio_freq = mt2050_set_radio_freq; | 514 | memcpy(&t->ops, &mt2050_tuner_ops, sizeof(struct tuner_operations)); |
515 | |||
486 | return 0; | 516 | return 0; |
487 | } | 517 | } |
488 | 518 | ||
489 | int microtune_init(struct i2c_client *c) | 519 | int microtune_init(struct i2c_client *c) |
490 | { | 520 | { |
521 | struct microtune_priv *priv = NULL; | ||
491 | struct tuner *t = i2c_get_clientdata(c); | 522 | struct tuner *t = i2c_get_clientdata(c); |
492 | char *name; | 523 | char *name; |
493 | unsigned char buf[21]; | 524 | unsigned char buf[21]; |
494 | int company_code; | 525 | int company_code; |
495 | 526 | ||
527 | priv = kzalloc(sizeof(struct microtune_priv), GFP_KERNEL); | ||
528 | if (priv == NULL) | ||
529 | return -ENOMEM; | ||
530 | t->priv = priv; | ||
531 | |||
532 | priv->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */ | ||
533 | |||
496 | memset(buf,0,sizeof(buf)); | 534 | memset(buf,0,sizeof(buf)); |
497 | t->set_tv_freq = NULL; | 535 | |
498 | t->set_radio_freq = NULL; | ||
499 | t->standby = NULL; | ||
500 | if (t->std & V4L2_STD_525_60) { | 536 | if (t->std & V4L2_STD_525_60) { |
501 | tuner_dbg("pinnacle ntsc\n"); | 537 | tuner_dbg("pinnacle ntsc\n"); |
502 | t->radio_if2 = 41300 * 1000; | 538 | priv->radio_if2 = 41300 * 1000; |
503 | } else { | 539 | } else { |
504 | tuner_dbg("pinnacle pal\n"); | 540 | tuner_dbg("pinnacle pal\n"); |
505 | t->radio_if2 = 33300 * 1000; | 541 | priv->radio_if2 = 33300 * 1000; |
506 | } | 542 | } |
507 | name = "unknown"; | 543 | name = "unknown"; |
508 | 544 | ||
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index 3ceb8a6249dd..f8f21ddd9843 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c | |||
@@ -617,7 +617,7 @@ static struct ov7670_win_size { | |||
617 | }, | 617 | }, |
618 | }; | 618 | }; |
619 | 619 | ||
620 | #define N_WIN_SIZES (sizeof(ov7670_win_sizes)/sizeof(ov7670_win_sizes[0])) | 620 | #define N_WIN_SIZES (ARRAY_SIZE(ov7670_win_sizes)) |
621 | 621 | ||
622 | 622 | ||
623 | /* | 623 | /* |
@@ -1183,7 +1183,7 @@ static struct ov7670_control { | |||
1183 | .query = ov7670_q_hflip, | 1183 | .query = ov7670_q_hflip, |
1184 | }, | 1184 | }, |
1185 | }; | 1185 | }; |
1186 | #define N_CONTROLS (sizeof(ov7670_controls)/sizeof(ov7670_controls[0])) | 1186 | #define N_CONTROLS (ARRAY_SIZE(ov7670_controls)) |
1187 | 1187 | ||
1188 | static struct ov7670_control *ov7670_find_control(__u32 id) | 1188 | static struct ov7670_control *ov7670_find_control(__u32 id) |
1189 | { | 1189 | { |
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 085332a503de..9c0e8d18c2f6 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c | |||
@@ -1099,7 +1099,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
1099 | return -EBUSY; | 1099 | return -EBUSY; |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | down(&pdev->modlock); | 1102 | mutex_lock(&pdev->modlock); |
1103 | if (!pdev->usb_init) { | 1103 | if (!pdev->usb_init) { |
1104 | PWC_DEBUG_OPEN("Doing first time initialization.\n"); | 1104 | PWC_DEBUG_OPEN("Doing first time initialization.\n"); |
1105 | pdev->usb_init = 1; | 1105 | pdev->usb_init = 1; |
@@ -1131,7 +1131,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
1131 | if (i < 0) { | 1131 | if (i < 0) { |
1132 | PWC_DEBUG_OPEN("Failed to allocate buffers memory.\n"); | 1132 | PWC_DEBUG_OPEN("Failed to allocate buffers memory.\n"); |
1133 | pwc_free_buffers(pdev); | 1133 | pwc_free_buffers(pdev); |
1134 | up(&pdev->modlock); | 1134 | mutex_unlock(&pdev->modlock); |
1135 | return i; | 1135 | return i; |
1136 | } | 1136 | } |
1137 | 1137 | ||
@@ -1172,7 +1172,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
1172 | if (i) { | 1172 | if (i) { |
1173 | PWC_DEBUG_OPEN("Second attempt at set_video_mode failed.\n"); | 1173 | PWC_DEBUG_OPEN("Second attempt at set_video_mode failed.\n"); |
1174 | pwc_free_buffers(pdev); | 1174 | pwc_free_buffers(pdev); |
1175 | up(&pdev->modlock); | 1175 | mutex_unlock(&pdev->modlock); |
1176 | return i; | 1176 | return i; |
1177 | } | 1177 | } |
1178 | 1178 | ||
@@ -1181,7 +1181,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
1181 | PWC_DEBUG_OPEN("Failed to init ISOC stuff = %d.\n", i); | 1181 | PWC_DEBUG_OPEN("Failed to init ISOC stuff = %d.\n", i); |
1182 | pwc_isoc_cleanup(pdev); | 1182 | pwc_isoc_cleanup(pdev); |
1183 | pwc_free_buffers(pdev); | 1183 | pwc_free_buffers(pdev); |
1184 | up(&pdev->modlock); | 1184 | mutex_unlock(&pdev->modlock); |
1185 | return i; | 1185 | return i; |
1186 | } | 1186 | } |
1187 | 1187 | ||
@@ -1191,7 +1191,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
1191 | 1191 | ||
1192 | pdev->vopen++; | 1192 | pdev->vopen++; |
1193 | file->private_data = vdev; | 1193 | file->private_data = vdev; |
1194 | up(&pdev->modlock); | 1194 | mutex_unlock(&pdev->modlock); |
1195 | PWC_DEBUG_OPEN("<< video_open() returns 0.\n"); | 1195 | PWC_DEBUG_OPEN("<< video_open() returns 0.\n"); |
1196 | return 0; | 1196 | return 0; |
1197 | } | 1197 | } |
@@ -1685,7 +1685,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1685 | pdev->angle_range.tilt_max = 2500; | 1685 | pdev->angle_range.tilt_max = 2500; |
1686 | } | 1686 | } |
1687 | 1687 | ||
1688 | init_MUTEX(&pdev->modlock); | 1688 | mutex_init(&pdev->modlock); |
1689 | spin_lock_init(&pdev->ptrlock); | 1689 | spin_lock_init(&pdev->ptrlock); |
1690 | 1690 | ||
1691 | pdev->udev = udev; | 1691 | pdev->udev = udev; |
diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index acbb9312960a..910a04f53920 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/wait.h> | 31 | #include <linux/wait.h> |
32 | #include <linux/smp_lock.h> | 32 | #include <linux/smp_lock.h> |
33 | #include <linux/version.h> | 33 | #include <linux/version.h> |
34 | #include <asm/semaphore.h> | 34 | #include <linux/mutex.h> |
35 | #include <asm/errno.h> | 35 | #include <asm/errno.h> |
36 | #include <linux/videodev.h> | 36 | #include <linux/videodev.h> |
37 | #include <media/v4l2-common.h> | 37 | #include <media/v4l2-common.h> |
@@ -244,7 +244,7 @@ struct pwc_device | |||
244 | int image_read_pos; /* In case we read data in pieces, keep track of were we are in the imagebuffer */ | 244 | int image_read_pos; /* In case we read data in pieces, keep track of were we are in the imagebuffer */ |
245 | int image_used[MAX_IMAGES]; /* For MCAPTURE and SYNC */ | 245 | int image_used[MAX_IMAGES]; /* For MCAPTURE and SYNC */ |
246 | 246 | ||
247 | struct semaphore modlock; /* to prevent races in video_open(), etc */ | 247 | struct mutex modlock; /* to prevent races in video_open(), etc */ |
248 | spinlock_t ptrlock; /* for manipulating the buffer pointers */ | 248 | spinlock_t ptrlock; /* for manipulating the buffer pointers */ |
249 | 249 | ||
250 | /*** motorized pan/tilt feature */ | 250 | /*** motorized pan/tilt feature */ |
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c index c1a392e47170..7ae2d646d000 100644 --- a/drivers/media/video/saa7111.c +++ b/drivers/media/video/saa7111.c | |||
@@ -37,23 +37,23 @@ | |||
37 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
38 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
39 | #include <linux/signal.h> | 39 | #include <linux/signal.h> |
40 | #include <linux/types.h> | ||
41 | #include <linux/i2c.h> | ||
40 | #include <asm/io.h> | 42 | #include <asm/io.h> |
41 | #include <asm/pgtable.h> | 43 | #include <asm/pgtable.h> |
42 | #include <asm/page.h> | 44 | #include <asm/page.h> |
43 | #include <linux/types.h> | 45 | #include <asm/uaccess.h> |
44 | 46 | ||
45 | #include <linux/videodev.h> | 47 | #include <linux/videodev.h> |
46 | #include <asm/uaccess.h> | 48 | #include <linux/video_decoder.h> |
47 | 49 | ||
48 | MODULE_DESCRIPTION("Philips SAA7111 video decoder driver"); | 50 | MODULE_DESCRIPTION("Philips SAA7111 video decoder driver"); |
49 | MODULE_AUTHOR("Dave Perks"); | 51 | MODULE_AUTHOR("Dave Perks"); |
50 | MODULE_LICENSE("GPL"); | 52 | MODULE_LICENSE("GPL"); |
51 | 53 | ||
52 | #include <linux/i2c.h> | ||
53 | 54 | ||
54 | #define I2C_NAME(s) (s)->name | 55 | #define I2C_NAME(s) (s)->name |
55 | 56 | ||
56 | #include <linux/video_decoder.h> | ||
57 | 57 | ||
58 | static int debug = 0; | 58 | static int debug = 0; |
59 | module_param(debug, int, 0644); | 59 | module_param(debug, int, 0644); |
diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c index 87c3144ec7fc..677df51de1a9 100644 --- a/drivers/media/video/saa7114.c +++ b/drivers/media/video/saa7114.c | |||
@@ -35,28 +35,26 @@ | |||
35 | #include <linux/fs.h> | 35 | #include <linux/fs.h> |
36 | #include <linux/kernel.h> | 36 | #include <linux/kernel.h> |
37 | #include <linux/major.h> | 37 | #include <linux/major.h> |
38 | |||
39 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
40 | |||
41 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
42 | #include <linux/signal.h> | 40 | #include <linux/signal.h> |
41 | #include <linux/types.h> | ||
42 | #include <linux/i2c.h> | ||
43 | #include <asm/io.h> | 43 | #include <asm/io.h> |
44 | #include <asm/pgtable.h> | 44 | #include <asm/pgtable.h> |
45 | #include <asm/page.h> | 45 | #include <asm/page.h> |
46 | #include <linux/types.h> | 46 | #include <asm/uaccess.h> |
47 | 47 | ||
48 | #include <linux/videodev.h> | 48 | #include <linux/videodev.h> |
49 | #include <asm/uaccess.h> | 49 | #include <linux/video_decoder.h> |
50 | 50 | ||
51 | MODULE_DESCRIPTION("Philips SAA7114H video decoder driver"); | 51 | MODULE_DESCRIPTION("Philips SAA7114H video decoder driver"); |
52 | MODULE_AUTHOR("Maxim Yevtyushkin"); | 52 | MODULE_AUTHOR("Maxim Yevtyushkin"); |
53 | MODULE_LICENSE("GPL"); | 53 | MODULE_LICENSE("GPL"); |
54 | 54 | ||
55 | #include <linux/i2c.h> | ||
56 | 55 | ||
57 | #define I2C_NAME(x) (x)->name | 56 | #define I2C_NAME(x) (x)->name |
58 | 57 | ||
59 | #include <linux/video_decoder.h> | ||
60 | 58 | ||
61 | static int debug = 0; | 59 | static int debug = 0; |
62 | module_param(debug, int, 0); | 60 | module_param(debug, int, 0); |
diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig index 309dca368f4a..9f1417a4f7d2 100644 --- a/drivers/media/video/saa7134/Kconfig +++ b/drivers/media/video/saa7134/Kconfig | |||
@@ -40,7 +40,7 @@ config VIDEO_SAA7134_DVB | |||
40 | depends on VIDEO_SAA7134 && DVB_CORE | 40 | depends on VIDEO_SAA7134 && DVB_CORE |
41 | select VIDEO_BUF_DVB | 41 | select VIDEO_BUF_DVB |
42 | select FW_LOADER | 42 | select FW_LOADER |
43 | select DVB_PLL | 43 | select DVB_PLL if !DVB_FE_CUSTOMISE |
44 | select DVB_MT352 if !DVB_FE_CUSTOMISE | 44 | select DVB_MT352 if !DVB_FE_CUSTOMISE |
45 | select DVB_TDA1004X if !DVB_FE_CUSTOMISE | 45 | select DVB_TDA1004X if !DVB_FE_CUSTOMISE |
46 | select DVB_NXT200X if !DVB_FE_CUSTOMISE | 46 | select DVB_NXT200X if !DVB_FE_CUSTOMISE |
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index ffb0f647a86d..3c0fc9027ad0 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c | |||
@@ -75,7 +75,8 @@ typedef struct snd_card_saa7134 { | |||
75 | struct saa7134_dev *dev; | 75 | struct saa7134_dev *dev; |
76 | 76 | ||
77 | unsigned long iobase; | 77 | unsigned long iobase; |
78 | int irq; | 78 | s16 irq; |
79 | u16 mute_was_on; | ||
79 | 80 | ||
80 | spinlock_t lock; | 81 | spinlock_t lock; |
81 | } snd_card_saa7134_t; | 82 | } snd_card_saa7134_t; |
@@ -589,8 +590,10 @@ static int snd_card_saa7134_capture_close(struct snd_pcm_substream * substream) | |||
589 | snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); | 590 | snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); |
590 | struct saa7134_dev *dev = saa7134->dev; | 591 | struct saa7134_dev *dev = saa7134->dev; |
591 | 592 | ||
592 | dev->ctl_mute = 1; | 593 | if (saa7134->mute_was_on) { |
593 | saa7134_tvaudio_setmute(dev); | 594 | dev->ctl_mute = 1; |
595 | saa7134_tvaudio_setmute(dev); | ||
596 | } | ||
594 | return 0; | 597 | return 0; |
595 | } | 598 | } |
596 | 599 | ||
@@ -637,8 +640,11 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream) | |||
637 | runtime->private_free = snd_card_saa7134_runtime_free; | 640 | runtime->private_free = snd_card_saa7134_runtime_free; |
638 | runtime->hw = snd_card_saa7134_capture; | 641 | runtime->hw = snd_card_saa7134_capture; |
639 | 642 | ||
640 | dev->ctl_mute = 0; | 643 | if (dev->ctl_mute != 0) { |
641 | saa7134_tvaudio_setmute(dev); | 644 | saa7134->mute_was_on = 1; |
645 | dev->ctl_mute = 0; | ||
646 | saa7134_tvaudio_setmute(dev); | ||
647 | } | ||
642 | 648 | ||
643 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) | 649 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) |
644 | return err; | 650 | return err; |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 50f15adfa7c8..8ec83bd70094 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -400,7 +400,7 @@ struct saa7134_board saa7134_boards[] = { | |||
400 | .inputs = {{ | 400 | .inputs = {{ |
401 | .name = name_tv, | 401 | .name = name_tv, |
402 | .vmux = 1, | 402 | .vmux = 1, |
403 | .amux = LINE2, | 403 | .amux = TV, |
404 | .tv = 1, | 404 | .tv = 1, |
405 | .gpio = 0x20000, | 405 | .gpio = 0x20000, |
406 | },{ | 406 | },{ |
@@ -3502,6 +3502,38 @@ struct saa7134_board saa7134_boards[] = { | |||
3502 | .amux = TV, | 3502 | .amux = TV, |
3503 | }, | 3503 | }, |
3504 | }, | 3504 | }, |
3505 | [SAA7134_BOARD_10MOONSTVMASTER3] = { | ||
3506 | /* Tony Wan <aloha_cn@hotmail.com> */ | ||
3507 | .name = "10MOONS TM300 TV Card", | ||
3508 | .audio_clock = 0x00200000, | ||
3509 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, | ||
3510 | .radio_type = UNSET, | ||
3511 | .tuner_addr = ADDR_UNSET, | ||
3512 | .radio_addr = ADDR_UNSET, | ||
3513 | .gpiomask = 0x7000, | ||
3514 | .inputs = {{ | ||
3515 | .name = name_tv, | ||
3516 | .vmux = 1, | ||
3517 | .amux = LINE2, | ||
3518 | .gpio = 0x0000, | ||
3519 | .tv = 1, | ||
3520 | },{ | ||
3521 | .name = name_comp1, | ||
3522 | .vmux = 3, | ||
3523 | .amux = LINE1, | ||
3524 | .gpio = 0x2000, | ||
3525 | },{ | ||
3526 | .name = name_svideo, | ||
3527 | .vmux = 8, | ||
3528 | .amux = LINE1, | ||
3529 | .gpio = 0x2000, | ||
3530 | }}, | ||
3531 | .mute = { | ||
3532 | .name = name_mute, | ||
3533 | .amux = LINE2, | ||
3534 | .gpio = 0x3000, | ||
3535 | }, | ||
3536 | }, | ||
3505 | }; | 3537 | }; |
3506 | 3538 | ||
3507 | const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); | 3539 | const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); |
@@ -4219,6 +4251,12 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
4219 | .subdevice = 0x2003, /* OEM cardbus */ | 4251 | .subdevice = 0x2003, /* OEM cardbus */ |
4220 | .driver_data = SAA7134_BOARD_SABRENT_TV_PCB05, | 4252 | .driver_data = SAA7134_BOARD_SABRENT_TV_PCB05, |
4221 | },{ | 4253 | },{ |
4254 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
4255 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | ||
4256 | .subvendor = PCI_VENDOR_ID_PHILIPS, | ||
4257 | .subdevice = 0x2304, | ||
4258 | .driver_data = SAA7134_BOARD_10MOONSTVMASTER3, | ||
4259 | },{ | ||
4222 | /* --- boards without eeprom + subsystem ID --- */ | 4260 | /* --- boards without eeprom + subsystem ID --- */ |
4223 | .vendor = PCI_VENDOR_ID_PHILIPS, | 4261 | .vendor = PCI_VENDOR_ID_PHILIPS, |
4224 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 4262 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
@@ -4330,6 +4368,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
4330 | case SAA7134_BOARD_AVERMEDIA_A16AR: | 4368 | case SAA7134_BOARD_AVERMEDIA_A16AR: |
4331 | case SAA7134_BOARD_ENCORE_ENLTV: | 4369 | case SAA7134_BOARD_ENCORE_ENLTV: |
4332 | case SAA7134_BOARD_ENCORE_ENLTV_FM: | 4370 | case SAA7134_BOARD_ENCORE_ENLTV_FM: |
4371 | case SAA7134_BOARD_10MOONSTVMASTER3: | ||
4333 | dev->has_remote = SAA7134_REMOTE_GPIO; | 4372 | dev->has_remote = SAA7134_REMOTE_GPIO; |
4334 | break; | 4373 | break; |
4335 | case SAA7134_BOARD_FLYDVBS_LR300: | 4374 | case SAA7134_BOARD_FLYDVBS_LR300: |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index e0eec80088c7..1f6bd3300715 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -175,18 +175,6 @@ static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe, | |||
175 | return mt352_pinnacle_init(fe); | 175 | return mt352_pinnacle_init(fe); |
176 | } | 176 | } |
177 | 177 | ||
178 | static int mt352_aver777_tuner_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, u8* pllbuf, int buf_len) | ||
179 | { | ||
180 | if (buf_len < 5) | ||
181 | return -EINVAL; | ||
182 | |||
183 | pllbuf[0] = 0x61; | ||
184 | dvb_pll_configure(&dvb_pll_philips_td1316, pllbuf+1, | ||
185 | params->frequency, | ||
186 | params->u.ofdm.bandwidth); | ||
187 | return 5; | ||
188 | } | ||
189 | |||
190 | static struct mt352_config pinnacle_300i = { | 178 | static struct mt352_config pinnacle_300i = { |
191 | .demod_address = 0x3c >> 1, | 179 | .demod_address = 0x3c >> 1, |
192 | .adc_clock = 20333, | 180 | .adc_clock = 20333, |
@@ -444,135 +432,6 @@ static struct tda1004x_config philips_europa_config = { | |||
444 | 432 | ||
445 | /* ------------------------------------------------------------------ */ | 433 | /* ------------------------------------------------------------------ */ |
446 | 434 | ||
447 | static int philips_fmd1216_tuner_init(struct dvb_frontend *fe) | ||
448 | { | ||
449 | struct saa7134_dev *dev = fe->dvb->priv; | ||
450 | struct tda1004x_state *state = fe->demodulator_priv; | ||
451 | u8 addr = state->config->tuner_address; | ||
452 | /* this message is to set up ATC and ALC */ | ||
453 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0xa0 }; | ||
454 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; | ||
455 | |||
456 | if (fe->ops.i2c_gate_ctrl) | ||
457 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
458 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | ||
459 | return -EIO; | ||
460 | msleep(1); | ||
461 | |||
462 | return 0; | ||
463 | } | ||
464 | |||
465 | static int philips_fmd1216_tuner_sleep(struct dvb_frontend *fe) | ||
466 | { | ||
467 | struct saa7134_dev *dev = fe->dvb->priv; | ||
468 | struct tda1004x_state *state = fe->demodulator_priv; | ||
469 | u8 addr = state->config->tuner_address; | ||
470 | /* this message actually turns the tuner back to analog mode */ | ||
471 | u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0x60 }; | ||
472 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; | ||
473 | |||
474 | if (fe->ops.i2c_gate_ctrl) | ||
475 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
476 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | ||
477 | msleep(1); | ||
478 | fmd1216_init[2] = 0x86; | ||
479 | fmd1216_init[3] = 0x54; | ||
480 | if (fe->ops.i2c_gate_ctrl) | ||
481 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
482 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | ||
483 | msleep(1); | ||
484 | return 0; | ||
485 | } | ||
486 | |||
487 | static int philips_fmd1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
488 | { | ||
489 | struct saa7134_dev *dev = fe->dvb->priv; | ||
490 | struct tda1004x_state *state = fe->demodulator_priv; | ||
491 | u8 addr = state->config->tuner_address; | ||
492 | u8 tuner_buf[4]; | ||
493 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tuner_buf,.len = | ||
494 | sizeof(tuner_buf) }; | ||
495 | int tuner_frequency = 0; | ||
496 | int divider = 0; | ||
497 | u8 band, mode, cp; | ||
498 | |||
499 | /* determine charge pump */ | ||
500 | tuner_frequency = params->frequency + 36130000; | ||
501 | if (tuner_frequency < 87000000) | ||
502 | return -EINVAL; | ||
503 | /* low band */ | ||
504 | else if (tuner_frequency < 180000000) { | ||
505 | band = 1; | ||
506 | mode = 7; | ||
507 | cp = 0; | ||
508 | } else if (tuner_frequency < 195000000) { | ||
509 | band = 1; | ||
510 | mode = 6; | ||
511 | cp = 1; | ||
512 | /* mid band */ | ||
513 | } else if (tuner_frequency < 366000000) { | ||
514 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
515 | band = 10; | ||
516 | } else { | ||
517 | band = 2; | ||
518 | } | ||
519 | mode = 7; | ||
520 | cp = 0; | ||
521 | } else if (tuner_frequency < 478000000) { | ||
522 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
523 | band = 10; | ||
524 | } else { | ||
525 | band = 2; | ||
526 | } | ||
527 | mode = 6; | ||
528 | cp = 1; | ||
529 | /* high band */ | ||
530 | } else if (tuner_frequency < 662000000) { | ||
531 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
532 | band = 12; | ||
533 | } else { | ||
534 | band = 4; | ||
535 | } | ||
536 | mode = 7; | ||
537 | cp = 0; | ||
538 | } else if (tuner_frequency < 840000000) { | ||
539 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
540 | band = 12; | ||
541 | } else { | ||
542 | band = 4; | ||
543 | } | ||
544 | mode = 6; | ||
545 | cp = 1; | ||
546 | } else { | ||
547 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
548 | band = 12; | ||
549 | } else { | ||
550 | band = 4; | ||
551 | } | ||
552 | mode = 7; | ||
553 | cp = 1; | ||
554 | |||
555 | } | ||
556 | /* calculate divisor */ | ||
557 | /* ((36166000 + Finput) / 166666) rounded! */ | ||
558 | divider = (tuner_frequency + 83333) / 166667; | ||
559 | |||
560 | /* setup tuner buffer */ | ||
561 | tuner_buf[0] = (divider >> 8) & 0x7f; | ||
562 | tuner_buf[1] = divider & 0xff; | ||
563 | tuner_buf[2] = 0x80 | (cp << 6) | (mode << 3) | 4; | ||
564 | tuner_buf[3] = 0x40 | band; | ||
565 | |||
566 | if (fe->ops.i2c_gate_ctrl) | ||
567 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
568 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) { | ||
569 | wprintk("could not write to tuner at addr: 0x%02x\n", | ||
570 | addr << 1); | ||
571 | return -EIO; | ||
572 | } | ||
573 | return 0; | ||
574 | } | ||
575 | |||
576 | static struct tda1004x_config medion_cardbus = { | 435 | static struct tda1004x_config medion_cardbus = { |
577 | .demod_address = 0x08, | 436 | .demod_address = 0x08, |
578 | .invert = 1, | 437 | .invert = 1, |
@@ -958,18 +817,8 @@ static struct nxt200x_config avertvhda180 = { | |||
958 | .demod_address = 0x0a, | 817 | .demod_address = 0x0a, |
959 | }; | 818 | }; |
960 | 819 | ||
961 | static int nxt200x_set_pll_input(u8 *buf, int input) | ||
962 | { | ||
963 | if (input) | ||
964 | buf[3] |= 0x08; | ||
965 | else | ||
966 | buf[3] &= ~0x08; | ||
967 | return 0; | ||
968 | } | ||
969 | |||
970 | static struct nxt200x_config kworldatsc110 = { | 820 | static struct nxt200x_config kworldatsc110 = { |
971 | .demod_address = 0x0a, | 821 | .demod_address = 0x0a, |
972 | .set_pll_input = nxt200x_set_pll_input, | ||
973 | }; | 822 | }; |
974 | 823 | ||
975 | /* ================================================================== | 824 | /* ================================================================== |
@@ -1005,7 +854,8 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1005 | dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777, | 854 | dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777, |
1006 | &dev->i2c_adap); | 855 | &dev->i2c_adap); |
1007 | if (dev->dvb.frontend) { | 856 | if (dev->dvb.frontend) { |
1008 | dev->dvb.frontend->ops.tuner_ops.calc_regs = mt352_aver777_tuner_calc_regs; | 857 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
858 | NULL, DVB_PLL_PHILIPS_TD1316); | ||
1009 | } | 859 | } |
1010 | break; | 860 | break; |
1011 | case SAA7134_BOARD_MD7134: | 861 | case SAA7134_BOARD_MD7134: |
@@ -1013,9 +863,8 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1013 | &medion_cardbus, | 863 | &medion_cardbus, |
1014 | &dev->i2c_adap); | 864 | &dev->i2c_adap); |
1015 | if (dev->dvb.frontend) { | 865 | if (dev->dvb.frontend) { |
1016 | dev->dvb.frontend->ops.tuner_ops.init = philips_fmd1216_tuner_init; | 866 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, medion_cardbus.tuner_address, |
1017 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_fmd1216_tuner_sleep; | 867 | &dev->i2c_adap, DVB_PLL_FMD1216ME); |
1018 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_fmd1216_tuner_set_params; | ||
1019 | } | 868 | } |
1020 | break; | 869 | break; |
1021 | case SAA7134_BOARD_PHILIPS_TOUGH: | 870 | case SAA7134_BOARD_PHILIPS_TOUGH: |
@@ -1113,7 +962,7 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1113 | &dev->i2c_adap); | 962 | &dev->i2c_adap); |
1114 | if (dev->dvb.frontend) { | 963 | if (dev->dvb.frontend) { |
1115 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 964 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
1116 | NULL, &dvb_pll_tdhu2); | 965 | NULL, DVB_PLL_TDHU2); |
1117 | } | 966 | } |
1118 | break; | 967 | break; |
1119 | case SAA7134_BOARD_KWORLD_ATSC110: | 968 | case SAA7134_BOARD_KWORLD_ATSC110: |
@@ -1121,7 +970,7 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1121 | &dev->i2c_adap); | 970 | &dev->i2c_adap); |
1122 | if (dev->dvb.frontend) { | 971 | if (dev->dvb.frontend) { |
1123 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 972 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
1124 | NULL, &dvb_pll_tuv1236d); | 973 | NULL, DVB_PLL_TUV1236D); |
1125 | } | 974 | } |
1126 | break; | 975 | break; |
1127 | case SAA7134_BOARD_FLYDVBS_LR300: | 976 | case SAA7134_BOARD_FLYDVBS_LR300: |
@@ -1144,9 +993,9 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1144 | if (dev->dvb.frontend) { | 993 | if (dev->dvb.frontend) { |
1145 | dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; | 994 | dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; |
1146 | dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; | 995 | dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; |
1147 | dev->dvb.frontend->ops.tuner_ops.init = philips_fmd1216_tuner_init; | 996 | |
1148 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_fmd1216_tuner_sleep; | 997 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, medion_cardbus.tuner_address, |
1149 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_fmd1216_tuner_set_params; | 998 | &dev->i2c_adap, DVB_PLL_FMD1216ME); |
1150 | } | 999 | } |
1151 | break; | 1000 | break; |
1152 | case SAA7134_BOARD_VIDEOMATE_DVBT_200A: | 1001 | case SAA7134_BOARD_VIDEOMATE_DVBT_200A: |
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index f521603482ca..fc260ec8fdc2 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -96,6 +96,10 @@ static int ts_open(struct inode *inode, struct file *file) | |||
96 | if (dev->empress_users) | 96 | if (dev->empress_users) |
97 | goto done_up; | 97 | goto done_up; |
98 | 98 | ||
99 | /* Unmute audio */ | ||
100 | saa_writeb(SAA7134_AUDIO_MUTE_CTRL, | ||
101 | saa_readb(SAA7134_AUDIO_MUTE_CTRL) & ~(1 << 6)); | ||
102 | |||
99 | dev->empress_users++; | 103 | dev->empress_users++; |
100 | file->private_data = dev; | 104 | file->private_data = dev; |
101 | err = 0; | 105 | err = 0; |
@@ -121,6 +125,10 @@ static int ts_release(struct inode *inode, struct file *file) | |||
121 | /* stop the encoder */ | 125 | /* stop the encoder */ |
122 | ts_reset_encoder(dev); | 126 | ts_reset_encoder(dev); |
123 | 127 | ||
128 | /* Mute audio */ | ||
129 | saa_writeb(SAA7134_AUDIO_MUTE_CTRL, | ||
130 | saa_readb(SAA7134_AUDIO_MUTE_CTRL) | (1 << 6)); | ||
131 | |||
124 | mutex_unlock(&dev->empress_tsq.lock); | 132 | mutex_unlock(&dev->empress_tsq.lock); |
125 | return 0; | 133 | return 0; |
126 | } | 134 | } |
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index c0de37e3f5c6..1b6dfd801cc1 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -153,21 +153,18 @@ void saa7134_input_irq(struct saa7134_dev *dev) | |||
153 | 153 | ||
154 | static void saa7134_input_timer(unsigned long data) | 154 | static void saa7134_input_timer(unsigned long data) |
155 | { | 155 | { |
156 | struct saa7134_dev *dev = (struct saa7134_dev*)data; | 156 | struct saa7134_dev *dev = (struct saa7134_dev *)data; |
157 | struct card_ir *ir = dev->remote; | 157 | struct card_ir *ir = dev->remote; |
158 | unsigned long timeout; | ||
159 | 158 | ||
160 | build_key(dev); | 159 | build_key(dev); |
161 | timeout = jiffies + (ir->polling * HZ / 1000); | 160 | mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling)); |
162 | mod_timer(&ir->timer, timeout); | ||
163 | } | 161 | } |
164 | 162 | ||
165 | static void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir) | 163 | static void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir) |
166 | { | 164 | { |
167 | if (ir->polling) { | 165 | if (ir->polling) { |
168 | init_timer(&ir->timer); | 166 | setup_timer(&ir->timer, saa7134_input_timer, |
169 | ir->timer.function = saa7134_input_timer; | 167 | (unsigned long)dev); |
170 | ir->timer.data = (unsigned long)dev; | ||
171 | ir->timer.expires = jiffies + HZ; | 168 | ir->timer.expires = jiffies + HZ; |
172 | add_timer(&ir->timer); | 169 | add_timer(&ir->timer); |
173 | } else if (ir->rc5_gpio) { | 170 | } else if (ir->rc5_gpio) { |
@@ -314,6 +311,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
314 | mask_keycode = 0x003F00; | 311 | mask_keycode = 0x003F00; |
315 | mask_keyup = 0x040000; | 312 | mask_keyup = 0x040000; |
316 | break; | 313 | break; |
314 | case SAA7134_BOARD_FLYDVBS_LR300: | ||
317 | case SAA7134_BOARD_FLYDVBT_LR301: | 315 | case SAA7134_BOARD_FLYDVBT_LR301: |
318 | case SAA7134_BOARD_FLYDVBTDUO: | 316 | case SAA7134_BOARD_FLYDVBTDUO: |
319 | ir_codes = ir_codes_flydvb; | 317 | ir_codes = ir_codes_flydvb; |
@@ -333,6 +331,12 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
333 | mask_keyup = 0x040000; | 331 | mask_keyup = 0x040000; |
334 | polling = 50; // ms | 332 | polling = 50; // ms |
335 | break; | 333 | break; |
334 | case SAA7134_BOARD_10MOONSTVMASTER3: | ||
335 | ir_codes = ir_codes_encore_enltv; | ||
336 | mask_keycode = 0x5f80000; | ||
337 | mask_keyup = 0x8000000; | ||
338 | polling = 50; //ms | ||
339 | break; | ||
336 | } | 340 | } |
337 | if (NULL == ir_codes) { | 341 | if (NULL == ir_codes) { |
338 | printk("%s: Oops: IR config error [card=%d]\n", | 342 | printk("%s: Oops: IR config error [card=%d]\n", |
@@ -374,7 +378,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
374 | input_dev->id.vendor = dev->pci->vendor; | 378 | input_dev->id.vendor = dev->pci->vendor; |
375 | input_dev->id.product = dev->pci->device; | 379 | input_dev->id.product = dev->pci->device; |
376 | } | 380 | } |
377 | input_dev->cdev.dev = &dev->pci->dev; | 381 | input_dev->dev.parent = &dev->pci->dev; |
378 | 382 | ||
379 | dev->remote = ir; | 383 | dev->remote = ir; |
380 | saa7134_ir_start(dev, ir); | 384 | saa7134_ir_start(dev, ir); |
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index 30395d6b5f14..18b4817b4aac 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/kthread.h> | ||
28 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
29 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
30 | #include <asm/div64.h> | 31 | #include <asm/div64.h> |
@@ -341,10 +342,8 @@ static void tvaudio_setmode(struct saa7134_dev *dev, | |||
341 | 342 | ||
342 | static int tvaudio_sleep(struct saa7134_dev *dev, int timeout) | 343 | static int tvaudio_sleep(struct saa7134_dev *dev, int timeout) |
343 | { | 344 | { |
344 | DECLARE_WAITQUEUE(wait, current); | 345 | if (dev->thread.scan1 == dev->thread.scan2 && |
345 | 346 | !kthread_should_stop()) { | |
346 | add_wait_queue(&dev->thread.wq, &wait); | ||
347 | if (dev->thread.scan1 == dev->thread.scan2 && !dev->thread.shutdown) { | ||
348 | if (timeout < 0) { | 347 | if (timeout < 0) { |
349 | set_current_state(TASK_INTERRUPTIBLE); | 348 | set_current_state(TASK_INTERRUPTIBLE); |
350 | schedule(); | 349 | schedule(); |
@@ -353,7 +352,6 @@ static int tvaudio_sleep(struct saa7134_dev *dev, int timeout) | |||
353 | (msecs_to_jiffies(timeout)); | 352 | (msecs_to_jiffies(timeout)); |
354 | } | 353 | } |
355 | } | 354 | } |
356 | remove_wait_queue(&dev->thread.wq, &wait); | ||
357 | return dev->thread.scan1 != dev->thread.scan2; | 355 | return dev->thread.scan1 != dev->thread.scan2; |
358 | } | 356 | } |
359 | 357 | ||
@@ -505,11 +503,10 @@ static int tvaudio_thread(void *data) | |||
505 | unsigned int i, audio, nscan; | 503 | unsigned int i, audio, nscan; |
506 | int max1,max2,carrier,rx,mode,lastmode,default_carrier; | 504 | int max1,max2,carrier,rx,mode,lastmode,default_carrier; |
507 | 505 | ||
508 | daemonize("%s", dev->name); | ||
509 | allow_signal(SIGTERM); | 506 | allow_signal(SIGTERM); |
510 | for (;;) { | 507 | for (;;) { |
511 | tvaudio_sleep(dev,-1); | 508 | tvaudio_sleep(dev,-1); |
512 | if (dev->thread.shutdown || signal_pending(current)) | 509 | if (kthread_should_stop() || signal_pending(current)) |
513 | goto done; | 510 | goto done; |
514 | 511 | ||
515 | restart: | 512 | restart: |
@@ -618,7 +615,7 @@ static int tvaudio_thread(void *data) | |||
618 | for (;;) { | 615 | for (;;) { |
619 | if (tvaudio_sleep(dev,5000)) | 616 | if (tvaudio_sleep(dev,5000)) |
620 | goto restart; | 617 | goto restart; |
621 | if (dev->thread.shutdown || signal_pending(current)) | 618 | if (kthread_should_stop() || signal_pending(current)) |
622 | break; | 619 | break; |
623 | if (UNSET == dev->thread.mode) { | 620 | if (UNSET == dev->thread.mode) { |
624 | rx = tvaudio_getstereo(dev,&tvaudio[i]); | 621 | rx = tvaudio_getstereo(dev,&tvaudio[i]); |
@@ -634,7 +631,6 @@ static int tvaudio_thread(void *data) | |||
634 | } | 631 | } |
635 | 632 | ||
636 | done: | 633 | done: |
637 | complete_and_exit(&dev->thread.exit, 0); | ||
638 | return 0; | 634 | return 0; |
639 | } | 635 | } |
640 | 636 | ||
@@ -782,7 +778,6 @@ static int tvaudio_thread_ddep(void *data) | |||
782 | struct saa7134_dev *dev = data; | 778 | struct saa7134_dev *dev = data; |
783 | u32 value, norms, clock; | 779 | u32 value, norms, clock; |
784 | 780 | ||
785 | daemonize("%s", dev->name); | ||
786 | allow_signal(SIGTERM); | 781 | allow_signal(SIGTERM); |
787 | 782 | ||
788 | clock = saa7134_boards[dev->board].audio_clock; | 783 | clock = saa7134_boards[dev->board].audio_clock; |
@@ -796,7 +791,7 @@ static int tvaudio_thread_ddep(void *data) | |||
796 | 791 | ||
797 | for (;;) { | 792 | for (;;) { |
798 | tvaudio_sleep(dev,-1); | 793 | tvaudio_sleep(dev,-1); |
799 | if (dev->thread.shutdown || signal_pending(current)) | 794 | if (kthread_should_stop() || signal_pending(current)) |
800 | goto done; | 795 | goto done; |
801 | 796 | ||
802 | restart: | 797 | restart: |
@@ -876,7 +871,6 @@ static int tvaudio_thread_ddep(void *data) | |||
876 | } | 871 | } |
877 | 872 | ||
878 | done: | 873 | done: |
879 | complete_and_exit(&dev->thread.exit, 0); | ||
880 | return 0; | 874 | return 0; |
881 | } | 875 | } |
882 | 876 | ||
@@ -973,7 +967,6 @@ int saa7134_tvaudio_getstereo(struct saa7134_dev *dev) | |||
973 | 967 | ||
974 | int saa7134_tvaudio_init2(struct saa7134_dev *dev) | 968 | int saa7134_tvaudio_init2(struct saa7134_dev *dev) |
975 | { | 969 | { |
976 | DECLARE_MUTEX_LOCKED(sem); | ||
977 | int (*my_thread)(void *data) = NULL; | 970 | int (*my_thread)(void *data) = NULL; |
978 | 971 | ||
979 | switch (dev->pci->device) { | 972 | switch (dev->pci->device) { |
@@ -986,15 +979,15 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev) | |||
986 | break; | 979 | break; |
987 | } | 980 | } |
988 | 981 | ||
989 | dev->thread.pid = -1; | 982 | dev->thread.thread = NULL; |
990 | if (my_thread) { | 983 | if (my_thread) { |
991 | /* start tvaudio thread */ | 984 | /* start tvaudio thread */ |
992 | init_waitqueue_head(&dev->thread.wq); | 985 | dev->thread.thread = kthread_run(my_thread, dev, "%s", dev->name); |
993 | init_completion(&dev->thread.exit); | 986 | if (IS_ERR(dev->thread.thread)) { |
994 | dev->thread.pid = kernel_thread(my_thread,dev,0); | ||
995 | if (dev->thread.pid < 0) | ||
996 | printk(KERN_WARNING "%s: kernel_thread() failed\n", | 987 | printk(KERN_WARNING "%s: kernel_thread() failed\n", |
997 | dev->name); | 988 | dev->name); |
989 | /* XXX: missing error handling here */ | ||
990 | } | ||
998 | saa7134_tvaudio_do_scan(dev); | 991 | saa7134_tvaudio_do_scan(dev); |
999 | } | 992 | } |
1000 | 993 | ||
@@ -1005,11 +998,9 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev) | |||
1005 | int saa7134_tvaudio_fini(struct saa7134_dev *dev) | 998 | int saa7134_tvaudio_fini(struct saa7134_dev *dev) |
1006 | { | 999 | { |
1007 | /* shutdown tvaudio thread */ | 1000 | /* shutdown tvaudio thread */ |
1008 | if (dev->thread.pid > 0) { | 1001 | if (dev->thread.thread) |
1009 | dev->thread.shutdown = 1; | 1002 | kthread_stop(dev->thread.thread); |
1010 | wake_up_interruptible(&dev->thread.wq); | 1003 | |
1011 | wait_for_completion(&dev->thread.exit); | ||
1012 | } | ||
1013 | saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x07, 0x00); /* LINE1 */ | 1004 | saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x07, 0x00); /* LINE1 */ |
1014 | return 0; | 1005 | return 0; |
1015 | } | 1006 | } |
@@ -1020,10 +1011,10 @@ int saa7134_tvaudio_do_scan(struct saa7134_dev *dev) | |||
1020 | dprintk("sound IF not in use, skipping scan\n"); | 1011 | dprintk("sound IF not in use, skipping scan\n"); |
1021 | dev->automute = 0; | 1012 | dev->automute = 0; |
1022 | saa7134_tvaudio_setmute(dev); | 1013 | saa7134_tvaudio_setmute(dev); |
1023 | } else if (dev->thread.pid >= 0) { | 1014 | } else if (dev->thread.thread) { |
1024 | dev->thread.mode = UNSET; | 1015 | dev->thread.mode = UNSET; |
1025 | dev->thread.scan2++; | 1016 | dev->thread.scan2++; |
1026 | wake_up_interruptible(&dev->thread.wq); | 1017 | wake_up_process(dev->thread.thread); |
1027 | } else { | 1018 | } else { |
1028 | dev->automute = 0; | 1019 | dev->automute = 0; |
1029 | saa7134_tvaudio_setmute(dev); | 1020 | saa7134_tvaudio_setmute(dev); |
@@ -1040,4 +1031,3 @@ EXPORT_SYMBOL(saa7134_tvaudio_setmute); | |||
1040 | * c-basic-offset: 8 | 1031 | * c-basic-offset: 8 |
1041 | * End: | 1032 | * End: |
1042 | */ | 1033 | */ |
1043 | |||
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 15623b27ad2e..d32a856192d7 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -238,6 +238,7 @@ struct saa7134_format { | |||
238 | #define SAA7134_BOARD_ECS_TVP3XP_4CB6 113 | 238 | #define SAA7134_BOARD_ECS_TVP3XP_4CB6 113 |
239 | #define SAA7134_BOARD_KWORLD_DVBT_210 114 | 239 | #define SAA7134_BOARD_KWORLD_DVBT_210 114 |
240 | #define SAA7134_BOARD_SABRENT_TV_PCB05 115 | 240 | #define SAA7134_BOARD_SABRENT_TV_PCB05 115 |
241 | #define SAA7134_BOARD_10MOONSTVMASTER3 116 | ||
241 | 242 | ||
242 | #define SAA7134_MAXBOARDS 8 | 243 | #define SAA7134_MAXBOARDS 8 |
243 | #define SAA7134_INPUT_MAX 8 | 244 | #define SAA7134_INPUT_MAX 8 |
@@ -327,10 +328,7 @@ struct saa7134_pgtable { | |||
327 | 328 | ||
328 | /* tvaudio thread status */ | 329 | /* tvaudio thread status */ |
329 | struct saa7134_thread { | 330 | struct saa7134_thread { |
330 | pid_t pid; | 331 | struct task_struct *thread; |
331 | struct completion exit; | ||
332 | wait_queue_head_t wq; | ||
333 | unsigned int shutdown; | ||
334 | unsigned int scan1; | 332 | unsigned int scan1; |
335 | unsigned int scan2; | 333 | unsigned int scan2; |
336 | unsigned int mode; | 334 | unsigned int mode; |
diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c index 339592e7722d..66cc92c0ea66 100644 --- a/drivers/media/video/saa7185.c +++ b/drivers/media/video/saa7185.c | |||
@@ -34,23 +34,23 @@ | |||
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/mm.h> | 35 | #include <linux/mm.h> |
36 | #include <linux/signal.h> | 36 | #include <linux/signal.h> |
37 | #include <linux/types.h> | ||
38 | #include <linux/i2c.h> | ||
37 | #include <asm/io.h> | 39 | #include <asm/io.h> |
38 | #include <asm/pgtable.h> | 40 | #include <asm/pgtable.h> |
39 | #include <asm/page.h> | 41 | #include <asm/page.h> |
40 | #include <linux/types.h> | 42 | #include <asm/uaccess.h> |
41 | 43 | ||
42 | #include <linux/videodev.h> | 44 | #include <linux/videodev.h> |
43 | #include <asm/uaccess.h> | 45 | #include <linux/video_encoder.h> |
44 | 46 | ||
45 | MODULE_DESCRIPTION("Philips SAA7185 video encoder driver"); | 47 | MODULE_DESCRIPTION("Philips SAA7185 video encoder driver"); |
46 | MODULE_AUTHOR("Dave Perks"); | 48 | MODULE_AUTHOR("Dave Perks"); |
47 | MODULE_LICENSE("GPL"); | 49 | MODULE_LICENSE("GPL"); |
48 | 50 | ||
49 | #include <linux/i2c.h> | ||
50 | 51 | ||
51 | #define I2C_NAME(s) (s)->name | 52 | #define I2C_NAME(s) (s)->name |
52 | 53 | ||
53 | #include <linux/video_encoder.h> | ||
54 | 54 | ||
55 | static int debug = 0; | 55 | static int debug = 0; |
56 | module_param(debug, int, 0); | 56 | module_param(debug, int, 0); |
diff --git a/drivers/media/video/sn9c102/sn9c102.h b/drivers/media/video/sn9c102/sn9c102.h index 11fcb49f5b99..2e3c3de793a7 100644 --- a/drivers/media/video/sn9c102/sn9c102.h +++ b/drivers/media/video/sn9c102/sn9c102.h | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | #include <linux/string.h> | 37 | #include <linux/string.h> |
38 | #include <linux/stddef.h> | 38 | #include <linux/stddef.h> |
39 | #include <linux/kref.h> | ||
39 | 40 | ||
40 | #include "sn9c102_config.h" | 41 | #include "sn9c102_config.h" |
41 | #include "sn9c102_sensor.h" | 42 | #include "sn9c102_sensor.h" |
@@ -94,7 +95,7 @@ struct sn9c102_module_param { | |||
94 | }; | 95 | }; |
95 | 96 | ||
96 | static DEFINE_MUTEX(sn9c102_sysfs_lock); | 97 | static DEFINE_MUTEX(sn9c102_sysfs_lock); |
97 | static DECLARE_RWSEM(sn9c102_disconnect); | 98 | static DECLARE_RWSEM(sn9c102_dev_lock); |
98 | 99 | ||
99 | struct sn9c102_device { | 100 | struct sn9c102_device { |
100 | struct video_device* v4ldev; | 101 | struct video_device* v4ldev; |
@@ -122,12 +123,14 @@ struct sn9c102_device { | |||
122 | 123 | ||
123 | struct sn9c102_module_param module_param; | 124 | struct sn9c102_module_param module_param; |
124 | 125 | ||
126 | struct kref kref; | ||
125 | enum sn9c102_dev_state state; | 127 | enum sn9c102_dev_state state; |
126 | u8 users; | 128 | u8 users; |
127 | 129 | ||
128 | struct mutex dev_mutex, fileop_mutex; | 130 | struct completion probe; |
131 | struct mutex open_mutex, fileop_mutex; | ||
129 | spinlock_t queue_lock; | 132 | spinlock_t queue_lock; |
130 | wait_queue_head_t open, wait_frame, wait_stream; | 133 | wait_queue_head_t wait_open, wait_frame, wait_stream; |
131 | }; | 134 | }; |
132 | 135 | ||
133 | /*****************************************************************************/ | 136 | /*****************************************************************************/ |
diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c index 74a204f8ebc8..36d8a455e0ec 100644 --- a/drivers/media/video/sn9c102/sn9c102_core.c +++ b/drivers/media/video/sn9c102/sn9c102_core.c | |||
@@ -48,8 +48,8 @@ | |||
48 | #define SN9C102_MODULE_AUTHOR "(C) 2004-2007 Luca Risolia" | 48 | #define SN9C102_MODULE_AUTHOR "(C) 2004-2007 Luca Risolia" |
49 | #define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" | 49 | #define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" |
50 | #define SN9C102_MODULE_LICENSE "GPL" | 50 | #define SN9C102_MODULE_LICENSE "GPL" |
51 | #define SN9C102_MODULE_VERSION "1:1.44" | 51 | #define SN9C102_MODULE_VERSION "1:1.47" |
52 | #define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 1, 44) | 52 | #define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 1, 47) |
53 | 53 | ||
54 | /*****************************************************************************/ | 54 | /*****************************************************************************/ |
55 | 55 | ||
@@ -64,9 +64,10 @@ MODULE_LICENSE(SN9C102_MODULE_LICENSE); | |||
64 | static short video_nr[] = {[0 ... SN9C102_MAX_DEVICES-1] = -1}; | 64 | static short video_nr[] = {[0 ... SN9C102_MAX_DEVICES-1] = -1}; |
65 | module_param_array(video_nr, short, NULL, 0444); | 65 | module_param_array(video_nr, short, NULL, 0444); |
66 | MODULE_PARM_DESC(video_nr, | 66 | MODULE_PARM_DESC(video_nr, |
67 | "\n<-1|n[,...]> Specify V4L2 minor mode number." | 67 | " <-1|n[,...]>" |
68 | "\n -1 = use next available (default)" | 68 | "\nSpecify V4L2 minor mode number." |
69 | "\n n = use minor number n (integer >= 0)" | 69 | "\n-1 = use next available (default)" |
70 | "\n n = use minor number n (integer >= 0)" | ||
70 | "\nYou can specify up to "__MODULE_STRING(SN9C102_MAX_DEVICES) | 71 | "\nYou can specify up to "__MODULE_STRING(SN9C102_MAX_DEVICES) |
71 | " cameras this way." | 72 | " cameras this way." |
72 | "\nFor example:" | 73 | "\nFor example:" |
@@ -79,13 +80,14 @@ static short force_munmap[] = {[0 ... SN9C102_MAX_DEVICES-1] = | |||
79 | SN9C102_FORCE_MUNMAP}; | 80 | SN9C102_FORCE_MUNMAP}; |
80 | module_param_array(force_munmap, bool, NULL, 0444); | 81 | module_param_array(force_munmap, bool, NULL, 0444); |
81 | MODULE_PARM_DESC(force_munmap, | 82 | MODULE_PARM_DESC(force_munmap, |
82 | "\n<0|1[,...]> Force the application to unmap previously" | 83 | " <0|1[,...]>" |
84 | "\nForce the application to unmap previously" | ||
83 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or" | 85 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or" |
84 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support" | 86 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support" |
85 | "\nthis feature. This parameter is specific for each" | 87 | "\nthis feature. This parameter is specific for each" |
86 | "\ndetected camera." | 88 | "\ndetected camera." |
87 | "\n 0 = do not force memory unmapping" | 89 | "\n0 = do not force memory unmapping" |
88 | "\n 1 = force memory unmapping (save memory)" | 90 | "\n1 = force memory unmapping (save memory)" |
89 | "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." | 91 | "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." |
90 | "\n"); | 92 | "\n"); |
91 | 93 | ||
@@ -93,7 +95,8 @@ static unsigned int frame_timeout[] = {[0 ... SN9C102_MAX_DEVICES-1] = | |||
93 | SN9C102_FRAME_TIMEOUT}; | 95 | SN9C102_FRAME_TIMEOUT}; |
94 | module_param_array(frame_timeout, uint, NULL, 0644); | 96 | module_param_array(frame_timeout, uint, NULL, 0644); |
95 | MODULE_PARM_DESC(frame_timeout, | 97 | MODULE_PARM_DESC(frame_timeout, |
96 | "\n<0|n[,...]> Timeout for a video frame in seconds before" | 98 | " <0|n[,...]>" |
99 | "\nTimeout for a video frame in seconds before" | ||
97 | "\nreturning an I/O error; 0 for infinity." | 100 | "\nreturning an I/O error; 0 for infinity." |
98 | "\nThis parameter is specific for each detected camera." | 101 | "\nThis parameter is specific for each detected camera." |
99 | "\nDefault value is "__MODULE_STRING(SN9C102_FRAME_TIMEOUT)"." | 102 | "\nDefault value is "__MODULE_STRING(SN9C102_FRAME_TIMEOUT)"." |
@@ -103,7 +106,8 @@ MODULE_PARM_DESC(frame_timeout, | |||
103 | static unsigned short debug = SN9C102_DEBUG_LEVEL; | 106 | static unsigned short debug = SN9C102_DEBUG_LEVEL; |
104 | module_param(debug, ushort, 0644); | 107 | module_param(debug, ushort, 0644); |
105 | MODULE_PARM_DESC(debug, | 108 | MODULE_PARM_DESC(debug, |
106 | "\n<n> Debugging information level, from 0 to 3:" | 109 | " <n>" |
110 | "\nDebugging information level, from 0 to 3:" | ||
107 | "\n0 = none (use carefully)" | 111 | "\n0 = none (use carefully)" |
108 | "\n1 = critical errors" | 112 | "\n1 = critical errors" |
109 | "\n2 = significant informations" | 113 | "\n2 = significant informations" |
@@ -1616,7 +1620,8 @@ static int sn9c102_init(struct sn9c102_device* cam) | |||
1616 | int err = 0; | 1620 | int err = 0; |
1617 | 1621 | ||
1618 | if (!(cam->state & DEV_INITIALIZED)) { | 1622 | if (!(cam->state & DEV_INITIALIZED)) { |
1619 | init_waitqueue_head(&cam->open); | 1623 | mutex_init(&cam->open_mutex); |
1624 | init_waitqueue_head(&cam->wait_open); | ||
1620 | qctrl = s->qctrl; | 1625 | qctrl = s->qctrl; |
1621 | rect = &(s->cropcap.defrect); | 1626 | rect = &(s->cropcap.defrect); |
1622 | } else { /* use current values */ | 1627 | } else { /* use current values */ |
@@ -1706,21 +1711,27 @@ static int sn9c102_init(struct sn9c102_device* cam) | |||
1706 | return 0; | 1711 | return 0; |
1707 | } | 1712 | } |
1708 | 1713 | ||
1714 | /*****************************************************************************/ | ||
1709 | 1715 | ||
1710 | static void sn9c102_release_resources(struct sn9c102_device* cam) | 1716 | static void sn9c102_release_resources(struct kref *kref) |
1711 | { | 1717 | { |
1718 | struct sn9c102_device *cam; | ||
1719 | |||
1712 | mutex_lock(&sn9c102_sysfs_lock); | 1720 | mutex_lock(&sn9c102_sysfs_lock); |
1713 | 1721 | ||
1722 | cam = container_of(kref, struct sn9c102_device, kref); | ||
1723 | |||
1714 | DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor); | 1724 | DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor); |
1715 | video_set_drvdata(cam->v4ldev, NULL); | 1725 | video_set_drvdata(cam->v4ldev, NULL); |
1716 | video_unregister_device(cam->v4ldev); | 1726 | video_unregister_device(cam->v4ldev); |
1727 | usb_put_dev(cam->usbdev); | ||
1728 | kfree(cam->control_buffer); | ||
1729 | kfree(cam); | ||
1717 | 1730 | ||
1718 | mutex_unlock(&sn9c102_sysfs_lock); | 1731 | mutex_unlock(&sn9c102_sysfs_lock); |
1719 | 1732 | ||
1720 | kfree(cam->control_buffer); | ||
1721 | } | 1733 | } |
1722 | 1734 | ||
1723 | /*****************************************************************************/ | ||
1724 | 1735 | ||
1725 | static int sn9c102_open(struct inode* inode, struct file* filp) | 1736 | static int sn9c102_open(struct inode* inode, struct file* filp) |
1726 | { | 1737 | { |
@@ -1728,43 +1739,78 @@ static int sn9c102_open(struct inode* inode, struct file* filp) | |||
1728 | int err = 0; | 1739 | int err = 0; |
1729 | 1740 | ||
1730 | /* | 1741 | /* |
1731 | This is the only safe way to prevent race conditions with | 1742 | A read_trylock() in open() is the only safe way to prevent race |
1732 | disconnect | 1743 | conditions with disconnect(), one close() and multiple (not |
1744 | necessarily simultaneous) attempts to open(). For example, it | ||
1745 | prevents from waiting for a second access, while the device | ||
1746 | structure is being deallocated, after a possible disconnect() and | ||
1747 | during a following close() holding the write lock: given that, after | ||
1748 | this deallocation, no access will be possible anymore, using the | ||
1749 | non-trylock version would have let open() gain the access to the | ||
1750 | device structure improperly. | ||
1751 | For this reason the lock must also not be per-device. | ||
1733 | */ | 1752 | */ |
1734 | if (!down_read_trylock(&sn9c102_disconnect)) | 1753 | if (!down_read_trylock(&sn9c102_dev_lock)) |
1735 | return -ERESTARTSYS; | 1754 | return -ERESTARTSYS; |
1736 | 1755 | ||
1737 | cam = video_get_drvdata(video_devdata(filp)); | 1756 | cam = video_get_drvdata(video_devdata(filp)); |
1738 | 1757 | ||
1739 | if (mutex_lock_interruptible(&cam->dev_mutex)) { | 1758 | if (wait_for_completion_interruptible(&cam->probe)) { |
1740 | up_read(&sn9c102_disconnect); | 1759 | up_read(&sn9c102_dev_lock); |
1760 | return -ERESTARTSYS; | ||
1761 | } | ||
1762 | |||
1763 | kref_get(&cam->kref); | ||
1764 | |||
1765 | /* | ||
1766 | Make sure to isolate all the simultaneous opens. | ||
1767 | */ | ||
1768 | if (mutex_lock_interruptible(&cam->open_mutex)) { | ||
1769 | kref_put(&cam->kref, sn9c102_release_resources); | ||
1770 | up_read(&sn9c102_dev_lock); | ||
1741 | return -ERESTARTSYS; | 1771 | return -ERESTARTSYS; |
1742 | } | 1772 | } |
1743 | 1773 | ||
1774 | if (cam->state & DEV_DISCONNECTED) { | ||
1775 | DBG(1, "Device not present"); | ||
1776 | err = -ENODEV; | ||
1777 | goto out; | ||
1778 | } | ||
1779 | |||
1744 | if (cam->users) { | 1780 | if (cam->users) { |
1745 | DBG(2, "Device /dev/video%d is busy...", cam->v4ldev->minor); | 1781 | DBG(2, "Device /dev/video%d is already in use", |
1782 | cam->v4ldev->minor); | ||
1746 | DBG(3, "Simultaneous opens are not supported"); | 1783 | DBG(3, "Simultaneous opens are not supported"); |
1784 | /* | ||
1785 | open() must follow the open flags and should block | ||
1786 | eventually while the device is in use. | ||
1787 | */ | ||
1747 | if ((filp->f_flags & O_NONBLOCK) || | 1788 | if ((filp->f_flags & O_NONBLOCK) || |
1748 | (filp->f_flags & O_NDELAY)) { | 1789 | (filp->f_flags & O_NDELAY)) { |
1749 | err = -EWOULDBLOCK; | 1790 | err = -EWOULDBLOCK; |
1750 | goto out; | 1791 | goto out; |
1751 | } | 1792 | } |
1752 | mutex_unlock(&cam->dev_mutex); | 1793 | DBG(2, "A blocking open() has been requested. Wait for the " |
1753 | err = wait_event_interruptible_exclusive(cam->open, | 1794 | "device to be released..."); |
1754 | cam->state & DEV_DISCONNECTED | 1795 | up_read(&sn9c102_dev_lock); |
1796 | /* | ||
1797 | We will not release the "open_mutex" lock, so that only one | ||
1798 | process can be in the wait queue below. This way the process | ||
1799 | will be sleeping while holding the lock, without loosing its | ||
1800 | priority after any wake_up(). | ||
1801 | */ | ||
1802 | err = wait_event_interruptible_exclusive(cam->wait_open, | ||
1803 | (cam->state & DEV_DISCONNECTED) | ||
1755 | || !cam->users); | 1804 | || !cam->users); |
1756 | if (err) { | 1805 | down_read(&sn9c102_dev_lock); |
1757 | up_read(&sn9c102_disconnect); | 1806 | if (err) |
1758 | return err; | 1807 | goto out; |
1759 | } | ||
1760 | if (cam->state & DEV_DISCONNECTED) { | 1808 | if (cam->state & DEV_DISCONNECTED) { |
1761 | up_read(&sn9c102_disconnect); | 1809 | err = -ENODEV; |
1762 | return -ENODEV; | 1810 | goto out; |
1763 | } | 1811 | } |
1764 | mutex_lock(&cam->dev_mutex); | ||
1765 | } | 1812 | } |
1766 | 1813 | ||
1767 | |||
1768 | if (cam->state & DEV_MISCONFIGURED) { | 1814 | if (cam->state & DEV_MISCONFIGURED) { |
1769 | err = sn9c102_init(cam); | 1815 | err = sn9c102_init(cam); |
1770 | if (err) { | 1816 | if (err) { |
@@ -1789,36 +1835,33 @@ static int sn9c102_open(struct inode* inode, struct file* filp) | |||
1789 | DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor); | 1835 | DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor); |
1790 | 1836 | ||
1791 | out: | 1837 | out: |
1792 | mutex_unlock(&cam->dev_mutex); | 1838 | mutex_unlock(&cam->open_mutex); |
1793 | up_read(&sn9c102_disconnect); | 1839 | if (err) |
1840 | kref_put(&cam->kref, sn9c102_release_resources); | ||
1841 | |||
1842 | up_read(&sn9c102_dev_lock); | ||
1794 | return err; | 1843 | return err; |
1795 | } | 1844 | } |
1796 | 1845 | ||
1797 | 1846 | ||
1798 | static int sn9c102_release(struct inode* inode, struct file* filp) | 1847 | static int sn9c102_release(struct inode* inode, struct file* filp) |
1799 | { | 1848 | { |
1800 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); | 1849 | struct sn9c102_device* cam; |
1801 | 1850 | ||
1802 | mutex_lock(&cam->dev_mutex); /* prevent disconnect() to be called */ | 1851 | down_write(&sn9c102_dev_lock); |
1803 | 1852 | ||
1804 | sn9c102_stop_transfer(cam); | 1853 | cam = video_get_drvdata(video_devdata(filp)); |
1805 | 1854 | ||
1855 | sn9c102_stop_transfer(cam); | ||
1806 | sn9c102_release_buffers(cam); | 1856 | sn9c102_release_buffers(cam); |
1807 | |||
1808 | if (cam->state & DEV_DISCONNECTED) { | ||
1809 | sn9c102_release_resources(cam); | ||
1810 | usb_put_dev(cam->usbdev); | ||
1811 | mutex_unlock(&cam->dev_mutex); | ||
1812 | kfree(cam); | ||
1813 | return 0; | ||
1814 | } | ||
1815 | |||
1816 | cam->users--; | 1857 | cam->users--; |
1817 | wake_up_interruptible_nr(&cam->open, 1); | 1858 | wake_up_interruptible_nr(&cam->wait_open, 1); |
1818 | 1859 | ||
1819 | DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor); | 1860 | DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor); |
1820 | 1861 | ||
1821 | mutex_unlock(&cam->dev_mutex); | 1862 | kref_put(&cam->kref, sn9c102_release_resources); |
1863 | |||
1864 | up_write(&sn9c102_dev_lock); | ||
1822 | 1865 | ||
1823 | return 0; | 1866 | return 0; |
1824 | } | 1867 | } |
@@ -2085,7 +2128,6 @@ static int sn9c102_mmap(struct file* filp, struct vm_area_struct *vma) | |||
2085 | 2128 | ||
2086 | vma->vm_ops = &sn9c102_vm_ops; | 2129 | vma->vm_ops = &sn9c102_vm_ops; |
2087 | vma->vm_private_data = &cam->frame[i]; | 2130 | vma->vm_private_data = &cam->frame[i]; |
2088 | |||
2089 | sn9c102_vm_open(vma); | 2131 | sn9c102_vm_open(vma); |
2090 | 2132 | ||
2091 | mutex_unlock(&cam->fileop_mutex); | 2133 | mutex_unlock(&cam->fileop_mutex); |
@@ -3215,8 +3257,6 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
3215 | goto fail; | 3257 | goto fail; |
3216 | } | 3258 | } |
3217 | 3259 | ||
3218 | mutex_init(&cam->dev_mutex); | ||
3219 | |||
3220 | r = sn9c102_read_reg(cam, 0x00); | 3260 | r = sn9c102_read_reg(cam, 0x00); |
3221 | if (r < 0 || (r != 0x10 && r != 0x11 && r != 0x12)) { | 3261 | if (r < 0 || (r != 0x10 && r != 0x11 && r != 0x12)) { |
3222 | DBG(1, "Sorry, this is not a SN9C1xx-based camera " | 3262 | DBG(1, "Sorry, this is not a SN9C1xx-based camera " |
@@ -3282,7 +3322,7 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
3282 | cam->v4ldev->release = video_device_release; | 3322 | cam->v4ldev->release = video_device_release; |
3283 | video_set_drvdata(cam->v4ldev, cam); | 3323 | video_set_drvdata(cam->v4ldev, cam); |
3284 | 3324 | ||
3285 | mutex_lock(&cam->dev_mutex); | 3325 | init_completion(&cam->probe); |
3286 | 3326 | ||
3287 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, | 3327 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, |
3288 | video_nr[dev_nr]); | 3328 | video_nr[dev_nr]); |
@@ -3292,7 +3332,7 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
3292 | DBG(1, "Free /dev/videoX node not found"); | 3332 | DBG(1, "Free /dev/videoX node not found"); |
3293 | video_nr[dev_nr] = -1; | 3333 | video_nr[dev_nr] = -1; |
3294 | dev_nr = (dev_nr < SN9C102_MAX_DEVICES-1) ? dev_nr+1 : 0; | 3334 | dev_nr = (dev_nr < SN9C102_MAX_DEVICES-1) ? dev_nr+1 : 0; |
3295 | mutex_unlock(&cam->dev_mutex); | 3335 | complete_all(&cam->probe); |
3296 | goto fail; | 3336 | goto fail; |
3297 | } | 3337 | } |
3298 | 3338 | ||
@@ -3318,8 +3358,10 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
3318 | #endif | 3358 | #endif |
3319 | 3359 | ||
3320 | usb_set_intfdata(intf, cam); | 3360 | usb_set_intfdata(intf, cam); |
3361 | kref_init(&cam->kref); | ||
3362 | usb_get_dev(cam->usbdev); | ||
3321 | 3363 | ||
3322 | mutex_unlock(&cam->dev_mutex); | 3364 | complete_all(&cam->probe); |
3323 | 3365 | ||
3324 | return 0; | 3366 | return 0; |
3325 | 3367 | ||
@@ -3336,40 +3378,31 @@ fail: | |||
3336 | 3378 | ||
3337 | static void sn9c102_usb_disconnect(struct usb_interface* intf) | 3379 | static void sn9c102_usb_disconnect(struct usb_interface* intf) |
3338 | { | 3380 | { |
3339 | struct sn9c102_device* cam = usb_get_intfdata(intf); | 3381 | struct sn9c102_device* cam; |
3340 | |||
3341 | if (!cam) | ||
3342 | return; | ||
3343 | 3382 | ||
3344 | down_write(&sn9c102_disconnect); | 3383 | down_write(&sn9c102_dev_lock); |
3345 | 3384 | ||
3346 | mutex_lock(&cam->dev_mutex); | 3385 | cam = usb_get_intfdata(intf); |
3347 | 3386 | ||
3348 | DBG(2, "Disconnecting %s...", cam->v4ldev->name); | 3387 | DBG(2, "Disconnecting %s...", cam->v4ldev->name); |
3349 | 3388 | ||
3350 | wake_up_interruptible_all(&cam->open); | ||
3351 | |||
3352 | if (cam->users) { | 3389 | if (cam->users) { |
3353 | DBG(2, "Device /dev/video%d is open! Deregistration and " | 3390 | DBG(2, "Device /dev/video%d is open! Deregistration and " |
3354 | "memory deallocation are deferred on close.", | 3391 | "memory deallocation are deferred.", |
3355 | cam->v4ldev->minor); | 3392 | cam->v4ldev->minor); |
3356 | cam->state |= DEV_MISCONFIGURED; | 3393 | cam->state |= DEV_MISCONFIGURED; |
3357 | sn9c102_stop_transfer(cam); | 3394 | sn9c102_stop_transfer(cam); |
3358 | cam->state |= DEV_DISCONNECTED; | 3395 | cam->state |= DEV_DISCONNECTED; |
3359 | wake_up_interruptible(&cam->wait_frame); | 3396 | wake_up_interruptible(&cam->wait_frame); |
3360 | wake_up(&cam->wait_stream); | 3397 | wake_up(&cam->wait_stream); |
3361 | usb_get_dev(cam->usbdev); | 3398 | } else |
3362 | } else { | ||
3363 | cam->state |= DEV_DISCONNECTED; | 3399 | cam->state |= DEV_DISCONNECTED; |
3364 | sn9c102_release_resources(cam); | ||
3365 | } | ||
3366 | 3400 | ||
3367 | mutex_unlock(&cam->dev_mutex); | 3401 | wake_up_interruptible_all(&cam->wait_open); |
3368 | 3402 | ||
3369 | if (!cam->users) | 3403 | kref_put(&cam->kref, sn9c102_release_resources); |
3370 | kfree(cam); | ||
3371 | 3404 | ||
3372 | up_write(&sn9c102_disconnect); | 3405 | up_write(&sn9c102_dev_lock); |
3373 | } | 3406 | } |
3374 | 3407 | ||
3375 | 3408 | ||
diff --git a/drivers/media/video/sn9c102/sn9c102_ov7630.c b/drivers/media/video/sn9c102/sn9c102_ov7630.c index e6832347894f..e4856fd77982 100644 --- a/drivers/media/video/sn9c102/sn9c102_ov7630.c +++ b/drivers/media/video/sn9c102/sn9c102_ov7630.c | |||
@@ -104,6 +104,145 @@ static int ov7630_init(struct sn9c102_device* cam) | |||
104 | err += sn9c102_i2c_write(cam, 0x74, 0x21); | 104 | err += sn9c102_i2c_write(cam, 0x74, 0x21); |
105 | err += sn9c102_i2c_write(cam, 0x7d, 0xf7); | 105 | err += sn9c102_i2c_write(cam, 0x7d, 0xf7); |
106 | break; | 106 | break; |
107 | case BRIDGE_SN9C105: | ||
108 | case BRIDGE_SN9C120: | ||
109 | err = sn9c102_write_const_regs(cam, {0x40, 0x02}, {0x00, 0x03}, | ||
110 | {0x1a, 0x04}, {0x03, 0x10}, | ||
111 | {0x0a, 0x14}, {0xe2, 0x17}, | ||
112 | {0x0b, 0x18}, {0x00, 0x19}, | ||
113 | {0x1d, 0x1a}, {0x10, 0x1b}, | ||
114 | {0x02, 0x1c}, {0x03, 0x1d}, | ||
115 | {0x0f, 0x1e}, {0x0c, 0x1f}, | ||
116 | {0x00, 0x20}, {0x24, 0x21}, | ||
117 | {0x3b, 0x22}, {0x47, 0x23}, | ||
118 | {0x60, 0x24}, {0x71, 0x25}, | ||
119 | {0x80, 0x26}, {0x8f, 0x27}, | ||
120 | {0x9d, 0x28}, {0xaa, 0x29}, | ||
121 | {0xb8, 0x2a}, {0xc4, 0x2b}, | ||
122 | {0xd1, 0x2c}, {0xdd, 0x2d}, | ||
123 | {0xe8, 0x2e}, {0xf4, 0x2f}, | ||
124 | {0xff, 0x30}, {0x00, 0x3f}, | ||
125 | {0xc7, 0x40}, {0x01, 0x41}, | ||
126 | {0x44, 0x42}, {0x00, 0x43}, | ||
127 | {0x44, 0x44}, {0x00, 0x45}, | ||
128 | {0x44, 0x46}, {0x00, 0x47}, | ||
129 | {0xc7, 0x48}, {0x01, 0x49}, | ||
130 | {0xc7, 0x4a}, {0x01, 0x4b}, | ||
131 | {0xc7, 0x4c}, {0x01, 0x4d}, | ||
132 | {0x44, 0x4e}, {0x00, 0x4f}, | ||
133 | {0x44, 0x50}, {0x00, 0x51}, | ||
134 | {0x44, 0x52}, {0x00, 0x53}, | ||
135 | {0xc7, 0x54}, {0x01, 0x55}, | ||
136 | {0xc7, 0x56}, {0x01, 0x57}, | ||
137 | {0xc7, 0x58}, {0x01, 0x59}, | ||
138 | {0x44, 0x5a}, {0x00, 0x5b}, | ||
139 | {0x44, 0x5c}, {0x00, 0x5d}, | ||
140 | {0x44, 0x5e}, {0x00, 0x5f}, | ||
141 | {0xc7, 0x60}, {0x01, 0x61}, | ||
142 | {0xc7, 0x62}, {0x01, 0x63}, | ||
143 | {0xc7, 0x64}, {0x01, 0x65}, | ||
144 | {0x44, 0x66}, {0x00, 0x67}, | ||
145 | {0x44, 0x68}, {0x00, 0x69}, | ||
146 | {0x44, 0x6a}, {0x00, 0x6b}, | ||
147 | {0xc7, 0x6c}, {0x01, 0x6d}, | ||
148 | {0xc7, 0x6e}, {0x01, 0x6f}, | ||
149 | {0xc7, 0x70}, {0x01, 0x71}, | ||
150 | {0x44, 0x72}, {0x00, 0x73}, | ||
151 | {0x44, 0x74}, {0x00, 0x75}, | ||
152 | {0x44, 0x76}, {0x00, 0x77}, | ||
153 | {0xc7, 0x78}, {0x01, 0x79}, | ||
154 | {0xc7, 0x7a}, {0x01, 0x7b}, | ||
155 | {0xc7, 0x7c}, {0x01, 0x7d}, | ||
156 | {0x44, 0x7e}, {0x00, 0x7f}, | ||
157 | {0x17, 0x84}, {0x00, 0x85}, | ||
158 | {0x2e, 0x86}, {0x00, 0x87}, | ||
159 | {0x09, 0x88}, {0x00, 0x89}, | ||
160 | {0xe8, 0x8a}, {0x0f, 0x8b}, | ||
161 | {0xda, 0x8c}, {0x0f, 0x8d}, | ||
162 | {0x40, 0x8e}, {0x00, 0x8f}, | ||
163 | {0x37, 0x90}, {0x00, 0x91}, | ||
164 | {0xcf, 0x92}, {0x0f, 0x93}, | ||
165 | {0xfa, 0x94}, {0x0f, 0x95}, | ||
166 | {0x00, 0x96}, {0x00, 0x97}, | ||
167 | {0x00, 0x98}, {0x66, 0x99}, | ||
168 | {0x00, 0x9a}, {0x40, 0x9b}, | ||
169 | {0x20, 0x9c}, {0x00, 0x9d}, | ||
170 | {0x00, 0x9e}, {0x00, 0x9f}, | ||
171 | {0x2d, 0xc0}, {0x2d, 0xc1}, | ||
172 | {0x3a, 0xc2}, {0x00, 0xc3}, | ||
173 | {0x04, 0xc4}, {0x3f, 0xc5}, | ||
174 | {0x00, 0xc6}, {0x00, 0xc7}, | ||
175 | {0x50, 0xc8}, {0x3c, 0xc9}, | ||
176 | {0x28, 0xca}, {0xd8, 0xcb}, | ||
177 | {0x14, 0xcc}, {0xec, 0xcd}, | ||
178 | {0x32, 0xce}, {0xdd, 0xcf}, | ||
179 | {0x32, 0xd0}, {0xdd, 0xd1}, | ||
180 | {0x6a, 0xd2}, {0x50, 0xd3}, | ||
181 | {0x60, 0xd4}, {0x00, 0xd5}, | ||
182 | {0x00, 0xd6}); | ||
183 | |||
184 | err += sn9c102_i2c_write(cam, 0x12, 0x80); | ||
185 | err += sn9c102_i2c_write(cam, 0x12, 0x48); | ||
186 | err += sn9c102_i2c_write(cam, 0x01, 0x80); | ||
187 | err += sn9c102_i2c_write(cam, 0x02, 0x80); | ||
188 | err += sn9c102_i2c_write(cam, 0x03, 0x80); | ||
189 | err += sn9c102_i2c_write(cam, 0x04, 0x10); | ||
190 | err += sn9c102_i2c_write(cam, 0x05, 0x20); | ||
191 | err += sn9c102_i2c_write(cam, 0x06, 0x80); | ||
192 | err += sn9c102_i2c_write(cam, 0x11, 0x00); | ||
193 | err += sn9c102_i2c_write(cam, 0x0c, 0x20); | ||
194 | err += sn9c102_i2c_write(cam, 0x0d, 0x20); | ||
195 | err += sn9c102_i2c_write(cam, 0x15, 0x80); | ||
196 | err += sn9c102_i2c_write(cam, 0x16, 0x03); | ||
197 | err += sn9c102_i2c_write(cam, 0x17, 0x1b); | ||
198 | err += sn9c102_i2c_write(cam, 0x18, 0xbd); | ||
199 | err += sn9c102_i2c_write(cam, 0x19, 0x05); | ||
200 | err += sn9c102_i2c_write(cam, 0x1a, 0xf6); | ||
201 | err += sn9c102_i2c_write(cam, 0x1b, 0x04); | ||
202 | err += sn9c102_i2c_write(cam, 0x21, 0x1b); | ||
203 | err += sn9c102_i2c_write(cam, 0x22, 0x00); | ||
204 | err += sn9c102_i2c_write(cam, 0x23, 0xde); | ||
205 | err += sn9c102_i2c_write(cam, 0x24, 0x10); | ||
206 | err += sn9c102_i2c_write(cam, 0x25, 0x8a); | ||
207 | err += sn9c102_i2c_write(cam, 0x26, 0xa0); | ||
208 | err += sn9c102_i2c_write(cam, 0x27, 0xca); | ||
209 | err += sn9c102_i2c_write(cam, 0x28, 0xa2); | ||
210 | err += sn9c102_i2c_write(cam, 0x29, 0x74); | ||
211 | err += sn9c102_i2c_write(cam, 0x2a, 0x88); | ||
212 | err += sn9c102_i2c_write(cam, 0x2b, 0x34); | ||
213 | err += sn9c102_i2c_write(cam, 0x2c, 0x88); | ||
214 | err += sn9c102_i2c_write(cam, 0x2e, 0x00); | ||
215 | err += sn9c102_i2c_write(cam, 0x2f, 0x00); | ||
216 | err += sn9c102_i2c_write(cam, 0x30, 0x00); | ||
217 | err += sn9c102_i2c_write(cam, 0x32, 0xc2); | ||
218 | err += sn9c102_i2c_write(cam, 0x33, 0x08); | ||
219 | err += sn9c102_i2c_write(cam, 0x4c, 0x40); | ||
220 | err += sn9c102_i2c_write(cam, 0x4d, 0xf3); | ||
221 | err += sn9c102_i2c_write(cam, 0x60, 0x05); | ||
222 | err += sn9c102_i2c_write(cam, 0x61, 0x40); | ||
223 | err += sn9c102_i2c_write(cam, 0x62, 0x12); | ||
224 | err += sn9c102_i2c_write(cam, 0x63, 0x57); | ||
225 | err += sn9c102_i2c_write(cam, 0x64, 0x73); | ||
226 | err += sn9c102_i2c_write(cam, 0x65, 0x00); | ||
227 | err += sn9c102_i2c_write(cam, 0x66, 0x55); | ||
228 | err += sn9c102_i2c_write(cam, 0x67, 0x01); | ||
229 | err += sn9c102_i2c_write(cam, 0x68, 0xac); | ||
230 | err += sn9c102_i2c_write(cam, 0x69, 0x38); | ||
231 | err += sn9c102_i2c_write(cam, 0x6f, 0x1f); | ||
232 | err += sn9c102_i2c_write(cam, 0x70, 0x01); | ||
233 | err += sn9c102_i2c_write(cam, 0x71, 0x00); | ||
234 | err += sn9c102_i2c_write(cam, 0x72, 0x10); | ||
235 | err += sn9c102_i2c_write(cam, 0x73, 0x50); | ||
236 | err += sn9c102_i2c_write(cam, 0x74, 0x20); | ||
237 | err += sn9c102_i2c_write(cam, 0x76, 0x01); | ||
238 | err += sn9c102_i2c_write(cam, 0x77, 0xf3); | ||
239 | err += sn9c102_i2c_write(cam, 0x78, 0x90); | ||
240 | err += sn9c102_i2c_write(cam, 0x79, 0x98); | ||
241 | err += sn9c102_i2c_write(cam, 0x7a, 0x98); | ||
242 | err += sn9c102_i2c_write(cam, 0x7b, 0x00); | ||
243 | err += sn9c102_i2c_write(cam, 0x7c, 0x38); | ||
244 | err += sn9c102_i2c_write(cam, 0x7d, 0xff); | ||
245 | break; | ||
107 | default: | 246 | default: |
108 | break; | 247 | break; |
109 | } | 248 | } |
@@ -115,6 +254,7 @@ static int ov7630_init(struct sn9c102_device* cam) | |||
115 | static int ov7630_get_ctrl(struct sn9c102_device* cam, | 254 | static int ov7630_get_ctrl(struct sn9c102_device* cam, |
116 | struct v4l2_control* ctrl) | 255 | struct v4l2_control* ctrl) |
117 | { | 256 | { |
257 | enum sn9c102_bridge bridge = sn9c102_get_bridge(cam); | ||
118 | int err = 0; | 258 | int err = 0; |
119 | 259 | ||
120 | switch (ctrl->id) { | 260 | switch (ctrl->id) { |
@@ -123,13 +263,20 @@ static int ov7630_get_ctrl(struct sn9c102_device* cam, | |||
123 | return -EIO; | 263 | return -EIO; |
124 | break; | 264 | break; |
125 | case V4L2_CID_RED_BALANCE: | 265 | case V4L2_CID_RED_BALANCE: |
126 | ctrl->value = sn9c102_pread_reg(cam, 0x07); | 266 | if (bridge == BRIDGE_SN9C105 || bridge == BRIDGE_SN9C120) |
267 | ctrl->value = sn9c102_pread_reg(cam, 0x05); | ||
268 | else | ||
269 | ctrl->value = sn9c102_pread_reg(cam, 0x07); | ||
127 | break; | 270 | break; |
128 | case V4L2_CID_BLUE_BALANCE: | 271 | case V4L2_CID_BLUE_BALANCE: |
129 | ctrl->value = sn9c102_pread_reg(cam, 0x06); | 272 | ctrl->value = sn9c102_pread_reg(cam, 0x06); |
130 | break; | 273 | break; |
131 | case SN9C102_V4L2_CID_GREEN_BALANCE: | 274 | case SN9C102_V4L2_CID_GREEN_BALANCE: |
132 | ctrl->value = sn9c102_pread_reg(cam, 0x05); | 275 | if (bridge == BRIDGE_SN9C105 || bridge == BRIDGE_SN9C120) |
276 | ctrl->value = sn9c102_pread_reg(cam, 0x07); | ||
277 | else | ||
278 | ctrl->value = sn9c102_pread_reg(cam, 0x05); | ||
279 | break; | ||
133 | break; | 280 | break; |
134 | case V4L2_CID_GAIN: | 281 | case V4L2_CID_GAIN: |
135 | if ((ctrl->value = sn9c102_i2c_read(cam, 0x00)) < 0) | 282 | if ((ctrl->value = sn9c102_i2c_read(cam, 0x00)) < 0) |
@@ -177,6 +324,7 @@ static int ov7630_get_ctrl(struct sn9c102_device* cam, | |||
177 | static int ov7630_set_ctrl(struct sn9c102_device* cam, | 324 | static int ov7630_set_ctrl(struct sn9c102_device* cam, |
178 | const struct v4l2_control* ctrl) | 325 | const struct v4l2_control* ctrl) |
179 | { | 326 | { |
327 | enum sn9c102_bridge bridge = sn9c102_get_bridge(cam); | ||
180 | int err = 0; | 328 | int err = 0; |
181 | 329 | ||
182 | switch (ctrl->id) { | 330 | switch (ctrl->id) { |
@@ -184,13 +332,19 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam, | |||
184 | err += sn9c102_i2c_write(cam, 0x10, ctrl->value); | 332 | err += sn9c102_i2c_write(cam, 0x10, ctrl->value); |
185 | break; | 333 | break; |
186 | case V4L2_CID_RED_BALANCE: | 334 | case V4L2_CID_RED_BALANCE: |
187 | err += sn9c102_write_reg(cam, ctrl->value, 0x07); | 335 | if (bridge == BRIDGE_SN9C105 || bridge == BRIDGE_SN9C120) |
336 | err += sn9c102_write_reg(cam, ctrl->value, 0x05); | ||
337 | else | ||
338 | err += sn9c102_write_reg(cam, ctrl->value, 0x07); | ||
188 | break; | 339 | break; |
189 | case V4L2_CID_BLUE_BALANCE: | 340 | case V4L2_CID_BLUE_BALANCE: |
190 | err += sn9c102_write_reg(cam, ctrl->value, 0x06); | 341 | err += sn9c102_write_reg(cam, ctrl->value, 0x06); |
191 | break; | 342 | break; |
192 | case SN9C102_V4L2_CID_GREEN_BALANCE: | 343 | case SN9C102_V4L2_CID_GREEN_BALANCE: |
193 | err += sn9c102_write_reg(cam, ctrl->value, 0x05); | 344 | if (bridge == BRIDGE_SN9C105 || bridge == BRIDGE_SN9C120) |
345 | err += sn9c102_write_reg(cam, ctrl->value, 0x07); | ||
346 | else | ||
347 | err += sn9c102_write_reg(cam, ctrl->value, 0x05); | ||
194 | break; | 348 | break; |
195 | case V4L2_CID_GAIN: | 349 | case V4L2_CID_GAIN: |
196 | err += sn9c102_i2c_write(cam, 0x00, ctrl->value); | 350 | err += sn9c102_i2c_write(cam, 0x00, ctrl->value); |
@@ -227,8 +381,21 @@ static int ov7630_set_crop(struct sn9c102_device* cam, | |||
227 | { | 381 | { |
228 | struct sn9c102_sensor* s = sn9c102_get_sensor(cam); | 382 | struct sn9c102_sensor* s = sn9c102_get_sensor(cam); |
229 | int err = 0; | 383 | int err = 0; |
230 | u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 1, | 384 | u8 h_start = 0, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 1; |
231 | v_start = (u8)(rect->top - s->cropcap.bounds.top) + 1; | 385 | |
386 | switch (sn9c102_get_bridge(cam)) { | ||
387 | case BRIDGE_SN9C101: | ||
388 | case BRIDGE_SN9C102: | ||
389 | case BRIDGE_SN9C103: | ||
390 | h_start = (u8)(rect->left - s->cropcap.bounds.left) + 1; | ||
391 | break; | ||
392 | case BRIDGE_SN9C105: | ||
393 | case BRIDGE_SN9C120: | ||
394 | h_start = (u8)(rect->left - s->cropcap.bounds.left) + 4; | ||
395 | break; | ||
396 | default: | ||
397 | break; | ||
398 | } | ||
232 | 399 | ||
233 | err += sn9c102_write_reg(cam, h_start, 0x12); | 400 | err += sn9c102_write_reg(cam, h_start, 0x12); |
234 | err += sn9c102_write_reg(cam, v_start, 0x13); | 401 | err += sn9c102_write_reg(cam, v_start, 0x13); |
@@ -242,10 +409,28 @@ static int ov7630_set_pix_format(struct sn9c102_device* cam, | |||
242 | { | 409 | { |
243 | int err = 0; | 410 | int err = 0; |
244 | 411 | ||
245 | if (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) | 412 | switch (sn9c102_get_bridge(cam)) { |
246 | err += sn9c102_write_reg(cam, 0x20, 0x19); | 413 | case BRIDGE_SN9C101: |
247 | else | 414 | case BRIDGE_SN9C102: |
248 | err += sn9c102_write_reg(cam, 0x50, 0x19); | 415 | case BRIDGE_SN9C103: |
416 | if (pix->pixelformat == V4L2_PIX_FMT_SBGGR8) | ||
417 | err += sn9c102_write_reg(cam, 0x50, 0x19); | ||
418 | else | ||
419 | err += sn9c102_write_reg(cam, 0x20, 0x19); | ||
420 | break; | ||
421 | case BRIDGE_SN9C105: | ||
422 | case BRIDGE_SN9C120: | ||
423 | if (pix->pixelformat == V4L2_PIX_FMT_SBGGR8) { | ||
424 | err += sn9c102_write_reg(cam, 0xe5, 0x17); | ||
425 | err += sn9c102_i2c_write(cam, 0x11, 0x04); | ||
426 | } else { | ||
427 | err += sn9c102_write_reg(cam, 0xe2, 0x17); | ||
428 | err += sn9c102_i2c_write(cam, 0x11, 0x02); | ||
429 | } | ||
430 | break; | ||
431 | default: | ||
432 | break; | ||
433 | } | ||
249 | 434 | ||
250 | return err; | 435 | return err; |
251 | } | 436 | } |
@@ -254,7 +439,8 @@ static int ov7630_set_pix_format(struct sn9c102_device* cam, | |||
254 | static const struct sn9c102_sensor ov7630 = { | 439 | static const struct sn9c102_sensor ov7630 = { |
255 | .name = "OV7630", | 440 | .name = "OV7630", |
256 | .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", | 441 | .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", |
257 | .supported_bridge = BRIDGE_SN9C101 | BRIDGE_SN9C102 | BRIDGE_SN9C103, | 442 | .supported_bridge = BRIDGE_SN9C101 | BRIDGE_SN9C102 | BRIDGE_SN9C103 | |
443 | BRIDGE_SN9C105 | BRIDGE_SN9C120, | ||
258 | .sysfs_ops = SN9C102_I2C_READ | SN9C102_I2C_WRITE, | 444 | .sysfs_ops = SN9C102_I2C_READ | SN9C102_I2C_WRITE, |
259 | .frequency = SN9C102_I2C_100KHZ, | 445 | .frequency = SN9C102_I2C_100KHZ, |
260 | .interface = SN9C102_I2C_2WIRES, | 446 | .interface = SN9C102_I2C_2WIRES, |
@@ -417,6 +603,12 @@ int sn9c102_probe_ov7630(struct sn9c102_device* cam) | |||
417 | err += sn9c102_write_const_regs(cam, {0x01, 0x01}, | 603 | err += sn9c102_write_const_regs(cam, {0x01, 0x01}, |
418 | {0x00, 0x01}); | 604 | {0x00, 0x01}); |
419 | break; | 605 | break; |
606 | case BRIDGE_SN9C105: | ||
607 | case BRIDGE_SN9C120: | ||
608 | err = sn9c102_write_const_regs(cam, {0x01, 0xf1}, {0x00, 0xf1}, | ||
609 | {0x29, 0x01}, {0x74, 0x02}, | ||
610 | {0x0e, 0x01}, {0x44, 0x01}); | ||
611 | break; | ||
420 | default: | 612 | default: |
421 | break; | 613 | break; |
422 | } | 614 | } |
diff --git a/drivers/media/video/sn9c102/sn9c102_ov7660.c b/drivers/media/video/sn9c102/sn9c102_ov7660.c index 4b6474048a72..8aae416ba8ec 100644 --- a/drivers/media/video/sn9c102/sn9c102_ov7660.c +++ b/drivers/media/video/sn9c102/sn9c102_ov7660.c | |||
@@ -41,65 +41,65 @@ static int ov7660_init(struct sn9c102_device* cam) | |||
41 | {0xbb, 0x2a}, {0xc7, 0x2b}, | 41 | {0xbb, 0x2a}, {0xc7, 0x2b}, |
42 | {0xd3, 0x2c}, {0xde, 0x2d}, | 42 | {0xd3, 0x2c}, {0xde, 0x2d}, |
43 | {0xea, 0x2e}, {0xf4, 0x2f}, | 43 | {0xea, 0x2e}, {0xf4, 0x2f}, |
44 | {0xff, 0x30}, {0x00, 0x3F}, | 44 | {0xff, 0x30}, {0x00, 0x3f}, |
45 | {0xC7, 0x40}, {0x01, 0x41}, | 45 | {0xc7, 0x40}, {0x01, 0x41}, |
46 | {0x44, 0x42}, {0x00, 0x43}, | 46 | {0x44, 0x42}, {0x00, 0x43}, |
47 | {0x44, 0x44}, {0x00, 0x45}, | 47 | {0x44, 0x44}, {0x00, 0x45}, |
48 | {0x44, 0x46}, {0x00, 0x47}, | 48 | {0x44, 0x46}, {0x00, 0x47}, |
49 | {0xC7, 0x48}, {0x01, 0x49}, | 49 | {0xc7, 0x48}, {0x01, 0x49}, |
50 | {0xC7, 0x4A}, {0x01, 0x4B}, | 50 | {0xc7, 0x4a}, {0x01, 0x4b}, |
51 | {0xC7, 0x4C}, {0x01, 0x4D}, | 51 | {0xc7, 0x4c}, {0x01, 0x4d}, |
52 | {0x44, 0x4E}, {0x00, 0x4F}, | 52 | {0x44, 0x4e}, {0x00, 0x4f}, |
53 | {0x44, 0x50}, {0x00, 0x51}, | 53 | {0x44, 0x50}, {0x00, 0x51}, |
54 | {0x44, 0x52}, {0x00, 0x53}, | 54 | {0x44, 0x52}, {0x00, 0x53}, |
55 | {0xC7, 0x54}, {0x01, 0x55}, | 55 | {0xc7, 0x54}, {0x01, 0x55}, |
56 | {0xC7, 0x56}, {0x01, 0x57}, | 56 | {0xc7, 0x56}, {0x01, 0x57}, |
57 | {0xC7, 0x58}, {0x01, 0x59}, | 57 | {0xc7, 0x58}, {0x01, 0x59}, |
58 | {0x44, 0x5A}, {0x00, 0x5B}, | 58 | {0x44, 0x5a}, {0x00, 0x5b}, |
59 | {0x44, 0x5C}, {0x00, 0x5D}, | 59 | {0x44, 0x5c}, {0x00, 0x5d}, |
60 | {0x44, 0x5E}, {0x00, 0x5F}, | 60 | {0x44, 0x5e}, {0x00, 0x5f}, |
61 | {0xC7, 0x60}, {0x01, 0x61}, | 61 | {0xc7, 0x60}, {0x01, 0x61}, |
62 | {0xC7, 0x62}, {0x01, 0x63}, | 62 | {0xc7, 0x62}, {0x01, 0x63}, |
63 | {0xC7, 0x64}, {0x01, 0x65}, | 63 | {0xc7, 0x64}, {0x01, 0x65}, |
64 | {0x44, 0x66}, {0x00, 0x67}, | 64 | {0x44, 0x66}, {0x00, 0x67}, |
65 | {0x44, 0x68}, {0x00, 0x69}, | 65 | {0x44, 0x68}, {0x00, 0x69}, |
66 | {0x44, 0x6A}, {0x00, 0x6B}, | 66 | {0x44, 0x6a}, {0x00, 0x6b}, |
67 | {0xC7, 0x6C}, {0x01, 0x6D}, | 67 | {0xc7, 0x6c}, {0x01, 0x6d}, |
68 | {0xC7, 0x6E}, {0x01, 0x6F}, | 68 | {0xc7, 0x6e}, {0x01, 0x6f}, |
69 | {0xC7, 0x70}, {0x01, 0x71}, | 69 | {0xc7, 0x70}, {0x01, 0x71}, |
70 | {0x44, 0x72}, {0x00, 0x73}, | 70 | {0x44, 0x72}, {0x00, 0x73}, |
71 | {0x44, 0x74}, {0x00, 0x75}, | 71 | {0x44, 0x74}, {0x00, 0x75}, |
72 | {0x44, 0x76}, {0x00, 0x77}, | 72 | {0x44, 0x76}, {0x00, 0x77}, |
73 | {0xC7, 0x78}, {0x01, 0x79}, | 73 | {0xc7, 0x78}, {0x01, 0x79}, |
74 | {0xC7, 0x7A}, {0x01, 0x7B}, | 74 | {0xc7, 0x7a}, {0x01, 0x7b}, |
75 | {0xC7, 0x7C}, {0x01, 0x7D}, | 75 | {0xc7, 0x7c}, {0x01, 0x7d}, |
76 | {0x44, 0x7E}, {0x00, 0x7F}, | 76 | {0x44, 0x7e}, {0x00, 0x7f}, |
77 | {0x14, 0x84}, {0x00, 0x85}, | 77 | {0x14, 0x84}, {0x00, 0x85}, |
78 | {0x27, 0x86}, {0x00, 0x87}, | 78 | {0x27, 0x86}, {0x00, 0x87}, |
79 | {0x07, 0x88}, {0x00, 0x89}, | 79 | {0x07, 0x88}, {0x00, 0x89}, |
80 | {0xEC, 0x8A}, {0x0f, 0x8B}, | 80 | {0xec, 0x8a}, {0x0f, 0x8b}, |
81 | {0xD8, 0x8C}, {0x0f, 0x8D}, | 81 | {0xd8, 0x8c}, {0x0f, 0x8d}, |
82 | {0x3D, 0x8E}, {0x00, 0x8F}, | 82 | {0x3d, 0x8e}, {0x00, 0x8f}, |
83 | {0x3D, 0x90}, {0x00, 0x91}, | 83 | {0x3d, 0x90}, {0x00, 0x91}, |
84 | {0xCD, 0x92}, {0x0f, 0x93}, | 84 | {0xcd, 0x92}, {0x0f, 0x93}, |
85 | {0xf7, 0x94}, {0x0f, 0x95}, | 85 | {0xf7, 0x94}, {0x0f, 0x95}, |
86 | {0x0C, 0x96}, {0x00, 0x97}, | 86 | {0x0c, 0x96}, {0x00, 0x97}, |
87 | {0x00, 0x98}, {0x66, 0x99}, | 87 | {0x00, 0x98}, {0x66, 0x99}, |
88 | {0x05, 0x9A}, {0x00, 0x9B}, | 88 | {0x05, 0x9a}, {0x00, 0x9b}, |
89 | {0x04, 0x9C}, {0x00, 0x9D}, | 89 | {0x04, 0x9c}, {0x00, 0x9d}, |
90 | {0x08, 0x9E}, {0x00, 0x9F}, | 90 | {0x08, 0x9e}, {0x00, 0x9f}, |
91 | {0x2D, 0xC0}, {0x2D, 0xC1}, | 91 | {0x2d, 0xc0}, {0x2d, 0xc1}, |
92 | {0x3A, 0xC2}, {0x05, 0xC3}, | 92 | {0x3a, 0xc2}, {0x05, 0xc3}, |
93 | {0x04, 0xC4}, {0x3F, 0xC5}, | 93 | {0x04, 0xc4}, {0x3f, 0xc5}, |
94 | {0x00, 0xC6}, {0x00, 0xC7}, | 94 | {0x00, 0xc6}, {0x00, 0xc7}, |
95 | {0x50, 0xC8}, {0x3C, 0xC9}, | 95 | {0x50, 0xc8}, {0x3C, 0xc9}, |
96 | {0x28, 0xCA}, {0xD8, 0xCB}, | 96 | {0x28, 0xca}, {0xd8, 0xcb}, |
97 | {0x14, 0xCC}, {0xEC, 0xCD}, | 97 | {0x14, 0xcc}, {0xec, 0xcd}, |
98 | {0x32, 0xCE}, {0xDD, 0xCF}, | 98 | {0x32, 0xce}, {0xdd, 0xcf}, |
99 | {0x32, 0xD0}, {0xDD, 0xD1}, | 99 | {0x32, 0xd0}, {0xdd, 0xd1}, |
100 | {0x6A, 0xD2}, {0x50, 0xD3}, | 100 | {0x6a, 0xd2}, {0x50, 0xd3}, |
101 | {0x00, 0xD4}, {0x00, 0xD5}, | 101 | {0x00, 0xd4}, {0x00, 0xd5}, |
102 | {0x00, 0xD6}); | 102 | {0x00, 0xd6}); |
103 | 103 | ||
104 | err += sn9c102_i2c_write(cam, 0x12, 0x80); | 104 | err += sn9c102_i2c_write(cam, 0x12, 0x80); |
105 | err += sn9c102_i2c_write(cam, 0x11, 0x09); | 105 | err += sn9c102_i2c_write(cam, 0x11, 0x09); |
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c index 3e736be5de84..eb220461ac77 100644 --- a/drivers/media/video/stradis.c +++ b/drivers/media/video/stradis.c | |||
@@ -1321,7 +1321,7 @@ static int saa_ioctl(struct inode *inode, struct file *file, | |||
1321 | u32 format; | 1321 | u32 format; |
1322 | if (copy_from_user(&p, arg, sizeof(p))) | 1322 | if (copy_from_user(&p, arg, sizeof(p))) |
1323 | return -EFAULT; | 1323 | return -EFAULT; |
1324 | if (p.palette < sizeof(palette2fmt) / sizeof(u32)) { | 1324 | if (p.palette < ARRAY_SIZE(palette2fmt)) { |
1325 | format = palette2fmt[p.palette]; | 1325 | format = palette2fmt[p.palette]; |
1326 | saa->win.color_fmt = format; | 1326 | saa->win.color_fmt = format; |
1327 | saawrite(format | 0x60, | 1327 | saawrite(format | 0x60, |
diff --git a/drivers/media/video/stv680.c b/drivers/media/video/stv680.c index bf3aa8d2d57e..4dc5bc714b95 100644 --- a/drivers/media/video/stv680.c +++ b/drivers/media/video/stv680.c | |||
@@ -715,8 +715,11 @@ static int stv680_start_stream (struct usb_stv *stv680) | |||
715 | stv680_video_irq, stv680); | 715 | stv680_video_irq, stv680); |
716 | stv680->urb[i] = urb; | 716 | stv680->urb[i] = urb; |
717 | err = usb_submit_urb (stv680->urb[i], GFP_KERNEL); | 717 | err = usb_submit_urb (stv680->urb[i], GFP_KERNEL); |
718 | if (err) | 718 | if (err) { |
719 | PDEBUG (0, "STV(e): urb burned down in start stream"); | 719 | PDEBUG (0, "STV(e): urb burned down with err " |
720 | "%d in start stream %d", err, i); | ||
721 | goto nomem_err; | ||
722 | } | ||
720 | } /* i STV680_NUMSBUF */ | 723 | } /* i STV680_NUMSBUF */ |
721 | 724 | ||
722 | stv680->framecount = 0; | 725 | stv680->framecount = 0; |
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index 1a1bef0e9c3d..59cff5a3c59e 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c | |||
@@ -21,7 +21,17 @@ | |||
21 | #include <linux/i2c.h> | 21 | #include <linux/i2c.h> |
22 | #include <linux/videodev.h> | 22 | #include <linux/videodev.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <media/tuner.h> | 24 | #include "tuner-driver.h" |
25 | |||
26 | /* ---------------------------------------------------------------------- */ | ||
27 | |||
28 | struct tda8290_priv { | ||
29 | unsigned char tda8290_easy_mode; | ||
30 | unsigned char tda827x_lpsel; | ||
31 | unsigned char tda827x_addr; | ||
32 | unsigned char tda827x_ver; | ||
33 | unsigned int sgIF; | ||
34 | }; | ||
25 | 35 | ||
26 | /* ---------------------------------------------------------------------- */ | 36 | /* ---------------------------------------------------------------------- */ |
27 | 37 | ||
@@ -76,7 +86,8 @@ static void tda827x_tune(struct i2c_client *c, u16 ifc, unsigned int freq) | |||
76 | u32 N; | 86 | u32 N; |
77 | int i; | 87 | int i; |
78 | struct tuner *t = i2c_get_clientdata(c); | 88 | struct tuner *t = i2c_get_clientdata(c); |
79 | struct i2c_msg msg = {.addr = t->tda827x_addr, .flags = 0}; | 89 | struct tda8290_priv *priv = t->priv; |
90 | struct i2c_msg msg = {.addr = priv->tda827x_addr, .flags = 0}; | ||
80 | 91 | ||
81 | if (t->mode == V4L2_TUNER_RADIO) | 92 | if (t->mode == V4L2_TUNER_RADIO) |
82 | freq = freq / 1000; | 93 | freq = freq / 1000; |
@@ -95,7 +106,7 @@ static void tda827x_tune(struct i2c_client *c, u16 ifc, unsigned int freq) | |||
95 | tuner_reg[1] = (unsigned char)(N>>8); | 106 | tuner_reg[1] = (unsigned char)(N>>8); |
96 | tuner_reg[2] = (unsigned char) N; | 107 | tuner_reg[2] = (unsigned char) N; |
97 | tuner_reg[3] = 0x40; | 108 | tuner_reg[3] = 0x40; |
98 | tuner_reg[4] = 0x52 + (t->tda827x_lpsel << 5); | 109 | tuner_reg[4] = 0x52 + (priv->tda827x_lpsel << 5); |
99 | tuner_reg[5] = (tda827x_analog[i].spd << 6) + (tda827x_analog[i].div1p5 <<5) + | 110 | tuner_reg[5] = (tda827x_analog[i].spd << 6) + (tda827x_analog[i].div1p5 <<5) + |
100 | (tda827x_analog[i].bs <<3) + tda827x_analog[i].bp; | 111 | (tda827x_analog[i].bs <<3) + tda827x_analog[i].bp; |
101 | tuner_reg[6] = 0x8f + (tda827x_analog[i].gc3 << 4); | 112 | tuner_reg[6] = 0x8f + (tda827x_analog[i].gc3 << 4); |
@@ -146,8 +157,9 @@ static void tda827x_tune(struct i2c_client *c, u16 ifc, unsigned int freq) | |||
146 | static void tda827x_agcf(struct i2c_client *c) | 157 | static void tda827x_agcf(struct i2c_client *c) |
147 | { | 158 | { |
148 | struct tuner *t = i2c_get_clientdata(c); | 159 | struct tuner *t = i2c_get_clientdata(c); |
160 | struct tda8290_priv *priv = t->priv; | ||
149 | unsigned char data[] = {0x80, 0x0c}; | 161 | unsigned char data[] = {0x80, 0x0c}; |
150 | struct i2c_msg msg = {.addr = t->tda827x_addr, .buf = data, | 162 | struct i2c_msg msg = {.addr = priv->tda827x_addr, .buf = data, |
151 | .flags = 0, .len = 2}; | 163 | .flags = 0, .len = 2}; |
152 | i2c_transfer(c->adapter, &msg, 1); | 164 | i2c_transfer(c->adapter, &msg, 1); |
153 | } | 165 | } |
@@ -234,7 +246,8 @@ static void tda827xa_tune(struct i2c_client *c, u16 ifc, unsigned int freq) | |||
234 | u32 N; | 246 | u32 N; |
235 | int i; | 247 | int i; |
236 | struct tuner *t = i2c_get_clientdata(c); | 248 | struct tuner *t = i2c_get_clientdata(c); |
237 | struct i2c_msg msg = {.addr = t->tda827x_addr, .flags = 0, .buf = tuner_reg}; | 249 | struct tda8290_priv *priv = t->priv; |
250 | struct i2c_msg msg = {.addr = priv->tda827x_addr, .flags = 0, .buf = tuner_reg}; | ||
238 | 251 | ||
239 | tda827xa_lna_gain( c, 1); | 252 | tda827xa_lna_gain( c, 1); |
240 | msleep(10); | 253 | msleep(10); |
@@ -271,7 +284,7 @@ static void tda827xa_tune(struct i2c_client *c, u16 ifc, unsigned int freq) | |||
271 | tuner_reg[1] = 0xff; | 284 | tuner_reg[1] = 0xff; |
272 | tuner_reg[2] = 0xe0; | 285 | tuner_reg[2] = 0xe0; |
273 | tuner_reg[3] = 0; | 286 | tuner_reg[3] = 0; |
274 | tuner_reg[4] = 0x99 + (t->tda827x_lpsel << 1); | 287 | tuner_reg[4] = 0x99 + (priv->tda827x_lpsel << 1); |
275 | msg.len = 5; | 288 | msg.len = 5; |
276 | i2c_transfer(c->adapter, &msg, 1); | 289 | i2c_transfer(c->adapter, &msg, 1); |
277 | 290 | ||
@@ -311,15 +324,16 @@ static void tda827xa_tune(struct i2c_client *c, u16 ifc, unsigned int freq) | |||
311 | i2c_transfer(c->adapter, &msg, 1); | 324 | i2c_transfer(c->adapter, &msg, 1); |
312 | 325 | ||
313 | tuner_reg[0] = 0xc0; | 326 | tuner_reg[0] = 0xc0; |
314 | tuner_reg[1] = 0x19 + (t->tda827x_lpsel << 1); | 327 | tuner_reg[1] = 0x19 + (priv->tda827x_lpsel << 1); |
315 | i2c_transfer(c->adapter, &msg, 1); | 328 | i2c_transfer(c->adapter, &msg, 1); |
316 | } | 329 | } |
317 | 330 | ||
318 | static void tda827xa_agcf(struct i2c_client *c) | 331 | static void tda827xa_agcf(struct i2c_client *c) |
319 | { | 332 | { |
320 | struct tuner *t = i2c_get_clientdata(c); | 333 | struct tuner *t = i2c_get_clientdata(c); |
334 | struct tda8290_priv *priv = t->priv; | ||
321 | unsigned char data[] = {0x80, 0x2c}; | 335 | unsigned char data[] = {0x80, 0x2c}; |
322 | struct i2c_msg msg = {.addr = t->tda827x_addr, .buf = data, | 336 | struct i2c_msg msg = {.addr = priv->tda827x_addr, .buf = data, |
323 | .flags = 0, .len = 2}; | 337 | .flags = 0, .len = 2}; |
324 | i2c_transfer(c->adapter, &msg, 1); | 338 | i2c_transfer(c->adapter, &msg, 1); |
325 | } | 339 | } |
@@ -347,8 +361,9 @@ static void tda8290_i2c_bridge(struct i2c_client *c, int close) | |||
347 | static int tda8290_tune(struct i2c_client *c, u16 ifc, unsigned int freq) | 361 | static int tda8290_tune(struct i2c_client *c, u16 ifc, unsigned int freq) |
348 | { | 362 | { |
349 | struct tuner *t = i2c_get_clientdata(c); | 363 | struct tuner *t = i2c_get_clientdata(c); |
364 | struct tda8290_priv *priv = t->priv; | ||
350 | unsigned char soft_reset[] = { 0x00, 0x00 }; | 365 | unsigned char soft_reset[] = { 0x00, 0x00 }; |
351 | unsigned char easy_mode[] = { 0x01, t->tda8290_easy_mode }; | 366 | unsigned char easy_mode[] = { 0x01, priv->tda8290_easy_mode }; |
352 | unsigned char expert_mode[] = { 0x01, 0x80 }; | 367 | unsigned char expert_mode[] = { 0x01, 0x80 }; |
353 | unsigned char agc_out_on[] = { 0x02, 0x00 }; | 368 | unsigned char agc_out_on[] = { 0x02, 0x00 }; |
354 | unsigned char gainset_off[] = { 0x28, 0x14 }; | 369 | unsigned char gainset_off[] = { 0x28, 0x14 }; |
@@ -375,18 +390,18 @@ static int tda8290_tune(struct i2c_client *c, u16 ifc, unsigned int freq) | |||
375 | i2c_master_send(c, soft_reset, 2); | 390 | i2c_master_send(c, soft_reset, 2); |
376 | msleep(1); | 391 | msleep(1); |
377 | 392 | ||
378 | expert_mode[1] = t->tda8290_easy_mode + 0x80; | 393 | expert_mode[1] = priv->tda8290_easy_mode + 0x80; |
379 | i2c_master_send(c, expert_mode, 2); | 394 | i2c_master_send(c, expert_mode, 2); |
380 | i2c_master_send(c, gainset_off, 2); | 395 | i2c_master_send(c, gainset_off, 2); |
381 | i2c_master_send(c, if_agc_spd, 2); | 396 | i2c_master_send(c, if_agc_spd, 2); |
382 | if (t->tda8290_easy_mode & 0x60) | 397 | if (priv->tda8290_easy_mode & 0x60) |
383 | i2c_master_send(c, adc_head_9, 2); | 398 | i2c_master_send(c, adc_head_9, 2); |
384 | else | 399 | else |
385 | i2c_master_send(c, adc_head_6, 2); | 400 | i2c_master_send(c, adc_head_6, 2); |
386 | i2c_master_send(c, pll_bw_nom, 2); | 401 | i2c_master_send(c, pll_bw_nom, 2); |
387 | 402 | ||
388 | tda8290_i2c_bridge(c, 1); | 403 | tda8290_i2c_bridge(c, 1); |
389 | if (t->tda827x_ver != 0) | 404 | if (priv->tda827x_ver != 0) |
390 | tda827xa_tune(c, ifc, freq); | 405 | tda827xa_tune(c, ifc, freq); |
391 | else | 406 | else |
392 | tda827x_tune(c, ifc, freq); | 407 | tda827x_tune(c, ifc, freq); |
@@ -418,7 +433,7 @@ static int tda8290_tune(struct i2c_client *c, u16 ifc, unsigned int freq) | |||
418 | if ((agc_stat > 115) || !(pll_stat & 0x80)) { | 433 | if ((agc_stat > 115) || !(pll_stat & 0x80)) { |
419 | tuner_dbg("adjust gain, step 2. Agc: %d, lock: %d\n", | 434 | tuner_dbg("adjust gain, step 2. Agc: %d, lock: %d\n", |
420 | agc_stat, pll_stat & 0x80); | 435 | agc_stat, pll_stat & 0x80); |
421 | if (t->tda827x_ver != 0) | 436 | if (priv->tda827x_ver != 0) |
422 | tda827xa_agcf(c); | 437 | tda827xa_agcf(c); |
423 | else | 438 | else |
424 | tda827x_agcf(c); | 439 | tda827x_agcf(c); |
@@ -437,7 +452,7 @@ static int tda8290_tune(struct i2c_client *c, u16 ifc, unsigned int freq) | |||
437 | } | 452 | } |
438 | 453 | ||
439 | /* l/ l' deadlock? */ | 454 | /* l/ l' deadlock? */ |
440 | if(t->tda8290_easy_mode & 0x60) { | 455 | if(priv->tda8290_easy_mode & 0x60) { |
441 | i2c_master_send(c, &addr_adc_sat, 1); | 456 | i2c_master_send(c, &addr_adc_sat, 1); |
442 | i2c_master_recv(c, &adc_sat, 1); | 457 | i2c_master_recv(c, &adc_sat, 1); |
443 | i2c_master_send(c, &addr_pll_stat, 1); | 458 | i2c_master_send(c, &addr_pll_stat, 1); |
@@ -459,41 +474,42 @@ static int tda8290_tune(struct i2c_client *c, u16 ifc, unsigned int freq) | |||
459 | 474 | ||
460 | static void set_audio(struct tuner *t) | 475 | static void set_audio(struct tuner *t) |
461 | { | 476 | { |
477 | struct tda8290_priv *priv = t->priv; | ||
462 | char* mode; | 478 | char* mode; |
463 | 479 | ||
464 | t->tda827x_lpsel = 0; | 480 | priv->tda827x_lpsel = 0; |
465 | if (t->std & V4L2_STD_MN) { | 481 | if (t->std & V4L2_STD_MN) { |
466 | t->sgIF = 92; | 482 | priv->sgIF = 92; |
467 | t->tda8290_easy_mode = 0x01; | 483 | priv->tda8290_easy_mode = 0x01; |
468 | t->tda827x_lpsel = 1; | 484 | priv->tda827x_lpsel = 1; |
469 | mode = "MN"; | 485 | mode = "MN"; |
470 | } else if (t->std & V4L2_STD_B) { | 486 | } else if (t->std & V4L2_STD_B) { |
471 | t->sgIF = 108; | 487 | priv->sgIF = 108; |
472 | t->tda8290_easy_mode = 0x02; | 488 | priv->tda8290_easy_mode = 0x02; |
473 | mode = "B"; | 489 | mode = "B"; |
474 | } else if (t->std & V4L2_STD_GH) { | 490 | } else if (t->std & V4L2_STD_GH) { |
475 | t->sgIF = 124; | 491 | priv->sgIF = 124; |
476 | t->tda8290_easy_mode = 0x04; | 492 | priv->tda8290_easy_mode = 0x04; |
477 | mode = "GH"; | 493 | mode = "GH"; |
478 | } else if (t->std & V4L2_STD_PAL_I) { | 494 | } else if (t->std & V4L2_STD_PAL_I) { |
479 | t->sgIF = 124; | 495 | priv->sgIF = 124; |
480 | t->tda8290_easy_mode = 0x08; | 496 | priv->tda8290_easy_mode = 0x08; |
481 | mode = "I"; | 497 | mode = "I"; |
482 | } else if (t->std & V4L2_STD_DK) { | 498 | } else if (t->std & V4L2_STD_DK) { |
483 | t->sgIF = 124; | 499 | priv->sgIF = 124; |
484 | t->tda8290_easy_mode = 0x10; | 500 | priv->tda8290_easy_mode = 0x10; |
485 | mode = "DK"; | 501 | mode = "DK"; |
486 | } else if (t->std & V4L2_STD_SECAM_L) { | 502 | } else if (t->std & V4L2_STD_SECAM_L) { |
487 | t->sgIF = 124; | 503 | priv->sgIF = 124; |
488 | t->tda8290_easy_mode = 0x20; | 504 | priv->tda8290_easy_mode = 0x20; |
489 | mode = "L"; | 505 | mode = "L"; |
490 | } else if (t->std & V4L2_STD_SECAM_LC) { | 506 | } else if (t->std & V4L2_STD_SECAM_LC) { |
491 | t->sgIF = 20; | 507 | priv->sgIF = 20; |
492 | t->tda8290_easy_mode = 0x40; | 508 | priv->tda8290_easy_mode = 0x40; |
493 | mode = "LC"; | 509 | mode = "LC"; |
494 | } else { | 510 | } else { |
495 | t->sgIF = 124; | 511 | priv->sgIF = 124; |
496 | t->tda8290_easy_mode = 0x10; | 512 | priv->tda8290_easy_mode = 0x10; |
497 | mode = "xx"; | 513 | mode = "xx"; |
498 | } | 514 | } |
499 | tuner_dbg("setting tda8290 to system %s\n", mode); | 515 | tuner_dbg("setting tda8290 to system %s\n", mode); |
@@ -502,9 +518,10 @@ static void set_audio(struct tuner *t) | |||
502 | static void set_tv_freq(struct i2c_client *c, unsigned int freq) | 518 | static void set_tv_freq(struct i2c_client *c, unsigned int freq) |
503 | { | 519 | { |
504 | struct tuner *t = i2c_get_clientdata(c); | 520 | struct tuner *t = i2c_get_clientdata(c); |
521 | struct tda8290_priv *priv = t->priv; | ||
505 | 522 | ||
506 | set_audio(t); | 523 | set_audio(t); |
507 | tda8290_tune(c, t->sgIF, freq); | 524 | tda8290_tune(c, priv->sgIF, freq); |
508 | } | 525 | } |
509 | 526 | ||
510 | static void set_radio_freq(struct i2c_client *c, unsigned int freq) | 527 | static void set_radio_freq(struct i2c_client *c, unsigned int freq) |
@@ -528,13 +545,14 @@ static int has_signal(struct i2c_client *c) | |||
528 | static void standby(struct i2c_client *c) | 545 | static void standby(struct i2c_client *c) |
529 | { | 546 | { |
530 | struct tuner *t = i2c_get_clientdata(c); | 547 | struct tuner *t = i2c_get_clientdata(c); |
548 | struct tda8290_priv *priv = t->priv; | ||
531 | unsigned char cb1[] = { 0x30, 0xD0 }; | 549 | unsigned char cb1[] = { 0x30, 0xD0 }; |
532 | unsigned char tda8290_standby[] = { 0x00, 0x02 }; | 550 | unsigned char tda8290_standby[] = { 0x00, 0x02 }; |
533 | unsigned char tda8290_agc_tri[] = { 0x02, 0x20 }; | 551 | unsigned char tda8290_agc_tri[] = { 0x02, 0x20 }; |
534 | struct i2c_msg msg = {.addr = t->tda827x_addr, .flags=0, .buf=cb1, .len = 2}; | 552 | struct i2c_msg msg = {.addr = priv->tda827x_addr, .flags=0, .buf=cb1, .len = 2}; |
535 | 553 | ||
536 | tda8290_i2c_bridge(c, 1); | 554 | tda8290_i2c_bridge(c, 1); |
537 | if (t->tda827x_ver != 0) | 555 | if (priv->tda827x_ver != 0) |
538 | cb1[1] = 0x90; | 556 | cb1[1] = 0x90; |
539 | i2c_transfer(c->adapter, &msg, 1); | 557 | i2c_transfer(c->adapter, &msg, 1); |
540 | tda8290_i2c_bridge(c, 0); | 558 | tda8290_i2c_bridge(c, 0); |
@@ -560,13 +578,14 @@ static void tda8290_init_if(struct i2c_client *c) | |||
560 | static void tda8290_init_tuner(struct i2c_client *c) | 578 | static void tda8290_init_tuner(struct i2c_client *c) |
561 | { | 579 | { |
562 | struct tuner *t = i2c_get_clientdata(c); | 580 | struct tuner *t = i2c_get_clientdata(c); |
581 | struct tda8290_priv *priv = t->priv; | ||
563 | unsigned char tda8275_init[] = { 0x00, 0x00, 0x00, 0x40, 0xdC, 0x04, 0xAf, | 582 | unsigned char tda8275_init[] = { 0x00, 0x00, 0x00, 0x40, 0xdC, 0x04, 0xAf, |
564 | 0x3F, 0x2A, 0x04, 0xFF, 0x00, 0x00, 0x40 }; | 583 | 0x3F, 0x2A, 0x04, 0xFF, 0x00, 0x00, 0x40 }; |
565 | unsigned char tda8275a_init[] = { 0x00, 0x00, 0x00, 0x00, 0xdC, 0x05, 0x8b, | 584 | unsigned char tda8275a_init[] = { 0x00, 0x00, 0x00, 0x00, 0xdC, 0x05, 0x8b, |
566 | 0x0c, 0x04, 0x20, 0xFF, 0x00, 0x00, 0x4b }; | 585 | 0x0c, 0x04, 0x20, 0xFF, 0x00, 0x00, 0x4b }; |
567 | struct i2c_msg msg = {.addr = t->tda827x_addr, .flags=0, | 586 | struct i2c_msg msg = {.addr = priv->tda827x_addr, .flags=0, |
568 | .buf=tda8275_init, .len = 14}; | 587 | .buf=tda8275_init, .len = 14}; |
569 | if (t->tda827x_ver != 0) | 588 | if (priv->tda827x_ver != 0) |
570 | msg.buf = tda8275a_init; | 589 | msg.buf = tda8275a_init; |
571 | 590 | ||
572 | tda8290_i2c_bridge(c, 1); | 591 | tda8290_i2c_bridge(c, 1); |
@@ -576,14 +595,36 @@ static void tda8290_init_tuner(struct i2c_client *c) | |||
576 | 595 | ||
577 | /*---------------------------------------------------------------------*/ | 596 | /*---------------------------------------------------------------------*/ |
578 | 597 | ||
598 | static void tda8290_release(struct i2c_client *c) | ||
599 | { | ||
600 | struct tuner *t = i2c_get_clientdata(c); | ||
601 | |||
602 | kfree(t->priv); | ||
603 | t->priv = NULL; | ||
604 | } | ||
605 | |||
606 | static struct tuner_operations tda8290_tuner_ops = { | ||
607 | .set_tv_freq = set_tv_freq, | ||
608 | .set_radio_freq = set_radio_freq, | ||
609 | .has_signal = has_signal, | ||
610 | .standby = standby, | ||
611 | .release = tda8290_release, | ||
612 | }; | ||
613 | |||
579 | int tda8290_init(struct i2c_client *c) | 614 | int tda8290_init(struct i2c_client *c) |
580 | { | 615 | { |
616 | struct tda8290_priv *priv = NULL; | ||
581 | struct tuner *t = i2c_get_clientdata(c); | 617 | struct tuner *t = i2c_get_clientdata(c); |
582 | u8 data; | 618 | u8 data; |
583 | int i, ret, tuners_found; | 619 | int i, ret, tuners_found; |
584 | u32 tuner_addrs; | 620 | u32 tuner_addrs; |
585 | struct i2c_msg msg = {.flags=I2C_M_RD, .buf=&data, .len = 1}; | 621 | struct i2c_msg msg = {.flags=I2C_M_RD, .buf=&data, .len = 1}; |
586 | 622 | ||
623 | priv = kzalloc(sizeof(struct tda8290_priv), GFP_KERNEL); | ||
624 | if (priv == NULL) | ||
625 | return -ENOMEM; | ||
626 | t->priv = priv; | ||
627 | |||
587 | tda8290_i2c_bridge(c, 1); | 628 | tda8290_i2c_bridge(c, 1); |
588 | /* probe for tuner chip */ | 629 | /* probe for tuner chip */ |
589 | tuners_found = 0; | 630 | tuners_found = 0; |
@@ -618,7 +659,7 @@ int tda8290_init(struct i2c_client *c) | |||
618 | tuner_addrs = tuner_addrs & 0xff; | 659 | tuner_addrs = tuner_addrs & 0xff; |
619 | tuner_info ("setting tuner address to %x\n", tuner_addrs); | 660 | tuner_info ("setting tuner address to %x\n", tuner_addrs); |
620 | } | 661 | } |
621 | t->tda827x_addr = tuner_addrs; | 662 | priv->tda827x_addr = tuner_addrs; |
622 | msg.addr = tuner_addrs; | 663 | msg.addr = tuner_addrs; |
623 | 664 | ||
624 | tda8290_i2c_bridge(c, 1); | 665 | tda8290_i2c_bridge(c, 1); |
@@ -627,18 +668,16 @@ int tda8290_init(struct i2c_client *c) | |||
627 | tuner_warn ("TDA827x access failed!\n"); | 668 | tuner_warn ("TDA827x access failed!\n"); |
628 | if ((data & 0x3c) == 0) { | 669 | if ((data & 0x3c) == 0) { |
629 | strlcpy(c->name, "tda8290+75", sizeof(c->name)); | 670 | strlcpy(c->name, "tda8290+75", sizeof(c->name)); |
630 | t->tda827x_ver = 0; | 671 | priv->tda827x_ver = 0; |
631 | } else { | 672 | } else { |
632 | strlcpy(c->name, "tda8290+75a", sizeof(c->name)); | 673 | strlcpy(c->name, "tda8290+75a", sizeof(c->name)); |
633 | t->tda827x_ver = 2; | 674 | priv->tda827x_ver = 2; |
634 | } | 675 | } |
635 | tuner_info("type set to %s\n", c->name); | 676 | tuner_info("type set to %s\n", c->name); |
636 | 677 | ||
637 | t->set_tv_freq = set_tv_freq; | 678 | memcpy(&t->ops, &tda8290_tuner_ops, sizeof(struct tuner_operations)); |
638 | t->set_radio_freq = set_radio_freq; | 679 | |
639 | t->has_signal = has_signal; | 680 | priv->tda827x_lpsel = 0; |
640 | t->standby = standby; | ||
641 | t->tda827x_lpsel = 0; | ||
642 | t->mode = V4L2_TUNER_ANALOG_TV; | 681 | t->mode = V4L2_TUNER_ANALOG_TV; |
643 | 682 | ||
644 | tda8290_init_tuner(c); | 683 | tda8290_init_tuner(c); |
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index fde576f1101c..a8f773274fe3 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <media/v4l2-common.h> | 12 | #include <media/v4l2-common.h> |
13 | #include <media/tuner.h> | 13 | #include <media/tuner.h> |
14 | #include "tuner-driver.h" | ||
14 | 15 | ||
15 | 16 | ||
16 | /* Chips: | 17 | /* Chips: |
@@ -29,6 +30,9 @@ | |||
29 | printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.name, \ | 30 | printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.name, \ |
30 | i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0) | 31 | i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0) |
31 | 32 | ||
33 | struct tda9887_priv { | ||
34 | unsigned char data[4]; | ||
35 | }; | ||
32 | 36 | ||
33 | /* ---------------------------------------------------------------------- */ | 37 | /* ---------------------------------------------------------------------- */ |
34 | 38 | ||
@@ -508,10 +512,11 @@ static int tda9887_status(struct tuner *t) | |||
508 | static void tda9887_configure(struct i2c_client *client) | 512 | static void tda9887_configure(struct i2c_client *client) |
509 | { | 513 | { |
510 | struct tuner *t = i2c_get_clientdata(client); | 514 | struct tuner *t = i2c_get_clientdata(client); |
515 | struct tda9887_priv *priv = t->priv; | ||
511 | int rc; | 516 | int rc; |
512 | 517 | ||
513 | memset(t->tda9887_data,0,sizeof(t->tda9887_data)); | 518 | memset(priv->data,0,sizeof(priv->data)); |
514 | tda9887_set_tvnorm(t,t->tda9887_data); | 519 | tda9887_set_tvnorm(t,priv->data); |
515 | 520 | ||
516 | /* A note on the port settings: | 521 | /* A note on the port settings: |
517 | These settings tend to depend on the specifics of the board. | 522 | These settings tend to depend on the specifics of the board. |
@@ -526,22 +531,22 @@ static void tda9887_configure(struct i2c_client *client) | |||
526 | the ports should be set to active (0), but, again, that may | 531 | the ports should be set to active (0), but, again, that may |
527 | differ depending on the precise hardware configuration. | 532 | differ depending on the precise hardware configuration. |
528 | */ | 533 | */ |
529 | t->tda9887_data[1] |= cOutputPort1Inactive; | 534 | priv->data[1] |= cOutputPort1Inactive; |
530 | t->tda9887_data[1] |= cOutputPort2Inactive; | 535 | priv->data[1] |= cOutputPort2Inactive; |
531 | 536 | ||
532 | tda9887_set_config(t,t->tda9887_data); | 537 | tda9887_set_config(t,priv->data); |
533 | tda9887_set_insmod(t,t->tda9887_data); | 538 | tda9887_set_insmod(t,priv->data); |
534 | 539 | ||
535 | if (t->mode == T_STANDBY) { | 540 | if (t->mode == T_STANDBY) { |
536 | t->tda9887_data[1] |= cForcedMuteAudioON; | 541 | priv->data[1] |= cForcedMuteAudioON; |
537 | } | 542 | } |
538 | 543 | ||
539 | tda9887_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n", | 544 | tda9887_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n", |
540 | t->tda9887_data[1],t->tda9887_data[2],t->tda9887_data[3]); | 545 | priv->data[1],priv->data[2],priv->data[3]); |
541 | if (tuner_debug > 1) | 546 | if (tuner_debug > 1) |
542 | dump_write_message(t, t->tda9887_data); | 547 | dump_write_message(t, priv->data); |
543 | 548 | ||
544 | if (4 != (rc = i2c_master_send(&t->i2c,t->tda9887_data,4))) | 549 | if (4 != (rc = i2c_master_send(&t->i2c,priv->data,4))) |
545 | tda9887_info("i2c i/o error: rc == %d (should be 4)\n",rc); | 550 | tda9887_info("i2c i/o error: rc == %d (should be 4)\n",rc); |
546 | 551 | ||
547 | if (tuner_debug > 2) { | 552 | if (tuner_debug > 2) { |
@@ -555,7 +560,8 @@ static void tda9887_configure(struct i2c_client *client) | |||
555 | static void tda9887_tuner_status(struct i2c_client *client) | 560 | static void tda9887_tuner_status(struct i2c_client *client) |
556 | { | 561 | { |
557 | struct tuner *t = i2c_get_clientdata(client); | 562 | struct tuner *t = i2c_get_clientdata(client); |
558 | tda9887_info("Data bytes: b=0x%02x c=0x%02x e=0x%02x\n", t->tda9887_data[1], t->tda9887_data[2], t->tda9887_data[3]); | 563 | struct tda9887_priv *priv = t->priv; |
564 | tda9887_info("Data bytes: b=0x%02x c=0x%02x e=0x%02x\n", priv->data[1], priv->data[2], priv->data[3]); | ||
559 | } | 565 | } |
560 | 566 | ||
561 | static int tda9887_get_afc(struct i2c_client *client) | 567 | static int tda9887_get_afc(struct i2c_client *client) |
@@ -586,20 +592,39 @@ static void tda9887_set_freq(struct i2c_client *client, unsigned int freq) | |||
586 | tda9887_configure(client); | 592 | tda9887_configure(client); |
587 | } | 593 | } |
588 | 594 | ||
595 | static void tda9887_release(struct i2c_client *c) | ||
596 | { | ||
597 | struct tuner *t = i2c_get_clientdata(c); | ||
598 | |||
599 | kfree(t->priv); | ||
600 | t->priv = NULL; | ||
601 | } | ||
602 | |||
603 | static struct tuner_operations tda9887_tuner_ops = { | ||
604 | .set_tv_freq = tda9887_set_freq, | ||
605 | .set_radio_freq = tda9887_set_freq, | ||
606 | .standby = tda9887_standby, | ||
607 | .tuner_status = tda9887_tuner_status, | ||
608 | .get_afc = tda9887_get_afc, | ||
609 | .release = tda9887_release, | ||
610 | }; | ||
611 | |||
589 | int tda9887_tuner_init(struct i2c_client *c) | 612 | int tda9887_tuner_init(struct i2c_client *c) |
590 | { | 613 | { |
614 | struct tda9887_priv *priv = NULL; | ||
591 | struct tuner *t = i2c_get_clientdata(c); | 615 | struct tuner *t = i2c_get_clientdata(c); |
592 | 616 | ||
617 | priv = kzalloc(sizeof(struct tda9887_priv), GFP_KERNEL); | ||
618 | if (priv == NULL) | ||
619 | return -ENOMEM; | ||
620 | t->priv = priv; | ||
621 | |||
593 | strlcpy(c->name, "tda9887", sizeof(c->name)); | 622 | strlcpy(c->name, "tda9887", sizeof(c->name)); |
594 | 623 | ||
595 | tda9887_info("tda988[5/6/7] found @ 0x%x (%s)\n", t->i2c.addr, | 624 | tda9887_info("tda988[5/6/7] found @ 0x%x (%s)\n", t->i2c.addr, |
596 | t->i2c.driver->driver.name); | 625 | t->i2c.driver->driver.name); |
597 | 626 | ||
598 | t->set_tv_freq = tda9887_set_freq; | 627 | memcpy(&t->ops, &tda9887_tuner_ops, sizeof(struct tuner_operations)); |
599 | t->set_radio_freq = tda9887_set_freq; | ||
600 | t->standby = tda9887_standby; | ||
601 | t->tuner_status = tda9887_tuner_status; | ||
602 | t->get_afc = tda9887_get_afc; | ||
603 | 628 | ||
604 | return 0; | 629 | return 0; |
605 | } | 630 | } |
diff --git a/drivers/media/video/tea5761.c b/drivers/media/video/tea5761.c new file mode 100644 index 000000000000..ae105c2cd0ac --- /dev/null +++ b/drivers/media/video/tea5761.c | |||
@@ -0,0 +1,243 @@ | |||
1 | /* | ||
2 | * For Philips TEA5761 FM Chip | ||
3 | * I2C address is allways 0x20 (0x10 at 7-bit mode). | ||
4 | * | ||
5 | * Copyright (c) 2005-2007 Mauro Carvalho Chehab (mchehab@infradead.org) | ||
6 | * This code is placed under the terms of the GNUv2 General Public License | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #include <linux/i2c.h> | ||
11 | #include <linux/videodev.h> | ||
12 | #include <linux/delay.h> | ||
13 | #include <media/tuner.h> | ||
14 | #include "tuner-driver.h" | ||
15 | |||
16 | #define PREFIX "TEA5761 " | ||
17 | |||
18 | /* from tuner-core.c */ | ||
19 | extern int tuner_debug; | ||
20 | |||
21 | /*****************************************************************************/ | ||
22 | |||
23 | /*************************** | ||
24 | * TEA5761HN I2C registers * | ||
25 | ***************************/ | ||
26 | |||
27 | /* INTREG - Read: bytes 0 and 1 / Write: byte 0 */ | ||
28 | |||
29 | /* first byte for reading */ | ||
30 | #define TEA5761_INTREG_IFFLAG 0x10 | ||
31 | #define TEA5761_INTREG_LEVFLAG 0x8 | ||
32 | #define TEA5761_INTREG_FRRFLAG 0x2 | ||
33 | #define TEA5761_INTREG_BLFLAG 0x1 | ||
34 | |||
35 | /* second byte for reading / byte for writing */ | ||
36 | #define TEA5761_INTREG_IFMSK 0x10 | ||
37 | #define TEA5761_INTREG_LEVMSK 0x8 | ||
38 | #define TEA5761_INTREG_FRMSK 0x2 | ||
39 | #define TEA5761_INTREG_BLMSK 0x1 | ||
40 | |||
41 | /* FRQSET - Read: bytes 2 and 3 / Write: byte 1 and 2 */ | ||
42 | |||
43 | /* First byte */ | ||
44 | #define TEA5761_FRQSET_SEARCH_UP 0x80 /* 1=Station search from botton to up */ | ||
45 | #define TEA5761_FRQSET_SEARCH_MODE 0x40 /* 1=Search mode */ | ||
46 | |||
47 | /* Bits 0-5 for divider MSB */ | ||
48 | |||
49 | /* Second byte */ | ||
50 | /* Bits 0-7 for divider LSB */ | ||
51 | |||
52 | /* TNCTRL - Read: bytes 4 and 5 / Write: Bytes 3 and 4 */ | ||
53 | |||
54 | /* first byte */ | ||
55 | |||
56 | #define TEA5761_TNCTRL_PUPD_0 0x40 /* Power UP/Power Down MSB */ | ||
57 | #define TEA5761_TNCTRL_BLIM 0X20 /* 1= Japan Frequencies, 0= European frequencies */ | ||
58 | #define TEA5761_TNCTRL_SWPM 0x10 /* 1= software port is FRRFLAG */ | ||
59 | #define TEA5761_TNCTRL_IFCTC 0x08 /* 1= IF count time 15.02 ms, 0= IF count time 2.02 ms */ | ||
60 | #define TEA5761_TNCTRL_AFM 0x04 | ||
61 | #define TEA5761_TNCTRL_SMUTE 0x02 /* 1= Soft mute */ | ||
62 | #define TEA5761_TNCTRL_SNC 0x01 | ||
63 | |||
64 | /* second byte */ | ||
65 | |||
66 | #define TEA5761_TNCTRL_MU 0x80 /* 1=Hard mute */ | ||
67 | #define TEA5761_TNCTRL_SSL_1 0x40 | ||
68 | #define TEA5761_TNCTRL_SSL_0 0x20 | ||
69 | #define TEA5761_TNCTRL_HLSI 0x10 | ||
70 | #define TEA5761_TNCTRL_MST 0x08 /* 1 = mono */ | ||
71 | #define TEA5761_TNCTRL_SWP 0x04 | ||
72 | #define TEA5761_TNCTRL_DTC 0x02 /* 1 = deemphasis 50 us, 0 = deemphasis 75 us */ | ||
73 | #define TEA5761_TNCTRL_AHLSI 0x01 | ||
74 | |||
75 | /* FRQCHECK - Read: bytes 6 and 7 */ | ||
76 | /* First byte */ | ||
77 | |||
78 | /* Bits 0-5 for divider MSB */ | ||
79 | |||
80 | /* Second byte */ | ||
81 | /* Bits 0-7 for divider LSB */ | ||
82 | |||
83 | /* TUNCHECK - Read: bytes 8 and 9 */ | ||
84 | |||
85 | /* First byte */ | ||
86 | #define TEA5761_TUNCHECK_IF_MASK 0x7e /* IF count */ | ||
87 | #define TEA5761_TUNCHECK_TUNTO 0x01 | ||
88 | |||
89 | /* Second byte */ | ||
90 | #define TEA5761_TUNCHECK_LEV_MASK 0xf0 /* Level Count */ | ||
91 | #define TEA5761_TUNCHECK_LD 0x08 | ||
92 | #define TEA5761_TUNCHECK_STEREO 0x04 | ||
93 | |||
94 | /* TESTREG - Read: bytes 10 and 11 / Write: bytes 5 and 6 */ | ||
95 | |||
96 | /* All zero = no test mode */ | ||
97 | |||
98 | /* MANID - Read: bytes 12 and 13 */ | ||
99 | |||
100 | /* First byte - should be 0x10 */ | ||
101 | #define TEA5767_MANID_VERSION_MASK 0xf0 /* Version = 1 */ | ||
102 | #define TEA5767_MANID_ID_MSB_MASK 0x0f /* Manufacurer ID - should be 0 */ | ||
103 | |||
104 | /* Second byte - Should be 0x2b */ | ||
105 | |||
106 | #define TEA5767_MANID_ID_LSB_MASK 0xfe /* Manufacturer ID - should be 0x15 */ | ||
107 | #define TEA5767_MANID_IDAV 0x01 /* 1 = Chip has ID, 0 = Chip has no ID */ | ||
108 | |||
109 | /* Chip ID - Read: bytes 14 and 15 */ | ||
110 | |||
111 | /* First byte - should be 0x57 */ | ||
112 | |||
113 | /* Second byte - should be 0x61 */ | ||
114 | |||
115 | /*****************************************************************************/ | ||
116 | |||
117 | static void set_tv_freq(struct i2c_client *c, unsigned int freq) | ||
118 | { | ||
119 | struct tuner *t = i2c_get_clientdata(c); | ||
120 | |||
121 | tuner_warn("This tuner doesn't support TV freq.\n"); | ||
122 | } | ||
123 | |||
124 | #define FREQ_OFFSET 0 /* for TEA5767, it is 700 to give the right freq */ | ||
125 | static void tea5761_status_dump(unsigned char *buffer) | ||
126 | { | ||
127 | unsigned int div, frq; | ||
128 | |||
129 | div = ((buffer[2] & 0x3f) << 8) | buffer[3]; | ||
130 | |||
131 | frq = 1000 * (div * 32768 / 1000 + FREQ_OFFSET + 225) / 4; /* Freq in KHz */ | ||
132 | |||
133 | printk(PREFIX "Frequency %d.%03d KHz (divider = 0x%04x)\n", | ||
134 | frq / 1000, frq % 1000, div); | ||
135 | } | ||
136 | |||
137 | /* Freq should be specifyed at 62.5 Hz */ | ||
138 | static void set_radio_freq(struct i2c_client *c, unsigned int frq) | ||
139 | { | ||
140 | struct tuner *t = i2c_get_clientdata(c); | ||
141 | unsigned char buffer[7] = {0, 0, 0, 0, 0, 0, 0 }; | ||
142 | unsigned div; | ||
143 | int rc; | ||
144 | |||
145 | tuner_dbg (PREFIX "radio freq counter %d\n", frq); | ||
146 | |||
147 | if (t->mode == T_STANDBY) { | ||
148 | tuner_dbg("TEA5761 set to standby mode\n"); | ||
149 | buffer[5] |= TEA5761_TNCTRL_MU; | ||
150 | } else { | ||
151 | buffer[4] |= TEA5761_TNCTRL_PUPD_0; | ||
152 | } | ||
153 | |||
154 | |||
155 | if (t->audmode == V4L2_TUNER_MODE_MONO) { | ||
156 | tuner_dbg("TEA5761 set to mono\n"); | ||
157 | buffer[5] |= TEA5761_TNCTRL_MST; | ||
158 | ; | ||
159 | } else { | ||
160 | tuner_dbg("TEA5761 set to stereo\n"); | ||
161 | } | ||
162 | |||
163 | div = (1000 * (frq * 4 / 16 + 700 + 225) ) >> 15; | ||
164 | buffer[1] = (div >> 8) & 0x3f; | ||
165 | buffer[2] = div & 0xff; | ||
166 | |||
167 | if (tuner_debug) | ||
168 | tea5761_status_dump(buffer); | ||
169 | |||
170 | if (7 != (rc = i2c_master_send(c, buffer, 7))) | ||
171 | tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); | ||
172 | } | ||
173 | |||
174 | static int tea5761_signal(struct i2c_client *c) | ||
175 | { | ||
176 | unsigned char buffer[16]; | ||
177 | int rc; | ||
178 | struct tuner *t = i2c_get_clientdata(c); | ||
179 | |||
180 | memset(buffer, 0, sizeof(buffer)); | ||
181 | if (16 != (rc = i2c_master_recv(c, buffer, 16))) | ||
182 | tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); | ||
183 | |||
184 | return ((buffer[9] & TEA5761_TUNCHECK_LEV_MASK) << (13 - 4)); | ||
185 | } | ||
186 | |||
187 | static int tea5761_stereo(struct i2c_client *c) | ||
188 | { | ||
189 | unsigned char buffer[16]; | ||
190 | int rc; | ||
191 | struct tuner *t = i2c_get_clientdata(c); | ||
192 | |||
193 | memset(buffer, 0, sizeof(buffer)); | ||
194 | if (16 != (rc = i2c_master_recv(c, buffer, 16))) | ||
195 | tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); | ||
196 | |||
197 | rc = buffer[9] & TEA5761_TUNCHECK_STEREO; | ||
198 | |||
199 | tuner_dbg("TEA5761 radio ST GET = %02x\n", rc); | ||
200 | |||
201 | return (rc ? V4L2_TUNER_SUB_STEREO : 0); | ||
202 | } | ||
203 | |||
204 | int tea5761_autodetection(struct i2c_client *c) | ||
205 | { | ||
206 | unsigned char buffer[16]; | ||
207 | int rc; | ||
208 | struct tuner *t = i2c_get_clientdata(c); | ||
209 | |||
210 | if (16 != (rc = i2c_master_recv(c, buffer, 16))) { | ||
211 | tuner_warn("it is not a TEA5761. Received %i chars.\n", rc); | ||
212 | return EINVAL; | ||
213 | } | ||
214 | |||
215 | if (!((buffer[13] != 0x2b) || (buffer[14] != 0x57) || (buffer[15] != 0x061))) { | ||
216 | tuner_warn("Manufacturer ID= 0x%02x, Chip ID = %02x%02x. It is not a TEA5761\n",buffer[13],buffer[14],buffer[15]); | ||
217 | return EINVAL; | ||
218 | } | ||
219 | tuner_warn("TEA5761 detected.\n"); | ||
220 | return 0; | ||
221 | } | ||
222 | |||
223 | static struct tuner_operations tea5761_tuner_ops = { | ||
224 | .set_tv_freq = set_tv_freq, | ||
225 | .set_radio_freq = set_radio_freq, | ||
226 | .has_signal = tea5761_signal, | ||
227 | .is_stereo = tea5761_stereo, | ||
228 | }; | ||
229 | |||
230 | int tea5761_tuner_init(struct i2c_client *c) | ||
231 | { | ||
232 | struct tuner *t = i2c_get_clientdata(c); | ||
233 | |||
234 | if (tea5761_autodetection(c) == EINVAL) | ||
235 | return EINVAL; | ||
236 | |||
237 | tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5761HN FM Radio"); | ||
238 | strlcpy(c->name, "tea5761", sizeof(c->name)); | ||
239 | |||
240 | memcpy(&t->ops, &tea5761_tuner_ops, sizeof(struct tuner_operations)); | ||
241 | |||
242 | return (0); | ||
243 | } | ||
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c index d1c41781ccc4..4985d47a508f 100644 --- a/drivers/media/video/tea5767.c +++ b/drivers/media/video/tea5767.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/i2c.h> | 13 | #include <linux/i2c.h> |
14 | #include <linux/videodev.h> | 14 | #include <linux/videodev.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <media/tuner.h> | 16 | #include "tuner-driver.h" |
17 | 17 | ||
18 | #define PREFIX "TEA5767 " | 18 | #define PREFIX "TEA5767 " |
19 | 19 | ||
@@ -343,6 +343,14 @@ int tea5767_autodetection(struct i2c_client *c) | |||
343 | return 0; | 343 | return 0; |
344 | } | 344 | } |
345 | 345 | ||
346 | static struct tuner_operations tea5767_tuner_ops = { | ||
347 | .set_tv_freq = set_tv_freq, | ||
348 | .set_radio_freq = set_radio_freq, | ||
349 | .has_signal = tea5767_signal, | ||
350 | .is_stereo = tea5767_stereo, | ||
351 | .standby = tea5767_standby, | ||
352 | }; | ||
353 | |||
346 | int tea5767_tuner_init(struct i2c_client *c) | 354 | int tea5767_tuner_init(struct i2c_client *c) |
347 | { | 355 | { |
348 | struct tuner *t = i2c_get_clientdata(c); | 356 | struct tuner *t = i2c_get_clientdata(c); |
@@ -350,11 +358,7 @@ int tea5767_tuner_init(struct i2c_client *c) | |||
350 | tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio"); | 358 | tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio"); |
351 | strlcpy(c->name, "tea5767", sizeof(c->name)); | 359 | strlcpy(c->name, "tea5767", sizeof(c->name)); |
352 | 360 | ||
353 | t->set_tv_freq = set_tv_freq; | 361 | memcpy(&t->ops, &tea5767_tuner_ops, sizeof(struct tuner_operations)); |
354 | t->set_radio_freq = set_radio_freq; | ||
355 | t->has_signal = tea5767_signal; | ||
356 | t->is_stereo = tea5767_stereo; | ||
357 | t->standby = tea5767_standby; | ||
358 | 362 | ||
359 | return (0); | 363 | return (0); |
360 | } | 364 | } |
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 505591a7abe9..e646465464a1 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -20,11 +20,15 @@ | |||
20 | 20 | ||
21 | #include <media/tuner.h> | 21 | #include <media/tuner.h> |
22 | #include <media/v4l2-common.h> | 22 | #include <media/v4l2-common.h> |
23 | #include "tuner-driver.h" | ||
23 | 24 | ||
24 | #define UNSET (-1U) | 25 | #define UNSET (-1U) |
25 | 26 | ||
26 | /* standard i2c insmod options */ | 27 | /* standard i2c insmod options */ |
27 | static unsigned short normal_i2c[] = { | 28 | static unsigned short normal_i2c[] = { |
29 | #ifdef CONFIG_TUNER_TEA5761 | ||
30 | 0x10, | ||
31 | #endif | ||
28 | 0x42, 0x43, 0x4a, 0x4b, /* tda8290 */ | 32 | 0x42, 0x43, 0x4a, 0x4b, /* tda8290 */ |
29 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, | 33 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, |
30 | 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | 34 | 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, |
@@ -77,7 +81,7 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
77 | tuner_warn ("tuner type not set\n"); | 81 | tuner_warn ("tuner type not set\n"); |
78 | return; | 82 | return; |
79 | } | 83 | } |
80 | if (NULL == t->set_tv_freq) { | 84 | if (NULL == t->ops.set_tv_freq) { |
81 | tuner_warn ("Tuner has no way to set tv freq\n"); | 85 | tuner_warn ("Tuner has no way to set tv freq\n"); |
82 | return; | 86 | return; |
83 | } | 87 | } |
@@ -92,7 +96,7 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
92 | else | 96 | else |
93 | freq = tv_range[1] * 16; | 97 | freq = tv_range[1] * 16; |
94 | } | 98 | } |
95 | t->set_tv_freq(c, freq); | 99 | t->ops.set_tv_freq(c, freq); |
96 | } | 100 | } |
97 | 101 | ||
98 | static void set_radio_freq(struct i2c_client *c, unsigned int freq) | 102 | static void set_radio_freq(struct i2c_client *c, unsigned int freq) |
@@ -103,7 +107,7 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
103 | tuner_warn ("tuner type not set\n"); | 107 | tuner_warn ("tuner type not set\n"); |
104 | return; | 108 | return; |
105 | } | 109 | } |
106 | if (NULL == t->set_radio_freq) { | 110 | if (NULL == t->ops.set_radio_freq) { |
107 | tuner_warn ("tuner has no way to set radio frequency\n"); | 111 | tuner_warn ("tuner has no way to set radio frequency\n"); |
108 | return; | 112 | return; |
109 | } | 113 | } |
@@ -119,7 +123,7 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
119 | freq = radio_range[1] * 16000; | 123 | freq = radio_range[1] * 16000; |
120 | } | 124 | } |
121 | 125 | ||
122 | t->set_radio_freq(c, freq); | 126 | t->ops.set_radio_freq(c, freq); |
123 | } | 127 | } |
124 | 128 | ||
125 | static void set_freq(struct i2c_client *c, unsigned long freq) | 129 | static void set_freq(struct i2c_client *c, unsigned long freq) |
@@ -174,6 +178,14 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
174 | return; | 178 | return; |
175 | } | 179 | } |
176 | 180 | ||
181 | /* discard private data, in case set_type() was previously called */ | ||
182 | if (t->ops.release) | ||
183 | t->ops.release(c); | ||
184 | else { | ||
185 | kfree(t->priv); | ||
186 | t->priv = NULL; | ||
187 | } | ||
188 | |||
177 | switch (t->type) { | 189 | switch (t->type) { |
178 | case TUNER_MT2032: | 190 | case TUNER_MT2032: |
179 | microtune_init(c); | 191 | microtune_init(c); |
@@ -189,6 +201,16 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
189 | } | 201 | } |
190 | t->mode_mask = T_RADIO; | 202 | t->mode_mask = T_RADIO; |
191 | break; | 203 | break; |
204 | #ifdef CONFIG_TUNER_TEA5761 | ||
205 | case TUNER_TEA5761: | ||
206 | if (tea5761_tuner_init(c) == EINVAL) { | ||
207 | t->type = TUNER_ABSENT; | ||
208 | t->mode_mask = T_UNINITIALIZED; | ||
209 | return; | ||
210 | } | ||
211 | t->mode_mask = T_RADIO; | ||
212 | break; | ||
213 | #endif | ||
192 | case TUNER_PHILIPS_FMD1216ME_MK3: | 214 | case TUNER_PHILIPS_FMD1216ME_MK3: |
193 | buffer[0] = 0x0b; | 215 | buffer[0] = 0x0b; |
194 | buffer[1] = 0xdc; | 216 | buffer[1] = 0xdc; |
@@ -408,11 +430,11 @@ static void tuner_status(struct i2c_client *client) | |||
408 | tuner_info("Standard: 0x%08lx\n", (unsigned long)t->std); | 430 | tuner_info("Standard: 0x%08lx\n", (unsigned long)t->std); |
409 | if (t->mode != V4L2_TUNER_RADIO) | 431 | if (t->mode != V4L2_TUNER_RADIO) |
410 | return; | 432 | return; |
411 | if (t->has_signal) { | 433 | if (t->ops.has_signal) { |
412 | tuner_info("Signal strength: %d\n", t->has_signal(client)); | 434 | tuner_info("Signal strength: %d\n", t->ops.has_signal(client)); |
413 | } | 435 | } |
414 | if (t->is_stereo) { | 436 | if (t->ops.is_stereo) { |
415 | tuner_info("Stereo: %s\n", t->is_stereo(client) ? "yes" : "no"); | 437 | tuner_info("Stereo: %s\n", t->ops.is_stereo(client) ? "yes" : "no"); |
416 | } | 438 | } |
417 | } | 439 | } |
418 | 440 | ||
@@ -437,10 +459,9 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
437 | memcpy(&t->i2c, &client_template, sizeof(struct i2c_client)); | 459 | memcpy(&t->i2c, &client_template, sizeof(struct i2c_client)); |
438 | i2c_set_clientdata(&t->i2c, t); | 460 | i2c_set_clientdata(&t->i2c, t); |
439 | t->type = UNSET; | 461 | t->type = UNSET; |
440 | t->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */ | ||
441 | t->audmode = V4L2_TUNER_MODE_STEREO; | 462 | t->audmode = V4L2_TUNER_MODE_STEREO; |
442 | t->mode_mask = T_UNINITIALIZED; | 463 | t->mode_mask = T_UNINITIALIZED; |
443 | t->tuner_status = tuner_status; | 464 | t->ops.tuner_status = tuner_status; |
444 | 465 | ||
445 | if (show_i2c) { | 466 | if (show_i2c) { |
446 | unsigned char buffer[16]; | 467 | unsigned char buffer[16]; |
@@ -460,6 +481,19 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
460 | /* autodetection code based on the i2c addr */ | 481 | /* autodetection code based on the i2c addr */ |
461 | if (!no_autodetect) { | 482 | if (!no_autodetect) { |
462 | switch (addr) { | 483 | switch (addr) { |
484 | #ifdef CONFIG_TUNER_TEA5761 | ||
485 | case 0x10: | ||
486 | if (tea5761_autodetection(&t->i2c) != EINVAL) { | ||
487 | t->type = TUNER_TEA5761; | ||
488 | t->mode_mask = T_RADIO; | ||
489 | t->mode = T_STANDBY; | ||
490 | t->radio_freq = 87.5 * 16000; /* Sets freq to FM range */ | ||
491 | default_mode_mask &= ~T_RADIO; | ||
492 | |||
493 | goto register_client; | ||
494 | } | ||
495 | break; | ||
496 | #endif | ||
463 | case 0x42: | 497 | case 0x42: |
464 | case 0x43: | 498 | case 0x43: |
465 | case 0x4a: | 499 | case 0x4a: |
@@ -533,6 +567,11 @@ static int tuner_detach(struct i2c_client *client) | |||
533 | return err; | 567 | return err; |
534 | } | 568 | } |
535 | 569 | ||
570 | if (t->ops.release) | ||
571 | t->ops.release(client); | ||
572 | else { | ||
573 | kfree(t->priv); | ||
574 | } | ||
536 | kfree(t); | 575 | kfree(t); |
537 | return 0; | 576 | return 0; |
538 | } | 577 | } |
@@ -553,8 +592,8 @@ static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, | |||
553 | 592 | ||
554 | if (check_mode(t, cmd) == EINVAL) { | 593 | if (check_mode(t, cmd) == EINVAL) { |
555 | t->mode = T_STANDBY; | 594 | t->mode = T_STANDBY; |
556 | if (t->standby) | 595 | if (t->ops.standby) |
557 | t->standby (client); | 596 | t->ops.standby (client); |
558 | return EINVAL; | 597 | return EINVAL; |
559 | } | 598 | } |
560 | return 0; | 599 | return 0; |
@@ -602,8 +641,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
602 | if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) | 641 | if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) |
603 | return 0; | 642 | return 0; |
604 | t->mode = T_STANDBY; | 643 | t->mode = T_STANDBY; |
605 | if (t->standby) | 644 | if (t->ops.standby) |
606 | t->standby (client); | 645 | t->ops.standby (client); |
607 | break; | 646 | break; |
608 | #ifdef CONFIG_VIDEO_V4L1 | 647 | #ifdef CONFIG_VIDEO_V4L1 |
609 | case VIDIOCSAUDIO: | 648 | case VIDIOCSAUDIO: |
@@ -662,10 +701,10 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
662 | return 0; | 701 | return 0; |
663 | 702 | ||
664 | if (V4L2_TUNER_RADIO == t->mode) { | 703 | if (V4L2_TUNER_RADIO == t->mode) { |
665 | if (t->has_signal) | 704 | if (t->ops.has_signal) |
666 | vt->signal = t->has_signal(client); | 705 | vt->signal = t->ops.has_signal(client); |
667 | if (t->is_stereo) { | 706 | if (t->ops.is_stereo) { |
668 | if (t->is_stereo(client)) | 707 | if (t->ops.is_stereo(client)) |
669 | vt->flags |= | 708 | vt->flags |= |
670 | VIDEO_TUNER_STEREO_ON; | 709 | VIDEO_TUNER_STEREO_ON; |
671 | else | 710 | else |
@@ -693,8 +732,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
693 | if (check_v4l2(t) == EINVAL) | 732 | if (check_v4l2(t) == EINVAL) |
694 | return 0; | 733 | return 0; |
695 | 734 | ||
696 | if (V4L2_TUNER_RADIO == t->mode && t->is_stereo) | 735 | if (V4L2_TUNER_RADIO == t->mode && t->ops.is_stereo) |
697 | va->mode = t->is_stereo(client) | 736 | va->mode = t->ops.is_stereo(client) |
698 | ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO; | 737 | ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO; |
699 | return 0; | 738 | return 0; |
700 | } | 739 | } |
@@ -759,8 +798,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
759 | switch_v4l2(); | 798 | switch_v4l2(); |
760 | 799 | ||
761 | tuner->type = t->mode; | 800 | tuner->type = t->mode; |
762 | if (t->get_afc) | 801 | if (t->ops.get_afc) |
763 | tuner->afc=t->get_afc(client); | 802 | tuner->afc=t->ops.get_afc(client); |
764 | if (t->mode == V4L2_TUNER_ANALOG_TV) | 803 | if (t->mode == V4L2_TUNER_ANALOG_TV) |
765 | tuner->capability |= V4L2_TUNER_CAP_NORM; | 804 | tuner->capability |= V4L2_TUNER_CAP_NORM; |
766 | if (t->mode != V4L2_TUNER_RADIO) { | 805 | if (t->mode != V4L2_TUNER_RADIO) { |
@@ -770,13 +809,13 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
770 | } | 809 | } |
771 | 810 | ||
772 | /* radio mode */ | 811 | /* radio mode */ |
773 | if (t->has_signal) | 812 | if (t->ops.has_signal) |
774 | tuner->signal = t->has_signal(client); | 813 | tuner->signal = t->ops.has_signal(client); |
775 | 814 | ||
776 | tuner->rxsubchans = | 815 | tuner->rxsubchans = |
777 | V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; | 816 | V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; |
778 | if (t->is_stereo) { | 817 | if (t->ops.is_stereo) { |
779 | tuner->rxsubchans = t->is_stereo(client) ? | 818 | tuner->rxsubchans = t->ops.is_stereo(client) ? |
780 | V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; | 819 | V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; |
781 | } | 820 | } |
782 | 821 | ||
@@ -804,8 +843,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
804 | break; | 843 | break; |
805 | } | 844 | } |
806 | case VIDIOC_LOG_STATUS: | 845 | case VIDIOC_LOG_STATUS: |
807 | if (t->tuner_status) | 846 | if (t->ops.tuner_status) |
808 | t->tuner_status(client); | 847 | t->ops.tuner_status(client); |
809 | break; | 848 | break; |
810 | } | 849 | } |
811 | 850 | ||
diff --git a/drivers/media/video/tuner-driver.h b/drivers/media/video/tuner-driver.h new file mode 100644 index 000000000000..0334a9125077 --- /dev/null +++ b/drivers/media/video/tuner-driver.h | |||
@@ -0,0 +1,107 @@ | |||
1 | /* | ||
2 | tuner-driver.h - interface for different tuners | ||
3 | |||
4 | Copyright (C) 1997 Markus Schroeder (schroedm@uni-duesseldorf.de) | ||
5 | minor modifications by Ralph Metzler (rjkm@thp.uni-koeln.de) | ||
6 | |||
7 | This program is free software; you can redistribute it and/or modify | ||
8 | it under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation; either version 2 of the License, or | ||
10 | (at your option) any later version. | ||
11 | |||
12 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; if not, write to the Free Software | ||
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | #ifndef __TUNER_HW_H__ | ||
23 | #define __TUNER_HW_H__ | ||
24 | |||
25 | #include <linux/videodev2.h> | ||
26 | #include <linux/i2c.h> | ||
27 | |||
28 | extern unsigned const int tuner_count; | ||
29 | |||
30 | struct tuner_operations { | ||
31 | void (*set_tv_freq)(struct i2c_client *c, unsigned int freq); | ||
32 | void (*set_radio_freq)(struct i2c_client *c, unsigned int freq); | ||
33 | int (*has_signal)(struct i2c_client *c); | ||
34 | int (*is_stereo)(struct i2c_client *c); | ||
35 | int (*get_afc)(struct i2c_client *c); | ||
36 | void (*tuner_status)(struct i2c_client *c); | ||
37 | void (*standby)(struct i2c_client *c); | ||
38 | void (*release)(struct i2c_client *c); | ||
39 | }; | ||
40 | |||
41 | struct tuner { | ||
42 | /* device */ | ||
43 | struct i2c_client i2c; | ||
44 | |||
45 | unsigned int type; /* chip type */ | ||
46 | |||
47 | unsigned int mode; | ||
48 | unsigned int mode_mask; /* Combination of allowable modes */ | ||
49 | |||
50 | unsigned int tv_freq; /* keep track of the current settings */ | ||
51 | unsigned int radio_freq; | ||
52 | u16 last_div; | ||
53 | unsigned int audmode; | ||
54 | v4l2_std_id std; | ||
55 | |||
56 | int using_v4l2; | ||
57 | void *priv; | ||
58 | |||
59 | /* used by tda9887 */ | ||
60 | unsigned int tda9887_config; | ||
61 | |||
62 | unsigned int config; | ||
63 | int (*tuner_callback) (void *dev, int command,int arg); | ||
64 | |||
65 | struct tuner_operations ops; | ||
66 | }; | ||
67 | |||
68 | /* ------------------------------------------------------------------------ */ | ||
69 | |||
70 | extern int default_tuner_init(struct i2c_client *c); | ||
71 | |||
72 | extern int tda9887_tuner_init(struct i2c_client *c); | ||
73 | |||
74 | extern int microtune_init(struct i2c_client *c); | ||
75 | |||
76 | extern int tda8290_init(struct i2c_client *c); | ||
77 | extern int tda8290_probe(struct i2c_client *c); | ||
78 | |||
79 | extern int tea5761_tuner_init(struct i2c_client *c); | ||
80 | extern int tea5761_autodetection(struct i2c_client *c); | ||
81 | |||
82 | extern int tea5767_autodetection(struct i2c_client *c); | ||
83 | extern int tea5767_tuner_init(struct i2c_client *c); | ||
84 | |||
85 | /* ------------------------------------------------------------------------ */ | ||
86 | |||
87 | #define tuner_warn(fmt, arg...) do {\ | ||
88 | printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ | ||
89 | i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0) | ||
90 | #define tuner_info(fmt, arg...) do {\ | ||
91 | printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ | ||
92 | i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0) | ||
93 | #define tuner_dbg(fmt, arg...) do {\ | ||
94 | extern int tuner_debug; \ | ||
95 | if (tuner_debug) \ | ||
96 | printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ | ||
97 | i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0) | ||
98 | |||
99 | #endif /* __TUNER_HW_H__ */ | ||
100 | |||
101 | /* | ||
102 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
103 | * --------------------------------------------------------------------------- | ||
104 | * Local variables: | ||
105 | * c-basic-offset: 8 | ||
106 | * End: | ||
107 | */ | ||
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index c40b92ce1fad..2d57e8bc0db3 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c | |||
@@ -8,6 +8,8 @@ | |||
8 | #include <linux/videodev.h> | 8 | #include <linux/videodev.h> |
9 | #include <media/tuner.h> | 9 | #include <media/tuner.h> |
10 | #include <media/v4l2-common.h> | 10 | #include <media/v4l2-common.h> |
11 | #include <media/tuner-types.h> | ||
12 | #include "tuner-driver.h" | ||
11 | 13 | ||
12 | static int offset = 0; | 14 | static int offset = 0; |
13 | module_param(offset, int, 0664); | 15 | module_param(offset, int, 0664); |
@@ -54,9 +56,9 @@ MODULE_PARM_DESC(offset,"Allows to specify an offset for tuner"); | |||
54 | sound 2 33.16 - - | 56 | sound 2 33.16 - - |
55 | NICAM 33.05 33.05 39.80 | 57 | NICAM 33.05 33.05 39.80 |
56 | */ | 58 | */ |
57 | #define PHILIPS_MF_SET_BG 0x01 /* Bit 2 must be zero, Bit 3 is system output */ | 59 | #define PHILIPS_MF_SET_STD_BG 0x01 /* Bit 2 must be zero, Bit 3 is system output */ |
58 | #define PHILIPS_MF_SET_PAL_L 0x03 // France | 60 | #define PHILIPS_MF_SET_STD_L 0x03 /* Used on Secam France */ |
59 | #define PHILIPS_MF_SET_PAL_L2 0x02 // L' | 61 | #define PHILIPS_MF_SET_STD_LC 0x02 /* Used on SECAM L' */ |
60 | 62 | ||
61 | /* Control byte */ | 63 | /* Control byte */ |
62 | 64 | ||
@@ -207,11 +209,11 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
207 | /* 0x04 -> ??? PAL others / SECAM others ??? */ | 209 | /* 0x04 -> ??? PAL others / SECAM others ??? */ |
208 | cb &= ~0x03; | 210 | cb &= ~0x03; |
209 | if (t->std & V4L2_STD_SECAM_L) //also valid for V4L2_STD_SECAM | 211 | if (t->std & V4L2_STD_SECAM_L) //also valid for V4L2_STD_SECAM |
210 | cb |= PHILIPS_MF_SET_PAL_L; | 212 | cb |= PHILIPS_MF_SET_STD_L; |
211 | else if (t->std & V4L2_STD_SECAM_LC) | 213 | else if (t->std & V4L2_STD_SECAM_LC) |
212 | cb |= PHILIPS_MF_SET_PAL_L2; | 214 | cb |= PHILIPS_MF_SET_STD_LC; |
213 | else /* V4L2_STD_B|V4L2_STD_GH */ | 215 | else /* V4L2_STD_B|V4L2_STD_GH */ |
214 | cb |= PHILIPS_MF_SET_BG; | 216 | cb |= PHILIPS_MF_SET_STD_BG; |
215 | break; | 217 | break; |
216 | 218 | ||
217 | case TUNER_TEMIC_4046FM5: | 219 | case TUNER_TEMIC_4046FM5: |
@@ -479,6 +481,13 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
479 | tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); | 481 | tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); |
480 | } | 482 | } |
481 | 483 | ||
484 | static struct tuner_operations simple_tuner_ops = { | ||
485 | .set_tv_freq = default_set_tv_freq, | ||
486 | .set_radio_freq = default_set_radio_freq, | ||
487 | .has_signal = tuner_signal, | ||
488 | .is_stereo = tuner_stereo, | ||
489 | }; | ||
490 | |||
482 | int default_tuner_init(struct i2c_client *c) | 491 | int default_tuner_init(struct i2c_client *c) |
483 | { | 492 | { |
484 | struct tuner *t = i2c_get_clientdata(c); | 493 | struct tuner *t = i2c_get_clientdata(c); |
@@ -487,11 +496,7 @@ int default_tuner_init(struct i2c_client *c) | |||
487 | t->type, tuners[t->type].name); | 496 | t->type, tuners[t->type].name); |
488 | strlcpy(c->name, tuners[t->type].name, sizeof(c->name)); | 497 | strlcpy(c->name, tuners[t->type].name, sizeof(c->name)); |
489 | 498 | ||
490 | t->set_tv_freq = default_set_tv_freq; | 499 | memcpy(&t->ops, &simple_tuner_ops, sizeof(struct tuner_operations)); |
491 | t->set_radio_freq = default_set_radio_freq; | ||
492 | t->has_signal = tuner_signal; | ||
493 | t->is_stereo = tuner_stereo; | ||
494 | t->standby = NULL; | ||
495 | 500 | ||
496 | return 0; | 501 | return 0; |
497 | } | 502 | } |
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c index 74c3e6f96f1a..417f642b4359 100644 --- a/drivers/media/video/tuner-types.c +++ b/drivers/media/video/tuner-types.c | |||
@@ -594,19 +594,19 @@ static struct tuner_params tuner_philips_pal_mk_params[] = { | |||
594 | }, | 594 | }, |
595 | }; | 595 | }; |
596 | 596 | ||
597 | /* ------------ TUNER_PHILIPS_ATSC - Philips ATSC ------------ */ | 597 | /* ---- TUNER_PHILIPS_ATSC - Philips FCV1236D (ATSC/NTSC) ---- */ |
598 | 598 | ||
599 | static struct tuner_range tuner_philips_atsc_ranges[] = { | 599 | static struct tuner_range tuner_philips_fcv1236d_ranges[] = { |
600 | { 16 * 157.25 /*MHz*/, 0x8e, 0xa0, }, | 600 | { 16 * 157.25 /*MHz*/, 0x8e, 0xa0, }, |
601 | { 16 * 454.00 /*MHz*/, 0x8e, 0x90, }, | 601 | { 16 * 451.25 /*MHz*/, 0x8e, 0x90, }, |
602 | { 16 * 999.99 , 0x8e, 0x30, }, | 602 | { 16 * 999.99 , 0x8e, 0x30, }, |
603 | }; | 603 | }; |
604 | 604 | ||
605 | static struct tuner_params tuner_philips_atsc_params[] = { | 605 | static struct tuner_params tuner_philips_fcv1236d_params[] = { |
606 | { | 606 | { |
607 | .type = TUNER_PARAM_TYPE_NTSC, | 607 | .type = TUNER_PARAM_TYPE_NTSC, |
608 | .ranges = tuner_philips_atsc_ranges, | 608 | .ranges = tuner_philips_fcv1236d_ranges, |
609 | .count = ARRAY_SIZE(tuner_philips_atsc_ranges), | 609 | .count = ARRAY_SIZE(tuner_philips_fcv1236d_ranges), |
610 | }, | 610 | }, |
611 | }; | 611 | }; |
612 | 612 | ||
@@ -1296,9 +1296,9 @@ struct tunertype tuners[] = { | |||
1296 | .count = ARRAY_SIZE(tuner_philips_pal_mk_params), | 1296 | .count = ARRAY_SIZE(tuner_philips_pal_mk_params), |
1297 | }, | 1297 | }, |
1298 | [TUNER_PHILIPS_ATSC] = { /* Philips ATSC */ | 1298 | [TUNER_PHILIPS_ATSC] = { /* Philips ATSC */ |
1299 | .name = "Philips 1236D ATSC/NTSC dual in", | 1299 | .name = "Philips FCV1236D ATSC/NTSC dual in", |
1300 | .params = tuner_philips_atsc_params, | 1300 | .params = tuner_philips_fcv1236d_params, |
1301 | .count = ARRAY_SIZE(tuner_philips_atsc_params), | 1301 | .count = ARRAY_SIZE(tuner_philips_fcv1236d_params), |
1302 | }, | 1302 | }, |
1303 | [TUNER_PHILIPS_FM1236_MK3] = { /* Philips NTSC */ | 1303 | [TUNER_PHILIPS_FM1236_MK3] = { /* Philips NTSC */ |
1304 | .name = "Philips NTSC MK3 (FM1236MK3 or FM1236/F)", | 1304 | .name = "Philips NTSC MK3 (FM1236MK3 or FM1236/F)", |
@@ -1463,6 +1463,10 @@ struct tunertype tuners[] = { | |||
1463 | .name = "Philips TDA988[5,6,7] IF PLL Demodulator", | 1463 | .name = "Philips TDA988[5,6,7] IF PLL Demodulator", |
1464 | /* see tda9887.c for details */ | 1464 | /* see tda9887.c for details */ |
1465 | }, | 1465 | }, |
1466 | [TUNER_TEA5761] = { /* Philips RADIO */ | ||
1467 | .name = "Philips TEA5761 FM Radio", | ||
1468 | /* see tea5767.c for details */ | ||
1469 | }, | ||
1466 | }; | 1470 | }; |
1467 | 1471 | ||
1468 | unsigned const int tuner_count = ARRAY_SIZE(tuners); | 1472 | unsigned const int tuner_count = ARRAY_SIZE(tuners); |
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index a1136da74ba8..fdc3def437b1 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c | |||
@@ -183,7 +183,7 @@ hauppauge_tuner[] = | |||
183 | { TUNER_ABSENT, "Silicon TDA8275C1 8290 FM"}, | 183 | { TUNER_ABSENT, "Silicon TDA8275C1 8290 FM"}, |
184 | { TUNER_ABSENT, "Thompson DTT757"}, | 184 | { TUNER_ABSENT, "Thompson DTT757"}, |
185 | /* 80-89 */ | 185 | /* 80-89 */ |
186 | { TUNER_ABSENT, "Philips FQ1216LME MK3"}, | 186 | { TUNER_PHILIPS_FM1216ME_MK3, "Philips FQ1216LME MK3"}, |
187 | { TUNER_LG_PAL_NEW_TAPC, "LG TAPC G701D"}, | 187 | { TUNER_LG_PAL_NEW_TAPC, "LG TAPC G701D"}, |
188 | { TUNER_LG_NTSC_NEW_TAPC, "LG TAPC H791F"}, | 188 | { TUNER_LG_NTSC_NEW_TAPC, "LG TAPC H791F"}, |
189 | { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MB 3"}, | 189 | { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MB 3"}, |
@@ -490,7 +490,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, | |||
490 | to indicate 4052 mux was removed in favor of using MSP | 490 | to indicate 4052 mux was removed in favor of using MSP |
491 | inputs directly. */ | 491 | inputs directly. */ |
492 | audioic = eeprom_data[i+2] & 0x7f; | 492 | audioic = eeprom_data[i+2] & 0x7f; |
493 | if (audioic < sizeof(audioIC)/sizeof(*audioIC)) | 493 | if (audioic < ARRAY_SIZE(audioIC)) |
494 | tvee->audio_processor = audioIC[audioic].id; | 494 | tvee->audio_processor = audioIC[audioic].id; |
495 | else | 495 | else |
496 | tvee->audio_processor = AUDIO_CHIP_UNKNOWN; | 496 | tvee->audio_processor = AUDIO_CHIP_UNKNOWN; |
@@ -523,7 +523,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, | |||
523 | to indicate 4052 mux was removed in favor of using MSP | 523 | to indicate 4052 mux was removed in favor of using MSP |
524 | inputs directly. */ | 524 | inputs directly. */ |
525 | audioic = eeprom_data[i+1] & 0x7f; | 525 | audioic = eeprom_data[i+1] & 0x7f; |
526 | if (audioic < sizeof(audioIC)/sizeof(*audioIC)) | 526 | if (audioic < ARRAY_SIZE(audioIC)) |
527 | tvee->audio_processor = audioIC[audioic].id; | 527 | tvee->audio_processor = audioIC[audioic].id; |
528 | else | 528 | else |
529 | tvee->audio_processor = AUDIO_CHIP_UNKNOWN; | 529 | tvee->audio_processor = AUDIO_CHIP_UNKNOWN; |
@@ -678,7 +678,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, | |||
678 | tveeprom_info("audio processor is unknown (no idx)\n"); | 678 | tveeprom_info("audio processor is unknown (no idx)\n"); |
679 | tvee->audio_processor=AUDIO_CHIP_UNKNOWN; | 679 | tvee->audio_processor=AUDIO_CHIP_UNKNOWN; |
680 | } else { | 680 | } else { |
681 | if (audioic < sizeof(audioIC)/sizeof(*audioIC)) | 681 | if (audioic < ARRAY_SIZE(audioIC)) |
682 | tveeprom_info("audio processor is %s (idx %d)\n", | 682 | tveeprom_info("audio processor is %s (idx %d)\n", |
683 | audioIC[audioic].name,audioic); | 683 | audioIC[audioic].name,audioic); |
684 | else | 684 | else |
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index d5ec05f56adf..e2f1c972754b 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c | |||
@@ -1006,7 +1006,7 @@ static int tvp5150_command(struct i2c_client *c, | |||
1006 | { | 1006 | { |
1007 | struct v4l2_control *ctrl = arg; | 1007 | struct v4l2_control *ctrl = arg; |
1008 | u8 i, n; | 1008 | u8 i, n; |
1009 | n = sizeof(tvp5150_qctrl) / sizeof(tvp5150_qctrl[0]); | 1009 | n = ARRAY_SIZE(tvp5150_qctrl); |
1010 | for (i = 0; i < n; i++) | 1010 | for (i = 0; i < n; i++) |
1011 | if (ctrl->id == tvp5150_qctrl[i].id) { | 1011 | if (ctrl->id == tvp5150_qctrl[i].id) { |
1012 | if (ctrl->value < | 1012 | if (ctrl->value < |
diff --git a/drivers/media/video/usbvideo/konicawc.c b/drivers/media/video/usbvideo/konicawc.c index abe214619092..491505d6fdee 100644 --- a/drivers/media/video/usbvideo/konicawc.c +++ b/drivers/media/video/usbvideo/konicawc.c | |||
@@ -236,7 +236,7 @@ static void konicawc_register_input(struct konicawc *cam, struct usb_device *dev | |||
236 | input_dev->name = "Konicawc snapshot button"; | 236 | input_dev->name = "Konicawc snapshot button"; |
237 | input_dev->phys = cam->input_physname; | 237 | input_dev->phys = cam->input_physname; |
238 | usb_to_input_id(dev, &input_dev->id); | 238 | usb_to_input_id(dev, &input_dev->id); |
239 | input_dev->cdev.dev = &dev->dev; | 239 | input_dev->dev.parent = &dev->dev; |
240 | 240 | ||
241 | input_dev->evbit[0] = BIT(EV_KEY); | 241 | input_dev->evbit[0] = BIT(EV_KEY); |
242 | input_dev->keybit[LONG(BTN_0)] = BIT(BTN_0); | 242 | input_dev->keybit[LONG(BTN_0)] = BIT(BTN_0); |
diff --git a/drivers/media/video/usbvideo/quickcam_messenger.c b/drivers/media/video/usbvideo/quickcam_messenger.c index ec0ff2247f06..dd1a6d6bbc9e 100644 --- a/drivers/media/video/usbvideo/quickcam_messenger.c +++ b/drivers/media/video/usbvideo/quickcam_messenger.c | |||
@@ -100,7 +100,7 @@ static void qcm_register_input(struct qcm *cam, struct usb_device *dev) | |||
100 | input_dev->name = "QCM button"; | 100 | input_dev->name = "QCM button"; |
101 | input_dev->phys = cam->input_physname; | 101 | input_dev->phys = cam->input_physname; |
102 | usb_to_input_id(dev, &input_dev->id); | 102 | usb_to_input_id(dev, &input_dev->id); |
103 | input_dev->cdev.dev = &dev->dev; | 103 | input_dev->dev.parent = &dev->dev; |
104 | 104 | ||
105 | input_dev->evbit[0] = BIT(EV_KEY); | 105 | input_dev->evbit[0] = BIT(EV_KEY); |
106 | input_dev->keybit[LONG(BTN_0)] = BIT(BTN_0); | 106 | input_dev->keybit[LONG(BTN_0)] = BIT(BTN_0); |
@@ -439,7 +439,7 @@ static int qcm_sensor_init(struct uvd *uvd) | |||
439 | int ret; | 439 | int ret; |
440 | int i; | 440 | int i; |
441 | 441 | ||
442 | for (i=0; i < sizeof(regval_table)/sizeof(regval_table[0]) ; i++) { | 442 | for (i=0; i < ARRAY_SIZE(regval_table) ; i++) { |
443 | CHECK_RET(ret, qcm_stv_setb(uvd->dev, | 443 | CHECK_RET(ret, qcm_stv_setb(uvd->dev, |
444 | regval_table[i].reg, | 444 | regval_table[i].reg, |
445 | regval_table[i].val)); | 445 | regval_table[i].val)); |
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c index 982b115193f8..2d9c0dd3b733 100644 --- a/drivers/media/video/usbvideo/vicam.c +++ b/drivers/media/video/usbvideo/vicam.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <linux/usb.h> | 42 | #include <linux/usb.h> |
43 | #include <linux/vmalloc.h> | 43 | #include <linux/vmalloc.h> |
44 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
45 | #include <linux/proc_fs.h> | ||
46 | #include <linux/mutex.h> | 45 | #include <linux/mutex.h> |
47 | #include "usbvideo.h" | 46 | #include "usbvideo.h" |
48 | 47 | ||
@@ -417,11 +416,6 @@ struct vicam_camera { | |||
417 | u8 open_count; | 416 | u8 open_count; |
418 | u8 bulkEndpoint; | 417 | u8 bulkEndpoint; |
419 | int needsDummyRead; | 418 | int needsDummyRead; |
420 | |||
421 | #if defined(CONFIG_VIDEO_PROC_FS) | ||
422 | struct proc_dir_entry *proc_dir; | ||
423 | #endif | ||
424 | |||
425 | }; | 419 | }; |
426 | 420 | ||
427 | static int vicam_probe( struct usb_interface *intf, const struct usb_device_id *id); | 421 | static int vicam_probe( struct usb_interface *intf, const struct usb_device_id *id); |
@@ -1065,175 +1059,6 @@ vicam_mmap(struct file *file, struct vm_area_struct *vma) | |||
1065 | return 0; | 1059 | return 0; |
1066 | } | 1060 | } |
1067 | 1061 | ||
1068 | #if defined(CONFIG_VIDEO_PROC_FS) | ||
1069 | |||
1070 | static struct proc_dir_entry *vicam_proc_root = NULL; | ||
1071 | |||
1072 | static int vicam_read_helper(char *page, char **start, off_t off, | ||
1073 | int count, int *eof, int value) | ||
1074 | { | ||
1075 | char *out = page; | ||
1076 | int len; | ||
1077 | |||
1078 | out += sprintf(out, "%d",value); | ||
1079 | |||
1080 | len = out - page; | ||
1081 | len -= off; | ||
1082 | if (len < count) { | ||
1083 | *eof = 1; | ||
1084 | if (len <= 0) | ||
1085 | return 0; | ||
1086 | } else | ||
1087 | len = count; | ||
1088 | |||
1089 | *start = page + off; | ||
1090 | return len; | ||
1091 | } | ||
1092 | |||
1093 | static int vicam_read_proc_shutter(char *page, char **start, off_t off, | ||
1094 | int count, int *eof, void *data) | ||
1095 | { | ||
1096 | return vicam_read_helper(page,start,off,count,eof, | ||
1097 | ((struct vicam_camera *)data)->shutter_speed); | ||
1098 | } | ||
1099 | |||
1100 | static int vicam_read_proc_gain(char *page, char **start, off_t off, | ||
1101 | int count, int *eof, void *data) | ||
1102 | { | ||
1103 | return vicam_read_helper(page,start,off,count,eof, | ||
1104 | ((struct vicam_camera *)data)->gain); | ||
1105 | } | ||
1106 | |||
1107 | static int | ||
1108 | vicam_write_proc_shutter(struct file *file, const char *buffer, | ||
1109 | unsigned long count, void *data) | ||
1110 | { | ||
1111 | u16 stmp; | ||
1112 | char kbuf[8]; | ||
1113 | struct vicam_camera *cam = (struct vicam_camera *) data; | ||
1114 | |||
1115 | if (count > 6) | ||
1116 | return -EINVAL; | ||
1117 | |||
1118 | if (copy_from_user(kbuf, buffer, count)) | ||
1119 | return -EFAULT; | ||
1120 | |||
1121 | stmp = (u16) simple_strtoul(kbuf, NULL, 10); | ||
1122 | if (stmp < 4 || stmp > 32000) | ||
1123 | return -EINVAL; | ||
1124 | |||
1125 | cam->shutter_speed = stmp; | ||
1126 | |||
1127 | return count; | ||
1128 | } | ||
1129 | |||
1130 | static int | ||
1131 | vicam_write_proc_gain(struct file *file, const char *buffer, | ||
1132 | unsigned long count, void *data) | ||
1133 | { | ||
1134 | u16 gtmp; | ||
1135 | char kbuf[8]; | ||
1136 | |||
1137 | struct vicam_camera *cam = (struct vicam_camera *) data; | ||
1138 | |||
1139 | if (count > 4) | ||
1140 | return -EINVAL; | ||
1141 | |||
1142 | if (copy_from_user(kbuf, buffer, count)) | ||
1143 | return -EFAULT; | ||
1144 | |||
1145 | gtmp = (u16) simple_strtoul(kbuf, NULL, 10); | ||
1146 | if (gtmp > 255) | ||
1147 | return -EINVAL; | ||
1148 | cam->gain = gtmp; | ||
1149 | |||
1150 | return count; | ||
1151 | } | ||
1152 | |||
1153 | static void | ||
1154 | vicam_create_proc_root(void) | ||
1155 | { | ||
1156 | vicam_proc_root = proc_mkdir("video/vicam", NULL); | ||
1157 | |||
1158 | if (vicam_proc_root) | ||
1159 | vicam_proc_root->owner = THIS_MODULE; | ||
1160 | else | ||
1161 | printk(KERN_ERR | ||
1162 | "could not create /proc entry for vicam!"); | ||
1163 | } | ||
1164 | |||
1165 | static void | ||
1166 | vicam_destroy_proc_root(void) | ||
1167 | { | ||
1168 | if (vicam_proc_root) | ||
1169 | remove_proc_entry("video/vicam", 0); | ||
1170 | } | ||
1171 | |||
1172 | static void | ||
1173 | vicam_create_proc_entry(struct vicam_camera *cam) | ||
1174 | { | ||
1175 | char name[64]; | ||
1176 | struct proc_dir_entry *ent; | ||
1177 | |||
1178 | DBG(KERN_INFO "vicam: creating proc entry\n"); | ||
1179 | |||
1180 | if (!vicam_proc_root || !cam) { | ||
1181 | printk(KERN_INFO | ||
1182 | "vicam: could not create proc entry, %s pointer is null.\n", | ||
1183 | (!cam ? "camera" : "root")); | ||
1184 | return; | ||
1185 | } | ||
1186 | |||
1187 | sprintf(name, "video%d", cam->vdev.minor); | ||
1188 | |||
1189 | cam->proc_dir = proc_mkdir(name, vicam_proc_root); | ||
1190 | |||
1191 | if ( !cam->proc_dir ) | ||
1192 | return; // FIXME: We should probably return an error here | ||
1193 | |||
1194 | ent = create_proc_entry("shutter", S_IFREG | S_IRUGO | S_IWUSR, | ||
1195 | cam->proc_dir); | ||
1196 | if (ent) { | ||
1197 | ent->data = cam; | ||
1198 | ent->read_proc = vicam_read_proc_shutter; | ||
1199 | ent->write_proc = vicam_write_proc_shutter; | ||
1200 | ent->size = 64; | ||
1201 | } | ||
1202 | |||
1203 | ent = create_proc_entry("gain", S_IFREG | S_IRUGO | S_IWUSR, | ||
1204 | cam->proc_dir); | ||
1205 | if (ent) { | ||
1206 | ent->data = cam; | ||
1207 | ent->read_proc = vicam_read_proc_gain; | ||
1208 | ent->write_proc = vicam_write_proc_gain; | ||
1209 | ent->size = 64; | ||
1210 | } | ||
1211 | } | ||
1212 | |||
1213 | static void | ||
1214 | vicam_destroy_proc_entry(void *ptr) | ||
1215 | { | ||
1216 | struct vicam_camera *cam = (struct vicam_camera *) ptr; | ||
1217 | char name[16]; | ||
1218 | |||
1219 | if ( !cam->proc_dir ) | ||
1220 | return; | ||
1221 | |||
1222 | sprintf(name, "video%d", cam->vdev.minor); | ||
1223 | remove_proc_entry("shutter", cam->proc_dir); | ||
1224 | remove_proc_entry("gain", cam->proc_dir); | ||
1225 | remove_proc_entry(name,vicam_proc_root); | ||
1226 | cam->proc_dir = NULL; | ||
1227 | |||
1228 | } | ||
1229 | |||
1230 | #else | ||
1231 | static inline void vicam_create_proc_root(void) { } | ||
1232 | static inline void vicam_destroy_proc_root(void) { } | ||
1233 | static inline void vicam_create_proc_entry(struct vicam_camera *cam) { } | ||
1234 | static inline void vicam_destroy_proc_entry(void *ptr) { } | ||
1235 | #endif | ||
1236 | |||
1237 | static const struct file_operations vicam_fops = { | 1062 | static const struct file_operations vicam_fops = { |
1238 | .owner = THIS_MODULE, | 1063 | .owner = THIS_MODULE, |
1239 | .open = vicam_open, | 1064 | .open = vicam_open, |
@@ -1330,8 +1155,6 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id) | |||
1330 | return -EIO; | 1155 | return -EIO; |
1331 | } | 1156 | } |
1332 | 1157 | ||
1333 | vicam_create_proc_entry(cam); | ||
1334 | |||
1335 | printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor); | 1158 | printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor); |
1336 | 1159 | ||
1337 | usb_set_intfdata (intf, cam); | 1160 | usb_set_intfdata (intf, cam); |
@@ -1363,8 +1186,6 @@ vicam_disconnect(struct usb_interface *intf) | |||
1363 | 1186 | ||
1364 | cam->udev = NULL; | 1187 | cam->udev = NULL; |
1365 | 1188 | ||
1366 | vicam_destroy_proc_entry(cam); | ||
1367 | |||
1368 | /* the only thing left to do is synchronize with | 1189 | /* the only thing left to do is synchronize with |
1369 | * our close/release function on who should release | 1190 | * our close/release function on who should release |
1370 | * the camera memory. if there are any users using the | 1191 | * the camera memory. if there are any users using the |
@@ -1390,7 +1211,6 @@ usb_vicam_init(void) | |||
1390 | { | 1211 | { |
1391 | int retval; | 1212 | int retval; |
1392 | DBG(KERN_INFO "ViCam-based WebCam driver startup\n"); | 1213 | DBG(KERN_INFO "ViCam-based WebCam driver startup\n"); |
1393 | vicam_create_proc_root(); | ||
1394 | retval = usb_register(&vicam_driver); | 1214 | retval = usb_register(&vicam_driver); |
1395 | if (retval) | 1215 | if (retval) |
1396 | printk(KERN_WARNING "usb_register failed!\n"); | 1216 | printk(KERN_WARNING "usb_register failed!\n"); |
@@ -1404,7 +1224,6 @@ usb_vicam_exit(void) | |||
1404 | "ViCam-based WebCam driver shutdown\n"); | 1224 | "ViCam-based WebCam driver shutdown\n"); |
1405 | 1225 | ||
1406 | usb_deregister(&vicam_driver); | 1226 | usb_deregister(&vicam_driver); |
1407 | vicam_destroy_proc_root(); | ||
1408 | } | 1227 | } |
1409 | 1228 | ||
1410 | module_init(usb_vicam_init); | 1229 | module_init(usb_vicam_init); |
diff --git a/drivers/media/video/usbvision/usbvision-cards.c b/drivers/media/video/usbvision/usbvision-cards.c index 51ab265d566a..380564cd3317 100644 --- a/drivers/media/video/usbvision/usbvision-cards.c +++ b/drivers/media/video/usbvision/usbvision-cards.c | |||
@@ -79,7 +79,7 @@ struct usbvision_device_data_st usbvision_device_data[] = { | |||
79 | .Interface = -1, | 79 | .Interface = -1, |
80 | .Codec = CODEC_SAA7113, | 80 | .Codec = CODEC_SAA7113, |
81 | .VideoChannels = 2, | 81 | .VideoChannels = 2, |
82 | .VideoNorm = V4L2_STD_PAL, | 82 | .VideoNorm = V4L2_STD_NTSC, |
83 | .AudioChannels = 1, | 83 | .AudioChannels = 1, |
84 | .Radio = 0, | 84 | .Radio = 0, |
85 | .vbi = 1, | 85 | .vbi = 1, |
@@ -311,8 +311,8 @@ struct usbvision_device_data_st usbvision_device_data[] = { | |||
311 | .vbi = 1, | 311 | .vbi = 1, |
312 | .Tuner = 1, | 312 | .Tuner = 1, |
313 | .TunerType = TUNER_PHILIPS_SECAM, | 313 | .TunerType = TUNER_PHILIPS_SECAM, |
314 | .X_Offset = -1, | 314 | .X_Offset = 0x80, |
315 | .Y_Offset = -1, | 315 | .Y_Offset = 0x16, |
316 | .ModelString = "Hauppauge WinTV USB (PAL/SECAM L)", | 316 | .ModelString = "Hauppauge WinTV USB (PAL/SECAM L)", |
317 | }, | 317 | }, |
318 | [HPG_WINTV_PAL_D_K] = { | 318 | [HPG_WINTV_PAL_D_K] = { |
@@ -586,7 +586,7 @@ struct usbvision_device_data_st usbvision_device_data[] = { | |||
586 | .Radio = 0, | 586 | .Radio = 0, |
587 | .vbi = 1, | 587 | .vbi = 1, |
588 | .Tuner = 1, | 588 | .Tuner = 1, |
589 | .TunerType = TUNER_PHILIPS_PAL, | 589 | .TunerType = TUNER_LG_PAL_NEW_TAPC, |
590 | .X_Offset = 0, | 590 | .X_Offset = 0, |
591 | .Y_Offset = 3, | 591 | .Y_Offset = 3, |
592 | .Dvi_yuv_override = 1, | 592 | .Dvi_yuv_override = 1, |
diff --git a/drivers/media/video/usbvision/usbvision-core.c b/drivers/media/video/usbvision/usbvision-core.c index 7df071eb0a3b..5b1e346df206 100644 --- a/drivers/media/video/usbvision/usbvision-core.c +++ b/drivers/media/video/usbvision/usbvision-core.c | |||
@@ -1742,7 +1742,7 @@ static int usbvision_set_video_format(struct usb_usbvision *usbvision, int forma | |||
1742 | format = ISOC_MODE_YUV420; | 1742 | format = ISOC_MODE_YUV420; |
1743 | } | 1743 | } |
1744 | value[0] = 0x0A; //TODO: See the effect of the filter | 1744 | value[0] = 0x0A; //TODO: See the effect of the filter |
1745 | value[1] = format; | 1745 | value[1] = format; // Sets the VO_MODE register which follows FILT_CONT |
1746 | rc = usb_control_msg(usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1), | 1746 | rc = usb_control_msg(usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1), |
1747 | USBVISION_OP_CODE, | 1747 | USBVISION_OP_CODE, |
1748 | USB_DIR_OUT | USB_TYPE_VENDOR | | 1748 | USB_DIR_OUT | USB_TYPE_VENDOR | |
@@ -1831,10 +1831,10 @@ int usbvision_set_output(struct usb_usbvision *usbvision, int width, | |||
1831 | frameRate = FRAMERATE_MAX; | 1831 | frameRate = FRAMERATE_MAX; |
1832 | } | 1832 | } |
1833 | 1833 | ||
1834 | if (usbvision->tvnorm->id & V4L2_STD_625_50) { | 1834 | if (usbvision->tvnormId & V4L2_STD_625_50) { |
1835 | frameDrop = frameRate * 32 / 25 - 1; | 1835 | frameDrop = frameRate * 32 / 25 - 1; |
1836 | } | 1836 | } |
1837 | else if (usbvision->tvnorm->id & V4L2_STD_525_60) { | 1837 | else if (usbvision->tvnormId & V4L2_STD_525_60) { |
1838 | frameDrop = frameRate * 32 / 30 - 1; | 1838 | frameDrop = frameRate * 32 / 30 - 1; |
1839 | } | 1839 | } |
1840 | 1840 | ||
@@ -2067,7 +2067,7 @@ int usbvision_set_input(struct usb_usbvision *usbvision) | |||
2067 | } | 2067 | } |
2068 | 2068 | ||
2069 | 2069 | ||
2070 | if (usbvision->tvnorm->id & V4L2_STD_PAL) { | 2070 | if (usbvision->tvnormId & V4L2_STD_PAL) { |
2071 | value[0] = 0xC0; | 2071 | value[0] = 0xC0; |
2072 | value[1] = 0x02; //0x02C0 -> 704 Input video line length | 2072 | value[1] = 0x02; //0x02C0 -> 704 Input video line length |
2073 | value[2] = 0x20; | 2073 | value[2] = 0x20; |
@@ -2076,7 +2076,7 @@ int usbvision_set_input(struct usb_usbvision *usbvision) | |||
2076 | value[5] = 0x00; //0x0060 -> 96 Input video h offset | 2076 | value[5] = 0x00; //0x0060 -> 96 Input video h offset |
2077 | value[6] = 0x16; | 2077 | value[6] = 0x16; |
2078 | value[7] = 0x00; //0x0016 -> 22 Input video v offset | 2078 | value[7] = 0x00; //0x0016 -> 22 Input video v offset |
2079 | } else if (usbvision->tvnorm->id & V4L2_STD_SECAM) { | 2079 | } else if (usbvision->tvnormId & V4L2_STD_SECAM) { |
2080 | value[0] = 0xC0; | 2080 | value[0] = 0xC0; |
2081 | value[1] = 0x02; //0x02C0 -> 704 Input video line length | 2081 | value[1] = 0x02; //0x02C0 -> 704 Input video line length |
2082 | value[2] = 0x20; | 2082 | value[2] = 0x20; |
@@ -2537,7 +2537,9 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision) | |||
2537 | 2537 | ||
2538 | int usbvision_muxsel(struct usb_usbvision *usbvision, int channel) | 2538 | int usbvision_muxsel(struct usb_usbvision *usbvision, int channel) |
2539 | { | 2539 | { |
2540 | int mode[4]; | 2540 | /* inputs #0 and #3 are constant for every SAA711x. */ |
2541 | /* inputs #1 and #2 are variable for SAA7111 and SAA7113 */ | ||
2542 | int mode[4]= {SAA7115_COMPOSITE0, 0, 0, SAA7115_COMPOSITE3}; | ||
2541 | int audio[]= {1, 0, 0, 0}; | 2543 | int audio[]= {1, 0, 0, 0}; |
2542 | struct v4l2_routing route; | 2544 | struct v4l2_routing route; |
2543 | //channel 0 is TV with audiochannel 1 (tuner mono) | 2545 | //channel 0 is TV with audiochannel 1 (tuner mono) |
@@ -2547,10 +2549,6 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int channel) | |||
2547 | 2549 | ||
2548 | RESTRICT_TO_RANGE(channel, 0, usbvision->video_inputs); | 2550 | RESTRICT_TO_RANGE(channel, 0, usbvision->video_inputs); |
2549 | usbvision->ctl_input = channel; | 2551 | usbvision->ctl_input = channel; |
2550 | route.input = SAA7115_COMPOSITE1; | ||
2551 | route.output = 0; | ||
2552 | call_i2c_clients(usbvision, VIDIOC_INT_S_VIDEO_ROUTING,&route); | ||
2553 | call_i2c_clients(usbvision, VIDIOC_S_INPUT, &usbvision->ctl_input); | ||
2554 | 2552 | ||
2555 | // set the new channel | 2553 | // set the new channel |
2556 | // Regular USB TV Tuners -> channel: 0 = Television, 1 = Composite, 2 = S-Video | 2554 | // Regular USB TV Tuners -> channel: 0 = Television, 1 = Composite, 2 = S-Video |
@@ -2558,28 +2556,27 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int channel) | |||
2558 | 2556 | ||
2559 | switch (usbvision_device_data[usbvision->DevModel].Codec) { | 2557 | switch (usbvision_device_data[usbvision->DevModel].Codec) { |
2560 | case CODEC_SAA7113: | 2558 | case CODEC_SAA7113: |
2561 | if (SwitchSVideoInput) { // To handle problems with S-Video Input for some devices. Use SwitchSVideoInput parameter when loading the module. | 2559 | mode[1] = SAA7115_COMPOSITE2; |
2562 | mode[2] = 1; | 2560 | if (SwitchSVideoInput) { |
2561 | /* To handle problems with S-Video Input for | ||
2562 | * some devices. Use SwitchSVideoInput | ||
2563 | * parameter when loading the module.*/ | ||
2564 | mode[2] = SAA7115_COMPOSITE1; | ||
2563 | } | 2565 | } |
2564 | else { | 2566 | else { |
2565 | mode[2] = 7; | 2567 | mode[2] = SAA7115_SVIDEO1; |
2566 | } | ||
2567 | if (usbvision_device_data[usbvision->DevModel].VideoChannels == 4) { | ||
2568 | mode[0] = 0; mode[1] = 2; mode[3] = 3; // Special for four input devices | ||
2569 | } | ||
2570 | else { | ||
2571 | mode[0] = 0; mode[1] = 2; //modes for regular saa7113 devices | ||
2572 | } | 2568 | } |
2573 | break; | 2569 | break; |
2574 | case CODEC_SAA7111: | 2570 | case CODEC_SAA7111: |
2575 | mode[0] = 0; mode[1] = 1; mode[2] = 7; //modes for saa7111 | ||
2576 | break; | ||
2577 | default: | 2571 | default: |
2578 | mode[0] = 0; mode[1] = 1; mode[2] = 7; //default modes | 2572 | /* modes for saa7111 */ |
2573 | mode[1] = SAA7115_COMPOSITE1; | ||
2574 | mode[2] = SAA7115_SVIDEO1; | ||
2575 | break; | ||
2579 | } | 2576 | } |
2580 | route.input = mode[channel]; | 2577 | route.input = mode[channel]; |
2578 | route.output = 0; | ||
2581 | call_i2c_clients(usbvision, VIDIOC_INT_S_VIDEO_ROUTING,&route); | 2579 | call_i2c_clients(usbvision, VIDIOC_INT_S_VIDEO_ROUTING,&route); |
2582 | usbvision->channel = channel; | ||
2583 | usbvision_set_audio(usbvision, audio[channel]); | 2580 | usbvision_set_audio(usbvision, audio[channel]); |
2584 | return 0; | 2581 | return 0; |
2585 | } | 2582 | } |
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index aa3258bbb4af..868b6886fe7f 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -36,7 +36,8 @@ | |||
36 | * - use submit_urb for all setup packets | 36 | * - use submit_urb for all setup packets |
37 | * - Fix memory settings for nt1004. It is 4 times as big as the | 37 | * - Fix memory settings for nt1004. It is 4 times as big as the |
38 | * nt1003 memory. | 38 | * nt1003 memory. |
39 | * - Add audio on endpoint 3 for nt1004 chip. Seems impossible, needs a codec interface. Which one? | 39 | * - Add audio on endpoint 3 for nt1004 chip. |
40 | * Seems impossible, needs a codec interface. Which one? | ||
40 | * - Clean up the driver. | 41 | * - Clean up the driver. |
41 | * - optimization for performance. | 42 | * - optimization for performance. |
42 | * - Add Videotext capability (VBI). Working on it..... | 43 | * - Add Videotext capability (VBI). Working on it..... |
@@ -77,7 +78,8 @@ | |||
77 | #include "usbvision.h" | 78 | #include "usbvision.h" |
78 | #include "usbvision-cards.h" | 79 | #include "usbvision-cards.h" |
79 | 80 | ||
80 | #define DRIVER_AUTHOR "Joerg Heckenbach <joerg@heckenbach-aw.de>, Dwaine Garden <DwaineGarden@rogers.com>" | 81 | #define DRIVER_AUTHOR "Joerg Heckenbach <joerg@heckenbach-aw.de>,\ |
82 | Dwaine Garden <DwaineGarden@rogers.com>" | ||
81 | #define DRIVER_NAME "usbvision" | 83 | #define DRIVER_NAME "usbvision" |
82 | #define DRIVER_ALIAS "USBVision" | 84 | #define DRIVER_ALIAS "USBVision" |
83 | #define DRIVER_DESC "USBVision USB Video Device Driver for Linux" | 85 | #define DRIVER_DESC "USBVision USB Video Device Driver for Linux" |
@@ -85,20 +87,25 @@ | |||
85 | #define USBVISION_DRIVER_VERSION_MAJOR 0 | 87 | #define USBVISION_DRIVER_VERSION_MAJOR 0 |
86 | #define USBVISION_DRIVER_VERSION_MINOR 9 | 88 | #define USBVISION_DRIVER_VERSION_MINOR 9 |
87 | #define USBVISION_DRIVER_VERSION_PATCHLEVEL 9 | 89 | #define USBVISION_DRIVER_VERSION_PATCHLEVEL 9 |
88 | #define USBVISION_DRIVER_VERSION KERNEL_VERSION(USBVISION_DRIVER_VERSION_MAJOR,USBVISION_DRIVER_VERSION_MINOR,USBVISION_DRIVER_VERSION_PATCHLEVEL) | 90 | #define USBVISION_DRIVER_VERSION KERNEL_VERSION(USBVISION_DRIVER_VERSION_MAJOR,\ |
89 | #define USBVISION_VERSION_STRING __stringify(USBVISION_DRIVER_VERSION_MAJOR) "." __stringify(USBVISION_DRIVER_VERSION_MINOR) "." __stringify(USBVISION_DRIVER_VERSION_PATCHLEVEL) | 91 | USBVISION_DRIVER_VERSION_MINOR,\ |
92 | USBVISION_DRIVER_VERSION_PATCHLEVEL) | ||
93 | #define USBVISION_VERSION_STRING __stringify(USBVISION_DRIVER_VERSION_MAJOR)\ | ||
94 | "." __stringify(USBVISION_DRIVER_VERSION_MINOR)\ | ||
95 | "." __stringify(USBVISION_DRIVER_VERSION_PATCHLEVEL) | ||
90 | 96 | ||
91 | #define ENABLE_HEXDUMP 0 /* Enable if you need it */ | 97 | #define ENABLE_HEXDUMP 0 /* Enable if you need it */ |
92 | 98 | ||
93 | 99 | ||
94 | #ifdef USBVISION_DEBUG | 100 | #ifdef USBVISION_DEBUG |
95 | #define PDEBUG(level, fmt, args...) \ | 101 | #define PDEBUG(level, fmt, args...) \ |
96 | if (video_debug & (level)) info("[%s:%d] " fmt, __PRETTY_FUNCTION__, __LINE__ , ## args) | 102 | if (video_debug & (level)) \ |
103 | info("[%s:%d] " fmt, __PRETTY_FUNCTION__, __LINE__ ,\ | ||
104 | ## args) | ||
97 | #else | 105 | #else |
98 | #define PDEBUG(level, fmt, args...) do {} while(0) | 106 | #define PDEBUG(level, fmt, args...) do {} while(0) |
99 | #endif | 107 | #endif |
100 | 108 | ||
101 | #define DBG_IOCTL 1<<0 | ||
102 | #define DBG_IO 1<<1 | 109 | #define DBG_IO 1<<1 |
103 | #define DBG_PROBE 1<<2 | 110 | #define DBG_PROBE 1<<2 |
104 | #define DBG_MMAP 1<<3 | 111 | #define DBG_MMAP 1<<3 |
@@ -108,7 +115,8 @@ | |||
108 | #define goto2next(str) while(*str!=' ') str++; while(*str==' ') str++; | 115 | #define goto2next(str) while(*str!=' ') str++; while(*str==' ') str++; |
109 | 116 | ||
110 | 117 | ||
111 | static int usbvision_nr = 0; // sequential number of usbvision device | 118 | /* sequential number of usbvision device */ |
119 | static int usbvision_nr = 0; | ||
112 | 120 | ||
113 | static struct usbvision_v4l2_format_st usbvision_v4l2_format[] = { | 121 | static struct usbvision_v4l2_format_st usbvision_v4l2_format[] = { |
114 | { 1, 1, 8, V4L2_PIX_FMT_GREY , "GREY" }, | 122 | { 1, 1, 8, V4L2_PIX_FMT_GREY , "GREY" }, |
@@ -121,55 +129,32 @@ static struct usbvision_v4l2_format_st usbvision_v4l2_format[] = { | |||
121 | { 1, 2, 16, V4L2_PIX_FMT_YUV422P , "YUV422P" } | 129 | { 1, 2, 16, V4L2_PIX_FMT_YUV422P , "YUV422P" } |
122 | }; | 130 | }; |
123 | 131 | ||
124 | /* supported tv norms */ | 132 | /* Function prototypes */ |
125 | static struct usbvision_tvnorm tvnorms[] = { | ||
126 | { | ||
127 | .name = "PAL", | ||
128 | .id = V4L2_STD_PAL, | ||
129 | }, { | ||
130 | .name = "NTSC", | ||
131 | .id = V4L2_STD_NTSC, | ||
132 | }, { | ||
133 | .name = "SECAM", | ||
134 | .id = V4L2_STD_SECAM, | ||
135 | }, { | ||
136 | .name = "PAL-M", | ||
137 | .id = V4L2_STD_PAL_M, | ||
138 | } | ||
139 | }; | ||
140 | |||
141 | #define TVNORMS ARRAY_SIZE(tvnorms) | ||
142 | |||
143 | // Function prototypes | ||
144 | static void usbvision_release(struct usb_usbvision *usbvision); | 133 | static void usbvision_release(struct usb_usbvision *usbvision); |
145 | 134 | ||
146 | // Default initalization of device driver parameters | 135 | /* Default initalization of device driver parameters */ |
147 | static int isocMode = ISOC_MODE_COMPRESS; // Set the default format for ISOC endpoint | 136 | /* Set the default format for ISOC endpoint */ |
148 | static int video_debug = 0; // Set the default Debug Mode of the device driver | 137 | static int isocMode = ISOC_MODE_COMPRESS; |
149 | static int PowerOnAtOpen = 1; // Set the default device to power on at startup | 138 | /* Set the default Debug Mode of the device driver */ |
150 | static int video_nr = -1; // Sequential Number of Video Device | 139 | static int video_debug = 0; |
151 | static int radio_nr = -1; // Sequential Number of Radio Device | 140 | /* Set the default device to power on at startup */ |
152 | static int vbi_nr = -1; // Sequential Number of VBI Device | 141 | static int PowerOnAtOpen = 1; |
153 | 142 | /* Sequential Number of Video Device */ | |
154 | // Grab parameters for the device driver | 143 | static int video_nr = -1; |
155 | 144 | /* Sequential Number of Radio Device */ | |
156 | #if defined(module_param) // Showing parameters under SYSFS | 145 | static int radio_nr = -1; |
146 | /* Sequential Number of VBI Device */ | ||
147 | static int vbi_nr = -1; | ||
148 | |||
149 | /* Grab parameters for the device driver */ | ||
150 | |||
151 | /* Showing parameters under SYSFS */ | ||
157 | module_param(isocMode, int, 0444); | 152 | module_param(isocMode, int, 0444); |
158 | module_param(video_debug, int, 0444); | 153 | module_param(video_debug, int, 0444); |
159 | module_param(PowerOnAtOpen, int, 0444); | 154 | module_param(PowerOnAtOpen, int, 0444); |
160 | module_param(video_nr, int, 0444); | 155 | module_param(video_nr, int, 0444); |
161 | module_param(radio_nr, int, 0444); | 156 | module_param(radio_nr, int, 0444); |
162 | module_param(vbi_nr, int, 0444); | 157 | module_param(vbi_nr, int, 0444); |
163 | #else // Old Style | ||
164 | MODULE_PARAM(isocMode, "i"); | ||
165 | MODULE_PARM(video_debug, "i"); // Grab the Debug Mode of the device driver | ||
166 | MODULE_PARM(adjustCompression, "i"); // Grab the compression to be adaptive | ||
167 | MODULE_PARM(PowerOnAtOpen, "i"); // Grab the device to power on at startup | ||
168 | MODULE_PARM(SwitchSVideoInput, "i"); // To help people with Black and White output with using s-video input. Some cables and input device are wired differently. | ||
169 | MODULE_PARM(video_nr, "i"); // video_nr option allows to specify a certain /dev/videoX device (like /dev/video0 or /dev/video1 ...) | ||
170 | MODULE_PARM(radio_nr, "i"); // radio_nr option allows to specify a certain /dev/radioX device (like /dev/radio0 or /dev/radio1 ...) | ||
171 | MODULE_PARM(vbi_nr, "i"); // vbi_nr option allows to specify a certain /dev/vbiX device (like /dev/vbi0 or /dev/vbi1 ...) | ||
172 | #endif | ||
173 | 158 | ||
174 | MODULE_PARM_DESC(isocMode, " Set the default format for ISOC endpoint. Default: 0x60 (Compression On)"); | 159 | MODULE_PARM_DESC(isocMode, " Set the default format for ISOC endpoint. Default: 0x60 (Compression On)"); |
175 | MODULE_PARM_DESC(video_debug, " Set the default Debug Mode of the device driver. Default: 0 (Off)"); | 160 | MODULE_PARM_DESC(video_debug, " Set the default Debug Mode of the device driver. Default: 0 (Off)"); |
@@ -187,19 +172,21 @@ MODULE_VERSION(USBVISION_VERSION_STRING); | |||
187 | MODULE_ALIAS(DRIVER_ALIAS); | 172 | MODULE_ALIAS(DRIVER_ALIAS); |
188 | 173 | ||
189 | 174 | ||
190 | /****************************************************************************************/ | 175 | /*****************************************************************************/ |
191 | /* SYSFS Code - Copied from the stv680.c usb module. */ | 176 | /* SYSFS Code - Copied from the stv680.c usb module. */ |
192 | /* Device information is located at /sys/class/video4linux/video0 */ | 177 | /* Device information is located at /sys/class/video4linux/video0 */ |
193 | /* Device parameters information is located at /sys/module/usbvision */ | 178 | /* Device parameters information is located at /sys/module/usbvision */ |
194 | /* Device USB Information is located at /sys/bus/usb/drivers/USBVision Video Grabber */ | 179 | /* Device USB Information is located at */ |
195 | /****************************************************************************************/ | 180 | /* /sys/bus/usb/drivers/USBVision Video Grabber */ |
181 | /*****************************************************************************/ | ||
196 | 182 | ||
197 | 183 | ||
198 | #define YES_NO(x) ((x) ? "Yes" : "No") | 184 | #define YES_NO(x) ((x) ? "Yes" : "No") |
199 | 185 | ||
200 | static inline struct usb_usbvision *cd_to_usbvision(struct class_device *cd) | 186 | static inline struct usb_usbvision *cd_to_usbvision(struct class_device *cd) |
201 | { | 187 | { |
202 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); | 188 | struct video_device *vdev = |
189 | container_of(cd, struct video_device, class_dev); | ||
203 | return video_get_drvdata(vdev); | 190 | return video_get_drvdata(vdev); |
204 | } | 191 | } |
205 | 192 | ||
@@ -211,15 +198,18 @@ static CLASS_DEVICE_ATTR(version, S_IRUGO, show_version, NULL); | |||
211 | 198 | ||
212 | static ssize_t show_model(struct class_device *cd, char *buf) | 199 | static ssize_t show_model(struct class_device *cd, char *buf) |
213 | { | 200 | { |
214 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); | 201 | struct video_device *vdev = |
202 | container_of(cd, struct video_device, class_dev); | ||
215 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 203 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
216 | return sprintf(buf, "%s\n", usbvision_device_data[usbvision->DevModel].ModelString); | 204 | return sprintf(buf, "%s\n", |
205 | usbvision_device_data[usbvision->DevModel].ModelString); | ||
217 | } | 206 | } |
218 | static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL); | 207 | static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL); |
219 | 208 | ||
220 | static ssize_t show_hue(struct class_device *cd, char *buf) | 209 | static ssize_t show_hue(struct class_device *cd, char *buf) |
221 | { | 210 | { |
222 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); | 211 | struct video_device *vdev = |
212 | container_of(cd, struct video_device, class_dev); | ||
223 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 213 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
224 | struct v4l2_control ctrl; | 214 | struct v4l2_control ctrl; |
225 | ctrl.id = V4L2_CID_HUE; | 215 | ctrl.id = V4L2_CID_HUE; |
@@ -232,7 +222,8 @@ static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); | |||
232 | 222 | ||
233 | static ssize_t show_contrast(struct class_device *cd, char *buf) | 223 | static ssize_t show_contrast(struct class_device *cd, char *buf) |
234 | { | 224 | { |
235 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); | 225 | struct video_device *vdev = |
226 | container_of(cd, struct video_device, class_dev); | ||
236 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 227 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
237 | struct v4l2_control ctrl; | 228 | struct v4l2_control ctrl; |
238 | ctrl.id = V4L2_CID_CONTRAST; | 229 | ctrl.id = V4L2_CID_CONTRAST; |
@@ -245,7 +236,8 @@ static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); | |||
245 | 236 | ||
246 | static ssize_t show_brightness(struct class_device *cd, char *buf) | 237 | static ssize_t show_brightness(struct class_device *cd, char *buf) |
247 | { | 238 | { |
248 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); | 239 | struct video_device *vdev = |
240 | container_of(cd, struct video_device, class_dev); | ||
249 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 241 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
250 | struct v4l2_control ctrl; | 242 | struct v4l2_control ctrl; |
251 | ctrl.id = V4L2_CID_BRIGHTNESS; | 243 | ctrl.id = V4L2_CID_BRIGHTNESS; |
@@ -258,7 +250,8 @@ static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); | |||
258 | 250 | ||
259 | static ssize_t show_saturation(struct class_device *cd, char *buf) | 251 | static ssize_t show_saturation(struct class_device *cd, char *buf) |
260 | { | 252 | { |
261 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); | 253 | struct video_device *vdev = |
254 | container_of(cd, struct video_device, class_dev); | ||
262 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 255 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
263 | struct v4l2_control ctrl; | 256 | struct v4l2_control ctrl; |
264 | ctrl.id = V4L2_CID_SATURATION; | 257 | ctrl.id = V4L2_CID_SATURATION; |
@@ -271,23 +264,28 @@ static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); | |||
271 | 264 | ||
272 | static ssize_t show_streaming(struct class_device *cd, char *buf) | 265 | static ssize_t show_streaming(struct class_device *cd, char *buf) |
273 | { | 266 | { |
274 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); | 267 | struct video_device *vdev = |
268 | container_of(cd, struct video_device, class_dev); | ||
275 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 269 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
276 | return sprintf(buf, "%s\n", YES_NO(usbvision->streaming==Stream_On?1:0)); | 270 | return sprintf(buf, "%s\n", |
271 | YES_NO(usbvision->streaming==Stream_On?1:0)); | ||
277 | } | 272 | } |
278 | static CLASS_DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL); | 273 | static CLASS_DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL); |
279 | 274 | ||
280 | static ssize_t show_compression(struct class_device *cd, char *buf) | 275 | static ssize_t show_compression(struct class_device *cd, char *buf) |
281 | { | 276 | { |
282 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); | 277 | struct video_device *vdev = |
278 | container_of(cd, struct video_device, class_dev); | ||
283 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 279 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
284 | return sprintf(buf, "%s\n", YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS)); | 280 | return sprintf(buf, "%s\n", |
281 | YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS)); | ||
285 | } | 282 | } |
286 | static CLASS_DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL); | 283 | static CLASS_DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL); |
287 | 284 | ||
288 | static ssize_t show_device_bridge(struct class_device *cd, char *buf) | 285 | static ssize_t show_device_bridge(struct class_device *cd, char *buf) |
289 | { | 286 | { |
290 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); | 287 | struct video_device *vdev = |
288 | container_of(cd, struct video_device, class_dev); | ||
291 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 289 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
292 | return sprintf(buf, "%d\n", usbvision->bridgeType); | 290 | return sprintf(buf, "%d\n", usbvision->bridgeType); |
293 | } | 291 | } |
@@ -376,7 +374,8 @@ static void usbvision_remove_sysfs(struct video_device *vdev) | |||
376 | static int usbvision_v4l2_open(struct inode *inode, struct file *file) | 374 | static int usbvision_v4l2_open(struct inode *inode, struct file *file) |
377 | { | 375 | { |
378 | struct video_device *dev = video_devdata(file); | 376 | struct video_device *dev = video_devdata(file); |
379 | struct usb_usbvision *usbvision = (struct usb_usbvision *) video_get_drvdata(dev); | 377 | struct usb_usbvision *usbvision = |
378 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
380 | int errCode = 0; | 379 | int errCode = 0; |
381 | 380 | ||
382 | PDEBUG(DBG_IO, "open"); | 381 | PDEBUG(DBG_IO, "open"); |
@@ -390,7 +389,8 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file) | |||
390 | /* Allocate memory for the scratch ring buffer */ | 389 | /* Allocate memory for the scratch ring buffer */ |
391 | errCode = usbvision_scratch_alloc(usbvision); | 390 | errCode = usbvision_scratch_alloc(usbvision); |
392 | if (isocMode==ISOC_MODE_COMPRESS) { | 391 | if (isocMode==ISOC_MODE_COMPRESS) { |
393 | /* Allocate intermediate decompression buffers only if needed */ | 392 | /* Allocate intermediate decompression buffers |
393 | only if needed */ | ||
394 | errCode = usbvision_decompress_alloc(usbvision); | 394 | errCode = usbvision_decompress_alloc(usbvision); |
395 | } | 395 | } |
396 | if (errCode) { | 396 | if (errCode) { |
@@ -421,11 +421,10 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file) | |||
421 | if (!errCode) { | 421 | if (!errCode) { |
422 | usbvision_begin_streaming(usbvision); | 422 | usbvision_begin_streaming(usbvision); |
423 | errCode = usbvision_init_isoc(usbvision); | 423 | errCode = usbvision_init_isoc(usbvision); |
424 | /* device needs to be initialized before isoc transfer */ | 424 | /* device must be initialized before isoc transfer */ |
425 | usbvision_muxsel(usbvision,0); | 425 | usbvision_muxsel(usbvision,0); |
426 | usbvision->user++; | 426 | usbvision->user++; |
427 | } | 427 | } else { |
428 | else { | ||
429 | if (PowerOnAtOpen) { | 428 | if (PowerOnAtOpen) { |
430 | usbvision_i2c_unregister(usbvision); | 429 | usbvision_i2c_unregister(usbvision); |
431 | usbvision_power_off(usbvision); | 430 | usbvision_power_off(usbvision); |
@@ -456,7 +455,8 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file) | |||
456 | static int usbvision_v4l2_close(struct inode *inode, struct file *file) | 455 | static int usbvision_v4l2_close(struct inode *inode, struct file *file) |
457 | { | 456 | { |
458 | struct video_device *dev = video_devdata(file); | 457 | struct video_device *dev = video_devdata(file); |
459 | struct usb_usbvision *usbvision = (struct usb_usbvision *) video_get_drvdata(dev); | 458 | struct usb_usbvision *usbvision = |
459 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
460 | 460 | ||
461 | PDEBUG(DBG_IO, "close"); | 461 | PDEBUG(DBG_IO, "close"); |
462 | down(&usbvision->lock); | 462 | down(&usbvision->lock); |
@@ -473,7 +473,8 @@ static int usbvision_v4l2_close(struct inode *inode, struct file *file) | |||
473 | usbvision->user--; | 473 | usbvision->user--; |
474 | 474 | ||
475 | if (PowerOnAtOpen) { | 475 | if (PowerOnAtOpen) { |
476 | /* power off in a little while to avoid off/on every close/open short sequences */ | 476 | /* power off in a little while |
477 | to avoid off/on every close/open short sequences */ | ||
477 | usbvision_set_powerOffTimer(usbvision); | 478 | usbvision_set_powerOffTimer(usbvision); |
478 | usbvision->initialized = 0; | 479 | usbvision->initialized = 0; |
479 | } | 480 | } |
@@ -498,583 +499,612 @@ static int usbvision_v4l2_close(struct inode *inode, struct file *file) | |||
498 | * This is part of Video 4 Linux API. The procedure handles ioctl() calls. | 499 | * This is part of Video 4 Linux API. The procedure handles ioctl() calls. |
499 | * | 500 | * |
500 | */ | 501 | */ |
501 | static int usbvision_v4l2_do_ioctl(struct inode *inode, struct file *file, | 502 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
502 | unsigned int cmd, void *arg) | 503 | static int vidioc_g_register (struct file *file, void *priv, |
504 | struct v4l2_register *reg) | ||
503 | { | 505 | { |
504 | struct video_device *dev = video_devdata(file); | 506 | struct video_device *dev = video_devdata(file); |
505 | struct usb_usbvision *usbvision = (struct usb_usbvision *) video_get_drvdata(dev); | 507 | struct usb_usbvision *usbvision = |
506 | 508 | (struct usb_usbvision *) video_get_drvdata(dev); | |
507 | if (!USBVISION_IS_OPERATIONAL(usbvision)) | 509 | int errCode; |
508 | return -EFAULT; | ||
509 | 510 | ||
510 | switch (cmd) { | 511 | if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) |
512 | return -EINVAL; | ||
513 | /* NT100x has a 8-bit register space */ | ||
514 | errCode = usbvision_read_reg(usbvision, reg->reg&0xff); | ||
515 | if (errCode < 0) { | ||
516 | err("%s: VIDIOC_DBG_G_REGISTER failed: error %d", | ||
517 | __FUNCTION__, errCode); | ||
518 | return errCode; | ||
519 | } | ||
520 | return 0; | ||
521 | } | ||
511 | 522 | ||
512 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 523 | static int vidioc_s_register (struct file *file, void *priv, |
513 | /* ioctls to allow direct acces to the NT100x registers */ | 524 | struct v4l2_register *reg) |
514 | case VIDIOC_DBG_G_REGISTER: | 525 | { |
515 | case VIDIOC_DBG_S_REGISTER: | 526 | struct video_device *dev = video_devdata(file); |
516 | { | 527 | struct usb_usbvision *usbvision = |
517 | struct v4l2_register *reg = arg; | 528 | (struct usb_usbvision *) video_get_drvdata(dev); |
518 | int errCode; | 529 | int errCode; |
519 | |||
520 | if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) | ||
521 | return -EINVAL; | ||
522 | if (!capable(CAP_SYS_ADMIN)) | ||
523 | return -EPERM; | ||
524 | /* NT100x has a 8-bit register space */ | ||
525 | if (cmd == VIDIOC_DBG_G_REGISTER) | ||
526 | errCode = usbvision_read_reg(usbvision, reg->reg&0xff); | ||
527 | else | ||
528 | errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val); | ||
529 | if (errCode < 0) { | ||
530 | err("%s: VIDIOC_DBG_%c_REGISTER failed: error %d", __FUNCTION__, | ||
531 | cmd == VIDIOC_DBG_G_REGISTER ? 'G' : 'S', errCode); | ||
532 | return errCode; | ||
533 | } | ||
534 | if (cmd == VIDIOC_DBG_S_REGISTER) | ||
535 | reg->val = (u8)errCode; | ||
536 | 530 | ||
537 | PDEBUG(DBG_IOCTL, "VIDIOC_DBG_%c_REGISTER reg=0x%02X, value=0x%02X", | 531 | if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) |
538 | cmd == VIDIOC_DBG_G_REGISTER ? 'G' : 'S', | 532 | return -EINVAL; |
539 | (unsigned int)reg->reg, (unsigned int)reg->val); | 533 | /* NT100x has a 8-bit register space */ |
540 | return 0; | 534 | reg->val = (u8)usbvision_write_reg(usbvision, reg->reg&0xff, reg->val); |
541 | } | 535 | if (reg->val < 0) { |
536 | err("%s: VIDIOC_DBG_S_REGISTER failed: error %d", | ||
537 | __FUNCTION__, errCode); | ||
538 | return errCode; | ||
539 | } | ||
540 | return 0; | ||
541 | } | ||
542 | #endif | 542 | #endif |
543 | case VIDIOC_QUERYCAP: | 543 | |
544 | { | 544 | static int vidioc_querycap (struct file *file, void *priv, |
545 | struct v4l2_capability *vc=arg; | 545 | struct v4l2_capability *vc) |
546 | 546 | { | |
547 | memset(vc, 0, sizeof(*vc)); | 547 | struct video_device *dev = video_devdata(file); |
548 | strlcpy(vc->driver, "USBVision", sizeof(vc->driver)); | 548 | struct usb_usbvision *usbvision = |
549 | strlcpy(vc->card, usbvision_device_data[usbvision->DevModel].ModelString, | 549 | (struct usb_usbvision *) video_get_drvdata(dev); |
550 | sizeof(vc->card)); | 550 | |
551 | strlcpy(vc->bus_info, usbvision->dev->dev.bus_id, | 551 | strlcpy(vc->driver, "USBVision", sizeof(vc->driver)); |
552 | sizeof(vc->bus_info)); | 552 | strlcpy(vc->card, |
553 | vc->version = USBVISION_DRIVER_VERSION; | 553 | usbvision_device_data[usbvision->DevModel].ModelString, |
554 | vc->capabilities = V4L2_CAP_VIDEO_CAPTURE | | 554 | sizeof(vc->card)); |
555 | V4L2_CAP_AUDIO | | 555 | strlcpy(vc->bus_info, usbvision->dev->dev.bus_id, |
556 | V4L2_CAP_READWRITE | | 556 | sizeof(vc->bus_info)); |
557 | V4L2_CAP_STREAMING | | 557 | vc->version = USBVISION_DRIVER_VERSION; |
558 | (usbvision->have_tuner ? V4L2_CAP_TUNER : 0); | 558 | vc->capabilities = V4L2_CAP_VIDEO_CAPTURE | |
559 | PDEBUG(DBG_IOCTL, "VIDIOC_QUERYCAP"); | 559 | V4L2_CAP_AUDIO | |
560 | return 0; | 560 | V4L2_CAP_READWRITE | |
561 | } | 561 | V4L2_CAP_STREAMING | |
562 | case VIDIOC_ENUMINPUT: | 562 | (usbvision->have_tuner ? V4L2_CAP_TUNER : 0); |
563 | { | 563 | return 0; |
564 | struct v4l2_input *vi = arg; | 564 | } |
565 | int chan; | 565 | |
566 | 566 | static int vidioc_enum_input (struct file *file, void *priv, | |
567 | if ((vi->index >= usbvision->video_inputs) || (vi->index < 0) ) | 567 | struct v4l2_input *vi) |
568 | return -EINVAL; | 568 | { |
569 | if (usbvision->have_tuner) { | 569 | struct video_device *dev = video_devdata(file); |
570 | chan = vi->index; | 570 | struct usb_usbvision *usbvision = |
571 | } | 571 | (struct usb_usbvision *) video_get_drvdata(dev); |
572 | else { | 572 | int chan; |
573 | chan = vi->index + 1; //skip Television string | 573 | |
574 | } | 574 | if ((vi->index >= usbvision->video_inputs) || (vi->index < 0) ) |
575 | switch(chan) { | 575 | return -EINVAL; |
576 | case 0: | 576 | if (usbvision->have_tuner) { |
577 | if (usbvision_device_data[usbvision->DevModel].VideoChannels == 4) { | 577 | chan = vi->index; |
578 | strcpy(vi->name, "White Video Input"); | 578 | } else { |
579 | } | 579 | chan = vi->index + 1; /*skip Television string*/ |
580 | else { | 580 | } |
581 | strcpy(vi->name, "Television"); | 581 | /* Determine the requested input characteristics |
582 | vi->type = V4L2_INPUT_TYPE_TUNER; | 582 | specific for each usbvision card model */ |
583 | vi->audioset = 1; | 583 | switch(chan) { |
584 | vi->tuner = chan; | 584 | case 0: |
585 | vi->std = V4L2_STD_PAL | V4L2_STD_NTSC | V4L2_STD_SECAM; | 585 | if (usbvision_device_data[usbvision->DevModel].VideoChannels == 4) { |
586 | } | 586 | strcpy(vi->name, "White Video Input"); |
587 | break; | 587 | } else { |
588 | case 1: | 588 | strcpy(vi->name, "Television"); |
589 | vi->type = V4L2_INPUT_TYPE_CAMERA; | 589 | vi->type = V4L2_INPUT_TYPE_TUNER; |
590 | if (usbvision_device_data[usbvision->DevModel].VideoChannels == 4) { | 590 | vi->audioset = 1; |
591 | strcpy(vi->name, "Green Video Input"); | 591 | vi->tuner = chan; |
592 | } | 592 | vi->std = USBVISION_NORMS; |
593 | else { | ||
594 | strcpy(vi->name, "Composite Video Input"); | ||
595 | } | ||
596 | vi->std = V4L2_STD_PAL; | ||
597 | break; | ||
598 | case 2: | ||
599 | vi->type = V4L2_INPUT_TYPE_CAMERA; | ||
600 | if (usbvision_device_data[usbvision->DevModel].VideoChannels == 4) { | ||
601 | strcpy(vi->name, "Yellow Video Input"); | ||
602 | } | ||
603 | else { | ||
604 | strcpy(vi->name, "S-Video Input"); | ||
605 | } | ||
606 | vi->std = V4L2_STD_PAL; | ||
607 | break; | ||
608 | case 3: | ||
609 | vi->type = V4L2_INPUT_TYPE_CAMERA; | ||
610 | strcpy(vi->name, "Red Video Input"); | ||
611 | vi->std = V4L2_STD_PAL; | ||
612 | break; | ||
613 | } | ||
614 | PDEBUG(DBG_IOCTL, "VIDIOC_ENUMINPUT name=%s:%d tuners=%d type=%d norm=%x", | ||
615 | vi->name, vi->index, vi->tuner,vi->type,(int)vi->std); | ||
616 | return 0; | ||
617 | } | ||
618 | case VIDIOC_ENUMSTD: | ||
619 | { | ||
620 | struct v4l2_standard *e = arg; | ||
621 | unsigned int i; | ||
622 | int ret; | ||
623 | |||
624 | i = e->index; | ||
625 | if (i >= TVNORMS) | ||
626 | return -EINVAL; | ||
627 | ret = v4l2_video_std_construct(e, tvnorms[e->index].id, | ||
628 | tvnorms[e->index].name); | ||
629 | e->index = i; | ||
630 | if (ret < 0) | ||
631 | return ret; | ||
632 | return 0; | ||
633 | } | 593 | } |
634 | case VIDIOC_G_INPUT: | 594 | break; |
635 | { | 595 | case 1: |
636 | int *input = arg; | 596 | vi->type = V4L2_INPUT_TYPE_CAMERA; |
637 | *input = usbvision->ctl_input; | 597 | if (usbvision_device_data[usbvision->DevModel].VideoChannels == 4) { |
638 | return 0; | 598 | strcpy(vi->name, "Green Video Input"); |
599 | } else { | ||
600 | strcpy(vi->name, "Composite Video Input"); | ||
639 | } | 601 | } |
640 | case VIDIOC_S_INPUT: | 602 | vi->std = V4L2_STD_PAL; |
641 | { | 603 | break; |
642 | int *input = arg; | 604 | case 2: |
643 | if ((*input >= usbvision->video_inputs) || (*input < 0) ) | 605 | vi->type = V4L2_INPUT_TYPE_CAMERA; |
644 | return -EINVAL; | 606 | if (usbvision_device_data[usbvision->DevModel].VideoChannels == 4) { |
645 | usbvision->ctl_input = *input; | 607 | strcpy(vi->name, "Yellow Video Input"); |
646 | 608 | } else { | |
647 | down(&usbvision->lock); | 609 | strcpy(vi->name, "S-Video Input"); |
648 | usbvision_muxsel(usbvision, usbvision->ctl_input); | ||
649 | usbvision_set_input(usbvision); | ||
650 | usbvision_set_output(usbvision, usbvision->curwidth, usbvision->curheight); | ||
651 | up(&usbvision->lock); | ||
652 | return 0; | ||
653 | } | 610 | } |
654 | case VIDIOC_G_STD: | 611 | vi->std = V4L2_STD_PAL; |
655 | { | 612 | break; |
656 | v4l2_std_id *id = arg; | 613 | case 3: |
614 | vi->type = V4L2_INPUT_TYPE_CAMERA; | ||
615 | strcpy(vi->name, "Red Video Input"); | ||
616 | vi->std = V4L2_STD_PAL; | ||
617 | break; | ||
618 | } | ||
619 | return 0; | ||
620 | } | ||
657 | 621 | ||
658 | *id = usbvision->tvnorm->id; | 622 | static int vidioc_g_input (struct file *file, void *priv, unsigned int *input) |
623 | { | ||
624 | struct video_device *dev = video_devdata(file); | ||
625 | struct usb_usbvision *usbvision = | ||
626 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
659 | 627 | ||
660 | PDEBUG(DBG_IOCTL, "VIDIOC_G_STD std_id=%s", usbvision->tvnorm->name); | 628 | *input = usbvision->ctl_input; |
661 | return 0; | 629 | return 0; |
662 | } | 630 | } |
663 | case VIDIOC_S_STD: | ||
664 | { | ||
665 | v4l2_std_id *id = arg; | ||
666 | unsigned int i; | ||
667 | |||
668 | for (i = 0; i < TVNORMS; i++) | ||
669 | if (*id == tvnorms[i].id) | ||
670 | break; | ||
671 | if (i == TVNORMS) | ||
672 | for (i = 0; i < TVNORMS; i++) | ||
673 | if (*id & tvnorms[i].id) | ||
674 | break; | ||
675 | if (i == TVNORMS) | ||
676 | return -EINVAL; | ||
677 | |||
678 | down(&usbvision->lock); | ||
679 | usbvision->tvnorm = &tvnorms[i]; | ||
680 | |||
681 | call_i2c_clients(usbvision, VIDIOC_S_STD, | ||
682 | &usbvision->tvnorm->id); | ||
683 | 631 | ||
684 | up(&usbvision->lock); | 632 | static int vidioc_s_input (struct file *file, void *priv, unsigned int input) |
633 | { | ||
634 | struct video_device *dev = video_devdata(file); | ||
635 | struct usb_usbvision *usbvision = | ||
636 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
685 | 637 | ||
686 | PDEBUG(DBG_IOCTL, "VIDIOC_S_STD std_id=%s", usbvision->tvnorm->name); | 638 | if ((input >= usbvision->video_inputs) || (input < 0) ) |
687 | return 0; | 639 | return -EINVAL; |
688 | } | ||
689 | case VIDIOC_G_TUNER: | ||
690 | { | ||
691 | struct v4l2_tuner *vt = arg; | ||
692 | |||
693 | if (!usbvision->have_tuner || vt->index) // Only tuner 0 | ||
694 | return -EINVAL; | ||
695 | strcpy(vt->name, "Television"); | ||
696 | /* Let clients fill in the remainder of this struct */ | ||
697 | call_i2c_clients(usbvision,VIDIOC_G_TUNER,vt); | ||
698 | |||
699 | PDEBUG(DBG_IOCTL, "VIDIOC_G_TUNER signal=%x, afc=%x",vt->signal,vt->afc); | ||
700 | return 0; | ||
701 | } | ||
702 | case VIDIOC_S_TUNER: | ||
703 | { | ||
704 | struct v4l2_tuner *vt = arg; | ||
705 | |||
706 | // Only no or one tuner for now | ||
707 | if (!usbvision->have_tuner || vt->index) | ||
708 | return -EINVAL; | ||
709 | /* let clients handle this */ | ||
710 | call_i2c_clients(usbvision,VIDIOC_S_TUNER,vt); | ||
711 | |||
712 | PDEBUG(DBG_IOCTL, "VIDIOC_S_TUNER"); | ||
713 | return 0; | ||
714 | } | ||
715 | case VIDIOC_G_FREQUENCY: | ||
716 | { | ||
717 | struct v4l2_frequency *freq = arg; | ||
718 | |||
719 | freq->tuner = 0; // Only one tuner | ||
720 | freq->type = V4L2_TUNER_ANALOG_TV; | ||
721 | freq->frequency = usbvision->freq; | ||
722 | PDEBUG(DBG_IOCTL, "VIDIOC_G_FREQUENCY freq=0x%X", (unsigned)freq->frequency); | ||
723 | return 0; | ||
724 | } | ||
725 | case VIDIOC_S_FREQUENCY: | ||
726 | { | ||
727 | struct v4l2_frequency *freq = arg; | ||
728 | |||
729 | // Only no or one tuner for now | ||
730 | if (!usbvision->have_tuner || freq->tuner) | ||
731 | return -EINVAL; | ||
732 | |||
733 | usbvision->freq = freq->frequency; | ||
734 | call_i2c_clients(usbvision, cmd, freq); | ||
735 | PDEBUG(DBG_IOCTL, "VIDIOC_S_FREQUENCY freq=0x%X", (unsigned)freq->frequency); | ||
736 | return 0; | ||
737 | } | ||
738 | case VIDIOC_G_AUDIO: | ||
739 | { | ||
740 | struct v4l2_audio *v = arg; | ||
741 | memset(v,0, sizeof(v)); | ||
742 | strcpy(v->name, "TV"); | ||
743 | PDEBUG(DBG_IOCTL, "VIDIOC_G_AUDIO"); | ||
744 | return 0; | ||
745 | } | ||
746 | case VIDIOC_S_AUDIO: | ||
747 | { | ||
748 | struct v4l2_audio *v = arg; | ||
749 | if(v->index) { | ||
750 | return -EINVAL; | ||
751 | } | ||
752 | PDEBUG(DBG_IOCTL, "VIDIOC_S_AUDIO"); | ||
753 | return 0; | ||
754 | } | ||
755 | case VIDIOC_QUERYCTRL: | ||
756 | { | ||
757 | struct v4l2_queryctrl *ctrl = arg; | ||
758 | int id=ctrl->id; | ||
759 | 640 | ||
760 | memset(ctrl,0,sizeof(*ctrl)); | 641 | down(&usbvision->lock); |
761 | ctrl->id=id; | 642 | usbvision_muxsel(usbvision, input); |
643 | usbvision_set_input(usbvision); | ||
644 | usbvision_set_output(usbvision, | ||
645 | usbvision->curwidth, | ||
646 | usbvision->curheight); | ||
647 | up(&usbvision->lock); | ||
648 | return 0; | ||
649 | } | ||
762 | 650 | ||
763 | call_i2c_clients(usbvision, cmd, arg); | 651 | static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *id) |
652 | { | ||
653 | struct video_device *dev = video_devdata(file); | ||
654 | struct usb_usbvision *usbvision = | ||
655 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
656 | usbvision->tvnormId=*id; | ||
764 | 657 | ||
765 | if (ctrl->type) | 658 | down(&usbvision->lock); |
766 | return 0; | 659 | call_i2c_clients(usbvision, VIDIOC_S_STD, |
767 | else | 660 | &usbvision->tvnormId); |
768 | return -EINVAL; | 661 | up(&usbvision->lock); |
662 | /* propagate the change to the decoder */ | ||
663 | usbvision_muxsel(usbvision, usbvision->ctl_input); | ||
769 | 664 | ||
770 | PDEBUG(DBG_IOCTL,"VIDIOC_QUERYCTRL id=%x value=%x",ctrl->id,ctrl->type); | 665 | return 0; |
771 | } | 666 | } |
772 | case VIDIOC_G_CTRL: | ||
773 | { | ||
774 | struct v4l2_control *ctrl = arg; | ||
775 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, ctrl); | ||
776 | PDEBUG(DBG_IOCTL,"VIDIOC_G_CTRL id=%x value=%x",ctrl->id,ctrl->value); | ||
777 | return 0; | ||
778 | } | ||
779 | case VIDIOC_S_CTRL: | ||
780 | { | ||
781 | struct v4l2_control *ctrl = arg; | ||
782 | 667 | ||
783 | PDEBUG(DBG_IOCTL, "VIDIOC_S_CTRL id=%x value=%x",ctrl->id,ctrl->value); | 668 | static int vidioc_g_tuner (struct file *file, void *priv, |
784 | call_i2c_clients(usbvision, VIDIOC_S_CTRL, ctrl); | 669 | struct v4l2_tuner *vt) |
785 | return 0; | 670 | { |
786 | } | 671 | struct video_device *dev = video_devdata(file); |
787 | case VIDIOC_REQBUFS: | 672 | struct usb_usbvision *usbvision = |
788 | { | 673 | (struct usb_usbvision *) video_get_drvdata(dev); |
789 | struct v4l2_requestbuffers *vr = arg; | ||
790 | int ret; | ||
791 | 674 | ||
792 | RESTRICT_TO_RANGE(vr->count,1,USBVISION_NUMFRAMES); | 675 | if (!usbvision->have_tuner || vt->index) // Only tuner 0 |
676 | return -EINVAL; | ||
677 | if(usbvision->radio) { | ||
678 | strcpy(vt->name, "Radio"); | ||
679 | vt->type = V4L2_TUNER_RADIO; | ||
680 | } else { | ||
681 | strcpy(vt->name, "Television"); | ||
682 | } | ||
683 | /* Let clients fill in the remainder of this struct */ | ||
684 | call_i2c_clients(usbvision,VIDIOC_G_TUNER,vt); | ||
793 | 685 | ||
794 | // Check input validity : the user must do a VIDEO CAPTURE and MMAP method. | 686 | return 0; |
795 | if((vr->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) || | 687 | } |
796 | (vr->memory != V4L2_MEMORY_MMAP)) | ||
797 | return -EINVAL; | ||
798 | 688 | ||
799 | if(usbvision->streaming == Stream_On) { | 689 | static int vidioc_s_tuner (struct file *file, void *priv, |
800 | if ((ret = usbvision_stream_interrupt(usbvision))) | 690 | struct v4l2_tuner *vt) |
801 | return ret; | 691 | { |
802 | } | 692 | struct video_device *dev = video_devdata(file); |
693 | struct usb_usbvision *usbvision = | ||
694 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
803 | 695 | ||
804 | usbvision_frames_free(usbvision); | 696 | // Only no or one tuner for now |
805 | usbvision_empty_framequeues(usbvision); | 697 | if (!usbvision->have_tuner || vt->index) |
806 | vr->count = usbvision_frames_alloc(usbvision,vr->count); | 698 | return -EINVAL; |
699 | /* let clients handle this */ | ||
700 | call_i2c_clients(usbvision,VIDIOC_S_TUNER,vt); | ||
807 | 701 | ||
808 | usbvision->curFrame = NULL; | 702 | return 0; |
703 | } | ||
809 | 704 | ||
810 | PDEBUG(DBG_IOCTL, "VIDIOC_REQBUFS count=%d",vr->count); | 705 | static int vidioc_g_frequency (struct file *file, void *priv, |
811 | return 0; | 706 | struct v4l2_frequency *freq) |
812 | } | 707 | { |
813 | case VIDIOC_QUERYBUF: | 708 | struct video_device *dev = video_devdata(file); |
814 | { | 709 | struct usb_usbvision *usbvision = |
815 | struct v4l2_buffer *vb = arg; | 710 | (struct usb_usbvision *) video_get_drvdata(dev); |
816 | struct usbvision_frame *frame; | ||
817 | 711 | ||
818 | // FIXME : must control that buffers are mapped (VIDIOC_REQBUFS has been called) | 712 | freq->tuner = 0; // Only one tuner |
713 | if(usbvision->radio) { | ||
714 | freq->type = V4L2_TUNER_RADIO; | ||
715 | } else { | ||
716 | freq->type = V4L2_TUNER_ANALOG_TV; | ||
717 | } | ||
718 | freq->frequency = usbvision->freq; | ||
819 | 719 | ||
820 | if(vb->type != V4L2_CAP_VIDEO_CAPTURE) { | 720 | return 0; |
821 | return -EINVAL; | 721 | } |
822 | } | ||
823 | if(vb->index>=usbvision->num_frames) { | ||
824 | return -EINVAL; | ||
825 | } | ||
826 | // Updating the corresponding frame state | ||
827 | vb->flags = 0; | ||
828 | frame = &usbvision->frame[vb->index]; | ||
829 | if(frame->grabstate >= FrameState_Ready) | ||
830 | vb->flags |= V4L2_BUF_FLAG_QUEUED; | ||
831 | if(frame->grabstate >= FrameState_Done) | ||
832 | vb->flags |= V4L2_BUF_FLAG_DONE; | ||
833 | if(frame->grabstate == FrameState_Unused) | ||
834 | vb->flags |= V4L2_BUF_FLAG_MAPPED; | ||
835 | vb->memory = V4L2_MEMORY_MMAP; | ||
836 | |||
837 | vb->m.offset = vb->index*PAGE_ALIGN(usbvision->max_frame_size); | ||
838 | |||
839 | vb->memory = V4L2_MEMORY_MMAP; | ||
840 | vb->field = V4L2_FIELD_NONE; | ||
841 | vb->length = usbvision->curwidth*usbvision->curheight*usbvision->palette.bytes_per_pixel; | ||
842 | vb->timestamp = usbvision->frame[vb->index].timestamp; | ||
843 | vb->sequence = usbvision->frame[vb->index].sequence; | ||
844 | return 0; | ||
845 | } | ||
846 | case VIDIOC_QBUF: | ||
847 | { | ||
848 | struct v4l2_buffer *vb = arg; | ||
849 | struct usbvision_frame *frame; | ||
850 | unsigned long lock_flags; | ||
851 | |||
852 | // FIXME : works only on VIDEO_CAPTURE MODE, MMAP. | ||
853 | if(vb->type != V4L2_CAP_VIDEO_CAPTURE) { | ||
854 | return -EINVAL; | ||
855 | } | ||
856 | if(vb->index>=usbvision->num_frames) { | ||
857 | return -EINVAL; | ||
858 | } | ||
859 | 722 | ||
860 | frame = &usbvision->frame[vb->index]; | 723 | static int vidioc_s_frequency (struct file *file, void *priv, |
724 | struct v4l2_frequency *freq) | ||
725 | { | ||
726 | struct video_device *dev = video_devdata(file); | ||
727 | struct usb_usbvision *usbvision = | ||
728 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
861 | 729 | ||
862 | if (frame->grabstate != FrameState_Unused) { | 730 | // Only no or one tuner for now |
863 | return -EAGAIN; | 731 | if (!usbvision->have_tuner || freq->tuner) |
864 | } | 732 | return -EINVAL; |
865 | 733 | ||
866 | /* Mark it as ready and enqueue frame */ | 734 | usbvision->freq = freq->frequency; |
867 | frame->grabstate = FrameState_Ready; | 735 | call_i2c_clients(usbvision, VIDIOC_S_FREQUENCY, freq); |
868 | frame->scanstate = ScanState_Scanning; | ||
869 | frame->scanlength = 0; /* Accumulated in usbvision_parse_data() */ | ||
870 | 736 | ||
871 | vb->flags &= ~V4L2_BUF_FLAG_DONE; | 737 | return 0; |
738 | } | ||
872 | 739 | ||
873 | /* set v4l2_format index */ | 740 | static int vidioc_g_audio (struct file *file, void *priv, struct v4l2_audio *a) |
874 | frame->v4l2_format = usbvision->palette; | 741 | { |
742 | struct video_device *dev = video_devdata(file); | ||
743 | struct usb_usbvision *usbvision = | ||
744 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
875 | 745 | ||
876 | spin_lock_irqsave(&usbvision->queue_lock, lock_flags); | 746 | memset(a,0,sizeof(*a)); |
877 | list_add_tail(&usbvision->frame[vb->index].frame, &usbvision->inqueue); | 747 | if(usbvision->radio) { |
878 | spin_unlock_irqrestore(&usbvision->queue_lock, lock_flags); | 748 | strcpy(a->name,"Radio"); |
749 | } else { | ||
750 | strcpy(a->name, "TV"); | ||
751 | } | ||
879 | 752 | ||
880 | PDEBUG(DBG_IOCTL, "VIDIOC_QBUF frame #%d",vb->index); | 753 | return 0; |
881 | return 0; | 754 | } |
882 | } | ||
883 | case VIDIOC_DQBUF: | ||
884 | { | ||
885 | struct v4l2_buffer *vb = arg; | ||
886 | int ret; | ||
887 | struct usbvision_frame *f; | ||
888 | unsigned long lock_flags; | ||
889 | |||
890 | if (vb->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
891 | return -EINVAL; | ||
892 | |||
893 | if (list_empty(&(usbvision->outqueue))) { | ||
894 | if (usbvision->streaming == Stream_Idle) | ||
895 | return -EINVAL; | ||
896 | ret = wait_event_interruptible | ||
897 | (usbvision->wait_frame, | ||
898 | !list_empty(&(usbvision->outqueue))); | ||
899 | if (ret) | ||
900 | return ret; | ||
901 | } | ||
902 | 755 | ||
903 | spin_lock_irqsave(&usbvision->queue_lock, lock_flags); | 756 | static int vidioc_s_audio (struct file *file, void *fh, |
904 | f = list_entry(usbvision->outqueue.next, | 757 | struct v4l2_audio *a) |
905 | struct usbvision_frame, frame); | 758 | { |
906 | list_del(usbvision->outqueue.next); | 759 | if(a->index) { |
907 | spin_unlock_irqrestore(&usbvision->queue_lock, lock_flags); | 760 | return -EINVAL; |
908 | 761 | } | |
909 | f->grabstate = FrameState_Unused; | ||
910 | |||
911 | vb->memory = V4L2_MEMORY_MMAP; | ||
912 | vb->flags = V4L2_BUF_FLAG_MAPPED | V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE; | ||
913 | vb->index = f->index; | ||
914 | vb->sequence = f->sequence; | ||
915 | vb->timestamp = f->timestamp; | ||
916 | vb->field = V4L2_FIELD_NONE; | ||
917 | vb->bytesused = f->scanlength; | ||
918 | |||
919 | return 0; | ||
920 | } | ||
921 | case VIDIOC_STREAMON: | ||
922 | { | ||
923 | int b=V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
924 | 762 | ||
925 | usbvision->streaming = Stream_On; | 763 | return 0; |
764 | } | ||
926 | 765 | ||
927 | call_i2c_clients(usbvision,VIDIOC_STREAMON , &b); | 766 | static int vidioc_queryctrl (struct file *file, void *priv, |
767 | struct v4l2_queryctrl *ctrl) | ||
768 | { | ||
769 | struct video_device *dev = video_devdata(file); | ||
770 | struct usb_usbvision *usbvision = | ||
771 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
772 | int id=ctrl->id; | ||
928 | 773 | ||
929 | PDEBUG(DBG_IOCTL, "VIDIOC_STREAMON"); | 774 | memset(ctrl,0,sizeof(*ctrl)); |
775 | ctrl->id=id; | ||
930 | 776 | ||
931 | return 0; | 777 | call_i2c_clients(usbvision, VIDIOC_QUERYCTRL, ctrl); |
932 | } | ||
933 | case VIDIOC_STREAMOFF: | ||
934 | { | ||
935 | int *type = arg; | ||
936 | int b=V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
937 | |||
938 | if (*type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
939 | return -EINVAL; | ||
940 | |||
941 | if(usbvision->streaming == Stream_On) { | ||
942 | usbvision_stream_interrupt(usbvision); | ||
943 | // Stop all video streamings | ||
944 | call_i2c_clients(usbvision,VIDIOC_STREAMOFF , &b); | ||
945 | } | ||
946 | usbvision_empty_framequeues(usbvision); | ||
947 | 778 | ||
948 | PDEBUG(DBG_IOCTL, "VIDIOC_STREAMOFF"); | 779 | if (!ctrl->type) |
949 | return 0; | 780 | return -EINVAL; |
950 | } | ||
951 | case VIDIOC_ENUM_FMT: | ||
952 | { | ||
953 | struct v4l2_fmtdesc *vfd = arg; | ||
954 | 781 | ||
955 | if(vfd->index>=USBVISION_SUPPORTED_PALETTES-1) { | 782 | return 0; |
956 | return -EINVAL; | 783 | } |
957 | } | 784 | |
958 | vfd->flags = 0; | 785 | static int vidioc_g_ctrl (struct file *file, void *priv, |
959 | vfd->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 786 | struct v4l2_control *ctrl) |
960 | strcpy(vfd->description,usbvision_v4l2_format[vfd->index].desc); | 787 | { |
961 | vfd->pixelformat = usbvision_v4l2_format[vfd->index].format; | 788 | struct video_device *dev = video_devdata(file); |
962 | memset(vfd->reserved, 0, sizeof(vfd->reserved)); | 789 | struct usb_usbvision *usbvision = |
963 | return 0; | 790 | (struct usb_usbvision *) video_get_drvdata(dev); |
964 | } | 791 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, ctrl); |
965 | case VIDIOC_G_FMT: | 792 | |
966 | { | 793 | return 0; |
967 | struct v4l2_format *vf = arg; | 794 | } |
968 | 795 | ||
969 | switch (vf->type) { | 796 | static int vidioc_s_ctrl (struct file *file, void *priv, |
970 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 797 | struct v4l2_control *ctrl) |
971 | { | 798 | { |
972 | vf->fmt.pix.width = usbvision->curwidth; | 799 | struct video_device *dev = video_devdata(file); |
973 | vf->fmt.pix.height = usbvision->curheight; | 800 | struct usb_usbvision *usbvision = |
974 | vf->fmt.pix.pixelformat = usbvision->palette.format; | 801 | (struct usb_usbvision *) video_get_drvdata(dev); |
975 | vf->fmt.pix.bytesperline = usbvision->curwidth*usbvision->palette.bytes_per_pixel; | 802 | call_i2c_clients(usbvision, VIDIOC_S_CTRL, ctrl); |
976 | vf->fmt.pix.sizeimage = vf->fmt.pix.bytesperline*usbvision->curheight; | 803 | |
977 | vf->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; | 804 | return 0; |
978 | vf->fmt.pix.field = V4L2_FIELD_NONE; /* Always progressive image */ | 805 | } |
979 | PDEBUG(DBG_IOCTL, "VIDIOC_G_FMT w=%d, h=%d, format=%s", | 806 | |
980 | vf->fmt.pix.width, vf->fmt.pix.height,usbvision->palette.desc); | 807 | static int vidioc_reqbufs (struct file *file, |
981 | return 0; | 808 | void *priv, struct v4l2_requestbuffers *vr) |
982 | } | 809 | { |
983 | default: | 810 | struct video_device *dev = video_devdata(file); |
984 | PDEBUG(DBG_IOCTL, "VIDIOC_G_FMT invalid type %d",vf->type); | 811 | struct usb_usbvision *usbvision = |
985 | return -EINVAL; | 812 | (struct usb_usbvision *) video_get_drvdata(dev); |
986 | } | 813 | int ret; |
987 | return 0; | 814 | |
988 | } | 815 | RESTRICT_TO_RANGE(vr->count,1,USBVISION_NUMFRAMES); |
989 | case VIDIOC_TRY_FMT: | 816 | |
990 | case VIDIOC_S_FMT: | 817 | /* Check input validity: |
991 | { | 818 | the user must do a VIDEO CAPTURE and MMAP method. */ |
992 | struct v4l2_format *vf = arg; | 819 | if((vr->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) || |
993 | int formatIdx,ret; | 820 | (vr->memory != V4L2_MEMORY_MMAP)) |
994 | 821 | return -EINVAL; | |
995 | switch(vf->type) { | 822 | |
996 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 823 | if(usbvision->streaming == Stream_On) { |
997 | { | 824 | if ((ret = usbvision_stream_interrupt(usbvision))) |
998 | /* Find requested format in available ones */ | 825 | return ret; |
999 | for(formatIdx=0;formatIdx<USBVISION_SUPPORTED_PALETTES;formatIdx++) { | ||
1000 | if(vf->fmt.pix.pixelformat == usbvision_v4l2_format[formatIdx].format) { | ||
1001 | usbvision->palette = usbvision_v4l2_format[formatIdx]; | ||
1002 | break; | ||
1003 | } | ||
1004 | } | ||
1005 | /* robustness */ | ||
1006 | if(formatIdx == USBVISION_SUPPORTED_PALETTES) { | ||
1007 | return -EINVAL; | ||
1008 | } | ||
1009 | RESTRICT_TO_RANGE(vf->fmt.pix.width, MIN_FRAME_WIDTH, MAX_FRAME_WIDTH); | ||
1010 | RESTRICT_TO_RANGE(vf->fmt.pix.height, MIN_FRAME_HEIGHT, MAX_FRAME_HEIGHT); | ||
1011 | |||
1012 | vf->fmt.pix.bytesperline = vf->fmt.pix.width*usbvision->palette.bytes_per_pixel; | ||
1013 | vf->fmt.pix.sizeimage = vf->fmt.pix.bytesperline*vf->fmt.pix.height; | ||
1014 | |||
1015 | if(cmd == VIDIOC_TRY_FMT) { | ||
1016 | PDEBUG(DBG_IOCTL, "VIDIOC_TRY_FMT grabdisplay w=%d, h=%d, format=%s", | ||
1017 | vf->fmt.pix.width, vf->fmt.pix.height,usbvision->palette.desc); | ||
1018 | return 0; | ||
1019 | } | ||
1020 | |||
1021 | /* stop io in case it is already in progress */ | ||
1022 | if(usbvision->streaming == Stream_On) { | ||
1023 | if ((ret = usbvision_stream_interrupt(usbvision))) | ||
1024 | return ret; | ||
1025 | } | ||
1026 | usbvision_frames_free(usbvision); | ||
1027 | usbvision_empty_framequeues(usbvision); | ||
1028 | |||
1029 | usbvision->curFrame = NULL; | ||
1030 | |||
1031 | // by now we are committed to the new data... | ||
1032 | down(&usbvision->lock); | ||
1033 | usbvision_set_output(usbvision, vf->fmt.pix.width, vf->fmt.pix.height); | ||
1034 | up(&usbvision->lock); | ||
1035 | |||
1036 | PDEBUG(DBG_IOCTL, "VIDIOC_S_FMT grabdisplay w=%d, h=%d, format=%s", | ||
1037 | vf->fmt.pix.width, vf->fmt.pix.height,usbvision->palette.desc); | ||
1038 | return 0; | ||
1039 | } | ||
1040 | default: | ||
1041 | return -EINVAL; | ||
1042 | } | ||
1043 | } | ||
1044 | default: | ||
1045 | return -ENOIOCTLCMD; | ||
1046 | } | 826 | } |
827 | |||
828 | usbvision_frames_free(usbvision); | ||
829 | usbvision_empty_framequeues(usbvision); | ||
830 | vr->count = usbvision_frames_alloc(usbvision,vr->count); | ||
831 | |||
832 | usbvision->curFrame = NULL; | ||
833 | |||
1047 | return 0; | 834 | return 0; |
1048 | } | 835 | } |
1049 | 836 | ||
1050 | static int usbvision_v4l2_ioctl(struct inode *inode, struct file *file, | 837 | static int vidioc_querybuf (struct file *file, |
1051 | unsigned int cmd, unsigned long arg) | 838 | void *priv, struct v4l2_buffer *vb) |
1052 | { | 839 | { |
1053 | return video_usercopy(inode, file, cmd, arg, usbvision_v4l2_do_ioctl); | 840 | struct video_device *dev = video_devdata(file); |
841 | struct usb_usbvision *usbvision = | ||
842 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
843 | struct usbvision_frame *frame; | ||
844 | |||
845 | /* FIXME : must control | ||
846 | that buffers are mapped (VIDIOC_REQBUFS has been called) */ | ||
847 | if(vb->type != V4L2_CAP_VIDEO_CAPTURE) { | ||
848 | return -EINVAL; | ||
849 | } | ||
850 | if(vb->index>=usbvision->num_frames) { | ||
851 | return -EINVAL; | ||
852 | } | ||
853 | /* Updating the corresponding frame state */ | ||
854 | vb->flags = 0; | ||
855 | frame = &usbvision->frame[vb->index]; | ||
856 | if(frame->grabstate >= FrameState_Ready) | ||
857 | vb->flags |= V4L2_BUF_FLAG_QUEUED; | ||
858 | if(frame->grabstate >= FrameState_Done) | ||
859 | vb->flags |= V4L2_BUF_FLAG_DONE; | ||
860 | if(frame->grabstate == FrameState_Unused) | ||
861 | vb->flags |= V4L2_BUF_FLAG_MAPPED; | ||
862 | vb->memory = V4L2_MEMORY_MMAP; | ||
863 | |||
864 | vb->m.offset = vb->index*PAGE_ALIGN(usbvision->max_frame_size); | ||
865 | |||
866 | vb->memory = V4L2_MEMORY_MMAP; | ||
867 | vb->field = V4L2_FIELD_NONE; | ||
868 | vb->length = usbvision->curwidth* | ||
869 | usbvision->curheight* | ||
870 | usbvision->palette.bytes_per_pixel; | ||
871 | vb->timestamp = usbvision->frame[vb->index].timestamp; | ||
872 | vb->sequence = usbvision->frame[vb->index].sequence; | ||
873 | return 0; | ||
874 | } | ||
875 | |||
876 | static int vidioc_qbuf (struct file *file, void *priv, struct v4l2_buffer *vb) | ||
877 | { | ||
878 | struct video_device *dev = video_devdata(file); | ||
879 | struct usb_usbvision *usbvision = | ||
880 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
881 | struct usbvision_frame *frame; | ||
882 | unsigned long lock_flags; | ||
883 | |||
884 | /* FIXME : works only on VIDEO_CAPTURE MODE, MMAP. */ | ||
885 | if(vb->type != V4L2_CAP_VIDEO_CAPTURE) { | ||
886 | return -EINVAL; | ||
887 | } | ||
888 | if(vb->index>=usbvision->num_frames) { | ||
889 | return -EINVAL; | ||
890 | } | ||
891 | |||
892 | frame = &usbvision->frame[vb->index]; | ||
893 | |||
894 | if (frame->grabstate != FrameState_Unused) { | ||
895 | return -EAGAIN; | ||
896 | } | ||
897 | |||
898 | /* Mark it as ready and enqueue frame */ | ||
899 | frame->grabstate = FrameState_Ready; | ||
900 | frame->scanstate = ScanState_Scanning; | ||
901 | frame->scanlength = 0; /* Accumulated in usbvision_parse_data() */ | ||
902 | |||
903 | vb->flags &= ~V4L2_BUF_FLAG_DONE; | ||
904 | |||
905 | /* set v4l2_format index */ | ||
906 | frame->v4l2_format = usbvision->palette; | ||
907 | |||
908 | spin_lock_irqsave(&usbvision->queue_lock, lock_flags); | ||
909 | list_add_tail(&usbvision->frame[vb->index].frame, &usbvision->inqueue); | ||
910 | spin_unlock_irqrestore(&usbvision->queue_lock, lock_flags); | ||
911 | |||
912 | return 0; | ||
1054 | } | 913 | } |
1055 | 914 | ||
915 | static int vidioc_dqbuf (struct file *file, void *priv, struct v4l2_buffer *vb) | ||
916 | { | ||
917 | struct video_device *dev = video_devdata(file); | ||
918 | struct usb_usbvision *usbvision = | ||
919 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
920 | int ret; | ||
921 | struct usbvision_frame *f; | ||
922 | unsigned long lock_flags; | ||
923 | |||
924 | if (vb->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
925 | return -EINVAL; | ||
926 | |||
927 | if (list_empty(&(usbvision->outqueue))) { | ||
928 | if (usbvision->streaming == Stream_Idle) | ||
929 | return -EINVAL; | ||
930 | ret = wait_event_interruptible | ||
931 | (usbvision->wait_frame, | ||
932 | !list_empty(&(usbvision->outqueue))); | ||
933 | if (ret) | ||
934 | return ret; | ||
935 | } | ||
936 | |||
937 | spin_lock_irqsave(&usbvision->queue_lock, lock_flags); | ||
938 | f = list_entry(usbvision->outqueue.next, | ||
939 | struct usbvision_frame, frame); | ||
940 | list_del(usbvision->outqueue.next); | ||
941 | spin_unlock_irqrestore(&usbvision->queue_lock, lock_flags); | ||
942 | |||
943 | f->grabstate = FrameState_Unused; | ||
944 | |||
945 | vb->memory = V4L2_MEMORY_MMAP; | ||
946 | vb->flags = V4L2_BUF_FLAG_MAPPED | | ||
947 | V4L2_BUF_FLAG_QUEUED | | ||
948 | V4L2_BUF_FLAG_DONE; | ||
949 | vb->index = f->index; | ||
950 | vb->sequence = f->sequence; | ||
951 | vb->timestamp = f->timestamp; | ||
952 | vb->field = V4L2_FIELD_NONE; | ||
953 | vb->bytesused = f->scanlength; | ||
954 | |||
955 | return 0; | ||
956 | } | ||
957 | |||
958 | static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) | ||
959 | { | ||
960 | struct video_device *dev = video_devdata(file); | ||
961 | struct usb_usbvision *usbvision = | ||
962 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
963 | int b=V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
964 | |||
965 | usbvision->streaming = Stream_On; | ||
966 | call_i2c_clients(usbvision,VIDIOC_STREAMON , &b); | ||
967 | |||
968 | return 0; | ||
969 | } | ||
970 | |||
971 | static int vidioc_streamoff(struct file *file, | ||
972 | void *priv, enum v4l2_buf_type type) | ||
973 | { | ||
974 | struct video_device *dev = video_devdata(file); | ||
975 | struct usb_usbvision *usbvision = | ||
976 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
977 | int b=V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
978 | |||
979 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
980 | return -EINVAL; | ||
981 | |||
982 | if(usbvision->streaming == Stream_On) { | ||
983 | usbvision_stream_interrupt(usbvision); | ||
984 | /* Stop all video streamings */ | ||
985 | call_i2c_clients(usbvision,VIDIOC_STREAMOFF , &b); | ||
986 | } | ||
987 | usbvision_empty_framequeues(usbvision); | ||
988 | |||
989 | return 0; | ||
990 | } | ||
991 | |||
992 | static int vidioc_enum_fmt_cap (struct file *file, void *priv, | ||
993 | struct v4l2_fmtdesc *vfd) | ||
994 | { | ||
995 | if(vfd->index>=USBVISION_SUPPORTED_PALETTES-1) { | ||
996 | return -EINVAL; | ||
997 | } | ||
998 | vfd->flags = 0; | ||
999 | vfd->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1000 | strcpy(vfd->description,usbvision_v4l2_format[vfd->index].desc); | ||
1001 | vfd->pixelformat = usbvision_v4l2_format[vfd->index].format; | ||
1002 | memset(vfd->reserved, 0, sizeof(vfd->reserved)); | ||
1003 | return 0; | ||
1004 | } | ||
1005 | |||
1006 | static int vidioc_g_fmt_cap (struct file *file, void *priv, | ||
1007 | struct v4l2_format *vf) | ||
1008 | { | ||
1009 | struct video_device *dev = video_devdata(file); | ||
1010 | struct usb_usbvision *usbvision = | ||
1011 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
1012 | vf->fmt.pix.width = usbvision->curwidth; | ||
1013 | vf->fmt.pix.height = usbvision->curheight; | ||
1014 | vf->fmt.pix.pixelformat = usbvision->palette.format; | ||
1015 | vf->fmt.pix.bytesperline = | ||
1016 | usbvision->curwidth*usbvision->palette.bytes_per_pixel; | ||
1017 | vf->fmt.pix.sizeimage = vf->fmt.pix.bytesperline*usbvision->curheight; | ||
1018 | vf->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; | ||
1019 | vf->fmt.pix.field = V4L2_FIELD_NONE; /* Always progressive image */ | ||
1020 | |||
1021 | return 0; | ||
1022 | } | ||
1023 | |||
1024 | static int vidioc_try_fmt_cap (struct file *file, void *priv, | ||
1025 | struct v4l2_format *vf) | ||
1026 | { | ||
1027 | struct video_device *dev = video_devdata(file); | ||
1028 | struct usb_usbvision *usbvision = | ||
1029 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
1030 | int formatIdx; | ||
1031 | |||
1032 | /* Find requested format in available ones */ | ||
1033 | for(formatIdx=0;formatIdx<USBVISION_SUPPORTED_PALETTES;formatIdx++) { | ||
1034 | if(vf->fmt.pix.pixelformat == | ||
1035 | usbvision_v4l2_format[formatIdx].format) { | ||
1036 | usbvision->palette = usbvision_v4l2_format[formatIdx]; | ||
1037 | break; | ||
1038 | } | ||
1039 | } | ||
1040 | /* robustness */ | ||
1041 | if(formatIdx == USBVISION_SUPPORTED_PALETTES) { | ||
1042 | return -EINVAL; | ||
1043 | } | ||
1044 | RESTRICT_TO_RANGE(vf->fmt.pix.width, MIN_FRAME_WIDTH, MAX_FRAME_WIDTH); | ||
1045 | RESTRICT_TO_RANGE(vf->fmt.pix.height, MIN_FRAME_HEIGHT, MAX_FRAME_HEIGHT); | ||
1046 | |||
1047 | vf->fmt.pix.bytesperline = vf->fmt.pix.width* | ||
1048 | usbvision->palette.bytes_per_pixel; | ||
1049 | vf->fmt.pix.sizeimage = vf->fmt.pix.bytesperline*vf->fmt.pix.height; | ||
1050 | |||
1051 | return 0; | ||
1052 | } | ||
1053 | |||
1054 | static int vidioc_s_fmt_cap(struct file *file, void *priv, | ||
1055 | struct v4l2_format *vf) | ||
1056 | { | ||
1057 | struct video_device *dev = video_devdata(file); | ||
1058 | struct usb_usbvision *usbvision = | ||
1059 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
1060 | int ret; | ||
1061 | |||
1062 | if( 0 != (ret=vidioc_try_fmt_cap (file, priv, vf)) ) { | ||
1063 | return ret; | ||
1064 | } | ||
1065 | |||
1066 | /* stop io in case it is already in progress */ | ||
1067 | if(usbvision->streaming == Stream_On) { | ||
1068 | if ((ret = usbvision_stream_interrupt(usbvision))) | ||
1069 | return ret; | ||
1070 | } | ||
1071 | usbvision_frames_free(usbvision); | ||
1072 | usbvision_empty_framequeues(usbvision); | ||
1073 | |||
1074 | usbvision->curFrame = NULL; | ||
1075 | |||
1076 | /* by now we are committed to the new data... */ | ||
1077 | down(&usbvision->lock); | ||
1078 | usbvision_set_output(usbvision, vf->fmt.pix.width, vf->fmt.pix.height); | ||
1079 | up(&usbvision->lock); | ||
1080 | |||
1081 | return 0; | ||
1082 | } | ||
1056 | 1083 | ||
1057 | static ssize_t usbvision_v4l2_read(struct file *file, char __user *buf, | 1084 | static ssize_t usbvision_v4l2_read(struct file *file, char __user *buf, |
1058 | size_t count, loff_t *ppos) | 1085 | size_t count, loff_t *ppos) |
1059 | { | 1086 | { |
1060 | struct video_device *dev = video_devdata(file); | 1087 | struct video_device *dev = video_devdata(file); |
1061 | struct usb_usbvision *usbvision = (struct usb_usbvision *) video_get_drvdata(dev); | 1088 | struct usb_usbvision *usbvision = |
1089 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
1062 | int noblock = file->f_flags & O_NONBLOCK; | 1090 | int noblock = file->f_flags & O_NONBLOCK; |
1063 | unsigned long lock_flags; | 1091 | unsigned long lock_flags; |
1064 | 1092 | ||
1065 | int ret,i; | 1093 | int ret,i; |
1066 | struct usbvision_frame *frame; | 1094 | struct usbvision_frame *frame; |
1067 | 1095 | ||
1068 | PDEBUG(DBG_IO, "%s: %ld bytes, noblock=%d", __FUNCTION__, (unsigned long)count, noblock); | 1096 | PDEBUG(DBG_IO, "%s: %ld bytes, noblock=%d", __FUNCTION__, |
1097 | (unsigned long)count, noblock); | ||
1069 | 1098 | ||
1070 | if (!USBVISION_IS_OPERATIONAL(usbvision) || (buf == NULL)) | 1099 | if (!USBVISION_IS_OPERATIONAL(usbvision) || (buf == NULL)) |
1071 | return -EFAULT; | 1100 | return -EFAULT; |
1072 | 1101 | ||
1073 | /* This entry point is compatible with the mmap routines so that a user can do either | 1102 | /* This entry point is compatible with the mmap routines |
1074 | VIDIOC_QBUF/VIDIOC_DQBUF to get frames or call read on the device. */ | 1103 | so that a user can do either VIDIOC_QBUF/VIDIOC_DQBUF |
1104 | to get frames or call read on the device. */ | ||
1075 | if(!usbvision->num_frames) { | 1105 | if(!usbvision->num_frames) { |
1076 | /* First, allocate some frames to work with if this has not been done with | 1106 | /* First, allocate some frames to work with |
1077 | VIDIOC_REQBUF */ | 1107 | if this has not been done with VIDIOC_REQBUF */ |
1078 | usbvision_frames_free(usbvision); | 1108 | usbvision_frames_free(usbvision); |
1079 | usbvision_empty_framequeues(usbvision); | 1109 | usbvision_empty_framequeues(usbvision); |
1080 | usbvision_frames_alloc(usbvision,USBVISION_NUMFRAMES); | 1110 | usbvision_frames_alloc(usbvision,USBVISION_NUMFRAMES); |
@@ -1086,21 +1116,24 @@ static ssize_t usbvision_v4l2_read(struct file *file, char __user *buf, | |||
1086 | call_i2c_clients(usbvision,VIDIOC_STREAMON , NULL); | 1116 | call_i2c_clients(usbvision,VIDIOC_STREAMON , NULL); |
1087 | } | 1117 | } |
1088 | 1118 | ||
1089 | /* Then, enqueue as many frames as possible (like a user of VIDIOC_QBUF would do) */ | 1119 | /* Then, enqueue as many frames as possible |
1120 | (like a user of VIDIOC_QBUF would do) */ | ||
1090 | for(i=0;i<usbvision->num_frames;i++) { | 1121 | for(i=0;i<usbvision->num_frames;i++) { |
1091 | frame = &usbvision->frame[i]; | 1122 | frame = &usbvision->frame[i]; |
1092 | if(frame->grabstate == FrameState_Unused) { | 1123 | if(frame->grabstate == FrameState_Unused) { |
1093 | /* Mark it as ready and enqueue frame */ | 1124 | /* Mark it as ready and enqueue frame */ |
1094 | frame->grabstate = FrameState_Ready; | 1125 | frame->grabstate = FrameState_Ready; |
1095 | frame->scanstate = ScanState_Scanning; | 1126 | frame->scanstate = ScanState_Scanning; |
1096 | frame->scanlength = 0; /* Accumulated in usbvision_parse_data() */ | 1127 | /* Accumulated in usbvision_parse_data() */ |
1128 | frame->scanlength = 0; | ||
1097 | 1129 | ||
1098 | /* set v4l2_format index */ | 1130 | /* set v4l2_format index */ |
1099 | frame->v4l2_format = usbvision->palette; | 1131 | frame->v4l2_format = usbvision->palette; |
1100 | 1132 | ||
1101 | spin_lock_irqsave(&usbvision->queue_lock, lock_flags); | 1133 | spin_lock_irqsave(&usbvision->queue_lock, lock_flags); |
1102 | list_add_tail(&frame->frame, &usbvision->inqueue); | 1134 | list_add_tail(&frame->frame, &usbvision->inqueue); |
1103 | spin_unlock_irqrestore(&usbvision->queue_lock, lock_flags); | 1135 | spin_unlock_irqrestore(&usbvision->queue_lock, |
1136 | lock_flags); | ||
1104 | } | 1137 | } |
1105 | } | 1138 | } |
1106 | 1139 | ||
@@ -1128,8 +1161,9 @@ static ssize_t usbvision_v4l2_read(struct file *file, char __user *buf, | |||
1128 | return 0; | 1161 | return 0; |
1129 | } | 1162 | } |
1130 | 1163 | ||
1131 | PDEBUG(DBG_IO, "%s: frmx=%d, bytes_read=%ld, scanlength=%ld", __FUNCTION__, | 1164 | PDEBUG(DBG_IO, "%s: frmx=%d, bytes_read=%ld, scanlength=%ld", |
1132 | frame->index, frame->bytes_read, frame->scanlength); | 1165 | __FUNCTION__, |
1166 | frame->index, frame->bytes_read, frame->scanlength); | ||
1133 | 1167 | ||
1134 | /* copy bytes to user space; we allow for partials reads */ | 1168 | /* copy bytes to user space; we allow for partials reads */ |
1135 | if ((count + frame->bytes_read) > (unsigned long)frame->scanlength) | 1169 | if ((count + frame->bytes_read) > (unsigned long)frame->scanlength) |
@@ -1140,10 +1174,11 @@ static ssize_t usbvision_v4l2_read(struct file *file, char __user *buf, | |||
1140 | } | 1174 | } |
1141 | 1175 | ||
1142 | frame->bytes_read += count; | 1176 | frame->bytes_read += count; |
1143 | PDEBUG(DBG_IO, "%s: {copy} count used=%ld, new bytes_read=%ld", __FUNCTION__, | 1177 | PDEBUG(DBG_IO, "%s: {copy} count used=%ld, new bytes_read=%ld", |
1144 | (unsigned long)count, frame->bytes_read); | 1178 | __FUNCTION__, |
1179 | (unsigned long)count, frame->bytes_read); | ||
1145 | 1180 | ||
1146 | // For now, forget the frame if it has not been read in one shot. | 1181 | /* For now, forget the frame if it has not been read in one shot. */ |
1147 | /* if (frame->bytes_read >= frame->scanlength) {// All data has been read */ | 1182 | /* if (frame->bytes_read >= frame->scanlength) {// All data has been read */ |
1148 | frame->bytes_read = 0; | 1183 | frame->bytes_read = 0; |
1149 | 1184 | ||
@@ -1162,7 +1197,8 @@ static int usbvision_v4l2_mmap(struct file *file, struct vm_area_struct *vma) | |||
1162 | u32 i; | 1197 | u32 i; |
1163 | 1198 | ||
1164 | struct video_device *dev = video_devdata(file); | 1199 | struct video_device *dev = video_devdata(file); |
1165 | struct usb_usbvision *usbvision = (struct usb_usbvision *) video_get_drvdata(dev); | 1200 | struct usb_usbvision *usbvision = |
1201 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
1166 | 1202 | ||
1167 | PDEBUG(DBG_MMAP, "mmap"); | 1203 | PDEBUG(DBG_MMAP, "mmap"); |
1168 | 1204 | ||
@@ -1180,11 +1216,13 @@ static int usbvision_v4l2_mmap(struct file *file, struct vm_area_struct *vma) | |||
1180 | } | 1216 | } |
1181 | 1217 | ||
1182 | for (i = 0; i < usbvision->num_frames; i++) { | 1218 | for (i = 0; i < usbvision->num_frames; i++) { |
1183 | if (((PAGE_ALIGN(usbvision->max_frame_size)*i) >> PAGE_SHIFT) == vma->vm_pgoff) | 1219 | if (((PAGE_ALIGN(usbvision->max_frame_size)*i) >> PAGE_SHIFT) == |
1220 | vma->vm_pgoff) | ||
1184 | break; | 1221 | break; |
1185 | } | 1222 | } |
1186 | if (i == usbvision->num_frames) { | 1223 | if (i == usbvision->num_frames) { |
1187 | PDEBUG(DBG_MMAP, "mmap: user supplied mapping address is out of range"); | 1224 | PDEBUG(DBG_MMAP, |
1225 | "mmap: user supplied mapping address is out of range"); | ||
1188 | up(&usbvision->lock); | 1226 | up(&usbvision->lock); |
1189 | return -EINVAL; | 1227 | return -EINVAL; |
1190 | } | 1228 | } |
@@ -1218,8 +1256,8 @@ static int usbvision_v4l2_mmap(struct file *file, struct vm_area_struct *vma) | |||
1218 | static int usbvision_radio_open(struct inode *inode, struct file *file) | 1256 | static int usbvision_radio_open(struct inode *inode, struct file *file) |
1219 | { | 1257 | { |
1220 | struct video_device *dev = video_devdata(file); | 1258 | struct video_device *dev = video_devdata(file); |
1221 | struct usb_usbvision *usbvision = (struct usb_usbvision *) video_get_drvdata(dev); | 1259 | struct usb_usbvision *usbvision = |
1222 | struct v4l2_frequency freq; | 1260 | (struct usb_usbvision *) video_get_drvdata(dev); |
1223 | int errCode = 0; | 1261 | int errCode = 0; |
1224 | 1262 | ||
1225 | PDEBUG(DBG_IO, "%s:", __FUNCTION__); | 1263 | PDEBUG(DBG_IO, "%s:", __FUNCTION__); |
@@ -1249,8 +1287,6 @@ static int usbvision_radio_open(struct inode *inode, struct file *file) | |||
1249 | // If so far no errors then we shall start the radio | 1287 | // If so far no errors then we shall start the radio |
1250 | usbvision->radio = 1; | 1288 | usbvision->radio = 1; |
1251 | call_i2c_clients(usbvision,AUDC_SET_RADIO,&usbvision->tuner_type); | 1289 | call_i2c_clients(usbvision,AUDC_SET_RADIO,&usbvision->tuner_type); |
1252 | freq.frequency = 1517; //SWR3 @ 94.8MHz | ||
1253 | call_i2c_clients(usbvision, VIDIOC_S_FREQUENCY, &freq); | ||
1254 | usbvision_set_audio(usbvision, USBVISION_AUDIO_RADIO); | 1290 | usbvision_set_audio(usbvision, USBVISION_AUDIO_RADIO); |
1255 | usbvision->user++; | 1291 | usbvision->user++; |
1256 | } | 1292 | } |
@@ -1270,7 +1306,8 @@ static int usbvision_radio_open(struct inode *inode, struct file *file) | |||
1270 | static int usbvision_radio_close(struct inode *inode, struct file *file) | 1306 | static int usbvision_radio_close(struct inode *inode, struct file *file) |
1271 | { | 1307 | { |
1272 | struct video_device *dev = video_devdata(file); | 1308 | struct video_device *dev = video_devdata(file); |
1273 | struct usb_usbvision *usbvision = (struct usb_usbvision *) video_get_drvdata(dev); | 1309 | struct usb_usbvision *usbvision = |
1310 | (struct usb_usbvision *) video_get_drvdata(dev); | ||
1274 | int errCode = 0; | 1311 | int errCode = 0; |
1275 | 1312 | ||
1276 | PDEBUG(DBG_IO, ""); | 1313 | PDEBUG(DBG_IO, ""); |
@@ -1304,149 +1341,6 @@ static int usbvision_radio_close(struct inode *inode, struct file *file) | |||
1304 | return errCode; | 1341 | return errCode; |
1305 | } | 1342 | } |
1306 | 1343 | ||
1307 | static int usbvision_do_radio_ioctl(struct inode *inode, struct file *file, | ||
1308 | unsigned int cmd, void *arg) | ||
1309 | { | ||
1310 | struct video_device *dev = video_devdata(file); | ||
1311 | struct usb_usbvision *usbvision = (struct usb_usbvision *) video_get_drvdata(dev); | ||
1312 | |||
1313 | if (!USBVISION_IS_OPERATIONAL(usbvision)) | ||
1314 | return -EIO; | ||
1315 | |||
1316 | switch (cmd) { | ||
1317 | case VIDIOC_QUERYCAP: | ||
1318 | { | ||
1319 | struct v4l2_capability *vc=arg; | ||
1320 | |||
1321 | memset(vc, 0, sizeof(*vc)); | ||
1322 | strlcpy(vc->driver, "USBVision", sizeof(vc->driver)); | ||
1323 | strlcpy(vc->card, usbvision_device_data[usbvision->DevModel].ModelString, | ||
1324 | sizeof(vc->card)); | ||
1325 | strlcpy(vc->bus_info, usbvision->dev->dev.bus_id, | ||
1326 | sizeof(vc->bus_info)); | ||
1327 | vc->version = USBVISION_DRIVER_VERSION; | ||
1328 | vc->capabilities = (usbvision->have_tuner ? V4L2_CAP_TUNER : 0); | ||
1329 | PDEBUG(DBG_IO, "VIDIOC_QUERYCAP"); | ||
1330 | return 0; | ||
1331 | } | ||
1332 | case VIDIOC_QUERYCTRL: | ||
1333 | { | ||
1334 | struct v4l2_queryctrl *ctrl = arg; | ||
1335 | int id=ctrl->id; | ||
1336 | |||
1337 | memset(ctrl,0,sizeof(*ctrl)); | ||
1338 | ctrl->id=id; | ||
1339 | |||
1340 | call_i2c_clients(usbvision, cmd, arg); | ||
1341 | PDEBUG(DBG_IO,"VIDIOC_QUERYCTRL id=%x value=%x",ctrl->id,ctrl->type); | ||
1342 | |||
1343 | if (ctrl->type) | ||
1344 | return 0; | ||
1345 | else | ||
1346 | return -EINVAL; | ||
1347 | |||
1348 | } | ||
1349 | case VIDIOC_G_CTRL: | ||
1350 | { | ||
1351 | struct v4l2_control *ctrl = arg; | ||
1352 | |||
1353 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, ctrl); | ||
1354 | PDEBUG(DBG_IO,"VIDIOC_G_CTRL id=%x value=%x",ctrl->id,ctrl->value); | ||
1355 | return 0; | ||
1356 | } | ||
1357 | case VIDIOC_S_CTRL: | ||
1358 | { | ||
1359 | struct v4l2_control *ctrl = arg; | ||
1360 | |||
1361 | call_i2c_clients(usbvision, VIDIOC_S_CTRL, ctrl); | ||
1362 | PDEBUG(DBG_IO, "VIDIOC_S_CTRL id=%x value=%x",ctrl->id,ctrl->value); | ||
1363 | return 0; | ||
1364 | } | ||
1365 | case VIDIOC_G_TUNER: | ||
1366 | { | ||
1367 | struct v4l2_tuner *t = arg; | ||
1368 | |||
1369 | if (t->index > 0) | ||
1370 | return -EINVAL; | ||
1371 | |||
1372 | memset(t,0,sizeof(*t)); | ||
1373 | strcpy(t->name, "Radio"); | ||
1374 | t->type = V4L2_TUNER_RADIO; | ||
1375 | |||
1376 | /* Let clients fill in the remainder of this struct */ | ||
1377 | call_i2c_clients(usbvision,VIDIOC_G_TUNER,t); | ||
1378 | PDEBUG(DBG_IO, "VIDIOC_G_TUNER signal=%x, afc=%x",t->signal,t->afc); | ||
1379 | return 0; | ||
1380 | } | ||
1381 | case VIDIOC_S_TUNER: | ||
1382 | { | ||
1383 | struct v4l2_tuner *vt = arg; | ||
1384 | |||
1385 | // Only no or one tuner for now | ||
1386 | if (!usbvision->have_tuner || vt->index) | ||
1387 | return -EINVAL; | ||
1388 | /* let clients handle this */ | ||
1389 | call_i2c_clients(usbvision,VIDIOC_S_TUNER,vt); | ||
1390 | |||
1391 | PDEBUG(DBG_IO, "VIDIOC_S_TUNER"); | ||
1392 | return 0; | ||
1393 | } | ||
1394 | case VIDIOC_G_AUDIO: | ||
1395 | { | ||
1396 | struct v4l2_audio *a = arg; | ||
1397 | |||
1398 | memset(a,0,sizeof(*a)); | ||
1399 | strcpy(a->name,"Radio"); | ||
1400 | PDEBUG(DBG_IO, "VIDIOC_G_AUDIO"); | ||
1401 | return 0; | ||
1402 | } | ||
1403 | case VIDIOC_S_AUDIO: | ||
1404 | case VIDIOC_S_INPUT: | ||
1405 | case VIDIOC_S_STD: | ||
1406 | return 0; | ||
1407 | |||
1408 | case VIDIOC_G_FREQUENCY: | ||
1409 | { | ||
1410 | struct v4l2_frequency *f = arg; | ||
1411 | |||
1412 | memset(f,0,sizeof(*f)); | ||
1413 | |||
1414 | f->type = V4L2_TUNER_RADIO; | ||
1415 | f->frequency = usbvision->freq; | ||
1416 | call_i2c_clients(usbvision, cmd, f); | ||
1417 | PDEBUG(DBG_IO, "VIDIOC_G_FREQUENCY freq=0x%X", (unsigned)f->frequency); | ||
1418 | |||
1419 | return 0; | ||
1420 | } | ||
1421 | case VIDIOC_S_FREQUENCY: | ||
1422 | { | ||
1423 | struct v4l2_frequency *f = arg; | ||
1424 | |||
1425 | if (f->tuner != 0) | ||
1426 | return -EINVAL; | ||
1427 | usbvision->freq = f->frequency; | ||
1428 | call_i2c_clients(usbvision, cmd, f); | ||
1429 | PDEBUG(DBG_IO, "VIDIOC_S_FREQUENCY freq=0x%X", (unsigned)f->frequency); | ||
1430 | |||
1431 | return 0; | ||
1432 | } | ||
1433 | default: | ||
1434 | { | ||
1435 | PDEBUG(DBG_IO, "%s: Unknown command %x", __FUNCTION__, cmd); | ||
1436 | return -ENOIOCTLCMD; | ||
1437 | } | ||
1438 | } | ||
1439 | return 0; | ||
1440 | } | ||
1441 | |||
1442 | |||
1443 | static int usbvision_radio_ioctl(struct inode *inode, struct file *file, | ||
1444 | unsigned int cmd, unsigned long arg) | ||
1445 | { | ||
1446 | return video_usercopy(inode, file, cmd, arg, usbvision_do_radio_ioctl); | ||
1447 | } | ||
1448 | |||
1449 | |||
1450 | /* | 1344 | /* |
1451 | * Here comes the stuff for vbi on usbvision based devices | 1345 | * Here comes the stuff for vbi on usbvision based devices |
1452 | * | 1346 | * |
@@ -1454,21 +1348,21 @@ static int usbvision_radio_ioctl(struct inode *inode, struct file *file, | |||
1454 | static int usbvision_vbi_open(struct inode *inode, struct file *file) | 1348 | static int usbvision_vbi_open(struct inode *inode, struct file *file) |
1455 | { | 1349 | { |
1456 | /* TODO */ | 1350 | /* TODO */ |
1457 | return -EINVAL; | 1351 | return -ENODEV; |
1458 | 1352 | ||
1459 | } | 1353 | } |
1460 | 1354 | ||
1461 | static int usbvision_vbi_close(struct inode *inode, struct file *file) | 1355 | static int usbvision_vbi_close(struct inode *inode, struct file *file) |
1462 | { | 1356 | { |
1463 | /* TODO */ | 1357 | /* TODO */ |
1464 | return -EINVAL; | 1358 | return -ENODEV; |
1465 | } | 1359 | } |
1466 | 1360 | ||
1467 | static int usbvision_do_vbi_ioctl(struct inode *inode, struct file *file, | 1361 | static int usbvision_do_vbi_ioctl(struct inode *inode, struct file *file, |
1468 | unsigned int cmd, void *arg) | 1362 | unsigned int cmd, void *arg) |
1469 | { | 1363 | { |
1470 | /* TODO */ | 1364 | /* TODO */ |
1471 | return -EINVAL; | 1365 | return -ENOIOCTLCMD; |
1472 | } | 1366 | } |
1473 | 1367 | ||
1474 | static int usbvision_vbi_ioctl(struct inode *inode, struct file *file, | 1368 | static int usbvision_vbi_ioctl(struct inode *inode, struct file *file, |
@@ -1489,8 +1383,11 @@ static const struct file_operations usbvision_fops = { | |||
1489 | .release = usbvision_v4l2_close, | 1383 | .release = usbvision_v4l2_close, |
1490 | .read = usbvision_v4l2_read, | 1384 | .read = usbvision_v4l2_read, |
1491 | .mmap = usbvision_v4l2_mmap, | 1385 | .mmap = usbvision_v4l2_mmap, |
1492 | .ioctl = usbvision_v4l2_ioctl, | 1386 | .ioctl = video_ioctl2, |
1493 | .llseek = no_llseek, | 1387 | .llseek = no_llseek, |
1388 | /* .poll = video_poll, */ | ||
1389 | .mmap = usbvision_v4l2_mmap, | ||
1390 | .compat_ioctl = v4l_compat_ioctl32, | ||
1494 | }; | 1391 | }; |
1495 | static struct video_device usbvision_video_template = { | 1392 | static struct video_device usbvision_video_template = { |
1496 | .owner = THIS_MODULE, | 1393 | .owner = THIS_MODULE, |
@@ -1500,6 +1397,39 @@ static struct video_device usbvision_video_template = { | |||
1500 | .name = "usbvision-video", | 1397 | .name = "usbvision-video", |
1501 | .release = video_device_release, | 1398 | .release = video_device_release, |
1502 | .minor = -1, | 1399 | .minor = -1, |
1400 | .vidioc_querycap = vidioc_querycap, | ||
1401 | .vidioc_enum_fmt_cap = vidioc_enum_fmt_cap, | ||
1402 | .vidioc_g_fmt_cap = vidioc_g_fmt_cap, | ||
1403 | .vidioc_try_fmt_cap = vidioc_try_fmt_cap, | ||
1404 | .vidioc_s_fmt_cap = vidioc_s_fmt_cap, | ||
1405 | .vidioc_reqbufs = vidioc_reqbufs, | ||
1406 | .vidioc_querybuf = vidioc_querybuf, | ||
1407 | .vidioc_qbuf = vidioc_qbuf, | ||
1408 | .vidioc_dqbuf = vidioc_dqbuf, | ||
1409 | .vidioc_s_std = vidioc_s_std, | ||
1410 | .vidioc_enum_input = vidioc_enum_input, | ||
1411 | .vidioc_g_input = vidioc_g_input, | ||
1412 | .vidioc_s_input = vidioc_s_input, | ||
1413 | .vidioc_queryctrl = vidioc_queryctrl, | ||
1414 | .vidioc_g_audio = vidioc_g_audio, | ||
1415 | .vidioc_g_audio = vidioc_s_audio, | ||
1416 | .vidioc_g_ctrl = vidioc_g_ctrl, | ||
1417 | .vidioc_s_ctrl = vidioc_s_ctrl, | ||
1418 | .vidioc_streamon = vidioc_streamon, | ||
1419 | .vidioc_streamoff = vidioc_streamoff, | ||
1420 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1421 | /* .vidiocgmbuf = vidiocgmbuf, */ | ||
1422 | #endif | ||
1423 | .vidioc_g_tuner = vidioc_g_tuner, | ||
1424 | .vidioc_s_tuner = vidioc_s_tuner, | ||
1425 | .vidioc_g_frequency = vidioc_g_frequency, | ||
1426 | .vidioc_s_frequency = vidioc_s_frequency, | ||
1427 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1428 | .vidioc_g_register = vidioc_g_register, | ||
1429 | .vidioc_s_register = vidioc_s_register, | ||
1430 | #endif | ||
1431 | .tvnorms = USBVISION_NORMS, | ||
1432 | .current_norm = V4L2_STD_PAL | ||
1503 | }; | 1433 | }; |
1504 | 1434 | ||
1505 | 1435 | ||
@@ -1508,8 +1438,9 @@ static const struct file_operations usbvision_radio_fops = { | |||
1508 | .owner = THIS_MODULE, | 1438 | .owner = THIS_MODULE, |
1509 | .open = usbvision_radio_open, | 1439 | .open = usbvision_radio_open, |
1510 | .release = usbvision_radio_close, | 1440 | .release = usbvision_radio_close, |
1511 | .ioctl = usbvision_radio_ioctl, | 1441 | .ioctl = video_ioctl2, |
1512 | .llseek = no_llseek, | 1442 | .llseek = no_llseek, |
1443 | .compat_ioctl = v4l_compat_ioctl32, | ||
1513 | }; | 1444 | }; |
1514 | 1445 | ||
1515 | static struct video_device usbvision_radio_template= | 1446 | static struct video_device usbvision_radio_template= |
@@ -1518,12 +1449,27 @@ static struct video_device usbvision_radio_template= | |||
1518 | .type = VID_TYPE_TUNER, | 1449 | .type = VID_TYPE_TUNER, |
1519 | .hardware = VID_HARDWARE_USBVISION, | 1450 | .hardware = VID_HARDWARE_USBVISION, |
1520 | .fops = &usbvision_radio_fops, | 1451 | .fops = &usbvision_radio_fops, |
1521 | .release = video_device_release, | ||
1522 | .name = "usbvision-radio", | 1452 | .name = "usbvision-radio", |
1453 | .release = video_device_release, | ||
1523 | .minor = -1, | 1454 | .minor = -1, |
1455 | .vidioc_querycap = vidioc_querycap, | ||
1456 | .vidioc_enum_input = vidioc_enum_input, | ||
1457 | .vidioc_g_input = vidioc_g_input, | ||
1458 | .vidioc_s_input = vidioc_s_input, | ||
1459 | .vidioc_queryctrl = vidioc_queryctrl, | ||
1460 | .vidioc_g_audio = vidioc_g_audio, | ||
1461 | .vidioc_g_audio = vidioc_s_audio, | ||
1462 | .vidioc_g_ctrl = vidioc_g_ctrl, | ||
1463 | .vidioc_s_ctrl = vidioc_s_ctrl, | ||
1464 | .vidioc_g_tuner = vidioc_g_tuner, | ||
1465 | .vidioc_s_tuner = vidioc_s_tuner, | ||
1466 | .vidioc_g_frequency = vidioc_g_frequency, | ||
1467 | .vidioc_s_frequency = vidioc_s_frequency, | ||
1468 | |||
1469 | .tvnorms = USBVISION_NORMS, | ||
1470 | .current_norm = V4L2_STD_PAL | ||
1524 | }; | 1471 | }; |
1525 | 1472 | ||
1526 | |||
1527 | // vbi template | 1473 | // vbi template |
1528 | static const struct file_operations usbvision_vbi_fops = { | 1474 | static const struct file_operations usbvision_vbi_fops = { |
1529 | .owner = THIS_MODULE, | 1475 | .owner = THIS_MODULE, |
@@ -1531,6 +1477,7 @@ static const struct file_operations usbvision_vbi_fops = { | |||
1531 | .release = usbvision_vbi_close, | 1477 | .release = usbvision_vbi_close, |
1532 | .ioctl = usbvision_vbi_ioctl, | 1478 | .ioctl = usbvision_vbi_ioctl, |
1533 | .llseek = no_llseek, | 1479 | .llseek = no_llseek, |
1480 | .compat_ioctl = v4l_compat_ioctl32, | ||
1534 | }; | 1481 | }; |
1535 | 1482 | ||
1536 | static struct video_device usbvision_vbi_template= | 1483 | static struct video_device usbvision_vbi_template= |
@@ -1574,11 +1521,11 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision) | |||
1574 | { | 1521 | { |
1575 | // vbi Device: | 1522 | // vbi Device: |
1576 | if (usbvision->vbi) { | 1523 | if (usbvision->vbi) { |
1577 | PDEBUG(DBG_PROBE, "unregister /dev/vbi%d [v4l2]", usbvision->vbi->minor & 0x1f); | 1524 | PDEBUG(DBG_PROBE, "unregister /dev/vbi%d [v4l2]", |
1525 | usbvision->vbi->minor & 0x1f); | ||
1578 | if (usbvision->vbi->minor != -1) { | 1526 | if (usbvision->vbi->minor != -1) { |
1579 | video_unregister_device(usbvision->vbi); | 1527 | video_unregister_device(usbvision->vbi); |
1580 | } | 1528 | } else { |
1581 | else { | ||
1582 | video_device_release(usbvision->vbi); | 1529 | video_device_release(usbvision->vbi); |
1583 | } | 1530 | } |
1584 | usbvision->vbi = NULL; | 1531 | usbvision->vbi = NULL; |
@@ -1586,11 +1533,11 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision) | |||
1586 | 1533 | ||
1587 | // Radio Device: | 1534 | // Radio Device: |
1588 | if (usbvision->rdev) { | 1535 | if (usbvision->rdev) { |
1589 | PDEBUG(DBG_PROBE, "unregister /dev/radio%d [v4l2]", usbvision->rdev->minor & 0x1f); | 1536 | PDEBUG(DBG_PROBE, "unregister /dev/radio%d [v4l2]", |
1537 | usbvision->rdev->minor & 0x1f); | ||
1590 | if (usbvision->rdev->minor != -1) { | 1538 | if (usbvision->rdev->minor != -1) { |
1591 | video_unregister_device(usbvision->rdev); | 1539 | video_unregister_device(usbvision->rdev); |
1592 | } | 1540 | } else { |
1593 | else { | ||
1594 | video_device_release(usbvision->rdev); | 1541 | video_device_release(usbvision->rdev); |
1595 | } | 1542 | } |
1596 | usbvision->rdev = NULL; | 1543 | usbvision->rdev = NULL; |
@@ -1598,11 +1545,11 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision) | |||
1598 | 1545 | ||
1599 | // Video Device: | 1546 | // Video Device: |
1600 | if (usbvision->vdev) { | 1547 | if (usbvision->vdev) { |
1601 | PDEBUG(DBG_PROBE, "unregister /dev/video%d [v4l2]", usbvision->vdev->minor & 0x1f); | 1548 | PDEBUG(DBG_PROBE, "unregister /dev/video%d [v4l2]", |
1549 | usbvision->vdev->minor & 0x1f); | ||
1602 | if (usbvision->vdev->minor != -1) { | 1550 | if (usbvision->vdev->minor != -1) { |
1603 | video_unregister_device(usbvision->vdev); | 1551 | video_unregister_device(usbvision->vdev); |
1604 | } | 1552 | } else { |
1605 | else { | ||
1606 | video_device_release(usbvision->vdev); | 1553 | video_device_release(usbvision->vdev); |
1607 | } | 1554 | } |
1608 | usbvision->vdev = NULL; | 1555 | usbvision->vdev = NULL; |
@@ -1613,37 +1560,52 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision) | |||
1613 | static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) | 1560 | static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) |
1614 | { | 1561 | { |
1615 | // Video Device: | 1562 | // Video Device: |
1616 | usbvision->vdev = usbvision_vdev_init(usbvision, &usbvision_video_template, "USBVision Video"); | 1563 | usbvision->vdev = usbvision_vdev_init(usbvision, |
1564 | &usbvision_video_template, | ||
1565 | "USBVision Video"); | ||
1617 | if (usbvision->vdev == NULL) { | 1566 | if (usbvision->vdev == NULL) { |
1618 | goto err_exit; | 1567 | goto err_exit; |
1619 | } | 1568 | } |
1620 | if (video_register_device(usbvision->vdev, VFL_TYPE_GRABBER, video_nr)<0) { | 1569 | if (video_register_device(usbvision->vdev, |
1570 | VFL_TYPE_GRABBER, | ||
1571 | video_nr)<0) { | ||
1621 | goto err_exit; | 1572 | goto err_exit; |
1622 | } | 1573 | } |
1623 | printk(KERN_INFO "USBVision[%d]: registered USBVision Video device /dev/video%d [v4l2]\n", usbvision->nr,usbvision->vdev->minor & 0x1f); | 1574 | printk(KERN_INFO "USBVision[%d]: registered USBVision Video device /dev/video%d [v4l2]\n", |
1575 | usbvision->nr,usbvision->vdev->minor & 0x1f); | ||
1624 | 1576 | ||
1625 | // Radio Device: | 1577 | // Radio Device: |
1626 | if (usbvision_device_data[usbvision->DevModel].Radio) { | 1578 | if (usbvision_device_data[usbvision->DevModel].Radio) { |
1627 | // usbvision has radio | 1579 | // usbvision has radio |
1628 | usbvision->rdev = usbvision_vdev_init(usbvision, &usbvision_radio_template, "USBVision Radio"); | 1580 | usbvision->rdev = usbvision_vdev_init(usbvision, |
1581 | &usbvision_radio_template, | ||
1582 | "USBVision Radio"); | ||
1629 | if (usbvision->rdev == NULL) { | 1583 | if (usbvision->rdev == NULL) { |
1630 | goto err_exit; | 1584 | goto err_exit; |
1631 | } | 1585 | } |
1632 | if (video_register_device(usbvision->rdev, VFL_TYPE_RADIO, radio_nr)<0) { | 1586 | if (video_register_device(usbvision->rdev, |
1587 | VFL_TYPE_RADIO, | ||
1588 | radio_nr)<0) { | ||
1633 | goto err_exit; | 1589 | goto err_exit; |
1634 | } | 1590 | } |
1635 | printk(KERN_INFO "USBVision[%d]: registered USBVision Radio device /dev/radio%d [v4l2]\n", usbvision->nr, usbvision->rdev->minor & 0x1f); | 1591 | printk(KERN_INFO "USBVision[%d]: registered USBVision Radio device /dev/radio%d [v4l2]\n", |
1592 | usbvision->nr, usbvision->rdev->minor & 0x1f); | ||
1636 | } | 1593 | } |
1637 | // vbi Device: | 1594 | // vbi Device: |
1638 | if (usbvision_device_data[usbvision->DevModel].vbi) { | 1595 | if (usbvision_device_data[usbvision->DevModel].vbi) { |
1639 | usbvision->vbi = usbvision_vdev_init(usbvision, &usbvision_vbi_template, "USBVision VBI"); | 1596 | usbvision->vbi = usbvision_vdev_init(usbvision, |
1597 | &usbvision_vbi_template, | ||
1598 | "USBVision VBI"); | ||
1640 | if (usbvision->vdev == NULL) { | 1599 | if (usbvision->vdev == NULL) { |
1641 | goto err_exit; | 1600 | goto err_exit; |
1642 | } | 1601 | } |
1643 | if (video_register_device(usbvision->vbi, VFL_TYPE_VBI, vbi_nr)<0) { | 1602 | if (video_register_device(usbvision->vbi, |
1603 | VFL_TYPE_VBI, | ||
1604 | vbi_nr)<0) { | ||
1644 | goto err_exit; | 1605 | goto err_exit; |
1645 | } | 1606 | } |
1646 | printk(KERN_INFO "USBVision[%d]: registered USBVision VBI device /dev/vbi%d [v4l2] (Not Working Yet!)\n", usbvision->nr,usbvision->vbi->minor & 0x1f); | 1607 | printk(KERN_INFO "USBVision[%d]: registered USBVision VBI device /dev/vbi%d [v4l2] (Not Working Yet!)\n", |
1608 | usbvision->nr,usbvision->vbi->minor & 0x1f); | ||
1647 | } | 1609 | } |
1648 | // all done | 1610 | // all done |
1649 | return 0; | 1611 | return 0; |
@@ -1657,7 +1619,8 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) | |||
1657 | /* | 1619 | /* |
1658 | * usbvision_alloc() | 1620 | * usbvision_alloc() |
1659 | * | 1621 | * |
1660 | * This code allocates the struct usb_usbvision. It is filled with default values. | 1622 | * This code allocates the struct usb_usbvision. |
1623 | * It is filled with default values. | ||
1661 | * | 1624 | * |
1662 | * Returns NULL on error, a pointer to usb_usbvision else. | 1625 | * Returns NULL on error, a pointer to usb_usbvision else. |
1663 | * | 1626 | * |
@@ -1666,7 +1629,8 @@ static struct usb_usbvision *usbvision_alloc(struct usb_device *dev) | |||
1666 | { | 1629 | { |
1667 | struct usb_usbvision *usbvision; | 1630 | struct usb_usbvision *usbvision; |
1668 | 1631 | ||
1669 | if ((usbvision = kzalloc(sizeof(struct usb_usbvision), GFP_KERNEL)) == NULL) { | 1632 | if ((usbvision = kzalloc(sizeof(struct usb_usbvision), GFP_KERNEL)) == |
1633 | NULL) { | ||
1670 | goto err_exit; | 1634 | goto err_exit; |
1671 | } | 1635 | } |
1672 | 1636 | ||
@@ -1728,11 +1692,11 @@ static void usbvision_release(struct usb_usbvision *usbvision) | |||
1728 | } | 1692 | } |
1729 | 1693 | ||
1730 | 1694 | ||
1731 | /******************************** usb interface *****************************************/ | 1695 | /*********************** usb interface **********************************/ |
1732 | 1696 | ||
1733 | static void usbvision_configure_video(struct usb_usbvision *usbvision) | 1697 | static void usbvision_configure_video(struct usb_usbvision *usbvision) |
1734 | { | 1698 | { |
1735 | int model,i; | 1699 | int model; |
1736 | 1700 | ||
1737 | if (usbvision == NULL) | 1701 | if (usbvision == NULL) |
1738 | return; | 1702 | return; |
@@ -1741,25 +1705,23 @@ static void usbvision_configure_video(struct usb_usbvision *usbvision) | |||
1741 | usbvision->palette = usbvision_v4l2_format[2]; // V4L2_PIX_FMT_RGB24; | 1705 | usbvision->palette = usbvision_v4l2_format[2]; // V4L2_PIX_FMT_RGB24; |
1742 | 1706 | ||
1743 | if (usbvision_device_data[usbvision->DevModel].Vin_Reg2_override) { | 1707 | if (usbvision_device_data[usbvision->DevModel].Vin_Reg2_override) { |
1744 | usbvision->Vin_Reg2_Preset = usbvision_device_data[usbvision->DevModel].Vin_Reg2; | 1708 | usbvision->Vin_Reg2_Preset = |
1709 | usbvision_device_data[usbvision->DevModel].Vin_Reg2; | ||
1745 | } else { | 1710 | } else { |
1746 | usbvision->Vin_Reg2_Preset = 0; | 1711 | usbvision->Vin_Reg2_Preset = 0; |
1747 | } | 1712 | } |
1748 | 1713 | ||
1749 | for (i = 0; i < TVNORMS; i++) | 1714 | usbvision->tvnormId = usbvision_device_data[model].VideoNorm; |
1750 | if (usbvision_device_data[model].VideoNorm == tvnorms[i].mode) | ||
1751 | break; | ||
1752 | if (i == TVNORMS) | ||
1753 | i = 0; | ||
1754 | usbvision->tvnorm = &tvnorms[i]; /* set default norm */ | ||
1755 | 1715 | ||
1756 | usbvision->video_inputs = usbvision_device_data[model].VideoChannels; | 1716 | usbvision->video_inputs = usbvision_device_data[model].VideoChannels; |
1757 | usbvision->ctl_input = 0; | 1717 | usbvision->ctl_input = 0; |
1758 | 1718 | ||
1759 | /* This should be here to make i2c clients to be able to register */ | 1719 | /* This should be here to make i2c clients to be able to register */ |
1760 | usbvision_audio_off(usbvision); //first switch off audio | 1720 | /* first switch off audio */ |
1721 | usbvision_audio_off(usbvision); | ||
1761 | if (!PowerOnAtOpen) { | 1722 | if (!PowerOnAtOpen) { |
1762 | usbvision_power_on(usbvision); //and then power up the noisy tuner | 1723 | /* and then power up the noisy tuner */ |
1724 | usbvision_power_on(usbvision); | ||
1763 | usbvision_i2c_register(usbvision); | 1725 | usbvision_i2c_register(usbvision); |
1764 | } | 1726 | } |
1765 | } | 1727 | } |
@@ -1796,18 +1758,22 @@ static int __devinit usbvision_probe(struct usb_interface *intf, | |||
1796 | 1758 | ||
1797 | if (usbvision_device_data[model].Interface >= 0) { | 1759 | if (usbvision_device_data[model].Interface >= 0) { |
1798 | interface = &dev->actconfig->interface[usbvision_device_data[model].Interface]->altsetting[0]; | 1760 | interface = &dev->actconfig->interface[usbvision_device_data[model].Interface]->altsetting[0]; |
1799 | } | 1761 | } else { |
1800 | else { | ||
1801 | interface = &dev->actconfig->interface[ifnum]->altsetting[0]; | 1762 | interface = &dev->actconfig->interface[ifnum]->altsetting[0]; |
1802 | } | 1763 | } |
1803 | endpoint = &interface->endpoint[1].desc; | 1764 | endpoint = &interface->endpoint[1].desc; |
1804 | if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_ISOC) { | 1765 | if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != |
1805 | err("%s: interface %d. has non-ISO endpoint!", __FUNCTION__, ifnum); | 1766 | USB_ENDPOINT_XFER_ISOC) { |
1806 | err("%s: Endpoint attributes %d", __FUNCTION__, endpoint->bmAttributes); | 1767 | err("%s: interface %d. has non-ISO endpoint!", |
1768 | __FUNCTION__, ifnum); | ||
1769 | err("%s: Endpoint attributes %d", | ||
1770 | __FUNCTION__, endpoint->bmAttributes); | ||
1807 | return -ENODEV; | 1771 | return -ENODEV; |
1808 | } | 1772 | } |
1809 | if ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) { | 1773 | if ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == |
1810 | err("%s: interface %d. has ISO OUT endpoint!", __FUNCTION__, ifnum); | 1774 | USB_DIR_OUT) { |
1775 | err("%s: interface %d. has ISO OUT endpoint!", | ||
1776 | __FUNCTION__, ifnum); | ||
1811 | return -ENODEV; | 1777 | return -ENODEV; |
1812 | } | 1778 | } |
1813 | 1779 | ||
@@ -1818,11 +1784,9 @@ static int __devinit usbvision_probe(struct usb_interface *intf, | |||
1818 | 1784 | ||
1819 | if (dev->descriptor.bNumConfigurations > 1) { | 1785 | if (dev->descriptor.bNumConfigurations > 1) { |
1820 | usbvision->bridgeType = BRIDGE_NT1004; | 1786 | usbvision->bridgeType = BRIDGE_NT1004; |
1821 | } | 1787 | } else if (model == DAZZLE_DVC_90_REV_1_SECAM) { |
1822 | else if (model == DAZZLE_DVC_90_REV_1_SECAM) { | ||
1823 | usbvision->bridgeType = BRIDGE_NT1005; | 1788 | usbvision->bridgeType = BRIDGE_NT1005; |
1824 | } | 1789 | } else { |
1825 | else { | ||
1826 | usbvision->bridgeType = BRIDGE_NT1003; | 1790 | usbvision->bridgeType = BRIDGE_NT1003; |
1827 | } | 1791 | } |
1828 | PDEBUG(DBG_PROBE, "bridgeType %d", usbvision->bridgeType); | 1792 | PDEBUG(DBG_PROBE, "bridgeType %d", usbvision->bridgeType); |
@@ -1919,11 +1883,11 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf) | |||
1919 | up(&usbvision->lock); | 1883 | up(&usbvision->lock); |
1920 | 1884 | ||
1921 | if (usbvision->user) { | 1885 | if (usbvision->user) { |
1922 | printk(KERN_INFO "%s: In use, disconnect pending\n", __FUNCTION__); | 1886 | printk(KERN_INFO "%s: In use, disconnect pending\n", |
1887 | __FUNCTION__); | ||
1923 | wake_up_interruptible(&usbvision->wait_frame); | 1888 | wake_up_interruptible(&usbvision->wait_frame); |
1924 | wake_up_interruptible(&usbvision->wait_stream); | 1889 | wake_up_interruptible(&usbvision->wait_stream); |
1925 | } | 1890 | } else { |
1926 | else { | ||
1927 | usbvision_release(usbvision); | 1891 | usbvision_release(usbvision); |
1928 | } | 1892 | } |
1929 | 1893 | ||
@@ -1950,7 +1914,6 @@ static int __init usbvision_init(void) | |||
1950 | 1914 | ||
1951 | PDEBUG(DBG_PROBE, ""); | 1915 | PDEBUG(DBG_PROBE, ""); |
1952 | 1916 | ||
1953 | PDEBUG(DBG_IOCTL, "IOCTL debugging is enabled [video]"); | ||
1954 | PDEBUG(DBG_IO, "IO debugging is enabled [video]"); | 1917 | PDEBUG(DBG_IO, "IO debugging is enabled [video]"); |
1955 | PDEBUG(DBG_PROBE, "PROBE debugging is enabled [video]"); | 1918 | PDEBUG(DBG_PROBE, "PROBE debugging is enabled [video]"); |
1956 | PDEBUG(DBG_MMAP, "MMAP debugging is enabled [video]"); | 1919 | PDEBUG(DBG_MMAP, "MMAP debugging is enabled [video]"); |
diff --git a/drivers/media/video/usbvision/usbvision.h b/drivers/media/video/usbvision/usbvision.h index c759d00d7014..c5b6c501c869 100644 --- a/drivers/media/video/usbvision/usbvision.h +++ b/drivers/media/video/usbvision/usbvision.h | |||
@@ -221,6 +221,8 @@ enum { | |||
221 | 221 | ||
222 | #define I2C_USB_ADAP_MAX 16 | 222 | #define I2C_USB_ADAP_MAX 16 |
223 | 223 | ||
224 | #define USBVISION_NORMS (V4L2_STD_PAL | V4L2_STD_NTSC | V4L2_STD_SECAM | V4L2_STD_PAL_M) | ||
225 | |||
224 | /* ----------------------------------------------------------------- */ | 226 | /* ----------------------------------------------------------------- */ |
225 | /* usbvision video structures */ | 227 | /* usbvision video structures */ |
226 | /* ----------------------------------------------------------------- */ | 228 | /* ----------------------------------------------------------------- */ |
@@ -301,14 +303,6 @@ struct usbvision_frame_header { | |||
301 | __u16 frameHeight; /* 10 - 11 after endian correction*/ | 303 | __u16 frameHeight; /* 10 - 11 after endian correction*/ |
302 | }; | 304 | }; |
303 | 305 | ||
304 | /* tvnorms */ | ||
305 | struct usbvision_tvnorm { | ||
306 | char *name; | ||
307 | v4l2_std_id id; | ||
308 | /* mode for saa7113h */ | ||
309 | int mode; | ||
310 | }; | ||
311 | |||
312 | struct usbvision_frame { | 306 | struct usbvision_frame { |
313 | char *data; /* Frame buffer */ | 307 | char *data; /* Frame buffer */ |
314 | struct usbvision_frame_header isocHeader; /* Header from stream */ | 308 | struct usbvision_frame_header isocHeader; /* Header from stream */ |
@@ -386,7 +380,6 @@ struct usb_usbvision { | |||
386 | int tuner_type; | 380 | int tuner_type; |
387 | int tuner_addr; | 381 | int tuner_addr; |
388 | int bridgeType; // NT1003, NT1004, NT1005 | 382 | int bridgeType; // NT1003, NT1004, NT1005 |
389 | int channel; | ||
390 | int radio; | 383 | int radio; |
391 | int video_inputs; // # of inputs | 384 | int video_inputs; // # of inputs |
392 | unsigned long freq; | 385 | unsigned long freq; |
@@ -441,7 +434,7 @@ struct usb_usbvision { | |||
441 | 434 | ||
442 | struct v4l2_capability vcap; /* Video capabilities */ | 435 | struct v4l2_capability vcap; /* Video capabilities */ |
443 | unsigned int ctl_input; /* selected input */ | 436 | unsigned int ctl_input; /* selected input */ |
444 | struct usbvision_tvnorm *tvnorm; /* selected tv norm */ | 437 | v4l2_std_id tvnormId; /* selected tv norm */ |
445 | unsigned char video_endp; /* 0x82 for USBVISION devices based */ | 438 | unsigned char video_endp; /* 0x82 for USBVISION devices based */ |
446 | 439 | ||
447 | // Decompression stuff: | 440 | // Decompression stuff: |
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index 0c658b74f2c4..e94a9a6036f5 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c | |||
@@ -2077,12 +2077,10 @@ static int vino_wait_for_frame(struct vino_channel_settings *vcs) | |||
2077 | init_waitqueue_entry(&wait, current); | 2077 | init_waitqueue_entry(&wait, current); |
2078 | /* add ourselves into wait queue */ | 2078 | /* add ourselves into wait queue */ |
2079 | add_wait_queue(&vcs->fb_queue.frame_wait_queue, &wait); | 2079 | add_wait_queue(&vcs->fb_queue.frame_wait_queue, &wait); |
2080 | /* and set current state */ | ||
2081 | set_current_state(TASK_INTERRUPTIBLE); | ||
2082 | 2080 | ||
2083 | /* to ensure that schedule_timeout will return immediately | 2081 | /* to ensure that schedule_timeout will return immediately |
2084 | * if VINO interrupt was triggred meanwhile */ | 2082 | * if VINO interrupt was triggered meanwhile */ |
2085 | schedule_timeout(HZ / 10); | 2083 | schedule_timeout_interruptible(HZ / 10); |
2086 | 2084 | ||
2087 | if (signal_pending(current)) | 2085 | if (signal_pending(current)) |
2088 | err = -EINTR; | 2086 | err = -EINTR; |
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 3ef4d0159c33..f6d3a9460ccc 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/random.h> | 26 | #include <linux/random.h> |
27 | #include <linux/version.h> | 27 | #include <linux/version.h> |
28 | #include <linux/mutex.h> | ||
28 | #include <linux/videodev2.h> | 29 | #include <linux/videodev2.h> |
29 | #include <linux/dma-mapping.h> | 30 | #include <linux/dma-mapping.h> |
30 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | 31 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
@@ -145,9 +146,6 @@ struct vivi_buffer { | |||
145 | 146 | ||
146 | struct vivi_fmt *fmt; | 147 | struct vivi_fmt *fmt; |
147 | 148 | ||
148 | #ifdef CONFIG_VIVI_SCATTER | ||
149 | struct sg_to_addr *to_addr; | ||
150 | #endif | ||
151 | }; | 149 | }; |
152 | 150 | ||
153 | struct vivi_dmaqueue { | 151 | struct vivi_dmaqueue { |
@@ -168,7 +166,7 @@ static LIST_HEAD(vivi_devlist); | |||
168 | struct vivi_dev { | 166 | struct vivi_dev { |
169 | struct list_head vivi_devlist; | 167 | struct list_head vivi_devlist; |
170 | 168 | ||
171 | struct semaphore lock; | 169 | struct mutex lock; |
172 | 170 | ||
173 | int users; | 171 | int users; |
174 | 172 | ||
@@ -232,68 +230,13 @@ static u8 bars[8][3] = { | |||
232 | #define TSTAMP_MAX_Y TSTAMP_MIN_Y+15 | 230 | #define TSTAMP_MAX_Y TSTAMP_MIN_Y+15 |
233 | #define TSTAMP_MIN_X 64 | 231 | #define TSTAMP_MIN_X 64 |
234 | 232 | ||
235 | #ifdef CONFIG_VIVI_SCATTER | ||
236 | static void prep_to_addr(struct sg_to_addr to_addr[], | ||
237 | struct videobuf_buffer *vb) | ||
238 | { | ||
239 | int i, pos=0; | ||
240 | |||
241 | for (i=0;i<vb->dma.nr_pages;i++) { | ||
242 | to_addr[i].sg=&vb->dma.sglist[i]; | ||
243 | to_addr[i].pos=pos; | ||
244 | pos += vb->dma.sglist[i].length; | ||
245 | } | ||
246 | } | ||
247 | |||
248 | static int get_addr_pos(int pos, int pages, struct sg_to_addr to_addr[]) | ||
249 | { | ||
250 | int p1=0,p2=pages-1,p3=pages/2; | ||
251 | |||
252 | /* Sanity test */ | ||
253 | BUG_ON (pos>=to_addr[p2].pos+to_addr[p2].sg->length); | ||
254 | |||
255 | while (p1+1<p2) { | ||
256 | if (pos < to_addr[p3].pos) { | ||
257 | p2=p3; | ||
258 | } else { | ||
259 | p1=p3; | ||
260 | } | ||
261 | p3=(p1+p2)/2; | ||
262 | } | ||
263 | if (pos >= to_addr[p2].pos) | ||
264 | p1=p2; | ||
265 | |||
266 | return (p1); | ||
267 | } | ||
268 | #endif | ||
269 | 233 | ||
270 | #ifdef CONFIG_VIVI_SCATTER | ||
271 | static void gen_line(struct sg_to_addr to_addr[],int inipos,int pages,int wmax, | ||
272 | int hmax, int line, char *timestr) | ||
273 | #else | ||
274 | static void gen_line(char *basep,int inipos,int wmax, | 234 | static void gen_line(char *basep,int inipos,int wmax, |
275 | int hmax, int line, char *timestr) | 235 | int hmax, int line, char *timestr) |
276 | #endif | ||
277 | { | 236 | { |
278 | int w,i,j,pos=inipos,y; | 237 | int w,i,j,pos=inipos,y; |
279 | char *p,*s; | 238 | char *p,*s; |
280 | u8 chr,r,g,b,color; | 239 | u8 chr,r,g,b,color; |
281 | #ifdef CONFIG_VIVI_SCATTER | ||
282 | int pgpos,oldpg; | ||
283 | char *basep; | ||
284 | struct page *pg; | ||
285 | |||
286 | unsigned long flags; | ||
287 | spinlock_t spinlock; | ||
288 | |||
289 | spin_lock_init(&spinlock); | ||
290 | |||
291 | /* Get first addr pointed to pixel position */ | ||
292 | oldpg=get_addr_pos(pos,pages,to_addr); | ||
293 | pg=pfn_to_page(sg_dma_address(to_addr[oldpg].sg) >> PAGE_SHIFT); | ||
294 | spin_lock_irqsave(&spinlock,flags); | ||
295 | basep = kmap_atomic(pg, KM_BOUNCE_READ)+to_addr[oldpg].sg->offset; | ||
296 | #endif | ||
297 | 240 | ||
298 | /* We will just duplicate the second pixel at the packet */ | 241 | /* We will just duplicate the second pixel at the packet */ |
299 | wmax/=2; | 242 | wmax/=2; |
@@ -305,18 +248,7 @@ static void gen_line(char *basep,int inipos,int wmax, | |||
305 | b=bars[w*7/wmax][2]; | 248 | b=bars[w*7/wmax][2]; |
306 | 249 | ||
307 | for (color=0;color<4;color++) { | 250 | for (color=0;color<4;color++) { |
308 | #ifdef CONFIG_VIVI_SCATTER | ||
309 | pgpos=get_addr_pos(pos,pages,to_addr); | ||
310 | if (pgpos!=oldpg) { | ||
311 | pg=pfn_to_page(sg_dma_address(to_addr[pgpos].sg) >> PAGE_SHIFT); | ||
312 | kunmap_atomic(basep, KM_BOUNCE_READ); | ||
313 | basep= kmap_atomic(pg, KM_BOUNCE_READ)+to_addr[pgpos].sg->offset; | ||
314 | oldpg=pgpos; | ||
315 | } | ||
316 | p=basep+pos-to_addr[pgpos].pos; | ||
317 | #else | ||
318 | p=basep+pos; | 251 | p=basep+pos; |
319 | #endif | ||
320 | 252 | ||
321 | switch (color) { | 253 | switch (color) { |
322 | case 0: | 254 | case 0: |
@@ -361,23 +293,7 @@ static void gen_line(char *basep,int inipos,int wmax, | |||
361 | 293 | ||
362 | pos=inipos+j*2; | 294 | pos=inipos+j*2; |
363 | for (color=0;color<4;color++) { | 295 | for (color=0;color<4;color++) { |
364 | #ifdef CONFIG_VIVI_SCATTER | ||
365 | pgpos=get_addr_pos(pos,pages,to_addr); | ||
366 | if (pgpos!=oldpg) { | ||
367 | pg=pfn_to_page(sg_dma_address( | ||
368 | to_addr[pgpos].sg) | ||
369 | >> PAGE_SHIFT); | ||
370 | kunmap_atomic(basep, | ||
371 | KM_BOUNCE_READ); | ||
372 | basep= kmap_atomic(pg, | ||
373 | KM_BOUNCE_READ)+ | ||
374 | to_addr[pgpos].sg->offset; | ||
375 | oldpg=pgpos; | ||
376 | } | ||
377 | p=basep+pos-to_addr[pgpos].pos; | ||
378 | #else | ||
379 | p=basep+pos; | 296 | p=basep+pos; |
380 | #endif | ||
381 | 297 | ||
382 | y=TO_Y(r,g,b); | 298 | y=TO_Y(r,g,b); |
383 | 299 | ||
@@ -402,12 +318,7 @@ static void gen_line(char *basep,int inipos,int wmax, | |||
402 | 318 | ||
403 | 319 | ||
404 | end: | 320 | end: |
405 | #ifdef CONFIG_VIVI_SCATTER | ||
406 | kunmap_atomic(basep, KM_BOUNCE_READ); | ||
407 | spin_unlock_irqrestore(&spinlock,flags); | ||
408 | #else | ||
409 | return; | 321 | return; |
410 | #endif | ||
411 | } | 322 | } |
412 | static void vivi_fillbuff(struct vivi_dev *dev,struct vivi_buffer *buf) | 323 | static void vivi_fillbuff(struct vivi_dev *dev,struct vivi_buffer *buf) |
413 | { | 324 | { |
@@ -415,35 +326,16 @@ static void vivi_fillbuff(struct vivi_dev *dev,struct vivi_buffer *buf) | |||
415 | int hmax = buf->vb.height; | 326 | int hmax = buf->vb.height; |
416 | int wmax = buf->vb.width; | 327 | int wmax = buf->vb.width; |
417 | struct timeval ts; | 328 | struct timeval ts; |
418 | #ifdef CONFIG_VIVI_SCATTER | ||
419 | struct sg_to_addr *to_addr=buf->to_addr; | ||
420 | struct videobuf_buffer *vb=&buf->vb; | ||
421 | #else | ||
422 | char *tmpbuf; | 329 | char *tmpbuf; |
423 | #endif | ||
424 | |||
425 | #ifdef CONFIG_VIVI_SCATTER | ||
426 | /* Test if DMA mapping is ready */ | ||
427 | if (!sg_dma_address(&vb->dma.sglist[0])) | ||
428 | return; | ||
429 | |||
430 | prep_to_addr(to_addr,vb); | ||
431 | 330 | ||
432 | /* Check if there is enough memory */ | ||
433 | BUG_ON(buf->vb.dma.nr_pages << PAGE_SHIFT < (buf->vb.width*buf->vb.height)*2); | ||
434 | #else | ||
435 | if (buf->vb.dma.varea) { | 331 | if (buf->vb.dma.varea) { |
436 | tmpbuf=kmalloc (wmax*2, GFP_KERNEL); | 332 | tmpbuf=kmalloc (wmax*2, GFP_KERNEL); |
437 | } else { | 333 | } else { |
438 | tmpbuf=buf->vb.dma.vmalloc; | 334 | tmpbuf=buf->vb.dma.vmalloc; |
439 | } | 335 | } |
440 | 336 | ||
441 | #endif | ||
442 | 337 | ||
443 | for (h=0;h<hmax;h++) { | 338 | for (h=0;h<hmax;h++) { |
444 | #ifdef CONFIG_VIVI_SCATTER | ||
445 | gen_line(to_addr,pos,vb->dma.nr_pages,wmax,hmax,h,dev->timestr); | ||
446 | #else | ||
447 | if (buf->vb.dma.varea) { | 339 | if (buf->vb.dma.varea) { |
448 | gen_line(tmpbuf,0,wmax,hmax,h,dev->timestr); | 340 | gen_line(tmpbuf,0,wmax,hmax,h,dev->timestr); |
449 | /* FIXME: replacing to __copy_to_user */ | 341 | /* FIXME: replacing to __copy_to_user */ |
@@ -452,7 +344,6 @@ static void vivi_fillbuff(struct vivi_dev *dev,struct vivi_buffer *buf) | |||
452 | } else { | 344 | } else { |
453 | gen_line(tmpbuf,pos,wmax,hmax,h,dev->timestr); | 345 | gen_line(tmpbuf,pos,wmax,hmax,h,dev->timestr); |
454 | } | 346 | } |
455 | #endif | ||
456 | pos += wmax*2; | 347 | pos += wmax*2; |
457 | } | 348 | } |
458 | 349 | ||
@@ -718,11 +609,6 @@ static void free_buffer(struct videobuf_queue *vq, struct vivi_buffer *buf) | |||
718 | if (in_interrupt()) | 609 | if (in_interrupt()) |
719 | BUG(); | 610 | BUG(); |
720 | 611 | ||
721 | #ifdef CONFIG_VIVI_SCATTER | ||
722 | /*FIXME: Maybe a spinlock is required here */ | ||
723 | kfree(buf->to_addr); | ||
724 | buf->to_addr=NULL; | ||
725 | #endif | ||
726 | 612 | ||
727 | videobuf_waiton(&buf->vb,0,0); | 613 | videobuf_waiton(&buf->vb,0,0); |
728 | videobuf_dma_unmap(vq, &buf->vb.dma); | 614 | videobuf_dma_unmap(vq, &buf->vb.dma); |
@@ -768,12 +654,6 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, | |||
768 | 654 | ||
769 | buf->vb.state = STATE_PREPARED; | 655 | buf->vb.state = STATE_PREPARED; |
770 | 656 | ||
771 | #ifdef CONFIG_VIVI_SCATTER | ||
772 | if (NULL == (buf->to_addr = kmalloc(sizeof(*buf->to_addr) * vb->dma.nr_pages,GFP_KERNEL))) { | ||
773 | rc=-ENOMEM; | ||
774 | goto fail; | ||
775 | } | ||
776 | #endif | ||
777 | return 0; | 657 | return 0; |
778 | 658 | ||
779 | fail: | 659 | fail: |
@@ -838,40 +718,6 @@ static void buffer_release(struct videobuf_queue *vq, struct videobuf_buffer *vb | |||
838 | free_buffer(vq,buf); | 718 | free_buffer(vq,buf); |
839 | } | 719 | } |
840 | 720 | ||
841 | #ifdef CONFIG_VIVI_SCATTER | ||
842 | static int vivi_map_sg(void *dev, struct scatterlist *sg, int nents, | ||
843 | int direction) | ||
844 | { | ||
845 | int i; | ||
846 | |||
847 | dprintk(1,"%s, number of pages=%d\n",__FUNCTION__,nents); | ||
848 | BUG_ON(direction == DMA_NONE); | ||
849 | |||
850 | for (i = 0; i < nents; i++ ) { | ||
851 | BUG_ON(!sg[i].page); | ||
852 | |||
853 | sg_dma_address(&sg[i]) = page_to_phys(sg[i].page) + sg[i].offset; | ||
854 | } | ||
855 | |||
856 | return nents; | ||
857 | } | ||
858 | |||
859 | static int vivi_unmap_sg(void *dev,struct scatterlist *sglist,int nr_pages, | ||
860 | int direction) | ||
861 | { | ||
862 | dprintk(1,"%s\n",__FUNCTION__); | ||
863 | return 0; | ||
864 | } | ||
865 | |||
866 | static int vivi_dma_sync_sg(void *dev,struct scatterlist *sglist, int nr_pages, | ||
867 | int direction) | ||
868 | { | ||
869 | // dprintk(1,"%s\n",__FUNCTION__); | ||
870 | |||
871 | // flush_write_buffers(); | ||
872 | return 0; | ||
873 | } | ||
874 | #endif | ||
875 | 721 | ||
876 | static struct videobuf_queue_ops vivi_video_qops = { | 722 | static struct videobuf_queue_ops vivi_video_qops = { |
877 | .buf_setup = buffer_setup, | 723 | .buf_setup = buffer_setup, |
@@ -893,16 +739,16 @@ static struct videobuf_queue_ops vivi_video_qops = { | |||
893 | static int res_get(struct vivi_dev *dev, struct vivi_fh *fh) | 739 | static int res_get(struct vivi_dev *dev, struct vivi_fh *fh) |
894 | { | 740 | { |
895 | /* is it free? */ | 741 | /* is it free? */ |
896 | down(&dev->lock); | 742 | mutex_lock(&dev->lock); |
897 | if (dev->resources) { | 743 | if (dev->resources) { |
898 | /* no, someone else uses it */ | 744 | /* no, someone else uses it */ |
899 | up(&dev->lock); | 745 | mutex_unlock(&dev->lock); |
900 | return 0; | 746 | return 0; |
901 | } | 747 | } |
902 | /* it's free, grab it */ | 748 | /* it's free, grab it */ |
903 | dev->resources =1; | 749 | dev->resources =1; |
904 | dprintk(1,"res: get\n"); | 750 | dprintk(1,"res: get\n"); |
905 | up(&dev->lock); | 751 | mutex_unlock(&dev->lock); |
906 | return 1; | 752 | return 1; |
907 | } | 753 | } |
908 | 754 | ||
@@ -913,10 +759,10 @@ static int res_locked(struct vivi_dev *dev) | |||
913 | 759 | ||
914 | static void res_free(struct vivi_dev *dev, struct vivi_fh *fh) | 760 | static void res_free(struct vivi_dev *dev, struct vivi_fh *fh) |
915 | { | 761 | { |
916 | down(&dev->lock); | 762 | mutex_lock(&dev->lock); |
917 | dev->resources = 0; | 763 | dev->resources = 0; |
918 | dprintk(1,"res: put\n"); | 764 | dprintk(1,"res: put\n"); |
919 | up(&dev->lock); | 765 | mutex_lock(&dev->lock); |
920 | } | 766 | } |
921 | 767 | ||
922 | /* ------------------------------------------------------------------ | 768 | /* ------------------------------------------------------------------ |
@@ -1260,19 +1106,11 @@ static int vivi_open(struct inode *inode, struct file *file) | |||
1260 | sprintf(dev->timestr,"%02d:%02d:%02d:%03d", | 1106 | sprintf(dev->timestr,"%02d:%02d:%02d:%03d", |
1261 | dev->h,dev->m,dev->s,(dev->us+500)/1000); | 1107 | dev->h,dev->m,dev->s,(dev->us+500)/1000); |
1262 | 1108 | ||
1263 | #ifdef CONFIG_VIVI_SCATTER | ||
1264 | videobuf_queue_init(&fh->vb_vidq,VIDEOBUF_DMA_SCATTER, &vivi_video_qops, | ||
1265 | NULL, NULL, | ||
1266 | fh->type, | ||
1267 | V4L2_FIELD_INTERLACED, | ||
1268 | sizeof(struct vivi_buffer),fh); | ||
1269 | #else | ||
1270 | videobuf_queue_init(&fh->vb_vidq, &vivi_video_qops, | 1109 | videobuf_queue_init(&fh->vb_vidq, &vivi_video_qops, |
1271 | NULL, NULL, | 1110 | NULL, NULL, |
1272 | fh->type, | 1111 | fh->type, |
1273 | V4L2_FIELD_INTERLACED, | 1112 | V4L2_FIELD_INTERLACED, |
1274 | sizeof(struct vivi_buffer),fh); | 1113 | sizeof(struct vivi_buffer),fh); |
1275 | #endif | ||
1276 | 1114 | ||
1277 | return 0; | 1115 | return 0; |
1278 | } | 1116 | } |
@@ -1423,7 +1261,7 @@ static int __init vivi_init(void) | |||
1423 | init_waitqueue_head(&dev->vidq.wq); | 1261 | init_waitqueue_head(&dev->vidq.wq); |
1424 | 1262 | ||
1425 | /* initialize locks */ | 1263 | /* initialize locks */ |
1426 | init_MUTEX(&dev->lock); | 1264 | mutex_init(&dev->lock); |
1427 | 1265 | ||
1428 | dev->vidq.timeout.function = vivi_vid_timeout; | 1266 | dev->vidq.timeout.function = vivi_vid_timeout; |
1429 | dev->vidq.timeout.data = (unsigned long)dev; | 1267 | dev->vidq.timeout.data = (unsigned long)dev; |
diff --git a/drivers/media/video/zc0301/Kconfig b/drivers/media/video/zc0301/Kconfig index 47cd93f9c7de..edb00293cd59 100644 --- a/drivers/media/video/zc0301/Kconfig +++ b/drivers/media/video/zc0301/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config USB_ZC0301 | 1 | config USB_ZC0301 |
2 | tristate "USB ZC0301[P] Image Processor and Control Chip support" | 2 | tristate "USB ZC0301[P] Image Processor and Control Chip support" |
3 | depends on VIDEO_V4L1 | 3 | depends on VIDEO_V4L2 |
4 | ---help--- | 4 | ---help--- |
5 | Say Y here if you want support for cameras based on the ZC0301 or | 5 | Say Y here if you want support for cameras based on the ZC0301 or |
6 | ZC0301P Image Processors and Control Chips. | 6 | ZC0301P Image Processors and Control Chips. |
diff --git a/drivers/media/video/zc0301/zc0301.h b/drivers/media/video/zc0301/zc0301.h index 710f12eb9126..a2de50efa31a 100644 --- a/drivers/media/video/zc0301/zc0301.h +++ b/drivers/media/video/zc0301/zc0301.h | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/rwsem.h> | 36 | #include <linux/rwsem.h> |
37 | #include <linux/stddef.h> | 37 | #include <linux/stddef.h> |
38 | #include <linux/string.h> | 38 | #include <linux/string.h> |
39 | #include <linux/kref.h> | ||
39 | 40 | ||
40 | #include "zc0301_sensor.h" | 41 | #include "zc0301_sensor.h" |
41 | 42 | ||
@@ -98,7 +99,7 @@ struct zc0301_module_param { | |||
98 | u16 frame_timeout; | 99 | u16 frame_timeout; |
99 | }; | 100 | }; |
100 | 101 | ||
101 | static DECLARE_RWSEM(zc0301_disconnect); | 102 | static DECLARE_RWSEM(zc0301_dev_lock); |
102 | 103 | ||
103 | struct zc0301_device { | 104 | struct zc0301_device { |
104 | struct video_device* v4ldev; | 105 | struct video_device* v4ldev; |
@@ -121,12 +122,14 @@ struct zc0301_device { | |||
121 | 122 | ||
122 | struct zc0301_module_param module_param; | 123 | struct zc0301_module_param module_param; |
123 | 124 | ||
125 | struct kref kref; | ||
124 | enum zc0301_dev_state state; | 126 | enum zc0301_dev_state state; |
125 | u8 users; | 127 | u8 users; |
126 | 128 | ||
127 | struct mutex dev_mutex, fileop_mutex; | 129 | struct completion probe; |
130 | struct mutex open_mutex, fileop_mutex; | ||
128 | spinlock_t queue_lock; | 131 | spinlock_t queue_lock; |
129 | wait_queue_head_t open, wait_frame, wait_stream; | 132 | wait_queue_head_t wait_open, wait_frame, wait_stream; |
130 | }; | 133 | }; |
131 | 134 | ||
132 | /*****************************************************************************/ | 135 | /*****************************************************************************/ |
@@ -156,8 +159,8 @@ do { \ | |||
156 | else if ((level) == 2) \ | 159 | else if ((level) == 2) \ |
157 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ | 160 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ |
158 | else if ((level) >= 3) \ | 161 | else if ((level) >= 3) \ |
159 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 162 | dev_info(&cam->usbdev->dev, "[%s:%s:%d] " fmt "\n", \ |
160 | __FUNCTION__, __LINE__ , ## args); \ | 163 | __FILE__, __FUNCTION__, __LINE__ , ## args); \ |
161 | } \ | 164 | } \ |
162 | } while (0) | 165 | } while (0) |
163 | # define KDBG(level, fmt, args...) \ | 166 | # define KDBG(level, fmt, args...) \ |
@@ -166,8 +169,8 @@ do { \ | |||
166 | if ((level) == 1 || (level) == 2) \ | 169 | if ((level) == 1 || (level) == 2) \ |
167 | pr_info("zc0301: " fmt "\n", ## args); \ | 170 | pr_info("zc0301: " fmt "\n", ## args); \ |
168 | else if ((level) == 3) \ | 171 | else if ((level) == 3) \ |
169 | pr_debug("zc0301: [%s:%d] " fmt "\n", __FUNCTION__, \ | 172 | pr_debug("sn9c102: [%s:%s:%d] " fmt "\n", __FILE__, \ |
170 | __LINE__ , ## args); \ | 173 | __FUNCTION__, __LINE__ , ## args); \ |
171 | } \ | 174 | } \ |
172 | } while (0) | 175 | } while (0) |
173 | # define V4LDBG(level, name, cmd) \ | 176 | # define V4LDBG(level, name, cmd) \ |
@@ -183,8 +186,8 @@ do { \ | |||
183 | 186 | ||
184 | #undef PDBG | 187 | #undef PDBG |
185 | #define PDBG(fmt, args...) \ | 188 | #define PDBG(fmt, args...) \ |
186 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 189 | dev_info(&cam->usbdev->dev, "[%s:%s:%d] " fmt "\n", __FILE__, __FUNCTION__, \ |
187 | __FUNCTION__, __LINE__ , ## args) | 190 | __LINE__ , ## args) |
188 | 191 | ||
189 | #undef PDBGG | 192 | #undef PDBGG |
190 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ | 193 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ |
diff --git a/drivers/media/video/zc0301/zc0301_core.c b/drivers/media/video/zc0301/zc0301_core.c index f1120551c70c..703b741e46df 100644 --- a/drivers/media/video/zc0301/zc0301_core.c +++ b/drivers/media/video/zc0301/zc0301_core.c | |||
@@ -49,11 +49,11 @@ | |||
49 | 49 | ||
50 | #define ZC0301_MODULE_NAME "V4L2 driver for ZC0301[P] " \ | 50 | #define ZC0301_MODULE_NAME "V4L2 driver for ZC0301[P] " \ |
51 | "Image Processor and Control Chip" | 51 | "Image Processor and Control Chip" |
52 | #define ZC0301_MODULE_AUTHOR "(C) 2006 Luca Risolia" | 52 | #define ZC0301_MODULE_AUTHOR "(C) 2006-2007 Luca Risolia" |
53 | #define ZC0301_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" | 53 | #define ZC0301_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" |
54 | #define ZC0301_MODULE_LICENSE "GPL" | 54 | #define ZC0301_MODULE_LICENSE "GPL" |
55 | #define ZC0301_MODULE_VERSION "1:1.07" | 55 | #define ZC0301_MODULE_VERSION "1:1.10" |
56 | #define ZC0301_MODULE_VERSION_CODE KERNEL_VERSION(1, 1, 7) | 56 | #define ZC0301_MODULE_VERSION_CODE KERNEL_VERSION(1, 1, 10) |
57 | 57 | ||
58 | /*****************************************************************************/ | 58 | /*****************************************************************************/ |
59 | 59 | ||
@@ -573,7 +573,8 @@ static int zc0301_init(struct zc0301_device* cam) | |||
573 | int err = 0; | 573 | int err = 0; |
574 | 574 | ||
575 | if (!(cam->state & DEV_INITIALIZED)) { | 575 | if (!(cam->state & DEV_INITIALIZED)) { |
576 | init_waitqueue_head(&cam->open); | 576 | mutex_init(&cam->open_mutex); |
577 | init_waitqueue_head(&cam->wait_open); | ||
577 | qctrl = s->qctrl; | 578 | qctrl = s->qctrl; |
578 | rect = &(s->cropcap.defrect); | 579 | rect = &(s->cropcap.defrect); |
579 | cam->compression.quality = ZC0301_COMPRESSION_QUALITY; | 580 | cam->compression.quality = ZC0301_COMPRESSION_QUALITY; |
@@ -634,59 +635,73 @@ static int zc0301_init(struct zc0301_device* cam) | |||
634 | return 0; | 635 | return 0; |
635 | } | 636 | } |
636 | 637 | ||
638 | /*****************************************************************************/ | ||
637 | 639 | ||
638 | static void zc0301_release_resources(struct zc0301_device* cam) | 640 | static void zc0301_release_resources(struct kref *kref) |
639 | { | 641 | { |
642 | struct zc0301_device *cam = container_of(kref, struct zc0301_device, | ||
643 | kref); | ||
640 | DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor); | 644 | DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor); |
641 | video_set_drvdata(cam->v4ldev, NULL); | 645 | video_set_drvdata(cam->v4ldev, NULL); |
642 | video_unregister_device(cam->v4ldev); | 646 | video_unregister_device(cam->v4ldev); |
647 | usb_put_dev(cam->usbdev); | ||
643 | kfree(cam->control_buffer); | 648 | kfree(cam->control_buffer); |
649 | kfree(cam); | ||
644 | } | 650 | } |
645 | 651 | ||
646 | /*****************************************************************************/ | ||
647 | 652 | ||
648 | static int zc0301_open(struct inode* inode, struct file* filp) | 653 | static int zc0301_open(struct inode* inode, struct file* filp) |
649 | { | 654 | { |
650 | struct zc0301_device* cam; | 655 | struct zc0301_device* cam; |
651 | int err = 0; | 656 | int err = 0; |
652 | 657 | ||
653 | /* | 658 | if (!down_read_trylock(&zc0301_dev_lock)) |
654 | This is the only safe way to prevent race conditions with | ||
655 | disconnect | ||
656 | */ | ||
657 | if (!down_read_trylock(&zc0301_disconnect)) | ||
658 | return -ERESTARTSYS; | 659 | return -ERESTARTSYS; |
659 | 660 | ||
660 | cam = video_get_drvdata(video_devdata(filp)); | 661 | cam = video_get_drvdata(video_devdata(filp)); |
661 | 662 | ||
662 | if (mutex_lock_interruptible(&cam->dev_mutex)) { | 663 | if (wait_for_completion_interruptible(&cam->probe)) { |
663 | up_read(&zc0301_disconnect); | 664 | up_read(&zc0301_dev_lock); |
664 | return -ERESTARTSYS; | 665 | return -ERESTARTSYS; |
665 | } | 666 | } |
666 | 667 | ||
668 | kref_get(&cam->kref); | ||
669 | |||
670 | if (mutex_lock_interruptible(&cam->open_mutex)) { | ||
671 | kref_put(&cam->kref, zc0301_release_resources); | ||
672 | up_read(&zc0301_dev_lock); | ||
673 | return -ERESTARTSYS; | ||
674 | } | ||
675 | |||
676 | if (cam->state & DEV_DISCONNECTED) { | ||
677 | DBG(1, "Device not present"); | ||
678 | err = -ENODEV; | ||
679 | goto out; | ||
680 | } | ||
681 | |||
667 | if (cam->users) { | 682 | if (cam->users) { |
668 | DBG(2, "Device /dev/video%d is busy...", cam->v4ldev->minor); | 683 | DBG(2, "Device /dev/video%d is busy...", cam->v4ldev->minor); |
684 | DBG(3, "Simultaneous opens are not supported"); | ||
669 | if ((filp->f_flags & O_NONBLOCK) || | 685 | if ((filp->f_flags & O_NONBLOCK) || |
670 | (filp->f_flags & O_NDELAY)) { | 686 | (filp->f_flags & O_NDELAY)) { |
671 | err = -EWOULDBLOCK; | 687 | err = -EWOULDBLOCK; |
672 | goto out; | 688 | goto out; |
673 | } | 689 | } |
674 | mutex_unlock(&cam->dev_mutex); | 690 | DBG(2, "A blocking open() has been requested. Wait for the " |
675 | err = wait_event_interruptible_exclusive(cam->open, | 691 | "device to be released..."); |
676 | cam->state & DEV_DISCONNECTED | 692 | up_read(&zc0301_dev_lock); |
693 | err = wait_event_interruptible_exclusive(cam->wait_open, | ||
694 | (cam->state & DEV_DISCONNECTED) | ||
677 | || !cam->users); | 695 | || !cam->users); |
678 | if (err) { | 696 | down_read(&zc0301_dev_lock); |
679 | up_read(&zc0301_disconnect); | 697 | if (err) |
680 | return err; | 698 | goto out; |
681 | } | ||
682 | if (cam->state & DEV_DISCONNECTED) { | 699 | if (cam->state & DEV_DISCONNECTED) { |
683 | up_read(&zc0301_disconnect); | 700 | err = -ENODEV; |
684 | return -ENODEV; | 701 | goto out; |
685 | } | 702 | } |
686 | mutex_lock(&cam->dev_mutex); | ||
687 | } | 703 | } |
688 | 704 | ||
689 | |||
690 | if (cam->state & DEV_MISCONFIGURED) { | 705 | if (cam->state & DEV_MISCONFIGURED) { |
691 | err = zc0301_init(cam); | 706 | err = zc0301_init(cam); |
692 | if (err) { | 707 | if (err) { |
@@ -711,36 +726,32 @@ static int zc0301_open(struct inode* inode, struct file* filp) | |||
711 | DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor); | 726 | DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor); |
712 | 727 | ||
713 | out: | 728 | out: |
714 | mutex_unlock(&cam->dev_mutex); | 729 | mutex_unlock(&cam->open_mutex); |
715 | up_read(&zc0301_disconnect); | 730 | if (err) |
731 | kref_put(&cam->kref, zc0301_release_resources); | ||
732 | up_read(&zc0301_dev_lock); | ||
716 | return err; | 733 | return err; |
717 | } | 734 | } |
718 | 735 | ||
719 | 736 | ||
720 | static int zc0301_release(struct inode* inode, struct file* filp) | 737 | static int zc0301_release(struct inode* inode, struct file* filp) |
721 | { | 738 | { |
722 | struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); | 739 | struct zc0301_device* cam; |
723 | 740 | ||
724 | mutex_lock(&cam->dev_mutex); /* prevent disconnect() to be called */ | 741 | down_write(&zc0301_dev_lock); |
725 | 742 | ||
726 | zc0301_stop_transfer(cam); | 743 | cam = video_get_drvdata(video_devdata(filp)); |
727 | 744 | ||
745 | zc0301_stop_transfer(cam); | ||
728 | zc0301_release_buffers(cam); | 746 | zc0301_release_buffers(cam); |
729 | |||
730 | if (cam->state & DEV_DISCONNECTED) { | ||
731 | zc0301_release_resources(cam); | ||
732 | usb_put_dev(cam->usbdev); | ||
733 | mutex_unlock(&cam->dev_mutex); | ||
734 | kfree(cam); | ||
735 | return 0; | ||
736 | } | ||
737 | |||
738 | cam->users--; | 747 | cam->users--; |
739 | wake_up_interruptible_nr(&cam->open, 1); | 748 | wake_up_interruptible_nr(&cam->wait_open, 1); |
740 | 749 | ||
741 | DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor); | 750 | DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor); |
742 | 751 | ||
743 | mutex_unlock(&cam->dev_mutex); | 752 | kref_put(&cam->kref, zc0301_release_resources); |
753 | |||
754 | up_write(&zc0301_dev_lock); | ||
744 | 755 | ||
745 | return 0; | 756 | return 0; |
746 | } | 757 | } |
@@ -775,7 +786,7 @@ zc0301_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) | |||
775 | DBG(3, "Close and open the device again to choose the read " | 786 | DBG(3, "Close and open the device again to choose the read " |
776 | "method"); | 787 | "method"); |
777 | mutex_unlock(&cam->fileop_mutex); | 788 | mutex_unlock(&cam->fileop_mutex); |
778 | return -EINVAL; | 789 | return -EBUSY; |
779 | } | 790 | } |
780 | 791 | ||
781 | if (cam->io == IO_NONE) { | 792 | if (cam->io == IO_NONE) { |
@@ -953,7 +964,12 @@ static int zc0301_mmap(struct file* filp, struct vm_area_struct *vma) | |||
953 | return -EIO; | 964 | return -EIO; |
954 | } | 965 | } |
955 | 966 | ||
956 | if (cam->io != IO_MMAP || !(vma->vm_flags & VM_WRITE) || | 967 | if (!(vma->vm_flags & (VM_WRITE | VM_READ))) { |
968 | mutex_unlock(&cam->fileop_mutex); | ||
969 | return -EACCES; | ||
970 | } | ||
971 | |||
972 | if (cam->io != IO_MMAP || | ||
957 | size != PAGE_ALIGN(cam->frame[0].buf.length)) { | 973 | size != PAGE_ALIGN(cam->frame[0].buf.length)) { |
958 | mutex_unlock(&cam->fileop_mutex); | 974 | mutex_unlock(&cam->fileop_mutex); |
959 | return -EINVAL; | 975 | return -EINVAL; |
@@ -984,7 +1000,6 @@ static int zc0301_mmap(struct file* filp, struct vm_area_struct *vma) | |||
984 | 1000 | ||
985 | vma->vm_ops = &zc0301_vm_ops; | 1001 | vma->vm_ops = &zc0301_vm_ops; |
986 | vma->vm_private_data = &cam->frame[i]; | 1002 | vma->vm_private_data = &cam->frame[i]; |
987 | |||
988 | zc0301_vm_open(vma); | 1003 | zc0301_vm_open(vma); |
989 | 1004 | ||
990 | mutex_unlock(&cam->fileop_mutex); | 1005 | mutex_unlock(&cam->fileop_mutex); |
@@ -1211,7 +1226,7 @@ zc0301_vidioc_s_crop(struct zc0301_device* cam, void __user * arg) | |||
1211 | if (cam->frame[i].vma_use_count) { | 1226 | if (cam->frame[i].vma_use_count) { |
1212 | DBG(3, "VIDIOC_S_CROP failed. " | 1227 | DBG(3, "VIDIOC_S_CROP failed. " |
1213 | "Unmap the buffers first."); | 1228 | "Unmap the buffers first."); |
1214 | return -EINVAL; | 1229 | return -EBUSY; |
1215 | } | 1230 | } |
1216 | 1231 | ||
1217 | if (!s->set_crop) { | 1232 | if (!s->set_crop) { |
@@ -1434,7 +1449,7 @@ zc0301_vidioc_try_s_fmt(struct zc0301_device* cam, unsigned int cmd, | |||
1434 | if (cam->frame[i].vma_use_count) { | 1449 | if (cam->frame[i].vma_use_count) { |
1435 | DBG(3, "VIDIOC_S_FMT failed. " | 1450 | DBG(3, "VIDIOC_S_FMT failed. " |
1436 | "Unmap the buffers first."); | 1451 | "Unmap the buffers first."); |
1437 | return -EINVAL; | 1452 | return -EBUSY; |
1438 | } | 1453 | } |
1439 | 1454 | ||
1440 | if (cam->stream == STREAM_ON) | 1455 | if (cam->stream == STREAM_ON) |
@@ -1544,14 +1559,14 @@ zc0301_vidioc_reqbufs(struct zc0301_device* cam, void __user * arg) | |||
1544 | if (cam->io == IO_READ) { | 1559 | if (cam->io == IO_READ) { |
1545 | DBG(3, "Close and open the device again to choose the mmap " | 1560 | DBG(3, "Close and open the device again to choose the mmap " |
1546 | "I/O method"); | 1561 | "I/O method"); |
1547 | return -EINVAL; | 1562 | return -EBUSY; |
1548 | } | 1563 | } |
1549 | 1564 | ||
1550 | for (i = 0; i < cam->nbuffers; i++) | 1565 | for (i = 0; i < cam->nbuffers; i++) |
1551 | if (cam->frame[i].vma_use_count) { | 1566 | if (cam->frame[i].vma_use_count) { |
1552 | DBG(3, "VIDIOC_REQBUFS failed. " | 1567 | DBG(3, "VIDIOC_REQBUFS failed. " |
1553 | "Previous buffers are still mapped."); | 1568 | "Previous buffers are still mapped."); |
1554 | return -EINVAL; | 1569 | return -EBUSY; |
1555 | } | 1570 | } |
1556 | 1571 | ||
1557 | if (cam->stream == STREAM_ON) | 1572 | if (cam->stream == STREAM_ON) |
@@ -1699,9 +1714,6 @@ zc0301_vidioc_streamon(struct zc0301_device* cam, void __user * arg) | |||
1699 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) | 1714 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) |
1700 | return -EINVAL; | 1715 | return -EINVAL; |
1701 | 1716 | ||
1702 | if (list_empty(&cam->inqueue)) | ||
1703 | return -EINVAL; | ||
1704 | |||
1705 | cam->stream = STREAM_ON; | 1717 | cam->stream = STREAM_ON; |
1706 | 1718 | ||
1707 | DBG(3, "Stream on"); | 1719 | DBG(3, "Stream on"); |
@@ -1949,8 +1961,6 @@ zc0301_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
1949 | goto fail; | 1961 | goto fail; |
1950 | } | 1962 | } |
1951 | 1963 | ||
1952 | mutex_init(&cam->dev_mutex); | ||
1953 | |||
1954 | DBG(2, "ZC0301[P] Image Processor and Control Chip detected " | 1964 | DBG(2, "ZC0301[P] Image Processor and Control Chip detected " |
1955 | "(vid/pid 0x%04X:0x%04X)",id->idVendor, id->idProduct); | 1965 | "(vid/pid 0x%04X:0x%04X)",id->idVendor, id->idProduct); |
1956 | 1966 | ||
@@ -1982,7 +1992,7 @@ zc0301_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
1982 | cam->v4ldev->release = video_device_release; | 1992 | cam->v4ldev->release = video_device_release; |
1983 | video_set_drvdata(cam->v4ldev, cam); | 1993 | video_set_drvdata(cam->v4ldev, cam); |
1984 | 1994 | ||
1985 | mutex_lock(&cam->dev_mutex); | 1995 | init_completion(&cam->probe); |
1986 | 1996 | ||
1987 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, | 1997 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, |
1988 | video_nr[dev_nr]); | 1998 | video_nr[dev_nr]); |
@@ -1992,7 +2002,7 @@ zc0301_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
1992 | DBG(1, "Free /dev/videoX node not found"); | 2002 | DBG(1, "Free /dev/videoX node not found"); |
1993 | video_nr[dev_nr] = -1; | 2003 | video_nr[dev_nr] = -1; |
1994 | dev_nr = (dev_nr < ZC0301_MAX_DEVICES-1) ? dev_nr+1 : 0; | 2004 | dev_nr = (dev_nr < ZC0301_MAX_DEVICES-1) ? dev_nr+1 : 0; |
1995 | mutex_unlock(&cam->dev_mutex); | 2005 | complete_all(&cam->probe); |
1996 | goto fail; | 2006 | goto fail; |
1997 | } | 2007 | } |
1998 | 2008 | ||
@@ -2004,8 +2014,10 @@ zc0301_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
2004 | dev_nr = (dev_nr < ZC0301_MAX_DEVICES-1) ? dev_nr+1 : 0; | 2014 | dev_nr = (dev_nr < ZC0301_MAX_DEVICES-1) ? dev_nr+1 : 0; |
2005 | 2015 | ||
2006 | usb_set_intfdata(intf, cam); | 2016 | usb_set_intfdata(intf, cam); |
2017 | kref_init(&cam->kref); | ||
2018 | usb_get_dev(cam->usbdev); | ||
2007 | 2019 | ||
2008 | mutex_unlock(&cam->dev_mutex); | 2020 | complete_all(&cam->probe); |
2009 | 2021 | ||
2010 | return 0; | 2022 | return 0; |
2011 | 2023 | ||
@@ -2022,40 +2034,31 @@ fail: | |||
2022 | 2034 | ||
2023 | static void zc0301_usb_disconnect(struct usb_interface* intf) | 2035 | static void zc0301_usb_disconnect(struct usb_interface* intf) |
2024 | { | 2036 | { |
2025 | struct zc0301_device* cam = usb_get_intfdata(intf); | 2037 | struct zc0301_device* cam; |
2026 | |||
2027 | if (!cam) | ||
2028 | return; | ||
2029 | 2038 | ||
2030 | down_write(&zc0301_disconnect); | 2039 | down_write(&zc0301_dev_lock); |
2031 | 2040 | ||
2032 | mutex_lock(&cam->dev_mutex); | 2041 | cam = usb_get_intfdata(intf); |
2033 | 2042 | ||
2034 | DBG(2, "Disconnecting %s...", cam->v4ldev->name); | 2043 | DBG(2, "Disconnecting %s...", cam->v4ldev->name); |
2035 | 2044 | ||
2036 | wake_up_interruptible_all(&cam->open); | ||
2037 | |||
2038 | if (cam->users) { | 2045 | if (cam->users) { |
2039 | DBG(2, "Device /dev/video%d is open! Deregistration and " | 2046 | DBG(2, "Device /dev/video%d is open! Deregistration and " |
2040 | "memory deallocation are deferred on close.", | 2047 | "memory deallocation are deferred.", |
2041 | cam->v4ldev->minor); | 2048 | cam->v4ldev->minor); |
2042 | cam->state |= DEV_MISCONFIGURED; | 2049 | cam->state |= DEV_MISCONFIGURED; |
2043 | zc0301_stop_transfer(cam); | 2050 | zc0301_stop_transfer(cam); |
2044 | cam->state |= DEV_DISCONNECTED; | 2051 | cam->state |= DEV_DISCONNECTED; |
2045 | wake_up_interruptible(&cam->wait_frame); | 2052 | wake_up_interruptible(&cam->wait_frame); |
2046 | wake_up(&cam->wait_stream); | 2053 | wake_up(&cam->wait_stream); |
2047 | usb_get_dev(cam->usbdev); | 2054 | } else |
2048 | } else { | ||
2049 | cam->state |= DEV_DISCONNECTED; | 2055 | cam->state |= DEV_DISCONNECTED; |
2050 | zc0301_release_resources(cam); | ||
2051 | } | ||
2052 | 2056 | ||
2053 | mutex_unlock(&cam->dev_mutex); | 2057 | wake_up_interruptible_all(&cam->wait_open); |
2054 | 2058 | ||
2055 | if (!cam->users) | 2059 | kref_put(&cam->kref, zc0301_release_resources); |
2056 | kfree(cam); | ||
2057 | 2060 | ||
2058 | up_write(&zc0301_disconnect); | 2061 | up_write(&zc0301_dev_lock); |
2059 | } | 2062 | } |
2060 | 2063 | ||
2061 | 2064 | ||
diff --git a/drivers/media/video/zc0301/zc0301_pas202bcb.c b/drivers/media/video/zc0301/zc0301_pas202bcb.c index 3efb92a0d0da..24b0dfba357e 100644 --- a/drivers/media/video/zc0301/zc0301_pas202bcb.c +++ b/drivers/media/video/zc0301/zc0301_pas202bcb.c | |||
@@ -327,6 +327,7 @@ static struct zc0301_sensor pas202bcb = { | |||
327 | .height = 480, | 327 | .height = 480, |
328 | .pixelformat = V4L2_PIX_FMT_JPEG, | 328 | .pixelformat = V4L2_PIX_FMT_JPEG, |
329 | .priv = 8, | 329 | .priv = 8, |
330 | .colorspace = V4L2_COLORSPACE_JPEG, | ||
330 | }, | 331 | }, |
331 | }; | 332 | }; |
332 | 333 | ||
diff --git a/drivers/media/video/zc0301/zc0301_pb0330.c b/drivers/media/video/zc0301/zc0301_pb0330.c index 5784b1d1491c..9519aba3612e 100644 --- a/drivers/media/video/zc0301/zc0301_pb0330.c +++ b/drivers/media/video/zc0301/zc0301_pb0330.c | |||
@@ -157,6 +157,7 @@ static struct zc0301_sensor pb0330 = { | |||
157 | .height = 480, | 157 | .height = 480, |
158 | .pixelformat = V4L2_PIX_FMT_JPEG, | 158 | .pixelformat = V4L2_PIX_FMT_JPEG, |
159 | .priv = 8, | 159 | .priv = 8, |
160 | .colorspace = V4L2_COLORSPACE_JPEG, | ||
160 | }, | 161 | }, |
161 | }; | 162 | }; |
162 | 163 | ||
diff --git a/drivers/media/video/zc0301/zc0301_sensor.h b/drivers/media/video/zc0301/zc0301_sensor.h index 44e82cff9319..70fe6fc6cdd5 100644 --- a/drivers/media/video/zc0301/zc0301_sensor.h +++ b/drivers/media/video/zc0301/zc0301_sensor.h | |||
@@ -23,7 +23,7 @@ | |||
23 | #define _ZC0301_SENSOR_H_ | 23 | #define _ZC0301_SENSOR_H_ |
24 | 24 | ||
25 | #include <linux/usb.h> | 25 | #include <linux/usb.h> |
26 | #include <linux/videodev.h> | 26 | #include <linux/videodev2.h> |
27 | #include <linux/device.h> | 27 | #include <linux/device.h> |
28 | #include <linux/stddef.h> | 28 | #include <linux/stddef.h> |
29 | #include <linux/errno.h> | 29 | #include <linux/errno.h> |
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index cf0ed6cbb0e3..17118a490f81 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c | |||
@@ -183,14 +183,7 @@ static const int zoran_num_formats = | |||
183 | (sizeof(zoran_formats) / sizeof(struct zoran_format)); | 183 | (sizeof(zoran_formats) / sizeof(struct zoran_format)); |
184 | 184 | ||
185 | // RJ: Test only - want to test BUZ_USE_HIMEM even when CONFIG_BIGPHYS_AREA is defined | 185 | // RJ: Test only - want to test BUZ_USE_HIMEM even when CONFIG_BIGPHYS_AREA is defined |
186 | #if !defined(CONFIG_BIGPHYS_AREA) | ||
187 | //#undef CONFIG_BIGPHYS_AREA | ||
188 | #define BUZ_USE_HIMEM | ||
189 | #endif | ||
190 | 186 | ||
191 | #if defined(CONFIG_BIGPHYS_AREA) | ||
192 | # include <linux/bigphysarea.h> | ||
193 | #endif | ||
194 | 187 | ||
195 | extern int *zr_debug; | 188 | extern int *zr_debug; |
196 | 189 | ||
@@ -250,7 +243,6 @@ static void jpg_fbuffer_free(struct file *file); | |||
250 | * Linux with the necessary memory left over). | 243 | * Linux with the necessary memory left over). |
251 | */ | 244 | */ |
252 | 245 | ||
253 | #if defined(BUZ_USE_HIMEM) && !defined(CONFIG_BIGPHYS_AREA) | ||
254 | static unsigned long | 246 | static unsigned long |
255 | get_high_mem (unsigned long size) | 247 | get_high_mem (unsigned long size) |
256 | { | 248 | { |
@@ -314,7 +306,6 @@ get_high_mem (unsigned long size) | |||
314 | 306 | ||
315 | return hi_mem_ph; | 307 | return hi_mem_ph; |
316 | } | 308 | } |
317 | #endif | ||
318 | 309 | ||
319 | static int | 310 | static int |
320 | v4l_fbuffer_alloc (struct file *file) | 311 | v4l_fbuffer_alloc (struct file *file) |
@@ -323,9 +314,7 @@ v4l_fbuffer_alloc (struct file *file) | |||
323 | struct zoran *zr = fh->zr; | 314 | struct zoran *zr = fh->zr; |
324 | int i, off; | 315 | int i, off; |
325 | unsigned char *mem; | 316 | unsigned char *mem; |
326 | #if defined(BUZ_USE_HIMEM) && !defined(CONFIG_BIGPHYS_AREA) | ||
327 | unsigned long pmem = 0; | 317 | unsigned long pmem = 0; |
328 | #endif | ||
329 | 318 | ||
330 | /* we might have old buffers lying around... */ | 319 | /* we might have old buffers lying around... */ |
331 | if (fh->v4l_buffers.ready_to_be_freed) { | 320 | if (fh->v4l_buffers.ready_to_be_freed) { |
@@ -369,39 +358,6 @@ v4l_fbuffer_alloc (struct file *file) | |||
369 | ZR_DEVNAME(zr), i, (unsigned long) mem, | 358 | ZR_DEVNAME(zr), i, (unsigned long) mem, |
370 | virt_to_bus(mem)); | 359 | virt_to_bus(mem)); |
371 | } else { | 360 | } else { |
372 | #if defined(CONFIG_BIGPHYS_AREA) | ||
373 | /* Use bigphysarea_alloc_pages */ | ||
374 | |||
375 | int n = | ||
376 | (fh->v4l_buffers.buffer_size + PAGE_SIZE - | ||
377 | 1) / PAGE_SIZE; | ||
378 | |||
379 | mem = | ||
380 | (unsigned char *) bigphysarea_alloc_pages(n, 0, | ||
381 | GFP_KERNEL); | ||
382 | if (mem == 0) { | ||
383 | dprintk(1, | ||
384 | KERN_ERR | ||
385 | "%s: v4l_fbuffer_alloc() - bigphysarea_alloc_pages for V4L buf %d failed\n", | ||
386 | ZR_DEVNAME(zr), i); | ||
387 | v4l_fbuffer_free(file); | ||
388 | return -ENOBUFS; | ||
389 | } | ||
390 | fh->v4l_buffers.buffer[i].fbuffer = mem; | ||
391 | fh->v4l_buffers.buffer[i].fbuffer_phys = | ||
392 | virt_to_phys(mem); | ||
393 | fh->v4l_buffers.buffer[i].fbuffer_bus = | ||
394 | virt_to_bus(mem); | ||
395 | dprintk(4, | ||
396 | KERN_INFO | ||
397 | "%s: Bigphysarea frame %d mem 0x%x (bus: 0x%x)\n", | ||
398 | ZR_DEVNAME(zr), i, (unsigned) mem, | ||
399 | (unsigned) virt_to_bus(mem)); | ||
400 | |||
401 | /* Zero out the allocated memory */ | ||
402 | memset(fh->v4l_buffers.buffer[i].fbuffer, 0, | ||
403 | fh->v4l_buffers.buffer_size); | ||
404 | #elif defined(BUZ_USE_HIMEM) | ||
405 | 361 | ||
406 | /* Use high memory which has been left at boot time */ | 362 | /* Use high memory which has been left at boot time */ |
407 | 363 | ||
@@ -441,20 +397,6 @@ v4l_fbuffer_alloc (struct file *file) | |||
441 | fh->v4l_buffers.buffer[i].fbuffer_bus = | 397 | fh->v4l_buffers.buffer[i].fbuffer_bus = |
442 | pmem + i * fh->v4l_buffers.buffer_size; | 398 | pmem + i * fh->v4l_buffers.buffer_size; |
443 | } | 399 | } |
444 | #else | ||
445 | /* No bigphysarea present, usage of high memory disabled, | ||
446 | * but user wants buffers of more than MAX_KMALLOC_MEM */ | ||
447 | dprintk(1, | ||
448 | KERN_ERR | ||
449 | "%s: v4l_fbuffer_alloc() - no bigphysarea_patch present, usage of high memory disabled,\n", | ||
450 | ZR_DEVNAME(zr)); | ||
451 | dprintk(1, | ||
452 | KERN_ERR | ||
453 | "%s: v4l_fbuffer_alloc() - sorry, could not allocate %d V4L buffers of size %d KB.\n", | ||
454 | ZR_DEVNAME(zr), fh->v4l_buffers.num_buffers, | ||
455 | fh->v4l_buffers.buffer_size >> 10); | ||
456 | return -ENOBUFS; | ||
457 | #endif | ||
458 | } | 400 | } |
459 | } | 401 | } |
460 | 402 | ||
@@ -485,11 +427,6 @@ v4l_fbuffer_free (struct file *file) | |||
485 | ClearPageReserved(MAP_NR(mem + off)); | 427 | ClearPageReserved(MAP_NR(mem + off)); |
486 | kfree((void *) fh->v4l_buffers.buffer[i].fbuffer); | 428 | kfree((void *) fh->v4l_buffers.buffer[i].fbuffer); |
487 | } | 429 | } |
488 | #if defined(CONFIG_BIGPHYS_AREA) | ||
489 | else | ||
490 | bigphysarea_free_pages((void *) fh->v4l_buffers. | ||
491 | buffer[i].fbuffer); | ||
492 | #endif | ||
493 | fh->v4l_buffers.buffer[i].fbuffer = NULL; | 430 | fh->v4l_buffers.buffer[i].fbuffer = NULL; |
494 | } | 431 | } |
495 | 432 | ||
diff --git a/drivers/media/video/zr364xx.c b/drivers/media/video/zr364xx.c index b5d3364c94c7..6f1892585cbb 100644 --- a/drivers/media/video/zr364xx.c +++ b/drivers/media/video/zr364xx.c | |||
@@ -92,6 +92,7 @@ static struct usb_device_id device_table[] = { | |||
92 | {USB_DEVICE(0x0784, 0x0040), .driver_info = METHOD1 }, | 92 | {USB_DEVICE(0x0784, 0x0040), .driver_info = METHOD1 }, |
93 | {USB_DEVICE(0x06d6, 0x0034), .driver_info = METHOD0 }, | 93 | {USB_DEVICE(0x06d6, 0x0034), .driver_info = METHOD0 }, |
94 | {USB_DEVICE(0x0a17, 0x0062), .driver_info = METHOD2 }, | 94 | {USB_DEVICE(0x0a17, 0x0062), .driver_info = METHOD2 }, |
95 | {USB_DEVICE(0x06d6, 0x003b), .driver_info = METHOD0 }, | ||
95 | {} /* Terminating entry */ | 96 | {} /* Terminating entry */ |
96 | }; | 97 | }; |
97 | 98 | ||
@@ -792,6 +793,7 @@ static int zr364xx_probe(struct usb_interface *intf, | |||
792 | { | 793 | { |
793 | struct usb_device *udev = interface_to_usbdev(intf); | 794 | struct usb_device *udev = interface_to_usbdev(intf); |
794 | struct zr364xx_camera *cam = NULL; | 795 | struct zr364xx_camera *cam = NULL; |
796 | int err; | ||
795 | 797 | ||
796 | DBG("probing..."); | 798 | DBG("probing..."); |
797 | 799 | ||
@@ -799,12 +801,11 @@ static int zr364xx_probe(struct usb_interface *intf, | |||
799 | info("model %04x:%04x detected", udev->descriptor.idVendor, | 801 | info("model %04x:%04x detected", udev->descriptor.idVendor, |
800 | udev->descriptor.idProduct); | 802 | udev->descriptor.idProduct); |
801 | 803 | ||
802 | if ((cam = | 804 | cam = kzalloc(sizeof(struct zr364xx_camera), GFP_KERNEL); |
803 | kmalloc(sizeof(struct zr364xx_camera), GFP_KERNEL)) == NULL) { | 805 | if (cam == NULL) { |
804 | info("cam: out of memory !"); | 806 | info("cam: out of memory !"); |
805 | return -ENODEV; | 807 | return -ENOMEM; |
806 | } | 808 | } |
807 | memset(cam, 0x00, sizeof(struct zr364xx_camera)); | ||
808 | /* save the init method used by this camera */ | 809 | /* save the init method used by this camera */ |
809 | cam->method = id->driver_info; | 810 | cam->method = id->driver_info; |
810 | 811 | ||
@@ -812,7 +813,7 @@ static int zr364xx_probe(struct usb_interface *intf, | |||
812 | if (cam->vdev == NULL) { | 813 | if (cam->vdev == NULL) { |
813 | info("cam->vdev: out of memory !"); | 814 | info("cam->vdev: out of memory !"); |
814 | kfree(cam); | 815 | kfree(cam); |
815 | return -ENODEV; | 816 | return -ENOMEM; |
816 | } | 817 | } |
817 | memcpy(cam->vdev, &zr364xx_template, sizeof(zr364xx_template)); | 818 | memcpy(cam->vdev, &zr364xx_template, sizeof(zr364xx_template)); |
818 | video_set_drvdata(cam->vdev, cam); | 819 | video_set_drvdata(cam->vdev, cam); |
@@ -858,12 +859,13 @@ static int zr364xx_probe(struct usb_interface *intf, | |||
858 | cam->brightness = 64; | 859 | cam->brightness = 64; |
859 | mutex_init(&cam->lock); | 860 | mutex_init(&cam->lock); |
860 | 861 | ||
861 | if (video_register_device(cam->vdev, VFL_TYPE_GRABBER, -1) == -1) { | 862 | err = video_register_device(cam->vdev, VFL_TYPE_GRABBER, -1); |
863 | if (err) { | ||
862 | info("video_register_device failed"); | 864 | info("video_register_device failed"); |
863 | video_device_release(cam->vdev); | 865 | video_device_release(cam->vdev); |
864 | kfree(cam->buffer); | 866 | kfree(cam->buffer); |
865 | kfree(cam); | 867 | kfree(cam); |
866 | return -ENODEV; | 868 | return err; |
867 | } | 869 | } |
868 | 870 | ||
869 | usb_set_intfdata(intf, cam); | 871 | usb_set_intfdata(intf, cam); |
@@ -905,7 +907,7 @@ static struct usb_driver zr364xx_driver = { | |||
905 | static int __init zr364xx_init(void) | 907 | static int __init zr364xx_init(void) |
906 | { | 908 | { |
907 | int retval; | 909 | int retval; |
908 | retval = usb_register(&zr364xx_driver) < 0; | 910 | retval = usb_register(&zr364xx_driver); |
909 | if (retval) | 911 | if (retval) |
910 | info("usb_register failed!"); | 912 | info("usb_register failed!"); |
911 | else | 913 | else |