diff options
Diffstat (limited to 'firmware/target/arm/imx233/creative-zenxfi3')
-rw-r--r-- | firmware/target/arm/imx233/creative-zenxfi3/audio-target.h | 30 | ||||
-rw-r--r-- | firmware/target/arm/imx233/creative-zenxfi3/audio-zenxfi3.c | 78 |
2 files changed, 30 insertions, 78 deletions
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/audio-target.h b/firmware/target/arm/imx233/creative-zenxfi3/audio-target.h new file mode 100644 index 0000000000..0b4610cd1a --- /dev/null +++ b/firmware/target/arm/imx233/creative-zenxfi3/audio-target.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
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 | #ifndef __audio_target__ | ||
22 | #define __audio_target__ | ||
23 | |||
24 | #define IMX233_AUDIO_HP_GATE_BANK 1 | ||
25 | #define IMX233_AUDIO_HP_GATE_PIN 30 | ||
26 | |||
27 | #define IMX233_AUDIO_SPKR_GATE_BANK 1 | ||
28 | #define IMX233_AUDIO_SPKR_GATE_PIN 22 | ||
29 | |||
30 | #endif /* __audio_target__ */ | ||
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/audio-zenxfi3.c b/firmware/target/arm/imx233/creative-zenxfi3/audio-zenxfi3.c deleted file mode 100644 index 3ea757aedb..0000000000 --- a/firmware/target/arm/imx233/creative-zenxfi3/audio-zenxfi3.c +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2012 by Amaury Pouly | ||
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 "config.h" | ||
22 | #include "system.h" | ||
23 | #include "audiohw.h" | ||
24 | #include "audio.h" | ||
25 | #include "audioout-imx233.h" | ||
26 | #include "audioin-imx233.h" | ||
27 | #include "pinctrl-imx233.h" | ||
28 | |||
29 | static int input_source = AUDIO_SRC_PLAYBACK; | ||
30 | static unsigned input_flags = 0; | ||
31 | static int output_source = AUDIO_SRC_PLAYBACK; | ||
32 | static bool initialized = false; | ||
33 | |||
34 | static void init(void) | ||
35 | { | ||
36 | /* HP gate */ | ||
37 | imx233_pinctrl_acquire(1, 30, "hp gate"); | ||
38 | imx233_pinctrl_set_function(1, 30, PINCTRL_FUNCTION_GPIO); | ||
39 | imx233_pinctrl_enable_gpio(1, 30, true); | ||
40 | imx233_pinctrl_set_gpio(1, 30, false); | ||
41 | /* SPKR gate */ | ||
42 | imx233_pinctrl_acquire(1, 22, "spkr gate"); | ||
43 | imx233_pinctrl_set_function(1, 22, PINCTRL_FUNCTION_GPIO); | ||
44 | imx233_pinctrl_enable_gpio(1, 22, true); | ||
45 | imx233_pinctrl_set_gpio(1, 22, false); | ||
46 | |||
47 | initialized = true; | ||
48 | } | ||
49 | |||
50 | static void select_audio_path(void) | ||
51 | { | ||
52 | if(!initialized) | ||
53 | init(); | ||
54 | /* route audio to HP */ | ||
55 | imx233_pinctrl_set_gpio(1, 30, true); | ||
56 | |||
57 | if(input_source == AUDIO_SRC_PLAYBACK) | ||
58 | imx233_audioout_select_hp_input(false); | ||
59 | else | ||
60 | imx233_audioout_select_hp_input(true); | ||
61 | } | ||
62 | |||
63 | void audio_input_mux(int source, unsigned flags) | ||
64 | { | ||
65 | (void) source; | ||
66 | (void) flags; | ||
67 | input_source = source; | ||
68 | input_flags = flags; | ||
69 | select_audio_path(); | ||
70 | } | ||
71 | |||
72 | void audio_set_output_source(int source) | ||
73 | { | ||
74 | (void) source; | ||
75 | output_source = source; | ||
76 | select_audio_path(); | ||
77 | } | ||
78 | |||