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 | |
parent | a62c80e559809e6c7851ec04d30575e85ad6f6ed (diff) | |
parent | 0aec63e67c69545ca757a73a66f5dcf05fa484bf (diff) |
Merge with Linus' kernel.
Diffstat (limited to 'sound/arm')
-rw-r--r-- | sound/arm/Kconfig | 1 | ||||
-rw-r--r-- | sound/arm/aaci.c | 84 | ||||
-rw-r--r-- | sound/arm/aaci.h | 6 | ||||
-rw-r--r-- | sound/arm/devdma.c | 12 | ||||
-rw-r--r-- | sound/arm/devdma.h | 6 | ||||
-rw-r--r-- | sound/arm/pxa2xx-ac97.c | 119 | ||||
-rw-r--r-- | sound/arm/pxa2xx-pcm.c | 59 | ||||
-rw-r--r-- | sound/arm/pxa2xx-pcm.h | 20 | ||||
-rw-r--r-- | sound/arm/sa11xx-uda1341.c | 209 |
9 files changed, 272 insertions, 244 deletions
diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig index 0864a7ce414d..2e4a5e0d16db 100644 --- a/sound/arm/Kconfig +++ b/sound/arm/Kconfig | |||
@@ -7,7 +7,6 @@ config SND_SA11XX_UDA1341 | |||
7 | tristate "SA11xx UDA1341TS driver (iPaq H3600)" | 7 | tristate "SA11xx UDA1341TS driver (iPaq H3600)" |
8 | depends on ARCH_SA1100 && SND && L3 | 8 | depends on ARCH_SA1100 && SND && L3 |
9 | select SND_PCM | 9 | select SND_PCM |
10 | select SND_GENERIC_DRIVER | ||
11 | help | 10 | help |
12 | Say Y here if you have a Compaq iPaq H3x00 handheld computer | 11 | Say Y here if you have a Compaq iPaq H3x00 handheld computer |
13 | and want to use its Philips UDA 1341 audio chip. | 12 | and want to use its Philips UDA 1341 audio chip. |
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 | ||
diff --git a/sound/arm/aaci.h b/sound/arm/aaci.h index b2f969bc7845..83f73c2505c6 100644 --- a/sound/arm/aaci.h +++ b/sound/arm/aaci.h | |||
@@ -207,7 +207,7 @@ struct aaci_runtime { | |||
207 | int pcm_open; | 207 | int pcm_open; |
208 | 208 | ||
209 | u32 cr; | 209 | u32 cr; |
210 | snd_pcm_substream_t *substream; | 210 | struct snd_pcm_substream *substream; |
211 | 211 | ||
212 | /* | 212 | /* |
213 | * PIO support | 213 | * PIO support |
@@ -222,7 +222,7 @@ struct aaci_runtime { | |||
222 | 222 | ||
223 | struct aaci { | 223 | struct aaci { |
224 | struct amba_device *dev; | 224 | struct amba_device *dev; |
225 | snd_card_t *card; | 225 | struct snd_card *card; |
226 | void __iomem *base; | 226 | void __iomem *base; |
227 | unsigned int fifosize; | 227 | unsigned int fifosize; |
228 | 228 | ||
@@ -236,7 +236,7 @@ struct aaci { | |||
236 | struct aaci_runtime playback; | 236 | struct aaci_runtime playback; |
237 | struct aaci_runtime capture; | 237 | struct aaci_runtime capture; |
238 | 238 | ||
239 | snd_pcm_t *pcm; | 239 | struct snd_pcm *pcm; |
240 | }; | 240 | }; |
241 | 241 | ||
242 | #define ACSTREAM_FRONT 0 | 242 | #define ACSTREAM_FRONT 0 |
diff --git a/sound/arm/devdma.c b/sound/arm/devdma.c index 60826a5324b4..ca3bf4ee05a3 100644 --- a/sound/arm/devdma.c +++ b/sound/arm/devdma.c | |||
@@ -18,9 +18,9 @@ | |||
18 | 18 | ||
19 | #include "devdma.h" | 19 | #include "devdma.h" |
20 | 20 | ||
21 | void devdma_hw_free(struct device *dev, snd_pcm_substream_t *substream) | 21 | void devdma_hw_free(struct device *dev, struct snd_pcm_substream *substream) |
22 | { | 22 | { |
23 | snd_pcm_runtime_t *runtime = substream->runtime; | 23 | struct snd_pcm_runtime *runtime = substream->runtime; |
24 | struct snd_dma_buffer *buf = runtime->dma_buffer_p; | 24 | struct snd_dma_buffer *buf = runtime->dma_buffer_p; |
25 | 25 | ||
26 | if (runtime->dma_area == NULL) | 26 | if (runtime->dma_area == NULL) |
@@ -34,9 +34,9 @@ void devdma_hw_free(struct device *dev, snd_pcm_substream_t *substream) | |||
34 | snd_pcm_set_runtime_buffer(substream, NULL); | 34 | snd_pcm_set_runtime_buffer(substream, NULL); |
35 | } | 35 | } |
36 | 36 | ||
37 | int devdma_hw_alloc(struct device *dev, snd_pcm_substream_t *substream, size_t size) | 37 | int devdma_hw_alloc(struct device *dev, struct snd_pcm_substream *substream, size_t size) |
38 | { | 38 | { |
39 | snd_pcm_runtime_t *runtime = substream->runtime; | 39 | struct snd_pcm_runtime *runtime = substream->runtime; |
40 | struct snd_dma_buffer *buf = runtime->dma_buffer_p; | 40 | struct snd_dma_buffer *buf = runtime->dma_buffer_p; |
41 | int ret = 0; | 41 | int ret = 0; |
42 | 42 | ||
@@ -74,8 +74,8 @@ int devdma_hw_alloc(struct device *dev, snd_pcm_substream_t *substream, size_t s | |||
74 | return -ENOMEM; | 74 | return -ENOMEM; |
75 | } | 75 | } |
76 | 76 | ||
77 | int devdma_mmap(struct device *dev, snd_pcm_substream_t *substream, struct vm_area_struct *vma) | 77 | int devdma_mmap(struct device *dev, struct snd_pcm_substream *substream, struct vm_area_struct *vma) |
78 | { | 78 | { |
79 | snd_pcm_runtime_t *runtime = substream->runtime; | 79 | struct snd_pcm_runtime *runtime = substream->runtime; |
80 | return dma_mmap_coherent(dev, vma, runtime->dma_area, runtime->dma_addr, runtime->dma_bytes); | 80 | return dma_mmap_coherent(dev, vma, runtime->dma_area, runtime->dma_addr, runtime->dma_bytes); |
81 | } | 81 | } |
diff --git a/sound/arm/devdma.h b/sound/arm/devdma.h index 5a33b6bacc34..d025329c8a0f 100644 --- a/sound/arm/devdma.h +++ b/sound/arm/devdma.h | |||
@@ -1,3 +1,3 @@ | |||
1 | void devdma_hw_free(struct device *dev, snd_pcm_substream_t *substream); | 1 | void devdma_hw_free(struct device *dev, struct snd_pcm_substream *substream); |
2 | int devdma_hw_alloc(struct device *dev, snd_pcm_substream_t *substream, size_t size); | 2 | int devdma_hw_alloc(struct device *dev, struct snd_pcm_substream *substream, size_t size); |
3 | int devdma_mmap(struct device *dev, snd_pcm_substream_t *substream, struct vm_area_struct *vma); | 3 | int devdma_mmap(struct device *dev, struct snd_pcm_substream *substream, struct vm_area_struct *vma); |
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index c96c8a2aa1c2..3acbc6023d19 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c | |||
@@ -37,69 +37,74 @@ static DECLARE_MUTEX(car_mutex); | |||
37 | static DECLARE_WAIT_QUEUE_HEAD(gsr_wq); | 37 | static DECLARE_WAIT_QUEUE_HEAD(gsr_wq); |
38 | static volatile long gsr_bits; | 38 | static volatile long gsr_bits; |
39 | 39 | ||
40 | static unsigned short pxa2xx_ac97_read(ac97_t *ac97, unsigned short reg) | 40 | /* |
41 | * Beware PXA27x bugs: | ||
42 | * | ||
43 | * o Slot 12 read from modem space will hang controller. | ||
44 | * o CDONE, SDONE interrupt fails after any slot 12 IO. | ||
45 | * | ||
46 | * We therefore have an hybrid approach for waiting on SDONE (interrupt or | ||
47 | * 1 jiffy timeout if interrupt never comes). | ||
48 | */ | ||
49 | |||
50 | static unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg) | ||
41 | { | 51 | { |
42 | unsigned short val = -1; | 52 | unsigned short val = -1; |
43 | volatile u32 *reg_addr; | 53 | volatile u32 *reg_addr; |
44 | 54 | ||
45 | down(&car_mutex); | 55 | down(&car_mutex); |
46 | if (CAR & CAR_CAIP) { | ||
47 | printk(KERN_CRIT"%s: CAR_CAIP already set\n", __FUNCTION__); | ||
48 | goto out; | ||
49 | } | ||
50 | 56 | ||
51 | /* set up primary or secondary codec space */ | 57 | /* set up primary or secondary codec space */ |
52 | reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE; | 58 | reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE; |
53 | reg_addr += (reg >> 1); | 59 | reg_addr += (reg >> 1); |
54 | 60 | ||
55 | /* start read access across the ac97 link */ | 61 | /* start read access across the ac97 link */ |
62 | GSR = GSR_CDONE | GSR_SDONE; | ||
56 | gsr_bits = 0; | 63 | gsr_bits = 0; |
57 | val = *reg_addr; | 64 | val = *reg_addr; |
58 | if (reg == AC97_GPIO_STATUS) | 65 | if (reg == AC97_GPIO_STATUS) |
59 | goto out; | 66 | goto out; |
60 | wait_event_timeout(gsr_wq, gsr_bits & GSR_SDONE, 1); | 67 | if (wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_SDONE, 1) <= 0 && |
61 | if (!gsr_bits & GSR_SDONE) { | 68 | !((GSR | gsr_bits) & GSR_SDONE)) { |
62 | printk(KERN_ERR "%s: read error (ac97_reg=%d GSR=%#lx)\n", | 69 | printk(KERN_ERR "%s: read error (ac97_reg=%d GSR=%#lx)\n", |
63 | __FUNCTION__, reg, gsr_bits); | 70 | __FUNCTION__, reg, GSR | gsr_bits); |
64 | val = -1; | 71 | val = -1; |
65 | goto out; | 72 | goto out; |
66 | } | 73 | } |
67 | 74 | ||
68 | /* valid data now */ | 75 | /* valid data now */ |
76 | GSR = GSR_CDONE | GSR_SDONE; | ||
69 | gsr_bits = 0; | 77 | gsr_bits = 0; |
70 | val = *reg_addr; | 78 | val = *reg_addr; |
71 | /* but we've just started another cycle... */ | 79 | /* but we've just started another cycle... */ |
72 | wait_event_timeout(gsr_wq, gsr_bits & GSR_SDONE, 1); | 80 | wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_SDONE, 1); |
73 | 81 | ||
74 | out: up(&car_mutex); | 82 | out: up(&car_mutex); |
75 | return val; | 83 | return val; |
76 | } | 84 | } |
77 | 85 | ||
78 | static void pxa2xx_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val) | 86 | static void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) |
79 | { | 87 | { |
80 | volatile u32 *reg_addr; | 88 | volatile u32 *reg_addr; |
81 | 89 | ||
82 | down(&car_mutex); | 90 | down(&car_mutex); |
83 | 91 | ||
84 | if (CAR & CAR_CAIP) { | ||
85 | printk(KERN_CRIT "%s: CAR_CAIP already set\n", __FUNCTION__); | ||
86 | goto out; | ||
87 | } | ||
88 | |||
89 | /* set up primary or secondary codec space */ | 92 | /* set up primary or secondary codec space */ |
90 | reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE; | 93 | reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE; |
91 | reg_addr += (reg >> 1); | 94 | reg_addr += (reg >> 1); |
95 | |||
96 | GSR = GSR_CDONE | GSR_SDONE; | ||
92 | gsr_bits = 0; | 97 | gsr_bits = 0; |
93 | *reg_addr = val; | 98 | *reg_addr = val; |
94 | wait_event_timeout(gsr_wq, gsr_bits & GSR_CDONE, 1); | 99 | if (wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_CDONE, 1) <= 0 && |
95 | if (!gsr_bits & GSR_SDONE) | 100 | !((GSR | gsr_bits) & GSR_CDONE)) |
96 | printk(KERN_ERR "%s: write error (ac97_reg=%d GSR=%#lx)\n", | 101 | printk(KERN_ERR "%s: write error (ac97_reg=%d GSR=%#lx)\n", |
97 | __FUNCTION__, reg, gsr_bits); | 102 | __FUNCTION__, reg, GSR | gsr_bits); |
98 | 103 | ||
99 | out: up(&car_mutex); | 104 | up(&car_mutex); |
100 | } | 105 | } |
101 | 106 | ||
102 | static void pxa2xx_ac97_reset(ac97_t *ac97) | 107 | static void pxa2xx_ac97_reset(struct snd_ac97 *ac97) |
103 | { | 108 | { |
104 | /* First, try cold reset */ | 109 | /* First, try cold reset */ |
105 | GCR &= GCR_COLD_RST; /* clear everything but nCRST */ | 110 | GCR &= GCR_COLD_RST; /* clear everything but nCRST */ |
@@ -172,13 +177,13 @@ static irqreturn_t pxa2xx_ac97_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
172 | return IRQ_NONE; | 177 | return IRQ_NONE; |
173 | } | 178 | } |
174 | 179 | ||
175 | static ac97_bus_ops_t pxa2xx_ac97_ops = { | 180 | static struct snd_ac97_bus_ops pxa2xx_ac97_ops = { |
176 | .read = pxa2xx_ac97_read, | 181 | .read = pxa2xx_ac97_read, |
177 | .write = pxa2xx_ac97_write, | 182 | .write = pxa2xx_ac97_write, |
178 | .reset = pxa2xx_ac97_reset, | 183 | .reset = pxa2xx_ac97_reset, |
179 | }; | 184 | }; |
180 | 185 | ||
181 | static pxa2xx_pcm_dma_params_t pxa2xx_ac97_pcm_out = { | 186 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_out = { |
182 | .name = "AC97 PCM out", | 187 | .name = "AC97 PCM out", |
183 | .dev_addr = __PREG(PCDR), | 188 | .dev_addr = __PREG(PCDR), |
184 | .drcmr = &DRCMRTXPCDR, | 189 | .drcmr = &DRCMRTXPCDR, |
@@ -186,7 +191,7 @@ static pxa2xx_pcm_dma_params_t pxa2xx_ac97_pcm_out = { | |||
186 | DCMD_BURST32 | DCMD_WIDTH4, | 191 | DCMD_BURST32 | DCMD_WIDTH4, |
187 | }; | 192 | }; |
188 | 193 | ||
189 | static pxa2xx_pcm_dma_params_t pxa2xx_ac97_pcm_in = { | 194 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_in = { |
190 | .name = "AC97 PCM in", | 195 | .name = "AC97 PCM in", |
191 | .dev_addr = __PREG(PCDR), | 196 | .dev_addr = __PREG(PCDR), |
192 | .drcmr = &DRCMRRXPCDR, | 197 | .drcmr = &DRCMRRXPCDR, |
@@ -194,12 +199,12 @@ static pxa2xx_pcm_dma_params_t pxa2xx_ac97_pcm_in = { | |||
194 | DCMD_BURST32 | DCMD_WIDTH4, | 199 | DCMD_BURST32 | DCMD_WIDTH4, |
195 | }; | 200 | }; |
196 | 201 | ||
197 | static snd_pcm_t *pxa2xx_ac97_pcm; | 202 | static struct snd_pcm *pxa2xx_ac97_pcm; |
198 | static ac97_t *pxa2xx_ac97_ac97; | 203 | static struct snd_ac97 *pxa2xx_ac97_ac97; |
199 | 204 | ||
200 | static int pxa2xx_ac97_pcm_startup(snd_pcm_substream_t *substream) | 205 | static int pxa2xx_ac97_pcm_startup(struct snd_pcm_substream *substream) |
201 | { | 206 | { |
202 | snd_pcm_runtime_t *runtime = substream->runtime; | 207 | struct snd_pcm_runtime *runtime = substream->runtime; |
203 | pxa2xx_audio_ops_t *platform_ops; | 208 | pxa2xx_audio_ops_t *platform_ops; |
204 | int r; | 209 | int r; |
205 | 210 | ||
@@ -218,7 +223,7 @@ static int pxa2xx_ac97_pcm_startup(snd_pcm_substream_t *substream) | |||
218 | return 0; | 223 | return 0; |
219 | } | 224 | } |
220 | 225 | ||
221 | static void pxa2xx_ac97_pcm_shutdown(snd_pcm_substream_t *substream) | 226 | static void pxa2xx_ac97_pcm_shutdown(struct snd_pcm_substream *substream) |
222 | { | 227 | { |
223 | pxa2xx_audio_ops_t *platform_ops; | 228 | pxa2xx_audio_ops_t *platform_ops; |
224 | 229 | ||
@@ -227,15 +232,15 @@ static void pxa2xx_ac97_pcm_shutdown(snd_pcm_substream_t *substream) | |||
227 | platform_ops->shutdown(substream, platform_ops->priv); | 232 | platform_ops->shutdown(substream, platform_ops->priv); |
228 | } | 233 | } |
229 | 234 | ||
230 | static int pxa2xx_ac97_pcm_prepare(snd_pcm_substream_t *substream) | 235 | static int pxa2xx_ac97_pcm_prepare(struct snd_pcm_substream *substream) |
231 | { | 236 | { |
232 | snd_pcm_runtime_t *runtime = substream->runtime; | 237 | struct snd_pcm_runtime *runtime = substream->runtime; |
233 | int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? | 238 | int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? |
234 | AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE; | 239 | AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE; |
235 | return snd_ac97_set_rate(pxa2xx_ac97_ac97, reg, runtime->rate); | 240 | return snd_ac97_set_rate(pxa2xx_ac97_ac97, reg, runtime->rate); |
236 | } | 241 | } |
237 | 242 | ||
238 | static pxa2xx_pcm_client_t pxa2xx_ac97_pcm_client = { | 243 | static struct pxa2xx_pcm_client pxa2xx_ac97_pcm_client = { |
239 | .playback_params = &pxa2xx_ac97_pcm_out, | 244 | .playback_params = &pxa2xx_ac97_pcm_out, |
240 | .capture_params = &pxa2xx_ac97_pcm_in, | 245 | .capture_params = &pxa2xx_ac97_pcm_in, |
241 | .startup = pxa2xx_ac97_pcm_startup, | 246 | .startup = pxa2xx_ac97_pcm_startup, |
@@ -245,39 +250,37 @@ static pxa2xx_pcm_client_t pxa2xx_ac97_pcm_client = { | |||
245 | 250 | ||
246 | #ifdef CONFIG_PM | 251 | #ifdef CONFIG_PM |
247 | 252 | ||
248 | static int pxa2xx_ac97_do_suspend(snd_card_t *card, pm_message_t state) | 253 | static int pxa2xx_ac97_do_suspend(struct snd_card *card, pm_message_t state) |
249 | { | 254 | { |
250 | if (card->power_state != SNDRV_CTL_POWER_D3cold) { | 255 | pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; |
251 | pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; | 256 | |
252 | snd_pcm_suspend_all(pxa2xx_ac97_pcm); | 257 | snd_power_change_state(card, SNDRV_CTL_POWER_D3cold); |
253 | snd_ac97_suspend(pxa2xx_ac97_ac97); | 258 | snd_pcm_suspend_all(pxa2xx_ac97_pcm); |
254 | snd_power_change_state(card, SNDRV_CTL_POWER_D3cold); | 259 | snd_ac97_suspend(pxa2xx_ac97_ac97); |
255 | if (platform_ops && platform_ops->suspend) | 260 | if (platform_ops && platform_ops->suspend) |
256 | platform_ops->suspend(platform_ops->priv); | 261 | platform_ops->suspend(platform_ops->priv); |
257 | GCR |= GCR_ACLINK_OFF; | 262 | GCR |= GCR_ACLINK_OFF; |
258 | pxa_set_cken(CKEN2_AC97, 0); | 263 | pxa_set_cken(CKEN2_AC97, 0); |
259 | } | ||
260 | 264 | ||
261 | return 0; | 265 | return 0; |
262 | } | 266 | } |
263 | 267 | ||
264 | static int pxa2xx_ac97_do_resume(snd_card_t *card) | 268 | static int pxa2xx_ac97_do_resume(struct snd_card *card) |
265 | { | 269 | { |
266 | if (card->power_state != SNDRV_CTL_POWER_D0) { | 270 | pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; |
267 | pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; | 271 | |
268 | pxa_set_cken(CKEN2_AC97, 1); | 272 | pxa_set_cken(CKEN2_AC97, 1); |
269 | if (platform_ops && platform_ops->resume) | 273 | if (platform_ops && platform_ops->resume) |
270 | platform_ops->resume(platform_ops->priv); | 274 | platform_ops->resume(platform_ops->priv); |
271 | snd_ac97_resume(pxa2xx_ac97_ac97); | 275 | snd_ac97_resume(pxa2xx_ac97_ac97); |
272 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 276 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
273 | } | ||
274 | 277 | ||
275 | return 0; | 278 | return 0; |
276 | } | 279 | } |
277 | 280 | ||
278 | static int pxa2xx_ac97_suspend(struct platform_device *dev, pm_message_t state) | 281 | static int pxa2xx_ac97_suspend(struct platform_device *dev, pm_message_t state) |
279 | { | 282 | { |
280 | snd_card_t *card = platform_get_drvdata(dev); | 283 | struct snd_card *card = platform_get_drvdata(dev); |
281 | int ret = 0; | 284 | int ret = 0; |
282 | 285 | ||
283 | if (card) | 286 | if (card) |
@@ -288,7 +291,7 @@ static int pxa2xx_ac97_suspend(struct platform_device *dev, pm_message_t state) | |||
288 | 291 | ||
289 | static int pxa2xx_ac97_resume(struct platform_device *dev) | 292 | static int pxa2xx_ac97_resume(struct platform_device *dev) |
290 | { | 293 | { |
291 | snd_card_t *card = platform_get_drvdata(dev); | 294 | struct snd_card *card = platform_get_drvdata(dev); |
292 | int ret = 0; | 295 | int ret = 0; |
293 | 296 | ||
294 | if (card) | 297 | if (card) |
@@ -304,9 +307,9 @@ static int pxa2xx_ac97_resume(struct platform_device *dev) | |||
304 | 307 | ||
305 | static int pxa2xx_ac97_probe(struct platform_device *dev) | 308 | static int pxa2xx_ac97_probe(struct platform_device *dev) |
306 | { | 309 | { |
307 | snd_card_t *card; | 310 | struct snd_card *card; |
308 | ac97_bus_t *ac97_bus; | 311 | struct snd_ac97_bus *ac97_bus; |
309 | ac97_template_t ac97_template; | 312 | struct snd_ac97_template ac97_template; |
310 | int ret; | 313 | int ret; |
311 | 314 | ||
312 | ret = -ENOMEM; | 315 | ret = -ENOMEM; |
@@ -349,8 +352,6 @@ static int pxa2xx_ac97_probe(struct platform_device *dev) | |||
349 | snprintf(card->longname, sizeof(card->longname), | 352 | snprintf(card->longname, sizeof(card->longname), |
350 | "%s (%s)", dev->dev.driver->name, card->mixername); | 353 | "%s (%s)", dev->dev.driver->name, card->mixername); |
351 | 354 | ||
352 | snd_card_set_pm_callback(card, pxa2xx_ac97_do_suspend, | ||
353 | pxa2xx_ac97_do_resume, NULL); | ||
354 | ret = snd_card_register(card); | 355 | ret = snd_card_register(card); |
355 | if (ret == 0) { | 356 | if (ret == 0) { |
356 | platform_set_drvdata(dev, card); | 357 | platform_set_drvdata(dev, card); |
@@ -370,7 +371,7 @@ static int pxa2xx_ac97_probe(struct platform_device *dev) | |||
370 | 371 | ||
371 | static int pxa2xx_ac97_remove(struct platform_device *dev) | 372 | static int pxa2xx_ac97_remove(struct platform_device *dev) |
372 | { | 373 | { |
373 | snd_card_t *card = platform_get_drvdata(dev); | 374 | struct snd_card *card = platform_get_drvdata(dev); |
374 | 375 | ||
375 | if (card) { | 376 | if (card) { |
376 | snd_card_free(card); | 377 | snd_card_free(card); |
diff --git a/sound/arm/pxa2xx-pcm.c b/sound/arm/pxa2xx-pcm.c index b1eb53b02eae..4938ef10b813 100644 --- a/sound/arm/pxa2xx-pcm.c +++ b/sound/arm/pxa2xx-pcm.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "pxa2xx-pcm.h" | 28 | #include "pxa2xx-pcm.h" |
29 | 29 | ||
30 | 30 | ||
31 | static const snd_pcm_hardware_t pxa2xx_pcm_hardware = { | 31 | static const struct snd_pcm_hardware pxa2xx_pcm_hardware = { |
32 | .info = SNDRV_PCM_INFO_MMAP | | 32 | .info = SNDRV_PCM_INFO_MMAP | |
33 | SNDRV_PCM_INFO_MMAP_VALID | | 33 | SNDRV_PCM_INFO_MMAP_VALID | |
34 | SNDRV_PCM_INFO_INTERLEAVED | | 34 | SNDRV_PCM_INFO_INTERLEAVED | |
@@ -44,15 +44,15 @@ static const snd_pcm_hardware_t pxa2xx_pcm_hardware = { | |||
44 | 44 | ||
45 | struct pxa2xx_runtime_data { | 45 | struct pxa2xx_runtime_data { |
46 | int dma_ch; | 46 | int dma_ch; |
47 | pxa2xx_pcm_dma_params_t *params; | 47 | struct pxa2xx_pcm_dma_params *params; |
48 | pxa_dma_desc *dma_desc_array; | 48 | pxa_dma_desc *dma_desc_array; |
49 | dma_addr_t dma_desc_array_phys; | 49 | dma_addr_t dma_desc_array_phys; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static int pxa2xx_pcm_hw_params(snd_pcm_substream_t *substream, | 52 | static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, |
53 | snd_pcm_hw_params_t *params) | 53 | struct snd_pcm_hw_params *params) |
54 | { | 54 | { |
55 | snd_pcm_runtime_t *runtime = substream->runtime; | 55 | struct snd_pcm_runtime *runtime = substream->runtime; |
56 | struct pxa2xx_runtime_data *rtd = runtime->private_data; | 56 | struct pxa2xx_runtime_data *rtd = runtime->private_data; |
57 | size_t totsize = params_buffer_bytes(params); | 57 | size_t totsize = params_buffer_bytes(params); |
58 | size_t period = params_period_bytes(params); | 58 | size_t period = params_period_bytes(params); |
@@ -86,7 +86,7 @@ static int pxa2xx_pcm_hw_params(snd_pcm_substream_t *substream, | |||
86 | return 0; | 86 | return 0; |
87 | } | 87 | } |
88 | 88 | ||
89 | static int pxa2xx_pcm_hw_free(snd_pcm_substream_t *substream) | 89 | static int pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream) |
90 | { | 90 | { |
91 | struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; | 91 | struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; |
92 | 92 | ||
@@ -95,10 +95,10 @@ static int pxa2xx_pcm_hw_free(snd_pcm_substream_t *substream) | |||
95 | return 0; | 95 | return 0; |
96 | } | 96 | } |
97 | 97 | ||
98 | static int pxa2xx_pcm_prepare(snd_pcm_substream_t *substream) | 98 | static int pxa2xx_pcm_prepare(struct snd_pcm_substream *substream) |
99 | { | 99 | { |
100 | pxa2xx_pcm_client_t *client = substream->private_data; | 100 | struct pxa2xx_pcm_client *client = substream->private_data; |
101 | snd_pcm_runtime_t *runtime = substream->runtime; | 101 | struct snd_pcm_runtime *runtime = substream->runtime; |
102 | struct pxa2xx_runtime_data *rtd = runtime->private_data; | 102 | struct pxa2xx_runtime_data *rtd = runtime->private_data; |
103 | 103 | ||
104 | DCSR(rtd->dma_ch) &= ~DCSR_RUN; | 104 | DCSR(rtd->dma_ch) &= ~DCSR_RUN; |
@@ -109,7 +109,7 @@ static int pxa2xx_pcm_prepare(snd_pcm_substream_t *substream) | |||
109 | return client->prepare(substream); | 109 | return client->prepare(substream); |
110 | } | 110 | } |
111 | 111 | ||
112 | static int pxa2xx_pcm_trigger(snd_pcm_substream_t *substream, int cmd) | 112 | static int pxa2xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
113 | { | 113 | { |
114 | struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; | 114 | struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; |
115 | int ret = 0; | 115 | int ret = 0; |
@@ -139,7 +139,7 @@ static int pxa2xx_pcm_trigger(snd_pcm_substream_t *substream, int cmd) | |||
139 | 139 | ||
140 | static void pxa2xx_pcm_dma_irq(int dma_ch, void *dev_id, struct pt_regs *regs) | 140 | static void pxa2xx_pcm_dma_irq(int dma_ch, void *dev_id, struct pt_regs *regs) |
141 | { | 141 | { |
142 | snd_pcm_substream_t *substream = dev_id; | 142 | struct snd_pcm_substream *substream = dev_id; |
143 | struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; | 143 | struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; |
144 | int dcsr; | 144 | int dcsr; |
145 | 145 | ||
@@ -155,9 +155,9 @@ static void pxa2xx_pcm_dma_irq(int dma_ch, void *dev_id, struct pt_regs *regs) | |||
155 | } | 155 | } |
156 | } | 156 | } |
157 | 157 | ||
158 | static snd_pcm_uframes_t pxa2xx_pcm_pointer(snd_pcm_substream_t *substream) | 158 | static snd_pcm_uframes_t pxa2xx_pcm_pointer(struct snd_pcm_substream *substream) |
159 | { | 159 | { |
160 | snd_pcm_runtime_t *runtime = substream->runtime; | 160 | struct snd_pcm_runtime *runtime = substream->runtime; |
161 | struct pxa2xx_runtime_data *rtd = runtime->private_data; | 161 | struct pxa2xx_runtime_data *rtd = runtime->private_data; |
162 | dma_addr_t ptr = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? | 162 | dma_addr_t ptr = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? |
163 | DSADR(rtd->dma_ch) : DTADR(rtd->dma_ch); | 163 | DSADR(rtd->dma_ch) : DTADR(rtd->dma_ch); |
@@ -168,9 +168,9 @@ static snd_pcm_uframes_t pxa2xx_pcm_pointer(snd_pcm_substream_t *substream) | |||
168 | } | 168 | } |
169 | 169 | ||
170 | static int | 170 | static int |
171 | pxa2xx_pcm_hw_rule_mult32(snd_pcm_hw_params_t *params, snd_pcm_hw_rule_t *rule) | 171 | pxa2xx_pcm_hw_rule_mult32(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) |
172 | { | 172 | { |
173 | snd_interval_t *i = hw_param_interval(params, rule->var); | 173 | struct snd_interval *i = hw_param_interval(params, rule->var); |
174 | int changed = 0; | 174 | int changed = 0; |
175 | 175 | ||
176 | if (i->min & 31) { | 176 | if (i->min & 31) { |
@@ -188,10 +188,10 @@ pxa2xx_pcm_hw_rule_mult32(snd_pcm_hw_params_t *params, snd_pcm_hw_rule_t *rule) | |||
188 | return changed; | 188 | return changed; |
189 | } | 189 | } |
190 | 190 | ||
191 | static int pxa2xx_pcm_open(snd_pcm_substream_t *substream) | 191 | static int pxa2xx_pcm_open(struct snd_pcm_substream *substream) |
192 | { | 192 | { |
193 | pxa2xx_pcm_client_t *client = substream->private_data; | 193 | struct pxa2xx_pcm_client *client = substream->private_data; |
194 | snd_pcm_runtime_t *runtime = substream->runtime; | 194 | struct snd_pcm_runtime *runtime = substream->runtime; |
195 | struct pxa2xx_runtime_data *rtd; | 195 | struct pxa2xx_runtime_data *rtd; |
196 | int ret; | 196 | int ret; |
197 | 197 | ||
@@ -246,9 +246,9 @@ static int pxa2xx_pcm_open(snd_pcm_substream_t *substream) | |||
246 | return ret; | 246 | return ret; |
247 | } | 247 | } |
248 | 248 | ||
249 | static int pxa2xx_pcm_close(snd_pcm_substream_t *substream) | 249 | static int pxa2xx_pcm_close(struct snd_pcm_substream *substream) |
250 | { | 250 | { |
251 | pxa2xx_pcm_client_t *client = substream->private_data; | 251 | struct pxa2xx_pcm_client *client = substream->private_data; |
252 | struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; | 252 | struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; |
253 | 253 | ||
254 | pxa_free_dma(rtd->dma_ch); | 254 | pxa_free_dma(rtd->dma_ch); |
@@ -260,16 +260,16 @@ static int pxa2xx_pcm_close(snd_pcm_substream_t *substream) | |||
260 | } | 260 | } |
261 | 261 | ||
262 | static int | 262 | static int |
263 | pxa2xx_pcm_mmap(snd_pcm_substream_t *substream, struct vm_area_struct *vma) | 263 | pxa2xx_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma) |
264 | { | 264 | { |
265 | snd_pcm_runtime_t *runtime = substream->runtime; | 265 | struct snd_pcm_runtime *runtime = substream->runtime; |
266 | return dma_mmap_writecombine(substream->pcm->card->dev, vma, | 266 | return dma_mmap_writecombine(substream->pcm->card->dev, vma, |
267 | runtime->dma_area, | 267 | runtime->dma_area, |
268 | runtime->dma_addr, | 268 | runtime->dma_addr, |
269 | runtime->dma_bytes); | 269 | runtime->dma_bytes); |
270 | } | 270 | } |
271 | 271 | ||
272 | static snd_pcm_ops_t pxa2xx_pcm_ops = { | 272 | static struct snd_pcm_ops pxa2xx_pcm_ops = { |
273 | .open = pxa2xx_pcm_open, | 273 | .open = pxa2xx_pcm_open, |
274 | .close = pxa2xx_pcm_close, | 274 | .close = pxa2xx_pcm_close, |
275 | .ioctl = snd_pcm_lib_ioctl, | 275 | .ioctl = snd_pcm_lib_ioctl, |
@@ -281,9 +281,9 @@ static snd_pcm_ops_t pxa2xx_pcm_ops = { | |||
281 | .mmap = pxa2xx_pcm_mmap, | 281 | .mmap = pxa2xx_pcm_mmap, |
282 | }; | 282 | }; |
283 | 283 | ||
284 | static int pxa2xx_pcm_preallocate_dma_buffer(snd_pcm_t *pcm, int stream) | 284 | static int pxa2xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) |
285 | { | 285 | { |
286 | snd_pcm_substream_t *substream = pcm->streams[stream].substream; | 286 | struct snd_pcm_substream *substream = pcm->streams[stream].substream; |
287 | struct snd_dma_buffer *buf = &substream->dma_buffer; | 287 | struct snd_dma_buffer *buf = &substream->dma_buffer; |
288 | size_t size = pxa2xx_pcm_hardware.buffer_bytes_max; | 288 | size_t size = pxa2xx_pcm_hardware.buffer_bytes_max; |
289 | buf->dev.type = SNDRV_DMA_TYPE_DEV; | 289 | buf->dev.type = SNDRV_DMA_TYPE_DEV; |
@@ -297,9 +297,9 @@ static int pxa2xx_pcm_preallocate_dma_buffer(snd_pcm_t *pcm, int stream) | |||
297 | return 0; | 297 | return 0; |
298 | } | 298 | } |
299 | 299 | ||
300 | static void pxa2xx_pcm_free_dma_buffers(snd_pcm_t *pcm) | 300 | static void pxa2xx_pcm_free_dma_buffers(struct snd_pcm *pcm) |
301 | { | 301 | { |
302 | snd_pcm_substream_t *substream; | 302 | struct snd_pcm_substream *substream; |
303 | struct snd_dma_buffer *buf; | 303 | struct snd_dma_buffer *buf; |
304 | int stream; | 304 | int stream; |
305 | 305 | ||
@@ -318,9 +318,10 @@ static void pxa2xx_pcm_free_dma_buffers(snd_pcm_t *pcm) | |||
318 | 318 | ||
319 | static u64 pxa2xx_pcm_dmamask = 0xffffffff; | 319 | static u64 pxa2xx_pcm_dmamask = 0xffffffff; |
320 | 320 | ||
321 | int pxa2xx_pcm_new(snd_card_t *card, pxa2xx_pcm_client_t *client, snd_pcm_t **rpcm) | 321 | int pxa2xx_pcm_new(struct snd_card *card, struct pxa2xx_pcm_client *client, |
322 | struct snd_pcm **rpcm) | ||
322 | { | 323 | { |
323 | snd_pcm_t *pcm; | 324 | struct snd_pcm *pcm; |
324 | int play = client->playback_params ? 1 : 0; | 325 | int play = client->playback_params ? 1 : 0; |
325 | int capt = client->capture_params ? 1 : 0; | 326 | int capt = client->capture_params ? 1 : 0; |
326 | int ret; | 327 | int ret; |
diff --git a/sound/arm/pxa2xx-pcm.h b/sound/arm/pxa2xx-pcm.h index 43517597cab9..b79f1e803780 100644 --- a/sound/arm/pxa2xx-pcm.h +++ b/sound/arm/pxa2xx-pcm.h | |||
@@ -10,20 +10,20 @@ | |||
10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | typedef struct { | 13 | struct pxa2xx_pcm_dma_params { |
14 | char *name; /* stream identifier */ | 14 | char *name; /* stream identifier */ |
15 | u32 dcmd; /* DMA descriptor dcmd field */ | 15 | u32 dcmd; /* DMA descriptor dcmd field */ |
16 | volatile u32 *drcmr; /* the DMA request channel to use */ | 16 | volatile u32 *drcmr; /* the DMA request channel to use */ |
17 | u32 dev_addr; /* device physical address for DMA */ | 17 | u32 dev_addr; /* device physical address for DMA */ |
18 | } pxa2xx_pcm_dma_params_t; | 18 | }; |
19 | 19 | ||
20 | typedef struct { | 20 | struct pxa2xx_pcm_client { |
21 | pxa2xx_pcm_dma_params_t *playback_params; | 21 | struct pxa2xx_pcm_dma_params *playback_params; |
22 | pxa2xx_pcm_dma_params_t *capture_params; | 22 | struct pxa2xx_pcm_dma_params *capture_params; |
23 | int (*startup)(snd_pcm_substream_t *); | 23 | int (*startup)(struct snd_pcm_substream *); |
24 | void (*shutdown)(snd_pcm_substream_t *); | 24 | void (*shutdown)(struct snd_pcm_substream *); |
25 | int (*prepare)(snd_pcm_substream_t *); | 25 | int (*prepare)(struct snd_pcm_substream *); |
26 | } pxa2xx_pcm_client_t; | 26 | }; |
27 | 27 | ||
28 | extern int pxa2xx_pcm_new(snd_card_t *, pxa2xx_pcm_client_t *, snd_pcm_t **); | 28 | extern int pxa2xx_pcm_new(struct snd_card *, struct pxa2xx_pcm_client *, struct snd_pcm **); |
29 | 29 | ||
diff --git a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c index 6ee912259cc5..13057d92f08a 100644 --- a/sound/arm/sa11xx-uda1341.c +++ b/sound/arm/sa11xx-uda1341.c | |||
@@ -21,7 +21,7 @@ | |||
21 | * merged HAL layer (patches from Brian) | 21 | * merged HAL layer (patches from Brian) |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* $Id: sa11xx-uda1341.c,v 1.23 2005/09/09 13:22:34 tiwai Exp $ */ | 24 | /* $Id: sa11xx-uda1341.c,v 1.27 2005/12/07 09:13:42 cladisch Exp $ */ |
25 | 25 | ||
26 | /*************************************************************************************************** | 26 | /*************************************************************************************************** |
27 | * | 27 | * |
@@ -64,6 +64,8 @@ | |||
64 | #include <linux/module.h> | 64 | #include <linux/module.h> |
65 | #include <linux/moduleparam.h> | 65 | #include <linux/moduleparam.h> |
66 | #include <linux/init.h> | 66 | #include <linux/init.h> |
67 | #include <linux/err.h> | ||
68 | #include <linux/platform_device.h> | ||
67 | #include <linux/errno.h> | 69 | #include <linux/errno.h> |
68 | #include <linux/ioctl.h> | 70 | #include <linux/ioctl.h> |
69 | #include <linux/delay.h> | 71 | #include <linux/delay.h> |
@@ -115,7 +117,7 @@ static char *id = NULL; /* ID for this card */ | |||
115 | module_param(id, charp, 0444); | 117 | module_param(id, charp, 0444); |
116 | MODULE_PARM_DESC(id, "ID string for SA1100/SA1111 + UDA1341TS soundcard."); | 118 | MODULE_PARM_DESC(id, "ID string for SA1100/SA1111 + UDA1341TS soundcard."); |
117 | 119 | ||
118 | typedef struct audio_stream { | 120 | struct audio_stream { |
119 | char *id; /* identification string */ | 121 | char *id; /* identification string */ |
120 | int stream_id; /* numeric identification */ | 122 | int stream_id; /* numeric identification */ |
121 | dma_device_t dma_dev; /* device identifier for DMA */ | 123 | dma_device_t dma_dev; /* device identifier for DMA */ |
@@ -130,18 +132,16 @@ typedef struct audio_stream { | |||
130 | int tx_spin; /* are we recoding - flag used to do DMA trans. for sync */ | 132 | int tx_spin; /* are we recoding - flag used to do DMA trans. for sync */ |
131 | unsigned int old_offset; | 133 | unsigned int old_offset; |
132 | spinlock_t dma_lock; /* for locking in DMA operations (see dma-sa1100.c in the kernel) */ | 134 | spinlock_t dma_lock; /* for locking in DMA operations (see dma-sa1100.c in the kernel) */ |
133 | snd_pcm_substream_t *stream; | 135 | struct snd_pcm_substream *stream; |
134 | }audio_stream_t; | 136 | }; |
135 | 137 | ||
136 | typedef struct snd_card_sa11xx_uda1341 { | 138 | struct sa11xx_uda1341 { |
137 | snd_card_t *card; | 139 | struct snd_card *card; |
138 | struct l3_client *uda1341; | 140 | struct l3_client *uda1341; |
139 | snd_pcm_t *pcm; | 141 | struct snd_pcm *pcm; |
140 | long samplerate; | 142 | long samplerate; |
141 | audio_stream_t s[2]; /* playback & capture */ | 143 | struct audio_stream s[2]; /* playback & capture */ |
142 | } sa11xx_uda1341_t; | 144 | }; |
143 | |||
144 | static struct snd_card_sa11xx_uda1341 *sa11xx_uda1341 = NULL; | ||
145 | 145 | ||
146 | static unsigned int rates[] = { | 146 | static unsigned int rates[] = { |
147 | 8000, 10666, 10985, 14647, | 147 | 8000, 10666, 10985, 14647, |
@@ -149,12 +149,14 @@ static unsigned int rates[] = { | |||
149 | 29400, 32000, 44100, 48000, | 149 | 29400, 32000, 44100, 48000, |
150 | }; | 150 | }; |
151 | 151 | ||
152 | static snd_pcm_hw_constraint_list_t hw_constraints_rates = { | 152 | static struct snd_pcm_hw_constraint_list hw_constraints_rates = { |
153 | .count = ARRAY_SIZE(rates), | 153 | .count = ARRAY_SIZE(rates), |
154 | .list = rates, | 154 | .list = rates, |
155 | .mask = 0, | 155 | .mask = 0, |
156 | }; | 156 | }; |
157 | 157 | ||
158 | static struct platform_device *device; | ||
159 | |||
158 | /* }}} */ | 160 | /* }}} */ |
159 | 161 | ||
160 | /* {{{ Clock and sample rate stuff */ | 162 | /* {{{ Clock and sample rate stuff */ |
@@ -195,7 +197,7 @@ static void sa11xx_uda1341_set_audio_clock(long val) | |||
195 | } | 197 | } |
196 | } | 198 | } |
197 | 199 | ||
198 | static void sa11xx_uda1341_set_samplerate(sa11xx_uda1341_t *sa11xx_uda1341, long rate) | 200 | static void sa11xx_uda1341_set_samplerate(struct sa11xx_uda1341 *sa11xx_uda1341, long rate) |
199 | { | 201 | { |
200 | int clk_div = 0; | 202 | int clk_div = 0; |
201 | int clk=0; | 203 | int clk=0; |
@@ -280,7 +282,7 @@ static void sa11xx_uda1341_set_samplerate(sa11xx_uda1341_t *sa11xx_uda1341, long | |||
280 | 282 | ||
281 | /* {{{ HW init and shutdown */ | 283 | /* {{{ HW init and shutdown */ |
282 | 284 | ||
283 | static void sa11xx_uda1341_audio_init(sa11xx_uda1341_t *sa11xx_uda1341) | 285 | static void sa11xx_uda1341_audio_init(struct sa11xx_uda1341 *sa11xx_uda1341) |
284 | { | 286 | { |
285 | unsigned long flags; | 287 | unsigned long flags; |
286 | 288 | ||
@@ -337,7 +339,7 @@ static void sa11xx_uda1341_audio_init(sa11xx_uda1341_t *sa11xx_uda1341) | |||
337 | #endif | 339 | #endif |
338 | } | 340 | } |
339 | 341 | ||
340 | static void sa11xx_uda1341_audio_shutdown(sa11xx_uda1341_t *sa11xx_uda1341) | 342 | static void sa11xx_uda1341_audio_shutdown(struct sa11xx_uda1341 *sa11xx_uda1341) |
341 | { | 343 | { |
342 | /* mute on */ | 344 | /* mute on */ |
343 | #ifdef CONFIG_H3600_HAL | 345 | #ifdef CONFIG_H3600_HAL |
@@ -378,7 +380,7 @@ static void sa11xx_uda1341_audio_shutdown(sa11xx_uda1341_t *sa11xx_uda1341) | |||
378 | 380 | ||
379 | #ifdef HH_VERSION | 381 | #ifdef HH_VERSION |
380 | 382 | ||
381 | static int audio_dma_request(audio_stream_t *s, void (*callback)(void *, int)) | 383 | static int audio_dma_request(struct audio_stream *s, void (*callback)(void *, int)) |
382 | { | 384 | { |
383 | int ret; | 385 | int ret; |
384 | 386 | ||
@@ -391,7 +393,7 @@ static int audio_dma_request(audio_stream_t *s, void (*callback)(void *, int)) | |||
391 | return 0; | 393 | return 0; |
392 | } | 394 | } |
393 | 395 | ||
394 | static inline void audio_dma_free(audio_stream_t *s) | 396 | static inline void audio_dma_free(struct audio_stream *s) |
395 | { | 397 | { |
396 | sa1100_free_dma(s->dmach); | 398 | sa1100_free_dma(s->dmach); |
397 | s->dmach = -1; | 399 | s->dmach = -1; |
@@ -399,7 +401,7 @@ static inline void audio_dma_free(audio_stream_t *s) | |||
399 | 401 | ||
400 | #else | 402 | #else |
401 | 403 | ||
402 | static int audio_dma_request(audio_stream_t *s, void (*callback)(void *)) | 404 | static int audio_dma_request(struct audio_stream *s, void (*callback)(void *)) |
403 | { | 405 | { |
404 | int ret; | 406 | int ret; |
405 | 407 | ||
@@ -409,18 +411,18 @@ static int audio_dma_request(audio_stream_t *s, void (*callback)(void *)) | |||
409 | return ret; | 411 | return ret; |
410 | } | 412 | } |
411 | 413 | ||
412 | static void audio_dma_free(audio_stream_t *s) | 414 | static void audio_dma_free(struct audio_stream *s) |
413 | { | 415 | { |
414 | sa1100_free_dma((s)->dma_regs); | 416 | sa1100_free_dma(s->dma_regs); |
415 | (s)->dma_regs = 0; | 417 | s->dma_regs = 0; |
416 | } | 418 | } |
417 | 419 | ||
418 | #endif | 420 | #endif |
419 | 421 | ||
420 | static u_int audio_get_dma_pos(audio_stream_t *s) | 422 | static u_int audio_get_dma_pos(struct audio_stream *s) |
421 | { | 423 | { |
422 | snd_pcm_substream_t * substream = s->stream; | 424 | struct snd_pcm_substream *substream = s->stream; |
423 | snd_pcm_runtime_t *runtime = substream->runtime; | 425 | struct snd_pcm_runtime *runtime = substream->runtime; |
424 | unsigned int offset; | 426 | unsigned int offset; |
425 | unsigned long flags; | 427 | unsigned long flags; |
426 | dma_addr_t addr; | 428 | dma_addr_t addr; |
@@ -445,7 +447,7 @@ static u_int audio_get_dma_pos(audio_stream_t *s) | |||
445 | /* | 447 | /* |
446 | * this stops the dma and clears the dma ptrs | 448 | * this stops the dma and clears the dma ptrs |
447 | */ | 449 | */ |
448 | static void audio_stop_dma(audio_stream_t *s) | 450 | static void audio_stop_dma(struct audio_stream *s) |
449 | { | 451 | { |
450 | unsigned long flags; | 452 | unsigned long flags; |
451 | 453 | ||
@@ -461,10 +463,10 @@ static void audio_stop_dma(audio_stream_t *s) | |||
461 | spin_unlock_irqrestore(&s->dma_lock, flags); | 463 | spin_unlock_irqrestore(&s->dma_lock, flags); |
462 | } | 464 | } |
463 | 465 | ||
464 | static void audio_process_dma(audio_stream_t *s) | 466 | static void audio_process_dma(struct audio_stream *s) |
465 | { | 467 | { |
466 | snd_pcm_substream_t *substream = s->stream; | 468 | struct snd_pcm_substream *substream = s->stream; |
467 | snd_pcm_runtime_t *runtime; | 469 | struct snd_pcm_runtime *runtime; |
468 | unsigned int dma_size; | 470 | unsigned int dma_size; |
469 | unsigned int offset; | 471 | unsigned int offset; |
470 | int ret; | 472 | int ret; |
@@ -527,7 +529,7 @@ static void audio_dma_callback(void *data, int size) | |||
527 | static void audio_dma_callback(void *data) | 529 | static void audio_dma_callback(void *data) |
528 | #endif | 530 | #endif |
529 | { | 531 | { |
530 | audio_stream_t *s = data; | 532 | struct audio_stream *s = data; |
531 | 533 | ||
532 | /* | 534 | /* |
533 | * If we are getting a callback for an active stream then we inform | 535 | * If we are getting a callback for an active stream then we inform |
@@ -549,12 +551,12 @@ static void audio_dma_callback(void *data) | |||
549 | 551 | ||
550 | /* {{{ trigger & timer */ | 552 | /* {{{ trigger & timer */ |
551 | 553 | ||
552 | static int snd_sa11xx_uda1341_trigger(snd_pcm_substream_t * substream, int cmd) | 554 | static int snd_sa11xx_uda1341_trigger(struct snd_pcm_substream *substream, int cmd) |
553 | { | 555 | { |
554 | sa11xx_uda1341_t *chip = snd_pcm_substream_chip(substream); | 556 | struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream); |
555 | int stream_id = substream->pstr->stream; | 557 | int stream_id = substream->pstr->stream; |
556 | audio_stream_t *s = &chip->s[stream_id]; | 558 | struct audio_stream *s = &chip->s[stream_id]; |
557 | audio_stream_t *s1 = &chip->s[stream_id ^ 1]; | 559 | struct audio_stream *s1 = &chip->s[stream_id ^ 1]; |
558 | int err = 0; | 560 | int err = 0; |
559 | 561 | ||
560 | /* note local interrupts are already disabled in the midlevel code */ | 562 | /* note local interrupts are already disabled in the midlevel code */ |
@@ -683,11 +685,11 @@ static int snd_sa11xx_uda1341_trigger(snd_pcm_substream_t * substream, int cmd) | |||
683 | return err; | 685 | return err; |
684 | } | 686 | } |
685 | 687 | ||
686 | static int snd_sa11xx_uda1341_prepare(snd_pcm_substream_t * substream) | 688 | static int snd_sa11xx_uda1341_prepare(struct snd_pcm_substream *substream) |
687 | { | 689 | { |
688 | sa11xx_uda1341_t *chip = snd_pcm_substream_chip(substream); | 690 | struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream); |
689 | snd_pcm_runtime_t *runtime = substream->runtime; | 691 | struct snd_pcm_runtime *runtime = substream->runtime; |
690 | audio_stream_t *s = &chip->s[substream->pstr->stream]; | 692 | struct audio_stream *s = &chip->s[substream->pstr->stream]; |
691 | 693 | ||
692 | /* set requested samplerate */ | 694 | /* set requested samplerate */ |
693 | sa11xx_uda1341_set_samplerate(chip, runtime->rate); | 695 | sa11xx_uda1341_set_samplerate(chip, runtime->rate); |
@@ -701,15 +703,15 @@ static int snd_sa11xx_uda1341_prepare(snd_pcm_substream_t * substream) | |||
701 | return 0; | 703 | return 0; |
702 | } | 704 | } |
703 | 705 | ||
704 | static snd_pcm_uframes_t snd_sa11xx_uda1341_pointer(snd_pcm_substream_t * substream) | 706 | static snd_pcm_uframes_t snd_sa11xx_uda1341_pointer(struct snd_pcm_substream *substream) |
705 | { | 707 | { |
706 | sa11xx_uda1341_t *chip = snd_pcm_substream_chip(substream); | 708 | struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream); |
707 | return audio_get_dma_pos(&chip->s[substream->pstr->stream]); | 709 | return audio_get_dma_pos(&chip->s[substream->pstr->stream]); |
708 | } | 710 | } |
709 | 711 | ||
710 | /* }}} */ | 712 | /* }}} */ |
711 | 713 | ||
712 | static snd_pcm_hardware_t snd_sa11xx_uda1341_capture = | 714 | static struct snd_pcm_hardware snd_sa11xx_uda1341_capture = |
713 | { | 715 | { |
714 | .info = (SNDRV_PCM_INFO_INTERLEAVED | | 716 | .info = (SNDRV_PCM_INFO_INTERLEAVED | |
715 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 717 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
@@ -732,7 +734,7 @@ static snd_pcm_hardware_t snd_sa11xx_uda1341_capture = | |||
732 | .fifo_size = 0, | 734 | .fifo_size = 0, |
733 | }; | 735 | }; |
734 | 736 | ||
735 | static snd_pcm_hardware_t snd_sa11xx_uda1341_playback = | 737 | static struct snd_pcm_hardware snd_sa11xx_uda1341_playback = |
736 | { | 738 | { |
737 | .info = (SNDRV_PCM_INFO_INTERLEAVED | | 739 | .info = (SNDRV_PCM_INFO_INTERLEAVED | |
738 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 740 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
@@ -755,10 +757,10 @@ static snd_pcm_hardware_t snd_sa11xx_uda1341_playback = | |||
755 | .fifo_size = 0, | 757 | .fifo_size = 0, |
756 | }; | 758 | }; |
757 | 759 | ||
758 | static int snd_card_sa11xx_uda1341_open(snd_pcm_substream_t * substream) | 760 | static int snd_card_sa11xx_uda1341_open(struct snd_pcm_substream *substream) |
759 | { | 761 | { |
760 | sa11xx_uda1341_t *chip = snd_pcm_substream_chip(substream); | 762 | struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream); |
761 | snd_pcm_runtime_t *runtime = substream->runtime; | 763 | struct snd_pcm_runtime *runtime = substream->runtime; |
762 | int stream_id = substream->pstr->stream; | 764 | int stream_id = substream->pstr->stream; |
763 | int err; | 765 | int err; |
764 | 766 | ||
@@ -776,9 +778,9 @@ static int snd_card_sa11xx_uda1341_open(snd_pcm_substream_t * substream) | |||
776 | return 0; | 778 | return 0; |
777 | } | 779 | } |
778 | 780 | ||
779 | static int snd_card_sa11xx_uda1341_close(snd_pcm_substream_t * substream) | 781 | static int snd_card_sa11xx_uda1341_close(struct snd_pcm_substream *substream) |
780 | { | 782 | { |
781 | sa11xx_uda1341_t *chip = snd_pcm_substream_chip(substream); | 783 | struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream); |
782 | 784 | ||
783 | chip->s[substream->pstr->stream].stream = NULL; | 785 | chip->s[substream->pstr->stream].stream = NULL; |
784 | return 0; | 786 | return 0; |
@@ -786,21 +788,21 @@ static int snd_card_sa11xx_uda1341_close(snd_pcm_substream_t * substream) | |||
786 | 788 | ||
787 | /* {{{ HW params & free */ | 789 | /* {{{ HW params & free */ |
788 | 790 | ||
789 | static int snd_sa11xx_uda1341_hw_params(snd_pcm_substream_t * substream, | 791 | static int snd_sa11xx_uda1341_hw_params(struct snd_pcm_substream *substream, |
790 | snd_pcm_hw_params_t * hw_params) | 792 | struct snd_pcm_hw_params *hw_params) |
791 | { | 793 | { |
792 | 794 | ||
793 | return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); | 795 | return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); |
794 | } | 796 | } |
795 | 797 | ||
796 | static int snd_sa11xx_uda1341_hw_free(snd_pcm_substream_t * substream) | 798 | static int snd_sa11xx_uda1341_hw_free(struct snd_pcm_substream *substream) |
797 | { | 799 | { |
798 | return snd_pcm_lib_free_pages(substream); | 800 | return snd_pcm_lib_free_pages(substream); |
799 | } | 801 | } |
800 | 802 | ||
801 | /* }}} */ | 803 | /* }}} */ |
802 | 804 | ||
803 | static snd_pcm_ops_t snd_card_sa11xx_uda1341_playback_ops = { | 805 | static struct snd_pcm_ops snd_card_sa11xx_uda1341_playback_ops = { |
804 | .open = snd_card_sa11xx_uda1341_open, | 806 | .open = snd_card_sa11xx_uda1341_open, |
805 | .close = snd_card_sa11xx_uda1341_close, | 807 | .close = snd_card_sa11xx_uda1341_close, |
806 | .ioctl = snd_pcm_lib_ioctl, | 808 | .ioctl = snd_pcm_lib_ioctl, |
@@ -811,7 +813,7 @@ static snd_pcm_ops_t snd_card_sa11xx_uda1341_playback_ops = { | |||
811 | .pointer = snd_sa11xx_uda1341_pointer, | 813 | .pointer = snd_sa11xx_uda1341_pointer, |
812 | }; | 814 | }; |
813 | 815 | ||
814 | static snd_pcm_ops_t snd_card_sa11xx_uda1341_capture_ops = { | 816 | static struct snd_pcm_ops snd_card_sa11xx_uda1341_capture_ops = { |
815 | .open = snd_card_sa11xx_uda1341_open, | 817 | .open = snd_card_sa11xx_uda1341_open, |
816 | .close = snd_card_sa11xx_uda1341_close, | 818 | .close = snd_card_sa11xx_uda1341_close, |
817 | .ioctl = snd_pcm_lib_ioctl, | 819 | .ioctl = snd_pcm_lib_ioctl, |
@@ -822,9 +824,9 @@ static snd_pcm_ops_t snd_card_sa11xx_uda1341_capture_ops = { | |||
822 | .pointer = snd_sa11xx_uda1341_pointer, | 824 | .pointer = snd_sa11xx_uda1341_pointer, |
823 | }; | 825 | }; |
824 | 826 | ||
825 | static int __init snd_card_sa11xx_uda1341_pcm(sa11xx_uda1341_t *sa11xx_uda1341, int device) | 827 | static int __init snd_card_sa11xx_uda1341_pcm(struct sa11xx_uda1341 *sa11xx_uda1341, int device) |
826 | { | 828 | { |
827 | snd_pcm_t *pcm; | 829 | struct snd_pcm *pcm; |
828 | int err; | 830 | int err; |
829 | 831 | ||
830 | if ((err = snd_pcm_new(sa11xx_uda1341->card, "UDA1341 PCM", device, 1, 1, &pcm)) < 0) | 832 | if ((err = snd_pcm_new(sa11xx_uda1341->card, "UDA1341 PCM", device, 1, 1, &pcm)) < 0) |
@@ -835,8 +837,8 @@ static int __init snd_card_sa11xx_uda1341_pcm(sa11xx_uda1341_t *sa11xx_uda1341, | |||
835 | * isa works but I'm not sure why (or if) it's the right choice | 837 | * isa works but I'm not sure why (or if) it's the right choice |
836 | * this may be too large, trying it for now | 838 | * this may be too large, trying it for now |
837 | */ | 839 | */ |
838 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_ISA, | 840 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
839 | snd_pcm_dma_flags(0), | 841 | snd_dma_isa_data(), |
840 | 64*1024, 64*1024); | 842 | 64*1024, 64*1024); |
841 | 843 | ||
842 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_sa11xx_uda1341_playback_ops); | 844 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_sa11xx_uda1341_playback_ops); |
@@ -862,12 +864,15 @@ static int __init snd_card_sa11xx_uda1341_pcm(sa11xx_uda1341_t *sa11xx_uda1341, | |||
862 | 864 | ||
863 | #ifdef CONFIG_PM | 865 | #ifdef CONFIG_PM |
864 | 866 | ||
865 | static int snd_sa11xx_uda1341_suspend(snd_card_t *card, pm_message_t state) | 867 | static int snd_sa11xx_uda1341_suspend(struct platform_device *devptr, |
868 | pm_message_t state) | ||
866 | { | 869 | { |
867 | sa11xx_uda1341_t *chip = card->pm_private_data; | 870 | struct snd_card *card = platform_get_drvdata(devptr); |
871 | struct sa11xx_uda1341 *chip = card->private_data; | ||
868 | 872 | ||
873 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | ||
869 | snd_pcm_suspend_all(chip->pcm); | 874 | snd_pcm_suspend_all(chip->pcm); |
870 | #ifdef HH_VERSION | 875 | #ifdef HH_VERSION |
871 | sa1100_dma_sleep(chip->s[SNDRV_PCM_STREAM_PLAYBACK].dmach); | 876 | sa1100_dma_sleep(chip->s[SNDRV_PCM_STREAM_PLAYBACK].dmach); |
872 | sa1100_dma_sleep(chip->s[SNDRV_PCM_STREAM_CAPTURE].dmach); | 877 | sa1100_dma_sleep(chip->s[SNDRV_PCM_STREAM_CAPTURE].dmach); |
873 | #else | 878 | #else |
@@ -875,12 +880,14 @@ static int snd_sa11xx_uda1341_suspend(snd_card_t *card, pm_message_t state) | |||
875 | #endif | 880 | #endif |
876 | l3_command(chip->uda1341, CMD_SUSPEND, NULL); | 881 | l3_command(chip->uda1341, CMD_SUSPEND, NULL); |
877 | sa11xx_uda1341_audio_shutdown(chip); | 882 | sa11xx_uda1341_audio_shutdown(chip); |
883 | |||
878 | return 0; | 884 | return 0; |
879 | } | 885 | } |
880 | 886 | ||
881 | static int snd_sa11xx_uda1341_resume(snd_card_t *card) | 887 | static int snd_sa11xx_uda1341_resume(struct platform_device *devptr) |
882 | { | 888 | { |
883 | sa11xx_uda1341_t *chip = card->pm_private_data; | 889 | struct snd_card *card = platform_get_drvdata(devptr); |
890 | struct sa11xx_uda1341 *chip = card->private_data; | ||
884 | 891 | ||
885 | sa11xx_uda1341_audio_init(chip); | 892 | sa11xx_uda1341_audio_init(chip); |
886 | l3_command(chip->uda1341, CMD_RESUME, NULL); | 893 | l3_command(chip->uda1341, CMD_RESUME, NULL); |
@@ -890,67 +897,55 @@ static int snd_sa11xx_uda1341_resume(snd_card_t *card) | |||
890 | #else | 897 | #else |
891 | //FIXME | 898 | //FIXME |
892 | #endif | 899 | #endif |
900 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | ||
893 | return 0; | 901 | return 0; |
894 | } | 902 | } |
895 | #endif /* COMFIG_PM */ | 903 | #endif /* COMFIG_PM */ |
896 | 904 | ||
897 | void snd_sa11xx_uda1341_free(snd_card_t *card) | 905 | void snd_sa11xx_uda1341_free(struct snd_card *card) |
898 | { | 906 | { |
899 | sa11xx_uda1341_t *chip = card->private_data; | 907 | struct sa11xx_uda1341 *chip = card->private_data; |
900 | 908 | ||
901 | audio_dma_free(&chip->s[SNDRV_PCM_STREAM_PLAYBACK]); | 909 | audio_dma_free(&chip->s[SNDRV_PCM_STREAM_PLAYBACK]); |
902 | audio_dma_free(&chip->s[SNDRV_PCM_STREAM_CAPTURE]); | 910 | audio_dma_free(&chip->s[SNDRV_PCM_STREAM_CAPTURE]); |
903 | sa11xx_uda1341 = NULL; | ||
904 | card->private_data = NULL; | ||
905 | kfree(chip); | ||
906 | } | 911 | } |
907 | 912 | ||
908 | static int __init sa11xx_uda1341_init(void) | 913 | static int __init sa11xx_uda1341_probe(struct platform_device *devptr) |
909 | { | 914 | { |
910 | int err; | 915 | int err; |
911 | snd_card_t *card; | 916 | struct snd_card *card; |
912 | 917 | struct sa11xx_uda1341 *chip; | |
913 | if (!machine_is_h3xxx()) | ||
914 | return -ENODEV; | ||
915 | 918 | ||
916 | /* register the soundcard */ | 919 | /* register the soundcard */ |
917 | card = snd_card_new(-1, id, THIS_MODULE, sizeof(sa11xx_uda1341_t)); | 920 | card = snd_card_new(-1, id, THIS_MODULE, sizeof(struct sa11xx_uda1341)); |
918 | if (card == NULL) | 921 | if (card == NULL) |
919 | return -ENOMEM; | 922 | return -ENOMEM; |
920 | 923 | ||
921 | sa11xx_uda1341 = kzalloc(sizeof(*sa11xx_uda1341), GFP_KERNEL); | 924 | chip = card->private_data; |
922 | if (sa11xx_uda1341 == NULL) | ||
923 | return -ENOMEM; | ||
924 | spin_lock_init(&chip->s[0].dma_lock); | 925 | spin_lock_init(&chip->s[0].dma_lock); |
925 | spin_lock_init(&chip->s[1].dma_lock); | 926 | spin_lock_init(&chip->s[1].dma_lock); |
926 | |||
927 | card->private_data = (void *)sa11xx_uda1341; | ||
928 | card->private_free = snd_sa11xx_uda1341_free; | ||
929 | 927 | ||
930 | sa11xx_uda1341->card = card; | 928 | card->private_free = snd_sa11xx_uda1341_free; |
931 | sa11xx_uda1341->samplerate = AUDIO_RATE_DEFAULT; | 929 | chip->card = card; |
930 | chip->samplerate = AUDIO_RATE_DEFAULT; | ||
932 | 931 | ||
933 | // mixer | 932 | // mixer |
934 | if ((err = snd_chip_uda1341_mixer_new(sa11xx_uda1341->card, &sa11xx_uda1341->uda1341))) | 933 | if ((err = snd_chip_uda1341_mixer_new(card, &chip->uda1341))) |
935 | goto nodev; | 934 | goto nodev; |
936 | 935 | ||
937 | // PCM | 936 | // PCM |
938 | if ((err = snd_card_sa11xx_uda1341_pcm(sa11xx_uda1341, 0)) < 0) | 937 | if ((err = snd_card_sa11xx_uda1341_pcm(chip, 0)) < 0) |
939 | goto nodev; | 938 | goto nodev; |
940 | 939 | ||
941 | snd_card_set_generic_pm_callback(card, | ||
942 | snd_sa11xx_uda1341_suspend, snd_sa11_uda1341_resume, | ||
943 | sa11xx_uda1341); | ||
944 | |||
945 | strcpy(card->driver, "UDA1341"); | 940 | strcpy(card->driver, "UDA1341"); |
946 | strcpy(card->shortname, "H3600 UDA1341TS"); | 941 | strcpy(card->shortname, "H3600 UDA1341TS"); |
947 | sprintf(card->longname, "Compaq iPAQ H3600 with Philips UDA1341TS"); | 942 | sprintf(card->longname, "Compaq iPAQ H3600 with Philips UDA1341TS"); |
948 | 943 | ||
949 | if ((err = snd_card_set_generic_dev(card)) < 0) | 944 | snd_card_set_dev(card, &devptr->dev); |
950 | goto nodev; | ||
951 | 945 | ||
952 | if ((err = snd_card_register(card)) == 0) { | 946 | if ((err = snd_card_register(card)) == 0) { |
953 | printk( KERN_INFO "iPAQ audio support initialized\n" ); | 947 | printk( KERN_INFO "iPAQ audio support initialized\n" ); |
948 | platform_set_drvdata(devptr, card); | ||
954 | return 0; | 949 | return 0; |
955 | } | 950 | } |
956 | 951 | ||
@@ -959,9 +954,47 @@ static int __init sa11xx_uda1341_init(void) | |||
959 | return err; | 954 | return err; |
960 | } | 955 | } |
961 | 956 | ||
957 | static int __devexit sa11xx_uda1341_remove(struct platform_device *devptr) | ||
958 | { | ||
959 | snd_card_free(platform_get_drvdata(devptr)); | ||
960 | platform_set_drvdata(devptr, NULL); | ||
961 | return 0; | ||
962 | } | ||
963 | |||
964 | #define SA11XX_UDA1341_DRIVER "sa11xx_uda1341" | ||
965 | |||
966 | static struct platform_driver sa11xx_uda1341_driver = { | ||
967 | .probe = sa11xx_uda1341_probe, | ||
968 | .remove = __devexit_p(sa11xx_uda1341_remove), | ||
969 | #ifdef CONFIG_PM | ||
970 | .suspend = snd_sa11xx_uda1341_suspend, | ||
971 | .resume = snd_sa11xx_uda1341_resume, | ||
972 | #endif | ||
973 | .driver = { | ||
974 | .name = SA11XX_UDA1341_DRIVER, | ||
975 | }, | ||
976 | }; | ||
977 | |||
978 | static int __init sa11xx_uda1341_init(void) | ||
979 | { | ||
980 | int err; | ||
981 | |||
982 | if (!machine_is_h3xxx()) | ||
983 | return -ENODEV; | ||
984 | if ((err = platform_driver_register(&sa11xx_uda1341_driver)) < 0) | ||
985 | return err; | ||
986 | device = platform_device_register_simple(SA11XX_UDA1341_DRIVER, -1, NULL, 0); | ||
987 | if (IS_ERR(device)) { | ||
988 | platform_driver_unregister(&sa11xx_uda1341_driver); | ||
989 | return PTR_ERR(device); | ||
990 | } | ||
991 | return 0; | ||
992 | } | ||
993 | |||
962 | static void __exit sa11xx_uda1341_exit(void) | 994 | static void __exit sa11xx_uda1341_exit(void) |
963 | { | 995 | { |
964 | snd_card_free(sa11xx_uda1341->card); | 996 | platform_device_unregister(device); |
997 | platform_driver_unregister(&sa11xx_uda1341_driver); | ||
965 | } | 998 | } |
966 | 999 | ||
967 | module_init(sa11xx_uda1341_init); | 1000 | module_init(sa11xx_uda1341_init); |