diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2008-06-08 19:10:29 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-06-26 14:58:48 -0400 |
commit | 44e645c20304bbe0a72cb994d9baf4b5727d7cec (patch) | |
tree | cc512ef052c3c3e0292bfe4be97d04bfcc2d888c /drivers/media | |
parent | 0e7830b50b20fcc25f21f79b7734102284d7c8f9 (diff) |
V4L/DVB (8034): tda18271: fix IF notch frequency handling
The IF notch bit gets unset when we update the Main Post Div register
value, before we have a chance to write the desired IF notch setting
to the tuner. Move the IF notch configuration to after we update MPD.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/common/tuners/tda18271-fe.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c index 89c01fb1f859..98acd588739a 100644 --- a/drivers/media/common/tuners/tda18271-fe.c +++ b/drivers/media/common/tuners/tda18271-fe.c | |||
@@ -45,6 +45,21 @@ static inline int charge_pump_source(struct dvb_frontend *fe, int force) | |||
45 | TDA18271_MAIN_PLL, force); | 45 | TDA18271_MAIN_PLL, force); |
46 | } | 46 | } |
47 | 47 | ||
48 | static inline void tda18271_set_if_notch(struct dvb_frontend *fe) | ||
49 | { | ||
50 | struct tda18271_priv *priv = fe->tuner_priv; | ||
51 | unsigned char *regs = priv->tda18271_regs; | ||
52 | |||
53 | switch (priv->mode) { | ||
54 | case TDA18271_ANALOG: | ||
55 | regs[R_MPD] &= ~0x80; /* IF notch = 0 */ | ||
56 | break; | ||
57 | case TDA18271_DIGITAL: | ||
58 | regs[R_MPD] |= 0x80; /* IF notch = 1 */ | ||
59 | break; | ||
60 | } | ||
61 | } | ||
62 | |||
48 | static int tda18271_channel_configuration(struct dvb_frontend *fe, | 63 | static int tda18271_channel_configuration(struct dvb_frontend *fe, |
49 | struct tda18271_std_map_item *map, | 64 | struct tda18271_std_map_item *map, |
50 | u32 freq, u32 bw) | 65 | u32 freq, u32 bw) |
@@ -66,19 +81,10 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe, | |||
66 | /* set cal mode to normal */ | 81 | /* set cal mode to normal */ |
67 | regs[R_EP4] &= ~0x03; | 82 | regs[R_EP4] &= ~0x03; |
68 | 83 | ||
69 | /* update IF output level & IF notch frequency */ | 84 | /* update IF output level */ |
70 | regs[R_EP4] &= ~0x1c; /* clear if level bits */ | 85 | regs[R_EP4] &= ~0x1c; /* clear if level bits */ |
71 | regs[R_EP4] |= (map->if_lvl << 2); | 86 | regs[R_EP4] |= (map->if_lvl << 2); |
72 | 87 | ||
73 | switch (priv->mode) { | ||
74 | case TDA18271_ANALOG: | ||
75 | regs[R_MPD] &= ~0x80; /* IF notch = 0 */ | ||
76 | break; | ||
77 | case TDA18271_DIGITAL: | ||
78 | regs[R_MPD] |= 0x80; /* IF notch = 1 */ | ||
79 | break; | ||
80 | } | ||
81 | |||
82 | /* update FM_RFn */ | 88 | /* update FM_RFn */ |
83 | regs[R_EP4] &= ~0x80; | 89 | regs[R_EP4] &= ~0x80; |
84 | regs[R_EP4] |= map->fm_rfn << 7; | 90 | regs[R_EP4] |= map->fm_rfn << 7; |
@@ -135,6 +141,7 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe, | |||
135 | switch (priv->role) { | 141 | switch (priv->role) { |
136 | case TDA18271_MASTER: | 142 | case TDA18271_MASTER: |
137 | tda18271_calc_main_pll(fe, N); | 143 | tda18271_calc_main_pll(fe, N); |
144 | tda18271_set_if_notch(fe); | ||
138 | tda18271_write_regs(fe, R_MPD, 4); | 145 | tda18271_write_regs(fe, R_MPD, 4); |
139 | break; | 146 | break; |
140 | case TDA18271_SLAVE: | 147 | case TDA18271_SLAVE: |
@@ -142,6 +149,7 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe, | |||
142 | tda18271_write_regs(fe, R_CPD, 4); | 149 | tda18271_write_regs(fe, R_CPD, 4); |
143 | 150 | ||
144 | regs[R_MPD] = regs[R_CPD] & 0x7f; | 151 | regs[R_MPD] = regs[R_CPD] & 0x7f; |
152 | tda18271_set_if_notch(fe); | ||
145 | tda18271_write_regs(fe, R_MPD, 1); | 153 | tda18271_write_regs(fe, R_MPD, 1); |
146 | break; | 154 | break; |
147 | } | 155 | } |
@@ -507,7 +515,7 @@ static int tda18271_powerscan_init(struct dvb_frontend *fe) | |||
507 | /* set cal mode to normal */ | 515 | /* set cal mode to normal */ |
508 | regs[R_EP4] &= ~0x03; | 516 | regs[R_EP4] &= ~0x03; |
509 | 517 | ||
510 | /* update IF output level & IF notch frequency */ | 518 | /* update IF output level */ |
511 | regs[R_EP4] &= ~0x1c; /* clear if level bits */ | 519 | regs[R_EP4] &= ~0x1c; /* clear if level bits */ |
512 | 520 | ||
513 | ret = tda18271_write_regs(fe, R_EP3, 2); | 521 | ret = tda18271_write_regs(fe, R_EP3, 2); |