diff options
Diffstat (limited to 'firmware/target/arm/sandisk/audio-c200_e200.c')
-rw-r--r-- | firmware/target/arm/sandisk/audio-c200_e200.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/firmware/target/arm/sandisk/audio-c200_e200.c b/firmware/target/arm/sandisk/audio-c200_e200.c index 0037bac58b..2f6bde1b98 100644 --- a/firmware/target/arm/sandisk/audio-c200_e200.c +++ b/firmware/target/arm/sandisk/audio-c200_e200.c | |||
@@ -45,8 +45,12 @@ void audio_set_output_source(int source) | |||
45 | void audio_input_mux(int source, unsigned flags) | 45 | void audio_input_mux(int source, unsigned flags) |
46 | { | 46 | { |
47 | static int last_source = AUDIO_SRC_PLAYBACK; | 47 | static int last_source = AUDIO_SRC_PLAYBACK; |
48 | #ifdef HAVE_RECORDING | ||
48 | static bool last_recording = false; | 49 | static bool last_recording = false; |
49 | bool recording = flags & SRCF_RECORDING; | 50 | bool recording = flags & SRCF_RECORDING; |
51 | #else | ||
52 | (void) flags; | ||
53 | #endif | ||
50 | 54 | ||
51 | switch (source) | 55 | switch (source) |
52 | { | 56 | { |
@@ -56,11 +60,16 @@ void audio_input_mux(int source, unsigned flags) | |||
56 | audio_channels = 2; | 60 | audio_channels = 2; |
57 | if (source != last_source) | 61 | if (source != last_source) |
58 | { | 62 | { |
63 | #if defined(HAVE_RECORDING) || defined(HAVE_FMRADIO_IN) | ||
59 | audiohw_set_monitor(false); | 64 | audiohw_set_monitor(false); |
65 | #endif | ||
66 | #ifdef HAVE_RECORDING | ||
60 | audiohw_disable_recording(); | 67 | audiohw_disable_recording(); |
68 | #endif | ||
61 | } | 69 | } |
62 | break; | 70 | break; |
63 | 71 | ||
72 | #if defined(HAVE_RECORDING) && (INPUT_SRC_CAPS & SRC_CAP_MIC) | ||
64 | case AUDIO_SRC_MIC: /* recording only */ | 73 | case AUDIO_SRC_MIC: /* recording only */ |
65 | audio_channels = 1; | 74 | audio_channels = 1; |
66 | if (source != last_source) | 75 | if (source != last_source) |
@@ -69,26 +78,39 @@ void audio_input_mux(int source, unsigned flags) | |||
69 | audiohw_enable_recording(true); /* source mic */ | 78 | audiohw_enable_recording(true); /* source mic */ |
70 | } | 79 | } |
71 | break; | 80 | break; |
81 | #endif | ||
72 | 82 | ||
83 | #if (INPUT_SRC_CAPS & SRC_CAP_FMRADIO) | ||
73 | case AUDIO_SRC_FMRADIO: /* recording and playback */ | 84 | case AUDIO_SRC_FMRADIO: /* recording and playback */ |
74 | audio_channels = 2; | 85 | audio_channels = 2; |
75 | 86 | ||
76 | if (source == last_source && recording == last_recording) | 87 | if (source == last_source |
88 | #ifdef HAVE_RECORDING | ||
89 | && recording == last_recording | ||
90 | #endif | ||
91 | ) | ||
77 | break; | 92 | break; |
78 | 93 | ||
94 | #ifdef HAVE_RECORDING | ||
79 | last_recording = recording; | 95 | last_recording = recording; |
80 | |||
81 | if (recording) | 96 | if (recording) |
82 | { | 97 | { |
83 | audiohw_set_monitor(false); | 98 | audiohw_set_monitor(false); |
84 | audiohw_enable_recording(false); | 99 | audiohw_enable_recording(false); |
85 | } | 100 | } |
101 | #endif | ||
86 | else | 102 | else |
87 | { | 103 | { |
104 | #ifdef HAVE_RECORDING | ||
88 | audiohw_disable_recording(); | 105 | audiohw_disable_recording(); |
106 | #endif | ||
107 | #if defined(HAVE_RECORDING) || defined(HAVE_FMRADIO_IN) | ||
89 | audiohw_set_monitor(true); /* line 1 analog audio path */ | 108 | audiohw_set_monitor(true); /* line 1 analog audio path */ |
109 | #endif | ||
110 | |||
90 | } | 111 | } |
91 | break; | 112 | break; |
113 | #endif /* (INPUT_SRC_CAPS & SRC_CAP_FMRADIO) */ | ||
92 | } /* end switch */ | 114 | } /* end switch */ |
93 | 115 | ||
94 | last_source = source; | 116 | last_source = source; |
@@ -164,6 +186,7 @@ void audiohw_set_sampr_dividers(int fsel) | |||
164 | IISDIV = (IISDIV & ~0xc000003f) | regvals[fsel].iisdiv; | 186 | IISDIV = (IISDIV & ~0xc000003f) | regvals[fsel].iisdiv; |
165 | } | 187 | } |
166 | 188 | ||
189 | #ifdef HAVE_RECORDING | ||
167 | unsigned int pcm_sampr_type_rec_to_play(unsigned int samplerate) | 190 | unsigned int pcm_sampr_type_rec_to_play(unsigned int samplerate) |
168 | { | 191 | { |
169 | /* Check if the samplerate is in the list of recordable rates. | 192 | /* Check if the samplerate is in the list of recordable rates. |
@@ -175,3 +198,4 @@ unsigned int pcm_sampr_type_rec_to_play(unsigned int samplerate) | |||
175 | 198 | ||
176 | return samplerate * 2; /* Recording rates are 1/2 the codec clock */ | 199 | return samplerate * 2; /* Recording rates are 1/2 the codec clock */ |
177 | } | 200 | } |
201 | #endif | ||