diff options
author | Michael Krufky <mkrufky@m1k.net> | 2005-07-07 20:58:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-07 21:24:04 -0400 |
commit | 08d805258f69bff5ba8268a969f140ef1f105c71 (patch) | |
tree | 489c26e578ad005f0c3f3842f9e9dc3dd117b0b5 | |
parent | 0d723c09f03e0b2cb4405c361c927efac373fe0c (diff) |
[PATCH] v4l: LGDT3302 read status fix
- Fix bug in lgdt3302_read_status to return correct
FE_HAS_SIGNAL and FS_HAS_CARRIER status.
- Removed #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10).
Signed-off-by: Mac Michaels <wmichaels1@earthlink.net>
Signed-off-by: Michael Krufky <mkrufky@m1k.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/media/dvb/frontends/lgdt3302.c | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/drivers/media/dvb/frontends/lgdt3302.c b/drivers/media/dvb/frontends/lgdt3302.c index d0b91219cf6e..09c914256e49 100644 --- a/drivers/media/dvb/frontends/lgdt3302.c +++ b/drivers/media/dvb/frontends/lgdt3302.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: lgdt3302.c,v 1.2 2005/06/28 23:50:48 mkrufky Exp $ | 2 | * $Id: lgdt3302.c,v 1.5 2005/07/07 03:47:15 mkrufky Exp $ |
3 | * | 3 | * |
4 | * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM | 4 | * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM |
5 | * | 5 | * |
@@ -34,7 +34,6 @@ | |||
34 | * | 34 | * |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include <linux/version.h> | ||
38 | #include <linux/kernel.h> | 37 | #include <linux/kernel.h> |
39 | #include <linux/module.h> | 38 | #include <linux/module.h> |
40 | #include <linux/moduleparam.h> | 39 | #include <linux/moduleparam.h> |
@@ -208,8 +207,6 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe, | |||
208 | struct lgdt3302_state* state = | 207 | struct lgdt3302_state* state = |
209 | (struct lgdt3302_state*) fe->demodulator_priv; | 208 | (struct lgdt3302_state*) fe->demodulator_priv; |
210 | 209 | ||
211 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10) | ||
212 | |||
213 | /* Use 50MHz parameter values from spec sheet since xtal is 50 */ | 210 | /* Use 50MHz parameter values from spec sheet since xtal is 50 */ |
214 | static u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 }; | 211 | static u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 }; |
215 | static u8 vsb_freq_cfg[] = { VSB_CARRIER_FREQ0, 0x00, 0x87, 0x8e, 0x01 }; | 212 | static u8 vsb_freq_cfg[] = { VSB_CARRIER_FREQ0, 0x00, 0x87, 0x8e, 0x01 }; |
@@ -301,9 +298,6 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe, | |||
301 | lgdt3302_SwReset(state); | 298 | lgdt3302_SwReset(state); |
302 | state->current_modulation = param->u.vsb.modulation; | 299 | state->current_modulation = param->u.vsb.modulation; |
303 | } | 300 | } |
304 | #else | ||
305 | printk("lgdt3302: %s: you need a newer kernel for this, sorry\n",__FUNCTION__); | ||
306 | #endif | ||
307 | 301 | ||
308 | /* Change only if we are actually changing the channel */ | 302 | /* Change only if we are actually changing the channel */ |
309 | if (state->current_frequency != param->frequency) { | 303 | if (state->current_frequency != param->frequency) { |
@@ -352,11 +346,28 @@ static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
352 | * This is done in SwReset(); | 346 | * This is done in SwReset(); |
353 | */ | 347 | */ |
354 | 348 | ||
349 | /* AGC status register */ | ||
350 | i2c_selectreadbytes(state, AGC_STATUS, buf, 1); | ||
351 | dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]); | ||
352 | if ((buf[0] & 0x0c) == 0x8){ | ||
353 | /* Test signal does not exist flag */ | ||
354 | /* as well as the AGC lock flag. */ | ||
355 | *status |= FE_HAS_SIGNAL; | ||
356 | } else { | ||
357 | /* Without a signal all other status bits are meaningless */ | ||
358 | return 0; | ||
359 | } | ||
360 | |||
355 | /* signal status */ | 361 | /* signal status */ |
356 | i2c_selectreadbytes(state, TOP_CONTROL, buf, sizeof(buf)); | 362 | i2c_selectreadbytes(state, TOP_CONTROL, buf, sizeof(buf)); |
357 | dprintk("%s: TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n", __FUNCTION__, buf[0], buf[1], buf[2]); | 363 | dprintk("%s: TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n", __FUNCTION__, buf[0], buf[1], buf[2]); |
364 | |||
365 | #if 0 | ||
366 | /* Alternative method to check for a signal */ | ||
367 | /* using the SNR good/bad interrupts. */ | ||
358 | if ((buf[2] & 0x30) == 0x10) | 368 | if ((buf[2] & 0x30) == 0x10) |
359 | *status |= FE_HAS_SIGNAL; | 369 | *status |= FE_HAS_SIGNAL; |
370 | #endif | ||
360 | 371 | ||
361 | /* sync status */ | 372 | /* sync status */ |
362 | if ((buf[2] & 0x03) == 0x01) { | 373 | if ((buf[2] & 0x03) == 0x01) { |
@@ -369,17 +380,6 @@ static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
369 | *status |= FE_HAS_VITERBI; | 380 | *status |= FE_HAS_VITERBI; |
370 | } | 381 | } |
371 | 382 | ||
372 | #if 0 | ||
373 | /* Alternative method to check for a signal */ | ||
374 | /* AGC status register */ | ||
375 | i2c_selectreadbytes(state, AGC_STATUS, buf, 1); | ||
376 | dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]); | ||
377 | if ((buf[0] & 0x0c) == 0x80) /* Test signal does not exist flag */ | ||
378 | /* Test AGC lock flag */ | ||
379 | *status |= FE_HAS_SIGNAL; | ||
380 | else | ||
381 | return 0; | ||
382 | |||
383 | /* Carrier Recovery Lock Status Register */ | 383 | /* Carrier Recovery Lock Status Register */ |
384 | i2c_selectreadbytes(state, CARRIER_LOCK, buf, 1); | 384 | i2c_selectreadbytes(state, CARRIER_LOCK, buf, 1); |
385 | dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]); | 385 | dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]); |
@@ -389,21 +389,14 @@ static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
389 | /* Need to undestand why there are 3 lock levels here */ | 389 | /* Need to undestand why there are 3 lock levels here */ |
390 | if ((buf[0] & 0x07) == 0x07) | 390 | if ((buf[0] & 0x07) == 0x07) |
391 | *status |= FE_HAS_CARRIER; | 391 | *status |= FE_HAS_CARRIER; |
392 | else | ||
393 | return 0; | ||
394 | break; | 392 | break; |
395 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10) | ||
396 | case VSB_8: | 393 | case VSB_8: |
397 | if ((buf[0] & 0x80) == 0x80) | 394 | if ((buf[0] & 0x80) == 0x80) |
398 | *status |= FE_HAS_CARRIER; | 395 | *status |= FE_HAS_CARRIER; |
399 | else | ||
400 | return 0; | ||
401 | break; | 396 | break; |
402 | #endif | ||
403 | default: | 397 | default: |
404 | printk("KERN_WARNING lgdt3302: %s: Modulation set to unsupported value\n", __FUNCTION__); | 398 | printk("KERN_WARNING lgdt3302: %s: Modulation set to unsupported value\n", __FUNCTION__); |
405 | } | 399 | } |
406 | #endif | ||
407 | 400 | ||
408 | return 0; | 401 | return 0; |
409 | } | 402 | } |