diff options
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-dvb.c')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-dvb.c | 80 |
1 files changed, 36 insertions, 44 deletions
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 3315a48a848b..f65cad287b83 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -237,12 +237,39 @@ static struct tda18271_std_map mb86a20s_tda18271_std_map = { | |||
237 | static struct tda18271_config kworld_tda18271_config = { | 237 | static struct tda18271_config kworld_tda18271_config = { |
238 | .std_map = &mb86a20s_tda18271_std_map, | 238 | .std_map = &mb86a20s_tda18271_std_map, |
239 | .gate = TDA18271_GATE_DIGITAL, | 239 | .gate = TDA18271_GATE_DIGITAL, |
240 | .config = 3, /* Use tuner callback for AGC */ | ||
241 | |||
240 | }; | 242 | }; |
241 | 243 | ||
242 | static const struct mb86a20s_config kworld_mb86a20s_config = { | 244 | static const struct mb86a20s_config kworld_mb86a20s_config = { |
243 | .demod_address = 0x10, | 245 | .demod_address = 0x10, |
244 | }; | 246 | }; |
245 | 247 | ||
248 | static int kworld_sbtvd_gate_ctrl(struct dvb_frontend* fe, int enable) | ||
249 | { | ||
250 | struct saa7134_dev *dev = fe->dvb->priv; | ||
251 | |||
252 | unsigned char initmsg[] = {0x45, 0x97}; | ||
253 | unsigned char msg_enable[] = {0x45, 0xc1}; | ||
254 | unsigned char msg_disable[] = {0x45, 0x81}; | ||
255 | struct i2c_msg msg = {.addr = 0x4b, .flags = 0, .buf = initmsg, .len = 2}; | ||
256 | |||
257 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) { | ||
258 | wprintk("could not access the I2C gate\n"); | ||
259 | return -EIO; | ||
260 | } | ||
261 | if (enable) | ||
262 | msg.buf = msg_enable; | ||
263 | else | ||
264 | msg.buf = msg_disable; | ||
265 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) { | ||
266 | wprintk("could not access the I2C gate\n"); | ||
267 | return -EIO; | ||
268 | } | ||
269 | msleep(20); | ||
270 | return 0; | ||
271 | } | ||
272 | |||
246 | /* ================================================================== | 273 | /* ================================================================== |
247 | * tda1004x based DVB-T cards, helper functions | 274 | * tda1004x based DVB-T cards, helper functions |
248 | */ | 275 | */ |
@@ -623,37 +650,6 @@ static struct tda827x_config tda827x_cfg_2_sw42 = { | |||
623 | 650 | ||
624 | /* ------------------------------------------------------------------ */ | 651 | /* ------------------------------------------------------------------ */ |
625 | 652 | ||
626 | static int __kworld_sbtvd_i2c_gate_ctrl(struct saa7134_dev *dev, int enable) | ||
627 | { | ||
628 | unsigned char initmsg[] = {0x45, 0x97}; | ||
629 | unsigned char msg_enable[] = {0x45, 0xc1}; | ||
630 | unsigned char msg_disable[] = {0x45, 0x81}; | ||
631 | struct i2c_msg msg = {.addr = 0x4b, .flags = 0, .buf = initmsg, .len = 2}; | ||
632 | |||
633 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) { | ||
634 | wprintk("could not access the I2C gate\n"); | ||
635 | return -EIO; | ||
636 | } | ||
637 | if (enable) | ||
638 | msg.buf = msg_enable; | ||
639 | else | ||
640 | msg.buf = msg_disable; | ||
641 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) { | ||
642 | wprintk("could not access the I2C gate\n"); | ||
643 | return -EIO; | ||
644 | } | ||
645 | msleep(20); | ||
646 | return 0; | ||
647 | } | ||
648 | static int kworld_sbtvd_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) | ||
649 | { | ||
650 | struct saa7134_dev *dev = fe->dvb->priv; | ||
651 | |||
652 | return __kworld_sbtvd_i2c_gate_ctrl(dev, enable); | ||
653 | } | ||
654 | |||
655 | /* ------------------------------------------------------------------ */ | ||
656 | |||
657 | static struct tda1004x_config tda827x_lifeview_config = { | 653 | static struct tda1004x_config tda827x_lifeview_config = { |
658 | .demod_address = 0x08, | 654 | .demod_address = 0x08, |
659 | .invert = 1, | 655 | .invert = 1, |
@@ -1660,27 +1656,23 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1660 | } | 1656 | } |
1661 | break; | 1657 | break; |
1662 | case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG: | 1658 | case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG: |
1663 | __kworld_sbtvd_i2c_gate_ctrl(dev, 0); | 1659 | /* Switch to digital mode */ |
1664 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x14000); | 1660 | saa7134_tuner_callback(dev, 0, |
1665 | saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x14000); | 1661 | TDA18271_CALLBACK_CMD_AGC_ENABLE, 1); |
1666 | msleep(20); | ||
1667 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x54000); | ||
1668 | saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x54000); | ||
1669 | msleep(20); | ||
1670 | fe0->dvb.frontend = dvb_attach(mb86a20s_attach, | 1662 | fe0->dvb.frontend = dvb_attach(mb86a20s_attach, |
1671 | &kworld_mb86a20s_config, | 1663 | &kworld_mb86a20s_config, |
1672 | &dev->i2c_adap); | 1664 | &dev->i2c_adap); |
1673 | __kworld_sbtvd_i2c_gate_ctrl(dev, 1); | ||
1674 | if (fe0->dvb.frontend != NULL) { | 1665 | if (fe0->dvb.frontend != NULL) { |
1666 | dvb_attach(tda829x_attach, fe0->dvb.frontend, | ||
1667 | &dev->i2c_adap, 0x4b, | ||
1668 | &tda829x_no_probe); | ||
1675 | dvb_attach(tda18271_attach, fe0->dvb.frontend, | 1669 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
1676 | 0x60, &dev->i2c_adap, | 1670 | 0x60, &dev->i2c_adap, |
1677 | &kworld_tda18271_config); | 1671 | &kworld_tda18271_config); |
1678 | /* | 1672 | fe0->dvb.frontend->ops.i2c_gate_ctrl = kworld_sbtvd_gate_ctrl; |
1679 | * Only after success, it can initialize the gate, otherwise | ||
1680 | * an OOPS will hit, due to kfree(fe0->dvb.frontend) | ||
1681 | */ | ||
1682 | fe0->dvb.frontend->ops.i2c_gate_ctrl = kworld_sbtvd_i2c_gate_ctrl; | ||
1683 | } | 1673 | } |
1674 | |||
1675 | /* mb86a20s need to use the I2C gateway */ | ||
1684 | break; | 1676 | break; |
1685 | default: | 1677 | default: |
1686 | wprintk("Huh? unknown DVB card?\n"); | 1678 | wprintk("Huh? unknown DVB card?\n"); |