aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/stv6110x.c
diff options
context:
space:
mode:
authorAndreas Regel <andreas.regel@gmx.de>2010-01-05 17:24:10 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 13:10:37 -0500
commitca108b39a75d9c6e8a18c8723ccb9c98fb8d6265 (patch)
tree478f40320967ec2ce7fd6598193c88ecada9b3fd /drivers/media/dvb/frontends/stv6110x.c
parent9045e729447192ab0ca27191ccab324c6b97fceb (diff)
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: Andreas Regel <andreas.regel@gmx.de> Signed-off-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends/stv6110x.c')
-rw-r--r--drivers/media/dvb/frontends/stv6110x.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/media/dvb/frontends/stv6110x.c b/drivers/media/dvb/frontends/stv6110x.c
index 945790ef3a43..f931ed07e92d 100644
--- a/drivers/media/dvb/frontends/stv6110x.c
+++ b/drivers/media/dvb/frontends/stv6110x.c
@@ -362,6 +362,7 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
362{ 362{
363 struct stv6110x_state *stv6110x; 363 struct stv6110x_state *stv6110x;
364 u8 default_regs[] = {0x07, 0x11, 0xdc, 0x85, 0x17, 0x01, 0xe6, 0x1e}; 364 u8 default_regs[] = {0x07, 0x11, 0xdc, 0x85, 0x17, 0x01, 0xe6, 0x1e};
365 int ret;
365 366
366 stv6110x = kzalloc(sizeof (struct stv6110x_state), GFP_KERNEL); 367 stv6110x = kzalloc(sizeof (struct stv6110x_state), GFP_KERNEL);
367 if (stv6110x == NULL) 368 if (stv6110x == NULL)
@@ -372,6 +373,43 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
372 stv6110x->devctl = &stv6110x_ctl; 373 stv6110x->devctl = &stv6110x_ctl;
373 memcpy(stv6110x->regs, default_regs, 8); 374 memcpy(stv6110x->regs, default_regs, 8);
374 375
376 /* setup divider */
377 switch (stv6110x->config->clk_div) {
378 default:
379 case 1:
380 STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_CO_DIV, 0);
381 break;
382 case 2:
383 STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_CO_DIV, 1);
384 break;
385 case 4:
386 STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_CO_DIV, 2);
387 break;
388 case 8:
389 case 0:
390 STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_CO_DIV, 3);
391 break;
392 }
393
394 if (fe->ops.i2c_gate_ctrl) {
395 ret = fe->ops.i2c_gate_ctrl(fe, 1);
396 if (ret < 0)
397 goto error;
398 }
399
400 ret = stv6110x_write_regs(stv6110x, 0, stv6110x->regs,
401 ARRAY_SIZE(stv6110x->regs));
402 if (ret < 0) {
403 dprintk(FE_ERROR, 1, "Initialization failed");
404 goto error;
405 }
406
407 if (fe->ops.i2c_gate_ctrl) {
408 ret = fe->ops.i2c_gate_ctrl(fe, 0);
409 if (ret < 0)
410 goto error;
411 }
412
375 fe->tuner_priv = stv6110x; 413 fe->tuner_priv = stv6110x;
376 fe->ops.tuner_ops = stv6110x_ops; 414 fe->ops.tuner_ops = stv6110x_ops;
377 415