diff options
Diffstat (limited to 'sound/ppc/awacs.c')
-rw-r--r-- | sound/ppc/awacs.c | 175 |
1 files changed, 98 insertions, 77 deletions
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c index 758ca1bcbcf2..82d791be7499 100644 --- a/sound/ppc/awacs.c +++ b/sound/ppc/awacs.c | |||
@@ -35,18 +35,18 @@ | |||
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #ifdef PMAC_AMP_AVAIL | 37 | #ifdef PMAC_AMP_AVAIL |
38 | typedef struct awacs_amp { | 38 | struct awacs_amp { |
39 | unsigned char amp_master; | 39 | unsigned char amp_master; |
40 | unsigned char amp_vol[2][2]; | 40 | unsigned char amp_vol[2][2]; |
41 | unsigned char amp_tone[2]; | 41 | unsigned char amp_tone[2]; |
42 | } awacs_amp_t; | 42 | }; |
43 | 43 | ||
44 | #define CHECK_CUDA_AMP() (sys_ctrler == SYS_CTRLER_CUDA) | 44 | #define CHECK_CUDA_AMP() (sys_ctrler == SYS_CTRLER_CUDA) |
45 | 45 | ||
46 | #endif /* PMAC_AMP_AVAIL */ | 46 | #endif /* PMAC_AMP_AVAIL */ |
47 | 47 | ||
48 | 48 | ||
49 | static void snd_pmac_screamer_wait(pmac_t *chip) | 49 | static void snd_pmac_screamer_wait(struct snd_pmac *chip) |
50 | { | 50 | { |
51 | long timeout = 2000; | 51 | long timeout = 2000; |
52 | while (!(in_le32(&chip->awacs->codec_stat) & MASK_VALID)) { | 52 | while (!(in_le32(&chip->awacs->codec_stat) & MASK_VALID)) { |
@@ -62,7 +62,7 @@ static void snd_pmac_screamer_wait(pmac_t *chip) | |||
62 | * write AWACS register | 62 | * write AWACS register |
63 | */ | 63 | */ |
64 | static void | 64 | static void |
65 | snd_pmac_awacs_write(pmac_t *chip, int val) | 65 | snd_pmac_awacs_write(struct snd_pmac *chip, int val) |
66 | { | 66 | { |
67 | long timeout = 5000000; | 67 | long timeout = 5000000; |
68 | 68 | ||
@@ -78,21 +78,21 @@ snd_pmac_awacs_write(pmac_t *chip, int val) | |||
78 | } | 78 | } |
79 | 79 | ||
80 | static void | 80 | static void |
81 | snd_pmac_awacs_write_reg(pmac_t *chip, int reg, int val) | 81 | snd_pmac_awacs_write_reg(struct snd_pmac *chip, int reg, int val) |
82 | { | 82 | { |
83 | snd_pmac_awacs_write(chip, val | (reg << 12)); | 83 | snd_pmac_awacs_write(chip, val | (reg << 12)); |
84 | chip->awacs_reg[reg] = val; | 84 | chip->awacs_reg[reg] = val; |
85 | } | 85 | } |
86 | 86 | ||
87 | static void | 87 | static void |
88 | snd_pmac_awacs_write_noreg(pmac_t *chip, int reg, int val) | 88 | snd_pmac_awacs_write_noreg(struct snd_pmac *chip, int reg, int val) |
89 | { | 89 | { |
90 | snd_pmac_awacs_write(chip, val | (reg << 12)); | 90 | snd_pmac_awacs_write(chip, val | (reg << 12)); |
91 | } | 91 | } |
92 | 92 | ||
93 | #ifdef CONFIG_PM | 93 | #ifdef CONFIG_PM |
94 | /* Recalibrate chip */ | 94 | /* Recalibrate chip */ |
95 | static void screamer_recalibrate(pmac_t *chip) | 95 | static void screamer_recalibrate(struct snd_pmac *chip) |
96 | { | 96 | { |
97 | if (chip->model != PMAC_SCREAMER) | 97 | if (chip->model != PMAC_SCREAMER) |
98 | return; | 98 | return; |
@@ -105,7 +105,8 @@ static void screamer_recalibrate(pmac_t *chip) | |||
105 | /* delay for broken crystal part */ | 105 | /* delay for broken crystal part */ |
106 | msleep(750); | 106 | msleep(750); |
107 | snd_pmac_awacs_write_noreg(chip, 1, | 107 | snd_pmac_awacs_write_noreg(chip, 1, |
108 | chip->awacs_reg[1] | MASK_RECALIBRATE | MASK_CMUTE | MASK_AMUTE); | 108 | chip->awacs_reg[1] | MASK_RECALIBRATE | |
109 | MASK_CMUTE | MASK_AMUTE); | ||
109 | snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]); | 110 | snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]); |
110 | snd_pmac_awacs_write_noreg(chip, 6, chip->awacs_reg[6]); | 111 | snd_pmac_awacs_write_noreg(chip, 6, chip->awacs_reg[6]); |
111 | } | 112 | } |
@@ -118,7 +119,7 @@ static void screamer_recalibrate(pmac_t *chip) | |||
118 | /* | 119 | /* |
119 | * additional callback to set the pcm format | 120 | * additional callback to set the pcm format |
120 | */ | 121 | */ |
121 | static void snd_pmac_awacs_set_format(pmac_t *chip) | 122 | static void snd_pmac_awacs_set_format(struct snd_pmac *chip) |
122 | { | 123 | { |
123 | chip->awacs_reg[1] &= ~MASK_SAMPLERATE; | 124 | chip->awacs_reg[1] &= ~MASK_SAMPLERATE; |
124 | chip->awacs_reg[1] |= chip->rate_index << 3; | 125 | chip->awacs_reg[1] |= chip->rate_index << 3; |
@@ -132,7 +133,8 @@ static void snd_pmac_awacs_set_format(pmac_t *chip) | |||
132 | /* | 133 | /* |
133 | * volumes: 0-15 stereo | 134 | * volumes: 0-15 stereo |
134 | */ | 135 | */ |
135 | static int snd_pmac_awacs_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 136 | static int snd_pmac_awacs_info_volume(struct snd_kcontrol *kcontrol, |
137 | struct snd_ctl_elem_info *uinfo) | ||
136 | { | 138 | { |
137 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 139 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
138 | uinfo->count = 2; | 140 | uinfo->count = 2; |
@@ -141,9 +143,10 @@ static int snd_pmac_awacs_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf | |||
141 | return 0; | 143 | return 0; |
142 | } | 144 | } |
143 | 145 | ||
144 | static int snd_pmac_awacs_get_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 146 | static int snd_pmac_awacs_get_volume(struct snd_kcontrol *kcontrol, |
147 | struct snd_ctl_elem_value *ucontrol) | ||
145 | { | 148 | { |
146 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 149 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
147 | int reg = kcontrol->private_value & 0xff; | 150 | int reg = kcontrol->private_value & 0xff; |
148 | int lshift = (kcontrol->private_value >> 8) & 0xff; | 151 | int lshift = (kcontrol->private_value >> 8) & 0xff; |
149 | int inverted = (kcontrol->private_value >> 16) & 1; | 152 | int inverted = (kcontrol->private_value >> 16) & 1; |
@@ -163,9 +166,10 @@ static int snd_pmac_awacs_get_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu | |||
163 | return 0; | 166 | return 0; |
164 | } | 167 | } |
165 | 168 | ||
166 | static int snd_pmac_awacs_put_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 169 | static int snd_pmac_awacs_put_volume(struct snd_kcontrol *kcontrol, |
170 | struct snd_ctl_elem_value *ucontrol) | ||
167 | { | 171 | { |
168 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 172 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
169 | int reg = kcontrol->private_value & 0xff; | 173 | int reg = kcontrol->private_value & 0xff; |
170 | int lshift = (kcontrol->private_value >> 8) & 0xff; | 174 | int lshift = (kcontrol->private_value >> 8) & 0xff; |
171 | int inverted = (kcontrol->private_value >> 16) & 1; | 175 | int inverted = (kcontrol->private_value >> 16) & 1; |
@@ -203,9 +207,10 @@ static int snd_pmac_awacs_put_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu | |||
203 | /* | 207 | /* |
204 | * mute master/ogain for AWACS: mono | 208 | * mute master/ogain for AWACS: mono |
205 | */ | 209 | */ |
206 | static int snd_pmac_awacs_get_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 210 | static int snd_pmac_awacs_get_switch(struct snd_kcontrol *kcontrol, |
211 | struct snd_ctl_elem_value *ucontrol) | ||
207 | { | 212 | { |
208 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 213 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
209 | int reg = kcontrol->private_value & 0xff; | 214 | int reg = kcontrol->private_value & 0xff; |
210 | int shift = (kcontrol->private_value >> 8) & 0xff; | 215 | int shift = (kcontrol->private_value >> 8) & 0xff; |
211 | int invert = (kcontrol->private_value >> 16) & 1; | 216 | int invert = (kcontrol->private_value >> 16) & 1; |
@@ -221,9 +226,10 @@ static int snd_pmac_awacs_get_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu | |||
221 | return 0; | 226 | return 0; |
222 | } | 227 | } |
223 | 228 | ||
224 | static int snd_pmac_awacs_put_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 229 | static int snd_pmac_awacs_put_switch(struct snd_kcontrol *kcontrol, |
230 | struct snd_ctl_elem_value *ucontrol) | ||
225 | { | 231 | { |
226 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 232 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
227 | int reg = kcontrol->private_value & 0xff; | 233 | int reg = kcontrol->private_value & 0xff; |
228 | int shift = (kcontrol->private_value >> 8) & 0xff; | 234 | int shift = (kcontrol->private_value >> 8) & 0xff; |
229 | int invert = (kcontrol->private_value >> 16) & 1; | 235 | int invert = (kcontrol->private_value >> 16) & 1; |
@@ -268,7 +274,7 @@ static void awacs_set_cuda(int reg, int val) | |||
268 | /* | 274 | /* |
269 | * level = 0 - 14, 7 = 0 dB | 275 | * level = 0 - 14, 7 = 0 dB |
270 | */ | 276 | */ |
271 | static void awacs_amp_set_tone(awacs_amp_t *amp, int bass, int treble) | 277 | static void awacs_amp_set_tone(struct awacs_amp *amp, int bass, int treble) |
272 | { | 278 | { |
273 | amp->amp_tone[0] = bass; | 279 | amp->amp_tone[0] = bass; |
274 | amp->amp_tone[1] = treble; | 280 | amp->amp_tone[1] = treble; |
@@ -282,7 +288,8 @@ static void awacs_amp_set_tone(awacs_amp_t *amp, int bass, int treble) | |||
282 | /* | 288 | /* |
283 | * vol = 0 - 31 (attenuation), 32 = mute bit, stereo | 289 | * vol = 0 - 31 (attenuation), 32 = mute bit, stereo |
284 | */ | 290 | */ |
285 | static int awacs_amp_set_vol(awacs_amp_t *amp, int index, int lvol, int rvol, int do_check) | 291 | static int awacs_amp_set_vol(struct awacs_amp *amp, int index, int lvol, int rvol, |
292 | int do_check) | ||
286 | { | 293 | { |
287 | if (do_check && amp->amp_vol[index][0] == lvol && | 294 | if (do_check && amp->amp_vol[index][0] == lvol && |
288 | amp->amp_vol[index][1] == rvol) | 295 | amp->amp_vol[index][1] == rvol) |
@@ -297,7 +304,7 @@ static int awacs_amp_set_vol(awacs_amp_t *amp, int index, int lvol, int rvol, in | |||
297 | /* | 304 | /* |
298 | * 0 = -79 dB, 79 = 0 dB, 99 = +20 dB | 305 | * 0 = -79 dB, 79 = 0 dB, 99 = +20 dB |
299 | */ | 306 | */ |
300 | static void awacs_amp_set_master(awacs_amp_t *amp, int vol) | 307 | static void awacs_amp_set_master(struct awacs_amp *amp, int vol) |
301 | { | 308 | { |
302 | amp->amp_master = vol; | 309 | amp->amp_master = vol; |
303 | if (vol <= 79) | 310 | if (vol <= 79) |
@@ -307,9 +314,9 @@ static void awacs_amp_set_master(awacs_amp_t *amp, int vol) | |||
307 | awacs_set_cuda(1, vol); | 314 | awacs_set_cuda(1, vol); |
308 | } | 315 | } |
309 | 316 | ||
310 | static void awacs_amp_free(pmac_t *chip) | 317 | static void awacs_amp_free(struct snd_pmac *chip) |
311 | { | 318 | { |
312 | awacs_amp_t *amp = chip->mixer_data; | 319 | struct awacs_amp *amp = chip->mixer_data; |
313 | snd_assert(amp, return); | 320 | snd_assert(amp, return); |
314 | kfree(amp); | 321 | kfree(amp); |
315 | chip->mixer_data = NULL; | 322 | chip->mixer_data = NULL; |
@@ -320,7 +327,8 @@ static void awacs_amp_free(pmac_t *chip) | |||
320 | /* | 327 | /* |
321 | * mixer controls | 328 | * mixer controls |
322 | */ | 329 | */ |
323 | static int snd_pmac_awacs_info_volume_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 330 | static int snd_pmac_awacs_info_volume_amp(struct snd_kcontrol *kcontrol, |
331 | struct snd_ctl_elem_info *uinfo) | ||
324 | { | 332 | { |
325 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 333 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
326 | uinfo->count = 2; | 334 | uinfo->count = 2; |
@@ -329,11 +337,12 @@ static int snd_pmac_awacs_info_volume_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem | |||
329 | return 0; | 337 | return 0; |
330 | } | 338 | } |
331 | 339 | ||
332 | static int snd_pmac_awacs_get_volume_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 340 | static int snd_pmac_awacs_get_volume_amp(struct snd_kcontrol *kcontrol, |
341 | struct snd_ctl_elem_value *ucontrol) | ||
333 | { | 342 | { |
334 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 343 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
335 | int index = kcontrol->private_value; | 344 | int index = kcontrol->private_value; |
336 | awacs_amp_t *amp = chip->mixer_data; | 345 | struct awacs_amp *amp = chip->mixer_data; |
337 | snd_assert(amp, return -EINVAL); | 346 | snd_assert(amp, return -EINVAL); |
338 | snd_assert(index >= 0 && index <= 1, return -EINVAL); | 347 | snd_assert(index >= 0 && index <= 1, return -EINVAL); |
339 | ucontrol->value.integer.value[0] = 31 - (amp->amp_vol[index][0] & 31); | 348 | ucontrol->value.integer.value[0] = 31 - (amp->amp_vol[index][0] & 31); |
@@ -341,12 +350,13 @@ static int snd_pmac_awacs_get_volume_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_ | |||
341 | return 0; | 350 | return 0; |
342 | } | 351 | } |
343 | 352 | ||
344 | static int snd_pmac_awacs_put_volume_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 353 | static int snd_pmac_awacs_put_volume_amp(struct snd_kcontrol *kcontrol, |
354 | struct snd_ctl_elem_value *ucontrol) | ||
345 | { | 355 | { |
346 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 356 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
347 | int index = kcontrol->private_value; | 357 | int index = kcontrol->private_value; |
348 | int vol[2]; | 358 | int vol[2]; |
349 | awacs_amp_t *amp = chip->mixer_data; | 359 | struct awacs_amp *amp = chip->mixer_data; |
350 | snd_assert(amp, return -EINVAL); | 360 | snd_assert(amp, return -EINVAL); |
351 | snd_assert(index >= 0 && index <= 1, return -EINVAL); | 361 | snd_assert(index >= 0 && index <= 1, return -EINVAL); |
352 | 362 | ||
@@ -355,11 +365,12 @@ static int snd_pmac_awacs_put_volume_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_ | |||
355 | return awacs_amp_set_vol(amp, index, vol[0], vol[1], 1); | 365 | return awacs_amp_set_vol(amp, index, vol[0], vol[1], 1); |
356 | } | 366 | } |
357 | 367 | ||
358 | static int snd_pmac_awacs_get_switch_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 368 | static int snd_pmac_awacs_get_switch_amp(struct snd_kcontrol *kcontrol, |
369 | struct snd_ctl_elem_value *ucontrol) | ||
359 | { | 370 | { |
360 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 371 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
361 | int index = kcontrol->private_value; | 372 | int index = kcontrol->private_value; |
362 | awacs_amp_t *amp = chip->mixer_data; | 373 | struct awacs_amp *amp = chip->mixer_data; |
363 | snd_assert(amp, return -EINVAL); | 374 | snd_assert(amp, return -EINVAL); |
364 | snd_assert(index >= 0 && index <= 1, return -EINVAL); | 375 | snd_assert(index >= 0 && index <= 1, return -EINVAL); |
365 | ucontrol->value.integer.value[0] = (amp->amp_vol[index][0] & 32) ? 0 : 1; | 376 | ucontrol->value.integer.value[0] = (amp->amp_vol[index][0] & 32) ? 0 : 1; |
@@ -367,12 +378,13 @@ static int snd_pmac_awacs_get_switch_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_ | |||
367 | return 0; | 378 | return 0; |
368 | } | 379 | } |
369 | 380 | ||
370 | static int snd_pmac_awacs_put_switch_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 381 | static int snd_pmac_awacs_put_switch_amp(struct snd_kcontrol *kcontrol, |
382 | struct snd_ctl_elem_value *ucontrol) | ||
371 | { | 383 | { |
372 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 384 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
373 | int index = kcontrol->private_value; | 385 | int index = kcontrol->private_value; |
374 | int vol[2]; | 386 | int vol[2]; |
375 | awacs_amp_t *amp = chip->mixer_data; | 387 | struct awacs_amp *amp = chip->mixer_data; |
376 | snd_assert(amp, return -EINVAL); | 388 | snd_assert(amp, return -EINVAL); |
377 | snd_assert(index >= 0 && index <= 1, return -EINVAL); | 389 | snd_assert(index >= 0 && index <= 1, return -EINVAL); |
378 | 390 | ||
@@ -381,7 +393,8 @@ static int snd_pmac_awacs_put_switch_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_ | |||
381 | return awacs_amp_set_vol(amp, index, vol[0], vol[1], 1); | 393 | return awacs_amp_set_vol(amp, index, vol[0], vol[1], 1); |
382 | } | 394 | } |
383 | 395 | ||
384 | static int snd_pmac_awacs_info_tone_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 396 | static int snd_pmac_awacs_info_tone_amp(struct snd_kcontrol *kcontrol, |
397 | struct snd_ctl_elem_info *uinfo) | ||
385 | { | 398 | { |
386 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 399 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
387 | uinfo->count = 1; | 400 | uinfo->count = 1; |
@@ -390,22 +403,24 @@ static int snd_pmac_awacs_info_tone_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_i | |||
390 | return 0; | 403 | return 0; |
391 | } | 404 | } |
392 | 405 | ||
393 | static int snd_pmac_awacs_get_tone_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 406 | static int snd_pmac_awacs_get_tone_amp(struct snd_kcontrol *kcontrol, |
407 | struct snd_ctl_elem_value *ucontrol) | ||
394 | { | 408 | { |
395 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 409 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
396 | int index = kcontrol->private_value; | 410 | int index = kcontrol->private_value; |
397 | awacs_amp_t *amp = chip->mixer_data; | 411 | struct awacs_amp *amp = chip->mixer_data; |
398 | snd_assert(amp, return -EINVAL); | 412 | snd_assert(amp, return -EINVAL); |
399 | snd_assert(index >= 0 && index <= 1, return -EINVAL); | 413 | snd_assert(index >= 0 && index <= 1, return -EINVAL); |
400 | ucontrol->value.integer.value[0] = amp->amp_tone[index]; | 414 | ucontrol->value.integer.value[0] = amp->amp_tone[index]; |
401 | return 0; | 415 | return 0; |
402 | } | 416 | } |
403 | 417 | ||
404 | static int snd_pmac_awacs_put_tone_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 418 | static int snd_pmac_awacs_put_tone_amp(struct snd_kcontrol *kcontrol, |
419 | struct snd_ctl_elem_value *ucontrol) | ||
405 | { | 420 | { |
406 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 421 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
407 | int index = kcontrol->private_value; | 422 | int index = kcontrol->private_value; |
408 | awacs_amp_t *amp = chip->mixer_data; | 423 | struct awacs_amp *amp = chip->mixer_data; |
409 | snd_assert(amp, return -EINVAL); | 424 | snd_assert(amp, return -EINVAL); |
410 | snd_assert(index >= 0 && index <= 1, return -EINVAL); | 425 | snd_assert(index >= 0 && index <= 1, return -EINVAL); |
411 | if (ucontrol->value.integer.value[0] != amp->amp_tone[index]) { | 426 | if (ucontrol->value.integer.value[0] != amp->amp_tone[index]) { |
@@ -416,7 +431,8 @@ static int snd_pmac_awacs_put_tone_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_va | |||
416 | return 0; | 431 | return 0; |
417 | } | 432 | } |
418 | 433 | ||
419 | static int snd_pmac_awacs_info_master_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 434 | static int snd_pmac_awacs_info_master_amp(struct snd_kcontrol *kcontrol, |
435 | struct snd_ctl_elem_info *uinfo) | ||
420 | { | 436 | { |
421 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 437 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
422 | uinfo->count = 1; | 438 | uinfo->count = 1; |
@@ -425,19 +441,21 @@ static int snd_pmac_awacs_info_master_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem | |||
425 | return 0; | 441 | return 0; |
426 | } | 442 | } |
427 | 443 | ||
428 | static int snd_pmac_awacs_get_master_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 444 | static int snd_pmac_awacs_get_master_amp(struct snd_kcontrol *kcontrol, |
445 | struct snd_ctl_elem_value *ucontrol) | ||
429 | { | 446 | { |
430 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 447 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
431 | awacs_amp_t *amp = chip->mixer_data; | 448 | struct awacs_amp *amp = chip->mixer_data; |
432 | snd_assert(amp, return -EINVAL); | 449 | snd_assert(amp, return -EINVAL); |
433 | ucontrol->value.integer.value[0] = amp->amp_master; | 450 | ucontrol->value.integer.value[0] = amp->amp_master; |
434 | return 0; | 451 | return 0; |
435 | } | 452 | } |
436 | 453 | ||
437 | static int snd_pmac_awacs_put_master_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 454 | static int snd_pmac_awacs_put_master_amp(struct snd_kcontrol *kcontrol, |
455 | struct snd_ctl_elem_value *ucontrol) | ||
438 | { | 456 | { |
439 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 457 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
440 | awacs_amp_t *amp = chip->mixer_data; | 458 | struct awacs_amp *amp = chip->mixer_data; |
441 | snd_assert(amp, return -EINVAL); | 459 | snd_assert(amp, return -EINVAL); |
442 | if (ucontrol->value.integer.value[0] != amp->amp_master) { | 460 | if (ucontrol->value.integer.value[0] != amp->amp_master) { |
443 | amp->amp_master = ucontrol->value.integer.value[0]; | 461 | amp->amp_master = ucontrol->value.integer.value[0]; |
@@ -450,7 +468,7 @@ static int snd_pmac_awacs_put_master_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_ | |||
450 | #define AMP_CH_SPK 0 | 468 | #define AMP_CH_SPK 0 |
451 | #define AMP_CH_HD 1 | 469 | #define AMP_CH_HD 1 |
452 | 470 | ||
453 | static snd_kcontrol_new_t snd_pmac_awacs_amp_vol[] __initdata = { | 471 | static struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] __initdata = { |
454 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 472 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
455 | .name = "PC Speaker Playback Volume", | 473 | .name = "PC Speaker Playback Volume", |
456 | .info = snd_pmac_awacs_info_volume_amp, | 474 | .info = snd_pmac_awacs_info_volume_amp, |
@@ -487,7 +505,7 @@ static snd_kcontrol_new_t snd_pmac_awacs_amp_vol[] __initdata = { | |||
487 | }, | 505 | }, |
488 | }; | 506 | }; |
489 | 507 | ||
490 | static snd_kcontrol_new_t snd_pmac_awacs_amp_hp_sw __initdata = { | 508 | static struct snd_kcontrol_new snd_pmac_awacs_amp_hp_sw __initdata = { |
491 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 509 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
492 | .name = "Headphone Playback Switch", | 510 | .name = "Headphone Playback Switch", |
493 | .info = snd_pmac_boolean_stereo_info, | 511 | .info = snd_pmac_boolean_stereo_info, |
@@ -496,7 +514,7 @@ static snd_kcontrol_new_t snd_pmac_awacs_amp_hp_sw __initdata = { | |||
496 | .private_value = AMP_CH_HD, | 514 | .private_value = AMP_CH_HD, |
497 | }; | 515 | }; |
498 | 516 | ||
499 | static snd_kcontrol_new_t snd_pmac_awacs_amp_spk_sw __initdata = { | 517 | static struct snd_kcontrol_new snd_pmac_awacs_amp_spk_sw __initdata = { |
500 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 518 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
501 | .name = "PC Speaker Playback Switch", | 519 | .name = "PC Speaker Playback Switch", |
502 | .info = snd_pmac_boolean_stereo_info, | 520 | .info = snd_pmac_boolean_stereo_info, |
@@ -511,7 +529,8 @@ static snd_kcontrol_new_t snd_pmac_awacs_amp_spk_sw __initdata = { | |||
511 | /* | 529 | /* |
512 | * mic boost for screamer | 530 | * mic boost for screamer |
513 | */ | 531 | */ |
514 | static int snd_pmac_screamer_mic_boost_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 532 | static int snd_pmac_screamer_mic_boost_info(struct snd_kcontrol *kcontrol, |
533 | struct snd_ctl_elem_info *uinfo) | ||
515 | { | 534 | { |
516 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 535 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
517 | uinfo->count = 1; | 536 | uinfo->count = 1; |
@@ -520,9 +539,10 @@ static int snd_pmac_screamer_mic_boost_info(snd_kcontrol_t *kcontrol, snd_ctl_el | |||
520 | return 0; | 539 | return 0; |
521 | } | 540 | } |
522 | 541 | ||
523 | static int snd_pmac_screamer_mic_boost_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 542 | static int snd_pmac_screamer_mic_boost_get(struct snd_kcontrol *kcontrol, |
543 | struct snd_ctl_elem_value *ucontrol) | ||
524 | { | 544 | { |
525 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 545 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
526 | int val; | 546 | int val; |
527 | unsigned long flags; | 547 | unsigned long flags; |
528 | 548 | ||
@@ -538,9 +558,10 @@ static int snd_pmac_screamer_mic_boost_get(snd_kcontrol_t *kcontrol, snd_ctl_ele | |||
538 | return 0; | 558 | return 0; |
539 | } | 559 | } |
540 | 560 | ||
541 | static int snd_pmac_screamer_mic_boost_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 561 | static int snd_pmac_screamer_mic_boost_put(struct snd_kcontrol *kcontrol, |
562 | struct snd_ctl_elem_value *ucontrol) | ||
542 | { | 563 | { |
543 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 564 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
544 | int changed = 0; | 565 | int changed = 0; |
545 | int val0, val6; | 566 | int val0, val6; |
546 | unsigned long flags; | 567 | unsigned long flags; |
@@ -568,7 +589,7 @@ static int snd_pmac_screamer_mic_boost_put(snd_kcontrol_t *kcontrol, snd_ctl_ele | |||
568 | /* | 589 | /* |
569 | * lists of mixer elements | 590 | * lists of mixer elements |
570 | */ | 591 | */ |
571 | static snd_kcontrol_new_t snd_pmac_awacs_mixers[] __initdata = { | 592 | static struct snd_kcontrol_new snd_pmac_awacs_mixers[] __initdata = { |
572 | AWACS_VOLUME("Master Playback Volume", 2, 6, 1), | 593 | AWACS_VOLUME("Master Playback Volume", 2, 6, 1), |
573 | AWACS_SWITCH("Master Capture Switch", 1, SHIFT_LOOPTHRU, 0), | 594 | AWACS_SWITCH("Master Capture Switch", 1, SHIFT_LOOPTHRU, 0), |
574 | AWACS_VOLUME("Capture Volume", 0, 4, 0), | 595 | AWACS_VOLUME("Capture Volume", 0, 4, 0), |
@@ -578,24 +599,24 @@ static snd_kcontrol_new_t snd_pmac_awacs_mixers[] __initdata = { | |||
578 | /* FIXME: is this correct order? | 599 | /* FIXME: is this correct order? |
579 | * screamer (powerbook G3 pismo) seems to have different bits... | 600 | * screamer (powerbook G3 pismo) seems to have different bits... |
580 | */ | 601 | */ |
581 | static snd_kcontrol_new_t snd_pmac_awacs_mixers2[] __initdata = { | 602 | static struct snd_kcontrol_new snd_pmac_awacs_mixers2[] __initdata = { |
582 | AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_LINE, 0), | 603 | AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_LINE, 0), |
583 | AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_MIC, 0), | 604 | AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_MIC, 0), |
584 | }; | 605 | }; |
585 | 606 | ||
586 | static snd_kcontrol_new_t snd_pmac_screamer_mixers2[] __initdata = { | 607 | static struct snd_kcontrol_new snd_pmac_screamer_mixers2[] __initdata = { |
587 | AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), | 608 | AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), |
588 | AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_LINE, 0), | 609 | AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_LINE, 0), |
589 | }; | 610 | }; |
590 | 611 | ||
591 | static snd_kcontrol_new_t snd_pmac_awacs_master_sw __initdata = | 612 | static struct snd_kcontrol_new snd_pmac_awacs_master_sw __initdata = |
592 | AWACS_SWITCH("Master Playback Switch", 1, SHIFT_HDMUTE, 1); | 613 | AWACS_SWITCH("Master Playback Switch", 1, SHIFT_HDMUTE, 1); |
593 | 614 | ||
594 | static snd_kcontrol_new_t snd_pmac_awacs_mic_boost[] __initdata = { | 615 | static struct snd_kcontrol_new snd_pmac_awacs_mic_boost[] __initdata = { |
595 | AWACS_SWITCH("Mic Boost", 0, SHIFT_GAINLINE, 0), | 616 | AWACS_SWITCH("Mic Boost", 0, SHIFT_GAINLINE, 0), |
596 | }; | 617 | }; |
597 | 618 | ||
598 | static snd_kcontrol_new_t snd_pmac_screamer_mic_boost[] __initdata = { | 619 | static struct snd_kcontrol_new snd_pmac_screamer_mic_boost[] __initdata = { |
599 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 620 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
600 | .name = "Mic Boost", | 621 | .name = "Mic Boost", |
601 | .info = snd_pmac_screamer_mic_boost_info, | 622 | .info = snd_pmac_screamer_mic_boost_info, |
@@ -604,17 +625,17 @@ static snd_kcontrol_new_t snd_pmac_screamer_mic_boost[] __initdata = { | |||
604 | }, | 625 | }, |
605 | }; | 626 | }; |
606 | 627 | ||
607 | static snd_kcontrol_new_t snd_pmac_awacs_speaker_vol[] __initdata = { | 628 | static struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] __initdata = { |
608 | AWACS_VOLUME("PC Speaker Playback Volume", 4, 6, 1), | 629 | AWACS_VOLUME("PC Speaker Playback Volume", 4, 6, 1), |
609 | }; | 630 | }; |
610 | static snd_kcontrol_new_t snd_pmac_awacs_speaker_sw __initdata = | 631 | static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw __initdata = |
611 | AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1); | 632 | AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1); |
612 | 633 | ||
613 | 634 | ||
614 | /* | 635 | /* |
615 | * add new mixer elements to the card | 636 | * add new mixer elements to the card |
616 | */ | 637 | */ |
617 | static int build_mixers(pmac_t *chip, int nums, snd_kcontrol_new_t *mixers) | 638 | static int build_mixers(struct snd_pmac *chip, int nums, struct snd_kcontrol_new *mixers) |
618 | { | 639 | { |
619 | int i, err; | 640 | int i, err; |
620 | 641 | ||
@@ -629,7 +650,7 @@ static int build_mixers(pmac_t *chip, int nums, snd_kcontrol_new_t *mixers) | |||
629 | /* | 650 | /* |
630 | * restore all registers | 651 | * restore all registers |
631 | */ | 652 | */ |
632 | static void awacs_restore_all_regs(pmac_t *chip) | 653 | static void awacs_restore_all_regs(struct snd_pmac *chip) |
633 | { | 654 | { |
634 | snd_pmac_awacs_write_noreg(chip, 0, chip->awacs_reg[0]); | 655 | snd_pmac_awacs_write_noreg(chip, 0, chip->awacs_reg[0]); |
635 | snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]); | 656 | snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]); |
@@ -643,13 +664,13 @@ static void awacs_restore_all_regs(pmac_t *chip) | |||
643 | } | 664 | } |
644 | 665 | ||
645 | #ifdef CONFIG_PM | 666 | #ifdef CONFIG_PM |
646 | static void snd_pmac_awacs_suspend(pmac_t *chip) | 667 | static void snd_pmac_awacs_suspend(struct snd_pmac *chip) |
647 | { | 668 | { |
648 | snd_pmac_awacs_write_noreg(chip, 1, (chip->awacs_reg[1] | 669 | snd_pmac_awacs_write_noreg(chip, 1, (chip->awacs_reg[1] |
649 | | MASK_AMUTE | MASK_CMUTE)); | 670 | | MASK_AMUTE | MASK_CMUTE)); |
650 | } | 671 | } |
651 | 672 | ||
652 | static void snd_pmac_awacs_resume(pmac_t *chip) | 673 | static void snd_pmac_awacs_resume(struct snd_pmac *chip) |
653 | { | 674 | { |
654 | if (machine_is_compatible("PowerBook3,1") | 675 | if (machine_is_compatible("PowerBook3,1") |
655 | || machine_is_compatible("PowerBook3,2")) { | 676 | || machine_is_compatible("PowerBook3,2")) { |
@@ -668,7 +689,7 @@ static void snd_pmac_awacs_resume(pmac_t *chip) | |||
668 | screamer_recalibrate(chip); | 689 | screamer_recalibrate(chip); |
669 | #ifdef PMAC_AMP_AVAIL | 690 | #ifdef PMAC_AMP_AVAIL |
670 | if (chip->mixer_data) { | 691 | if (chip->mixer_data) { |
671 | awacs_amp_t *amp = chip->mixer_data; | 692 | struct awacs_amp *amp = chip->mixer_data; |
672 | awacs_amp_set_vol(amp, 0, amp->amp_vol[0][0], amp->amp_vol[0][1], 0); | 693 | awacs_amp_set_vol(amp, 0, amp->amp_vol[0][0], amp->amp_vol[0][1], 0); |
673 | awacs_amp_set_vol(amp, 1, amp->amp_vol[1][0], amp->amp_vol[1][1], 0); | 694 | awacs_amp_set_vol(amp, 1, amp->amp_vol[1][0], amp->amp_vol[1][1], 0); |
674 | awacs_amp_set_tone(amp, amp->amp_tone[0], amp->amp_tone[1]); | 695 | awacs_amp_set_tone(amp, amp->amp_tone[0], amp->amp_tone[1]); |
@@ -682,13 +703,13 @@ static void snd_pmac_awacs_resume(pmac_t *chip) | |||
682 | /* | 703 | /* |
683 | * auto-mute stuffs | 704 | * auto-mute stuffs |
684 | */ | 705 | */ |
685 | static int snd_pmac_awacs_detect_headphone(pmac_t *chip) | 706 | static int snd_pmac_awacs_detect_headphone(struct snd_pmac *chip) |
686 | { | 707 | { |
687 | return (in_le32(&chip->awacs->codec_stat) & chip->hp_stat_mask) ? 1 : 0; | 708 | return (in_le32(&chip->awacs->codec_stat) & chip->hp_stat_mask) ? 1 : 0; |
688 | } | 709 | } |
689 | 710 | ||
690 | #ifdef PMAC_AMP_AVAIL | 711 | #ifdef PMAC_AMP_AVAIL |
691 | static int toggle_amp_mute(awacs_amp_t *amp, int index, int mute) | 712 | static int toggle_amp_mute(struct awacs_amp *amp, int index, int mute) |
692 | { | 713 | { |
693 | int vol[2]; | 714 | int vol[2]; |
694 | vol[0] = amp->amp_vol[index][0] & 31; | 715 | vol[0] = amp->amp_vol[index][0] & 31; |
@@ -701,12 +722,12 @@ static int toggle_amp_mute(awacs_amp_t *amp, int index, int mute) | |||
701 | } | 722 | } |
702 | #endif | 723 | #endif |
703 | 724 | ||
704 | static void snd_pmac_awacs_update_automute(pmac_t *chip, int do_notify) | 725 | static void snd_pmac_awacs_update_automute(struct snd_pmac *chip, int do_notify) |
705 | { | 726 | { |
706 | if (chip->auto_mute) { | 727 | if (chip->auto_mute) { |
707 | #ifdef PMAC_AMP_AVAIL | 728 | #ifdef PMAC_AMP_AVAIL |
708 | if (chip->mixer_data) { | 729 | if (chip->mixer_data) { |
709 | awacs_amp_t *amp = chip->mixer_data; | 730 | struct awacs_amp *amp = chip->mixer_data; |
710 | int changed; | 731 | int changed; |
711 | if (snd_pmac_awacs_detect_headphone(chip)) { | 732 | if (snd_pmac_awacs_detect_headphone(chip)) { |
712 | changed = toggle_amp_mute(amp, AMP_CH_HD, 0); | 733 | changed = toggle_amp_mute(amp, AMP_CH_HD, 0); |
@@ -746,7 +767,7 @@ static void snd_pmac_awacs_update_automute(pmac_t *chip, int do_notify) | |||
746 | * initialize chip | 767 | * initialize chip |
747 | */ | 768 | */ |
748 | int __init | 769 | int __init |
749 | snd_pmac_awacs_init(pmac_t *chip) | 770 | snd_pmac_awacs_init(struct snd_pmac *chip) |
750 | { | 771 | { |
751 | int err, vol; | 772 | int err, vol; |
752 | 773 | ||
@@ -780,7 +801,7 @@ snd_pmac_awacs_init(pmac_t *chip) | |||
780 | chip->revision = (in_le32(&chip->awacs->codec_stat) >> 12) & 0xf; | 801 | chip->revision = (in_le32(&chip->awacs->codec_stat) >> 12) & 0xf; |
781 | #ifdef PMAC_AMP_AVAIL | 802 | #ifdef PMAC_AMP_AVAIL |
782 | if (chip->revision == 3 && chip->has_iic && CHECK_CUDA_AMP()) { | 803 | if (chip->revision == 3 && chip->has_iic && CHECK_CUDA_AMP()) { |
783 | awacs_amp_t *amp = kmalloc(sizeof(*amp), GFP_KERNEL); | 804 | struct awacs_amp *amp = kmalloc(sizeof(*amp), GFP_KERNEL); |
784 | if (! amp) | 805 | if (! amp) |
785 | return -ENOMEM; | 806 | return -ENOMEM; |
786 | chip->mixer_data = amp; | 807 | chip->mixer_data = amp; |