aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-07-28 04:30:20 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-07-28 04:30:20 -0400
commit661299d9d0437a0ff72240f3d60016ac3a361a6e (patch)
tree765512576314fc3612b503f182b9ae4e60fcf849 /drivers/media/dvb
parent05caac585f8abd6c0113856bc8858e3ef214d8a6 (diff)
parent41c018b7ecb60b1c2c4d5dee0cd37d32a94c45af (diff)
Merge with Linus' 2.6 tree
Diffstat (limited to 'drivers/media/dvb')
-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)193
-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
6 files changed, 123 insertions, 117 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 c85a2a99df42..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 };
@@ -228,6 +217,10 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe,
228 217
229 /* Select VSB mode and serial MPEG interface */ 218 /* Select VSB mode and serial MPEG interface */
230 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);
231 break; 224 break;
232 225
233 case QAM_64: 226 case QAM_64:
@@ -235,6 +228,10 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe,
235 228
236 /* Select QAM_64 mode and serial MPEG interface */ 229 /* Select QAM_64 mode and serial MPEG interface */
237 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);
238 break; 235 break;
239 236
240 case QAM_256: 237 case QAM_256:
@@ -242,9 +239,13 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe,
242 239
243 /* Select QAM_256 mode and serial MPEG interface */ 240 /* Select QAM_256 mode and serial MPEG interface */
244 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);
245 break; 246 break;
246 default: 247 default:
247 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);
248 return -1; 249 return -1;
249 } 250 }
250 /* Initializations common to all modes */ 251 /* Initializations common to all modes */
@@ -290,44 +291,50 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe,
290 291
291 /* Change only if we are actually changing the channel */ 292 /* Change only if we are actually changing the channel */
292 if (state->current_frequency != param->frequency) { 293 if (state->current_frequency != param->frequency) {
293 dvb_pll_configure(state->config->pll_desc, buf, 294 u8 buf[5];
294 param->frequency, 0); 295 struct i2c_msg msg = { .flags = 0, .buf = &buf[1], .len = 4 };
295 dprintk("%s: tuner bytes: 0x%02x 0x%02x " 296 int err;
296 "0x%02x 0x%02x\n", __FUNCTION__, buf[0],buf[1],buf[2],buf[3]);
297 i2c_writebytes(state, state->config->pll_address ,buf, 4);
298 297
299 /* Check the status of the tuner pll */ 298 state->config->pll_set(fe, param, buf);
300 i2c_readbytes(state, state->config->pll_address, buf, 1); 299 msg.addr = buf[0];
301 dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]);
302 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
303 /* Update current frequency */ 316 /* Update current frequency */
304 state->current_frequency = param->frequency; 317 state->current_frequency = param->frequency;
305 } 318 }
306 lgdt3302_SwReset(state); 319 lgdt330x_SwReset(state);
307 return 0; 320 return 0;
308} 321}
309 322
310static int lgdt3302_get_frontend(struct dvb_frontend* fe, 323static int lgdt330x_get_frontend(struct dvb_frontend* fe,
311 struct dvb_frontend_parameters* param) 324 struct dvb_frontend_parameters* param)
312{ 325{
313 struct lgdt3302_state *state = fe->demodulator_priv; 326 struct lgdt330x_state *state = fe->demodulator_priv;
314 param->frequency = state->current_frequency; 327 param->frequency = state->current_frequency;
315 return 0; 328 return 0;
316} 329}
317 330
318static 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)
319{ 332{
320 struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv; 333 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
321 u8 buf[3]; 334 u8 buf[3];
322 335
323 *status = 0; /* Reset status result */ 336 *status = 0; /* Reset status result */
324 337
325 /* Check the status of the tuner pll */
326 i2c_readbytes(state, state->config->pll_address, buf, 1);
327 dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]);
328 if ((buf[0] & 0xc0) != 0x40)
329 return 0; /* Tuner PLL not locked or not powered on */
330
331 /* 338 /*
332 * 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
333 * to see that status bit in the IRQ_STATUS register. 340 * to see that status bit in the IRQ_STATUS register.
@@ -383,19 +390,19 @@ static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status)
383 *status |= FE_HAS_CARRIER; 390 *status |= FE_HAS_CARRIER;
384 break; 391 break;
385 default: 392 default:
386 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__);
387 } 394 }
388 395
389 return 0; 396 return 0;
390} 397}
391 398
392static int lgdt3302_read_signal_strength(struct dvb_frontend* fe, u16* strength) 399static int lgdt330x_read_signal_strength(struct dvb_frontend* fe, u16* strength)
393{ 400{
394 /* not directly available. */ 401 /* not directly available. */
395 return 0; 402 return 0;
396} 403}
397 404
398static int lgdt3302_read_snr(struct dvb_frontend* fe, u16* snr) 405static int lgdt330x_read_snr(struct dvb_frontend* fe, u16* snr)
399{ 406{
400#ifdef SNR_IN_DB 407#ifdef SNR_IN_DB
401 /* 408 /*
@@ -450,7 +457,7 @@ static int lgdt3302_read_snr(struct dvb_frontend* fe, u16* snr)
450 static u8 buf[5];/* read data buffer */ 457 static u8 buf[5];/* read data buffer */
451 static u32 noise; /* noise value */ 458 static u32 noise; /* noise value */
452 static u32 snr_db; /* index into SNR_EQ[] */ 459 static u32 snr_db; /* index into SNR_EQ[] */
453 struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv; 460 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
454 461
455 /* read both equalizer and pase tracker noise data */ 462 /* read both equalizer and pase tracker noise data */
456 i2c_selectreadbytes(state, EQPH_ERR0, buf, sizeof(buf)); 463 i2c_selectreadbytes(state, EQPH_ERR0, buf, sizeof(buf));
@@ -486,7 +493,7 @@ static int lgdt3302_read_snr(struct dvb_frontend* fe, u16* snr)
486 /* Return the raw noise value */ 493 /* Return the raw noise value */
487 static u8 buf[5];/* read data buffer */ 494 static u8 buf[5];/* read data buffer */
488 static u32 noise; /* noise value */ 495 static u32 noise; /* noise value */
489 struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv; 496 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
490 497
491 /* read both equalizer and pase tracker noise data */ 498 /* read both equalizer and pase tracker noise data */
492 i2c_selectreadbytes(state, EQPH_ERR0, buf, sizeof(buf)); 499 i2c_selectreadbytes(state, EQPH_ERR0, buf, sizeof(buf));
@@ -509,7 +516,7 @@ static int lgdt3302_read_snr(struct dvb_frontend* fe, u16* snr)
509 return 0; 516 return 0;
510} 517}
511 518
512static 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)
513{ 520{
514 /* I have no idea about this - it may not be needed */ 521 /* I have no idea about this - it may not be needed */
515 fe_tune_settings->min_delay_ms = 500; 522 fe_tune_settings->min_delay_ms = 500;
@@ -518,22 +525,22 @@ static int lgdt3302_get_tune_settings(struct dvb_frontend* fe, struct dvb_fronte
518 return 0; 525 return 0;
519} 526}
520 527
521static void lgdt3302_release(struct dvb_frontend* fe) 528static void lgdt330x_release(struct dvb_frontend* fe)
522{ 529{
523 struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv; 530 struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
524 kfree(state); 531 kfree(state);
525} 532}
526 533
527static struct dvb_frontend_ops lgdt3302_ops; 534static struct dvb_frontend_ops lgdt330x_ops;
528 535
529struct dvb_frontend* lgdt3302_attach(const struct lgdt3302_config* config, 536struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
530 struct i2c_adapter* i2c) 537 struct i2c_adapter* i2c)
531{ 538{
532 struct lgdt3302_state* state = NULL; 539 struct lgdt330x_state* state = NULL;
533 u8 buf[1]; 540 u8 buf[1];
534 541
535 /* Allocate memory for the internal state */ 542 /* Allocate memory for the internal state */
536 state = (struct lgdt3302_state*) kmalloc(sizeof(struct lgdt3302_state), GFP_KERNEL); 543 state = (struct lgdt330x_state*) kmalloc(sizeof(struct lgdt330x_state), GFP_KERNEL);
537 if (state == NULL) 544 if (state == NULL)
538 goto error; 545 goto error;
539 memset(state,0,sizeof(*state)); 546 memset(state,0,sizeof(*state));
@@ -541,7 +548,7 @@ struct dvb_frontend* lgdt3302_attach(const struct lgdt3302_config* config,
541 /* Setup the state */ 548 /* Setup the state */
542 state->config = config; 549 state->config = config;
543 state->i2c = i2c; 550 state->i2c = i2c;
544 memcpy(&state->ops, &lgdt3302_ops, sizeof(struct dvb_frontend_ops)); 551 memcpy(&state->ops, &lgdt330x_ops, sizeof(struct dvb_frontend_ops));
545 /* Verify communication with demod chip */ 552 /* Verify communication with demod chip */
546 if (i2c_selectreadbytes(state, 2, buf, 1)) 553 if (i2c_selectreadbytes(state, 2, buf, 1))
547 goto error; 554 goto error;
@@ -561,9 +568,9 @@ error:
561 return NULL; 568 return NULL;
562} 569}
563 570
564static struct dvb_frontend_ops lgdt3302_ops = { 571static struct dvb_frontend_ops lgdt330x_ops = {
565 .info = { 572 .info = {
566 .name= "LG Electronics LGDT3302 VSB/QAM Frontend", 573 .name= "LG Electronics lgdt330x VSB/QAM Frontend",
567 .type = FE_ATSC, 574 .type = FE_ATSC,
568 .frequency_min= 54000000, 575 .frequency_min= 54000000,
569 .frequency_max= 858000000, 576 .frequency_max= 858000000,
@@ -573,23 +580,23 @@ static struct dvb_frontend_ops lgdt3302_ops = {
573 .symbol_rate_max = 10762000, 580 .symbol_rate_max = 10762000,
574 .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
575 }, 582 },
576 .init = lgdt3302_init, 583 .init = lgdt330x_init,
577 .set_frontend = lgdt3302_set_parameters, 584 .set_frontend = lgdt330x_set_parameters,
578 .get_frontend = lgdt3302_get_frontend, 585 .get_frontend = lgdt330x_get_frontend,
579 .get_tune_settings = lgdt3302_get_tune_settings, 586 .get_tune_settings = lgdt330x_get_tune_settings,
580 .read_status = lgdt3302_read_status, 587 .read_status = lgdt330x_read_status,
581 .read_ber = lgdt3302_read_ber, 588 .read_ber = lgdt330x_read_ber,
582 .read_signal_strength = lgdt3302_read_signal_strength, 589 .read_signal_strength = lgdt330x_read_signal_strength,
583 .read_snr = lgdt3302_read_snr, 590 .read_snr = lgdt330x_read_snr,
584 .read_ucblocks = lgdt3302_read_ucblocks, 591 .read_ucblocks = lgdt330x_read_ucblocks,
585 .release = lgdt3302_release, 592 .release = lgdt330x_release,
586}; 593};
587 594
588MODULE_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");
589MODULE_AUTHOR("Wilson Michaels"); 596MODULE_AUTHOR("Wilson Michaels");
590MODULE_LICENSE("GPL"); 597MODULE_LICENSE("GPL");
591 598
592EXPORT_SYMBOL(lgdt3302_attach); 599EXPORT_SYMBOL(lgdt330x_attach);
593 600
594/* 601/*
595 * 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: