diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/frontends/lgdt3302.c | 68 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/lgdt3302.h | 7 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-dvb.c | 34 |
3 files changed, 55 insertions, 54 deletions
diff --git a/drivers/media/dvb/frontends/lgdt3302.c b/drivers/media/dvb/frontends/lgdt3302.c index c85a2a99df42..136563606fb1 100644 --- a/drivers/media/dvb/frontends/lgdt3302.c +++ b/drivers/media/dvb/frontends/lgdt3302.c | |||
@@ -74,11 +74,14 @@ static int i2c_writebytes (struct lgdt3302_state* state, | |||
74 | u8 *buf, /* data bytes to send */ | 74 | u8 *buf, /* data bytes to send */ |
75 | int len /* number of bytes to send */ ) | 75 | int len /* number of bytes to send */ ) |
76 | { | 76 | { |
77 | if (addr == state->config->pll_address) { | 77 | u8 tmp[] = { buf[0], buf[1] }; |
78 | struct i2c_msg msg = | 78 | struct i2c_msg msg = |
79 | { .addr = addr, .flags = 0, .buf = buf, .len = len }; | 79 | { .addr = addr, .flags = 0, .buf = tmp, .len = 2 }; |
80 | int err; | 80 | int err; |
81 | int i; | ||
81 | 82 | ||
83 | for (i=1; i<len; i++) { | ||
84 | tmp[1] = buf[i]; | ||
82 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | 85 | 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); | 86 | printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err); |
84 | if (err < 0) | 87 | if (err < 0) |
@@ -86,27 +89,11 @@ static int i2c_writebytes (struct lgdt3302_state* state, | |||
86 | else | 89 | else |
87 | return -EREMOTEIO; | 90 | return -EREMOTEIO; |
88 | } | 91 | } |
89 | } else { | 92 | 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 | } | 93 | } |
108 | return 0; | 94 | return 0; |
109 | } | 95 | } |
96 | |||
110 | static int i2c_readbytes (struct lgdt3302_state* state, | 97 | static int i2c_readbytes (struct lgdt3302_state* state, |
111 | u8 addr, /* demod_address or pll_address */ | 98 | u8 addr, /* demod_address or pll_address */ |
112 | u8 *buf, /* holds data bytes read */ | 99 | u8 *buf, /* holds data bytes read */ |
@@ -207,7 +194,6 @@ static int lgdt3302_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
207 | static int lgdt3302_set_parameters(struct dvb_frontend* fe, | 194 | static int lgdt3302_set_parameters(struct dvb_frontend* fe, |
208 | struct dvb_frontend_parameters *param) | 195 | struct dvb_frontend_parameters *param) |
209 | { | 196 | { |
210 | u8 buf[4]; | ||
211 | struct lgdt3302_state* state = | 197 | struct lgdt3302_state* state = |
212 | (struct lgdt3302_state*) fe->demodulator_priv; | 198 | (struct lgdt3302_state*) fe->demodulator_priv; |
213 | 199 | ||
@@ -290,16 +276,30 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe, | |||
290 | 276 | ||
291 | /* Change only if we are actually changing the channel */ | 277 | /* Change only if we are actually changing the channel */ |
292 | if (state->current_frequency != param->frequency) { | 278 | if (state->current_frequency != param->frequency) { |
293 | dvb_pll_configure(state->config->pll_desc, buf, | 279 | u8 buf[5]; |
294 | param->frequency, 0); | ||
295 | dprintk("%s: tuner bytes: 0x%02x 0x%02x " | ||
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 | 280 | ||
299 | /* Check the status of the tuner pll */ | 281 | /* This must be done before the initialized msg is declared */ |
300 | i2c_readbytes(state, state->config->pll_address, buf, 1); | 282 | state->config->pll_set(fe, param, buf); |
301 | dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]); | 283 | |
284 | struct i2c_msg msg = | ||
285 | { .addr = buf[0], .flags = 0, .buf = &buf[1], .len = 4 }; | ||
286 | int err; | ||
302 | 287 | ||
288 | dprintk("%s: tuner at 0x%02x bytes: 0x%02x 0x%02x " | ||
289 | "0x%02x 0x%02x\n", __FUNCTION__, | ||
290 | buf[0],buf[1],buf[2],buf[3],buf[4]); | ||
291 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | ||
292 | printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err = %i)\n", __FUNCTION__, buf[0], buf[1], err); | ||
293 | if (err < 0) | ||
294 | return err; | ||
295 | else | ||
296 | return -EREMOTEIO; | ||
297 | } | ||
298 | #if 0 | ||
299 | /* Check the status of the tuner pll */ | ||
300 | i2c_readbytes(state, buf[0], &buf[1], 1); | ||
301 | dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[1]); | ||
302 | #endif | ||
303 | /* Update current frequency */ | 303 | /* Update current frequency */ |
304 | state->current_frequency = param->frequency; | 304 | state->current_frequency = param->frequency; |
305 | } | 305 | } |
@@ -322,12 +322,6 @@ static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
322 | 322 | ||
323 | *status = 0; /* Reset status result */ | 323 | *status = 0; /* Reset status result */ |
324 | 324 | ||
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 | /* | 325 | /* |
332 | * You must set the Mask bits to 1 in the IRQ_MASK in order | 326 | * 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. | 327 | * to see that status bit in the IRQ_STATUS register. |
diff --git a/drivers/media/dvb/frontends/lgdt3302.h b/drivers/media/dvb/frontends/lgdt3302.h index 81587a40032b..327c47e598a2 100644 --- a/drivers/media/dvb/frontends/lgdt3302.h +++ b/drivers/media/dvb/frontends/lgdt3302.h | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: lgdt3302.h,v 1.2 2005/06/28 23:50:48 mkrufky Exp $ | ||
3 | * | ||
4 | * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM | 2 | * 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> |
@@ -30,8 +28,9 @@ struct lgdt3302_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_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pll_address); | ||
35 | 34 | ||
36 | /* Need to set device param for start_dma */ | 35 | /* Need to set device param for start_dma */ |
37 | int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); | 36 | int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); |
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 6ad1458ab652..3a8551a02d0c 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.42 2005/07/12 15:44:55 mkrufky Exp $ | 2 | * $Id: cx88-dvb.c,v 1.47 2005/07/20 05:20:37 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 |
@@ -211,6 +211,18 @@ static struct or51132_config pchdtv_hd3000 = { | |||
211 | #endif | 211 | #endif |
212 | 212 | ||
213 | #if CONFIG_DVB_LGDT3302 | 213 | #if CONFIG_DVB_LGDT3302 |
214 | static int lgdt3302_pll_set(struct dvb_frontend* fe, | ||
215 | struct dvb_frontend_parameters* params, | ||
216 | u8* pllbuf) | ||
217 | { | ||
218 | struct cx8802_dev *dev= fe->dvb->priv; | ||
219 | |||
220 | pllbuf[0] = dev->core->pll_addr; | ||
221 | dvb_pll_configure(dev->core->pll_desc, &pllbuf[1], | ||
222 | params->frequency, 0); | ||
223 | return 0; | ||
224 | } | ||
225 | |||
214 | static int lgdt3302_set_ts_param(struct dvb_frontend* fe, int is_punctured) | 226 | static int lgdt3302_set_ts_param(struct dvb_frontend* fe, int is_punctured) |
215 | { | 227 | { |
216 | struct cx8802_dev *dev= fe->dvb->priv; | 228 | struct cx8802_dev *dev= fe->dvb->priv; |
@@ -221,17 +233,9 @@ static int lgdt3302_set_ts_param(struct dvb_frontend* fe, int is_punctured) | |||
221 | return 0; | 233 | return 0; |
222 | } | 234 | } |
223 | 235 | ||
224 | static struct lgdt3302_config fusionhdtv_3_gold_q = { | 236 | static struct lgdt3302_config fusionhdtv_3_gold = { |
225 | .demod_address = 0x0e, | ||
226 | .pll_address = 0x61, | ||
227 | .pll_desc = &dvb_pll_microtune_4042, | ||
228 | .set_ts_params = lgdt3302_set_ts_param, | ||
229 | }; | ||
230 | |||
231 | static struct lgdt3302_config fusionhdtv_3_gold_t = { | ||
232 | .demod_address = 0x0e, | 237 | .demod_address = 0x0e, |
233 | .pll_address = 0x61, | 238 | .pll_set = lgdt3302_pll_set, |
234 | .pll_desc = &dvb_pll_thomson_dtt7611, | ||
235 | .set_ts_params = lgdt3302_set_ts_param, | 239 | .set_ts_params = lgdt3302_set_ts_param, |
236 | }; | 240 | }; |
237 | #endif | 241 | #endif |
@@ -294,7 +298,9 @@ static int dvb_register(struct cx8802_dev *dev) | |||
294 | mdelay(100); | 298 | mdelay(100); |
295 | cx_set(MO_GP0_IO, 9); // ANT connector too FIXME | 299 | cx_set(MO_GP0_IO, 9); // ANT connector too FIXME |
296 | mdelay(200); | 300 | mdelay(200); |
297 | dev->dvb.frontend = lgdt3302_attach(&fusionhdtv_3_gold_q, | 301 | dev->core->pll_addr = 0x61; |
302 | dev->core->pll_desc = &dvb_pll_microtune_4042; | ||
303 | dev->dvb.frontend = lgdt3302_attach(&fusionhdtv_3_gold, | ||
298 | &dev->core->i2c_adap); | 304 | &dev->core->i2c_adap); |
299 | } | 305 | } |
300 | break; | 306 | break; |
@@ -308,7 +314,9 @@ static int dvb_register(struct cx8802_dev *dev) | |||
308 | mdelay(100); | 314 | mdelay(100); |
309 | cx_set(MO_GP0_IO, 9); /* ANT connector too FIXME */ | 315 | cx_set(MO_GP0_IO, 9); /* ANT connector too FIXME */ |
310 | mdelay(200); | 316 | mdelay(200); |
311 | dev->dvb.frontend = lgdt3302_attach(&fusionhdtv_3_gold_t, | 317 | dev->core->pll_addr = 0x61; |
318 | dev->core->pll_desc = &dvb_pll_thomson_dtt7611; | ||
319 | dev->dvb.frontend = lgdt3302_attach(&fusionhdtv_3_gold, | ||
312 | &dev->core->i2c_adap); | 320 | &dev->core->i2c_adap); |
313 | } | 321 | } |
314 | break; | 322 | break; |