diff options
author | Mark Arigo <markarigo@gmail.com> | 2009-05-25 21:10:45 +0000 |
---|---|---|
committer | Mark Arigo <markarigo@gmail.com> | 2009-05-25 21:10:45 +0000 |
commit | 758bb3bc628705ff8e5c677b3b2d87720c726c13 (patch) | |
tree | d78cbf984e4bc613b0b76fcf4a5f090ab1d774b8 /firmware/target/arm/samsung/akcodec-yh82x_yh92x.c | |
parent | d2ea7db6f55cbb121870ecd41d4d80581354b799 (diff) | |
download | rockbox-758bb3bc628705ff8e5c677b3b2d87720c726c13.tar.gz rockbox-758bb3bc628705ff8e5c677b3b2d87720c726c13.zip |
3 new ports: Samsung YH-820, YH-920, and YH-925. Mostly functional. Audio working on 820 & 925 (untested on the 920). No battery readings. No recording. No plugins. Keymap needs work.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21083 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/samsung/akcodec-yh82x_yh92x.c')
-rw-r--r-- | firmware/target/arm/samsung/akcodec-yh82x_yh92x.c | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/firmware/target/arm/samsung/akcodec-yh82x_yh92x.c b/firmware/target/arm/samsung/akcodec-yh82x_yh92x.c new file mode 100644 index 0000000000..bfdd9203ce --- /dev/null +++ b/firmware/target/arm/samsung/akcodec-yh82x_yh92x.c | |||
@@ -0,0 +1,102 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (c) 2009 Mark Arigo | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "system.h" | ||
23 | #include "audiohw.h" | ||
24 | #include "i2c-pp.h" | ||
25 | #include "i2s.h" | ||
26 | #include "akcodec.h" | ||
27 | |||
28 | // #define LOGF_ENABLE | ||
29 | #include "logf.h" | ||
30 | |||
31 | #define I2C_AUDIO_ADDRESS 0x10 | ||
32 | |||
33 | /* | ||
34 | * Initialise the PP I2C and I2S. | ||
35 | */ | ||
36 | void audiohw_init(void) | ||
37 | { | ||
38 | unsigned long tmp; | ||
39 | |||
40 | logf("audiohw_init"); | ||
41 | |||
42 | /* I2S device enable */ | ||
43 | DEV_EN |= (DEV_I2S | DEV_EXTCLOCKS); | ||
44 | |||
45 | /* I2S device reset */ | ||
46 | DEV_RS |= DEV_I2S; | ||
47 | asm volatile ("nop\n"); | ||
48 | DEV_RS &= ~DEV_I2S; | ||
49 | |||
50 | DEV_INIT1 &= ~0x3000000; | ||
51 | |||
52 | tmp = DEV_INIT1; | ||
53 | DEV_INIT1 = tmp; | ||
54 | |||
55 | DEV_INIT2 &= ~0x100; | ||
56 | |||
57 | /* reset the I2S controller into known state */ | ||
58 | i2s_reset(); | ||
59 | |||
60 | /* this gpio pin maybe powers the codec chip */ | ||
61 | GPIOB_ENABLE |= 0x01; | ||
62 | GPIOB_OUTPUT_EN |= 0x01; | ||
63 | GPIOB_OUTPUT_VAL |= 0x01; | ||
64 | |||
65 | GPIOL_ENABLE |= 0x20; | ||
66 | GPIOL_OUTPUT_VAL &= ~0x20; | ||
67 | GPIOL_OUTPUT_EN |= 0x20; | ||
68 | |||
69 | GPO32_VAL |= 0x00000020; | ||
70 | GPO32_ENABLE |= 0x00000020; | ||
71 | |||
72 | GPIOF_ENABLE |= 0x80; | ||
73 | GPIOF_OUTPUT_VAL |= 0x80; | ||
74 | GPIOF_OUTPUT_EN |= 0x80; | ||
75 | |||
76 | audiohw_preinit(); | ||
77 | |||
78 | GPIOL_ENABLE |= 0x20; | ||
79 | GPIOL_OUTPUT_VAL |= 0x20; | ||
80 | GPIOL_OUTPUT_EN |= 0x20; | ||
81 | } | ||
82 | |||
83 | void akcodec_close(void) | ||
84 | { | ||
85 | GPIOF_ENABLE |= 0x80; | ||
86 | GPIOF_OUTPUT_VAL &= ~0x80; | ||
87 | GPIOF_OUTPUT_EN |= 0x80; | ||
88 | |||
89 | GPIOB_ENABLE |= 0x01; | ||
90 | GPIOB_OUTPUT_EN |= 0x01; | ||
91 | GPIOB_OUTPUT_VAL |= 0x01; | ||
92 | } | ||
93 | |||
94 | void akcodec_write(int reg, int data) | ||
95 | { | ||
96 | pp_i2c_send(I2C_AUDIO_ADDRESS, reg, data); | ||
97 | } | ||
98 | |||
99 | int akcodec_read(int reg) | ||
100 | { | ||
101 | return i2c_readbyte(I2C_AUDIO_ADDRESS, reg); | ||
102 | } | ||