Hi Gerd, I've managed to get the FlyVideo2000 External Audio In working. Enclosed is a patch against saa7134-20020219.tar.gz to support switching between TV Tuner audio and External Audio In. Details below. Thanks to Gert Vervoort for his kind assistance in explaining the difference between SAA7134 and SAA7130 to me. Regards, T.C. The FlyVideo2000 uses an external analog mux HEF4052BT to switch between the various Audio Input sources. All the sources feed into LINE2 of the SAA7130. The patch updates saa7134-core.c to include Gerd's fix for the FlyVideo2000 audio path initialization problem (against saa7134-20020219.tar.gz), and updates the FlyVideo2000 Audio input definition. saa7134-reg.h contains defintions for GPIO support on the SAA7134/0. saa7134-tvaudio.c & saa7134.h defines a new function to switch the external mux. saa7134-video.c is modified to call the audio mux. -------saa7134-0.1.5-fv2k.diff ------- cut here --------------------- diff -Naur saa7134-0.1.5/saa7134-core.c saa7134-0.1.5-fv2k/saa7134-core.c --- saa7134-0.1.5/saa7134-core.c Tue Feb 19 14:59:04 2002 +++ saa7134-0.1.5-fv2k/saa7134-core.c Tue Mar 5 15:10:28 2002 @@ -107,7 +107,7 @@ tuner_type: TUNER_LG_PAL_NEW_TAPC, vmux_tuner: 1, amux_tuner: LINE2, - amux_extern: LINE1, + amux_extern: LINE2, }, }; #define BOARDS (sizeof(boards)/sizeof(struct saa7134_board)) @@ -804,9 +804,9 @@ printk(KERN_INFO "%s: registered device vbi%d\n", dev->name,dev->vbi_dev.minor & 0x1f); + dev->radio_dev = saa7134_radio_template; + dev->radio_dev.priv = dev; if (card_amux_radio(dev)) { - dev->radio_dev = saa7134_radio_template; - dev->radio_dev.priv = dev; err = video_register_device(&dev->radio_dev,VFL_TYPE_RADIO,radio_nr); if (err < 0) goto fail5; diff -Naur saa7134-0.1.5/saa7134-reg.h saa7134-0.1.5-fv2k/saa7134-reg.h --- saa7134-0.1.5/saa7134-reg.h Sat Jan 5 20:40:01 2002 +++ saa7134-0.1.5-fv2k/saa7134-reg.h Tue Mar 5 15:09:58 2002 @@ -290,6 +290,23 @@ #define SAA7134_AUDIO_CLOCKS_PER_FIELD1 0x175 #define SAA7134_AUDIO_CLOCKS_PER_FIELD2 0x176 +/* GPIO Controls */ +/* Bidirectional Read/Write Pins, controlled via SAA7134_GPIO_GPMODEx. Default READ */ + +#define SAA7134_GPIO_GPMODE0 0x1B0 /* GPMOD 7-0 */ +#define SAA7134_GPIO_GPMODE1 0x1B1 /* GPMOD 15-8 */ +#define SAA7134_GPIO_GPMODE2 0x1B2 /* GPMOD 23-16 */ +#define SAA7134_GPIO_GPMODE3 0x1B3 /* GPRESCAN,0,0,0,GPMOD27-25,0 */ + +#define SAA7134_GPIO_GPRESCAN 0x80 /* bit 0->1 to latch GPIO read registers from pins */ +#define SAA7134_GPIO_27_25 0x0E /* Bitmask for GPIO pins 27-25 */ + +#define SAA7134_GPIO_GPSTATUS0 0x1B4 /* GPSTAT 7-0 */ +#define SAA7134_GPIO_GPSTATUS1 0x1B5 /* GPSTAT 15-8 */ +#define SAA7134_GPIO_GPSTATUS2 0x1B6 /* GPSTAT 23-16 */ +#define SAA7134_GPIO_GPSTATUS3 0x1B7 /* 0,0,0,0,GPSTAT27-25,0 */ + + /* test modes */ #define SAA7134_SPECIAL_MODE 0x1d0 diff -Naur saa7134-0.1.5/saa7134-tvaudio.c saa7134-0.1.5-fv2k/saa7134-tvaudio.c --- saa7134-0.1.5/saa7134-tvaudio.c Tue Dec 18 13:47:10 2001 +++ saa7134-0.1.5-fv2k/saa7134-tvaudio.c Tue Mar 5 23:47:47 2002 @@ -123,6 +123,10 @@ saa_writeb(SAA7134_NICAM_ERROR_HIGH, 0x50); saa_writeb(SAA7134_MONITOR_SELECT, 0xa0); saa_writeb(SAA7134_FM_DEMATRIX, 0x80); + + if (card_hasexternmux(dev)) { + saa_andorb(SAA7134_GPIO_GPMODE1,0x60, 0x60); /* Enable A1A0 for HEF4052BT Analog Mux (guessed) */ + } } static __u32 tvaudio_carr2reg(__u32 carrier) @@ -162,6 +166,31 @@ saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x07, reg); } +void saa7134_tvaudio_setexternmux(struct saa7134_dev *dev, + int video_input) +{ + /* + We must check for video input as all audio share the same + SAA7130 input line. + + Note: This routine only handles inputs for TV Tuner Audio and + External Audio In. It doesn't cater for FM Radio Input + as the FlyVideo2000 card I have doesn't have FM Radio. + (if it's even available as an option on the FlyVideo2000) + -- 20020306 TC Wan <tcwan@xxxxxxxxx> + */ + + int gpio_output = 0; + if (video_input == card_vmux_tuner(dev)) { + gpio_output = 0x00; /* HEF4052BT Y0 output */ + } else { + gpio_output = 0x40; /* HEF4052BT Y2 output */ + } + + saa_andorb(SAA7134_GPIO_GPSTATUS1,0x60, gpio_output); /* Select Audio Input */ + dprintk("tvaudio_setexternmux: gpio = %02x\n",gpio_output); +} + void saa7134_tvaudio_setvolume(struct saa7134_dev *dev, int level) { saa_writeb(SAA7134_CHANNEL1_LEVEL, level & 0x1f); @@ -413,6 +442,7 @@ } done: + saa7134_tvaudio_setinput(dev,LINE1); /* Select Default Audio Source */ dev->thread.task = NULL; if(dev->thread.notify != NULL) up(dev->thread.notify); diff -Naur saa7134-0.1.5/saa7134-video.c saa7134-0.1.5-fv2k/saa7134-video.c --- saa7134-0.1.5/saa7134-video.c Tue Feb 19 15:01:08 2002 +++ saa7134-0.1.5-fv2k/saa7134-video.c Tue Mar 5 23:48:47 2002 @@ -474,6 +474,9 @@ dprintk("video input = %d%s\n",input,is_tv ? " [TV]" : ""); dev->ctl_input = input; saa_andorb(SAA7134_ANALOG_IN_CTRL1,0x0f,input); + if (card_hasexternmux(dev)) { + saa7134_tvaudio_setexternmux(dev, input); + } saa7134_tvaudio_setinput(dev, is_tv ? card_amux_tuner(dev) : card_amux_extern(dev)); } diff -Naur saa7134-0.1.5/saa7134.h saa7134-0.1.5-fv2k/saa7134.h --- saa7134-0.1.5/saa7134.h Tue Feb 19 14:59:22 2002 +++ saa7134-0.1.5-fv2k/saa7134.h Tue Mar 5 23:40:48 2002 @@ -137,6 +137,7 @@ }; #define card_hasaudio(dev) (dev->pci->device == PCI_DEVICE_ID_PHILIPS_SAA7134) +#define card_hasexternmux(dev) (dev->board == SAA7143_BOARD_FLYVIDEO2000) #define card_tuner_type(dev) (saa7134_boards[dev->board].tuner_type) #define card_vmux_tuner(dev) (saa7134_boards[dev->board].vmux_tuner) #define card_amux_tuner(dev) (saa7134_boards[dev->board].amux_tuner) @@ -435,6 +436,8 @@ /* saa7134-tvaudio.c */ void saa7134_tvaudio_setmute(struct saa7134_dev *dev); +void saa7134_tvaudio_setexternmux(struct saa7134_dev *dev, + int video_input); void saa7134_tvaudio_setinput(struct saa7134_dev *dev, enum saa7134_audio_in in); void saa7134_tvaudio_setvolume(struct saa7134_dev *dev, int level); ------------------------------ cut here -------------------------------- ---- Wan Tat Chee (Lecturer) School of Computer Science, Univ. Science Malaysia, 11800 Minden, Penang, Malaysia. Ofc Ph: +604 657-7888 x 3617 Internet: tcwan@xxxxxxxxx Web: http://nrg.cs.usm.my/~tcwan GPG Key : http://nrg.cs.usm.my/~tcwan/tcw_gpg.asc F'print : 2DB6 E00A 9B98 BD36 AF0A 0FE8 69D2 20E5 573C DBA3