diff options
-rw-r--r-- | drivers/media/dvb/frontends/dvb-pll.c | 55 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dvb-pll.h | 1 |
2 files changed, 26 insertions, 30 deletions
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index c6651a12eb67..d29e0ae23ee6 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c | |||
@@ -43,9 +43,9 @@ struct dvb_pll_desc dvb_pll_thomson_dtt7579 = { | |||
43 | .min = 177000000, | 43 | .min = 177000000, |
44 | .max = 858000000, | 44 | .max = 858000000, |
45 | .iffreq= 36166667, | 45 | .iffreq= 36166667, |
46 | .count = 5, | 46 | .sleepdata = (u8[]){ 2, 0xb4, 0x03 }, |
47 | .count = 4, | ||
47 | .entries = { | 48 | .entries = { |
48 | { 0, 166667, 0xb4, 0x03 }, /* go sleep */ | ||
49 | { 443250000, 166667, 0xb4, 0x02 }, | 49 | { 443250000, 166667, 0xb4, 0x02 }, |
50 | { 542000000, 166667, 0xb4, 0x08 }, | 50 | { 542000000, 166667, 0xb4, 0x08 }, |
51 | { 771000000, 166667, 0xbc, 0x08 }, | 51 | { 771000000, 166667, 0xbc, 0x08 }, |
@@ -80,9 +80,9 @@ struct dvb_pll_desc dvb_pll_thomson_dtt759x = { | |||
80 | .max = 896000000, | 80 | .max = 896000000, |
81 | .setbw = thomson_dtt759x_bw, | 81 | .setbw = thomson_dtt759x_bw, |
82 | .iffreq= 36166667, | 82 | .iffreq= 36166667, |
83 | .count = 6, | 83 | .sleepdata = (u8[]){ 2, 0x84, 0x03 }, |
84 | .count = 5, | ||
84 | .entries = { | 85 | .entries = { |
85 | { 0, 166667, 0x84, 0x03 }, | ||
86 | { 264000000, 166667, 0xb4, 0x02 }, | 86 | { 264000000, 166667, 0xb4, 0x02 }, |
87 | { 470000000, 166667, 0xbc, 0x02 }, | 87 | { 470000000, 166667, 0xbc, 0x02 }, |
88 | { 735000000, 166667, 0xbc, 0x08 }, | 88 | { 735000000, 166667, 0xbc, 0x08 }, |
@@ -97,9 +97,9 @@ struct dvb_pll_desc dvb_pll_lg_z201 = { | |||
97 | .min = 174000000, | 97 | .min = 174000000, |
98 | .max = 862000000, | 98 | .max = 862000000, |
99 | .iffreq= 36166667, | 99 | .iffreq= 36166667, |
100 | .count = 6, | 100 | .sleepdata = (u8[]){ 2, 0xbc, 0x03 }, |
101 | .count = 5, | ||
101 | .entries = { | 102 | .entries = { |
102 | { 0, 166667, 0xbc, 0x03 }, | ||
103 | { 157500000, 166667, 0xbc, 0x01 }, | 103 | { 157500000, 166667, 0xbc, 0x01 }, |
104 | { 443250000, 166667, 0xbc, 0x02 }, | 104 | { 443250000, 166667, 0xbc, 0x02 }, |
105 | { 542000000, 166667, 0xbc, 0x04 }, | 105 | { 542000000, 166667, 0xbc, 0x04 }, |
@@ -521,35 +521,27 @@ static int dvb_pll_release(struct dvb_frontend *fe) | |||
521 | static int dvb_pll_sleep(struct dvb_frontend *fe) | 521 | static int dvb_pll_sleep(struct dvb_frontend *fe) |
522 | { | 522 | { |
523 | struct dvb_pll_priv *priv = fe->tuner_priv; | 523 | struct dvb_pll_priv *priv = fe->tuner_priv; |
524 | u8 buf[4]; | ||
525 | struct i2c_msg msg = | ||
526 | { .addr = priv->pll_i2c_address, .flags = 0, | ||
527 | .buf = buf, .len = sizeof(buf) }; | ||
528 | int i; | ||
529 | int result; | ||
530 | 524 | ||
531 | if (priv->i2c == NULL) | 525 | if (priv->i2c == NULL) |
532 | return -EINVAL; | 526 | return -EINVAL; |
533 | 527 | ||
534 | for (i = 0; i < priv->pll_desc->count; i++) { | 528 | if (priv->pll_desc->sleepdata) { |
535 | if (priv->pll_desc->entries[i].limit == 0) | 529 | struct i2c_msg msg = { .flags = 0, |
536 | break; | 530 | .addr = priv->pll_i2c_address, |
537 | } | 531 | .buf = priv->pll_desc->sleepdata + 1, |
538 | if (i == priv->pll_desc->count) | 532 | .len = priv->pll_desc->sleepdata[0] }; |
539 | return 0; | ||
540 | 533 | ||
541 | buf[0] = 0; | 534 | int result; |
542 | buf[1] = 0; | ||
543 | buf[2] = priv->pll_desc->entries[i].config; | ||
544 | buf[3] = priv->pll_desc->entries[i].cb; | ||
545 | 535 | ||
546 | if (fe->ops.i2c_gate_ctrl) | 536 | if (fe->ops.i2c_gate_ctrl) |
547 | fe->ops.i2c_gate_ctrl(fe, 1); | 537 | fe->ops.i2c_gate_ctrl(fe, 1); |
548 | if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) { | 538 | if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) { |
549 | return result; | 539 | return result; |
540 | } | ||
541 | return 0; | ||
550 | } | 542 | } |
551 | 543 | /* Shouldn't be called when initdata is NULL, maybe BUG()? */ | |
552 | return 0; | 544 | return -EINVAL; |
553 | } | 545 | } |
554 | 546 | ||
555 | static int dvb_pll_set_params(struct dvb_frontend *fe, | 547 | static int dvb_pll_set_params(struct dvb_frontend *fe, |
@@ -661,6 +653,7 @@ static int dvb_pll_init(struct dvb_frontend *fe) | |||
661 | static struct dvb_tuner_ops dvb_pll_tuner_ops = { | 653 | static struct dvb_tuner_ops dvb_pll_tuner_ops = { |
662 | .release = dvb_pll_release, | 654 | .release = dvb_pll_release, |
663 | .sleep = dvb_pll_sleep, | 655 | .sleep = dvb_pll_sleep, |
656 | .init = dvb_pll_init, | ||
664 | .set_params = dvb_pll_set_params, | 657 | .set_params = dvb_pll_set_params, |
665 | .calc_regs = dvb_pll_calc_regs, | 658 | .calc_regs = dvb_pll_calc_regs, |
666 | .get_frequency = dvb_pll_get_frequency, | 659 | .get_frequency = dvb_pll_get_frequency, |
@@ -703,8 +696,10 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, | |||
703 | sizeof(fe->ops.tuner_ops.info.name)); | 696 | sizeof(fe->ops.tuner_ops.info.name)); |
704 | fe->ops.tuner_ops.info.frequency_min = desc->min; | 697 | fe->ops.tuner_ops.info.frequency_min = desc->min; |
705 | fe->ops.tuner_ops.info.frequency_min = desc->max; | 698 | fe->ops.tuner_ops.info.frequency_min = desc->max; |
706 | if (desc->initdata) | 699 | if (!desc->initdata) |
707 | fe->ops.tuner_ops.init = dvb_pll_init; | 700 | fe->ops.tuner_ops.init = NULL; |
701 | if (!desc->sleepdata) | ||
702 | fe->ops.tuner_ops.sleep = NULL; | ||
708 | 703 | ||
709 | fe->tuner_priv = priv; | 704 | fe->tuner_priv = priv; |
710 | return fe; | 705 | return fe; |
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h index 40b2dca1bd51..d13a1c01c541 100644 --- a/drivers/media/dvb/frontends/dvb-pll.h +++ b/drivers/media/dvb/frontends/dvb-pll.h | |||
@@ -15,6 +15,7 @@ struct dvb_pll_desc { | |||
15 | u32 iffreq; | 15 | u32 iffreq; |
16 | void (*setbw)(u8 *buf, u32 freq, int bandwidth); | 16 | void (*setbw)(u8 *buf, u32 freq, int bandwidth); |
17 | u8 *initdata; | 17 | u8 *initdata; |
18 | u8 *sleepdata; | ||
18 | int count; | 19 | int count; |
19 | struct { | 20 | struct { |
20 | u32 limit; | 21 | u32 limit; |