aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.c39
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.h1
2 files changed, 40 insertions, 0 deletions
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index 43084bfc0f18..e7978442fbe9 100644
--- a/drivers/media/dvb/frontends/dvb-pll.c
+++ b/drivers/media/dvb/frontends/dvb-pll.c
@@ -27,6 +27,17 @@
27/* ----------------------------------------------------------- */ 27/* ----------------------------------------------------------- */
28/* descriptions */ 28/* descriptions */
29 29
30/* Set AGC TOP value to 103 dBuV:
31 0x80 = Control Byte
32 0x40 = 250 uA charge pump (irrelevant)
33 0x18 = Aux Byte to follow
34 0x06 = 64.5 kHz divider (irrelevant)
35 0x01 = Disable Vt (aka sleep)
36
37 0x00 = AGC Time constant 2s Iagc = 300 nA (vs 0x80 = 9 nA)
38 0x50 = AGC Take over point = 103 dBuV */
39static u8 tua603x_agc103[] = { 2, 0x80|0x40|0x18|0x06|0x01, 0x00|0x50 };
40
30struct dvb_pll_desc dvb_pll_thomson_dtt7579 = { 41struct dvb_pll_desc dvb_pll_thomson_dtt7579 = {
31 .name = "Thomson dtt7579", 42 .name = "Thomson dtt7579",
32 .min = 177000000, 43 .min = 177000000,
@@ -113,6 +124,7 @@ struct dvb_pll_desc dvb_pll_thomson_dtt761x = {
113 .min = 57000000, 124 .min = 57000000,
114 .max = 863000000, 125 .max = 863000000,
115 .count = 3, 126 .count = 3,
127 .initdata = tua603x_agc103,
116 .entries = { 128 .entries = {
117 { 147000000, 44000000, 62500, 0x8e, 0x39 }, 129 { 147000000, 44000000, 62500, 0x8e, 0x39 },
118 { 417000000, 44000000, 62500, 0x8e, 0x3a }, 130 { 417000000, 44000000, 62500, 0x8e, 0x3a },
@@ -599,6 +611,31 @@ static int dvb_pll_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
599 return 0; 611 return 0;
600} 612}
601 613
614static int dvb_pll_init(struct dvb_frontend *fe)
615{
616 struct dvb_pll_priv *priv = fe->tuner_priv;
617
618 if (priv->i2c == NULL)
619 return -EINVAL;
620
621 if (priv->pll_desc->initdata) {
622 struct i2c_msg msg = { .flags = 0,
623 .addr = priv->pll_i2c_address,
624 .buf = priv->pll_desc->initdata + 1,
625 .len = priv->pll_desc->initdata[0] };
626
627 int result;
628 if (fe->ops.i2c_gate_ctrl)
629 fe->ops.i2c_gate_ctrl(fe, 1);
630 if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) {
631 return result;
632 }
633 return 0;
634 }
635 /* Shouldn't be called when initdata is NULL, maybe BUG()? */
636 return -EINVAL;
637}
638
602static struct dvb_tuner_ops dvb_pll_tuner_ops = { 639static struct dvb_tuner_ops dvb_pll_tuner_ops = {
603 .release = dvb_pll_release, 640 .release = dvb_pll_release,
604 .sleep = dvb_pll_sleep, 641 .sleep = dvb_pll_sleep,
@@ -644,6 +681,8 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr,
644 sizeof(fe->ops.tuner_ops.info.name)); 681 sizeof(fe->ops.tuner_ops.info.name));
645 fe->ops.tuner_ops.info.frequency_min = desc->min; 682 fe->ops.tuner_ops.info.frequency_min = desc->min;
646 fe->ops.tuner_ops.info.frequency_min = desc->max; 683 fe->ops.tuner_ops.info.frequency_min = desc->max;
684 if (desc->initdata)
685 fe->ops.tuner_ops.init = dvb_pll_init;
647 686
648 fe->tuner_priv = priv; 687 fe->tuner_priv = priv;
649 return fe; 688 return fe;
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h
index a5bd928d4202..bb79a78151f5 100644
--- a/drivers/media/dvb/frontends/dvb-pll.h
+++ b/drivers/media/dvb/frontends/dvb-pll.h
@@ -13,6 +13,7 @@ struct dvb_pll_desc {
13 u32 min; 13 u32 min;
14 u32 max; 14 u32 max;
15 void (*setbw)(u8 *buf, u32 freq, int bandwidth); 15 void (*setbw)(u8 *buf, u32 freq, int bandwidth);
16 u8 *initdata;
16 int count; 17 int count;
17 struct { 18 struct {
18 u32 limit; 19 u32 limit;