diff options
Diffstat (limited to 'firmware/target/arm/pp/ascodec-pp.c')
-rw-r--r-- | firmware/target/arm/pp/ascodec-pp.c | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/firmware/target/arm/pp/ascodec-pp.c b/firmware/target/arm/pp/ascodec-pp.c new file mode 100644 index 0000000000..49a69d1a11 --- /dev/null +++ b/firmware/target/arm/pp/ascodec-pp.c | |||
@@ -0,0 +1,82 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Driver for AS3514 audio codec | ||
11 | * | ||
12 | * Copyright (c) 2007 Daniel Ankers | ||
13 | * Copyright (c) 2007 Christian Gmeiner | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or | ||
16 | * modify it under the terms of the GNU General Public License | ||
17 | * as published by the Free Software Foundation; either version 2 | ||
18 | * of the License, or (at your option) any later version. | ||
19 | * | ||
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
21 | * KIND, either express or implied. | ||
22 | * | ||
23 | ****************************************************************************/ | ||
24 | #include "cpu.h" | ||
25 | #include "system.h" | ||
26 | |||
27 | #include "audiohw.h" | ||
28 | #include "i2s.h" | ||
29 | #include "ascodec-target.h" | ||
30 | |||
31 | /* | ||
32 | * Initialise the PP I2C and I2S. | ||
33 | */ | ||
34 | void audiohw_init(void) | ||
35 | { | ||
36 | /* normal outputs for CDI and I2S pin groups */ | ||
37 | DEV_INIT2 &= ~0x300; | ||
38 | |||
39 | /*mini2?*/ | ||
40 | DEV_INIT1 &=~0x3000000; | ||
41 | /*mini2?*/ | ||
42 | |||
43 | /* I2S device reset */ | ||
44 | DEV_RS |= DEV_I2S; | ||
45 | DEV_RS &=~DEV_I2S; | ||
46 | |||
47 | /* I2S device enable */ | ||
48 | DEV_EN |= DEV_I2S; | ||
49 | |||
50 | /* enable external dev clock clocks */ | ||
51 | DEV_EN |= DEV_EXTCLOCKS; | ||
52 | |||
53 | /* external dev clock to 24MHz */ | ||
54 | outl(inl(0x70000018) & ~0xc, 0x70000018); | ||
55 | |||
56 | #ifdef SANSA_E200 | ||
57 | /* Prevent pops on startup */ | ||
58 | GPIOG_ENABLE |= 0x08; | ||
59 | GPIO_SET_BITWISE(GPIOG_OUTPUT_VAL, 0x08); | ||
60 | GPIOG_OUTPUT_EN |= 0x08; | ||
61 | #endif | ||
62 | |||
63 | i2s_reset(); | ||
64 | |||
65 | audiohw_preinit(); | ||
66 | } | ||
67 | |||
68 | void ascodec_suppressor_on(bool on) | ||
69 | { | ||
70 | /* CHECK: Good for c200 too? */ | ||
71 | #ifdef SANSA_E200 | ||
72 | if (on) { | ||
73 | /* Set pop prevention */ | ||
74 | GPIO_SET_BITWISE(GPIOG_OUTPUT_VAL, 0x08); | ||
75 | } else { | ||
76 | /* Release pop prevention */ | ||
77 | GPIO_CLEAR_BITWISE(GPIOG_OUTPUT_VAL, 0x08); | ||
78 | } | ||
79 | #else | ||
80 | (void)on; | ||
81 | #endif | ||
82 | } | ||