diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2006-01-07 09:40:05 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-01-07 09:40:05 -0500 |
commit | 123656d4cc8c946f578ebd18c2050f5251720428 (patch) | |
tree | 3d5432eff034a3b9cfdc98b37e245abe5695342d /sound/arm/aaci.c | |
parent | a62c80e559809e6c7851ec04d30575e85ad6f6ed (diff) | |
parent | 0aec63e67c69545ca757a73a66f5dcf05fa484bf (diff) |
Merge with Linus' kernel.
Diffstat (limited to 'sound/arm/aaci.c')
-rw-r--r-- | sound/arm/aaci.c | 84 |
1 files changed, 39 insertions, 45 deletions
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index 5b6cae50d0d5..54147c1f6361 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c | |||
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | #undef CONFIG_PM | 41 | #undef CONFIG_PM |
42 | 42 | ||
43 | static void aaci_ac97_select_codec(struct aaci *aaci, ac97_t *ac97) | 43 | static void aaci_ac97_select_codec(struct aaci *aaci, struct snd_ac97 *ac97) |
44 | { | 44 | { |
45 | u32 v, maincr = aaci->maincr | MAINCR_SCRA(ac97->num); | 45 | u32 v, maincr = aaci->maincr | MAINCR_SCRA(ac97->num); |
46 | 46 | ||
@@ -65,7 +65,7 @@ static void aaci_ac97_select_codec(struct aaci *aaci, ac97_t *ac97) | |||
65 | * SI1TxEn, SI2TxEn and SI12TxEn bits are set in the AACI_MAINCR | 65 | * SI1TxEn, SI2TxEn and SI12TxEn bits are set in the AACI_MAINCR |
66 | * register. | 66 | * register. |
67 | */ | 67 | */ |
68 | static void aaci_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val) | 68 | static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) |
69 | { | 69 | { |
70 | struct aaci *aaci = ac97->private_data; | 70 | struct aaci *aaci = ac97->private_data; |
71 | u32 v; | 71 | u32 v; |
@@ -97,7 +97,7 @@ static void aaci_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val | |||
97 | /* | 97 | /* |
98 | * Read an AC'97 register. | 98 | * Read an AC'97 register. |
99 | */ | 99 | */ |
100 | static unsigned short aaci_ac97_read(ac97_t *ac97, unsigned short reg) | 100 | static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) |
101 | { | 101 | { |
102 | struct aaci *aaci = ac97->private_data; | 102 | struct aaci *aaci = ac97->private_data; |
103 | u32 v; | 103 | u32 v; |
@@ -284,11 +284,11 @@ static unsigned int rate_list[] = { | |||
284 | * (unimplemented) | 284 | * (unimplemented) |
285 | */ | 285 | */ |
286 | static int | 286 | static int |
287 | aaci_rule_rate_by_channels(snd_pcm_hw_params_t *p, snd_pcm_hw_rule_t *rule) | 287 | aaci_rule_rate_by_channels(struct snd_pcm_hw_params *p, struct snd_pcm_hw_rule *rule) |
288 | { | 288 | { |
289 | struct aaci *aaci = rule->private; | 289 | struct aaci *aaci = rule->private; |
290 | unsigned int rate_mask = SNDRV_PCM_RATE_8000_48000|SNDRV_PCM_RATE_5512; | 290 | unsigned int rate_mask = SNDRV_PCM_RATE_8000_48000|SNDRV_PCM_RATE_5512; |
291 | snd_interval_t *c = hw_param_interval(p, SNDRV_PCM_HW_PARAM_CHANNELS); | 291 | struct snd_interval *c = hw_param_interval(p, SNDRV_PCM_HW_PARAM_CHANNELS); |
292 | 292 | ||
293 | switch (c->max) { | 293 | switch (c->max) { |
294 | case 6: | 294 | case 6: |
@@ -304,7 +304,7 @@ aaci_rule_rate_by_channels(snd_pcm_hw_params_t *p, snd_pcm_hw_rule_t *rule) | |||
304 | rate_mask); | 304 | rate_mask); |
305 | } | 305 | } |
306 | 306 | ||
307 | static snd_pcm_hardware_t aaci_hw_info = { | 307 | static struct snd_pcm_hardware aaci_hw_info = { |
308 | .info = SNDRV_PCM_INFO_MMAP | | 308 | .info = SNDRV_PCM_INFO_MMAP | |
309 | SNDRV_PCM_INFO_MMAP_VALID | | 309 | SNDRV_PCM_INFO_MMAP_VALID | |
310 | SNDRV_PCM_INFO_INTERLEAVED | | 310 | SNDRV_PCM_INFO_INTERLEAVED | |
@@ -330,10 +330,10 @@ static snd_pcm_hardware_t aaci_hw_info = { | |||
330 | .periods_max = PAGE_SIZE / 16, | 330 | .periods_max = PAGE_SIZE / 16, |
331 | }; | 331 | }; |
332 | 332 | ||
333 | static int aaci_pcm_open(struct aaci *aaci, snd_pcm_substream_t *substream, | 333 | static int aaci_pcm_open(struct aaci *aaci, struct snd_pcm_substream *substream, |
334 | struct aaci_runtime *aacirun) | 334 | struct aaci_runtime *aacirun) |
335 | { | 335 | { |
336 | snd_pcm_runtime_t *runtime = substream->runtime; | 336 | struct snd_pcm_runtime *runtime = substream->runtime; |
337 | int ret; | 337 | int ret; |
338 | 338 | ||
339 | aacirun->substream = substream; | 339 | aacirun->substream = substream; |
@@ -375,7 +375,7 @@ static int aaci_pcm_open(struct aaci *aaci, snd_pcm_substream_t *substream, | |||
375 | /* | 375 | /* |
376 | * Common ALSA stuff | 376 | * Common ALSA stuff |
377 | */ | 377 | */ |
378 | static int aaci_pcm_close(snd_pcm_substream_t *substream) | 378 | static int aaci_pcm_close(struct snd_pcm_substream *substream) |
379 | { | 379 | { |
380 | struct aaci *aaci = substream->private_data; | 380 | struct aaci *aaci = substream->private_data; |
381 | struct aaci_runtime *aacirun = substream->runtime->private_data; | 381 | struct aaci_runtime *aacirun = substream->runtime->private_data; |
@@ -388,7 +388,7 @@ static int aaci_pcm_close(snd_pcm_substream_t *substream) | |||
388 | return 0; | 388 | return 0; |
389 | } | 389 | } |
390 | 390 | ||
391 | static int aaci_pcm_hw_free(snd_pcm_substream_t *substream) | 391 | static int aaci_pcm_hw_free(struct snd_pcm_substream *substream) |
392 | { | 392 | { |
393 | struct aaci_runtime *aacirun = substream->runtime->private_data; | 393 | struct aaci_runtime *aacirun = substream->runtime->private_data; |
394 | 394 | ||
@@ -409,9 +409,9 @@ static int aaci_pcm_hw_free(snd_pcm_substream_t *substream) | |||
409 | return 0; | 409 | return 0; |
410 | } | 410 | } |
411 | 411 | ||
412 | static int aaci_pcm_hw_params(snd_pcm_substream_t *substream, | 412 | static int aaci_pcm_hw_params(struct snd_pcm_substream *substream, |
413 | struct aaci_runtime *aacirun, | 413 | struct aaci_runtime *aacirun, |
414 | snd_pcm_hw_params_t *params) | 414 | struct snd_pcm_hw_params *params) |
415 | { | 415 | { |
416 | int err; | 416 | int err; |
417 | 417 | ||
@@ -434,9 +434,9 @@ static int aaci_pcm_hw_params(snd_pcm_substream_t *substream, | |||
434 | return err; | 434 | return err; |
435 | } | 435 | } |
436 | 436 | ||
437 | static int aaci_pcm_prepare(snd_pcm_substream_t *substream) | 437 | static int aaci_pcm_prepare(struct snd_pcm_substream *substream) |
438 | { | 438 | { |
439 | snd_pcm_runtime_t *runtime = substream->runtime; | 439 | struct snd_pcm_runtime *runtime = substream->runtime; |
440 | struct aaci_runtime *aacirun = runtime->private_data; | 440 | struct aaci_runtime *aacirun = runtime->private_data; |
441 | 441 | ||
442 | aacirun->start = (void *)runtime->dma_area; | 442 | aacirun->start = (void *)runtime->dma_area; |
@@ -448,16 +448,16 @@ static int aaci_pcm_prepare(snd_pcm_substream_t *substream) | |||
448 | return 0; | 448 | return 0; |
449 | } | 449 | } |
450 | 450 | ||
451 | static snd_pcm_uframes_t aaci_pcm_pointer(snd_pcm_substream_t *substream) | 451 | static snd_pcm_uframes_t aaci_pcm_pointer(struct snd_pcm_substream *substream) |
452 | { | 452 | { |
453 | snd_pcm_runtime_t *runtime = substream->runtime; | 453 | struct snd_pcm_runtime *runtime = substream->runtime; |
454 | struct aaci_runtime *aacirun = runtime->private_data; | 454 | struct aaci_runtime *aacirun = runtime->private_data; |
455 | ssize_t bytes = aacirun->ptr - aacirun->start; | 455 | ssize_t bytes = aacirun->ptr - aacirun->start; |
456 | 456 | ||
457 | return bytes_to_frames(runtime, bytes); | 457 | return bytes_to_frames(runtime, bytes); |
458 | } | 458 | } |
459 | 459 | ||
460 | static int aaci_pcm_mmap(snd_pcm_substream_t *substream, struct vm_area_struct *vma) | 460 | static int aaci_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma) |
461 | { | 461 | { |
462 | return devdma_mmap(NULL, substream, vma); | 462 | return devdma_mmap(NULL, substream, vma); |
463 | } | 463 | } |
@@ -484,7 +484,7 @@ static const u32 channels_to_txmask[] = { | |||
484 | static unsigned int channel_list[] = { 2, 4, 6 }; | 484 | static unsigned int channel_list[] = { 2, 4, 6 }; |
485 | 485 | ||
486 | static int | 486 | static int |
487 | aaci_rule_channels(snd_pcm_hw_params_t *p, snd_pcm_hw_rule_t *rule) | 487 | aaci_rule_channels(struct snd_pcm_hw_params *p, struct snd_pcm_hw_rule *rule) |
488 | { | 488 | { |
489 | struct aaci *aaci = rule->private; | 489 | struct aaci *aaci = rule->private; |
490 | unsigned int chan_mask = 1 << 0, slots; | 490 | unsigned int chan_mask = 1 << 0, slots; |
@@ -504,7 +504,7 @@ aaci_rule_channels(snd_pcm_hw_params_t *p, snd_pcm_hw_rule_t *rule) | |||
504 | chan_mask); | 504 | chan_mask); |
505 | } | 505 | } |
506 | 506 | ||
507 | static int aaci_pcm_playback_open(snd_pcm_substream_t *substream) | 507 | static int aaci_pcm_playback_open(struct snd_pcm_substream *substream) |
508 | { | 508 | { |
509 | struct aaci *aaci = substream->private_data; | 509 | struct aaci *aaci = substream->private_data; |
510 | int ret; | 510 | int ret; |
@@ -522,8 +522,8 @@ static int aaci_pcm_playback_open(snd_pcm_substream_t *substream) | |||
522 | return aaci_pcm_open(aaci, substream, &aaci->playback); | 522 | return aaci_pcm_open(aaci, substream, &aaci->playback); |
523 | } | 523 | } |
524 | 524 | ||
525 | static int aaci_pcm_playback_hw_params(snd_pcm_substream_t *substream, | 525 | static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream, |
526 | snd_pcm_hw_params_t *params) | 526 | struct snd_pcm_hw_params *params) |
527 | { | 527 | { |
528 | struct aaci *aaci = substream->private_data; | 528 | struct aaci *aaci = substream->private_data; |
529 | struct aaci_runtime *aacirun = substream->runtime->private_data; | 529 | struct aaci_runtime *aacirun = substream->runtime->private_data; |
@@ -575,7 +575,7 @@ static void aaci_pcm_playback_start(struct aaci_runtime *aacirun) | |||
575 | writel(aacirun->cr, aacirun->base + AACI_TXCR); | 575 | writel(aacirun->cr, aacirun->base + AACI_TXCR); |
576 | } | 576 | } |
577 | 577 | ||
578 | static int aaci_pcm_playback_trigger(snd_pcm_substream_t *substream, int cmd) | 578 | static int aaci_pcm_playback_trigger(struct snd_pcm_substream *substream, int cmd) |
579 | { | 579 | { |
580 | struct aaci *aaci = substream->private_data; | 580 | struct aaci *aaci = substream->private_data; |
581 | struct aaci_runtime *aacirun = substream->runtime->private_data; | 581 | struct aaci_runtime *aacirun = substream->runtime->private_data; |
@@ -614,7 +614,7 @@ static int aaci_pcm_playback_trigger(snd_pcm_substream_t *substream, int cmd) | |||
614 | return ret; | 614 | return ret; |
615 | } | 615 | } |
616 | 616 | ||
617 | static snd_pcm_ops_t aaci_playback_ops = { | 617 | static struct snd_pcm_ops aaci_playback_ops = { |
618 | .open = aaci_pcm_playback_open, | 618 | .open = aaci_pcm_playback_open, |
619 | .close = aaci_pcm_close, | 619 | .close = aaci_pcm_close, |
620 | .ioctl = snd_pcm_lib_ioctl, | 620 | .ioctl = snd_pcm_lib_ioctl, |
@@ -632,34 +632,29 @@ static snd_pcm_ops_t aaci_playback_ops = { | |||
632 | * Power Management. | 632 | * Power Management. |
633 | */ | 633 | */ |
634 | #ifdef CONFIG_PM | 634 | #ifdef CONFIG_PM |
635 | static int aaci_do_suspend(snd_card_t *card, unsigned int state) | 635 | static int aaci_do_suspend(struct snd_card *card, unsigned int state) |
636 | { | 636 | { |
637 | struct aaci *aaci = card->private_data; | 637 | struct aaci *aaci = card->private_data; |
638 | if (aaci->card->power_state != SNDRV_CTL_POWER_D3cold) { | 638 | snd_power_change_state(card, SNDRV_CTL_POWER_D3cold); |
639 | snd_pcm_suspend_all(aaci->pcm); | 639 | snd_pcm_suspend_all(aaci->pcm); |
640 | snd_power_change_state(aaci->card, SNDRV_CTL_POWER_D3cold); | ||
641 | } | ||
642 | return 0; | 640 | return 0; |
643 | } | 641 | } |
644 | 642 | ||
645 | static int aaci_do_resume(snd_card_t *card, unsigned int state) | 643 | static int aaci_do_resume(struct snd_card *card, unsigned int state) |
646 | { | 644 | { |
647 | struct aaci *aaci = card->private_data; | 645 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
648 | if (aaci->card->power_state != SNDRV_CTL_POWER_D0) { | ||
649 | snd_power_change_state(aaci->card, SNDRV_CTL_POWER_D0); | ||
650 | } | ||
651 | return 0; | 646 | return 0; |
652 | } | 647 | } |
653 | 648 | ||
654 | static int aaci_suspend(struct amba_device *dev, pm_message_t state) | 649 | static int aaci_suspend(struct amba_device *dev, pm_message_t state) |
655 | { | 650 | { |
656 | snd_card_t *card = amba_get_drvdata(dev); | 651 | struct snd_card *card = amba_get_drvdata(dev); |
657 | return card ? aaci_do_suspend(card) : 0; | 652 | return card ? aaci_do_suspend(card) : 0; |
658 | } | 653 | } |
659 | 654 | ||
660 | static int aaci_resume(struct amba_device *dev) | 655 | static int aaci_resume(struct amba_device *dev) |
661 | { | 656 | { |
662 | snd_card_t *card = amba_get_drvdata(dev); | 657 | struct snd_card *card = amba_get_drvdata(dev); |
663 | return card ? aaci_do_resume(card) : 0; | 658 | return card ? aaci_do_resume(card) : 0; |
664 | } | 659 | } |
665 | #else | 660 | #else |
@@ -705,16 +700,16 @@ static struct ac97_pcm ac97_defs[] __devinitdata = { | |||
705 | } | 700 | } |
706 | }; | 701 | }; |
707 | 702 | ||
708 | static ac97_bus_ops_t aaci_bus_ops = { | 703 | static struct snd_ac97_bus_ops aaci_bus_ops = { |
709 | .write = aaci_ac97_write, | 704 | .write = aaci_ac97_write, |
710 | .read = aaci_ac97_read, | 705 | .read = aaci_ac97_read, |
711 | }; | 706 | }; |
712 | 707 | ||
713 | static int __devinit aaci_probe_ac97(struct aaci *aaci) | 708 | static int __devinit aaci_probe_ac97(struct aaci *aaci) |
714 | { | 709 | { |
715 | ac97_template_t ac97_template; | 710 | struct snd_ac97_template ac97_template; |
716 | ac97_bus_t *ac97_bus; | 711 | struct snd_ac97_bus *ac97_bus; |
717 | ac97_t *ac97; | 712 | struct snd_ac97 *ac97; |
718 | int ret; | 713 | int ret; |
719 | 714 | ||
720 | /* | 715 | /* |
@@ -737,7 +732,7 @@ static int __devinit aaci_probe_ac97(struct aaci *aaci) | |||
737 | ac97_bus->clock = 48000; | 732 | ac97_bus->clock = 48000; |
738 | aaci->ac97_bus = ac97_bus; | 733 | aaci->ac97_bus = ac97_bus; |
739 | 734 | ||
740 | memset(&ac97_template, 0, sizeof(ac97_template_t)); | 735 | memset(&ac97_template, 0, sizeof(struct snd_ac97_template)); |
741 | ac97_template.private_data = aaci; | 736 | ac97_template.private_data = aaci; |
742 | ac97_template.num = 0; | 737 | ac97_template.num = 0; |
743 | ac97_template.scaps = AC97_SCAP_SKIP_MODEM; | 738 | ac97_template.scaps = AC97_SCAP_SKIP_MODEM; |
@@ -762,7 +757,7 @@ static int __devinit aaci_probe_ac97(struct aaci *aaci) | |||
762 | return ret; | 757 | return ret; |
763 | } | 758 | } |
764 | 759 | ||
765 | static void aaci_free_card(snd_card_t *card) | 760 | static void aaci_free_card(struct snd_card *card) |
766 | { | 761 | { |
767 | struct aaci *aaci = card->private_data; | 762 | struct aaci *aaci = card->private_data; |
768 | if (aaci->base) | 763 | if (aaci->base) |
@@ -772,7 +767,7 @@ static void aaci_free_card(snd_card_t *card) | |||
772 | static struct aaci * __devinit aaci_init_card(struct amba_device *dev) | 767 | static struct aaci * __devinit aaci_init_card(struct amba_device *dev) |
773 | { | 768 | { |
774 | struct aaci *aaci; | 769 | struct aaci *aaci; |
775 | snd_card_t *card; | 770 | struct snd_card *card; |
776 | 771 | ||
777 | card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, | 772 | card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, |
778 | THIS_MODULE, sizeof(struct aaci)); | 773 | THIS_MODULE, sizeof(struct aaci)); |
@@ -780,7 +775,6 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev) | |||
780 | return ERR_PTR(-ENOMEM); | 775 | return ERR_PTR(-ENOMEM); |
781 | 776 | ||
782 | card->private_free = aaci_free_card; | 777 | card->private_free = aaci_free_card; |
783 | snd_card_set_pm_callback(card, aaci_do_suspend, aaci_do_resume, NULL); | ||
784 | 778 | ||
785 | strlcpy(card->driver, DRIVER_NAME, sizeof(card->driver)); | 779 | strlcpy(card->driver, DRIVER_NAME, sizeof(card->driver)); |
786 | strlcpy(card->shortname, "ARM AC'97 Interface", sizeof(card->shortname)); | 780 | strlcpy(card->shortname, "ARM AC'97 Interface", sizeof(card->shortname)); |
@@ -803,7 +797,7 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev) | |||
803 | 797 | ||
804 | static int __devinit aaci_init_pcm(struct aaci *aaci) | 798 | static int __devinit aaci_init_pcm(struct aaci *aaci) |
805 | { | 799 | { |
806 | snd_pcm_t *pcm; | 800 | struct snd_pcm *pcm; |
807 | int ret; | 801 | int ret; |
808 | 802 | ||
809 | ret = snd_pcm_new(aaci->card, "AACI AC'97", 0, 1, 0, &pcm); | 803 | ret = snd_pcm_new(aaci->card, "AACI AC'97", 0, 1, 0, &pcm); |
@@ -920,7 +914,7 @@ static int __devinit aaci_probe(struct amba_device *dev, void *id) | |||
920 | 914 | ||
921 | static int __devexit aaci_remove(struct amba_device *dev) | 915 | static int __devexit aaci_remove(struct amba_device *dev) |
922 | { | 916 | { |
923 | snd_card_t *card = amba_get_drvdata(dev); | 917 | struct snd_card *card = amba_get_drvdata(dev); |
924 | 918 | ||
925 | amba_set_drvdata(dev, NULL); | 919 | amba_set_drvdata(dev, NULL); |
926 | 920 | ||