diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-26 13:05:58 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-29 17:41:33 -0400 |
commit | c117d05cd4c09342f97ba1c6ef63f0bae3239a39 (patch) | |
tree | ad7a4eaad8672cc2015285b819b93d829b41aacc /drivers/media/video/saa7134 | |
parent | 397be5c4d66e6583ce3d38b0f99a56eb9818492b (diff) |
V4L/DVB (7753): saa7134: fix tuner setup
Tuner setup were happening during i2c attach callback. This means that it would
happen on two conditions:
1) if tuner module weren't load, it will happen at request_module("tuner");
2) if tuner is not compiled as a module, or it is already loaded
(for example, on setups with more than one tuner), it will happen
when saa7134 registers I2C bus.
Due to that, if tuner were loaded, tuner setup will happen _before_ reading
the proper values at tuner eeprom. Since set_addr refuses to change for a tuner
that were previously defined (except if the tuner_addr is set), this were
making eeprom tuner detection useless.
This patch removes tuner type setup from saa7134-i2c, moving it to the proper
place, after taking eeprom into account.
Reviewed-by: Hermann Pitton <hermann-pitton@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/saa7134')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-cards.c | 218 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-i2c.c | 42 |
2 files changed, 117 insertions, 143 deletions
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 98375955a84b..4046b23a3139 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -47,6 +47,9 @@ static char name_svideo[] = "S-Video"; | |||
47 | /* ------------------------------------------------------------------ */ | 47 | /* ------------------------------------------------------------------ */ |
48 | /* board config info */ | 48 | /* board config info */ |
49 | 49 | ||
50 | /* If radio_type !=UNSET, radio_addr should be specified | ||
51 | */ | ||
52 | |||
50 | struct saa7134_board saa7134_boards[] = { | 53 | struct saa7134_board saa7134_boards[] = { |
51 | [SAA7134_BOARD_UNKNOWN] = { | 54 | [SAA7134_BOARD_UNKNOWN] = { |
52 | .name = "UNKNOWN/GENERIC", | 55 | .name = "UNKNOWN/GENERIC", |
@@ -3087,7 +3090,7 @@ struct saa7134_board saa7134_boards[] = { | |||
3087 | .tuner_type = TUNER_PHILIPS_TD1316, /* untested */ | 3090 | .tuner_type = TUNER_PHILIPS_TD1316, /* untested */ |
3088 | .radio_type = TUNER_TEA5767, /* untested */ | 3091 | .radio_type = TUNER_TEA5767, /* untested */ |
3089 | .tuner_addr = ADDR_UNSET, | 3092 | .tuner_addr = ADDR_UNSET, |
3090 | .radio_addr = ADDR_UNSET, | 3093 | .radio_addr = 0x60, |
3091 | .tda9887_conf = TDA9887_PRESENT, | 3094 | .tda9887_conf = TDA9887_PRESENT, |
3092 | .mpeg = SAA7134_MPEG_DVB, | 3095 | .mpeg = SAA7134_MPEG_DVB, |
3093 | .inputs = {{ | 3096 | .inputs = {{ |
@@ -5577,20 +5580,87 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
5577 | return 0; | 5580 | return 0; |
5578 | } | 5581 | } |
5579 | 5582 | ||
5583 | static void saa7134_tuner_setup(struct saa7134_dev *dev) | ||
5584 | { | ||
5585 | struct tuner_setup tun_setup; | ||
5586 | unsigned int mode_mask = T_RADIO | | ||
5587 | T_ANALOG_TV | | ||
5588 | T_DIGITAL_TV; | ||
5589 | |||
5590 | memset(&tun_setup, 0, sizeof(tun_setup)); | ||
5591 | tun_setup.tuner_callback = saa7134_tuner_callback; | ||
5592 | |||
5593 | if (saa7134_boards[dev->board].radio_type != UNSET) { | ||
5594 | tun_setup.type = saa7134_boards[dev->board].radio_type; | ||
5595 | tun_setup.addr = saa7134_boards[dev->board].radio_addr; | ||
5596 | |||
5597 | tun_setup.mode_mask = T_RADIO; | ||
5598 | |||
5599 | saa7134_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup); | ||
5600 | mode_mask &= ~T_RADIO; | ||
5601 | } | ||
5602 | |||
5603 | if ((dev->tuner_type != TUNER_ABSENT) && (dev->tuner_type != UNSET)) { | ||
5604 | tun_setup.type = dev->tuner_type; | ||
5605 | tun_setup.addr = dev->tuner_addr; | ||
5606 | tun_setup.config = saa7134_boards[dev->board].tuner_config; | ||
5607 | tun_setup.tuner_callback = saa7134_tuner_callback; | ||
5608 | |||
5609 | tun_setup.mode_mask = mode_mask; | ||
5610 | |||
5611 | saa7134_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup); | ||
5612 | } | ||
5613 | |||
5614 | if (dev->tda9887_conf) { | ||
5615 | struct v4l2_priv_tun_config tda9887_cfg; | ||
5616 | |||
5617 | tda9887_cfg.tuner = TUNER_TDA9887; | ||
5618 | tda9887_cfg.priv = &dev->tda9887_conf; | ||
5619 | |||
5620 | saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, | ||
5621 | &tda9887_cfg); | ||
5622 | } | ||
5623 | |||
5624 | if (dev->tuner_type == TUNER_XC2028) { | ||
5625 | struct v4l2_priv_tun_config xc2028_cfg; | ||
5626 | struct xc2028_ctrl ctl; | ||
5627 | |||
5628 | memset(&xc2028_cfg, 0, sizeof(ctl)); | ||
5629 | memset(&ctl, 0, sizeof(ctl)); | ||
5630 | |||
5631 | ctl.fname = XC2028_DEFAULT_FIRMWARE; | ||
5632 | ctl.max_len = 64; | ||
5633 | |||
5634 | switch (dev->board) { | ||
5635 | case SAA7134_BOARD_AVERMEDIA_A16D: | ||
5636 | ctl.demod = XC3028_FE_ZARLINK456; | ||
5637 | break; | ||
5638 | default: | ||
5639 | ctl.demod = XC3028_FE_OREN538; | ||
5640 | ctl.mts = 1; | ||
5641 | } | ||
5642 | |||
5643 | xc2028_cfg.tuner = TUNER_XC2028; | ||
5644 | xc2028_cfg.priv = &ctl; | ||
5645 | |||
5646 | saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg); | ||
5647 | } | ||
5648 | } | ||
5649 | |||
5580 | /* stuff which needs working i2c */ | 5650 | /* stuff which needs working i2c */ |
5581 | int saa7134_board_init2(struct saa7134_dev *dev) | 5651 | int saa7134_board_init2(struct saa7134_dev *dev) |
5582 | { | 5652 | { |
5583 | unsigned char buf; | 5653 | unsigned char buf; |
5584 | int board; | 5654 | int board; |
5585 | struct tuner_setup tun_setup; | 5655 | |
5586 | tun_setup.config = 0; | 5656 | dev->tuner_type = saa7134_boards[dev->board].tuner_type; |
5587 | tun_setup.tuner_callback = saa7134_tuner_callback; | 5657 | dev->tuner_addr = saa7134_boards[dev->board].tuner_addr; |
5588 | 5658 | ||
5589 | switch (dev->board) { | 5659 | switch (dev->board) { |
5590 | case SAA7134_BOARD_BMK_MPEX_NOTUNER: | 5660 | case SAA7134_BOARD_BMK_MPEX_NOTUNER: |
5591 | case SAA7134_BOARD_BMK_MPEX_TUNER: | 5661 | case SAA7134_BOARD_BMK_MPEX_TUNER: |
5592 | dev->i2c_client.addr = 0x60; | 5662 | dev->i2c_client.addr = 0x60; |
5593 | board = (i2c_master_recv(&dev->i2c_client,&buf,0) < 0) | 5663 | board = (i2c_master_recv(&dev->i2c_client, &buf, 0) < 0) |
5594 | ? SAA7134_BOARD_BMK_MPEX_NOTUNER | 5664 | ? SAA7134_BOARD_BMK_MPEX_NOTUNER |
5595 | : SAA7134_BOARD_BMK_MPEX_TUNER; | 5665 | : SAA7134_BOARD_BMK_MPEX_TUNER; |
5596 | if (board == dev->board) | 5666 | if (board == dev->board) |
@@ -5600,21 +5670,9 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
5600 | saa7134_boards[dev->board].name); | 5670 | saa7134_boards[dev->board].name); |
5601 | dev->tuner_type = saa7134_boards[dev->board].tuner_type; | 5671 | dev->tuner_type = saa7134_boards[dev->board].tuner_type; |
5602 | 5672 | ||
5603 | if (TUNER_ABSENT != dev->tuner_type) { | ||
5604 | tun_setup.mode_mask = T_RADIO | | ||
5605 | T_ANALOG_TV | | ||
5606 | T_DIGITAL_TV; | ||
5607 | tun_setup.type = dev->tuner_type; | ||
5608 | tun_setup.addr = ADDR_UNSET; | ||
5609 | tun_setup.tuner_callback = saa7134_tuner_callback; | ||
5610 | |||
5611 | saa7134_i2c_call_clients(dev, | ||
5612 | TUNER_SET_TYPE_ADDR, | ||
5613 | &tun_setup); | ||
5614 | } | ||
5615 | break; | 5673 | break; |
5616 | case SAA7134_BOARD_MD7134: | 5674 | case SAA7134_BOARD_MD7134: |
5617 | { | 5675 | { |
5618 | u8 subaddr; | 5676 | u8 subaddr; |
5619 | u8 data[3]; | 5677 | u8 data[3]; |
5620 | int ret, tuner_t; | 5678 | int ret, tuner_t; |
@@ -5667,30 +5725,8 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
5667 | } | 5725 | } |
5668 | 5726 | ||
5669 | printk(KERN_INFO "%s Tuner type is %d\n", dev->name, dev->tuner_type); | 5727 | printk(KERN_INFO "%s Tuner type is %d\n", dev->name, dev->tuner_type); |
5670 | if (dev->tuner_type == TUNER_PHILIPS_FMD1216ME_MK3) { | ||
5671 | struct v4l2_priv_tun_config tda9887_cfg; | ||
5672 | |||
5673 | tda9887_cfg.tuner = TUNER_TDA9887; | ||
5674 | tda9887_cfg.priv = &dev->tda9887_conf; | ||
5675 | |||
5676 | dev->tda9887_conf = TDA9887_PRESENT | | ||
5677 | TDA9887_PORT1_ACTIVE | | ||
5678 | TDA9887_PORT2_ACTIVE; | ||
5679 | |||
5680 | saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, | ||
5681 | &tda9887_cfg); | ||
5682 | } | ||
5683 | |||
5684 | tun_setup.mode_mask = T_RADIO | | ||
5685 | T_ANALOG_TV | | ||
5686 | T_DIGITAL_TV; | ||
5687 | tun_setup.type = dev->tuner_type; | ||
5688 | tun_setup.addr = ADDR_UNSET; | ||
5689 | |||
5690 | saa7134_i2c_call_clients(dev, | ||
5691 | TUNER_SET_TYPE_ADDR, &tun_setup); | ||
5692 | } | ||
5693 | break; | 5728 | break; |
5729 | } | ||
5694 | case SAA7134_BOARD_PHILIPS_EUROPA: | 5730 | case SAA7134_BOARD_PHILIPS_EUROPA: |
5695 | if (dev->autodetected && (dev->eedata[0x41] == 0x1c)) { | 5731 | if (dev->autodetected && (dev->eedata[0x41] == 0x1c)) { |
5696 | /* Reconfigure board as Snake reference design */ | 5732 | /* Reconfigure board as Snake reference design */ |
@@ -5702,43 +5738,43 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
5702 | } | 5738 | } |
5703 | case SAA7134_BOARD_VIDEOMATE_DVBT_300: | 5739 | case SAA7134_BOARD_VIDEOMATE_DVBT_300: |
5704 | case SAA7134_BOARD_ASUS_EUROPA2_HYBRID: | 5740 | case SAA7134_BOARD_ASUS_EUROPA2_HYBRID: |
5741 | { | ||
5742 | |||
5705 | /* The Philips EUROPA based hybrid boards have the tuner connected through | 5743 | /* The Philips EUROPA based hybrid boards have the tuner connected through |
5706 | * the channel decoder. We have to make it transparent to find it | 5744 | * the channel decoder. We have to make it transparent to find it |
5707 | */ | 5745 | */ |
5708 | { | ||
5709 | u8 data[] = { 0x07, 0x02}; | 5746 | u8 data[] = { 0x07, 0x02}; |
5710 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; | 5747 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; |
5711 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 5748 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
5712 | 5749 | ||
5713 | tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; | ||
5714 | tun_setup.type = dev->tuner_type; | ||
5715 | tun_setup.addr = dev->tuner_addr; | ||
5716 | |||
5717 | saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup); | ||
5718 | } | ||
5719 | break; | 5750 | break; |
5751 | } | ||
5720 | case SAA7134_BOARD_PHILIPS_TIGER: | 5752 | case SAA7134_BOARD_PHILIPS_TIGER: |
5721 | case SAA7134_BOARD_PHILIPS_TIGER_S: | 5753 | case SAA7134_BOARD_PHILIPS_TIGER_S: |
5722 | { | 5754 | { |
5723 | u8 data[] = { 0x3c, 0x33, 0x60}; | 5755 | u8 data[] = { 0x3c, 0x33, 0x60}; |
5724 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; | 5756 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; |
5725 | if(dev->autodetected && (dev->eedata[0x49] == 0x50)) { | 5757 | if (dev->autodetected && (dev->eedata[0x49] == 0x50)) { |
5726 | dev->board = SAA7134_BOARD_PHILIPS_TIGER_S; | 5758 | dev->board = SAA7134_BOARD_PHILIPS_TIGER_S; |
5727 | printk(KERN_INFO "%s: Reconfigured board as %s\n", | 5759 | printk(KERN_INFO "%s: Reconfigured board as %s\n", |
5728 | dev->name, saa7134_boards[dev->board].name); | 5760 | dev->name, saa7134_boards[dev->board].name); |
5729 | } | 5761 | } |
5730 | if(dev->board == SAA7134_BOARD_PHILIPS_TIGER_S) { | 5762 | if (dev->board == SAA7134_BOARD_PHILIPS_TIGER_S) { |
5731 | tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; | 5763 | dev->tuner_type = TUNER_PHILIPS_TDA8290; |
5732 | tun_setup.type = TUNER_PHILIPS_TDA8290; | 5764 | |
5733 | tun_setup.addr = 0x4b; | 5765 | saa7134_tuner_setup(dev); |
5734 | tun_setup.config = 2; | ||
5735 | 5766 | ||
5736 | saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup); | ||
5737 | data[2] = 0x68; | 5767 | data[2] = 0x68; |
5768 | i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
5769 | |||
5770 | /* Tuner setup is handled before I2C transfer. | ||
5771 | Due to that, there's no need to do it later | ||
5772 | */ | ||
5773 | return 0; | ||
5738 | } | 5774 | } |
5739 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 5775 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
5740 | } | ||
5741 | break; | 5776 | break; |
5777 | } | ||
5742 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: | 5778 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: |
5743 | hauppauge_eeprom(dev, dev->eedata+0x80); | 5779 | hauppauge_eeprom(dev, dev->eedata+0x80); |
5744 | /* break intentionally omitted */ | 5780 | /* break intentionally omitted */ |
@@ -5751,52 +5787,55 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
5751 | case SAA7134_BOARD_AVERMEDIA_SUPER_007: | 5787 | case SAA7134_BOARD_AVERMEDIA_SUPER_007: |
5752 | case SAA7134_BOARD_TWINHAN_DTV_DVB_3056: | 5788 | case SAA7134_BOARD_TWINHAN_DTV_DVB_3056: |
5753 | case SAA7134_BOARD_CREATIX_CTX953: | 5789 | case SAA7134_BOARD_CREATIX_CTX953: |
5790 | { | ||
5754 | /* this is a hybrid board, initialize to analog mode | 5791 | /* this is a hybrid board, initialize to analog mode |
5755 | * and configure firmware eeprom address | 5792 | * and configure firmware eeprom address |
5756 | */ | 5793 | */ |
5757 | { | ||
5758 | u8 data[] = { 0x3c, 0x33, 0x60}; | 5794 | u8 data[] = { 0x3c, 0x33, 0x60}; |
5759 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; | 5795 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; |
5760 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 5796 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
5761 | } | ||
5762 | break; | 5797 | break; |
5798 | } | ||
5763 | case SAA7134_BOARD_FLYDVB_TRIO: | 5799 | case SAA7134_BOARD_FLYDVB_TRIO: |
5764 | { | 5800 | { |
5765 | u8 data[] = { 0x3c, 0x33, 0x62}; | 5801 | u8 data[] = { 0x3c, 0x33, 0x62}; |
5766 | struct i2c_msg msg = {.addr=0x09, .flags=0, .buf=data, .len = sizeof(data)}; | 5802 | struct i2c_msg msg = {.addr=0x09, .flags=0, .buf=data, .len = sizeof(data)}; |
5767 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 5803 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
5768 | } | ||
5769 | break; | 5804 | break; |
5805 | } | ||
5770 | case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: | 5806 | case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: |
5771 | case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS: | 5807 | case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS: |
5808 | { | ||
5772 | /* initialize analog mode */ | 5809 | /* initialize analog mode */ |
5773 | { | ||
5774 | u8 data[] = { 0x3c, 0x33, 0x6a}; | 5810 | u8 data[] = { 0x3c, 0x33, 0x6a}; |
5775 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; | 5811 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; |
5776 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 5812 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
5777 | } | ||
5778 | break; | 5813 | break; |
5814 | } | ||
5779 | case SAA7134_BOARD_CINERGY_HT_PCMCIA: | 5815 | case SAA7134_BOARD_CINERGY_HT_PCMCIA: |
5780 | case SAA7134_BOARD_CINERGY_HT_PCI: | 5816 | case SAA7134_BOARD_CINERGY_HT_PCI: |
5817 | { | ||
5781 | /* initialize analog mode */ | 5818 | /* initialize analog mode */ |
5782 | { | ||
5783 | u8 data[] = { 0x3c, 0x33, 0x68}; | 5819 | u8 data[] = { 0x3c, 0x33, 0x68}; |
5784 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; | 5820 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; |
5785 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 5821 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
5786 | } | ||
5787 | break; | 5822 | break; |
5823 | } | ||
5788 | case SAA7134_BOARD_KWORLD_ATSC110: | 5824 | case SAA7134_BOARD_KWORLD_ATSC110: |
5789 | { | 5825 | { |
5790 | /* enable tuner */ | 5826 | /* enable tuner */ |
5791 | int i; | 5827 | int i; |
5792 | static const u8 buffer [] = { 0x10,0x12,0x13,0x04,0x16,0x00,0x14,0x04,0x017,0x00 }; | 5828 | static const u8 buffer [] = { 0x10, 0x12, 0x13, 0x04, 0x16, |
5793 | dev->i2c_client.addr = 0x0a; | 5829 | 0x00, 0x14, 0x04, 0x17, 0x00 }; |
5794 | for (i = 0; i < 5; i++) | 5830 | dev->i2c_client.addr = 0x0a; |
5795 | if (2 != i2c_master_send(&dev->i2c_client,&buffer[i*2],2)) | 5831 | for (i = 0; i < 5; i++) |
5796 | printk(KERN_WARNING "%s: Unable to enable tuner(%i).\n", | 5832 | if (2 != i2c_master_send(&dev->i2c_client, |
5797 | dev->name, i); | 5833 | &buffer[i*2], 2)) |
5798 | } | 5834 | printk(KERN_WARNING |
5835 | "%s: Unable to enable tuner(%i).\n", | ||
5836 | dev->name, i); | ||
5799 | break; | 5837 | break; |
5838 | } | ||
5800 | case SAA7134_BOARD_VIDEOMATE_DVBT_200: | 5839 | case SAA7134_BOARD_VIDEOMATE_DVBT_200: |
5801 | case SAA7134_BOARD_VIDEOMATE_DVBT_200A: | 5840 | case SAA7134_BOARD_VIDEOMATE_DVBT_200A: |
5802 | /* The T200 and the T200A share the same pci id. Consequently, | 5841 | /* The T200 and the T200A share the same pci id. Consequently, |
@@ -5821,7 +5860,7 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
5821 | } | 5860 | } |
5822 | break; | 5861 | break; |
5823 | case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM: | 5862 | case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM: |
5824 | { | 5863 | { |
5825 | struct v4l2_priv_tun_config tea5767_cfg; | 5864 | struct v4l2_priv_tun_config tea5767_cfg; |
5826 | struct tea5767_ctrl ctl; | 5865 | struct tea5767_ctrl ctl; |
5827 | 5866 | ||
@@ -5832,34 +5871,11 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
5832 | tea5767_cfg.tuner = TUNER_TEA5767; | 5871 | tea5767_cfg.tuner = TUNER_TEA5767; |
5833 | tea5767_cfg.priv = &ctl; | 5872 | tea5767_cfg.priv = &ctl; |
5834 | saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &tea5767_cfg); | 5873 | saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &tea5767_cfg); |
5835 | } | ||
5836 | break; | 5874 | break; |
5837 | } | 5875 | } |
5876 | } /* switch() */ | ||
5838 | 5877 | ||
5839 | if (dev->tuner_type == TUNER_XC2028) { | 5878 | saa7134_tuner_setup(dev); |
5840 | struct v4l2_priv_tun_config xc2028_cfg; | ||
5841 | struct xc2028_ctrl ctl; | ||
5842 | |||
5843 | memset(&xc2028_cfg, 0, sizeof(ctl)); | ||
5844 | memset(&ctl, 0, sizeof(ctl)); | ||
5845 | |||
5846 | ctl.fname = XC2028_DEFAULT_FIRMWARE; | ||
5847 | ctl.max_len = 64; | ||
5848 | |||
5849 | switch (dev->board) { | ||
5850 | case SAA7134_BOARD_AVERMEDIA_A16D: | ||
5851 | ctl.demod = XC3028_FE_ZARLINK456; | ||
5852 | break; | ||
5853 | default: | ||
5854 | ctl.demod = XC3028_FE_OREN538; | ||
5855 | ctl.mts = 1; | ||
5856 | } | ||
5857 | |||
5858 | xc2028_cfg.tuner = TUNER_XC2028; | ||
5859 | xc2028_cfg.priv = &ctl; | ||
5860 | |||
5861 | saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg); | ||
5862 | } | ||
5863 | 5879 | ||
5864 | return 0; | 5880 | return 0; |
5865 | } | 5881 | } |
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index 2ccfaba0c490..d8af3863f2d3 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c | |||
@@ -324,8 +324,6 @@ static u32 functionality(struct i2c_adapter *adap) | |||
324 | static int attach_inform(struct i2c_client *client) | 324 | static int attach_inform(struct i2c_client *client) |
325 | { | 325 | { |
326 | struct saa7134_dev *dev = client->adapter->algo_data; | 326 | struct saa7134_dev *dev = client->adapter->algo_data; |
327 | int tuner = dev->tuner_type; | ||
328 | struct tuner_setup tun_setup; | ||
329 | 327 | ||
330 | d1printk( "%s i2c attach [addr=0x%x,client=%s]\n", | 328 | d1printk( "%s i2c attach [addr=0x%x,client=%s]\n", |
331 | client->driver->driver.name, client->addr, client->name); | 329 | client->driver->driver.name, client->addr, client->name); |
@@ -346,46 +344,6 @@ static int attach_inform(struct i2c_client *client) | |||
346 | } | 344 | } |
347 | } | 345 | } |
348 | 346 | ||
349 | if (!client->driver->command) | ||
350 | return 0; | ||
351 | |||
352 | if (saa7134_boards[dev->board].radio_type != UNSET) { | ||
353 | |||
354 | tun_setup.type = saa7134_boards[dev->board].radio_type; | ||
355 | tun_setup.addr = saa7134_boards[dev->board].radio_addr; | ||
356 | |||
357 | if ((tun_setup.addr == ADDR_UNSET) || (tun_setup.addr == client->addr)) { | ||
358 | tun_setup.mode_mask = T_RADIO; | ||
359 | |||
360 | client->driver->command(client, TUNER_SET_TYPE_ADDR, &tun_setup); | ||
361 | } | ||
362 | } | ||
363 | |||
364 | if (tuner != UNSET) { | ||
365 | tun_setup.type = tuner; | ||
366 | tun_setup.addr = saa7134_boards[dev->board].tuner_addr; | ||
367 | tun_setup.config = saa7134_boards[dev->board].tuner_config; | ||
368 | tun_setup.tuner_callback = saa7134_tuner_callback; | ||
369 | |||
370 | if ((tun_setup.addr == ADDR_UNSET)||(tun_setup.addr == client->addr)) { | ||
371 | |||
372 | tun_setup.mode_mask = T_ANALOG_TV; | ||
373 | |||
374 | client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_setup); | ||
375 | } | ||
376 | |||
377 | if (tuner == TUNER_TDA9887) { | ||
378 | struct v4l2_priv_tun_config tda9887_cfg; | ||
379 | |||
380 | tda9887_cfg.tuner = TUNER_TDA9887; | ||
381 | tda9887_cfg.priv = &dev->tda9887_conf; | ||
382 | |||
383 | client->driver->command(client, TUNER_SET_CONFIG, | ||
384 | &tda9887_cfg); | ||
385 | } | ||
386 | } | ||
387 | |||
388 | |||
389 | return 0; | 347 | return 0; |
390 | } | 348 | } |
391 | 349 | ||