Hi Mauro, I've finally found the time (and an energy) to go look into the automute breakage. With the attached automute fix I no longer have any problems with pulseaudio. I also attached the patch that introduces an "std" option to limit the scan list, resulting in a faster scan. It is completely unrelated to the automute one, it is here just in case. What do you think?
>From ccdfa126e98b5484f4a08de591ac8d89f775251c Mon Sep 17 00:00:00 2001 From: Stas Sergeev <stsp@xxxxxxxxxxxxxxxxxxxxx> Date: Sun, 18 Sep 2011 19:06:21 +0400 Subject: [PATCH 1/2] saa7134: fix automute --- drivers/media/video/saa7134/saa7134-tvaudio.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index 57e646b..62a6287 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -332,7 +332,7 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, struct mainscan *scan) { __s32 left,right,value; - if (audio_debug > 1) { + if (audio_debug > 1 && (dev->tvnorm->id & scan->std)) { int i; dprintk("debug %d:",scan->carr); for (i = -150; i <= 150; i += 30) { @@ -546,6 +546,7 @@ static int tvaudio_thread(void *data) dev->tvnorm->name, carrier/1000, carrier%1000, max1, max2); dev->last_carrier = carrier; + dev->automute = !(dev->thread.scan1 > 1); } else if (0 != dev->last_carrier) { /* no carrier -- try last detected one as fallback */ @@ -553,6 +554,7 @@ static int tvaudio_thread(void *data) dprintk("audio carrier scan failed, " "using %d.%03d MHz [last detected]\n", carrier/1000, carrier%1000); + dev->automute = 1; } else { /* no carrier + no fallback -- use default */ @@ -560,9 +562,9 @@ static int tvaudio_thread(void *data) dprintk("audio carrier scan failed, " "using %d.%03d MHz [default]\n", carrier/1000, carrier%1000); + dev->automute = 1; } tvaudio_setcarrier(dev,carrier,carrier); - dev->automute = 0; saa_andorb(SAA7134_STEREO_DAC_OUTPUT_SELECT, 0x30, 0x00); saa7134_tvaudio_setmute(dev); /* find the exact tv audio norm */ @@ -1020,6 +1022,7 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev) } dev->thread.thread = NULL; + dev->thread.scan1 = dev->thread.scan2 = 0; if (my_thread) { saa7134_tvaudio_init(dev); /* start tvaudio thread */ -- 1.7.6
>From 70709f12f7161c98cb7ebae104b520dc30c6bd53 Mon Sep 17 00:00:00 2001 From: Stas Sergeev <stsp@xxxxxxxxxxxxxxxxxxxxx> Date: Sun, 18 Sep 2011 19:13:05 +0400 Subject: [PATCH 2/2] saa7134: introduce "std" module parameter to force video std --- drivers/media/video/saa7134/saa7134-video.c | 39 ++++++++++++++++++++++++-- drivers/media/video/saa7134/saa7134.h | 1 + 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 776ba2d..04ac7de 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -40,12 +40,15 @@ static unsigned int noninterlaced; /* 0 */ static unsigned int gbufsize = 720*576*4; static unsigned int gbufsize_max = 720*576*4; static char secam[] = "--"; +static char std[16] = "--"; module_param(video_debug, int, 0644); MODULE_PARM_DESC(video_debug,"enable debug messages [video]"); module_param(gbuffers, int, 0444); MODULE_PARM_DESC(gbuffers,"number of capture buffers, range 2-32"); module_param(noninterlaced, int, 0644); MODULE_PARM_DESC(noninterlaced,"capture non interlaced video"); +module_param_string(std, std, sizeof(std), 0644); +MODULE_PARM_DESC(secam, "force TV standard, either PAL, SECAM or NTSC"); module_param_string(secam, secam, sizeof(secam), 0644); MODULE_PARM_DESC(secam, "force SECAM variant, either DK,L or Lc"); @@ -1847,14 +1850,20 @@ int saa7134_s_std_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, v4l2_ return -EBUSY; } - for (i = 0; i < TVNORMS; i++) + for (i = 0; i < TVNORMS; i++) { + if (!tvnorms[i].enabled) + continue; if (*id == tvnorms[i].id) break; + } if (i == TVNORMS) - for (i = 0; i < TVNORMS; i++) + for (i = 0; i < TVNORMS; i++) { + if (!tvnorms[i].enabled) + continue; if (*id & tvnorms[i].id) break; + } if (i == TVNORMS) return -EINVAL; @@ -1871,6 +1880,8 @@ int saa7134_s_std_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, v4l2_ fixup = V4L2_STD_SECAM; } for (i = 0; i < TVNORMS; i++) { + if (!tvnorms[i].enabled) + continue; if (fixup == tvnorms[i].id) break; } @@ -2579,8 +2590,30 @@ int saa7134_videoport_init(struct saa7134_dev *dev) int saa7134_video_init2(struct saa7134_dev *dev) { + int i, idx = -1; + for (i = 0; i < TVNORMS; i++) { + int enable = (std[0] == '-' || strncasecmp(std, + tvnorms[i].name, strlen(std)) == 0); + + if (secam[0] != '-') { + char buf[16] = "SECAM"; + if (strncasecmp(buf, tvnorms[i].name, + strlen(buf)) == 0) { + strcat(buf, "-"); + strcat(buf, secam); + if (strncasecmp(buf, tvnorms[i].name, + strlen(buf)) != 0) + enable = 0; + } + } + tvnorms[i].enabled = enable; + if (enable && idx == -1) + idx = i; + } + if (idx == -1) + return -EINVAL; /* init video hw */ - set_tvnorm(dev,&tvnorms[0]); + set_tvnorm(dev,&tvnorms[idx]); video_mux(dev,0); saa7134_tvaudio_setmute(dev); saa7134_tvaudio_setvolume(dev,dev->ctl_volume); diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 28eb103..a0eddce 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -77,6 +77,7 @@ enum saa7134_video_out { struct saa7134_tvnorm { char *name; v4l2_std_id id; + int enabled; /* video decoder */ unsigned int sync_control; -- 1.7.6