diff options
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/tuners/tda18271-fe.c | 21 | ||||
-rw-r--r-- | drivers/media/common/tuners/tda18271-priv.h | 11 |
2 files changed, 17 insertions, 15 deletions
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c index 8b515a7d93f8..e0fd9f5d5944 100644 --- a/drivers/media/common/tuners/tda18271-fe.c +++ b/drivers/media/common/tuners/tda18271-fe.c | |||
@@ -256,8 +256,9 @@ static int tda18271c2_rf_tracking_filters_correction(struct dvb_frontend *fe, | |||
256 | struct tda18271_priv *priv = fe->tuner_priv; | 256 | struct tda18271_priv *priv = fe->tuner_priv; |
257 | struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state; | 257 | struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state; |
258 | unsigned char *regs = priv->tda18271_regs; | 258 | unsigned char *regs = priv->tda18271_regs; |
259 | int tm_current, rfcal_comp, approx, i, ret; | 259 | int i, ret; |
260 | u8 dc_over_dt, rf_tab; | 260 | u8 tm_current, dc_over_dt, rf_tab; |
261 | s32 rfcal_comp, approx; | ||
261 | 262 | ||
262 | /* power up */ | 263 | /* power up */ |
263 | ret = tda18271_set_standby_mode(fe, 0, 0, 0); | 264 | ret = tda18271_set_standby_mode(fe, 0, 0, 0); |
@@ -277,11 +278,11 @@ static int tda18271c2_rf_tracking_filters_correction(struct dvb_frontend *fe, | |||
277 | return i; | 278 | return i; |
278 | 279 | ||
279 | if ((0 == map[i].rf3) || (freq / 1000 < map[i].rf2)) { | 280 | if ((0 == map[i].rf3) || (freq / 1000 < map[i].rf2)) { |
280 | approx = map[i].rf_a1 * | 281 | approx = map[i].rf_a1 * (s32)(freq / 1000 - map[i].rf1) + |
281 | (freq / 1000 - map[i].rf1) + map[i].rf_b1 + rf_tab; | 282 | map[i].rf_b1 + rf_tab; |
282 | } else { | 283 | } else { |
283 | approx = map[i].rf_a2 * | 284 | approx = map[i].rf_a2 * (s32)(freq / 1000 - map[i].rf2) + |
284 | (freq / 1000 - map[i].rf2) + map[i].rf_b2 + rf_tab; | 285 | map[i].rf_b2 + rf_tab; |
285 | } | 286 | } |
286 | 287 | ||
287 | if (approx < 0) | 288 | if (approx < 0) |
@@ -292,9 +293,9 @@ static int tda18271c2_rf_tracking_filters_correction(struct dvb_frontend *fe, | |||
292 | tda18271_lookup_map(fe, RF_CAL_DC_OVER_DT, &freq, &dc_over_dt); | 293 | tda18271_lookup_map(fe, RF_CAL_DC_OVER_DT, &freq, &dc_over_dt); |
293 | 294 | ||
294 | /* calculate temperature compensation */ | 295 | /* calculate temperature compensation */ |
295 | rfcal_comp = dc_over_dt * (tm_current - priv->tm_rfcal) / 1000; | 296 | rfcal_comp = dc_over_dt * (s32)(tm_current - priv->tm_rfcal) / 1000; |
296 | 297 | ||
297 | regs[R_EB14] = approx + rfcal_comp; | 298 | regs[R_EB14] = (unsigned char)(approx + rfcal_comp); |
298 | ret = tda18271_write_regs(fe, R_EB14, 1); | 299 | ret = tda18271_write_regs(fe, R_EB14, 1); |
299 | fail: | 300 | fail: |
300 | return ret; | 301 | return ret; |
@@ -611,7 +612,7 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq) | |||
611 | switch (rf) { | 612 | switch (rf) { |
612 | case RF1: | 613 | case RF1: |
613 | map[i].rf_a1 = 0; | 614 | map[i].rf_a1 = 0; |
614 | map[i].rf_b1 = prog_cal[RF1] - prog_tab[RF1]; | 615 | map[i].rf_b1 = (s32)(prog_cal[RF1] - prog_tab[RF1]); |
615 | map[i].rf1 = rf_freq[RF1] / 1000; | 616 | map[i].rf1 = rf_freq[RF1] / 1000; |
616 | break; | 617 | break; |
617 | case RF2: | 618 | case RF2: |
@@ -626,7 +627,7 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq) | |||
626 | (s32)(prog_cal[RF2] + prog_tab[RF2]); | 627 | (s32)(prog_cal[RF2] + prog_tab[RF2]); |
627 | divisor = (s32)(rf_freq[RF3] - rf_freq[RF2]) / 1000; | 628 | divisor = (s32)(rf_freq[RF3] - rf_freq[RF2]) / 1000; |
628 | map[i].rf_a2 = (dividend / divisor); | 629 | map[i].rf_a2 = (dividend / divisor); |
629 | map[i].rf_b2 = prog_cal[RF2] - prog_tab[RF2]; | 630 | map[i].rf_b2 = (s32)(prog_cal[RF2] - prog_tab[RF2]); |
630 | map[i].rf3 = rf_freq[RF3] / 1000; | 631 | map[i].rf3 = rf_freq[RF3] / 1000; |
631 | break; | 632 | break; |
632 | default: | 633 | default: |
diff --git a/drivers/media/common/tuners/tda18271-priv.h b/drivers/media/common/tuners/tda18271-priv.h index 2bee229acd91..74075be4dea3 100644 --- a/drivers/media/common/tuners/tda18271-priv.h +++ b/drivers/media/common/tuners/tda18271-priv.h | |||
@@ -80,10 +80,10 @@ struct tda18271_rf_tracking_filter_cal { | |||
80 | u32 rf1; | 80 | u32 rf1; |
81 | u32 rf2; | 81 | u32 rf2; |
82 | u32 rf3; | 82 | u32 rf3; |
83 | int rf_a1; | 83 | s32 rf_a1; |
84 | int rf_b1; | 84 | s32 rf_b1; |
85 | int rf_a2; | 85 | s32 rf_a2; |
86 | int rf_b2; | 86 | s32 rf_b2; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | enum tda18271_pll { | 89 | enum tda18271_pll { |
@@ -111,10 +111,11 @@ struct tda18271_priv { | |||
111 | enum tda18271_output_options output_opt; | 111 | enum tda18271_output_options output_opt; |
112 | 112 | ||
113 | unsigned int config; /* interface to saa713x / tda829x */ | 113 | unsigned int config; /* interface to saa713x / tda829x */ |
114 | unsigned int tm_rfcal; | ||
115 | unsigned int cal_initialized:1; | 114 | unsigned int cal_initialized:1; |
116 | unsigned int small_i2c:1; | 115 | unsigned int small_i2c:1; |
117 | 116 | ||
117 | u8 tm_rfcal; | ||
118 | |||
118 | struct tda18271_map_layout *maps; | 119 | struct tda18271_map_layout *maps; |
119 | struct tda18271_std_map std; | 120 | struct tda18271_std_map std; |
120 | struct tda18271_rf_tracking_filter_cal rf_cal_state[8]; | 121 | struct tda18271_rf_tracking_filter_cal rf_cal_state[8]; |