si2165: Add simple DVB-C support
Subsystems (2)
Matthias Schwarzott
maintainerThis series adds simple DVB-C support to the si2165 demod driver.
It works only for HVR-4400/HVR-5500.
For WinTV-HVR-930C-HD it fails with bad/no reception for unknown reasons.
Regards
Matthias
Matthias Schwarzott
maintainerPATCH 1/10 si2165: rename frontend -> fe
--- drivers/media/dvb-frontends/si2165.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/media/dvb-frontends/si2165.c +9 -9
@@ -42,7 +42,7 @@struct si2165_state {struct i2c_adapter *i2c; -struct dvb_frontend frontend; +struct dvb_frontend fe;struct si2165_config config;
@@ -988,9 +988,9 @@ struct dvb_frontend *si2165_attach(const struct si2165_config *config, }/* create dvb_frontend */ -memcpy (&state->frontend.ops, &si2165_ops, +memcpy (&state->fe.ops, &si2165_ops,sizeof (struct dvb_frontend_ops )); - state->frontend.demodulator_priv = state; + state->fe.demodulator_priv = state;/* powerup */ io_ret =si2165_writereg8 (state,0x0000 , state->config.chip_mode);
@@ -1042,20 +1042,20 @@ struct dvb_frontend *si2165_attach(const struct si2165_config *config,KBUILD_MODNAME , chip_name, rev_char, state->chip_type, state->chip_revcode); -strlcat (state->frontend.ops.info.name, chip_name, -sizeof (state->frontend.ops.info.name)); +strlcat (state->fe.ops.info.name, chip_name, +sizeof (state->fe.ops.info.name)); n =0 ;if (state->has_dvbt) { - state->frontend.ops.delsys[n++] =SYS_DVBT ; -strlcat (state->frontend.ops.info.name," DVB-T" , -sizeof (state->frontend.ops.info.name)); + state->fe.ops.delsys[n++] =SYS_DVBT ; +strlcat (state->fe.ops.info.name," DVB-T" , +sizeof (state->fe.ops.info.name)); }if (state->has_dvbc)dev_warn (&state->i2c->dev,"%s: DVB-C is not yet supported.\n" ,KBUILD_MODNAME ); -return &state->frontend; +return &state->fe; error:kfree (state);
Signature · 1 line
2.6.3
Matthias Schwarzott
maintainerPATCH 2/10 si2165: rename si2165_set_parameters to si2165_set_frontend
In reply to Matthias Schwarzott--- drivers/media/dvb-frontends/si2165.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/dvb-frontends/si2165.c +2 -2
@@ -767,7 +767,7 @@ static int si2165_set_if_freq_shift(struct si2165_state *state, u32 IF)return si2165_writereg32 (state,0x00e8 , reg_value); } -static int si2165_set_parameters (struct dvb_frontend *fe) +static int si2165_set_frontend (struct dvb_frontend *fe) {int ret;struct dtv_frontend_properties *p = &fe->dtv_property_cache;
@@ -952,7 +952,7 @@ static struct dvb_frontend_ops si2165_ops = { .init = si2165_init, .sleep = si2165_sleep, - .set_frontend = si2165_set_parameters, + .set_frontend = si2165_set_frontend, .read_status = si2165_read_status, .release = si2165_release,
Signature · 1 line
2.6.3
Matthias Schwarzott
maintainerPATCH 3/10 si2165: create function si2165_write_reg_list for writing register lists
In reply to Matthias Schwarzott--- drivers/media/dvb-frontends/si2165.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/media/dvb-frontends/si2165.c +21 -0
@@ -243,6 +243,27 @@ err:return ret; } +#define REG16 (reg, val) { (reg), (val) & 0xff }, { (reg)+1, (val)>>8 & 0xff } +struct si2165_reg_value_pair { +u16 reg; +u8 val; +}; + +static int si2165_write_reg_list (struct si2165_state *state, +const struct si2165_reg_value_pair *regs, +int count) +{ +int i; +int ret; + +for (i =0 ; i < count; i++) { + ret =si2165_writereg8 (state, regs[i].reg, regs[i].val); +if (ret <0 ) +return ret; + } +return 0 ; +} +static int si2165_get_tune_settings (struct dvb_frontend *fe,struct dvb_frontend_tune_settings *s) {
Signature · 1 line
2.6.3
Matthias Schwarzott
maintainerPATCH 4/10 si2165: only write agc registers after reset before start_syncro
In reply to Matthias SchwarzottDatasheet says they must be rewritten after reset.
But it only makes sense to write them when trying to tune afterwards.
--- drivers/media/dvb-frontends/si2165.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-)
drivers/media/dvb-frontends/si2165.c +15 -17
@@ -690,23 +690,6 @@ static int si2165_init(struct dvb_frontend *fe) goto error; } -/* write adc values after each reset*/ - ret =si2165_writereg8 (state,0x012a ,0x46 ); -if (ret <0 ) - goto error; - ret =si2165_writereg8 (state,0x012c ,0x00 ); -if (ret <0 ) - goto error; - ret =si2165_writereg8 (state,0x012e ,0x0a ); -if (ret <0 ) - goto error; - ret =si2165_writereg8 (state,0x012f ,0xff ); -if (ret <0 ) - goto error; - ret =si2165_writereg8 (state,0x0123 ,0x70 ); -if (ret <0 ) - goto error; -return 0 ; error:return ret;
@@ -788,6 +771,14 @@ static int si2165_set_if_freq_shift(struct si2165_state *state, u32 IF)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 int si2165_set_frontend (struct dvb_frontend *fe) {int ret;
@@ -924,6 +915,13 @@ static int si2165_set_frontend(struct dvb_frontend *fe) ret =si2165_writereg32 (state,0x0384 ,0x00000000 );if (ret <0 )return ret; + +/* write adc values after each reset*/ + ret =si2165_write_reg_list (state, agc_rewrite, +ARRAY_SIZE (agc_rewrite)); +if (ret <0 ) +return ret; +/* start_synchro */ ret =si2165_writereg8 (state,0x02e0 ,0x01 );if (ret <0 )
Signature · 1 line
2.6.3
Matthias Schwarzott
maintainerPATCH 5/10 si2165: move setting ts config to init
In reply to Matthias SchwarzottThe TS config is fixed, so no need to write it for each tune.
--- drivers/media/dvb-frontends/si2165.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
drivers/media/dvb-frontends/si2165.c +14 -13
@@ -690,6 +690,20 @@ static int si2165_init(struct dvb_frontend *fe) goto error; } +/* ts output config */ + ret =si2165_writereg8 (state,0x04e4 ,0x20 ); +if (ret <0 ) +return ret; + ret =si2165_writereg16 (state,0x04ef ,0x00fe ); +if (ret <0 ) +return ret; + ret =si2165_writereg24 (state,0x04f4 ,0x555555 ); +if (ret <0 ) +return ret; + ret =si2165_writereg8 (state,0x04e5 ,0x01 ); +if (ret <0 ) +return ret; +return 0 ; error:return ret;
@@ -824,19 +838,6 @@ static int si2165_set_frontend(struct dvb_frontend *fe) ret =si2165_writereg8 (state,0x08f8 ,0x00 );if (ret <0 )return ret; -/* ts output config */ - ret =si2165_writereg8 (state,0x04e4 ,0x20 ); -if (ret <0 ) -return ret; - ret =si2165_writereg16 (state,0x04ef ,0x00fe ); -if (ret <0 ) -return ret; - ret =si2165_writereg24 (state,0x04f4 ,0x555555 ); -if (ret <0 ) -return ret; - ret =si2165_writereg8 (state,0x04e5 ,0x01 ); -if (ret <0 ) -return ret;/* bandwidth in 10KHz steps */ ret =si2165_writereg16 (state,0x0308 , bw10k);if (ret <0 )
Signature · 1 line
2.6.3
Matthias Schwarzott
maintainerPATCH 6/10 si2165: Simplify si2165_set_if_freq_shift usage
In reply to Matthias Schwarzott--- drivers/media/dvb-frontends/si2165.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/media/dvb-frontends/si2165.c +13 -13
@@ -764,12 +764,22 @@ static int si2165_set_oversamp(struct si2165_state *state, u32 dvb_rate)return si2165_writereg32 (state,0x00e4 , reg_value); } -static int si2165_set_if_freq_shift (struct si2165_state *state,u32 IF ) +static int si2165_set_if_freq_shift (struct si2165_state *state) { +struct dvb_frontend *fe = &state->fe;u64 if_freq_shift;s32 reg_value =0 ;u32 fe_clk =si2165_get_fe_clk (state); +u32 IF =0 ; +if (!fe->ops.tuner_ops.get_if_frequency) { +dev_err (&state->i2c->dev, +"%s: Error: get_if_frequency() not defined at tuner. Can't work without it!\n" , +KBUILD_MODNAME ); +return -EINVAL ; + } + + fe->ops.tuner_ops.get_if_frequency (fe, &IF ); if_freq_shift =IF ; if_freq_shift <<=29 ;
@@ -799,19 +809,11 @@ static int si2165_set_frontend(struct dvb_frontend *fe)struct dtv_frontend_properties *p = &fe->dtv_property_cache;struct si2165_state *state = fe->demodulator_priv;u8 val[3 ]; -u32 IF ;u32 dvb_rate =0 ;u16 bw10k;dprintk ("%s: called\n" , __func__); -if (!fe->ops.tuner_ops.get_if_frequency) { -dev_err (&state->i2c->dev, -"%s: Error: get_if_frequency() not defined at tuner. Can't work without it!\n" , -KBUILD_MODNAME ); -return -EINVAL ; - } -if (!state->has_dvbt)return -EINVAL ;
@@ -831,8 +833,7 @@ static int si2165_set_frontend(struct dvb_frontend *fe)if (ret <0 )return ret; - fe->ops.tuner_ops.get_if_frequency (fe, &IF ); - ret =si2165_set_if_freq_shift (state,IF ); + ret =si2165_set_if_freq_shift (state);if (ret <0 )return ret; ret =si2165_writereg8 (state,0x08f8 ,0x00 );
@@ -896,8 +897,7 @@ static int si2165_set_frontend(struct dvb_frontend *fe) fe->ops.tuner_ops.set_params (fe);/* recalc if_freq_shift if IF might has changed */ - fe->ops.tuner_ops.get_if_frequency (fe, &IF ); - ret =si2165_set_if_freq_shift (state,IF ); + ret =si2165_set_if_freq_shift (state);if (ret <0 )return ret;
Signature · 1 line
2.6.3
Matthias Schwarzott
maintainerPATCH 7/10 si2165: Fix DVB-T bandwidth default
In reply to Matthias Schwarzott--- drivers/media/dvb-frontends/si2165.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/media/dvb-frontends/si2165.c +6 -7
@@ -811,19 +811,18 @@ static int si2165_set_frontend(struct dvb_frontend *fe)u8 val[3 ];u32 dvb_rate =0 ;u16 bw10k; +u32 bw_hz = p->bandwidth_hz;dprintk ("%s: called\n" , __func__);if (!state->has_dvbt)return -EINVAL ; -if (p->bandwidth_hz >0 ) { - dvb_rate = p->bandwidth_hz *8 /7 ; - bw10k = p->bandwidth_hz /10000 ; - }else { - dvb_rate =8 *8 /7 ; - bw10k =800 ; - } +if (bw_hz ==0 ) + bw_hz =8000000 ; + + dvb_rate = bw_hz *8 /7 ; + bw10k = bw_hz /10000 ;/* standard = DVB-T */ ret =si2165_writereg8 (state,0x00ec ,0x01 );
Signature · 1 line
2.6.3
Re: [PATCH 07/10] si2165: Fix DVB-T bandwidth default
Em Thu, 19 Nov 2015 21:03:59 +0100
Matthias Schwarzott <[email protected]> escreveu:
Please, add a description to your patches.
That's said, this patch should be called, instead:
si2165: Fix DVB-T bandwidth auto
DVB auto bandwidth mode (bandwidth_hz == 0) logic was setting the initial value for dvb_rate to a wrong value. Fix it.
as a zero value here means to let the frontend to auto-detect the bandwidth. Of course, assuming that si2165 is capable of doing that.
If si2165 chip or driver doesn't support bandwidth auto-detection, it should, instead, return -EINVAL.
Are you sure that it will auto-detect the bandwidth if we keep it as 8MHz?
Regards,
Mauro
Quoted 35 lines
Signed-off-by Matthias Schwarzott <[email protected]>--- drivers/media/dvb-frontends/si2165.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)drivers/media/dvb-frontends/si2165.c +6
-7@@ -811,19 +811,18 @@ static int si2165_set_frontend(struct dvb_frontend *fe)u8 val[3 ];u32 dvb_rate =0 ;u16 bw10k; +u32 bw_hz = p->bandwidth_hz;dprintk ("%s: called\n" , __func__);if (!state->has_dvbt)return -EINVAL ; -if (p->bandwidth_hz >0 ) { - dvb_rate = p->bandwidth_hz *8 /7 ; - bw10k = p->bandwidth_hz /10000 ; - }else { - dvb_rate =8 *8 /7 ; - bw10k =800 ; - } +if (bw_hz ==0 ) + bw_hz =8000000 ; + + dvb_rate = bw_hz *8 /7 ; + bw10k = bw_hz /10000 ;/* standard = DVB-T */ ret =si2165_writereg8 (state,0x00ec ,0x01 );
Matthias Schwarzott
maintainerRe: [PATCH 07/10] si2165: Fix DVB-T bandwidth default
Am 03.12.2015 um 15:15 schrieb Mauro Carvalho Chehab:
Quoted 17 lines
Em Thu, 19 Nov 2015 21:03:59 +0100
Matthias Schwarzott <[email protected]> escreveu:Please, add a description to your patches.
That's said, this patch should be called, instead:
si2165: Fix DVB-T bandwidth auto
DVB auto bandwidth mode (
bandwidth_hz== 0) logic was setting the initial value fordvb_rateto a wrong value. Fix it.as a zero value here means to let the frontend to auto-detect the bandwidth. Of course, assuming that si2165 is capable of doing that.
Quoted 6 lines
If si2165 chip or driver doesn't support bandwidth auto-detection, it should, instead, return
-EINVAL.Are you sure that it will auto-detect the bandwidth if we keep it as 8MHz?
Thanks for the feedback.
As far as I know si2165 does not support auto-detection of bandwidth.
I only have 8MHz channels available I tried what happens when configuring other bandwidth values - it will not lock.
So I will resend the modified the patch.
Regards
Matthias
Matthias Schwarzott
maintainerPATCH 1/1 si2165: Reject DVB-T bandwidth auto mode
The si2165 does not support bandwidth auto-detection. Reject the request.
--- drivers/media/dvb-frontends/si2165.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/media/dvb-frontends/si2165.c +7 -7
@@ -825,19 +825,19 @@ static int si2165_set_frontend_dvbt(struct dvb_frontend *fe)struct si2165_state *state = fe->demodulator_priv;u32 dvb_rate =0 ;u16 bw10k; +u32 bw_hz = p->bandwidth_hz;dprintk ("%s: called\n" , __func__);if (!state->has_dvbt)return -EINVAL ; -if (p->bandwidth_hz >0 ) { - dvb_rate = p->bandwidth_hz *8 /7 ; - bw10k = p->bandwidth_hz /10000 ; - }else { - dvb_rate =8 *8 /7 ; - bw10k =800 ; - } +/* no bandwidth auto-detection */ +if (bw_hz ==0 ) +return -EINVAL ; + + dvb_rate = bw_hz *8 /7 ; + bw10k = bw_hz /10000 ; ret =si2165_adjust_pll_divl (state,12 );if (ret <0 )
Signature · 1 line
2.6.3
Matthias Schwarzott
maintainerPATCH 8/10 si2165: set list of DVB-T registers together
In reply to Matthias Schwarzott--- drivers/media/dvb-frontends/si2165.c | 73 +++++++++++++----------------------- 1 file changed, 26 insertions(+), 47 deletions(-)
drivers/media/dvb-frontends/si2165.c +26 -47
@@ -803,6 +803,29 @@ static const struct si2165_reg_value_pair agc_rewrite[] = { { 0x0123, 0x70 } }; +static const struct si2165_reg_value_pair dvbt_regs[] = { +/* standard = DVB-T */ + {0x00ec ,0x01 }, + {0x08f8 ,0x00 }, +/* impulsive_noise_remover */ + {0x031c ,0x01 }, + {0x00cb ,0x00 }, +/* agc2 */ + {0x016e ,0x41 }, + {0x016c ,0x0e }, + {0x016d ,0x10 }, +/* agc */ + {0x015b ,0x03 }, + {0x0150 ,0x78 }, +/* agc */ + {0x01a0 ,0x78 }, + {0x01c8 ,0x68 }, +/* freq_sync_range */ +REG16 (0x030c ,0x0064 ), +/* gp_reg0 */ + {0x0387 ,0x00 } +}; +static int si2165_set_frontend (struct dvb_frontend *fe) {int ret;
@@ -824,10 +847,6 @@ static int si2165_set_frontend(struct dvb_frontend *fe) dvb_rate = bw_hz *8 /7 ; bw10k = bw_hz /10000 ; -/* standard = DVB-T */ - ret =si2165_writereg8 (state,0x00ec ,0x01 ); -if (ret <0 ) -return ret; ret =si2165_adjust_pll_divl (state,12 );if (ret <0 )return ret;
@@ -835,9 +854,6 @@ static int si2165_set_frontend(struct dvb_frontend *fe) ret =si2165_set_if_freq_shift (state);if (ret <0 )return ret; - ret =si2165_writereg8 (state,0x08f8 ,0x00 ); -if (ret <0 ) -return ret;/* bandwidth in 10KHz steps */ ret =si2165_writereg16 (state,0x0308 , bw10k);if (ret <0 )
@@ -845,48 +861,11 @@ static int si2165_set_frontend(struct dvb_frontend *fe) ret =si2165_set_oversamp (state, dvb_rate);if (ret <0 )return ret; -/* impulsive_noise_remover */ - ret =si2165_writereg8 (state,0x031c ,0x01 ); -if (ret <0 ) -return ret; - ret =si2165_writereg8 (state,0x00cb ,0x00 ); -if (ret <0 ) -return ret; -/* agc2 */ - ret =si2165_writereg8 (state,0x016e ,0x41 ); -if (ret <0 ) -return ret; - ret =si2165_writereg8 (state,0x016c ,0x0e ); -if (ret <0 ) -return ret; - ret =si2165_writereg8 (state,0x016d ,0x10 ); -if (ret <0 ) -return ret; -/* agc */ - ret =si2165_writereg8 (state,0x015b ,0x03 ); -if (ret <0 ) -return ret; - ret =si2165_writereg8 (state,0x0150 ,0x78 ); -if (ret <0 ) -return ret; -/* agc */ - ret =si2165_writereg8 (state,0x01a0 ,0x78 ); -if (ret <0 ) -return ret; - ret =si2165_writereg8 (state,0x01c8 ,0x68 ); -if (ret <0 ) -return ret; -/* freq_sync_range */ - ret =si2165_writereg16 (state,0x030c ,0x0064 ); -if (ret <0 ) -return ret; -/* gp_reg0 */ - ret =si2165_readreg8 (state,0x0387 , val); -if (ret <0 ) -return ret; - ret =si2165_writereg8 (state,0x0387 ,0x00 ); + + ret =si2165_write_reg_list (state, dvbt_regs,ARRAY_SIZE (dvbt_regs));if (ret <0 )return ret; +/* dsp_addr_jump */ ret =si2165_writereg32 (state,0x0348 ,0xf4000000 );if (ret <0 )
Signature · 1 line
2.6.3
Matthias Schwarzott
maintainerPATCH 9/10 si2165: Prepare si2165_set_frontend for splitting
In reply to Matthias Schwarzott--- drivers/media/dvb-frontends/si2165.c | 51 ++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 14 deletions(-)
drivers/media/dvb-frontends/si2165.c +37 -14
@@ -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;u32 bw_hz = p->bandwidth_hz;
@@ -851,9 +842,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 )
@@ -866,6 +854,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 )
@@ -886,6 +908,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 )
Signature · 1 line
2.6.3
Matthias Schwarzott
maintainerPATCH 10/10 si2165: Add DVB-C support for HVR-4400/HVR-5500
In reply to Matthias SchwarzottIt works only for HVR-4400/HVR-5500.
For WinTV-HVR-930C-HD it fails with bad/no reception for unknown reasons.
--- drivers/media/dvb-frontends/si2165.c | 86 +++++++++++++++++++++++++++++++++--- 1 file changed, 81 insertions(+), 5 deletions(-)
drivers/media/dvb-frontends/si2165.c +81 -5
@@ -857,6 +857,71 @@ static int si2165_set_frontend_dvbt(struct dvb_frontend *fe)return 0 ; } +static const struct si2165_reg_value_pair dvbc_regs[] = { +/* standard = DVB-C */ + {0x00ec ,0x05 }, + {0x08f8 ,0x00 }, + +/* agc2 */ + {0x016e ,0x50 }, + {0x016c ,0x0e }, + {0x016d ,0x10 }, +/* agc */ + {0x015b ,0x03 }, + {0x0150 ,0x68 }, +/* agc */ + {0x01a0 ,0x68 }, + {0x01c8 ,0x50 }, + + {0x0278 ,0x0d }, + + {0x023a ,0x05 }, + {0x0261 ,0x09 }, +REG16 (0x0350 ,0x3e80 ), + {0x02f4 ,0x00 }, + + {0x00cb ,0x01 }, +REG16 (0x024c ,0x0000 ), +REG16 (0x027c ,0x0000 ), + {0x0232 ,0x03 }, + {0x02f4 ,0x0b }, + {0x018b ,0x00 }, +}; + +static int si2165_set_frontend_dvbc (struct dvb_frontend *fe) +{ +struct si2165_state *state = fe->demodulator_priv; +int ret; +struct dtv_frontend_properties *p = &fe->dtv_property_cache; +const u32 dvb_rate = p->symbol_rate; +const u32 bw_hz = p->bandwidth_hz; + +if (!state->has_dvbc) +return -EINVAL ; + +if (dvb_rate ==0 ) +return -EINVAL ; + + ret =si2165_adjust_pll_divl (state,14 ); +if (ret <0 ) +return ret; + +/* Oversampling */ + ret =si2165_set_oversamp (state, dvb_rate); +if (ret <0 ) +return ret; + + ret =si2165_writereg32 (state,0x00c4 , bw_hz); +if (ret <0 ) +return ret; + + ret =si2165_write_reg_list (state, dvbc_regs,ARRAY_SIZE (dvbc_regs)); +if (ret <0 ) +return ret; + +return 0 ; +} +static const struct si2165_reg_value_pair agc_rewrite[] = { {0x012a ,0x46 }, {0x012c ,0x00 },
@@ -884,6 +949,11 @@ static int si2165_set_frontend(struct dvb_frontend *fe)if (ret <0 )return ret;break ; +case SYS_DVBC_ANNEX_A : + ret =si2165_set_frontend_dvbc (fe); +if (ret <0 ) +return ret; +break ;default :return -EINVAL ; }
@@ -947,7 +1017,12 @@ static void si2165_release(struct dvb_frontend *fe)static struct dvb_frontend_ops si2165_ops = { .info = { .name ="Silicon Labs " , - .caps =FE_CAN_FEC_1_2 | +/* For DVB-C */ + .symbol_rate_min =1000000 , + .symbol_rate_max =7200000 , +/* For DVB-T */ + .frequency_stepsize =166667 , + .caps =FE_CAN_FEC_1_2 |FE_CAN_FEC_2_3 |FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 |
@@ -960,7 +1035,6 @@ static struct dvb_frontend_ops si2165_ops = {FE_CAN_QAM_128 |FE_CAN_QAM_256 |FE_CAN_QAM_AUTO | -FE_CAN_TRANSMISSION_MODE_AUTO |FE_CAN_GUARD_INTERVAL_AUTO |FE_CAN_HIERARCHY_AUTO | FE_CAN_MUTE_TS |
@@ -1072,9 +1146,11 @@ struct dvb_frontend *si2165_attach(const struct si2165_config *config,strlcat (state->fe.ops.info.name," DVB-T" ,sizeof (state->fe.ops.info.name)); } -if (state->has_dvbc) -dev_warn (&state->i2c->dev,"%s: DVB-C is not yet supported.\n" , -KBUILD_MODNAME ); +if (state->has_dvbc) { + state->fe.ops.delsys[n++] =SYS_DVBC_ANNEX_A ; +strlcat (state->fe.ops.info.name," DVB-C" , +sizeof (state->fe.ops.info.name)); + }return &state->fe;
Signature · 1 line
2.6.3