1
0
Fork 0
forked from len0rd/rockbox

Fixed pops from headphone audio output.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6977 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Miika Pekkarinen 2005-07-01 21:23:07 +00:00
parent cea09fa139
commit 45d6fa916c
2 changed files with 16 additions and 9 deletions

View file

@ -158,10 +158,8 @@ void uda1380_enable_output(bool enable)
{ {
if (enable) { if (enable) {
uda1380_write_reg(REG_PWR, uda1380_regs[REG_PWR] | PON_HP); uda1380_write_reg(REG_PWR, uda1380_regs[REG_PWR] | PON_HP);
/* Don't unmute audio output here */
/* Sleep a while, then disable the master mute */ // uda1380_write_reg(REG_MUTE, MUTE_CH2);
sleep(HZ/8);
uda1380_write_reg(REG_MUTE, MUTE_CH2);
} else { } else {
uda1380_write_reg(REG_MUTE, MUTE_MASTER); uda1380_write_reg(REG_MUTE, MUTE_MASTER);
uda1380_write_reg(REG_PWR, uda1380_regs[REG_PWR] & ~PON_HP); uda1380_write_reg(REG_PWR, uda1380_regs[REG_PWR] & ~PON_HP);

View file

@ -247,9 +247,9 @@ void pcm_play_data(const unsigned char* start, int size,
get_more(&next_start, &next_size); get_more(&next_start, &next_size);
dma_start(start, size); dma_start(start, size);
/* Sleep a while, then power on audio output */ /* Sleep a while, then unmute audio output */
sleep(HZ/16); sleep(1);
uda1380_enable_output(true); uda1380_mute(false);
} }
void pcm_play_stop(void) void pcm_play_stop(void)
@ -257,9 +257,9 @@ void pcm_play_stop(void)
crossfade_active = false; crossfade_active = false;
pcm_set_boost_mode(false); pcm_set_boost_mode(false);
if (pcm_playing) { if (pcm_playing) {
uda1380_enable_output(false); uda1380_mute(true);
pcm_boost(false); pcm_boost(false);
sleep(HZ/16); sleep(1);
dma_stop(); dma_stop();
} }
} }
@ -277,10 +277,14 @@ void pcm_play_pause(bool play)
IIS2CONFIG = (pcm_freq << 12) | 0x300 | 4 << 2; IIS2CONFIG = (pcm_freq << 12) | 0x300 | 4 << 2;
EBU1CONFIG = 7 << 12 | 3 << 8 | 5 << 2; EBU1CONFIG = 7 << 12 | 3 << 8 | 5 << 2;
DCR0 |= DMA_EEXT | DMA_START; DCR0 |= DMA_EEXT | DMA_START;
sleep(1);
uda1380_mute(false);
} }
else if(!pcm_paused && !play) else if(!pcm_paused && !play)
{ {
logf("pause"); logf("pause");
uda1380_mute(true);
/* Disable DMA peripheral request. */ /* Disable DMA peripheral request. */
DCR0 &= ~DMA_EEXT; DCR0 &= ~DMA_EEXT;
IIS2CONFIG = 0x800; IIS2CONFIG = 0x800;
@ -695,6 +699,11 @@ void pcm_play_init(void)
crossfade_active = false; crossfade_active = false;
crossfade_init = false; crossfade_init = false;
pcm_event_handler = NULL; pcm_event_handler = NULL;
/* Turn on headphone power with audio output muted. */
uda1380_mute(true);
sleep(HZ/4);
uda1380_enable_output(true);
} }
void pcm_crossfade_enable(bool on_off) void pcm_crossfade_enable(bool on_off)