Initial commit for the Creative ZEN X-Fi2 and X-Fi3 ports
[maemo-rb.git] / firmware / target / arm / imx233 / creative-zenxfi3 / audio-zenxfi3.c
blobfaf15242abf3253b1cfb81dab9a7e8edf4a3fca7
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2012 by Amaury Pouly
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
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"
29 static int input_source = AUDIO_SRC_PLAYBACK;
30 static unsigned input_flags = 0;
31 static int output_source = AUDIO_SRC_PLAYBACK;
33 static void select_audio_path(void)
35 /* route audio to HP */
36 imx233_set_pin_function(1, 30, PINCTRL_FUNCTION_GPIO);
37 imx233_enable_gpio_output(1, 30, true);
38 imx233_set_gpio_output(1, 30, true);
40 if(input_source == AUDIO_SRC_PLAYBACK)
41 imx233_audioout_select_hp_input(false);
42 else
43 imx233_audioout_select_hp_input(true);
46 void audio_input_mux(int source, unsigned flags)
48 (void) source;
49 (void) flags;
50 input_source = source;
51 input_flags = flags;
52 select_audio_path();
55 void audio_set_output_source(int source)
57 (void) source;
58 output_source = source;
59 select_audio_path();