aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends')
-rw-r--r--drivers/media/dvb/frontends/dib7000p.c2
-rw-r--r--drivers/media/dvb/frontends/stb6100.c4
-rw-r--r--drivers/media/dvb/frontends/tda10021.c2
-rw-r--r--drivers/media/dvb/frontends/ves1820.c2
4 files changed, 6 insertions, 4 deletions
diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c
index 8217e5b38f47..fc96fbf03d6d 100644
--- a/drivers/media/dvb/frontends/dib7000p.c
+++ b/drivers/media/dvb/frontends/dib7000p.c
@@ -883,7 +883,7 @@ static void dib7000p_spur_protect(struct dib7000p_state *state, u32 rf_khz, u32
883 255, 255, 255, 255, 255, 255}; 883 255, 255, 255, 255, 255, 255};
884 884
885 u32 xtal = state->cfg.bw->xtal_hz / 1000; 885 u32 xtal = state->cfg.bw->xtal_hz / 1000;
886 int f_rel = ( (rf_khz + xtal/2) / xtal) * xtal - rf_khz; 886 int f_rel = DIV_ROUND_CLOSEST(rf_khz, xtal) * xtal - rf_khz;
887 int k; 887 int k;
888 int coef_re[8],coef_im[8]; 888 int coef_re[8],coef_im[8];
889 int bw_khz = bw; 889 int bw_khz = bw;
diff --git a/drivers/media/dvb/frontends/stb6100.c b/drivers/media/dvb/frontends/stb6100.c
index 1ed5a7db4c5e..60ee18a94f43 100644
--- a/drivers/media/dvb/frontends/stb6100.c
+++ b/drivers/media/dvb/frontends/stb6100.c
@@ -367,7 +367,9 @@ static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency)
367 /* N(I) = floor(f(VCO) / (f(XTAL) * (PSD2 ? 2 : 1))) */ 367 /* N(I) = floor(f(VCO) / (f(XTAL) * (PSD2 ? 2 : 1))) */
368 nint = fvco / (state->reference << psd2); 368 nint = fvco / (state->reference << psd2);
369 /* N(F) = round(f(VCO) / f(XTAL) * (PSD2 ? 2 : 1) - N(I)) * 2 ^ 9 */ 369 /* N(F) = round(f(VCO) / f(XTAL) * (PSD2 ? 2 : 1) - N(I)) * 2 ^ 9 */
370 nfrac = (((fvco - (nint * state->reference << psd2)) << (9 - psd2)) + state->reference / 2) / state->reference; 370 nfrac = DIV_ROUND_CLOSEST((fvco - (nint * state->reference << psd2))
371 << (9 - psd2),
372 state->reference);
371 dprintk(verbose, FE_DEBUG, 1, 373 dprintk(verbose, FE_DEBUG, 1,
372 "frequency = %u, srate = %u, g = %u, odiv = %u, psd2 = %u, fxtal = %u, osm = %u, fvco = %u, N(I) = %u, N(F) = %u", 374 "frequency = %u, srate = %u, g = %u, odiv = %u, psd2 = %u, fxtal = %u, osm = %u, fvco = %u, N(I) = %u, N(F) = %u",
373 frequency, srate, (unsigned int)g, (unsigned int)odiv, 375 frequency, srate, (unsigned int)g, (unsigned int)odiv,
diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c
index f5d7b3277a2f..6c1dbf9288d8 100644
--- a/drivers/media/dvb/frontends/tda10021.c
+++ b/drivers/media/dvb/frontends/tda10021.c
@@ -176,7 +176,7 @@ static int tda10021_set_symbolrate (struct tda10021_state* state, u32 symbolrate
176 tmp = ((symbolrate << 4) % FIN) << 8; 176 tmp = ((symbolrate << 4) % FIN) << 8;
177 ratio = (ratio << 8) + tmp / FIN; 177 ratio = (ratio << 8) + tmp / FIN;
178 tmp = (tmp % FIN) << 8; 178 tmp = (tmp % FIN) << 8;
179 ratio = (ratio << 8) + (tmp + FIN/2) / FIN; 179 ratio = (ratio << 8) + DIV_ROUND_CLOSEST(tmp, FIN);
180 180
181 BDR = ratio; 181 BDR = ratio;
182 BDRI = (((XIN << 5) / symbolrate) + 1) / 2; 182 BDRI = (((XIN << 5) / symbolrate) + 1) / 2;
diff --git a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c
index 6e78e4865515..550a07a8a997 100644
--- a/drivers/media/dvb/frontends/ves1820.c
+++ b/drivers/media/dvb/frontends/ves1820.c
@@ -165,7 +165,7 @@ static int ves1820_set_symbolrate(struct ves1820_state *state, u32 symbolrate)
165 tmp = ((symbolrate << 4) % fin) << 8; 165 tmp = ((symbolrate << 4) % fin) << 8;
166 ratio = (ratio << 8) + tmp / fin; 166 ratio = (ratio << 8) + tmp / fin;
167 tmp = (tmp % fin) << 8; 167 tmp = (tmp % fin) << 8;
168 ratio = (ratio << 8) + (tmp + fin / 2) / fin; 168 ratio = (ratio << 8) + DIV_ROUND_CLOSEST(tmp, fin);
169 169
170 BDR = ratio; 170 BDR = ratio;
171 BDRI = (((state->config->xin << 5) / symbolrate) + 1) / 2; 171 BDRI = (((state->config->xin << 5) / symbolrate) + 1) / 2;