diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2010-04-09 01:21:53 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2010-04-09 01:21:53 +0000 |
commit | 7abf2b53a462612808d46d6d77a7f35261a0e5a3 (patch) | |
tree | 241304f7cd2b5d1c2a9e091fe56a33d2d2f8e816 /firmware/target/arm/imx31/gigabeat-s/wmcodec-gigabeat-s.c | |
parent | 43304b87b0662d1619ac60e5297a1694aa580310 (diff) | |
download | rockbox-7abf2b53a462612808d46d6d77a7f35261a0e5a3.tar.gz rockbox-7abf2b53a462612808d46d6d77a7f35261a0e5a3.zip |
Gigabeat S/i.MX31: Sort files in the /target tree into things that are SoC-generic (into /imx31) and player-specific (into /gigabeat-s, based upon current appearances). Move i2s clock init into the appropriate file. Housekeeping only-- no functional changes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25547 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/imx31/gigabeat-s/wmcodec-gigabeat-s.c')
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/wmcodec-gigabeat-s.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/wmcodec-gigabeat-s.c b/firmware/target/arm/imx31/gigabeat-s/wmcodec-gigabeat-s.c new file mode 100644 index 0000000000..96324cc162 --- /dev/null +++ b/firmware/target/arm/imx31/gigabeat-s/wmcodec-gigabeat-s.c | |||
@@ -0,0 +1,67 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Gigabeat S specific code for the WM8978 codec | ||
11 | * | ||
12 | * Copyright (C) 2008 Michael Sevakis | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | #include "config.h" | ||
24 | #include "system.h" | ||
25 | #include "kernel.h" | ||
26 | #include "sound.h" | ||
27 | #include "wmcodec.h" | ||
28 | #include "i2s.h" | ||
29 | #include "i2c-imx31.h" | ||
30 | |||
31 | /* NOTE: Some port-specific bits will have to be moved away (node and GPIO | ||
32 | * writes) for cleanest implementation. */ | ||
33 | |||
34 | static struct i2c_node wm8978_i2c_node = | ||
35 | { | ||
36 | .num = I2C1_NUM, | ||
37 | .ifdr = I2C_IFDR_DIV192, /* 66MHz/.4MHz = 165, closest = 192 = 343750Hz */ | ||
38 | /* Just hard-code for now - scaling may require | ||
39 | * updating */ | ||
40 | .addr = WMC_I2C_ADDR, | ||
41 | }; | ||
42 | |||
43 | void audiohw_init(void) | ||
44 | { | ||
45 | i2s_reset(); | ||
46 | |||
47 | i2c_enable_node(&wm8978_i2c_node, true); | ||
48 | |||
49 | audiohw_preinit(); | ||
50 | |||
51 | imx31_regset32(&GPIO3_DR, (1 << 21)); /* Turn on analogue LDO */ | ||
52 | } | ||
53 | |||
54 | void audiohw_enable_headphone_jack(bool enable) | ||
55 | { | ||
56 | /* Turn headphone jack output on or off. */ | ||
57 | imx31_regmod32(&GPIO3_DR, enable ? (1 << 22) : 0, (1 << 22)); | ||
58 | } | ||
59 | |||
60 | void wmcodec_write(int reg, int data) | ||
61 | { | ||
62 | unsigned char d[2]; | ||
63 | /* |aaaaaaad|dddddddd| */ | ||
64 | d[0] = (reg << 1) | ((data & 0x100) >> 8); | ||
65 | d[1] = data; | ||
66 | i2c_write(&wm8978_i2c_node, d, 2); | ||
67 | } | ||