aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntti Palosaari <[email protected]>2013-09-02 13:06:13 -0300
committerMauro Carvalho Chehab <[email protected]>2013-09-24 13:20:19 -0300
commit35c00c98a28835bcbf7450ab74cc112c28e5f59c (patch)
tree4251c6419aea7ed226f401b441d2046357c33b10
parent1558ec837f4aa85987193d057377c42b243ca140 (diff)
[media] e4000: fix PLL calc bug on 32-bit arch
Fix long-lasting bug that causes tuning failure of some frequencies on 32-bit arch. Special thanks goes to Damien CABROL who finally find root of the bug. Also big thanks to Jacek Konieczny for donating "non-working" device. [[email protected]: fix trivial merge conflict] [[email protected]: add missing header file] Reported-by: Jacek Konieczny <[email protected]> Reported-by: Torsten Seyffarth <[email protected]> Reported-by: Jan Taegert <[email protected]> Reported-by: Damien CABROL <[email protected]> Tested-by: Damien CABROL <[email protected]> Tested-by: Jan Taegert <[email protected]> Signed-off-by: Antti Palosaari <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
-rw-r--r--drivers/media/tuners/e4000.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c
index ad9309da4a91..6c96e4898777 100644
--- a/drivers/media/tuners/e4000.c
+++ b/drivers/media/tuners/e4000.c
@@ -19,6 +19,7 @@
*/
#include "e4000_priv.h"
+#include <linux/math64.h>
/* write multiple registers */
static int e4000_wr_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len)
@@ -233,7 +234,7 @@ static int e4000_set_params(struct dvb_frontend *fe)
* or more.
*/
f_vco = c->frequency * e4000_pll_lut[i].mul;
- sigma_delta = 0x10000UL * (f_vco % priv->cfg->clock) / priv->cfg->clock;
+ sigma_delta = div_u64(0x10000ULL * (f_vco % priv->cfg->clock), priv->cfg->clock);
buf[0] = f_vco / priv->cfg->clock;
buf[1] = (sigma_delta >> 0) & 0xff;
buf[2] = (sigma_delta >> 8) & 0xff;