Fix mistake on targets without frequency scaling.
[kugel-rb.git] / firmware / target / arm / ascodec-pp.c
blob49a69d1a111bf3052c31f8335af4ac3211bc1a1f
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Driver for AS3514 audio codec
12 * Copyright (c) 2007 Daniel Ankers
13 * Copyright (c) 2007 Christian Gmeiner
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.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 ****************************************************************************/
24 #include "cpu.h"
25 #include "system.h"
27 #include "audiohw.h"
28 #include "i2s.h"
29 #include "ascodec-target.h"
32 * Initialise the PP I2C and I2S.
34 void audiohw_init(void)
36 /* normal outputs for CDI and I2S pin groups */
37 DEV_INIT2 &= ~0x300;
39 /*mini2?*/
40 DEV_INIT1 &=~0x3000000;
41 /*mini2?*/
43 /* I2S device reset */
44 DEV_RS |= DEV_I2S;
45 DEV_RS &=~DEV_I2S;
47 /* I2S device enable */
48 DEV_EN |= DEV_I2S;
50 /* enable external dev clock clocks */
51 DEV_EN |= DEV_EXTCLOCKS;
53 /* external dev clock to 24MHz */
54 outl(inl(0x70000018) & ~0xc, 0x70000018);
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
63 i2s_reset();
65 audiohw_preinit();
68 void ascodec_suppressor_on(bool on)
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);
79 #else
80 (void)on;
81 #endif