Commit ca108b39 authored by Andreas Regel's avatar Andreas Regel Committed by Mauro Carvalho Chehab

V4L/DVB (13983): [STV6110x] add clk_div member to stv6110x_config structure

Using clk_div member of stv6110x_config structure the tuner's clock
output divider can be configured. It is set in stv6110x_attach.
Signed-off-by: default avatarAndreas Regel <andreas.regel@gmx.de>
Signed-off-by: default avatarManu Abraham <manu@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 9045e729
...@@ -362,6 +362,7 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe, ...@@ -362,6 +362,7 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
{ {
struct stv6110x_state *stv6110x; struct stv6110x_state *stv6110x;
u8 default_regs[] = {0x07, 0x11, 0xdc, 0x85, 0x17, 0x01, 0xe6, 0x1e}; u8 default_regs[] = {0x07, 0x11, 0xdc, 0x85, 0x17, 0x01, 0xe6, 0x1e};
int ret;
stv6110x = kzalloc(sizeof (struct stv6110x_state), GFP_KERNEL); stv6110x = kzalloc(sizeof (struct stv6110x_state), GFP_KERNEL);
if (stv6110x == NULL) if (stv6110x == NULL)
...@@ -372,6 +373,43 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe, ...@@ -372,6 +373,43 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
stv6110x->devctl = &stv6110x_ctl; stv6110x->devctl = &stv6110x_ctl;
memcpy(stv6110x->regs, default_regs, 8); 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->tuner_priv = stv6110x;
fe->ops.tuner_ops = stv6110x_ops; fe->ops.tuner_ops = stv6110x_ops;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
struct stv6110x_config { struct stv6110x_config {
u8 addr; u8 addr;
u32 refclk; u32 refclk;
u8 clk_div; /* divisor value for the output clock */
}; };
enum tuner_mode { enum tuner_mode {
......
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