Commit 47f95dbd authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] tua9001: use div_u64() for frequency calculation

Use div_u64() to simplify and remove home made divides.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent dd219a87
...@@ -88,7 +88,6 @@ static int tua9001_set_params(struct dvb_frontend *fe) ...@@ -88,7 +88,6 @@ static int tua9001_set_params(struct dvb_frontend *fe)
struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int ret, i; int ret, i;
u16 val; u16 val;
u32 frequency;
struct tua9001_reg_val data[2]; struct tua9001_reg_val data[2];
dev_dbg(&client->dev, dev_dbg(&client->dev,
...@@ -122,14 +121,8 @@ static int tua9001_set_params(struct dvb_frontend *fe) ...@@ -122,14 +121,8 @@ static int tua9001_set_params(struct dvb_frontend *fe)
data[0].reg = 0x04; data[0].reg = 0x04;
data[0].val = val; data[0].val = val;
frequency = (c->frequency - 150000000);
frequency /= 100;
frequency *= 48;
frequency /= 10000;
data[1].reg = 0x1f; data[1].reg = 0x1f;
data[1].val = frequency; data[1].val = div_u64((u64) (c->frequency - 150000000) * 48, 1000000);
if (fe->callback) { if (fe->callback) {
ret = fe->callback(client->adapter, ret = fe->callback(client->adapter,
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#define TUA9001_PRIV_H #define TUA9001_PRIV_H
#include "tua9001.h" #include "tua9001.h"
#include <linux/math64.h>
#include <linux/regmap.h> #include <linux/regmap.h>
struct tua9001_reg_val { struct tua9001_reg_val {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment