]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
tea5761 tuner: fix registers utilization
authorEduardo Valentin <eduardo.valentin@indt.org.br>
Tue, 10 Jun 2008 17:42:11 +0000 (13:42 -0400)
committerTony Lindgren <tony@atomide.com>
Mon, 23 Jun 2008 10:42:20 +0000 (13:42 +0300)
Fix registers utilization.
tnctrl register was supposed to be used but it was
right shifted. frqset also was being configured using
incorrect equation.

Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br>
Signed-off-by: Tony Lindgren <tony@atomide.com>
drivers/media/common/tuners/tea5761.c

index e644f7fb15bc7bc2c7f571d84bf684a6f42a8ff6..a9e1414cb8a11083ae53cb7b52d34be462b06310 100644 (file)
@@ -101,6 +101,8 @@ struct tea5761_priv {
 
        /* All zero = no test mode */
 
+#define TEA5761_TESTREG_TRIGFR         0x08
+
 /* MANID - Read: bytes 12 and 13 */
 
        /* First byte - should be 0x10 */
@@ -147,20 +149,21 @@ static int set_radio_freq(struct dvb_frontend *fe,
 
        if (params->mode == T_STANDBY) {
                tuner_dbg("TEA5761 set to standby mode\n");
-               buffer[5] |= TEA5761_TNCTRL_MU;
+               buffer[4] |= TEA5761_TNCTRL_MU;
        } else {
-               buffer[4] |= TEA5761_TNCTRL_PUPD_0;
+               buffer[3] |= TEA5761_TNCTRL_PUPD_0;
        }
 
+       buffer[5] = TEA5761_TESTREG_TRIGFR;
 
        if (params->audmode == V4L2_TUNER_MODE_MONO) {
                tuner_dbg("TEA5761 set to mono\n");
-               buffer[5] |= TEA5761_TNCTRL_MST;
+               buffer[4] |= TEA5761_TNCTRL_MST;
        } else {
                tuner_dbg("TEA5761 set to stereo\n");
        }
 
-       div = (1000 * (frq * 4 / 16 + 700 + 225) ) >> 15;
+       div = (frq * 125 / 2 - 225000) >> 13;
        buffer[1] = (div >> 8) & 0x3f;
        buffer[2] = div & 0xff;