summaryrefslogtreecommitdiff
path: root/firmware/target/arm/sandisk/sansa-e200/audio-e200.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/sandisk/sansa-e200/audio-e200.c')
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/audio-e200.c103
1 files changed, 103 insertions, 0 deletions
diff --git a/firmware/target/arm/sandisk/sansa-e200/audio-e200.c b/firmware/target/arm/sandisk/sansa-e200/audio-e200.c
new file mode 100644
index 0000000000..a3f3284b98
--- /dev/null
+++ b/firmware/target/arm/sandisk/sansa-e200/audio-e200.c
@@ -0,0 +1,103 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Michael Sevakis
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#include "system.h"
20#include "cpu.h"
21#include "audio.h"
22#include "sound.h"
23
24int audio_channels = 2;
25int audio_output_source = AUDIO_SRC_PLAYBACK;
26
27void audio_set_output_source(int source)
28{
29 int oldmode = set_fiq_status(FIQ_DISABLED);
30
31 if ((unsigned)source >= AUDIO_NUM_SOURCES)
32 source = AUDIO_SRC_PLAYBACK;
33
34 audio_output_source = source;
35
36 if (source != AUDIO_SRC_PLAYBACK)
37 IISCONFIG |= (1 << 29);
38
39 set_fiq_status(oldmode);
40} /* audio_set_output_source */
41
42void audio_set_source(int source, unsigned flags)
43{
44 static int last_source = AUDIO_SRC_PLAYBACK;
45#if 0
46 static bool last_recording = false;
47 bool recording = flags & SRCF_RECORDING;
48#endif
49 (void)flags;
50
51 switch (source)
52 {
53 default: /* playback - no recording */
54 source = AUDIO_SRC_PLAYBACK;
55 case AUDIO_SRC_PLAYBACK:
56 audio_channels = 2;
57 if (source != last_source)
58 {
59 audiohw_set_monitor(false);
60 audiohw_disable_recording();
61 }
62 break;
63
64 case AUDIO_SRC_MIC: /* recording only */
65 audio_channels = 1;
66 if (source != last_source)
67 {
68 audiohw_set_monitor(false);
69 audiohw_enable_recording(true); /* source mic */
70 }
71 break;
72
73#if 0
74 case AUDIO_SRC_FMRADIO: /* recording and playback */
75 audio_channels = 2;
76
77 if (!recording)
78 audiohw_set_recvol(23, 23, AUDIO_GAIN_LINEIN);
79
80 if (source == last_source && recording == last_recording)
81 break;
82
83 last_recording = recording;
84
85 if (recording)
86 {
87 audiohw_set_monitor(false);
88 audiohw_enable_recording(false);
89 }
90 else
91 {
92 audiohw_disable_recording();
93 audiohw_set_monitor(true); /* line 1 analog audio path */
94 }
95
96 break;
97#endif
98 } /* end switch */
99
100 last_source = source;
101} /* audio_set_source */
102
103