diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2007-08-23 05:32:46 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-09 21:06:47 -0400 |
commit | 33c0fcad2160bc211272295e862c6f708118d006 (patch) | |
tree | 1627d21d1042a1ede7fc9c8f55356ab314a6a63e /drivers/media/video/ivtv | |
parent | 612570f2c4794bbf4e5bfa8648b61fbfc9cd8501 (diff) |
V4L/DVB (6092): ivtv: more cleanups, merged ivtv-audio.c and ivtv-video.c into ivtv-routing.c
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/ivtv')
-rw-r--r-- | drivers/media/video/ivtv/Makefile | 4 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-audio.c | 71 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-controls.c | 10 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-driver.c | 14 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-driver.h | 113 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-fb.c | 2 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-fileops.c | 2 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 5 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-irq.h | 22 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-mailbox.h | 3 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-routing.c (renamed from drivers/media/video/ivtv/ivtv-video.c) | 90 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-routing.h (renamed from drivers/media/video/ivtv/ivtv-audio.h) | 11 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-streams.c | 16 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-vbi.c | 64 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-video.h | 29 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-yuv.c | 4 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-yuv.h | 3 |
17 files changed, 184 insertions, 279 deletions
diff --git a/drivers/media/video/ivtv/Makefile b/drivers/media/video/ivtv/Makefile index 90e2d1270561..6998781e2b11 100644 --- a/drivers/media/video/ivtv/Makefile +++ b/drivers/media/video/ivtv/Makefile | |||
@@ -1,8 +1,8 @@ | |||
1 | ivtv-objs := ivtv-audio.o ivtv-cards.o ivtv-controls.o \ | 1 | ivtv-objs := ivtv-routing.o ivtv-cards.o ivtv-controls.o \ |
2 | ivtv-driver.o ivtv-fileops.o ivtv-firmware.o \ | 2 | ivtv-driver.o ivtv-fileops.o ivtv-firmware.o \ |
3 | ivtv-gpio.o ivtv-i2c.o ivtv-ioctl.o ivtv-irq.o \ | 3 | ivtv-gpio.o ivtv-i2c.o ivtv-ioctl.o ivtv-irq.o \ |
4 | ivtv-mailbox.o ivtv-queue.o ivtv-streams.o ivtv-udma.o \ | 4 | ivtv-mailbox.o ivtv-queue.o ivtv-streams.o ivtv-udma.o \ |
5 | ivtv-vbi.o ivtv-video.o ivtv-yuv.o | 5 | ivtv-vbi.o ivtv-yuv.o |
6 | 6 | ||
7 | obj-$(CONFIG_VIDEO_IVTV) += ivtv.o | 7 | obj-$(CONFIG_VIDEO_IVTV) += ivtv.o |
8 | obj-$(CONFIG_VIDEO_IVTV_FB) += ivtv-fb.o | 8 | obj-$(CONFIG_VIDEO_IVTV_FB) += ivtv-fb.o |
diff --git a/drivers/media/video/ivtv/ivtv-audio.c b/drivers/media/video/ivtv/ivtv-audio.c deleted file mode 100644 index 6cb65d69c986..000000000000 --- a/drivers/media/video/ivtv/ivtv-audio.c +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | /* | ||
2 | Audio-related ivtv functions. | ||
3 | Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com> | ||
4 | Copyright (C) 2005-2007 Hans Verkuil <hverkuil@xs4all.nl> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include "ivtv-driver.h" | ||
22 | #include "ivtv-i2c.h" | ||
23 | #include "ivtv-cards.h" | ||
24 | #include "ivtv-audio.h" | ||
25 | #include <media/msp3400.h> | ||
26 | |||
27 | /* Selects the audio input and output according to the current | ||
28 | settings. */ | ||
29 | int ivtv_audio_set_io(struct ivtv *itv) | ||
30 | { | ||
31 | struct v4l2_routing route; | ||
32 | u32 audio_input; | ||
33 | int mux_input; | ||
34 | |||
35 | /* Determine which input to use */ | ||
36 | if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) { | ||
37 | audio_input = itv->card->radio_input.audio_input; | ||
38 | mux_input = itv->card->radio_input.muxer_input; | ||
39 | } else { | ||
40 | audio_input = itv->card->audio_inputs[itv->audio_input].audio_input; | ||
41 | mux_input = itv->card->audio_inputs[itv->audio_input].muxer_input; | ||
42 | } | ||
43 | |||
44 | /* handle muxer chips */ | ||
45 | route.input = mux_input; | ||
46 | route.output = 0; | ||
47 | ivtv_i2c_hw(itv, itv->card->hw_muxer, VIDIOC_INT_S_AUDIO_ROUTING, &route); | ||
48 | |||
49 | route.input = audio_input; | ||
50 | if (itv->card->hw_audio & IVTV_HW_MSP34XX) { | ||
51 | route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1); | ||
52 | } | ||
53 | return ivtv_i2c_hw(itv, itv->card->hw_audio, VIDIOC_INT_S_AUDIO_ROUTING, &route); | ||
54 | } | ||
55 | |||
56 | void ivtv_audio_set_route(struct ivtv *itv, struct v4l2_routing *route) | ||
57 | { | ||
58 | ivtv_i2c_hw(itv, itv->card->hw_audio, VIDIOC_INT_S_AUDIO_ROUTING, route); | ||
59 | } | ||
60 | |||
61 | void ivtv_audio_set_audio_clock_freq(struct ivtv *itv, u8 freq) | ||
62 | { | ||
63 | static u32 freqs[3] = { 44100, 48000, 32000 }; | ||
64 | |||
65 | /* The audio clock of the digitizer must match the codec sample | ||
66 | rate otherwise you get some very strange effects. */ | ||
67 | if (freq > 2) | ||
68 | return; | ||
69 | ivtv_call_i2c_clients(itv, VIDIOC_INT_AUDIO_CLOCK_FREQ, &freqs[freq]); | ||
70 | } | ||
71 | |||
diff --git a/drivers/media/video/ivtv/ivtv-controls.c b/drivers/media/video/ivtv/ivtv-controls.c index 0005ea46f208..8c02fa661591 100644 --- a/drivers/media/video/ivtv/ivtv-controls.c +++ b/drivers/media/video/ivtv/ivtv-controls.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "ivtv-driver.h" | 21 | #include "ivtv-driver.h" |
22 | #include "ivtv-cards.h" | 22 | #include "ivtv-cards.h" |
23 | #include "ivtv-ioctl.h" | 23 | #include "ivtv-ioctl.h" |
24 | #include "ivtv-audio.h" | 24 | #include "ivtv-routing.h" |
25 | #include "ivtv-i2c.h" | 25 | #include "ivtv-i2c.h" |
26 | #include "ivtv-mailbox.h" | 26 | #include "ivtv-mailbox.h" |
27 | #include "ivtv-controls.h" | 27 | #include "ivtv-controls.h" |
@@ -231,8 +231,10 @@ int ivtv_control_ioctls(struct ivtv *itv, unsigned int cmd, void *arg) | |||
231 | } | 231 | } |
232 | IVTV_DEBUG_IOCTL("VIDIOC_S_EXT_CTRLS\n"); | 232 | IVTV_DEBUG_IOCTL("VIDIOC_S_EXT_CTRLS\n"); |
233 | if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) { | 233 | if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) { |
234 | static u32 freqs[3] = { 44100, 48000, 32000 }; | ||
234 | struct cx2341x_mpeg_params p = itv->params; | 235 | struct cx2341x_mpeg_params p = itv->params; |
235 | int err = cx2341x_ext_ctrls(&p, atomic_read(&itv->capturing), arg, cmd); | 236 | int err = cx2341x_ext_ctrls(&p, atomic_read(&itv->capturing), arg, cmd); |
237 | unsigned idx; | ||
236 | 238 | ||
237 | if (err) | 239 | if (err) |
238 | return err; | 240 | return err; |
@@ -254,7 +256,11 @@ int ivtv_control_ioctls(struct ivtv *itv, unsigned int cmd, void *arg) | |||
254 | } | 256 | } |
255 | itv->params = p; | 257 | itv->params = p; |
256 | itv->dualwatch_stereo_mode = p.audio_properties & 0x0300; | 258 | itv->dualwatch_stereo_mode = p.audio_properties & 0x0300; |
257 | ivtv_audio_set_audio_clock_freq(itv, p.audio_properties & 0x03); | 259 | idx = p.audio_properties & 0x03; |
260 | /* The audio clock of the digitizer must match the codec sample | ||
261 | rate otherwise you get some very strange effects. */ | ||
262 | if (idx < sizeof(freqs)) | ||
263 | ivtv_call_i2c_clients(itv, VIDIOC_INT_AUDIO_CLOCK_FREQ, &freqs[idx]); | ||
258 | return err; | 264 | return err; |
259 | } | 265 | } |
260 | return -EINVAL; | 266 | return -EINVAL; |
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index 2ed9894672f4..6a74e509c87d 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
@@ -52,7 +52,7 @@ | |||
52 | #include "ivtv-ioctl.h" | 52 | #include "ivtv-ioctl.h" |
53 | #include "ivtv-cards.h" | 53 | #include "ivtv-cards.h" |
54 | #include "ivtv-vbi.h" | 54 | #include "ivtv-vbi.h" |
55 | #include "ivtv-audio.h" | 55 | #include "ivtv-routing.h" |
56 | #include "ivtv-gpio.h" | 56 | #include "ivtv-gpio.h" |
57 | #include "ivtv-yuv.h" | 57 | #include "ivtv-yuv.h" |
58 | 58 | ||
@@ -106,6 +106,18 @@ static char secam[] = "--"; | |||
106 | static char ntsc[] = "-"; | 106 | static char ntsc[] = "-"; |
107 | 107 | ||
108 | /* Buffers */ | 108 | /* Buffers */ |
109 | |||
110 | /* DMA Buffers, Default size in MB allocated */ | ||
111 | #define IVTV_DEFAULT_ENC_MPG_BUFFERS 4 | ||
112 | #define IVTV_DEFAULT_ENC_YUV_BUFFERS 2 | ||
113 | #define IVTV_DEFAULT_ENC_VBI_BUFFERS 1 | ||
114 | /* Exception: size in kB for this stream (MB is overkill) */ | ||
115 | #define IVTV_DEFAULT_ENC_PCM_BUFFERS 320 | ||
116 | #define IVTV_DEFAULT_DEC_MPG_BUFFERS 1 | ||
117 | #define IVTV_DEFAULT_DEC_YUV_BUFFERS 1 | ||
118 | /* Exception: size in kB for this stream (MB is way overkill) */ | ||
119 | #define IVTV_DEFAULT_DEC_VBI_BUFFERS 64 | ||
120 | |||
109 | static int enc_mpg_buffers = IVTV_DEFAULT_ENC_MPG_BUFFERS; | 121 | static int enc_mpg_buffers = IVTV_DEFAULT_ENC_MPG_BUFFERS; |
110 | static int enc_yuv_buffers = IVTV_DEFAULT_ENC_YUV_BUFFERS; | 122 | static int enc_yuv_buffers = IVTV_DEFAULT_ENC_YUV_BUFFERS; |
111 | static int enc_vbi_buffers = IVTV_DEFAULT_ENC_VBI_BUFFERS; | 123 | static int enc_vbi_buffers = IVTV_DEFAULT_ENC_VBI_BUFFERS; |
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h index f7849f852e9d..b9dfdab66362 100644 --- a/drivers/media/video/ivtv/ivtv-driver.h +++ b/drivers/media/video/ivtv/ivtv-driver.h | |||
@@ -65,12 +65,11 @@ | |||
65 | #include <media/ivtv.h> | 65 | #include <media/ivtv.h> |
66 | 66 | ||
67 | 67 | ||
68 | /* Memory layout */ | ||
68 | #define IVTV_ENCODER_OFFSET 0x00000000 | 69 | #define IVTV_ENCODER_OFFSET 0x00000000 |
69 | #define IVTV_ENCODER_SIZE 0x00800000 /* Last half isn't needed 0x01000000 */ | 70 | #define IVTV_ENCODER_SIZE 0x00800000 /* Total size is 0x01000000, but only first half is used */ |
70 | |||
71 | #define IVTV_DECODER_OFFSET 0x01000000 | 71 | #define IVTV_DECODER_OFFSET 0x01000000 |
72 | #define IVTV_DECODER_SIZE 0x00800000 /* Last half isn't needed 0x01000000 */ | 72 | #define IVTV_DECODER_SIZE 0x00800000 /* Total size is 0x01000000, but only first half is used */ |
73 | |||
74 | #define IVTV_REG_OFFSET 0x02000000 | 73 | #define IVTV_REG_OFFSET 0x02000000 |
75 | #define IVTV_REG_SIZE 0x00010000 | 74 | #define IVTV_REG_SIZE 0x00010000 |
76 | 75 | ||
@@ -89,51 +88,8 @@ | |||
89 | #define IVTV_DEC_STREAM_TYPE_YUV 8 | 88 | #define IVTV_DEC_STREAM_TYPE_YUV 8 |
90 | #define IVTV_MAX_STREAMS 9 | 89 | #define IVTV_MAX_STREAMS 9 |
91 | 90 | ||
92 | #define IVTV_V4L2_DEC_MPG_OFFSET 16 /* offset from 0 to register decoder mpg v4l2 minors on */ | ||
93 | #define IVTV_V4L2_ENC_PCM_OFFSET 24 /* offset from 0 to register pcm v4l2 minors on */ | ||
94 | #define IVTV_V4L2_ENC_YUV_OFFSET 32 /* offset from 0 to register yuv v4l2 minors on */ | ||
95 | #define IVTV_V4L2_DEC_YUV_OFFSET 48 /* offset from 0 to register decoder yuv v4l2 minors on */ | ||
96 | #define IVTV_V4L2_DEC_VBI_OFFSET 8 /* offset from 0 to register decoder vbi input v4l2 minors on */ | ||
97 | #define IVTV_V4L2_DEC_VOUT_OFFSET 16 /* offset from 0 to register vbi output v4l2 minors on */ | ||
98 | |||
99 | #define IVTV_ENC_MEM_START 0x00000000 | ||
100 | #define IVTV_DEC_MEM_START 0x01000000 | ||
101 | |||
102 | /* Decoder Buffer hardware size on Chip */ | ||
103 | #define IVTV_DEC_MAX_BUF 0x00100000 /* max bytes in decoder buffer */ | ||
104 | #define IVTV_DEC_MIN_BUF 0x00010000 /* min bytes in dec buffer */ | ||
105 | |||
106 | /* ======================================================================== */ | ||
107 | /* ========================== START USER SETTABLE DMA VARIABLES =========== */ | ||
108 | /* ======================================================================== */ | ||
109 | |||
110 | #define IVTV_DMA_SG_OSD_ENT (2883584/PAGE_SIZE) /* sg entities */ | 91 | #define IVTV_DMA_SG_OSD_ENT (2883584/PAGE_SIZE) /* sg entities */ |
111 | 92 | ||
112 | /* DMA Buffers, Default size in MB allocated */ | ||
113 | #define IVTV_DEFAULT_ENC_MPG_BUFFERS 4 | ||
114 | #define IVTV_DEFAULT_ENC_YUV_BUFFERS 2 | ||
115 | #define IVTV_DEFAULT_ENC_VBI_BUFFERS 1 | ||
116 | /* Exception: size in kB for this stream (MB is overkill) */ | ||
117 | #define IVTV_DEFAULT_ENC_PCM_BUFFERS 320 | ||
118 | #define IVTV_DEFAULT_DEC_MPG_BUFFERS 1 | ||
119 | #define IVTV_DEFAULT_DEC_YUV_BUFFERS 1 | ||
120 | /* Exception: size in kB for this stream (MB is way overkill) */ | ||
121 | #define IVTV_DEFAULT_DEC_VBI_BUFFERS 64 | ||
122 | |||
123 | /* ======================================================================== */ | ||
124 | /* ========================== END USER SETTABLE DMA VARIABLES ============= */ | ||
125 | /* ======================================================================== */ | ||
126 | |||
127 | /* Decoder Status Register */ | ||
128 | #define IVTV_DMA_ERR_LIST 0x00000010 | ||
129 | #define IVTV_DMA_ERR_WRITE 0x00000008 | ||
130 | #define IVTV_DMA_ERR_READ 0x00000004 | ||
131 | #define IVTV_DMA_SUCCESS_WRITE 0x00000002 | ||
132 | #define IVTV_DMA_SUCCESS_READ 0x00000001 | ||
133 | #define IVTV_DMA_READ_ERR (IVTV_DMA_ERR_LIST | IVTV_DMA_ERR_READ) | ||
134 | #define IVTV_DMA_WRITE_ERR (IVTV_DMA_ERR_LIST | IVTV_DMA_ERR_WRITE) | ||
135 | #define IVTV_DMA_ERR (IVTV_DMA_ERR_LIST | IVTV_DMA_ERR_WRITE | IVTV_DMA_ERR_READ) | ||
136 | |||
137 | /* DMA Registers */ | 93 | /* DMA Registers */ |
138 | #define IVTV_REG_DMAXFER (0x0000) | 94 | #define IVTV_REG_DMAXFER (0x0000) |
139 | #define IVTV_REG_DMASTATUS (0x0004) | 95 | #define IVTV_REG_DMASTATUS (0x0004) |
@@ -156,32 +112,11 @@ | |||
156 | #define IVTV_REG_VPU (0x9058) | 112 | #define IVTV_REG_VPU (0x9058) |
157 | #define IVTV_REG_APU (0xA064) | 113 | #define IVTV_REG_APU (0xA064) |
158 | 114 | ||
159 | #define IVTV_IRQ_ENC_START_CAP (0x1 << 31) | ||
160 | #define IVTV_IRQ_ENC_EOS (0x1 << 30) | ||
161 | #define IVTV_IRQ_ENC_VBI_CAP (0x1 << 29) | ||
162 | #define IVTV_IRQ_ENC_VIM_RST (0x1 << 28) | ||
163 | #define IVTV_IRQ_ENC_DMA_COMPLETE (0x1 << 27) | ||
164 | #define IVTV_IRQ_ENC_PIO_COMPLETE (0x1 << 25) | ||
165 | #define IVTV_IRQ_DEC_AUD_MODE_CHG (0x1 << 24) | ||
166 | #define IVTV_IRQ_DEC_DATA_REQ (0x1 << 22) | ||
167 | #define IVTV_IRQ_DEC_DMA_COMPLETE (0x1 << 20) | ||
168 | #define IVTV_IRQ_DEC_VBI_RE_INSERT (0x1 << 19) | ||
169 | #define IVTV_IRQ_DMA_ERR (0x1 << 18) | ||
170 | #define IVTV_IRQ_DMA_WRITE (0x1 << 17) | ||
171 | #define IVTV_IRQ_DMA_READ (0x1 << 16) | ||
172 | #define IVTV_IRQ_DEC_VSYNC (0x1 << 10) | ||
173 | |||
174 | /* IRQ Masks */ | ||
175 | #define IVTV_IRQ_MASK_INIT (IVTV_IRQ_DMA_ERR|IVTV_IRQ_ENC_DMA_COMPLETE|\ | ||
176 | IVTV_IRQ_DMA_READ|IVTV_IRQ_ENC_PIO_COMPLETE) | ||
177 | |||
178 | #define IVTV_IRQ_MASK_CAPTURE (IVTV_IRQ_ENC_START_CAP | IVTV_IRQ_ENC_EOS) | ||
179 | #define IVTV_IRQ_MASK_DECODE (IVTV_IRQ_DEC_DATA_REQ|IVTV_IRQ_DEC_AUD_MODE_CHG) | ||
180 | |||
181 | /* i2c stuff */ | 115 | /* i2c stuff */ |
182 | #define I2C_CLIENTS_MAX 16 | 116 | #define I2C_CLIENTS_MAX 16 |
183 | 117 | ||
184 | /* debugging */ | 118 | /* debugging */ |
119 | extern int ivtv_debug; | ||
185 | 120 | ||
186 | #define IVTV_DBGFLG_WARN (1 << 0) | 121 | #define IVTV_DBGFLG_WARN (1 << 0) |
187 | #define IVTV_DBGFLG_INFO (1 << 1) | 122 | #define IVTV_DBGFLG_INFO (1 << 1) |
@@ -235,11 +170,6 @@ | |||
235 | #define IVTV_WARN(fmt, args...) printk(KERN_WARNING "ivtv%d: " fmt, itv->num , ## args) | 170 | #define IVTV_WARN(fmt, args...) printk(KERN_WARNING "ivtv%d: " fmt, itv->num , ## args) |
236 | #define IVTV_INFO(fmt, args...) printk(KERN_INFO "ivtv%d: " fmt, itv->num , ## args) | 171 | #define IVTV_INFO(fmt, args...) printk(KERN_INFO "ivtv%d: " fmt, itv->num , ## args) |
237 | 172 | ||
238 | /* Values for IVTV_API_DEC_PLAYBACK_SPEED mpeg_frame_type_mask parameter: */ | ||
239 | #define MPEG_FRAME_TYPE_IFRAME 1 | ||
240 | #define MPEG_FRAME_TYPE_IFRAME_PFRAME 3 | ||
241 | #define MPEG_FRAME_TYPE_ALL 7 | ||
242 | |||
243 | /* output modes (cx23415 only) */ | 173 | /* output modes (cx23415 only) */ |
244 | #define OUT_NONE 0 | 174 | #define OUT_NONE 0 |
245 | #define OUT_MPG 1 | 175 | #define OUT_MPG 1 |
@@ -249,9 +179,6 @@ | |||
249 | 179 | ||
250 | #define IVTV_MAX_PGM_INDEX (400) | 180 | #define IVTV_MAX_PGM_INDEX (400) |
251 | 181 | ||
252 | extern int ivtv_debug; | ||
253 | |||
254 | |||
255 | struct ivtv_options { | 182 | struct ivtv_options { |
256 | int kilobytes[IVTV_MAX_STREAMS]; /* Size in kilobytes of each stream */ | 183 | int kilobytes[IVTV_MAX_STREAMS]; /* Size in kilobytes of each stream */ |
257 | int cardtype; /* force card type on load */ | 184 | int cardtype; /* force card type on load */ |
@@ -260,11 +187,6 @@ struct ivtv_options { | |||
260 | int newi2c; /* New I2C algorithm */ | 187 | int newi2c; /* New I2C algorithm */ |
261 | }; | 188 | }; |
262 | 189 | ||
263 | #define IVTV_MBOX_DMA_START 6 | ||
264 | #define IVTV_MBOX_DMA_END 8 | ||
265 | #define IVTV_MBOX_DMA 9 | ||
266 | #define IVTV_MBOX_FIELD_DISPLAYED 8 | ||
267 | |||
268 | /* ivtv-specific mailbox template */ | 190 | /* ivtv-specific mailbox template */ |
269 | struct ivtv_mailbox { | 191 | struct ivtv_mailbox { |
270 | u32 flags; | 192 | u32 flags; |
@@ -450,31 +372,28 @@ struct ivtv_open_id { | |||
450 | struct ivtv *itv; | 372 | struct ivtv *itv; |
451 | }; | 373 | }; |
452 | 374 | ||
453 | #define IVTV_YUV_UPDATE_HORIZONTAL 0x01 | ||
454 | #define IVTV_YUV_UPDATE_VERTICAL 0x02 | ||
455 | |||
456 | struct yuv_frame_info | 375 | struct yuv_frame_info |
457 | { | 376 | { |
458 | u32 update; | 377 | u32 update; |
459 | int src_x; | 378 | s32 src_x; |
460 | int src_y; | 379 | s32 src_y; |
461 | unsigned int src_w; | 380 | u32 src_w; |
462 | unsigned int src_h; | 381 | u32 src_h; |
463 | int dst_x; | 382 | s32 dst_x; |
464 | int dst_y; | 383 | s32 dst_y; |
465 | unsigned int dst_w; | 384 | u32 dst_w; |
466 | unsigned int dst_h; | 385 | u32 dst_h; |
467 | int pan_x; | 386 | s32 pan_x; |
468 | int pan_y; | 387 | s32 pan_y; |
469 | u32 vis_w; | 388 | u32 vis_w; |
470 | u32 vis_h; | 389 | u32 vis_h; |
471 | u32 interlaced_y; | 390 | u32 interlaced_y; |
472 | u32 interlaced_uv; | 391 | u32 interlaced_uv; |
473 | int tru_x; | 392 | s32 tru_x; |
474 | u32 tru_w; | 393 | u32 tru_w; |
475 | u32 tru_h; | 394 | u32 tru_h; |
476 | u32 offset_y; | 395 | u32 offset_y; |
477 | int lace_mode; | 396 | s32 lace_mode; |
478 | }; | 397 | }; |
479 | 398 | ||
480 | #define IVTV_YUV_MODE_INTERLACED 0x00 | 399 | #define IVTV_YUV_MODE_INTERLACED 0x00 |
diff --git a/drivers/media/video/ivtv/ivtv-fb.c b/drivers/media/video/ivtv/ivtv-fb.c index 7618cd47a35d..2c521d1bb057 100644 --- a/drivers/media/video/ivtv/ivtv-fb.c +++ b/drivers/media/video/ivtv/ivtv-fb.c | |||
@@ -382,7 +382,7 @@ static int ivtv_fb_prep_frame(struct ivtv *itv, int cmd, void __user *source, | |||
382 | } | 382 | } |
383 | 383 | ||
384 | /* OSD Address to send DMA to */ | 384 | /* OSD Address to send DMA to */ |
385 | dest_offset += IVTV_DEC_MEM_START + oi->video_rbase; | 385 | dest_offset += IVTV_DECODER_OFFSET + oi->video_rbase; |
386 | 386 | ||
387 | /* Fill Buffers */ | 387 | /* Fill Buffers */ |
388 | return ivtv_fb_prep_dec_dma_to_device(itv, dest_offset, source, count); | 388 | return ivtv_fb_prep_dec_dma_to_device(itv, dest_offset, source, count); |
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c index 6449f5831e66..170bef61aa62 100644 --- a/drivers/media/video/ivtv/ivtv-fileops.c +++ b/drivers/media/video/ivtv/ivtv-fileops.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "ivtv-irq.h" | 27 | #include "ivtv-irq.h" |
28 | #include "ivtv-vbi.h" | 28 | #include "ivtv-vbi.h" |
29 | #include "ivtv-mailbox.h" | 29 | #include "ivtv-mailbox.h" |
30 | #include "ivtv-audio.h" | 30 | #include "ivtv-routing.h" |
31 | #include "ivtv-streams.h" | 31 | #include "ivtv-streams.h" |
32 | #include "ivtv-yuv.h" | 32 | #include "ivtv-yuv.h" |
33 | #include "ivtv-ioctl.h" | 33 | #include "ivtv-ioctl.h" |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index bb59634419cc..f4f56a6e1f81 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -25,8 +25,7 @@ | |||
25 | #include "ivtv-queue.h" | 25 | #include "ivtv-queue.h" |
26 | #include "ivtv-fileops.h" | 26 | #include "ivtv-fileops.h" |
27 | #include "ivtv-vbi.h" | 27 | #include "ivtv-vbi.h" |
28 | #include "ivtv-audio.h" | 28 | #include "ivtv-routing.h" |
29 | #include "ivtv-video.h" | ||
30 | #include "ivtv-streams.h" | 29 | #include "ivtv-streams.h" |
31 | #include "ivtv-yuv.h" | 30 | #include "ivtv-yuv.h" |
32 | #include "ivtv-ioctl.h" | 31 | #include "ivtv-ioctl.h" |
@@ -675,7 +674,7 @@ static int ivtv_debug_ioctls(struct file *filp, unsigned int cmd, void *arg) | |||
675 | case VIDIOC_INT_S_AUDIO_ROUTING: { | 674 | case VIDIOC_INT_S_AUDIO_ROUTING: { |
676 | struct v4l2_routing *route = arg; | 675 | struct v4l2_routing *route = arg; |
677 | 676 | ||
678 | ivtv_audio_set_route(itv, route); | 677 | ivtv_i2c_hw(itv, itv->card->hw_audio, VIDIOC_INT_S_AUDIO_ROUTING, route); |
679 | break; | 678 | break; |
680 | } | 679 | } |
681 | 680 | ||
diff --git a/drivers/media/video/ivtv/ivtv-irq.h b/drivers/media/video/ivtv/ivtv-irq.h index e180bd348989..f879a5822e71 100644 --- a/drivers/media/video/ivtv/ivtv-irq.h +++ b/drivers/media/video/ivtv/ivtv-irq.h | |||
@@ -22,6 +22,28 @@ | |||
22 | #ifndef IVTV_IRQ_H | 22 | #ifndef IVTV_IRQ_H |
23 | #define IVTV_IRQ_H | 23 | #define IVTV_IRQ_H |
24 | 24 | ||
25 | #define IVTV_IRQ_ENC_START_CAP (0x1 << 31) | ||
26 | #define IVTV_IRQ_ENC_EOS (0x1 << 30) | ||
27 | #define IVTV_IRQ_ENC_VBI_CAP (0x1 << 29) | ||
28 | #define IVTV_IRQ_ENC_VIM_RST (0x1 << 28) | ||
29 | #define IVTV_IRQ_ENC_DMA_COMPLETE (0x1 << 27) | ||
30 | #define IVTV_IRQ_ENC_PIO_COMPLETE (0x1 << 25) | ||
31 | #define IVTV_IRQ_DEC_AUD_MODE_CHG (0x1 << 24) | ||
32 | #define IVTV_IRQ_DEC_DATA_REQ (0x1 << 22) | ||
33 | #define IVTV_IRQ_DEC_DMA_COMPLETE (0x1 << 20) | ||
34 | #define IVTV_IRQ_DEC_VBI_RE_INSERT (0x1 << 19) | ||
35 | #define IVTV_IRQ_DMA_ERR (0x1 << 18) | ||
36 | #define IVTV_IRQ_DMA_WRITE (0x1 << 17) | ||
37 | #define IVTV_IRQ_DMA_READ (0x1 << 16) | ||
38 | #define IVTV_IRQ_DEC_VSYNC (0x1 << 10) | ||
39 | |||
40 | /* IRQ Masks */ | ||
41 | #define IVTV_IRQ_MASK_INIT (IVTV_IRQ_DMA_ERR|IVTV_IRQ_ENC_DMA_COMPLETE|\ | ||
42 | IVTV_IRQ_DMA_READ|IVTV_IRQ_ENC_PIO_COMPLETE) | ||
43 | |||
44 | #define IVTV_IRQ_MASK_CAPTURE (IVTV_IRQ_ENC_START_CAP | IVTV_IRQ_ENC_EOS) | ||
45 | #define IVTV_IRQ_MASK_DECODE (IVTV_IRQ_DEC_DATA_REQ|IVTV_IRQ_DEC_AUD_MODE_CHG) | ||
46 | |||
25 | irqreturn_t ivtv_irq_handler(int irq, void *dev_id); | 47 | irqreturn_t ivtv_irq_handler(int irq, void *dev_id); |
26 | 48 | ||
27 | void ivtv_irq_work_handler(struct work_struct *work); | 49 | void ivtv_irq_work_handler(struct work_struct *work); |
diff --git a/drivers/media/video/ivtv/ivtv-mailbox.h b/drivers/media/video/ivtv/ivtv-mailbox.h index 90c871b8e23b..71a54eef8fc7 100644 --- a/drivers/media/video/ivtv/ivtv-mailbox.h +++ b/drivers/media/video/ivtv/ivtv-mailbox.h | |||
@@ -21,6 +21,9 @@ | |||
21 | #ifndef IVTV_MAILBOX_H | 21 | #ifndef IVTV_MAILBOX_H |
22 | #define IVTV_MAILBOX_H | 22 | #define IVTV_MAILBOX_H |
23 | 23 | ||
24 | #define IVTV_MBOX_DMA_END 8 | ||
25 | #define IVTV_MBOX_DMA 9 | ||
26 | |||
24 | void ivtv_api_get_data(struct ivtv_mailbox_data *mbox, int mb, u32 data[]); | 27 | void ivtv_api_get_data(struct ivtv_mailbox_data *mbox, int mb, u32 data[]); |
25 | int ivtv_api(struct ivtv *itv, int cmd, int args, u32 data[]); | 28 | int ivtv_api(struct ivtv *itv, int cmd, int args, u32 data[]); |
26 | int ivtv_vapi_result(struct ivtv *itv, u32 data[CX2341X_MBOX_MAX_DATA], int cmd, int args, ...); | 29 | int ivtv_vapi_result(struct ivtv *itv, u32 data[CX2341X_MBOX_MAX_DATA], int cmd, int args, ...); |
diff --git a/drivers/media/video/ivtv/ivtv-video.c b/drivers/media/video/ivtv/ivtv-routing.c index 5858b197d510..398bd33033ed 100644 --- a/drivers/media/video/ivtv/ivtv-video.c +++ b/drivers/media/video/ivtv/ivtv-routing.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | saa7127 interface functions | 2 | Audio/video-routing-related ivtv functions. |
3 | Copyright (C) 2004-2007 Hans Verkuil <hverkuil@xs4all.nl> | 3 | Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com> |
4 | Copyright (C) 2005-2007 Hans Verkuil <hverkuil@xs4all.nl> | ||
4 | 5 | ||
5 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
@@ -18,73 +19,46 @@ | |||
18 | */ | 19 | */ |
19 | 20 | ||
20 | #include "ivtv-driver.h" | 21 | #include "ivtv-driver.h" |
21 | #include "ivtv-video.h" | ||
22 | #include "ivtv-i2c.h" | 22 | #include "ivtv-i2c.h" |
23 | #include "ivtv-gpio.h" | ||
24 | #include "ivtv-cards.h" | 23 | #include "ivtv-cards.h" |
24 | #include "ivtv-gpio.h" | ||
25 | #include "ivtv-routing.h" | ||
26 | |||
27 | #include <media/msp3400.h> | ||
25 | #include <media/upd64031a.h> | 28 | #include <media/upd64031a.h> |
26 | #include <media/upd64083.h> | 29 | #include <media/upd64083.h> |
27 | 30 | ||
28 | void ivtv_set_vps(struct ivtv *itv, int enabled, u8 vps1, u8 vps2, u8 vps3, | 31 | /* Selects the audio input and output according to the current |
29 | u8 vps4, u8 vps5) | 32 | settings. */ |
33 | void ivtv_audio_set_io(struct ivtv *itv) | ||
30 | { | 34 | { |
31 | struct v4l2_sliced_vbi_data data; | 35 | struct v4l2_routing route; |
32 | 36 | u32 audio_input; | |
33 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) | 37 | int mux_input; |
34 | return; | ||
35 | data.id = V4L2_SLICED_VPS; | ||
36 | data.field = 0; | ||
37 | data.line = enabled ? 16 : 0; | ||
38 | data.data[4] = vps1; | ||
39 | data.data[10] = vps2; | ||
40 | data.data[11] = vps3; | ||
41 | data.data[12] = vps4; | ||
42 | data.data[13] = vps5; | ||
43 | ivtv_saa7127(itv, VIDIOC_INT_S_VBI_DATA, &data); | ||
44 | } | ||
45 | 38 | ||
46 | void ivtv_set_cc(struct ivtv *itv, int mode, u8 cc1, u8 cc2, u8 cc3, u8 cc4) | 39 | /* Determine which input to use */ |
47 | { | 40 | if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) { |
48 | struct v4l2_sliced_vbi_data data; | 41 | audio_input = itv->card->radio_input.audio_input; |
49 | 42 | mux_input = itv->card->radio_input.muxer_input; | |
50 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) | 43 | } else { |
51 | return; | 44 | audio_input = itv->card->audio_inputs[itv->audio_input].audio_input; |
52 | data.id = V4L2_SLICED_CAPTION_525; | 45 | mux_input = itv->card->audio_inputs[itv->audio_input].muxer_input; |
53 | data.field = 0; | 46 | } |
54 | data.line = (mode & 1) ? 21 : 0; | ||
55 | data.data[0] = cc1; | ||
56 | data.data[1] = cc2; | ||
57 | ivtv_saa7127(itv, VIDIOC_INT_S_VBI_DATA, &data); | ||
58 | data.field = 1; | ||
59 | data.line = (mode & 2) ? 21 : 0; | ||
60 | data.data[0] = cc3; | ||
61 | data.data[1] = cc4; | ||
62 | ivtv_saa7127(itv, VIDIOC_INT_S_VBI_DATA, &data); | ||
63 | } | ||
64 | 47 | ||
65 | void ivtv_set_wss(struct ivtv *itv, int enabled, int mode) | 48 | /* handle muxer chips */ |
66 | { | 49 | route.input = mux_input; |
67 | struct v4l2_sliced_vbi_data data; | 50 | route.output = 0; |
68 | 51 | ivtv_i2c_hw(itv, itv->card->hw_muxer, VIDIOC_INT_S_AUDIO_ROUTING, &route); | |
69 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) | 52 | |
70 | return; | 53 | route.input = audio_input; |
71 | /* When using a 50 Hz system, always turn on the | 54 | if (itv->card->hw_audio & IVTV_HW_MSP34XX) { |
72 | wide screen signal with 4x3 ratio as the default. | 55 | route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1); |
73 | Turning this signal on and off can confuse certain | ||
74 | TVs. As far as I can tell there is no reason not to | ||
75 | transmit this signal. */ | ||
76 | if ((itv->std & V4L2_STD_625_50) && !enabled) { | ||
77 | enabled = 1; | ||
78 | mode = 0x08; /* 4x3 full format */ | ||
79 | } | 56 | } |
80 | data.id = V4L2_SLICED_WSS_625; | 57 | ivtv_i2c_hw(itv, itv->card->hw_audio, VIDIOC_INT_S_AUDIO_ROUTING, &route); |
81 | data.field = 0; | ||
82 | data.line = enabled ? 23 : 0; | ||
83 | data.data[0] = mode & 0xff; | ||
84 | data.data[1] = (mode >> 8) & 0xff; | ||
85 | ivtv_saa7127(itv, VIDIOC_INT_S_VBI_DATA, &data); | ||
86 | } | 58 | } |
87 | 59 | ||
60 | /* Selects the video input and output according to the current | ||
61 | settings. */ | ||
88 | void ivtv_video_set_io(struct ivtv *itv) | 62 | void ivtv_video_set_io(struct ivtv *itv) |
89 | { | 63 | { |
90 | struct v4l2_routing route; | 64 | struct v4l2_routing route; |
diff --git a/drivers/media/video/ivtv/ivtv-audio.h b/drivers/media/video/ivtv/ivtv-routing.h index ebb90cc8f861..c72a9731ca01 100644 --- a/drivers/media/video/ivtv/ivtv-audio.h +++ b/drivers/media/video/ivtv/ivtv-routing.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | Audio-related ivtv functions. | 2 | Audio/video-routing-related ivtv functions. |
3 | Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com> | 3 | Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com> |
4 | Copyright (C) 2005-2007 Hans Verkuil <hverkuil@xs4all.nl> | 4 | Copyright (C) 2005-2007 Hans Verkuil <hverkuil@xs4all.nl> |
5 | 5 | ||
@@ -18,11 +18,10 @@ | |||
18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef IVTV_AUDIO_H | 21 | #ifndef IVTV_ROUTING_H |
22 | #define IVTV_AUDIO_H | 22 | #define IVTV_ROUTING_H |
23 | 23 | ||
24 | int ivtv_audio_set_io(struct ivtv *itv); | 24 | void ivtv_audio_set_io(struct ivtv *itv); |
25 | void ivtv_audio_set_route(struct ivtv *itv, struct v4l2_routing *route); | 25 | void ivtv_video_set_io(struct ivtv *itv); |
26 | void ivtv_audio_set_audio_clock_freq(struct ivtv *itv, u8 freq); | ||
27 | 26 | ||
28 | #endif | 27 | #endif |
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index fae151a31e85..3939a804f043 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include "ivtv-queue.h" | 38 | #include "ivtv-queue.h" |
39 | #include "ivtv-mailbox.h" | 39 | #include "ivtv-mailbox.h" |
40 | #include "ivtv-ioctl.h" | 40 | #include "ivtv-ioctl.h" |
41 | #include "ivtv-irq.h" | ||
41 | #include "ivtv-yuv.h" | 42 | #include "ivtv-yuv.h" |
42 | #include "ivtv-cards.h" | 43 | #include "ivtv-cards.h" |
43 | #include "ivtv-streams.h" | 44 | #include "ivtv-streams.h" |
@@ -62,6 +63,13 @@ static struct file_operations ivtv_v4l2_dec_fops = { | |||
62 | .poll = ivtv_v4l2_dec_poll, | 63 | .poll = ivtv_v4l2_dec_poll, |
63 | }; | 64 | }; |
64 | 65 | ||
66 | #define IVTV_V4L2_DEC_MPG_OFFSET 16 /* offset from 0 to register decoder mpg v4l2 minors on */ | ||
67 | #define IVTV_V4L2_ENC_PCM_OFFSET 24 /* offset from 0 to register pcm v4l2 minors on */ | ||
68 | #define IVTV_V4L2_ENC_YUV_OFFSET 32 /* offset from 0 to register yuv v4l2 minors on */ | ||
69 | #define IVTV_V4L2_DEC_YUV_OFFSET 48 /* offset from 0 to register decoder yuv v4l2 minors on */ | ||
70 | #define IVTV_V4L2_DEC_VBI_OFFSET 8 /* offset from 0 to register decoder vbi input v4l2 minors on */ | ||
71 | #define IVTV_V4L2_DEC_VOUT_OFFSET 16 /* offset from 0 to register vbi output v4l2 minors on */ | ||
72 | |||
65 | static struct { | 73 | static struct { |
66 | const char *name; | 74 | const char *name; |
67 | int vfl_type; | 75 | int vfl_type; |
@@ -658,10 +666,10 @@ int ivtv_start_v4l2_decode_stream(struct ivtv_stream *s, int gop_offset) | |||
658 | clear_bit(IVTV_F_S_STREAMOFF, &s->s_flags); | 666 | clear_bit(IVTV_F_S_STREAMOFF, &s->s_flags); |
659 | 667 | ||
660 | /* Zero out decoder counters */ | 668 | /* Zero out decoder counters */ |
661 | writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_FIELD_DISPLAYED].data[0]); | 669 | writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA_END].data[0]); |
662 | writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_FIELD_DISPLAYED].data[1]); | 670 | writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA_END].data[1]); |
663 | writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_FIELD_DISPLAYED].data[2]); | 671 | writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA_END].data[2]); |
664 | writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_FIELD_DISPLAYED].data[3]); | 672 | writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA_END].data[3]); |
665 | writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA].data[0]); | 673 | writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA].data[0]); |
666 | writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA].data[1]); | 674 | writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA].data[1]); |
667 | writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA].data[2]); | 675 | writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA].data[2]); |
diff --git a/drivers/media/video/ivtv/ivtv-vbi.c b/drivers/media/video/ivtv/ivtv-vbi.c index a58c833c2b04..5d8a40f3d2b6 100644 --- a/drivers/media/video/ivtv/ivtv-vbi.c +++ b/drivers/media/video/ivtv/ivtv-vbi.c | |||
@@ -18,10 +18,70 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "ivtv-driver.h" | 20 | #include "ivtv-driver.h" |
21 | #include "ivtv-video.h" | 21 | #include "ivtv-i2c.h" |
22 | #include "ivtv-vbi.h" | ||
23 | #include "ivtv-ioctl.h" | 22 | #include "ivtv-ioctl.h" |
24 | #include "ivtv-queue.h" | 23 | #include "ivtv-queue.h" |
24 | #include "ivtv-vbi.h" | ||
25 | |||
26 | static void ivtv_set_vps(struct ivtv *itv, int enabled, u8 vps1, u8 vps2, u8 vps3, | ||
27 | u8 vps4, u8 vps5) | ||
28 | { | ||
29 | struct v4l2_sliced_vbi_data data; | ||
30 | |||
31 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) | ||
32 | return; | ||
33 | data.id = V4L2_SLICED_VPS; | ||
34 | data.field = 0; | ||
35 | data.line = enabled ? 16 : 0; | ||
36 | data.data[4] = vps1; | ||
37 | data.data[10] = vps2; | ||
38 | data.data[11] = vps3; | ||
39 | data.data[12] = vps4; | ||
40 | data.data[13] = vps5; | ||
41 | ivtv_saa7127(itv, VIDIOC_INT_S_VBI_DATA, &data); | ||
42 | } | ||
43 | |||
44 | static void ivtv_set_cc(struct ivtv *itv, int mode, u8 cc1, u8 cc2, u8 cc3, u8 cc4) | ||
45 | { | ||
46 | struct v4l2_sliced_vbi_data data; | ||
47 | |||
48 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) | ||
49 | return; | ||
50 | data.id = V4L2_SLICED_CAPTION_525; | ||
51 | data.field = 0; | ||
52 | data.line = (mode & 1) ? 21 : 0; | ||
53 | data.data[0] = cc1; | ||
54 | data.data[1] = cc2; | ||
55 | ivtv_saa7127(itv, VIDIOC_INT_S_VBI_DATA, &data); | ||
56 | data.field = 1; | ||
57 | data.line = (mode & 2) ? 21 : 0; | ||
58 | data.data[0] = cc3; | ||
59 | data.data[1] = cc4; | ||
60 | ivtv_saa7127(itv, VIDIOC_INT_S_VBI_DATA, &data); | ||
61 | } | ||
62 | |||
63 | static void ivtv_set_wss(struct ivtv *itv, int enabled, int mode) | ||
64 | { | ||
65 | struct v4l2_sliced_vbi_data data; | ||
66 | |||
67 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) | ||
68 | return; | ||
69 | /* When using a 50 Hz system, always turn on the | ||
70 | wide screen signal with 4x3 ratio as the default. | ||
71 | Turning this signal on and off can confuse certain | ||
72 | TVs. As far as I can tell there is no reason not to | ||
73 | transmit this signal. */ | ||
74 | if ((itv->std & V4L2_STD_625_50) && !enabled) { | ||
75 | enabled = 1; | ||
76 | mode = 0x08; /* 4x3 full format */ | ||
77 | } | ||
78 | data.id = V4L2_SLICED_WSS_625; | ||
79 | data.field = 0; | ||
80 | data.line = enabled ? 23 : 0; | ||
81 | data.data[0] = mode & 0xff; | ||
82 | data.data[1] = (mode >> 8) & 0xff; | ||
83 | ivtv_saa7127(itv, VIDIOC_INT_S_VBI_DATA, &data); | ||
84 | } | ||
25 | 85 | ||
26 | static int odd_parity(u8 c) | 86 | static int odd_parity(u8 c) |
27 | { | 87 | { |
diff --git a/drivers/media/video/ivtv/ivtv-video.h b/drivers/media/video/ivtv/ivtv-video.h deleted file mode 100644 index 498e9b61c227..000000000000 --- a/drivers/media/video/ivtv/ivtv-video.h +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | /* | ||
2 | saa7127 interface functions | ||
3 | Copyright (C) 2004-2007 Hans Verkuil <hverkuil@xs4all.nl> | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the Free Software | ||
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef IVTV_VIDEO_H | ||
21 | #define IVTV_VIDEO_H | ||
22 | |||
23 | void ivtv_set_wss(struct ivtv *itv, int enabled, int mode); | ||
24 | void ivtv_set_cc(struct ivtv *itv, int mode, u8 cc1, u8 cc2, u8 cc3, u8 cc4); | ||
25 | void ivtv_set_vps(struct ivtv *itv, int enabled, u8 vps1, u8 vps2, u8 vps3, | ||
26 | u8 vps4, u8 vps5); | ||
27 | void ivtv_video_set_io(struct ivtv *itv); | ||
28 | |||
29 | #endif | ||
diff --git a/drivers/media/video/ivtv/ivtv-yuv.c b/drivers/media/video/ivtv/ivtv-yuv.c index bb2cbb206c14..e2288f224ab6 100644 --- a/drivers/media/video/ivtv/ivtv-yuv.c +++ b/drivers/media/video/ivtv/ivtv-yuv.c | |||
@@ -42,7 +42,7 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma, | |||
42 | int y_decode_height, uv_decode_height, y_size; | 42 | int y_decode_height, uv_decode_height, y_size; |
43 | int frame = atomic_read(&itv->yuv_info.next_fill_frame); | 43 | int frame = atomic_read(&itv->yuv_info.next_fill_frame); |
44 | 44 | ||
45 | y_buffer_offset = IVTV_DEC_MEM_START + yuv_offset[frame]; | 45 | y_buffer_offset = IVTV_DECODER_OFFSET + yuv_offset[frame]; |
46 | uv_buffer_offset = y_buffer_offset + IVTV_YUV_BUFFER_UV_OFFSET; | 46 | uv_buffer_offset = y_buffer_offset + IVTV_YUV_BUFFER_UV_OFFSET; |
47 | 47 | ||
48 | y_decode_height = uv_decode_height = args->src.height + args->src.top; | 48 | y_decode_height = uv_decode_height = args->src.height + args->src.top; |
@@ -106,7 +106,7 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma, | |||
106 | if (itv->yuv_info.blanking_dmaptr) { | 106 | if (itv->yuv_info.blanking_dmaptr) { |
107 | dma->SGarray[dma->SG_length].size = cpu_to_le32(720*16); | 107 | dma->SGarray[dma->SG_length].size = cpu_to_le32(720*16); |
108 | dma->SGarray[dma->SG_length].src = cpu_to_le32(itv->yuv_info.blanking_dmaptr); | 108 | dma->SGarray[dma->SG_length].src = cpu_to_le32(itv->yuv_info.blanking_dmaptr); |
109 | dma->SGarray[dma->SG_length].dst = cpu_to_le32(IVTV_DEC_MEM_START + yuv_offset[frame]); | 109 | dma->SGarray[dma->SG_length].dst = cpu_to_le32(IVTV_DECODER_OFFSET + yuv_offset[frame]); |
110 | dma->SG_length++; | 110 | dma->SG_length++; |
111 | } | 111 | } |
112 | } | 112 | } |
diff --git a/drivers/media/video/ivtv/ivtv-yuv.h b/drivers/media/video/ivtv/ivtv-yuv.h index 0824048ce3a2..f7215eeca018 100644 --- a/drivers/media/video/ivtv/ivtv-yuv.h +++ b/drivers/media/video/ivtv/ivtv-yuv.h | |||
@@ -32,6 +32,9 @@ | |||
32 | #define IVTV_YUV_HORIZONTAL_FILTER_OFFSET 0x025d8 | 32 | #define IVTV_YUV_HORIZONTAL_FILTER_OFFSET 0x025d8 |
33 | #define IVTV_YUV_VERTICAL_FILTER_OFFSET 0x03358 | 33 | #define IVTV_YUV_VERTICAL_FILTER_OFFSET 0x03358 |
34 | 34 | ||
35 | #define IVTV_YUV_UPDATE_HORIZONTAL 0x01 | ||
36 | #define IVTV_YUV_UPDATE_VERTICAL 0x02 | ||
37 | |||
35 | extern const u32 yuv_offset[4]; | 38 | extern const u32 yuv_offset[4]; |
36 | 39 | ||
37 | int ivtv_yuv_filter_check(struct ivtv *itv); | 40 | int ivtv_yuv_filter_check(struct ivtv *itv); |