diff options
author | Michael Sparmann <theseven@rockbox.org> | 2010-11-13 11:38:38 +0000 |
---|---|---|
committer | Michael Sparmann <theseven@rockbox.org> | 2010-11-13 11:38:38 +0000 |
commit | e872e9b91304262717218f93fd31f417d557588b (patch) | |
tree | f1ce1da0471a31c1f1f946cbc14701f3b23f2739 | |
parent | 2089a7dd7ba6a59f9b35adf2402689fc88b21d23 (diff) | |
download | rockbox-e872e9b91304262717218f93fd31f417d557588b.tar.gz rockbox-e872e9b91304262717218f93fd31f417d557588b.zip |
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
-rw-r--r-- | firmware/drivers/audio/wm8975.c | 41 |
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[] = | |||
53 | [LINVOL] = LINVOL_LZCEN | 23, /* 0dB */ | 53 | [LINVOL] = LINVOL_LZCEN | 23, /* 0dB */ |
54 | [RINVOL] = RINVOL_RIVU | RINVOL_RZCEN | 23, /* 0dB */ | 54 | [RINVOL] = RINVOL_RIVU | RINVOL_RZCEN | 23, /* 0dB */ |
55 | [DAPCTRL] = DAPCTRL_DACMU, | 55 | [DAPCTRL] = DAPCTRL_DACMU, |
56 | /* This reduces the popping noise during codec powerup | ||
57 | noticably, especially with high-impedance loads. | ||
58 | We might want to change this for all targets, | ||
59 | but it has only been tested on iPod Nano 2G so far. */ | ||
60 | #ifdef IPOD_NANO2G | ||
61 | [PWRMGMT1] = PWRMGMT1_VMIDSEL_500K | PWRMGMT1_VREF, | ||
62 | #else | ||
56 | [PWRMGMT1] = PWRMGMT1_VMIDSEL_5K | PWRMGMT1_VREF, | 63 | [PWRMGMT1] = PWRMGMT1_VMIDSEL_5K | PWRMGMT1_VREF, |
64 | #endif | ||
57 | [PWRMGMT2] = PWRMGMT2_DACL | PWRMGMT2_DACR | PWRMGMT2_LOUT1 | 65 | [PWRMGMT2] = PWRMGMT2_DACL | PWRMGMT2_DACR | PWRMGMT2_LOUT1 |
58 | | PWRMGMT2_ROUT1 | PWRMGMT2_LOUT2 | PWRMGMT2_ROUT2, | 66 | | PWRMGMT2_ROUT1 | PWRMGMT2_LOUT2 | PWRMGMT2_ROUT2, |
59 | }; | 67 | }; |
@@ -126,6 +134,37 @@ static void audiohw_mute(bool mute) | |||
126 | 134 | ||
127 | #define IPOD_PCM_LEVEL 0x65 /* -6dB */ | 135 | #define IPOD_PCM_LEVEL 0x65 /* -6dB */ |
128 | 136 | ||
137 | /* This reduces the popping noise during codec powerup | ||
138 | noticably, especially with high-impedance loads. | ||
139 | We might want to change this for all targets, | ||
140 | but it has only been tested on iPod Nano 2G so far. */ | ||
141 | #ifdef IPOD_NANO2G | ||
142 | void audiohw_preinit(void) | ||
143 | { | ||
144 | wmcodec_write(RESET, RESET_RESET); | ||
145 | |||
146 | wmcodec_write(AINTFCE, AINTFCE_MS | AINTFCE_LRP_I2S_RLO | ||
147 | | AINTFCE_IWL_16BIT | AINTFCE_FORMAT_I2S); | ||
148 | |||
149 | #ifndef IPOD_NANO2G | ||
150 | wmcodec_write(SAMPCTRL, WM8975_44100HZ); | ||
151 | #endif | ||
152 | |||
153 | wmcodec_write(LOUTMIX1, LOUTMIX1_LD2LO | LOUTMIX1_LI2LOVOL(5)); | ||
154 | wmcodec_write(ROUTMIX2, ROUTMIX2_RD2RO | ROUTMIX2_RI2ROVOL(5)); | ||
155 | |||
156 | wm8975_write(PWRMGMT1, wm8975_regs[PWRMGMT1]); | ||
157 | wm8975_write(PWRMGMT2, wm8975_regs[PWRMGMT2]); | ||
158 | } | ||
159 | |||
160 | void audiohw_postinit(void) | ||
161 | { | ||
162 | wm8975_regs[PWRMGMT1] &= ~PWRMGMT1_VMIDSEL_MASK; | ||
163 | wm8975_regs[PWRMGMT1] |= PWRMGMT1_VMIDSEL_50K; | ||
164 | wm8975_write(PWRMGMT1, wm8975_regs[PWRMGMT1]); | ||
165 | audiohw_mute(false); | ||
166 | } | ||
167 | #else | ||
129 | void audiohw_preinit(void) | 168 | void audiohw_preinit(void) |
130 | { | 169 | { |
131 | /* POWER UP SEQUENCE */ | 170 | /* POWER UP SEQUENCE */ |
@@ -170,7 +209,7 @@ void audiohw_postinit(void) | |||
170 | { | 209 | { |
171 | audiohw_mute(false); | 210 | audiohw_mute(false); |
172 | } | 211 | } |
173 | 212 | #endif | |
174 | 213 | ||
175 | void audiohw_set_master_vol(int vol_l, int vol_r) | 214 | void audiohw_set_master_vol(int vol_l, int vol_r) |
176 | { | 215 | { |