summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
authorMichael Sparmann <theseven@rockbox.org>2010-11-13 11:38:38 +0000
committerMichael Sparmann <theseven@rockbox.org>2010-11-13 11:38:38 +0000
commite872e9b91304262717218f93fd31f417d557588b (patch)
treef1ce1da0471a31c1f1f946cbc14701f3b23f2739 /firmware/drivers
parent2089a7dd7ba6a59f9b35adf2402689fc88b21d23 (diff)
iPod Nano 2G: Reduce popping noise during codec powerup, especially when driving high-impedance loads
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28572 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/audio/wm8975.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/firmware/drivers/audio/wm8975.c b/firmware/drivers/audio/wm8975.c
index 1def644f33..77d567d6da 100644
--- a/firmware/drivers/audio/wm8975.c
+++ b/firmware/drivers/audio/wm8975.c
@@ -53,7 +53,15 @@ static unsigned short wm8975_regs[] =
[LINVOL] = LINVOL_LZCEN | 23, /* 0dB */
[RINVOL] = RINVOL_RIVU | RINVOL_RZCEN | 23, /* 0dB */
[DAPCTRL] = DAPCTRL_DACMU,
+/* This reduces the popping noise during codec powerup
+ noticably, especially with high-impedance loads.
+ We might want to change this for all targets,
+ but it has only been tested on iPod Nano 2G so far. */
+#ifdef IPOD_NANO2G
+ [PWRMGMT1] = PWRMGMT1_VMIDSEL_500K | PWRMGMT1_VREF,
+#else
[PWRMGMT1] = PWRMGMT1_VMIDSEL_5K | PWRMGMT1_VREF,
+#endif
[PWRMGMT2] = PWRMGMT2_DACL | PWRMGMT2_DACR | PWRMGMT2_LOUT1
| PWRMGMT2_ROUT1 | PWRMGMT2_LOUT2 | PWRMGMT2_ROUT2,
};
@@ -126,6 +134,37 @@ static void audiohw_mute(bool mute)
#define IPOD_PCM_LEVEL 0x65 /* -6dB */
+/* This reduces the popping noise during codec powerup
+ noticably, especially with high-impedance loads.
+ We might want to change this for all targets,
+ but it has only been tested on iPod Nano 2G so far. */
+#ifdef IPOD_NANO2G
+void audiohw_preinit(void)
+{
+ wmcodec_write(RESET, RESET_RESET);
+
+ wmcodec_write(AINTFCE, AINTFCE_MS | AINTFCE_LRP_I2S_RLO
+ | AINTFCE_IWL_16BIT | AINTFCE_FORMAT_I2S);
+
+#ifndef IPOD_NANO2G
+ wmcodec_write(SAMPCTRL, WM8975_44100HZ);
+#endif
+
+ wmcodec_write(LOUTMIX1, LOUTMIX1_LD2LO | LOUTMIX1_LI2LOVOL(5));
+ wmcodec_write(ROUTMIX2, ROUTMIX2_RD2RO | ROUTMIX2_RI2ROVOL(5));
+
+ wm8975_write(PWRMGMT1, wm8975_regs[PWRMGMT1]);
+ wm8975_write(PWRMGMT2, wm8975_regs[PWRMGMT2]);
+}
+
+void audiohw_postinit(void)
+{
+ wm8975_regs[PWRMGMT1] &= ~PWRMGMT1_VMIDSEL_MASK;
+ wm8975_regs[PWRMGMT1] |= PWRMGMT1_VMIDSEL_50K;
+ wm8975_write(PWRMGMT1, wm8975_regs[PWRMGMT1]);
+ audiohw_mute(false);
+}
+#else
void audiohw_preinit(void)
{
/* POWER UP SEQUENCE */
@@ -170,7 +209,7 @@ void audiohw_postinit(void)
{
audiohw_mute(false);
}
-
+#endif
void audiohw_set_master_vol(int vol_l, int vol_r)
{