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.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/wmcodec-imx31.c b/firmware/target/arm/imx31/gigabeat-s/wmcodec-imx31.c
index 238ee3aeb2..235ae54bad 100644
--- a/firmware/target/arm/imx31/gigabeat-s/wmcodec-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/wmcodec-imx31.c
@@ -7,7 +7,7 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Gigabeat specific code for the Wolfson codec 10 * Gigabeat S specific code for the WM8978 codec
11 * 11 *
12 * Based on code from the ipodlinux project - http://ipodlinux.org/ 12 * Based on code from the ipodlinux project - http://ipodlinux.org/
13 * Adapted for Rockbox in December 2005 13 * Adapted for Rockbox in December 2005
@@ -28,12 +28,31 @@
28#include "sound.h" 28#include "sound.h"
29#include "i2c-imx31.h" 29#include "i2c-imx31.h"
30 30
31/* NOTE: Some port-specific bits will have to be moved away (node and GPIO
32 * writes) for cleanest implementation. */
33
34static 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 = WM8978_I2C_ADDR,
41};
42
31void audiohw_init(void) 43void audiohw_init(void)
32{ 44{
45 i2c_enable_node(&wm8978_i2c_node, true);
46 GPIO3_DR |= (1 << 21); /* Turn on analogue LDO */
47 sleep(HZ/10); /* Wait for things to stabilize */
48 audiohw_preinit();
33} 49}
34 50
35void wmcodec_write(int reg, int data) 51void wmcodec_write(int reg, int data)
36{ 52{
37 (void)reg; 53 unsigned char d[2];
38 (void)data; 54 /* |aaaaaaad|dddddddd| */
55 d[0] = (reg << 1) | ((data & 0x100) >> 8);
56 d[1] = data;
57 i2c_write(&wm8978_i2c_node, d, 2);
39} 58}