diff options
Diffstat (limited to 'firmware/target/arm/s5l8702/ipod6g/audio-6g.c')
-rw-r--r-- | firmware/target/arm/s5l8702/ipod6g/audio-6g.c | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/firmware/target/arm/s5l8702/ipod6g/audio-6g.c b/firmware/target/arm/s5l8702/ipod6g/audio-6g.c new file mode 100644 index 0000000000..6a3bab06d6 --- /dev/null +++ b/firmware/target/arm/s5l8702/ipod6g/audio-6g.c | |||
@@ -0,0 +1,97 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: audio-nano2g.c 23095 2009-10-11 09:17:12Z dave $ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Michael Sevakis | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "system.h" | ||
22 | #include "cpu.h" | ||
23 | #include "audio.h" | ||
24 | #include "sound.h" | ||
25 | #include "pmu-target.h" | ||
26 | |||
27 | extern int rec_hw_ver; | ||
28 | |||
29 | #if INPUT_SRC_CAPS != 0 | ||
30 | void audio_set_output_source(int source) | ||
31 | { | ||
32 | if ((unsigned)source >= AUDIO_NUM_SOURCES) | ||
33 | source = AUDIO_SRC_PLAYBACK; | ||
34 | } /* audio_set_output_source */ | ||
35 | |||
36 | void audio_input_mux(int source, unsigned flags) | ||
37 | { | ||
38 | (void)flags; | ||
39 | /* Prevent pops from unneeded switching */ | ||
40 | static int last_source = AUDIO_SRC_PLAYBACK; | ||
41 | |||
42 | switch (source) | ||
43 | { | ||
44 | default: /* playback - no recording */ | ||
45 | source = AUDIO_SRC_PLAYBACK; | ||
46 | case AUDIO_SRC_PLAYBACK: | ||
47 | #ifdef HAVE_RECORDING | ||
48 | if (source != last_source) | ||
49 | { | ||
50 | audiohw_set_monitor(false); | ||
51 | audiohw_disable_recording(); | ||
52 | |||
53 | /* Vcodec = 1800mV (900mV + value*100mV) */ | ||
54 | pmu_ldo_set_voltage(3, 0x9); | ||
55 | |||
56 | if (rec_hw_ver == 1) | ||
57 | GPIOCMD = 0xe070e; | ||
58 | } | ||
59 | #endif | ||
60 | break; | ||
61 | |||
62 | #ifdef HAVE_MIC_REC | ||
63 | case AUDIO_SRC_MIC: /* recording only */ | ||
64 | if (source != last_source) | ||
65 | { | ||
66 | if (rec_hw_ver == 1) | ||
67 | GPIOCMD = 0xe070f; | ||
68 | |||
69 | /* Vcodec = 2400mV (900mV + value*100mV) */ | ||
70 | pmu_ldo_set_voltage(3, 0xf); | ||
71 | |||
72 | audiohw_set_monitor(false); | ||
73 | audiohw_enable_recording(true); /* source mic */ | ||
74 | } | ||
75 | break; | ||
76 | #endif | ||
77 | |||
78 | #ifdef HAVE_LINE_REC | ||
79 | case AUDIO_SRC_LINEIN: /* recording only */ | ||
80 | if (source != last_source) | ||
81 | { | ||
82 | if (rec_hw_ver == 1) | ||
83 | GPIOCMD = 0xe070e; | ||
84 | |||
85 | /* Vcodec = 2400mV (900mV + value*100mV) */ | ||
86 | pmu_ldo_set_voltage(3, 0xf); | ||
87 | |||
88 | audiohw_set_monitor(false); | ||
89 | audiohw_enable_recording(false); /* source line */ | ||
90 | } | ||
91 | break; | ||
92 | #endif | ||
93 | } /* end switch */ | ||
94 | |||
95 | last_source = source; | ||
96 | } /* audio_input_mux */ | ||
97 | #endif /* INPUT_SRC_CAPS != 0 */ | ||