diff options
Diffstat (limited to 'firmware/target/coldfire/iriver/h100')
-rw-r--r-- | firmware/target/coldfire/iriver/h100/power-h100.c | 2 | ||||
-rw-r--r-- | firmware/target/coldfire/iriver/h100/spdif-h100.c | 18 |
2 files changed, 16 insertions, 4 deletions
diff --git a/firmware/target/coldfire/iriver/h100/power-h100.c b/firmware/target/coldfire/iriver/h100/power-h100.c index 75c8bea9dd..ce1c350802 100644 --- a/firmware/target/coldfire/iriver/h100/power-h100.c +++ b/firmware/target/coldfire/iriver/h100/power-h100.c | |||
@@ -119,7 +119,7 @@ bool ide_powered(void) | |||
119 | 119 | ||
120 | void power_off(void) | 120 | void power_off(void) |
121 | { | 121 | { |
122 | set_irq_level(HIGHEST_IRQ_LEVEL); | 122 | set_irq_level(DISABLE_INTERRUPTS); |
123 | and_l(~0x00080000, &GPIO1_OUT); | 123 | and_l(~0x00080000, &GPIO1_OUT); |
124 | asm("halt"); | 124 | asm("halt"); |
125 | while(1) | 125 | while(1) |
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 */ |