From 53a7338af60689817e81114d42cfa2ab4bb95516 Mon Sep 17 00:00:00 2001 From: Ian Pickworth Date: Thu, 1 Dec 2005 00:51:28 -0800 Subject: [PATCH] [PATCH] V4L: Fixes nicam sound - 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 Signed-off-by: Michal Pytasz Signed-off-by: Marcin Rudowski Signed-off-by: Torsten Seeboth Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-tvaudio.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c index 6d9bec1c583b..a9059c53a418 100644 --- a/drivers/media/video/cx88/cx88-tvaudio.c +++ b/drivers/media/video/cx88/cx88-tvaudio.c @@ -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; }