diff options
author | Manu Abraham <abraham.manu@gmail.com> | 2009-04-08 19:30:29 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-16 17:20:40 -0400 |
commit | da4b9059c948ce35ce9d34b982b6a9934a9251ef (patch) | |
tree | 39c645ced9e29d6825a5184549062fd750ed1aec /drivers/media/dvb/frontends/stv090x.c | |
parent | 5f99feffc0426f88db07e2d777d9dd4aa2205c2f (diff) |
V4L/DVB (11591): stv090x: code simplification
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends/stv090x.c')
-rw-r--r-- | drivers/media/dvb/frontends/stv090x.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index b3a02790c9a2..3e0acd7cc822 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c | |||
@@ -2222,23 +2222,22 @@ static enum stv090x_delsys stv090x_get_std(struct stv090x_state *state) | |||
2222 | static s32 stv090x_get_car_freq(struct stv090x_state *state, u32 mclk) | 2222 | static s32 stv090x_get_car_freq(struct stv090x_state *state, u32 mclk) |
2223 | { | 2223 | { |
2224 | s32 derot, int_1, int_2, tmp_1, tmp_2; | 2224 | s32 derot, int_1, int_2, tmp_1, tmp_2; |
2225 | u32 pow2; | ||
2226 | 2225 | ||
2227 | derot = STV090x_READ_DEMOD(state, CFR2) << 16; | 2226 | derot = STV090x_READ_DEMOD(state, CFR2) << 16; |
2228 | derot |= STV090x_READ_DEMOD(state, CFR1) << 8; | 2227 | derot |= STV090x_READ_DEMOD(state, CFR1) << 8; |
2229 | derot |= STV090x_READ_DEMOD(state, CFR0); | 2228 | derot |= STV090x_READ_DEMOD(state, CFR0); |
2230 | 2229 | ||
2231 | derot = comp2(derot, 24); | 2230 | derot = comp2(derot, 24); |
2232 | pow2 = 1 << 12; | 2231 | int_1 = state->mclk >> 12; |
2233 | int_1 = state->mclk / pow2; | 2232 | int_2 = derot >> 12; |
2234 | int_2 = derot / pow2; | ||
2235 | 2233 | ||
2236 | tmp_1 = state->mclk % pow2; | 2234 | /* carrier_frequency = MasterClock * Reg / 2^24 */ |
2237 | tmp_2 = derot % pow2; | 2235 | tmp_1 = state->mclk % 0x1000; |
2236 | tmp_2 = derot % 0x1000; | ||
2238 | 2237 | ||
2239 | derot = (int_1 * int_2) + | 2238 | derot = (int_1 * int_2) + |
2240 | ((int_1 * tmp_2) / pow2) + | 2239 | ((int_1 * tmp_2) >> 12) + |
2241 | ((int_1 * tmp_1) / pow2); | 2240 | ((int_1 * tmp_1) >> 12); |
2242 | 2241 | ||
2243 | return derot; | 2242 | return derot; |
2244 | } | 2243 | } |