Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
Dave Chapman | c3f9d00 | 2005-12-19 14:30:52 +0000 | [diff] [blame] | 10 | * Driver for WM8975 audio codec |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 11 | * |
Dave Chapman | c3f9d00 | 2005-12-19 14:30:52 +0000 | [diff] [blame] | 12 | * Based on code from the ipodlinux project - http://ipodlinux.org/ |
| 13 | * Adapted for Rockbox in December 2005 |
| 14 | * |
| 15 | * Original file: linux/arch/armnommu/mach-ipod/audio.c |
| 16 | * |
| 17 | * Copyright (c) 2003-2005 Bernard Leach (leachbj@bouncycastle.org) |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 18 | * |
| 19 | * All files in this archive are subject to the GNU General Public License. |
| 20 | * See the file COPYING in the source tree root for full license agreement. |
| 21 | * |
| 22 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 23 | * KIND, either express or implied. |
| 24 | * |
| 25 | ****************************************************************************/ |
| 26 | #include "lcd.h" |
| 27 | #include "cpu.h" |
| 28 | #include "kernel.h" |
| 29 | #include "thread.h" |
| 30 | #include "power.h" |
| 31 | #include "debug.h" |
| 32 | #include "system.h" |
| 33 | #include "sprintf.h" |
| 34 | #include "button.h" |
| 35 | #include "string.h" |
| 36 | #include "file.h" |
| 37 | #include "buffer.h" |
| 38 | #include "audio.h" |
| 39 | |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 40 | #include "wmcodec.h" |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 41 | #include "wm8975.h" |
Daniel Ankers | acbbe82 | 2006-12-09 19:18:18 +0000 | [diff] [blame] | 42 | #include "i2s.h" |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 43 | |
Marcoen Hirschberg | 1b967f4 | 2006-12-06 13:34:15 +0000 | [diff] [blame] | 44 | /* convert tenth of dB volume (-730..60) to master volume register value */ |
| 45 | int tenthdb2master(int db) |
| 46 | { |
| 47 | /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */ |
| 48 | /* 1111111 == +6dB (0x7f) */ |
| 49 | /* 1111001 == 0dB (0x79) */ |
| 50 | /* 0110000 == -73dB (0x30 */ |
| 51 | /* 0101111 == mute (0x2f) */ |
| 52 | |
| 53 | if (db < VOLUME_MIN) { |
| 54 | return 0x0; |
| 55 | } else { |
| 56 | return((db/10)+73+0x30); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | /* convert tenth of dB volume (-780..0) to mixer volume register value */ |
| 61 | int tenthdb2mixer(int db) |
| 62 | { |
| 63 | if (db < -660) /* 1.5 dB steps */ |
| 64 | return (2640 - db) / 15; |
| 65 | else if (db < -600) /* 0.75 dB steps */ |
| 66 | return (990 - db) * 2 / 15; |
| 67 | else if (db < -460) /* 0.5 dB steps */ |
| 68 | return (460 - db) / 5; |
| 69 | else /* 0.25 dB steps */ |
| 70 | return -db * 2 / 5; |
| 71 | } |
| 72 | |
| 73 | |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 74 | void audiohw_reset(void); |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 75 | |
| 76 | #define IPOD_PCM_LEVEL 0x65 /* -6dB */ |
| 77 | |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 78 | |
| 79 | /* Silently enable / disable audio output */ |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 80 | void audiohw_enable_output(bool enable) |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 81 | { |
| 82 | if (enable) |
| 83 | { |
| 84 | /* reset the I2S controller into known state */ |
| 85 | i2s_reset(); |
| 86 | |
| 87 | /* |
| 88 | * 1. Switch on power supplies. |
| 89 | * By default the WM8750L is in Standby Mode, the DAC is |
| 90 | * digitally muted and the Audio Interface, Line outputs |
| 91 | * and Headphone outputs are all OFF (DACMU = 1 Power |
| 92 | * Management registers 1 and 2 are all zeros). |
| 93 | */ |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 94 | wmcodec_write(RESET, 0x1ff); /*Reset*/ |
| 95 | wmcodec_write(RESET, 0x0); |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 96 | |
| 97 | /* 2. Enable Vmid and VREF. */ |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 98 | wmcodec_write(PWRMGMT1, 0xc0); /*Pwr Mgmt(1)*/ |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 99 | |
| 100 | /* 3. Enable DACs as required. */ |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 101 | wmcodec_write(PWRMGMT2, 0x180); /*Pwr Mgmt(2)*/ |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 102 | |
| 103 | /* 4. Enable line and / or headphone output buffers as required. */ |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 104 | wmcodec_write(PWRMGMT2, 0x1f8); /*Pwr Mgmt(2)*/ |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 105 | |
| 106 | /* BCLKINV=0(Dont invert BCLK) MS=1(Enable Master) LRSWAP=0 LRP=0 */ |
| 107 | /* IWL=00(16 bit) FORMAT=10(I2S format) */ |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 108 | wmcodec_write(AINTFCE, 0x42); |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 109 | |
| 110 | /* The iPod can handle multiple frequencies, but fix at 44.1KHz for now */ |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 111 | audiohw_set_sample_rate(WM8975_44100HZ); |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 112 | |
| 113 | /* set the volume to -6dB */ |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 114 | wmcodec_write(LOUT1VOL, IPOD_PCM_LEVEL); |
| 115 | wmcodec_write(ROUT1VOL,0x100 | IPOD_PCM_LEVEL); |
| 116 | wmcodec_write(LOUT1VOL, IPOD_PCM_LEVEL); |
| 117 | wmcodec_write(ROUT1VOL,0x100 | IPOD_PCM_LEVEL); |
Dave Chapman | 6ffd3cf | 2006-02-12 17:18:47 +0000 | [diff] [blame] | 118 | |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 119 | wmcodec_write(LOUTMIX1, 0x150); /* Left out Mix(def) */ |
| 120 | wmcodec_write(LOUTMIX2, 0x50); |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 121 | |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 122 | wmcodec_write(ROUTMIX1, 0x50); /* Right out Mix(def) */ |
| 123 | wmcodec_write(ROUTMIX2, 0x150); |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 124 | |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 125 | wmcodec_write(MOUTMIX1, 0x0); /* Mono out Mix */ |
| 126 | wmcodec_write(MOUTMIX2, 0x0); |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 127 | |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 128 | audiohw_mute(0); |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 129 | } else { |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 130 | audiohw_mute(1); |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 131 | } |
| 132 | } |
| 133 | |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 134 | int audiohw_set_master_vol(int vol_l, int vol_r) |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 135 | { |
| 136 | /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */ |
| 137 | /* 1111111 == +6dB */ |
| 138 | /* 1111001 == 0dB */ |
| 139 | /* 0110000 == -73dB */ |
| 140 | /* 0101111 == mute (0x2f) */ |
| 141 | |
| 142 | /* OUT1 */ |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 143 | wmcodec_write(LOUT1VOL, vol_l); |
| 144 | wmcodec_write(ROUT1VOL, 0x100 | vol_r); |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 145 | |
Thom Johansen | 473fc2b | 2006-03-22 13:04:49 +0000 | [diff] [blame] | 146 | return 0; |
| 147 | } |
| 148 | |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 149 | int audiohw_set_lineout_vol(int vol_l, int vol_r) |
Thom Johansen | 473fc2b | 2006-03-22 13:04:49 +0000 | [diff] [blame] | 150 | { |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 151 | /* OUT2 */ |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 152 | wmcodec_write(LOUT2VOL, vol_l); |
| 153 | wmcodec_write(ROUT2VOL, 0x100 | vol_r); |
Dave Chapman | 149f5bb | 2005-12-16 11:18:04 +0000 | [diff] [blame] | 154 | |
| 155 | return 0; |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 156 | } |
| 157 | |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 158 | int audiohw_set_mixer_vol(int channel1, int channel2) |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 159 | { |
Dave Chapman | 149f5bb | 2005-12-16 11:18:04 +0000 | [diff] [blame] | 160 | (void)channel1; |
| 161 | (void)channel2; |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 162 | |
Dave Chapman | 149f5bb | 2005-12-16 11:18:04 +0000 | [diff] [blame] | 163 | return 0; |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 164 | } |
| 165 | |
Dave Chapman | 5ffa8c5 | 2006-01-30 21:12:31 +0000 | [diff] [blame] | 166 | /* We are using Linear bass control */ |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 167 | void audiohw_set_bass(int value) |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 168 | { |
Dave Chapman | 5ffa8c5 | 2006-01-30 21:12:31 +0000 | [diff] [blame] | 169 | int regvalues[]={11, 10, 10, 9, 8, 8, 0xf , 6, 6, 5, 4, 4, 3, 2, 1, 0}; |
| 170 | |
| 171 | if ((value >= -6) && (value <= 9)) { |
| 172 | /* We use linear bass control with 130Hz cutoff */ |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 173 | wmcodec_write(BASSCTRL, regvalues[value+6]); |
Dave Chapman | 5ffa8c5 | 2006-01-30 21:12:31 +0000 | [diff] [blame] | 174 | } |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 175 | } |
| 176 | |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 177 | void audiohw_set_treble(int value) |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 178 | { |
Dave Chapman | 5ffa8c5 | 2006-01-30 21:12:31 +0000 | [diff] [blame] | 179 | int regvalues[]={11, 10, 10, 9, 8, 8, 0xf , 6, 6, 5, 4, 4, 3, 2, 1, 0}; |
| 180 | |
| 181 | if ((value >= -6) && (value <= 9)) { |
| 182 | /* We use a 8Khz cutoff */ |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 183 | wmcodec_write(TREBCTRL, regvalues[value+6]); |
Dave Chapman | 5ffa8c5 | 2006-01-30 21:12:31 +0000 | [diff] [blame] | 184 | } |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 185 | } |
| 186 | |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 187 | int audiohw_mute(int mute) |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 188 | { |
| 189 | if (mute) |
| 190 | { |
| 191 | /* Set DACMU = 1 to soft-mute the audio DACs. */ |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 192 | wmcodec_write(DACCTRL, 0x8); |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 193 | } else { |
| 194 | /* Set DACMU = 0 to soft-un-mute the audio DACs. */ |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 195 | wmcodec_write(DACCTRL, 0x0); |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 196 | } |
Dave Chapman | 149f5bb | 2005-12-16 11:18:04 +0000 | [diff] [blame] | 197 | |
| 198 | return 0; |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | /* Nice shutdown of WM8975 codec */ |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 202 | void audiohw_close(void) |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 203 | { |
| 204 | /* 1. Set DACMU = 1 to soft-mute the audio DACs. */ |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 205 | wmcodec_write(DACCTRL, 0x8); |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 206 | |
| 207 | /* 2. Disable all output buffers. */ |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 208 | wmcodec_write(PWRMGMT2, 0x0); /*Pwr Mgmt(2)*/ |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 209 | |
| 210 | /* 3. Switch off the power supplies. */ |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 211 | wmcodec_write(PWRMGMT1, 0x0); /*Pwr Mgmt(1)*/ |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | /* Change the order of the noise shaper, 5th order is recommended above 32kHz */ |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 215 | void audiohw_set_nsorder(int order) |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 216 | { |
Dave Chapman | 149f5bb | 2005-12-16 11:18:04 +0000 | [diff] [blame] | 217 | (void)order; |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | /* Note: Disable output before calling this function */ |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 221 | void audiohw_set_sample_rate(int sampling_control) { |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 222 | |
Marcoen Hirschberg | 1d7ebdf | 2006-10-20 17:12:42 +0000 | [diff] [blame] | 223 | wmcodec_write(0x08, sampling_control); |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 224 | |
| 225 | } |
| 226 | |
Barry Wardell | df0dc22 | 2006-12-18 01:52:21 +0000 | [diff] [blame] | 227 | void audiohw_enable_recording(bool source_mic) |
| 228 | { |
| 229 | (void)source_mic; |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 230 | |
Barry Wardell | df0dc22 | 2006-12-18 01:52:21 +0000 | [diff] [blame] | 231 | /* reset the I2S controller into known state */ |
| 232 | i2s_reset(); |
| 233 | |
| 234 | /* |
| 235 | * 1. Switch on power supplies. |
| 236 | * By default the WM8750L is in Standby Mode, the DAC is |
| 237 | * digitally muted and the Audio Interface, Line outputs |
| 238 | * and Headphone outputs are all OFF (DACMU = 1 Power |
| 239 | * Management registers 1 and 2 are all zeros). |
| 240 | */ |
| 241 | wmcodec_write(0x0f, 0x1ff); |
| 242 | wmcodec_write(0x0f, 0x000); |
| 243 | |
| 244 | /* 2. Enable Vmid and VREF. */ |
| 245 | wmcodec_write(0x19, 0xc0); /*Pwr Mgmt(1)*/ |
| 246 | |
| 247 | /* 3. Enable ADCs as required. */ |
| 248 | wmcodec_write(0x19, 0xcc); /*Pwr Mgmt(1)*/ |
| 249 | wmcodec_write(0x1a, 0x180); /*Pwr Mgmt(2)*/ |
| 250 | |
| 251 | /* 4. Enable line and / or headphone output buffers as required. */ |
| 252 | wmcodec_write(0x19, 0xfc); /*Pwr Mgmt(1)*/ |
| 253 | |
| 254 | /* BCLKINV=0(Dont invert BCLK) MS=1(Enable Master) LRSWAP=0 LRP=0 */ |
| 255 | /* IWL=00(16 bit) FORMAT=10(I2S format) */ |
| 256 | wmcodec_write(0x07, 0x42); |
| 257 | |
| 258 | /* The iPod can handle multiple frequencies, but fix at 44.1KHz for now */ |
Barry Wardell | ca7a264 | 2006-12-18 02:18:56 +0000 | [diff] [blame^] | 259 | audiohw_set_sample_rate(WM8975_44100HZ); |
Barry Wardell | df0dc22 | 2006-12-18 01:52:21 +0000 | [diff] [blame] | 260 | |
| 261 | /* unmute inputs */ |
| 262 | wmcodec_write(0x00, 0x17); /* LINVOL (def 0dB) */ |
| 263 | wmcodec_write(0x01, 0x117); /* RINVOL (def 0dB) */ |
| 264 | |
| 265 | wmcodec_write(0x15, 0x1d7); /* LADCVOL max vol x was ff */ |
| 266 | wmcodec_write(0x16, 0x1d7); /* RADCVOL max vol x was ff */ |
| 267 | |
| 268 | if (source_mic) { |
| 269 | /* VSEL=10(def) DATSEL=10 (use right ADC only) */ |
| 270 | wmcodec_write(0x17, 0xc8); /* Additional control(1) */ |
| 271 | |
| 272 | /* VROI=1 (sets output resistance to 40kohms) */ |
| 273 | wmcodec_write(0x1b, 0x40); /* Additional control(3) */ |
| 274 | |
| 275 | /* LINSEL=1 (LINPUT2) LMICBOOST=10 (20dB boost) */ |
| 276 | wmcodec_write(0x20, 0x60); /* ADCL signal path */ |
| 277 | wmcodec_write(0x21, 0x60); /* ADCR signal path */ |
| 278 | } else { |
| 279 | /* VSEL=10(def) DATSEL=00 (left->left, right->right) */ |
| 280 | wmcodec_write(0x17, 0xc0); /* Additional control(1) */ |
| 281 | |
| 282 | /* VROI=1 (sets output resistance to 40kohms) */ |
| 283 | wmcodec_write(0x1b, 0x40); /* Additional control(3) */ |
| 284 | |
| 285 | /* LINSEL=0 (LINPUT1) LMICBOOST=00 (bypass boost) */ |
| 286 | wmcodec_write(0x20, 0x00); /* ADCL signal path */ |
| 287 | /* RINSEL=0 (RINPUT1) RMICBOOST=00 (bypass boost) */ |
| 288 | wmcodec_write(0x21, 0x00); /* ADCR signal path */ |
| 289 | } |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 290 | } |
Barry Wardell | df0dc22 | 2006-12-18 01:52:21 +0000 | [diff] [blame] | 291 | |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 292 | void audiohw_disable_recording(void) { |
Barry Wardell | df0dc22 | 2006-12-18 01:52:21 +0000 | [diff] [blame] | 293 | /* 1. Set DACMU = 1 to soft-mute the audio DACs. */ |
| 294 | wmcodec_write(0x05, 0x8); |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 295 | |
Barry Wardell | df0dc22 | 2006-12-18 01:52:21 +0000 | [diff] [blame] | 296 | /* 2. Disable all output buffers. */ |
| 297 | wmcodec_write(0x1a, 0x0); /*Pwr Mgmt(2)*/ |
| 298 | |
| 299 | /* 3. Switch off the power supplies. */ |
| 300 | wmcodec_write(0x19, 0x0); /*Pwr Mgmt(1)*/ |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 301 | } |
| 302 | |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 303 | void audiohw_set_recvol(int left, int right, int type) { |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 304 | |
Dave Chapman | 149f5bb | 2005-12-16 11:18:04 +0000 | [diff] [blame] | 305 | (void)left; |
| 306 | (void)right; |
| 307 | (void)type; |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 308 | } |
| 309 | |
Marcoen Hirschberg | 77d039b | 2006-12-06 10:24:59 +0000 | [diff] [blame] | 310 | void audiohw_set_monitor(int enable) { |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 311 | |
Dave Chapman | 149f5bb | 2005-12-16 11:18:04 +0000 | [diff] [blame] | 312 | (void)enable; |
Dave Chapman | a472ed5 | 2005-12-16 11:00:44 +0000 | [diff] [blame] | 313 | } |