aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/saa7134')
-rw-r--r--drivers/media/video/saa7134/saa6752hs.c105
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c4
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c181
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c1
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c10
-rw-r--r--drivers/media/video/saa7134/saa7134-empress.c86
-rw-r--r--drivers/media/video/saa7134/saa7134-i2c.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c81
-rw-r--r--drivers/media/video/saa7134/saa7134-reg.h1
-rw-r--r--drivers/media/video/saa7134/saa7134-tvaudio.c35
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c82
-rw-r--r--drivers/media/video/saa7134/saa7134.h6
12 files changed, 532 insertions, 62 deletions
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c
index 002e70a33a4f..707be175509d 100644
--- a/drivers/media/video/saa7134/saa6752hs.c
+++ b/drivers/media/video/saa7134/saa6752hs.c
@@ -13,7 +13,6 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/crc32.h> 14#include <linux/crc32.h>
15 15
16
17#define MPEG_VIDEO_TARGET_BITRATE_MAX 27000 16#define MPEG_VIDEO_TARGET_BITRATE_MAX 27000
18#define MPEG_VIDEO_MAX_BITRATE_MAX 27000 17#define MPEG_VIDEO_MAX_BITRATE_MAX 27000
19#define MPEG_TOTAL_TARGET_BITRATE_MAX 27000 18#define MPEG_TOTAL_TARGET_BITRATE_MAX 27000
@@ -21,6 +20,7 @@
21 20
22/* Addresses to scan */ 21/* Addresses to scan */
23static unsigned short normal_i2c[] = {0x20, I2C_CLIENT_END}; 22static unsigned short normal_i2c[] = {0x20, I2C_CLIENT_END};
23
24I2C_CLIENT_INSMOD; 24I2C_CLIENT_INSMOD;
25 25
26MODULE_DESCRIPTION("device driver for saa6752hs MPEG2 encoder"); 26MODULE_DESCRIPTION("device driver for saa6752hs MPEG2 encoder");
@@ -448,6 +448,104 @@ static int handle_ctrl(struct saa6752hs_mpeg_params *params,
448 return 0; 448 return 0;
449} 449}
450 450
451static int saa6752hs_qctrl(struct saa6752hs_mpeg_params *params,
452 struct v4l2_queryctrl *qctrl)
453{
454 int err;
455
456 switch (qctrl->id) {
457 case V4L2_CID_MPEG_AUDIO_ENCODING:
458 return v4l2_ctrl_query_fill(qctrl,
459 V4L2_MPEG_AUDIO_ENCODING_LAYER_2,
460 V4L2_MPEG_AUDIO_ENCODING_LAYER_2, 1,
461 V4L2_MPEG_AUDIO_ENCODING_LAYER_2);
462
463 case V4L2_CID_MPEG_AUDIO_L2_BITRATE:
464 return v4l2_ctrl_query_fill(qctrl,
465 V4L2_MPEG_AUDIO_L2_BITRATE_256K,
466 V4L2_MPEG_AUDIO_L2_BITRATE_384K, 1,
467 V4L2_MPEG_AUDIO_L2_BITRATE_256K);
468
469 case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
470 return v4l2_ctrl_query_fill(qctrl,
471 V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000,
472 V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, 1,
473 V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000);
474
475 case V4L2_CID_MPEG_VIDEO_ENCODING:
476 return v4l2_ctrl_query_fill(qctrl,
477 V4L2_MPEG_VIDEO_ENCODING_MPEG_2,
478 V4L2_MPEG_VIDEO_ENCODING_MPEG_2, 1,
479 V4L2_MPEG_VIDEO_ENCODING_MPEG_2);
480
481 case V4L2_CID_MPEG_VIDEO_ASPECT:
482 return v4l2_ctrl_query_fill(qctrl,
483 V4L2_MPEG_VIDEO_ASPECT_4x3,
484 V4L2_MPEG_VIDEO_ASPECT_16x9, 1,
485 V4L2_MPEG_VIDEO_ASPECT_4x3);
486
487 case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
488 err = v4l2_ctrl_query_fill_std(qctrl);
489 if (err == 0 &&
490 params->vi_bitrate_mode ==
491 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR)
492 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
493 return err;
494
495 case V4L2_CID_MPEG_STREAM_TYPE:
496 return v4l2_ctrl_query_fill(qctrl,
497 V4L2_MPEG_STREAM_TYPE_MPEG2_TS,
498 V4L2_MPEG_STREAM_TYPE_MPEG2_TS, 1,
499 V4L2_MPEG_STREAM_TYPE_MPEG2_TS);
500
501 case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
502 case V4L2_CID_MPEG_VIDEO_BITRATE:
503 case V4L2_CID_MPEG_STREAM_PID_PMT:
504 case V4L2_CID_MPEG_STREAM_PID_AUDIO:
505 case V4L2_CID_MPEG_STREAM_PID_VIDEO:
506 case V4L2_CID_MPEG_STREAM_PID_PCR:
507 return v4l2_ctrl_query_fill_std(qctrl);
508
509 default:
510 break;
511 }
512 return -EINVAL;
513}
514
515static int saa6752hs_qmenu(struct saa6752hs_mpeg_params *params,
516 struct v4l2_querymenu *qmenu)
517{
518 static const char *mpeg_audio_l2_bitrate[] = {
519 "",
520 "",
521 "",
522 "",
523 "",
524 "",
525 "",
526 "",
527 "",
528 "",
529 "",
530 "256 kbps",
531 "",
532 "384 kbps",
533 NULL
534 };
535 struct v4l2_queryctrl qctrl;
536 int err;
537
538 qctrl.id = qmenu->id;
539 err = saa6752hs_qctrl(params, &qctrl);
540 if (err)
541 return err;
542 if (qmenu->id == V4L2_CID_MPEG_AUDIO_L2_BITRATE)
543 return v4l2_ctrl_query_menu(qmenu, &qctrl,
544 mpeg_audio_l2_bitrate);
545 return v4l2_ctrl_query_menu(qmenu, &qctrl,
546 v4l2_ctrl_get_menu(qmenu->id));
547}
548
451static int saa6752hs_init(struct i2c_client* client) 549static int saa6752hs_init(struct i2c_client* client)
452{ 550{
453 unsigned char buf[9], buf2[4]; 551 unsigned char buf[9], buf2[4];
@@ -609,7 +707,6 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind)
609 i2c_attach_client(&h->client); 707 i2c_attach_client(&h->client);
610 708
611 v4l_info(&h->client,"saa6752hs: chip found @ 0x%x\n", addr<<1); 709 v4l_info(&h->client,"saa6752hs: chip found @ 0x%x\n", addr<<1);
612
613 return 0; 710 return 0;
614} 711}
615 712
@@ -662,6 +759,10 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg)
662 } 759 }
663 h->params = params; 760 h->params = params;
664 break; 761 break;
762 case VIDIOC_QUERYCTRL:
763 return saa6752hs_qctrl(&h->params, arg);
764 case VIDIOC_QUERYMENU:
765 return saa6752hs_qmenu(&h->params, arg);
665 case VIDIOC_G_FMT: 766 case VIDIOC_G_FMT:
666 { 767 {
667 struct v4l2_format *f = arg; 768 struct v4l2_format *f = arg;
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index f118de6e3672..9929d20320b4 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -80,7 +80,6 @@ typedef struct snd_card_saa7134 {
80} snd_card_saa7134_t; 80} snd_card_saa7134_t;
81 81
82 82
83
84/* 83/*
85 * PCM structure 84 * PCM structure
86 */ 85 */
@@ -1121,6 +1120,3 @@ late_initcall(saa7134_alsa_init);
1121module_exit(saa7134_alsa_exit); 1120module_exit(saa7134_alsa_exit);
1122MODULE_LICENSE("GPL"); 1121MODULE_LICENSE("GPL");
1123MODULE_AUTHOR("Ricardo Cerqueira"); 1122MODULE_AUTHOR("Ricardo Cerqueira");
1124
1125
1126
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 2618cfa592e7..6893f998d292 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -1287,6 +1287,22 @@ struct saa7134_board saa7134_boards[] = {
1287 .vmux = 8, 1287 .vmux = 8,
1288 }}, 1288 }},
1289 }, 1289 },
1290 [SAA7134_BOARD_AVERMEDIA_M103] = {
1291 /* Massimo Piccioni <dafastidio@libero.it> */
1292 .name = "AVerMedia MiniPCI DVB-T Hybrid M103",
1293 .audio_clock = 0x187de7,
1294 .tuner_type = TUNER_XC2028,
1295 .radio_type = UNSET,
1296 .tuner_addr = ADDR_UNSET,
1297 .radio_addr = ADDR_UNSET,
1298 .mpeg = SAA7134_MPEG_DVB,
1299 .inputs = {{
1300 .name = name_tv,
1301 .vmux = 1,
1302 .amux = TV,
1303 .tv = 1,
1304 } },
1305 },
1290 [SAA7134_BOARD_NOVAC_PRIMETV7133] = { 1306 [SAA7134_BOARD_NOVAC_PRIMETV7133] = {
1291 /* toshii@netbsd.org */ 1307 /* toshii@netbsd.org */
1292 .name = "Noval Prime TV 7133", 1308 .name = "Noval Prime TV 7133",
@@ -3503,6 +3519,39 @@ struct saa7134_board saa7134_boards[] = {
3503 .amux = TV, 3519 .amux = TV,
3504 .gpio = 0x0200000, 3520 .gpio = 0x0200000,
3505 }, 3521 },
3522 },
3523 [SAA7134_BOARD_ASUSTeK_P7131_ANALOG] = {
3524 .name = "ASUSTeK P7131 Analog",
3525 .audio_clock = 0x00187de7,
3526 .tuner_type = TUNER_PHILIPS_TDA8290,
3527 .radio_type = UNSET,
3528 .tuner_addr = ADDR_UNSET,
3529 .radio_addr = ADDR_UNSET,
3530 .gpiomask = 1 << 21,
3531 .inputs = {{
3532 .name = name_tv,
3533 .vmux = 1,
3534 .amux = TV,
3535 .tv = 1,
3536 .gpio = 0x0000000,
3537 }, {
3538 .name = name_comp1,
3539 .vmux = 3,
3540 .amux = LINE2,
3541 }, {
3542 .name = name_comp2,
3543 .vmux = 0,
3544 .amux = LINE2,
3545 }, {
3546 .name = name_svideo,
3547 .vmux = 8,
3548 .amux = LINE2,
3549 } },
3550 .radio = {
3551 .name = name_radio,
3552 .amux = TV,
3553 .gpio = 0x0200000,
3554 },
3506 }, 3555 },
3507 [SAA7134_BOARD_SABRENT_TV_PCB05] = { 3556 [SAA7134_BOARD_SABRENT_TV_PCB05] = {
3508 .name = "Sabrent PCMCIA TV-PCB05", 3557 .name = "Sabrent PCMCIA TV-PCB05",
@@ -3940,32 +3989,111 @@ struct saa7134_board saa7134_boards[] = {
3940 [SAA7134_BOARD_BEHOLD_M6] = { 3989 [SAA7134_BOARD_BEHOLD_M6] = {
3941 /* Igor Kuznetsov <igk@igk.ru> */ 3990 /* Igor Kuznetsov <igk@igk.ru> */
3942 /* Andrey Melnikoff <temnota@kmv.ru> */ 3991 /* Andrey Melnikoff <temnota@kmv.ru> */
3943 .name = "Beholder BeholdTV M6 / BeholdTV M6 Extra", 3992 /* Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com> */
3993 .name = "Beholder BeholdTV M6",
3944 .audio_clock = 0x00187de7, 3994 .audio_clock = 0x00187de7,
3945 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 3995 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
3946 .radio_type = UNSET, 3996 .radio_type = UNSET,
3947 .tuner_addr = ADDR_UNSET, 3997 .tuner_addr = ADDR_UNSET,
3948 .radio_addr = ADDR_UNSET, 3998 .radio_addr = ADDR_UNSET,
3949 .tda9887_conf = TDA9887_PRESENT, 3999 .tda9887_conf = TDA9887_PRESENT,
3950 .inputs = {{ 4000 .inputs = { {
3951 .name = name_tv, 4001 .name = name_tv,
3952 .vmux = 3, 4002 .vmux = 3,
3953 .amux = TV, 4003 .amux = TV,
3954 .tv = 1, 4004 .tv = 1,
3955 },{ 4005 }, {
3956 .name = name_comp1, 4006 .name = name_comp1,
3957 .vmux = 1, 4007 .vmux = 1,
3958 .amux = LINE1, 4008 .amux = LINE1,
3959 },{ 4009 }, {
3960 .name = name_svideo, 4010 .name = name_svideo,
3961 .vmux = 8, 4011 .vmux = 8,
3962 .amux = LINE1, 4012 .amux = LINE1,
3963 }}, 4013 } },
3964 .radio = { 4014 .radio = {
3965 .name = name_radio, 4015 .name = name_radio,
3966 .amux = LINE2, 4016 .amux = LINE2,
3967 }, 4017 },
3968 .mpeg = SAA7134_MPEG_EMPRESS, 4018 .mpeg = SAA7134_MPEG_EMPRESS,
4019 .video_out = CCIR656,
4020 .vid_port_opts = (SET_T_CODE_POLARITY_NON_INVERTED |
4021 SET_CLOCK_NOT_DELAYED |
4022 SET_CLOCK_INVERTED |
4023 SET_VSYNC_OFF),
4024 },
4025 [SAA7134_BOARD_BEHOLD_M63] = {
4026 /* Igor Kuznetsov <igk@igk.ru> */
4027 /* Andrey Melnikoff <temnota@kmv.ru> */
4028 /* Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com> */
4029 .name = "Beholder BeholdTV M63",
4030 .audio_clock = 0x00187de7,
4031 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
4032 .radio_type = UNSET,
4033 .tuner_addr = ADDR_UNSET,
4034 .radio_addr = ADDR_UNSET,
4035 .tda9887_conf = TDA9887_PRESENT,
4036 .inputs = { {
4037 .name = name_tv,
4038 .vmux = 3,
4039 .amux = TV,
4040 .tv = 1,
4041 }, {
4042 .name = name_comp1,
4043 .vmux = 1,
4044 .amux = LINE1,
4045 }, {
4046 .name = name_svideo,
4047 .vmux = 8,
4048 .amux = LINE1,
4049 } },
4050 .radio = {
4051 .name = name_radio,
4052 .amux = LINE2,
4053 },
4054 .mpeg = SAA7134_MPEG_EMPRESS,
4055 .video_out = CCIR656,
4056 .vid_port_opts = (SET_T_CODE_POLARITY_NON_INVERTED |
4057 SET_CLOCK_NOT_DELAYED |
4058 SET_CLOCK_INVERTED |
4059 SET_VSYNC_OFF),
4060 },
4061 [SAA7134_BOARD_BEHOLD_M6_EXTRA] = {
4062 /* Igor Kuznetsov <igk@igk.ru> */
4063 /* Andrey Melnikoff <temnota@kmv.ru> */
4064 /* Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com> */
4065 .name = "Beholder BeholdTV M6 Extra",
4066 .audio_clock = 0x00187de7,
4067 /* FIXME: Must be PHILIPS_FM1216ME_MK5*/
4068 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
4069 .radio_type = UNSET,
4070 .tuner_addr = ADDR_UNSET,
4071 .radio_addr = ADDR_UNSET,
4072 .tda9887_conf = TDA9887_PRESENT,
4073 .inputs = { {
4074 .name = name_tv,
4075 .vmux = 3,
4076 .amux = TV,
4077 .tv = 1,
4078 }, {
4079 .name = name_comp1,
4080 .vmux = 1,
4081 .amux = LINE1,
4082 }, {
4083 .name = name_svideo,
4084 .vmux = 8,
4085 .amux = LINE1,
4086 } },
4087 .radio = {
4088 .name = name_radio,
4089 .amux = LINE2,
4090 },
4091 .mpeg = SAA7134_MPEG_EMPRESS,
4092 .video_out = CCIR656,
4093 .vid_port_opts = (SET_T_CODE_POLARITY_NON_INVERTED |
4094 SET_CLOCK_NOT_DELAYED |
4095 SET_CLOCK_INVERTED |
4096 SET_VSYNC_OFF),
3969 }, 4097 },
3970 [SAA7134_BOARD_TWINHAN_DTV_DVB_3056] = { 4098 [SAA7134_BOARD_TWINHAN_DTV_DVB_3056] = {
3971 .name = "Twinhan Hybrid DTV-DVB 3056 PCI", 4099 .name = "Twinhan Hybrid DTV-DVB 3056 PCI",
@@ -4121,9 +4249,9 @@ struct saa7134_board saa7134_boards[] = {
4121 .amux = TV, 4249 .amux = TV,
4122 .tv = 1, 4250 .tv = 1,
4123 }, { 4251 }, {
4124 .name = name_comp1, 4252 .name = name_comp,
4125 .vmux = 3, 4253 .vmux = 0,
4126 .amux = LINE2, 4254 .amux = LINE1,
4127 }, { 4255 }, {
4128 .name = name_svideo, 4256 .name = name_svideo,
4129 .vmux = 8, 4257 .vmux = 8,
@@ -4141,6 +4269,7 @@ struct saa7134_board saa7134_boards[] = {
4141 .radio_type = UNSET, 4269 .radio_type = UNSET,
4142 .tuner_addr = ADDR_UNSET, 4270 .tuner_addr = ADDR_UNSET,
4143 .radio_addr = ADDR_UNSET, 4271 .radio_addr = ADDR_UNSET,
4272 .mpeg = SAA7134_MPEG_DVB,
4144 .inputs = {{ 4273 .inputs = {{
4145 .name = name_tv, 4274 .name = name_tv,
4146 .vmux = 1, 4275 .vmux = 1,
@@ -4150,6 +4279,10 @@ struct saa7134_board saa7134_boards[] = {
4150 .name = name_svideo, 4279 .name = name_svideo,
4151 .vmux = 8, 4280 .vmux = 8,
4152 .amux = LINE1, 4281 .amux = LINE1,
4282 }, {
4283 .name = name_comp,
4284 .vmux = 0,
4285 .amux = LINE1,
4153 } }, 4286 } },
4154 .radio = { 4287 .radio = {
4155 .name = name_radio, 4288 .name = name_radio,
@@ -4163,7 +4296,6 @@ struct saa7134_board saa7134_boards[] = {
4163 .radio_type = UNSET, 4296 .radio_type = UNSET,
4164 .tuner_addr = ADDR_UNSET, 4297 .tuner_addr = ADDR_UNSET,
4165 .radio_addr = ADDR_UNSET, 4298 .radio_addr = ADDR_UNSET,
4166 .mpeg = SAA7134_MPEG_DVB,
4167 .inputs = {{ 4299 .inputs = {{
4168 .name = name_tv, 4300 .name = name_tv,
4169 .vmux = 1, 4301 .vmux = 1,
@@ -5226,13 +5358,13 @@ struct pci_device_id saa7134_pci_tbl[] = {
5226 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 5358 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5227 .subvendor = 0x5ace, 5359 .subvendor = 0x5ace,
5228 .subdevice = 0x6193, 5360 .subdevice = 0x6193,
5229 .driver_data = SAA7134_BOARD_BEHOLD_M6, 5361 .driver_data = SAA7134_BOARD_BEHOLD_M6_EXTRA,
5230 }, { 5362 }, {
5231 .vendor = PCI_VENDOR_ID_PHILIPS, 5363 .vendor = PCI_VENDOR_ID_PHILIPS,
5232 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 5364 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5233 .subvendor = 0x5ace, 5365 .subvendor = 0x5ace,
5234 .subdevice = 0x6191, 5366 .subdevice = 0x6191,
5235 .driver_data = SAA7134_BOARD_BEHOLD_M6, 5367 .driver_data = SAA7134_BOARD_BEHOLD_M63,
5236 },{ 5368 },{
5237 .vendor = PCI_VENDOR_ID_PHILIPS, 5369 .vendor = PCI_VENDOR_ID_PHILIPS,
5238 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 5370 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
@@ -5284,10 +5416,22 @@ struct pci_device_id saa7134_pci_tbl[] = {
5284 }, { 5416 }, {
5285 .vendor = PCI_VENDOR_ID_PHILIPS, 5417 .vendor = PCI_VENDOR_ID_PHILIPS,
5286 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 5418 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5419 .subvendor = 0x5169,
5420 .subdevice = 0x1502,
5421 .driver_data = SAA7134_BOARD_FLYTVPLATINUM_MINI,
5422 }, {
5423 .vendor = PCI_VENDOR_ID_PHILIPS,
5424 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5287 .subvendor = 0x5ace, 5425 .subvendor = 0x5ace,
5288 .subdevice = 0x6290, 5426 .subdevice = 0x6290,
5289 .driver_data = SAA7134_BOARD_BEHOLD_H6, 5427 .driver_data = SAA7134_BOARD_BEHOLD_H6,
5290 }, { 5428 }, {
5429 .vendor = PCI_VENDOR_ID_PHILIPS,
5430 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5431 .subvendor = 0x1461, /* Avermedia Technologies Inc */
5432 .subdevice = 0xf636,
5433 .driver_data = SAA7134_BOARD_AVERMEDIA_M103,
5434 }, {
5291 /* --- boards without eeprom + subsystem ID --- */ 5435 /* --- boards without eeprom + subsystem ID --- */
5292 .vendor = PCI_VENDOR_ID_PHILIPS, 5436 .vendor = PCI_VENDOR_ID_PHILIPS,
5293 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 5437 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -5352,6 +5496,7 @@ static int saa7134_xc2028_callback(struct saa7134_dev *dev,
5352 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00008000, 0x00008000); 5496 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00008000, 0x00008000);
5353 switch (dev->board) { 5497 switch (dev->board) {
5354 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: 5498 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
5499 case SAA7134_BOARD_AVERMEDIA_M103:
5355 saa7134_set_gpio(dev, 23, 0); 5500 saa7134_set_gpio(dev, 23, 0);
5356 msleep(10); 5501 msleep(10);
5357 saa7134_set_gpio(dev, 23, 1); 5502 saa7134_set_gpio(dev, 23, 1);
@@ -5493,6 +5638,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
5493 case SAA7134_BOARD_FLYDVBT_LR301: 5638 case SAA7134_BOARD_FLYDVBT_LR301:
5494 case SAA7134_BOARD_ASUSTeK_P7131_DUAL: 5639 case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
5495 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: 5640 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA:
5641 case SAA7134_BOARD_ASUSTeK_P7131_ANALOG:
5496 case SAA7134_BOARD_FLYDVBTDUO: 5642 case SAA7134_BOARD_FLYDVBTDUO:
5497 case SAA7134_BOARD_PROTEUS_2309: 5643 case SAA7134_BOARD_PROTEUS_2309:
5498 case SAA7134_BOARD_AVERMEDIA_A16AR: 5644 case SAA7134_BOARD_AVERMEDIA_A16AR:
@@ -5560,6 +5706,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
5560 msleep(10); 5706 msleep(10);
5561 break; 5707 break;
5562 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: 5708 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
5709 case SAA7134_BOARD_AVERMEDIA_M103:
5563 saa7134_set_gpio(dev, 23, 0); 5710 saa7134_set_gpio(dev, 23, 0);
5564 msleep(10); 5711 msleep(10);
5565 saa7134_set_gpio(dev, 23, 1); 5712 saa7134_set_gpio(dev, 23, 1);
@@ -5601,6 +5748,8 @@ int saa7134_board_init1(struct saa7134_dev *dev)
5601 case SAA7134_BOARD_HAUPPAUGE_HVR1110: 5748 case SAA7134_BOARD_HAUPPAUGE_HVR1110:
5602 case SAA7134_BOARD_BEHOLD_607_9FM: 5749 case SAA7134_BOARD_BEHOLD_607_9FM:
5603 case SAA7134_BOARD_BEHOLD_M6: 5750 case SAA7134_BOARD_BEHOLD_M6:
5751 case SAA7134_BOARD_BEHOLD_M63:
5752 case SAA7134_BOARD_BEHOLD_M6_EXTRA:
5604 dev->has_remote = SAA7134_REMOTE_I2C; 5753 dev->has_remote = SAA7134_REMOTE_I2C;
5605 break; 5754 break;
5606 case SAA7134_BOARD_AVERMEDIA_A169_B: 5755 case SAA7134_BOARD_AVERMEDIA_A169_B:
@@ -5683,6 +5832,7 @@ static void saa7134_tuner_setup(struct saa7134_dev *dev)
5683 switch (dev->board) { 5832 switch (dev->board) {
5684 case SAA7134_BOARD_AVERMEDIA_A16D: 5833 case SAA7134_BOARD_AVERMEDIA_A16D:
5685 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: 5834 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
5835 case SAA7134_BOARD_AVERMEDIA_M103:
5686 ctl.demod = XC3028_FE_ZARLINK456; 5836 ctl.demod = XC3028_FE_ZARLINK456;
5687 break; 5837 break;
5688 default: 5838 default:
@@ -5825,6 +5975,15 @@ int saa7134_board_init2(struct saa7134_dev *dev)
5825 i2c_transfer(&dev->i2c_adap, &msg, 1); 5975 i2c_transfer(&dev->i2c_adap, &msg, 1);
5826 break; 5976 break;
5827 } 5977 }
5978 case SAA7134_BOARD_ASUSTeK_TVFM7135:
5979 /* The card below is detected as card=53, but is different */
5980 if (dev->autodetected && (dev->eedata[0x27] == 0x03)) {
5981 dev->board = SAA7134_BOARD_ASUSTeK_P7131_ANALOG;
5982 printk(KERN_INFO "%s: P7131 analog only, using "
5983 "entry of %s\n",
5984 dev->name, saa7134_boards[dev->board].name);
5985 }
5986 break;
5828 case SAA7134_BOARD_HAUPPAUGE_HVR1110: 5987 case SAA7134_BOARD_HAUPPAUGE_HVR1110:
5829 hauppauge_eeprom(dev, dev->eedata+0x80); 5988 hauppauge_eeprom(dev, dev->eedata+0x80);
5830 /* break intentionally omitted */ 5989 /* break intentionally omitted */
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 2c19cd0113c8..cfee84ee7a88 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -150,7 +150,6 @@ void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value)
150 150
151#if defined(CONFIG_MODULES) && defined(MODULE) 151#if defined(CONFIG_MODULES) && defined(MODULE)
152 152
153
154static void request_module_async(struct work_struct *work){ 153static void request_module_async(struct work_struct *work){
155 struct saa7134_dev* dev = container_of(work, struct saa7134_dev, request_module_wk); 154 struct saa7134_dev* dev = container_of(work, struct saa7134_dev, request_module_wk);
156 if (card_is_empress(dev)) 155 if (card_is_empress(dev))
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 341b101b0357..be48b9b66a67 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -1263,6 +1263,7 @@ static int dvb_init(struct saa7134_dev *dev)
1263 &avermedia_xc3028_mt352_dev, 1263 &avermedia_xc3028_mt352_dev,
1264 &dev->i2c_adap); 1264 &dev->i2c_adap);
1265 attach_xc3028 = 1; 1265 attach_xc3028 = 1;
1266 break;
1266 case SAA7134_BOARD_MD7134_BRIDGE_2: 1267 case SAA7134_BOARD_MD7134_BRIDGE_2:
1267 dev->dvb.frontend = dvb_attach(tda10086_attach, 1268 dev->dvb.frontend = dvb_attach(tda10086_attach,
1268 &sd1878_4m, &dev->i2c_adap); 1269 &sd1878_4m, &dev->i2c_adap);
@@ -1290,6 +1291,15 @@ static int dvb_init(struct saa7134_dev *dev)
1290 fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage; 1291 fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage;
1291 } 1292 }
1292 break; 1293 break;
1294 case SAA7134_BOARD_AVERMEDIA_M103:
1295 saa7134_set_gpio(dev, 25, 0);
1296 msleep(10);
1297 saa7134_set_gpio(dev, 25, 1);
1298 dev->dvb.frontend = dvb_attach(mt352_attach,
1299 &avermedia_xc3028_mt352_dev,
1300 &dev->i2c_adap);
1301 attach_xc3028 = 1;
1302 break;
1293 default: 1303 default:
1294 wprintk("Huh? unknown DVB card?\n"); 1304 wprintk("Huh? unknown DVB card?\n");
1295 break; 1305 break;
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c
index 3ae71a340822..2a5ab957542d 100644
--- a/drivers/media/video/saa7134/saa7134-empress.c
+++ b/drivers/media/video/saa7134/saa7134-empress.c
@@ -208,7 +208,7 @@ static int empress_s_input(struct file *file, void *priv, unsigned int i)
208 return 0; 208 return 0;
209} 209}
210 210
211static int empress_enum_fmt_cap(struct file *file, void *priv, 211static int empress_enum_fmt_vid_cap(struct file *file, void *priv,
212 struct v4l2_fmtdesc *f) 212 struct v4l2_fmtdesc *f)
213{ 213{
214 if (f->index != 0) 214 if (f->index != 0)
@@ -220,7 +220,7 @@ static int empress_enum_fmt_cap(struct file *file, void *priv,
220 return 0; 220 return 0;
221} 221}
222 222
223static int empress_g_fmt_cap(struct file *file, void *priv, 223static int empress_g_fmt_vid_cap(struct file *file, void *priv,
224 struct v4l2_format *f) 224 struct v4l2_format *f)
225{ 225{
226 struct saa7134_dev *dev = file->private_data; 226 struct saa7134_dev *dev = file->private_data;
@@ -233,7 +233,7 @@ static int empress_g_fmt_cap(struct file *file, void *priv,
233 return 0; 233 return 0;
234} 234}
235 235
236static int empress_s_fmt_cap(struct file *file, void *priv, 236static int empress_s_fmt_vid_cap(struct file *file, void *priv,
237 struct v4l2_format *f) 237 struct v4l2_format *f)
238{ 238{
239 struct saa7134_dev *dev = file->private_data; 239 struct saa7134_dev *dev = file->private_data;
@@ -294,10 +294,20 @@ static int empress_streamoff(struct file *file, void *priv,
294 return videobuf_streamoff(&dev->empress_tsq); 294 return videobuf_streamoff(&dev->empress_tsq);
295} 295}
296 296
297static int saa7134_i2c_call_saa6752(struct saa7134_dev *dev,
298 unsigned int cmd, void *arg)
299{
300 if (dev->mpeg_i2c_client == NULL)
301 return -EINVAL;
302 return dev->mpeg_i2c_client->driver->command(dev->mpeg_i2c_client,
303 cmd, arg);
304}
305
297static int empress_s_ext_ctrls(struct file *file, void *priv, 306static int empress_s_ext_ctrls(struct file *file, void *priv,
298 struct v4l2_ext_controls *ctrls) 307 struct v4l2_ext_controls *ctrls)
299{ 308{
300 struct saa7134_dev *dev = file->private_data; 309 struct saa7134_dev *dev = file->private_data;
310 int err;
301 311
302 /* count == 0 is abused in saa6752hs.c, so that special 312 /* count == 0 is abused in saa6752hs.c, so that special
303 case is handled here explicitly. */ 313 case is handled here explicitly. */
@@ -307,10 +317,10 @@ static int empress_s_ext_ctrls(struct file *file, void *priv,
307 if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG) 317 if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG)
308 return -EINVAL; 318 return -EINVAL;
309 319
310 saa7134_i2c_call_clients(dev, VIDIOC_S_EXT_CTRLS, ctrls); 320 err = saa7134_i2c_call_saa6752(dev, VIDIOC_S_EXT_CTRLS, ctrls);
311 ts_init_encoder(dev); 321 ts_init_encoder(dev);
312 322
313 return 0; 323 return err;
314} 324}
315 325
316static int empress_g_ext_ctrls(struct file *file, void *priv, 326static int empress_g_ext_ctrls(struct file *file, void *priv,
@@ -320,9 +330,62 @@ static int empress_g_ext_ctrls(struct file *file, void *priv,
320 330
321 if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG) 331 if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG)
322 return -EINVAL; 332 return -EINVAL;
323 saa7134_i2c_call_clients(dev, VIDIOC_G_EXT_CTRLS, ctrls); 333 return saa7134_i2c_call_saa6752(dev, VIDIOC_G_EXT_CTRLS, ctrls);
334}
324 335
325 return 0; 336static int empress_queryctrl(struct file *file, void *priv,
337 struct v4l2_queryctrl *c)
338{
339 static const u32 user_ctrls[] = {
340 V4L2_CID_USER_CLASS,
341 V4L2_CID_BRIGHTNESS,
342 V4L2_CID_CONTRAST,
343 V4L2_CID_SATURATION,
344 V4L2_CID_HUE,
345 V4L2_CID_AUDIO_VOLUME,
346 V4L2_CID_AUDIO_MUTE,
347 V4L2_CID_HFLIP,
348 0
349 };
350
351 static const u32 mpeg_ctrls[] = {
352 V4L2_CID_MPEG_CLASS,
353 V4L2_CID_MPEG_STREAM_TYPE,
354 V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ,
355 V4L2_CID_MPEG_AUDIO_ENCODING,
356 V4L2_CID_MPEG_AUDIO_L2_BITRATE,
357 V4L2_CID_MPEG_VIDEO_ENCODING,
358 V4L2_CID_MPEG_VIDEO_ASPECT,
359 V4L2_CID_MPEG_VIDEO_BITRATE_MODE,
360 V4L2_CID_MPEG_VIDEO_BITRATE,
361 V4L2_CID_MPEG_VIDEO_BITRATE_PEAK,
362 0
363 };
364 static const u32 *ctrl_classes[] = {
365 user_ctrls,
366 mpeg_ctrls,
367 NULL
368 };
369 struct saa7134_dev *dev = file->private_data;
370
371 c->id = v4l2_ctrl_next(ctrl_classes, c->id);
372 if (c->id == 0)
373 return -EINVAL;
374 if (c->id == V4L2_CID_USER_CLASS || c->id == V4L2_CID_MPEG_CLASS)
375 return v4l2_ctrl_query_fill_std(c);
376 if (V4L2_CTRL_ID2CLASS(c->id) != V4L2_CTRL_CLASS_MPEG)
377 return saa7134_queryctrl(file, priv, c);
378 return saa7134_i2c_call_saa6752(dev, VIDIOC_QUERYCTRL, c);
379}
380
381static int empress_querymenu(struct file *file, void *priv,
382 struct v4l2_querymenu *c)
383{
384 struct saa7134_dev *dev = file->private_data;
385
386 if (V4L2_CTRL_ID2CLASS(c->id) != V4L2_CTRL_CLASS_MPEG)
387 return -EINVAL;
388 return saa7134_i2c_call_saa6752(dev, VIDIOC_QUERYMENU, c);
326} 389}
327 390
328static const struct file_operations ts_fops = 391static const struct file_operations ts_fops =
@@ -348,9 +411,9 @@ static struct video_device saa7134_empress_template =
348 .minor = -1, 411 .minor = -1,
349 412
350 .vidioc_querycap = empress_querycap, 413 .vidioc_querycap = empress_querycap,
351 .vidioc_enum_fmt_cap = empress_enum_fmt_cap, 414 .vidioc_enum_fmt_vid_cap = empress_enum_fmt_vid_cap,
352 .vidioc_s_fmt_cap = empress_s_fmt_cap, 415 .vidioc_s_fmt_vid_cap = empress_s_fmt_vid_cap,
353 .vidioc_g_fmt_cap = empress_g_fmt_cap, 416 .vidioc_g_fmt_vid_cap = empress_g_fmt_vid_cap,
354 .vidioc_reqbufs = empress_reqbufs, 417 .vidioc_reqbufs = empress_reqbufs,
355 .vidioc_querybuf = empress_querybuf, 418 .vidioc_querybuf = empress_querybuf,
356 .vidioc_qbuf = empress_qbuf, 419 .vidioc_qbuf = empress_qbuf,
@@ -363,7 +426,8 @@ static struct video_device saa7134_empress_template =
363 .vidioc_g_input = empress_g_input, 426 .vidioc_g_input = empress_g_input,
364 .vidioc_s_input = empress_s_input, 427 .vidioc_s_input = empress_s_input,
365 428
366 .vidioc_queryctrl = saa7134_queryctrl, 429 .vidioc_queryctrl = empress_queryctrl,
430 .vidioc_querymenu = empress_querymenu,
367 .vidioc_g_ctrl = saa7134_g_ctrl, 431 .vidioc_g_ctrl = saa7134_g_ctrl,
368 .vidioc_s_ctrl = saa7134_s_ctrl, 432 .vidioc_s_ctrl = saa7134_s_ctrl,
369 433
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c
index d8af3863f2d3..5f713e637683 100644
--- a/drivers/media/video/saa7134/saa7134-i2c.c
+++ b/drivers/media/video/saa7134/saa7134-i2c.c
@@ -327,6 +327,8 @@ static int attach_inform(struct i2c_client *client)
327 327
328 d1printk( "%s i2c attach [addr=0x%x,client=%s]\n", 328 d1printk( "%s i2c attach [addr=0x%x,client=%s]\n",
329 client->driver->driver.name, client->addr, client->name); 329 client->driver->driver.name, client->addr, client->name);
330 if (client->addr == 0x20 && client->driver && client->driver->command)
331 dev->mpeg_i2c_client = client;
330 332
331 /* Am I an i2c remote control? */ 333 /* Am I an i2c remote control? */
332 334
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index 76e6501d238d..ad08d13dffdd 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -198,6 +198,84 @@ static int get_key_beholdm6xx(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
198 return 1; 198 return 1;
199} 199}
200 200
201/* Common (grey or coloured) pinnacle PCTV remote handling
202 *
203 */
204static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw,
205 int parity_offset, int marker, int code_modulo)
206{
207 unsigned char b[4];
208 unsigned int start = 0,parity = 0,code = 0;
209
210 /* poll IR chip */
211 if (4 != i2c_master_recv(&ir->c, b, 4)) {
212 i2cdprintk("read error\n");
213 return -EIO;
214 }
215
216 for (start = 0; start < ARRAY_SIZE(b); start++) {
217 if (b[start] == marker) {
218 code=b[(start+parity_offset + 1) % 4];
219 parity=b[(start+parity_offset) % 4];
220 }
221 }
222
223 /* Empty Request */
224 if (parity == 0)
225 return 0;
226
227 /* Repeating... */
228 if (ir->old == parity)
229 return 0;
230
231 ir->old = parity;
232
233 /* drop special codes when a key is held down a long time for the grey controller
234 In this case, the second bit of the code is asserted */
235 if (marker == 0xfe && (code & 0x40))
236 return 0;
237
238 code %= code_modulo;
239
240 *ir_raw = code;
241 *ir_key = code;
242
243 i2cdprintk("Pinnacle PCTV key %02x\n", code);
244
245 return 1;
246}
247
248/* The grey pinnacle PCTV remote
249 *
250 * There are one issue with this remote:
251 * - I2c packet does not change when the same key is pressed quickly. The workaround
252 * is to hold down each key for about half a second, so that another code is generated
253 * in the i2c packet, and the function can distinguish key presses.
254 *
255 * Sylvain Pasche <sylvain.pasche@gmail.com>
256 */
257static int get_key_pinnacle_grey(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
258{
259
260 return get_key_pinnacle(ir, ir_key, ir_raw, 1, 0xfe, 0xff);
261}
262
263
264/* The new pinnacle PCTV remote (with the colored buttons)
265 *
266 * Ricardo Cerqueira <v4l@cerqueira.org>
267 */
268static int get_key_pinnacle_color(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
269{
270 /* code_modulo parameter (0x88) is used to reduce code value to fit inside IR_KEYTAB_SIZE
271 *
272 * this is the only value that results in 42 unique
273 * codes < 128
274 */
275
276 return get_key_pinnacle(ir, ir_key, ir_raw, 2, 0x80, 0x88);
277}
278
201void saa7134_input_irq(struct saa7134_dev *dev) 279void saa7134_input_irq(struct saa7134_dev *dev)
202{ 280{
203 struct card_ir *ir = dev->remote; 281 struct card_ir *ir = dev->remote;
@@ -409,6 +487,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
409 break; 487 break;
410 case SAA7134_BOARD_ASUSTeK_P7131_DUAL: 488 case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
411 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: 489 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA:
490 case SAA7134_BOARD_ASUSTeK_P7131_ANALOG:
412 ir_codes = ir_codes_asus_pc39; 491 ir_codes = ir_codes_asus_pc39;
413 mask_keydown = 0x0040000; 492 mask_keydown = 0x0040000;
414 rc5_gpio = 1; 493 rc5_gpio = 1;
@@ -540,6 +619,8 @@ void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir)
540 break; 619 break;
541 case SAA7134_BOARD_BEHOLD_607_9FM: 620 case SAA7134_BOARD_BEHOLD_607_9FM:
542 case SAA7134_BOARD_BEHOLD_M6: 621 case SAA7134_BOARD_BEHOLD_M6:
622 case SAA7134_BOARD_BEHOLD_M63:
623 case SAA7134_BOARD_BEHOLD_M6_EXTRA:
543 case SAA7134_BOARD_BEHOLD_H6: 624 case SAA7134_BOARD_BEHOLD_H6:
544 snprintf(ir->c.name, sizeof(ir->c.name), "BeholdTV"); 625 snprintf(ir->c.name, sizeof(ir->c.name), "BeholdTV");
545 ir->get_key = get_key_beholdm6xx; 626 ir->get_key = get_key_beholdm6xx;
diff --git a/drivers/media/video/saa7134/saa7134-reg.h b/drivers/media/video/saa7134/saa7134-reg.h
index 86f5eefdb0f6..cf89d96d7295 100644
--- a/drivers/media/video/saa7134/saa7134-reg.h
+++ b/drivers/media/video/saa7134/saa7134-reg.h
@@ -368,6 +368,7 @@
368#define SAA7135_DSP_RWCLEAR 0x586 368#define SAA7135_DSP_RWCLEAR 0x586
369#define SAA7135_DSP_RWCLEAR_RERR 1 369#define SAA7135_DSP_RWCLEAR_RERR 1
370 370
371#define SAA7133_I2S_AUDIO_CONTROL 0x591
371/* ------------------------------------------------------------------ */ 372/* ------------------------------------------------------------------ */
372/* 373/*
373 * Local variables: 374 * Local variables:
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c
index 232af598d947..c5d0b44c179e 100644
--- a/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ b/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -477,7 +477,6 @@ static int tvaudio_thread(void *data)
477 unsigned int i, audio, nscan; 477 unsigned int i, audio, nscan;
478 int max1,max2,carrier,rx,mode,lastmode,default_carrier; 478 int max1,max2,carrier,rx,mode,lastmode,default_carrier;
479 479
480
481 set_freezable(); 480 set_freezable();
482 481
483 for (;;) { 482 for (;;) {
@@ -775,7 +774,6 @@ static int tvaudio_thread_ddep(void *data)
775 struct saa7134_dev *dev = data; 774 struct saa7134_dev *dev = data;
776 u32 value, norms; 775 u32 value, norms;
777 776
778
779 set_freezable(); 777 set_freezable();
780 for (;;) { 778 for (;;) {
781 tvaudio_sleep(dev,-1); 779 tvaudio_sleep(dev,-1);
@@ -873,13 +871,34 @@ void saa7134_enable_i2s(struct saa7134_dev *dev)
873 871
874 if (!card_is_empress(dev)) 872 if (!card_is_empress(dev))
875 return; 873 return;
876 i2s_format = (dev->input->amux == TV) ? 0x00 : 0x01;
877 874
878 /* enable I2S audio output for the mpeg encoder */ 875 if (dev->pci->device == PCI_DEVICE_ID_PHILIPS_SAA7130)
879 saa_writeb(SAA7134_I2S_OUTPUT_SELECT, 0x80); 876 return;
880 saa_writeb(SAA7134_I2S_OUTPUT_FORMAT, i2s_format); 877
881 saa_writeb(SAA7134_I2S_OUTPUT_LEVEL, 0x0F); 878 /* configure GPIO for out */
882 saa_writeb(SAA7134_I2S_AUDIO_OUTPUT, 0x01); 879 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x0E000000, 0x00000000);
880
881 switch (dev->pci->device) {
882 case PCI_DEVICE_ID_PHILIPS_SAA7133:
883 case PCI_DEVICE_ID_PHILIPS_SAA7135:
884 /* Set I2S format (SONY)  */
885 saa_writeb(SAA7133_I2S_AUDIO_CONTROL, 0x00);
886 /* Start I2S */
887 saa_writeb(SAA7134_I2S_AUDIO_OUTPUT, 0x11);
888 break;
889
890 case PCI_DEVICE_ID_PHILIPS_SAA7134:
891 i2s_format = (dev->input->amux == TV) ? 0x00 : 0x01;
892
893 /* enable I2S audio output for the mpeg encoder */
894 saa_writeb(SAA7134_I2S_OUTPUT_SELECT, 0x80);
895 saa_writeb(SAA7134_I2S_OUTPUT_FORMAT, i2s_format);
896 saa_writeb(SAA7134_I2S_OUTPUT_LEVEL, 0x0F);
897 saa_writeb(SAA7134_I2S_AUDIO_OUTPUT, 0x01);
898
899 default:
900 break;
901 }
883} 902}
884 903
885int saa7134_tvaudio_rx2mode(u32 rx) 904int saa7134_tvaudio_rx2mode(u32 rx)
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 48e1a01718ec..1a5137550e7a 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1496,7 +1496,7 @@ static int video_mmap(struct file *file, struct vm_area_struct * vma)
1496 1496
1497/* ------------------------------------------------------------------ */ 1497/* ------------------------------------------------------------------ */
1498 1498
1499static int saa7134_try_get_set_fmt_vbi(struct file *file, void *priv, 1499static int saa7134_try_get_set_fmt_vbi_cap(struct file *file, void *priv,
1500 struct v4l2_format *f) 1500 struct v4l2_format *f)
1501{ 1501{
1502 struct saa7134_fh *fh = priv; 1502 struct saa7134_fh *fh = priv;
@@ -1516,7 +1516,7 @@ static int saa7134_try_get_set_fmt_vbi(struct file *file, void *priv,
1516 return 0; 1516 return 0;
1517} 1517}
1518 1518
1519static int saa7134_g_fmt_cap(struct file *file, void *priv, 1519static int saa7134_g_fmt_vid_cap(struct file *file, void *priv,
1520 struct v4l2_format *f) 1520 struct v4l2_format *f)
1521{ 1521{
1522 struct saa7134_fh *fh = priv; 1522 struct saa7134_fh *fh = priv;
@@ -1532,7 +1532,7 @@ static int saa7134_g_fmt_cap(struct file *file, void *priv,
1532 return 0; 1532 return 0;
1533} 1533}
1534 1534
1535static int saa7134_g_fmt_overlay(struct file *file, void *priv, 1535static int saa7134_g_fmt_vid_overlay(struct file *file, void *priv,
1536 struct v4l2_format *f) 1536 struct v4l2_format *f)
1537{ 1537{
1538 struct saa7134_fh *fh = priv; 1538 struct saa7134_fh *fh = priv;
@@ -1546,7 +1546,7 @@ static int saa7134_g_fmt_overlay(struct file *file, void *priv,
1546 return 0; 1546 return 0;
1547} 1547}
1548 1548
1549static int saa7134_try_fmt_cap(struct file *file, void *priv, 1549static int saa7134_try_fmt_vid_cap(struct file *file, void *priv,
1550 struct v4l2_format *f) 1550 struct v4l2_format *f)
1551{ 1551{
1552 struct saa7134_fh *fh = priv; 1552 struct saa7134_fh *fh = priv;
@@ -1597,7 +1597,7 @@ static int saa7134_try_fmt_cap(struct file *file, void *priv,
1597 return 0; 1597 return 0;
1598} 1598}
1599 1599
1600static int saa7134_try_fmt_overlay(struct file *file, void *priv, 1600static int saa7134_try_fmt_vid_overlay(struct file *file, void *priv,
1601 struct v4l2_format *f) 1601 struct v4l2_format *f)
1602{ 1602{
1603 struct saa7134_fh *fh = priv; 1603 struct saa7134_fh *fh = priv;
@@ -1611,13 +1611,13 @@ static int saa7134_try_fmt_overlay(struct file *file, void *priv,
1611 return verify_preview(dev, &f->fmt.win); 1611 return verify_preview(dev, &f->fmt.win);
1612} 1612}
1613 1613
1614static int saa7134_s_fmt_cap(struct file *file, void *priv, 1614static int saa7134_s_fmt_vid_cap(struct file *file, void *priv,
1615 struct v4l2_format *f) 1615 struct v4l2_format *f)
1616{ 1616{
1617 struct saa7134_fh *fh = priv; 1617 struct saa7134_fh *fh = priv;
1618 int err; 1618 int err;
1619 1619
1620 err = saa7134_try_fmt_cap(file, priv, f); 1620 err = saa7134_try_fmt_vid_cap(file, priv, f);
1621 if (0 != err) 1621 if (0 != err)
1622 return err; 1622 return err;
1623 1623
@@ -1628,7 +1628,7 @@ static int saa7134_s_fmt_cap(struct file *file, void *priv,
1628 return 0; 1628 return 0;
1629} 1629}
1630 1630
1631static int saa7134_s_fmt_overlay(struct file *file, void *priv, 1631static int saa7134_s_fmt_vid_overlay(struct file *file, void *priv,
1632 struct v4l2_format *f) 1632 struct v4l2_format *f)
1633{ 1633{
1634 struct saa7134_fh *fh = priv; 1634 struct saa7134_fh *fh = priv;
@@ -2028,7 +2028,7 @@ static int saa7134_s_priority(struct file *file, void *f,
2028 return v4l2_prio_change(&dev->prio, &fh->prio, prio); 2028 return v4l2_prio_change(&dev->prio, &fh->prio, prio);
2029} 2029}
2030 2030
2031static int saa7134_enum_fmt_cap(struct file *file, void *priv, 2031static int saa7134_enum_fmt_vid_cap(struct file *file, void *priv,
2032 struct v4l2_fmtdesc *f) 2032 struct v4l2_fmtdesc *f)
2033{ 2033{
2034 if (f->index >= FORMATS) 2034 if (f->index >= FORMATS)
@@ -2042,7 +2042,7 @@ static int saa7134_enum_fmt_cap(struct file *file, void *priv,
2042 return 0; 2042 return 0;
2043} 2043}
2044 2044
2045static int saa7134_enum_fmt_overlay(struct file *file, void *priv, 2045static int saa7134_enum_fmt_vid_overlay(struct file *file, void *priv,
2046 struct v4l2_fmtdesc *f) 2046 struct v4l2_fmtdesc *f)
2047{ 2047{
2048 if (saa7134_no_overlay > 0) { 2048 if (saa7134_no_overlay > 0) {
@@ -2061,7 +2061,7 @@ static int saa7134_enum_fmt_overlay(struct file *file, void *priv,
2061 return 0; 2061 return 0;
2062} 2062}
2063 2063
2064static int saa7134_enum_fmt_vbi(struct file *file, void *priv, 2064static int saa7134_enum_fmt_vbi_cap(struct file *file, void *priv,
2065 struct v4l2_fmtdesc *f) 2065 struct v4l2_fmtdesc *f)
2066{ 2066{
2067 if (0 != f->index) 2067 if (0 != f->index)
@@ -2208,6 +2208,32 @@ static int saa7134_g_parm(struct file *file, void *fh,
2208 return 0; 2208 return 0;
2209} 2209}
2210 2210
2211#ifdef CONFIG_VIDEO_ADV_DEBUG
2212static int vidioc_g_register (struct file *file, void *priv,
2213 struct v4l2_register *reg)
2214{
2215 struct saa7134_fh *fh = priv;
2216 struct saa7134_dev *dev = fh->dev;
2217
2218 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
2219 return -EINVAL;
2220 reg->val = saa_readb(reg->reg);
2221 return 0;
2222}
2223
2224static int vidioc_s_register (struct file *file, void *priv,
2225 struct v4l2_register *reg)
2226{
2227 struct saa7134_fh *fh = priv;
2228 struct saa7134_dev *dev = fh->dev;
2229
2230 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
2231 return -EINVAL;
2232 saa_writeb(reg->reg&0xffffff, reg->val);
2233 return 0;
2234}
2235#endif
2236
2211static int radio_querycap(struct file *file, void *priv, 2237static int radio_querycap(struct file *file, void *priv,
2212 struct v4l2_capability *cap) 2238 struct v4l2_capability *cap)
2213{ 2239{
@@ -2348,18 +2374,18 @@ struct video_device saa7134_video_template =
2348 .fops = &video_fops, 2374 .fops = &video_fops,
2349 .minor = -1, 2375 .minor = -1,
2350 .vidioc_querycap = saa7134_querycap, 2376 .vidioc_querycap = saa7134_querycap,
2351 .vidioc_enum_fmt_cap = saa7134_enum_fmt_cap, 2377 .vidioc_enum_fmt_vid_cap = saa7134_enum_fmt_vid_cap,
2352 .vidioc_g_fmt_cap = saa7134_g_fmt_cap, 2378 .vidioc_g_fmt_vid_cap = saa7134_g_fmt_vid_cap,
2353 .vidioc_try_fmt_cap = saa7134_try_fmt_cap, 2379 .vidioc_try_fmt_vid_cap = saa7134_try_fmt_vid_cap,
2354 .vidioc_s_fmt_cap = saa7134_s_fmt_cap, 2380 .vidioc_s_fmt_vid_cap = saa7134_s_fmt_vid_cap,
2355 .vidioc_enum_fmt_overlay = saa7134_enum_fmt_overlay, 2381 .vidioc_enum_fmt_vid_overlay = saa7134_enum_fmt_vid_overlay,
2356 .vidioc_g_fmt_overlay = saa7134_g_fmt_overlay, 2382 .vidioc_g_fmt_vid_overlay = saa7134_g_fmt_vid_overlay,
2357 .vidioc_try_fmt_overlay = saa7134_try_fmt_overlay, 2383 .vidioc_try_fmt_vid_overlay = saa7134_try_fmt_vid_overlay,
2358 .vidioc_s_fmt_overlay = saa7134_s_fmt_overlay, 2384 .vidioc_s_fmt_vid_overlay = saa7134_s_fmt_vid_overlay,
2359 .vidioc_enum_fmt_vbi = saa7134_enum_fmt_vbi, 2385 .vidioc_enum_fmt_vbi_cap = saa7134_enum_fmt_vbi_cap,
2360 .vidioc_g_fmt_vbi = saa7134_try_get_set_fmt_vbi, 2386 .vidioc_g_fmt_vbi_cap = saa7134_try_get_set_fmt_vbi_cap,
2361 .vidioc_try_fmt_vbi = saa7134_try_get_set_fmt_vbi, 2387 .vidioc_try_fmt_vbi_cap = saa7134_try_get_set_fmt_vbi_cap,
2362 .vidioc_s_fmt_vbi = saa7134_try_get_set_fmt_vbi, 2388 .vidioc_s_fmt_vbi_cap = saa7134_try_get_set_fmt_vbi_cap,
2363 .vidioc_g_audio = saa7134_g_audio, 2389 .vidioc_g_audio = saa7134_g_audio,
2364 .vidioc_s_audio = saa7134_s_audio, 2390 .vidioc_s_audio = saa7134_s_audio,
2365 .vidioc_cropcap = saa7134_cropcap, 2391 .vidioc_cropcap = saa7134_cropcap,
@@ -2391,6 +2417,10 @@ struct video_device saa7134_video_template =
2391 .vidioc_g_parm = saa7134_g_parm, 2417 .vidioc_g_parm = saa7134_g_parm,
2392 .vidioc_g_frequency = saa7134_g_frequency, 2418 .vidioc_g_frequency = saa7134_g_frequency,
2393 .vidioc_s_frequency = saa7134_s_frequency, 2419 .vidioc_s_frequency = saa7134_s_frequency,
2420#ifdef CONFIG_VIDEO_ADV_DEBUG
2421 .vidioc_g_register = vidioc_g_register,
2422 .vidioc_s_register = vidioc_s_register,
2423#endif
2394 .tvnorms = SAA7134_NORMS, 2424 .tvnorms = SAA7134_NORMS,
2395 .current_norm = V4L2_STD_PAL, 2425 .current_norm = V4L2_STD_PAL,
2396}; 2426};
@@ -2458,13 +2488,14 @@ int saa7134_videoport_init(struct saa7134_dev *dev)
2458 int vo = saa7134_boards[dev->board].video_out; 2488 int vo = saa7134_boards[dev->board].video_out;
2459 int video_reg; 2489 int video_reg;
2460 unsigned int vid_port_opts = saa7134_boards[dev->board].vid_port_opts; 2490 unsigned int vid_port_opts = saa7134_boards[dev->board].vid_port_opts;
2491
2492 /* Configure videoport */
2461 saa_writeb(SAA7134_VIDEO_PORT_CTRL0, video_out[vo][0]); 2493 saa_writeb(SAA7134_VIDEO_PORT_CTRL0, video_out[vo][0]);
2462 video_reg = video_out[vo][1]; 2494 video_reg = video_out[vo][1];
2463 if (vid_port_opts & SET_T_CODE_POLARITY_NON_INVERTED) 2495 if (vid_port_opts & SET_T_CODE_POLARITY_NON_INVERTED)
2464 video_reg &= ~VP_T_CODE_P_INVERTED; 2496 video_reg &= ~VP_T_CODE_P_INVERTED;
2465 saa_writeb(SAA7134_VIDEO_PORT_CTRL1, video_reg); 2497 saa_writeb(SAA7134_VIDEO_PORT_CTRL1, video_reg);
2466 saa_writeb(SAA7134_VIDEO_PORT_CTRL2, video_out[vo][2]); 2498 saa_writeb(SAA7134_VIDEO_PORT_CTRL2, video_out[vo][2]);
2467 saa_writeb(SAA7134_VIDEO_PORT_CTRL3, video_out[vo][3]);
2468 saa_writeb(SAA7134_VIDEO_PORT_CTRL4, video_out[vo][4]); 2499 saa_writeb(SAA7134_VIDEO_PORT_CTRL4, video_out[vo][4]);
2469 video_reg = video_out[vo][5]; 2500 video_reg = video_out[vo][5];
2470 if (vid_port_opts & SET_CLOCK_NOT_DELAYED) 2501 if (vid_port_opts & SET_CLOCK_NOT_DELAYED)
@@ -2481,6 +2512,9 @@ int saa7134_videoport_init(struct saa7134_dev *dev)
2481 saa_writeb(SAA7134_VIDEO_PORT_CTRL7, video_out[vo][7]); 2512 saa_writeb(SAA7134_VIDEO_PORT_CTRL7, video_out[vo][7]);
2482 saa_writeb(SAA7134_VIDEO_PORT_CTRL8, video_out[vo][8]); 2513 saa_writeb(SAA7134_VIDEO_PORT_CTRL8, video_out[vo][8]);
2483 2514
2515 /* Start videoport */
2516 saa_writeb(SAA7134_VIDEO_PORT_CTRL3, video_out[vo][3]);
2517
2484 return 0; 2518 return 0;
2485} 2519}
2486 2520
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index 34ff0d4998f3..6927cbea8624 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -264,7 +264,10 @@ struct saa7134_format {
264#define SAA7134_BOARD_AVERMEDIA_A700_PRO 140 264#define SAA7134_BOARD_AVERMEDIA_A700_PRO 140
265#define SAA7134_BOARD_AVERMEDIA_A700_HYBRID 141 265#define SAA7134_BOARD_AVERMEDIA_A700_HYBRID 141
266#define SAA7134_BOARD_BEHOLD_H6 142 266#define SAA7134_BOARD_BEHOLD_H6 142
267 267#define SAA7134_BOARD_BEHOLD_M63 143
268#define SAA7134_BOARD_BEHOLD_M6_EXTRA 144
269#define SAA7134_BOARD_AVERMEDIA_M103 145
270#define SAA7134_BOARD_ASUSTeK_P7131_ANALOG 146
268 271
269#define SAA7134_MAXBOARDS 8 272#define SAA7134_MAXBOARDS 8
270#define SAA7134_INPUT_MAX 8 273#define SAA7134_INPUT_MAX 8
@@ -552,6 +555,7 @@ struct saa7134_dev {
552 struct saa7134_ts ts; 555 struct saa7134_ts ts;
553 struct saa7134_dmaqueue ts_q; 556 struct saa7134_dmaqueue ts_q;
554 struct saa7134_mpeg_ops *mops; 557 struct saa7134_mpeg_ops *mops;
558 struct i2c_client *mpeg_i2c_client;
555 559
556 /* SAA7134_MPEG_EMPRESS only */ 560 /* SAA7134_MPEG_EMPRESS only */
557 struct video_device *empress_dev; 561 struct video_device *empress_dev;