diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-11-05 07:07:13 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:02:01 -0500 |
commit | 80b522085a2c870ba0c0bdf2415cc925d7c86ca5 (patch) | |
tree | efcf9cc4690afb00c636c100ad15aec85baa5a82 /drivers | |
parent | f8b6030ccca06bf0d45d9b0908caac9b624a9beb (diff) |
V4L/DVB (6561): Fix xc2028 get register functions and calls
The status registers require a dword for setting register. Fix it on all
occurrences, and at xc3028_get_reg. Also, improves the hardware/firmware
detection printk.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/tuner-xc2028.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/media/video/tuner-xc2028.c b/drivers/media/video/tuner-xc2028.c index b4c88ed12a8a..ecfc39036f90 100644 --- a/drivers/media/video/tuner-xc2028.c +++ b/drivers/media/video/tuner-xc2028.c | |||
@@ -91,16 +91,17 @@ struct xc2028_data { | |||
91 | msleep(10); \ | 91 | msleep(10); \ |
92 | } while (0) | 92 | } while (0) |
93 | 93 | ||
94 | static int xc2028_get_reg(struct xc2028_data *priv, u16 reg) | 94 | static unsigned int xc2028_get_reg(struct xc2028_data *priv, u16 reg) |
95 | { | 95 | { |
96 | int rc; | 96 | int rc; |
97 | unsigned char buf[2]; | 97 | unsigned char buf[2]; |
98 | 98 | ||
99 | tuner_info("%s called\n", __FUNCTION__); | 99 | tuner_info("%s called\n", __FUNCTION__); |
100 | 100 | ||
101 | buf[0] = reg; | 101 | buf[0] = reg>>8; |
102 | buf[1] = (unsigned char) reg; | ||
102 | 103 | ||
103 | i2c_send(rc, priv, buf, 1); | 104 | i2c_send(rc, priv, buf, 2); |
104 | if (rc < 0) | 105 | if (rc < 0) |
105 | return rc; | 106 | return rc; |
106 | 107 | ||
@@ -372,7 +373,7 @@ static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode, | |||
372 | v4l2_std_id std, fe_bandwidth_t bandwidth) | 373 | v4l2_std_id std, fe_bandwidth_t bandwidth) |
373 | { | 374 | { |
374 | struct xc2028_data *priv = fe->tuner_priv; | 375 | struct xc2028_data *priv = fe->tuner_priv; |
375 | int rc, version; | 376 | int rc, version, hwmodel; |
376 | v4l2_std_id std0 = 0; | 377 | v4l2_std_id std0 = 0; |
377 | unsigned int type0 = 0, type = 0; | 378 | unsigned int type0 = 0, type = 0; |
378 | int change_digital_bandwidth; | 379 | int change_digital_bandwidth; |
@@ -484,9 +485,13 @@ static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode, | |||
484 | if (rc < 0) | 485 | if (rc < 0) |
485 | return rc; | 486 | return rc; |
486 | 487 | ||
487 | version = xc2028_get_reg(priv, 0x4); | 488 | version = xc2028_get_reg(priv, 0x0004); |
488 | tuner_info("Firmware version is %d.%d\n", | 489 | hwmodel = xc2028_get_reg(priv, 0x0008); |
489 | (version >> 4) & 0x0f, (version) & 0x0f); | 490 | |
491 | tuner_info("Device is Xceive %d version %d.%d, " | ||
492 | "firmware version %d.%d\n", | ||
493 | hwmodel, (version & 0xf000) >> 12, (version & 0xf00) >> 8, | ||
494 | (version & 0xf0) >> 4, version & 0xf); | ||
490 | 495 | ||
491 | priv->firm_type = std; | 496 | priv->firm_type = std; |
492 | 497 | ||
@@ -504,13 +509,15 @@ static int xc2028_signal(struct dvb_frontend *fe, u16 *strength) | |||
504 | 509 | ||
505 | *strength = 0; | 510 | *strength = 0; |
506 | 511 | ||
507 | frq_lock = xc2028_get_reg(priv, 0x2); | 512 | /* Sync Lock Indicator */ |
513 | frq_lock = xc2028_get_reg(priv, 0x0002); | ||
508 | if (frq_lock <= 0) | 514 | if (frq_lock <= 0) |
509 | goto ret; | 515 | goto ret; |
510 | 516 | ||
511 | /* Frequency is locked. Return signal quality */ | 517 | /* Frequency is locked. Return signal quality */ |
512 | 518 | ||
513 | signal = xc2028_get_reg(priv, 0x40); | 519 | /* Get SNR of the video signal */ |
520 | signal = xc2028_get_reg(priv, 0x0040); | ||
514 | 521 | ||
515 | if (signal <= 0) | 522 | if (signal <= 0) |
516 | signal = frq_lock; | 523 | signal = frq_lock; |