aboutsummaryrefslogtreecommitdiffstats
path: root/sound/ppc/tumbler.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 09:09:46 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:20:00 -0500
commit65b29f5039b38a5854b5e12238b0688a33e235cc (patch)
treebcbb2986d8a6b247387c0f7516c8f43dddeaf07c /sound/ppc/tumbler.c
parentbbe85bbd02b2220c819ad1e33c9d6327131ad281 (diff)
[ALSA] Remove xxx_t typedefs: PowerMac
Remove xxx_t typedefs from the PowerMac driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/ppc/tumbler.c')
-rw-r--r--sound/ppc/tumbler.c244
1 files changed, 134 insertions, 110 deletions
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index d74bfabe5300..15c63cb2ccba 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
85typedef struct pmac_gpio { 85struct 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
92typedef struct pmac_tumbler_t { 92struct 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
121static int send_init_client(pmac_keywest_t *i2c, unsigned int *regs) 121static 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
141static int tumbler_init_client(pmac_keywest_t *i2c) 141static 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
152static int snapper_init_client(pmac_keywest_t *i2c) 152static 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
176static void write_audio_gpio(pmac_gpio_t *gp, int active) 176static 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
185static int check_audio_gpio(pmac_gpio_t *gp) 185static 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
197static int read_audio_gpio(pmac_gpio_t *gp) 197static 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 */
209static int tumbler_set_master_volume(pmac_tumbler_t *mix) 209static 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 */
252static int tumbler_info_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 252static 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
261static int tumbler_get_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 262static 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
271static int tumbler_put_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 273static 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 */
289static int tumbler_get_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 292static 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
299static int tumbler_put_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 303static 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
323static int tumbler_set_drc(pmac_tumbler_t *mix) 328static 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
357static int snapper_set_drc(pmac_tumbler_t *mix) 362static 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
387static int tumbler_info_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 392static 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
398static int tumbler_get_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 404static 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
408static int tumbler_put_drc_value(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 415static 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
427static int tumbler_get_drc_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 435static 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
437static int tumbler_put_drc_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 446static 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
469static int tumbler_set_mono_volume(pmac_tumbler_t *mix, struct tumbler_mono_vol *info) 479static 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
492static int tumbler_info_mono(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 503static 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
503static int tumbler_get_mono(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 515static 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
514static int tumbler_put_mono(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 527static 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
597static int snapper_set_mix_vol1(pmac_tumbler_t *mix, int idx, int ch, int reg) 611static 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
621static int snapper_set_mix_vol(pmac_tumbler_t *mix, int idx) 635static 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
631static int snapper_info_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 645static 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
640static int snapper_get_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 655static 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
652static int snapper_put_mix(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 668static 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
677enum { TUMBLER_MUTE_HP, TUMBLER_MUTE_AMP, TUMBLER_MUTE_LINE }; 694enum { TUMBLER_MUTE_HP, TUMBLER_MUTE_AMP, TUMBLER_MUTE_LINE };
678 695
679static int tumbler_get_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 696static 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
702static int tumbler_put_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 720static 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
734static int snapper_set_capture_source(pmac_tumbler_t *mix) 753static 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
745static int snapper_info_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 764static 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
759static int snapper_get_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 779static 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
769static int snapper_put_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 790static 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 */
797static snd_kcontrol_new_t tumbler_mixers[] __initdata = { 819static 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
821static snd_kcontrol_new_t snapper_mixers[] __initdata = { 843static 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
853static snd_kcontrol_new_t tumbler_hp_sw __initdata = { 875static 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};
861static snd_kcontrol_new_t tumbler_speaker_sw __initdata = { 883static 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};
869static snd_kcontrol_new_t tumbler_lineout_sw __initdata = { 891static 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};
877static snd_kcontrol_new_t tumbler_drc_sw __initdata = { 899static 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 */
890static int tumbler_detect_headphone(pmac_t *chip) 912static 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
900static int tumbler_detect_lineout(pmac_t *chip) 922static 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
910static void check_mute(pmac_t *chip, pmac_gpio_t *gp, int val, int do_notify, snd_kcontrol_t *sw) 932static 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
922static void device_change_handler(void *self) 945static 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
982static void tumbler_update_automute(pmac_t *chip, int do_notify) 1005static 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 */
996static irqreturn_t headphone_intr(int irq, void *devid, struct pt_regs *regs) 1019static 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 */
1038static long tumbler_find_device(const char *device, const char *platform, pmac_gpio_t *gp, int is_compatible) 1061static 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 */
1104static void tumbler_reset_audio(pmac_t *chip) 1128static 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 */
1133static void tumbler_suspend(pmac_t *chip) 1157static 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 */
1163static void tumbler_resume(pmac_t *chip) 1187static 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
@@ -1208,10 +1232,10 @@ static void tumbler_resume(pmac_t *chip)
1208#endif 1232#endif
1209 1233
1210/* initialize tumbler */ 1234/* initialize tumbler */
1211static int __init tumbler_init(pmac_t *chip) 1235static int __init tumbler_init(struct snd_pmac *chip)
1212{ 1236{
1213 int irq; 1237 int irq;
1214 pmac_tumbler_t *mix = chip->mixer_data; 1238 struct pmac_tumbler *mix = chip->mixer_data;
1215 snd_assert(mix, return -EINVAL); 1239 snd_assert(mix, return -EINVAL);
1216 1240
1217 if (tumbler_find_device("audio-hw-reset", 1241 if (tumbler_find_device("audio-hw-reset",
@@ -1259,9 +1283,9 @@ static int __init tumbler_init(pmac_t *chip)
1259 return 0; 1283 return 0;
1260} 1284}
1261 1285
1262static void tumbler_cleanup(pmac_t *chip) 1286static void tumbler_cleanup(struct snd_pmac *chip)
1263{ 1287{
1264 pmac_tumbler_t *mix = chip->mixer_data; 1288 struct pmac_tumbler *mix = chip->mixer_data;
1265 if (! mix) 1289 if (! mix)
1266 return; 1290 return;
1267 1291
@@ -1279,10 +1303,10 @@ static void tumbler_cleanup(pmac_t *chip)
1279} 1303}
1280 1304
1281/* exported */ 1305/* exported */
1282int __init snd_pmac_tumbler_init(pmac_t *chip) 1306int __init snd_pmac_tumbler_init(struct snd_pmac *chip)
1283{ 1307{
1284 int i, err; 1308 int i, err;
1285 pmac_tumbler_t *mix; 1309 struct pmac_tumbler *mix;
1286 u32 *paddr; 1310 u32 *paddr;
1287 struct device_node *tas_node, *np; 1311 struct device_node *tas_node, *np;
1288 char *chipname; 1312 char *chipname;