From d7614f074e7ec112f72b44226ecb04b87913e40e Mon Sep 17 00:00:00 2001 From: Andreas Regel Date: Tue, 5 Jan 2010 19:24:10 -0300 Subject: [PATCH] --- yaml --- r: 181518 b: refs/heads/master c: ca108b39a75d9c6e8a18c8723ccb9c98fb8d6265 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/media/dvb/frontends/stv6110x.c | 38 ++++++++++++++++++++ trunk/drivers/media/dvb/frontends/stv6110x.h | 1 + 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 5306057b7cc2..39267d8355f3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9045e729447192ab0ca27191ccab324c6b97fceb +refs/heads/master: ca108b39a75d9c6e8a18c8723ccb9c98fb8d6265 diff --git a/trunk/drivers/media/dvb/frontends/stv6110x.c b/trunk/drivers/media/dvb/frontends/stv6110x.c index 945790ef3a43..f931ed07e92d 100644 --- a/trunk/drivers/media/dvb/frontends/stv6110x.c +++ b/trunk/drivers/media/dvb/frontends/stv6110x.c @@ -362,6 +362,7 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe, { struct stv6110x_state *stv6110x; u8 default_regs[] = {0x07, 0x11, 0xdc, 0x85, 0x17, 0x01, 0xe6, 0x1e}; + int ret; stv6110x = kzalloc(sizeof (struct stv6110x_state), GFP_KERNEL); if (stv6110x == NULL) @@ -372,6 +373,43 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe, stv6110x->devctl = &stv6110x_ctl; memcpy(stv6110x->regs, default_regs, 8); + /* setup divider */ + switch (stv6110x->config->clk_div) { + default: + case 1: + STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_CO_DIV, 0); + break; + case 2: + STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_CO_DIV, 1); + break; + case 4: + STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_CO_DIV, 2); + break; + case 8: + case 0: + STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_CO_DIV, 3); + break; + } + + if (fe->ops.i2c_gate_ctrl) { + ret = fe->ops.i2c_gate_ctrl(fe, 1); + if (ret < 0) + goto error; + } + + ret = stv6110x_write_regs(stv6110x, 0, stv6110x->regs, + ARRAY_SIZE(stv6110x->regs)); + if (ret < 0) { + dprintk(FE_ERROR, 1, "Initialization failed"); + goto error; + } + + if (fe->ops.i2c_gate_ctrl) { + ret = fe->ops.i2c_gate_ctrl(fe, 0); + if (ret < 0) + goto error; + } + fe->tuner_priv = stv6110x; fe->ops.tuner_ops = stv6110x_ops; diff --git a/trunk/drivers/media/dvb/frontends/stv6110x.h b/trunk/drivers/media/dvb/frontends/stv6110x.h index a38257080e01..2429ae6d7847 100644 --- a/trunk/drivers/media/dvb/frontends/stv6110x.h +++ b/trunk/drivers/media/dvb/frontends/stv6110x.h @@ -26,6 +26,7 @@ struct stv6110x_config { u8 addr; u32 refclk; + u8 clk_div; /* divisor value for the output clock */ }; enum tuner_mode {