FS#11250: Hotkey setting method changed to menu item vs button pres in context menu...
[kugel-rb.git] / firmware / target / arm / wmcodec-telechips.c
blob8fb035bdfa8507a4531229c24eac1e98cb63d426
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * TCC specific code for Wolfson audio codecs
12 * Based on code from the ipodlinux project - http://ipodlinux.org/
13 * Adapted for Rockbox in December 2005
15 * Original file: linux/arch/armnommu/mach-ipod/audio.c
17 * Copyright (c) 2003-2005 Bernard Leach (leachbj@bouncycastle.org)
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version 2
22 * of the License, or (at your option) any later version.
24 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
25 * KIND, either express or implied.
27 ****************************************************************************/
29 #include "system.h"
30 #include "audiohw.h"
31 #include "i2c.h"
32 #include "wmcodec.h"
34 #if defined(COWON_D2)
35 /* The D2's audio codec uses an I2C address of 0x34 */
36 #define I2C_AUDIO_ADDRESS 0x34
37 #elif defined (IAUDIO_7) || defined(LOGIK_DAX) || defined(SANSA_M200)
38 #define I2C_AUDIO_ADDRESS 0x34
39 #else
40 #error wmcodec not implemented for this target!
41 #endif
44 void audiohw_init(void)
46 #if defined(HAVE_WM8731) || defined(HAVE_WM8751) || defined(HAVE_WM8985)
47 audiohw_preinit();
48 #endif
51 void wmcodec_write(int reg, int data)
53 unsigned char d[2];
54 d[0] = (reg << 1) | ((data & 0x100) >> 8);
55 d[1] = data;
57 i2c_write(I2C_AUDIO_ADDRESS, d, 2);