aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx25840
diff options
context:
space:
mode:
authorChristopher Neufeld <television@cneufeld.ca>2006-05-24 09:16:45 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 01:05:00 -0400
commit3e3bf277f1d2487307227e2c5329763cf3af44bc (patch)
tree9e3534c6279437c7520feca3725e3e5d20246147 /drivers/media/video/cx25840
parent88ca8ed0b7f2f04a055ff3c389f398ba3ad3d27d (diff)
V4L/DVB (4050): Add NTSC sliced VBI support to the cx25840 module.
NTSC sliced VBI support by Christopher Neufeld <television@cneufeld.ca> with additional fixes by Hans Verkuil <hverkuil@xs4all.nl>. Signed-off-by: Christopher Neufeld <television@cneufeld.ca> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cx25840')
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c4
-rw-r--r--drivers/media/video/cx25840/cx25840-core.h1
-rw-r--r--drivers/media/video/cx25840/cx25840-vbi.c24
3 files changed, 24 insertions, 5 deletions
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index e4655e3c2520..6d7207e67d6f 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -10,6 +10,9 @@
10 * 10 *
11 * VBI support by Hans Verkuil <hverkuil@xs4all.nl>. 11 * VBI support by Hans Verkuil <hverkuil@xs4all.nl>.
12 * 12 *
13 * NTSC sliced VBI support by Christopher Neufeld <television@cneufeld.ca>
14 * with additional fixes by Hans Verkuil <hverkuil@xs4all.nl>.
15 *
13 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License 17 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2 18 * as published by the Free Software Foundation; either version 2
@@ -982,6 +985,7 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address,
982 state->audclk_freq = 48000; 985 state->audclk_freq = 48000;
983 state->pvr150_workaround = 0; 986 state->pvr150_workaround = 0;
984 state->audmode = V4L2_TUNER_MODE_LANG1; 987 state->audmode = V4L2_TUNER_MODE_LANG1;
988 state->vbi_line_offset = 8;
985 state->id = id; 989 state->id = id;
986 990
987 if (state->is_cx25836) 991 if (state->is_cx25836)
diff --git a/drivers/media/video/cx25840/cx25840-core.h b/drivers/media/video/cx25840/cx25840-core.h
index 69d7bd2bcb29..b1321920dfe7 100644
--- a/drivers/media/video/cx25840/cx25840-core.h
+++ b/drivers/media/video/cx25840/cx25840-core.h
@@ -40,6 +40,7 @@ struct cx25840_state {
40 enum cx25840_audio_input aud_input; 40 enum cx25840_audio_input aud_input;
41 u32 audclk_freq; 41 u32 audclk_freq;
42 int audmode; 42 int audmode;
43 int vbi_line_offset;
43 enum v4l2_chip_ident id; 44 enum v4l2_chip_ident id;
44 int is_cx25836; 45 int is_cx25836;
45}; 46};
diff --git a/drivers/media/video/cx25840/cx25840-vbi.c b/drivers/media/video/cx25840/cx25840-vbi.c
index 57feca288d2b..c124974c55b1 100644
--- a/drivers/media/video/cx25840/cx25840-vbi.c
+++ b/drivers/media/video/cx25840/cx25840-vbi.c
@@ -84,6 +84,7 @@ static int decode_vps(u8 * dst, u8 * p)
84 84
85void cx25840_vbi_setup(struct i2c_client *client) 85void cx25840_vbi_setup(struct i2c_client *client)
86{ 86{
87 struct cx25840_state *state = i2c_get_clientdata(client);
87 v4l2_std_id std = cx25840_get_v4lstd(client); 88 v4l2_std_id std = cx25840_get_v4lstd(client);
88 89
89 if (std & ~V4L2_STD_NTSC) { 90 if (std & ~V4L2_STD_NTSC) {
@@ -117,6 +118,7 @@ void cx25840_vbi_setup(struct i2c_client *client)
117 118
118 cx25840_write(client, 0x47e, 0x0a); 119 cx25840_write(client, 0x47e, 0x0a);
119 cx25840_write(client, 0x47f, 0x01); 120 cx25840_write(client, 0x47f, 0x01);
121 state->vbi_line_offset = 5;
120 } else { 122 } else {
121 /* datasheet startup, step 8d */ 123 /* datasheet startup, step 8d */
122 cx25840_write(client, 0x49f, 0x14); 124 cx25840_write(client, 0x49f, 0x14);
@@ -140,11 +142,13 @@ void cx25840_vbi_setup(struct i2c_client *client)
140 cx25840_write(client, 0x47d, 0x7c); 142 cx25840_write(client, 0x47d, 0x7c);
141 cx25840_write(client, 0x47e, 0x08); 143 cx25840_write(client, 0x47e, 0x08);
142 cx25840_write(client, 0x47f, 0x00); 144 cx25840_write(client, 0x47f, 0x00);
145 state->vbi_line_offset = 8;
143 } 146 }
144} 147}
145 148
146int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg) 149int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg)
147{ 150{
151 struct cx25840_state *state = i2c_get_clientdata(client);
148 struct v4l2_format *fmt; 152 struct v4l2_format *fmt;
149 struct v4l2_sliced_vbi_format *svbi; 153 struct v4l2_sliced_vbi_format *svbi;
150 154
@@ -211,7 +215,7 @@ int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg)
211 cx25840_vbi_setup(client); 215 cx25840_vbi_setup(client);
212 216
213 /* Sliced VBI */ 217 /* Sliced VBI */
214 cx25840_write(client, 0x404, 0x36); /* Ancillery data */ 218 cx25840_write(client, 0x404, 0x32); /* Ancillary data */
215 cx25840_write(client, 0x406, 0x13); 219 cx25840_write(client, 0x406, 0x13);
216 cx25840_write(client, 0x47f, vbi_offset); 220 cx25840_write(client, 0x47f, vbi_offset);
217 221
@@ -248,8 +252,18 @@ int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg)
248 } 252 }
249 } 253 }
250 254
251 for (x = 1, i = 0x424; i <= 0x434; i++, x++) { 255 if (is_pal) {
252 cx25840_write(client, i, lcr[6 + x]); 256 for (x = 1, i = 0x424; i <= 0x434; i++, x++) {
257 cx25840_write(client, i, lcr[6 + x]);
258 }
259 }
260 else {
261 for (x = 1, i = 0x424; i <= 0x430; i++, x++) {
262 cx25840_write(client, i, lcr[9 + x]);
263 }
264 for (i = 0x431; i <= 0x434; i++) {
265 cx25840_write(client, i, 0);
266 }
253 } 267 }
254 268
255 cx25840_write(client, 0x43c, 0x16); 269 cx25840_write(client, 0x43c, 0x16);
@@ -257,7 +271,7 @@ int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg)
257 if (is_pal) { 271 if (is_pal) {
258 cx25840_write(client, 0x474, 0x2a); 272 cx25840_write(client, 0x474, 0x2a);
259 } else { 273 } else {
260 cx25840_write(client, 0x474, 0x1a + 6); 274 cx25840_write(client, 0x474, 0x22);
261 } 275 }
262 break; 276 break;
263 } 277 }
@@ -278,7 +292,7 @@ int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg)
278 id1 = p[-1]; 292 id1 = p[-1];
279 id2 = p[0] & 0xf; 293 id2 = p[0] & 0xf;
280 l = p[2] & 0x3f; 294 l = p[2] & 0x3f;
281 l += 5; 295 l += state->vbi_line_offset;
282 p += 4; 296 p += 4;
283 297
284 switch (id2) { 298 switch (id2) {