diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2014-07-22 00:21:37 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-22 11:53:33 -0400 |
commit | 7955f03d18d14d18188f94581a4ea336c94b1e2d (patch) | |
tree | 45adce1032716316b288dde48682280163cdc8d6 | |
parent | 28cae868cd245b6bb2f27bce807e9d78afcf8ea2 (diff) |
[media] go7007: move out of staging into drivers/media/usb.
Now that the custom motion detection API in this driver has been
replaced with a standard API there is no reason anymore to keep it
in staging. So (finally!) move it to drivers/media/usb.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r-- | drivers/media/usb/Kconfig | 1 | ||||
-rw-r--r-- | drivers/media/usb/Makefile | 1 | ||||
-rw-r--r-- | drivers/media/usb/go7007/Kconfig (renamed from drivers/staging/media/go7007/Kconfig) | 0 | ||||
-rw-r--r-- | drivers/media/usb/go7007/Makefile (renamed from drivers/staging/media/go7007/Makefile) | 4 | ||||
-rw-r--r-- | drivers/media/usb/go7007/go7007-driver.c (renamed from drivers/staging/media/go7007/go7007-driver.c) | 0 | ||||
-rw-r--r-- | drivers/media/usb/go7007/go7007-fw.c (renamed from drivers/staging/media/go7007/go7007-fw.c) | 0 | ||||
-rw-r--r-- | drivers/media/usb/go7007/go7007-i2c.c (renamed from drivers/staging/media/go7007/go7007-i2c.c) | 0 | ||||
-rw-r--r-- | drivers/media/usb/go7007/go7007-loader.c (renamed from drivers/staging/media/go7007/go7007-loader.c) | 0 | ||||
-rw-r--r-- | drivers/media/usb/go7007/go7007-priv.h (renamed from drivers/staging/media/go7007/go7007-priv.h) | 0 | ||||
-rw-r--r-- | drivers/media/usb/go7007/go7007-usb.c (renamed from drivers/staging/media/go7007/go7007-usb.c) | 0 | ||||
-rw-r--r-- | drivers/media/usb/go7007/go7007-v4l2.c (renamed from drivers/staging/media/go7007/go7007-v4l2.c) | 0 | ||||
-rw-r--r-- | drivers/media/usb/go7007/s2250-board.c (renamed from drivers/staging/media/go7007/s2250-board.c) | 0 | ||||
-rw-r--r-- | drivers/media/usb/go7007/snd-go7007.c (renamed from drivers/staging/media/go7007/snd-go7007.c) | 0 | ||||
-rw-r--r-- | drivers/staging/media/Kconfig | 2 | ||||
-rw-r--r-- | drivers/staging/media/Makefile | 1 | ||||
-rw-r--r-- | drivers/staging/media/go7007/README | 136 | ||||
-rw-r--r-- | drivers/staging/media/go7007/go7007.txt | 478 | ||||
-rw-r--r-- | drivers/staging/media/go7007/saa7134-go7007.c | 560 |
18 files changed, 2 insertions, 1181 deletions
diff --git a/drivers/media/usb/Kconfig b/drivers/media/usb/Kconfig index fa67519abda2..94d51e092db3 100644 --- a/drivers/media/usb/Kconfig +++ b/drivers/media/usb/Kconfig | |||
@@ -27,6 +27,7 @@ source "drivers/media/usb/hdpvr/Kconfig" | |||
27 | source "drivers/media/usb/tlg2300/Kconfig" | 27 | source "drivers/media/usb/tlg2300/Kconfig" |
28 | source "drivers/media/usb/usbvision/Kconfig" | 28 | source "drivers/media/usb/usbvision/Kconfig" |
29 | source "drivers/media/usb/stk1160/Kconfig" | 29 | source "drivers/media/usb/stk1160/Kconfig" |
30 | source "drivers/media/usb/go7007/Kconfig" | ||
30 | endif | 31 | endif |
31 | 32 | ||
32 | if (MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT) | 33 | if (MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT) |
diff --git a/drivers/media/usb/Makefile b/drivers/media/usb/Makefile index 712a6b1e8882..f438efffefc5 100644 --- a/drivers/media/usb/Makefile +++ b/drivers/media/usb/Makefile | |||
@@ -22,3 +22,4 @@ obj-$(CONFIG_VIDEO_CX231XX) += cx231xx/ | |||
22 | obj-$(CONFIG_VIDEO_TM6000) += tm6000/ | 22 | obj-$(CONFIG_VIDEO_TM6000) += tm6000/ |
23 | obj-$(CONFIG_VIDEO_EM28XX) += em28xx/ | 23 | obj-$(CONFIG_VIDEO_EM28XX) += em28xx/ |
24 | obj-$(CONFIG_VIDEO_USBTV) += usbtv/ | 24 | obj-$(CONFIG_VIDEO_USBTV) += usbtv/ |
25 | obj-$(CONFIG_VIDEO_GO7007) += go7007/ | ||
diff --git a/drivers/staging/media/go7007/Kconfig b/drivers/media/usb/go7007/Kconfig index 95a3af644a92..95a3af644a92 100644 --- a/drivers/staging/media/go7007/Kconfig +++ b/drivers/media/usb/go7007/Kconfig | |||
diff --git a/drivers/staging/media/go7007/Makefile b/drivers/media/usb/go7007/Makefile index 9c6ad4a263ec..e99287c3b828 100644 --- a/drivers/staging/media/go7007/Makefile +++ b/drivers/media/usb/go7007/Makefile | |||
@@ -8,8 +8,4 @@ go7007-y := go7007-v4l2.o go7007-driver.o go7007-i2c.o go7007-fw.o \ | |||
8 | 8 | ||
9 | s2250-y := s2250-board.o | 9 | s2250-y := s2250-board.o |
10 | 10 | ||
11 | # Uncomment when the saa7134 patches get into upstream | ||
12 | #obj-$(CONFIG_VIDEO_SAA7134) += saa7134-go7007.o | ||
13 | #ccflags-$(CONFIG_VIDEO_SAA7134:m=y) += -Idrivers/media/pci/saa7134 | ||
14 | |||
15 | ccflags-$(CONFIG_VIDEO_GO7007_LOADER:m=y) += -Idrivers/media/common | 11 | ccflags-$(CONFIG_VIDEO_GO7007_LOADER:m=y) += -Idrivers/media/common |
diff --git a/drivers/staging/media/go7007/go7007-driver.c b/drivers/media/usb/go7007/go7007-driver.c index 95cffb771a62..95cffb771a62 100644 --- a/drivers/staging/media/go7007/go7007-driver.c +++ b/drivers/media/usb/go7007/go7007-driver.c | |||
diff --git a/drivers/staging/media/go7007/go7007-fw.c b/drivers/media/usb/go7007/go7007-fw.c index 5f4c9b9e899a..5f4c9b9e899a 100644 --- a/drivers/staging/media/go7007/go7007-fw.c +++ b/drivers/media/usb/go7007/go7007-fw.c | |||
diff --git a/drivers/staging/media/go7007/go7007-i2c.c b/drivers/media/usb/go7007/go7007-i2c.c index 55addfa855d4..55addfa855d4 100644 --- a/drivers/staging/media/go7007/go7007-i2c.c +++ b/drivers/media/usb/go7007/go7007-i2c.c | |||
diff --git a/drivers/staging/media/go7007/go7007-loader.c b/drivers/media/usb/go7007/go7007-loader.c index 042f78a31283..042f78a31283 100644 --- a/drivers/staging/media/go7007/go7007-loader.c +++ b/drivers/media/usb/go7007/go7007-loader.c | |||
diff --git a/drivers/staging/media/go7007/go7007-priv.h b/drivers/media/usb/go7007/go7007-priv.h index 2251c3f99d1d..2251c3f99d1d 100644 --- a/drivers/staging/media/go7007/go7007-priv.h +++ b/drivers/media/usb/go7007/go7007-priv.h | |||
diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/media/usb/go7007/go7007-usb.c index ece27ece8115..ece27ece8115 100644 --- a/drivers/staging/media/go7007/go7007-usb.c +++ b/drivers/media/usb/go7007/go7007-usb.c | |||
diff --git a/drivers/staging/media/go7007/go7007-v4l2.c b/drivers/media/usb/go7007/go7007-v4l2.c index ec799b4d88be..ec799b4d88be 100644 --- a/drivers/staging/media/go7007/go7007-v4l2.c +++ b/drivers/media/usb/go7007/go7007-v4l2.c | |||
diff --git a/drivers/staging/media/go7007/s2250-board.c b/drivers/media/usb/go7007/s2250-board.c index bb846680bcd4..bb846680bcd4 100644 --- a/drivers/staging/media/go7007/s2250-board.c +++ b/drivers/media/usb/go7007/s2250-board.c | |||
diff --git a/drivers/staging/media/go7007/snd-go7007.c b/drivers/media/usb/go7007/snd-go7007.c index d22d7d574672..d22d7d574672 100644 --- a/drivers/staging/media/go7007/snd-go7007.c +++ b/drivers/media/usb/go7007/snd-go7007.c | |||
diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig index 3312a3bd256d..3323eb5e77b0 100644 --- a/drivers/staging/media/Kconfig +++ b/drivers/staging/media/Kconfig | |||
@@ -29,8 +29,6 @@ source "drivers/staging/media/davinci_vpfe/Kconfig" | |||
29 | 29 | ||
30 | source "drivers/staging/media/dt3155v4l/Kconfig" | 30 | source "drivers/staging/media/dt3155v4l/Kconfig" |
31 | 31 | ||
32 | source "drivers/staging/media/go7007/Kconfig" | ||
33 | |||
34 | source "drivers/staging/media/omap24xx/Kconfig" | 32 | source "drivers/staging/media/omap24xx/Kconfig" |
35 | 33 | ||
36 | source "drivers/staging/media/omap4iss/Kconfig" | 34 | source "drivers/staging/media/omap4iss/Kconfig" |
diff --git a/drivers/staging/media/Makefile b/drivers/staging/media/Makefile index 205eba283326..7db83f373f63 100644 --- a/drivers/staging/media/Makefile +++ b/drivers/staging/media/Makefile | |||
@@ -3,7 +3,6 @@ obj-$(CONFIG_I2C_BCM2048) += bcm2048/ | |||
3 | obj-$(CONFIG_DVB_CXD2099) += cxd2099/ | 3 | obj-$(CONFIG_DVB_CXD2099) += cxd2099/ |
4 | obj-$(CONFIG_LIRC_STAGING) += lirc/ | 4 | obj-$(CONFIG_LIRC_STAGING) += lirc/ |
5 | obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l/ | 5 | obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l/ |
6 | obj-$(CONFIG_VIDEO_GO7007) += go7007/ | ||
7 | obj-$(CONFIG_VIDEO_DM365_VPFE) += davinci_vpfe/ | 6 | obj-$(CONFIG_VIDEO_DM365_VPFE) += davinci_vpfe/ |
8 | obj-$(CONFIG_VIDEO_OMAP4) += omap4iss/ | 7 | obj-$(CONFIG_VIDEO_OMAP4) += omap4iss/ |
9 | obj-$(CONFIG_VIDEO_OMAP2) += omap24xx/ | 8 | obj-$(CONFIG_VIDEO_OMAP2) += omap24xx/ |
diff --git a/drivers/staging/media/go7007/README b/drivers/staging/media/go7007/README deleted file mode 100644 index 34516ea3b9c5..000000000000 --- a/drivers/staging/media/go7007/README +++ /dev/null | |||
@@ -1,136 +0,0 @@ | |||
1 | Todo: | ||
2 | - let s2250-board use i2c subdevs as well instead of hardcoding | ||
3 | support for the i2c devices. | ||
4 | - when the driver is moved out of staging, support for saa7134-go7007 | ||
5 | should be added to the saa7134 driver. The patch for that is | ||
6 | included below. | ||
7 | |||
8 | Patch for saa7134: | ||
9 | |||
10 | diff --git a/drivers/media/pci/saa7134/saa7134-cards.c b/drivers/media/pci/saa7134/saa7134-cards.c | ||
11 | index dc68cf1..9a53794 100644 | ||
12 | --- a/drivers/media/pci/saa7134/saa7134-cards.c | ||
13 | +++ b/drivers/media/pci/saa7134/saa7134-cards.c | ||
14 | @@ -5790,6 +5790,29 @@ struct saa7134_board saa7134_boards[] = { | ||
15 | .gpio = 0x6010000, | ||
16 | } }, | ||
17 | }, | ||
18 | + [SAA7134_BOARD_WIS_VOYAGER] = { | ||
19 | + .name = "WIS Voyager or compatible", | ||
20 | + .audio_clock = 0x00200000, | ||
21 | + .tuner_type = TUNER_PHILIPS_TDA8290, | ||
22 | + .radio_type = UNSET, | ||
23 | + .tuner_addr = ADDR_UNSET, | ||
24 | + .radio_addr = ADDR_UNSET, | ||
25 | + .mpeg = SAA7134_MPEG_GO7007, | ||
26 | + .inputs = { { | ||
27 | + .name = name_comp1, | ||
28 | + .vmux = 0, | ||
29 | + .amux = LINE2, | ||
30 | + }, { | ||
31 | + .name = name_tv, | ||
32 | + .vmux = 3, | ||
33 | + .amux = TV, | ||
34 | + .tv = 1, | ||
35 | + }, { | ||
36 | + .name = name_svideo, | ||
37 | + .vmux = 6, | ||
38 | + .amux = LINE1, | ||
39 | + } }, | ||
40 | + }, | ||
41 | |||
42 | }; | ||
43 | |||
44 | @@ -7037,6 +7060,12 @@ struct pci_device_id saa7134_pci_tbl[] = { | ||
45 | .subdevice = 0x0911, | ||
46 | .driver_data = SAA7134_BOARD_SENSORAY811_911, | ||
47 | }, { | ||
48 | + .vendor = PCI_VENDOR_ID_PHILIPS, | ||
49 | + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
50 | + .subvendor = 0x1905, /* WIS */ | ||
51 | + .subdevice = 0x7007, | ||
52 | + .driver_data = SAA7134_BOARD_WIS_VOYAGER, | ||
53 | + }, { | ||
54 | /* --- boards without eeprom + subsystem ID --- */ | ||
55 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
56 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
57 | diff --git a/drivers/media/pci/saa7134/saa7134-core.c b/drivers/media/pci/saa7134/saa7134-core.c | ||
58 | index 8fd24e7..0a849ea 100644 | ||
59 | --- a/drivers/media/pci/saa7134/saa7134-core.c | ||
60 | +++ b/drivers/media/pci/saa7134/saa7134-core.c | ||
61 | @@ -156,6 +156,8 @@ static void request_module_async(struct work_struct *work){ | ||
62 | request_module("saa7134-empress"); | ||
63 | if (card_is_dvb(dev)) | ||
64 | request_module("saa7134-dvb"); | ||
65 | + if (card_is_go7007(dev)) | ||
66 | + request_module("saa7134-go7007"); | ||
67 | if (alsa) { | ||
68 | if (dev->pci->device != PCI_DEVICE_ID_PHILIPS_SAA7130) | ||
69 | request_module("saa7134-alsa"); | ||
70 | @@ -557,8 +559,12 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id) | ||
71 | saa7134_irq_vbi_done(dev,status); | ||
72 | |||
73 | if ((report & SAA7134_IRQ_REPORT_DONE_RA2) && | ||
74 | - card_has_mpeg(dev)) | ||
75 | - saa7134_irq_ts_done(dev,status); | ||
76 | + card_has_mpeg(dev)) { | ||
77 | + if (dev->mops->irq_ts_done != NULL) | ||
78 | + dev->mops->irq_ts_done(dev, status); | ||
79 | + else | ||
80 | + saa7134_irq_ts_done(dev, status); | ||
81 | + } | ||
82 | |||
83 | if (report & SAA7134_IRQ_REPORT_GPIO16) { | ||
84 | switch (dev->has_remote) { | ||
85 | diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h | ||
86 | index 62169dd..5fad39a 100644 | ||
87 | --- a/drivers/media/pci/saa7134/saa7134.h | ||
88 | +++ b/drivers/media/pci/saa7134/saa7134.h | ||
89 | @@ -334,6 +334,7 @@ struct saa7134_card_ir { | ||
90 | #define SAA7134_BOARD_KWORLD_PC150U 189 | ||
91 | #define SAA7134_BOARD_ASUSTeK_PS3_100 190 | ||
92 | #define SAA7134_BOARD_HAWELL_HW_9004V1 191 | ||
93 | +#define SAA7134_BOARD_WIS_VOYAGER 192 | ||
94 | |||
95 | #define SAA7134_MAXBOARDS 32 | ||
96 | #define SAA7134_INPUT_MAX 8 | ||
97 | @@ -364,6 +365,7 @@ enum saa7134_mpeg_type { | ||
98 | SAA7134_MPEG_UNUSED, | ||
99 | SAA7134_MPEG_EMPRESS, | ||
100 | SAA7134_MPEG_DVB, | ||
101 | + SAA7134_MPEG_GO7007, | ||
102 | }; | ||
103 | |||
104 | enum saa7134_mpeg_ts_type { | ||
105 | @@ -403,6 +405,7 @@ struct saa7134_board { | ||
106 | #define card_has_radio(dev) (NULL != saa7134_boards[dev->board].radio.name) | ||
107 | #define card_is_empress(dev) (SAA7134_MPEG_EMPRESS == saa7134_boards[dev->board].mpeg) | ||
108 | #define card_is_dvb(dev) (SAA7134_MPEG_DVB == saa7134_boards[dev->board].mpeg) | ||
109 | +#define card_is_go7007(dev) (SAA7134_MPEG_GO7007 == saa7134_boards[dev->board].mpeg) | ||
110 | #define card_has_mpeg(dev) (SAA7134_MPEG_UNUSED != saa7134_boards[dev->board].mpeg) | ||
111 | #define card(dev) (saa7134_boards[dev->board]) | ||
112 | #define card_in(dev,n) (saa7134_boards[dev->board].inputs[n]) | ||
113 | @@ -535,6 +538,8 @@ struct saa7134_mpeg_ops { | ||
114 | int (*init)(struct saa7134_dev *dev); | ||
115 | int (*fini)(struct saa7134_dev *dev); | ||
116 | void (*signal_change)(struct saa7134_dev *dev); | ||
117 | + void (*irq_ts_done)(struct saa7134_dev *dev, | ||
118 | + unsigned long status); | ||
119 | }; | ||
120 | |||
121 | /* global device status */ | ||
122 | diff --git a/drivers/staging/media/go7007/Makefile b/drivers/staging/media/go7007/Makefile | ||
123 | index 9c6ad4a..1b23689 100644 | ||
124 | --- a/drivers/staging/media/go7007/Makefile | ||
125 | +++ b/drivers/staging/media/go7007/Makefile | ||
126 | @@ -8,8 +8,7 @@ go7007-y := go7007-v4l2.o go7007-driver.o go7007-i2c.o go7007-fw.o \ | ||
127 | |||
128 | s2250-y := s2250-board.o | ||
129 | |||
130 | -# Uncomment when the saa7134 patches get into upstream | ||
131 | -#obj-$(CONFIG_VIDEO_SAA7134) += saa7134-go7007.o | ||
132 | -#ccflags-$(CONFIG_VIDEO_SAA7134:m=y) += -Idrivers/media/pci/saa7134 | ||
133 | +obj-$(CONFIG_VIDEO_SAA7134) += saa7134-go7007.o | ||
134 | +ccflags-$(CONFIG_VIDEO_SAA7134:m=y) += -Idrivers/media/pci/saa7134 | ||
135 | |||
136 | ccflags-$(CONFIG_VIDEO_GO7007_LOADER:m=y) += -Idrivers/media/common | ||
diff --git a/drivers/staging/media/go7007/go7007.txt b/drivers/staging/media/go7007/go7007.txt deleted file mode 100644 index c8e5eb09d385..000000000000 --- a/drivers/staging/media/go7007/go7007.txt +++ /dev/null | |||
@@ -1,478 +0,0 @@ | |||
1 | This is a driver for the WIS GO7007SB multi-format video encoder. | ||
2 | |||
3 | Pete Eberlein <pete@sensoray.com> | ||
4 | |||
5 | The driver was originally released under the GPL and is currently hosted at: | ||
6 | http://nikosapi.org/wiki/index.php/WIS_Go7007_Linux_driver | ||
7 | The go7007 firmware can be acquired from the package on the site above. | ||
8 | |||
9 | I've modified the driver to support the following Video4Linux2 MPEG | ||
10 | controls, with acceptable values: | ||
11 | |||
12 | V4L2_CID_MPEG_STREAM_TYPE V4L2_MPEG_STREAM_TYPE_MPEG2_DVD | ||
13 | V4L2_MPEG_STREAM_TYPE_MPEG_ELEM | ||
14 | V4L2_CID_MPEG_VIDEO_ENCODING V4L2_MPEG_VIDEO_ENCODING_MPEG_1 | ||
15 | V4L2_MPEG_VIDEO_ENCODING_MPEG_2 | ||
16 | V4L2_MPEG_VIDEO_ENCODING_MPEG_4 | ||
17 | V4L2_CID_MPEG_VIDEO_ASPECT V4L2_MPEG_VIDEO_ASPECT_1x1 | ||
18 | V4L2_MPEG_VIDEO_ASPECT_4x3 | ||
19 | V4L2_MPEG_VIDEO_ASPECT_16x9 | ||
20 | V4L2_CID_MPEG_VIDEO_GOP_SIZE integer | ||
21 | V4L2_CID_MPEG_VIDEO_BITRATE 64000 .. 10000000 | ||
22 | |||
23 | These should be used instead of the non-standard GO7007 ioctls described | ||
24 | below. | ||
25 | |||
26 | |||
27 | The README files from the orignal package appear below: | ||
28 | |||
29 | --------------------------------------------------------------------------- | ||
30 | WIS GO7007SB Public Linux Driver | ||
31 | --------------------------------------------------------------------------- | ||
32 | |||
33 | |||
34 | *** Please see the file RELEASE-NOTES for important last-minute updates *** | ||
35 | |||
36 | |||
37 | 0. OVERVIEW AND LICENSING/DISCLAIMER | ||
38 | |||
39 | |||
40 | This driver kit contains Linux drivers for the WIS GO7007SB multi-format | ||
41 | video encoder. Only kernel version 2.6.x is supported. The video stream | ||
42 | is available through the Video4Linux2 API and the audio stream is available | ||
43 | through the ALSA API (or the OSS emulation layer of the ALSA system). | ||
44 | |||
45 | The files in kernel/ and hotplug/ are licensed under the GNU General Public | ||
46 | License Version 2 from the Free Software Foundation. A copy of the license | ||
47 | is included in the file COPYING. | ||
48 | |||
49 | The example applications in apps/ and C header files in include/ are | ||
50 | licensed under a permissive license included in the source files which | ||
51 | allows copying, modification and redistribution for any purpose without | ||
52 | attribution. | ||
53 | |||
54 | The firmware files included in the firmware/ directory may be freely | ||
55 | redistributed only in conjunction with this document; but modification, | ||
56 | tampering and reverse engineering are prohibited. | ||
57 | |||
58 | MICRONAS USA, INC., MAKES NO WARRANTIES TO ANY PERSON OR ENTITY WITH | ||
59 | RESPECT TO THE SOFTWARE OR ANY DERIVATIVES THEREOF OR ANY SERVICES OR | ||
60 | LICENSES AND DISCLAIMS ALL IMPLIED WARRANTIES, INCLUDING WITHOUT LIMITATION | ||
61 | WARRANTIES OF MERCHANTABILITY, SUPPORT, AND FITNESS FOR A PARTICULAR | ||
62 | PURPOSE AND NON-INFRINGEMENT. | ||
63 | |||
64 | |||
65 | 1. SYSTEM REQUIREMENTS | ||
66 | |||
67 | |||
68 | This driver requires Linux kernel 2.6. Kernel 2.4 is not supported. Using | ||
69 | kernel 2.6.10 or later is recommended, as earlier kernels are known to have | ||
70 | unstable USB 2.0 support. | ||
71 | |||
72 | A fully built kernel source tree must be available. Typically this will be | ||
73 | linked from "/lib/modules/<KERNEL VERSION>/build" for convenience. If this | ||
74 | link does not exist, an extra parameter will need to be passed to the | ||
75 | `make` command. | ||
76 | |||
77 | All vendor-built kernels should already be configured properly. However, | ||
78 | for custom-built kernels, the following options need to be enabled in the | ||
79 | kernel as built-in or modules: | ||
80 | |||
81 | CONFIG_MODULES - Enable loadable module support | ||
82 | CONFIG_FW_LOADER - Hotplug firmware loading support | ||
83 | CONFIG_I2C - I2C support | ||
84 | CONFIG_VIDEO_DEV - Video For Linux | ||
85 | CONFIG_SOUND - Sound card support | ||
86 | CONFIG_SND - Advanced Linux Sound Architecture | ||
87 | CONFIG_USB - Support for Host-side USB | ||
88 | CONFIG_USB_EHCI_HCD - EHCI HCD (USB 2.0) support | ||
89 | |||
90 | Additionally, to use the example application, the following options need to | ||
91 | be enabled in the ALSA section: | ||
92 | |||
93 | CONFIG_SND_MIXER_OSS - OSS Mixer API | ||
94 | CONFIG_SND_PCM_OSS - OSS PCM (digital audio) API | ||
95 | |||
96 | The hotplug scripts, along with the fxload utility, must also be installed. | ||
97 | These scripts can be obtained from <http://linux-hotplug.sourceforge.net/>. | ||
98 | Hotplugging is used for loading firmware into the Cypruss EZ-USB chip using | ||
99 | fxload and for loading firmware into the driver using the firmware agent. | ||
100 | |||
101 | |||
102 | 2. COMPILING AND INSTALLING THE DRIVER | ||
103 | |||
104 | |||
105 | Most users should be able to compile the driver by simply running: | ||
106 | |||
107 | $ make | ||
108 | |||
109 | in the top-level directory of the driver kit. First the kernel modules | ||
110 | will be built, followed by the example applications. | ||
111 | |||
112 | If the build system is unable to locate the kernel source tree for the | ||
113 | currently-running kernel, or if the module should be built for a kernel | ||
114 | other than the currently-running kernel, an additional parameter will need | ||
115 | to be passed to make to specify the appropriate kernel source directory: | ||
116 | |||
117 | $ make KERNELSRC=/usr/src/linux-2.6.10-custom3 | ||
118 | |||
119 | Once the compile completes, the driver and firmware files should be | ||
120 | installed by running: | ||
121 | |||
122 | $ make install | ||
123 | |||
124 | The kernel modules will be placed in "/lib/modules/<KERNEL VERSION>/extra" | ||
125 | and the firmware files will be placed in the appropriate hotplug firmware | ||
126 | directory, usually /lib/firmware. In addition, USB maps and scripts will | ||
127 | be placed in /etc/hotplug/usb to enable fxload to initialize the EZ-USB | ||
128 | control chip when the device is connected. | ||
129 | |||
130 | |||
131 | 3. PAL/SECAM TUNER CONFIGURATION (TV402U-EU only) | ||
132 | |||
133 | |||
134 | The PAL model of the Plextor ConvertX TV402U may require additional | ||
135 | configuration to correctly select the appropriate TV frequency band and | ||
136 | audio subchannel. | ||
137 | |||
138 | Users with a device other than the Plextor ConvertX TV402U-EU should skip | ||
139 | this section. | ||
140 | |||
141 | The wide variety of PAL TV systems used in Europe requires that additional | ||
142 | information about the local TV standards be passed to the driver in order | ||
143 | to properly tune TV channels. The two necessary parameters are (a) the PAL | ||
144 | TV band, and (b) the audio subchannel format in use. | ||
145 | |||
146 | In many cases, the appropriate TV band selection is passed to the driver | ||
147 | from applications. However, in some cases, the application only specifies | ||
148 | that the driver should use PAL but not the specific information about the | ||
149 | appropriate TV band. To work around this issue, the correct TV band may be | ||
150 | specified in the "force_band" parameter to the wis-sony-tuner module: | ||
151 | |||
152 | TV band force_band | ||
153 | ------- ---------- | ||
154 | PAL B/G B | ||
155 | PAL I I | ||
156 | PAL D/K D | ||
157 | SECAM L L | ||
158 | |||
159 | If the "force_band" parameter is specified, the driver will ignore any TV | ||
160 | band specified by applications and will always use the band provided in the | ||
161 | module parameter. | ||
162 | |||
163 | The other parameter that can be specified is the audio subchannel format. | ||
164 | There are several stereo audio carrier systems in use, including NICAM and | ||
165 | three varieties of A2. To receive audio broadcast on one of these stereo | ||
166 | carriers, the "force_mpx_mode" parameter must be specified to the | ||
167 | wis-sony-tuner module. | ||
168 | |||
169 | TV band Audio subcarrier force_mpx_mode | ||
170 | ------- ---------------- -------------- | ||
171 | PAL B/G Mono (default) 1 | ||
172 | PAL B/G A2 2 | ||
173 | PAL B/G NICAM 3 | ||
174 | PAL I Mono (default) 4 | ||
175 | PAL I NICAM 5 | ||
176 | PAL D/K Mono (default) 6 | ||
177 | PAL D/K A2 (1) 7 | ||
178 | PAL D/K A2 (2) 8 | ||
179 | PAL D/K A2 (3) 9 | ||
180 | PAL D/K NICAM 10 | ||
181 | SECAM L Mono (default) 11 | ||
182 | SECAM L NICAM 12 | ||
183 | |||
184 | If the "force_mpx_mode" parameter is not specified, the correct mono-only | ||
185 | mode will be chosen based on the TV band. However, the tuner will not | ||
186 | receive stereo audio or bilingual broadcasts correctly. | ||
187 | |||
188 | To pass the "force_band" or "force_mpx_mode" parameters to the | ||
189 | wis-sony-tuner module, the following line must be added to the modprobe | ||
190 | configuration file, which varies from one Linux distribution to another. | ||
191 | |||
192 | options wis-sony-tuner force_band=B force_mpx_mode=2 | ||
193 | |||
194 | The above example would force the tuner to the PAL B/G TV band and receive | ||
195 | stereo audio broadcasts on the A2 carrier. | ||
196 | |||
197 | To verify that the configuration has been placed in the correct location, | ||
198 | execute: | ||
199 | |||
200 | $ modprobe -c | grep wis-sony-tuner | ||
201 | |||
202 | If the configuration line appears, then modprobe will pass the parameters | ||
203 | correctly the next time the wis-sony-tuner module is loaded into the | ||
204 | kernel. | ||
205 | |||
206 | |||
207 | 4. TESTING THE DRIVER | ||
208 | |||
209 | |||
210 | Because few Linux applications are able to correctly capture from | ||
211 | Video4Linux2 devices with only compressed formats supported, the new driver | ||
212 | should be tested with the "gorecord" application in the apps/ directory. | ||
213 | |||
214 | First connect a video source to the device, such as a DVD player or VCR. | ||
215 | This will be captured to a file for testing the driver. If an input source | ||
216 | is unavailable, a test file can still be captured, but the video will be | ||
217 | black and the audio will be silent. | ||
218 | |||
219 | This application will auto-detect the V4L2 and ALSA/OSS device names of the | ||
220 | hardware and will record video and audio to an AVI file for a specified | ||
221 | number of seconds. For example: | ||
222 | |||
223 | $ apps/gorecord -duration 60 capture.avi | ||
224 | |||
225 | If this application does not successfully record an AVI file, the error | ||
226 | messages produced by gorecord and recorded in the system log (usually in | ||
227 | /var/log/messages) should provide information to help resolve the problem. | ||
228 | |||
229 | Supplying no parameters to gorecord will cause it to probe the available | ||
230 | devices and exit. Use the -help flag for usage information. | ||
231 | |||
232 | |||
233 | 5. USING THE DRIVER | ||
234 | |||
235 | |||
236 | The V4L2 device implemented by the driver provides a standard compressed | ||
237 | format API, within the following criteria: | ||
238 | |||
239 | * Applications that only support the original Video4Linux1 API will not | ||
240 | be able to communicate with this driver at all. | ||
241 | |||
242 | * No raw video modes are supported, so applications like xawtv that | ||
243 | expect only uncompressed video will not function. | ||
244 | |||
245 | * Supported compression formats are: Motion-JPEG, MPEG1, MPEG2 and MPEG4. | ||
246 | |||
247 | * MPEG video formats are delivered as Video Elementary Streams only. | ||
248 | Program Stream (PS), Transport Stream (TS) and Packetized Elementary | ||
249 | Stream (PES) formats are not supported. | ||
250 | |||
251 | * Video parameters such as format and input port may not be changed while | ||
252 | the encoder is active. | ||
253 | |||
254 | * The audio capture device only functions when the video encoder is | ||
255 | actively capturing video. Attempts to read from the audio device when | ||
256 | the encoder is inactive will result in an I/O error. | ||
257 | |||
258 | * The native format of the audio device is 48Khz 2-channel 16-bit | ||
259 | little-endian PCM, delivered through the ALSA system. No audio | ||
260 | compression is implemented in the hardware. ALSA may convert to other | ||
261 | uncompressed formats on the fly. | ||
262 | |||
263 | The include/ directory contains a C header file describing non-standard | ||
264 | features of the GO7007SB encoder, which are described below: | ||
265 | |||
266 | |||
267 | GO7007IOC_S_COMP_PARAMS, GO7007IOC_G_COMP_PARAMS | ||
268 | |||
269 | These ioctls are used to negotiate general compression parameters. | ||
270 | |||
271 | To query the current parameters, call the GO7007IOC_G_COMP_PARAMS ioctl | ||
272 | with a pointer to a struct go7007_comp_params. If the driver is not | ||
273 | set to MPEG format, the EINVAL error code will be returned. | ||
274 | |||
275 | To change the current parameters, initialize all fields of a struct | ||
276 | go7007_comp_params and call the GO7007_IOC_S_COMP_PARAMS ioctl with a | ||
277 | pointer to this structure. The driver will return the current | ||
278 | parameters with any necessary changes to conform to the limitations of | ||
279 | the hardware or current compression mode. Any or all fields can be set | ||
280 | to zero to request a reasonable default value. If the driver is not | ||
281 | set to MPEG format, the EINVAL error code will be returned. When I/O | ||
282 | is in progress, the EBUSY error code will be returned. | ||
283 | |||
284 | Fields in struct go7007_comp_params: | ||
285 | |||
286 | __u32 The maximum number of frames in each | ||
287 | gop_size Group Of Pictures; i.e. the maximum | ||
288 | number of frames minus one between | ||
289 | each key frame. | ||
290 | |||
291 | __u32 The maximum number of sequential | ||
292 | max_b_frames bidirectionally-predicted frames. | ||
293 | (B-frames are not yet supported.) | ||
294 | |||
295 | enum go7007_aspect_ratio The aspect ratio to be encoded in the | ||
296 | aspect_ratio meta-data of the compressed format. | ||
297 | |||
298 | Choices are: | ||
299 | GO7007_ASPECT_RATIO_1_1 | ||
300 | GO7007_ASPECT_RATIO_4_3_NTSC | ||
301 | GO7007_ASPECT_RATIO_4_3_PAL | ||
302 | GO7007_ASPECT_RATIO_16_9_NTSC | ||
303 | GO7007_ASPECT_RATIO_16_9_PAL | ||
304 | |||
305 | __u32 Bit-wise OR of control flags (below) | ||
306 | flags | ||
307 | |||
308 | Flags in struct go7007_comp_params: | ||
309 | |||
310 | GO7007_COMP_CLOSED_GOP Only produce self-contained GOPs, used | ||
311 | to produce streams appropriate for | ||
312 | random seeking. | ||
313 | |||
314 | GO7007_COMP_OMIT_SEQ_HEADER Omit the stream sequence header. | ||
315 | |||
316 | |||
317 | GO7007IOC_S_MPEG_PARAMS, GO7007IOC_G_MPEG_PARAMS | ||
318 | |||
319 | These ioctls are used to negotiate MPEG-specific stream parameters when | ||
320 | the pixelformat has been set to V4L2_PIX_FMT_MPEG. | ||
321 | |||
322 | To query the current parameters, call the GO7007IOC_G_MPEG_PARAMS ioctl | ||
323 | with a pointer to a struct go7007_mpeg_params. If the driver is not | ||
324 | set to MPEG format, the EINVAL error code will be returned. | ||
325 | |||
326 | To change the current parameters, initialize all fields of a struct | ||
327 | go7007_mpeg_params and call the GO7007_IOC_S_MPEG_PARAMS ioctl with a | ||
328 | pointer to this structure. The driver will return the current | ||
329 | parameters with any necessary changes to conform to the limitations of | ||
330 | the hardware or selected MPEG mode. Any or all fields can be set to | ||
331 | zero to request a reasonable default value. If the driver is not set | ||
332 | to MPEG format, the EINVAL error code will be returned. When I/O is in | ||
333 | progress, the EBUSY error code will be returned. | ||
334 | |||
335 | Fields in struct go7007_mpeg_params: | ||
336 | |||
337 | enum go7007_mpeg_video_standard | ||
338 | mpeg_video_standard The MPEG video standard in which to | ||
339 | compress the video. | ||
340 | |||
341 | Choices are: | ||
342 | GO7007_MPEG_VIDEO_MPEG1 | ||
343 | GO7007_MPEG_VIDEO_MPEG2 | ||
344 | GO7007_MPEG_VIDEO_MPEG4 | ||
345 | |||
346 | __u32 Bit-wise OR of control flags (below) | ||
347 | flags | ||
348 | |||
349 | __u32 The profile and level indication to be | ||
350 | pali stored in the sequence header. This | ||
351 | is only used as an indicator to the | ||
352 | decoder, and does not affect the MPEG | ||
353 | features used in the video stream. | ||
354 | Not valid for MPEG1. | ||
355 | |||
356 | Choices for MPEG2 are: | ||
357 | GO7007_MPEG2_PROFILE_MAIN_MAIN | ||
358 | |||
359 | Choices for MPEG4 are: | ||
360 | GO7007_MPEG4_PROFILE_S_L0 | ||
361 | GO7007_MPEG4_PROFILE_S_L1 | ||
362 | GO7007_MPEG4_PROFILE_S_L2 | ||
363 | GO7007_MPEG4_PROFILE_S_L3 | ||
364 | GO7007_MPEG4_PROFILE_ARTS_L1 | ||
365 | GO7007_MPEG4_PROFILE_ARTS_L2 | ||
366 | GO7007_MPEG4_PROFILE_ARTS_L3 | ||
367 | GO7007_MPEG4_PROFILE_ARTS_L4 | ||
368 | GO7007_MPEG4_PROFILE_AS_L0 | ||
369 | GO7007_MPEG4_PROFILE_AS_L1 | ||
370 | GO7007_MPEG4_PROFILE_AS_L2 | ||
371 | GO7007_MPEG4_PROFILE_AS_L3 | ||
372 | GO7007_MPEG4_PROFILE_AS_L4 | ||
373 | GO7007_MPEG4_PROFILE_AS_L5 | ||
374 | |||
375 | Flags in struct go7007_mpeg_params: | ||
376 | |||
377 | GO7007_MPEG_FORCE_DVD_MODE Force all compression parameters and | ||
378 | bitrate control settings to comply | ||
379 | with DVD MPEG2 stream requirements. | ||
380 | This overrides most compression and | ||
381 | bitrate settings! | ||
382 | |||
383 | GO7007_MPEG_OMIT_GOP_HEADER Omit the GOP header. | ||
384 | |||
385 | GO7007_MPEG_REPEAT_SEQHEADER Repeat the MPEG sequence header at | ||
386 | the start of each GOP. | ||
387 | |||
388 | |||
389 | GO7007IOC_S_BITRATE, GO7007IOC_G_BITRATE | ||
390 | |||
391 | These ioctls are used to set and query the target bitrate value for the | ||
392 | compressed video stream. The bitrate may be selected by storing the | ||
393 | target bits per second in an int and calling GO7007IOC_S_BITRATE with a | ||
394 | pointer to the int. The bitrate may be queried by calling | ||
395 | GO7007IOC_G_BITRATE with a pointer to an int where the current bitrate | ||
396 | will be stored. | ||
397 | |||
398 | Note that this is the primary means of controlling the video quality | ||
399 | for all compression modes, including V4L2_PIX_FMT_MJPEG. The | ||
400 | VIDIOC_S_JPEGCOMP ioctl is not supported. | ||
401 | |||
402 | |||
403 | ---------------------------------------------------------------------------- | ||
404 | Installing the WIS PCI Voyager Driver | ||
405 | --------------------------------------------------------------------------- | ||
406 | |||
407 | The WIS PCI Voyager driver requires several patches to the Linux 2.6.11.x | ||
408 | kernel source tree before compiling the driver. These patches update the | ||
409 | in-kernel SAA7134 driver to the newest development version and patch bugs | ||
410 | in the TDA8290/TDA8275 tuner driver. | ||
411 | |||
412 | The following patches must be downloaded from Gerd Knorr's website and | ||
413 | applied in the order listed: | ||
414 | |||
415 | http://dl.bytesex.org/patches/2.6.11-2/i2c-tuner | ||
416 | http://dl.bytesex.org/patches/2.6.11-2/i2c-tuner2 | ||
417 | http://dl.bytesex.org/patches/2.6.11-2/v4l2-api-mpeg | ||
418 | http://dl.bytesex.org/patches/2.6.11-2/saa7134-update | ||
419 | |||
420 | The following patches are included with this SDK and can be applied in any | ||
421 | order: | ||
422 | |||
423 | patches/2.6.11/saa7134-voyager.diff | ||
424 | patches/2.6.11/tda8275-newaddr.diff | ||
425 | patches/2.6.11/tda8290-ntsc.diff | ||
426 | |||
427 | Check to make sure the CONFIG_VIDEO_SAA7134 option is enabled in the kernel | ||
428 | configuration, and build and install the kernel. | ||
429 | |||
430 | After rebooting into the new kernel, the GO7007 driver can be compiled and | ||
431 | installed: | ||
432 | |||
433 | $ make SAA7134_BUILD=y | ||
434 | $ make install | ||
435 | $ modprobe saa7134-go7007 | ||
436 | |||
437 | There will be two V4L video devices associated with the PCI Voyager. The | ||
438 | first device (most likely /dev/video0) provides access to the raw video | ||
439 | capture mode of the SAA7133 device and is used to configure the source | ||
440 | video parameters and tune the TV tuner. This device can be used with xawtv | ||
441 | or other V4L(2) video software as a standard uncompressed device. | ||
442 | |||
443 | The second device (most likely /dev/video1) provides access to the | ||
444 | compression functions of the GO7007. It can be tested using the gorecord | ||
445 | application in the apps/ directory of this SDK: | ||
446 | |||
447 | $ apps/gorecord -vdevice /dev/video1 -noaudio test.avi | ||
448 | |||
449 | Currently the frame resolution is fixed at 720x480 (NTSC) or 720x576 (PAL), | ||
450 | and the video standard must be specified to both the raw and the compressed | ||
451 | video devices (xawtv and gorecord, for example). | ||
452 | |||
453 | |||
454 | -------------------------------------------------------------------------- | ||
455 | RELEASE NOTES FOR WIS GO7007SB LINUX DRIVER | ||
456 | --------------------------------------------------------------------------- | ||
457 | |||
458 | Last updated: 5 November 2005 | ||
459 | |||
460 | - Release 0.9.7 includes new support for using udev to run fxload. The | ||
461 | install script should automatically detect whether the old hotplug | ||
462 | scripts or the new udev rules should be used. To force the use of | ||
463 | hotplug, run "make install USE_UDEV=n". To force the use of udev, run | ||
464 | "make install USE_UDEV=y". | ||
465 | |||
466 | - Motion detection is supported but undocumented. Try the `modet` app | ||
467 | for a demonstration of how to use the facility. | ||
468 | |||
469 | - Using USB2.0 devices such as the TV402U with USB1.1 HCDs or hubs can | ||
470 | cause buffer overruns and frame drops, even at low framerates, due to | ||
471 | inconsistency in the bitrate control mechanism. | ||
472 | |||
473 | - On devices with an SAA7115, including the Plextor ConvertX, video height | ||
474 | values of 96, 128, 160, 192, 256, 320, and 384 do not work in NTSC mode. | ||
475 | All valid heights up to 512 work correctly in PAL mode. | ||
476 | |||
477 | - The WIS Star Trek and PCI Voyager boards have no support yet for audio | ||
478 | or the TV tuner. | ||
diff --git a/drivers/staging/media/go7007/saa7134-go7007.c b/drivers/staging/media/go7007/saa7134-go7007.c deleted file mode 100644 index b137432fa0e4..000000000000 --- a/drivers/staging/media/go7007/saa7134-go7007.c +++ /dev/null | |||
@@ -1,560 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2005-2006 Micronas USA Inc. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License (Version 2) as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/spinlock.h> | ||
18 | #include <linux/wait.h> | ||
19 | #include <linux/list.h> | ||
20 | #include <linux/slab.h> | ||
21 | #include <linux/time.h> | ||
22 | #include <linux/mm.h> | ||
23 | #include <linux/usb.h> | ||
24 | #include <linux/i2c.h> | ||
25 | #include <asm/byteorder.h> | ||
26 | #include <media/v4l2-common.h> | ||
27 | #include <media/v4l2-device.h> | ||
28 | #include <media/v4l2-subdev.h> | ||
29 | |||
30 | #include "saa7134.h" | ||
31 | #include "saa7134-reg.h" | ||
32 | #include "go7007-priv.h" | ||
33 | |||
34 | /*#define GO7007_HPI_DEBUG*/ | ||
35 | |||
36 | enum hpi_address { | ||
37 | HPI_ADDR_VIDEO_BUFFER = 0xe4, | ||
38 | HPI_ADDR_INIT_BUFFER = 0xea, | ||
39 | HPI_ADDR_INTR_RET_VALUE = 0xee, | ||
40 | HPI_ADDR_INTR_RET_DATA = 0xec, | ||
41 | HPI_ADDR_INTR_STATUS = 0xf4, | ||
42 | HPI_ADDR_INTR_WR_PARAM = 0xf6, | ||
43 | HPI_ADDR_INTR_WR_INDEX = 0xf8, | ||
44 | }; | ||
45 | |||
46 | enum gpio_command { | ||
47 | GPIO_COMMAND_RESET = 0x00, /* 000b */ | ||
48 | GPIO_COMMAND_REQ1 = 0x04, /* 001b */ | ||
49 | GPIO_COMMAND_WRITE = 0x20, /* 010b */ | ||
50 | GPIO_COMMAND_REQ2 = 0x24, /* 011b */ | ||
51 | GPIO_COMMAND_READ = 0x80, /* 100b */ | ||
52 | GPIO_COMMAND_VIDEO = 0x84, /* 101b */ | ||
53 | GPIO_COMMAND_IDLE = 0xA0, /* 110b */ | ||
54 | GPIO_COMMAND_ADDR = 0xA4, /* 111b */ | ||
55 | }; | ||
56 | |||
57 | struct saa7134_go7007 { | ||
58 | struct v4l2_subdev sd; | ||
59 | struct saa7134_dev *dev; | ||
60 | u8 *top; | ||
61 | u8 *bottom; | ||
62 | dma_addr_t top_dma; | ||
63 | dma_addr_t bottom_dma; | ||
64 | }; | ||
65 | |||
66 | static inline struct saa7134_go7007 *to_state(struct v4l2_subdev *sd) | ||
67 | { | ||
68 | return container_of(sd, struct saa7134_go7007, sd); | ||
69 | } | ||
70 | |||
71 | static const struct go7007_board_info board_voyager = { | ||
72 | .flags = 0, | ||
73 | .sensor_flags = GO7007_SENSOR_656 | | ||
74 | GO7007_SENSOR_VALID_ENABLE | | ||
75 | GO7007_SENSOR_TV | | ||
76 | GO7007_SENSOR_VBI, | ||
77 | .audio_flags = GO7007_AUDIO_I2S_MODE_1 | | ||
78 | GO7007_AUDIO_WORD_16, | ||
79 | .audio_rate = 48000, | ||
80 | .audio_bclk_div = 8, | ||
81 | .audio_main_div = 2, | ||
82 | .hpi_buffer_cap = 7, | ||
83 | .num_inputs = 1, | ||
84 | .inputs = { | ||
85 | { | ||
86 | .name = "SAA7134", | ||
87 | }, | ||
88 | }, | ||
89 | }; | ||
90 | |||
91 | /********************* Driver for GPIO HPI interface *********************/ | ||
92 | |||
93 | static int gpio_write(struct saa7134_dev *dev, u8 addr, u16 data) | ||
94 | { | ||
95 | saa_writeb(SAA7134_GPIO_GPMODE0, 0xff); | ||
96 | |||
97 | /* Write HPI address */ | ||
98 | saa_writeb(SAA7134_GPIO_GPSTATUS0, addr); | ||
99 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_ADDR); | ||
100 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_IDLE); | ||
101 | |||
102 | /* Write low byte */ | ||
103 | saa_writeb(SAA7134_GPIO_GPSTATUS0, data & 0xff); | ||
104 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_WRITE); | ||
105 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_IDLE); | ||
106 | |||
107 | /* Write high byte */ | ||
108 | saa_writeb(SAA7134_GPIO_GPSTATUS0, data >> 8); | ||
109 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_WRITE); | ||
110 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_IDLE); | ||
111 | |||
112 | return 0; | ||
113 | } | ||
114 | |||
115 | static int gpio_read(struct saa7134_dev *dev, u8 addr, u16 *data) | ||
116 | { | ||
117 | saa_writeb(SAA7134_GPIO_GPMODE0, 0xff); | ||
118 | |||
119 | /* Write HPI address */ | ||
120 | saa_writeb(SAA7134_GPIO_GPSTATUS0, addr); | ||
121 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_ADDR); | ||
122 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_IDLE); | ||
123 | |||
124 | saa_writeb(SAA7134_GPIO_GPMODE0, 0x00); | ||
125 | |||
126 | /* Read low byte */ | ||
127 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_READ); | ||
128 | saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | ||
129 | saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | ||
130 | *data = saa_readb(SAA7134_GPIO_GPSTATUS0); | ||
131 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_IDLE); | ||
132 | |||
133 | /* Read high byte */ | ||
134 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_READ); | ||
135 | saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | ||
136 | saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | ||
137 | *data |= saa_readb(SAA7134_GPIO_GPSTATUS0) << 8; | ||
138 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_IDLE); | ||
139 | |||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | static int saa7134_go7007_interface_reset(struct go7007 *go) | ||
144 | { | ||
145 | struct saa7134_go7007 *saa = go->hpi_context; | ||
146 | struct saa7134_dev *dev = saa->dev; | ||
147 | u32 status; | ||
148 | u16 intr_val, intr_data; | ||
149 | int count = 20; | ||
150 | |||
151 | saa_clearb(SAA7134_TS_PARALLEL, 0x80); /* Disable TS interface */ | ||
152 | saa_writeb(SAA7134_GPIO_GPMODE2, 0xa4); | ||
153 | saa_writeb(SAA7134_GPIO_GPMODE0, 0xff); | ||
154 | |||
155 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_REQ1); | ||
156 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_RESET); | ||
157 | msleep(1); | ||
158 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_REQ1); | ||
159 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_REQ2); | ||
160 | msleep(10); | ||
161 | |||
162 | saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | ||
163 | saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | ||
164 | |||
165 | status = saa_readb(SAA7134_GPIO_GPSTATUS2); | ||
166 | /*pr_debug("status is %s\n", status & 0x40 ? "OK" : "not OK"); */ | ||
167 | |||
168 | /* enter command mode...(?) */ | ||
169 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_REQ1); | ||
170 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_REQ2); | ||
171 | |||
172 | do { | ||
173 | saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | ||
174 | saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | ||
175 | status = saa_readb(SAA7134_GPIO_GPSTATUS2); | ||
176 | /*pr_info("gpio is %08x\n", saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2)); */ | ||
177 | } while (--count > 0); | ||
178 | |||
179 | /* Wait for an interrupt to indicate successful hardware reset */ | ||
180 | if (go7007_read_interrupt(go, &intr_val, &intr_data) < 0 || | ||
181 | (intr_val & ~0x1) != 0x55aa) { | ||
182 | pr_err("saa7134-go7007: unable to reset the GO7007\n"); | ||
183 | return -1; | ||
184 | } | ||
185 | return 0; | ||
186 | } | ||
187 | |||
188 | static int saa7134_go7007_write_interrupt(struct go7007 *go, int addr, int data) | ||
189 | { | ||
190 | struct saa7134_go7007 *saa = go->hpi_context; | ||
191 | struct saa7134_dev *dev = saa->dev; | ||
192 | int i; | ||
193 | u16 status_reg; | ||
194 | |||
195 | #ifdef GO7007_HPI_DEBUG | ||
196 | pr_debug("saa7134-go7007: WriteInterrupt: %04x %04x\n", addr, data); | ||
197 | #endif | ||
198 | |||
199 | for (i = 0; i < 100; ++i) { | ||
200 | gpio_read(dev, HPI_ADDR_INTR_STATUS, &status_reg); | ||
201 | if (!(status_reg & 0x0010)) | ||
202 | break; | ||
203 | msleep(10); | ||
204 | } | ||
205 | if (i == 100) { | ||
206 | pr_err("saa7134-go7007: device is hung, status reg = 0x%04x\n", | ||
207 | status_reg); | ||
208 | return -1; | ||
209 | } | ||
210 | gpio_write(dev, HPI_ADDR_INTR_WR_PARAM, data); | ||
211 | gpio_write(dev, HPI_ADDR_INTR_WR_INDEX, addr); | ||
212 | |||
213 | return 0; | ||
214 | } | ||
215 | |||
216 | static int saa7134_go7007_read_interrupt(struct go7007 *go) | ||
217 | { | ||
218 | struct saa7134_go7007 *saa = go->hpi_context; | ||
219 | struct saa7134_dev *dev = saa->dev; | ||
220 | |||
221 | /* XXX we need to wait if there is no interrupt available */ | ||
222 | go->interrupt_available = 1; | ||
223 | gpio_read(dev, HPI_ADDR_INTR_RET_VALUE, &go->interrupt_value); | ||
224 | gpio_read(dev, HPI_ADDR_INTR_RET_DATA, &go->interrupt_data); | ||
225 | #ifdef GO7007_HPI_DEBUG | ||
226 | pr_debug("saa7134-go7007: ReadInterrupt: %04x %04x\n", | ||
227 | go->interrupt_value, go->interrupt_data); | ||
228 | #endif | ||
229 | return 0; | ||
230 | } | ||
231 | |||
232 | static void saa7134_go7007_irq_ts_done(struct saa7134_dev *dev, | ||
233 | unsigned long status) | ||
234 | { | ||
235 | struct go7007 *go = video_get_drvdata(dev->empress_dev); | ||
236 | struct saa7134_go7007 *saa = go->hpi_context; | ||
237 | |||
238 | if (!vb2_is_streaming(&go->vidq)) | ||
239 | return; | ||
240 | if (0 != (status & 0x000f0000)) | ||
241 | pr_debug("saa7134-go7007: irq: lost %ld\n", | ||
242 | (status >> 16) & 0x0f); | ||
243 | if (status & 0x100000) { | ||
244 | dma_sync_single_for_cpu(&dev->pci->dev, | ||
245 | saa->bottom_dma, PAGE_SIZE, DMA_FROM_DEVICE); | ||
246 | go7007_parse_video_stream(go, saa->bottom, PAGE_SIZE); | ||
247 | saa_writel(SAA7134_RS_BA2(5), cpu_to_le32(saa->bottom_dma)); | ||
248 | } else { | ||
249 | dma_sync_single_for_cpu(&dev->pci->dev, | ||
250 | saa->top_dma, PAGE_SIZE, DMA_FROM_DEVICE); | ||
251 | go7007_parse_video_stream(go, saa->top, PAGE_SIZE); | ||
252 | saa_writel(SAA7134_RS_BA1(5), cpu_to_le32(saa->top_dma)); | ||
253 | } | ||
254 | } | ||
255 | |||
256 | static int saa7134_go7007_stream_start(struct go7007 *go) | ||
257 | { | ||
258 | struct saa7134_go7007 *saa = go->hpi_context; | ||
259 | struct saa7134_dev *dev = saa->dev; | ||
260 | |||
261 | saa->top_dma = dma_map_page(&dev->pci->dev, virt_to_page(saa->top), | ||
262 | 0, PAGE_SIZE, DMA_FROM_DEVICE); | ||
263 | if (dma_mapping_error(&dev->pci->dev, saa->top_dma)) | ||
264 | return -ENOMEM; | ||
265 | saa->bottom_dma = dma_map_page(&dev->pci->dev, | ||
266 | virt_to_page(saa->bottom), | ||
267 | 0, PAGE_SIZE, DMA_FROM_DEVICE); | ||
268 | if (dma_mapping_error(&dev->pci->dev, saa->bottom_dma)) { | ||
269 | dma_unmap_page(&dev->pci->dev, saa->top_dma, PAGE_SIZE, | ||
270 | DMA_FROM_DEVICE); | ||
271 | return -ENOMEM; | ||
272 | } | ||
273 | |||
274 | saa_writel(SAA7134_VIDEO_PORT_CTRL0 >> 2, 0xA300B000); | ||
275 | saa_writel(SAA7134_VIDEO_PORT_CTRL4 >> 2, 0x40000200); | ||
276 | |||
277 | /* Set HPI interface for video */ | ||
278 | saa_writeb(SAA7134_GPIO_GPMODE0, 0xff); | ||
279 | saa_writeb(SAA7134_GPIO_GPSTATUS0, HPI_ADDR_VIDEO_BUFFER); | ||
280 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_ADDR); | ||
281 | saa_writeb(SAA7134_GPIO_GPMODE0, 0x00); | ||
282 | |||
283 | /* Enable TS interface */ | ||
284 | saa_writeb(SAA7134_TS_PARALLEL, 0xe6); | ||
285 | |||
286 | /* Reset TS interface */ | ||
287 | saa_setb(SAA7134_TS_SERIAL1, 0x01); | ||
288 | saa_clearb(SAA7134_TS_SERIAL1, 0x01); | ||
289 | |||
290 | /* Set up transfer block size */ | ||
291 | saa_writeb(SAA7134_TS_PARALLEL_SERIAL, 128 - 1); | ||
292 | saa_writeb(SAA7134_TS_DMA0, (PAGE_SIZE >> 7) - 1); | ||
293 | saa_writeb(SAA7134_TS_DMA1, 0); | ||
294 | saa_writeb(SAA7134_TS_DMA2, 0); | ||
295 | |||
296 | /* Enable video streaming mode */ | ||
297 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_VIDEO); | ||
298 | |||
299 | saa_writel(SAA7134_RS_BA1(5), cpu_to_le32(saa->top_dma)); | ||
300 | saa_writel(SAA7134_RS_BA2(5), cpu_to_le32(saa->bottom_dma)); | ||
301 | saa_writel(SAA7134_RS_PITCH(5), 128); | ||
302 | saa_writel(SAA7134_RS_CONTROL(5), SAA7134_RS_CONTROL_BURST_MAX); | ||
303 | |||
304 | /* Enable TS FIFO */ | ||
305 | saa_setl(SAA7134_MAIN_CTRL, SAA7134_MAIN_CTRL_TE5); | ||
306 | |||
307 | /* Enable DMA IRQ */ | ||
308 | saa_setl(SAA7134_IRQ1, | ||
309 | SAA7134_IRQ1_INTE_RA2_1 | SAA7134_IRQ1_INTE_RA2_0); | ||
310 | |||
311 | return 0; | ||
312 | } | ||
313 | |||
314 | static int saa7134_go7007_stream_stop(struct go7007 *go) | ||
315 | { | ||
316 | struct saa7134_go7007 *saa = go->hpi_context; | ||
317 | struct saa7134_dev *dev; | ||
318 | |||
319 | if (!saa) | ||
320 | return -EINVAL; | ||
321 | dev = saa->dev; | ||
322 | if (!dev) | ||
323 | return -EINVAL; | ||
324 | |||
325 | /* Shut down TS FIFO */ | ||
326 | saa_clearl(SAA7134_MAIN_CTRL, SAA7134_MAIN_CTRL_TE5); | ||
327 | |||
328 | /* Disable DMA IRQ */ | ||
329 | saa_clearl(SAA7134_IRQ1, | ||
330 | SAA7134_IRQ1_INTE_RA2_1 | SAA7134_IRQ1_INTE_RA2_0); | ||
331 | |||
332 | /* Disable TS interface */ | ||
333 | saa_clearb(SAA7134_TS_PARALLEL, 0x80); | ||
334 | |||
335 | dma_unmap_page(&dev->pci->dev, saa->top_dma, PAGE_SIZE, | ||
336 | DMA_FROM_DEVICE); | ||
337 | dma_unmap_page(&dev->pci->dev, saa->bottom_dma, PAGE_SIZE, | ||
338 | DMA_FROM_DEVICE); | ||
339 | |||
340 | return 0; | ||
341 | } | ||
342 | |||
343 | static int saa7134_go7007_send_firmware(struct go7007 *go, u8 *data, int len) | ||
344 | { | ||
345 | struct saa7134_go7007 *saa = go->hpi_context; | ||
346 | struct saa7134_dev *dev = saa->dev; | ||
347 | u16 status_reg; | ||
348 | int i; | ||
349 | |||
350 | #ifdef GO7007_HPI_DEBUG | ||
351 | pr_debug("saa7134-go7007: DownloadBuffer sending %d bytes\n", len); | ||
352 | #endif | ||
353 | |||
354 | while (len > 0) { | ||
355 | i = len > 64 ? 64 : len; | ||
356 | saa_writeb(SAA7134_GPIO_GPMODE0, 0xff); | ||
357 | saa_writeb(SAA7134_GPIO_GPSTATUS0, HPI_ADDR_INIT_BUFFER); | ||
358 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_ADDR); | ||
359 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_IDLE); | ||
360 | while (i-- > 0) { | ||
361 | saa_writeb(SAA7134_GPIO_GPSTATUS0, *data); | ||
362 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_WRITE); | ||
363 | saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_IDLE); | ||
364 | ++data; | ||
365 | --len; | ||
366 | } | ||
367 | for (i = 0; i < 100; ++i) { | ||
368 | gpio_read(dev, HPI_ADDR_INTR_STATUS, &status_reg); | ||
369 | if (!(status_reg & 0x0002)) | ||
370 | break; | ||
371 | } | ||
372 | if (i == 100) { | ||
373 | pr_err("saa7134-go7007: device is hung, status reg = 0x%04x\n", | ||
374 | status_reg); | ||
375 | return -1; | ||
376 | } | ||
377 | } | ||
378 | return 0; | ||
379 | } | ||
380 | |||
381 | static struct go7007_hpi_ops saa7134_go7007_hpi_ops = { | ||
382 | .interface_reset = saa7134_go7007_interface_reset, | ||
383 | .write_interrupt = saa7134_go7007_write_interrupt, | ||
384 | .read_interrupt = saa7134_go7007_read_interrupt, | ||
385 | .stream_start = saa7134_go7007_stream_start, | ||
386 | .stream_stop = saa7134_go7007_stream_stop, | ||
387 | .send_firmware = saa7134_go7007_send_firmware, | ||
388 | }; | ||
389 | MODULE_FIRMWARE("go7007/go7007tv.bin"); | ||
390 | |||
391 | /* --------------------------------------------------------------------------*/ | ||
392 | |||
393 | static int saa7134_go7007_s_std(struct v4l2_subdev *sd, v4l2_std_id norm) | ||
394 | { | ||
395 | struct saa7134_go7007 *saa = to_state(sd); | ||
396 | struct saa7134_dev *dev = saa->dev; | ||
397 | |||
398 | return saa7134_s_std_internal(dev, NULL, norm); | ||
399 | } | ||
400 | |||
401 | static int saa7134_go7007_queryctrl(struct v4l2_subdev *sd, | ||
402 | struct v4l2_queryctrl *query) | ||
403 | { | ||
404 | return saa7134_queryctrl(NULL, NULL, query); | ||
405 | } | ||
406 | static int saa7134_go7007_s_ctrl(struct v4l2_subdev *sd, | ||
407 | struct v4l2_control *ctrl) | ||
408 | { | ||
409 | struct saa7134_go7007 *saa = to_state(sd); | ||
410 | struct saa7134_dev *dev = saa->dev; | ||
411 | |||
412 | return saa7134_s_ctrl_internal(dev, NULL, ctrl); | ||
413 | } | ||
414 | |||
415 | static int saa7134_go7007_g_ctrl(struct v4l2_subdev *sd, | ||
416 | struct v4l2_control *ctrl) | ||
417 | { | ||
418 | struct saa7134_go7007 *saa = to_state(sd); | ||
419 | struct saa7134_dev *dev = saa->dev; | ||
420 | |||
421 | return saa7134_g_ctrl_internal(dev, NULL, ctrl); | ||
422 | } | ||
423 | |||
424 | /* --------------------------------------------------------------------------*/ | ||
425 | |||
426 | static const struct v4l2_subdev_core_ops saa7134_go7007_core_ops = { | ||
427 | .g_ctrl = saa7134_go7007_g_ctrl, | ||
428 | .s_ctrl = saa7134_go7007_s_ctrl, | ||
429 | .queryctrl = saa7134_go7007_queryctrl, | ||
430 | }; | ||
431 | |||
432 | static const struct v4l2_subdev_video_ops saa7134_go7007_video_ops = { | ||
433 | .s_std = saa7134_go7007_s_std, | ||
434 | }; | ||
435 | |||
436 | static const struct v4l2_subdev_ops saa7134_go7007_sd_ops = { | ||
437 | .core = &saa7134_go7007_core_ops, | ||
438 | .video = &saa7134_go7007_video_ops, | ||
439 | }; | ||
440 | |||
441 | /* --------------------------------------------------------------------------*/ | ||
442 | |||
443 | |||
444 | /********************* Add/remove functions *********************/ | ||
445 | |||
446 | static int saa7134_go7007_init(struct saa7134_dev *dev) | ||
447 | { | ||
448 | struct go7007 *go; | ||
449 | struct saa7134_go7007 *saa; | ||
450 | struct v4l2_subdev *sd; | ||
451 | |||
452 | pr_debug("saa7134-go7007: probing new SAA713X board\n"); | ||
453 | |||
454 | go = go7007_alloc(&board_voyager, &dev->pci->dev); | ||
455 | if (go == NULL) | ||
456 | return -ENOMEM; | ||
457 | |||
458 | saa = kzalloc(sizeof(struct saa7134_go7007), GFP_KERNEL); | ||
459 | if (saa == NULL) { | ||
460 | kfree(go); | ||
461 | return -ENOMEM; | ||
462 | } | ||
463 | |||
464 | go->board_id = GO7007_BOARDID_PCI_VOYAGER; | ||
465 | snprintf(go->bus_info, sizeof(go->bus_info), "PCI:%s", pci_name(dev->pci)); | ||
466 | strlcpy(go->name, saa7134_boards[dev->board].name, sizeof(go->name)); | ||
467 | go->hpi_ops = &saa7134_go7007_hpi_ops; | ||
468 | go->hpi_context = saa; | ||
469 | saa->dev = dev; | ||
470 | |||
471 | /* Init the subdevice interface */ | ||
472 | sd = &saa->sd; | ||
473 | v4l2_subdev_init(sd, &saa7134_go7007_sd_ops); | ||
474 | v4l2_set_subdevdata(sd, saa); | ||
475 | strncpy(sd->name, "saa7134-go7007", sizeof(sd->name)); | ||
476 | |||
477 | /* Allocate a couple pages for receiving the compressed stream */ | ||
478 | saa->top = (u8 *)get_zeroed_page(GFP_KERNEL); | ||
479 | if (!saa->top) | ||
480 | goto allocfail; | ||
481 | saa->bottom = (u8 *)get_zeroed_page(GFP_KERNEL); | ||
482 | if (!saa->bottom) | ||
483 | goto allocfail; | ||
484 | |||
485 | /* Boot the GO7007 */ | ||
486 | if (go7007_boot_encoder(go, go->board_info->flags & | ||
487 | GO7007_BOARD_USE_ONBOARD_I2C) < 0) | ||
488 | goto allocfail; | ||
489 | |||
490 | /* Do any final GO7007 initialization, then register the | ||
491 | * V4L2 and ALSA interfaces */ | ||
492 | if (go7007_register_encoder(go, go->board_info->num_i2c_devs) < 0) | ||
493 | goto allocfail; | ||
494 | |||
495 | /* Register the subdevice interface with the go7007 device */ | ||
496 | if (v4l2_device_register_subdev(&go->v4l2_dev, sd) < 0) | ||
497 | pr_info("saa7134-go7007: register subdev failed\n"); | ||
498 | |||
499 | dev->empress_dev = &go->vdev; | ||
500 | |||
501 | go->status = STATUS_ONLINE; | ||
502 | return 0; | ||
503 | |||
504 | allocfail: | ||
505 | if (saa->top) | ||
506 | free_page((unsigned long)saa->top); | ||
507 | if (saa->bottom) | ||
508 | free_page((unsigned long)saa->bottom); | ||
509 | kfree(saa); | ||
510 | kfree(go); | ||
511 | return -ENOMEM; | ||
512 | } | ||
513 | |||
514 | static int saa7134_go7007_fini(struct saa7134_dev *dev) | ||
515 | { | ||
516 | struct go7007 *go; | ||
517 | struct saa7134_go7007 *saa; | ||
518 | |||
519 | if (NULL == dev->empress_dev) | ||
520 | return 0; | ||
521 | |||
522 | go = video_get_drvdata(dev->empress_dev); | ||
523 | if (go->audio_enabled) | ||
524 | go7007_snd_remove(go); | ||
525 | |||
526 | saa = go->hpi_context; | ||
527 | go->status = STATUS_SHUTDOWN; | ||
528 | free_page((unsigned long)saa->top); | ||
529 | free_page((unsigned long)saa->bottom); | ||
530 | v4l2_device_unregister_subdev(&saa->sd); | ||
531 | kfree(saa); | ||
532 | video_unregister_device(&go->vdev); | ||
533 | |||
534 | v4l2_device_put(&go->v4l2_dev); | ||
535 | dev->empress_dev = NULL; | ||
536 | |||
537 | return 0; | ||
538 | } | ||
539 | |||
540 | static struct saa7134_mpeg_ops saa7134_go7007_ops = { | ||
541 | .type = SAA7134_MPEG_GO7007, | ||
542 | .init = saa7134_go7007_init, | ||
543 | .fini = saa7134_go7007_fini, | ||
544 | .irq_ts_done = saa7134_go7007_irq_ts_done, | ||
545 | }; | ||
546 | |||
547 | static int __init saa7134_go7007_mod_init(void) | ||
548 | { | ||
549 | return saa7134_ts_register(&saa7134_go7007_ops); | ||
550 | } | ||
551 | |||
552 | static void __exit saa7134_go7007_mod_cleanup(void) | ||
553 | { | ||
554 | saa7134_ts_unregister(&saa7134_go7007_ops); | ||
555 | } | ||
556 | |||
557 | module_init(saa7134_go7007_mod_init); | ||
558 | module_exit(saa7134_go7007_mod_cleanup); | ||
559 | |||
560 | MODULE_LICENSE("GPL v2"); | ||