diff options
Diffstat (limited to 'sound/ppc/burgundy.c')
-rw-r--r-- | sound/ppc/burgundy.c | 75 |
1 files changed, 44 insertions, 31 deletions
diff --git a/sound/ppc/burgundy.c b/sound/ppc/burgundy.c index edbc0484e22a..e02263fe44dc 100644 --- a/sound/ppc/burgundy.c +++ b/sound/ppc/burgundy.c | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | /* Waits for busy flag to clear */ | 32 | /* Waits for busy flag to clear */ |
33 | static inline void | 33 | static inline void |
34 | snd_pmac_burgundy_busy_wait(pmac_t *chip) | 34 | snd_pmac_burgundy_busy_wait(struct snd_pmac *chip) |
35 | { | 35 | { |
36 | int timeout = 50; | 36 | int timeout = 50; |
37 | while ((in_le32(&chip->awacs->codec_ctrl) & MASK_NEWECMD) && timeout--) | 37 | while ((in_le32(&chip->awacs->codec_ctrl) & MASK_NEWECMD) && timeout--) |
@@ -41,7 +41,7 @@ snd_pmac_burgundy_busy_wait(pmac_t *chip) | |||
41 | } | 41 | } |
42 | 42 | ||
43 | static inline void | 43 | static inline void |
44 | snd_pmac_burgundy_extend_wait(pmac_t *chip) | 44 | snd_pmac_burgundy_extend_wait(struct snd_pmac *chip) |
45 | { | 45 | { |
46 | int timeout; | 46 | int timeout; |
47 | timeout = 50; | 47 | timeout = 50; |
@@ -57,7 +57,7 @@ snd_pmac_burgundy_extend_wait(pmac_t *chip) | |||
57 | } | 57 | } |
58 | 58 | ||
59 | static void | 59 | static void |
60 | snd_pmac_burgundy_wcw(pmac_t *chip, unsigned addr, unsigned val) | 60 | snd_pmac_burgundy_wcw(struct snd_pmac *chip, unsigned addr, unsigned val) |
61 | { | 61 | { |
62 | out_le32(&chip->awacs->codec_ctrl, addr + 0x200c00 + (val & 0xff)); | 62 | out_le32(&chip->awacs->codec_ctrl, addr + 0x200c00 + (val & 0xff)); |
63 | snd_pmac_burgundy_busy_wait(chip); | 63 | snd_pmac_burgundy_busy_wait(chip); |
@@ -70,7 +70,7 @@ snd_pmac_burgundy_wcw(pmac_t *chip, unsigned addr, unsigned val) | |||
70 | } | 70 | } |
71 | 71 | ||
72 | static unsigned | 72 | static unsigned |
73 | snd_pmac_burgundy_rcw(pmac_t *chip, unsigned addr) | 73 | snd_pmac_burgundy_rcw(struct snd_pmac *chip, unsigned addr) |
74 | { | 74 | { |
75 | unsigned val = 0; | 75 | unsigned val = 0; |
76 | unsigned long flags; | 76 | unsigned long flags; |
@@ -103,14 +103,14 @@ snd_pmac_burgundy_rcw(pmac_t *chip, unsigned addr) | |||
103 | } | 103 | } |
104 | 104 | ||
105 | static void | 105 | static void |
106 | snd_pmac_burgundy_wcb(pmac_t *chip, unsigned int addr, unsigned int val) | 106 | snd_pmac_burgundy_wcb(struct snd_pmac *chip, unsigned int addr, unsigned int val) |
107 | { | 107 | { |
108 | out_le32(&chip->awacs->codec_ctrl, addr + 0x300000 + (val & 0xff)); | 108 | out_le32(&chip->awacs->codec_ctrl, addr + 0x300000 + (val & 0xff)); |
109 | snd_pmac_burgundy_busy_wait(chip); | 109 | snd_pmac_burgundy_busy_wait(chip); |
110 | } | 110 | } |
111 | 111 | ||
112 | static unsigned | 112 | static unsigned |
113 | snd_pmac_burgundy_rcb(pmac_t *chip, unsigned int addr) | 113 | snd_pmac_burgundy_rcb(struct snd_pmac *chip, unsigned int addr) |
114 | { | 114 | { |
115 | unsigned val = 0; | 115 | unsigned val = 0; |
116 | unsigned long flags; | 116 | unsigned long flags; |
@@ -131,7 +131,8 @@ snd_pmac_burgundy_rcb(pmac_t *chip, unsigned int addr) | |||
131 | * Burgundy volume: 0 - 100, stereo | 131 | * Burgundy volume: 0 - 100, stereo |
132 | */ | 132 | */ |
133 | static void | 133 | static void |
134 | snd_pmac_burgundy_write_volume(pmac_t *chip, unsigned int address, long *volume, int shift) | 134 | snd_pmac_burgundy_write_volume(struct snd_pmac *chip, unsigned int address, |
135 | long *volume, int shift) | ||
135 | { | 136 | { |
136 | int hardvolume, lvolume, rvolume; | 137 | int hardvolume, lvolume, rvolume; |
137 | 138 | ||
@@ -146,7 +147,8 @@ snd_pmac_burgundy_write_volume(pmac_t *chip, unsigned int address, long *volume, | |||
146 | } | 147 | } |
147 | 148 | ||
148 | static void | 149 | static void |
149 | snd_pmac_burgundy_read_volume(pmac_t *chip, unsigned int address, long *volume, int shift) | 150 | snd_pmac_burgundy_read_volume(struct snd_pmac *chip, unsigned int address, |
151 | long *volume, int shift) | ||
150 | { | 152 | { |
151 | int wvolume; | 153 | int wvolume; |
152 | 154 | ||
@@ -171,7 +173,8 @@ snd_pmac_burgundy_read_volume(pmac_t *chip, unsigned int address, long *volume, | |||
171 | #define BASE2ADDR(base) ((base) << 12) | 173 | #define BASE2ADDR(base) ((base) << 12) |
172 | #define ADDR2BASE(addr) ((addr) >> 12) | 174 | #define ADDR2BASE(addr) ((addr) >> 12) |
173 | 175 | ||
174 | static int snd_pmac_burgundy_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 176 | static int snd_pmac_burgundy_info_volume(struct snd_kcontrol *kcontrol, |
177 | struct snd_ctl_elem_info *uinfo) | ||
175 | { | 178 | { |
176 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 179 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
177 | uinfo->count = 2; | 180 | uinfo->count = 2; |
@@ -180,23 +183,27 @@ static int snd_pmac_burgundy_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_ | |||
180 | return 0; | 183 | return 0; |
181 | } | 184 | } |
182 | 185 | ||
183 | static int snd_pmac_burgundy_get_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 186 | static int snd_pmac_burgundy_get_volume(struct snd_kcontrol *kcontrol, |
187 | struct snd_ctl_elem_value *ucontrol) | ||
184 | { | 188 | { |
185 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 189 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
186 | unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); | 190 | unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); |
187 | int shift = (kcontrol->private_value >> 8) & 0xff; | 191 | int shift = (kcontrol->private_value >> 8) & 0xff; |
188 | snd_pmac_burgundy_read_volume(chip, addr, ucontrol->value.integer.value, shift); | 192 | snd_pmac_burgundy_read_volume(chip, addr, ucontrol->value.integer.value, |
193 | shift); | ||
189 | return 0; | 194 | return 0; |
190 | } | 195 | } |
191 | 196 | ||
192 | static int snd_pmac_burgundy_put_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 197 | static int snd_pmac_burgundy_put_volume(struct snd_kcontrol *kcontrol, |
198 | struct snd_ctl_elem_value *ucontrol) | ||
193 | { | 199 | { |
194 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 200 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
195 | unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); | 201 | unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); |
196 | int shift = (kcontrol->private_value >> 8) & 0xff; | 202 | int shift = (kcontrol->private_value >> 8) & 0xff; |
197 | long nvoices[2]; | 203 | long nvoices[2]; |
198 | 204 | ||
199 | snd_pmac_burgundy_write_volume(chip, addr, ucontrol->value.integer.value, shift); | 205 | snd_pmac_burgundy_write_volume(chip, addr, ucontrol->value.integer.value, |
206 | shift); | ||
200 | snd_pmac_burgundy_read_volume(chip, addr, nvoices, shift); | 207 | snd_pmac_burgundy_read_volume(chip, addr, nvoices, shift); |
201 | return (nvoices[0] != ucontrol->value.integer.value[0] || | 208 | return (nvoices[0] != ucontrol->value.integer.value[0] || |
202 | nvoices[1] != ucontrol->value.integer.value[1]); | 209 | nvoices[1] != ucontrol->value.integer.value[1]); |
@@ -211,7 +218,8 @@ static int snd_pmac_burgundy_put_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_v | |||
211 | 218 | ||
212 | /* lineout/speaker */ | 219 | /* lineout/speaker */ |
213 | 220 | ||
214 | static int snd_pmac_burgundy_info_switch_out(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 221 | static int snd_pmac_burgundy_info_switch_out(struct snd_kcontrol *kcontrol, |
222 | struct snd_ctl_elem_info *uinfo) | ||
215 | { | 223 | { |
216 | int stereo = (kcontrol->private_value >> 24) & 1; | 224 | int stereo = (kcontrol->private_value >> 24) & 1; |
217 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | 225 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
@@ -221,9 +229,10 @@ static int snd_pmac_burgundy_info_switch_out(snd_kcontrol_t *kcontrol, snd_ctl_e | |||
221 | return 0; | 229 | return 0; |
222 | } | 230 | } |
223 | 231 | ||
224 | static int snd_pmac_burgundy_get_switch_out(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 232 | static int snd_pmac_burgundy_get_switch_out(struct snd_kcontrol *kcontrol, |
233 | struct snd_ctl_elem_value *ucontrol) | ||
225 | { | 234 | { |
226 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 235 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
227 | int lmask = kcontrol->private_value & 0xff; | 236 | int lmask = kcontrol->private_value & 0xff; |
228 | int rmask = (kcontrol->private_value >> 8) & 0xff; | 237 | int rmask = (kcontrol->private_value >> 8) & 0xff; |
229 | int stereo = (kcontrol->private_value >> 24) & 1; | 238 | int stereo = (kcontrol->private_value >> 24) & 1; |
@@ -234,9 +243,10 @@ static int snd_pmac_burgundy_get_switch_out(snd_kcontrol_t *kcontrol, snd_ctl_el | |||
234 | return 0; | 243 | return 0; |
235 | } | 244 | } |
236 | 245 | ||
237 | static int snd_pmac_burgundy_put_switch_out(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 246 | static int snd_pmac_burgundy_put_switch_out(struct snd_kcontrol *kcontrol, |
247 | struct snd_ctl_elem_value *ucontrol) | ||
238 | { | 248 | { |
239 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 249 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
240 | int lmask = kcontrol->private_value & 0xff; | 250 | int lmask = kcontrol->private_value & 0xff; |
241 | int rmask = (kcontrol->private_value >> 8) & 0xff; | 251 | int rmask = (kcontrol->private_value >> 8) & 0xff; |
242 | int stereo = (kcontrol->private_value >> 24) & 1; | 252 | int stereo = (kcontrol->private_value >> 24) & 1; |
@@ -259,7 +269,8 @@ static int snd_pmac_burgundy_put_switch_out(snd_kcontrol_t *kcontrol, snd_ctl_el | |||
259 | .private_value = ((lmask) | ((rmask) << 8) | ((stereo) << 24)) } | 269 | .private_value = ((lmask) | ((rmask) << 8) | ((stereo) << 24)) } |
260 | 270 | ||
261 | /* line/speaker output volume */ | 271 | /* line/speaker output volume */ |
262 | static int snd_pmac_burgundy_info_volume_out(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 272 | static int snd_pmac_burgundy_info_volume_out(struct snd_kcontrol *kcontrol, |
273 | struct snd_ctl_elem_info *uinfo) | ||
263 | { | 274 | { |
264 | int stereo = (kcontrol->private_value >> 24) & 1; | 275 | int stereo = (kcontrol->private_value >> 24) & 1; |
265 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 276 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
@@ -269,9 +280,10 @@ static int snd_pmac_burgundy_info_volume_out(snd_kcontrol_t *kcontrol, snd_ctl_e | |||
269 | return 0; | 280 | return 0; |
270 | } | 281 | } |
271 | 282 | ||
272 | static int snd_pmac_burgundy_get_volume_out(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 283 | static int snd_pmac_burgundy_get_volume_out(struct snd_kcontrol *kcontrol, |
284 | struct snd_ctl_elem_value *ucontrol) | ||
273 | { | 285 | { |
274 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 286 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
275 | unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); | 287 | unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); |
276 | int stereo = (kcontrol->private_value >> 24) & 1; | 288 | int stereo = (kcontrol->private_value >> 24) & 1; |
277 | int oval; | 289 | int oval; |
@@ -283,9 +295,10 @@ static int snd_pmac_burgundy_get_volume_out(snd_kcontrol_t *kcontrol, snd_ctl_el | |||
283 | return 0; | 295 | return 0; |
284 | } | 296 | } |
285 | 297 | ||
286 | static int snd_pmac_burgundy_put_volume_out(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 298 | static int snd_pmac_burgundy_put_volume_out(struct snd_kcontrol *kcontrol, |
299 | struct snd_ctl_elem_value *ucontrol) | ||
287 | { | 300 | { |
288 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 301 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
289 | unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); | 302 | unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); |
290 | int stereo = (kcontrol->private_value >> 24) & 1; | 303 | int stereo = (kcontrol->private_value >> 24) & 1; |
291 | int oval, val; | 304 | int oval, val; |
@@ -308,7 +321,7 @@ static int snd_pmac_burgundy_put_volume_out(snd_kcontrol_t *kcontrol, snd_ctl_el | |||
308 | .put = snd_pmac_burgundy_put_volume_out,\ | 321 | .put = snd_pmac_burgundy_put_volume_out,\ |
309 | .private_value = (ADDR2BASE(addr) | ((stereo) << 24)) } | 322 | .private_value = (ADDR2BASE(addr) | ((stereo) << 24)) } |
310 | 323 | ||
311 | static snd_kcontrol_new_t snd_pmac_burgundy_mixers[] __initdata = { | 324 | static struct snd_kcontrol_new snd_pmac_burgundy_mixers[] __initdata = { |
312 | BURGUNDY_VOLUME("Master Playback Volume", 0, MASK_ADDR_BURGUNDY_MASTER_VOLUME, 8), | 325 | BURGUNDY_VOLUME("Master Playback Volume", 0, MASK_ADDR_BURGUNDY_MASTER_VOLUME, 8), |
313 | BURGUNDY_VOLUME("Line Playback Volume", 0, MASK_ADDR_BURGUNDY_VOLLINE, 16), | 326 | BURGUNDY_VOLUME("Line Playback Volume", 0, MASK_ADDR_BURGUNDY_VOLLINE, 16), |
314 | BURGUNDY_VOLUME("CD Playback Volume", 0, MASK_ADDR_BURGUNDY_VOLCD, 16), | 327 | BURGUNDY_VOLUME("CD Playback Volume", 0, MASK_ADDR_BURGUNDY_VOLCD, 16), |
@@ -317,9 +330,9 @@ static snd_kcontrol_new_t snd_pmac_burgundy_mixers[] __initdata = { | |||
317 | /*BURGUNDY_OUTPUT_VOLUME("PCM Playback Volume", 0, MASK_ADDR_BURGUNDY_ATTENLINEOUT, 1),*/ | 330 | /*BURGUNDY_OUTPUT_VOLUME("PCM Playback Volume", 0, MASK_ADDR_BURGUNDY_ATTENLINEOUT, 1),*/ |
318 | BURGUNDY_OUTPUT_VOLUME("Headphone Playback Volume", 0, MASK_ADDR_BURGUNDY_ATTENSPEAKER, 1), | 331 | BURGUNDY_OUTPUT_VOLUME("Headphone Playback Volume", 0, MASK_ADDR_BURGUNDY_ATTENSPEAKER, 1), |
319 | }; | 332 | }; |
320 | static snd_kcontrol_new_t snd_pmac_burgundy_master_sw __initdata = | 333 | static struct snd_kcontrol_new snd_pmac_burgundy_master_sw __initdata = |
321 | BURGUNDY_OUTPUT_SWITCH("Headphone Playback Switch", 0, BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1); | 334 | BURGUNDY_OUTPUT_SWITCH("Headphone Playback Switch", 0, BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1); |
322 | static snd_kcontrol_new_t snd_pmac_burgundy_speaker_sw __initdata = | 335 | static struct snd_kcontrol_new snd_pmac_burgundy_speaker_sw __initdata = |
323 | BURGUNDY_OUTPUT_SWITCH("PC Speaker Playback Switch", 0, BURGUNDY_OUTPUT_INTERN, 0, 0); | 336 | BURGUNDY_OUTPUT_SWITCH("PC Speaker Playback Switch", 0, BURGUNDY_OUTPUT_INTERN, 0, 0); |
324 | 337 | ||
325 | 338 | ||
@@ -327,12 +340,12 @@ BURGUNDY_OUTPUT_SWITCH("PC Speaker Playback Switch", 0, BURGUNDY_OUTPUT_INTERN, | |||
327 | /* | 340 | /* |
328 | * auto-mute stuffs | 341 | * auto-mute stuffs |
329 | */ | 342 | */ |
330 | static int snd_pmac_burgundy_detect_headphone(pmac_t *chip) | 343 | static int snd_pmac_burgundy_detect_headphone(struct snd_pmac *chip) |
331 | { | 344 | { |
332 | return (in_le32(&chip->awacs->codec_stat) & chip->hp_stat_mask) ? 1 : 0; | 345 | return (in_le32(&chip->awacs->codec_stat) & chip->hp_stat_mask) ? 1 : 0; |
333 | } | 346 | } |
334 | 347 | ||
335 | static void snd_pmac_burgundy_update_automute(pmac_t *chip, int do_notify) | 348 | static void snd_pmac_burgundy_update_automute(struct snd_pmac *chip, int do_notify) |
336 | { | 349 | { |
337 | if (chip->auto_mute) { | 350 | if (chip->auto_mute) { |
338 | int reg, oreg; | 351 | int reg, oreg; |
@@ -361,7 +374,7 @@ static void snd_pmac_burgundy_update_automute(pmac_t *chip, int do_notify) | |||
361 | /* | 374 | /* |
362 | * initialize burgundy | 375 | * initialize burgundy |
363 | */ | 376 | */ |
364 | int __init snd_pmac_burgundy_init(pmac_t *chip) | 377 | int __init snd_pmac_burgundy_init(struct snd_pmac *chip) |
365 | { | 378 | { |
366 | int i, err; | 379 | int i, err; |
367 | 380 | ||