Commit 53a7338a authored by Ian Pickworth's avatar Ian Pickworth Committed by Linus Torvalds

[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: default avatarIan Pickworth <ian@pickworth.me.uk>
Signed-off-by: default avatarMichal Pytasz <pytasz@lodz.home.pl>
Signed-off-by: default avatarMarcin Rudowski <mar_rud@poczta.onet.pl>
Signed-off-by: default avatarTorsten Seeboth <Torsten.Seeboth@t-online.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3ca0ea98
...@@ -119,13 +119,10 @@ static void set_audio_registers(struct cx88_core *core, const struct rlist *l) ...@@ -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) static void set_audio_start(struct cx88_core *core, u32 mode)
{ {
// mute /* mute */
cx_write(AUD_VOL_CTL, (1 << 6)); cx_write(AUD_VOL_CTL, (1 << 6));
// start programming /* start programming */
cx_write(MO_AUD_DMACNTRL, 0x0000);
msleep(100);
//cx_write(AUD_CTL, 0x0000);
cx_write(AUD_INIT, mode); cx_write(AUD_INIT, mode);
cx_write(AUD_INIT_LD, 0x0001); cx_write(AUD_INIT_LD, 0x0001);
cx_write(AUD_SOFT_RESET, 0x0001); cx_write(AUD_SOFT_RESET, 0x0001);
...@@ -135,17 +132,18 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl) ...@@ -135,17 +132,18 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl)
{ {
u32 volume; u32 volume;
cx_write(AUD_RATE_THRES_DMD, 0x000000C0);
if (cx88_boards[core->board].blackbird) { 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_set(AUD_CTL, EN_I2SIN_ENABLE);
//cx_write(AUD_I2SINPUTCNTL, 0);
cx_write(AUD_I2SINPUTCNTL, 4); cx_write(AUD_I2SINPUTCNTL, 4);
cx_write(AUD_BAUDRATE, 1); 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_set(AUD_CTL, EN_I2SOUT_ENABLE);
cx_write(AUD_I2SOUTPUTCNTL, 1); cx_write(AUD_I2SOUTPUTCNTL, 1);
cx_write(AUD_I2SCNTL, 0); cx_write(AUD_I2SCNTL, 0);
//cx_write(AUD_APB_IN_RATE_ADJ, 0); /* cx_write(AUD_APB_IN_RATE_ADJ, 0); */
} else { } else {
ctl |= EN_DAC_ENABLE; ctl |= EN_DAC_ENABLE;
cx_write(AUD_CTL, ctl); cx_write(AUD_CTL, ctl);
...@@ -153,7 +151,6 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl) ...@@ -153,7 +151,6 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl)
/* finish programming */ /* finish programming */
cx_write(AUD_SOFT_RESET, 0x0000); cx_write(AUD_SOFT_RESET, 0x0000);
cx_write(MO_AUD_DMACNTRL, 0x0003);
/* unmute */ /* unmute */
volume = cx_sread(SHADOW_AUD_VOL_CTL); volume = cx_sread(SHADOW_AUD_VOL_CTL);
...@@ -313,7 +310,6 @@ static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode) ...@@ -313,7 +310,6 @@ static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode)
{AUD_RATE_ADJ3, 0x00000100}, {AUD_RATE_ADJ3, 0x00000100},
{AUD_RATE_ADJ4, 0x00000400}, {AUD_RATE_ADJ4, 0x00000400},
{AUD_RATE_ADJ5, 0x00001000}, {AUD_RATE_ADJ5, 0x00001000},
//{ AUD_DMD_RA_DDS, 0x00c0d5ce },
{AUD_ERRLOGPERIOD_R, 0x00000fff}, {AUD_ERRLOGPERIOD_R, 0x00000fff},
{AUD_ERRINTRPTTHSHLD1_R, 0x000003ff}, {AUD_ERRINTRPTTHSHLD1_R, 0x000003ff},
{AUD_ERRINTRPTTHSHLD2_R, 0x000000ff}, {AUD_ERRINTRPTTHSHLD2_R, 0x000000ff},
...@@ -351,12 +347,12 @@ static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode) ...@@ -351,12 +347,12 @@ static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode)
set_audio_registers(core, nicam_l); set_audio_registers(core, nicam_l);
break; break;
case WW_I: 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_bgdki_common);
set_audio_registers(core, nicam_i); set_audio_registers(core, nicam_i);
break; break;
default: 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_bgdki_common);
set_audio_registers(core, nicam_default); set_audio_registers(core, nicam_default);
break; break;
...@@ -715,8 +711,7 @@ int cx88_detect_nicam(struct cx88_core *core) ...@@ -715,8 +711,7 @@ int cx88_detect_nicam(struct cx88_core *core)
/* if bit1=1 then nicam is detected */ /* if bit1=1 then nicam is detected */
j += ((cx_read(AUD_NICAM_STATUS2) & 0x02) >> 1); j += ((cx_read(AUD_NICAM_STATUS2) & 0x02) >> 1);
/* 3x detected: absolutly sure now */ if (j == 1) {
if (j == 3) {
dprintk("nicam is detected.\n"); dprintk("nicam is detected.\n");
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment