From 9ac51c5e53d6b16c9a3fa541117cf96dedd6b3dd Mon Sep 17 00:00:00 2001 From: Steve Kerrison Date: Mon, 2 May 2011 18:19:13 -0300 Subject: [PATCH] [media] cxd2820r: make C, T, T2 and core components as linked objects Signed-off-by: Steve Kerrison Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/Makefile | 1 + drivers/media/dvb/frontends/cxd2820r_c.c | 22 ++-- .../frontends/{cxd2820r.c => cxd2820r_core.c} | 19 ++-- drivers/media/dvb/frontends/cxd2820r_priv.h | 102 +++++++++++++++++- drivers/media/dvb/frontends/cxd2820r_t.c | 22 ++-- drivers/media/dvb/frontends/cxd2820r_t2.c | 20 ++-- 6 files changed, 144 insertions(+), 42 deletions(-) rename drivers/media/dvb/frontends/{cxd2820r.c => cxd2820r_core.c} (97%) diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile index adec1a3f6291..2f3a6f736d64 100644 --- a/drivers/media/dvb/frontends/Makefile +++ b/drivers/media/dvb/frontends/Makefile @@ -9,6 +9,7 @@ stb0899-objs = stb0899_drv.o stb0899_algo.o stv0900-objs = stv0900_core.o stv0900_sw.o au8522-objs = au8522_dig.o au8522_decoder.o drxd-objs = drxd_firm.o drxd_hard.o +cxd2820r-objs = cxd2820r_core.o cxd2820r_c.o cxd2820r_t.o cxd2820r_t2.o obj-$(CONFIG_DVB_PLL) += dvb-pll.o obj-$(CONFIG_DVB_STV0299) += stv0299.o diff --git a/drivers/media/dvb/frontends/cxd2820r_c.c b/drivers/media/dvb/frontends/cxd2820r_c.c index a94bff944722..3c07d400731d 100644 --- a/drivers/media/dvb/frontends/cxd2820r_c.c +++ b/drivers/media/dvb/frontends/cxd2820r_c.c @@ -19,7 +19,9 @@ */ -static int cxd2820r_set_frontend_c(struct dvb_frontend *fe, +#include "cxd2820r_priv.h" + +int cxd2820r_set_frontend_c(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) { struct cxd2820r_priv *priv = fe->demodulator_priv; @@ -92,7 +94,7 @@ error: return ret; } -static int cxd2820r_get_frontend_c(struct dvb_frontend *fe, +int cxd2820r_get_frontend_c(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) { struct cxd2820r_priv *priv = fe->demodulator_priv; @@ -143,7 +145,7 @@ error: return ret; } -static int cxd2820r_read_ber_c(struct dvb_frontend *fe, u32 *ber) +int cxd2820r_read_ber_c(struct dvb_frontend *fe, u32 *ber) { struct cxd2820r_priv *priv = fe->demodulator_priv; int ret; @@ -177,7 +179,7 @@ error: return ret; } -static int cxd2820r_read_signal_strength_c(struct dvb_frontend *fe, +int cxd2820r_read_signal_strength_c(struct dvb_frontend *fe, u16 *strength) { struct cxd2820r_priv *priv = fe->demodulator_priv; @@ -207,7 +209,7 @@ error: return ret; } -static int cxd2820r_read_snr_c(struct dvb_frontend *fe, u16 *snr) +int cxd2820r_read_snr_c(struct dvb_frontend *fe, u16 *snr) { struct cxd2820r_priv *priv = fe->demodulator_priv; int ret; @@ -244,14 +246,14 @@ error: return ret; } -static int cxd2820r_read_ucblocks_c(struct dvb_frontend *fe, u32 *ucblocks) +int cxd2820r_read_ucblocks_c(struct dvb_frontend *fe, u32 *ucblocks) { *ucblocks = 0; /* no way to read ? */ return 0; } -static int cxd2820r_read_status_c(struct dvb_frontend *fe, fe_status_t *status) +int cxd2820r_read_status_c(struct dvb_frontend *fe, fe_status_t *status) { struct cxd2820r_priv *priv = fe->demodulator_priv; int ret; @@ -280,7 +282,7 @@ error: return ret; } -static int cxd2820r_init_c(struct dvb_frontend *fe) +int cxd2820r_init_c(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; int ret; @@ -295,7 +297,7 @@ error: return ret; } -static int cxd2820r_sleep_c(struct dvb_frontend *fe) +int cxd2820r_sleep_c(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; int ret, i; @@ -324,7 +326,7 @@ error: return ret; } -static int cxd2820r_get_tune_settings_c(struct dvb_frontend *fe, +int cxd2820r_get_tune_settings_c(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *s) { s->min_delay_ms = 500; diff --git a/drivers/media/dvb/frontends/cxd2820r.c b/drivers/media/dvb/frontends/cxd2820r_core.c similarity index 97% rename from drivers/media/dvb/frontends/cxd2820r.c rename to drivers/media/dvb/frontends/cxd2820r_core.c index b58f92c75116..59d302f7a8f1 100644 --- a/drivers/media/dvb/frontends/cxd2820r.c +++ b/drivers/media/dvb/frontends/cxd2820r_core.c @@ -93,7 +93,7 @@ static int cxd2820r_rd_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, } /* write multiple registers */ -static int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, +int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, int len) { int ret; @@ -119,7 +119,7 @@ static int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, } /* read multiple registers */ -static int cxd2820r_rd_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, +int cxd2820r_rd_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, int len) { int ret; @@ -145,19 +145,19 @@ static int cxd2820r_rd_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, } /* write single register */ -static int cxd2820r_wr_reg(struct cxd2820r_priv *priv, u32 reg, u8 val) +int cxd2820r_wr_reg(struct cxd2820r_priv *priv, u32 reg, u8 val) { return cxd2820r_wr_regs(priv, reg, &val, 1); } /* read single register */ -static int cxd2820r_rd_reg(struct cxd2820r_priv *priv, u32 reg, u8 *val) +int cxd2820r_rd_reg(struct cxd2820r_priv *priv, u32 reg, u8 *val) { return cxd2820r_rd_regs(priv, reg, val, 1); } /* write single register with mask */ -static int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val, +int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val, u8 mask) { int ret; @@ -177,7 +177,7 @@ static int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val, return cxd2820r_wr_reg(priv, reg, val); } -static int cxd2820r_gpio(struct dvb_frontend *fe) +int cxd2820r_gpio(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; int ret, i; @@ -285,16 +285,11 @@ static void cxd2820r_unlock(struct cxd2820r_priv *priv, int active_fe) } /* 64 bit div with round closest, like DIV_ROUND_CLOSEST but 64 bit */ -static u32 cxd2820r_div_u64_round_closest(u64 dividend, u32 divisor) +u32 cxd2820r_div_u64_round_closest(u64 dividend, u32 divisor) { return div_u64(dividend + (divisor / 2), divisor); } -/* TODO: ... */ -#include "cxd2820r_t.c" -#include "cxd2820r_c.c" -#include "cxd2820r_t2.c" - static int cxd2820r_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) { diff --git a/drivers/media/dvb/frontends/cxd2820r_priv.h b/drivers/media/dvb/frontends/cxd2820r_priv.h index 4d2d79969d91..2437d51bdae3 100644 --- a/drivers/media/dvb/frontends/cxd2820r_priv.h +++ b/drivers/media/dvb/frontends/cxd2820r_priv.h @@ -22,6 +22,7 @@ #ifndef CXD2820R_PRIV_H #define CXD2820R_PRIV_H +#include #include "dvb_frontend.h" #include "dvb_math.h" #include "cxd2820r.h" @@ -70,8 +71,107 @@ struct cxd2820r_priv { u8 bank[2]; u8 gpio[3]; - + fe_delivery_system_t delivery_system; }; +/* cxd2820r_core.c */ + +extern int cxd2820r_debug; + +int cxd2820r_gpio(struct dvb_frontend *fe); + +int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val, + u8 mask); + +int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, + int len); + +u32 cxd2820r_div_u64_round_closest(u64 dividend, u32 divisor); + +int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, + int len); + +int cxd2820r_rd_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, + int len); + +int cxd2820r_wr_reg(struct cxd2820r_priv *priv, u32 reg, u8 val); + +int cxd2820r_rd_reg(struct cxd2820r_priv *priv, u32 reg, u8 *val); + +/* cxd2820r_c.c */ + +int cxd2820r_get_frontend_c(struct dvb_frontend *fe, + struct dvb_frontend_parameters *p); + +int cxd2820r_set_frontend_c(struct dvb_frontend *fe, + struct dvb_frontend_parameters *params); + +int cxd2820r_read_status_c(struct dvb_frontend *fe, fe_status_t *status); + +int cxd2820r_read_ber_c(struct dvb_frontend *fe, u32 *ber); + +int cxd2820r_read_signal_strength_c(struct dvb_frontend *fe, u16 *strength); + +int cxd2820r_read_snr_c(struct dvb_frontend *fe, u16 *snr); + +int cxd2820r_read_ucblocks_c(struct dvb_frontend *fe, u32 *ucblocks); + +int cxd2820r_init_c(struct dvb_frontend *fe); + +int cxd2820r_sleep_c(struct dvb_frontend *fe); + +int cxd2820r_get_tune_settings_c(struct dvb_frontend *fe, + struct dvb_frontend_tune_settings *s); + +/* cxd2820r_t.c */ + +int cxd2820r_get_frontend_t(struct dvb_frontend *fe, + struct dvb_frontend_parameters *p); + +int cxd2820r_set_frontend_t(struct dvb_frontend *fe, + struct dvb_frontend_parameters *params); + +int cxd2820r_read_status_t(struct dvb_frontend *fe, fe_status_t *status); + +int cxd2820r_read_ber_t(struct dvb_frontend *fe, u32 *ber); + +int cxd2820r_read_signal_strength_t(struct dvb_frontend *fe, u16 *strength); + +int cxd2820r_read_snr_t(struct dvb_frontend *fe, u16 *snr); + +int cxd2820r_read_ucblocks_t(struct dvb_frontend *fe, u32 *ucblocks); + +int cxd2820r_init_t(struct dvb_frontend *fe); + +int cxd2820r_sleep_t(struct dvb_frontend *fe); + +int cxd2820r_get_tune_settings_t(struct dvb_frontend *fe, + struct dvb_frontend_tune_settings *s); + +/* cxd2820r_t2.c */ + +int cxd2820r_get_frontend_t2(struct dvb_frontend *fe, + struct dvb_frontend_parameters *p); + +int cxd2820r_set_frontend_t2(struct dvb_frontend *fe, + struct dvb_frontend_parameters *params); + +int cxd2820r_read_status_t2(struct dvb_frontend *fe, fe_status_t *status); + +int cxd2820r_read_ber_t2(struct dvb_frontend *fe, u32 *ber); + +int cxd2820r_read_signal_strength_t2(struct dvb_frontend *fe, u16 *strength); + +int cxd2820r_read_snr_t2(struct dvb_frontend *fe, u16 *snr); + +int cxd2820r_read_ucblocks_t2(struct dvb_frontend *fe, u32 *ucblocks); + +int cxd2820r_init_t2(struct dvb_frontend *fe); + +int cxd2820r_sleep_t2(struct dvb_frontend *fe); + +int cxd2820r_get_tune_settings_t2(struct dvb_frontend *fe, + struct dvb_frontend_tune_settings *s); + #endif /* CXD2820R_PRIV_H */ diff --git a/drivers/media/dvb/frontends/cxd2820r_t.c b/drivers/media/dvb/frontends/cxd2820r_t.c index 6732a9843f13..6582564c930c 100644 --- a/drivers/media/dvb/frontends/cxd2820r_t.c +++ b/drivers/media/dvb/frontends/cxd2820r_t.c @@ -19,7 +19,9 @@ */ -static int cxd2820r_set_frontend_t(struct dvb_frontend *fe, +#include "cxd2820r_priv.h" + +int cxd2820r_set_frontend_t(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) { struct cxd2820r_priv *priv = fe->demodulator_priv; @@ -133,7 +135,7 @@ error: return ret; } -static int cxd2820r_get_frontend_t(struct dvb_frontend *fe, +int cxd2820r_get_frontend_t(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) { struct cxd2820r_priv *priv = fe->demodulator_priv; @@ -251,7 +253,7 @@ error: return ret; } -static int cxd2820r_read_ber_t(struct dvb_frontend *fe, u32 *ber) +int cxd2820r_read_ber_t(struct dvb_frontend *fe, u32 *ber) { struct cxd2820r_priv *priv = fe->demodulator_priv; int ret; @@ -285,7 +287,7 @@ error: return ret; } -static int cxd2820r_read_signal_strength_t(struct dvb_frontend *fe, +int cxd2820r_read_signal_strength_t(struct dvb_frontend *fe, u16 *strength) { struct cxd2820r_priv *priv = fe->demodulator_priv; @@ -309,7 +311,7 @@ error: return ret; } -static int cxd2820r_read_snr_t(struct dvb_frontend *fe, u16 *snr) +int cxd2820r_read_snr_t(struct dvb_frontend *fe, u16 *snr) { struct cxd2820r_priv *priv = fe->demodulator_priv; int ret; @@ -337,14 +339,14 @@ error: return ret; } -static int cxd2820r_read_ucblocks_t(struct dvb_frontend *fe, u32 *ucblocks) +int cxd2820r_read_ucblocks_t(struct dvb_frontend *fe, u32 *ucblocks) { *ucblocks = 0; /* no way to read ? */ return 0; } -static int cxd2820r_read_status_t(struct dvb_frontend *fe, fe_status_t *status) +int cxd2820r_read_status_t(struct dvb_frontend *fe, fe_status_t *status) { struct cxd2820r_priv *priv = fe->demodulator_priv; int ret; @@ -391,7 +393,7 @@ error: return ret; } -static int cxd2820r_init_t(struct dvb_frontend *fe) +int cxd2820r_init_t(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; int ret; @@ -406,7 +408,7 @@ error: return ret; } -static int cxd2820r_sleep_t(struct dvb_frontend *fe) +int cxd2820r_sleep_t(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; int ret, i; @@ -435,7 +437,7 @@ error: return ret; } -static int cxd2820r_get_tune_settings_t(struct dvb_frontend *fe, +int cxd2820r_get_tune_settings_t(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *s) { s->min_delay_ms = 500; diff --git a/drivers/media/dvb/frontends/cxd2820r_t2.c b/drivers/media/dvb/frontends/cxd2820r_t2.c index 6ec94ea77f15..c47b35c8acf1 100644 --- a/drivers/media/dvb/frontends/cxd2820r_t2.c +++ b/drivers/media/dvb/frontends/cxd2820r_t2.c @@ -19,7 +19,9 @@ */ -static int cxd2820r_set_frontend_t2(struct dvb_frontend *fe, +#include "cxd2820r_priv.h" + +int cxd2820r_set_frontend_t2(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) { struct cxd2820r_priv *priv = fe->demodulator_priv; @@ -148,7 +150,7 @@ error: } -static int cxd2820r_get_frontend_t2(struct dvb_frontend *fe, +int cxd2820r_get_frontend_t2(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) { struct cxd2820r_priv *priv = fe->demodulator_priv; @@ -264,7 +266,7 @@ error: return ret; } -static int cxd2820r_read_status_t2(struct dvb_frontend *fe, fe_status_t *status) +int cxd2820r_read_status_t2(struct dvb_frontend *fe, fe_status_t *status) { struct cxd2820r_priv *priv = fe->demodulator_priv; int ret; @@ -293,7 +295,7 @@ error: return ret; } -static int cxd2820r_read_ber_t2(struct dvb_frontend *fe, u32 *ber) +int cxd2820r_read_ber_t2(struct dvb_frontend *fe, u32 *ber) { struct cxd2820r_priv *priv = fe->demodulator_priv; int ret; @@ -320,7 +322,7 @@ error: return ret; } -static int cxd2820r_read_signal_strength_t2(struct dvb_frontend *fe, +int cxd2820r_read_signal_strength_t2(struct dvb_frontend *fe, u16 *strength) { struct cxd2820r_priv *priv = fe->demodulator_priv; @@ -344,7 +346,7 @@ error: return ret; } -static int cxd2820r_read_snr_t2(struct dvb_frontend *fe, u16 *snr) +int cxd2820r_read_snr_t2(struct dvb_frontend *fe, u16 *snr) { struct cxd2820r_priv *priv = fe->demodulator_priv; int ret; @@ -372,14 +374,14 @@ error: return ret; } -static int cxd2820r_read_ucblocks_t2(struct dvb_frontend *fe, u32 *ucblocks) +int cxd2820r_read_ucblocks_t2(struct dvb_frontend *fe, u32 *ucblocks) { *ucblocks = 0; /* no way to read ? */ return 0; } -static int cxd2820r_sleep_t2(struct dvb_frontend *fe) +int cxd2820r_sleep_t2(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; int ret, i; @@ -409,7 +411,7 @@ error: return ret; } -static int cxd2820r_get_tune_settings_t2(struct dvb_frontend *fe, +int cxd2820r_get_tune_settings_t2(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *s) { s->min_delay_ms = 1500; -- 2.30.2