From 81484e4b759f088033755e5edb07422d5ee70a2b Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Tue, 5 Dec 2006 07:38:55 +0000 Subject: H1x0: Enable optical output to be switched on or off during playback and recording. Fixes FS#6414 - H120 opto out toggle freezes codec. Really DMA just needed a kickstart after setting the optical TXSRC if the peripheral requests were currently enabled (the method of detection). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11661 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/coldfire/iriver/h100/spdif-h100.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/firmware/target/coldfire/iriver/h100/spdif-h100.c b/firmware/target/coldfire/iriver/h100/spdif-h100.c index 20e5bc3c45..8de96238a5 100644 --- a/firmware/target/coldfire/iriver/h100/spdif-h100.c +++ b/firmware/target/coldfire/iriver/h100/spdif-h100.c @@ -62,16 +62,34 @@ void spdif_set_output_source(int source, bool src_on) [AUDIO_SRC_FMRADIO+1] = (7 << 12) | (4 << 8) | (1 << 5) | (5 << 2), }; + int level; + unsigned long playing, recording; + if ((unsigned)source >= ARRAYLEN(ebu1_config)) source = AUDIO_SRC_PLAYBACK; - EBU1CONFIG = 0x800; /* Reset before reprogram */ - spdif_source = source; spdif_on = spdif_powered() && src_on; + level = set_irq_level(HIGHEST_IRQ_LEVEL); + + /* Check if DMA peripheral requests are enabled */ + playing = DCR0 & DMA_EEXT; + recording = DCR1 & DMA_EEXT; + + EBU1CONFIG = 0x800; /* Reset before reprogram */ + /* Tranceiver must be powered or else monitoring will be disabled */ EBU1CONFIG = spdif_on ? ebu1_config[source + 1] : 0; + + /* Kick-start DMAs if in progress */ + if (recording) + DCR1 |= DMA_START; + + if (playing) + DCR0 |= DMA_START; + + set_irq_level(level); } /* spdif_set_output_source */ /* Return the last set S/PDIF audio source */ -- cgit v1.2.3