diff options
author | Matthias Schwarzott <zzam@gentoo.org> | 2015-11-19 20:04:01 (GMT) |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-12-03 14:19:57 (GMT) |
commit | 3b0c9807b7778b98388329cb7e5d1e0c9c5c5fe5 (patch) | |
tree | 64cd21ac8caab676694ad0edfd311483374266b6 /drivers/media | |
parent | 25e7375309038d3be3e156332d1597cedb4afc1a (diff) | |
download | linux-3b0c9807b7778b98388329cb7e5d1e0c9c5c5fe5.tar.xz |
[media] si2165: Prepare si2165_set_frontend() for future DVB-C support
The current si2165_set_frontend() function actually works only for DVB-T.
Split it into two functions, preparing the code to support DVB-C.
Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb-frontends/si2165.c | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c index a0e6ad8..4e3acd4 100644 --- a/drivers/media/dvb-frontends/si2165.c +++ b/drivers/media/dvb-frontends/si2165.c @@ -760,7 +760,7 @@ static int si2165_set_oversamp(struct si2165_state *state, u32 dvb_rate) do_div(oversamp, dvb_rate); reg_value = oversamp & 0x3fffffff; - /* oversamp, usbdump contained 0x03100000; */ + dprintk("%s: Write oversamp=%#x\n", __func__, reg_value); return si2165_writereg32(state, 0x00e4, reg_value); } @@ -795,14 +795,6 @@ static int si2165_set_if_freq_shift(struct si2165_state *state) return si2165_writereg32(state, 0x00e8, reg_value); } -static const struct si2165_reg_value_pair agc_rewrite[] = { - { 0x012a, 0x46 }, - { 0x012c, 0x00 }, - { 0x012e, 0x0a }, - { 0x012f, 0xff }, - { 0x0123, 0x70 } -}; - static const struct si2165_reg_value_pair dvbt_regs[] = { /* standard = DVB-T */ { 0x00ec, 0x01 }, @@ -826,12 +818,11 @@ static const struct si2165_reg_value_pair dvbt_regs[] = { { 0x0387, 0x00 } }; -static int si2165_set_frontend(struct dvb_frontend *fe) +static int si2165_set_frontend_dvbt(struct dvb_frontend *fe) { int ret; struct dtv_frontend_properties *p = &fe->dtv_property_cache; struct si2165_state *state = fe->demodulator_priv; - u8 val[3]; u32 dvb_rate = 0; u16 bw10k; @@ -852,9 +843,6 @@ static int si2165_set_frontend(struct dvb_frontend *fe) if (ret < 0) return ret; - ret = si2165_set_if_freq_shift(state); - if (ret < 0) - return ret; /* bandwidth in 10KHz steps */ ret = si2165_writereg16(state, 0x0308, bw10k); if (ret < 0) @@ -867,6 +855,40 @@ static int si2165_set_frontend(struct dvb_frontend *fe) if (ret < 0) return ret; + return 0; +} + +static const struct si2165_reg_value_pair agc_rewrite[] = { + { 0x012a, 0x46 }, + { 0x012c, 0x00 }, + { 0x012e, 0x0a }, + { 0x012f, 0xff }, + { 0x0123, 0x70 } +}; + +static int si2165_set_frontend(struct dvb_frontend *fe) +{ + struct si2165_state *state = fe->demodulator_priv; + struct dtv_frontend_properties *p = &fe->dtv_property_cache; + u32 delsys = p->delivery_system; + int ret; + u8 val[3]; + + /* initial setting of if freq shift */ + ret = si2165_set_if_freq_shift(state); + if (ret < 0) + return ret; + + switch (delsys) { + case SYS_DVBT: + ret = si2165_set_frontend_dvbt(fe); + if (ret < 0) + return ret; + break; + default: + return -EINVAL; + } + /* dsp_addr_jump */ ret = si2165_writereg32(state, 0x0348, 0xf4000000); if (ret < 0) @@ -887,6 +909,7 @@ static int si2165_set_frontend(struct dvb_frontend *fe) ret = si2165_writereg8(state, 0x0341, 0x00); if (ret < 0) return ret; + /* reset all */ ret = si2165_writereg8(state, 0x00c0, 0x00); if (ret < 0) |