diff options
author | Dave Kleikamp <shaggy@austin.ibm.com> | 2006-01-24 15:34:47 -0500 |
---|---|---|
committer | Dave Kleikamp <shaggy@austin.ibm.com> | 2006-01-24 15:34:47 -0500 |
commit | 0a0fc0ddbe732779366ab6b1b879f62195e65967 (patch) | |
tree | 7b42490a676cf39ae0691b6859ecf7fd410f229b /sound/ppc | |
parent | 4d5dbd0945d9e0833dd7964a3d6ee33157f7cc7a (diff) | |
parent | 3ee68c4af3fd7228c1be63254b9f884614f9ebb2 (diff) |
Merge with /home/shaggy/git/linus-clean/
Diffstat (limited to 'sound/ppc')
-rw-r--r-- | sound/ppc/Kconfig | 1 | ||||
-rw-r--r-- | sound/ppc/awacs.c | 175 | ||||
-rw-r--r-- | sound/ppc/beep.c | 34 | ||||
-rw-r--r-- | sound/ppc/burgundy.c | 75 | ||||
-rw-r--r-- | sound/ppc/daca.c | 72 | ||||
-rw-r--r-- | sound/ppc/keywest.c | 11 | ||||
-rw-r--r-- | sound/ppc/pmac.c | 371 | ||||
-rw-r--r-- | sound/ppc/pmac.h | 101 | ||||
-rw-r--r-- | sound/ppc/powermac.c | 71 | ||||
-rw-r--r-- | sound/ppc/toonie.c | 32 | ||||
-rw-r--r-- | sound/ppc/tumbler.c | 252 |
11 files changed, 632 insertions, 563 deletions
diff --git a/sound/ppc/Kconfig b/sound/ppc/Kconfig index 206b9333f9..a3fb1496e4 100644 --- a/sound/ppc/Kconfig +++ b/sound/ppc/Kconfig | |||
@@ -13,7 +13,6 @@ config SND_POWERMAC | |||
13 | tristate "PowerMac (AWACS, DACA, Burgundy, Tumbler, Keywest)" | 13 | tristate "PowerMac (AWACS, DACA, Burgundy, Tumbler, Keywest)" |
14 | depends on SND && I2C && INPUT && PPC_PMAC | 14 | depends on SND && I2C && INPUT && PPC_PMAC |
15 | select SND_PCM | 15 | select SND_PCM |
16 | select SND_GENERIC_DRIVER | ||
17 | help | 16 | help |
18 | Say Y here to include support for the integrated sound device. | 17 | Say Y here to include support for the integrated sound device. |
19 | 18 | ||
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c index 758ca1bcbc..82d791be74 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; |
diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c index d4ec6cc3f1..5fec1e58f3 100644 --- a/sound/ppc/beep.c +++ b/sound/ppc/beep.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <sound/control.h> | 30 | #include <sound/control.h> |
31 | #include "pmac.h" | 31 | #include "pmac.h" |
32 | 32 | ||
33 | struct snd_pmac_beep { | 33 | struct pmac_beep { |
34 | int running; /* boolean */ | 34 | int running; /* boolean */ |
35 | int volume; /* mixer volume: 0-100 */ | 35 | int volume; /* mixer volume: 0-100 */ |
36 | int volume_play; /* currently playing volume */ | 36 | int volume_play; /* currently playing volume */ |
@@ -44,9 +44,9 @@ struct snd_pmac_beep { | |||
44 | /* | 44 | /* |
45 | * stop beep if running | 45 | * stop beep if running |
46 | */ | 46 | */ |
47 | void snd_pmac_beep_stop(pmac_t *chip) | 47 | void snd_pmac_beep_stop(struct snd_pmac *chip) |
48 | { | 48 | { |
49 | pmac_beep_t *beep = chip->beep; | 49 | struct pmac_beep *beep = chip->beep; |
50 | if (beep && beep->running) { | 50 | if (beep && beep->running) { |
51 | beep->running = 0; | 51 | beep->running = 0; |
52 | snd_pmac_beep_dma_stop(chip); | 52 | snd_pmac_beep_dma_stop(chip); |
@@ -97,10 +97,11 @@ static short beep_wform[256] = { | |||
97 | #define BEEP_BUFLEN 512 | 97 | #define BEEP_BUFLEN 512 |
98 | #define BEEP_VOLUME 15 /* 0 - 100 */ | 98 | #define BEEP_VOLUME 15 /* 0 - 100 */ |
99 | 99 | ||
100 | static int snd_pmac_beep_event(struct input_dev *dev, unsigned int type, unsigned int code, int hz) | 100 | static int snd_pmac_beep_event(struct input_dev *dev, unsigned int type, |
101 | unsigned int code, int hz) | ||
101 | { | 102 | { |
102 | pmac_t *chip; | 103 | struct snd_pmac *chip; |
103 | pmac_beep_t *beep; | 104 | struct pmac_beep *beep; |
104 | unsigned long flags; | 105 | unsigned long flags; |
105 | int beep_speed = 0; | 106 | int beep_speed = 0; |
106 | int srate; | 107 | int srate; |
@@ -171,7 +172,8 @@ static int snd_pmac_beep_event(struct input_dev *dev, unsigned int type, unsigne | |||
171 | * beep volume mixer | 172 | * beep volume mixer |
172 | */ | 173 | */ |
173 | 174 | ||
174 | static int snd_pmac_info_beep(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 175 | static int snd_pmac_info_beep(struct snd_kcontrol *kcontrol, |
176 | struct snd_ctl_elem_info *uinfo) | ||
175 | { | 177 | { |
176 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 178 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
177 | uinfo->count = 1; | 179 | uinfo->count = 1; |
@@ -180,17 +182,19 @@ static int snd_pmac_info_beep(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uin | |||
180 | return 0; | 182 | return 0; |
181 | } | 183 | } |
182 | 184 | ||
183 | static int snd_pmac_get_beep(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 185 | static int snd_pmac_get_beep(struct snd_kcontrol *kcontrol, |
186 | struct snd_ctl_elem_value *ucontrol) | ||
184 | { | 187 | { |
185 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 188 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
186 | snd_assert(chip->beep, return -ENXIO); | 189 | snd_assert(chip->beep, return -ENXIO); |
187 | ucontrol->value.integer.value[0] = chip->beep->volume; | 190 | ucontrol->value.integer.value[0] = chip->beep->volume; |
188 | return 0; | 191 | return 0; |
189 | } | 192 | } |
190 | 193 | ||
191 | static int snd_pmac_put_beep(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 194 | static int snd_pmac_put_beep(struct snd_kcontrol *kcontrol, |
195 | struct snd_ctl_elem_value *ucontrol) | ||
192 | { | 196 | { |
193 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 197 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
194 | int oval; | 198 | int oval; |
195 | snd_assert(chip->beep, return -ENXIO); | 199 | snd_assert(chip->beep, return -ENXIO); |
196 | oval = chip->beep->volume; | 200 | oval = chip->beep->volume; |
@@ -198,7 +202,7 @@ static int snd_pmac_put_beep(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uco | |||
198 | return oval != chip->beep->volume; | 202 | return oval != chip->beep->volume; |
199 | } | 203 | } |
200 | 204 | ||
201 | static snd_kcontrol_new_t snd_pmac_beep_mixer = { | 205 | static struct snd_kcontrol_new snd_pmac_beep_mixer = { |
202 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 206 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
203 | .name = "Beep Playback Volume", | 207 | .name = "Beep Playback Volume", |
204 | .info = snd_pmac_info_beep, | 208 | .info = snd_pmac_info_beep, |
@@ -207,9 +211,9 @@ static snd_kcontrol_new_t snd_pmac_beep_mixer = { | |||
207 | }; | 211 | }; |
208 | 212 | ||
209 | /* Initialize beep stuff */ | 213 | /* Initialize beep stuff */ |
210 | int __init snd_pmac_attach_beep(pmac_t *chip) | 214 | int __init snd_pmac_attach_beep(struct snd_pmac *chip) |
211 | { | 215 | { |
212 | pmac_beep_t *beep; | 216 | struct pmac_beep *beep; |
213 | struct input_dev *input_dev; | 217 | struct input_dev *input_dev; |
214 | void *dmabuf; | 218 | void *dmabuf; |
215 | int err = -ENOMEM; | 219 | int err = -ENOMEM; |
@@ -255,7 +259,7 @@ int __init snd_pmac_attach_beep(pmac_t *chip) | |||
255 | return err; | 259 | return err; |
256 | } | 260 | } |
257 | 261 | ||
258 | void snd_pmac_detach_beep(pmac_t *chip) | 262 | void snd_pmac_detach_beep(struct snd_pmac *chip) |
259 | { | 263 | { |
260 | if (chip->beep) { | 264 | if (chip->beep) { |
261 | input_unregister_device(chip->beep->dev); | 265 | input_unregister_device(chip->beep->dev); |
diff --git a/sound/ppc/burgundy.c b/sound/ppc/burgundy.c index edbc0484e2..e02263fe44 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 | ||
diff --git a/sound/ppc/daca.c b/sound/ppc/daca.c index a737f298e7..08cde51177 100644 --- a/sound/ppc/daca.c +++ b/sound/ppc/daca.c | |||
@@ -40,18 +40,18 @@ | |||
40 | #define DACA_VOL_MAX 0x38 | 40 | #define DACA_VOL_MAX 0x38 |
41 | 41 | ||
42 | 42 | ||
43 | typedef struct pmac_daca_t { | 43 | struct pmac_daca { |
44 | pmac_keywest_t i2c; | 44 | struct pmac_keywest i2c; |
45 | int left_vol, right_vol; | 45 | int left_vol, right_vol; |
46 | unsigned int deemphasis : 1; | 46 | unsigned int deemphasis : 1; |
47 | unsigned int amp_on : 1; | 47 | unsigned int amp_on : 1; |
48 | } pmac_daca_t; | 48 | }; |
49 | 49 | ||
50 | 50 | ||
51 | /* | 51 | /* |
52 | * initialize / detect DACA | 52 | * initialize / detect DACA |
53 | */ | 53 | */ |
54 | static int daca_init_client(pmac_keywest_t *i2c) | 54 | static int daca_init_client(struct pmac_keywest *i2c) |
55 | { | 55 | { |
56 | unsigned short wdata = 0x00; | 56 | unsigned short wdata = 0x00; |
57 | /* SR: no swap, 1bit delay, 32-48kHz */ | 57 | /* SR: no swap, 1bit delay, 32-48kHz */ |
@@ -66,7 +66,7 @@ static int daca_init_client(pmac_keywest_t *i2c) | |||
66 | /* | 66 | /* |
67 | * update volume | 67 | * update volume |
68 | */ | 68 | */ |
69 | static int daca_set_volume(pmac_daca_t *mix) | 69 | static int daca_set_volume(struct pmac_daca *mix) |
70 | { | 70 | { |
71 | unsigned char data[2]; | 71 | unsigned char data[2]; |
72 | 72 | ||
@@ -92,7 +92,8 @@ static int daca_set_volume(pmac_daca_t *mix) | |||
92 | 92 | ||
93 | 93 | ||
94 | /* deemphasis switch */ | 94 | /* deemphasis switch */ |
95 | static int daca_info_deemphasis(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 95 | static int daca_info_deemphasis(struct snd_kcontrol *kcontrol, |
96 | struct snd_ctl_elem_info *uinfo) | ||
96 | { | 97 | { |
97 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | 98 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
98 | uinfo->count = 1; | 99 | uinfo->count = 1; |
@@ -101,20 +102,22 @@ static int daca_info_deemphasis(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *u | |||
101 | return 0; | 102 | return 0; |
102 | } | 103 | } |
103 | 104 | ||
104 | static int daca_get_deemphasis(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 105 | static int daca_get_deemphasis(struct snd_kcontrol *kcontrol, |
106 | struct snd_ctl_elem_value *ucontrol) | ||
105 | { | 107 | { |
106 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 108 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
107 | pmac_daca_t *mix; | 109 | struct pmac_daca *mix; |
108 | if (! (mix = chip->mixer_data)) | 110 | if (! (mix = chip->mixer_data)) |
109 | return -ENODEV; | 111 | return -ENODEV; |
110 | ucontrol->value.integer.value[0] = mix->deemphasis ? 1 : 0; | 112 | ucontrol->value.integer.value[0] = mix->deemphasis ? 1 : 0; |
111 | return 0; | 113 | return 0; |
112 | } | 114 | } |
113 | 115 | ||
114 | static int daca_put_deemphasis(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 116 | static int daca_put_deemphasis(struct snd_kcontrol *kcontrol, |
117 | struct snd_ctl_elem_value *ucontrol) | ||
115 | { | 118 | { |
116 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 119 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
117 | pmac_daca_t *mix; | 120 | struct pmac_daca *mix; |
118 | int change; | 121 | int change; |
119 | 122 | ||
120 | if (! (mix = chip->mixer_data)) | 123 | if (! (mix = chip->mixer_data)) |
@@ -128,7 +131,8 @@ static int daca_put_deemphasis(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u | |||
128 | } | 131 | } |
129 | 132 | ||
130 | /* output volume */ | 133 | /* output volume */ |
131 | static int daca_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 134 | static int daca_info_volume(struct snd_kcontrol *kcontrol, |
135 | struct snd_ctl_elem_info *uinfo) | ||
132 | { | 136 | { |
133 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 137 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
134 | uinfo->count = 2; | 138 | uinfo->count = 2; |
@@ -137,10 +141,11 @@ static int daca_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo | |||
137 | return 0; | 141 | return 0; |
138 | } | 142 | } |
139 | 143 | ||
140 | static int daca_get_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 144 | static int daca_get_volume(struct snd_kcontrol *kcontrol, |
145 | struct snd_ctl_elem_value *ucontrol) | ||
141 | { | 146 | { |
142 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 147 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
143 | pmac_daca_t *mix; | 148 | struct pmac_daca *mix; |
144 | if (! (mix = chip->mixer_data)) | 149 | if (! (mix = chip->mixer_data)) |
145 | return -ENODEV; | 150 | return -ENODEV; |
146 | ucontrol->value.integer.value[0] = mix->left_vol; | 151 | ucontrol->value.integer.value[0] = mix->left_vol; |
@@ -148,10 +153,11 @@ static int daca_get_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucont | |||
148 | return 0; | 153 | return 0; |
149 | } | 154 | } |
150 | 155 | ||
151 | static int daca_put_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 156 | static int daca_put_volume(struct snd_kcontrol *kcontrol, |
157 | struct snd_ctl_elem_value *ucontrol) | ||
152 | { | 158 | { |
153 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 159 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
154 | pmac_daca_t *mix; | 160 | struct pmac_daca *mix; |
155 | int change; | 161 | int change; |
156 | 162 | ||
157 | if (! (mix = chip->mixer_data)) | 163 | if (! (mix = chip->mixer_data)) |
@@ -169,20 +175,22 @@ static int daca_put_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucont | |||
169 | /* amplifier switch */ | 175 | /* amplifier switch */ |
170 | #define daca_info_amp daca_info_deemphasis | 176 | #define daca_info_amp daca_info_deemphasis |
171 | 177 | ||
172 | static int daca_get_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 178 | static int daca_get_amp(struct snd_kcontrol *kcontrol, |
179 | struct snd_ctl_elem_value *ucontrol) | ||
173 | { | 180 | { |
174 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 181 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
175 | pmac_daca_t *mix; | 182 | struct pmac_daca *mix; |
176 | if (! (mix = chip->mixer_data)) | 183 | if (! (mix = chip->mixer_data)) |
177 | return -ENODEV; | 184 | return -ENODEV; |
178 | ucontrol->value.integer.value[0] = mix->amp_on ? 1 : 0; | 185 | ucontrol->value.integer.value[0] = mix->amp_on ? 1 : 0; |
179 | return 0; | 186 | return 0; |
180 | } | 187 | } |
181 | 188 | ||
182 | static int daca_put_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 189 | static int daca_put_amp(struct snd_kcontrol *kcontrol, |
190 | struct snd_ctl_elem_value *ucontrol) | ||
183 | { | 191 | { |
184 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 192 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
185 | pmac_daca_t *mix; | 193 | struct pmac_daca *mix; |
186 | int change; | 194 | int change; |
187 | 195 | ||
188 | if (! (mix = chip->mixer_data)) | 196 | if (! (mix = chip->mixer_data)) |
@@ -196,7 +204,7 @@ static int daca_put_amp(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol | |||
196 | return change; | 204 | return change; |
197 | } | 205 | } |
198 | 206 | ||
199 | static snd_kcontrol_new_t daca_mixers[] = { | 207 | static struct snd_kcontrol_new daca_mixers[] = { |
200 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 208 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
201 | .name = "Deemphasis Switch", | 209 | .name = "Deemphasis Switch", |
202 | .info = daca_info_deemphasis, | 210 | .info = daca_info_deemphasis, |
@@ -219,9 +227,9 @@ static snd_kcontrol_new_t daca_mixers[] = { | |||
219 | 227 | ||
220 | 228 | ||
221 | #ifdef CONFIG_PM | 229 | #ifdef CONFIG_PM |
222 | static void daca_resume(pmac_t *chip) | 230 | static void daca_resume(struct snd_pmac *chip) |
223 | { | 231 | { |
224 | pmac_daca_t *mix = chip->mixer_data; | 232 | struct pmac_daca *mix = chip->mixer_data; |
225 | i2c_smbus_write_byte_data(mix->i2c.client, DACA_REG_SR, 0x08); | 233 | i2c_smbus_write_byte_data(mix->i2c.client, DACA_REG_SR, 0x08); |
226 | i2c_smbus_write_byte_data(mix->i2c.client, DACA_REG_GCFG, | 234 | i2c_smbus_write_byte_data(mix->i2c.client, DACA_REG_GCFG, |
227 | mix->amp_on ? 0x05 : 0x04); | 235 | mix->amp_on ? 0x05 : 0x04); |
@@ -230,9 +238,9 @@ static void daca_resume(pmac_t *chip) | |||
230 | #endif /* CONFIG_PM */ | 238 | #endif /* CONFIG_PM */ |
231 | 239 | ||
232 | 240 | ||
233 | static void daca_cleanup(pmac_t *chip) | 241 | static void daca_cleanup(struct snd_pmac *chip) |
234 | { | 242 | { |
235 | pmac_daca_t *mix = chip->mixer_data; | 243 | struct pmac_daca *mix = chip->mixer_data; |
236 | if (! mix) | 244 | if (! mix) |
237 | return; | 245 | return; |
238 | snd_pmac_keywest_cleanup(&mix->i2c); | 246 | snd_pmac_keywest_cleanup(&mix->i2c); |
@@ -241,10 +249,10 @@ static void daca_cleanup(pmac_t *chip) | |||
241 | } | 249 | } |
242 | 250 | ||
243 | /* exported */ | 251 | /* exported */ |
244 | int __init snd_pmac_daca_init(pmac_t *chip) | 252 | int __init snd_pmac_daca_init(struct snd_pmac *chip) |
245 | { | 253 | { |
246 | int i, err; | 254 | int i, err; |
247 | pmac_daca_t *mix; | 255 | struct pmac_daca *mix; |
248 | 256 | ||
249 | #ifdef CONFIG_KMOD | 257 | #ifdef CONFIG_KMOD |
250 | if (current->fs->root) | 258 | if (current->fs->root) |
diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index df073a05b5..6058c2dd1b 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c | |||
@@ -32,7 +32,7 @@ | |||
32 | * we have to keep a static variable here since i2c attach_adapter | 32 | * we have to keep a static variable here since i2c attach_adapter |
33 | * callback cannot pass a private data. | 33 | * callback cannot pass a private data. |
34 | */ | 34 | */ |
35 | static pmac_keywest_t *keywest_ctx; | 35 | static struct pmac_keywest *keywest_ctx; |
36 | 36 | ||
37 | 37 | ||
38 | #define I2C_DRIVERID_KEYWEST 0xFEBA | 38 | #define I2C_DRIVERID_KEYWEST 0xFEBA |
@@ -41,9 +41,10 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter); | |||
41 | static int keywest_detach_client(struct i2c_client *client); | 41 | static int keywest_detach_client(struct i2c_client *client); |
42 | 42 | ||
43 | struct i2c_driver keywest_driver = { | 43 | struct i2c_driver keywest_driver = { |
44 | .name = "PMac Keywest Audio", | 44 | .driver = { |
45 | .name = "PMac Keywest Audio", | ||
46 | }, | ||
45 | .id = I2C_DRIVERID_KEYWEST, | 47 | .id = I2C_DRIVERID_KEYWEST, |
46 | .flags = I2C_DF_NOTIFY, | ||
47 | .attach_adapter = &keywest_attach_adapter, | 48 | .attach_adapter = &keywest_attach_adapter, |
48 | .detach_client = &keywest_detach_client, | 49 | .detach_client = &keywest_detach_client, |
49 | }; | 50 | }; |
@@ -106,7 +107,7 @@ static int keywest_detach_client(struct i2c_client *client) | |||
106 | } | 107 | } |
107 | 108 | ||
108 | /* exported */ | 109 | /* exported */ |
109 | void snd_pmac_keywest_cleanup(pmac_keywest_t *i2c) | 110 | void snd_pmac_keywest_cleanup(struct pmac_keywest *i2c) |
110 | { | 111 | { |
111 | if (keywest_ctx && keywest_ctx == i2c) { | 112 | if (keywest_ctx && keywest_ctx == i2c) { |
112 | i2c_del_driver(&keywest_driver); | 113 | i2c_del_driver(&keywest_driver); |
@@ -126,7 +127,7 @@ int __init snd_pmac_tumbler_post_init(void) | |||
126 | } | 127 | } |
127 | 128 | ||
128 | /* exported */ | 129 | /* exported */ |
129 | int __init snd_pmac_keywest_init(pmac_keywest_t *i2c) | 130 | int __init snd_pmac_keywest_init(struct pmac_keywest *i2c) |
130 | { | 131 | { |
131 | int err; | 132 | int err; |
132 | 133 | ||
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index db2f1815fc..a642e4cfcf 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c | |||
@@ -36,14 +36,6 @@ | |||
36 | #include <asm/pci-bridge.h> | 36 | #include <asm/pci-bridge.h> |
37 | 37 | ||
38 | 38 | ||
39 | #ifdef CONFIG_PM | ||
40 | static int snd_pmac_register_sleep_notifier(pmac_t *chip); | ||
41 | static int snd_pmac_unregister_sleep_notifier(pmac_t *chip); | ||
42 | static int snd_pmac_suspend(snd_card_t *card, pm_message_t state); | ||
43 | static int snd_pmac_resume(snd_card_t *card); | ||
44 | #endif | ||
45 | |||
46 | |||
47 | /* fixed frequency table for awacs, screamer, burgundy, DACA (44100 max) */ | 39 | /* fixed frequency table for awacs, screamer, burgundy, DACA (44100 max) */ |
48 | static int awacs_freqs[8] = { | 40 | static int awacs_freqs[8] = { |
49 | 44100, 29400, 22050, 17640, 14700, 11025, 8820, 7350 | 41 | 44100, 29400, 22050, 17640, 14700, 11025, 8820, 7350 |
@@ -56,7 +48,7 @@ static int tumbler_freqs[1] = { | |||
56 | /* | 48 | /* |
57 | * allocate DBDMA command arrays | 49 | * allocate DBDMA command arrays |
58 | */ | 50 | */ |
59 | static int snd_pmac_dbdma_alloc(pmac_t *chip, pmac_dbdma_t *rec, int size) | 51 | static int snd_pmac_dbdma_alloc(struct snd_pmac *chip, struct pmac_dbdma *rec, int size) |
60 | { | 52 | { |
61 | unsigned int rsize = sizeof(struct dbdma_cmd) * (size + 1); | 53 | unsigned int rsize = sizeof(struct dbdma_cmd) * (size + 1); |
62 | 54 | ||
@@ -72,7 +64,7 @@ static int snd_pmac_dbdma_alloc(pmac_t *chip, pmac_dbdma_t *rec, int size) | |||
72 | return 0; | 64 | return 0; |
73 | } | 65 | } |
74 | 66 | ||
75 | static void snd_pmac_dbdma_free(pmac_t *chip, pmac_dbdma_t *rec) | 67 | static void snd_pmac_dbdma_free(struct snd_pmac *chip, struct pmac_dbdma *rec) |
76 | { | 68 | { |
77 | if (rec) { | 69 | if (rec) { |
78 | unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1); | 70 | unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1); |
@@ -90,7 +82,7 @@ static void snd_pmac_dbdma_free(pmac_t *chip, pmac_dbdma_t *rec) | |||
90 | * look up frequency table | 82 | * look up frequency table |
91 | */ | 83 | */ |
92 | 84 | ||
93 | unsigned int snd_pmac_rate_index(pmac_t *chip, pmac_stream_t *rec, unsigned int rate) | 85 | unsigned int snd_pmac_rate_index(struct snd_pmac *chip, struct pmac_stream *rec, unsigned int rate) |
94 | { | 86 | { |
95 | int i, ok, found; | 87 | int i, ok, found; |
96 | 88 | ||
@@ -119,8 +111,8 @@ static inline int another_stream(int stream) | |||
119 | /* | 111 | /* |
120 | * allocate buffers | 112 | * allocate buffers |
121 | */ | 113 | */ |
122 | static int snd_pmac_pcm_hw_params(snd_pcm_substream_t *subs, | 114 | static int snd_pmac_pcm_hw_params(struct snd_pcm_substream *subs, |
123 | snd_pcm_hw_params_t *hw_params) | 115 | struct snd_pcm_hw_params *hw_params) |
124 | { | 116 | { |
125 | return snd_pcm_lib_malloc_pages(subs, params_buffer_bytes(hw_params)); | 117 | return snd_pcm_lib_malloc_pages(subs, params_buffer_bytes(hw_params)); |
126 | } | 118 | } |
@@ -128,7 +120,7 @@ static int snd_pmac_pcm_hw_params(snd_pcm_substream_t *subs, | |||
128 | /* | 120 | /* |
129 | * release buffers | 121 | * release buffers |
130 | */ | 122 | */ |
131 | static int snd_pmac_pcm_hw_free(snd_pcm_substream_t *subs) | 123 | static int snd_pmac_pcm_hw_free(struct snd_pcm_substream *subs) |
132 | { | 124 | { |
133 | snd_pcm_lib_free_pages(subs); | 125 | snd_pcm_lib_free_pages(subs); |
134 | return 0; | 126 | return 0; |
@@ -137,7 +129,7 @@ static int snd_pmac_pcm_hw_free(snd_pcm_substream_t *subs) | |||
137 | /* | 129 | /* |
138 | * get a stream of the opposite direction | 130 | * get a stream of the opposite direction |
139 | */ | 131 | */ |
140 | static pmac_stream_t *snd_pmac_get_stream(pmac_t *chip, int stream) | 132 | static struct pmac_stream *snd_pmac_get_stream(struct snd_pmac *chip, int stream) |
141 | { | 133 | { |
142 | switch (stream) { | 134 | switch (stream) { |
143 | case SNDRV_PCM_STREAM_PLAYBACK: | 135 | case SNDRV_PCM_STREAM_PLAYBACK: |
@@ -154,7 +146,7 @@ static pmac_stream_t *snd_pmac_get_stream(pmac_t *chip, int stream) | |||
154 | * wait while run status is on | 146 | * wait while run status is on |
155 | */ | 147 | */ |
156 | static inline void | 148 | static inline void |
157 | snd_pmac_wait_ack(pmac_stream_t *rec) | 149 | snd_pmac_wait_ack(struct pmac_stream *rec) |
158 | { | 150 | { |
159 | int timeout = 50000; | 151 | int timeout = 50000; |
160 | while ((in_le32(&rec->dma->status) & RUN) && timeout-- > 0) | 152 | while ((in_le32(&rec->dma->status) & RUN) && timeout-- > 0) |
@@ -165,7 +157,7 @@ snd_pmac_wait_ack(pmac_stream_t *rec) | |||
165 | * set the format and rate to the chip. | 157 | * set the format and rate to the chip. |
166 | * call the lowlevel function if defined (e.g. for AWACS). | 158 | * call the lowlevel function if defined (e.g. for AWACS). |
167 | */ | 159 | */ |
168 | static void snd_pmac_pcm_set_format(pmac_t *chip) | 160 | static void snd_pmac_pcm_set_format(struct snd_pmac *chip) |
169 | { | 161 | { |
170 | /* set up frequency and format */ | 162 | /* set up frequency and format */ |
171 | out_le32(&chip->awacs->control, chip->control_mask | (chip->rate_index << 8)); | 163 | out_le32(&chip->awacs->control, chip->control_mask | (chip->rate_index << 8)); |
@@ -177,7 +169,7 @@ static void snd_pmac_pcm_set_format(pmac_t *chip) | |||
177 | /* | 169 | /* |
178 | * stop the DMA transfer | 170 | * stop the DMA transfer |
179 | */ | 171 | */ |
180 | static inline void snd_pmac_dma_stop(pmac_stream_t *rec) | 172 | static inline void snd_pmac_dma_stop(struct pmac_stream *rec) |
181 | { | 173 | { |
182 | out_le32(&rec->dma->control, (RUN|WAKE|FLUSH|PAUSE) << 16); | 174 | out_le32(&rec->dma->control, (RUN|WAKE|FLUSH|PAUSE) << 16); |
183 | snd_pmac_wait_ack(rec); | 175 | snd_pmac_wait_ack(rec); |
@@ -186,7 +178,7 @@ static inline void snd_pmac_dma_stop(pmac_stream_t *rec) | |||
186 | /* | 178 | /* |
187 | * set the command pointer address | 179 | * set the command pointer address |
188 | */ | 180 | */ |
189 | static inline void snd_pmac_dma_set_command(pmac_stream_t *rec, pmac_dbdma_t *cmd) | 181 | static inline void snd_pmac_dma_set_command(struct pmac_stream *rec, struct pmac_dbdma *cmd) |
190 | { | 182 | { |
191 | out_le32(&rec->dma->cmdptr, cmd->addr); | 183 | out_le32(&rec->dma->cmdptr, cmd->addr); |
192 | } | 184 | } |
@@ -194,7 +186,7 @@ static inline void snd_pmac_dma_set_command(pmac_stream_t *rec, pmac_dbdma_t *cm | |||
194 | /* | 186 | /* |
195 | * start the DMA | 187 | * start the DMA |
196 | */ | 188 | */ |
197 | static inline void snd_pmac_dma_run(pmac_stream_t *rec, int status) | 189 | static inline void snd_pmac_dma_run(struct pmac_stream *rec, int status) |
198 | { | 190 | { |
199 | out_le32(&rec->dma->control, status | (status << 16)); | 191 | out_le32(&rec->dma->control, status | (status << 16)); |
200 | } | 192 | } |
@@ -203,14 +195,14 @@ static inline void snd_pmac_dma_run(pmac_stream_t *rec, int status) | |||
203 | /* | 195 | /* |
204 | * prepare playback/capture stream | 196 | * prepare playback/capture stream |
205 | */ | 197 | */ |
206 | static int snd_pmac_pcm_prepare(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substream_t *subs) | 198 | static int snd_pmac_pcm_prepare(struct snd_pmac *chip, struct pmac_stream *rec, struct snd_pcm_substream *subs) |
207 | { | 199 | { |
208 | int i; | 200 | int i; |
209 | volatile struct dbdma_cmd __iomem *cp; | 201 | volatile struct dbdma_cmd __iomem *cp; |
210 | snd_pcm_runtime_t *runtime = subs->runtime; | 202 | struct snd_pcm_runtime *runtime = subs->runtime; |
211 | int rate_index; | 203 | int rate_index; |
212 | long offset; | 204 | long offset; |
213 | pmac_stream_t *astr; | 205 | struct pmac_stream *astr; |
214 | 206 | ||
215 | rec->dma_size = snd_pcm_lib_buffer_bytes(subs); | 207 | rec->dma_size = snd_pcm_lib_buffer_bytes(subs); |
216 | rec->period_size = snd_pcm_lib_period_bytes(subs); | 208 | rec->period_size = snd_pcm_lib_period_bytes(subs); |
@@ -267,8 +259,8 @@ static int snd_pmac_pcm_prepare(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substr | |||
267 | /* | 259 | /* |
268 | * PCM trigger/stop | 260 | * PCM trigger/stop |
269 | */ | 261 | */ |
270 | static int snd_pmac_pcm_trigger(pmac_t *chip, pmac_stream_t *rec, | 262 | static int snd_pmac_pcm_trigger(struct snd_pmac *chip, struct pmac_stream *rec, |
271 | snd_pcm_substream_t *subs, int cmd) | 263 | struct snd_pcm_substream *subs, int cmd) |
272 | { | 264 | { |
273 | volatile struct dbdma_cmd __iomem *cp; | 265 | volatile struct dbdma_cmd __iomem *cp; |
274 | int i, command; | 266 | int i, command; |
@@ -314,8 +306,9 @@ static int snd_pmac_pcm_trigger(pmac_t *chip, pmac_stream_t *rec, | |||
314 | * return the current pointer | 306 | * return the current pointer |
315 | */ | 307 | */ |
316 | inline | 308 | inline |
317 | static snd_pcm_uframes_t snd_pmac_pcm_pointer(pmac_t *chip, pmac_stream_t *rec, | 309 | static snd_pcm_uframes_t snd_pmac_pcm_pointer(struct snd_pmac *chip, |
318 | snd_pcm_substream_t *subs) | 310 | struct pmac_stream *rec, |
311 | struct snd_pcm_substream *subs) | ||
319 | { | 312 | { |
320 | int count = 0; | 313 | int count = 0; |
321 | 314 | ||
@@ -338,22 +331,22 @@ static snd_pcm_uframes_t snd_pmac_pcm_pointer(pmac_t *chip, pmac_stream_t *rec, | |||
338 | * playback | 331 | * playback |
339 | */ | 332 | */ |
340 | 333 | ||
341 | static int snd_pmac_playback_prepare(snd_pcm_substream_t *subs) | 334 | static int snd_pmac_playback_prepare(struct snd_pcm_substream *subs) |
342 | { | 335 | { |
343 | pmac_t *chip = snd_pcm_substream_chip(subs); | 336 | struct snd_pmac *chip = snd_pcm_substream_chip(subs); |
344 | return snd_pmac_pcm_prepare(chip, &chip->playback, subs); | 337 | return snd_pmac_pcm_prepare(chip, &chip->playback, subs); |
345 | } | 338 | } |
346 | 339 | ||
347 | static int snd_pmac_playback_trigger(snd_pcm_substream_t *subs, | 340 | static int snd_pmac_playback_trigger(struct snd_pcm_substream *subs, |
348 | int cmd) | 341 | int cmd) |
349 | { | 342 | { |
350 | pmac_t *chip = snd_pcm_substream_chip(subs); | 343 | struct snd_pmac *chip = snd_pcm_substream_chip(subs); |
351 | return snd_pmac_pcm_trigger(chip, &chip->playback, subs, cmd); | 344 | return snd_pmac_pcm_trigger(chip, &chip->playback, subs, cmd); |
352 | } | 345 | } |
353 | 346 | ||
354 | static snd_pcm_uframes_t snd_pmac_playback_pointer(snd_pcm_substream_t *subs) | 347 | static snd_pcm_uframes_t snd_pmac_playback_pointer(struct snd_pcm_substream *subs) |
355 | { | 348 | { |
356 | pmac_t *chip = snd_pcm_substream_chip(subs); | 349 | struct snd_pmac *chip = snd_pcm_substream_chip(subs); |
357 | return snd_pmac_pcm_pointer(chip, &chip->playback, subs); | 350 | return snd_pmac_pcm_pointer(chip, &chip->playback, subs); |
358 | } | 351 | } |
359 | 352 | ||
@@ -362,22 +355,22 @@ static snd_pcm_uframes_t snd_pmac_playback_pointer(snd_pcm_substream_t *subs) | |||
362 | * capture | 355 | * capture |
363 | */ | 356 | */ |
364 | 357 | ||
365 | static int snd_pmac_capture_prepare(snd_pcm_substream_t *subs) | 358 | static int snd_pmac_capture_prepare(struct snd_pcm_substream *subs) |
366 | { | 359 | { |
367 | pmac_t *chip = snd_pcm_substream_chip(subs); | 360 | struct snd_pmac *chip = snd_pcm_substream_chip(subs); |
368 | return snd_pmac_pcm_prepare(chip, &chip->capture, subs); | 361 | return snd_pmac_pcm_prepare(chip, &chip->capture, subs); |
369 | } | 362 | } |
370 | 363 | ||
371 | static int snd_pmac_capture_trigger(snd_pcm_substream_t *subs, | 364 | static int snd_pmac_capture_trigger(struct snd_pcm_substream *subs, |
372 | int cmd) | 365 | int cmd) |
373 | { | 366 | { |
374 | pmac_t *chip = snd_pcm_substream_chip(subs); | 367 | struct snd_pmac *chip = snd_pcm_substream_chip(subs); |
375 | return snd_pmac_pcm_trigger(chip, &chip->capture, subs, cmd); | 368 | return snd_pmac_pcm_trigger(chip, &chip->capture, subs, cmd); |
376 | } | 369 | } |
377 | 370 | ||
378 | static snd_pcm_uframes_t snd_pmac_capture_pointer(snd_pcm_substream_t *subs) | 371 | static snd_pcm_uframes_t snd_pmac_capture_pointer(struct snd_pcm_substream *subs) |
379 | { | 372 | { |
380 | pmac_t *chip = snd_pcm_substream_chip(subs); | 373 | struct snd_pmac *chip = snd_pcm_substream_chip(subs); |
381 | return snd_pmac_pcm_pointer(chip, &chip->capture, subs); | 374 | return snd_pmac_pcm_pointer(chip, &chip->capture, subs); |
382 | } | 375 | } |
383 | 376 | ||
@@ -385,7 +378,7 @@ static snd_pcm_uframes_t snd_pmac_capture_pointer(snd_pcm_substream_t *subs) | |||
385 | /* | 378 | /* |
386 | * update playback/capture pointer from interrupts | 379 | * update playback/capture pointer from interrupts |
387 | */ | 380 | */ |
388 | static void snd_pmac_pcm_update(pmac_t *chip, pmac_stream_t *rec) | 381 | static void snd_pmac_pcm_update(struct snd_pmac *chip, struct pmac_stream *rec) |
389 | { | 382 | { |
390 | volatile struct dbdma_cmd __iomem *cp; | 383 | volatile struct dbdma_cmd __iomem *cp; |
391 | int c; | 384 | int c; |
@@ -421,7 +414,7 @@ static void snd_pmac_pcm_update(pmac_t *chip, pmac_stream_t *rec) | |||
421 | * hw info | 414 | * hw info |
422 | */ | 415 | */ |
423 | 416 | ||
424 | static snd_pcm_hardware_t snd_pmac_playback = | 417 | static struct snd_pcm_hardware snd_pmac_playback = |
425 | { | 418 | { |
426 | .info = (SNDRV_PCM_INFO_INTERLEAVED | | 419 | .info = (SNDRV_PCM_INFO_INTERLEAVED | |
427 | SNDRV_PCM_INFO_MMAP | | 420 | SNDRV_PCM_INFO_MMAP | |
@@ -440,7 +433,7 @@ static snd_pcm_hardware_t snd_pmac_playback = | |||
440 | .periods_max = PMAC_MAX_FRAGS, | 433 | .periods_max = PMAC_MAX_FRAGS, |
441 | }; | 434 | }; |
442 | 435 | ||
443 | static snd_pcm_hardware_t snd_pmac_capture = | 436 | static struct snd_pcm_hardware snd_pmac_capture = |
444 | { | 437 | { |
445 | .info = (SNDRV_PCM_INFO_INTERLEAVED | | 438 | .info = (SNDRV_PCM_INFO_INTERLEAVED | |
446 | SNDRV_PCM_INFO_MMAP | | 439 | SNDRV_PCM_INFO_MMAP | |
@@ -461,11 +454,11 @@ static snd_pcm_hardware_t snd_pmac_capture = | |||
461 | 454 | ||
462 | 455 | ||
463 | #if 0 // NYI | 456 | #if 0 // NYI |
464 | static int snd_pmac_hw_rule_rate(snd_pcm_hw_params_t *params, | 457 | static int snd_pmac_hw_rule_rate(struct snd_pcm_hw_params *params, |
465 | snd_pcm_hw_rule_t *rule) | 458 | struct snd_pcm_hw_rule *rule) |
466 | { | 459 | { |
467 | pmac_t *chip = rule->private; | 460 | struct snd_pmac *chip = rule->private; |
468 | pmac_stream_t *rec = snd_pmac_get_stream(chip, rule->deps[0]); | 461 | struct pmac_stream *rec = snd_pmac_get_stream(chip, rule->deps[0]); |
469 | int i, freq_table[8], num_freqs; | 462 | int i, freq_table[8], num_freqs; |
470 | 463 | ||
471 | if (! rec) | 464 | if (! rec) |
@@ -480,11 +473,11 @@ static int snd_pmac_hw_rule_rate(snd_pcm_hw_params_t *params, | |||
480 | num_freqs, freq_table, 0); | 473 | num_freqs, freq_table, 0); |
481 | } | 474 | } |
482 | 475 | ||
483 | static int snd_pmac_hw_rule_format(snd_pcm_hw_params_t *params, | 476 | static int snd_pmac_hw_rule_format(struct snd_pcm_hw_params *params, |
484 | snd_pcm_hw_rule_t *rule) | 477 | struct snd_pcm_hw_rule *rule) |
485 | { | 478 | { |
486 | pmac_t *chip = rule->private; | 479 | struct snd_pmac *chip = rule->private; |
487 | pmac_stream_t *rec = snd_pmac_get_stream(chip, rule->deps[0]); | 480 | struct pmac_stream *rec = snd_pmac_get_stream(chip, rule->deps[0]); |
488 | 481 | ||
489 | if (! rec) | 482 | if (! rec) |
490 | return -EINVAL; | 483 | return -EINVAL; |
@@ -493,9 +486,10 @@ static int snd_pmac_hw_rule_format(snd_pcm_hw_params_t *params, | |||
493 | } | 486 | } |
494 | #endif // NYI | 487 | #endif // NYI |
495 | 488 | ||
496 | static int snd_pmac_pcm_open(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substream_t *subs) | 489 | static int snd_pmac_pcm_open(struct snd_pmac *chip, struct pmac_stream *rec, |
490 | struct snd_pcm_substream *subs) | ||
497 | { | 491 | { |
498 | snd_pcm_runtime_t *runtime = subs->runtime; | 492 | struct snd_pcm_runtime *runtime = subs->runtime; |
499 | int i, j, fflags; | 493 | int i, j, fflags; |
500 | static int typical_freqs[] = { | 494 | static int typical_freqs[] = { |
501 | 44100, | 495 | 44100, |
@@ -565,9 +559,10 @@ static int snd_pmac_pcm_open(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substream | |||
565 | return 0; | 559 | return 0; |
566 | } | 560 | } |
567 | 561 | ||
568 | static int snd_pmac_pcm_close(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substream_t *subs) | 562 | static int snd_pmac_pcm_close(struct snd_pmac *chip, struct pmac_stream *rec, |
563 | struct snd_pcm_substream *subs) | ||
569 | { | 564 | { |
570 | pmac_stream_t *astr; | 565 | struct pmac_stream *astr; |
571 | 566 | ||
572 | snd_pmac_dma_stop(rec); | 567 | snd_pmac_dma_stop(rec); |
573 | 568 | ||
@@ -582,32 +577,32 @@ static int snd_pmac_pcm_close(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substrea | |||
582 | return 0; | 577 | return 0; |
583 | } | 578 | } |
584 | 579 | ||
585 | static int snd_pmac_playback_open(snd_pcm_substream_t *subs) | 580 | static int snd_pmac_playback_open(struct snd_pcm_substream *subs) |
586 | { | 581 | { |
587 | pmac_t *chip = snd_pcm_substream_chip(subs); | 582 | struct snd_pmac *chip = snd_pcm_substream_chip(subs); |
588 | 583 | ||
589 | subs->runtime->hw = snd_pmac_playback; | 584 | subs->runtime->hw = snd_pmac_playback; |
590 | return snd_pmac_pcm_open(chip, &chip->playback, subs); | 585 | return snd_pmac_pcm_open(chip, &chip->playback, subs); |
591 | } | 586 | } |
592 | 587 | ||
593 | static int snd_pmac_capture_open(snd_pcm_substream_t *subs) | 588 | static int snd_pmac_capture_open(struct snd_pcm_substream *subs) |
594 | { | 589 | { |
595 | pmac_t *chip = snd_pcm_substream_chip(subs); | 590 | struct snd_pmac *chip = snd_pcm_substream_chip(subs); |
596 | 591 | ||
597 | subs->runtime->hw = snd_pmac_capture; | 592 | subs->runtime->hw = snd_pmac_capture; |
598 | return snd_pmac_pcm_open(chip, &chip->capture, subs); | 593 | return snd_pmac_pcm_open(chip, &chip->capture, subs); |
599 | } | 594 | } |
600 | 595 | ||
601 | static int snd_pmac_playback_close(snd_pcm_substream_t *subs) | 596 | static int snd_pmac_playback_close(struct snd_pcm_substream *subs) |
602 | { | 597 | { |
603 | pmac_t *chip = snd_pcm_substream_chip(subs); | 598 | struct snd_pmac *chip = snd_pcm_substream_chip(subs); |
604 | 599 | ||
605 | return snd_pmac_pcm_close(chip, &chip->playback, subs); | 600 | return snd_pmac_pcm_close(chip, &chip->playback, subs); |
606 | } | 601 | } |
607 | 602 | ||
608 | static int snd_pmac_capture_close(snd_pcm_substream_t *subs) | 603 | static int snd_pmac_capture_close(struct snd_pcm_substream *subs) |
609 | { | 604 | { |
610 | pmac_t *chip = snd_pcm_substream_chip(subs); | 605 | struct snd_pmac *chip = snd_pcm_substream_chip(subs); |
611 | 606 | ||
612 | return snd_pmac_pcm_close(chip, &chip->capture, subs); | 607 | return snd_pmac_pcm_close(chip, &chip->capture, subs); |
613 | } | 608 | } |
@@ -615,7 +610,7 @@ static int snd_pmac_capture_close(snd_pcm_substream_t *subs) | |||
615 | /* | 610 | /* |
616 | */ | 611 | */ |
617 | 612 | ||
618 | static snd_pcm_ops_t snd_pmac_playback_ops = { | 613 | static struct snd_pcm_ops snd_pmac_playback_ops = { |
619 | .open = snd_pmac_playback_open, | 614 | .open = snd_pmac_playback_open, |
620 | .close = snd_pmac_playback_close, | 615 | .close = snd_pmac_playback_close, |
621 | .ioctl = snd_pcm_lib_ioctl, | 616 | .ioctl = snd_pcm_lib_ioctl, |
@@ -626,7 +621,7 @@ static snd_pcm_ops_t snd_pmac_playback_ops = { | |||
626 | .pointer = snd_pmac_playback_pointer, | 621 | .pointer = snd_pmac_playback_pointer, |
627 | }; | 622 | }; |
628 | 623 | ||
629 | static snd_pcm_ops_t snd_pmac_capture_ops = { | 624 | static struct snd_pcm_ops snd_pmac_capture_ops = { |
630 | .open = snd_pmac_capture_open, | 625 | .open = snd_pmac_capture_open, |
631 | .close = snd_pmac_capture_close, | 626 | .close = snd_pmac_capture_close, |
632 | .ioctl = snd_pcm_lib_ioctl, | 627 | .ioctl = snd_pcm_lib_ioctl, |
@@ -637,14 +632,9 @@ static snd_pcm_ops_t snd_pmac_capture_ops = { | |||
637 | .pointer = snd_pmac_capture_pointer, | 632 | .pointer = snd_pmac_capture_pointer, |
638 | }; | 633 | }; |
639 | 634 | ||
640 | static void pmac_pcm_free(snd_pcm_t *pcm) | 635 | int __init snd_pmac_pcm_new(struct snd_pmac *chip) |
641 | { | 636 | { |
642 | snd_pcm_lib_preallocate_free_for_all(pcm); | 637 | struct snd_pcm *pcm; |
643 | } | ||
644 | |||
645 | int __init snd_pmac_pcm_new(pmac_t *chip) | ||
646 | { | ||
647 | snd_pcm_t *pcm; | ||
648 | int err; | 638 | int err; |
649 | int num_captures = 1; | 639 | int num_captures = 1; |
650 | 640 | ||
@@ -659,7 +649,6 @@ int __init snd_pmac_pcm_new(pmac_t *chip) | |||
659 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_pmac_capture_ops); | 649 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_pmac_capture_ops); |
660 | 650 | ||
661 | pcm->private_data = chip; | 651 | pcm->private_data = chip; |
662 | pcm->private_free = pmac_pcm_free; | ||
663 | pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX; | 652 | pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX; |
664 | strcpy(pcm->name, chip->card->shortname); | 653 | strcpy(pcm->name, chip->card->shortname); |
665 | chip->pcm = pcm; | 654 | chip->pcm = pcm; |
@@ -682,7 +671,7 @@ int __init snd_pmac_pcm_new(pmac_t *chip) | |||
682 | } | 671 | } |
683 | 672 | ||
684 | 673 | ||
685 | static void snd_pmac_dbdma_reset(pmac_t *chip) | 674 | static void snd_pmac_dbdma_reset(struct snd_pmac *chip) |
686 | { | 675 | { |
687 | out_le32(&chip->playback.dma->control, (RUN|PAUSE|FLUSH|WAKE|DEAD) << 16); | 676 | out_le32(&chip->playback.dma->control, (RUN|PAUSE|FLUSH|WAKE|DEAD) << 16); |
688 | snd_pmac_wait_ack(&chip->playback); | 677 | snd_pmac_wait_ack(&chip->playback); |
@@ -694,9 +683,9 @@ static void snd_pmac_dbdma_reset(pmac_t *chip) | |||
694 | /* | 683 | /* |
695 | * handling beep | 684 | * handling beep |
696 | */ | 685 | */ |
697 | void snd_pmac_beep_dma_start(pmac_t *chip, int bytes, unsigned long addr, int speed) | 686 | void snd_pmac_beep_dma_start(struct snd_pmac *chip, int bytes, unsigned long addr, int speed) |
698 | { | 687 | { |
699 | pmac_stream_t *rec = &chip->playback; | 688 | struct pmac_stream *rec = &chip->playback; |
700 | 689 | ||
701 | snd_pmac_dma_stop(rec); | 690 | snd_pmac_dma_stop(rec); |
702 | st_le16(&chip->extra_dma.cmds->req_count, bytes); | 691 | st_le16(&chip->extra_dma.cmds->req_count, bytes); |
@@ -712,7 +701,7 @@ void snd_pmac_beep_dma_start(pmac_t *chip, int bytes, unsigned long addr, int sp | |||
712 | snd_pmac_dma_run(rec, RUN); | 701 | snd_pmac_dma_run(rec, RUN); |
713 | } | 702 | } |
714 | 703 | ||
715 | void snd_pmac_beep_dma_stop(pmac_t *chip) | 704 | void snd_pmac_beep_dma_stop(struct snd_pmac *chip) |
716 | { | 705 | { |
717 | snd_pmac_dma_stop(&chip->playback); | 706 | snd_pmac_dma_stop(&chip->playback); |
718 | st_le16(&chip->extra_dma.cmds->command, DBDMA_STOP); | 707 | st_le16(&chip->extra_dma.cmds->command, DBDMA_STOP); |
@@ -726,7 +715,7 @@ void snd_pmac_beep_dma_stop(pmac_t *chip) | |||
726 | static irqreturn_t | 715 | static irqreturn_t |
727 | snd_pmac_tx_intr(int irq, void *devid, struct pt_regs *regs) | 716 | snd_pmac_tx_intr(int irq, void *devid, struct pt_regs *regs) |
728 | { | 717 | { |
729 | pmac_t *chip = devid; | 718 | struct snd_pmac *chip = devid; |
730 | snd_pmac_pcm_update(chip, &chip->playback); | 719 | snd_pmac_pcm_update(chip, &chip->playback); |
731 | return IRQ_HANDLED; | 720 | return IRQ_HANDLED; |
732 | } | 721 | } |
@@ -735,7 +724,7 @@ snd_pmac_tx_intr(int irq, void *devid, struct pt_regs *regs) | |||
735 | static irqreturn_t | 724 | static irqreturn_t |
736 | snd_pmac_rx_intr(int irq, void *devid, struct pt_regs *regs) | 725 | snd_pmac_rx_intr(int irq, void *devid, struct pt_regs *regs) |
737 | { | 726 | { |
738 | pmac_t *chip = devid; | 727 | struct snd_pmac *chip = devid; |
739 | snd_pmac_pcm_update(chip, &chip->capture); | 728 | snd_pmac_pcm_update(chip, &chip->capture); |
740 | return IRQ_HANDLED; | 729 | return IRQ_HANDLED; |
741 | } | 730 | } |
@@ -744,7 +733,7 @@ snd_pmac_rx_intr(int irq, void *devid, struct pt_regs *regs) | |||
744 | static irqreturn_t | 733 | static irqreturn_t |
745 | snd_pmac_ctrl_intr(int irq, void *devid, struct pt_regs *regs) | 734 | snd_pmac_ctrl_intr(int irq, void *devid, struct pt_regs *regs) |
746 | { | 735 | { |
747 | pmac_t *chip = devid; | 736 | struct snd_pmac *chip = devid; |
748 | int ctrl = in_le32(&chip->awacs->control); | 737 | int ctrl = in_le32(&chip->awacs->control); |
749 | 738 | ||
750 | /*printk("pmac: control interrupt.. 0x%x\n", ctrl);*/ | 739 | /*printk("pmac: control interrupt.. 0x%x\n", ctrl);*/ |
@@ -767,7 +756,7 @@ snd_pmac_ctrl_intr(int irq, void *devid, struct pt_regs *regs) | |||
767 | /* | 756 | /* |
768 | * a wrapper to feature call for compatibility | 757 | * a wrapper to feature call for compatibility |
769 | */ | 758 | */ |
770 | static void snd_pmac_sound_feature(pmac_t *chip, int enable) | 759 | static void snd_pmac_sound_feature(struct snd_pmac *chip, int enable) |
771 | { | 760 | { |
772 | if (ppc_md.feature_call) | 761 | if (ppc_md.feature_call) |
773 | ppc_md.feature_call(PMAC_FTR_SOUND_CHIP_ENABLE, chip->node, 0, enable); | 762 | ppc_md.feature_call(PMAC_FTR_SOUND_CHIP_ENABLE, chip->node, 0, enable); |
@@ -777,7 +766,7 @@ static void snd_pmac_sound_feature(pmac_t *chip, int enable) | |||
777 | * release resources | 766 | * release resources |
778 | */ | 767 | */ |
779 | 768 | ||
780 | static int snd_pmac_free(pmac_t *chip) | 769 | static int snd_pmac_free(struct snd_pmac *chip) |
781 | { | 770 | { |
782 | /* stop sounds */ | 771 | /* stop sounds */ |
783 | if (chip->initialized) { | 772 | if (chip->initialized) { |
@@ -787,9 +776,6 @@ static int snd_pmac_free(pmac_t *chip) | |||
787 | } | 776 | } |
788 | 777 | ||
789 | snd_pmac_sound_feature(chip, 0); | 778 | snd_pmac_sound_feature(chip, 0); |
790 | #ifdef CONFIG_PM | ||
791 | snd_pmac_unregister_sleep_notifier(chip); | ||
792 | #endif | ||
793 | 779 | ||
794 | /* clean up mixer if any */ | 780 | /* clean up mixer if any */ |
795 | if (chip->mixer_free) | 781 | if (chip->mixer_free) |
@@ -817,21 +803,17 @@ static int snd_pmac_free(pmac_t *chip) | |||
817 | iounmap(chip->playback.dma); | 803 | iounmap(chip->playback.dma); |
818 | if (chip->capture.dma) | 804 | if (chip->capture.dma) |
819 | iounmap(chip->capture.dma); | 805 | iounmap(chip->capture.dma); |
820 | #ifndef CONFIG_PPC64 | 806 | |
821 | if (chip->node) { | 807 | if (chip->node) { |
822 | int i; | 808 | int i; |
823 | |||
824 | for (i = 0; i < 3; i++) { | 809 | for (i = 0; i < 3; i++) { |
825 | if (chip->of_requested & (1 << i)) { | 810 | if (chip->requested & (1 << i)) |
826 | if (chip->is_k2) | 811 | release_mem_region(chip->rsrc[i].start, |
827 | release_OF_resource(chip->node->parent, | 812 | chip->rsrc[i].end - |
828 | i); | 813 | chip->rsrc[i].start + 1); |
829 | else | ||
830 | release_OF_resource(chip->node, i); | ||
831 | } | ||
832 | } | 814 | } |
833 | } | 815 | } |
834 | #endif /* CONFIG_PPC64 */ | 816 | |
835 | if (chip->pdev) | 817 | if (chip->pdev) |
836 | pci_dev_put(chip->pdev); | 818 | pci_dev_put(chip->pdev); |
837 | kfree(chip); | 819 | kfree(chip); |
@@ -842,9 +824,9 @@ static int snd_pmac_free(pmac_t *chip) | |||
842 | /* | 824 | /* |
843 | * free the device | 825 | * free the device |
844 | */ | 826 | */ |
845 | static int snd_pmac_dev_free(snd_device_t *device) | 827 | static int snd_pmac_dev_free(struct snd_device *device) |
846 | { | 828 | { |
847 | pmac_t *chip = device->device_data; | 829 | struct snd_pmac *chip = device->device_data; |
848 | return snd_pmac_free(chip); | 830 | return snd_pmac_free(chip); |
849 | } | 831 | } |
850 | 832 | ||
@@ -853,7 +835,7 @@ static int snd_pmac_dev_free(snd_device_t *device) | |||
853 | * check the machine support byteswap (little-endian) | 835 | * check the machine support byteswap (little-endian) |
854 | */ | 836 | */ |
855 | 837 | ||
856 | static void __init detect_byte_swap(pmac_t *chip) | 838 | static void __init detect_byte_swap(struct snd_pmac *chip) |
857 | { | 839 | { |
858 | struct device_node *mio; | 840 | struct device_node *mio; |
859 | 841 | ||
@@ -879,7 +861,7 @@ static void __init detect_byte_swap(pmac_t *chip) | |||
879 | /* | 861 | /* |
880 | * detect a sound chip | 862 | * detect a sound chip |
881 | */ | 863 | */ |
882 | static int __init snd_pmac_detect(pmac_t *chip) | 864 | static int __init snd_pmac_detect(struct snd_pmac *chip) |
883 | { | 865 | { |
884 | struct device_node *sound = NULL; | 866 | struct device_node *sound = NULL; |
885 | unsigned int *prop, l; | 867 | unsigned int *prop, l; |
@@ -987,11 +969,11 @@ static int __init snd_pmac_detect(pmac_t *chip) | |||
987 | * single frequency until proper i2s control is implemented | 969 | * single frequency until proper i2s control is implemented |
988 | */ | 970 | */ |
989 | switch(layout_id) { | 971 | switch(layout_id) { |
990 | case 0x48: | ||
991 | case 0x46: | ||
992 | case 0x33: | ||
993 | case 0x29: | ||
994 | case 0x24: | 972 | case 0x24: |
973 | case 0x29: | ||
974 | case 0x33: | ||
975 | case 0x46: | ||
976 | case 0x48: | ||
995 | case 0x50: | 977 | case 0x50: |
996 | case 0x5c: | 978 | case 0x5c: |
997 | chip->num_freqs = ARRAY_SIZE(tumbler_freqs); | 979 | chip->num_freqs = ARRAY_SIZE(tumbler_freqs); |
@@ -1005,6 +987,11 @@ static int __init snd_pmac_detect(pmac_t *chip) | |||
1005 | chip->can_byte_swap = 0; /* FIXME: check this */ | 987 | chip->can_byte_swap = 0; /* FIXME: check this */ |
1006 | chip->control_mask = MASK_IEPC | 0x11;/* disable IEE */ | 988 | chip->control_mask = MASK_IEPC | 0x11;/* disable IEE */ |
1007 | break; | 989 | break; |
990 | default: | ||
991 | printk(KERN_ERR "snd: Unknown layout ID 0x%x\n", | ||
992 | layout_id); | ||
993 | return -ENODEV; | ||
994 | |||
1008 | } | 995 | } |
1009 | } | 996 | } |
1010 | prop = (unsigned int *)get_property(sound, "device-id", NULL); | 997 | prop = (unsigned int *)get_property(sound, "device-id", NULL); |
@@ -1067,8 +1054,8 @@ static int __init snd_pmac_detect(pmac_t *chip) | |||
1067 | /* | 1054 | /* |
1068 | * exported - boolean info callbacks for ease of programming | 1055 | * exported - boolean info callbacks for ease of programming |
1069 | */ | 1056 | */ |
1070 | int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol, | 1057 | int snd_pmac_boolean_stereo_info(struct snd_kcontrol *kcontrol, |
1071 | snd_ctl_elem_info_t *uinfo) | 1058 | struct snd_ctl_elem_info *uinfo) |
1072 | { | 1059 | { |
1073 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | 1060 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
1074 | uinfo->count = 2; | 1061 | uinfo->count = 2; |
@@ -1077,8 +1064,8 @@ int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol, | |||
1077 | return 0; | 1064 | return 0; |
1078 | } | 1065 | } |
1079 | 1066 | ||
1080 | int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol, | 1067 | int snd_pmac_boolean_mono_info(struct snd_kcontrol *kcontrol, |
1081 | snd_ctl_elem_info_t *uinfo) | 1068 | struct snd_ctl_elem_info *uinfo) |
1082 | { | 1069 | { |
1083 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | 1070 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
1084 | uinfo->count = 1; | 1071 | uinfo->count = 1; |
@@ -1091,16 +1078,18 @@ int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol, | |||
1091 | /* | 1078 | /* |
1092 | * auto-mute | 1079 | * auto-mute |
1093 | */ | 1080 | */ |
1094 | static int pmac_auto_mute_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 1081 | static int pmac_auto_mute_get(struct snd_kcontrol *kcontrol, |
1082 | struct snd_ctl_elem_value *ucontrol) | ||
1095 | { | 1083 | { |
1096 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 1084 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
1097 | ucontrol->value.integer.value[0] = chip->auto_mute; | 1085 | ucontrol->value.integer.value[0] = chip->auto_mute; |
1098 | return 0; | 1086 | return 0; |
1099 | } | 1087 | } |
1100 | 1088 | ||
1101 | static int pmac_auto_mute_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 1089 | static int pmac_auto_mute_put(struct snd_kcontrol *kcontrol, |
1090 | struct snd_ctl_elem_value *ucontrol) | ||
1102 | { | 1091 | { |
1103 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 1092 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
1104 | if (ucontrol->value.integer.value[0] != chip->auto_mute) { | 1093 | if (ucontrol->value.integer.value[0] != chip->auto_mute) { |
1105 | chip->auto_mute = ucontrol->value.integer.value[0]; | 1094 | chip->auto_mute = ucontrol->value.integer.value[0]; |
1106 | if (chip->update_automute) | 1095 | if (chip->update_automute) |
@@ -1110,9 +1099,10 @@ static int pmac_auto_mute_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc | |||
1110 | return 0; | 1099 | return 0; |
1111 | } | 1100 | } |
1112 | 1101 | ||
1113 | static int pmac_hp_detect_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 1102 | static int pmac_hp_detect_get(struct snd_kcontrol *kcontrol, |
1103 | struct snd_ctl_elem_value *ucontrol) | ||
1114 | { | 1104 | { |
1115 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 1105 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
1116 | if (chip->detect_headphone) | 1106 | if (chip->detect_headphone) |
1117 | ucontrol->value.integer.value[0] = chip->detect_headphone(chip); | 1107 | ucontrol->value.integer.value[0] = chip->detect_headphone(chip); |
1118 | else | 1108 | else |
@@ -1120,7 +1110,7 @@ static int pmac_hp_detect_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc | |||
1120 | return 0; | 1110 | return 0; |
1121 | } | 1111 | } |
1122 | 1112 | ||
1123 | static snd_kcontrol_new_t auto_mute_controls[] __initdata = { | 1113 | static struct snd_kcontrol_new auto_mute_controls[] __initdata = { |
1124 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1114 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1125 | .name = "Auto Mute Switch", | 1115 | .name = "Auto Mute Switch", |
1126 | .info = snd_pmac_boolean_mono_info, | 1116 | .info = snd_pmac_boolean_mono_info, |
@@ -1135,7 +1125,7 @@ static snd_kcontrol_new_t auto_mute_controls[] __initdata = { | |||
1135 | }, | 1125 | }, |
1136 | }; | 1126 | }; |
1137 | 1127 | ||
1138 | int __init snd_pmac_add_automute(pmac_t *chip) | 1128 | int __init snd_pmac_add_automute(struct snd_pmac *chip) |
1139 | { | 1129 | { |
1140 | int err; | 1130 | int err; |
1141 | chip->auto_mute = 1; | 1131 | chip->auto_mute = 1; |
@@ -1152,13 +1142,13 @@ int __init snd_pmac_add_automute(pmac_t *chip) | |||
1152 | /* | 1142 | /* |
1153 | * create and detect a pmac chip record | 1143 | * create and detect a pmac chip record |
1154 | */ | 1144 | */ |
1155 | int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return) | 1145 | int __init snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return) |
1156 | { | 1146 | { |
1157 | pmac_t *chip; | 1147 | struct snd_pmac *chip; |
1158 | struct device_node *np; | 1148 | struct device_node *np; |
1159 | int i, err; | 1149 | int i, err; |
1160 | unsigned long ctrl_addr, txdma_addr, rxdma_addr; | 1150 | unsigned long ctrl_addr, txdma_addr, rxdma_addr; |
1161 | static snd_device_ops_t ops = { | 1151 | static struct snd_device_ops ops = { |
1162 | .dev_free = snd_pmac_dev_free, | 1152 | .dev_free = snd_pmac_dev_free, |
1163 | }; | 1153 | }; |
1164 | 1154 | ||
@@ -1186,46 +1176,69 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return) | |||
1186 | } | 1176 | } |
1187 | 1177 | ||
1188 | np = chip->node; | 1178 | np = chip->node; |
1179 | chip->requested = 0; | ||
1189 | if (chip->is_k2) { | 1180 | if (chip->is_k2) { |
1190 | if (np->parent->n_addrs < 2 || np->n_intrs < 3) { | 1181 | static char *rnames[] = { |
1182 | "Sound Control", "Sound DMA" }; | ||
1183 | if (np->n_intrs < 3) { | ||
1191 | err = -ENODEV; | 1184 | err = -ENODEV; |
1192 | goto __error; | 1185 | goto __error; |
1193 | } | 1186 | } |
1194 | for (i = 0; i < 2; i++) { | 1187 | for (i = 0; i < 2; i ++) { |
1195 | #ifndef CONFIG_PPC64 | 1188 | if (of_address_to_resource(np->parent, i, |
1196 | static char *name[2] = { "- Control", "- DMA" }; | 1189 | &chip->rsrc[i])) { |
1197 | if (! request_OF_resource(np->parent, i, name[i])) { | 1190 | printk(KERN_ERR "snd: can't translate rsrc " |
1198 | snd_printk(KERN_ERR "pmac: can't request resource %d!\n", i); | 1191 | " %d (%s)\n", i, rnames[i]); |
1199 | err = -ENODEV; | 1192 | err = -ENODEV; |
1200 | goto __error; | 1193 | goto __error; |
1201 | } | 1194 | } |
1202 | chip->of_requested |= (1 << i); | 1195 | if (request_mem_region(chip->rsrc[i].start, |
1203 | #endif /* CONFIG_PPC64 */ | 1196 | chip->rsrc[i].end - |
1204 | ctrl_addr = np->parent->addrs[0].address; | 1197 | chip->rsrc[i].start + 1, |
1205 | txdma_addr = np->parent->addrs[1].address; | 1198 | rnames[i]) == NULL) { |
1206 | rxdma_addr = txdma_addr + 0x100; | 1199 | printk(KERN_ERR "snd: can't request rsrc " |
1200 | " %d (%s: 0x%08lx:%08lx)\n", | ||
1201 | i, rnames[i], chip->rsrc[i].start, | ||
1202 | chip->rsrc[i].end); | ||
1203 | err = -ENODEV; | ||
1204 | goto __error; | ||
1205 | } | ||
1206 | chip->requested |= (1 << i); | ||
1207 | } | 1207 | } |
1208 | 1208 | ctrl_addr = chip->rsrc[0].start; | |
1209 | txdma_addr = chip->rsrc[1].start; | ||
1210 | rxdma_addr = txdma_addr + 0x100; | ||
1209 | } else { | 1211 | } else { |
1210 | if (np->n_addrs < 3 || np->n_intrs < 3) { | 1212 | static char *rnames[] = { |
1213 | "Sound Control", "Sound Tx DMA", "Sound Rx DMA" }; | ||
1214 | if (np->n_intrs < 3) { | ||
1211 | err = -ENODEV; | 1215 | err = -ENODEV; |
1212 | goto __error; | 1216 | goto __error; |
1213 | } | 1217 | } |
1214 | 1218 | for (i = 0; i < 3; i ++) { | |
1215 | for (i = 0; i < 3; i++) { | 1219 | if (of_address_to_resource(np->parent, i, |
1216 | #ifndef CONFIG_PPC64 | 1220 | &chip->rsrc[i])) { |
1217 | static char *name[3] = { "- Control", "- Tx DMA", "- Rx DMA" }; | 1221 | printk(KERN_ERR "snd: can't translate rsrc " |
1218 | if (! request_OF_resource(np, i, name[i])) { | 1222 | " %d (%s)\n", i, rnames[i]); |
1219 | snd_printk(KERN_ERR "pmac: can't request resource %d!\n", i); | 1223 | err = -ENODEV; |
1224 | goto __error; | ||
1225 | } | ||
1226 | if (request_mem_region(chip->rsrc[i].start, | ||
1227 | chip->rsrc[i].end - | ||
1228 | chip->rsrc[i].start + 1, | ||
1229 | rnames[i]) == NULL) { | ||
1230 | printk(KERN_ERR "snd: can't request rsrc " | ||
1231 | " %d (%s: 0x%08lx:%08lx)\n", | ||
1232 | i, rnames[i], chip->rsrc[i].start, | ||
1233 | chip->rsrc[i].end); | ||
1220 | err = -ENODEV; | 1234 | err = -ENODEV; |
1221 | goto __error; | 1235 | goto __error; |
1222 | } | 1236 | } |
1223 | chip->of_requested |= (1 << i); | 1237 | chip->requested |= (1 << i); |
1224 | #endif /* CONFIG_PPC64 */ | ||
1225 | ctrl_addr = np->addrs[0].address; | ||
1226 | txdma_addr = np->addrs[1].address; | ||
1227 | rxdma_addr = np->addrs[2].address; | ||
1228 | } | 1238 | } |
1239 | ctrl_addr = chip->rsrc[0].start; | ||
1240 | txdma_addr = chip->rsrc[1].start; | ||
1241 | rxdma_addr = chip->rsrc[2].start; | ||
1229 | } | 1242 | } |
1230 | 1243 | ||
1231 | chip->awacs = ioremap(ctrl_addr, 0x1000); | 1244 | chip->awacs = ioremap(ctrl_addr, 0x1000); |
@@ -1277,9 +1290,11 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return) | |||
1277 | } else if (chip->is_pbook_G3) { | 1290 | } else if (chip->is_pbook_G3) { |
1278 | struct device_node* mio; | 1291 | struct device_node* mio; |
1279 | for (mio = chip->node->parent; mio; mio = mio->parent) { | 1292 | for (mio = chip->node->parent; mio; mio = mio->parent) { |
1280 | if (strcmp(mio->name, "mac-io") == 0 | 1293 | if (strcmp(mio->name, "mac-io") == 0) { |
1281 | && mio->n_addrs > 0) { | 1294 | struct resource r; |
1282 | chip->macio_base = ioremap(mio->addrs[0].address, 0x40); | 1295 | if (of_address_to_resource(mio, 0, &r) == 0) |
1296 | chip->macio_base = | ||
1297 | ioremap(r.start, 0x40); | ||
1283 | break; | 1298 | break; |
1284 | } | 1299 | } |
1285 | } | 1300 | } |
@@ -1298,12 +1313,6 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return) | |||
1298 | /* Reset dbdma channels */ | 1313 | /* Reset dbdma channels */ |
1299 | snd_pmac_dbdma_reset(chip); | 1314 | snd_pmac_dbdma_reset(chip); |
1300 | 1315 | ||
1301 | #ifdef CONFIG_PM | ||
1302 | /* add sleep notifier */ | ||
1303 | if (! snd_pmac_register_sleep_notifier(chip)) | ||
1304 | snd_card_set_pm_callback(chip->card, snd_pmac_suspend, snd_pmac_resume, chip); | ||
1305 | #endif | ||
1306 | |||
1307 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) | 1316 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) |
1308 | goto __error; | 1317 | goto __error; |
1309 | 1318 | ||
@@ -1328,11 +1337,11 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return) | |||
1328 | * Save state when going to sleep, restore it afterwards. | 1337 | * Save state when going to sleep, restore it afterwards. |
1329 | */ | 1338 | */ |
1330 | 1339 | ||
1331 | static int snd_pmac_suspend(snd_card_t *card, pm_message_t state) | 1340 | void snd_pmac_suspend(struct snd_pmac *chip) |
1332 | { | 1341 | { |
1333 | pmac_t *chip = card->pm_private_data; | ||
1334 | unsigned long flags; | 1342 | unsigned long flags; |
1335 | 1343 | ||
1344 | snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); | ||
1336 | if (chip->suspend) | 1345 | if (chip->suspend) |
1337 | chip->suspend(chip); | 1346 | chip->suspend(chip); |
1338 | snd_pcm_suspend_all(chip->pcm); | 1347 | snd_pcm_suspend_all(chip->pcm); |
@@ -1346,22 +1355,18 @@ static int snd_pmac_suspend(snd_card_t *card, pm_message_t state) | |||
1346 | if (chip->rx_irq >= 0) | 1355 | if (chip->rx_irq >= 0) |
1347 | disable_irq(chip->rx_irq); | 1356 | disable_irq(chip->rx_irq); |
1348 | snd_pmac_sound_feature(chip, 0); | 1357 | snd_pmac_sound_feature(chip, 0); |
1349 | return 0; | ||
1350 | } | 1358 | } |
1351 | 1359 | ||
1352 | static int snd_pmac_resume(snd_card_t *card) | 1360 | void snd_pmac_resume(struct snd_pmac *chip) |
1353 | { | 1361 | { |
1354 | pmac_t *chip = card->pm_private_data; | ||
1355 | |||
1356 | snd_pmac_sound_feature(chip, 1); | 1362 | snd_pmac_sound_feature(chip, 1); |
1357 | if (chip->resume) | 1363 | if (chip->resume) |
1358 | chip->resume(chip); | 1364 | chip->resume(chip); |
1359 | /* enable CD sound input */ | 1365 | /* enable CD sound input */ |
1360 | if (chip->macio_base && chip->is_pbook_G3) { | 1366 | if (chip->macio_base && chip->is_pbook_G3) |
1361 | out_8(chip->macio_base + 0x37, 3); | 1367 | out_8(chip->macio_base + 0x37, 3); |
1362 | } else if (chip->is_pbook_3400) { | 1368 | else if (chip->is_pbook_3400) |
1363 | in_8(chip->latch_base + 0x190); | 1369 | in_8(chip->latch_base + 0x190); |
1364 | } | ||
1365 | 1370 | ||
1366 | snd_pmac_pcm_set_format(chip); | 1371 | snd_pmac_pcm_set_format(chip); |
1367 | 1372 | ||
@@ -1372,53 +1377,7 @@ static int snd_pmac_resume(snd_card_t *card) | |||
1372 | if (chip->rx_irq >= 0) | 1377 | if (chip->rx_irq >= 0) |
1373 | enable_irq(chip->rx_irq); | 1378 | enable_irq(chip->rx_irq); |
1374 | 1379 | ||
1375 | return 0; | 1380 | snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0); |
1376 | } | ||
1377 | |||
1378 | /* the chip is stored statically by snd_pmac_register_sleep_notifier | ||
1379 | * because we can't have any private data for notify callback. | ||
1380 | */ | ||
1381 | static pmac_t *sleeping_pmac = NULL; | ||
1382 | |||
1383 | static int snd_pmac_sleep_notify(struct pmu_sleep_notifier *self, int when) | ||
1384 | { | ||
1385 | pmac_t *chip; | ||
1386 | |||
1387 | chip = sleeping_pmac; | ||
1388 | if (! chip) | ||
1389 | return 0; | ||
1390 | |||
1391 | switch (when) { | ||
1392 | case PBOOK_SLEEP_NOW: | ||
1393 | snd_pmac_suspend(chip->card, PMSG_SUSPEND); | ||
1394 | break; | ||
1395 | case PBOOK_WAKE: | ||
1396 | snd_pmac_resume(chip->card); | ||
1397 | break; | ||
1398 | } | ||
1399 | return PBOOK_SLEEP_OK; | ||
1400 | } | ||
1401 | |||
1402 | static struct pmu_sleep_notifier snd_pmac_sleep_notifier = { | ||
1403 | snd_pmac_sleep_notify, SLEEP_LEVEL_SOUND, | ||
1404 | }; | ||
1405 | |||
1406 | static int __init snd_pmac_register_sleep_notifier(pmac_t *chip) | ||
1407 | { | ||
1408 | /* should be protected here.. */ | ||
1409 | snd_assert(! sleeping_pmac, return -EBUSY); | ||
1410 | sleeping_pmac = chip; | ||
1411 | pmu_register_sleep_notifier(&snd_pmac_sleep_notifier); | ||
1412 | return 0; | ||
1413 | } | ||
1414 | |||
1415 | static int snd_pmac_unregister_sleep_notifier(pmac_t *chip) | ||
1416 | { | ||
1417 | /* should be protected here.. */ | ||
1418 | snd_assert(sleeping_pmac == chip, return -ENODEV); | ||
1419 | pmu_unregister_sleep_notifier(&snd_pmac_sleep_notifier); | ||
1420 | sleeping_pmac = NULL; | ||
1421 | return 0; | ||
1422 | } | 1381 | } |
1423 | 1382 | ||
1424 | #endif /* CONFIG_PM */ | 1383 | #endif /* CONFIG_PM */ |
diff --git a/sound/ppc/pmac.h b/sound/ppc/pmac.h index bfff788e98..3a9bd4dbb9 100644 --- a/sound/ppc/pmac.h +++ b/sound/ppc/pmac.h | |||
@@ -47,18 +47,9 @@ | |||
47 | #define PMAC_SUPPORT_AUTOMUTE | 47 | #define PMAC_SUPPORT_AUTOMUTE |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * typedefs | ||
51 | */ | ||
52 | typedef struct snd_pmac pmac_t; | ||
53 | typedef struct snd_pmac_stream pmac_stream_t; | ||
54 | typedef struct snd_pmac_beep pmac_beep_t; | ||
55 | typedef struct snd_pmac_dbdma pmac_dbdma_t; | ||
56 | |||
57 | |||
58 | /* | ||
59 | * DBDMA space | 50 | * DBDMA space |
60 | */ | 51 | */ |
61 | struct snd_pmac_dbdma { | 52 | struct pmac_dbdma { |
62 | dma_addr_t dma_base; | 53 | dma_addr_t dma_base; |
63 | dma_addr_t addr; | 54 | dma_addr_t addr; |
64 | struct dbdma_cmd __iomem *cmds; | 55 | struct dbdma_cmd __iomem *cmds; |
@@ -69,7 +60,7 @@ struct snd_pmac_dbdma { | |||
69 | /* | 60 | /* |
70 | * playback/capture stream | 61 | * playback/capture stream |
71 | */ | 62 | */ |
72 | struct snd_pmac_stream { | 63 | struct pmac_stream { |
73 | int running; /* boolean */ | 64 | int running; /* boolean */ |
74 | 65 | ||
75 | int stream; /* PLAYBACK/CAPTURE */ | 66 | int stream; /* PLAYBACK/CAPTURE */ |
@@ -79,10 +70,10 @@ struct snd_pmac_stream { | |||
79 | int buffer_size; /* in kbytes */ | 70 | int buffer_size; /* in kbytes */ |
80 | int nperiods, cur_period; | 71 | int nperiods, cur_period; |
81 | 72 | ||
82 | pmac_dbdma_t cmd; | 73 | struct pmac_dbdma cmd; |
83 | volatile struct dbdma_regs __iomem *dma; | 74 | volatile struct dbdma_regs __iomem *dma; |
84 | 75 | ||
85 | snd_pcm_substream_t *substream; | 76 | struct snd_pcm_substream *substream; |
86 | 77 | ||
87 | unsigned int cur_freqs; /* currently available frequencies */ | 78 | unsigned int cur_freqs; /* currently available frequencies */ |
88 | unsigned int cur_formats; /* currently available formats */ | 79 | unsigned int cur_formats; /* currently available formats */ |
@@ -98,7 +89,7 @@ enum snd_pmac_model { | |||
98 | }; | 89 | }; |
99 | 90 | ||
100 | struct snd_pmac { | 91 | struct snd_pmac { |
101 | snd_card_t *card; | 92 | struct snd_card *card; |
102 | 93 | ||
103 | /* h/w info */ | 94 | /* h/w info */ |
104 | struct device_node *node; | 95 | struct device_node *node; |
@@ -122,7 +113,8 @@ struct snd_pmac { | |||
122 | unsigned int initialized : 1; | 113 | unsigned int initialized : 1; |
123 | unsigned int feature_is_set : 1; | 114 | unsigned int feature_is_set : 1; |
124 | 115 | ||
125 | unsigned int of_requested; | 116 | unsigned int requested; |
117 | struct resource rsrc[3]; | ||
126 | 118 | ||
127 | int num_freqs; | 119 | int num_freqs; |
128 | int *freq_table; | 120 | int *freq_table; |
@@ -140,75 +132,80 @@ struct snd_pmac { | |||
140 | unsigned char __iomem *latch_base; | 132 | unsigned char __iomem *latch_base; |
141 | unsigned char __iomem *macio_base; | 133 | unsigned char __iomem *macio_base; |
142 | 134 | ||
143 | pmac_stream_t playback; | 135 | struct pmac_stream playback; |
144 | pmac_stream_t capture; | 136 | struct pmac_stream capture; |
145 | 137 | ||
146 | pmac_dbdma_t extra_dma; | 138 | struct pmac_dbdma extra_dma; |
147 | 139 | ||
148 | int irq, tx_irq, rx_irq; | 140 | int irq, tx_irq, rx_irq; |
149 | 141 | ||
150 | snd_pcm_t *pcm; | 142 | struct snd_pcm *pcm; |
151 | 143 | ||
152 | pmac_beep_t *beep; | 144 | struct pmac_beep *beep; |
153 | 145 | ||
154 | unsigned int control_mask; /* control mask */ | 146 | unsigned int control_mask; /* control mask */ |
155 | 147 | ||
156 | /* mixer stuffs */ | 148 | /* mixer stuffs */ |
157 | void *mixer_data; | 149 | void *mixer_data; |
158 | void (*mixer_free)(pmac_t *); | 150 | void (*mixer_free)(struct snd_pmac *); |
159 | snd_kcontrol_t *master_sw_ctl; | 151 | struct snd_kcontrol *master_sw_ctl; |
160 | snd_kcontrol_t *speaker_sw_ctl; | 152 | struct snd_kcontrol *speaker_sw_ctl; |
161 | snd_kcontrol_t *drc_sw_ctl; /* only used for tumbler -ReneR */ | 153 | struct snd_kcontrol *drc_sw_ctl; /* only used for tumbler -ReneR */ |
162 | snd_kcontrol_t *hp_detect_ctl; | 154 | struct snd_kcontrol *hp_detect_ctl; |
163 | snd_kcontrol_t *lineout_sw_ctl; | 155 | struct snd_kcontrol *lineout_sw_ctl; |
164 | 156 | ||
165 | /* lowlevel callbacks */ | 157 | /* lowlevel callbacks */ |
166 | void (*set_format)(pmac_t *chip); | 158 | void (*set_format)(struct snd_pmac *chip); |
167 | void (*update_automute)(pmac_t *chip, int do_notify); | 159 | void (*update_automute)(struct snd_pmac *chip, int do_notify); |
168 | int (*detect_headphone)(pmac_t *chip); | 160 | int (*detect_headphone)(struct snd_pmac *chip); |
169 | #ifdef CONFIG_PM | 161 | #ifdef CONFIG_PM |
170 | void (*suspend)(pmac_t *chip); | 162 | void (*suspend)(struct snd_pmac *chip); |
171 | void (*resume)(pmac_t *chip); | 163 | void (*resume)(struct snd_pmac *chip); |
172 | #endif | 164 | #endif |
173 | 165 | ||
174 | }; | 166 | }; |
175 | 167 | ||
176 | 168 | ||
177 | /* exported functions */ | 169 | /* exported functions */ |
178 | int snd_pmac_new(snd_card_t *card, pmac_t **chip_return); | 170 | int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return); |
179 | int snd_pmac_pcm_new(pmac_t *chip); | 171 | int snd_pmac_pcm_new(struct snd_pmac *chip); |
180 | int snd_pmac_attach_beep(pmac_t *chip); | 172 | int snd_pmac_attach_beep(struct snd_pmac *chip); |
181 | void snd_pmac_detach_beep(pmac_t *chip); | 173 | void snd_pmac_detach_beep(struct snd_pmac *chip); |
182 | void snd_pmac_beep_stop(pmac_t *chip); | 174 | void snd_pmac_beep_stop(struct snd_pmac *chip); |
183 | unsigned int snd_pmac_rate_index(pmac_t *chip, pmac_stream_t *rec, unsigned int rate); | 175 | unsigned int snd_pmac_rate_index(struct snd_pmac *chip, struct pmac_stream *rec, unsigned int rate); |
184 | 176 | ||
185 | void snd_pmac_beep_dma_start(pmac_t *chip, int bytes, unsigned long addr, int speed); | 177 | void snd_pmac_beep_dma_start(struct snd_pmac *chip, int bytes, unsigned long addr, int speed); |
186 | void snd_pmac_beep_dma_stop(pmac_t *chip); | 178 | void snd_pmac_beep_dma_stop(struct snd_pmac *chip); |
179 | |||
180 | #ifdef CONFIG_PM | ||
181 | void snd_pmac_suspend(struct snd_pmac *chip); | ||
182 | void snd_pmac_resume(struct snd_pmac *chip); | ||
183 | #endif | ||
187 | 184 | ||
188 | /* initialize mixer */ | 185 | /* initialize mixer */ |
189 | int snd_pmac_awacs_init(pmac_t *chip); | 186 | int snd_pmac_awacs_init(struct snd_pmac *chip); |
190 | int snd_pmac_burgundy_init(pmac_t *chip); | 187 | int snd_pmac_burgundy_init(struct snd_pmac *chip); |
191 | int snd_pmac_daca_init(pmac_t *chip); | 188 | int snd_pmac_daca_init(struct snd_pmac *chip); |
192 | int snd_pmac_tumbler_init(pmac_t *chip); | 189 | int snd_pmac_tumbler_init(struct snd_pmac *chip); |
193 | int snd_pmac_tumbler_post_init(void); | 190 | int snd_pmac_tumbler_post_init(void); |
194 | int snd_pmac_toonie_init(pmac_t *chip); | 191 | int snd_pmac_toonie_init(struct snd_pmac *chip); |
195 | 192 | ||
196 | /* i2c functions */ | 193 | /* i2c functions */ |
197 | typedef struct snd_pmac_keywest { | 194 | struct pmac_keywest { |
198 | int addr; | 195 | int addr; |
199 | struct i2c_client *client; | 196 | struct i2c_client *client; |
200 | int id; | 197 | int id; |
201 | int (*init_client)(struct snd_pmac_keywest *i2c); | 198 | int (*init_client)(struct pmac_keywest *i2c); |
202 | char *name; | 199 | char *name; |
203 | } pmac_keywest_t; | 200 | }; |
204 | 201 | ||
205 | int snd_pmac_keywest_init(pmac_keywest_t *i2c); | 202 | int snd_pmac_keywest_init(struct pmac_keywest *i2c); |
206 | void snd_pmac_keywest_cleanup(pmac_keywest_t *i2c); | 203 | void snd_pmac_keywest_cleanup(struct pmac_keywest *i2c); |
207 | 204 | ||
208 | /* misc */ | 205 | /* misc */ |
209 | int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo); | 206 | int snd_pmac_boolean_stereo_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); |
210 | int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo); | 207 | int snd_pmac_boolean_mono_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); |
211 | 208 | ||
212 | int snd_pmac_add_automute(pmac_t *chip); | 209 | int snd_pmac_add_automute(struct snd_pmac *chip); |
213 | 210 | ||
214 | #endif /* __PMAC_H */ | 211 | #endif /* __PMAC_H */ |
diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c index a6d8cbf406..f4902a219e 100644 --- a/sound/ppc/powermac.c +++ b/sound/ppc/powermac.c | |||
@@ -20,6 +20,8 @@ | |||
20 | 20 | ||
21 | #include <sound/driver.h> | 21 | #include <sound/driver.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/err.h> | ||
24 | #include <linux/platform_device.h> | ||
23 | #include <linux/moduleparam.h> | 25 | #include <linux/moduleparam.h> |
24 | #include <sound/core.h> | 26 | #include <sound/core.h> |
25 | #include <sound/initval.h> | 27 | #include <sound/initval.h> |
@@ -44,20 +46,16 @@ MODULE_PARM_DESC(id, "ID string for " CHIP_NAME " soundchip."); | |||
44 | module_param(enable_beep, bool, 0444); | 46 | module_param(enable_beep, bool, 0444); |
45 | MODULE_PARM_DESC(enable_beep, "Enable beep using PCM."); | 47 | MODULE_PARM_DESC(enable_beep, "Enable beep using PCM."); |
46 | 48 | ||
49 | static struct platform_device *device; | ||
47 | 50 | ||
48 | /* | ||
49 | * card entry | ||
50 | */ | ||
51 | |||
52 | static snd_card_t *snd_pmac_card = NULL; | ||
53 | 51 | ||
54 | /* | 52 | /* |
55 | */ | 53 | */ |
56 | 54 | ||
57 | static int __init snd_pmac_probe(void) | 55 | static int __init snd_pmac_probe(struct platform_device *devptr) |
58 | { | 56 | { |
59 | snd_card_t *card; | 57 | struct snd_card *card; |
60 | pmac_t *chip; | 58 | struct snd_pmac *chip; |
61 | char *name_ext; | 59 | char *name_ext; |
62 | int err; | 60 | int err; |
63 | 61 | ||
@@ -67,6 +65,7 @@ static int __init snd_pmac_probe(void) | |||
67 | 65 | ||
68 | if ((err = snd_pmac_new(card, &chip)) < 0) | 66 | if ((err = snd_pmac_new(card, &chip)) < 0) |
69 | goto __error; | 67 | goto __error; |
68 | card->private_data = chip; | ||
70 | 69 | ||
71 | switch (chip->model) { | 70 | switch (chip->model) { |
72 | case PMAC_BURGUNDY: | 71 | case PMAC_BURGUNDY: |
@@ -131,13 +130,12 @@ static int __init snd_pmac_probe(void) | |||
131 | if (enable_beep) | 130 | if (enable_beep) |
132 | snd_pmac_attach_beep(chip); | 131 | snd_pmac_attach_beep(chip); |
133 | 132 | ||
134 | if ((err = snd_card_set_generic_dev(card)) < 0) | 133 | snd_card_set_dev(card, &devptr->dev); |
135 | goto __error; | ||
136 | 134 | ||
137 | if ((err = snd_card_register(card)) < 0) | 135 | if ((err = snd_card_register(card)) < 0) |
138 | goto __error; | 136 | goto __error; |
139 | 137 | ||
140 | snd_pmac_card = card; | 138 | platform_set_drvdata(devptr, card); |
141 | return 0; | 139 | return 0; |
142 | 140 | ||
143 | __error: | 141 | __error: |
@@ -146,23 +144,62 @@ __error: | |||
146 | } | 144 | } |
147 | 145 | ||
148 | 146 | ||
149 | /* | 147 | static int __devexit snd_pmac_remove(struct platform_device *devptr) |
150 | * MODULE stuff | 148 | { |
151 | */ | 149 | snd_card_free(platform_get_drvdata(devptr)); |
150 | platform_set_drvdata(devptr, NULL); | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | #ifdef CONFIG_PM | ||
155 | static int snd_pmac_driver_suspend(struct platform_device *devptr, pm_message_t state) | ||
156 | { | ||
157 | struct snd_card *card = platform_get_drvdata(devptr); | ||
158 | snd_pmac_suspend(card->private_data); | ||
159 | return 0; | ||
160 | } | ||
161 | |||
162 | static int snd_pmac_driver_resume(struct platform_device *devptr) | ||
163 | { | ||
164 | struct snd_card *card = platform_get_drvdata(devptr); | ||
165 | snd_pmac_resume(card->private_data); | ||
166 | return 0; | ||
167 | } | ||
168 | #endif | ||
169 | |||
170 | #define SND_PMAC_DRIVER "snd_powermac" | ||
171 | |||
172 | static struct platform_driver snd_pmac_driver = { | ||
173 | .probe = snd_pmac_probe, | ||
174 | .remove = __devexit_p(snd_pmac_remove), | ||
175 | #ifdef CONFIG_PM | ||
176 | .suspend = snd_pmac_driver_suspend, | ||
177 | .resume = snd_pmac_driver_resume, | ||
178 | #endif | ||
179 | .driver = { | ||
180 | .name = SND_PMAC_DRIVER | ||
181 | }, | ||
182 | }; | ||
152 | 183 | ||
153 | static int __init alsa_card_pmac_init(void) | 184 | static int __init alsa_card_pmac_init(void) |
154 | { | 185 | { |
155 | int err; | 186 | int err; |
156 | if ((err = snd_pmac_probe()) < 0) | 187 | |
188 | if ((err = platform_driver_register(&snd_pmac_driver)) < 0) | ||
157 | return err; | 189 | return err; |
190 | device = platform_device_register_simple(SND_PMAC_DRIVER, -1, NULL, 0); | ||
191 | if (IS_ERR(device)) { | ||
192 | platform_driver_unregister(&snd_pmac_driver); | ||
193 | return PTR_ERR(device); | ||
194 | } | ||
158 | return 0; | 195 | return 0; |
159 | 196 | ||
160 | } | 197 | } |
161 | 198 | ||
162 | static void __exit alsa_card_pmac_exit(void) | 199 | static void __exit alsa_card_pmac_exit(void) |
163 | { | 200 | { |
164 | if (snd_pmac_card) | 201 | platform_device_unregister(device); |
165 | snd_card_free(snd_pmac_card); | 202 | platform_driver_unregister(&snd_pmac_driver); |
166 | } | 203 | } |
167 | 204 | ||
168 | module_init(alsa_card_pmac_init) | 205 | module_init(alsa_card_pmac_init) |
diff --git a/sound/ppc/toonie.c b/sound/ppc/toonie.c index 082bc4baba..053b8f24e4 100644 --- a/sound/ppc/toonie.c +++ b/sound/ppc/toonie.c | |||
@@ -101,10 +101,10 @@ static int read_audio_gpio(struct pmac_gpio *gp) | |||
101 | 101 | ||
102 | enum { TOONIE_MUTE_HP, TOONIE_MUTE_AMP }; | 102 | enum { TOONIE_MUTE_HP, TOONIE_MUTE_AMP }; |
103 | 103 | ||
104 | static int toonie_get_mute_switch(snd_kcontrol_t *kcontrol, | 104 | static int toonie_get_mute_switch(struct snd_kcontrol *kcontrol, |
105 | snd_ctl_elem_value_t *ucontrol) | 105 | struct snd_ctl_elem_value *ucontrol) |
106 | { | 106 | { |
107 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 107 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
108 | struct pmac_toonie *mix = chip->mixer_data; | 108 | struct pmac_toonie *mix = chip->mixer_data; |
109 | struct pmac_gpio *gp; | 109 | struct pmac_gpio *gp; |
110 | 110 | ||
@@ -124,10 +124,10 @@ static int toonie_get_mute_switch(snd_kcontrol_t *kcontrol, | |||
124 | return 0; | 124 | return 0; |
125 | } | 125 | } |
126 | 126 | ||
127 | static int toonie_put_mute_switch(snd_kcontrol_t *kcontrol, | 127 | static int toonie_put_mute_switch(struct snd_kcontrol *kcontrol, |
128 | snd_ctl_elem_value_t *ucontrol) | 128 | struct snd_ctl_elem_value *ucontrol) |
129 | { | 129 | { |
130 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 130 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
131 | struct pmac_toonie *mix = chip->mixer_data; | 131 | struct pmac_toonie *mix = chip->mixer_data; |
132 | struct pmac_gpio *gp; | 132 | struct pmac_gpio *gp; |
133 | int val; | 133 | int val; |
@@ -156,7 +156,7 @@ static int toonie_put_mute_switch(snd_kcontrol_t *kcontrol, | |||
156 | return 0; | 156 | return 0; |
157 | } | 157 | } |
158 | 158 | ||
159 | static snd_kcontrol_new_t toonie_hp_sw __initdata = { | 159 | static struct snd_kcontrol_new toonie_hp_sw __initdata = { |
160 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 160 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
161 | .name = "Headphone Playback Switch", | 161 | .name = "Headphone Playback Switch", |
162 | .info = snd_pmac_boolean_mono_info, | 162 | .info = snd_pmac_boolean_mono_info, |
@@ -164,7 +164,7 @@ static snd_kcontrol_new_t toonie_hp_sw __initdata = { | |||
164 | .put = toonie_put_mute_switch, | 164 | .put = toonie_put_mute_switch, |
165 | .private_value = TOONIE_MUTE_HP, | 165 | .private_value = TOONIE_MUTE_HP, |
166 | }; | 166 | }; |
167 | static snd_kcontrol_new_t toonie_speaker_sw __initdata = { | 167 | static struct snd_kcontrol_new toonie_speaker_sw __initdata = { |
168 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 168 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
169 | .name = "PC Speaker Playback Switch", | 169 | .name = "PC Speaker Playback Switch", |
170 | .info = snd_pmac_boolean_mono_info, | 170 | .info = snd_pmac_boolean_mono_info, |
@@ -176,7 +176,7 @@ static snd_kcontrol_new_t toonie_speaker_sw __initdata = { | |||
176 | /* | 176 | /* |
177 | * auto-mute stuffs | 177 | * auto-mute stuffs |
178 | */ | 178 | */ |
179 | static int toonie_detect_headphone(pmac_t *chip) | 179 | static int toonie_detect_headphone(struct snd_pmac *chip) |
180 | { | 180 | { |
181 | struct pmac_toonie *mix = chip->mixer_data; | 181 | struct pmac_toonie *mix = chip->mixer_data; |
182 | int detect = 0; | 182 | int detect = 0; |
@@ -186,8 +186,8 @@ static int toonie_detect_headphone(pmac_t *chip) | |||
186 | return detect; | 186 | return detect; |
187 | } | 187 | } |
188 | 188 | ||
189 | static void toonie_check_mute(pmac_t *chip, struct pmac_gpio *gp, int val, | 189 | static void toonie_check_mute(struct snd_pmac *chip, struct pmac_gpio *gp, int val, |
190 | int do_notify, snd_kcontrol_t *sw) | 190 | int do_notify, struct snd_kcontrol *sw) |
191 | { | 191 | { |
192 | if (check_audio_gpio(gp) != val) { | 192 | if (check_audio_gpio(gp) != val) { |
193 | write_audio_gpio(gp, val); | 193 | write_audio_gpio(gp, val); |
@@ -199,7 +199,7 @@ static void toonie_check_mute(pmac_t *chip, struct pmac_gpio *gp, int val, | |||
199 | 199 | ||
200 | static void toonie_detect_handler(void *self) | 200 | static void toonie_detect_handler(void *self) |
201 | { | 201 | { |
202 | pmac_t *chip = (pmac_t*) self; | 202 | struct snd_pmac *chip = (struct snd_pmac *) self; |
203 | struct pmac_toonie *mix; | 203 | struct pmac_toonie *mix; |
204 | int headphone; | 204 | int headphone; |
205 | 205 | ||
@@ -232,7 +232,7 @@ static void toonie_detect_handler(void *self) | |||
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | static void toonie_update_automute(pmac_t *chip, int do_notify) | 235 | static void toonie_update_automute(struct snd_pmac *chip, int do_notify) |
236 | { | 236 | { |
237 | if (chip->auto_mute) { | 237 | if (chip->auto_mute) { |
238 | struct pmac_toonie *mix; | 238 | struct pmac_toonie *mix; |
@@ -246,7 +246,7 @@ static void toonie_update_automute(pmac_t *chip, int do_notify) | |||
246 | /* interrupt - headphone plug changed */ | 246 | /* interrupt - headphone plug changed */ |
247 | static irqreturn_t toonie_hp_intr(int irq, void *devid, struct pt_regs *regs) | 247 | static irqreturn_t toonie_hp_intr(int irq, void *devid, struct pt_regs *regs) |
248 | { | 248 | { |
249 | pmac_t *chip = devid; | 249 | struct snd_pmac *chip = devid; |
250 | 250 | ||
251 | if (chip->update_automute && chip->initialized) { | 251 | if (chip->update_automute && chip->initialized) { |
252 | chip->update_automute(chip, 1); | 252 | chip->update_automute(chip, 1); |
@@ -325,7 +325,7 @@ static int find_audio_gpio(const char *name, const char *platform, | |||
325 | return (np->n_intrs > 0) ? np->intrs[0].line : 0; | 325 | return (np->n_intrs > 0) ? np->intrs[0].line : 0; |
326 | } | 326 | } |
327 | 327 | ||
328 | static void toonie_cleanup(pmac_t *chip) | 328 | static void toonie_cleanup(struct snd_pmac *chip) |
329 | { | 329 | { |
330 | struct pmac_toonie *mix = chip->mixer_data; | 330 | struct pmac_toonie *mix = chip->mixer_data; |
331 | if (! mix) | 331 | if (! mix) |
@@ -336,7 +336,7 @@ static void toonie_cleanup(pmac_t *chip) | |||
336 | chip->mixer_data = NULL; | 336 | chip->mixer_data = NULL; |
337 | } | 337 | } |
338 | 338 | ||
339 | int snd_pmac_toonie_init(pmac_t *chip) | 339 | int snd_pmac_toonie_init(struct snd_pmac *chip) |
340 | { | 340 | { |
341 | struct pmac_toonie *mix; | 341 | struct pmac_toonie *mix; |
342 | 342 | ||
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 65384afcfc..15c63cb2cc 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c | |||
@@ -82,21 +82,21 @@ enum { | |||
82 | VOL_IDX_LAST_MIX | 82 | VOL_IDX_LAST_MIX |
83 | }; | 83 | }; |
84 | 84 | ||
85 | typedef struct pmac_gpio { | 85 | struct pmac_gpio { |
86 | unsigned int addr; | 86 | unsigned int addr; |
87 | u8 active_val; | 87 | u8 active_val; |
88 | u8 inactive_val; | 88 | u8 inactive_val; |
89 | u8 active_state; | 89 | u8 active_state; |
90 | } pmac_gpio_t; | 90 | }; |
91 | 91 | ||
92 | typedef struct pmac_tumbler_t { | 92 | struct pmac_tumbler { |
93 | pmac_keywest_t i2c; | 93 | struct pmac_keywest i2c; |
94 | pmac_gpio_t audio_reset; | 94 | struct pmac_gpio audio_reset; |
95 | pmac_gpio_t amp_mute; | 95 | struct pmac_gpio amp_mute; |
96 | pmac_gpio_t line_mute; | 96 | struct pmac_gpio line_mute; |
97 | pmac_gpio_t line_detect; | 97 | struct pmac_gpio line_detect; |
98 | pmac_gpio_t hp_mute; | 98 | struct pmac_gpio hp_mute; |
99 | pmac_gpio_t hp_detect; | 99 | struct pmac_gpio hp_detect; |
100 | int headphone_irq; | 100 | int headphone_irq; |
101 | int lineout_irq; | 101 | int lineout_irq; |
102 | unsigned int save_master_vol[2]; | 102 | unsigned int save_master_vol[2]; |
@@ -112,13 +112,13 @@ typedef struct pmac_tumbler_t { | |||
112 | int auto_mute_notify; | 112 | int auto_mute_notify; |
113 | int reset_on_sleep; | 113 | int reset_on_sleep; |
114 | u8 acs; | 114 | u8 acs; |
115 | } pmac_tumbler_t; | 115 | }; |
116 | 116 | ||
117 | 117 | ||
118 | /* | 118 | /* |
119 | */ | 119 | */ |
120 | 120 | ||
121 | static int send_init_client(pmac_keywest_t *i2c, unsigned int *regs) | 121 | static int send_init_client(struct pmac_keywest *i2c, unsigned int *regs) |
122 | { | 122 | { |
123 | while (*regs > 0) { | 123 | while (*regs > 0) { |
124 | int err, count = 10; | 124 | int err, count = 10; |
@@ -138,7 +138,7 @@ static int send_init_client(pmac_keywest_t *i2c, unsigned int *regs) | |||
138 | } | 138 | } |
139 | 139 | ||
140 | 140 | ||
141 | static int tumbler_init_client(pmac_keywest_t *i2c) | 141 | static int tumbler_init_client(struct pmac_keywest *i2c) |
142 | { | 142 | { |
143 | static unsigned int regs[] = { | 143 | static unsigned int regs[] = { |
144 | /* normal operation, SCLK=64fps, i2s output, i2s input, 16bit width */ | 144 | /* normal operation, SCLK=64fps, i2s output, i2s input, 16bit width */ |
@@ -149,7 +149,7 @@ static int tumbler_init_client(pmac_keywest_t *i2c) | |||
149 | return send_init_client(i2c, regs); | 149 | return send_init_client(i2c, regs); |
150 | } | 150 | } |
151 | 151 | ||
152 | static int snapper_init_client(pmac_keywest_t *i2c) | 152 | static int snapper_init_client(struct pmac_keywest *i2c) |
153 | { | 153 | { |
154 | static unsigned int regs[] = { | 154 | static unsigned int regs[] = { |
155 | /* normal operation, SCLK=64fps, i2s output, 16bit width */ | 155 | /* normal operation, SCLK=64fps, i2s output, 16bit width */ |
@@ -173,7 +173,7 @@ static int snapper_init_client(pmac_keywest_t *i2c) | |||
173 | pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, (gp)->addr, 0) | 173 | pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, (gp)->addr, 0) |
174 | #define tumbler_gpio_free(gp) /* NOP */ | 174 | #define tumbler_gpio_free(gp) /* NOP */ |
175 | 175 | ||
176 | static void write_audio_gpio(pmac_gpio_t *gp, int active) | 176 | static void write_audio_gpio(struct pmac_gpio *gp, int active) |
177 | { | 177 | { |
178 | if (! gp->addr) | 178 | if (! gp->addr) |
179 | return; | 179 | return; |
@@ -182,7 +182,7 @@ static void write_audio_gpio(pmac_gpio_t *gp, int active) | |||
182 | DBG("(I) gpio %x write %d\n", gp->addr, active); | 182 | DBG("(I) gpio %x write %d\n", gp->addr, active); |
183 | } | 183 | } |
184 | 184 | ||
185 | static int check_audio_gpio(pmac_gpio_t *gp) | 185 | static int check_audio_gpio(struct pmac_gpio *gp) |
186 | { | 186 | { |
187 | int ret; | 187 | int ret; |
188 | 188 | ||
@@ -194,7 +194,7 @@ static int check_audio_gpio(pmac_gpio_t *gp) | |||
194 | return (ret & 0xd) == (gp->active_val & 0xd); | 194 | return (ret & 0xd) == (gp->active_val & 0xd); |
195 | } | 195 | } |
196 | 196 | ||
197 | static int read_audio_gpio(pmac_gpio_t *gp) | 197 | static int read_audio_gpio(struct pmac_gpio *gp) |
198 | { | 198 | { |
199 | int ret; | 199 | int ret; |
200 | if (! gp->addr) | 200 | if (! gp->addr) |
@@ -206,7 +206,7 @@ static int read_audio_gpio(pmac_gpio_t *gp) | |||
206 | /* | 206 | /* |
207 | * update master volume | 207 | * update master volume |
208 | */ | 208 | */ |
209 | static int tumbler_set_master_volume(pmac_tumbler_t *mix) | 209 | static int tumbler_set_master_volume(struct pmac_tumbler *mix) |
210 | { | 210 | { |
211 | unsigned char block[6]; | 211 | unsigned char block[6]; |
212 | unsigned int left_vol, right_vol; | 212 | unsigned int left_vol, right_vol; |
@@ -249,7 +249,8 @@ static int tumbler_set_master_volume(pmac_tumbler_t *mix) | |||
249 | 249 | ||
250 | 250 | ||
251 | /* output volume */ | 251 | /* output volume */ |
252 | static int tumbler_info_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 252 | static int tumbler_info_master_volume(struct snd_kcontrol *kcontrol, |
253 | struct snd_ctl_elem_info *uinfo) | ||
253 | { | 254 | { |
254 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 255 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
255 | uinfo->count = 2; | 256 | uinfo->count = 2; |
@@ -258,20 +259,22 @@ static int tumbler_info_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf | |||
258 | return 0; | 259 | return 0; |
259 | } | 260 | } |
260 | 261 | ||
261 | static int tumbler_get_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 262 | static int tumbler_get_master_volume(struct snd_kcontrol *kcontrol, |
263 | struct snd_ctl_elem_value *ucontrol) | ||
262 | { | 264 | { |
263 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 265 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
264 | pmac_tumbler_t *mix = chip->mixer_data; | 266 | struct pmac_tumbler *mix = chip->mixer_data; |
265 | snd_assert(mix, return -ENODEV); | 267 | snd_assert(mix, return -ENODEV); |
266 | ucontrol->value.integer.value[0] = mix->master_vol[0]; | 268 | ucontrol->value.integer.value[0] = mix->master_vol[0]; |
267 | ucontrol->value.integer.value[1] = mix->master_vol[1]; | 269 | ucontrol->value.integer.value[1] = mix->master_vol[1]; |
268 | return 0; | 270 | return 0; |
269 | } | 271 | } |
270 | 272 | ||
271 | static int tumbler_put_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 273 | static int tumbler_put_master_volume(struct snd_kcontrol *kcontrol, |
274 | struct snd_ctl_elem_value *ucontrol) | ||
272 | { | 275 | { |
273 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 276 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
274 | pmac_tumbler_t *mix = chip->mixer_data; | 277 | struct pmac_tumbler *mix = chip->mixer_data; |
275 | int change; | 278 | int change; |
276 | 279 | ||
277 | snd_assert(mix, return -ENODEV); | 280 | snd_assert(mix, return -ENODEV); |
@@ -286,20 +289,22 @@ static int tumbler_put_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu | |||
286 | } | 289 | } |
287 | 290 | ||
288 | /* output switch */ | 291 | /* output switch */ |
289 | static int tumbler_get_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 292 | static int tumbler_get_master_switch(struct snd_kcontrol *kcontrol, |
293 | struct snd_ctl_elem_value *ucontrol) | ||
290 | { | 294 | { |
291 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 295 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
292 | pmac_tumbler_t *mix = chip->mixer_data; | 296 | struct pmac_tumbler *mix = chip->mixer_data; |
293 | snd_assert(mix, return -ENODEV); | 297 | snd_assert(mix, return -ENODEV); |
294 | ucontrol->value.integer.value[0] = mix->master_switch[0]; | 298 | ucontrol->value.integer.value[0] = mix->master_switch[0]; |
295 | ucontrol->value.integer.value[1] = mix->master_switch[1]; | 299 | ucontrol->value.integer.value[1] = mix->master_switch[1]; |
296 | return 0; | 300 | return 0; |
297 | } | 301 | } |
298 | 302 | ||
299 | static int tumbler_put_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 303 | static int tumbler_put_master_switch(struct snd_kcontrol *kcontrol, |
304 | struct snd_ctl_elem_value *ucontrol) | ||
300 | { | 305 | { |
301 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 306 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
302 | pmac_tumbler_t *mix = chip->mixer_data; | 307 | struct pmac_tumbler *mix = chip->mixer_data; |
303 | int change; | 308 | int change; |
304 | 309 | ||
305 | snd_assert(mix, return -ENODEV); | 310 | snd_assert(mix, return -ENODEV); |
@@ -320,7 +325,7 @@ static int tumbler_put_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu | |||
320 | 325 | ||
321 | #define TAS3001_DRC_MAX 0x5f | 326 | #define TAS3001_DRC_MAX 0x5f |
322 | 327 | ||
323 | static int tumbler_set_drc(pmac_tumbler_t *mix) | 328 | static int tumbler_set_drc(struct pmac_tumbler *mix) |
324 | { | 329 | { |
325 | unsigned char val[2]; | 330 | unsigned char val[2]; |
326 | 331 | ||
@@ -354,7 +359,7 @@ static int tumbler_set_drc(pmac_tumbler_t *mix) | |||
354 | 359 | ||
355 | #define TAS3004_DRC_MAX 0xef | 360 | #define TAS3004_DRC_MAX 0xef |
356 | 361 | ||
357 | static int snapper_set_drc(pmac_tumbler_t *mix) | 362 | static int snapper_set_drc(struct pmac_tumbler *mix) |
358 | { | 363 | { |
359 | unsigned char val[6]; | 364 | unsigned char val[6]; |
360 | 365 | ||
@@ -384,9 +389,10 @@ static int snapper_set_drc(pmac_tumbler_t *mix) | |||
384 | return 0; | 389 | return 0; |
385 | } | 390 | } |
386 | 391 | ||
387 | static int tumbler_info_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 392 | static int tumbler_info_drc_value(struct snd_kcontrol *kcontrol, |
393 | struct snd_ctl_elem_info *uinfo) | ||
388 | { | 394 | { |
389 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 395 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
390 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 396 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
391 | uinfo->count = 1; | 397 | uinfo->count = 1; |
392 | uinfo->value.integer.min = 0; | 398 | uinfo->value.integer.min = 0; |
@@ -395,20 +401,22 @@ static int tumbler_info_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t | |||
395 | return 0; | 401 | return 0; |
396 | } | 402 | } |
397 | 403 | ||
398 | static int tumbler_get_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 404 | static int tumbler_get_drc_value(struct snd_kcontrol *kcontrol, |
405 | struct snd_ctl_elem_value *ucontrol) | ||
399 | { | 406 | { |
400 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 407 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
401 | pmac_tumbler_t *mix; | 408 | struct pmac_tumbler *mix; |
402 | if (! (mix = chip->mixer_data)) | 409 | if (! (mix = chip->mixer_data)) |
403 | return -ENODEV; | 410 | return -ENODEV; |
404 | ucontrol->value.integer.value[0] = mix->drc_range; | 411 | ucontrol->value.integer.value[0] = mix->drc_range; |
405 | return 0; | 412 | return 0; |
406 | } | 413 | } |
407 | 414 | ||
408 | static int tumbler_put_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 415 | static int tumbler_put_drc_value(struct snd_kcontrol *kcontrol, |
416 | struct snd_ctl_elem_value *ucontrol) | ||
409 | { | 417 | { |
410 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 418 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
411 | pmac_tumbler_t *mix; | 419 | struct pmac_tumbler *mix; |
412 | int change; | 420 | int change; |
413 | 421 | ||
414 | if (! (mix = chip->mixer_data)) | 422 | if (! (mix = chip->mixer_data)) |
@@ -424,20 +432,22 @@ static int tumbler_put_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t | |||
424 | return change; | 432 | return change; |
425 | } | 433 | } |
426 | 434 | ||
427 | static int tumbler_get_drc_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 435 | static int tumbler_get_drc_switch(struct snd_kcontrol *kcontrol, |
436 | struct snd_ctl_elem_value *ucontrol) | ||
428 | { | 437 | { |
429 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 438 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
430 | pmac_tumbler_t *mix; | 439 | struct pmac_tumbler *mix; |
431 | if (! (mix = chip->mixer_data)) | 440 | if (! (mix = chip->mixer_data)) |
432 | return -ENODEV; | 441 | return -ENODEV; |
433 | ucontrol->value.integer.value[0] = mix->drc_enable; | 442 | ucontrol->value.integer.value[0] = mix->drc_enable; |
434 | return 0; | 443 | return 0; |
435 | } | 444 | } |
436 | 445 | ||
437 | static int tumbler_put_drc_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 446 | static int tumbler_put_drc_switch(struct snd_kcontrol *kcontrol, |
447 | struct snd_ctl_elem_value *ucontrol) | ||
438 | { | 448 | { |
439 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 449 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
440 | pmac_tumbler_t *mix; | 450 | struct pmac_tumbler *mix; |
441 | int change; | 451 | int change; |
442 | 452 | ||
443 | if (! (mix = chip->mixer_data)) | 453 | if (! (mix = chip->mixer_data)) |
@@ -466,7 +476,8 @@ struct tumbler_mono_vol { | |||
466 | unsigned int *table; | 476 | unsigned int *table; |
467 | }; | 477 | }; |
468 | 478 | ||
469 | static int tumbler_set_mono_volume(pmac_tumbler_t *mix, struct tumbler_mono_vol *info) | 479 | static int tumbler_set_mono_volume(struct pmac_tumbler *mix, |
480 | struct tumbler_mono_vol *info) | ||
470 | { | 481 | { |
471 | unsigned char block[4]; | 482 | unsigned char block[4]; |
472 | unsigned int vol; | 483 | unsigned int vol; |
@@ -489,7 +500,8 @@ static int tumbler_set_mono_volume(pmac_tumbler_t *mix, struct tumbler_mono_vol | |||
489 | return 0; | 500 | return 0; |
490 | } | 501 | } |
491 | 502 | ||
492 | static int tumbler_info_mono(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 503 | static int tumbler_info_mono(struct snd_kcontrol *kcontrol, |
504 | struct snd_ctl_elem_info *uinfo) | ||
493 | { | 505 | { |
494 | struct tumbler_mono_vol *info = (struct tumbler_mono_vol *)kcontrol->private_value; | 506 | struct tumbler_mono_vol *info = (struct tumbler_mono_vol *)kcontrol->private_value; |
495 | 507 | ||
@@ -500,22 +512,24 @@ static int tumbler_info_mono(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinf | |||
500 | return 0; | 512 | return 0; |
501 | } | 513 | } |
502 | 514 | ||
503 | static int tumbler_get_mono(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 515 | static int tumbler_get_mono(struct snd_kcontrol *kcontrol, |
516 | struct snd_ctl_elem_value *ucontrol) | ||
504 | { | 517 | { |
505 | struct tumbler_mono_vol *info = (struct tumbler_mono_vol *)kcontrol->private_value; | 518 | struct tumbler_mono_vol *info = (struct tumbler_mono_vol *)kcontrol->private_value; |
506 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 519 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
507 | pmac_tumbler_t *mix; | 520 | struct pmac_tumbler *mix; |
508 | if (! (mix = chip->mixer_data)) | 521 | if (! (mix = chip->mixer_data)) |
509 | return -ENODEV; | 522 | return -ENODEV; |
510 | ucontrol->value.integer.value[0] = mix->mono_vol[info->index]; | 523 | ucontrol->value.integer.value[0] = mix->mono_vol[info->index]; |
511 | return 0; | 524 | return 0; |
512 | } | 525 | } |
513 | 526 | ||
514 | static int tumbler_put_mono(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 527 | static int tumbler_put_mono(struct snd_kcontrol *kcontrol, |
528 | struct snd_ctl_elem_value *ucontrol) | ||
515 | { | 529 | { |
516 | struct tumbler_mono_vol *info = (struct tumbler_mono_vol *)kcontrol->private_value; | 530 | struct tumbler_mono_vol *info = (struct tumbler_mono_vol *)kcontrol->private_value; |
517 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 531 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
518 | pmac_tumbler_t *mix; | 532 | struct pmac_tumbler *mix; |
519 | int change; | 533 | int change; |
520 | 534 | ||
521 | if (! (mix = chip->mixer_data)) | 535 | if (! (mix = chip->mixer_data)) |
@@ -594,7 +608,7 @@ static struct tumbler_mono_vol snapper_treble_vol_info = { | |||
594 | * snapper mixer volumes | 608 | * snapper mixer volumes |
595 | */ | 609 | */ |
596 | 610 | ||
597 | static int snapper_set_mix_vol1(pmac_tumbler_t *mix, int idx, int ch, int reg) | 611 | static int snapper_set_mix_vol1(struct pmac_tumbler *mix, int idx, int ch, int reg) |
598 | { | 612 | { |
599 | int i, j, vol; | 613 | int i, j, vol; |
600 | unsigned char block[9]; | 614 | unsigned char block[9]; |
@@ -618,7 +632,7 @@ static int snapper_set_mix_vol1(pmac_tumbler_t *mix, int idx, int ch, int reg) | |||
618 | return 0; | 632 | return 0; |
619 | } | 633 | } |
620 | 634 | ||
621 | static int snapper_set_mix_vol(pmac_tumbler_t *mix, int idx) | 635 | static int snapper_set_mix_vol(struct pmac_tumbler *mix, int idx) |
622 | { | 636 | { |
623 | if (! mix->i2c.client) | 637 | if (! mix->i2c.client) |
624 | return -ENODEV; | 638 | return -ENODEV; |
@@ -628,7 +642,8 @@ static int snapper_set_mix_vol(pmac_tumbler_t *mix, int idx) | |||
628 | return 0; | 642 | return 0; |
629 | } | 643 | } |
630 | 644 | ||
631 | static int snapper_info_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 645 | static int snapper_info_mix(struct snd_kcontrol *kcontrol, |
646 | struct snd_ctl_elem_info *uinfo) | ||
632 | { | 647 | { |
633 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 648 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
634 | uinfo->count = 2; | 649 | uinfo->count = 2; |
@@ -637,11 +652,12 @@ static int snapper_info_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo | |||
637 | return 0; | 652 | return 0; |
638 | } | 653 | } |
639 | 654 | ||
640 | static int snapper_get_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 655 | static int snapper_get_mix(struct snd_kcontrol *kcontrol, |
656 | struct snd_ctl_elem_value *ucontrol) | ||
641 | { | 657 | { |
642 | int idx = (int)kcontrol->private_value; | 658 | int idx = (int)kcontrol->private_value; |
643 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 659 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
644 | pmac_tumbler_t *mix; | 660 | struct pmac_tumbler *mix; |
645 | if (! (mix = chip->mixer_data)) | 661 | if (! (mix = chip->mixer_data)) |
646 | return -ENODEV; | 662 | return -ENODEV; |
647 | ucontrol->value.integer.value[0] = mix->mix_vol[idx][0]; | 663 | ucontrol->value.integer.value[0] = mix->mix_vol[idx][0]; |
@@ -649,11 +665,12 @@ static int snapper_get_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucont | |||
649 | return 0; | 665 | return 0; |
650 | } | 666 | } |
651 | 667 | ||
652 | static int snapper_put_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 668 | static int snapper_put_mix(struct snd_kcontrol *kcontrol, |
669 | struct snd_ctl_elem_value *ucontrol) | ||
653 | { | 670 | { |
654 | int idx = (int)kcontrol->private_value; | 671 | int idx = (int)kcontrol->private_value; |
655 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 672 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
656 | pmac_tumbler_t *mix; | 673 | struct pmac_tumbler *mix; |
657 | int change; | 674 | int change; |
658 | 675 | ||
659 | if (! (mix = chip->mixer_data)) | 676 | if (! (mix = chip->mixer_data)) |
@@ -676,11 +693,12 @@ static int snapper_put_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucont | |||
676 | 693 | ||
677 | enum { TUMBLER_MUTE_HP, TUMBLER_MUTE_AMP, TUMBLER_MUTE_LINE }; | 694 | enum { TUMBLER_MUTE_HP, TUMBLER_MUTE_AMP, TUMBLER_MUTE_LINE }; |
678 | 695 | ||
679 | static int tumbler_get_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 696 | static int tumbler_get_mute_switch(struct snd_kcontrol *kcontrol, |
697 | struct snd_ctl_elem_value *ucontrol) | ||
680 | { | 698 | { |
681 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 699 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
682 | pmac_tumbler_t *mix; | 700 | struct pmac_tumbler *mix; |
683 | pmac_gpio_t *gp; | 701 | struct pmac_gpio *gp; |
684 | if (! (mix = chip->mixer_data)) | 702 | if (! (mix = chip->mixer_data)) |
685 | return -ENODEV; | 703 | return -ENODEV; |
686 | switch(kcontrol->private_value) { | 704 | switch(kcontrol->private_value) { |
@@ -699,11 +717,12 @@ static int tumbler_get_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_ | |||
699 | return 0; | 717 | return 0; |
700 | } | 718 | } |
701 | 719 | ||
702 | static int tumbler_put_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 720 | static int tumbler_put_mute_switch(struct snd_kcontrol *kcontrol, |
721 | struct snd_ctl_elem_value *ucontrol) | ||
703 | { | 722 | { |
704 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 723 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
705 | pmac_tumbler_t *mix; | 724 | struct pmac_tumbler *mix; |
706 | pmac_gpio_t *gp; | 725 | struct pmac_gpio *gp; |
707 | int val; | 726 | int val; |
708 | #ifdef PMAC_SUPPORT_AUTOMUTE | 727 | #ifdef PMAC_SUPPORT_AUTOMUTE |
709 | if (chip->update_automute && chip->auto_mute) | 728 | if (chip->update_automute && chip->auto_mute) |
@@ -731,7 +750,7 @@ static int tumbler_put_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_ | |||
731 | return 0; | 750 | return 0; |
732 | } | 751 | } |
733 | 752 | ||
734 | static int snapper_set_capture_source(pmac_tumbler_t *mix) | 753 | static int snapper_set_capture_source(struct pmac_tumbler *mix) |
735 | { | 754 | { |
736 | if (! mix->i2c.client) | 755 | if (! mix->i2c.client) |
737 | return -ENODEV; | 756 | return -ENODEV; |
@@ -742,7 +761,8 @@ static int snapper_set_capture_source(pmac_tumbler_t *mix) | |||
742 | return i2c_smbus_write_byte_data(mix->i2c.client, TAS_REG_ACS, mix->acs); | 761 | return i2c_smbus_write_byte_data(mix->i2c.client, TAS_REG_ACS, mix->acs); |
743 | } | 762 | } |
744 | 763 | ||
745 | static int snapper_info_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 764 | static int snapper_info_capture_source(struct snd_kcontrol *kcontrol, |
765 | struct snd_ctl_elem_info *uinfo) | ||
746 | { | 766 | { |
747 | static char *texts[2] = { | 767 | static char *texts[2] = { |
748 | "Line", "Mic" | 768 | "Line", "Mic" |
@@ -756,20 +776,22 @@ static int snapper_info_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_in | |||
756 | return 0; | 776 | return 0; |
757 | } | 777 | } |
758 | 778 | ||
759 | static int snapper_get_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 779 | static int snapper_get_capture_source(struct snd_kcontrol *kcontrol, |
780 | struct snd_ctl_elem_value *ucontrol) | ||
760 | { | 781 | { |
761 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 782 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
762 | pmac_tumbler_t *mix = chip->mixer_data; | 783 | struct pmac_tumbler *mix = chip->mixer_data; |
763 | 784 | ||
764 | snd_assert(mix, return -ENODEV); | 785 | snd_assert(mix, return -ENODEV); |
765 | ucontrol->value.integer.value[0] = mix->capture_source; | 786 | ucontrol->value.integer.value[0] = mix->capture_source; |
766 | return 0; | 787 | return 0; |
767 | } | 788 | } |
768 | 789 | ||
769 | static int snapper_put_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 790 | static int snapper_put_capture_source(struct snd_kcontrol *kcontrol, |
791 | struct snd_ctl_elem_value *ucontrol) | ||
770 | { | 792 | { |
771 | pmac_t *chip = snd_kcontrol_chip(kcontrol); | 793 | struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); |
772 | pmac_tumbler_t *mix = chip->mixer_data; | 794 | struct pmac_tumbler *mix = chip->mixer_data; |
773 | int change; | 795 | int change; |
774 | 796 | ||
775 | snd_assert(mix, return -ENODEV); | 797 | snd_assert(mix, return -ENODEV); |
@@ -794,7 +816,7 @@ static int snapper_put_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_val | |||
794 | 816 | ||
795 | /* | 817 | /* |
796 | */ | 818 | */ |
797 | static snd_kcontrol_new_t tumbler_mixers[] __initdata = { | 819 | static struct snd_kcontrol_new tumbler_mixers[] __initdata = { |
798 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 820 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
799 | .name = "Master Playback Volume", | 821 | .name = "Master Playback Volume", |
800 | .info = tumbler_info_master_volume, | 822 | .info = tumbler_info_master_volume, |
@@ -818,7 +840,7 @@ static snd_kcontrol_new_t tumbler_mixers[] __initdata = { | |||
818 | }, | 840 | }, |
819 | }; | 841 | }; |
820 | 842 | ||
821 | static snd_kcontrol_new_t snapper_mixers[] __initdata = { | 843 | static struct snd_kcontrol_new snapper_mixers[] __initdata = { |
822 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 844 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
823 | .name = "Master Playback Volume", | 845 | .name = "Master Playback Volume", |
824 | .info = tumbler_info_master_volume, | 846 | .info = tumbler_info_master_volume, |
@@ -850,7 +872,7 @@ static snd_kcontrol_new_t snapper_mixers[] __initdata = { | |||
850 | }, | 872 | }, |
851 | }; | 873 | }; |
852 | 874 | ||
853 | static snd_kcontrol_new_t tumbler_hp_sw __initdata = { | 875 | static struct snd_kcontrol_new tumbler_hp_sw __initdata = { |
854 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 876 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
855 | .name = "Headphone Playback Switch", | 877 | .name = "Headphone Playback Switch", |
856 | .info = snd_pmac_boolean_mono_info, | 878 | .info = snd_pmac_boolean_mono_info, |
@@ -858,7 +880,7 @@ static snd_kcontrol_new_t tumbler_hp_sw __initdata = { | |||
858 | .put = tumbler_put_mute_switch, | 880 | .put = tumbler_put_mute_switch, |
859 | .private_value = TUMBLER_MUTE_HP, | 881 | .private_value = TUMBLER_MUTE_HP, |
860 | }; | 882 | }; |
861 | static snd_kcontrol_new_t tumbler_speaker_sw __initdata = { | 883 | static struct snd_kcontrol_new tumbler_speaker_sw __initdata = { |
862 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 884 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
863 | .name = "PC Speaker Playback Switch", | 885 | .name = "PC Speaker Playback Switch", |
864 | .info = snd_pmac_boolean_mono_info, | 886 | .info = snd_pmac_boolean_mono_info, |
@@ -866,7 +888,7 @@ static snd_kcontrol_new_t tumbler_speaker_sw __initdata = { | |||
866 | .put = tumbler_put_mute_switch, | 888 | .put = tumbler_put_mute_switch, |
867 | .private_value = TUMBLER_MUTE_AMP, | 889 | .private_value = TUMBLER_MUTE_AMP, |
868 | }; | 890 | }; |
869 | static snd_kcontrol_new_t tumbler_lineout_sw __initdata = { | 891 | static struct snd_kcontrol_new tumbler_lineout_sw __initdata = { |
870 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 892 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
871 | .name = "Line Out Playback Switch", | 893 | .name = "Line Out Playback Switch", |
872 | .info = snd_pmac_boolean_mono_info, | 894 | .info = snd_pmac_boolean_mono_info, |
@@ -874,7 +896,7 @@ static snd_kcontrol_new_t tumbler_lineout_sw __initdata = { | |||
874 | .put = tumbler_put_mute_switch, | 896 | .put = tumbler_put_mute_switch, |
875 | .private_value = TUMBLER_MUTE_LINE, | 897 | .private_value = TUMBLER_MUTE_LINE, |
876 | }; | 898 | }; |
877 | static snd_kcontrol_new_t tumbler_drc_sw __initdata = { | 899 | static struct snd_kcontrol_new tumbler_drc_sw __initdata = { |
878 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 900 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
879 | .name = "DRC Switch", | 901 | .name = "DRC Switch", |
880 | .info = snd_pmac_boolean_mono_info, | 902 | .info = snd_pmac_boolean_mono_info, |
@@ -887,9 +909,9 @@ static snd_kcontrol_new_t tumbler_drc_sw __initdata = { | |||
887 | /* | 909 | /* |
888 | * auto-mute stuffs | 910 | * auto-mute stuffs |
889 | */ | 911 | */ |
890 | static int tumbler_detect_headphone(pmac_t *chip) | 912 | static int tumbler_detect_headphone(struct snd_pmac *chip) |
891 | { | 913 | { |
892 | pmac_tumbler_t *mix = chip->mixer_data; | 914 | struct pmac_tumbler *mix = chip->mixer_data; |
893 | int detect = 0; | 915 | int detect = 0; |
894 | 916 | ||
895 | if (mix->hp_detect.addr) | 917 | if (mix->hp_detect.addr) |
@@ -897,9 +919,9 @@ static int tumbler_detect_headphone(pmac_t *chip) | |||
897 | return detect; | 919 | return detect; |
898 | } | 920 | } |
899 | 921 | ||
900 | static int tumbler_detect_lineout(pmac_t *chip) | 922 | static int tumbler_detect_lineout(struct snd_pmac *chip) |
901 | { | 923 | { |
902 | pmac_tumbler_t *mix = chip->mixer_data; | 924 | struct pmac_tumbler *mix = chip->mixer_data; |
903 | int detect = 0; | 925 | int detect = 0; |
904 | 926 | ||
905 | if (mix->line_detect.addr) | 927 | if (mix->line_detect.addr) |
@@ -907,7 +929,8 @@ static int tumbler_detect_lineout(pmac_t *chip) | |||
907 | return detect; | 929 | return detect; |
908 | } | 930 | } |
909 | 931 | ||
910 | static void check_mute(pmac_t *chip, pmac_gpio_t *gp, int val, int do_notify, snd_kcontrol_t *sw) | 932 | static void check_mute(struct snd_pmac *chip, struct pmac_gpio *gp, int val, int do_notify, |
933 | struct snd_kcontrol *sw) | ||
911 | { | 934 | { |
912 | if (check_audio_gpio(gp) != val) { | 935 | if (check_audio_gpio(gp) != val) { |
913 | write_audio_gpio(gp, val); | 936 | write_audio_gpio(gp, val); |
@@ -921,8 +944,8 @@ static struct work_struct device_change; | |||
921 | 944 | ||
922 | static void device_change_handler(void *self) | 945 | static void device_change_handler(void *self) |
923 | { | 946 | { |
924 | pmac_t *chip = (pmac_t*) self; | 947 | struct snd_pmac *chip = self; |
925 | pmac_tumbler_t *mix; | 948 | struct pmac_tumbler *mix; |
926 | int headphone, lineout; | 949 | int headphone, lineout; |
927 | 950 | ||
928 | if (!chip) | 951 | if (!chip) |
@@ -979,10 +1002,10 @@ static void device_change_handler(void *self) | |||
979 | tumbler_set_master_volume(mix); | 1002 | tumbler_set_master_volume(mix); |
980 | } | 1003 | } |
981 | 1004 | ||
982 | static void tumbler_update_automute(pmac_t *chip, int do_notify) | 1005 | static void tumbler_update_automute(struct snd_pmac *chip, int do_notify) |
983 | { | 1006 | { |
984 | if (chip->auto_mute) { | 1007 | if (chip->auto_mute) { |
985 | pmac_tumbler_t *mix; | 1008 | struct pmac_tumbler *mix; |
986 | mix = chip->mixer_data; | 1009 | mix = chip->mixer_data; |
987 | snd_assert(mix, return); | 1010 | snd_assert(mix, return); |
988 | mix->auto_mute_notify = do_notify; | 1011 | mix->auto_mute_notify = do_notify; |
@@ -995,7 +1018,7 @@ static void tumbler_update_automute(pmac_t *chip, int do_notify) | |||
995 | /* interrupt - headphone plug changed */ | 1018 | /* interrupt - headphone plug changed */ |
996 | static irqreturn_t headphone_intr(int irq, void *devid, struct pt_regs *regs) | 1019 | static irqreturn_t headphone_intr(int irq, void *devid, struct pt_regs *regs) |
997 | { | 1020 | { |
998 | pmac_t *chip = devid; | 1021 | struct snd_pmac *chip = devid; |
999 | if (chip->update_automute && chip->initialized) { | 1022 | if (chip->update_automute && chip->initialized) { |
1000 | chip->update_automute(chip, 1); | 1023 | chip->update_automute(chip, 1); |
1001 | return IRQ_HANDLED; | 1024 | return IRQ_HANDLED; |
@@ -1035,7 +1058,8 @@ static struct device_node *find_compatible_audio_device(const char *name) | |||
1035 | } | 1058 | } |
1036 | 1059 | ||
1037 | /* find an audio device and get its address */ | 1060 | /* find an audio device and get its address */ |
1038 | static long tumbler_find_device(const char *device, const char *platform, pmac_gpio_t *gp, int is_compatible) | 1061 | static long tumbler_find_device(const char *device, const char *platform, |
1062 | struct pmac_gpio *gp, int is_compatible) | ||
1039 | { | 1063 | { |
1040 | struct device_node *node; | 1064 | struct device_node *node; |
1041 | u32 *base, addr; | 1065 | u32 *base, addr; |
@@ -1101,9 +1125,9 @@ static long tumbler_find_device(const char *device, const char *platform, pmac_g | |||
1101 | } | 1125 | } |
1102 | 1126 | ||
1103 | /* reset audio */ | 1127 | /* reset audio */ |
1104 | static void tumbler_reset_audio(pmac_t *chip) | 1128 | static void tumbler_reset_audio(struct snd_pmac *chip) |
1105 | { | 1129 | { |
1106 | pmac_tumbler_t *mix = chip->mixer_data; | 1130 | struct pmac_tumbler *mix = chip->mixer_data; |
1107 | 1131 | ||
1108 | if (mix->anded_reset) { | 1132 | if (mix->anded_reset) { |
1109 | DBG("(I) codec anded reset !\n"); | 1133 | DBG("(I) codec anded reset !\n"); |
@@ -1130,9 +1154,9 @@ static void tumbler_reset_audio(pmac_t *chip) | |||
1130 | 1154 | ||
1131 | #ifdef CONFIG_PM | 1155 | #ifdef CONFIG_PM |
1132 | /* suspend mixer */ | 1156 | /* suspend mixer */ |
1133 | static void tumbler_suspend(pmac_t *chip) | 1157 | static void tumbler_suspend(struct snd_pmac *chip) |
1134 | { | 1158 | { |
1135 | pmac_tumbler_t *mix = chip->mixer_data; | 1159 | struct pmac_tumbler *mix = chip->mixer_data; |
1136 | 1160 | ||
1137 | if (mix->headphone_irq >= 0) | 1161 | if (mix->headphone_irq >= 0) |
1138 | disable_irq(mix->headphone_irq); | 1162 | disable_irq(mix->headphone_irq); |
@@ -1160,9 +1184,9 @@ static void tumbler_suspend(pmac_t *chip) | |||
1160 | } | 1184 | } |
1161 | 1185 | ||
1162 | /* resume mixer */ | 1186 | /* resume mixer */ |
1163 | static void tumbler_resume(pmac_t *chip) | 1187 | static void tumbler_resume(struct snd_pmac *chip) |
1164 | { | 1188 | { |
1165 | pmac_tumbler_t *mix = chip->mixer_data; | 1189 | struct pmac_tumbler *mix = chip->mixer_data; |
1166 | 1190 | ||
1167 | snd_assert(mix, return); | 1191 | snd_assert(mix, return); |
1168 | 1192 | ||
@@ -1194,18 +1218,24 @@ static void tumbler_resume(pmac_t *chip) | |||
1194 | tumbler_set_master_volume(mix); | 1218 | tumbler_set_master_volume(mix); |
1195 | if (chip->update_automute) | 1219 | if (chip->update_automute) |
1196 | chip->update_automute(chip, 0); | 1220 | chip->update_automute(chip, 0); |
1197 | if (mix->headphone_irq >= 0) | 1221 | if (mix->headphone_irq >= 0) { |
1222 | unsigned char val; | ||
1223 | |||
1198 | enable_irq(mix->headphone_irq); | 1224 | enable_irq(mix->headphone_irq); |
1225 | /* activate headphone status interrupts */ | ||
1226 | val = do_gpio_read(&mix->hp_detect); | ||
1227 | do_gpio_write(&mix->hp_detect, val | 0x80); | ||
1228 | } | ||
1199 | if (mix->lineout_irq >= 0) | 1229 | if (mix->lineout_irq >= 0) |
1200 | enable_irq(mix->lineout_irq); | 1230 | enable_irq(mix->lineout_irq); |
1201 | } | 1231 | } |
1202 | #endif | 1232 | #endif |
1203 | 1233 | ||
1204 | /* initialize tumbler */ | 1234 | /* initialize tumbler */ |
1205 | static int __init tumbler_init(pmac_t *chip) | 1235 | static int __init tumbler_init(struct snd_pmac *chip) |
1206 | { | 1236 | { |
1207 | int irq; | 1237 | int irq; |
1208 | pmac_tumbler_t *mix = chip->mixer_data; | 1238 | struct pmac_tumbler *mix = chip->mixer_data; |
1209 | snd_assert(mix, return -EINVAL); | 1239 | snd_assert(mix, return -EINVAL); |
1210 | 1240 | ||
1211 | if (tumbler_find_device("audio-hw-reset", | 1241 | if (tumbler_find_device("audio-hw-reset", |
@@ -1253,9 +1283,9 @@ static int __init tumbler_init(pmac_t *chip) | |||
1253 | return 0; | 1283 | return 0; |
1254 | } | 1284 | } |
1255 | 1285 | ||
1256 | static void tumbler_cleanup(pmac_t *chip) | 1286 | static void tumbler_cleanup(struct snd_pmac *chip) |
1257 | { | 1287 | { |
1258 | pmac_tumbler_t *mix = chip->mixer_data; | 1288 | struct pmac_tumbler *mix = chip->mixer_data; |
1259 | if (! mix) | 1289 | if (! mix) |
1260 | return; | 1290 | return; |
1261 | 1291 | ||
@@ -1273,10 +1303,10 @@ static void tumbler_cleanup(pmac_t *chip) | |||
1273 | } | 1303 | } |
1274 | 1304 | ||
1275 | /* exported */ | 1305 | /* exported */ |
1276 | int __init snd_pmac_tumbler_init(pmac_t *chip) | 1306 | int __init snd_pmac_tumbler_init(struct snd_pmac *chip) |
1277 | { | 1307 | { |
1278 | int i, err; | 1308 | int i, err; |
1279 | pmac_tumbler_t *mix; | 1309 | struct pmac_tumbler *mix; |
1280 | u32 *paddr; | 1310 | u32 *paddr; |
1281 | struct device_node *tas_node, *np; | 1311 | struct device_node *tas_node, *np; |
1282 | char *chipname; | 1312 | char *chipname; |