[PATCH] V4L: Fixes nicam sound
authorIan Pickworth <ian@pickworth.me.uk>
Thu, 1 Dec 2005 08:51:28 +0000 (00:51 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 1 Dec 2005 23:48:57 +0000 (15:48 -0800)
- Resolved problem of sporadic buzz after setting Nicam stereo
- improved setting audio standard with dma reset
- cleaned up comments format
- more sensitive Nicam detection

Signed-off-by: Ian Pickworth <ian@pickworth.me.uk>
Signed-off-by: Michal Pytasz <pytasz@lodz.home.pl>
Signed-off-by: Marcin Rudowski <mar_rud@poczta.onet.pl>
Signed-off-by: Torsten Seeboth <Torsten.Seeboth@t-online.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/media/video/cx88/cx88-tvaudio.c

index 6d9bec1..a9059c5 100644 (file)
@@ -119,13 +119,10 @@ static void set_audio_registers(struct cx88_core *core, const struct rlist *l)
 
 static void set_audio_start(struct cx88_core *core, u32 mode)
 {
-       // mute
+       /* mute */
        cx_write(AUD_VOL_CTL, (1 << 6));
 
-       // start programming
-       cx_write(MO_AUD_DMACNTRL, 0x0000);
-       msleep(100);
-       //cx_write(AUD_CTL, 0x0000);
+       /* start programming */
        cx_write(AUD_INIT, mode);
        cx_write(AUD_INIT_LD, 0x0001);
        cx_write(AUD_SOFT_RESET, 0x0001);
@@ -135,17 +132,18 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl)
 {
        u32 volume;
 
+       cx_write(AUD_RATE_THRES_DMD, 0x000000C0);
+
        if (cx88_boards[core->board].blackbird) {
-               // sets sound input from external adc
+               /* sets sound input from external adc */
                cx_set(AUD_CTL, EN_I2SIN_ENABLE);
-               //cx_write(AUD_I2SINPUTCNTL, 0);
                cx_write(AUD_I2SINPUTCNTL, 4);
                cx_write(AUD_BAUDRATE, 1);
-               // 'pass-thru mode': this enables the i2s output to the mpeg encoder
+               /* 'pass-thru mode': this enables the i2s output to the mpeg encoder */
                cx_set(AUD_CTL, EN_I2SOUT_ENABLE);
                cx_write(AUD_I2SOUTPUTCNTL, 1);
                cx_write(AUD_I2SCNTL, 0);
-               //cx_write(AUD_APB_IN_RATE_ADJ, 0);
+               /* cx_write(AUD_APB_IN_RATE_ADJ, 0); */
        } else {
                ctl |= EN_DAC_ENABLE;
                cx_write(AUD_CTL, ctl);
@@ -153,7 +151,6 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl)
 
        /* finish programming */
        cx_write(AUD_SOFT_RESET, 0x0000);
-       cx_write(MO_AUD_DMACNTRL, 0x0003);
 
        /* unmute */
        volume = cx_sread(SHADOW_AUD_VOL_CTL);
@@ -313,7 +310,6 @@ static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode)
                {AUD_RATE_ADJ3, 0x00000100},
                {AUD_RATE_ADJ4, 0x00000400},
                {AUD_RATE_ADJ5, 0x00001000},
-               //{ AUD_DMD_RA_DDS,        0x00c0d5ce },
                {AUD_ERRLOGPERIOD_R, 0x00000fff},
                {AUD_ERRINTRPTTHSHLD1_R, 0x000003ff},
                {AUD_ERRINTRPTTHSHLD2_R, 0x000000ff},
@@ -351,12 +347,12 @@ static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode)
                set_audio_registers(core, nicam_l);
                break;
        case WW_I:
-               dprintk("%s PAL-I NICAM (status: devel)\n", __FUNCTION__);
+               dprintk("%s PAL-I NICAM (status: known-good)\n", __FUNCTION__);
                set_audio_registers(core, nicam_bgdki_common);
                set_audio_registers(core, nicam_i);
                break;
        default:
-               dprintk("%s PAL-BGDK NICAM (status: unknown)\n", __FUNCTION__);
+               dprintk("%s PAL-BGDK NICAM (status: known-good)\n", __FUNCTION__);
                set_audio_registers(core, nicam_bgdki_common);
                set_audio_registers(core, nicam_default);
                break;
@@ -715,8 +711,7 @@ int cx88_detect_nicam(struct cx88_core *core)
                /* if bit1=1 then nicam is detected */
                j += ((cx_read(AUD_NICAM_STATUS2) & 0x02) >> 1);
 
-               /* 3x detected: absolutly sure now */
-               if (j == 3) {
+               if (j == 1) {
                        dprintk("nicam is detected.\n");
                        return 1;
                }