aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/radio/radio-tea5777.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/media/radio/radio-tea5777.c b/drivers/media/radio/radio-tea5777.c
index 3e12179364f8..5bc9fa62720b 100644
--- a/drivers/media/radio/radio-tea5777.c
+++ b/drivers/media/radio/radio-tea5777.c
@@ -33,6 +33,7 @@
33#include <media/v4l2-fh.h> 33#include <media/v4l2-fh.h>
34#include <media/v4l2-ioctl.h> 34#include <media/v4l2-ioctl.h>
35#include <media/v4l2-event.h> 35#include <media/v4l2-event.h>
36#include <asm/div64.h>
36#include "radio-tea5777.h" 37#include "radio-tea5777.h"
37 38
38MODULE_AUTHOR("Hans de Goede <perex@perex.cz>"); 39MODULE_AUTHOR("Hans de Goede <perex@perex.cz>");
@@ -158,10 +159,11 @@ static int radio_tea5777_set_freq(struct radio_tea5777 *tea)
158 int res; 159 int res;
159 160
160 freq = clamp_t(u32, tea->freq, 161 freq = clamp_t(u32, tea->freq,
161 TEA5777_FM_RANGELOW, TEA5777_FM_RANGEHIGH); 162 TEA5777_FM_RANGELOW, TEA5777_FM_RANGEHIGH) + 8;
162 freq = (freq + 8) / 16; /* to kHz */ 163 do_div(freq, 16); /* to kHz */
163 164
164 freq = (freq - TEA5777_FM_IF) / TEA5777_FM_FREQ_STEP; 165 freq -= TEA5777_FM_IF;
166 do_div(freq, TEA5777_FM_FREQ_STEP);
165 167
166 tea->write_reg &= ~(TEA5777_W_FM_PLL_MASK | TEA5777_W_FM_FREF_MASK); 168 tea->write_reg &= ~(TEA5777_W_FM_PLL_MASK | TEA5777_W_FM_FREF_MASK);
167 tea->write_reg |= freq << TEA5777_W_FM_PLL_SHIFT; 169 tea->write_reg |= freq << TEA5777_W_FM_PLL_SHIFT;