diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 08:21:36 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:18:12 -0500 |
commit | ee42381e71c56328db9e9d64d19a4de7a2f09a93 (patch) | |
tree | 641cdecfa64347efb7d402c707412e0a45fe7ced /sound/pci/ac97/ac97_codec.c | |
parent | dc4cafbadad1ae2322e598f2cb72720ef4095fee (diff) |
[ALSA] Remove xxx_t typedefs: AC97
Modules: AC97 Codec
Remove xxx_t typedefs from the AC97 codec support.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ac97/ac97_codec.c')
-rw-r--r-- | sound/pci/ac97/ac97_codec.c | 313 |
1 files changed, 157 insertions, 156 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 9bde76c4c6a2..bdb6a8cc0ae6 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -50,16 +50,16 @@ MODULE_PARM_DESC(enable_loopback, "Enable AC97 ADC/DAC Loopback Control"); | |||
50 | 50 | ||
51 | */ | 51 | */ |
52 | 52 | ||
53 | typedef struct { | 53 | struct ac97_codec_id { |
54 | unsigned int id; | 54 | unsigned int id; |
55 | unsigned int mask; | 55 | unsigned int mask; |
56 | const char *name; | 56 | const char *name; |
57 | int (*patch)(ac97_t *ac97); | 57 | int (*patch)(struct snd_ac97 *ac97); |
58 | int (*mpatch)(ac97_t *ac97); | 58 | int (*mpatch)(struct snd_ac97 *ac97); |
59 | unsigned int flags; | 59 | unsigned int flags; |
60 | } ac97_codec_id_t; | 60 | }; |
61 | 61 | ||
62 | static const ac97_codec_id_t snd_ac97_codec_id_vendors[] = { | 62 | static const struct ac97_codec_id snd_ac97_codec_id_vendors[] = { |
63 | { 0x414b4d00, 0xffffff00, "Asahi Kasei", NULL, NULL }, | 63 | { 0x414b4d00, 0xffffff00, "Asahi Kasei", NULL, NULL }, |
64 | { 0x41445300, 0xffffff00, "Analog Devices", NULL, NULL }, | 64 | { 0x41445300, 0xffffff00, "Analog Devices", NULL, NULL }, |
65 | { 0x414c4300, 0xffffff00, "Realtek", NULL, NULL }, | 65 | { 0x414c4300, 0xffffff00, "Realtek", NULL, NULL }, |
@@ -86,7 +86,7 @@ static const ac97_codec_id_t snd_ac97_codec_id_vendors[] = { | |||
86 | { 0, 0, NULL, NULL, NULL } | 86 | { 0, 0, NULL, NULL, NULL } |
87 | }; | 87 | }; |
88 | 88 | ||
89 | static const ac97_codec_id_t snd_ac97_codec_ids[] = { | 89 | static const struct ac97_codec_id snd_ac97_codec_ids[] = { |
90 | { 0x414b4d00, 0xffffffff, "AK4540", NULL, NULL }, | 90 | { 0x414b4d00, 0xffffffff, "AK4540", NULL, NULL }, |
91 | { 0x414b4d01, 0xffffffff, "AK4542", NULL, NULL }, | 91 | { 0x414b4d01, 0xffffffff, "AK4542", NULL, NULL }, |
92 | { 0x414b4d02, 0xffffffff, "AK4543", NULL, NULL }, | 92 | { 0x414b4d02, 0xffffffff, "AK4543", NULL, NULL }, |
@@ -225,7 +225,7 @@ const char *snd_ac97_stereo_enhancements[] = | |||
225 | * I/O routines | 225 | * I/O routines |
226 | */ | 226 | */ |
227 | 227 | ||
228 | static int snd_ac97_valid_reg(ac97_t *ac97, unsigned short reg) | 228 | static int snd_ac97_valid_reg(struct snd_ac97 *ac97, unsigned short reg) |
229 | { | 229 | { |
230 | if (ac97->limited_regs && ! test_bit(reg, ac97->reg_accessed)) | 230 | if (ac97->limited_regs && ! test_bit(reg, ac97->reg_accessed)) |
231 | return 0; | 231 | return 0; |
@@ -278,7 +278,7 @@ static int snd_ac97_valid_reg(ac97_t *ac97, unsigned short reg) | |||
278 | * #snd_ca97_write_cache(), so use this only when you don't want to | 278 | * #snd_ca97_write_cache(), so use this only when you don't want to |
279 | * reflect the change to the suspend/resume state. | 279 | * reflect the change to the suspend/resume state. |
280 | */ | 280 | */ |
281 | void snd_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short value) | 281 | void snd_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short value) |
282 | { | 282 | { |
283 | if (!snd_ac97_valid_reg(ac97, reg)) | 283 | if (!snd_ac97_valid_reg(ac97, reg)) |
284 | return; | 284 | return; |
@@ -301,7 +301,7 @@ void snd_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short value) | |||
301 | * | 301 | * |
302 | * Returns the read value. | 302 | * Returns the read value. |
303 | */ | 303 | */ |
304 | unsigned short snd_ac97_read(ac97_t *ac97, unsigned short reg) | 304 | unsigned short snd_ac97_read(struct snd_ac97 *ac97, unsigned short reg) |
305 | { | 305 | { |
306 | if (!snd_ac97_valid_reg(ac97, reg)) | 306 | if (!snd_ac97_valid_reg(ac97, reg)) |
307 | return 0; | 307 | return 0; |
@@ -309,7 +309,7 @@ unsigned short snd_ac97_read(ac97_t *ac97, unsigned short reg) | |||
309 | } | 309 | } |
310 | 310 | ||
311 | /* read a register - return the cached value if already read */ | 311 | /* read a register - return the cached value if already read */ |
312 | static inline unsigned short snd_ac97_read_cache(ac97_t *ac97, unsigned short reg) | 312 | static inline unsigned short snd_ac97_read_cache(struct snd_ac97 *ac97, unsigned short reg) |
313 | { | 313 | { |
314 | if (! test_bit(reg, ac97->reg_accessed)) { | 314 | if (! test_bit(reg, ac97->reg_accessed)) { |
315 | ac97->regs[reg] = ac97->bus->ops->read(ac97, reg); | 315 | ac97->regs[reg] = ac97->bus->ops->read(ac97, reg); |
@@ -328,7 +328,7 @@ static inline unsigned short snd_ac97_read_cache(ac97_t *ac97, unsigned short re | |||
328 | * cache. The cached values are used for the cached-read and the | 328 | * cache. The cached values are used for the cached-read and the |
329 | * suspend/resume. | 329 | * suspend/resume. |
330 | */ | 330 | */ |
331 | void snd_ac97_write_cache(ac97_t *ac97, unsigned short reg, unsigned short value) | 331 | void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned short value) |
332 | { | 332 | { |
333 | if (!snd_ac97_valid_reg(ac97, reg)) | 333 | if (!snd_ac97_valid_reg(ac97, reg)) |
334 | return; | 334 | return; |
@@ -351,7 +351,7 @@ void snd_ac97_write_cache(ac97_t *ac97, unsigned short reg, unsigned short value | |||
351 | * Returns 1 if the value is changed, 0 if no change, or a negative | 351 | * Returns 1 if the value is changed, 0 if no change, or a negative |
352 | * code on failure. | 352 | * code on failure. |
353 | */ | 353 | */ |
354 | int snd_ac97_update(ac97_t *ac97, unsigned short reg, unsigned short value) | 354 | int snd_ac97_update(struct snd_ac97 *ac97, unsigned short reg, unsigned short value) |
355 | { | 355 | { |
356 | int change; | 356 | int change; |
357 | 357 | ||
@@ -381,7 +381,7 @@ int snd_ac97_update(ac97_t *ac97, unsigned short reg, unsigned short value) | |||
381 | * Returns 1 if the bits are changed, 0 if no change, or a negative | 381 | * Returns 1 if the bits are changed, 0 if no change, or a negative |
382 | * code on failure. | 382 | * code on failure. |
383 | */ | 383 | */ |
384 | int snd_ac97_update_bits(ac97_t *ac97, unsigned short reg, unsigned short mask, unsigned short value) | 384 | int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value) |
385 | { | 385 | { |
386 | int change; | 386 | int change; |
387 | 387 | ||
@@ -394,7 +394,7 @@ int snd_ac97_update_bits(ac97_t *ac97, unsigned short reg, unsigned short mask, | |||
394 | } | 394 | } |
395 | 395 | ||
396 | /* no lock version - see snd_ac97_updat_bits() */ | 396 | /* no lock version - see snd_ac97_updat_bits() */ |
397 | int snd_ac97_update_bits_nolock(ac97_t *ac97, unsigned short reg, | 397 | int snd_ac97_update_bits_nolock(struct snd_ac97 *ac97, unsigned short reg, |
398 | unsigned short mask, unsigned short value) | 398 | unsigned short mask, unsigned short value) |
399 | { | 399 | { |
400 | int change; | 400 | int change; |
@@ -411,7 +411,7 @@ int snd_ac97_update_bits_nolock(ac97_t *ac97, unsigned short reg, | |||
411 | return change; | 411 | return change; |
412 | } | 412 | } |
413 | 413 | ||
414 | static int snd_ac97_ad18xx_update_pcm_bits(ac97_t *ac97, int codec, unsigned short mask, unsigned short value) | 414 | static int snd_ac97_ad18xx_update_pcm_bits(struct snd_ac97 *ac97, int codec, unsigned short mask, unsigned short value) |
415 | { | 415 | { |
416 | int change; | 416 | int change; |
417 | unsigned short old, new, cfg; | 417 | unsigned short old, new, cfg; |
@@ -443,7 +443,7 @@ static int snd_ac97_ad18xx_update_pcm_bits(ac97_t *ac97, int codec, unsigned sho | |||
443 | * Controls | 443 | * Controls |
444 | */ | 444 | */ |
445 | 445 | ||
446 | int snd_ac97_info_enum_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) | 446 | int snd_ac97_info_enum_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
447 | { | 447 | { |
448 | struct ac97_enum *e = (struct ac97_enum *)kcontrol->private_value; | 448 | struct ac97_enum *e = (struct ac97_enum *)kcontrol->private_value; |
449 | 449 | ||
@@ -457,9 +457,9 @@ int snd_ac97_info_enum_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * ui | |||
457 | return 0; | 457 | return 0; |
458 | } | 458 | } |
459 | 459 | ||
460 | int snd_ac97_get_enum_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 460 | int snd_ac97_get_enum_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
461 | { | 461 | { |
462 | ac97_t *ac97 = snd_kcontrol_chip(kcontrol); | 462 | struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); |
463 | struct ac97_enum *e = (struct ac97_enum *)kcontrol->private_value; | 463 | struct ac97_enum *e = (struct ac97_enum *)kcontrol->private_value; |
464 | unsigned short val, bitmask; | 464 | unsigned short val, bitmask; |
465 | 465 | ||
@@ -473,9 +473,9 @@ int snd_ac97_get_enum_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * u | |||
473 | return 0; | 473 | return 0; |
474 | } | 474 | } |
475 | 475 | ||
476 | int snd_ac97_put_enum_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 476 | int snd_ac97_put_enum_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
477 | { | 477 | { |
478 | ac97_t *ac97 = snd_kcontrol_chip(kcontrol); | 478 | struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); |
479 | struct ac97_enum *e = (struct ac97_enum *)kcontrol->private_value; | 479 | struct ac97_enum *e = (struct ac97_enum *)kcontrol->private_value; |
480 | unsigned short val; | 480 | unsigned short val; |
481 | unsigned short mask, bitmask; | 481 | unsigned short mask, bitmask; |
@@ -496,7 +496,7 @@ int snd_ac97_put_enum_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * u | |||
496 | } | 496 | } |
497 | 497 | ||
498 | /* save/restore ac97 v2.3 paging */ | 498 | /* save/restore ac97 v2.3 paging */ |
499 | static int snd_ac97_page_save(ac97_t *ac97, int reg, snd_kcontrol_t *kcontrol) | 499 | static int snd_ac97_page_save(struct snd_ac97 *ac97, int reg, struct snd_kcontrol *kcontrol) |
500 | { | 500 | { |
501 | int page_save = -1; | 501 | int page_save = -1; |
502 | if ((kcontrol->private_value & (1<<25)) && | 502 | if ((kcontrol->private_value & (1<<25)) && |
@@ -510,7 +510,7 @@ static int snd_ac97_page_save(ac97_t *ac97, int reg, snd_kcontrol_t *kcontrol) | |||
510 | return page_save; | 510 | return page_save; |
511 | } | 511 | } |
512 | 512 | ||
513 | static void snd_ac97_page_restore(ac97_t *ac97, int page_save) | 513 | static void snd_ac97_page_restore(struct snd_ac97 *ac97, int page_save) |
514 | { | 514 | { |
515 | if (page_save >= 0) { | 515 | if (page_save >= 0) { |
516 | snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, page_save); | 516 | snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, page_save); |
@@ -519,7 +519,7 @@ static void snd_ac97_page_restore(ac97_t *ac97, int page_save) | |||
519 | } | 519 | } |
520 | 520 | ||
521 | /* volume and switch controls */ | 521 | /* volume and switch controls */ |
522 | int snd_ac97_info_volsw(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) | 522 | int snd_ac97_info_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
523 | { | 523 | { |
524 | int mask = (kcontrol->private_value >> 16) & 0xff; | 524 | int mask = (kcontrol->private_value >> 16) & 0xff; |
525 | int shift = (kcontrol->private_value >> 8) & 0x0f; | 525 | int shift = (kcontrol->private_value >> 8) & 0x0f; |
@@ -532,9 +532,9 @@ int snd_ac97_info_volsw(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) | |||
532 | return 0; | 532 | return 0; |
533 | } | 533 | } |
534 | 534 | ||
535 | int snd_ac97_get_volsw(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 535 | int snd_ac97_get_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
536 | { | 536 | { |
537 | ac97_t *ac97 = snd_kcontrol_chip(kcontrol); | 537 | struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); |
538 | int reg = kcontrol->private_value & 0xff; | 538 | int reg = kcontrol->private_value & 0xff; |
539 | int shift = (kcontrol->private_value >> 8) & 0x0f; | 539 | int shift = (kcontrol->private_value >> 8) & 0x0f; |
540 | int rshift = (kcontrol->private_value >> 12) & 0x0f; | 540 | int rshift = (kcontrol->private_value >> 12) & 0x0f; |
@@ -555,9 +555,9 @@ int snd_ac97_get_volsw(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontro | |||
555 | return 0; | 555 | return 0; |
556 | } | 556 | } |
557 | 557 | ||
558 | int snd_ac97_put_volsw(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 558 | int snd_ac97_put_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
559 | { | 559 | { |
560 | ac97_t *ac97 = snd_kcontrol_chip(kcontrol); | 560 | struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); |
561 | int reg = kcontrol->private_value & 0xff; | 561 | int reg = kcontrol->private_value & 0xff; |
562 | int shift = (kcontrol->private_value >> 8) & 0x0f; | 562 | int shift = (kcontrol->private_value >> 8) & 0x0f; |
563 | int rshift = (kcontrol->private_value >> 12) & 0x0f; | 563 | int rshift = (kcontrol->private_value >> 12) & 0x0f; |
@@ -584,22 +584,22 @@ int snd_ac97_put_volsw(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontro | |||
584 | return err; | 584 | return err; |
585 | } | 585 | } |
586 | 586 | ||
587 | static const snd_kcontrol_new_t snd_ac97_controls_master_mono[2] = { | 587 | static const struct snd_kcontrol_new snd_ac97_controls_master_mono[2] = { |
588 | AC97_SINGLE("Master Mono Playback Switch", AC97_MASTER_MONO, 15, 1, 1), | 588 | AC97_SINGLE("Master Mono Playback Switch", AC97_MASTER_MONO, 15, 1, 1), |
589 | AC97_SINGLE("Master Mono Playback Volume", AC97_MASTER_MONO, 0, 31, 1) | 589 | AC97_SINGLE("Master Mono Playback Volume", AC97_MASTER_MONO, 0, 31, 1) |
590 | }; | 590 | }; |
591 | 591 | ||
592 | static const snd_kcontrol_new_t snd_ac97_controls_tone[2] = { | 592 | static const struct snd_kcontrol_new snd_ac97_controls_tone[2] = { |
593 | AC97_SINGLE("Tone Control - Bass", AC97_MASTER_TONE, 8, 15, 1), | 593 | AC97_SINGLE("Tone Control - Bass", AC97_MASTER_TONE, 8, 15, 1), |
594 | AC97_SINGLE("Tone Control - Treble", AC97_MASTER_TONE, 0, 15, 1) | 594 | AC97_SINGLE("Tone Control - Treble", AC97_MASTER_TONE, 0, 15, 1) |
595 | }; | 595 | }; |
596 | 596 | ||
597 | static const snd_kcontrol_new_t snd_ac97_controls_pc_beep[2] = { | 597 | static const struct snd_kcontrol_new snd_ac97_controls_pc_beep[2] = { |
598 | AC97_SINGLE("PC Speaker Playback Switch", AC97_PC_BEEP, 15, 1, 1), | 598 | AC97_SINGLE("PC Speaker Playback Switch", AC97_PC_BEEP, 15, 1, 1), |
599 | AC97_SINGLE("PC Speaker Playback Volume", AC97_PC_BEEP, 1, 15, 1) | 599 | AC97_SINGLE("PC Speaker Playback Volume", AC97_PC_BEEP, 1, 15, 1) |
600 | }; | 600 | }; |
601 | 601 | ||
602 | static const snd_kcontrol_new_t snd_ac97_controls_mic_boost = | 602 | static const struct snd_kcontrol_new snd_ac97_controls_mic_boost = |
603 | AC97_SINGLE("Mic Boost (+20dB)", AC97_MIC, 6, 1, 0); | 603 | AC97_SINGLE("Mic Boost (+20dB)", AC97_MIC, 6, 1, 0); |
604 | 604 | ||
605 | 605 | ||
@@ -615,18 +615,18 @@ AC97_ENUM_SINGLE(AC97_GENERAL_PURPOSE, 9, 2, std_mix), | |||
615 | AC97_ENUM_SINGLE(AC97_GENERAL_PURPOSE, 8, 2, std_mic), | 615 | AC97_ENUM_SINGLE(AC97_GENERAL_PURPOSE, 8, 2, std_mic), |
616 | }; | 616 | }; |
617 | 617 | ||
618 | static const snd_kcontrol_new_t snd_ac97_control_capture_src = | 618 | static const struct snd_kcontrol_new snd_ac97_control_capture_src = |
619 | AC97_ENUM("Capture Source", std_enum[0]); | 619 | AC97_ENUM("Capture Source", std_enum[0]); |
620 | 620 | ||
621 | static const snd_kcontrol_new_t snd_ac97_control_capture_vol = | 621 | static const struct snd_kcontrol_new snd_ac97_control_capture_vol = |
622 | AC97_DOUBLE("Capture Volume", AC97_REC_GAIN, 8, 0, 15, 0); | 622 | AC97_DOUBLE("Capture Volume", AC97_REC_GAIN, 8, 0, 15, 0); |
623 | 623 | ||
624 | static const snd_kcontrol_new_t snd_ac97_controls_mic_capture[2] = { | 624 | static const struct snd_kcontrol_new snd_ac97_controls_mic_capture[2] = { |
625 | AC97_SINGLE("Mic Capture Switch", AC97_REC_GAIN_MIC, 15, 1, 1), | 625 | AC97_SINGLE("Mic Capture Switch", AC97_REC_GAIN_MIC, 15, 1, 1), |
626 | AC97_SINGLE("Mic Capture Volume", AC97_REC_GAIN_MIC, 0, 15, 0) | 626 | AC97_SINGLE("Mic Capture Volume", AC97_REC_GAIN_MIC, 0, 15, 0) |
627 | }; | 627 | }; |
628 | 628 | ||
629 | typedef enum { | 629 | enum { |
630 | AC97_GENERAL_PCM_OUT = 0, | 630 | AC97_GENERAL_PCM_OUT = 0, |
631 | AC97_GENERAL_STEREO_ENHANCEMENT, | 631 | AC97_GENERAL_STEREO_ENHANCEMENT, |
632 | AC97_GENERAL_3D, | 632 | AC97_GENERAL_3D, |
@@ -634,9 +634,9 @@ typedef enum { | |||
634 | AC97_GENERAL_MONO, | 634 | AC97_GENERAL_MONO, |
635 | AC97_GENERAL_MIC, | 635 | AC97_GENERAL_MIC, |
636 | AC97_GENERAL_LOOPBACK | 636 | AC97_GENERAL_LOOPBACK |
637 | } ac97_general_index_t; | 637 | }; |
638 | 638 | ||
639 | static const snd_kcontrol_new_t snd_ac97_controls_general[7] = { | 639 | static const struct snd_kcontrol_new snd_ac97_controls_general[7] = { |
640 | AC97_ENUM("PCM Out Path & Mute", std_enum[1]), | 640 | AC97_ENUM("PCM Out Path & Mute", std_enum[1]), |
641 | AC97_SINGLE("Simulated Stereo Enhancement", AC97_GENERAL_PURPOSE, 14, 1, 0), | 641 | AC97_SINGLE("Simulated Stereo Enhancement", AC97_GENERAL_PURPOSE, 14, 1, 0), |
642 | AC97_SINGLE("3D Control - Switch", AC97_GENERAL_PURPOSE, 13, 1, 0), | 642 | AC97_SINGLE("3D Control - Switch", AC97_GENERAL_PURPOSE, 13, 1, 0), |
@@ -646,45 +646,45 @@ AC97_ENUM("Mic Select", std_enum[3]), | |||
646 | AC97_SINGLE("ADC/DAC Loopback", AC97_GENERAL_PURPOSE, 7, 1, 0) | 646 | AC97_SINGLE("ADC/DAC Loopback", AC97_GENERAL_PURPOSE, 7, 1, 0) |
647 | }; | 647 | }; |
648 | 648 | ||
649 | const snd_kcontrol_new_t snd_ac97_controls_3d[2] = { | 649 | const struct snd_kcontrol_new snd_ac97_controls_3d[2] = { |
650 | AC97_SINGLE("3D Control - Center", AC97_3D_CONTROL, 8, 15, 0), | 650 | AC97_SINGLE("3D Control - Center", AC97_3D_CONTROL, 8, 15, 0), |
651 | AC97_SINGLE("3D Control - Depth", AC97_3D_CONTROL, 0, 15, 0) | 651 | AC97_SINGLE("3D Control - Depth", AC97_3D_CONTROL, 0, 15, 0) |
652 | }; | 652 | }; |
653 | 653 | ||
654 | static const snd_kcontrol_new_t snd_ac97_controls_center[2] = { | 654 | static const struct snd_kcontrol_new snd_ac97_controls_center[2] = { |
655 | AC97_SINGLE("Center Playback Switch", AC97_CENTER_LFE_MASTER, 7, 1, 1), | 655 | AC97_SINGLE("Center Playback Switch", AC97_CENTER_LFE_MASTER, 7, 1, 1), |
656 | AC97_SINGLE("Center Playback Volume", AC97_CENTER_LFE_MASTER, 0, 31, 1) | 656 | AC97_SINGLE("Center Playback Volume", AC97_CENTER_LFE_MASTER, 0, 31, 1) |
657 | }; | 657 | }; |
658 | 658 | ||
659 | static const snd_kcontrol_new_t snd_ac97_controls_lfe[2] = { | 659 | static const struct snd_kcontrol_new snd_ac97_controls_lfe[2] = { |
660 | AC97_SINGLE("LFE Playback Switch", AC97_CENTER_LFE_MASTER, 15, 1, 1), | 660 | AC97_SINGLE("LFE Playback Switch", AC97_CENTER_LFE_MASTER, 15, 1, 1), |
661 | AC97_SINGLE("LFE Playback Volume", AC97_CENTER_LFE_MASTER, 8, 31, 1) | 661 | AC97_SINGLE("LFE Playback Volume", AC97_CENTER_LFE_MASTER, 8, 31, 1) |
662 | }; | 662 | }; |
663 | 663 | ||
664 | static const snd_kcontrol_new_t snd_ac97_control_eapd = | 664 | static const struct snd_kcontrol_new snd_ac97_control_eapd = |
665 | AC97_SINGLE("External Amplifier", AC97_POWERDOWN, 15, 1, 1); | 665 | AC97_SINGLE("External Amplifier", AC97_POWERDOWN, 15, 1, 1); |
666 | 666 | ||
667 | static const snd_kcontrol_new_t snd_ac97_controls_modem_switches[2] = { | 667 | static const struct snd_kcontrol_new snd_ac97_controls_modem_switches[2] = { |
668 | AC97_SINGLE("Off-hook Switch", AC97_GPIO_STATUS, 0, 1, 0), | 668 | AC97_SINGLE("Off-hook Switch", AC97_GPIO_STATUS, 0, 1, 0), |
669 | AC97_SINGLE("Caller ID Switch", AC97_GPIO_STATUS, 2, 1, 0) | 669 | AC97_SINGLE("Caller ID Switch", AC97_GPIO_STATUS, 2, 1, 0) |
670 | }; | 670 | }; |
671 | 671 | ||
672 | /* change the existing EAPD control as inverted */ | 672 | /* change the existing EAPD control as inverted */ |
673 | static void set_inv_eapd(ac97_t *ac97, snd_kcontrol_t *kctl) | 673 | static void set_inv_eapd(struct snd_ac97 *ac97, struct snd_kcontrol *kctl) |
674 | { | 674 | { |
675 | kctl->private_value = AC97_SINGLE_VALUE(AC97_POWERDOWN, 15, 1, 0); | 675 | kctl->private_value = AC97_SINGLE_VALUE(AC97_POWERDOWN, 15, 1, 0); |
676 | snd_ac97_update_bits(ac97, AC97_POWERDOWN, (1<<15), (1<<15)); /* EAPD up */ | 676 | snd_ac97_update_bits(ac97, AC97_POWERDOWN, (1<<15), (1<<15)); /* EAPD up */ |
677 | ac97->scaps |= AC97_SCAP_INV_EAPD; | 677 | ac97->scaps |= AC97_SCAP_INV_EAPD; |
678 | } | 678 | } |
679 | 679 | ||
680 | static int snd_ac97_spdif_mask_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) | 680 | static int snd_ac97_spdif_mask_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
681 | { | 681 | { |
682 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; | 682 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; |
683 | uinfo->count = 1; | 683 | uinfo->count = 1; |
684 | return 0; | 684 | return 0; |
685 | } | 685 | } |
686 | 686 | ||
687 | static int snd_ac97_spdif_cmask_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t * ucontrol) | 687 | static int snd_ac97_spdif_cmask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
688 | { | 688 | { |
689 | ucontrol->value.iec958.status[0] = IEC958_AES0_PROFESSIONAL | | 689 | ucontrol->value.iec958.status[0] = IEC958_AES0_PROFESSIONAL | |
690 | IEC958_AES0_NONAUDIO | | 690 | IEC958_AES0_NONAUDIO | |
@@ -696,7 +696,7 @@ static int snd_ac97_spdif_cmask_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value | |||
696 | return 0; | 696 | return 0; |
697 | } | 697 | } |
698 | 698 | ||
699 | static int snd_ac97_spdif_pmask_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t * ucontrol) | 699 | static int snd_ac97_spdif_pmask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
700 | { | 700 | { |
701 | /* FIXME: AC'97 spec doesn't say which bits are used for what */ | 701 | /* FIXME: AC'97 spec doesn't say which bits are used for what */ |
702 | ucontrol->value.iec958.status[0] = IEC958_AES0_PROFESSIONAL | | 702 | ucontrol->value.iec958.status[0] = IEC958_AES0_PROFESSIONAL | |
@@ -706,9 +706,9 @@ static int snd_ac97_spdif_pmask_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value | |||
706 | return 0; | 706 | return 0; |
707 | } | 707 | } |
708 | 708 | ||
709 | static int snd_ac97_spdif_default_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t * ucontrol) | 709 | static int snd_ac97_spdif_default_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
710 | { | 710 | { |
711 | ac97_t *ac97 = snd_kcontrol_chip(kcontrol); | 711 | struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); |
712 | 712 | ||
713 | down(&ac97->reg_mutex); | 713 | down(&ac97->reg_mutex); |
714 | ucontrol->value.iec958.status[0] = ac97->spdif_status & 0xff; | 714 | ucontrol->value.iec958.status[0] = ac97->spdif_status & 0xff; |
@@ -719,9 +719,9 @@ static int snd_ac97_spdif_default_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_val | |||
719 | return 0; | 719 | return 0; |
720 | } | 720 | } |
721 | 721 | ||
722 | static int snd_ac97_spdif_default_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t * ucontrol) | 722 | static int snd_ac97_spdif_default_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
723 | { | 723 | { |
724 | ac97_t *ac97 = snd_kcontrol_chip(kcontrol); | 724 | struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); |
725 | unsigned int new = 0; | 725 | unsigned int new = 0; |
726 | unsigned short val = 0; | 726 | unsigned short val = 0; |
727 | int change; | 727 | int change; |
@@ -787,9 +787,9 @@ static int snd_ac97_spdif_default_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_val | |||
787 | return change; | 787 | return change; |
788 | } | 788 | } |
789 | 789 | ||
790 | static int snd_ac97_put_spsa(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 790 | static int snd_ac97_put_spsa(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
791 | { | 791 | { |
792 | ac97_t *ac97 = snd_kcontrol_chip(kcontrol); | 792 | struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); |
793 | int reg = kcontrol->private_value & 0xff; | 793 | int reg = kcontrol->private_value & 0xff; |
794 | int shift = (kcontrol->private_value >> 8) & 0xff; | 794 | int shift = (kcontrol->private_value >> 8) & 0xff; |
795 | int mask = (kcontrol->private_value >> 16) & 0xff; | 795 | int mask = (kcontrol->private_value >> 16) & 0xff; |
@@ -817,7 +817,7 @@ static int snd_ac97_put_spsa(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uco | |||
817 | return change; | 817 | return change; |
818 | } | 818 | } |
819 | 819 | ||
820 | const snd_kcontrol_new_t snd_ac97_controls_spdif[5] = { | 820 | const struct snd_kcontrol_new snd_ac97_controls_spdif[5] = { |
821 | { | 821 | { |
822 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 822 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
823 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 823 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
@@ -856,9 +856,9 @@ const snd_kcontrol_new_t snd_ac97_controls_spdif[5] = { | |||
856 | .get = snd_ac97_ad18xx_pcm_get_bits, .put = snd_ac97_ad18xx_pcm_put_bits, \ | 856 | .get = snd_ac97_ad18xx_pcm_get_bits, .put = snd_ac97_ad18xx_pcm_put_bits, \ |
857 | .private_value = (codec) | ((lshift) << 8) | ((rshift) << 12) | ((mask) << 16) } | 857 | .private_value = (codec) | ((lshift) << 8) | ((rshift) << 12) | ((mask) << 16) } |
858 | 858 | ||
859 | static int snd_ac97_ad18xx_pcm_info_bits(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) | 859 | static int snd_ac97_ad18xx_pcm_info_bits(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
860 | { | 860 | { |
861 | ac97_t *ac97 = snd_kcontrol_chip(kcontrol); | 861 | struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); |
862 | int mask = (kcontrol->private_value >> 16) & 0x0f; | 862 | int mask = (kcontrol->private_value >> 16) & 0x0f; |
863 | int lshift = (kcontrol->private_value >> 8) & 0x0f; | 863 | int lshift = (kcontrol->private_value >> 8) & 0x0f; |
864 | int rshift = (kcontrol->private_value >> 12) & 0x0f; | 864 | int rshift = (kcontrol->private_value >> 12) & 0x0f; |
@@ -873,9 +873,9 @@ static int snd_ac97_ad18xx_pcm_info_bits(snd_kcontrol_t *kcontrol, snd_ctl_elem_ | |||
873 | return 0; | 873 | return 0; |
874 | } | 874 | } |
875 | 875 | ||
876 | static int snd_ac97_ad18xx_pcm_get_bits(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 876 | static int snd_ac97_ad18xx_pcm_get_bits(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
877 | { | 877 | { |
878 | ac97_t *ac97 = snd_kcontrol_chip(kcontrol); | 878 | struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); |
879 | int codec = kcontrol->private_value & 3; | 879 | int codec = kcontrol->private_value & 3; |
880 | int lshift = (kcontrol->private_value >> 8) & 0x0f; | 880 | int lshift = (kcontrol->private_value >> 8) & 0x0f; |
881 | int rshift = (kcontrol->private_value >> 12) & 0x0f; | 881 | int rshift = (kcontrol->private_value >> 12) & 0x0f; |
@@ -887,9 +887,9 @@ static int snd_ac97_ad18xx_pcm_get_bits(snd_kcontrol_t * kcontrol, snd_ctl_elem_ | |||
887 | return 0; | 887 | return 0; |
888 | } | 888 | } |
889 | 889 | ||
890 | static int snd_ac97_ad18xx_pcm_put_bits(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 890 | static int snd_ac97_ad18xx_pcm_put_bits(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
891 | { | 891 | { |
892 | ac97_t *ac97 = snd_kcontrol_chip(kcontrol); | 892 | struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); |
893 | int codec = kcontrol->private_value & 3; | 893 | int codec = kcontrol->private_value & 3; |
894 | int lshift = (kcontrol->private_value >> 8) & 0x0f; | 894 | int lshift = (kcontrol->private_value >> 8) & 0x0f; |
895 | int rshift = (kcontrol->private_value >> 12) & 0x0f; | 895 | int rshift = (kcontrol->private_value >> 12) & 0x0f; |
@@ -910,7 +910,7 @@ static int snd_ac97_ad18xx_pcm_put_bits(snd_kcontrol_t * kcontrol, snd_ctl_elem_ | |||
910 | .get = snd_ac97_ad18xx_pcm_get_volume, .put = snd_ac97_ad18xx_pcm_put_volume, \ | 910 | .get = snd_ac97_ad18xx_pcm_get_volume, .put = snd_ac97_ad18xx_pcm_put_volume, \ |
911 | .private_value = codec } | 911 | .private_value = codec } |
912 | 912 | ||
913 | static int snd_ac97_ad18xx_pcm_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) | 913 | static int snd_ac97_ad18xx_pcm_info_volume(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
914 | { | 914 | { |
915 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 915 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
916 | uinfo->count = 2; | 916 | uinfo->count = 2; |
@@ -919,9 +919,9 @@ static int snd_ac97_ad18xx_pcm_info_volume(snd_kcontrol_t *kcontrol, snd_ctl_ele | |||
919 | return 0; | 919 | return 0; |
920 | } | 920 | } |
921 | 921 | ||
922 | static int snd_ac97_ad18xx_pcm_get_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 922 | static int snd_ac97_ad18xx_pcm_get_volume(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
923 | { | 923 | { |
924 | ac97_t *ac97 = snd_kcontrol_chip(kcontrol); | 924 | struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); |
925 | int codec = kcontrol->private_value & 3; | 925 | int codec = kcontrol->private_value & 3; |
926 | 926 | ||
927 | down(&ac97->page_mutex); | 927 | down(&ac97->page_mutex); |
@@ -931,9 +931,9 @@ static int snd_ac97_ad18xx_pcm_get_volume(snd_kcontrol_t * kcontrol, snd_ctl_ele | |||
931 | return 0; | 931 | return 0; |
932 | } | 932 | } |
933 | 933 | ||
934 | static int snd_ac97_ad18xx_pcm_put_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 934 | static int snd_ac97_ad18xx_pcm_put_volume(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
935 | { | 935 | { |
936 | ac97_t *ac97 = snd_kcontrol_chip(kcontrol); | 936 | struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); |
937 | int codec = kcontrol->private_value & 3; | 937 | int codec = kcontrol->private_value & 3; |
938 | unsigned short val1, val2; | 938 | unsigned short val1, val2; |
939 | 939 | ||
@@ -942,22 +942,22 @@ static int snd_ac97_ad18xx_pcm_put_volume(snd_kcontrol_t * kcontrol, snd_ctl_ele | |||
942 | return snd_ac97_ad18xx_update_pcm_bits(ac97, codec, 0x1f1f, (val1 << 8) | val2); | 942 | return snd_ac97_ad18xx_update_pcm_bits(ac97, codec, 0x1f1f, (val1 << 8) | val2); |
943 | } | 943 | } |
944 | 944 | ||
945 | static const snd_kcontrol_new_t snd_ac97_controls_ad18xx_pcm[2] = { | 945 | static const struct snd_kcontrol_new snd_ac97_controls_ad18xx_pcm[2] = { |
946 | AD18XX_PCM_BITS("PCM Playback Switch", 0, 15, 7, 1), | 946 | AD18XX_PCM_BITS("PCM Playback Switch", 0, 15, 7, 1), |
947 | AD18XX_PCM_VOLUME("PCM Playback Volume", 0) | 947 | AD18XX_PCM_VOLUME("PCM Playback Volume", 0) |
948 | }; | 948 | }; |
949 | 949 | ||
950 | static const snd_kcontrol_new_t snd_ac97_controls_ad18xx_surround[2] = { | 950 | static const struct snd_kcontrol_new snd_ac97_controls_ad18xx_surround[2] = { |
951 | AD18XX_PCM_BITS("Surround Playback Switch", 1, 15, 7, 1), | 951 | AD18XX_PCM_BITS("Surround Playback Switch", 1, 15, 7, 1), |
952 | AD18XX_PCM_VOLUME("Surround Playback Volume", 1) | 952 | AD18XX_PCM_VOLUME("Surround Playback Volume", 1) |
953 | }; | 953 | }; |
954 | 954 | ||
955 | static const snd_kcontrol_new_t snd_ac97_controls_ad18xx_center[2] = { | 955 | static const struct snd_kcontrol_new snd_ac97_controls_ad18xx_center[2] = { |
956 | AD18XX_PCM_BITS("Center Playback Switch", 2, 15, 15, 1), | 956 | AD18XX_PCM_BITS("Center Playback Switch", 2, 15, 15, 1), |
957 | AD18XX_PCM_BITS("Center Playback Volume", 2, 8, 8, 31) | 957 | AD18XX_PCM_BITS("Center Playback Volume", 2, 8, 8, 31) |
958 | }; | 958 | }; |
959 | 959 | ||
960 | static const snd_kcontrol_new_t snd_ac97_controls_ad18xx_lfe[2] = { | 960 | static const struct snd_kcontrol_new snd_ac97_controls_ad18xx_lfe[2] = { |
961 | AD18XX_PCM_BITS("LFE Playback Switch", 2, 7, 7, 1), | 961 | AD18XX_PCM_BITS("LFE Playback Switch", 2, 7, 7, 1), |
962 | AD18XX_PCM_BITS("LFE Playback Volume", 2, 0, 0, 31) | 962 | AD18XX_PCM_BITS("LFE Playback Volume", 2, 0, 0, 31) |
963 | }; | 963 | }; |
@@ -966,9 +966,9 @@ AD18XX_PCM_BITS("LFE Playback Volume", 2, 0, 0, 31) | |||
966 | * | 966 | * |
967 | */ | 967 | */ |
968 | 968 | ||
969 | static void snd_ac97_powerdown(ac97_t *ac97); | 969 | static void snd_ac97_powerdown(struct snd_ac97 *ac97); |
970 | 970 | ||
971 | static int snd_ac97_bus_free(ac97_bus_t *bus) | 971 | static int snd_ac97_bus_free(struct snd_ac97_bus *bus) |
972 | { | 972 | { |
973 | if (bus) { | 973 | if (bus) { |
974 | snd_ac97_bus_proc_done(bus); | 974 | snd_ac97_bus_proc_done(bus); |
@@ -980,13 +980,13 @@ static int snd_ac97_bus_free(ac97_bus_t *bus) | |||
980 | return 0; | 980 | return 0; |
981 | } | 981 | } |
982 | 982 | ||
983 | static int snd_ac97_bus_dev_free(snd_device_t *device) | 983 | static int snd_ac97_bus_dev_free(struct snd_device *device) |
984 | { | 984 | { |
985 | ac97_bus_t *bus = device->device_data; | 985 | struct snd_ac97_bus *bus = device->device_data; |
986 | return snd_ac97_bus_free(bus); | 986 | return snd_ac97_bus_free(bus); |
987 | } | 987 | } |
988 | 988 | ||
989 | static int snd_ac97_free(ac97_t *ac97) | 989 | static int snd_ac97_free(struct snd_ac97 *ac97) |
990 | { | 990 | { |
991 | if (ac97) { | 991 | if (ac97) { |
992 | snd_ac97_proc_done(ac97); | 992 | snd_ac97_proc_done(ac97); |
@@ -999,14 +999,14 @@ static int snd_ac97_free(ac97_t *ac97) | |||
999 | return 0; | 999 | return 0; |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | static int snd_ac97_dev_free(snd_device_t *device) | 1002 | static int snd_ac97_dev_free(struct snd_device *device) |
1003 | { | 1003 | { |
1004 | ac97_t *ac97 = device->device_data; | 1004 | struct snd_ac97 *ac97 = device->device_data; |
1005 | snd_ac97_powerdown(ac97); /* for avoiding click noises during shut down */ | 1005 | snd_ac97_powerdown(ac97); /* for avoiding click noises during shut down */ |
1006 | return snd_ac97_free(ac97); | 1006 | return snd_ac97_free(ac97); |
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | static int snd_ac97_try_volume_mix(ac97_t * ac97, int reg) | 1009 | static int snd_ac97_try_volume_mix(struct snd_ac97 * ac97, int reg) |
1010 | { | 1010 | { |
1011 | unsigned short val, mask = 0x8000; | 1011 | unsigned short val, mask = 0x8000; |
1012 | 1012 | ||
@@ -1052,13 +1052,14 @@ static int snd_ac97_try_volume_mix(ac97_t * ac97, int reg) | |||
1052 | /* try another test */ | 1052 | /* try another test */ |
1053 | snd_ac97_write_cache(ac97, reg, val | mask); | 1053 | snd_ac97_write_cache(ac97, reg, val | mask); |
1054 | val = snd_ac97_read(ac97, reg); | 1054 | val = snd_ac97_read(ac97, reg); |
1055 | val = snd_ac97_read(ac97, reg); | ||
1055 | if (!(val & mask)) | 1056 | if (!(val & mask)) |
1056 | return 0; /* nothing here */ | 1057 | return 0; /* nothing here */ |
1057 | } | 1058 | } |
1058 | return 1; /* success, useable */ | 1059 | return 1; /* success, useable */ |
1059 | } | 1060 | } |
1060 | 1061 | ||
1061 | static void check_volume_resolution(ac97_t *ac97, int reg, unsigned char *lo_max, unsigned char *hi_max) | 1062 | static void check_volume_resolution(struct snd_ac97 *ac97, int reg, unsigned char *lo_max, unsigned char *hi_max) |
1062 | { | 1063 | { |
1063 | unsigned short cbit[3] = { 0x20, 0x10, 0x01 }; | 1064 | unsigned short cbit[3] = { 0x20, 0x10, 0x01 }; |
1064 | unsigned char max[3] = { 63, 31, 15 }; | 1065 | unsigned char max[3] = { 63, 31, 15 }; |
@@ -1083,7 +1084,7 @@ static void check_volume_resolution(ac97_t *ac97, int reg, unsigned char *lo_max | |||
1083 | } | 1084 | } |
1084 | } | 1085 | } |
1085 | 1086 | ||
1086 | int snd_ac97_try_bit(ac97_t * ac97, int reg, int bit) | 1087 | int snd_ac97_try_bit(struct snd_ac97 * ac97, int reg, int bit) |
1087 | { | 1088 | { |
1088 | unsigned short mask, val, orig, res; | 1089 | unsigned short mask, val, orig, res; |
1089 | 1090 | ||
@@ -1097,7 +1098,7 @@ int snd_ac97_try_bit(ac97_t * ac97, int reg, int bit) | |||
1097 | } | 1098 | } |
1098 | 1099 | ||
1099 | /* check the volume resolution of center/lfe */ | 1100 | /* check the volume resolution of center/lfe */ |
1100 | static void snd_ac97_change_volume_params2(ac97_t * ac97, int reg, int shift, unsigned char *max) | 1101 | static void snd_ac97_change_volume_params2(struct snd_ac97 * ac97, int reg, int shift, unsigned char *max) |
1101 | { | 1102 | { |
1102 | unsigned short val, val1; | 1103 | unsigned short val, val1; |
1103 | 1104 | ||
@@ -1123,9 +1124,9 @@ static inline int printable(unsigned int x) | |||
1123 | return x; | 1124 | return x; |
1124 | } | 1125 | } |
1125 | 1126 | ||
1126 | snd_kcontrol_t *snd_ac97_cnew(const snd_kcontrol_new_t *_template, ac97_t * ac97) | 1127 | struct snd_kcontrol *snd_ac97_cnew(const struct snd_kcontrol_new *_template, struct snd_ac97 * ac97) |
1127 | { | 1128 | { |
1128 | snd_kcontrol_new_t template; | 1129 | struct snd_kcontrol_new template; |
1129 | memcpy(&template, _template, sizeof(template)); | 1130 | memcpy(&template, _template, sizeof(template)); |
1130 | template.index = ac97->num; | 1131 | template.index = ac97->num; |
1131 | return snd_ctl_new1(&template, ac97); | 1132 | return snd_ctl_new1(&template, ac97); |
@@ -1134,9 +1135,9 @@ snd_kcontrol_t *snd_ac97_cnew(const snd_kcontrol_new_t *_template, ac97_t * ac97 | |||
1134 | /* | 1135 | /* |
1135 | * create mute switch(es) for normal stereo controls | 1136 | * create mute switch(es) for normal stereo controls |
1136 | */ | 1137 | */ |
1137 | static int snd_ac97_cmute_new_stereo(snd_card_t *card, char *name, int reg, int check_stereo, ac97_t *ac97) | 1138 | static int snd_ac97_cmute_new_stereo(struct snd_card *card, char *name, int reg, int check_stereo, struct snd_ac97 *ac97) |
1138 | { | 1139 | { |
1139 | snd_kcontrol_t *kctl; | 1140 | struct snd_kcontrol *kctl; |
1140 | int err; | 1141 | int err; |
1141 | unsigned short val, val1, mute_mask; | 1142 | unsigned short val, val1, mute_mask; |
1142 | 1143 | ||
@@ -1153,11 +1154,11 @@ static int snd_ac97_cmute_new_stereo(snd_card_t *card, char *name, int reg, int | |||
1153 | mute_mask = 0x8080; | 1154 | mute_mask = 0x8080; |
1154 | } | 1155 | } |
1155 | if (mute_mask == 0x8080) { | 1156 | if (mute_mask == 0x8080) { |
1156 | snd_kcontrol_new_t tmp = AC97_DOUBLE(name, reg, 15, 7, 1, 1); | 1157 | struct snd_kcontrol_new tmp = AC97_DOUBLE(name, reg, 15, 7, 1, 1); |
1157 | tmp.index = ac97->num; | 1158 | tmp.index = ac97->num; |
1158 | kctl = snd_ctl_new1(&tmp, ac97); | 1159 | kctl = snd_ctl_new1(&tmp, ac97); |
1159 | } else { | 1160 | } else { |
1160 | snd_kcontrol_new_t tmp = AC97_SINGLE(name, reg, 15, 1, 1); | 1161 | struct snd_kcontrol_new tmp = AC97_SINGLE(name, reg, 15, 1, 1); |
1161 | tmp.index = ac97->num; | 1162 | tmp.index = ac97->num; |
1162 | kctl = snd_ctl_new1(&tmp, ac97); | 1163 | kctl = snd_ctl_new1(&tmp, ac97); |
1163 | } | 1164 | } |
@@ -1172,22 +1173,22 @@ static int snd_ac97_cmute_new_stereo(snd_card_t *card, char *name, int reg, int | |||
1172 | /* | 1173 | /* |
1173 | * create a volume for normal stereo/mono controls | 1174 | * create a volume for normal stereo/mono controls |
1174 | */ | 1175 | */ |
1175 | static int snd_ac97_cvol_new(snd_card_t *card, char *name, int reg, unsigned int lo_max, | 1176 | static int snd_ac97_cvol_new(struct snd_card *card, char *name, int reg, unsigned int lo_max, |
1176 | unsigned int hi_max, ac97_t *ac97) | 1177 | unsigned int hi_max, struct snd_ac97 *ac97) |
1177 | { | 1178 | { |
1178 | int err; | 1179 | int err; |
1179 | snd_kcontrol_t *kctl; | 1180 | struct snd_kcontrol *kctl; |
1180 | 1181 | ||
1181 | if (! snd_ac97_valid_reg(ac97, reg)) | 1182 | if (! snd_ac97_valid_reg(ac97, reg)) |
1182 | return 0; | 1183 | return 0; |
1183 | if (hi_max) { | 1184 | if (hi_max) { |
1184 | /* invert */ | 1185 | /* invert */ |
1185 | snd_kcontrol_new_t tmp = AC97_DOUBLE(name, reg, 8, 0, lo_max, 1); | 1186 | struct snd_kcontrol_new tmp = AC97_DOUBLE(name, reg, 8, 0, lo_max, 1); |
1186 | tmp.index = ac97->num; | 1187 | tmp.index = ac97->num; |
1187 | kctl = snd_ctl_new1(&tmp, ac97); | 1188 | kctl = snd_ctl_new1(&tmp, ac97); |
1188 | } else { | 1189 | } else { |
1189 | /* invert */ | 1190 | /* invert */ |
1190 | snd_kcontrol_new_t tmp = AC97_SINGLE(name, reg, 0, lo_max, 1); | 1191 | struct snd_kcontrol_new tmp = AC97_SINGLE(name, reg, 0, lo_max, 1); |
1191 | tmp.index = ac97->num; | 1192 | tmp.index = ac97->num; |
1192 | kctl = snd_ctl_new1(&tmp, ac97); | 1193 | kctl = snd_ctl_new1(&tmp, ac97); |
1193 | } | 1194 | } |
@@ -1203,7 +1204,7 @@ static int snd_ac97_cvol_new(snd_card_t *card, char *name, int reg, unsigned int | |||
1203 | /* | 1204 | /* |
1204 | * create a mute-switch and a volume for normal stereo/mono controls | 1205 | * create a mute-switch and a volume for normal stereo/mono controls |
1205 | */ | 1206 | */ |
1206 | static int snd_ac97_cmix_new_stereo(snd_card_t *card, const char *pfx, int reg, int check_stereo, ac97_t *ac97) | 1207 | static int snd_ac97_cmix_new_stereo(struct snd_card *card, const char *pfx, int reg, int check_stereo, struct snd_ac97 *ac97) |
1207 | { | 1208 | { |
1208 | int err; | 1209 | int err; |
1209 | char name[44]; | 1210 | char name[44]; |
@@ -1229,12 +1230,12 @@ static int snd_ac97_cmix_new_stereo(snd_card_t *card, const char *pfx, int reg, | |||
1229 | #define snd_ac97_cmix_new(card, pfx, reg, ac97) snd_ac97_cmix_new_stereo(card, pfx, reg, 0, ac97) | 1230 | #define snd_ac97_cmix_new(card, pfx, reg, ac97) snd_ac97_cmix_new_stereo(card, pfx, reg, 0, ac97) |
1230 | #define snd_ac97_cmute_new(card, name, reg, ac97) snd_ac97_cmute_new_stereo(card, name, reg, 0, ac97) | 1231 | #define snd_ac97_cmute_new(card, name, reg, ac97) snd_ac97_cmute_new_stereo(card, name, reg, 0, ac97) |
1231 | 1232 | ||
1232 | static unsigned int snd_ac97_determine_spdif_rates(ac97_t *ac97); | 1233 | static unsigned int snd_ac97_determine_spdif_rates(struct snd_ac97 *ac97); |
1233 | 1234 | ||
1234 | static int snd_ac97_mixer_build(ac97_t * ac97) | 1235 | static int snd_ac97_mixer_build(struct snd_ac97 * ac97) |
1235 | { | 1236 | { |
1236 | snd_card_t *card = ac97->bus->card; | 1237 | struct snd_card *card = ac97->bus->card; |
1237 | snd_kcontrol_t *kctl; | 1238 | struct snd_kcontrol *kctl; |
1238 | int err; | 1239 | int err; |
1239 | unsigned int idx; | 1240 | unsigned int idx; |
1240 | unsigned char max; | 1241 | unsigned char max; |
@@ -1531,7 +1532,7 @@ static int snd_ac97_mixer_build(ac97_t * ac97) | |||
1531 | return 0; | 1532 | return 0; |
1532 | } | 1533 | } |
1533 | 1534 | ||
1534 | static int snd_ac97_modem_build(snd_card_t * card, ac97_t * ac97) | 1535 | static int snd_ac97_modem_build(struct snd_card *card, struct snd_ac97 * ac97) |
1535 | { | 1536 | { |
1536 | int err, idx; | 1537 | int err, idx; |
1537 | 1538 | ||
@@ -1555,7 +1556,7 @@ static int snd_ac97_modem_build(snd_card_t * card, ac97_t * ac97) | |||
1555 | return 0; | 1556 | return 0; |
1556 | } | 1557 | } |
1557 | 1558 | ||
1558 | static int snd_ac97_test_rate(ac97_t *ac97, int reg, int shadow_reg, int rate) | 1559 | static int snd_ac97_test_rate(struct snd_ac97 *ac97, int reg, int shadow_reg, int rate) |
1559 | { | 1560 | { |
1560 | unsigned short val; | 1561 | unsigned short val; |
1561 | unsigned int tmp; | 1562 | unsigned int tmp; |
@@ -1568,7 +1569,7 @@ static int snd_ac97_test_rate(ac97_t *ac97, int reg, int shadow_reg, int rate) | |||
1568 | return val == (tmp & 0xffff); | 1569 | return val == (tmp & 0xffff); |
1569 | } | 1570 | } |
1570 | 1571 | ||
1571 | static void snd_ac97_determine_rates(ac97_t *ac97, int reg, int shadow_reg, unsigned int *r_result) | 1572 | static void snd_ac97_determine_rates(struct snd_ac97 *ac97, int reg, int shadow_reg, unsigned int *r_result) |
1572 | { | 1573 | { |
1573 | unsigned int result = 0; | 1574 | unsigned int result = 0; |
1574 | unsigned short saved; | 1575 | unsigned short saved; |
@@ -1628,7 +1629,7 @@ static void snd_ac97_determine_rates(ac97_t *ac97, int reg, int shadow_reg, unsi | |||
1628 | } | 1629 | } |
1629 | 1630 | ||
1630 | /* check AC97_SPDIF register to accept which sample rates */ | 1631 | /* check AC97_SPDIF register to accept which sample rates */ |
1631 | static unsigned int snd_ac97_determine_spdif_rates(ac97_t *ac97) | 1632 | static unsigned int snd_ac97_determine_spdif_rates(struct snd_ac97 *ac97) |
1632 | { | 1633 | { |
1633 | unsigned int result = 0; | 1634 | unsigned int result = 0; |
1634 | int i; | 1635 | int i; |
@@ -1648,10 +1649,10 @@ static unsigned int snd_ac97_determine_spdif_rates(ac97_t *ac97) | |||
1648 | } | 1649 | } |
1649 | 1650 | ||
1650 | /* look for the codec id table matching with the given id */ | 1651 | /* look for the codec id table matching with the given id */ |
1651 | static const ac97_codec_id_t *look_for_codec_id(const ac97_codec_id_t *table, | 1652 | static const struct ac97_codec_id *look_for_codec_id(const struct ac97_codec_id *table, |
1652 | unsigned int id) | 1653 | unsigned int id) |
1653 | { | 1654 | { |
1654 | const ac97_codec_id_t *pid; | 1655 | const struct ac97_codec_id *pid; |
1655 | 1656 | ||
1656 | for (pid = table; pid->id; pid++) | 1657 | for (pid = table; pid->id; pid++) |
1657 | if (pid->id == (id & pid->mask)) | 1658 | if (pid->id == (id & pid->mask)) |
@@ -1659,9 +1660,9 @@ static const ac97_codec_id_t *look_for_codec_id(const ac97_codec_id_t *table, | |||
1659 | return NULL; | 1660 | return NULL; |
1660 | } | 1661 | } |
1661 | 1662 | ||
1662 | void snd_ac97_get_name(ac97_t *ac97, unsigned int id, char *name, int modem) | 1663 | void snd_ac97_get_name(struct snd_ac97 *ac97, unsigned int id, char *name, int modem) |
1663 | { | 1664 | { |
1664 | const ac97_codec_id_t *pid; | 1665 | const struct ac97_codec_id *pid; |
1665 | 1666 | ||
1666 | sprintf(name, "0x%x %c%c%c", id, | 1667 | sprintf(name, "0x%x %c%c%c", id, |
1667 | printable(id >> 24), | 1668 | printable(id >> 24), |
@@ -1699,9 +1700,9 @@ void snd_ac97_get_name(ac97_t *ac97, unsigned int id, char *name, int modem) | |||
1699 | * | 1700 | * |
1700 | * Returns the short identifying name of the codec. | 1701 | * Returns the short identifying name of the codec. |
1701 | */ | 1702 | */ |
1702 | const char *snd_ac97_get_short_name(ac97_t *ac97) | 1703 | const char *snd_ac97_get_short_name(struct snd_ac97 *ac97) |
1703 | { | 1704 | { |
1704 | const ac97_codec_id_t *pid; | 1705 | const struct ac97_codec_id *pid; |
1705 | 1706 | ||
1706 | for (pid = snd_ac97_codec_ids; pid->id; pid++) | 1707 | for (pid = snd_ac97_codec_ids; pid->id; pid++) |
1707 | if (pid->id == (ac97->id & pid->mask)) | 1708 | if (pid->id == (ac97->id & pid->mask)) |
@@ -1713,7 +1714,7 @@ const char *snd_ac97_get_short_name(ac97_t *ac97) | |||
1713 | /* wait for a while until registers are accessible after RESET | 1714 | /* wait for a while until registers are accessible after RESET |
1714 | * return 0 if ok, negative not ready | 1715 | * return 0 if ok, negative not ready |
1715 | */ | 1716 | */ |
1716 | static int ac97_reset_wait(ac97_t *ac97, int timeout, int with_modem) | 1717 | static int ac97_reset_wait(struct snd_ac97 *ac97, int timeout, int with_modem) |
1717 | { | 1718 | { |
1718 | unsigned long end_time; | 1719 | unsigned long end_time; |
1719 | unsigned short val; | 1720 | unsigned short val; |
@@ -1758,7 +1759,7 @@ static int ac97_reset_wait(ac97_t *ac97, int timeout, int with_modem) | |||
1758 | * @private_data: private data pointer for the new instance | 1759 | * @private_data: private data pointer for the new instance |
1759 | * @rbus: the pointer to store the new AC97 bus instance. | 1760 | * @rbus: the pointer to store the new AC97 bus instance. |
1760 | * | 1761 | * |
1761 | * Creates an AC97 bus component. An ac97_bus_t instance is newly | 1762 | * Creates an AC97 bus component. An struct snd_ac97_bus instance is newly |
1762 | * allocated and initialized. | 1763 | * allocated and initialized. |
1763 | * | 1764 | * |
1764 | * The ops table must include valid callbacks (at least read and | 1765 | * The ops table must include valid callbacks (at least read and |
@@ -1772,12 +1773,12 @@ static int ac97_reset_wait(ac97_t *ac97, int timeout, int with_modem) | |||
1772 | * | 1773 | * |
1773 | * Returns zero if successful, or a negative error code on failure. | 1774 | * Returns zero if successful, or a negative error code on failure. |
1774 | */ | 1775 | */ |
1775 | int snd_ac97_bus(snd_card_t *card, int num, ac97_bus_ops_t *ops, | 1776 | int snd_ac97_bus(struct snd_card *card, int num, struct snd_ac97_bus_ops *ops, |
1776 | void *private_data, ac97_bus_t **rbus) | 1777 | void *private_data, struct snd_ac97_bus **rbus) |
1777 | { | 1778 | { |
1778 | int err; | 1779 | int err; |
1779 | ac97_bus_t *bus; | 1780 | struct snd_ac97_bus *bus; |
1780 | static snd_device_ops_t dev_ops = { | 1781 | static struct snd_device_ops dev_ops = { |
1781 | .dev_free = snd_ac97_bus_dev_free, | 1782 | .dev_free = snd_ac97_bus_dev_free, |
1782 | }; | 1783 | }; |
1783 | 1784 | ||
@@ -1807,9 +1808,9 @@ static void ac97_device_release(struct device * dev) | |||
1807 | } | 1808 | } |
1808 | 1809 | ||
1809 | /* register ac97 codec to bus */ | 1810 | /* register ac97 codec to bus */ |
1810 | static int snd_ac97_dev_register(snd_device_t *device) | 1811 | static int snd_ac97_dev_register(struct snd_device *device) |
1811 | { | 1812 | { |
1812 | ac97_t *ac97 = device->device_data; | 1813 | struct snd_ac97 *ac97 = device->device_data; |
1813 | int err; | 1814 | int err; |
1814 | 1815 | ||
1815 | ac97->dev.bus = &ac97_bus_type; | 1816 | ac97->dev.bus = &ac97_bus_type; |
@@ -1825,9 +1826,9 @@ static int snd_ac97_dev_register(snd_device_t *device) | |||
1825 | } | 1826 | } |
1826 | 1827 | ||
1827 | /* unregister ac97 codec */ | 1828 | /* unregister ac97 codec */ |
1828 | static int snd_ac97_dev_unregister(snd_device_t *device) | 1829 | static int snd_ac97_dev_unregister(struct snd_device *device) |
1829 | { | 1830 | { |
1830 | ac97_t *ac97 = device->device_data; | 1831 | struct snd_ac97 *ac97 = device->device_data; |
1831 | if (ac97->dev.bus) | 1832 | if (ac97->dev.bus) |
1832 | device_unregister(&ac97->dev); | 1833 | device_unregister(&ac97->dev); |
1833 | return snd_ac97_free(ac97); | 1834 | return snd_ac97_free(ac97); |
@@ -1843,7 +1844,7 @@ static struct snd_ac97_build_ops null_build_ops; | |||
1843 | * the private data. | 1844 | * the private data. |
1844 | * @rac97: the pointer to store the new ac97 instance. | 1845 | * @rac97: the pointer to store the new ac97 instance. |
1845 | * | 1846 | * |
1846 | * Creates an Codec97 component. An ac97_t instance is newly | 1847 | * Creates an Codec97 component. An struct snd_ac97 instance is newly |
1847 | * allocated and initialized from the template. The codec | 1848 | * allocated and initialized from the template. The codec |
1848 | * is then initialized by the standard procedure. | 1849 | * is then initialized by the standard procedure. |
1849 | * | 1850 | * |
@@ -1855,16 +1856,16 @@ static struct snd_ac97_build_ops null_build_ops; | |||
1855 | * | 1856 | * |
1856 | * Returns zero if successful, or a negative error code on failure. | 1857 | * Returns zero if successful, or a negative error code on failure. |
1857 | */ | 1858 | */ |
1858 | int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97) | 1859 | int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, struct snd_ac97 **rac97) |
1859 | { | 1860 | { |
1860 | int err; | 1861 | int err; |
1861 | ac97_t *ac97; | 1862 | struct snd_ac97 *ac97; |
1862 | snd_card_t *card; | 1863 | struct snd_card *card; |
1863 | char name[64]; | 1864 | char name[64]; |
1864 | unsigned long end_time; | 1865 | unsigned long end_time; |
1865 | unsigned int reg; | 1866 | unsigned int reg; |
1866 | const ac97_codec_id_t *pid; | 1867 | const struct ac97_codec_id *pid; |
1867 | static snd_device_ops_t ops = { | 1868 | static struct snd_device_ops ops = { |
1868 | .dev_free = snd_ac97_dev_free, | 1869 | .dev_free = snd_ac97_dev_free, |
1869 | .dev_register = snd_ac97_dev_register, | 1870 | .dev_register = snd_ac97_dev_register, |
1870 | .dev_unregister = snd_ac97_dev_unregister, | 1871 | .dev_unregister = snd_ac97_dev_unregister, |
@@ -2148,7 +2149,7 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97) | |||
2148 | * MASTER and HEADPHONE registers are muted but the register cache values | 2149 | * MASTER and HEADPHONE registers are muted but the register cache values |
2149 | * are not changed, so that the values can be restored in snd_ac97_resume(). | 2150 | * are not changed, so that the values can be restored in snd_ac97_resume(). |
2150 | */ | 2151 | */ |
2151 | static void snd_ac97_powerdown(ac97_t *ac97) | 2152 | static void snd_ac97_powerdown(struct snd_ac97 *ac97) |
2152 | { | 2153 | { |
2153 | unsigned short power; | 2154 | unsigned short power; |
2154 | 2155 | ||
@@ -2181,7 +2182,7 @@ static void snd_ac97_powerdown(ac97_t *ac97) | |||
2181 | * | 2182 | * |
2182 | * Suspends the codec, power down the chip. | 2183 | * Suspends the codec, power down the chip. |
2183 | */ | 2184 | */ |
2184 | void snd_ac97_suspend(ac97_t *ac97) | 2185 | void snd_ac97_suspend(struct snd_ac97 *ac97) |
2185 | { | 2186 | { |
2186 | if (ac97->build_ops->suspend) | 2187 | if (ac97->build_ops->suspend) |
2187 | ac97->build_ops->suspend(ac97); | 2188 | ac97->build_ops->suspend(ac97); |
@@ -2191,7 +2192,7 @@ void snd_ac97_suspend(ac97_t *ac97) | |||
2191 | /* | 2192 | /* |
2192 | * restore ac97 status | 2193 | * restore ac97 status |
2193 | */ | 2194 | */ |
2194 | void snd_ac97_restore_status(ac97_t *ac97) | 2195 | void snd_ac97_restore_status(struct snd_ac97 *ac97) |
2195 | { | 2196 | { |
2196 | int i; | 2197 | int i; |
2197 | 2198 | ||
@@ -2212,7 +2213,7 @@ void snd_ac97_restore_status(ac97_t *ac97) | |||
2212 | /* | 2213 | /* |
2213 | * restore IEC958 status | 2214 | * restore IEC958 status |
2214 | */ | 2215 | */ |
2215 | void snd_ac97_restore_iec958(ac97_t *ac97) | 2216 | void snd_ac97_restore_iec958(struct snd_ac97 *ac97) |
2216 | { | 2217 | { |
2217 | if (ac97->ext_id & AC97_EI_SPDIF) { | 2218 | if (ac97->ext_id & AC97_EI_SPDIF) { |
2218 | if (ac97->regs[AC97_EXTENDED_STATUS] & AC97_EA_SPDIF) { | 2219 | if (ac97->regs[AC97_EXTENDED_STATUS] & AC97_EA_SPDIF) { |
@@ -2235,7 +2236,7 @@ void snd_ac97_restore_iec958(ac97_t *ac97) | |||
2235 | * Do the standard resume procedure, power up and restoring the | 2236 | * Do the standard resume procedure, power up and restoring the |
2236 | * old register values. | 2237 | * old register values. |
2237 | */ | 2238 | */ |
2238 | void snd_ac97_resume(ac97_t *ac97) | 2239 | void snd_ac97_resume(struct snd_ac97 *ac97) |
2239 | { | 2240 | { |
2240 | unsigned long end_time; | 2241 | unsigned long end_time; |
2241 | 2242 | ||
@@ -2301,18 +2302,18 @@ static void set_ctl_name(char *dst, const char *src, const char *suffix) | |||
2301 | } | 2302 | } |
2302 | 2303 | ||
2303 | /* remove the control with the given name and optional suffix */ | 2304 | /* remove the control with the given name and optional suffix */ |
2304 | int snd_ac97_remove_ctl(ac97_t *ac97, const char *name, const char *suffix) | 2305 | int snd_ac97_remove_ctl(struct snd_ac97 *ac97, const char *name, const char *suffix) |
2305 | { | 2306 | { |
2306 | snd_ctl_elem_id_t id; | 2307 | struct snd_ctl_elem_id id; |
2307 | memset(&id, 0, sizeof(id)); | 2308 | memset(&id, 0, sizeof(id)); |
2308 | set_ctl_name(id.name, name, suffix); | 2309 | set_ctl_name(id.name, name, suffix); |
2309 | id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; | 2310 | id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; |
2310 | return snd_ctl_remove_id(ac97->bus->card, &id); | 2311 | return snd_ctl_remove_id(ac97->bus->card, &id); |
2311 | } | 2312 | } |
2312 | 2313 | ||
2313 | static snd_kcontrol_t *ctl_find(ac97_t *ac97, const char *name, const char *suffix) | 2314 | static struct snd_kcontrol *ctl_find(struct snd_ac97 *ac97, const char *name, const char *suffix) |
2314 | { | 2315 | { |
2315 | snd_ctl_elem_id_t sid; | 2316 | struct snd_ctl_elem_id sid; |
2316 | memset(&sid, 0, sizeof(sid)); | 2317 | memset(&sid, 0, sizeof(sid)); |
2317 | set_ctl_name(sid.name, name, suffix); | 2318 | set_ctl_name(sid.name, name, suffix); |
2318 | sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER; | 2319 | sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER; |
@@ -2320,9 +2321,9 @@ static snd_kcontrol_t *ctl_find(ac97_t *ac97, const char *name, const char *suff | |||
2320 | } | 2321 | } |
2321 | 2322 | ||
2322 | /* rename the control with the given name and optional suffix */ | 2323 | /* rename the control with the given name and optional suffix */ |
2323 | int snd_ac97_rename_ctl(ac97_t *ac97, const char *src, const char *dst, const char *suffix) | 2324 | int snd_ac97_rename_ctl(struct snd_ac97 *ac97, const char *src, const char *dst, const char *suffix) |
2324 | { | 2325 | { |
2325 | snd_kcontrol_t *kctl = ctl_find(ac97, src, suffix); | 2326 | struct snd_kcontrol *kctl = ctl_find(ac97, src, suffix); |
2326 | if (kctl) { | 2327 | if (kctl) { |
2327 | set_ctl_name(kctl->id.name, dst, suffix); | 2328 | set_ctl_name(kctl->id.name, dst, suffix); |
2328 | return 0; | 2329 | return 0; |
@@ -2331,16 +2332,16 @@ int snd_ac97_rename_ctl(ac97_t *ac97, const char *src, const char *dst, const ch | |||
2331 | } | 2332 | } |
2332 | 2333 | ||
2333 | /* rename both Volume and Switch controls - don't check the return value */ | 2334 | /* rename both Volume and Switch controls - don't check the return value */ |
2334 | void snd_ac97_rename_vol_ctl(ac97_t *ac97, const char *src, const char *dst) | 2335 | void snd_ac97_rename_vol_ctl(struct snd_ac97 *ac97, const char *src, const char *dst) |
2335 | { | 2336 | { |
2336 | snd_ac97_rename_ctl(ac97, src, dst, "Switch"); | 2337 | snd_ac97_rename_ctl(ac97, src, dst, "Switch"); |
2337 | snd_ac97_rename_ctl(ac97, src, dst, "Volume"); | 2338 | snd_ac97_rename_ctl(ac97, src, dst, "Volume"); |
2338 | } | 2339 | } |
2339 | 2340 | ||
2340 | /* swap controls */ | 2341 | /* swap controls */ |
2341 | int snd_ac97_swap_ctl(ac97_t *ac97, const char *s1, const char *s2, const char *suffix) | 2342 | int snd_ac97_swap_ctl(struct snd_ac97 *ac97, const char *s1, const char *s2, const char *suffix) |
2342 | { | 2343 | { |
2343 | snd_kcontrol_t *kctl1, *kctl2; | 2344 | struct snd_kcontrol *kctl1, *kctl2; |
2344 | kctl1 = ctl_find(ac97, s1, suffix); | 2345 | kctl1 = ctl_find(ac97, s1, suffix); |
2345 | kctl2 = ctl_find(ac97, s2, suffix); | 2346 | kctl2 = ctl_find(ac97, s2, suffix); |
2346 | if (kctl1 && kctl2) { | 2347 | if (kctl1 && kctl2) { |
@@ -2353,7 +2354,7 @@ int snd_ac97_swap_ctl(ac97_t *ac97, const char *s1, const char *s2, const char * | |||
2353 | 2354 | ||
2354 | #if 1 | 2355 | #if 1 |
2355 | /* bind hp and master controls instead of using only hp control */ | 2356 | /* bind hp and master controls instead of using only hp control */ |
2356 | static int bind_hp_volsw_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 2357 | static int bind_hp_volsw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
2357 | { | 2358 | { |
2358 | int err = snd_ac97_put_volsw(kcontrol, ucontrol); | 2359 | int err = snd_ac97_put_volsw(kcontrol, ucontrol); |
2359 | if (err > 0) { | 2360 | if (err > 0) { |
@@ -2366,10 +2367,10 @@ static int bind_hp_volsw_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uco | |||
2366 | } | 2367 | } |
2367 | 2368 | ||
2368 | /* ac97 tune: bind Master and Headphone controls */ | 2369 | /* ac97 tune: bind Master and Headphone controls */ |
2369 | static int tune_hp_only(ac97_t *ac97) | 2370 | static int tune_hp_only(struct snd_ac97 *ac97) |
2370 | { | 2371 | { |
2371 | snd_kcontrol_t *msw = ctl_find(ac97, "Master Playback Switch", NULL); | 2372 | struct snd_kcontrol *msw = ctl_find(ac97, "Master Playback Switch", NULL); |
2372 | snd_kcontrol_t *mvol = ctl_find(ac97, "Master Playback Volume", NULL); | 2373 | struct snd_kcontrol *mvol = ctl_find(ac97, "Master Playback Volume", NULL); |
2373 | if (! msw || ! mvol) | 2374 | if (! msw || ! mvol) |
2374 | return -ENOENT; | 2375 | return -ENOENT; |
2375 | msw->put = bind_hp_volsw_put; | 2376 | msw->put = bind_hp_volsw_put; |
@@ -2381,7 +2382,7 @@ static int tune_hp_only(ac97_t *ac97) | |||
2381 | 2382 | ||
2382 | #else | 2383 | #else |
2383 | /* ac97 tune: use Headphone control as master */ | 2384 | /* ac97 tune: use Headphone control as master */ |
2384 | static int tune_hp_only(ac97_t *ac97) | 2385 | static int tune_hp_only(struct snd_ac97 *ac97) |
2385 | { | 2386 | { |
2386 | if (ctl_find(ac97, "Headphone Playback Switch", NULL) == NULL) | 2387 | if (ctl_find(ac97, "Headphone Playback Switch", NULL) == NULL) |
2387 | return -ENOENT; | 2388 | return -ENOENT; |
@@ -2393,7 +2394,7 @@ static int tune_hp_only(ac97_t *ac97) | |||
2393 | #endif | 2394 | #endif |
2394 | 2395 | ||
2395 | /* ac97 tune: swap Headphone and Master controls */ | 2396 | /* ac97 tune: swap Headphone and Master controls */ |
2396 | static int tune_swap_hp(ac97_t *ac97) | 2397 | static int tune_swap_hp(struct snd_ac97 *ac97) |
2397 | { | 2398 | { |
2398 | if (ctl_find(ac97, "Headphone Playback Switch", NULL) == NULL) | 2399 | if (ctl_find(ac97, "Headphone Playback Switch", NULL) == NULL) |
2399 | return -ENOENT; | 2400 | return -ENOENT; |
@@ -2403,7 +2404,7 @@ static int tune_swap_hp(ac97_t *ac97) | |||
2403 | } | 2404 | } |
2404 | 2405 | ||
2405 | /* ac97 tune: swap Surround and Master controls */ | 2406 | /* ac97 tune: swap Surround and Master controls */ |
2406 | static int tune_swap_surround(ac97_t *ac97) | 2407 | static int tune_swap_surround(struct snd_ac97 *ac97) |
2407 | { | 2408 | { |
2408 | if (snd_ac97_swap_ctl(ac97, "Master Playback", "Surround Playback", "Switch") || | 2409 | if (snd_ac97_swap_ctl(ac97, "Master Playback", "Surround Playback", "Switch") || |
2409 | snd_ac97_swap_ctl(ac97, "Master Playback", "Surround Playback", "Volume")) | 2410 | snd_ac97_swap_ctl(ac97, "Master Playback", "Surround Playback", "Volume")) |
@@ -2412,7 +2413,7 @@ static int tune_swap_surround(ac97_t *ac97) | |||
2412 | } | 2413 | } |
2413 | 2414 | ||
2414 | /* ac97 tune: set up mic sharing for AD codecs */ | 2415 | /* ac97 tune: set up mic sharing for AD codecs */ |
2415 | static int tune_ad_sharing(ac97_t *ac97) | 2416 | static int tune_ad_sharing(struct snd_ac97 *ac97) |
2416 | { | 2417 | { |
2417 | unsigned short scfg; | 2418 | unsigned short scfg; |
2418 | if ((ac97->id & 0xffffff00) != 0x41445300) { | 2419 | if ((ac97->id & 0xffffff00) != 0x41445300) { |
@@ -2425,11 +2426,11 @@ static int tune_ad_sharing(ac97_t *ac97) | |||
2425 | return 0; | 2426 | return 0; |
2426 | } | 2427 | } |
2427 | 2428 | ||
2428 | static const snd_kcontrol_new_t snd_ac97_alc_jack_detect = | 2429 | static const struct snd_kcontrol_new snd_ac97_alc_jack_detect = |
2429 | AC97_SINGLE("Jack Detect", AC97_ALC650_CLOCK, 5, 1, 0); | 2430 | AC97_SINGLE("Jack Detect", AC97_ALC650_CLOCK, 5, 1, 0); |
2430 | 2431 | ||
2431 | /* ac97 tune: set up ALC jack-select */ | 2432 | /* ac97 tune: set up ALC jack-select */ |
2432 | static int tune_alc_jack(ac97_t *ac97) | 2433 | static int tune_alc_jack(struct snd_ac97 *ac97) |
2433 | { | 2434 | { |
2434 | if ((ac97->id & 0xffffff00) != 0x414c4700) { | 2435 | if ((ac97->id & 0xffffff00) != 0x414c4700) { |
2435 | snd_printk(KERN_ERR "ac97_quirk ALC_JACK is only for Realtek codecs\n"); | 2436 | snd_printk(KERN_ERR "ac97_quirk ALC_JACK is only for Realtek codecs\n"); |
@@ -2441,20 +2442,20 @@ static int tune_alc_jack(ac97_t *ac97) | |||
2441 | } | 2442 | } |
2442 | 2443 | ||
2443 | /* ac97 tune: inversed EAPD bit */ | 2444 | /* ac97 tune: inversed EAPD bit */ |
2444 | static int tune_inv_eapd(ac97_t *ac97) | 2445 | static int tune_inv_eapd(struct snd_ac97 *ac97) |
2445 | { | 2446 | { |
2446 | snd_kcontrol_t *kctl = ctl_find(ac97, "External Amplifier", NULL); | 2447 | struct snd_kcontrol *kctl = ctl_find(ac97, "External Amplifier", NULL); |
2447 | if (! kctl) | 2448 | if (! kctl) |
2448 | return -ENOENT; | 2449 | return -ENOENT; |
2449 | set_inv_eapd(ac97, kctl); | 2450 | set_inv_eapd(ac97, kctl); |
2450 | return 0; | 2451 | return 0; |
2451 | } | 2452 | } |
2452 | 2453 | ||
2453 | static int master_mute_sw_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 2454 | static int master_mute_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
2454 | { | 2455 | { |
2455 | int err = snd_ac97_put_volsw(kcontrol, ucontrol); | 2456 | int err = snd_ac97_put_volsw(kcontrol, ucontrol); |
2456 | if (err > 0) { | 2457 | if (err > 0) { |
2457 | ac97_t *ac97 = snd_kcontrol_chip(kcontrol); | 2458 | struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); |
2458 | int shift = (kcontrol->private_value >> 8) & 0x0f; | 2459 | int shift = (kcontrol->private_value >> 8) & 0x0f; |
2459 | int rshift = (kcontrol->private_value >> 12) & 0x0f; | 2460 | int rshift = (kcontrol->private_value >> 12) & 0x0f; |
2460 | unsigned short mask; | 2461 | unsigned short mask; |
@@ -2470,9 +2471,9 @@ static int master_mute_sw_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc | |||
2470 | } | 2471 | } |
2471 | 2472 | ||
2472 | /* ac97 tune: EAPD controls mute LED bound with the master mute */ | 2473 | /* ac97 tune: EAPD controls mute LED bound with the master mute */ |
2473 | static int tune_mute_led(ac97_t *ac97) | 2474 | static int tune_mute_led(struct snd_ac97 *ac97) |
2474 | { | 2475 | { |
2475 | snd_kcontrol_t *msw = ctl_find(ac97, "Master Playback Switch", NULL); | 2476 | struct snd_kcontrol *msw = ctl_find(ac97, "Master Playback Switch", NULL); |
2476 | if (! msw) | 2477 | if (! msw) |
2477 | return -ENOENT; | 2478 | return -ENOENT; |
2478 | msw->put = master_mute_sw_put; | 2479 | msw->put = master_mute_sw_put; |
@@ -2483,7 +2484,7 @@ static int tune_mute_led(ac97_t *ac97) | |||
2483 | 2484 | ||
2484 | struct quirk_table { | 2485 | struct quirk_table { |
2485 | const char *name; | 2486 | const char *name; |
2486 | int (*func)(ac97_t *); | 2487 | int (*func)(struct snd_ac97 *); |
2487 | }; | 2488 | }; |
2488 | 2489 | ||
2489 | static struct quirk_table applicable_quirks[] = { | 2490 | static struct quirk_table applicable_quirks[] = { |
@@ -2498,7 +2499,7 @@ static struct quirk_table applicable_quirks[] = { | |||
2498 | }; | 2499 | }; |
2499 | 2500 | ||
2500 | /* apply the quirk with the given type */ | 2501 | /* apply the quirk with the given type */ |
2501 | static int apply_quirk(ac97_t *ac97, int type) | 2502 | static int apply_quirk(struct snd_ac97 *ac97, int type) |
2502 | { | 2503 | { |
2503 | if (type <= 0) | 2504 | if (type <= 0) |
2504 | return 0; | 2505 | return 0; |
@@ -2510,7 +2511,7 @@ static int apply_quirk(ac97_t *ac97, int type) | |||
2510 | } | 2511 | } |
2511 | 2512 | ||
2512 | /* apply the quirk with the given name */ | 2513 | /* apply the quirk with the given name */ |
2513 | static int apply_quirk_str(ac97_t *ac97, const char *typestr) | 2514 | static int apply_quirk_str(struct snd_ac97 *ac97, const char *typestr) |
2514 | { | 2515 | { |
2515 | int i; | 2516 | int i; |
2516 | struct quirk_table *q; | 2517 | struct quirk_table *q; |
@@ -2539,7 +2540,7 @@ static int apply_quirk_str(ac97_t *ac97, const char *typestr) | |||
2539 | * Returns zero if successful, or a negative error code on failure. | 2540 | * Returns zero if successful, or a negative error code on failure. |
2540 | */ | 2541 | */ |
2541 | 2542 | ||
2542 | int snd_ac97_tune_hardware(ac97_t *ac97, struct ac97_quirk *quirk, const char *override) | 2543 | int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, const char *override) |
2543 | { | 2544 | { |
2544 | int result; | 2545 | int result; |
2545 | 2546 | ||