summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx31/gigabeat-s/wmcodec-imx31.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/imx31/gigabeat-s/wmcodec-imx31.c')
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/wmcodec-imx31.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/wmcodec-imx31.c b/firmware/target/arm/imx31/gigabeat-s/wmcodec-imx31.c
index 235ae54bad..c8a04ce20e 100644
--- a/firmware/target/arm/imx31/gigabeat-s/wmcodec-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/wmcodec-imx31.c
@@ -7,14 +7,9 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Gigabeat S specific code for the WM8978 codec 10 * Gigabeat S specific code for the WM8978 codec
11 * 11 *
12 * Based on code from the ipodlinux project - http://ipodlinux.org/ 12 * Copyright (C) 2008 Michael Sevakis
13 * Adapted for Rockbox in December 2005
14 *
15 * Original file: linux/arch/armnommu/mach-ipod/audio.c
16 *
17 * Copyright (c) 2003-2005 Bernard Leach (leachbj@bouncycastle.org)
18 * 13 *
19 * All files in this archive are subject to the GNU General Public License. 14 * All files in this archive are subject to the GNU General Public License.
20 * See the file COPYING in the source tree root for full license agreement. 15 * See the file COPYING in the source tree root for full license agreement.
@@ -23,7 +18,8 @@
23 * KIND, either express or implied. 18 * KIND, either express or implied.
24 * 19 *
25 ****************************************************************************/ 20 ****************************************************************************/
26#include "cpu.h" 21#include "config.h"
22#include "system.h"
27#include "kernel.h" 23#include "kernel.h"
28#include "sound.h" 24#include "sound.h"
29#include "i2c-imx31.h" 25#include "i2c-imx31.h"
@@ -37,15 +33,33 @@ static struct i2c_node wm8978_i2c_node =
37 .ifdr = I2C_IFDR_DIV192, /* 66MHz/.4MHz = 165, closest = 192 = 343750Hz */ 33 .ifdr = I2C_IFDR_DIV192, /* 66MHz/.4MHz = 165, closest = 192 = 343750Hz */
38 /* Just hard-code for now - scaling may require 34 /* Just hard-code for now - scaling may require
39 * updating */ 35 * updating */
40 .addr = WM8978_I2C_ADDR, 36 .addr = WMC_I2C_ADDR,
41}; 37};
42 38
43void audiohw_init(void) 39void audiohw_init(void)
44{ 40{
41 /* USB PLL = 338.688MHz, /30 = 11.2896MHz = 256Fs */
42 imx31_regmod32(&CLKCTL_PDR1, PDR1_SSI1_PODF | PDR1_SSI2_PODF,
43 PDR1_SSI1_PODFw(64-1) | PDR1_SSI2_PODFw(5-1));
44 imx31_regmod32(&CLKCTL_PDR1, PDR1_SSI1_PRE_PODF | PDR1_SSI2_PRE_PODF,
45 PDR1_SSI1_PRE_PODFw(4-1) | PDR1_SSI2_PRE_PODFw(1-1));
45 i2c_enable_node(&wm8978_i2c_node, true); 46 i2c_enable_node(&wm8978_i2c_node, true);
46 GPIO3_DR |= (1 << 21); /* Turn on analogue LDO */ 47
47 sleep(HZ/10); /* Wait for things to stabilize */
48 audiohw_preinit(); 48 audiohw_preinit();
49
50 GPIO3_DR |= (1 << 21); /* Turn on analogue LDO */
51}
52
53void audiohw_enable_headphone_jack(bool enable)
54{
55 if (enable)
56 {
57 GPIO3_DR |= (1 << 22); /* Turn on headphone jack output */
58 }
59 else
60 {
61 GPIO3_DR &= ~(1 << 22); /* Turn off headphone jack output */
62 }
49} 63}
50 64
51void wmcodec_write(int reg, int data) 65void wmcodec_write(int reg, int data)