diff options
Diffstat (limited to 'firmware/target/coldfire/iriver/h100/spdif-h100.c')
-rw-r--r-- | firmware/target/coldfire/iriver/h100/spdif-h100.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/firmware/target/coldfire/iriver/h100/spdif-h100.c b/firmware/target/coldfire/iriver/h100/spdif-h100.c index 35508d10e8..ee4a9402ea 100644 --- a/firmware/target/coldfire/iriver/h100/spdif-h100.c +++ b/firmware/target/coldfire/iriver/h100/spdif-h100.c | |||
@@ -63,30 +63,42 @@ void spdif_set_output_source(int source, bool src_on) | |||
63 | }; | 63 | }; |
64 | 64 | ||
65 | bool kick; | 65 | bool kick; |
66 | int level; | ||
67 | int iis2config = 0; | ||
66 | 68 | ||
67 | if ((unsigned)source >= ARRAYLEN(ebu1_config)) | 69 | if ((unsigned)source >= ARRAYLEN(ebu1_config)) |
68 | source = AUDIO_SRC_PLAYBACK; | 70 | source = AUDIO_SRC_PLAYBACK; |
69 | 71 | ||
70 | spdif_source = source; | 72 | spdif_source = source; |
71 | spdif_on = spdif_powered() && src_on; | 73 | spdif_on = spdif_powered() && src_on; |
72 | kick = spdif_on && source == AUDIO_SRC_PLAYBACK; | 74 | |
75 | /* Keep a DMA interrupt initiated stop from changing play state */ | ||
76 | level = set_irq_level(DMA_IRQ_LEVEL); | ||
77 | |||
78 | kick = spdif_on && source == AUDIO_SRC_PLAYBACK | ||
79 | && (DCR0 & DMA_EEXT); | ||
73 | 80 | ||
74 | /* FIFO must be in reset condition to reprogram bits 15-12 */ | 81 | /* FIFO must be in reset condition to reprogram bits 15-12 */ |
75 | or_l(0x800, &EBU1CONFIG); | 82 | or_l(0x800, &EBU1CONFIG); |
76 | 83 | ||
77 | if (kick) | 84 | if (kick) |
85 | { | ||
86 | iis2config = IIS2CONFIG; | ||
78 | or_l(0x800, &IIS2CONFIG); /* Have to resync IIS2 TXSRC */ | 87 | or_l(0x800, &IIS2CONFIG); /* Have to resync IIS2 TXSRC */ |
88 | } | ||
79 | 89 | ||
80 | /* Tranceiver must be powered or else monitoring will be disabled. | 90 | /* Tranceiver must be powered or else monitoring will be disabled. |
81 | CLOCKSEL bits only have relevance to normal operation so just | 91 | CLOCKSEL bits only have relevance to normal operation so just |
82 | set them always. */ | 92 | set them always. */ |
83 | EBU1CONFIG = (spdif_on ? ebu1_config[source + 1] : 0) | (7 << 12); | 93 | EBU1CONFIG = (spdif_on ? ebu1_config[source + 1] : 0) | (7 << 12); |
84 | 94 | ||
85 | if (kick && (DCR0 & DMA_EEXT)) /* only if still playing */ | 95 | if (kick) |
86 | { | 96 | { |
87 | and_l(~0x800, &IIS2CONFIG); | 97 | IIS2CONFIG = iis2config; |
88 | PDOR3 = 0; /* A write to the FIFO kick-starts playback */ | 98 | PDOR3 = 0; /* A write to the FIFO kick-starts playback */ |
89 | } | 99 | } |
100 | |||
101 | set_irq_level(level); | ||
90 | } /* spdif_set_output_source */ | 102 | } /* spdif_set_output_source */ |
91 | 103 | ||
92 | /* Return the last set S/PDIF audio source */ | 104 | /* Return the last set S/PDIF audio source */ |