summaryrefslogtreecommitdiff
path: root/firmware/drivers/wm8758.c
diff options
context:
space:
mode:
authorBrandon Low <lostlogic@rockbox.org>2006-03-05 22:14:53 +0000
committerBrandon Low <lostlogic@rockbox.org>2006-03-05 22:14:53 +0000
commitbb2f15ca7d6eeedbf5634c93609da9dc61824d3c (patch)
treea654da63f0d308f5aa601d999ff8618ad72b91cd /firmware/drivers/wm8758.c
parent03b8708f9e7d79189326795785d87f57367fc78c (diff)
downloadrockbox-bb2f15ca7d6eeedbf5634c93609da9dc61824d3c.tar.gz
rockbox-bb2f15ca7d6eeedbf5634c93609da9dc61824d3c.zip
Finer grained irq masking, blocking for i2c, plus a mutex to prevent conflicting read/writes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8922 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/wm8758.c')
-rw-r--r--firmware/drivers/wm8758.c21
1 files changed, 0 insertions, 21 deletions
diff --git a/firmware/drivers/wm8758.c b/firmware/drivers/wm8758.c
index 7c9ac77395..3867748417 100644
--- a/firmware/drivers/wm8758.c
+++ b/firmware/drivers/wm8758.c
@@ -86,8 +86,6 @@ void wm8758_write(int reg, int data)
86 * Note, I'm using the WM8750 datasheet as its apparently close. 86 * Note, I'm using the WM8750 datasheet as its apparently close.
87 */ 87 */
88int wmcodec_init(void) { 88int wmcodec_init(void) {
89 int old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL);
90
91 /* normal outputs for CDI and I2S pin groups */ 89 /* normal outputs for CDI and I2S pin groups */
92 outl(inl(0x70000020) & ~0x300, 0x70000020); 90 outl(inl(0x70000020) & ~0x300, 0x70000020);
93 91
@@ -108,7 +106,6 @@ int wmcodec_init(void) {
108 /* external dev clock to 24MHz */ 106 /* external dev clock to 24MHz */
109 outl(inl(0x70000018) & ~0xc, 0x70000018); 107 outl(inl(0x70000018) & ~0xc, 0x70000018);
110 108
111 set_irq_level(old_irq_level);
112 return 0; 109 return 0;
113} 110}
114 111
@@ -117,8 +114,6 @@ void wmcodec_enable_output(bool enable)
117{ 114{
118 if (enable) 115 if (enable)
119 { 116 {
120 int old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL);
121
122 /* reset the I2S controller into known state */ 117 /* reset the I2S controller into known state */
123 i2s_reset(); 118 i2s_reset();
124 119
@@ -142,7 +137,6 @@ void wmcodec_enable_output(bool enable)
142 wm8758_write(LOUTMIX,0x1); /* Enable mixer */ 137 wm8758_write(LOUTMIX,0x1); /* Enable mixer */
143 wm8758_write(ROUTMIX,0x1); /* Enable mixer */ 138 wm8758_write(ROUTMIX,0x1); /* Enable mixer */
144 wmcodec_mute(0); 139 wmcodec_mute(0);
145 set_irq_level(old_irq_level);
146 } else { 140 } else {
147 wmcodec_mute(1); 141 wmcodec_mute(1);
148 } 142 }
@@ -150,7 +144,6 @@ void wmcodec_enable_output(bool enable)
150 144
151int wmcodec_set_master_vol(int vol_l, int vol_r) 145int wmcodec_set_master_vol(int vol_l, int vol_r)
152{ 146{
153 int old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL);
154 /* OUT1 */ 147 /* OUT1 */
155 wm8758_write(LOUT1VOL, vol_l); 148 wm8758_write(LOUT1VOL, vol_l);
156 wm8758_write(ROUT1VOL, 0x100 | vol_r); 149 wm8758_write(ROUT1VOL, 0x100 | vol_r);
@@ -159,8 +152,6 @@ int wmcodec_set_master_vol(int vol_l, int vol_r)
159 wm8758_write(LOUT2VOL, vol_l); 152 wm8758_write(LOUT2VOL, vol_l);
160 wm8758_write(ROUT2VOL, 0x100 | vol_r); 153 wm8758_write(ROUT2VOL, 0x100 | vol_r);
161 154
162 set_irq_level(old_irq_level);
163
164 return 0; 155 return 0;
165} 156}
166 157
@@ -204,8 +195,6 @@ void wmcodec_set_treble(int value)
204 195
205int wmcodec_mute(int mute) 196int wmcodec_mute(int mute)
206{ 197{
207 int old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL);
208
209 if (mute) 198 if (mute)
210 { 199 {
211 /* Set DACMU = 1 to soft-mute the audio DACs. */ 200 /* Set DACMU = 1 to soft-mute the audio DACs. */
@@ -215,16 +204,12 @@ int wmcodec_mute(int mute)
215 wm8758_write(DACCTRL, 0x0); 204 wm8758_write(DACCTRL, 0x0);
216 } 205 }
217 206
218 set_irq_level(old_irq_level);
219
220 return 0; 207 return 0;
221} 208}
222 209
223/* Nice shutdown of WM8758 codec */ 210/* Nice shutdown of WM8758 codec */
224void wmcodec_close(void) 211void wmcodec_close(void)
225{ 212{
226 int old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL);
227
228 wmcodec_mute(1); 213 wmcodec_mute(1);
229 214
230 wm8758_write(PWRMGMT3, 0x0); 215 wm8758_write(PWRMGMT3, 0x0);
@@ -232,8 +217,6 @@ void wmcodec_close(void)
232 wm8758_write(PWRMGMT1, 0x0); 217 wm8758_write(PWRMGMT1, 0x0);
233 218
234 wm8758_write(PWRMGMT2, 0x40); 219 wm8758_write(PWRMGMT2, 0x40);
235
236 set_irq_level(old_irq_level);
237} 220}
238 221
239/* Change the order of the noise shaper, 5th order is recommended above 32kHz */ 222/* Change the order of the noise shaper, 5th order is recommended above 32kHz */
@@ -245,8 +228,6 @@ void wmcodec_set_nsorder(int order)
245/* Note: Disable output before calling this function */ 228/* Note: Disable output before calling this function */
246void wmcodec_set_sample_rate(int sampling_control) 229void wmcodec_set_sample_rate(int sampling_control)
247{ 230{
248 int old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL);
249
250 /**** We force 44.1KHz for now. ****/ 231 /**** We force 44.1KHz for now. ****/
251 (void)sampling_control; 232 (void)sampling_control;
252 233
@@ -264,8 +245,6 @@ void wmcodec_set_sample_rate(int sampling_control)
264 245
265 /* set srate */ 246 /* set srate */
266 wm8758_write(SRATECTRL, (0 << 1)); 247 wm8758_write(SRATECTRL, (0 << 1));
267
268 set_irq_level(old_irq_level);
269} 248}
270 249
271void wmcodec_enable_recording(bool source_mic) 250void wmcodec_enable_recording(bool source_mic)