Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174214
b: refs/heads/master
c: 92fda21
h: refs/heads/master
v: v3
  • Loading branch information
David Wong authored and Mauro Carvalho Chehab committed Dec 5, 2009
1 parent 6c12661 commit 82469f3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7fee03e487e87a196deb5602ee3c7676511995c9
refs/heads/master: 92fda216b439932bf7511e6381bbe1d42ba98875
19 changes: 14 additions & 5 deletions trunk/drivers/media/dvb/frontends/atbm8830.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include <asm/div64.h>
#include "dvb_frontend.h"

#include "atbm8830.h"
Expand Down Expand Up @@ -102,8 +103,12 @@ static inline int atbm8830_reglatch_lock(struct atbm_state *priv, int lock)
static int set_osc_freq(struct atbm_state *priv, u32 freq /*in kHz*/)
{
u32 val;
u64 t;

val = (u64)0x100000 * freq / 30400;
/* 0x100000 * freq / 30.4MHz */
t = (u64)0x100000 * freq;
do_div(t, 30400);
val = t;

atbm8830_write_reg(priv, REG_OSC_CLK, val);
atbm8830_write_reg(priv, REG_OSC_CLK + 1, val >> 8);
Expand All @@ -116,14 +121,18 @@ static int set_if_freq(struct atbm_state *priv, u32 freq /*in kHz*/)
{

u32 fs = priv->config->osc_clk_freq;
double t;
u64 t;
u32 val;
u8 dat;

t = 2 * 3.141593 * (freq - fs) / fs * (1 << 22);
val = t;

if (freq != 0) {
/* 2 * PI * (freq - fs) / fs * (2 ^ 22) */
t = (u64) 2 * 31416 * (freq - fs);
t <<= 22;
do_div(t, fs);
do_div(t, 1000);
val = t;

atbm8830_write_reg(priv, REG_TUNER_BASEBAND, 1);
atbm8830_write_reg(priv, REG_IF_FREQ, val);
atbm8830_write_reg(priv, REG_IF_FREQ+1, val >> 8);
Expand Down

0 comments on commit 82469f3

Please sign in to comment.