aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134/saa7134-cards.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-cards.c')
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c333
1 files changed, 280 insertions, 53 deletions
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index e2febcd6e529..a790a7246a63 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -31,6 +31,7 @@
31#include <media/v4l2-common.h> 31#include <media/v4l2-common.h>
32#include <media/tveeprom.h> 32#include <media/tveeprom.h>
33#include "tea5767.h" 33#include "tea5767.h"
34#include "tda18271.h"
34 35
35/* commly used strings */ 36/* commly used strings */
36static char name_mute[] = "mute"; 37static char name_mute[] = "mute";
@@ -272,6 +273,7 @@ struct saa7134_board saa7134_boards[] = {
272 .radio_type = UNSET, 273 .radio_type = UNSET,
273 .tuner_addr = ADDR_UNSET, 274 .tuner_addr = ADDR_UNSET,
274 .radio_addr = ADDR_UNSET, 275 .radio_addr = ADDR_UNSET,
276 .empress_addr = 0x20,
275 277
276 .inputs = {{ 278 .inputs = {{
277 .name = name_comp1, 279 .name = name_comp1,
@@ -408,6 +410,7 @@ struct saa7134_board saa7134_boards[] = {
408 .radio_type = UNSET, 410 .radio_type = UNSET,
409 .tuner_addr = ADDR_UNSET, 411 .tuner_addr = ADDR_UNSET,
410 .radio_addr = ADDR_UNSET, 412 .radio_addr = ADDR_UNSET,
413 .empress_addr = 0x20,
411 .tda9887_conf = TDA9887_PRESENT, 414 .tda9887_conf = TDA9887_PRESENT,
412 .gpiomask = 0x820000, 415 .gpiomask = 0x820000,
413 .inputs = {{ 416 .inputs = {{
@@ -818,6 +821,7 @@ struct saa7134_board saa7134_boards[] = {
818 .radio_type = UNSET, 821 .radio_type = UNSET,
819 .tuner_addr = ADDR_UNSET, 822 .tuner_addr = ADDR_UNSET,
820 .radio_addr = ADDR_UNSET, 823 .radio_addr = ADDR_UNSET,
824 .empress_addr = 0x20,
821 .inputs = {{ 825 .inputs = {{
822 .name = name_comp1, 826 .name = name_comp1,
823 .vmux = 4, 827 .vmux = 4,
@@ -977,6 +981,7 @@ struct saa7134_board saa7134_boards[] = {
977 .radio_type = UNSET, 981 .radio_type = UNSET,
978 .tuner_addr = ADDR_UNSET, 982 .tuner_addr = ADDR_UNSET,
979 .radio_addr = ADDR_UNSET, 983 .radio_addr = ADDR_UNSET,
984 .empress_addr = 0x20,
980 .inputs = {{ 985 .inputs = {{
981 .name = name_comp1, 986 .name = name_comp1,
982 .vmux = 1, 987 .vmux = 1,
@@ -1699,6 +1704,7 @@ struct saa7134_board saa7134_boards[] = {
1699 .radio_type = UNSET, 1704 .radio_type = UNSET,
1700 .tuner_addr = ADDR_UNSET, 1705 .tuner_addr = ADDR_UNSET,
1701 .radio_addr = ADDR_UNSET, 1706 .radio_addr = ADDR_UNSET,
1707 .rds_addr = 0x10,
1702 .tda9887_conf = TDA9887_PRESENT, 1708 .tda9887_conf = TDA9887_PRESENT,
1703 .inputs = {{ 1709 .inputs = {{
1704 .name = name_tv, 1710 .name = name_tv,
@@ -2364,6 +2370,7 @@ struct saa7134_board saa7134_boards[] = {
2364 .radio_type = UNSET, 2370 .radio_type = UNSET,
2365 .tuner_addr = ADDR_UNSET, 2371 .tuner_addr = ADDR_UNSET,
2366 .radio_addr = ADDR_UNSET, 2372 .radio_addr = ADDR_UNSET,
2373 .empress_addr = 0x21,
2367 .inputs = {{ 2374 .inputs = {{
2368 .name = "Composite 0", 2375 .name = "Composite 0",
2369 .vmux = 0, 2376 .vmux = 0,
@@ -3291,6 +3298,68 @@ struct saa7134_board saa7134_boards[] = {
3291 .gpio = 0x0200100, 3298 .gpio = 0x0200100,
3292 }, 3299 },
3293 }, 3300 },
3301 [SAA7134_BOARD_HAUPPAUGE_HVR1120] = {
3302 .name = "Hauppauge WinTV-HVR1120 ATSC/QAM-Hybrid",
3303 .audio_clock = 0x00187de7,
3304 .tuner_type = TUNER_PHILIPS_TDA8290,
3305 .radio_type = UNSET,
3306 .tuner_addr = ADDR_UNSET,
3307 .radio_addr = ADDR_UNSET,
3308 .tuner_config = 3,
3309 .mpeg = SAA7134_MPEG_DVB,
3310 .ts_type = SAA7134_MPEG_TS_SERIAL,
3311 .gpiomask = 0x0800100, /* GPIO 21 is an INPUT */
3312 .inputs = {{
3313 .name = name_tv,
3314 .vmux = 1,
3315 .amux = TV,
3316 .tv = 1,
3317 .gpio = 0x0000100,
3318 }, {
3319 .name = name_comp1,
3320 .vmux = 3,
3321 .amux = LINE1,
3322 }, {
3323 .name = name_svideo,
3324 .vmux = 8,
3325 .amux = LINE1,
3326 } },
3327 .radio = {
3328 .name = name_radio,
3329 .amux = TV,
3330 .gpio = 0x0800100, /* GPIO 23 HI for FM */
3331 },
3332 },
3333 [SAA7134_BOARD_HAUPPAUGE_HVR1110R3] = {
3334 .name = "Hauppauge WinTV-HVR1110r3",
3335 .audio_clock = 0x00187de7,
3336 .tuner_type = TUNER_PHILIPS_TDA8290,
3337 .radio_type = UNSET,
3338 .tuner_addr = ADDR_UNSET,
3339 .radio_addr = ADDR_UNSET,
3340 .tuner_config = 3,
3341 .gpiomask = 0x0800100, /* GPIO 21 is an INPUT */
3342 .inputs = {{
3343 .name = name_tv,
3344 .vmux = 1,
3345 .amux = TV,
3346 .tv = 1,
3347 .gpio = 0x0000100,
3348 }, {
3349 .name = name_comp1,
3350 .vmux = 3,
3351 .amux = LINE1,
3352 }, {
3353 .name = name_svideo,
3354 .vmux = 8,
3355 .amux = LINE1,
3356 } },
3357 .radio = {
3358 .name = name_radio,
3359 .amux = TV,
3360 .gpio = 0x0800100, /* GPIO 23 HI for FM */
3361 },
3362 },
3294 [SAA7134_BOARD_CINERGY_HT_PCMCIA] = { 3363 [SAA7134_BOARD_CINERGY_HT_PCMCIA] = {
3295 .name = "Terratec Cinergy HT PCMCIA", 3364 .name = "Terratec Cinergy HT PCMCIA",
3296 .audio_clock = 0x00187de7, 3365 .audio_clock = 0x00187de7,
@@ -4070,6 +4139,7 @@ struct saa7134_board saa7134_boards[] = {
4070 .radio_type = UNSET, 4139 .radio_type = UNSET,
4071 .tuner_addr = ADDR_UNSET, 4140 .tuner_addr = ADDR_UNSET,
4072 .radio_addr = ADDR_UNSET, 4141 .radio_addr = ADDR_UNSET,
4142 .empress_addr = 0x20,
4073 .tda9887_conf = TDA9887_PRESENT, 4143 .tda9887_conf = TDA9887_PRESENT,
4074 .inputs = { { 4144 .inputs = { {
4075 .name = name_tv, 4145 .name = name_tv,
@@ -4106,6 +4176,7 @@ struct saa7134_board saa7134_boards[] = {
4106 .radio_type = UNSET, 4176 .radio_type = UNSET,
4107 .tuner_addr = ADDR_UNSET, 4177 .tuner_addr = ADDR_UNSET,
4108 .radio_addr = ADDR_UNSET, 4178 .radio_addr = ADDR_UNSET,
4179 .empress_addr = 0x20,
4109 .tda9887_conf = TDA9887_PRESENT, 4180 .tda9887_conf = TDA9887_PRESENT,
4110 .inputs = { { 4181 .inputs = { {
4111 .name = name_tv, 4182 .name = name_tv,
@@ -4143,6 +4214,7 @@ struct saa7134_board saa7134_boards[] = {
4143 .radio_type = UNSET, 4214 .radio_type = UNSET,
4144 .tuner_addr = ADDR_UNSET, 4215 .tuner_addr = ADDR_UNSET,
4145 .radio_addr = ADDR_UNSET, 4216 .radio_addr = ADDR_UNSET,
4217 .empress_addr = 0x20,
4146 .tda9887_conf = TDA9887_PRESENT, 4218 .tda9887_conf = TDA9887_PRESENT,
4147 .inputs = { { 4219 .inputs = { {
4148 .name = name_tv, 4220 .name = name_tv,
@@ -4323,13 +4395,13 @@ struct saa7134_board saa7134_boards[] = {
4323 .amux = TV, 4395 .amux = TV,
4324 .tv = 1, 4396 .tv = 1,
4325 }, { 4397 }, {
4326 .name = name_comp, 4398 .name = name_comp1,
4327 .vmux = 0, 4399 .vmux = 3,
4328 .amux = LINE1, 4400 .amux = LINE1,
4329 }, { 4401 }, {
4330 .name = name_svideo, 4402 .name = name_svideo,
4331 .vmux = 8, 4403 .vmux = 8,
4332 .amux = LINE1, 4404 .amux = LINE2,
4333 } }, 4405 } },
4334 .radio = { 4406 .radio = {
4335 .name = name_radio, 4407 .name = name_radio,
@@ -4421,8 +4493,7 @@ struct saa7134_board saa7134_boards[] = {
4421 .radio_type = UNSET, 4493 .radio_type = UNSET,
4422 .tuner_addr = ADDR_UNSET, 4494 .tuner_addr = ADDR_UNSET,
4423 .radio_addr = ADDR_UNSET, 4495 .radio_addr = ADDR_UNSET,
4424 /* no DVB support for now */ 4496 .mpeg = SAA7134_MPEG_DVB,
4425 /* .mpeg = SAA7134_MPEG_DVB, */
4426 .inputs = { { 4497 .inputs = { {
4427 .name = name_comp, 4498 .name = name_comp,
4428 .vmux = 1, 4499 .vmux = 1,
@@ -4441,8 +4512,7 @@ struct saa7134_board saa7134_boards[] = {
4441 .radio_type = UNSET, 4512 .radio_type = UNSET,
4442 .tuner_addr = ADDR_UNSET, 4513 .tuner_addr = ADDR_UNSET,
4443 .radio_addr = ADDR_UNSET, 4514 .radio_addr = ADDR_UNSET,
4444 /* no DVB support for now */ 4515 .mpeg = SAA7134_MPEG_DVB,
4445 /* .mpeg = SAA7134_MPEG_DVB, */
4446 .inputs = { { 4516 .inputs = { {
4447 .name = name_comp, 4517 .name = name_comp,
4448 .vmux = 1, 4518 .vmux = 1,
@@ -4611,7 +4681,7 @@ struct saa7134_board saa7134_boards[] = {
4611 .tuner_type = TUNER_YMEC_TVF_5533MF, 4681 .tuner_type = TUNER_YMEC_TVF_5533MF,
4612 .radio_type = TUNER_TEA5767, 4682 .radio_type = TUNER_TEA5767,
4613 .tuner_addr = ADDR_UNSET, 4683 .tuner_addr = ADDR_UNSET,
4614 .radio_addr = ADDR_UNSET, 4684 .radio_addr = 0x60,
4615 .gpiomask = 0x80000700, 4685 .gpiomask = 0x80000700,
4616 .inputs = { { 4686 .inputs = { {
4617 .name = name_tv, 4687 .name = name_tv,
@@ -5405,6 +5475,36 @@ struct pci_device_id saa7134_pci_tbl[] = {
5405 },{ 5475 },{
5406 .vendor = PCI_VENDOR_ID_PHILIPS, 5476 .vendor = PCI_VENDOR_ID_PHILIPS,
5407 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 5477 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5478 .subvendor = 0x0070,
5479 .subdevice = 0x6706,
5480 .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1120,
5481 },{
5482 .vendor = PCI_VENDOR_ID_PHILIPS,
5483 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5484 .subvendor = 0x0070,
5485 .subdevice = 0x6707,
5486 .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1110R3,
5487 },{
5488 .vendor = PCI_VENDOR_ID_PHILIPS,
5489 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5490 .subvendor = 0x0070,
5491 .subdevice = 0x6708,
5492 .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1120,
5493 },{
5494 .vendor = PCI_VENDOR_ID_PHILIPS,
5495 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5496 .subvendor = 0x0070,
5497 .subdevice = 0x6709,
5498 .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1110R3,
5499 },{
5500 .vendor = PCI_VENDOR_ID_PHILIPS,
5501 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5502 .subvendor = 0x0070,
5503 .subdevice = 0x670a,
5504 .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1110R3,
5505 },{
5506 .vendor = PCI_VENDOR_ID_PHILIPS,
5507 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5408 .subvendor = 0x153b, 5508 .subvendor = 0x153b,
5409 .subdevice = 0x1172, 5509 .subdevice = 0x1172,
5410 .driver_data = SAA7134_BOARD_CINERGY_HT_PCMCIA, 5510 .driver_data = SAA7134_BOARD_CINERGY_HT_PCMCIA,
@@ -5821,8 +5921,8 @@ static int saa7134_xc2028_callback(struct saa7134_dev *dev,
5821} 5921}
5822 5922
5823 5923
5824static int saa7134_tda8290_callback(struct saa7134_dev *dev, 5924static int saa7134_tda8290_827x_callback(struct saa7134_dev *dev,
5825 int command, int arg) 5925 int command, int arg)
5826{ 5926{
5827 u8 sync_control; 5927 u8 sync_control;
5828 5928
@@ -5848,6 +5948,65 @@ static int saa7134_tda8290_callback(struct saa7134_dev *dev,
5848 return 0; 5948 return 0;
5849} 5949}
5850 5950
5951static inline int saa7134_tda18271_hvr11x0_toggle_agc(struct saa7134_dev *dev,
5952 enum tda18271_mode mode)
5953{
5954 /* toggle AGC switch through GPIO 26 */
5955 switch (mode) {
5956 case TDA18271_ANALOG:
5957 saa7134_set_gpio(dev, 26, 0);
5958 break;
5959 case TDA18271_DIGITAL:
5960 saa7134_set_gpio(dev, 26, 1);
5961 break;
5962 default:
5963 return -EINVAL;
5964 }
5965 return 0;
5966}
5967
5968static int saa7134_tda8290_18271_callback(struct saa7134_dev *dev,
5969 int command, int arg)
5970{
5971 int ret = 0;
5972
5973 switch (command) {
5974 case TDA18271_CALLBACK_CMD_AGC_ENABLE: /* 0 */
5975 switch (dev->board) {
5976 case SAA7134_BOARD_HAUPPAUGE_HVR1120:
5977 case SAA7134_BOARD_HAUPPAUGE_HVR1110R3:
5978 ret = saa7134_tda18271_hvr11x0_toggle_agc(dev, arg);
5979 break;
5980 default:
5981 break;
5982 }
5983 break;
5984 default:
5985 ret = -EINVAL;
5986 break;
5987 }
5988 return ret;
5989}
5990
5991static int saa7134_tda8290_callback(struct saa7134_dev *dev,
5992 int command, int arg)
5993{
5994 int ret;
5995
5996 switch (dev->board) {
5997 case SAA7134_BOARD_HAUPPAUGE_HVR1120:
5998 case SAA7134_BOARD_HAUPPAUGE_HVR1110R3:
5999 /* tda8290 + tda18271 */
6000 ret = saa7134_tda8290_18271_callback(dev, command, arg);
6001 break;
6002 default:
6003 /* tda8290 + tda827x */
6004 ret = saa7134_tda8290_827x_callback(dev, command, arg);
6005 break;
6006 }
6007 return ret;
6008}
6009
5851int saa7134_tuner_callback(void *priv, int component, int command, int arg) 6010int saa7134_tuner_callback(void *priv, int component, int command, int arg)
5852{ 6011{
5853 struct saa7134_dev *dev = priv; 6012 struct saa7134_dev *dev = priv;
@@ -5878,11 +6037,16 @@ static void hauppauge_eeprom(struct saa7134_dev *dev, u8 *eeprom_data)
5878 switch (tv.model) { 6037 switch (tv.model) {
5879 case 67019: /* WinTV-HVR1110 (Retail, IR Blaster, hybrid, FM, SVid/Comp, 3.5mm audio in) */ 6038 case 67019: /* WinTV-HVR1110 (Retail, IR Blaster, hybrid, FM, SVid/Comp, 3.5mm audio in) */
5880 case 67109: /* WinTV-HVR1000 (Retail, IR Receive, analog, no FM, SVid/Comp, 3.5mm audio in) */ 6039 case 67109: /* WinTV-HVR1000 (Retail, IR Receive, analog, no FM, SVid/Comp, 3.5mm audio in) */
6040 case 67201: /* WinTV-HVR1120 (Retail, IR Receive, hybrid, FM, SVid/Comp, 3.5mm audio in) */
6041 case 67301: /* WinTV-HVR1000 (Retail, IR Receive, analog, no FM, SVid/Comp, 3.5mm audio in) */
6042 case 67209: /* WinTV-HVR1110 (Retail, IR Receive, hybrid, FM, SVid/Comp, 3.5mm audio in) */
5881 case 67559: /* WinTV-HVR1110 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */ 6043 case 67559: /* WinTV-HVR1110 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */
5882 case 67569: /* WinTV-HVR1110 (OEM, no IR, hybrid, FM) */ 6044 case 67569: /* WinTV-HVR1110 (OEM, no IR, hybrid, FM) */
5883 case 67579: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM) */ 6045 case 67579: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM) */
5884 case 67589: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM, SVid/Comp, RCA aud) */ 6046 case 67589: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM, SVid/Comp, RCA aud) */
5885 case 67599: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM, SVid/Comp, RCA aud) */ 6047 case 67599: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM, SVid/Comp, RCA aud) */
6048 case 67651: /* WinTV-HVR1120 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */
6049 case 67659: /* WinTV-HVR1110 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */
5886 break; 6050 break;
5887 default: 6051 default:
5888 printk(KERN_WARNING "%s: warning: " 6052 printk(KERN_WARNING "%s: warning: "
@@ -6019,6 +6183,11 @@ int saa7134_board_init1(struct saa7134_dev *dev)
6019 msleep(10); 6183 msleep(10);
6020 break; 6184 break;
6021 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: 6185 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
6186 saa7134_set_gpio(dev, 23, 0);
6187 msleep(10);
6188 saa7134_set_gpio(dev, 23, 1);
6189 dev->has_remote = SAA7134_REMOTE_I2C;
6190 break;
6022 case SAA7134_BOARD_AVERMEDIA_M103: 6191 case SAA7134_BOARD_AVERMEDIA_M103:
6023 saa7134_set_gpio(dev, 23, 0); 6192 saa7134_set_gpio(dev, 23, 0);
6024 msleep(10); 6193 msleep(10);
@@ -6054,6 +6223,16 @@ int saa7134_board_init1(struct saa7134_dev *dev)
6054 6223
6055 saa_writeb (SAA7134_PRODUCTION_TEST_MODE, 0x00); 6224 saa_writeb (SAA7134_PRODUCTION_TEST_MODE, 0x00);
6056 break; 6225 break;
6226 case SAA7134_BOARD_HAUPPAUGE_HVR1120:
6227 case SAA7134_BOARD_HAUPPAUGE_HVR1110R3:
6228 /* GPIO 26 high for digital, low for analog */
6229 saa7134_set_gpio(dev, 26, 0);
6230 msleep(1);
6231
6232 saa7134_set_gpio(dev, 22, 0);
6233 msleep(10);
6234 saa7134_set_gpio(dev, 22, 1);
6235 break;
6057 /* i2c remotes */ 6236 /* i2c remotes */
6058 case SAA7134_BOARD_PINNACLE_PCTV_110i: 6237 case SAA7134_BOARD_PINNACLE_PCTV_110i:
6059 case SAA7134_BOARD_PINNACLE_PCTV_310i: 6238 case SAA7134_BOARD_PINNACLE_PCTV_310i:
@@ -6079,15 +6258,15 @@ int saa7134_board_init1(struct saa7134_dev *dev)
6079 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x8c040007, 0x8c040007); 6258 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x8c040007, 0x8c040007);
6080 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x0c0007cd, 0x0c0007cd); 6259 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x0c0007cd, 0x0c0007cd);
6081 break; 6260 break;
6082 case SAA7134_BOARD_AVERMEDIA_A700_PRO:
6083 case SAA7134_BOARD_AVERMEDIA_A700_HYBRID: 6261 case SAA7134_BOARD_AVERMEDIA_A700_HYBRID:
6084 /* write windows gpio values */
6085 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x80040100, 0x80040100);
6086 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x80040100, 0x00040100);
6087 printk("%s: %s: hybrid analog/dvb card\n" 6262 printk("%s: %s: hybrid analog/dvb card\n"
6088 "%s: Sorry, only analog s-video and composite input " 6263 "%s: Sorry, of the analog inputs, only analog s-video and composite "
6089 "are supported for now.\n", 6264 "are supported for now.\n",
6090 dev->name, card(dev).name, dev->name); 6265 dev->name, card(dev).name, dev->name);
6266 case SAA7134_BOARD_AVERMEDIA_A700_PRO:
6267 /* write windows gpio values */
6268 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x80040100, 0x80040100);
6269 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x80040100, 0x00040100);
6091 break; 6270 break;
6092 } 6271 }
6093 return 0; 6272 return 0;
@@ -6109,7 +6288,7 @@ static void saa7134_tuner_setup(struct saa7134_dev *dev)
6109 6288
6110 tun_setup.mode_mask = T_RADIO; 6289 tun_setup.mode_mask = T_RADIO;
6111 6290
6112 saa7134_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup); 6291 saa_call_all(dev, tuner, s_type_addr, &tun_setup);
6113 mode_mask &= ~T_RADIO; 6292 mode_mask &= ~T_RADIO;
6114 } 6293 }
6115 6294
@@ -6121,7 +6300,7 @@ static void saa7134_tuner_setup(struct saa7134_dev *dev)
6121 6300
6122 tun_setup.mode_mask = mode_mask; 6301 tun_setup.mode_mask = mode_mask;
6123 6302
6124 saa7134_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup); 6303 saa_call_all(dev, tuner, s_type_addr, &tun_setup);
6125 } 6304 }
6126 6305
6127 if (dev->tda9887_conf) { 6306 if (dev->tda9887_conf) {
@@ -6130,8 +6309,7 @@ static void saa7134_tuner_setup(struct saa7134_dev *dev)
6130 tda9887_cfg.tuner = TUNER_TDA9887; 6309 tda9887_cfg.tuner = TUNER_TDA9887;
6131 tda9887_cfg.priv = &dev->tda9887_conf; 6310 tda9887_cfg.priv = &dev->tda9887_conf;
6132 6311
6133 saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, 6312 saa_call_all(dev, tuner, s_config, &tda9887_cfg);
6134 &tda9887_cfg);
6135 } 6313 }
6136 6314
6137 if (dev->tuner_type == TUNER_XC2028) { 6315 if (dev->tuner_type == TUNER_XC2028) {
@@ -6158,7 +6336,7 @@ static void saa7134_tuner_setup(struct saa7134_dev *dev)
6158 xc2028_cfg.tuner = TUNER_XC2028; 6336 xc2028_cfg.tuner = TUNER_XC2028;
6159 xc2028_cfg.priv = &ctl; 6337 xc2028_cfg.priv = &ctl;
6160 6338
6161 saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg); 6339 saa_call_all(dev, tuner, s_config, &xc2028_cfg);
6162 } 6340 }
6163} 6341}
6164 6342
@@ -6168,9 +6346,20 @@ int saa7134_board_init2(struct saa7134_dev *dev)
6168 unsigned char buf; 6346 unsigned char buf;
6169 int board; 6347 int board;
6170 6348
6349 /* Put here the code that enables the chips that are needed
6350 for analog mode and doesn't depend on the tuner attachment.
6351 It is also a good idea to get tuner type from eeprom, etc before
6352 initializing tuner, since we can avoid loading tuner driver
6353 on devices that has TUNER_ABSENT
6354 */
6171 switch (dev->board) { 6355 switch (dev->board) {
6172 case SAA7134_BOARD_BMK_MPEX_NOTUNER: 6356 case SAA7134_BOARD_BMK_MPEX_NOTUNER:
6173 case SAA7134_BOARD_BMK_MPEX_TUNER: 6357 case SAA7134_BOARD_BMK_MPEX_TUNER:
6358 /* Checks if the device has a tuner at 0x60 addr
6359 If the device doesn't have a tuner, TUNER_ABSENT
6360 will be used at tuner_type, avoiding loading tuner
6361 without needing it
6362 */
6174 dev->i2c_client.addr = 0x60; 6363 dev->i2c_client.addr = 0x60;
6175 board = (i2c_master_recv(&dev->i2c_client, &buf, 0) < 0) 6364 board = (i2c_master_recv(&dev->i2c_client, &buf, 0) < 0)
6176 ? SAA7134_BOARD_BMK_MPEX_NOTUNER 6365 ? SAA7134_BOARD_BMK_MPEX_NOTUNER
@@ -6188,11 +6377,15 @@ int saa7134_board_init2(struct saa7134_dev *dev)
6188 u8 subaddr; 6377 u8 subaddr;
6189 u8 data[3]; 6378 u8 data[3];
6190 int ret, tuner_t; 6379 int ret, tuner_t;
6191
6192 struct i2c_msg msg[] = {{.addr=0x50, .flags=0, .buf=&subaddr, .len = 1}, 6380 struct i2c_msg msg[] = {{.addr=0x50, .flags=0, .buf=&subaddr, .len = 1},
6193 {.addr=0x50, .flags=I2C_M_RD, .buf=data, .len = 3}}; 6381 {.addr=0x50, .flags=I2C_M_RD, .buf=data, .len = 3}};
6382
6194 subaddr= 0x14; 6383 subaddr= 0x14;
6195 tuner_t = 0; 6384 tuner_t = 0;
6385
6386 /* Retrieve device data from eeprom, checking for the
6387 proper tuner_type.
6388 */
6196 ret = i2c_transfer(&dev->i2c_adap, msg, 2); 6389 ret = i2c_transfer(&dev->i2c_adap, msg, 2);
6197 if (ret != 2) { 6390 if (ret != 2) {
6198 printk(KERN_ERR "EEPROM read failure\n"); 6391 printk(KERN_ERR "EEPROM read failure\n");
@@ -6248,12 +6441,14 @@ int saa7134_board_init2(struct saa7134_dev *dev)
6248 dev->name, saa7134_boards[dev->board].name); 6441 dev->name, saa7134_boards[dev->board].name);
6249 break; 6442 break;
6250 } 6443 }
6444 /* break intentionally omitted */
6251 case SAA7134_BOARD_VIDEOMATE_DVBT_300: 6445 case SAA7134_BOARD_VIDEOMATE_DVBT_300:
6252 case SAA7134_BOARD_ASUS_EUROPA2_HYBRID: 6446 case SAA7134_BOARD_ASUS_EUROPA2_HYBRID:
6253 { 6447 {
6254 6448
6255 /* The Philips EUROPA based hybrid boards have the tuner connected through 6449 /* The Philips EUROPA based hybrid boards have the tuner
6256 * the channel decoder. We have to make it transparent to find it 6450 connected through the channel decoder. We have to make it
6451 transparent to find it
6257 */ 6452 */
6258 u8 data[] = { 0x07, 0x02}; 6453 u8 data[] = { 0x07, 0x02};
6259 struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; 6454 struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)};
@@ -6274,21 +6469,15 @@ int saa7134_board_init2(struct saa7134_dev *dev)
6274 if (dev->board == SAA7134_BOARD_PHILIPS_TIGER_S) { 6469 if (dev->board == SAA7134_BOARD_PHILIPS_TIGER_S) {
6275 dev->tuner_type = TUNER_PHILIPS_TDA8290; 6470 dev->tuner_type = TUNER_PHILIPS_TDA8290;
6276 6471
6277 saa7134_tuner_setup(dev);
6278
6279 data[2] = 0x68; 6472 data[2] = 0x68;
6280 i2c_transfer(&dev->i2c_adap, &msg, 1); 6473 i2c_transfer(&dev->i2c_adap, &msg, 1);
6281 6474 break;
6282 /* Tuner setup is handled before I2C transfer.
6283 Due to that, there's no need to do it later
6284 */
6285 return 0;
6286 } 6475 }
6287 i2c_transfer(&dev->i2c_adap, &msg, 1); 6476 i2c_transfer(&dev->i2c_adap, &msg, 1);
6288 break; 6477 break;
6289 } 6478 }
6290 case SAA7134_BOARD_ASUSTeK_TVFM7135: 6479 case SAA7134_BOARD_ASUSTeK_TVFM7135:
6291 /* The card below is detected as card=53, but is different */ 6480 /* The card below is detected as card=53, but is different */
6292 if (dev->autodetected && (dev->eedata[0x27] == 0x03)) { 6481 if (dev->autodetected && (dev->eedata[0x27] == 0x03)) {
6293 dev->board = SAA7134_BOARD_ASUSTeK_P7131_ANALOG; 6482 dev->board = SAA7134_BOARD_ASUSTeK_P7131_ANALOG;
6294 printk(KERN_INFO "%s: P7131 analog only, using " 6483 printk(KERN_INFO "%s: P7131 analog only, using "
@@ -6296,6 +6485,10 @@ int saa7134_board_init2(struct saa7134_dev *dev)
6296 dev->name, saa7134_boards[dev->board].name); 6485 dev->name, saa7134_boards[dev->board].name);
6297 } 6486 }
6298 break; 6487 break;
6488 case SAA7134_BOARD_HAUPPAUGE_HVR1120:
6489 case SAA7134_BOARD_HAUPPAUGE_HVR1110R3:
6490 hauppauge_eeprom(dev, dev->eedata+0x80);
6491 break;
6299 case SAA7134_BOARD_HAUPPAUGE_HVR1110: 6492 case SAA7134_BOARD_HAUPPAUGE_HVR1110:
6300 hauppauge_eeprom(dev, dev->eedata+0x80); 6493 hauppauge_eeprom(dev, dev->eedata+0x80);
6301 /* break intentionally omitted */ 6494 /* break intentionally omitted */
@@ -6351,22 +6544,6 @@ int saa7134_board_init2(struct saa7134_dev *dev)
6351 i2c_transfer(&dev->i2c_adap, &msg, 1); 6544 i2c_transfer(&dev->i2c_adap, &msg, 1);
6352 break; 6545 break;
6353 } 6546 }
6354 case SAA7134_BOARD_ADS_INSTANT_HDTV_PCI:
6355 case SAA7134_BOARD_KWORLD_ATSC110:
6356 {
6357 /* enable tuner */
6358 int i;
6359 static const u8 buffer [] = { 0x10, 0x12, 0x13, 0x04, 0x16,
6360 0x00, 0x14, 0x04, 0x17, 0x00 };
6361 dev->i2c_client.addr = 0x0a;
6362 for (i = 0; i < 5; i++)
6363 if (2 != i2c_master_send(&dev->i2c_client,
6364 &buffer[i*2], 2))
6365 printk(KERN_WARNING
6366 "%s: Unable to enable tuner(%i).\n",
6367 dev->name, i);
6368 break;
6369 }
6370 case SAA7134_BOARD_VIDEOMATE_DVBT_200: 6547 case SAA7134_BOARD_VIDEOMATE_DVBT_200:
6371 case SAA7134_BOARD_VIDEOMATE_DVBT_200A: 6548 case SAA7134_BOARD_VIDEOMATE_DVBT_200A:
6372 /* The T200 and the T200A share the same pci id. Consequently, 6549 /* The T200 and the T200A share the same pci id. Consequently,
@@ -6375,9 +6552,9 @@ int saa7134_board_init2(struct saa7134_dev *dev)
6375 6552
6376 /* Don't do this if the board was specifically selected with an 6553 /* Don't do this if the board was specifically selected with an
6377 * insmod option or if we have the default configuration T200*/ 6554 * insmod option or if we have the default configuration T200*/
6378 if(!dev->autodetected || (dev->eedata[0x41] == 0xd0)) 6555 if (!dev->autodetected || (dev->eedata[0x41] == 0xd0))
6379 break; 6556 break;
6380 if(dev->eedata[0x41] == 0x02) { 6557 if (dev->eedata[0x41] == 0x02) {
6381 /* Reconfigure board as T200A */ 6558 /* Reconfigure board as T200A */
6382 dev->board = SAA7134_BOARD_VIDEOMATE_DVBT_200A; 6559 dev->board = SAA7134_BOARD_VIDEOMATE_DVBT_200A;
6383 dev->tuner_type = saa7134_boards[dev->board].tuner_type; 6560 dev->tuner_type = saa7134_boards[dev->board].tuner_type;
@@ -6390,6 +6567,58 @@ int saa7134_board_init2(struct saa7134_dev *dev)
6390 break; 6567 break;
6391 } 6568 }
6392 break; 6569 break;
6570 case SAA7134_BOARD_ADS_INSTANT_HDTV_PCI:
6571 case SAA7134_BOARD_KWORLD_ATSC110:
6572 {
6573 struct i2c_msg msg = { .addr = 0x0a, .flags = 0 };
6574 int i;
6575 static u8 buffer[][2] = {
6576 { 0x10, 0x12 },
6577 { 0x13, 0x04 },
6578 { 0x16, 0x00 },
6579 { 0x14, 0x04 },
6580 { 0x17, 0x00 },
6581 };
6582
6583 for (i = 0; i < ARRAY_SIZE(buffer); i++) {
6584 msg.buf = &buffer[i][0];
6585 msg.len = ARRAY_SIZE(buffer[0]);
6586 if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1)
6587 printk(KERN_WARNING
6588 "%s: Unable to enable tuner(%i).\n",
6589 dev->name, i);
6590 }
6591 break;
6592 }
6593 } /* switch() */
6594
6595 /* initialize tuner */
6596 if (TUNER_ABSENT != dev->tuner_type) {
6597 int has_demod = (dev->tda9887_conf & TDA9887_PRESENT);
6598
6599 /* Note: radio tuner address is always filled in,
6600 so we do not need to probe for a radio tuner device. */
6601 if (dev->radio_type != UNSET)
6602 v4l2_i2c_new_subdev(&dev->i2c_adap,
6603 "tuner", "tuner", dev->radio_addr);
6604 if (has_demod)
6605 v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "tuner",
6606 "tuner", v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
6607 if (dev->tuner_addr == ADDR_UNSET) {
6608 enum v4l2_i2c_tuner_type type =
6609 has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV;
6610
6611 v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "tuner",
6612 "tuner", v4l2_i2c_tuner_addrs(type));
6613 } else {
6614 v4l2_i2c_new_subdev(&dev->i2c_adap,
6615 "tuner", "tuner", dev->tuner_addr);
6616 }
6617 }
6618
6619 saa7134_tuner_setup(dev);
6620
6621 switch (dev->board) {
6393 case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM: 6622 case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM:
6394 { 6623 {
6395 struct v4l2_priv_tun_config tea5767_cfg; 6624 struct v4l2_priv_tun_config tea5767_cfg;
@@ -6401,12 +6630,10 @@ int saa7134_board_init2(struct saa7134_dev *dev)
6401 ctl.xtal_freq = TEA5767_HIGH_LO_13MHz; 6630 ctl.xtal_freq = TEA5767_HIGH_LO_13MHz;
6402 tea5767_cfg.tuner = TUNER_TEA5767; 6631 tea5767_cfg.tuner = TUNER_TEA5767;
6403 tea5767_cfg.priv = &ctl; 6632 tea5767_cfg.priv = &ctl;
6404 saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &tea5767_cfg); 6633 saa_call_all(dev, tuner, s_config, &tea5767_cfg);
6405 break; 6634 break;
6406 } 6635 }
6407 } /* switch() */ 6636 } /* switch() */
6408 6637
6409 saa7134_tuner_setup(dev);
6410
6411 return 0; 6638 return 0;
6412} 6639}