From 5df4405317890cc4a84edcfe827a765b52a712c9 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sat, 3 May 2008 15:14:52 +0000 Subject: Gigabeat S: Man it's so loud in here. We have SOUND! Someone please make keymaps consistent; it's rather messy atm. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17327 a1c6a512-1295-4272-9138-f99709370657 --- .../target/arm/imx31/gigabeat-s/wmcodec-imx31.c | 36 +++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'firmware/target/arm/imx31/gigabeat-s/wmcodec-imx31.c') 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 @@ * \/ \/ \/ \/ \/ * $Id$ * - * Gigabeat S specific code for the WM8978 codec + * Gigabeat S specific code for the WM8978 codec * - * Based on code from the ipodlinux project - http://ipodlinux.org/ - * Adapted for Rockbox in December 2005 - * - * Original file: linux/arch/armnommu/mach-ipod/audio.c - * - * Copyright (c) 2003-2005 Bernard Leach (leachbj@bouncycastle.org) + * Copyright (C) 2008 Michael Sevakis * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. @@ -23,7 +18,8 @@ * KIND, either express or implied. * ****************************************************************************/ -#include "cpu.h" +#include "config.h" +#include "system.h" #include "kernel.h" #include "sound.h" #include "i2c-imx31.h" @@ -37,15 +33,33 @@ static struct i2c_node wm8978_i2c_node = .ifdr = I2C_IFDR_DIV192, /* 66MHz/.4MHz = 165, closest = 192 = 343750Hz */ /* Just hard-code for now - scaling may require * updating */ - .addr = WM8978_I2C_ADDR, + .addr = WMC_I2C_ADDR, }; void audiohw_init(void) { + /* USB PLL = 338.688MHz, /30 = 11.2896MHz = 256Fs */ + imx31_regmod32(&CLKCTL_PDR1, PDR1_SSI1_PODF | PDR1_SSI2_PODF, + PDR1_SSI1_PODFw(64-1) | PDR1_SSI2_PODFw(5-1)); + imx31_regmod32(&CLKCTL_PDR1, PDR1_SSI1_PRE_PODF | PDR1_SSI2_PRE_PODF, + PDR1_SSI1_PRE_PODFw(4-1) | PDR1_SSI2_PRE_PODFw(1-1)); i2c_enable_node(&wm8978_i2c_node, true); - GPIO3_DR |= (1 << 21); /* Turn on analogue LDO */ - sleep(HZ/10); /* Wait for things to stabilize */ + audiohw_preinit(); + + GPIO3_DR |= (1 << 21); /* Turn on analogue LDO */ +} + +void audiohw_enable_headphone_jack(bool enable) +{ + if (enable) + { + GPIO3_DR |= (1 << 22); /* Turn on headphone jack output */ + } + else + { + GPIO3_DR &= ~(1 << 22); /* Turn off headphone jack output */ + } } void wmcodec_write(int reg, int data) -- cgit v1.2.3