aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/frontends/Kconfig4
-rw-r--r--drivers/media/dvb/frontends/Makefile2
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.c11
-rw-r--r--drivers/media/dvb/frontends/lgdt330x.c (renamed from drivers/media/dvb/frontends/lgdt3302.c)209
-rw-r--r--drivers/media/dvb/frontends/lgdt330x.h (renamed from drivers/media/dvb/frontends/lgdt3302.h)20
-rw-r--r--drivers/media/dvb/frontends/lgdt330x_priv.h (renamed from drivers/media/dvb/frontends/lgdt3302_priv.h)10
-rw-r--r--drivers/media/radio/radio-maestro.c4
-rw-r--r--drivers/media/radio/radio-maxiradio.c2
-rw-r--r--drivers/media/video/Kconfig4
-rw-r--r--drivers/media/video/bttv-cards.c4
-rw-r--r--drivers/media/video/cx88/Makefile12
-rw-r--r--drivers/media/video/cx88/cx88-cards.c8
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c92
-rw-r--r--drivers/media/video/cx88/cx88-i2c.c4
-rw-r--r--drivers/media/video/cx88/cx88-video.c7
-rw-r--r--drivers/media/video/cx88/cx88.h6
-rw-r--r--drivers/media/video/mxb.c39
-rw-r--r--drivers/media/video/saa7134/Makefile6
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c20
-rw-r--r--drivers/media/video/tea5767.c34
-rw-r--r--drivers/media/video/tuner-core.c33
-rw-r--r--drivers/media/video/tvaudio.c1
-rw-r--r--drivers/media/video/tveeprom.c6
23 files changed, 290 insertions, 248 deletions
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
index d847c62bd837..e83256d0fd14 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -187,8 +187,8 @@ config DVB_BCM3510
187 An ATSC 8VSB/16VSB and QAM64/256 tuner module. Say Y when you want to 187 An ATSC 8VSB/16VSB and QAM64/256 tuner module. Say Y when you want to
188 support this frontend. 188 support this frontend.
189 189
190config DVB_LGDT3302 190config DVB_LGDT330X
191 tristate "LGDT3302 based (DViCO FusionHDTV3 Gold)" 191 tristate "LGDT3302 or LGDT3303 based (DViCO FusionHDTV Gold)"
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/Makefile b/drivers/media/dvb/frontends/Makefile
index de5e240cba7f..ad8658ffd60a 100644
--- a/drivers/media/dvb/frontends/Makefile
+++ b/drivers/media/dvb/frontends/Makefile
@@ -30,4 +30,4 @@ obj-$(CONFIG_DVB_OR51211) += or51211.o
30obj-$(CONFIG_DVB_OR51132) += or51132.o 30obj-$(CONFIG_DVB_OR51132) += or51132.o
31obj-$(CONFIG_DVB_BCM3510) += bcm3510.o 31obj-$(CONFIG_DVB_BCM3510) += bcm3510.o
32obj-$(CONFIG_DVB_S5H1420) += s5h1420.o 32obj-$(CONFIG_DVB_S5H1420) += s5h1420.o
33obj-$(CONFIG_DVB_LGDT3302) += lgdt3302.o 33obj-$(CONFIG_DVB_LGDT330X) += lgdt330x.o
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index 5afeaa9b43b4..5264310c070e 100644
--- a/drivers/media/dvb/frontends/dvb-pll.c
+++ b/drivers/media/dvb/frontends/dvb-pll.c
@@ -82,13 +82,14 @@ struct dvb_pll_desc dvb_pll_lg_z201 = {
82 .name = "LG z201", 82 .name = "LG z201",
83 .min = 174000000, 83 .min = 174000000,
84 .max = 862000000, 84 .max = 862000000,
85 .count = 5, 85 .count = 6,
86 .entries = { 86 .entries = {
87 { 0, 36166667, 166666, 0xbc, 0x03 }, 87 { 0, 36166667, 166666, 0xbc, 0x03 },
88 { 443250000, 36166667, 166666, 0xbc, 0x01 }, 88 { 157500000, 36166667, 166666, 0xbc, 0x01 },
89 { 542000000, 36166667, 166666, 0xbc, 0x02 }, 89 { 443250000, 36166667, 166666, 0xbc, 0x02 },
90 { 830000000, 36166667, 166666, 0xf4, 0x02 }, 90 { 542000000, 36166667, 166666, 0xbc, 0x04 },
91 { 999999999, 36166667, 166666, 0xfc, 0x02 }, 91 { 830000000, 36166667, 166666, 0xf4, 0x04 },
92 { 999999999, 36166667, 166666, 0xfc, 0x04 },
92 }, 93 },
93}; 94};
94EXPORT_SYMBOL(dvb_pll_lg_z201); 95EXPORT_SYMBOL(dvb_pll_lg_z201);
diff --git a/drivers/media/dvb/frontends/lgdt3302.c b/drivers/media/dvb/frontends/lgdt330x.c
index 2eea03d218cd..e94dee50eecd 100644
--- a/drivers/media/dvb/frontends/lgdt3302.c
+++ b/drivers/media/dvb/frontends/lgdt330x.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM 2 * Support for LGDT3302 & LGDT3303 (DViCO FusionHDTV Gold) - VSB/QAM
3 * 3 *
4 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> 4 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
5 * 5 *
@@ -25,10 +25,11 @@
25/* 25/*
26 * NOTES ABOUT THIS DRIVER 26 * NOTES ABOUT THIS DRIVER
27 * 27 *
28 * This driver supports DViCO FusionHDTV 3 Gold under Linux. 28 * This driver supports DViCO FusionHDTV Gold under Linux.
29 * 29 *
30 * TODO: 30 * TODO:
31 * BER and signal strength always return 0. 31 * BER and signal strength always return 0.
32 * Include support for LGDT3303
32 * 33 *
33 */ 34 */
34 35
@@ -41,24 +42,24 @@
41 42
42#include "dvb_frontend.h" 43#include "dvb_frontend.h"
43#include "dvb-pll.h" 44#include "dvb-pll.h"
44#include "lgdt3302_priv.h" 45#include "lgdt330x_priv.h"
45#include "lgdt3302.h" 46#include "lgdt330x.h"
46 47
47static int debug = 0; 48static int debug = 0;
48module_param(debug, int, 0644); 49module_param(debug, int, 0644);
49MODULE_PARM_DESC(debug,"Turn on/off lgdt3302 frontend debugging (default:off)."); 50MODULE_PARM_DESC(debug,"Turn on/off lgdt330x frontend debugging (default:off).");
50#define dprintk(args...) \ 51#define dprintk(args...) \
51do { \ 52do { \
52if (debug) printk(KERN_DEBUG "lgdt3302: " args); \ 53if (debug) printk(KERN_DEBUG "lgdt330x: " args); \
53} while (0) 54} while (0)
54 55
55struct lgdt3302_state 56struct lgdt330x_state
56{ 57{
57 struct i2c_adapter* i2c; 58 struct i2c_adapter* i2c;
58 struct dvb_frontend_ops ops; 59 struct dvb_frontend_ops ops;
59 60
60 /* Configuration settings */ 61 /* Configuration settings */
61 const struct lgdt3302_config* config; 62 const struct lgdt330x_config* config;
62 63
63 struct dvb_frontend frontend; 64 struct dvb_frontend frontend;
64 65
@@ -69,45 +70,33 @@ struct lgdt3302_state
69 u32 current_frequency; 70 u32 current_frequency;
70}; 71};
71 72
72static int i2c_writebytes (struct lgdt3302_state* state, 73static int i2c_writebytes (struct lgdt330x_state* state,
73 u8 addr, /* demod_address or pll_address */ 74 u8 addr, /* demod_address or pll_address */
74 u8 *buf, /* data bytes to send */ 75 u8 *buf, /* data bytes to send */
75 int len /* number of bytes to send */ ) 76 int len /* number of bytes to send */ )
76{ 77{
77 if (addr == state->config->pll_address) { 78 u8 tmp[] = { buf[0], buf[1] };
78 struct i2c_msg msg = 79 struct i2c_msg msg =
79 { .addr = addr, .flags = 0, .buf = buf, .len = len }; 80 { .addr = addr, .flags = 0, .buf = tmp, .len = 2 };
80 int err; 81 int err;
82 int i;
81 83
84 for (i=1; i<len; i++) {
85 tmp[1] = buf[i];
82 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { 86 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
83 printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err); 87 printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err);
84 if (err < 0) 88 if (err < 0)
85 return err; 89 return err;
86 else 90 else
87 return -EREMOTEIO; 91 return -EREMOTEIO;
88 } 92 }
89 } else { 93 tmp[0]++;
90 u8 tmp[] = { buf[0], buf[1] };
91 struct i2c_msg msg =
92 { .addr = addr, .flags = 0, .buf = tmp, .len = 2 };
93 int err;
94 int i;
95
96 for (i=1; i<len; i++) {
97 tmp[1] = buf[i];
98 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
99 printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err);
100 if (err < 0)
101 return err;
102 else
103 return -EREMOTEIO;
104 }
105 tmp[0]++;
106 }
107 } 94 }
108 return 0; 95 return 0;
109} 96}
110static int i2c_readbytes (struct lgdt3302_state* state, 97
98#if 0
99static int i2c_readbytes (struct lgdt330x_state* state,
111 u8 addr, /* demod_address or pll_address */ 100 u8 addr, /* demod_address or pll_address */
112 u8 *buf, /* holds data bytes read */ 101 u8 *buf, /* holds data bytes read */
113 int len /* number of bytes to read */ ) 102 int len /* number of bytes to read */ )
@@ -117,18 +106,19 @@ static int i2c_readbytes (struct lgdt3302_state* state,
117 int err; 106 int err;
118 107
119 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { 108 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
120 printk(KERN_WARNING "lgdt3302: %s error (addr %02x, err == %i)\n", __FUNCTION__, addr, err); 109 printk(KERN_WARNING "lgdt330x: %s error (addr %02x, err == %i)\n", __FUNCTION__, addr, err);
121 return -EREMOTEIO; 110 return -EREMOTEIO;
122 } 111 }
123 return 0; 112 return 0;
124} 113}
114#endif
125 115
126/* 116/*
127 * This routine writes the register (reg) to the demod bus 117 * This routine writes the register (reg) to the demod bus
128 * then reads the data returned for (len) bytes. 118 * then reads the data returned for (len) bytes.
129 */ 119 */
130 120
131static u8 i2c_selectreadbytes (struct lgdt3302_state* state, 121static u8 i2c_selectreadbytes (struct lgdt330x_state* state,
132 enum I2C_REG reg, u8* buf, int len) 122 enum I2C_REG reg, u8* buf, int len)
133{ 123{
134 u8 wr [] = { reg }; 124 u8 wr [] = { reg };
@@ -141,7 +131,7 @@ static u8 i2c_selectreadbytes (struct lgdt3302_state* state,
141 int ret; 131 int ret;
142 ret = i2c_transfer(state->i2c, msg, 2); 132 ret = i2c_transfer(state->i2c, msg, 2);
143 if (ret != 2) { 133 if (ret != 2) {
144 printk(KERN_WARNING "lgdt3302: %s: addr 0x%02x select 0x%02x error (ret == %i)\n", __FUNCTION__, state->config->demod_address, reg, ret); 134 printk(KERN_WARNING "lgdt330x: %s: addr 0x%02x select 0x%02x error (ret == %i)\n", __FUNCTION__, state->config->demod_address, reg, ret);
145 } else { 135 } else {
146 ret = 0; 136 ret = 0;
147 } 137 }
@@ -149,7 +139,7 @@ static u8 i2c_selectreadbytes (struct lgdt3302_state* state,
149} 139}
150 140
151/* Software reset */ 141/* Software reset */
152int lgdt3302_SwReset(struct lgdt3302_state* state) 142int lgdt330x_SwReset(struct lgdt330x_state* state)
153{ 143{
154 u8 ret; 144 u8 ret;
155 u8 reset[] = { 145 u8 reset[] = {
@@ -175,7 +165,7 @@ int lgdt3302_SwReset(struct lgdt3302_state* state)
175 return ret; 165 return ret;
176} 166}
177 167
178static int lgdt3302_init(struct dvb_frontend* fe) 168static int lgdt330x_init(struct dvb_frontend* fe)
179{ 169{
180 /* Hardware reset is done using gpio[0] of cx23880x chip. 170 /* Hardware reset is done using gpio[0] of cx23880x chip.
181 * I'd like to do it here, but don't know how to find chip address. 171 * I'd like to do it here, but don't know how to find chip address.
@@ -184,18 +174,18 @@ static int lgdt3302_init(struct dvb_frontend* fe)
184 * the caller of this function needs to do it. */ 174 * the caller of this function needs to do it. */
185 175
186 dprintk("%s entered\n", __FUNCTION__); 176 dprintk("%s entered\n", __FUNCTION__);
187 return lgdt3302_SwReset((struct lgdt3302_state*) fe->demodulator_priv); 177 return lgdt330x_SwReset((struct lgdt330x_state*) fe->demodulator_priv);
188} 178}
189 179
190static int lgdt3302_read_ber(struct dvb_frontend* fe, u32* ber) 180static int lgdt330x_read_ber(struct dvb_frontend* fe, u32* ber)
191{ 181{
192 *ber = 0; /* Dummy out for now */ 182 *ber = 0; /* Dummy out for now */
193 return 0; 183 return 0;
194} 184}
195 185
196static int lgdt3302_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) 186static int lgdt330x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
197{ 187{
198 struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv; 188 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
199 u8 buf[2]; 189 u8 buf[2];
200 190
201 i2c_selectreadbytes(state, PACKET_ERR_COUNTER1, buf, sizeof(buf)); 191 i2c_selectreadbytes(state, PACKET_ERR_COUNTER1, buf, sizeof(buf));
@@ -204,12 +194,11 @@ static int lgdt3302_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
204 return 0; 194 return 0;
205} 195}
206 196
207static int lgdt3302_set_parameters(struct dvb_frontend* fe, 197static int lgdt330x_set_parameters(struct dvb_frontend* fe,
208 struct dvb_frontend_parameters *param) 198 struct dvb_frontend_parameters *param)
209{ 199{
210 u8 buf[4]; 200 struct lgdt330x_state* state =
211 struct lgdt3302_state* state = 201 (struct lgdt330x_state*) fe->demodulator_priv;
212 (struct lgdt3302_state*) fe->demodulator_priv;
213 202
214 /* Use 50MHz parameter values from spec sheet since xtal is 50 */ 203 /* Use 50MHz parameter values from spec sheet since xtal is 50 */
215 static u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 }; 204 static u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 };
@@ -217,19 +206,21 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe,
217 static u8 demux_ctrl_cfg[] = { DEMUX_CONTROL, 0xfb }; 206 static u8 demux_ctrl_cfg[] = { DEMUX_CONTROL, 0xfb };
218 static u8 agc_rf_cfg[] = { AGC_RF_BANDWIDTH0, 0x40, 0x93, 0x00 }; 207 static u8 agc_rf_cfg[] = { AGC_RF_BANDWIDTH0, 0x40, 0x93, 0x00 };
219 static u8 agc_ctrl_cfg[] = { AGC_FUNC_CTRL2, 0xc6, 0x40 }; 208 static u8 agc_ctrl_cfg[] = { AGC_FUNC_CTRL2, 0xc6, 0x40 };
220 static u8 agc_delay_cfg[] = { AGC_DELAY0, 0x00, 0x00, 0x00 }; 209 static u8 agc_delay_cfg[] = { AGC_DELAY0, 0x07, 0x00, 0xfe };
221 static u8 agc_loop_cfg[] = { AGC_LOOP_BANDWIDTH0, 0x08, 0x9a }; 210 static u8 agc_loop_cfg[] = { AGC_LOOP_BANDWIDTH0, 0x08, 0x9a };
222 211
223 /* Change only if we are actually changing the modulation */ 212 /* Change only if we are actually changing the modulation */
224 if (state->current_modulation != param->u.vsb.modulation) { 213 if (state->current_modulation != param->u.vsb.modulation) {
225 int value;
226
227 switch(param->u.vsb.modulation) { 214 switch(param->u.vsb.modulation) {
228 case VSB_8: 215 case VSB_8:
229 dprintk("%s: VSB_8 MODE\n", __FUNCTION__); 216 dprintk("%s: VSB_8 MODE\n", __FUNCTION__);
230 217
231 /* Select VSB mode and serial MPEG interface */ 218 /* Select VSB mode and serial MPEG interface */
232 top_ctrl_cfg[1] = 0x07; 219 top_ctrl_cfg[1] = 0x07;
220
221 /* Select ANT connector if supported by card */
222 if (state->config->pll_rf_set)
223 state->config->pll_rf_set(fe, 1);
233 break; 224 break;
234 225
235 case QAM_64: 226 case QAM_64:
@@ -237,6 +228,10 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe,
237 228
238 /* Select QAM_64 mode and serial MPEG interface */ 229 /* Select QAM_64 mode and serial MPEG interface */
239 top_ctrl_cfg[1] = 0x04; 230 top_ctrl_cfg[1] = 0x04;
231
232 /* Select CABLE connector if supported by card */
233 if (state->config->pll_rf_set)
234 state->config->pll_rf_set(fe, 0);
240 break; 235 break;
241 236
242 case QAM_256: 237 case QAM_256:
@@ -244,9 +239,13 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe,
244 239
245 /* Select QAM_256 mode and serial MPEG interface */ 240 /* Select QAM_256 mode and serial MPEG interface */
246 top_ctrl_cfg[1] = 0x05; 241 top_ctrl_cfg[1] = 0x05;
242
243 /* Select CABLE connector if supported by card */
244 if (state->config->pll_rf_set)
245 state->config->pll_rf_set(fe, 0);
247 break; 246 break;
248 default: 247 default:
249 printk(KERN_WARNING "lgdt3302: %s: Modulation type(%d) UNSUPPORTED\n", __FUNCTION__, param->u.vsb.modulation); 248 printk(KERN_WARNING "lgdt330x: %s: Modulation type(%d) UNSUPPORTED\n", __FUNCTION__, param->u.vsb.modulation);
250 return -1; 249 return -1;
251 } 250 }
252 /* Initializations common to all modes */ 251 /* Initializations common to all modes */
@@ -276,16 +275,8 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe,
276 recovery center frequency register */ 275 recovery center frequency register */
277 i2c_writebytes(state, state->config->demod_address, 276 i2c_writebytes(state, state->config->demod_address,
278 vsb_freq_cfg, sizeof(vsb_freq_cfg)); 277 vsb_freq_cfg, sizeof(vsb_freq_cfg));
279 /* Set the value of 'INLVTHD' register 0x2a/0x2c 278
280 to value from 'IFACC' register 0x39/0x3b -1 */ 279 /* Set the value of 'INLVTHD' register 0x2a/0x2c to 0x7fe */
281 i2c_selectreadbytes(state, AGC_RFIF_ACC0,
282 &agc_delay_cfg[1], 3);
283 value = ((agc_delay_cfg[1] & 0x0f) << 8) | agc_delay_cfg[3];
284 value = value -1;
285 dprintk("%s IFACC -1 = 0x%03x\n", __FUNCTION__, value);
286 agc_delay_cfg[1] = (value >> 8) & 0x0f;
287 agc_delay_cfg[2] = 0x00;
288 agc_delay_cfg[3] = value & 0xff;
289 i2c_writebytes(state, state->config->demod_address, 280 i2c_writebytes(state, state->config->demod_address,
290 agc_delay_cfg, sizeof(agc_delay_cfg)); 281 agc_delay_cfg, sizeof(agc_delay_cfg));
291 282
@@ -300,44 +291,50 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe,
300 291
301 /* Change only if we are actually changing the channel */ 292 /* Change only if we are actually changing the channel */
302 if (state->current_frequency != param->frequency) { 293 if (state->current_frequency != param->frequency) {
303 dvb_pll_configure(state->config->pll_desc, buf, 294 u8 buf[5];
304 param->frequency, 0); 295 struct i2c_msg msg = { .flags = 0, .buf = &buf[1], .len = 4 };
305 dprintk("%s: tuner bytes: 0x%02x 0x%02x " 296 int err;
306 "0x%02x 0x%02x\n", __FUNCTION__, buf[0],buf[1],buf[2],buf[3]);
307 i2c_writebytes(state, state->config->pll_address ,buf, 4);
308 297
309 /* Check the status of the tuner pll */ 298 state->config->pll_set(fe, param, buf);
310 i2c_readbytes(state, state->config->pll_address, buf, 1); 299 msg.addr = buf[0];
311 dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]);
312 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
313 /* Update current frequency */ 316 /* Update current frequency */
314 state->current_frequency = param->frequency; 317 state->current_frequency = param->frequency;
315 } 318 }
316 lgdt3302_SwReset(state); 319 lgdt330x_SwReset(state);
317 return 0; 320 return 0;
318} 321}
319 322
320static int lgdt3302_get_frontend(struct dvb_frontend* fe, 323static int lgdt330x_get_frontend(struct dvb_frontend* fe,
321 struct dvb_frontend_parameters* param) 324 struct dvb_frontend_parameters* param)
322{ 325{
323 struct lgdt3302_state *state = fe->demodulator_priv; 326 struct lgdt330x_state *state = fe->demodulator_priv;
324 param->frequency = state->current_frequency; 327 param->frequency = state->current_frequency;
325 return 0; 328 return 0;
326} 329}
327 330
328static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status) 331static int lgdt330x_read_status(struct dvb_frontend* fe, fe_status_t* status)
329{ 332{
330 struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv; 333 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
331 u8 buf[3]; 334 u8 buf[3];
332 335
333 *status = 0; /* Reset status result */ 336 *status = 0; /* Reset status result */
334 337
335 /* Check the status of the tuner pll */
336 i2c_readbytes(state, state->config->pll_address, buf, 1);
337 dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]);
338 if ((buf[0] & 0xc0) != 0x40)
339 return 0; /* Tuner PLL not locked or not powered on */
340
341 /* 338 /*
342 * You must set the Mask bits to 1 in the IRQ_MASK in order 339 * You must set the Mask bits to 1 in the IRQ_MASK in order
343 * to see that status bit in the IRQ_STATUS register. 340 * to see that status bit in the IRQ_STATUS register.
@@ -393,19 +390,19 @@ static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status)
393 *status |= FE_HAS_CARRIER; 390 *status |= FE_HAS_CARRIER;
394 break; 391 break;
395 default: 392 default:
396 printk("KERN_WARNING lgdt3302: %s: Modulation set to unsupported value\n", __FUNCTION__); 393 printk("KERN_WARNING lgdt330x: %s: Modulation set to unsupported value\n", __FUNCTION__);
397 } 394 }
398 395
399 return 0; 396 return 0;
400} 397}
401 398
402static int lgdt3302_read_signal_strength(struct dvb_frontend* fe, u16* strength) 399static int lgdt330x_read_signal_strength(struct dvb_frontend* fe, u16* strength)
403{ 400{
404 /* not directly available. */ 401 /* not directly available. */
405 return 0; 402 return 0;
406} 403}
407 404
408static int lgdt3302_read_snr(struct dvb_frontend* fe, u16* snr) 405static int lgdt330x_read_snr(struct dvb_frontend* fe, u16* snr)
409{ 406{
410#ifdef SNR_IN_DB 407#ifdef SNR_IN_DB
411 /* 408 /*
@@ -460,7 +457,7 @@ static int lgdt3302_read_snr(struct dvb_frontend* fe, u16* snr)
460 static u8 buf[5];/* read data buffer */ 457 static u8 buf[5];/* read data buffer */
461 static u32 noise; /* noise value */ 458 static u32 noise; /* noise value */
462 static u32 snr_db; /* index into SNR_EQ[] */ 459 static u32 snr_db; /* index into SNR_EQ[] */
463 struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv; 460 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
464 461
465 /* read both equalizer and pase tracker noise data */ 462 /* read both equalizer and pase tracker noise data */
466 i2c_selectreadbytes(state, EQPH_ERR0, buf, sizeof(buf)); 463 i2c_selectreadbytes(state, EQPH_ERR0, buf, sizeof(buf));
@@ -496,7 +493,7 @@ static int lgdt3302_read_snr(struct dvb_frontend* fe, u16* snr)
496 /* Return the raw noise value */ 493 /* Return the raw noise value */
497 static u8 buf[5];/* read data buffer */ 494 static u8 buf[5];/* read data buffer */
498 static u32 noise; /* noise value */ 495 static u32 noise; /* noise value */
499 struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv; 496 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
500 497
501 /* read both equalizer and pase tracker noise data */ 498 /* read both equalizer and pase tracker noise data */
502 i2c_selectreadbytes(state, EQPH_ERR0, buf, sizeof(buf)); 499 i2c_selectreadbytes(state, EQPH_ERR0, buf, sizeof(buf));
@@ -519,7 +516,7 @@ static int lgdt3302_read_snr(struct dvb_frontend* fe, u16* snr)
519 return 0; 516 return 0;
520} 517}
521 518
522static int lgdt3302_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fe_tune_settings) 519static int lgdt330x_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fe_tune_settings)
523{ 520{
524 /* I have no idea about this - it may not be needed */ 521 /* I have no idea about this - it may not be needed */
525 fe_tune_settings->min_delay_ms = 500; 522 fe_tune_settings->min_delay_ms = 500;
@@ -528,22 +525,22 @@ static int lgdt3302_get_tune_settings(struct dvb_frontend* fe, struct dvb_fronte
528 return 0; 525 return 0;
529} 526}
530 527
531static void lgdt3302_release(struct dvb_frontend* fe) 528static void lgdt330x_release(struct dvb_frontend* fe)
532{ 529{
533 struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv; 530 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
534 kfree(state); 531 kfree(state);
535} 532}
536 533
537static struct dvb_frontend_ops lgdt3302_ops; 534static struct dvb_frontend_ops lgdt330x_ops;
538 535
539struct dvb_frontend* lgdt3302_attach(const struct lgdt3302_config* config, 536struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
540 struct i2c_adapter* i2c) 537 struct i2c_adapter* i2c)
541{ 538{
542 struct lgdt3302_state* state = NULL; 539 struct lgdt330x_state* state = NULL;
543 u8 buf[1]; 540 u8 buf[1];
544 541
545 /* Allocate memory for the internal state */ 542 /* Allocate memory for the internal state */
546 state = (struct lgdt3302_state*) kmalloc(sizeof(struct lgdt3302_state), GFP_KERNEL); 543 state = (struct lgdt330x_state*) kmalloc(sizeof(struct lgdt330x_state), GFP_KERNEL);
547 if (state == NULL) 544 if (state == NULL)
548 goto error; 545 goto error;
549 memset(state,0,sizeof(*state)); 546 memset(state,0,sizeof(*state));
@@ -551,7 +548,7 @@ struct dvb_frontend* lgdt3302_attach(const struct lgdt3302_config* config,
551 /* Setup the state */ 548 /* Setup the state */
552 state->config = config; 549 state->config = config;
553 state->i2c = i2c; 550 state->i2c = i2c;
554 memcpy(&state->ops, &lgdt3302_ops, sizeof(struct dvb_frontend_ops)); 551 memcpy(&state->ops, &lgdt330x_ops, sizeof(struct dvb_frontend_ops));
555 /* Verify communication with demod chip */ 552 /* Verify communication with demod chip */
556 if (i2c_selectreadbytes(state, 2, buf, 1)) 553 if (i2c_selectreadbytes(state, 2, buf, 1))
557 goto error; 554 goto error;
@@ -571,9 +568,9 @@ error:
571 return NULL; 568 return NULL;
572} 569}
573 570
574static struct dvb_frontend_ops lgdt3302_ops = { 571static struct dvb_frontend_ops lgdt330x_ops = {
575 .info = { 572 .info = {
576 .name= "LG Electronics LGDT3302 VSB/QAM Frontend", 573 .name= "LG Electronics lgdt330x VSB/QAM Frontend",
577 .type = FE_ATSC, 574 .type = FE_ATSC,
578 .frequency_min= 54000000, 575 .frequency_min= 54000000,
579 .frequency_max= 858000000, 576 .frequency_max= 858000000,
@@ -583,23 +580,23 @@ static struct dvb_frontend_ops lgdt3302_ops = {
583 .symbol_rate_max = 10762000, 580 .symbol_rate_max = 10762000,
584 .caps = FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_8VSB 581 .caps = FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_8VSB
585 }, 582 },
586 .init = lgdt3302_init, 583 .init = lgdt330x_init,
587 .set_frontend = lgdt3302_set_parameters, 584 .set_frontend = lgdt330x_set_parameters,
588 .get_frontend = lgdt3302_get_frontend, 585 .get_frontend = lgdt330x_get_frontend,
589 .get_tune_settings = lgdt3302_get_tune_settings, 586 .get_tune_settings = lgdt330x_get_tune_settings,
590 .read_status = lgdt3302_read_status, 587 .read_status = lgdt330x_read_status,
591 .read_ber = lgdt3302_read_ber, 588 .read_ber = lgdt330x_read_ber,
592 .read_signal_strength = lgdt3302_read_signal_strength, 589 .read_signal_strength = lgdt330x_read_signal_strength,
593 .read_snr = lgdt3302_read_snr, 590 .read_snr = lgdt330x_read_snr,
594 .read_ucblocks = lgdt3302_read_ucblocks, 591 .read_ucblocks = lgdt330x_read_ucblocks,
595 .release = lgdt3302_release, 592 .release = lgdt330x_release,
596}; 593};
597 594
598MODULE_DESCRIPTION("LGDT3302 [DViCO FusionHDTV 3 Gold] (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver"); 595MODULE_DESCRIPTION("lgdt330x [DViCO FusionHDTV 3 Gold] (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver");
599MODULE_AUTHOR("Wilson Michaels"); 596MODULE_AUTHOR("Wilson Michaels");
600MODULE_LICENSE("GPL"); 597MODULE_LICENSE("GPL");
601 598
602EXPORT_SYMBOL(lgdt3302_attach); 599EXPORT_SYMBOL(lgdt330x_attach);
603 600
604/* 601/*
605 * Local variables: 602 * Local variables:
diff --git a/drivers/media/dvb/frontends/lgdt3302.h b/drivers/media/dvb/frontends/lgdt330x.h
index 81587a40032b..04986f8e7565 100644
--- a/drivers/media/dvb/frontends/lgdt3302.h
+++ b/drivers/media/dvb/frontends/lgdt330x.h
@@ -1,7 +1,5 @@
1/* 1/*
2 * $Id: lgdt3302.h,v 1.2 2005/06/28 23:50:48 mkrufky Exp $ 2 * Support for LGDT3302 & LGDT3303 (DViCO FustionHDTV Gold) - VSB/QAM
3 *
4 * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM
5 * 3 *
6 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> 4 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
7 * 5 *
@@ -21,26 +19,28 @@
21 * 19 *
22 */ 20 */
23 21
24#ifndef LGDT3302_H 22#ifndef LGDT330X_H
25#define LGDT3302_H 23#define LGDT330X_H
26 24
27#include <linux/dvb/frontend.h> 25#include <linux/dvb/frontend.h>
28 26
29struct lgdt3302_config 27struct lgdt330x_config
30{ 28{
31 /* The demodulator's i2c address */ 29 /* The demodulator's i2c address */
32 u8 demod_address; 30 u8 demod_address;
33 u8 pll_address; 31
34 struct dvb_pll_desc *pll_desc; 32 /* PLL interface */
33 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);
35 35
36 /* Need to set device param for start_dma */ 36 /* Need to set device param for start_dma */
37 int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); 37 int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured);
38}; 38};
39 39
40extern struct dvb_frontend* lgdt3302_attach(const struct lgdt3302_config* config, 40extern struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
41 struct i2c_adapter* i2c); 41 struct i2c_adapter* i2c);
42 42
43#endif /* LGDT3302_H */ 43#endif /* LGDT330X_H */
44 44
45/* 45/*
46 * Local variables: 46 * Local variables:
diff --git a/drivers/media/dvb/frontends/lgdt3302_priv.h b/drivers/media/dvb/frontends/lgdt330x_priv.h
index 6193fa7a569d..4143ce8f1a95 100644
--- a/drivers/media/dvb/frontends/lgdt3302_priv.h
+++ b/drivers/media/dvb/frontends/lgdt330x_priv.h
@@ -1,7 +1,5 @@
1/* 1/*
2 * $Id: lgdt3302_priv.h,v 1.2 2005/06/28 23:50:48 mkrufky Exp $ 2 * Support for LGDT3302 & LGDT3303 (DViCO FustionHDTV Gold) - VSB/QAM
3 *
4 * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM
5 * 3 *
6 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> 4 * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
7 * 5 *
@@ -21,8 +19,8 @@
21 * 19 *
22 */ 20 */
23 21
24#ifndef _LGDT3302_PRIV_ 22#ifndef _LGDT330X_PRIV_
25#define _LGDT3302_PRIV_ 23#define _LGDT330X_PRIV_
26 24
27/* i2c control register addresses */ 25/* i2c control register addresses */
28enum I2C_REG { 26enum I2C_REG {
@@ -63,7 +61,7 @@ enum I2C_REG {
63 PACKET_ERR_COUNTER2= 0x6b, 61 PACKET_ERR_COUNTER2= 0x6b,
64}; 62};
65 63
66#endif /* _LGDT3302_PRIV_ */ 64#endif /* _LGDT330X_PRIV_ */
67 65
68/* 66/*
69 * Local variables: 67 * Local variables:
diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c
index e62147e4ed1b..e5e2021a7312 100644
--- a/drivers/media/radio/radio-maestro.c
+++ b/drivers/media/radio/radio-maestro.c
@@ -154,7 +154,7 @@ static void radio_bits_set(struct radio_device *dev, __u32 data)
154 msleep(125); 154 msleep(125);
155} 155}
156 156
157inline static int radio_function(struct inode *inode, struct file *file, 157static inline int radio_function(struct inode *inode, struct file *file,
158 unsigned int cmd, void *arg) 158 unsigned int cmd, void *arg)
159{ 159{
160 struct video_device *dev = video_devdata(file); 160 struct video_device *dev = video_devdata(file);
@@ -283,7 +283,7 @@ static int __init maestro_radio_init(void)
283module_init(maestro_radio_init); 283module_init(maestro_radio_init);
284module_exit(maestro_radio_exit); 284module_exit(maestro_radio_exit);
285 285
286inline static __u16 radio_power_on(struct radio_device *dev) 286static inline __u16 radio_power_on(struct radio_device *dev)
287{ 287{
288 register __u16 io=dev->io; 288 register __u16 io=dev->io;
289 register __u32 ofreq; 289 register __u32 ofreq;
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c
index 5b748a48ce72..02d39a50d5ed 100644
--- a/drivers/media/radio/radio-maxiradio.c
+++ b/drivers/media/radio/radio-maxiradio.c
@@ -166,7 +166,7 @@ static int get_tune(__u16 io)
166} 166}
167 167
168 168
169inline static int radio_function(struct inode *inode, struct file *file, 169static inline int radio_function(struct inode *inode, struct file *file,
170 unsigned int cmd, void *arg) 170 unsigned int cmd, void *arg)
171{ 171{
172 struct video_device *dev = video_devdata(file); 172 struct video_device *dev = video_devdata(file);
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index f461750c7646..ac81e5e01a9a 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -236,7 +236,7 @@ config VIDEO_MEYE
236 236
237config VIDEO_SAA7134 237config VIDEO_SAA7134
238 tristate "Philips SAA7134 support" 238 tristate "Philips SAA7134 support"
239 depends on VIDEO_DEV && PCI && I2C 239 depends on VIDEO_DEV && PCI && I2C && SOUND
240 select VIDEO_BUF 240 select VIDEO_BUF
241 select VIDEO_IR 241 select VIDEO_IR
242 select VIDEO_TUNER 242 select VIDEO_TUNER
@@ -331,7 +331,7 @@ config VIDEO_CX88_DVB
331 select DVB_MT352 331 select DVB_MT352
332 select DVB_OR51132 332 select DVB_OR51132
333 select DVB_CX22702 333 select DVB_CX22702
334 select DVB_LGDT3302 334 select DVB_LGDT330X
335 ---help--- 335 ---help---
336 This adds support for DVB/ATSC cards based on the 336 This adds support for DVB/ATSC cards based on the
337 Connexant 2388x chip. 337 Connexant 2388x chip.
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c
index 2dbf5ec43abd..6c52fd0bb7df 100644
--- a/drivers/media/video/bttv-cards.c
+++ b/drivers/media/video/bttv-cards.c
@@ -1,5 +1,5 @@
1/* 1/*
2 $Id: bttv-cards.c,v 1.53 2005/07/05 17:37:35 nsh Exp $ 2 $Id: bttv-cards.c,v 1.54 2005/07/19 18:26:46 mkrufky Exp $
3 3
4 bttv-cards.c 4 bttv-cards.c
5 5
@@ -2772,8 +2772,6 @@ void __devinit bttv_init_card2(struct bttv *btv)
2772 } 2772 }
2773 btv->pll.pll_current = -1; 2773 btv->pll.pll_current = -1;
2774 2774
2775 bttv_reset_audio(btv);
2776
2777 /* tuner configuration (from card list / autodetect / insmod option) */ 2775 /* tuner configuration (from card list / autodetect / insmod option) */
2778 if (UNSET != bttv_tvcards[btv->c.type].tuner_type) 2776 if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
2779 if(UNSET == btv->tuner_type) 2777 if(UNSET == btv->tuner_type)
diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile
index 606d0348da2c..107e48645e3a 100644
--- a/drivers/media/video/cx88/Makefile
+++ b/drivers/media/video/cx88/Makefile
@@ -9,3 +9,15 @@ obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o
9EXTRA_CFLAGS += -I$(src)/.. 9EXTRA_CFLAGS += -I$(src)/..
10EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core 10EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core
11EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends 11EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends
12ifneq ($(CONFIG_DVB_CX22702),n)
13 EXTRA_CFLAGS += -DHAVE_CX22702=1
14endif
15ifneq ($(CONFIG_DVB_OR51132),n)
16 EXTRA_CFLAGS += -DHAVE_OR51132=1
17endif
18ifneq ($(CONFIG_DVB_LGDT330X),n)
19 EXTRA_CFLAGS += -DHAVE_LGDT330X=1
20endif
21ifneq ($(CONFIG_DVB_MT352),n)
22 EXTRA_CFLAGS += -DHAVE_MT352=1
23endif
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index b0b47c3cde3c..3d0c784b376f 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.85 2005/07/04 19:35:05 mkrufky Exp $ 2 * $Id: cx88-cards.c,v 1.86 2005/07/14 03:06:43 mchehab 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.
@@ -682,9 +682,9 @@ struct cx88_board cx88_boards[] = {
682 .name = "PixelView PlayTV Ultra Pro (Stereo)", 682 .name = "PixelView PlayTV Ultra Pro (Stereo)",
683 /* May be also TUNER_YMEC_TVF_5533MF for NTSC/M or PAL/M */ 683 /* May be also TUNER_YMEC_TVF_5533MF for NTSC/M or PAL/M */
684 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 684 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
685 .radio_type = TUNER_TEA5767, 685 .radio_type = UNSET,
686 .tuner_addr = 0xc2>>1, 686 .tuner_addr = ADDR_UNSET,
687 .radio_addr = 0xc0>>1, 687 .radio_addr = ADDR_UNSET,
688 .input = {{ 688 .input = {{
689 .type = CX88_VMUX_TELEVISION, 689 .type = CX88_VMUX_TELEVISION,
690 .vmux = 0, 690 .vmux = 0,
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index 8db68f2d1351..ef0e9a85c359 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.41 2005/07/04 19:35:05 mkrufky Exp $ 2 * $Id: cx88-dvb.c,v 1.54 2005/07/25 05:13:50 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
@@ -29,27 +29,23 @@
29#include <linux/kthread.h> 29#include <linux/kthread.h>
30#include <linux/file.h> 30#include <linux/file.h>
31#include <linux/suspend.h> 31#include <linux/suspend.h>
32 32#include <linux/config.h>
33#define CONFIG_DVB_MT352 1
34#define CONFIG_DVB_CX22702 1
35#define CONFIG_DVB_OR51132 1
36#define CONFIG_DVB_LGDT3302 1
37 33
38#include "cx88.h" 34#include "cx88.h"
39#include "dvb-pll.h" 35#include "dvb-pll.h"
40 36
41#if CONFIG_DVB_MT352 37#ifdef HAVE_MT352
42# include "mt352.h" 38# include "mt352.h"
43# include "mt352_priv.h" 39# include "mt352_priv.h"
44#endif 40#endif
45#if CONFIG_DVB_CX22702 41#ifdef HAVE_CX22702
46# include "cx22702.h" 42# include "cx22702.h"
47#endif 43#endif
48#if CONFIG_DVB_OR51132 44#ifdef HAVE_OR51132
49# include "or51132.h" 45# include "or51132.h"
50#endif 46#endif
51#if CONFIG_DVB_LGDT3302 47#ifdef HAVE_LGDT330X
52# include "lgdt3302.h" 48# include "lgdt330x.h"
53#endif 49#endif
54 50
55MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); 51MODULE_DESCRIPTION("driver for cx2388x based DVB cards");
@@ -107,7 +103,7 @@ static struct videobuf_queue_ops dvb_qops = {
107 103
108/* ------------------------------------------------------------------ */ 104/* ------------------------------------------------------------------ */
109 105
110#if CONFIG_DVB_MT352 106#ifdef HAVE_MT352
111static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe) 107static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe)
112{ 108{
113 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; 109 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 };
@@ -177,21 +173,23 @@ static struct mt352_config dntv_live_dvbt_config = {
177}; 173};
178#endif 174#endif
179 175
180#if CONFIG_DVB_CX22702 176#ifdef HAVE_CX22702
181static struct cx22702_config connexant_refboard_config = { 177static struct cx22702_config connexant_refboard_config = {
182 .demod_address = 0x43, 178 .demod_address = 0x43,
179 .output_mode = CX22702_SERIAL_OUTPUT,
183 .pll_address = 0x60, 180 .pll_address = 0x60,
184 .pll_desc = &dvb_pll_thomson_dtt7579, 181 .pll_desc = &dvb_pll_thomson_dtt7579,
185}; 182};
186 183
187static struct cx22702_config hauppauge_novat_config = { 184static struct cx22702_config hauppauge_novat_config = {
188 .demod_address = 0x43, 185 .demod_address = 0x43,
186 .output_mode = CX22702_SERIAL_OUTPUT,
189 .pll_address = 0x61, 187 .pll_address = 0x61,
190 .pll_desc = &dvb_pll_thomson_dtt759x, 188 .pll_desc = &dvb_pll_thomson_dtt759x,
191}; 189};
192#endif 190#endif
193 191
194#if CONFIG_DVB_OR51132 192#ifdef HAVE_OR51132
195static int or51132_set_ts_param(struct dvb_frontend* fe, 193static int or51132_set_ts_param(struct dvb_frontend* fe,
196 int is_punctured) 194 int is_punctured)
197{ 195{
@@ -208,8 +206,33 @@ static struct or51132_config pchdtv_hd3000 = {
208}; 206};
209#endif 207#endif
210 208
211#if CONFIG_DVB_LGDT3302 209#ifdef HAVE_LGDT330X
212static int lgdt3302_set_ts_param(struct dvb_frontend* fe, int is_punctured) 210static int lgdt330x_pll_set(struct dvb_frontend* fe,
211 struct dvb_frontend_parameters* params,
212 u8* pllbuf)
213{
214 struct cx8802_dev *dev= fe->dvb->priv;
215
216 pllbuf[0] = dev->core->pll_addr;
217 dvb_pll_configure(dev->core->pll_desc, &pllbuf[1],
218 params->frequency, 0);
219 return 0;
220}
221
222static int lgdt330x_pll_rf_set(struct dvb_frontend* fe, int index)
223{
224 struct cx8802_dev *dev= fe->dvb->priv;
225 struct cx88_core *core = dev->core;
226
227 dprintk(1, "%s: index = %d\n", __FUNCTION__, index);
228 if (index == 0)
229 cx_clear(MO_GP0_IO, 8);
230 else
231 cx_set(MO_GP0_IO, 8);
232 return 0;
233}
234
235static int lgdt330x_set_ts_param(struct dvb_frontend* fe, int is_punctured)
213{ 236{
214 struct cx8802_dev *dev= fe->dvb->priv; 237 struct cx8802_dev *dev= fe->dvb->priv;
215 if (is_punctured) 238 if (is_punctured)
@@ -219,18 +242,10 @@ static int lgdt3302_set_ts_param(struct dvb_frontend* fe, int is_punctured)
219 return 0; 242 return 0;
220} 243}
221 244
222static struct lgdt3302_config fusionhdtv_3_gold_q = { 245static struct lgdt330x_config fusionhdtv_3_gold = {
223 .demod_address = 0x0e, 246 .demod_address = 0x0e,
224 .pll_address = 0x61, 247 .pll_set = lgdt330x_pll_set,
225 .pll_desc = &dvb_pll_microtune_4042, 248 .set_ts_params = lgdt330x_set_ts_param,
226 .set_ts_params = lgdt3302_set_ts_param,
227};
228
229static struct lgdt3302_config fusionhdtv_3_gold_t = {
230 .demod_address = 0x0e,
231 .pll_address = 0x61,
232 .pll_desc = &dvb_pll_thomson_dtt7611,
233 .set_ts_params = lgdt3302_set_ts_param,
234}; 249};
235#endif 250#endif
236 251
@@ -242,7 +257,7 @@ static int dvb_register(struct cx8802_dev *dev)
242 257
243 /* init frontend */ 258 /* init frontend */
244 switch (dev->core->board) { 259 switch (dev->core->board) {
245#if CONFIG_DVB_CX22702 260#ifdef HAVE_CX22702
246 case CX88_BOARD_HAUPPAUGE_DVB_T1: 261 case CX88_BOARD_HAUPPAUGE_DVB_T1:
247 dev->dvb.frontend = cx22702_attach(&hauppauge_novat_config, 262 dev->dvb.frontend = cx22702_attach(&hauppauge_novat_config,
248 &dev->core->i2c_adap); 263 &dev->core->i2c_adap);
@@ -253,7 +268,7 @@ static int dvb_register(struct cx8802_dev *dev)
253 &dev->core->i2c_adap); 268 &dev->core->i2c_adap);
254 break; 269 break;
255#endif 270#endif
256#if CONFIG_DVB_MT352 271#ifdef HAVE_MT352
257 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: 272 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
258 dev->core->pll_addr = 0x61; 273 dev->core->pll_addr = 0x61;
259 dev->core->pll_desc = &dvb_pll_lg_z201; 274 dev->core->pll_desc = &dvb_pll_lg_z201;
@@ -275,13 +290,13 @@ static int dvb_register(struct cx8802_dev *dev)
275 &dev->core->i2c_adap); 290 &dev->core->i2c_adap);
276 break; 291 break;
277#endif 292#endif
278#if CONFIG_DVB_OR51132 293#ifdef HAVE_OR51132
279 case CX88_BOARD_PCHDTV_HD3000: 294 case CX88_BOARD_PCHDTV_HD3000:
280 dev->dvb.frontend = or51132_attach(&pchdtv_hd3000, 295 dev->dvb.frontend = or51132_attach(&pchdtv_hd3000,
281 &dev->core->i2c_adap); 296 &dev->core->i2c_adap);
282 break; 297 break;
283#endif 298#endif
284#if CONFIG_DVB_LGDT3302 299#ifdef HAVE_LGDT330X
285 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: 300 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q:
286 dev->ts_gen_cntrl = 0x08; 301 dev->ts_gen_cntrl = 0x08;
287 { 302 {
@@ -290,9 +305,14 @@ static int dvb_register(struct cx8802_dev *dev)
290 305
291 cx_clear(MO_GP0_IO, 1); 306 cx_clear(MO_GP0_IO, 1);
292 mdelay(100); 307 mdelay(100);
293 cx_set(MO_GP0_IO, 9); // ANT connector too FIXME 308 cx_set(MO_GP0_IO, 1);
294 mdelay(200); 309 mdelay(200);
295 dev->dvb.frontend = lgdt3302_attach(&fusionhdtv_3_gold_q, 310
311 /* Select RF connector callback */
312 fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set;
313 dev->core->pll_addr = 0x61;
314 dev->core->pll_desc = &dvb_pll_microtune_4042;
315 dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold,
296 &dev->core->i2c_adap); 316 &dev->core->i2c_adap);
297 } 317 }
298 break; 318 break;
@@ -304,9 +324,11 @@ static int dvb_register(struct cx8802_dev *dev)
304 324
305 cx_clear(MO_GP0_IO, 1); 325 cx_clear(MO_GP0_IO, 1);
306 mdelay(100); 326 mdelay(100);
307 cx_set(MO_GP0_IO, 9); /* ANT connector too FIXME */ 327 cx_set(MO_GP0_IO, 9);
308 mdelay(200); 328 mdelay(200);
309 dev->dvb.frontend = lgdt3302_attach(&fusionhdtv_3_gold_t, 329 dev->core->pll_addr = 0x61;
330 dev->core->pll_desc = &dvb_pll_thomson_dtt7611;
331 dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold,
310 &dev->core->i2c_adap); 332 &dev->core->i2c_adap);
311 } 333 }
312 break; 334 break;
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c
index 8403c4e95050..a628a55299c6 100644
--- a/drivers/media/video/cx88/cx88-i2c.c
+++ b/drivers/media/video/cx88/cx88-i2c.c
@@ -1,5 +1,5 @@
1/* 1/*
2 $Id: cx88-i2c.c,v 1.28 2005/07/05 17:37:35 nsh Exp $ 2 $Id: cx88-i2c.c,v 1.30 2005/07/25 05:10:13 mkrufky Exp $
3 3
4 cx88-i2c.c -- all the i2c code is here 4 cx88-i2c.c -- all the i2c code is here
5 5
@@ -164,7 +164,7 @@ static struct i2c_client cx8800_i2c_client_template = {
164}; 164};
165 165
166static char *i2c_devs[128] = { 166static char *i2c_devs[128] = {
167 [ 0x1c >> 1 ] = "lgdt3302", 167 [ 0x1c >> 1 ] = "lgdt330x",
168 [ 0x86 >> 1 ] = "tda9887/cx22702", 168 [ 0x86 >> 1 ] = "tda9887/cx22702",
169 [ 0xa0 >> 1 ] = "eeprom", 169 [ 0xa0 >> 1 ] = "eeprom",
170 [ 0xc0 >> 1 ] = "tuner (analog)", 170 [ 0xc0 >> 1 ] = "tuner (analog)",
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index c44a079d08c0..5588a3aeecb4 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.79 2005/07/07 14:17:47 mchehab Exp $ 2 * $Id: cx88-video.c,v 1.80 2005/07/13 08:49:08 mchehab 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
@@ -1346,6 +1346,11 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1346 dev->freq = f->frequency; 1346 dev->freq = f->frequency;
1347 cx88_newstation(core); 1347 cx88_newstation(core);
1348 cx88_call_i2c_clients(dev->core,VIDIOC_S_FREQUENCY,f); 1348 cx88_call_i2c_clients(dev->core,VIDIOC_S_FREQUENCY,f);
1349
1350 /* When changing channels it is required to reset TVAUDIO */
1351 msleep (10);
1352 cx88_set_tvaudio(core);
1353
1349 up(&dev->lock); 1354 up(&dev->lock);
1350 return 0; 1355 return 0;
1351 } 1356 }
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 307beae04f2a..b008f7db6dfd 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.68 2005/07/07 14:17:47 mchehab Exp $ 2 * $Id: cx88.h,v 1.69 2005/07/13 17:25:25 mchehab Exp $
3 * 3 *
4 * v4l2 device driver for cx2388x based TV cards 4 * v4l2 device driver for cx2388x based TV cards
5 * 5 *
@@ -35,8 +35,8 @@
35#include "btcx-risc.h" 35#include "btcx-risc.h"
36#include "cx88-reg.h" 36#include "cx88-reg.h"
37 37
38#include <linux/version.h> 38#include <linux/utsname.h>
39#define CX88_VERSION_CODE KERNEL_VERSION(0,0,4) 39#define CX88_VERSION_CODE KERNEL_VERSION(0,0,5)
40 40
41#ifndef TRUE 41#ifndef TRUE
42# define TRUE (1==1) 42# define TRUE (1==1)
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
index 486234d41b56..d04793fb80fc 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -142,8 +142,8 @@ struct mxb
142 142
143 int cur_mode; /* current audio mode (mono, stereo, ...) */ 143 int cur_mode; /* current audio mode (mono, stereo, ...) */
144 int cur_input; /* current input */ 144 int cur_input; /* current input */
145 int cur_freq; /* current frequency the tuner is tuned to */
146 int cur_mute; /* current mute status */ 145 int cur_mute; /* current mute status */
146 struct v4l2_frequency cur_freq; /* current frequency the tuner is tuned to */
147}; 147};
148 148
149static struct saa7146_extension extension; 149static struct saa7146_extension extension;
@@ -352,9 +352,15 @@ static int mxb_init_done(struct saa7146_dev* dev)
352 /* select a tuner type */ 352 /* select a tuner type */
353 tun_setup.mode_mask = T_ANALOG_TV; 353 tun_setup.mode_mask = T_ANALOG_TV;
354 tun_setup.addr = ADDR_UNSET; 354 tun_setup.addr = ADDR_UNSET;
355 tun_setup.type = 5; 355 tun_setup.type = TUNER_PHILIPS_PAL;
356 mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE_ADDR, &tun_setup); 356 mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE_ADDR, &tun_setup);
357 357 /* tune in some frequency on tuner */
358 mxb->cur_freq.tuner = 0;
359 mxb->cur_freq.type = V4L2_TUNER_ANALOG_TV;
360 mxb->cur_freq.frequency = freq;
361 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_FREQUENCY,
362 &mxb->cur_freq);
363
358 /* mute audio on tea6420s */ 364 /* mute audio on tea6420s */
359 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]); 365 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]);
360 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]); 366 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]);
@@ -371,12 +377,8 @@ static int mxb_init_done(struct saa7146_dev* dev)
371 vm.out = 13; 377 vm.out = 13;
372 mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm); 378 mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm);
373 379
374 /* tune in some frequency on tuner */
375 mxb->tuner->driver->command(mxb->tuner, VIDIOCSFREQ, &freq);
376
377 /* the rest for mxb */ 380 /* the rest for mxb */
378 mxb->cur_input = 0; 381 mxb->cur_input = 0;
379 mxb->cur_freq = freq;
380 mxb->cur_mute = 1; 382 mxb->cur_mute = 1;
381 383
382 mxb->cur_mode = V4L2_TUNER_MODE_STEREO; 384 mxb->cur_mode = V4L2_TUNER_MODE_STEREO;
@@ -819,18 +821,14 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
819 return -EINVAL; 821 return -EINVAL;
820 } 822 }
821 823
822 memset(f,0,sizeof(*f)); 824 *f = mxb->cur_freq;
823 f->type = V4L2_TUNER_ANALOG_TV;
824 f->frequency = mxb->cur_freq;
825 825
826 DEB_EE(("VIDIOC_G_FREQ: freq:0x%08x.\n", mxb->cur_freq)); 826 DEB_EE(("VIDIOC_G_FREQ: freq:0x%08x.\n", mxb->cur_freq.frequency));
827 return 0; 827 return 0;
828 } 828 }
829 case VIDIOC_S_FREQUENCY: 829 case VIDIOC_S_FREQUENCY:
830 { 830 {
831 struct v4l2_frequency *f = arg; 831 struct v4l2_frequency *f = arg;
832 int t_locked = 0;
833 int v_byte = 0;
834 832
835 if (0 != f->tuner) 833 if (0 != f->tuner)
836 return -EINVAL; 834 return -EINVAL;
@@ -843,20 +841,11 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
843 return -EINVAL; 841 return -EINVAL;
844 } 842 }
845 843
846 DEB_EE(("VIDIOC_S_FREQUENCY: freq:0x%08x.\n",f->frequency)); 844 mxb->cur_freq = *f;
847 845 DEB_EE(("VIDIOC_S_FREQUENCY: freq:0x%08x.\n", mxb->cur_freq.frequency));
848 mxb->cur_freq = f->frequency;
849 846
850 /* tune in desired frequency */ 847 /* tune in desired frequency */
851 mxb->tuner->driver->command(mxb->tuner, VIDIOCSFREQ, &mxb->cur_freq); 848 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_FREQUENCY, &mxb->cur_freq);
852
853 /* check if pll of tuner & saa7111a is locked */
854// mxb->tuner->driver->command(mxb->tuner,TUNER_IS_LOCKED, &t_locked);
855 mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_GET_STATUS, &v_byte);
856
857 /* not locked -- anything to do here ? */
858 if( 0 == t_locked || 0 == (v_byte & DECODER_STATUS_GOOD)) {
859 }
860 849
861 /* hack: changing the frequency should invalidate the vbi-counter (=> alevt) */ 850 /* hack: changing the frequency should invalidate the vbi-counter (=> alevt) */
862 spin_lock(&dev->slock); 851 spin_lock(&dev->slock);
diff --git a/drivers/media/video/saa7134/Makefile b/drivers/media/video/saa7134/Makefile
index e577a06b136b..b778ffd94e65 100644
--- a/drivers/media/video/saa7134/Makefile
+++ b/drivers/media/video/saa7134/Makefile
@@ -9,3 +9,9 @@ obj-$(CONFIG_VIDEO_SAA7134_DVB) += saa7134-dvb.o
9EXTRA_CFLAGS += -I$(src)/.. 9EXTRA_CFLAGS += -I$(src)/..
10EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core 10EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core
11EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends 11EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends
12ifneq ($(CONFIG_DVB_MT352),n)
13 EXTRA_CFLAGS += -DHAVE_MT352=1
14endif
15ifneq ($(CONFIG_DVB_TDA1004X),n)
16 EXTRA_CFLAGS += -DHAVE_TDA1004X=1
17endif
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 334bc1850092..8be6a90358c8 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: saa7134-dvb.c,v 1.18 2005/07/04 16:05:50 mkrufky Exp $ 2 * $Id: saa7134-dvb.c,v 1.23 2005/07/24 22:12:47 mkrufky Exp $
3 * 3 *
4 * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] 4 * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
5 * 5 *
@@ -29,18 +29,17 @@
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/kthread.h> 30#include <linux/kthread.h>
31#include <linux/suspend.h> 31#include <linux/suspend.h>
32#include <linux/config.h>
32 33
33#define CONFIG_DVB_MT352 1
34#define CONFIG_DVB_TDA1004X 1
35 34
36#include "saa7134-reg.h" 35#include "saa7134-reg.h"
37#include "saa7134.h" 36#include "saa7134.h"
38 37
39#if CONFIG_DVB_MT352 38#ifdef HAVE_MT352
40# include "mt352.h" 39# include "mt352.h"
41# include "mt352_priv.h" /* FIXME */ 40# include "mt352_priv.h" /* FIXME */
42#endif 41#endif
43#if CONFIG_DVB_TDA1004X 42#ifdef HAVE_TDA1004X
44# include "tda1004x.h" 43# include "tda1004x.h"
45#endif 44#endif
46 45
@@ -54,7 +53,7 @@ MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)");
54 53
55/* ------------------------------------------------------------------ */ 54/* ------------------------------------------------------------------ */
56 55
57#if CONFIG_DVB_MT352 56#ifdef HAVE_MT352
58static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) 57static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on)
59{ 58{
60 u32 ok; 59 u32 ok;
@@ -153,7 +152,7 @@ static struct mt352_config pinnacle_300i = {
153 152
154/* ------------------------------------------------------------------ */ 153/* ------------------------------------------------------------------ */
155 154
156#if CONFIG_DVB_TDA1004X 155#ifdef HAVE_TDA1004X
157static int philips_tu1216_pll_init(struct dvb_frontend *fe) 156static int philips_tu1216_pll_init(struct dvb_frontend *fe)
158{ 157{
159 struct saa7134_dev *dev = fe->dvb->priv; 158 struct saa7134_dev *dev = fe->dvb->priv;
@@ -385,7 +384,7 @@ static int philips_fmd1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_
385 return 0; 384 return 0;
386} 385}
387 386
388 387#ifdef HAVE_TDA1004X
389static struct tda1004x_config medion_cardbus = { 388static struct tda1004x_config medion_cardbus = {
390 .demod_address = 0x08, 389 .demod_address = 0x08,
391 .invert = 1, 390 .invert = 1,
@@ -398,6 +397,7 @@ static struct tda1004x_config medion_cardbus = {
398 .pll_sleep = philips_fmd1216_analog, 397 .pll_sleep = philips_fmd1216_analog,
399 .request_firmware = NULL, 398 .request_firmware = NULL,
400}; 399};
400#endif
401 401
402/* ------------------------------------------------------------------ */ 402/* ------------------------------------------------------------------ */
403 403
@@ -547,14 +547,14 @@ static int dvb_init(struct saa7134_dev *dev)
547 dev); 547 dev);
548 548
549 switch (dev->board) { 549 switch (dev->board) {
550#if CONFIG_DVB_MT352 550#ifdef HAVE_MT352
551 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: 551 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
552 printk("%s: pinnacle 300i dvb setup\n",dev->name); 552 printk("%s: pinnacle 300i dvb setup\n",dev->name);
553 dev->dvb.frontend = mt352_attach(&pinnacle_300i, 553 dev->dvb.frontend = mt352_attach(&pinnacle_300i,
554 &dev->i2c_adap); 554 &dev->i2c_adap);
555 break; 555 break;
556#endif 556#endif
557#if CONFIG_DVB_TDA1004X 557#ifdef HAVE_TDA1004X
558 case SAA7134_BOARD_MD7134: 558 case SAA7134_BOARD_MD7134:
559 dev->dvb.frontend = tda10046_attach(&medion_cardbus, 559 dev->dvb.frontend = tda10046_attach(&medion_cardbus,
560 &dev->i2c_adap); 560 &dev->i2c_adap);
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c
index b53c748caf2a..4d27ac1b7fb8 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.18 2005/07/07 03:02:55 mchehab Exp $ 5 * $Id: tea5767.c,v 1.21 2005/07/14 03:06:43 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
@@ -153,17 +153,17 @@ static void tea5767_status_dump(unsigned char *buffer)
153 153
154 switch (TEA5767_HIGH_LO_32768) { 154 switch (TEA5767_HIGH_LO_32768) {
155 case TEA5767_HIGH_LO_13MHz: 155 case TEA5767_HIGH_LO_13MHz:
156 frq = 1000 * (div * 50 - 700 - 225) / 4; /* Freq in KHz */ 156 frq = (div * 50000 - 700000 - 225000) / 4; /* Freq in KHz */
157 break; 157 break;
158 case TEA5767_LOW_LO_13MHz: 158 case TEA5767_LOW_LO_13MHz:
159 frq = 1000 * (div * 50 + 700 + 225) / 4; /* Freq in KHz */ 159 frq = (div * 50000 + 700000 + 225000) / 4; /* Freq in KHz */
160 break; 160 break;
161 case TEA5767_LOW_LO_32768: 161 case TEA5767_LOW_LO_32768:
162 frq = 1000 * (div * 32768 / 1000 + 700 + 225) / 4; /* Freq in KHz */ 162 frq = (div * 32768 + 700000 + 225000) / 4; /* Freq in KHz */
163 break; 163 break;
164 case TEA5767_HIGH_LO_32768: 164 case TEA5767_HIGH_LO_32768:
165 default: 165 default:
166 frq = 1000 * (div * 32768 / 1000 - 700 - 225) / 4; /* Freq in KHz */ 166 frq = (div * 32768 - 700000 - 225000) / 4; /* Freq in KHz */
167 break; 167 break;
168 } 168 }
169 buffer[0] = (div >> 8) & 0x3f; 169 buffer[0] = (div >> 8) & 0x3f;
@@ -196,7 +196,7 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq)
196 unsigned div; 196 unsigned div;
197 int rc; 197 int rc;
198 198
199 tuner_dbg (PREFIX "radio freq counter %d\n", frq); 199 tuner_dbg (PREFIX "radio freq = %d.%03d MHz\n", frq/16000,(frq/16)%1000);
200 200
201 /* Rounds freq to next decimal value - for 62.5 KHz step */ 201 /* Rounds freq to next decimal value - for 62.5 KHz step */
202 /* frq = 20*(frq/16)+radio_frq[frq%16]; */ 202 /* frq = 20*(frq/16)+radio_frq[frq%16]; */
@@ -224,19 +224,19 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq)
224 tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n"); 224 tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n");
225 buffer[2] |= TEA5767_HIGH_LO_INJECT; 225 buffer[2] |= TEA5767_HIGH_LO_INJECT;
226 buffer[4] |= TEA5767_PLLREF_ENABLE; 226 buffer[4] |= TEA5767_PLLREF_ENABLE;
227 div = (frq * 4 / 16 + 700 + 225 + 25) / 50; 227 div = (frq * 4000 / 16 + 700000 + 225000 + 25000) / 50000;
228 break; 228 break;
229 case TEA5767_LOW_LO_13MHz: 229 case TEA5767_LOW_LO_13MHz:
230 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n"); 230 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n");
231 231
232 buffer[4] |= TEA5767_PLLREF_ENABLE; 232 buffer[4] |= TEA5767_PLLREF_ENABLE;
233 div = (frq * 4 / 16 - 700 - 225 + 25) / 50; 233 div = (frq * 4000 / 16 - 700000 - 225000 + 25000) / 50000;
234 break; 234 break;
235 case TEA5767_LOW_LO_32768: 235 case TEA5767_LOW_LO_32768:
236 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n"); 236 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n");
237 buffer[3] |= TEA5767_XTAL_32768; 237 buffer[3] |= TEA5767_XTAL_32768;
238 /* const 700=4000*175 Khz - to adjust freq to right value */ 238 /* const 700=4000*175 Khz - to adjust freq to right value */
239 div = (1000 * (frq * 4 / 16 - 700 - 225) + 16384) >> 15; 239 div = ((frq * 4000 / 16 - 700000 - 225000) + 16384) >> 15;
240 break; 240 break;
241 case TEA5767_HIGH_LO_32768: 241 case TEA5767_HIGH_LO_32768:
242 default: 242 default:
@@ -244,17 +244,21 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq)
244 244
245 buffer[2] |= TEA5767_HIGH_LO_INJECT; 245 buffer[2] |= TEA5767_HIGH_LO_INJECT;
246 buffer[3] |= TEA5767_XTAL_32768; 246 buffer[3] |= TEA5767_XTAL_32768;
247 div = (1000 * (frq * 4 / 16 + 700 + 225) + 16384) >> 15; 247 div = ((frq * (4000 / 16) + 700000 + 225000) + 16384) >> 15;
248 break; 248 break;
249 } 249 }
250 buffer[0] = (div >> 8) & 0x3f; 250 buffer[0] = (div >> 8) & 0x3f;
251 buffer[1] = div & 0xff; 251 buffer[1] = div & 0xff;
252 252
253 if (tuner_debug)
254 tea5767_status_dump(buffer);
255
256 if (5 != (rc = i2c_master_send(c, buffer, 5))) 253 if (5 != (rc = i2c_master_send(c, buffer, 5)))
257 tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); 254 tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc);
255
256 if (tuner_debug) {
257 if (5 != (rc = i2c_master_recv(c, buffer, 5)))
258 tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc);
259 else
260 tea5767_status_dump(buffer);
261 }
258} 262}
259 263
260static int tea5767_signal(struct i2c_client *c) 264static int tea5767_signal(struct i2c_client *c)
@@ -294,7 +298,7 @@ int tea5767_autodetection(struct i2c_client *c)
294 struct tuner *t = i2c_get_clientdata(c); 298 struct tuner *t = i2c_get_clientdata(c);
295 299
296 if (5 != (rc = i2c_master_recv(c, buffer, 5))) { 300 if (5 != (rc = i2c_master_recv(c, buffer, 5))) {
297 tuner_warn("it is not a TEA5767. Received %i chars.\n", rc); 301 tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc);
298 return EINVAL; 302 return EINVAL;
299 } 303 }
300 304
@@ -310,11 +314,11 @@ int tea5767_autodetection(struct i2c_client *c)
310 * bit 0 : internally set to 0 314 * bit 0 : internally set to 0
311 * Byte 5: bit 7:0 : == 0 315 * Byte 5: bit 7:0 : == 0
312 */ 316 */
313
314 if (!((buffer[3] & 0x0f) == 0x00) && (buffer[4] == 0x00)) { 317 if (!((buffer[3] & 0x0f) == 0x00) && (buffer[4] == 0x00)) {
315 tuner_warn("Chip ID is not zero. It is not a TEA5767\n"); 318 tuner_warn("Chip ID is not zero. It is not a TEA5767\n");
316 return EINVAL; 319 return EINVAL;
317 } 320 }
321
318 tuner_warn("TEA5767 detected.\n"); 322 tuner_warn("TEA5767 detected.\n");
319 return 0; 323 return 0;
320} 324}
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index de190630babb..b25a9c08ac02 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.55 2005/07/08 13:20:33 mchehab Exp $ 2 * $Id: tuner-core.c,v 1.58 2005/07/14 03:06:43 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
@@ -39,6 +39,9 @@ I2C_CLIENT_INSMOD;
39static unsigned int addr = 0; 39static unsigned int addr = 0;
40module_param(addr, int, 0444); 40module_param(addr, int, 0444);
41 41
42static unsigned int no_autodetect = 0;
43module_param(no_autodetect, int, 0444);
44
42/* insmod options used at runtime => read/write */ 45/* insmod options used at runtime => read/write */
43unsigned int tuner_debug = 0; 46unsigned int tuner_debug = 0;
44module_param(tuner_debug, int, 0644); 47module_param(tuner_debug, int, 0644);
@@ -318,17 +321,19 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
318 tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name); 321 tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name);
319 322
320 /* TEA5767 autodetection code - only for addr = 0xc0 */ 323 /* TEA5767 autodetection code - only for addr = 0xc0 */
321 if (addr == 0x60) { 324 if (!no_autodetect) {
322 if (tea5767_autodetection(&t->i2c) != EINVAL) { 325 if (addr == 0x60) {
323 t->type = TUNER_TEA5767; 326 if (tea5767_autodetection(&t->i2c) != EINVAL) {
324 t->mode_mask = T_RADIO; 327 t->type = TUNER_TEA5767;
325 t->mode = T_STANDBY; 328 t->mode_mask = T_RADIO;
326 t->freq = 87.5 * 16; /* Sets freq to FM range */ 329 t->mode = T_STANDBY;
327 default_mode_mask &= ~T_RADIO; 330 t->freq = 87.5 * 16; /* Sets freq to FM range */
328 331 default_mode_mask &= ~T_RADIO;
329 i2c_attach_client (&t->i2c); 332
330 set_type(&t->i2c,t->type, t->mode_mask); 333 i2c_attach_client (&t->i2c);
331 return 0; 334 set_type(&t->i2c,t->type, t->mode_mask);
335 return 0;
336 }
332 } 337 }
333 } 338 }
334 339
@@ -631,7 +636,9 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
631 break; 636 break;
632 } 637 }
633 default: 638 default:
634 tuner_dbg("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd); 639 tuner_dbg("Unimplemented IOCTL 0x%08x(dir=%d,tp=0x%02x,nr=%d,sz=%d)\n",
640 cmd, _IOC_DIR(cmd), _IOC_TYPE(cmd),
641 _IOC_NR(cmd), _IOC_SIZE(cmd));
635 break; 642 break;
636 } 643 }
637 644
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index d8b78f1d686b..f42a1efa8fcf 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -285,6 +285,7 @@ static int chip_thread(void *data)
285 schedule(); 285 schedule();
286 } 286 }
287 remove_wait_queue(&chip->wq, &wait); 287 remove_wait_queue(&chip->wq, &wait);
288 try_to_freeze();
288 if (chip->done || signal_pending(current)) 289 if (chip->done || signal_pending(current))
289 break; 290 break;
290 dprintk("%s: thread wakeup\n", i2c_clientname(&chip->c)); 291 dprintk("%s: thread wakeup\n", i2c_clientname(&chip->c));
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index e8d9440977cb..62b03ef091e0 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -445,6 +445,7 @@ int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len)
445} 445}
446EXPORT_SYMBOL(tveeprom_read); 446EXPORT_SYMBOL(tveeprom_read);
447 447
448#if 0
448int tveeprom_dump(unsigned char *eedata, int len) 449int tveeprom_dump(unsigned char *eedata, int len)
449{ 450{
450 int i; 451 int i;
@@ -460,6 +461,7 @@ int tveeprom_dump(unsigned char *eedata, int len)
460 return 0; 461 return 0;
461} 462}
462EXPORT_SYMBOL(tveeprom_dump); 463EXPORT_SYMBOL(tveeprom_dump);
464#endif /* 0 */
463 465
464/* ----------------------------------------------------------------------- */ 466/* ----------------------------------------------------------------------- */
465/* needed for ivtv.sf.net at the moment. Should go away in the long */ 467/* needed for ivtv.sf.net at the moment. Should go away in the long */
@@ -477,7 +479,7 @@ static unsigned short normal_i2c[] = {
477 479
478I2C_CLIENT_INSMOD; 480I2C_CLIENT_INSMOD;
479 481
480struct i2c_driver i2c_driver_tveeprom; 482static struct i2c_driver i2c_driver_tveeprom;
481 483
482static int 484static int
483tveeprom_command(struct i2c_client *client, 485tveeprom_command(struct i2c_client *client,
@@ -549,7 +551,7 @@ tveeprom_detach_client (struct i2c_client *client)
549 return 0; 551 return 0;
550} 552}
551 553
552struct i2c_driver i2c_driver_tveeprom = { 554static struct i2c_driver i2c_driver_tveeprom = {
553 .owner = THIS_MODULE, 555 .owner = THIS_MODULE,
554 .name = "tveeprom", 556 .name = "tveeprom",
555 .id = I2C_DRIVERID_TVEEPROM, 557 .id = I2C_DRIVERID_TVEEPROM,