aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-08-14 23:10:00 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-08-14 23:10:00 -0400
commit4c0e176dd5e4c44dd60f398518f75eedbe1a65f3 (patch)
tree07aea7539f78f221c6fc535a94a07befa2afdb63 /drivers/media
parentf241be74b803dcf9d70c9978292946370654320f (diff)
parent2ba84684e8cf6f980e4e95a2300f53a505eb794e (diff)
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/frontends/Kconfig2
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.c16
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.h1
-rw-r--r--drivers/media/dvb/frontends/lgdt330x.c514
-rw-r--r--drivers/media/dvb/frontends/lgdt330x.h16
-rw-r--r--drivers/media/dvb/frontends/lgdt330x_priv.h8
-rw-r--r--drivers/media/video/bttv-cards.c8
-rw-r--r--drivers/media/video/bttv-driver.c33
-rw-r--r--drivers/media/video/bttv.h6
-rw-r--r--drivers/media/video/bttvp.h4
-rw-r--r--drivers/media/video/cx88/cx88-cards.c33
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c26
-rw-r--r--drivers/media/video/cx88/cx88-video.c4
-rw-r--r--drivers/media/video/cx88/cx88.h3
-rw-r--r--drivers/media/video/msp3400.c4
-rw-r--r--drivers/media/video/saa7134/saa7134-i2c.c4
-rw-r--r--drivers/media/video/saa7134/saa7134.h4
-rw-r--r--drivers/media/video/tea5767.c26
-rw-r--r--drivers/media/video/tuner-core.c29
-rw-r--r--drivers/media/video/tuner-simple.c8
-rw-r--r--drivers/media/video/tveeprom.c2
21 files changed, 539 insertions, 212 deletions
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
index e83256d0fd14..a50a41f6f79d 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -188,7 +188,7 @@ config DVB_BCM3510
188 support this frontend. 188 support this frontend.
189 189
190config DVB_LGDT330X 190config DVB_LGDT330X
191 tristate "LGDT3302 or LGDT3303 based (DViCO FusionHDTV Gold)" 191 tristate "LG Electronics LGDT3302/LGDT3303 based"
192 depends on DVB_CORE 192 depends on DVB_CORE
193 help 193 help
194 An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want 194 An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index 5264310c070e..536c35d969b7 100644
--- a/drivers/media/dvb/frontends/dvb-pll.c
+++ b/drivers/media/dvb/frontends/dvb-pll.c
@@ -225,6 +225,22 @@ struct dvb_pll_desc dvb_pll_tua6034 = {
225}; 225};
226EXPORT_SYMBOL(dvb_pll_tua6034); 226EXPORT_SYMBOL(dvb_pll_tua6034);
227 227
228/* Infineon TUA6034
229 * used in LG Innotek TDVS-H062F
230 */
231struct dvb_pll_desc dvb_pll_tdvs_tua6034 = {
232 .name = "LG/Infineon TUA6034",
233 .min = 54000000,
234 .max = 863000000,
235 .count = 3,
236 .entries = {
237 { 160000000, 44000000, 62500, 0xce, 0x01 },
238 { 455000000, 44000000, 62500, 0xce, 0x02 },
239 { 999999999, 44000000, 62500, 0xce, 0x04 },
240 },
241};
242EXPORT_SYMBOL(dvb_pll_tdvs_tua6034);
243
228/* Philips FMD1216ME 244/* Philips FMD1216ME
229 * used in Medion Hybrid PCMCIA card and USB Box 245 * used in Medion Hybrid PCMCIA card and USB Box
230 */ 246 */
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h
index cb794759d89e..205b2d1a8852 100644
--- a/drivers/media/dvb/frontends/dvb-pll.h
+++ b/drivers/media/dvb/frontends/dvb-pll.h
@@ -31,6 +31,7 @@ extern struct dvb_pll_desc dvb_pll_unknown_1;
31extern struct dvb_pll_desc dvb_pll_tua6010xs; 31extern struct dvb_pll_desc dvb_pll_tua6010xs;
32extern struct dvb_pll_desc dvb_pll_env57h1xd5; 32extern struct dvb_pll_desc dvb_pll_env57h1xd5;
33extern struct dvb_pll_desc dvb_pll_tua6034; 33extern struct dvb_pll_desc dvb_pll_tua6034;
34extern struct dvb_pll_desc dvb_pll_tdvs_tua6034;
34extern struct dvb_pll_desc dvb_pll_tda665x; 35extern struct dvb_pll_desc dvb_pll_tda665x;
35extern struct dvb_pll_desc dvb_pll_fmd1216me; 36extern struct dvb_pll_desc dvb_pll_fmd1216me;
36extern struct dvb_pll_desc dvb_pll_tded4; 37extern struct dvb_pll_desc dvb_pll_tded4;
diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c
index e94dee50eecd..1f1cd7a8d500 100644
--- a/drivers/media/dvb/frontends/lgdt330x.c
+++ b/drivers/media/dvb/frontends/lgdt330x.c
@@ -1,11 +1,8 @@
1/* 1/*
2 * Support for LGDT3302 & LGDT3303 (DViCO FusionHDTV Gold) - VSB/QAM 2 * Support for LGDT3302 and LGDT3303 - VSB/QAM
3 * 3 *
4 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> 4 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
5 * 5 *
6 * Based on code from Kirk Lapray <kirk_lapray@bigfoot.com>
7 * Copyright (C) 2005
8 *
9 * 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
10 * 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
11 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
@@ -25,11 +22,13 @@
25/* 22/*
26 * NOTES ABOUT THIS DRIVER 23 * NOTES ABOUT THIS DRIVER
27 * 24 *
28 * This driver supports DViCO FusionHDTV Gold under Linux. 25 * This Linux driver supports:
26 * DViCO FusionHDTV 3 Gold-Q
27 * DViCO FusionHDTV 3 Gold-T
28 * DViCO FusionHDTV 5 Gold
29 * 29 *
30 * TODO: 30 * TODO:
31 * BER and signal strength always return 0. 31 * signal strength always returns 0.
32 * Include support for LGDT3303
33 * 32 *
34 */ 33 */
35 34
@@ -41,7 +40,6 @@
41#include <asm/byteorder.h> 40#include <asm/byteorder.h>
42 41
43#include "dvb_frontend.h" 42#include "dvb_frontend.h"
44#include "dvb-pll.h"
45#include "lgdt330x_priv.h" 43#include "lgdt330x_priv.h"
46#include "lgdt330x.h" 44#include "lgdt330x.h"
47 45
@@ -70,55 +68,37 @@ struct lgdt330x_state
70 u32 current_frequency; 68 u32 current_frequency;
71}; 69};
72 70
73static int i2c_writebytes (struct lgdt330x_state* state, 71static int i2c_write_demod_bytes (struct lgdt330x_state* state,
74 u8 addr, /* demod_address or pll_address */
75 u8 *buf, /* data bytes to send */ 72 u8 *buf, /* data bytes to send */
76 int len /* number of bytes to send */ ) 73 int len /* number of bytes to send */ )
77{ 74{
78 u8 tmp[] = { buf[0], buf[1] };
79 struct i2c_msg msg = 75 struct i2c_msg msg =
80 { .addr = addr, .flags = 0, .buf = tmp, .len = 2 }; 76 { .addr = state->config->demod_address,
81 int err; 77 .flags = 0,
78 .buf = buf,
79 .len = 2 };
82 int i; 80 int i;
81 int err;
83 82
84 for (i=1; i<len; i++) { 83 for (i=0; i<len-1; i+=2){
85 tmp[1] = buf[i];
86 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { 84 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
87 printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err); 85 printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err = %i)\n", __FUNCTION__, msg.buf[0], msg.buf[1], err);
88 if (err < 0) 86 if (err < 0)
89 return err; 87 return err;
90 else 88 else
91 return -EREMOTEIO; 89 return -EREMOTEIO;
92 } 90 }
93 tmp[0]++; 91 msg.buf += 2;
94 } 92 }
95 return 0; 93 return 0;
96} 94}
97 95
98#if 0
99static int i2c_readbytes (struct lgdt330x_state* state,
100 u8 addr, /* demod_address or pll_address */
101 u8 *buf, /* holds data bytes read */
102 int len /* number of bytes to read */ )
103{
104 struct i2c_msg msg =
105 { .addr = addr, .flags = I2C_M_RD, .buf = buf, .len = len };
106 int err;
107
108 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
109 printk(KERN_WARNING "lgdt330x: %s error (addr %02x, err == %i)\n", __FUNCTION__, addr, err);
110 return -EREMOTEIO;
111 }
112 return 0;
113}
114#endif
115
116/* 96/*
117 * This routine writes the register (reg) to the demod bus 97 * This routine writes the register (reg) to the demod bus
118 * then reads the data returned for (len) bytes. 98 * then reads the data returned for (len) bytes.
119 */ 99 */
120 100
121static u8 i2c_selectreadbytes (struct lgdt330x_state* state, 101static u8 i2c_read_demod_bytes (struct lgdt330x_state* state,
122 enum I2C_REG reg, u8* buf, int len) 102 enum I2C_REG reg, u8* buf, int len)
123{ 103{
124 u8 wr [] = { reg }; 104 u8 wr [] = { reg };
@@ -139,7 +119,7 @@ static u8 i2c_selectreadbytes (struct lgdt330x_state* state,
139} 119}
140 120
141/* Software reset */ 121/* Software reset */
142int lgdt330x_SwReset(struct lgdt330x_state* state) 122static int lgdt3302_SwReset(struct lgdt330x_state* state)
143{ 123{
144 u8 ret; 124 u8 ret;
145 u8 reset[] = { 125 u8 reset[] = {
@@ -148,23 +128,51 @@ int lgdt330x_SwReset(struct lgdt330x_state* state)
148 * bits 5-0 are 1 to mask interrupts */ 128 * bits 5-0 are 1 to mask interrupts */
149 }; 129 };
150 130
151 ret = i2c_writebytes(state, 131 ret = i2c_write_demod_bytes(state,
152 state->config->demod_address, 132 reset, sizeof(reset));
133 if (ret == 0) {
134
135 /* force reset high (inactive) and unmask interrupts */
136 reset[1] = 0x7f;
137 ret = i2c_write_demod_bytes(state,
138 reset, sizeof(reset));
139 }
140 return ret;
141}
142
143static int lgdt3303_SwReset(struct lgdt330x_state* state)
144{
145 u8 ret;
146 u8 reset[] = {
147 0x02,
148 0x00 /* bit 0 is active low software reset */
149 };
150
151 ret = i2c_write_demod_bytes(state,
153 reset, sizeof(reset)); 152 reset, sizeof(reset));
154 if (ret == 0) { 153 if (ret == 0) {
155 /* spec says reset takes 100 ns why wait */ 154
156 /* mdelay(100); */ /* keep low for 100mS */ 155 /* force reset high (inactive) */
157 reset[1] = 0x7f; /* force reset high (inactive) 156 reset[1] = 0x01;
158 * and unmask interrupts */ 157 ret = i2c_write_demod_bytes(state,
159 ret = i2c_writebytes(state,
160 state->config->demod_address,
161 reset, sizeof(reset)); 158 reset, sizeof(reset));
162 } 159 }
163 /* Spec does not indicate a need for this either */
164 /*mdelay(5); */ /* wait 5 msec before doing more */
165 return ret; 160 return ret;
166} 161}
167 162
163static int lgdt330x_SwReset(struct lgdt330x_state* state)
164{
165 switch (state->config->demod_chip) {
166 case LGDT3302:
167 return lgdt3302_SwReset(state);
168 case LGDT3303:
169 return lgdt3303_SwReset(state);
170 default:
171 return -ENODEV;
172 }
173}
174
175
168static int lgdt330x_init(struct dvb_frontend* fe) 176static int lgdt330x_init(struct dvb_frontend* fe)
169{ 177{
170 /* Hardware reset is done using gpio[0] of cx23880x chip. 178 /* Hardware reset is done using gpio[0] of cx23880x chip.
@@ -173,22 +181,98 @@ static int lgdt330x_init(struct dvb_frontend* fe)
173 * Maybe there needs to be a callable function in cx88-core or 181 * Maybe there needs to be a callable function in cx88-core or
174 * the caller of this function needs to do it. */ 182 * the caller of this function needs to do it. */
175 183
176 dprintk("%s entered\n", __FUNCTION__); 184 /*
177 return lgdt330x_SwReset((struct lgdt330x_state*) fe->demodulator_priv); 185 * Array of byte pairs <address, value>
186 * to initialize each different chip
187 */
188 static u8 lgdt3302_init_data[] = {
189 /* Use 50MHz parameter values from spec sheet since xtal is 50 */
190 /* Change the value of NCOCTFV[25:0] of carrier
191 recovery center frequency register */
192 VSB_CARRIER_FREQ0, 0x00,
193 VSB_CARRIER_FREQ1, 0x87,
194 VSB_CARRIER_FREQ2, 0x8e,
195 VSB_CARRIER_FREQ3, 0x01,
196 /* Change the TPCLK pin polarity
197 data is valid on falling clock */
198 DEMUX_CONTROL, 0xfb,
199 /* Change the value of IFBW[11:0] of
200 AGC IF/RF loop filter bandwidth register */
201 AGC_RF_BANDWIDTH0, 0x40,
202 AGC_RF_BANDWIDTH1, 0x93,
203 AGC_RF_BANDWIDTH2, 0x00,
204 /* Change the value of bit 6, 'nINAGCBY' and
205 'NSSEL[1:0] of ACG function control register 2 */
206 AGC_FUNC_CTRL2, 0xc6,
207 /* Change the value of bit 6 'RFFIX'
208 of AGC function control register 3 */
209 AGC_FUNC_CTRL3, 0x40,
210 /* Set the value of 'INLVTHD' register 0x2a/0x2c
211 to 0x7fe */
212 AGC_DELAY0, 0x07,
213 AGC_DELAY2, 0xfe,
214 /* Change the value of IAGCBW[15:8]
215 of inner AGC loop filter bandwith */
216 AGC_LOOP_BANDWIDTH0, 0x08,
217 AGC_LOOP_BANDWIDTH1, 0x9a
218 };
219
220 static u8 lgdt3303_init_data[] = {
221 0x4c, 0x14
222 };
223
224 struct lgdt330x_state* state = fe->demodulator_priv;
225 char *chip_name;
226 int err;
227
228 switch (state->config->demod_chip) {
229 case LGDT3302:
230 chip_name = "LGDT3302";
231 err = i2c_write_demod_bytes(state, lgdt3302_init_data,
232 sizeof(lgdt3302_init_data));
233 break;
234 case LGDT3303:
235 chip_name = "LGDT3303";
236 err = i2c_write_demod_bytes(state, lgdt3303_init_data,
237 sizeof(lgdt3303_init_data));
238 break;
239 default:
240 chip_name = "undefined";
241 printk (KERN_WARNING "Only LGDT3302 and LGDT3303 are supported chips.\n");
242 err = -ENODEV;
243 }
244 dprintk("%s entered as %s\n", __FUNCTION__, chip_name);
245 if (err < 0)
246 return err;
247 return lgdt330x_SwReset(state);
178} 248}
179 249
180static int lgdt330x_read_ber(struct dvb_frontend* fe, u32* ber) 250static int lgdt330x_read_ber(struct dvb_frontend* fe, u32* ber)
181{ 251{
182 *ber = 0; /* Dummy out for now */ 252 *ber = 0; /* Not supplied by the demod chips */
183 return 0; 253 return 0;
184} 254}
185 255
186static int lgdt330x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) 256static int lgdt330x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
187{ 257{
188 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv; 258 struct lgdt330x_state* state = fe->demodulator_priv;
259 int err;
189 u8 buf[2]; 260 u8 buf[2];
190 261
191 i2c_selectreadbytes(state, PACKET_ERR_COUNTER1, buf, sizeof(buf)); 262 switch (state->config->demod_chip) {
263 case LGDT3302:
264 err = i2c_read_demod_bytes(state, LGDT3302_PACKET_ERR_COUNTER1,
265 buf, sizeof(buf));
266 break;
267 case LGDT3303:
268 err = i2c_read_demod_bytes(state, LGDT3303_PACKET_ERR_COUNTER1,
269 buf, sizeof(buf));
270 break;
271 default:
272 printk(KERN_WARNING
273 "Only LGDT3302 and LGDT3303 are supported chips.\n");
274 err = -ENODEV;
275 }
192 276
193 *ucblocks = (buf[0] << 8) | buf[1]; 277 *ucblocks = (buf[0] << 8) | buf[1];
194 return 0; 278 return 0;
@@ -197,123 +281,113 @@ static int lgdt330x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
197static int lgdt330x_set_parameters(struct dvb_frontend* fe, 281static int lgdt330x_set_parameters(struct dvb_frontend* fe,
198 struct dvb_frontend_parameters *param) 282 struct dvb_frontend_parameters *param)
199{ 283{
200 struct lgdt330x_state* state = 284 /*
201 (struct lgdt330x_state*) fe->demodulator_priv; 285 * Array of byte pairs <address, value>
286 * to initialize 8VSB for lgdt3303 chip 50 MHz IF
287 */
288 static u8 lgdt3303_8vsb_44_data[] = {
289 0x04, 0x00,
290 0x0d, 0x40,
291 0x0e, 0x87,
292 0x0f, 0x8e,
293 0x10, 0x01,
294 0x47, 0x8b };
295
296 /*
297 * Array of byte pairs <address, value>
298 * to initialize QAM for lgdt3303 chip
299 */
300 static u8 lgdt3303_qam_data[] = {
301 0x04, 0x00,
302 0x0d, 0x00,
303 0x0e, 0x00,
304 0x0f, 0x00,
305 0x10, 0x00,
306 0x51, 0x63,
307 0x47, 0x66,
308 0x48, 0x66,
309 0x4d, 0x1a,
310 0x49, 0x08,
311 0x4a, 0x9b };
312
313 struct lgdt330x_state* state = fe->demodulator_priv;
202 314
203 /* Use 50MHz parameter values from spec sheet since xtal is 50 */
204 static u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 }; 315 static u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 };
205 static u8 vsb_freq_cfg[] = { VSB_CARRIER_FREQ0, 0x00, 0x87, 0x8e, 0x01 };
206 static u8 demux_ctrl_cfg[] = { DEMUX_CONTROL, 0xfb };
207 static u8 agc_rf_cfg[] = { AGC_RF_BANDWIDTH0, 0x40, 0x93, 0x00 };
208 static u8 agc_ctrl_cfg[] = { AGC_FUNC_CTRL2, 0xc6, 0x40 };
209 static u8 agc_delay_cfg[] = { AGC_DELAY0, 0x07, 0x00, 0xfe };
210 static u8 agc_loop_cfg[] = { AGC_LOOP_BANDWIDTH0, 0x08, 0x9a };
211 316
317 int err;
212 /* Change only if we are actually changing the modulation */ 318 /* Change only if we are actually changing the modulation */
213 if (state->current_modulation != param->u.vsb.modulation) { 319 if (state->current_modulation != param->u.vsb.modulation) {
214 switch(param->u.vsb.modulation) { 320 switch(param->u.vsb.modulation) {
215 case VSB_8: 321 case VSB_8:
216 dprintk("%s: VSB_8 MODE\n", __FUNCTION__); 322 dprintk("%s: VSB_8 MODE\n", __FUNCTION__);
217 323
218 /* Select VSB mode and serial MPEG interface */ 324 /* Select VSB mode */
219 top_ctrl_cfg[1] = 0x07; 325 top_ctrl_cfg[1] = 0x03;
220 326
221 /* Select ANT connector if supported by card */ 327 /* Select ANT connector if supported by card */
222 if (state->config->pll_rf_set) 328 if (state->config->pll_rf_set)
223 state->config->pll_rf_set(fe, 1); 329 state->config->pll_rf_set(fe, 1);
330
331 if (state->config->demod_chip == LGDT3303) {
332 err = i2c_write_demod_bytes(state, lgdt3303_8vsb_44_data,
333 sizeof(lgdt3303_8vsb_44_data));
334 }
224 break; 335 break;
225 336
226 case QAM_64: 337 case QAM_64:
227 dprintk("%s: QAM_64 MODE\n", __FUNCTION__); 338 dprintk("%s: QAM_64 MODE\n", __FUNCTION__);
228 339
229 /* Select QAM_64 mode and serial MPEG interface */ 340 /* Select QAM_64 mode */
230 top_ctrl_cfg[1] = 0x04; 341 top_ctrl_cfg[1] = 0x00;
231 342
232 /* Select CABLE connector if supported by card */ 343 /* Select CABLE connector if supported by card */
233 if (state->config->pll_rf_set) 344 if (state->config->pll_rf_set)
234 state->config->pll_rf_set(fe, 0); 345 state->config->pll_rf_set(fe, 0);
346
347 if (state->config->demod_chip == LGDT3303) {
348 err = i2c_write_demod_bytes(state, lgdt3303_qam_data,
349 sizeof(lgdt3303_qam_data));
350 }
235 break; 351 break;
236 352
237 case QAM_256: 353 case QAM_256:
238 dprintk("%s: QAM_256 MODE\n", __FUNCTION__); 354 dprintk("%s: QAM_256 MODE\n", __FUNCTION__);
239 355
240 /* Select QAM_256 mode and serial MPEG interface */ 356 /* Select QAM_256 mode */
241 top_ctrl_cfg[1] = 0x05; 357 top_ctrl_cfg[1] = 0x01;
242 358
243 /* Select CABLE connector if supported by card */ 359 /* Select CABLE connector if supported by card */
244 if (state->config->pll_rf_set) 360 if (state->config->pll_rf_set)
245 state->config->pll_rf_set(fe, 0); 361 state->config->pll_rf_set(fe, 0);
362
363 if (state->config->demod_chip == LGDT3303) {
364 err = i2c_write_demod_bytes(state, lgdt3303_qam_data,
365 sizeof(lgdt3303_qam_data));
366 }
246 break; 367 break;
247 default: 368 default:
248 printk(KERN_WARNING "lgdt330x: %s: Modulation type(%d) UNSUPPORTED\n", __FUNCTION__, param->u.vsb.modulation); 369 printk(KERN_WARNING "lgdt330x: %s: Modulation type(%d) UNSUPPORTED\n", __FUNCTION__, param->u.vsb.modulation);
249 return -1; 370 return -1;
250 } 371 }
251 /* Initializations common to all modes */ 372 /*
373 * select serial or parallel MPEG harware interface
374 * Serial: 0x04 for LGDT3302 or 0x40 for LGDT3303
375 * Parallel: 0x00
376 */
377 top_ctrl_cfg[1] |= state->config->serial_mpeg;
252 378
253 /* Select the requested mode */ 379 /* Select the requested mode */
254 i2c_writebytes(state, state->config->demod_address, 380 i2c_write_demod_bytes(state, top_ctrl_cfg,
255 top_ctrl_cfg, sizeof(top_ctrl_cfg)); 381 sizeof(top_ctrl_cfg));
256
257 /* Change the value of IFBW[11:0]
258 of AGC IF/RF loop filter bandwidth register */
259 i2c_writebytes(state, state->config->demod_address,
260 agc_rf_cfg, sizeof(agc_rf_cfg));
261
262 /* Change the value of bit 6, 'nINAGCBY' and
263 'NSSEL[1:0] of ACG function control register 2 */
264 /* Change the value of bit 6 'RFFIX'
265 of AGC function control register 3 */
266 i2c_writebytes(state, state->config->demod_address,
267 agc_ctrl_cfg, sizeof(agc_ctrl_cfg));
268
269 /* Change the TPCLK pin polarity
270 data is valid on falling clock */
271 i2c_writebytes(state, state->config->demod_address,
272 demux_ctrl_cfg, sizeof(demux_ctrl_cfg));
273
274 /* Change the value of NCOCTFV[25:0] of carrier
275 recovery center frequency register */
276 i2c_writebytes(state, state->config->demod_address,
277 vsb_freq_cfg, sizeof(vsb_freq_cfg));
278
279 /* Set the value of 'INLVTHD' register 0x2a/0x2c to 0x7fe */
280 i2c_writebytes(state, state->config->demod_address,
281 agc_delay_cfg, sizeof(agc_delay_cfg));
282
283 /* Change the value of IAGCBW[15:8]
284 of inner AGC loop filter bandwith */
285 i2c_writebytes(state, state->config->demod_address,
286 agc_loop_cfg, sizeof(agc_loop_cfg));
287
288 state->config->set_ts_params(fe, 0); 382 state->config->set_ts_params(fe, 0);
289 state->current_modulation = param->u.vsb.modulation; 383 state->current_modulation = param->u.vsb.modulation;
290 } 384 }
291 385
292 /* Change only if we are actually changing the channel */ 386 /* Change only if we are actually changing the channel */
293 if (state->current_frequency != param->frequency) { 387 if (state->current_frequency != param->frequency) {
294 u8 buf[5]; 388 /* Tune to the new frequency */
295 struct i2c_msg msg = { .flags = 0, .buf = &buf[1], .len = 4 }; 389 state->config->pll_set(fe, param);
296 int err; 390 /* Keep track of the new frequency */
297
298 state->config->pll_set(fe, param, buf);
299 msg.addr = buf[0];
300
301 dprintk("%s: tuner at 0x%02x bytes: 0x%02x 0x%02x "
302 "0x%02x 0x%02x\n", __FUNCTION__,
303 buf[0],buf[1],buf[2],buf[3],buf[4]);
304 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
305 printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err = %i)\n", __FUNCTION__, buf[0], buf[1], err);
306 if (err < 0)
307 return err;
308 else
309 return -EREMOTEIO;
310 }
311#if 0
312 /* Check the status of the tuner pll */
313 i2c_readbytes(state, buf[0], &buf[1], 1);
314 dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[1]);
315#endif
316 /* Update current frequency */
317 state->current_frequency = param->frequency; 391 state->current_frequency = param->frequency;
318 } 392 }
319 lgdt330x_SwReset(state); 393 lgdt330x_SwReset(state);
@@ -328,21 +402,15 @@ static int lgdt330x_get_frontend(struct dvb_frontend* fe,
328 return 0; 402 return 0;
329} 403}
330 404
331static int lgdt330x_read_status(struct dvb_frontend* fe, fe_status_t* status) 405static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status)
332{ 406{
333 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv; 407 struct lgdt330x_state* state = fe->demodulator_priv;
334 u8 buf[3]; 408 u8 buf[3];
335 409
336 *status = 0; /* Reset status result */ 410 *status = 0; /* Reset status result */
337 411
338 /*
339 * You must set the Mask bits to 1 in the IRQ_MASK in order
340 * to see that status bit in the IRQ_STATUS register.
341 * This is done in SwReset();
342 */
343
344 /* AGC status register */ 412 /* AGC status register */
345 i2c_selectreadbytes(state, AGC_STATUS, buf, 1); 413 i2c_read_demod_bytes(state, AGC_STATUS, buf, 1);
346 dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]); 414 dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]);
347 if ((buf[0] & 0x0c) == 0x8){ 415 if ((buf[0] & 0x0c) == 0x8){
348 /* Test signal does not exist flag */ 416 /* Test signal does not exist flag */
@@ -353,16 +421,15 @@ static int lgdt330x_read_status(struct dvb_frontend* fe, fe_status_t* status)
353 return 0; 421 return 0;
354 } 422 }
355 423
424 /*
425 * You must set the Mask bits to 1 in the IRQ_MASK in order
426 * to see that status bit in the IRQ_STATUS register.
427 * This is done in SwReset();
428 */
356 /* signal status */ 429 /* signal status */
357 i2c_selectreadbytes(state, TOP_CONTROL, buf, sizeof(buf)); 430 i2c_read_demod_bytes(state, TOP_CONTROL, buf, sizeof(buf));
358 dprintk("%s: TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n", __FUNCTION__, buf[0], buf[1], buf[2]); 431 dprintk("%s: TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n", __FUNCTION__, buf[0], buf[1], buf[2]);
359 432
360#if 0
361 /* Alternative method to check for a signal */
362 /* using the SNR good/bad interrupts. */
363 if ((buf[2] & 0x30) == 0x10)
364 *status |= FE_HAS_SIGNAL;
365#endif
366 433
367 /* sync status */ 434 /* sync status */
368 if ((buf[2] & 0x03) == 0x01) { 435 if ((buf[2] & 0x03) == 0x01) {
@@ -376,7 +443,7 @@ static int lgdt330x_read_status(struct dvb_frontend* fe, fe_status_t* status)
376 } 443 }
377 444
378 /* Carrier Recovery Lock Status Register */ 445 /* Carrier Recovery Lock Status Register */
379 i2c_selectreadbytes(state, CARRIER_LOCK, buf, 1); 446 i2c_read_demod_bytes(state, CARRIER_LOCK, buf, 1);
380 dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]); 447 dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]);
381 switch (state->current_modulation) { 448 switch (state->current_modulation) {
382 case QAM_256: 449 case QAM_256:
@@ -396,13 +463,75 @@ static int lgdt330x_read_status(struct dvb_frontend* fe, fe_status_t* status)
396 return 0; 463 return 0;
397} 464}
398 465
466static int lgdt3303_read_status(struct dvb_frontend* fe, fe_status_t* status)
467{
468 struct lgdt330x_state* state = fe->demodulator_priv;
469 int err;
470 u8 buf[3];
471
472 *status = 0; /* Reset status result */
473
474 /* lgdt3303 AGC status register */
475 err = i2c_read_demod_bytes(state, 0x58, buf, 1);
476 if (err < 0)
477 return err;
478
479 dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]);
480 if ((buf[0] & 0x21) == 0x01){
481 /* Test input signal does not exist flag */
482 /* as well as the AGC lock flag. */
483 *status |= FE_HAS_SIGNAL;
484 } else {
485 /* Without a signal all other status bits are meaningless */
486 return 0;
487 }
488
489 /* Carrier Recovery Lock Status Register */
490 i2c_read_demod_bytes(state, CARRIER_LOCK, buf, 1);
491 dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]);
492 switch (state->current_modulation) {
493 case QAM_256:
494 case QAM_64:
495 /* Need to undestand why there are 3 lock levels here */
496 if ((buf[0] & 0x07) == 0x07)
497 *status |= FE_HAS_CARRIER;
498 else
499 break;
500 i2c_read_demod_bytes(state, 0x8a, buf, 1);
501 if ((buf[0] & 0x04) == 0x04)
502 *status |= FE_HAS_SYNC;
503 if ((buf[0] & 0x01) == 0x01)
504 *status |= FE_HAS_LOCK;
505 if ((buf[0] & 0x08) == 0x08)
506 *status |= FE_HAS_VITERBI;
507 break;
508 case VSB_8:
509 if ((buf[0] & 0x80) == 0x80)
510 *status |= FE_HAS_CARRIER;
511 else
512 break;
513 i2c_read_demod_bytes(state, 0x38, buf, 1);
514 if ((buf[0] & 0x02) == 0x00)
515 *status |= FE_HAS_SYNC;
516 if ((buf[0] & 0x01) == 0x01) {
517 *status |= FE_HAS_LOCK;
518 *status |= FE_HAS_VITERBI;
519 }
520 break;
521 default:
522 printk("KERN_WARNING lgdt330x: %s: Modulation set to unsupported value\n", __FUNCTION__);
523 }
524 return 0;
525}
526
399static int lgdt330x_read_signal_strength(struct dvb_frontend* fe, u16* strength) 527static int lgdt330x_read_signal_strength(struct dvb_frontend* fe, u16* strength)
400{ 528{
401 /* not directly available. */ 529 /* not directly available. */
530 *strength = 0;
402 return 0; 531 return 0;
403} 532}
404 533
405static int lgdt330x_read_snr(struct dvb_frontend* fe, u16* snr) 534static int lgdt3302_read_snr(struct dvb_frontend* fe, u16* snr)
406{ 535{
407#ifdef SNR_IN_DB 536#ifdef SNR_IN_DB
408 /* 537 /*
@@ -451,7 +580,7 @@ static int lgdt330x_read_snr(struct dvb_frontend* fe, u16* snr)
451 91, 115, 144, 182, 229, 288, 362, 456, 574, 722, 580 91, 115, 144, 182, 229, 288, 362, 456, 574, 722,
452 909, 1144, 1440, 1813, 2282, 2873, 3617, 4553, 5732, 7216, 581 909, 1144, 1440, 1813, 2282, 2873, 3617, 4553, 5732, 7216,
453 9084, 11436, 14396, 18124, 22817, 28724, 36161, 45524, 57312, 72151, 582 9084, 11436, 14396, 18124, 22817, 28724, 36161, 45524, 57312, 72151,
454 90833, 114351, 143960, 181235, 228161, 0x040000 583 90833, 114351, 143960, 181235, 228161, 0x080000
455 }; 584 };
456 585
457 static u8 buf[5];/* read data buffer */ 586 static u8 buf[5];/* read data buffer */
@@ -459,8 +588,8 @@ static int lgdt330x_read_snr(struct dvb_frontend* fe, u16* snr)
459 static u32 snr_db; /* index into SNR_EQ[] */ 588 static u32 snr_db; /* index into SNR_EQ[] */
460 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv; 589 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
461 590
462 /* read both equalizer and pase tracker noise data */ 591 /* read both equalizer and phase tracker noise data */
463 i2c_selectreadbytes(state, EQPH_ERR0, buf, sizeof(buf)); 592 i2c_read_demod_bytes(state, EQPH_ERR0, buf, sizeof(buf));
464 593
465 if (state->current_modulation == VSB_8) { 594 if (state->current_modulation == VSB_8) {
466 /* Equalizer Mean-Square Error Register for VSB */ 595 /* Equalizer Mean-Square Error Register for VSB */
@@ -496,19 +625,20 @@ static int lgdt330x_read_snr(struct dvb_frontend* fe, u16* snr)
496 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv; 625 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
497 626
498 /* read both equalizer and pase tracker noise data */ 627 /* read both equalizer and pase tracker noise data */
499 i2c_selectreadbytes(state, EQPH_ERR0, buf, sizeof(buf)); 628 i2c_read_demod_bytes(state, EQPH_ERR0, buf, sizeof(buf));
500 629
501 if (state->current_modulation == VSB_8) { 630 if (state->current_modulation == VSB_8) {
502 /* Equalizer Mean-Square Error Register for VSB */ 631 /* Phase Tracker Mean-Square Error Register for VSB */
503 noise = ((buf[0] & 7) << 16) | (buf[1] << 8) | buf[2];
504 } else {
505 /* Phase Tracker Mean-Square Error Register for QAM */
506 noise = ((buf[0] & 7<<3) << 13) | (buf[3] << 8) | buf[4]; 632 noise = ((buf[0] & 7<<3) << 13) | (buf[3] << 8) | buf[4];
633 } else {
634
635 /* Carrier Recovery Mean-Square Error for QAM */
636 i2c_read_demod_bytes(state, 0x1a, buf, 2);
637 noise = ((buf[0] & 3) << 8) | buf[1];
507 } 638 }
508 639
509 /* Small values for noise mean signal is better so invert noise */ 640 /* Small values for noise mean signal is better so invert noise */
510 /* Noise is 19 bit value so discard 3 LSB*/ 641 *snr = ~noise;
511 *snr = ~noise>>3;
512#endif 642#endif
513 643
514 dprintk("%s: noise = 0x%05x, snr = %idb\n",__FUNCTION__, noise, *snr); 644 dprintk("%s: noise = 0x%05x, snr = %idb\n",__FUNCTION__, noise, *snr);
@@ -516,6 +646,32 @@ static int lgdt330x_read_snr(struct dvb_frontend* fe, u16* snr)
516 return 0; 646 return 0;
517} 647}
518 648
649static int lgdt3303_read_snr(struct dvb_frontend* fe, u16* snr)
650{
651 /* Return the raw noise value */
652 static u8 buf[5];/* read data buffer */
653 static u32 noise; /* noise value */
654 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
655
656 if (state->current_modulation == VSB_8) {
657
658 /* Phase Tracker Mean-Square Error Register for VSB */
659 noise = ((buf[0] & 7) << 16) | (buf[3] << 8) | buf[4];
660 } else {
661
662 /* Carrier Recovery Mean-Square Error for QAM */
663 i2c_read_demod_bytes(state, 0x1a, buf, 2);
664 noise = (buf[0] << 8) | buf[1];
665 }
666
667 /* Small values for noise mean signal is better so invert noise */
668 *snr = ~noise;
669
670 dprintk("%s: noise = 0x%05x, snr = %idb\n",__FUNCTION__, noise, *snr);
671
672 return 0;
673}
674
519static int lgdt330x_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fe_tune_settings) 675static int lgdt330x_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fe_tune_settings)
520{ 676{
521 /* I have no idea about this - it may not be needed */ 677 /* I have no idea about this - it may not be needed */
@@ -531,7 +687,8 @@ static void lgdt330x_release(struct dvb_frontend* fe)
531 kfree(state); 687 kfree(state);
532} 688}
533 689
534static struct dvb_frontend_ops lgdt330x_ops; 690static struct dvb_frontend_ops lgdt3302_ops;
691static struct dvb_frontend_ops lgdt3303_ops;
535 692
536struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, 693struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
537 struct i2c_adapter* i2c) 694 struct i2c_adapter* i2c)
@@ -548,9 +705,19 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
548 /* Setup the state */ 705 /* Setup the state */
549 state->config = config; 706 state->config = config;
550 state->i2c = i2c; 707 state->i2c = i2c;
551 memcpy(&state->ops, &lgdt330x_ops, sizeof(struct dvb_frontend_ops)); 708 switch (config->demod_chip) {
709 case LGDT3302:
710 memcpy(&state->ops, &lgdt3302_ops, sizeof(struct dvb_frontend_ops));
711 break;
712 case LGDT3303:
713 memcpy(&state->ops, &lgdt3303_ops, sizeof(struct dvb_frontend_ops));
714 break;
715 default:
716 goto error;
717 }
718
552 /* Verify communication with demod chip */ 719 /* Verify communication with demod chip */
553 if (i2c_selectreadbytes(state, 2, buf, 1)) 720 if (i2c_read_demod_bytes(state, 2, buf, 1))
554 goto error; 721 goto error;
555 722
556 state->current_frequency = -1; 723 state->current_frequency = -1;
@@ -568,9 +735,33 @@ error:
568 return NULL; 735 return NULL;
569} 736}
570 737
571static struct dvb_frontend_ops lgdt330x_ops = { 738static struct dvb_frontend_ops lgdt3302_ops = {
739 .info = {
740 .name= "LG Electronics LGDT3302 VSB/QAM Frontend",
741 .type = FE_ATSC,
742 .frequency_min= 54000000,
743 .frequency_max= 858000000,
744 .frequency_stepsize= 62500,
745 /* Symbol rate is for all VSB modes need to check QAM */
746 .symbol_rate_min = 10762000,
747 .symbol_rate_max = 10762000,
748 .caps = FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_8VSB
749 },
750 .init = lgdt330x_init,
751 .set_frontend = lgdt330x_set_parameters,
752 .get_frontend = lgdt330x_get_frontend,
753 .get_tune_settings = lgdt330x_get_tune_settings,
754 .read_status = lgdt3302_read_status,
755 .read_ber = lgdt330x_read_ber,
756 .read_signal_strength = lgdt330x_read_signal_strength,
757 .read_snr = lgdt3302_read_snr,
758 .read_ucblocks = lgdt330x_read_ucblocks,
759 .release = lgdt330x_release,
760};
761
762static struct dvb_frontend_ops lgdt3303_ops = {
572 .info = { 763 .info = {
573 .name= "LG Electronics lgdt330x VSB/QAM Frontend", 764 .name= "LG Electronics LGDT3303 VSB/QAM Frontend",
574 .type = FE_ATSC, 765 .type = FE_ATSC,
575 .frequency_min= 54000000, 766 .frequency_min= 54000000,
576 .frequency_max= 858000000, 767 .frequency_max= 858000000,
@@ -584,15 +775,15 @@ static struct dvb_frontend_ops lgdt330x_ops = {
584 .set_frontend = lgdt330x_set_parameters, 775 .set_frontend = lgdt330x_set_parameters,
585 .get_frontend = lgdt330x_get_frontend, 776 .get_frontend = lgdt330x_get_frontend,
586 .get_tune_settings = lgdt330x_get_tune_settings, 777 .get_tune_settings = lgdt330x_get_tune_settings,
587 .read_status = lgdt330x_read_status, 778 .read_status = lgdt3303_read_status,
588 .read_ber = lgdt330x_read_ber, 779 .read_ber = lgdt330x_read_ber,
589 .read_signal_strength = lgdt330x_read_signal_strength, 780 .read_signal_strength = lgdt330x_read_signal_strength,
590 .read_snr = lgdt330x_read_snr, 781 .read_snr = lgdt3303_read_snr,
591 .read_ucblocks = lgdt330x_read_ucblocks, 782 .read_ucblocks = lgdt330x_read_ucblocks,
592 .release = lgdt330x_release, 783 .release = lgdt330x_release,
593}; 784};
594 785
595MODULE_DESCRIPTION("lgdt330x [DViCO FusionHDTV 3 Gold] (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver"); 786MODULE_DESCRIPTION("LGDT330X (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver");
596MODULE_AUTHOR("Wilson Michaels"); 787MODULE_AUTHOR("Wilson Michaels");
597MODULE_LICENSE("GPL"); 788MODULE_LICENSE("GPL");
598 789
@@ -601,6 +792,5 @@ EXPORT_SYMBOL(lgdt330x_attach);
601/* 792/*
602 * Local variables: 793 * Local variables:
603 * c-basic-offset: 8 794 * c-basic-offset: 8
604 * compile-command: "make DVB=1"
605 * End: 795 * End:
606 */ 796 */
diff --git a/drivers/media/dvb/frontends/lgdt330x.h b/drivers/media/dvb/frontends/lgdt330x.h
index 04986f8e7565..e209ba1e47c5 100644
--- a/drivers/media/dvb/frontends/lgdt330x.h
+++ b/drivers/media/dvb/frontends/lgdt330x.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Support for LGDT3302 & LGDT3303 (DViCO FustionHDTV Gold) - VSB/QAM 2 * Support for LGDT3302 and LGDT3303 - VSB/QAM
3 * 3 *
4 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> 4 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
5 * 5 *
@@ -24,14 +24,26 @@
24 24
25#include <linux/dvb/frontend.h> 25#include <linux/dvb/frontend.h>
26 26
27typedef enum lg_chip_t {
28 UNDEFINED,
29 LGDT3302,
30 LGDT3303
31}lg_chip_type;
32
27struct lgdt330x_config 33struct lgdt330x_config
28{ 34{
29 /* The demodulator's i2c address */ 35 /* The demodulator's i2c address */
30 u8 demod_address; 36 u8 demod_address;
31 37
38 /* LG demodulator chip LGDT3302 or LGDT3303 */
39 lg_chip_type demod_chip;
40
41 /* MPEG hardware interface - 0:parallel 1:serial */
42 int serial_mpeg;
43
32 /* PLL interface */ 44 /* PLL interface */
33 int (*pll_rf_set) (struct dvb_frontend* fe, int index); 45 int (*pll_rf_set) (struct dvb_frontend* fe, int index);
34 int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pll_address); 46 int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
35 47
36 /* Need to set device param for start_dma */ 48 /* Need to set device param for start_dma */
37 int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); 49 int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured);
diff --git a/drivers/media/dvb/frontends/lgdt330x_priv.h b/drivers/media/dvb/frontends/lgdt330x_priv.h
index 4143ce8f1a95..59b7c5b9012d 100644
--- a/drivers/media/dvb/frontends/lgdt330x_priv.h
+++ b/drivers/media/dvb/frontends/lgdt330x_priv.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Support for LGDT3302 & LGDT3303 (DViCO FustionHDTV Gold) - VSB/QAM 2 * Support for LGDT3302 and LGDT3303 - VSB/QAM
3 * 3 *
4 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> 4 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
5 * 5 *
@@ -57,8 +57,10 @@ enum I2C_REG {
57 PH_ERR1= 0x4a, 57 PH_ERR1= 0x4a,
58 PH_ERR2= 0x4b, 58 PH_ERR2= 0x4b,
59 DEMUX_CONTROL= 0x66, 59 DEMUX_CONTROL= 0x66,
60 PACKET_ERR_COUNTER1= 0x6a, 60 LGDT3302_PACKET_ERR_COUNTER1= 0x6a,
61 PACKET_ERR_COUNTER2= 0x6b, 61 LGDT3302_PACKET_ERR_COUNTER2= 0x6b,
62 LGDT3303_PACKET_ERR_COUNTER1= 0x8b,
63 LGDT3303_PACKET_ERR_COUNTER2= 0x8c,
62}; 64};
63 65
64#endif /* _LGDT330X_PRIV_ */ 66#endif /* _LGDT330X_PRIV_ */
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c
index 6c52fd0bb7df..a97b9b958ed6 100644
--- a/drivers/media/video/bttv-cards.c
+++ b/drivers/media/video/bttv-cards.c
@@ -95,7 +95,7 @@ static int __devinit pvr_boot(struct bttv *btv);
95static unsigned int triton1=0; 95static unsigned int triton1=0;
96static unsigned int vsfx=0; 96static unsigned int vsfx=0;
97static unsigned int latency = UNSET; 97static unsigned int latency = UNSET;
98static unsigned int no_overlay=-1; 98int no_overlay=-1;
99 99
100static unsigned int card[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET }; 100static unsigned int card[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
101static unsigned int pll[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET }; 101static unsigned int pll[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
@@ -4296,9 +4296,11 @@ void __devinit bttv_check_chipset(void)
4296 printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n"); 4296 printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n");
4297 if (pcipci_fail) { 4297 if (pcipci_fail) {
4298 printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n"); 4298 printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n");
4299 if (UNSET == no_overlay) { 4299 if (!no_overlay) {
4300 printk(KERN_WARNING "bttv: going to disable overlay.\n"); 4300 printk(KERN_WARNING "bttv: overlay will be disabled.\n");
4301 no_overlay = 1; 4301 no_overlay = 1;
4302 } else {
4303 printk(KERN_WARNING "bttv: overlay forced. Use this option at your own risk.\n");
4302 } 4304 }
4303 } 4305 }
4304 if (UNSET != latency) 4306 if (UNSET != latency)
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index 51a0f6d68e73..eee9322ce21b 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -1,5 +1,5 @@
1/* 1/*
2 $Id: bttv-driver.c,v 1.42 2005/07/05 17:37:35 nsh Exp $ 2 $Id: bttv-driver.c,v 1.52 2005/08/04 00:55:16 mchehab Exp $
3 3
4 bttv - Bt848 frame grabber driver 4 bttv - Bt848 frame grabber driver
5 5
@@ -80,6 +80,7 @@ static unsigned int irq_iswitch = 0;
80static unsigned int uv_ratio = 50; 80static unsigned int uv_ratio = 50;
81static unsigned int full_luma_range = 0; 81static unsigned int full_luma_range = 0;
82static unsigned int coring = 0; 82static unsigned int coring = 0;
83extern int no_overlay;
83 84
84/* API features (turn on/off stuff for testing) */ 85/* API features (turn on/off stuff for testing) */
85static unsigned int v4l2 = 1; 86static unsigned int v4l2 = 1;
@@ -2151,6 +2152,10 @@ static int bttv_s_fmt(struct bttv_fh *fh, struct bttv *btv,
2151 return 0; 2152 return 0;
2152 } 2153 }
2153 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 2154 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
2155 if (no_overlay > 0) {
2156 printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n");
2157 return -EINVAL;
2158 }
2154 return setup_window(fh, btv, &f->fmt.win, 1); 2159 return setup_window(fh, btv, &f->fmt.win, 1);
2155 case V4L2_BUF_TYPE_VBI_CAPTURE: 2160 case V4L2_BUF_TYPE_VBI_CAPTURE:
2156 retval = bttv_switch_type(fh,f->type); 2161 retval = bttv_switch_type(fh,f->type);
@@ -2224,9 +2229,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2224 /* others */ 2229 /* others */
2225 cap->type = VID_TYPE_CAPTURE| 2230 cap->type = VID_TYPE_CAPTURE|
2226 VID_TYPE_TUNER| 2231 VID_TYPE_TUNER|
2227 VID_TYPE_OVERLAY|
2228 VID_TYPE_CLIPPING| 2232 VID_TYPE_CLIPPING|
2229 VID_TYPE_SCALES; 2233 VID_TYPE_SCALES;
2234 if (no_overlay <= 0)
2235 cap->type |= VID_TYPE_OVERLAY;
2236
2230 cap->maxwidth = bttv_tvnorms[btv->tvnorm].swidth; 2237 cap->maxwidth = bttv_tvnorms[btv->tvnorm].swidth;
2231 cap->maxheight = bttv_tvnorms[btv->tvnorm].sheight; 2238 cap->maxheight = bttv_tvnorms[btv->tvnorm].sheight;
2232 cap->minwidth = 48; 2239 cap->minwidth = 48;
@@ -2302,6 +2309,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2302 struct video_window *win = arg; 2309 struct video_window *win = arg;
2303 struct v4l2_window w2; 2310 struct v4l2_window w2;
2304 2311
2312 if (no_overlay > 0) {
2313 printk ("VIDIOCSWIN: no_overlay\n");
2314 return -EINVAL;
2315 }
2316
2305 w2.field = V4L2_FIELD_ANY; 2317 w2.field = V4L2_FIELD_ANY;
2306 w2.w.left = win->x; 2318 w2.w.left = win->x;
2307 w2.w.top = win->y; 2319 w2.w.top = win->y;
@@ -2577,10 +2589,12 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2577 cap->version = BTTV_VERSION_CODE; 2589 cap->version = BTTV_VERSION_CODE;
2578 cap->capabilities = 2590 cap->capabilities =
2579 V4L2_CAP_VIDEO_CAPTURE | 2591 V4L2_CAP_VIDEO_CAPTURE |
2580 V4L2_CAP_VIDEO_OVERLAY |
2581 V4L2_CAP_VBI_CAPTURE | 2592 V4L2_CAP_VBI_CAPTURE |
2582 V4L2_CAP_READWRITE | 2593 V4L2_CAP_READWRITE |
2583 V4L2_CAP_STREAMING; 2594 V4L2_CAP_STREAMING;
2595 if (no_overlay <= 0)
2596 cap->capabilities |= V4L2_CAP_VIDEO_OVERLAY;
2597
2584 if (bttv_tvcards[btv->c.type].tuner != UNSET && 2598 if (bttv_tvcards[btv->c.type].tuner != UNSET &&
2585 bttv_tvcards[btv->c.type].tuner != TUNER_ABSENT) 2599 bttv_tvcards[btv->c.type].tuner != TUNER_ABSENT)
2586 cap->capabilities |= V4L2_CAP_TUNER; 2600 cap->capabilities |= V4L2_CAP_TUNER;
@@ -3076,7 +3090,7 @@ static struct file_operations bttv_fops =
3076static struct video_device bttv_video_template = 3090static struct video_device bttv_video_template =
3077{ 3091{
3078 .name = "UNSET", 3092 .name = "UNSET",
3079 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_OVERLAY| 3093 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|
3080 VID_TYPE_CLIPPING|VID_TYPE_SCALES, 3094 VID_TYPE_CLIPPING|VID_TYPE_SCALES,
3081 .hardware = VID_HARDWARE_BT848, 3095 .hardware = VID_HARDWARE_BT848,
3082 .fops = &bttv_fops, 3096 .fops = &bttv_fops,
@@ -3756,6 +3770,12 @@ static void bttv_unregister_video(struct bttv *btv)
3756/* register video4linux devices */ 3770/* register video4linux devices */
3757static int __devinit bttv_register_video(struct bttv *btv) 3771static int __devinit bttv_register_video(struct bttv *btv)
3758{ 3772{
3773 if (no_overlay <= 0) {
3774 bttv_video_template.type |= VID_TYPE_OVERLAY;
3775 } else {
3776 printk("bttv: Overlay support disabled.\n");
3777 }
3778
3759 /* video */ 3779 /* video */
3760 btv->video_dev = vdev_init(btv, &bttv_video_template, "video"); 3780 btv->video_dev = vdev_init(btv, &bttv_video_template, "video");
3761 if (NULL == btv->video_dev) 3781 if (NULL == btv->video_dev)
@@ -3869,11 +3889,6 @@ static int __devinit bttv_probe(struct pci_dev *dev,
3869 pci_set_master(dev); 3889 pci_set_master(dev);
3870 pci_set_command(dev); 3890 pci_set_command(dev);
3871 pci_set_drvdata(dev,btv); 3891 pci_set_drvdata(dev,btv);
3872 if (!pci_dma_supported(dev,0xffffffff)) {
3873 printk("bttv%d: Oops: no 32bit PCI DMA ???\n", btv->c.nr);
3874 result = -EIO;
3875 goto fail1;
3876 }
3877 3892
3878 pci_read_config_byte(dev, PCI_CLASS_REVISION, &btv->revision); 3893 pci_read_config_byte(dev, PCI_CLASS_REVISION, &btv->revision);
3879 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); 3894 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat);
diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h
index 191eaf1714ba..f2af9e1454f0 100644
--- a/drivers/media/video/bttv.h
+++ b/drivers/media/video/bttv.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: bttv.h,v 1.18 2005/05/24 23:41:42 nsh Exp $ 2 * $Id: bttv.h,v 1.22 2005/07/28 18:41:21 mchehab Exp $
3 * 3 *
4 * bttv - Bt848 frame grabber driver 4 * bttv - Bt848 frame grabber driver
5 * 5 *
@@ -135,7 +135,9 @@
135#define BTTV_DVICO_DVBT_LITE 0x80 135#define BTTV_DVICO_DVBT_LITE 0x80
136#define BTTV_TIBET_CS16 0x83 136#define BTTV_TIBET_CS16 0x83
137#define BTTV_KODICOM_4400R 0x84 137#define BTTV_KODICOM_4400R 0x84
138#define BTTV_ADLINK_RTV24 0x85 138#define BTTV_ADLINK_RTV24 0x86
139#define BTTV_DVICO_FUSIONHDTV_5_LITE 0x87
140#define BTTV_ACORP_Y878F 0x88
139 141
140/* i2c address list */ 142/* i2c address list */
141#define I2C_TSA5522 0xc2 143#define I2C_TSA5522 0xc2
diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bttvp.h
index f3293e4a15ad..aab094bc243d 100644
--- a/drivers/media/video/bttvp.h
+++ b/drivers/media/video/bttvp.h
@@ -1,5 +1,5 @@
1/* 1/*
2 $Id: bttvp.h,v 1.19 2005/06/16 21:38:45 nsh Exp $ 2 $Id: bttvp.h,v 1.21 2005/07/15 21:44:14 mchehab Exp $
3 3
4 bttv - Bt848 frame grabber driver 4 bttv - Bt848 frame grabber driver
5 5
@@ -27,7 +27,7 @@
27#define _BTTVP_H_ 27#define _BTTVP_H_
28 28
29#include <linux/version.h> 29#include <linux/version.h>
30#define BTTV_VERSION_CODE KERNEL_VERSION(0,9,15) 30#define BTTV_VERSION_CODE KERNEL_VERSION(0,9,16)
31 31
32#include <linux/types.h> 32#include <linux/types.h>
33#include <linux/wait.h> 33#include <linux/wait.h>
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 3d0c784b376f..ebf02a7f81e8 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: cx88-cards.c,v 1.86 2005/07/14 03:06:43 mchehab Exp $ 2 * $Id: cx88-cards.c,v 1.90 2005/07/28 02:47:42 mkrufky Exp $
3 * 3 *
4 * device driver for Conexant 2388x based TV cards 4 * device driver for Conexant 2388x based TV cards
5 * card-specific stuff. 5 * card-specific stuff.
@@ -90,6 +90,9 @@ struct cx88_board cx88_boards[] = {
90 .input = {{ 90 .input = {{
91 .type = CX88_VMUX_TELEVISION, 91 .type = CX88_VMUX_TELEVISION,
92 .vmux = 0, 92 .vmux = 0,
93 },{
94 .type = CX88_VMUX_SVIDEO,
95 .vmux = 2,
93 }}, 96 }},
94 }, 97 },
95 [CX88_BOARD_PIXELVIEW] = { 98 [CX88_BOARD_PIXELVIEW] = {
@@ -496,6 +499,9 @@ struct cx88_board cx88_boards[] = {
496 .input = {{ 499 .input = {{
497 .type = CX88_VMUX_DVB, 500 .type = CX88_VMUX_DVB,
498 .vmux = 0, 501 .vmux = 0,
502 },{
503 .type = CX88_VMUX_SVIDEO,
504 .vmux = 2,
499 }}, 505 }},
500 .dvb = 1, 506 .dvb = 1,
501 }, 507 },
@@ -753,6 +759,27 @@ struct cx88_board cx88_boards[] = {
753 }}, 759 }},
754 .dvb = 1, 760 .dvb = 1,
755 }, 761 },
762 [CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD] = {
763 .name = "DViCO FusionHDTV 5 Gold",
764 .tuner_type = TUNER_LG_TDVS_H062F,
765 .radio_type = UNSET,
766 .tuner_addr = ADDR_UNSET,
767 .radio_addr = ADDR_UNSET,
768 /* See DViCO FusionHDTV 3 Gold-Q for GPIO documentation. */
769 .input = {{
770 .type = CX88_VMUX_TELEVISION,
771 .vmux = 0,
772 .gpio0 = 0x0f0d,
773 },{
774 .type = CX88_VMUX_COMPOSITE1,
775 .vmux = 1,
776 .gpio0 = 0x0f00,
777 },{
778 .type = CX88_VMUX_SVIDEO,
779 .vmux = 2,
780 .gpio0 = 0x0f00,
781 }},
782 },
756}; 783};
757const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); 784const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards);
758 785
@@ -880,6 +907,10 @@ struct cx88_subid cx88_subids[] = {
880 .subvendor = 0x153b, 907 .subvendor = 0x153b,
881 .subdevice = 0x1166, 908 .subdevice = 0x1166,
882 .card = CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1, 909 .card = CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1,
910 },{
911 .subvendor = 0x18ac,
912 .subdevice = 0xd500,
913 .card = CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD,
883 }, 914 },
884}; 915};
885const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); 916const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index ef0e9a85c359..78d223257a68 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: cx88-dvb.c,v 1.54 2005/07/25 05:13:50 mkrufky Exp $ 2 * $Id: cx88-dvb.c,v 1.58 2005/08/07 09:24:08 mkrufky Exp $
3 * 3 *
4 * device driver for Conexant 2388x based TV cards 4 * device driver for Conexant 2388x based TV cards
5 * MPEG Transport Stream (DVB) routines 5 * MPEG Transport Stream (DVB) routines
@@ -208,14 +208,26 @@ static struct or51132_config pchdtv_hd3000 = {
208 208
209#ifdef HAVE_LGDT330X 209#ifdef HAVE_LGDT330X
210static int lgdt330x_pll_set(struct dvb_frontend* fe, 210static int lgdt330x_pll_set(struct dvb_frontend* fe,
211 struct dvb_frontend_parameters* params, 211 struct dvb_frontend_parameters* params)
212 u8* pllbuf)
213{ 212{
214 struct cx8802_dev *dev= fe->dvb->priv; 213 struct cx8802_dev *dev= fe->dvb->priv;
214 u8 buf[4];
215 struct i2c_msg msg =
216 { .addr = dev->core->pll_addr, .flags = 0, .buf = buf, .len = 4 };
217 int err;
215 218
216 pllbuf[0] = dev->core->pll_addr; 219 dvb_pll_configure(dev->core->pll_desc, buf, params->frequency, 0);
217 dvb_pll_configure(dev->core->pll_desc, &pllbuf[1], 220 dprintk(1, "%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n",
218 params->frequency, 0); 221 __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]);
222 if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) {
223 printk(KERN_WARNING "cx88-dvb: %s error "
224 "(addr %02x <- %02x, err = %i)\n",
225 __FUNCTION__, buf[0], buf[1], err);
226 if (err < 0)
227 return err;
228 else
229 return -EREMOTEIO;
230 }
219 return 0; 231 return 0;
220} 232}
221 233
@@ -244,6 +256,8 @@ static int lgdt330x_set_ts_param(struct dvb_frontend* fe, int is_punctured)
244 256
245static struct lgdt330x_config fusionhdtv_3_gold = { 257static struct lgdt330x_config fusionhdtv_3_gold = {
246 .demod_address = 0x0e, 258 .demod_address = 0x0e,
259 .demod_chip = LGDT3302,
260 .serial_mpeg = 0x04, /* TPSERIAL for 3302 in TOP_CONTROL */
247 .pll_set = lgdt330x_pll_set, 261 .pll_set = lgdt330x_pll_set,
248 .set_ts_params = lgdt330x_set_ts_param, 262 .set_ts_params = lgdt330x_set_ts_param,
249}; 263};
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 5588a3aeecb4..5f58c103198a 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: cx88-video.c,v 1.80 2005/07/13 08:49:08 mchehab Exp $ 2 * $Id: cx88-video.c,v 1.82 2005/07/22 05:13:34 mkrufky Exp $
3 * 3 *
4 * device driver for Conexant 2388x based TV cards 4 * device driver for Conexant 2388x based TV cards
5 * video4linux video interface 5 * video4linux video interface
@@ -758,10 +758,10 @@ static int video_open(struct inode *inode, struct file *file)
758 struct cx88_core *core = dev->core; 758 struct cx88_core *core = dev->core;
759 int board = core->board; 759 int board = core->board;
760 dprintk(1,"video_open: setting radio device\n"); 760 dprintk(1,"video_open: setting radio device\n");
761 cx_write(MO_GP3_IO, cx88_boards[board].radio.gpio3);
761 cx_write(MO_GP0_IO, cx88_boards[board].radio.gpio0); 762 cx_write(MO_GP0_IO, cx88_boards[board].radio.gpio0);
762 cx_write(MO_GP1_IO, cx88_boards[board].radio.gpio1); 763 cx_write(MO_GP1_IO, cx88_boards[board].radio.gpio1);
763 cx_write(MO_GP2_IO, cx88_boards[board].radio.gpio2); 764 cx_write(MO_GP2_IO, cx88_boards[board].radio.gpio2);
764 cx_write(MO_GP3_IO, cx88_boards[board].radio.gpio3);
765 dev->core->tvaudio = WW_FM; 765 dev->core->tvaudio = WW_FM;
766 cx88_set_tvaudio(core); 766 cx88_set_tvaudio(core);
767 cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1); 767 cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1);
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index b008f7db6dfd..da65dc92787c 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: cx88.h,v 1.69 2005/07/13 17:25:25 mchehab Exp $ 2 * $Id: cx88.h,v 1.70 2005/07/24 17:44:09 mkrufky Exp $
3 * 3 *
4 * v4l2 device driver for cx2388x based TV cards 4 * v4l2 device driver for cx2388x based TV cards
5 * 5 *
@@ -171,6 +171,7 @@ extern struct sram_channel cx88_sram_channels[];
171#define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T 28 171#define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T 28
172#define CX88_BOARD_ADSTECH_DVB_T_PCI 29 172#define CX88_BOARD_ADSTECH_DVB_T_PCI 29
173#define CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1 30 173#define CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1 30
174#define CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD 31
174 175
175enum cx88_itype { 176enum cx88_itype {
176 CX88_VMUX_COMPOSITE1 = 1, 177 CX88_VMUX_COMPOSITE1 = 1,
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c
index 6239254db27e..62f1b8ddb98b 100644
--- a/drivers/media/video/msp3400.c
+++ b/drivers/media/video/msp3400.c
@@ -741,11 +741,9 @@ static int msp34xx_sleep(struct msp3400c *msp, int timeout)
741 schedule_timeout(msecs_to_jiffies(timeout)); 741 schedule_timeout(msecs_to_jiffies(timeout));
742 } 742 }
743 } 743 }
744 if (current->flags & PF_FREEZE) {
745 refrigerator ();
746 }
747 744
748 remove_wait_queue(&msp->wq, &wait); 745 remove_wait_queue(&msp->wq, &wait);
746 try_to_freeze();
749 return msp->restart; 747 return msp->restart;
750} 748}
751 749
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c
index 93dd61978541..1203b93a572c 100644
--- a/drivers/media/video/saa7134/saa7134-i2c.c
+++ b/drivers/media/video/saa7134/saa7134-i2c.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: saa7134-i2c.c,v 1.19 2005/07/07 01:49:30 mkrufky Exp $ 2 * $Id: saa7134-i2c.c,v 1.22 2005/07/22 04:09:41 mkrufky Exp $
3 * 3 *
4 * device driver for philips saa7134 based TV cards 4 * device driver for philips saa7134 based TV cards
5 * i2c interface support 5 * i2c interface support
@@ -300,6 +300,8 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap,
300 status = i2c_get_status(dev); 300 status = i2c_get_status(dev);
301 if (i2c_is_error(status)) 301 if (i2c_is_error(status))
302 goto err; 302 goto err;
303 /* ensure that the bus is idle for at least one bit slot */
304 msleep(1);
303 305
304 d1printk("\n"); 306 d1printk("\n");
305 return num; 307 return num;
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index 6836c07794fc..2af0cb2a731b 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: saa7134.h,v 1.48 2005/07/01 08:22:24 nsh Exp $ 2 * $Id: saa7134.h,v 1.49 2005/07/13 17:25:25 mchehab Exp $
3 * 3 *
4 * v4l2 device driver for philips saa7134 based TV cards 4 * v4l2 device driver for philips saa7134 based TV cards
5 * 5 *
@@ -21,7 +21,7 @@
21 */ 21 */
22 22
23#include <linux/version.h> 23#include <linux/version.h>
24#define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,13) 24#define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,14)
25 25
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <linux/i2c.h> 27#include <linux/i2c.h>
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c
index 4d27ac1b7fb8..cebcc1fa68d1 100644
--- a/drivers/media/video/tea5767.c
+++ b/drivers/media/video/tea5767.c
@@ -2,7 +2,7 @@
2 * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview 2 * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview
3 * I2C address is allways 0xC0. 3 * I2C address is allways 0xC0.
4 * 4 *
5 * $Id: tea5767.c,v 1.21 2005/07/14 03:06:43 mchehab Exp $ 5 * $Id: tea5767.c,v 1.27 2005/07/31 12:10:56 mchehab Exp $
6 * 6 *
7 * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) 7 * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br)
8 * This code is placed under the terms of the GNU General Public License 8 * This code is placed under the terms of the GNU General Public License
@@ -15,7 +15,6 @@
15#include <linux/videodev.h> 15#include <linux/videodev.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <media/tuner.h> 17#include <media/tuner.h>
18#include <media/tuner.h>
19 18
20#define PREFIX "TEA5767 " 19#define PREFIX "TEA5767 "
21 20
@@ -293,16 +292,16 @@ static int tea5767_stereo(struct i2c_client *c)
293 292
294int tea5767_autodetection(struct i2c_client *c) 293int tea5767_autodetection(struct i2c_client *c)
295{ 294{
296 unsigned char buffer[5] = { 0xff, 0xff, 0xff, 0xff, 0xff }; 295 unsigned char buffer[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
297 int rc; 296 int rc;
298 struct tuner *t = i2c_get_clientdata(c); 297 struct tuner *t = i2c_get_clientdata(c);
299 298
300 if (5 != (rc = i2c_master_recv(c, buffer, 5))) { 299 if (7 != (rc = i2c_master_recv(c, buffer, 7))) {
301 tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc); 300 tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc);
302 return EINVAL; 301 return EINVAL;
303 } 302 }
304 303
305 /* If all bytes are the same then it's a TV tuner and not a tea5767 chip. */ 304 /* If all bytes are the same then it's a TV tuner and not a tea5767 */
306 if (buffer[0] == buffer[1] && buffer[0] == buffer[2] && 305 if (buffer[0] == buffer[1] && buffer[0] == buffer[2] &&
307 buffer[0] == buffer[3] && buffer[0] == buffer[4]) { 306 buffer[0] == buffer[3] && buffer[0] == buffer[4]) {
308 tuner_warn("All bytes are equal. It is not a TEA5767\n"); 307 tuner_warn("All bytes are equal. It is not a TEA5767\n");
@@ -318,6 +317,17 @@ int tea5767_autodetection(struct i2c_client *c)
318 tuner_warn("Chip ID is not zero. It is not a TEA5767\n"); 317 tuner_warn("Chip ID is not zero. It is not a TEA5767\n");
319 return EINVAL; 318 return EINVAL;
320 } 319 }
320 /* It seems that tea5767 returns 0xff after the 5th byte */
321 if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) {
322 tuner_warn("Returned more than 5 bytes. It is not a TEA5767\n");
323 return EINVAL;
324 }
325
326 /* It seems that tea5767 returns 0xff after the 5th byte */
327 if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) {
328 tuner_warn("Returned more than 5 bytes. It is not a TEA5767\n");
329 return EINVAL;
330 }
321 331
322 tuner_warn("TEA5767 detected.\n"); 332 tuner_warn("TEA5767 detected.\n");
323 return 0; 333 return 0;
@@ -327,10 +337,8 @@ int tea5767_tuner_init(struct i2c_client *c)
327{ 337{
328 struct tuner *t = i2c_get_clientdata(c); 338 struct tuner *t = i2c_get_clientdata(c);
329 339
330 if (tea5767_autodetection(c) == EINVAL) 340 tuner_info("type set to %d (%s)\n", t->type,
331 return EINVAL; 341 "Philips TEA5767HN FM Radio");
332
333 tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio");
334 strlcpy(c->name, "tea5767", sizeof(c->name)); 342 strlcpy(c->name, "tea5767", sizeof(c->name));
335 343
336 t->tv_freq = set_tv_freq; 344 t->tv_freq = set_tv_freq;
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index b25a9c08ac02..f0a579827a24 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: tuner-core.c,v 1.58 2005/07/14 03:06:43 mchehab Exp $ 2 * $Id: tuner-core.c,v 1.63 2005/07/28 18:19:55 mchehab Exp $
3 * 3 *
4 * i2c tv tuner chip device driver 4 * i2c tv tuner chip device driver
5 * core core, i.e. kernel interfaces, registering and so on 5 * core core, i.e. kernel interfaces, registering and so on
@@ -23,6 +23,8 @@
23#include <media/tuner.h> 23#include <media/tuner.h>
24#include <media/audiochip.h> 24#include <media/audiochip.h>
25 25
26#include "msp3400.h"
27
26#define UNSET (-1U) 28#define UNSET (-1U)
27 29
28/* standard i2c insmod options */ 30/* standard i2c insmod options */
@@ -42,6 +44,9 @@ module_param(addr, int, 0444);
42static unsigned int no_autodetect = 0; 44static unsigned int no_autodetect = 0;
43module_param(no_autodetect, int, 0444); 45module_param(no_autodetect, int, 0444);
44 46
47static unsigned int show_i2c = 0;
48module_param(show_i2c, int, 0444);
49
45/* insmod options used at runtime => read/write */ 50/* insmod options used at runtime => read/write */
46unsigned int tuner_debug = 0; 51unsigned int tuner_debug = 0;
47module_param(tuner_debug, int, 0644); 52module_param(tuner_debug, int, 0644);
@@ -320,6 +325,17 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
320 325
321 tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name); 326 tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name);
322 327
328 if (show_i2c) {
329 unsigned char buffer[16];
330 int i,rc;
331
332 memset(buffer, 0, sizeof(buffer));
333 rc = i2c_master_recv(&t->i2c, buffer, sizeof(buffer));
334 printk("tuner-%04x I2C RECV = ",addr);
335 for (i=0;i<rc;i++)
336 printk("%02x ",buffer[i]);
337 printk("\n");
338 }
323 /* TEA5767 autodetection code - only for addr = 0xc0 */ 339 /* TEA5767 autodetection code - only for addr = 0xc0 */
324 if (!no_autodetect) { 340 if (!no_autodetect) {
325 if (addr == 0x60) { 341 if (addr == 0x60) {
@@ -451,6 +467,17 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
451 break; 467 break;
452 } 468 }
453 break; 469 break;
470 case VIDIOCSAUDIO:
471 if (check_mode(t, "VIDIOCSAUDIO") == EINVAL)
472 return 0;
473 if (check_v4l2(t) == EINVAL)
474 return 0;
475
476 /* Should be implemented, since bttv calls it */
477 tuner_dbg("VIDIOCSAUDIO not implemented.\n");
478
479 break;
480 case MSP_SET_MATRIX:
454 case TDA9887_SET_CONFIG: 481 case TDA9887_SET_CONFIG:
455 break; 482 break;
456 /* --- v4l ioctls --- */ 483 /* --- v4l ioctls --- */
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index a3f8e83f5314..de0c93aeb75d 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: tuner-simple.c,v 1.39 2005/07/07 01:49:30 mkrufky Exp $ 2 * $Id: tuner-simple.c,v 1.43 2005/07/28 18:41:21 mchehab Exp $
3 * 3 *
4 * i2c tv tuner chip device driver 4 * i2c tv tuner chip device driver
5 * controls all those simple 4-control-bytes style tuners. 5 * controls all those simple 4-control-bytes style tuners.
@@ -245,6 +245,12 @@ static struct tunertype tuners[] = {
245 /* see tea5767.c for details */}, 245 /* see tea5767.c for details */},
246 { "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL, 246 { "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL,
247 16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 }, 247 16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 },
248
249 { "LG TDVS-H062F/TUA6034", LGINNOTEK, NTSC,
250 16*160.00,16*455.00,0x01,0x02,0x04,0x8e,732},
251
252 { "Ymec TVF66T5-B/DFF", Philips, PAL,
253 16*160.25,16*464.25,0x01,0x02,0x08,0x8e,623},
248}; 254};
249 255
250unsigned const int tuner_count = ARRAY_SIZE(tuners); 256unsigned const int tuner_count = ARRAY_SIZE(tuners);
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index 62b03ef091e0..127ec38ebd60 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -189,7 +189,7 @@ hauppauge_tuner[] =
189 { TUNER_ABSENT, "Philips FQ1236 MK3"}, 189 { TUNER_ABSENT, "Philips FQ1236 MK3"},
190 { TUNER_ABSENT, "Samsung TCPN 2121P30A"}, 190 { TUNER_ABSENT, "Samsung TCPN 2121P30A"},
191 { TUNER_ABSENT, "Samsung TCPE 4121P30A"}, 191 { TUNER_ABSENT, "Samsung TCPE 4121P30A"},
192 { TUNER_ABSENT, "TCL MFPE05 2"}, 192 { TUNER_PHILIPS_FM1216ME_MK3, "TCL MFPE05 2"},
193 /* 90-99 */ 193 /* 90-99 */
194 { TUNER_ABSENT, "LG TALN H202T"}, 194 { TUNER_ABSENT, "LG TALN H202T"},
195 { TUNER_PHILIPS_FQ1216AME_MK4, "Philips FQ1216AME MK4"}, 195 { TUNER_PHILIPS_FQ1216AME_MK4, "Philips FQ1216AME MK4"},