summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/audioout-imx233.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2012-11-13 18:24:44 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2012-11-13 18:25:00 +0100
commit5ead8f3f441221f19830af2866a33a7f3f03423e (patch)
treef64c486bd1c9389e4c1a69e6b05dc889d6fdf128 /firmware/target/arm/imx233/audioout-imx233.c
parent214f226ca63c8c5d6f446d69ffe95aec91779254 (diff)
downloadrockbox-5ead8f3f441221f19830af2866a33a7f3f03423e.tar.gz
rockbox-5ead8f3f441221f19830af2866a33a7f3f03423e.tar.bz2
rockbox-5ead8f3f441221f19830af2866a33a7f3f03423e.zip
imx233: hopefully fix audio pop on startup
Change-Id: I6410c0e11acc02ec996461153b4737f416f8cbee
Diffstat (limited to 'firmware/target/arm/imx233/audioout-imx233.c')
-rw-r--r--firmware/target/arm/imx233/audioout-imx233.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/firmware/target/arm/imx233/audioout-imx233.c b/firmware/target/arm/imx233/audioout-imx233.c
index 4e1ff27ad2..e5e1e37264 100644
--- a/firmware/target/arm/imx233/audioout-imx233.c
+++ b/firmware/target/arm/imx233/audioout-imx233.c
@@ -24,6 +24,15 @@
#include "pcm_sampr.h"
static int hp_vol_l, hp_vol_r;
+static struct timeout hp_unmute_oneshort;
+
+static int hp_unmute_cb(struct timeout *tmo)
+{
+ (void) tmo;
+ /* unmute HP */
+ __REG_CLR(HW_AUDIOOUT_HPVOL) = HW_AUDIOOUT_HPVOL__MUTE;
+ return 0;
+}
void imx233_audioout_preinit(void)
{
@@ -41,7 +50,6 @@ void imx233_audioout_preinit(void)
__REG_CLR(HW_AUDIOOUT_PWRDN) = HW_AUDIOOUT_PWRDN__DAC;
/* Hold HP to ground to avoid pop, then release and power up HP */
__REG_SET(HW_AUDIOOUT_ANACTRL) = HW_AUDIOOUT_ANACTRL__HP_HOLD_GND;
- __REG_SET(HW_RTC_PERSISTENT0) = HW_RTC_PERSISTENT0__SPARE__RELEASE_GND;
__REG_CLR(HW_AUDIOOUT_PWRDN) = HW_AUDIOOUT_PWRDN__HEADPHONE;
/* Set HP mode to AB */
__REG_SET(HW_AUDIOOUT_ANACTRL) = HW_AUDIOOUT_ANACTRL__HP_CLASSAB;
@@ -50,12 +58,22 @@ void imx233_audioout_preinit(void)
/* Set dmawait count to 31 (see errata, workaround random stop) */
__REG_CLR(HW_AUDIOOUT_CTRL) = HW_AUDIOOUT_CTRL__DMAWAIT_COUNT_BM;
__REG_SET(HW_AUDIOOUT_CTRL) = 31 << HW_AUDIOOUT_CTRL__DMAWAIT_COUNT_BP;
+ /* start converting audio */
+ __REG_SET(HW_AUDIOOUT_CTRL) = HW_AUDIOOUT_CTRL__RUN;
+ /* unmute DAC */
+ __REG_CLR(HW_AUDIOOUT_DACVOLUME) = HW_AUDIOOUT_DACVOLUME__MUTE_LEFT |
+ HW_AUDIOOUT_DACVOLUME__MUTE_RIGHT;
+ /* send a few samples to avoid pop */
+ HW_AUDIOOUT_DATA = 0;
+ HW_AUDIOOUT_DATA = 0;
+ HW_AUDIOOUT_DATA = 0;
+ HW_AUDIOOUT_DATA = 0;
+ /* wait for everything to stabilize before unmuting */
+ timeout_register(&hp_unmute_oneshort, hp_unmute_cb, HZ / 2, 0);
}
void imx233_audioout_postinit(void)
{
- /* start converting audio */
- __REG_SET(HW_AUDIOOUT_CTRL) = HW_AUDIOOUT_CTRL__RUN;
}
void imx233_audioout_close(void)