diff options
author | Mark Brown <broonie@kernel.org> | 2019-03-18 07:15:09 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-03-18 07:15:09 -0400 |
commit | 127470597b6b9466872d9794a80804ec95fff8ea (patch) | |
tree | b0087938a7f980c5b3d3879e0c2d18bab45d78e8 /sound | |
parent | 3789debfc379ac84b90e2db32d7a6b66d28a2c7c (diff) | |
parent | 9e98c678c2d6ae3a17cb2de55d17f69dddaa231b (diff) |
Merge tag 'v5.1-rc1' into asoc-5.2
Linux 5.1-rc1
Diffstat (limited to 'sound')
187 files changed, 2630 insertions, 2280 deletions
diff --git a/sound/ac97/bus.c b/sound/ac97/bus.c index 9f0c480489ef..9cbf6927abe9 100644 --- a/sound/ac97/bus.c +++ b/sound/ac97/bus.c | |||
@@ -84,7 +84,7 @@ ac97_of_get_child_device(struct ac97_controller *ac97_ctrl, int idx, | |||
84 | if ((idx != of_property_read_u32(node, "reg", ®)) || | 84 | if ((idx != of_property_read_u32(node, "reg", ®)) || |
85 | !of_device_is_compatible(node, compat)) | 85 | !of_device_is_compatible(node, compat)) |
86 | continue; | 86 | continue; |
87 | return of_node_get(node); | 87 | return node; |
88 | } | 88 | } |
89 | 89 | ||
90 | return NULL; | 90 | return NULL; |
diff --git a/sound/aoa/core/gpio-feature.c b/sound/aoa/core/gpio-feature.c index 65557421fe0b..c3ff721e4660 100644 --- a/sound/aoa/core/gpio-feature.c +++ b/sound/aoa/core/gpio-feature.c | |||
@@ -82,6 +82,7 @@ static struct device_node *get_gpio(char *name, | |||
82 | if (altname && (strcmp(audio_gpio, altname) == 0)) | 82 | if (altname && (strcmp(audio_gpio, altname) == 0)) |
83 | break; | 83 | break; |
84 | } | 84 | } |
85 | of_node_put(gpio); | ||
85 | /* still not found, assume not there */ | 86 | /* still not found, assume not there */ |
86 | if (!np) | 87 | if (!np) |
87 | return NULL; | 88 | return NULL; |
diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c index 40ebde2e1ab1..904659d14988 100644 --- a/sound/aoa/soundbus/i2sbus/core.c +++ b/sound/aoa/soundbus/i2sbus/core.c | |||
@@ -380,10 +380,6 @@ static int i2sbus_suspend(struct macio_dev* dev, pm_message_t state) | |||
380 | int err, ret = 0; | 380 | int err, ret = 0; |
381 | 381 | ||
382 | list_for_each_entry(i2sdev, &control->list, item) { | 382 | list_for_each_entry(i2sdev, &control->list, item) { |
383 | /* Notify Alsa */ | ||
384 | /* Suspend PCM streams */ | ||
385 | snd_pcm_suspend_all(i2sdev->sound.pcm); | ||
386 | |||
387 | /* Notify codecs */ | 383 | /* Notify codecs */ |
388 | list_for_each_entry(cii, &i2sdev->sound.codec_list, list) { | 384 | list_for_each_entry(cii, &i2sdev->sound.codec_list, list) { |
389 | err = 0; | 385 | err = 0; |
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index 0114ffed56dd..a2d4b41096e0 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c | |||
@@ -757,7 +757,6 @@ static int aaci_do_suspend(struct snd_card *card) | |||
757 | { | 757 | { |
758 | struct aaci *aaci = card->private_data; | 758 | struct aaci *aaci = card->private_data; |
759 | snd_power_change_state(card, SNDRV_CTL_POWER_D3cold); | 759 | snd_power_change_state(card, SNDRV_CTL_POWER_D3cold); |
760 | snd_pcm_suspend_all(aaci->pcm); | ||
761 | return 0; | 760 | return 0; |
762 | } | 761 | } |
763 | 762 | ||
@@ -942,7 +941,8 @@ static int aaci_init_pcm(struct aaci *aaci) | |||
942 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops); | 941 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops); |
943 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops); | 942 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops); |
944 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 943 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
945 | NULL, 0, 64 * 1024); | 944 | aaci->card->dev, |
945 | 0, 64 * 1024); | ||
946 | } | 946 | } |
947 | 947 | ||
948 | return ret; | 948 | return ret; |
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index 1f72672262d0..68fe5bb11eea 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c | |||
@@ -124,7 +124,6 @@ static int pxa2xx_ac97_do_suspend(struct snd_card *card) | |||
124 | pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; | 124 | pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; |
125 | 125 | ||
126 | snd_power_change_state(card, SNDRV_CTL_POWER_D3cold); | 126 | snd_power_change_state(card, SNDRV_CTL_POWER_D3cold); |
127 | snd_pcm_suspend_all(pxa2xx_ac97_pcm); | ||
128 | snd_ac97_suspend(pxa2xx_ac97_ac97); | 127 | snd_ac97_suspend(pxa2xx_ac97_ac97); |
129 | if (platform_ops && platform_ops->suspend) | 128 | if (platform_ops && platform_ops->suspend) |
130 | platform_ops->suspend(platform_ops->priv); | 129 | platform_ops->suspend(platform_ops->priv); |
diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index 380025887aef..33c87a0547a9 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c | |||
@@ -603,11 +603,9 @@ static int atmel_ac97c_pcm_new(struct atmel_ac97c *chip) | |||
603 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &atmel_ac97_capture_ops); | 603 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &atmel_ac97_capture_ops); |
604 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &atmel_ac97_playback_ops); | 604 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &atmel_ac97_playback_ops); |
605 | 605 | ||
606 | retval = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 606 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
607 | &chip->pdev->dev, hw.periods_min * hw.period_bytes_min, | 607 | &chip->pdev->dev, hw.periods_min * hw.period_bytes_min, |
608 | hw.buffer_bytes_max); | 608 | hw.buffer_bytes_max); |
609 | if (retval) | ||
610 | return retval; | ||
611 | 609 | ||
612 | pcm->private_data = chip; | 610 | pcm->private_data = chip; |
613 | pcm->info_flags = 0; | 611 | pcm->info_flags = 0; |
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index f7d2b373da0a..a1a6fd75cfe5 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c | |||
@@ -1015,22 +1015,13 @@ static int snd_compress_proc_init(struct snd_compr *compr) | |||
1015 | if (!entry) | 1015 | if (!entry) |
1016 | return -ENOMEM; | 1016 | return -ENOMEM; |
1017 | entry->mode = S_IFDIR | 0555; | 1017 | entry->mode = S_IFDIR | 0555; |
1018 | if (snd_info_register(entry) < 0) { | ||
1019 | snd_info_free_entry(entry); | ||
1020 | return -ENOMEM; | ||
1021 | } | ||
1022 | compr->proc_root = entry; | 1018 | compr->proc_root = entry; |
1023 | 1019 | ||
1024 | entry = snd_info_create_card_entry(compr->card, "info", | 1020 | entry = snd_info_create_card_entry(compr->card, "info", |
1025 | compr->proc_root); | 1021 | compr->proc_root); |
1026 | if (entry) { | 1022 | if (entry) |
1027 | snd_info_set_text_ops(entry, compr, | 1023 | snd_info_set_text_ops(entry, compr, |
1028 | snd_compress_proc_info_read); | 1024 | snd_compress_proc_info_read); |
1029 | if (snd_info_register(entry) < 0) { | ||
1030 | snd_info_free_entry(entry); | ||
1031 | entry = NULL; | ||
1032 | } | ||
1033 | } | ||
1034 | compr->proc_info_entry = entry; | 1025 | compr->proc_info_entry = entry; |
1035 | 1026 | ||
1036 | return 0; | 1027 | return 0; |
diff --git a/sound/core/info.c b/sound/core/info.c index fe502bc5e6d2..96a074019c33 100644 --- a/sound/core/info.c +++ b/sound/core/info.c | |||
@@ -463,11 +463,12 @@ static struct snd_info_entry *create_subdir(struct module *mod, | |||
463 | } | 463 | } |
464 | 464 | ||
465 | static struct snd_info_entry * | 465 | static struct snd_info_entry * |
466 | snd_info_create_entry(const char *name, struct snd_info_entry *parent); | 466 | snd_info_create_entry(const char *name, struct snd_info_entry *parent, |
467 | struct module *module); | ||
467 | 468 | ||
468 | int __init snd_info_init(void) | 469 | int __init snd_info_init(void) |
469 | { | 470 | { |
470 | snd_proc_root = snd_info_create_entry("asound", NULL); | 471 | snd_proc_root = snd_info_create_entry("asound", NULL, THIS_MODULE); |
471 | if (!snd_proc_root) | 472 | if (!snd_proc_root) |
472 | return -ENOMEM; | 473 | return -ENOMEM; |
473 | snd_proc_root->mode = S_IFDIR | 0555; | 474 | snd_proc_root->mode = S_IFDIR | 0555; |
@@ -503,6 +504,14 @@ int __exit snd_info_done(void) | |||
503 | return 0; | 504 | return 0; |
504 | } | 505 | } |
505 | 506 | ||
507 | static void snd_card_id_read(struct snd_info_entry *entry, | ||
508 | struct snd_info_buffer *buffer) | ||
509 | { | ||
510 | struct snd_card *card = entry->private_data; | ||
511 | |||
512 | snd_iprintf(buffer, "%s\n", card->id); | ||
513 | } | ||
514 | |||
506 | /* | 515 | /* |
507 | * create a card proc file | 516 | * create a card proc file |
508 | * called from init.c | 517 | * called from init.c |
@@ -520,28 +529,8 @@ int snd_info_card_create(struct snd_card *card) | |||
520 | if (!entry) | 529 | if (!entry) |
521 | return -ENOMEM; | 530 | return -ENOMEM; |
522 | card->proc_root = entry; | 531 | card->proc_root = entry; |
523 | return 0; | ||
524 | } | ||
525 | |||
526 | /* register all pending info entries */ | ||
527 | static int snd_info_register_recursive(struct snd_info_entry *entry) | ||
528 | { | ||
529 | struct snd_info_entry *p; | ||
530 | int err; | ||
531 | 532 | ||
532 | if (!entry->p) { | 533 | return snd_card_ro_proc_new(card, "id", card, snd_card_id_read); |
533 | err = snd_info_register(entry); | ||
534 | if (err < 0) | ||
535 | return err; | ||
536 | } | ||
537 | |||
538 | list_for_each_entry(p, &entry->children, list) { | ||
539 | err = snd_info_register_recursive(p); | ||
540 | if (err < 0) | ||
541 | return err; | ||
542 | } | ||
543 | |||
544 | return 0; | ||
545 | } | 534 | } |
546 | 535 | ||
547 | /* | 536 | /* |
@@ -557,7 +546,7 @@ int snd_info_card_register(struct snd_card *card) | |||
557 | if (snd_BUG_ON(!card)) | 546 | if (snd_BUG_ON(!card)) |
558 | return -ENXIO; | 547 | return -ENXIO; |
559 | 548 | ||
560 | err = snd_info_register_recursive(card->proc_root); | 549 | err = snd_info_register(card->proc_root); |
561 | if (err < 0) | 550 | if (err < 0) |
562 | return err; | 551 | return err; |
563 | 552 | ||
@@ -705,7 +694,8 @@ EXPORT_SYMBOL(snd_info_get_str); | |||
705 | * Return: The pointer of the new instance, or %NULL on failure. | 694 | * Return: The pointer of the new instance, or %NULL on failure. |
706 | */ | 695 | */ |
707 | static struct snd_info_entry * | 696 | static struct snd_info_entry * |
708 | snd_info_create_entry(const char *name, struct snd_info_entry *parent) | 697 | snd_info_create_entry(const char *name, struct snd_info_entry *parent, |
698 | struct module *module) | ||
709 | { | 699 | { |
710 | struct snd_info_entry *entry; | 700 | struct snd_info_entry *entry; |
711 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | 701 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); |
@@ -722,6 +712,7 @@ snd_info_create_entry(const char *name, struct snd_info_entry *parent) | |||
722 | INIT_LIST_HEAD(&entry->children); | 712 | INIT_LIST_HEAD(&entry->children); |
723 | INIT_LIST_HEAD(&entry->list); | 713 | INIT_LIST_HEAD(&entry->list); |
724 | entry->parent = parent; | 714 | entry->parent = parent; |
715 | entry->module = module; | ||
725 | if (parent) | 716 | if (parent) |
726 | list_add_tail(&entry->list, &parent->children); | 717 | list_add_tail(&entry->list, &parent->children); |
727 | return entry; | 718 | return entry; |
@@ -741,10 +732,9 @@ struct snd_info_entry *snd_info_create_module_entry(struct module * module, | |||
741 | const char *name, | 732 | const char *name, |
742 | struct snd_info_entry *parent) | 733 | struct snd_info_entry *parent) |
743 | { | 734 | { |
744 | struct snd_info_entry *entry = snd_info_create_entry(name, parent); | 735 | if (!parent) |
745 | if (entry) | 736 | parent = snd_proc_root; |
746 | entry->module = module; | 737 | return snd_info_create_entry(name, parent, module); |
747 | return entry; | ||
748 | } | 738 | } |
749 | EXPORT_SYMBOL(snd_info_create_module_entry); | 739 | EXPORT_SYMBOL(snd_info_create_module_entry); |
750 | 740 | ||
@@ -762,12 +752,9 @@ struct snd_info_entry *snd_info_create_card_entry(struct snd_card *card, | |||
762 | const char *name, | 752 | const char *name, |
763 | struct snd_info_entry * parent) | 753 | struct snd_info_entry * parent) |
764 | { | 754 | { |
765 | struct snd_info_entry *entry = snd_info_create_entry(name, parent); | 755 | if (!parent) |
766 | if (entry) { | 756 | parent = card->proc_root; |
767 | entry->module = card->module; | 757 | return snd_info_create_entry(name, parent, card->module); |
768 | entry->card = card; | ||
769 | } | ||
770 | return entry; | ||
771 | } | 758 | } |
772 | EXPORT_SYMBOL(snd_info_create_card_entry); | 759 | EXPORT_SYMBOL(snd_info_create_card_entry); |
773 | 760 | ||
@@ -813,15 +800,7 @@ void snd_info_free_entry(struct snd_info_entry * entry) | |||
813 | } | 800 | } |
814 | EXPORT_SYMBOL(snd_info_free_entry); | 801 | EXPORT_SYMBOL(snd_info_free_entry); |
815 | 802 | ||
816 | /** | 803 | static int __snd_info_register(struct snd_info_entry *entry) |
817 | * snd_info_register - register the info entry | ||
818 | * @entry: the info entry | ||
819 | * | ||
820 | * Registers the proc info entry. | ||
821 | * | ||
822 | * Return: Zero if successful, or a negative error code on failure. | ||
823 | */ | ||
824 | int snd_info_register(struct snd_info_entry * entry) | ||
825 | { | 804 | { |
826 | struct proc_dir_entry *root, *p = NULL; | 805 | struct proc_dir_entry *root, *p = NULL; |
827 | 806 | ||
@@ -829,6 +808,8 @@ int snd_info_register(struct snd_info_entry * entry) | |||
829 | return -ENXIO; | 808 | return -ENXIO; |
830 | root = entry->parent == NULL ? snd_proc_root->p : entry->parent->p; | 809 | root = entry->parent == NULL ? snd_proc_root->p : entry->parent->p; |
831 | mutex_lock(&info_mutex); | 810 | mutex_lock(&info_mutex); |
811 | if (entry->p || !root) | ||
812 | goto unlock; | ||
832 | if (S_ISDIR(entry->mode)) { | 813 | if (S_ISDIR(entry->mode)) { |
833 | p = proc_mkdir_mode(entry->name, entry->mode, root); | 814 | p = proc_mkdir_mode(entry->name, entry->mode, root); |
834 | if (!p) { | 815 | if (!p) { |
@@ -850,11 +831,73 @@ int snd_info_register(struct snd_info_entry * entry) | |||
850 | proc_set_size(p, entry->size); | 831 | proc_set_size(p, entry->size); |
851 | } | 832 | } |
852 | entry->p = p; | 833 | entry->p = p; |
834 | unlock: | ||
853 | mutex_unlock(&info_mutex); | 835 | mutex_unlock(&info_mutex); |
854 | return 0; | 836 | return 0; |
855 | } | 837 | } |
838 | |||
839 | /** | ||
840 | * snd_info_register - register the info entry | ||
841 | * @entry: the info entry | ||
842 | * | ||
843 | * Registers the proc info entry. | ||
844 | * The all children entries are registered recursively. | ||
845 | * | ||
846 | * Return: Zero if successful, or a negative error code on failure. | ||
847 | */ | ||
848 | int snd_info_register(struct snd_info_entry *entry) | ||
849 | { | ||
850 | struct snd_info_entry *p; | ||
851 | int err; | ||
852 | |||
853 | if (!entry->p) { | ||
854 | err = __snd_info_register(entry); | ||
855 | if (err < 0) | ||
856 | return err; | ||
857 | } | ||
858 | |||
859 | list_for_each_entry(p, &entry->children, list) { | ||
860 | err = snd_info_register(p); | ||
861 | if (err < 0) | ||
862 | return err; | ||
863 | } | ||
864 | |||
865 | return 0; | ||
866 | } | ||
856 | EXPORT_SYMBOL(snd_info_register); | 867 | EXPORT_SYMBOL(snd_info_register); |
857 | 868 | ||
869 | /** | ||
870 | * snd_card_rw_proc_new - Create a read/write text proc file entry for the card | ||
871 | * @card: the card instance | ||
872 | * @name: the file name | ||
873 | * @private_data: the arbitrary private data | ||
874 | * @read: the read callback | ||
875 | * @write: the write callback, NULL for read-only | ||
876 | * | ||
877 | * This proc file entry will be registered via snd_card_register() call, and | ||
878 | * it will be removed automatically at the card removal, too. | ||
879 | */ | ||
880 | int snd_card_rw_proc_new(struct snd_card *card, const char *name, | ||
881 | void *private_data, | ||
882 | void (*read)(struct snd_info_entry *, | ||
883 | struct snd_info_buffer *), | ||
884 | void (*write)(struct snd_info_entry *entry, | ||
885 | struct snd_info_buffer *buffer)) | ||
886 | { | ||
887 | struct snd_info_entry *entry; | ||
888 | |||
889 | entry = snd_info_create_card_entry(card, name, card->proc_root); | ||
890 | if (!entry) | ||
891 | return -ENOMEM; | ||
892 | snd_info_set_text_ops(entry, private_data, read); | ||
893 | if (write) { | ||
894 | entry->mode |= 0200; | ||
895 | entry->c.text.write = write; | ||
896 | } | ||
897 | return 0; | ||
898 | } | ||
899 | EXPORT_SYMBOL_GPL(snd_card_rw_proc_new); | ||
900 | |||
858 | /* | 901 | /* |
859 | 902 | ||
860 | */ | 903 | */ |
diff --git a/sound/core/init.c b/sound/core/init.c index 4849c611c0fe..0c4dc40376a7 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
@@ -100,31 +100,6 @@ int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int free_flag); | |||
100 | EXPORT_SYMBOL(snd_mixer_oss_notify_callback); | 100 | EXPORT_SYMBOL(snd_mixer_oss_notify_callback); |
101 | #endif | 101 | #endif |
102 | 102 | ||
103 | #ifdef CONFIG_SND_PROC_FS | ||
104 | static void snd_card_id_read(struct snd_info_entry *entry, | ||
105 | struct snd_info_buffer *buffer) | ||
106 | { | ||
107 | snd_iprintf(buffer, "%s\n", entry->card->id); | ||
108 | } | ||
109 | |||
110 | static int init_info_for_card(struct snd_card *card) | ||
111 | { | ||
112 | struct snd_info_entry *entry; | ||
113 | |||
114 | entry = snd_info_create_card_entry(card, "id", card->proc_root); | ||
115 | if (!entry) { | ||
116 | dev_dbg(card->dev, "unable to create card entry\n"); | ||
117 | return -ENOMEM; | ||
118 | } | ||
119 | entry->c.text.read = snd_card_id_read; | ||
120 | card->proc_id = entry; | ||
121 | |||
122 | return snd_info_card_register(card); | ||
123 | } | ||
124 | #else /* !CONFIG_SND_PROC_FS */ | ||
125 | #define init_info_for_card(card) | ||
126 | #endif | ||
127 | |||
128 | static int check_empty_slot(struct module *module, int slot) | 103 | static int check_empty_slot(struct module *module, int slot) |
129 | { | 104 | { |
130 | return !slots[slot] || !*slots[slot]; | 105 | return !slots[slot] || !*slots[slot]; |
@@ -491,7 +466,6 @@ static int snd_card_do_free(struct snd_card *card) | |||
491 | snd_device_free_all(card); | 466 | snd_device_free_all(card); |
492 | if (card->private_free) | 467 | if (card->private_free) |
493 | card->private_free(card); | 468 | card->private_free(card); |
494 | snd_info_free_entry(card->proc_id); | ||
495 | if (snd_info_card_free(card) < 0) { | 469 | if (snd_info_card_free(card) < 0) { |
496 | dev_warn(card->dev, "unable to free card info\n"); | 470 | dev_warn(card->dev, "unable to free card info\n"); |
497 | /* Not fatal error */ | 471 | /* Not fatal error */ |
@@ -795,7 +769,10 @@ int snd_card_register(struct snd_card *card) | |||
795 | } | 769 | } |
796 | snd_cards[card->number] = card; | 770 | snd_cards[card->number] = card; |
797 | mutex_unlock(&snd_card_mutex); | 771 | mutex_unlock(&snd_card_mutex); |
798 | init_info_for_card(card); | 772 | err = snd_info_card_register(card); |
773 | if (err < 0) | ||
774 | return err; | ||
775 | |||
799 | #if IS_ENABLED(CONFIG_SND_MIXER_OSS) | 776 | #if IS_ENABLED(CONFIG_SND_MIXER_OSS) |
800 | if (snd_mixer_oss_notify_callback) | 777 | if (snd_mixer_oss_notify_callback) |
801 | snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_REGISTER); | 778 | snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_REGISTER); |
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index 59a4adc286ed..eb974235c92b 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c | |||
@@ -182,6 +182,8 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size, | |||
182 | return -ENXIO; | 182 | return -ENXIO; |
183 | if (WARN_ON(!dmab)) | 183 | if (WARN_ON(!dmab)) |
184 | return -ENXIO; | 184 | return -ENXIO; |
185 | if (WARN_ON(!device)) | ||
186 | return -EINVAL; | ||
185 | 187 | ||
186 | dmab->dev.type = type; | 188 | dmab->dev.type = type; |
187 | dmab->dev.dev = device; | 189 | dmab->dev.dev = device; |
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 467039b342b5..d5b0d7ba83c4 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -2427,7 +2427,6 @@ static int snd_pcm_oss_open_file(struct file *file, | |||
2427 | } | 2427 | } |
2428 | 2428 | ||
2429 | pcm_oss_file->streams[idx] = substream; | 2429 | pcm_oss_file->streams[idx] = substream; |
2430 | substream->file = pcm_oss_file; | ||
2431 | snd_pcm_oss_init_substream(substream, &setup[idx], minor); | 2430 | snd_pcm_oss_init_substream(substream, &setup[idx], minor); |
2432 | } | 2431 | } |
2433 | 2432 | ||
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 01b9d62eef14..7b63aee124af 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -528,52 +528,44 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr) | |||
528 | if (!entry) | 528 | if (!entry) |
529 | return -ENOMEM; | 529 | return -ENOMEM; |
530 | entry->mode = S_IFDIR | 0555; | 530 | entry->mode = S_IFDIR | 0555; |
531 | if (snd_info_register(entry) < 0) { | ||
532 | snd_info_free_entry(entry); | ||
533 | return -ENOMEM; | ||
534 | } | ||
535 | pstr->proc_root = entry; | 531 | pstr->proc_root = entry; |
536 | entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root); | 532 | entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root); |
537 | if (entry) { | 533 | if (entry) |
538 | snd_info_set_text_ops(entry, pstr, snd_pcm_stream_proc_info_read); | 534 | snd_info_set_text_ops(entry, pstr, snd_pcm_stream_proc_info_read); |
539 | if (snd_info_register(entry) < 0) { | ||
540 | snd_info_free_entry(entry); | ||
541 | entry = NULL; | ||
542 | } | ||
543 | } | ||
544 | pstr->proc_info_entry = entry; | ||
545 | |||
546 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG | 535 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG |
547 | entry = snd_info_create_card_entry(pcm->card, "xrun_debug", | 536 | entry = snd_info_create_card_entry(pcm->card, "xrun_debug", |
548 | pstr->proc_root); | 537 | pstr->proc_root); |
549 | if (entry) { | 538 | if (entry) { |
550 | entry->c.text.read = snd_pcm_xrun_debug_read; | 539 | snd_info_set_text_ops(entry, pstr, snd_pcm_xrun_debug_read); |
551 | entry->c.text.write = snd_pcm_xrun_debug_write; | 540 | entry->c.text.write = snd_pcm_xrun_debug_write; |
552 | entry->mode |= 0200; | 541 | entry->mode |= 0200; |
553 | entry->private_data = pstr; | ||
554 | if (snd_info_register(entry) < 0) { | ||
555 | snd_info_free_entry(entry); | ||
556 | entry = NULL; | ||
557 | } | ||
558 | } | 542 | } |
559 | pstr->proc_xrun_debug_entry = entry; | ||
560 | #endif | 543 | #endif |
561 | return 0; | 544 | return 0; |
562 | } | 545 | } |
563 | 546 | ||
564 | static int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr) | 547 | static int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr) |
565 | { | 548 | { |
566 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG | ||
567 | snd_info_free_entry(pstr->proc_xrun_debug_entry); | ||
568 | pstr->proc_xrun_debug_entry = NULL; | ||
569 | #endif | ||
570 | snd_info_free_entry(pstr->proc_info_entry); | ||
571 | pstr->proc_info_entry = NULL; | ||
572 | snd_info_free_entry(pstr->proc_root); | 549 | snd_info_free_entry(pstr->proc_root); |
573 | pstr->proc_root = NULL; | 550 | pstr->proc_root = NULL; |
574 | return 0; | 551 | return 0; |
575 | } | 552 | } |
576 | 553 | ||
554 | static struct snd_info_entry * | ||
555 | create_substream_info_entry(struct snd_pcm_substream *substream, | ||
556 | const char *name, | ||
557 | void (*read)(struct snd_info_entry *, | ||
558 | struct snd_info_buffer *)) | ||
559 | { | ||
560 | struct snd_info_entry *entry; | ||
561 | |||
562 | entry = snd_info_create_card_entry(substream->pcm->card, name, | ||
563 | substream->proc_root); | ||
564 | if (entry) | ||
565 | snd_info_set_text_ops(entry, substream, read); | ||
566 | return entry; | ||
567 | } | ||
568 | |||
577 | static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) | 569 | static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) |
578 | { | 570 | { |
579 | struct snd_info_entry *entry; | 571 | struct snd_info_entry *entry; |
@@ -588,101 +580,61 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) | |||
588 | if (!entry) | 580 | if (!entry) |
589 | return -ENOMEM; | 581 | return -ENOMEM; |
590 | entry->mode = S_IFDIR | 0555; | 582 | entry->mode = S_IFDIR | 0555; |
591 | if (snd_info_register(entry) < 0) { | ||
592 | snd_info_free_entry(entry); | ||
593 | return -ENOMEM; | ||
594 | } | ||
595 | substream->proc_root = entry; | 583 | substream->proc_root = entry; |
596 | entry = snd_info_create_card_entry(card, "info", substream->proc_root); | 584 | |
597 | if (entry) { | 585 | create_substream_info_entry(substream, "info", |
598 | snd_info_set_text_ops(entry, substream, | 586 | snd_pcm_substream_proc_info_read); |
599 | snd_pcm_substream_proc_info_read); | 587 | create_substream_info_entry(substream, "hw_params", |
600 | if (snd_info_register(entry) < 0) { | 588 | snd_pcm_substream_proc_hw_params_read); |
601 | snd_info_free_entry(entry); | 589 | create_substream_info_entry(substream, "sw_params", |
602 | entry = NULL; | 590 | snd_pcm_substream_proc_sw_params_read); |
603 | } | 591 | create_substream_info_entry(substream, "status", |
604 | } | 592 | snd_pcm_substream_proc_status_read); |
605 | substream->proc_info_entry = entry; | ||
606 | entry = snd_info_create_card_entry(card, "hw_params", | ||
607 | substream->proc_root); | ||
608 | if (entry) { | ||
609 | snd_info_set_text_ops(entry, substream, | ||
610 | snd_pcm_substream_proc_hw_params_read); | ||
611 | if (snd_info_register(entry) < 0) { | ||
612 | snd_info_free_entry(entry); | ||
613 | entry = NULL; | ||
614 | } | ||
615 | } | ||
616 | substream->proc_hw_params_entry = entry; | ||
617 | entry = snd_info_create_card_entry(card, "sw_params", | ||
618 | substream->proc_root); | ||
619 | if (entry) { | ||
620 | snd_info_set_text_ops(entry, substream, | ||
621 | snd_pcm_substream_proc_sw_params_read); | ||
622 | if (snd_info_register(entry) < 0) { | ||
623 | snd_info_free_entry(entry); | ||
624 | entry = NULL; | ||
625 | } | ||
626 | } | ||
627 | substream->proc_sw_params_entry = entry; | ||
628 | entry = snd_info_create_card_entry(card, "status", | ||
629 | substream->proc_root); | ||
630 | if (entry) { | ||
631 | snd_info_set_text_ops(entry, substream, | ||
632 | snd_pcm_substream_proc_status_read); | ||
633 | if (snd_info_register(entry) < 0) { | ||
634 | snd_info_free_entry(entry); | ||
635 | entry = NULL; | ||
636 | } | ||
637 | } | ||
638 | substream->proc_status_entry = entry; | ||
639 | 593 | ||
640 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG | 594 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG |
641 | entry = snd_info_create_card_entry(card, "xrun_injection", | 595 | entry = create_substream_info_entry(substream, "xrun_injection", NULL); |
642 | substream->proc_root); | ||
643 | if (entry) { | 596 | if (entry) { |
644 | entry->private_data = substream; | ||
645 | entry->c.text.read = NULL; | ||
646 | entry->c.text.write = snd_pcm_xrun_injection_write; | 597 | entry->c.text.write = snd_pcm_xrun_injection_write; |
647 | entry->mode = S_IFREG | 0200; | 598 | entry->mode = S_IFREG | 0200; |
648 | if (snd_info_register(entry) < 0) { | ||
649 | snd_info_free_entry(entry); | ||
650 | entry = NULL; | ||
651 | } | ||
652 | } | 599 | } |
653 | substream->proc_xrun_injection_entry = entry; | ||
654 | #endif /* CONFIG_SND_PCM_XRUN_DEBUG */ | 600 | #endif /* CONFIG_SND_PCM_XRUN_DEBUG */ |
655 | 601 | ||
656 | return 0; | 602 | return 0; |
657 | } | 603 | } |
658 | 604 | ||
659 | static int snd_pcm_substream_proc_done(struct snd_pcm_substream *substream) | ||
660 | { | ||
661 | snd_info_free_entry(substream->proc_info_entry); | ||
662 | substream->proc_info_entry = NULL; | ||
663 | snd_info_free_entry(substream->proc_hw_params_entry); | ||
664 | substream->proc_hw_params_entry = NULL; | ||
665 | snd_info_free_entry(substream->proc_sw_params_entry); | ||
666 | substream->proc_sw_params_entry = NULL; | ||
667 | snd_info_free_entry(substream->proc_status_entry); | ||
668 | substream->proc_status_entry = NULL; | ||
669 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG | ||
670 | snd_info_free_entry(substream->proc_xrun_injection_entry); | ||
671 | substream->proc_xrun_injection_entry = NULL; | ||
672 | #endif | ||
673 | snd_info_free_entry(substream->proc_root); | ||
674 | substream->proc_root = NULL; | ||
675 | return 0; | ||
676 | } | ||
677 | #else /* !CONFIG_SND_VERBOSE_PROCFS */ | 605 | #else /* !CONFIG_SND_VERBOSE_PROCFS */ |
678 | static inline int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr) { return 0; } | 606 | static inline int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr) { return 0; } |
679 | static inline int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr) { return 0; } | 607 | static inline int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr) { return 0; } |
680 | static inline int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) { return 0; } | 608 | static inline int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) { return 0; } |
681 | static inline int snd_pcm_substream_proc_done(struct snd_pcm_substream *substream) { return 0; } | ||
682 | #endif /* CONFIG_SND_VERBOSE_PROCFS */ | 609 | #endif /* CONFIG_SND_VERBOSE_PROCFS */ |
683 | 610 | ||
684 | static const struct attribute_group *pcm_dev_attr_groups[]; | 611 | static const struct attribute_group *pcm_dev_attr_groups[]; |
685 | 612 | ||
613 | /* | ||
614 | * PM callbacks: we need to deal only with suspend here, as the resume is | ||
615 | * triggered either from user-space or the driver's resume callback | ||
616 | */ | ||
617 | #ifdef CONFIG_PM_SLEEP | ||
618 | static int do_pcm_suspend(struct device *dev) | ||
619 | { | ||
620 | struct snd_pcm_str *pstr = container_of(dev, struct snd_pcm_str, dev); | ||
621 | |||
622 | if (!pstr->pcm->no_device_suspend) | ||
623 | snd_pcm_suspend_all(pstr->pcm); | ||
624 | return 0; | ||
625 | } | ||
626 | #endif | ||
627 | |||
628 | static const struct dev_pm_ops pcm_dev_pm_ops = { | ||
629 | SET_SYSTEM_SLEEP_PM_OPS(do_pcm_suspend, NULL) | ||
630 | }; | ||
631 | |||
632 | /* device type for PCM -- basically only for passing PM callbacks */ | ||
633 | static const struct device_type pcm_dev_type = { | ||
634 | .name = "pcm", | ||
635 | .pm = &pcm_dev_pm_ops, | ||
636 | }; | ||
637 | |||
686 | /** | 638 | /** |
687 | * snd_pcm_new_stream - create a new PCM stream | 639 | * snd_pcm_new_stream - create a new PCM stream |
688 | * @pcm: the pcm instance | 640 | * @pcm: the pcm instance |
@@ -713,6 +665,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) | |||
713 | 665 | ||
714 | snd_device_initialize(&pstr->dev, pcm->card); | 666 | snd_device_initialize(&pstr->dev, pcm->card); |
715 | pstr->dev.groups = pcm_dev_attr_groups; | 667 | pstr->dev.groups = pcm_dev_attr_groups; |
668 | pstr->dev.type = &pcm_dev_type; | ||
716 | dev_set_name(&pstr->dev, "pcmC%iD%i%c", pcm->card->number, pcm->device, | 669 | dev_set_name(&pstr->dev, "pcmC%iD%i%c", pcm->card->number, pcm->device, |
717 | stream == SNDRV_PCM_STREAM_PLAYBACK ? 'p' : 'c'); | 670 | stream == SNDRV_PCM_STREAM_PLAYBACK ? 'p' : 'c'); |
718 | 671 | ||
@@ -753,9 +706,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) | |||
753 | } | 706 | } |
754 | } | 707 | } |
755 | substream->group = &substream->self_group; | 708 | substream->group = &substream->self_group; |
756 | spin_lock_init(&substream->self_group.lock); | 709 | snd_pcm_group_init(&substream->self_group); |
757 | mutex_init(&substream->self_group.mutex); | ||
758 | INIT_LIST_HEAD(&substream->self_group.substreams); | ||
759 | list_add_tail(&substream->link_list, &substream->self_group.substreams); | 710 | list_add_tail(&substream->link_list, &substream->self_group.substreams); |
760 | atomic_set(&substream->mmap_count, 0); | 711 | atomic_set(&substream->mmap_count, 0); |
761 | prev = substream; | 712 | prev = substream; |
@@ -885,15 +836,17 @@ static void snd_pcm_free_stream(struct snd_pcm_str * pstr) | |||
885 | #if IS_ENABLED(CONFIG_SND_PCM_OSS) | 836 | #if IS_ENABLED(CONFIG_SND_PCM_OSS) |
886 | struct snd_pcm_oss_setup *setup, *setupn; | 837 | struct snd_pcm_oss_setup *setup, *setupn; |
887 | #endif | 838 | #endif |
839 | |||
840 | /* free all proc files under the stream */ | ||
841 | snd_pcm_stream_proc_done(pstr); | ||
842 | |||
888 | substream = pstr->substream; | 843 | substream = pstr->substream; |
889 | while (substream) { | 844 | while (substream) { |
890 | substream_next = substream->next; | 845 | substream_next = substream->next; |
891 | snd_pcm_timer_done(substream); | 846 | snd_pcm_timer_done(substream); |
892 | snd_pcm_substream_proc_done(substream); | ||
893 | kfree(substream); | 847 | kfree(substream); |
894 | substream = substream_next; | 848 | substream = substream_next; |
895 | } | 849 | } |
896 | snd_pcm_stream_proc_done(pstr); | ||
897 | #if IS_ENABLED(CONFIG_SND_PCM_OSS) | 850 | #if IS_ENABLED(CONFIG_SND_PCM_OSS) |
898 | for (setup = pstr->oss.setup_list; setup; setup = setupn) { | 851 | for (setup = pstr->oss.setup_list; setup; setup = setupn) { |
899 | setupn = setup->next; | 852 | setupn = setup->next; |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 6c0b30391ba9..345ab1ab2cac 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -2176,6 +2176,10 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, | |||
2176 | if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) | 2176 | if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) |
2177 | snd_pcm_update_hw_ptr(substream); | 2177 | snd_pcm_update_hw_ptr(substream); |
2178 | 2178 | ||
2179 | /* | ||
2180 | * If size < start_threshold, wait indefinitely. Another | ||
2181 | * thread may start capture | ||
2182 | */ | ||
2179 | if (!is_playback && | 2183 | if (!is_playback && |
2180 | runtime->status->state == SNDRV_PCM_STATE_PREPARED && | 2184 | runtime->status->state == SNDRV_PCM_STATE_PREPARED && |
2181 | size >= runtime->start_threshold) { | 2185 | size >= runtime->start_threshold) { |
@@ -2214,9 +2218,8 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, | |||
2214 | if (frames > cont) | 2218 | if (frames > cont) |
2215 | frames = cont; | 2219 | frames = cont; |
2216 | if (snd_BUG_ON(!frames)) { | 2220 | if (snd_BUG_ON(!frames)) { |
2217 | runtime->twake = 0; | 2221 | err = -EINVAL; |
2218 | snd_pcm_stream_unlock_irq(substream); | 2222 | goto _end_unlock; |
2219 | return -EINVAL; | ||
2220 | } | 2223 | } |
2221 | snd_pcm_stream_unlock_irq(substream); | 2224 | snd_pcm_stream_unlock_irq(substream); |
2222 | err = writer(substream, appl_ofs, data, offset, frames, | 2225 | err = writer(substream, appl_ofs, data, offset, frames, |
diff --git a/sound/core/pcm_local.h b/sound/core/pcm_local.h index c515612969a4..0b4b5dfaec18 100644 --- a/sound/core/pcm_local.h +++ b/sound/core/pcm_local.h | |||
@@ -66,5 +66,6 @@ static inline void snd_pcm_timer_done(struct snd_pcm_substream *substream) {} | |||
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | void __snd_pcm_xrun(struct snd_pcm_substream *substream); | 68 | void __snd_pcm_xrun(struct snd_pcm_substream *substream); |
69 | void snd_pcm_group_init(struct snd_pcm_group *group); | ||
69 | 70 | ||
70 | #endif /* __SOUND_CORE_PCM_LOCAL_H */ | 71 | #endif /* __SOUND_CORE_PCM_LOCAL_H */ |
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c index 4b5356a10315..ed73be80bd29 100644 --- a/sound/core/pcm_memory.c +++ b/sound/core/pcm_memory.c | |||
@@ -87,19 +87,10 @@ static void snd_pcm_lib_preallocate_dma_free(struct snd_pcm_substream *substream | |||
87 | * @substream: the pcm substream instance | 87 | * @substream: the pcm substream instance |
88 | * | 88 | * |
89 | * Releases the pre-allocated buffer of the given substream. | 89 | * Releases the pre-allocated buffer of the given substream. |
90 | * | ||
91 | * Return: Zero if successful, or a negative error code on failure. | ||
92 | */ | 90 | */ |
93 | int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream) | 91 | void snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream) |
94 | { | 92 | { |
95 | snd_pcm_lib_preallocate_dma_free(substream); | 93 | snd_pcm_lib_preallocate_dma_free(substream); |
96 | #ifdef CONFIG_SND_VERBOSE_PROCFS | ||
97 | snd_info_free_entry(substream->proc_prealloc_max_entry); | ||
98 | substream->proc_prealloc_max_entry = NULL; | ||
99 | snd_info_free_entry(substream->proc_prealloc_entry); | ||
100 | substream->proc_prealloc_entry = NULL; | ||
101 | #endif | ||
102 | return 0; | ||
103 | } | 94 | } |
104 | 95 | ||
105 | /** | 96 | /** |
@@ -107,10 +98,8 @@ int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream) | |||
107 | * @pcm: the pcm instance | 98 | * @pcm: the pcm instance |
108 | * | 99 | * |
109 | * Releases all the pre-allocated buffers on the given pcm. | 100 | * Releases all the pre-allocated buffers on the given pcm. |
110 | * | ||
111 | * Return: Zero if successful, or a negative error code on failure. | ||
112 | */ | 101 | */ |
113 | int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm) | 102 | void snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm) |
114 | { | 103 | { |
115 | struct snd_pcm_substream *substream; | 104 | struct snd_pcm_substream *substream; |
116 | int stream; | 105 | int stream; |
@@ -118,7 +107,6 @@ int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm) | |||
118 | for (stream = 0; stream < 2; stream++) | 107 | for (stream = 0; stream < 2; stream++) |
119 | for (substream = pcm->streams[stream].substream; substream; substream = substream->next) | 108 | for (substream = pcm->streams[stream].substream; substream; substream = substream->next) |
120 | snd_pcm_lib_preallocate_free(substream); | 109 | snd_pcm_lib_preallocate_free(substream); |
121 | return 0; | ||
122 | } | 110 | } |
123 | EXPORT_SYMBOL(snd_pcm_lib_preallocate_free_for_all); | 111 | EXPORT_SYMBOL(snd_pcm_lib_preallocate_free_for_all); |
124 | 112 | ||
@@ -198,26 +186,19 @@ static inline void preallocate_info_init(struct snd_pcm_substream *substream) | |||
198 | { | 186 | { |
199 | struct snd_info_entry *entry; | 187 | struct snd_info_entry *entry; |
200 | 188 | ||
201 | if ((entry = snd_info_create_card_entry(substream->pcm->card, "prealloc", substream->proc_root)) != NULL) { | 189 | entry = snd_info_create_card_entry(substream->pcm->card, "prealloc", |
202 | entry->c.text.read = snd_pcm_lib_preallocate_proc_read; | 190 | substream->proc_root); |
191 | if (entry) { | ||
192 | snd_info_set_text_ops(entry, substream, | ||
193 | snd_pcm_lib_preallocate_proc_read); | ||
203 | entry->c.text.write = snd_pcm_lib_preallocate_proc_write; | 194 | entry->c.text.write = snd_pcm_lib_preallocate_proc_write; |
204 | entry->mode |= 0200; | 195 | entry->mode |= 0200; |
205 | entry->private_data = substream; | ||
206 | if (snd_info_register(entry) < 0) { | ||
207 | snd_info_free_entry(entry); | ||
208 | entry = NULL; | ||
209 | } | ||
210 | } | 196 | } |
211 | substream->proc_prealloc_entry = entry; | 197 | entry = snd_info_create_card_entry(substream->pcm->card, "prealloc_max", |
212 | if ((entry = snd_info_create_card_entry(substream->pcm->card, "prealloc_max", substream->proc_root)) != NULL) { | 198 | substream->proc_root); |
213 | entry->c.text.read = snd_pcm_lib_preallocate_max_proc_read; | 199 | if (entry) |
214 | entry->private_data = substream; | 200 | snd_info_set_text_ops(entry, substream, |
215 | if (snd_info_register(entry) < 0) { | 201 | snd_pcm_lib_preallocate_max_proc_read); |
216 | snd_info_free_entry(entry); | ||
217 | entry = NULL; | ||
218 | } | ||
219 | } | ||
220 | substream->proc_prealloc_max_entry = entry; | ||
221 | } | 202 | } |
222 | 203 | ||
223 | #else /* !CONFIG_SND_VERBOSE_PROCFS */ | 204 | #else /* !CONFIG_SND_VERBOSE_PROCFS */ |
@@ -227,7 +208,7 @@ static inline void preallocate_info_init(struct snd_pcm_substream *substream) | |||
227 | /* | 208 | /* |
228 | * pre-allocate the buffer and create a proc file for the substream | 209 | * pre-allocate the buffer and create a proc file for the substream |
229 | */ | 210 | */ |
230 | static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream, | 211 | static void snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream, |
231 | size_t size, size_t max) | 212 | size_t size, size_t max) |
232 | { | 213 | { |
233 | 214 | ||
@@ -238,7 +219,6 @@ static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream, | |||
238 | substream->buffer_bytes_max = substream->dma_buffer.bytes; | 219 | substream->buffer_bytes_max = substream->dma_buffer.bytes; |
239 | substream->dma_max = max; | 220 | substream->dma_max = max; |
240 | preallocate_info_init(substream); | 221 | preallocate_info_init(substream); |
241 | return 0; | ||
242 | } | 222 | } |
243 | 223 | ||
244 | 224 | ||
@@ -251,16 +231,14 @@ static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream, | |||
251 | * @max: the max. allowed pre-allocation size | 231 | * @max: the max. allowed pre-allocation size |
252 | * | 232 | * |
253 | * Do pre-allocation for the given DMA buffer type. | 233 | * Do pre-allocation for the given DMA buffer type. |
254 | * | ||
255 | * Return: Zero if successful, or a negative error code on failure. | ||
256 | */ | 234 | */ |
257 | int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, | 235 | void snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, |
258 | int type, struct device *data, | 236 | int type, struct device *data, |
259 | size_t size, size_t max) | 237 | size_t size, size_t max) |
260 | { | 238 | { |
261 | substream->dma_buffer.dev.type = type; | 239 | substream->dma_buffer.dev.type = type; |
262 | substream->dma_buffer.dev.dev = data; | 240 | substream->dma_buffer.dev.dev = data; |
263 | return snd_pcm_lib_preallocate_pages1(substream, size, max); | 241 | snd_pcm_lib_preallocate_pages1(substream, size, max); |
264 | } | 242 | } |
265 | EXPORT_SYMBOL(snd_pcm_lib_preallocate_pages); | 243 | EXPORT_SYMBOL(snd_pcm_lib_preallocate_pages); |
266 | 244 | ||
@@ -274,21 +252,17 @@ EXPORT_SYMBOL(snd_pcm_lib_preallocate_pages); | |||
274 | * | 252 | * |
275 | * Do pre-allocation to all substreams of the given pcm for the | 253 | * Do pre-allocation to all substreams of the given pcm for the |
276 | * specified DMA type. | 254 | * specified DMA type. |
277 | * | ||
278 | * Return: Zero if successful, or a negative error code on failure. | ||
279 | */ | 255 | */ |
280 | int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm, | 256 | void snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm, |
281 | int type, void *data, | 257 | int type, void *data, |
282 | size_t size, size_t max) | 258 | size_t size, size_t max) |
283 | { | 259 | { |
284 | struct snd_pcm_substream *substream; | 260 | struct snd_pcm_substream *substream; |
285 | int stream, err; | 261 | int stream; |
286 | 262 | ||
287 | for (stream = 0; stream < 2; stream++) | 263 | for (stream = 0; stream < 2; stream++) |
288 | for (substream = pcm->streams[stream].substream; substream; substream = substream->next) | 264 | for (substream = pcm->streams[stream].substream; substream; substream = substream->next) |
289 | if ((err = snd_pcm_lib_preallocate_pages(substream, type, data, size, max)) < 0) | 265 | snd_pcm_lib_preallocate_pages(substream, type, data, size, max); |
290 | return err; | ||
291 | return 0; | ||
292 | } | 266 | } |
293 | EXPORT_SYMBOL(snd_pcm_lib_preallocate_pages_for_all); | 267 | EXPORT_SYMBOL(snd_pcm_lib_preallocate_pages_for_all); |
294 | 268 | ||
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 818dff1de545..f731f904e8cc 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -85,71 +85,30 @@ static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream); | |||
85 | * | 85 | * |
86 | */ | 86 | */ |
87 | 87 | ||
88 | static DEFINE_RWLOCK(snd_pcm_link_rwlock); | ||
89 | static DECLARE_RWSEM(snd_pcm_link_rwsem); | 88 | static DECLARE_RWSEM(snd_pcm_link_rwsem); |
90 | 89 | ||
91 | /* Writer in rwsem may block readers even during its waiting in queue, | 90 | void snd_pcm_group_init(struct snd_pcm_group *group) |
92 | * and this may lead to a deadlock when the code path takes read sem | ||
93 | * twice (e.g. one in snd_pcm_action_nonatomic() and another in | ||
94 | * snd_pcm_stream_lock()). As a (suboptimal) workaround, let writer to | ||
95 | * sleep until all the readers are completed without blocking by writer. | ||
96 | */ | ||
97 | static inline void down_write_nonfifo(struct rw_semaphore *lock) | ||
98 | { | 91 | { |
99 | while (!down_write_trylock(lock)) | 92 | spin_lock_init(&group->lock); |
100 | msleep(1); | 93 | mutex_init(&group->mutex); |
94 | INIT_LIST_HEAD(&group->substreams); | ||
95 | refcount_set(&group->refs, 0); | ||
101 | } | 96 | } |
102 | 97 | ||
103 | #define PCM_LOCK_DEFAULT 0 | 98 | /* define group lock helpers */ |
104 | #define PCM_LOCK_IRQ 1 | 99 | #define DEFINE_PCM_GROUP_LOCK(action, mutex_action) \ |
105 | #define PCM_LOCK_IRQSAVE 2 | 100 | static void snd_pcm_group_ ## action(struct snd_pcm_group *group, bool nonatomic) \ |
106 | 101 | { \ | |
107 | static unsigned long __snd_pcm_stream_lock_mode(struct snd_pcm_substream *substream, | 102 | if (nonatomic) \ |
108 | unsigned int mode) | 103 | mutex_ ## mutex_action(&group->mutex); \ |
109 | { | 104 | else \ |
110 | unsigned long flags = 0; | 105 | spin_ ## action(&group->lock); \ |
111 | if (substream->pcm->nonatomic) { | ||
112 | down_read_nested(&snd_pcm_link_rwsem, SINGLE_DEPTH_NESTING); | ||
113 | mutex_lock(&substream->self_group.mutex); | ||
114 | } else { | ||
115 | switch (mode) { | ||
116 | case PCM_LOCK_DEFAULT: | ||
117 | read_lock(&snd_pcm_link_rwlock); | ||
118 | break; | ||
119 | case PCM_LOCK_IRQ: | ||
120 | read_lock_irq(&snd_pcm_link_rwlock); | ||
121 | break; | ||
122 | case PCM_LOCK_IRQSAVE: | ||
123 | read_lock_irqsave(&snd_pcm_link_rwlock, flags); | ||
124 | break; | ||
125 | } | ||
126 | spin_lock(&substream->self_group.lock); | ||
127 | } | ||
128 | return flags; | ||
129 | } | 106 | } |
130 | 107 | ||
131 | static void __snd_pcm_stream_unlock_mode(struct snd_pcm_substream *substream, | 108 | DEFINE_PCM_GROUP_LOCK(lock, lock); |
132 | unsigned int mode, unsigned long flags) | 109 | DEFINE_PCM_GROUP_LOCK(unlock, unlock); |
133 | { | 110 | DEFINE_PCM_GROUP_LOCK(lock_irq, lock); |
134 | if (substream->pcm->nonatomic) { | 111 | DEFINE_PCM_GROUP_LOCK(unlock_irq, unlock); |
135 | mutex_unlock(&substream->self_group.mutex); | ||
136 | up_read(&snd_pcm_link_rwsem); | ||
137 | } else { | ||
138 | spin_unlock(&substream->self_group.lock); | ||
139 | |||
140 | switch (mode) { | ||
141 | case PCM_LOCK_DEFAULT: | ||
142 | read_unlock(&snd_pcm_link_rwlock); | ||
143 | break; | ||
144 | case PCM_LOCK_IRQ: | ||
145 | read_unlock_irq(&snd_pcm_link_rwlock); | ||
146 | break; | ||
147 | case PCM_LOCK_IRQSAVE: | ||
148 | read_unlock_irqrestore(&snd_pcm_link_rwlock, flags); | ||
149 | break; | ||
150 | } | ||
151 | } | ||
152 | } | ||
153 | 112 | ||
154 | /** | 113 | /** |
155 | * snd_pcm_stream_lock - Lock the PCM stream | 114 | * snd_pcm_stream_lock - Lock the PCM stream |
@@ -161,7 +120,7 @@ static void __snd_pcm_stream_unlock_mode(struct snd_pcm_substream *substream, | |||
161 | */ | 120 | */ |
162 | void snd_pcm_stream_lock(struct snd_pcm_substream *substream) | 121 | void snd_pcm_stream_lock(struct snd_pcm_substream *substream) |
163 | { | 122 | { |
164 | __snd_pcm_stream_lock_mode(substream, PCM_LOCK_DEFAULT); | 123 | snd_pcm_group_lock(&substream->self_group, substream->pcm->nonatomic); |
165 | } | 124 | } |
166 | EXPORT_SYMBOL_GPL(snd_pcm_stream_lock); | 125 | EXPORT_SYMBOL_GPL(snd_pcm_stream_lock); |
167 | 126 | ||
@@ -173,7 +132,7 @@ EXPORT_SYMBOL_GPL(snd_pcm_stream_lock); | |||
173 | */ | 132 | */ |
174 | void snd_pcm_stream_unlock(struct snd_pcm_substream *substream) | 133 | void snd_pcm_stream_unlock(struct snd_pcm_substream *substream) |
175 | { | 134 | { |
176 | __snd_pcm_stream_unlock_mode(substream, PCM_LOCK_DEFAULT, 0); | 135 | snd_pcm_group_unlock(&substream->self_group, substream->pcm->nonatomic); |
177 | } | 136 | } |
178 | EXPORT_SYMBOL_GPL(snd_pcm_stream_unlock); | 137 | EXPORT_SYMBOL_GPL(snd_pcm_stream_unlock); |
179 | 138 | ||
@@ -187,7 +146,8 @@ EXPORT_SYMBOL_GPL(snd_pcm_stream_unlock); | |||
187 | */ | 146 | */ |
188 | void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream) | 147 | void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream) |
189 | { | 148 | { |
190 | __snd_pcm_stream_lock_mode(substream, PCM_LOCK_IRQ); | 149 | snd_pcm_group_lock_irq(&substream->self_group, |
150 | substream->pcm->nonatomic); | ||
191 | } | 151 | } |
192 | EXPORT_SYMBOL_GPL(snd_pcm_stream_lock_irq); | 152 | EXPORT_SYMBOL_GPL(snd_pcm_stream_lock_irq); |
193 | 153 | ||
@@ -199,13 +159,19 @@ EXPORT_SYMBOL_GPL(snd_pcm_stream_lock_irq); | |||
199 | */ | 159 | */ |
200 | void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream) | 160 | void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream) |
201 | { | 161 | { |
202 | __snd_pcm_stream_unlock_mode(substream, PCM_LOCK_IRQ, 0); | 162 | snd_pcm_group_unlock_irq(&substream->self_group, |
163 | substream->pcm->nonatomic); | ||
203 | } | 164 | } |
204 | EXPORT_SYMBOL_GPL(snd_pcm_stream_unlock_irq); | 165 | EXPORT_SYMBOL_GPL(snd_pcm_stream_unlock_irq); |
205 | 166 | ||
206 | unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream) | 167 | unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream) |
207 | { | 168 | { |
208 | return __snd_pcm_stream_lock_mode(substream, PCM_LOCK_IRQSAVE); | 169 | unsigned long flags = 0; |
170 | if (substream->pcm->nonatomic) | ||
171 | mutex_lock(&substream->self_group.mutex); | ||
172 | else | ||
173 | spin_lock_irqsave(&substream->self_group.lock, flags); | ||
174 | return flags; | ||
209 | } | 175 | } |
210 | EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave); | 176 | EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave); |
211 | 177 | ||
@@ -219,7 +185,10 @@ EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave); | |||
219 | void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream, | 185 | void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream, |
220 | unsigned long flags) | 186 | unsigned long flags) |
221 | { | 187 | { |
222 | __snd_pcm_stream_unlock_mode(substream, PCM_LOCK_IRQSAVE, flags); | 188 | if (substream->pcm->nonatomic) |
189 | mutex_unlock(&substream->self_group.mutex); | ||
190 | else | ||
191 | spin_unlock_irqrestore(&substream->self_group.lock, flags); | ||
223 | } | 192 | } |
224 | EXPORT_SYMBOL_GPL(snd_pcm_stream_unlock_irqrestore); | 193 | EXPORT_SYMBOL_GPL(snd_pcm_stream_unlock_irqrestore); |
225 | 194 | ||
@@ -1124,6 +1093,68 @@ static int snd_pcm_action_single(const struct action_ops *ops, | |||
1124 | return res; | 1093 | return res; |
1125 | } | 1094 | } |
1126 | 1095 | ||
1096 | static void snd_pcm_group_assign(struct snd_pcm_substream *substream, | ||
1097 | struct snd_pcm_group *new_group) | ||
1098 | { | ||
1099 | substream->group = new_group; | ||
1100 | list_move(&substream->link_list, &new_group->substreams); | ||
1101 | } | ||
1102 | |||
1103 | /* | ||
1104 | * Unref and unlock the group, but keep the stream lock; | ||
1105 | * when the group becomes empty and no longer referred, destroy itself | ||
1106 | */ | ||
1107 | static void snd_pcm_group_unref(struct snd_pcm_group *group, | ||
1108 | struct snd_pcm_substream *substream) | ||
1109 | { | ||
1110 | bool do_free; | ||
1111 | |||
1112 | if (!group) | ||
1113 | return; | ||
1114 | do_free = refcount_dec_and_test(&group->refs) && | ||
1115 | list_empty(&group->substreams); | ||
1116 | snd_pcm_group_unlock(group, substream->pcm->nonatomic); | ||
1117 | if (do_free) | ||
1118 | kfree(group); | ||
1119 | } | ||
1120 | |||
1121 | /* | ||
1122 | * Lock the group inside a stream lock and reference it; | ||
1123 | * return the locked group object, or NULL if not linked | ||
1124 | */ | ||
1125 | static struct snd_pcm_group * | ||
1126 | snd_pcm_stream_group_ref(struct snd_pcm_substream *substream) | ||
1127 | { | ||
1128 | bool nonatomic = substream->pcm->nonatomic; | ||
1129 | struct snd_pcm_group *group; | ||
1130 | bool trylock; | ||
1131 | |||
1132 | for (;;) { | ||
1133 | if (!snd_pcm_stream_linked(substream)) | ||
1134 | return NULL; | ||
1135 | group = substream->group; | ||
1136 | /* block freeing the group object */ | ||
1137 | refcount_inc(&group->refs); | ||
1138 | |||
1139 | trylock = nonatomic ? mutex_trylock(&group->mutex) : | ||
1140 | spin_trylock(&group->lock); | ||
1141 | if (trylock) | ||
1142 | break; /* OK */ | ||
1143 | |||
1144 | /* re-lock for avoiding ABBA deadlock */ | ||
1145 | snd_pcm_stream_unlock(substream); | ||
1146 | snd_pcm_group_lock(group, nonatomic); | ||
1147 | snd_pcm_stream_lock(substream); | ||
1148 | |||
1149 | /* check the group again; the above opens a small race window */ | ||
1150 | if (substream->group == group) | ||
1151 | break; /* OK */ | ||
1152 | /* group changed, try again */ | ||
1153 | snd_pcm_group_unref(group, substream); | ||
1154 | } | ||
1155 | return group; | ||
1156 | } | ||
1157 | |||
1127 | /* | 1158 | /* |
1128 | * Note: call with stream lock | 1159 | * Note: call with stream lock |
1129 | */ | 1160 | */ |
@@ -1131,28 +1162,15 @@ static int snd_pcm_action(const struct action_ops *ops, | |||
1131 | struct snd_pcm_substream *substream, | 1162 | struct snd_pcm_substream *substream, |
1132 | int state) | 1163 | int state) |
1133 | { | 1164 | { |
1165 | struct snd_pcm_group *group; | ||
1134 | int res; | 1166 | int res; |
1135 | 1167 | ||
1136 | if (!snd_pcm_stream_linked(substream)) | 1168 | group = snd_pcm_stream_group_ref(substream); |
1137 | return snd_pcm_action_single(ops, substream, state); | 1169 | if (group) |
1138 | |||
1139 | if (substream->pcm->nonatomic) { | ||
1140 | if (!mutex_trylock(&substream->group->mutex)) { | ||
1141 | mutex_unlock(&substream->self_group.mutex); | ||
1142 | mutex_lock(&substream->group->mutex); | ||
1143 | mutex_lock(&substream->self_group.mutex); | ||
1144 | } | ||
1145 | res = snd_pcm_action_group(ops, substream, state, 1); | 1170 | res = snd_pcm_action_group(ops, substream, state, 1); |
1146 | mutex_unlock(&substream->group->mutex); | 1171 | else |
1147 | } else { | 1172 | res = snd_pcm_action_single(ops, substream, state); |
1148 | if (!spin_trylock(&substream->group->lock)) { | 1173 | snd_pcm_group_unref(group, substream); |
1149 | spin_unlock(&substream->self_group.lock); | ||
1150 | spin_lock(&substream->group->lock); | ||
1151 | spin_lock(&substream->self_group.lock); | ||
1152 | } | ||
1153 | res = snd_pcm_action_group(ops, substream, state, 1); | ||
1154 | spin_unlock(&substream->group->lock); | ||
1155 | } | ||
1156 | return res; | 1174 | return res; |
1157 | } | 1175 | } |
1158 | 1176 | ||
@@ -1179,6 +1197,7 @@ static int snd_pcm_action_nonatomic(const struct action_ops *ops, | |||
1179 | { | 1197 | { |
1180 | int res; | 1198 | int res; |
1181 | 1199 | ||
1200 | /* Guarantee the group members won't change during non-atomic action */ | ||
1182 | down_read(&snd_pcm_link_rwsem); | 1201 | down_read(&snd_pcm_link_rwsem); |
1183 | if (snd_pcm_stream_linked(substream)) | 1202 | if (snd_pcm_stream_linked(substream)) |
1184 | res = snd_pcm_action_group(ops, substream, state, 0); | 1203 | res = snd_pcm_action_group(ops, substream, state, 0); |
@@ -1460,29 +1479,24 @@ static const struct action_ops snd_pcm_action_suspend = { | |||
1460 | .post_action = snd_pcm_post_suspend | 1479 | .post_action = snd_pcm_post_suspend |
1461 | }; | 1480 | }; |
1462 | 1481 | ||
1463 | /** | 1482 | /* |
1464 | * snd_pcm_suspend - trigger SUSPEND to all linked streams | 1483 | * snd_pcm_suspend - trigger SUSPEND to all linked streams |
1465 | * @substream: the PCM substream | 1484 | * @substream: the PCM substream |
1466 | * | 1485 | * |
1467 | * After this call, all streams are changed to SUSPENDED state. | 1486 | * After this call, all streams are changed to SUSPENDED state. |
1468 | * | 1487 | * |
1469 | * Return: Zero if successful (or @substream is %NULL), or a negative error | 1488 | * Return: Zero if successful, or a negative error code. |
1470 | * code. | ||
1471 | */ | 1489 | */ |
1472 | int snd_pcm_suspend(struct snd_pcm_substream *substream) | 1490 | static int snd_pcm_suspend(struct snd_pcm_substream *substream) |
1473 | { | 1491 | { |
1474 | int err; | 1492 | int err; |
1475 | unsigned long flags; | 1493 | unsigned long flags; |
1476 | 1494 | ||
1477 | if (! substream) | ||
1478 | return 0; | ||
1479 | |||
1480 | snd_pcm_stream_lock_irqsave(substream, flags); | 1495 | snd_pcm_stream_lock_irqsave(substream, flags); |
1481 | err = snd_pcm_action(&snd_pcm_action_suspend, substream, 0); | 1496 | err = snd_pcm_action(&snd_pcm_action_suspend, substream, 0); |
1482 | snd_pcm_stream_unlock_irqrestore(substream, flags); | 1497 | snd_pcm_stream_unlock_irqrestore(substream, flags); |
1483 | return err; | 1498 | return err; |
1484 | } | 1499 | } |
1485 | EXPORT_SYMBOL(snd_pcm_suspend); | ||
1486 | 1500 | ||
1487 | /** | 1501 | /** |
1488 | * snd_pcm_suspend_all - trigger SUSPEND to all substreams in the given pcm | 1502 | * snd_pcm_suspend_all - trigger SUSPEND to all substreams in the given pcm |
@@ -1506,6 +1520,14 @@ int snd_pcm_suspend_all(struct snd_pcm *pcm) | |||
1506 | /* FIXME: the open/close code should lock this as well */ | 1520 | /* FIXME: the open/close code should lock this as well */ |
1507 | if (substream->runtime == NULL) | 1521 | if (substream->runtime == NULL) |
1508 | continue; | 1522 | continue; |
1523 | |||
1524 | /* | ||
1525 | * Skip BE dai link PCM's that are internal and may | ||
1526 | * not have their substream ops set. | ||
1527 | */ | ||
1528 | if (!substream->ops) | ||
1529 | continue; | ||
1530 | |||
1509 | err = snd_pcm_suspend(substream); | 1531 | err = snd_pcm_suspend(substream); |
1510 | if (err < 0 && err != -EBUSY) | 1532 | if (err < 0 && err != -EBUSY) |
1511 | return err; | 1533 | return err; |
@@ -1792,8 +1814,6 @@ static const struct action_ops snd_pcm_action_drain_init = { | |||
1792 | .post_action = snd_pcm_post_drain_init | 1814 | .post_action = snd_pcm_post_drain_init |
1793 | }; | 1815 | }; |
1794 | 1816 | ||
1795 | static int snd_pcm_drop(struct snd_pcm_substream *substream); | ||
1796 | |||
1797 | /* | 1817 | /* |
1798 | * Drain the stream(s). | 1818 | * Drain the stream(s). |
1799 | * When the substream is linked, sync until the draining of all playback streams | 1819 | * When the substream is linked, sync until the draining of all playback streams |
@@ -1807,6 +1827,7 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, | |||
1807 | struct snd_card *card; | 1827 | struct snd_card *card; |
1808 | struct snd_pcm_runtime *runtime; | 1828 | struct snd_pcm_runtime *runtime; |
1809 | struct snd_pcm_substream *s; | 1829 | struct snd_pcm_substream *s; |
1830 | struct snd_pcm_group *group; | ||
1810 | wait_queue_entry_t wait; | 1831 | wait_queue_entry_t wait; |
1811 | int result = 0; | 1832 | int result = 0; |
1812 | int nonblock = 0; | 1833 | int nonblock = 0; |
@@ -1823,7 +1844,6 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, | |||
1823 | } else if (substream->f_flags & O_NONBLOCK) | 1844 | } else if (substream->f_flags & O_NONBLOCK) |
1824 | nonblock = 1; | 1845 | nonblock = 1; |
1825 | 1846 | ||
1826 | down_read(&snd_pcm_link_rwsem); | ||
1827 | snd_pcm_stream_lock_irq(substream); | 1847 | snd_pcm_stream_lock_irq(substream); |
1828 | /* resume pause */ | 1848 | /* resume pause */ |
1829 | if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) | 1849 | if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) |
@@ -1848,6 +1868,7 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, | |||
1848 | } | 1868 | } |
1849 | /* find a substream to drain */ | 1869 | /* find a substream to drain */ |
1850 | to_check = NULL; | 1870 | to_check = NULL; |
1871 | group = snd_pcm_stream_group_ref(substream); | ||
1851 | snd_pcm_group_for_each_entry(s, substream) { | 1872 | snd_pcm_group_for_each_entry(s, substream) { |
1852 | if (s->stream != SNDRV_PCM_STREAM_PLAYBACK) | 1873 | if (s->stream != SNDRV_PCM_STREAM_PLAYBACK) |
1853 | continue; | 1874 | continue; |
@@ -1857,12 +1878,12 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, | |||
1857 | break; | 1878 | break; |
1858 | } | 1879 | } |
1859 | } | 1880 | } |
1881 | snd_pcm_group_unref(group, substream); | ||
1860 | if (!to_check) | 1882 | if (!to_check) |
1861 | break; /* all drained */ | 1883 | break; /* all drained */ |
1862 | init_waitqueue_entry(&wait, current); | 1884 | init_waitqueue_entry(&wait, current); |
1863 | add_wait_queue(&to_check->sleep, &wait); | 1885 | add_wait_queue(&to_check->sleep, &wait); |
1864 | snd_pcm_stream_unlock_irq(substream); | 1886 | snd_pcm_stream_unlock_irq(substream); |
1865 | up_read(&snd_pcm_link_rwsem); | ||
1866 | if (runtime->no_period_wakeup) | 1887 | if (runtime->no_period_wakeup) |
1867 | tout = MAX_SCHEDULE_TIMEOUT; | 1888 | tout = MAX_SCHEDULE_TIMEOUT; |
1868 | else { | 1889 | else { |
@@ -1874,9 +1895,17 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, | |||
1874 | tout = msecs_to_jiffies(tout * 1000); | 1895 | tout = msecs_to_jiffies(tout * 1000); |
1875 | } | 1896 | } |
1876 | tout = schedule_timeout_interruptible(tout); | 1897 | tout = schedule_timeout_interruptible(tout); |
1877 | down_read(&snd_pcm_link_rwsem); | 1898 | |
1878 | snd_pcm_stream_lock_irq(substream); | 1899 | snd_pcm_stream_lock_irq(substream); |
1879 | remove_wait_queue(&to_check->sleep, &wait); | 1900 | group = snd_pcm_stream_group_ref(substream); |
1901 | snd_pcm_group_for_each_entry(s, substream) { | ||
1902 | if (s->runtime == to_check) { | ||
1903 | remove_wait_queue(&to_check->sleep, &wait); | ||
1904 | break; | ||
1905 | } | ||
1906 | } | ||
1907 | snd_pcm_group_unref(group, substream); | ||
1908 | |||
1880 | if (card->shutdown) { | 1909 | if (card->shutdown) { |
1881 | result = -ENODEV; | 1910 | result = -ENODEV; |
1882 | break; | 1911 | break; |
@@ -1896,7 +1925,6 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, | |||
1896 | 1925 | ||
1897 | unlock: | 1926 | unlock: |
1898 | snd_pcm_stream_unlock_irq(substream); | 1927 | snd_pcm_stream_unlock_irq(substream); |
1899 | up_read(&snd_pcm_link_rwsem); | ||
1900 | 1928 | ||
1901 | return result; | 1929 | return result; |
1902 | } | 1930 | } |
@@ -1935,13 +1963,19 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream) | |||
1935 | static bool is_pcm_file(struct file *file) | 1963 | static bool is_pcm_file(struct file *file) |
1936 | { | 1964 | { |
1937 | struct inode *inode = file_inode(file); | 1965 | struct inode *inode = file_inode(file); |
1966 | struct snd_pcm *pcm; | ||
1938 | unsigned int minor; | 1967 | unsigned int minor; |
1939 | 1968 | ||
1940 | if (!S_ISCHR(inode->i_mode) || imajor(inode) != snd_major) | 1969 | if (!S_ISCHR(inode->i_mode) || imajor(inode) != snd_major) |
1941 | return false; | 1970 | return false; |
1942 | minor = iminor(inode); | 1971 | minor = iminor(inode); |
1943 | return snd_lookup_minor_data(minor, SNDRV_DEVICE_TYPE_PCM_PLAYBACK) || | 1972 | pcm = snd_lookup_minor_data(minor, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
1944 | snd_lookup_minor_data(minor, SNDRV_DEVICE_TYPE_PCM_CAPTURE); | 1973 | if (!pcm) |
1974 | pcm = snd_lookup_minor_data(minor, SNDRV_DEVICE_TYPE_PCM_CAPTURE); | ||
1975 | if (!pcm) | ||
1976 | return false; | ||
1977 | snd_card_unref(pcm->card); | ||
1978 | return true; | ||
1945 | } | 1979 | } |
1946 | 1980 | ||
1947 | /* | 1981 | /* |
@@ -1952,7 +1986,8 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) | |||
1952 | int res = 0; | 1986 | int res = 0; |
1953 | struct snd_pcm_file *pcm_file; | 1987 | struct snd_pcm_file *pcm_file; |
1954 | struct snd_pcm_substream *substream1; | 1988 | struct snd_pcm_substream *substream1; |
1955 | struct snd_pcm_group *group; | 1989 | struct snd_pcm_group *group, *target_group; |
1990 | bool nonatomic = substream->pcm->nonatomic; | ||
1956 | struct fd f = fdget(fd); | 1991 | struct fd f = fdget(fd); |
1957 | 1992 | ||
1958 | if (!f.file) | 1993 | if (!f.file) |
@@ -1963,13 +1998,14 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) | |||
1963 | } | 1998 | } |
1964 | pcm_file = f.file->private_data; | 1999 | pcm_file = f.file->private_data; |
1965 | substream1 = pcm_file->substream; | 2000 | substream1 = pcm_file->substream; |
1966 | group = kmalloc(sizeof(*group), GFP_KERNEL); | 2001 | group = kzalloc(sizeof(*group), GFP_KERNEL); |
1967 | if (!group) { | 2002 | if (!group) { |
1968 | res = -ENOMEM; | 2003 | res = -ENOMEM; |
1969 | goto _nolock; | 2004 | goto _nolock; |
1970 | } | 2005 | } |
1971 | down_write_nonfifo(&snd_pcm_link_rwsem); | 2006 | snd_pcm_group_init(group); |
1972 | write_lock_irq(&snd_pcm_link_rwlock); | 2007 | |
2008 | down_write(&snd_pcm_link_rwsem); | ||
1973 | if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN || | 2009 | if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN || |
1974 | substream->runtime->status->state != substream1->runtime->status->state || | 2010 | substream->runtime->status->state != substream1->runtime->status->state || |
1975 | substream->pcm->nonatomic != substream1->pcm->nonatomic) { | 2011 | substream->pcm->nonatomic != substream1->pcm->nonatomic) { |
@@ -1980,23 +2016,23 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) | |||
1980 | res = -EALREADY; | 2016 | res = -EALREADY; |
1981 | goto _end; | 2017 | goto _end; |
1982 | } | 2018 | } |
2019 | |||
2020 | snd_pcm_stream_lock_irq(substream); | ||
1983 | if (!snd_pcm_stream_linked(substream)) { | 2021 | if (!snd_pcm_stream_linked(substream)) { |
1984 | substream->group = group; | 2022 | snd_pcm_group_assign(substream, group); |
1985 | group = NULL; | 2023 | group = NULL; /* assigned, don't free this one below */ |
1986 | spin_lock_init(&substream->group->lock); | 2024 | } |
1987 | mutex_init(&substream->group->mutex); | 2025 | target_group = substream->group; |
1988 | INIT_LIST_HEAD(&substream->group->substreams); | 2026 | snd_pcm_stream_unlock_irq(substream); |
1989 | list_add_tail(&substream->link_list, &substream->group->substreams); | 2027 | |
1990 | substream->group->count = 1; | 2028 | snd_pcm_group_lock_irq(target_group, nonatomic); |
1991 | } | 2029 | snd_pcm_stream_lock(substream1); |
1992 | list_add_tail(&substream1->link_list, &substream->group->substreams); | 2030 | snd_pcm_group_assign(substream1, target_group); |
1993 | substream->group->count++; | 2031 | snd_pcm_stream_unlock(substream1); |
1994 | substream1->group = substream->group; | 2032 | snd_pcm_group_unlock_irq(target_group, nonatomic); |
1995 | _end: | 2033 | _end: |
1996 | write_unlock_irq(&snd_pcm_link_rwlock); | ||
1997 | up_write(&snd_pcm_link_rwsem); | 2034 | up_write(&snd_pcm_link_rwsem); |
1998 | _nolock: | 2035 | _nolock: |
1999 | snd_card_unref(substream1->pcm->card); | ||
2000 | kfree(group); | 2036 | kfree(group); |
2001 | _badf: | 2037 | _badf: |
2002 | fdput(f); | 2038 | fdput(f); |
@@ -2005,34 +2041,43 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) | |||
2005 | 2041 | ||
2006 | static void relink_to_local(struct snd_pcm_substream *substream) | 2042 | static void relink_to_local(struct snd_pcm_substream *substream) |
2007 | { | 2043 | { |
2008 | substream->group = &substream->self_group; | 2044 | snd_pcm_stream_lock(substream); |
2009 | INIT_LIST_HEAD(&substream->self_group.substreams); | 2045 | snd_pcm_group_assign(substream, &substream->self_group); |
2010 | list_add_tail(&substream->link_list, &substream->self_group.substreams); | 2046 | snd_pcm_stream_unlock(substream); |
2011 | } | 2047 | } |
2012 | 2048 | ||
2013 | static int snd_pcm_unlink(struct snd_pcm_substream *substream) | 2049 | static int snd_pcm_unlink(struct snd_pcm_substream *substream) |
2014 | { | 2050 | { |
2015 | struct snd_pcm_substream *s; | 2051 | struct snd_pcm_group *group; |
2052 | bool nonatomic = substream->pcm->nonatomic; | ||
2053 | bool do_free = false; | ||
2016 | int res = 0; | 2054 | int res = 0; |
2017 | 2055 | ||
2018 | down_write_nonfifo(&snd_pcm_link_rwsem); | 2056 | down_write(&snd_pcm_link_rwsem); |
2019 | write_lock_irq(&snd_pcm_link_rwlock); | 2057 | |
2020 | if (!snd_pcm_stream_linked(substream)) { | 2058 | if (!snd_pcm_stream_linked(substream)) { |
2021 | res = -EALREADY; | 2059 | res = -EALREADY; |
2022 | goto _end; | 2060 | goto _end; |
2023 | } | 2061 | } |
2024 | list_del(&substream->link_list); | 2062 | |
2025 | substream->group->count--; | 2063 | group = substream->group; |
2026 | if (substream->group->count == 1) { /* detach the last stream, too */ | 2064 | snd_pcm_group_lock_irq(group, nonatomic); |
2027 | snd_pcm_group_for_each_entry(s, substream) { | 2065 | |
2028 | relink_to_local(s); | ||
2029 | break; | ||
2030 | } | ||
2031 | kfree(substream->group); | ||
2032 | } | ||
2033 | relink_to_local(substream); | 2066 | relink_to_local(substream); |
2067 | |||
2068 | /* detach the last stream, too */ | ||
2069 | if (list_is_singular(&group->substreams)) { | ||
2070 | relink_to_local(list_first_entry(&group->substreams, | ||
2071 | struct snd_pcm_substream, | ||
2072 | link_list)); | ||
2073 | do_free = !refcount_read(&group->refs); | ||
2074 | } | ||
2075 | |||
2076 | snd_pcm_group_unlock_irq(group, nonatomic); | ||
2077 | if (do_free) | ||
2078 | kfree(group); | ||
2079 | |||
2034 | _end: | 2080 | _end: |
2035 | write_unlock_irq(&snd_pcm_link_rwlock); | ||
2036 | up_write(&snd_pcm_link_rwsem); | 2081 | up_write(&snd_pcm_link_rwsem); |
2037 | return res; | 2082 | return res; |
2038 | } | 2083 | } |
@@ -2457,10 +2502,8 @@ static int snd_pcm_open_file(struct file *file, | |||
2457 | return -ENOMEM; | 2502 | return -ENOMEM; |
2458 | } | 2503 | } |
2459 | pcm_file->substream = substream; | 2504 | pcm_file->substream = substream; |
2460 | if (substream->ref_count == 1) { | 2505 | if (substream->ref_count == 1) |
2461 | substream->file = pcm_file; | ||
2462 | substream->pcm_release = pcm_release_private; | 2506 | substream->pcm_release = pcm_release_private; |
2463 | } | ||
2464 | file->private_data = pcm_file; | 2507 | file->private_data = pcm_file; |
2465 | 2508 | ||
2466 | return 0; | 2509 | return 0; |
diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c index 1e34e6381baa..8c3fbe1276be 100644 --- a/sound/drivers/aloop.c +++ b/sound/drivers/aloop.c | |||
@@ -1133,16 +1133,10 @@ static void print_cable_info(struct snd_info_entry *entry, | |||
1133 | static int loopback_proc_new(struct loopback *loopback, int cidx) | 1133 | static int loopback_proc_new(struct loopback *loopback, int cidx) |
1134 | { | 1134 | { |
1135 | char name[32]; | 1135 | char name[32]; |
1136 | struct snd_info_entry *entry; | ||
1137 | int err; | ||
1138 | 1136 | ||
1139 | snprintf(name, sizeof(name), "cable#%d", cidx); | 1137 | snprintf(name, sizeof(name), "cable#%d", cidx); |
1140 | err = snd_card_proc_new(loopback->card, name, &entry); | 1138 | return snd_card_ro_proc_new(loopback->card, name, loopback, |
1141 | if (err < 0) | 1139 | print_cable_info); |
1142 | return err; | ||
1143 | |||
1144 | snd_info_set_text_ops(entry, loopback, print_cable_info); | ||
1145 | return 0; | ||
1146 | } | 1140 | } |
1147 | 1141 | ||
1148 | static int loopback_probe(struct platform_device *devptr) | 1142 | static int loopback_probe(struct platform_device *devptr) |
@@ -1200,12 +1194,8 @@ static int loopback_remove(struct platform_device *devptr) | |||
1200 | static int loopback_suspend(struct device *pdev) | 1194 | static int loopback_suspend(struct device *pdev) |
1201 | { | 1195 | { |
1202 | struct snd_card *card = dev_get_drvdata(pdev); | 1196 | struct snd_card *card = dev_get_drvdata(pdev); |
1203 | struct loopback *loopback = card->private_data; | ||
1204 | 1197 | ||
1205 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1198 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1206 | |||
1207 | snd_pcm_suspend_all(loopback->pcm[0]); | ||
1208 | snd_pcm_suspend_all(loopback->pcm[1]); | ||
1209 | return 0; | 1199 | return 0; |
1210 | } | 1200 | } |
1211 | 1201 | ||
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index 9af154db530a..2672c2e13334 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c | |||
@@ -1037,14 +1037,8 @@ static void dummy_proc_write(struct snd_info_entry *entry, | |||
1037 | 1037 | ||
1038 | static void dummy_proc_init(struct snd_dummy *chip) | 1038 | static void dummy_proc_init(struct snd_dummy *chip) |
1039 | { | 1039 | { |
1040 | struct snd_info_entry *entry; | 1040 | snd_card_rw_proc_new(chip->card, "dummy_pcm", chip, |
1041 | 1041 | dummy_proc_read, dummy_proc_write); | |
1042 | if (!snd_card_proc_new(chip->card, "dummy_pcm", &entry)) { | ||
1043 | snd_info_set_text_ops(entry, chip, dummy_proc_read); | ||
1044 | entry->c.text.write = dummy_proc_write; | ||
1045 | entry->mode |= 0200; | ||
1046 | entry->private_data = chip; | ||
1047 | } | ||
1048 | } | 1042 | } |
1049 | #else | 1043 | #else |
1050 | #define dummy_proc_init(x) | 1044 | #define dummy_proc_init(x) |
@@ -1138,10 +1132,8 @@ static int snd_dummy_remove(struct platform_device *devptr) | |||
1138 | static int snd_dummy_suspend(struct device *pdev) | 1132 | static int snd_dummy_suspend(struct device *pdev) |
1139 | { | 1133 | { |
1140 | struct snd_card *card = dev_get_drvdata(pdev); | 1134 | struct snd_card *card = dev_get_drvdata(pdev); |
1141 | struct snd_dummy *dummy = card->private_data; | ||
1142 | 1135 | ||
1143 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1136 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1144 | snd_pcm_suspend_all(dummy->pcm); | ||
1145 | return 0; | 1137 | return 0; |
1146 | } | 1138 | } |
1147 | 1139 | ||
diff --git a/sound/drivers/opl4/opl4_proc.c b/sound/drivers/opl4/opl4_proc.c index 16b24091d799..f1b839a0e7b7 100644 --- a/sound/drivers/opl4/opl4_proc.c +++ b/sound/drivers/opl4/opl4_proc.c | |||
@@ -114,10 +114,6 @@ int snd_opl4_create_proc(struct snd_opl4 *opl4) | |||
114 | entry->c.ops = &snd_opl4_mem_proc_ops; | 114 | entry->c.ops = &snd_opl4_mem_proc_ops; |
115 | entry->module = THIS_MODULE; | 115 | entry->module = THIS_MODULE; |
116 | entry->private_data = opl4; | 116 | entry->private_data = opl4; |
117 | if (snd_info_register(entry) < 0) { | ||
118 | snd_info_free_entry(entry); | ||
119 | entry = NULL; | ||
120 | } | ||
121 | } | 117 | } |
122 | opl4->proc_entry = entry; | 118 | opl4->proc_entry = entry; |
123 | return 0; | 119 | return 0; |
diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c index 0dd3f46eb03e..d83ad3820f02 100644 --- a/sound/drivers/pcsp/pcsp.c +++ b/sound/drivers/pcsp/pcsp.c | |||
@@ -197,7 +197,6 @@ static int pcsp_suspend(struct device *dev) | |||
197 | { | 197 | { |
198 | struct snd_pcsp *chip = dev_get_drvdata(dev); | 198 | struct snd_pcsp *chip = dev_get_drvdata(dev); |
199 | pcsp_stop_beep(chip); | 199 | pcsp_stop_beep(chip); |
200 | snd_pcm_suspend_all(chip->pcm); | ||
201 | return 0; | 200 | return 0; |
202 | } | 201 | } |
203 | 202 | ||
diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c index 04368dd59a4c..543945643a76 100644 --- a/sound/drivers/vx/vx_core.c +++ b/sound/drivers/vx/vx_core.c | |||
@@ -643,10 +643,7 @@ static void vx_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *b | |||
643 | 643 | ||
644 | static void vx_proc_init(struct vx_core *chip) | 644 | static void vx_proc_init(struct vx_core *chip) |
645 | { | 645 | { |
646 | struct snd_info_entry *entry; | 646 | snd_card_ro_proc_new(chip->card, "vx-status", chip, vx_proc_read); |
647 | |||
648 | if (! snd_card_proc_new(chip->card, "vx-status", &entry)) | ||
649 | snd_info_set_text_ops(entry, chip, vx_proc_read); | ||
650 | } | 647 | } |
651 | 648 | ||
652 | 649 | ||
@@ -732,12 +729,8 @@ EXPORT_SYMBOL(snd_vx_dsp_load); | |||
732 | */ | 729 | */ |
733 | int snd_vx_suspend(struct vx_core *chip) | 730 | int snd_vx_suspend(struct vx_core *chip) |
734 | { | 731 | { |
735 | unsigned int i; | ||
736 | |||
737 | snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); | 732 | snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); |
738 | chip->chip_status |= VX_STAT_IN_SUSPEND; | 733 | chip->chip_status |= VX_STAT_IN_SUSPEND; |
739 | for (i = 0; i < chip->hw->num_codecs; i++) | ||
740 | snd_pcm_suspend_all(chip->pcm[i]); | ||
741 | 734 | ||
742 | return 0; | 735 | return 0; |
743 | } | 736 | } |
diff --git a/sound/firewire/Kconfig b/sound/firewire/Kconfig index 052e00590259..b9e96d0b3a0a 100644 --- a/sound/firewire/Kconfig +++ b/sound/firewire/Kconfig | |||
@@ -163,5 +163,6 @@ config SND_FIREFACE | |||
163 | Say Y here to include support for RME fireface series. | 163 | Say Y here to include support for RME fireface series. |
164 | * Fireface 400 | 164 | * Fireface 400 |
165 | * Fireface 800 | 165 | * Fireface 800 |
166 | * Fireface UCX | ||
166 | 167 | ||
167 | endif # SND_FIREWIRE | 168 | endif # SND_FIREWIRE |
diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c index d91874275d2c..5b46e8dcc2dd 100644 --- a/sound/firewire/bebob/bebob.c +++ b/sound/firewire/bebob/bebob.c | |||
@@ -448,7 +448,19 @@ static const struct ieee1394_device_id bebob_id_table[] = { | |||
448 | /* Focusrite, SaffirePro 26 I/O */ | 448 | /* Focusrite, SaffirePro 26 I/O */ |
449 | SND_BEBOB_DEV_ENTRY(VEN_FOCUSRITE, 0x00000003, &saffirepro_26_spec), | 449 | SND_BEBOB_DEV_ENTRY(VEN_FOCUSRITE, 0x00000003, &saffirepro_26_spec), |
450 | /* Focusrite, SaffirePro 10 I/O */ | 450 | /* Focusrite, SaffirePro 10 I/O */ |
451 | SND_BEBOB_DEV_ENTRY(VEN_FOCUSRITE, 0x00000006, &saffirepro_10_spec), | 451 | { |
452 | // The combination of vendor_id and model_id is the same as the | ||
453 | // same as the one of Liquid Saffire 56. | ||
454 | .match_flags = IEEE1394_MATCH_VENDOR_ID | | ||
455 | IEEE1394_MATCH_MODEL_ID | | ||
456 | IEEE1394_MATCH_SPECIFIER_ID | | ||
457 | IEEE1394_MATCH_VERSION, | ||
458 | .vendor_id = VEN_FOCUSRITE, | ||
459 | .model_id = 0x000006, | ||
460 | .specifier_id = 0x00a02d, | ||
461 | .version = 0x010001, | ||
462 | .driver_data = (kernel_ulong_t)&saffirepro_10_spec, | ||
463 | }, | ||
452 | /* Focusrite, Saffire(no label and LE) */ | 464 | /* Focusrite, Saffire(no label and LE) */ |
453 | SND_BEBOB_DEV_ENTRY(VEN_FOCUSRITE, MODEL_FOCUSRITE_SAFFIRE_BOTH, | 465 | SND_BEBOB_DEV_ENTRY(VEN_FOCUSRITE, MODEL_FOCUSRITE_SAFFIRE_BOTH, |
454 | &saffire_spec), | 466 | &saffire_spec), |
diff --git a/sound/firewire/bebob/bebob_proc.c b/sound/firewire/bebob/bebob_proc.c index 8096891af913..05e2a1c6326c 100644 --- a/sound/firewire/bebob/bebob_proc.c +++ b/sound/firewire/bebob/bebob_proc.c | |||
@@ -163,12 +163,8 @@ add_node(struct snd_bebob *bebob, struct snd_info_entry *root, const char *name, | |||
163 | struct snd_info_entry *entry; | 163 | struct snd_info_entry *entry; |
164 | 164 | ||
165 | entry = snd_info_create_card_entry(bebob->card, name, root); | 165 | entry = snd_info_create_card_entry(bebob->card, name, root); |
166 | if (entry == NULL) | 166 | if (entry) |
167 | return; | 167 | snd_info_set_text_ops(entry, bebob, op); |
168 | |||
169 | snd_info_set_text_ops(entry, bebob, op); | ||
170 | if (snd_info_register(entry) < 0) | ||
171 | snd_info_free_entry(entry); | ||
172 | } | 168 | } |
173 | 169 | ||
174 | void snd_bebob_proc_init(struct snd_bebob *bebob) | 170 | void snd_bebob_proc_init(struct snd_bebob *bebob) |
@@ -184,10 +180,6 @@ void snd_bebob_proc_init(struct snd_bebob *bebob) | |||
184 | if (root == NULL) | 180 | if (root == NULL) |
185 | return; | 181 | return; |
186 | root->mode = S_IFDIR | 0555; | 182 | root->mode = S_IFDIR | 0555; |
187 | if (snd_info_register(root) < 0) { | ||
188 | snd_info_free_entry(root); | ||
189 | return; | ||
190 | } | ||
191 | 183 | ||
192 | add_node(bebob, root, "clock", proc_read_clock); | 184 | add_node(bebob, root, "clock", proc_read_clock); |
193 | add_node(bebob, root, "firmware", proc_read_hw_info); | 185 | add_node(bebob, root, "firmware", proc_read_hw_info); |
diff --git a/sound/firewire/dice/dice-proc.c b/sound/firewire/dice/dice-proc.c index bb870fc73f99..9b1d509c6320 100644 --- a/sound/firewire/dice/dice-proc.c +++ b/sound/firewire/dice/dice-proc.c | |||
@@ -285,12 +285,8 @@ static void add_node(struct snd_dice *dice, struct snd_info_entry *root, | |||
285 | struct snd_info_entry *entry; | 285 | struct snd_info_entry *entry; |
286 | 286 | ||
287 | entry = snd_info_create_card_entry(dice->card, name, root); | 287 | entry = snd_info_create_card_entry(dice->card, name, root); |
288 | if (!entry) | 288 | if (entry) |
289 | return; | 289 | snd_info_set_text_ops(entry, dice, op); |
290 | |||
291 | snd_info_set_text_ops(entry, dice, op); | ||
292 | if (snd_info_register(entry) < 0) | ||
293 | snd_info_free_entry(entry); | ||
294 | } | 290 | } |
295 | 291 | ||
296 | void snd_dice_create_proc(struct snd_dice *dice) | 292 | void snd_dice_create_proc(struct snd_dice *dice) |
@@ -306,10 +302,6 @@ void snd_dice_create_proc(struct snd_dice *dice) | |||
306 | if (!root) | 302 | if (!root) |
307 | return; | 303 | return; |
308 | root->mode = S_IFDIR | 0555; | 304 | root->mode = S_IFDIR | 0555; |
309 | if (snd_info_register(root) < 0) { | ||
310 | snd_info_free_entry(root); | ||
311 | return; | ||
312 | } | ||
313 | 305 | ||
314 | add_node(dice, root, "dice", dice_proc_read); | 306 | add_node(dice, root, "dice", dice_proc_read); |
315 | add_node(dice, root, "formation", dice_proc_read_formation); | 307 | add_node(dice, root, "formation", dice_proc_read_formation); |
diff --git a/sound/firewire/dice/dice.c b/sound/firewire/dice/dice.c index ed50b222d36e..eee184b05d93 100644 --- a/sound/firewire/dice/dice.c +++ b/sound/firewire/dice/dice.c | |||
@@ -18,6 +18,7 @@ MODULE_LICENSE("GPL v2"); | |||
18 | #define OUI_ALESIS 0x000595 | 18 | #define OUI_ALESIS 0x000595 |
19 | #define OUI_MAUDIO 0x000d6c | 19 | #define OUI_MAUDIO 0x000d6c |
20 | #define OUI_MYTEK 0x001ee8 | 20 | #define OUI_MYTEK 0x001ee8 |
21 | #define OUI_SSL 0x0050c2 // Actually ID reserved by IEEE. | ||
21 | 22 | ||
22 | #define DICE_CATEGORY_ID 0x04 | 23 | #define DICE_CATEGORY_ID 0x04 |
23 | #define WEISS_CATEGORY_ID 0x00 | 24 | #define WEISS_CATEGORY_ID 0x00 |
@@ -196,7 +197,7 @@ static int dice_probe(struct fw_unit *unit, | |||
196 | struct snd_dice *dice; | 197 | struct snd_dice *dice; |
197 | int err; | 198 | int err; |
198 | 199 | ||
199 | if (!entry->driver_data) { | 200 | if (!entry->driver_data && entry->vendor_id != OUI_SSL) { |
200 | err = check_dice_category(unit); | 201 | err = check_dice_category(unit); |
201 | if (err < 0) | 202 | if (err < 0) |
202 | return -ENODEV; | 203 | return -ENODEV; |
@@ -361,6 +362,15 @@ static const struct ieee1394_device_id dice_id_table[] = { | |||
361 | .model_id = 0x000002, | 362 | .model_id = 0x000002, |
362 | .driver_data = (kernel_ulong_t)snd_dice_detect_mytek_formats, | 363 | .driver_data = (kernel_ulong_t)snd_dice_detect_mytek_formats, |
363 | }, | 364 | }, |
365 | // Solid State Logic, Duende Classic and Mini. | ||
366 | // NOTE: each field of GUID in config ROM is not compliant to standard | ||
367 | // DICE scheme. | ||
368 | { | ||
369 | .match_flags = IEEE1394_MATCH_VENDOR_ID | | ||
370 | IEEE1394_MATCH_MODEL_ID, | ||
371 | .vendor_id = OUI_SSL, | ||
372 | .model_id = 0x000070, | ||
373 | }, | ||
364 | { | 374 | { |
365 | .match_flags = IEEE1394_MATCH_VERSION, | 375 | .match_flags = IEEE1394_MATCH_VERSION, |
366 | .version = DICE_INTERFACE, | 376 | .version = DICE_INTERFACE, |
diff --git a/sound/firewire/digi00x/digi00x-proc.c b/sound/firewire/digi00x/digi00x-proc.c index 6996d5a6ff5f..d22e8675b10f 100644 --- a/sound/firewire/digi00x/digi00x-proc.c +++ b/sound/firewire/digi00x/digi00x-proc.c | |||
@@ -80,20 +80,8 @@ void snd_dg00x_proc_init(struct snd_dg00x *dg00x) | |||
80 | return; | 80 | return; |
81 | 81 | ||
82 | root->mode = S_IFDIR | 0555; | 82 | root->mode = S_IFDIR | 0555; |
83 | if (snd_info_register(root) < 0) { | ||
84 | snd_info_free_entry(root); | ||
85 | return; | ||
86 | } | ||
87 | 83 | ||
88 | entry = snd_info_create_card_entry(dg00x->card, "clock", root); | 84 | entry = snd_info_create_card_entry(dg00x->card, "clock", root); |
89 | if (entry == NULL) { | 85 | if (entry) |
90 | snd_info_free_entry(root); | 86 | snd_info_set_text_ops(entry, dg00x, proc_read_clock); |
91 | return; | ||
92 | } | ||
93 | |||
94 | snd_info_set_text_ops(entry, dg00x, proc_read_clock); | ||
95 | if (snd_info_register(entry) < 0) { | ||
96 | snd_info_free_entry(entry); | ||
97 | snd_info_free_entry(root); | ||
98 | } | ||
99 | } | 87 | } |
diff --git a/sound/firewire/fireface/Makefile b/sound/firewire/fireface/Makefile index 79a7d6d99d72..d64f4e2a1096 100644 --- a/sound/firewire/fireface/Makefile +++ b/sound/firewire/fireface/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | snd-fireface-objs := ff.o ff-transaction.o ff-midi.o ff-proc.o amdtp-ff.o \ | 1 | snd-fireface-objs := ff.o ff-transaction.o ff-midi.o ff-proc.o amdtp-ff.o \ |
2 | ff-stream.o ff-pcm.o ff-hwdep.o ff-protocol-ff400.o \ | 2 | ff-stream.o ff-pcm.o ff-hwdep.o ff-protocol-former.o \ |
3 | ff-protocol-ff800.o | 3 | ff-protocol-latter.o |
4 | obj-$(CONFIG_SND_FIREFACE) += snd-fireface.o | 4 | obj-$(CONFIG_SND_FIREFACE) += snd-fireface.o |
diff --git a/sound/firewire/fireface/ff-midi.c b/sound/firewire/fireface/ff-midi.c index 6a49611ee462..5b44e1c4569a 100644 --- a/sound/firewire/fireface/ff-midi.c +++ b/sound/firewire/fireface/ff-midi.c | |||
@@ -19,7 +19,7 @@ static int midi_playback_open(struct snd_rawmidi_substream *substream) | |||
19 | struct snd_ff *ff = substream->rmidi->private_data; | 19 | struct snd_ff *ff = substream->rmidi->private_data; |
20 | 20 | ||
21 | /* Initialize internal status. */ | 21 | /* Initialize internal status. */ |
22 | ff->running_status[substream->number] = 0; | 22 | ff->on_sysex[substream->number] = 0; |
23 | ff->rx_midi_error[substream->number] = false; | 23 | ff->rx_midi_error[substream->number] = false; |
24 | 24 | ||
25 | WRITE_ONCE(ff->rx_midi_substreams[substream->number], substream); | 25 | WRITE_ONCE(ff->rx_midi_substreams[substream->number], substream); |
diff --git a/sound/firewire/fireface/ff-pcm.c b/sound/firewire/fireface/ff-pcm.c index d0bc96b20a65..5adf04b95c04 100644 --- a/sound/firewire/fireface/ff-pcm.c +++ b/sound/firewire/fireface/ff-pcm.c | |||
@@ -152,7 +152,7 @@ static int pcm_open(struct snd_pcm_substream *substream) | |||
152 | if (err < 0) | 152 | if (err < 0) |
153 | goto release_lock; | 153 | goto release_lock; |
154 | 154 | ||
155 | err = snd_ff_transaction_get_clock(ff, &rate, &src); | 155 | err = ff->spec->protocol->get_clock(ff, &rate, &src); |
156 | if (err < 0) | 156 | if (err < 0) |
157 | goto release_lock; | 157 | goto release_lock; |
158 | 158 | ||
diff --git a/sound/firewire/fireface/ff-proc.c b/sound/firewire/fireface/ff-proc.c index a0c550dabe9a..b886b541c94b 100644 --- a/sound/firewire/fireface/ff-proc.c +++ b/sound/firewire/fireface/ff-proc.c | |||
@@ -8,209 +8,29 @@ | |||
8 | 8 | ||
9 | #include "./ff.h" | 9 | #include "./ff.h" |
10 | 10 | ||
11 | static void proc_dump_clock_config(struct snd_info_entry *entry, | 11 | const char *snd_ff_proc_get_clk_label(enum snd_ff_clock_src src) |
12 | struct snd_info_buffer *buffer) | ||
13 | { | 12 | { |
14 | struct snd_ff *ff = entry->private_data; | 13 | static const char *const labels[] = { |
15 | __le32 reg; | 14 | "Internal", |
16 | u32 data; | 15 | "S/PDIF", |
17 | unsigned int rate; | 16 | "ADAT1", |
18 | const char *src; | 17 | "ADAT2", |
19 | int err; | 18 | "Word", |
20 | 19 | "LTC", | |
21 | err = snd_fw_transaction(ff->unit, TCODE_READ_BLOCK_REQUEST, | 20 | }; |
22 | SND_FF_REG_CLOCK_CONFIG, ®, sizeof(reg), 0); | 21 | |
23 | if (err < 0) | 22 | if (src >= ARRAY_SIZE(labels)) |
24 | return; | 23 | return NULL; |
25 | 24 | ||
26 | data = le32_to_cpu(reg); | 25 | return labels[src]; |
27 | |||
28 | snd_iprintf(buffer, "Output S/PDIF format: %s (Emphasis: %s)\n", | ||
29 | (data & 0x20) ? "Professional" : "Consumer", | ||
30 | (data & 0x40) ? "on" : "off"); | ||
31 | |||
32 | snd_iprintf(buffer, "Optical output interface format: %s\n", | ||
33 | ((data >> 8) & 0x01) ? "S/PDIF" : "ADAT"); | ||
34 | |||
35 | snd_iprintf(buffer, "Word output single speed: %s\n", | ||
36 | ((data >> 8) & 0x20) ? "on" : "off"); | ||
37 | |||
38 | snd_iprintf(buffer, "S/PDIF input interface: %s\n", | ||
39 | ((data >> 8) & 0x02) ? "Optical" : "Coaxial"); | ||
40 | |||
41 | switch ((data >> 1) & 0x03) { | ||
42 | case 0x01: | ||
43 | rate = 32000; | ||
44 | break; | ||
45 | case 0x00: | ||
46 | rate = 44100; | ||
47 | break; | ||
48 | case 0x03: | ||
49 | rate = 48000; | ||
50 | break; | ||
51 | case 0x02: | ||
52 | default: | ||
53 | return; | ||
54 | } | ||
55 | |||
56 | if (data & 0x08) | ||
57 | rate *= 2; | ||
58 | else if (data & 0x10) | ||
59 | rate *= 4; | ||
60 | |||
61 | snd_iprintf(buffer, "Sampling rate: %d\n", rate); | ||
62 | |||
63 | if (data & 0x01) { | ||
64 | src = "Internal"; | ||
65 | } else { | ||
66 | switch ((data >> 10) & 0x07) { | ||
67 | case 0x00: | ||
68 | src = "ADAT1"; | ||
69 | break; | ||
70 | case 0x01: | ||
71 | src = "ADAT2"; | ||
72 | break; | ||
73 | case 0x03: | ||
74 | src = "S/PDIF"; | ||
75 | break; | ||
76 | case 0x04: | ||
77 | src = "Word"; | ||
78 | break; | ||
79 | case 0x05: | ||
80 | src = "LTC"; | ||
81 | break; | ||
82 | default: | ||
83 | return; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | snd_iprintf(buffer, "Sync to clock source: %s\n", src); | ||
88 | } | 26 | } |
89 | 27 | ||
90 | static void proc_dump_sync_status(struct snd_info_entry *entry, | 28 | static void proc_dump_status(struct snd_info_entry *entry, |
91 | struct snd_info_buffer *buffer) | 29 | struct snd_info_buffer *buffer) |
92 | { | 30 | { |
93 | struct snd_ff *ff = entry->private_data; | 31 | struct snd_ff *ff = entry->private_data; |
94 | __le32 reg; | ||
95 | u32 data; | ||
96 | int err; | ||
97 | 32 | ||
98 | err = snd_fw_transaction(ff->unit, TCODE_READ_QUADLET_REQUEST, | 33 | ff->spec->protocol->dump_status(ff, buffer); |
99 | SND_FF_REG_SYNC_STATUS, ®, sizeof(reg), 0); | ||
100 | if (err < 0) | ||
101 | return; | ||
102 | |||
103 | data = le32_to_cpu(reg); | ||
104 | |||
105 | snd_iprintf(buffer, "External source detection:\n"); | ||
106 | |||
107 | snd_iprintf(buffer, "Word Clock:"); | ||
108 | if ((data >> 24) & 0x20) { | ||
109 | if ((data >> 24) & 0x40) | ||
110 | snd_iprintf(buffer, "sync\n"); | ||
111 | else | ||
112 | snd_iprintf(buffer, "lock\n"); | ||
113 | } else { | ||
114 | snd_iprintf(buffer, "none\n"); | ||
115 | } | ||
116 | |||
117 | snd_iprintf(buffer, "S/PDIF:"); | ||
118 | if ((data >> 16) & 0x10) { | ||
119 | if ((data >> 16) & 0x04) | ||
120 | snd_iprintf(buffer, "sync\n"); | ||
121 | else | ||
122 | snd_iprintf(buffer, "lock\n"); | ||
123 | } else { | ||
124 | snd_iprintf(buffer, "none\n"); | ||
125 | } | ||
126 | |||
127 | snd_iprintf(buffer, "ADAT1:"); | ||
128 | if ((data >> 8) & 0x04) { | ||
129 | if ((data >> 8) & 0x10) | ||
130 | snd_iprintf(buffer, "sync\n"); | ||
131 | else | ||
132 | snd_iprintf(buffer, "lock\n"); | ||
133 | } else { | ||
134 | snd_iprintf(buffer, "none\n"); | ||
135 | } | ||
136 | |||
137 | snd_iprintf(buffer, "ADAT2:"); | ||
138 | if ((data >> 8) & 0x08) { | ||
139 | if ((data >> 8) & 0x20) | ||
140 | snd_iprintf(buffer, "sync\n"); | ||
141 | else | ||
142 | snd_iprintf(buffer, "lock\n"); | ||
143 | } else { | ||
144 | snd_iprintf(buffer, "none\n"); | ||
145 | } | ||
146 | |||
147 | snd_iprintf(buffer, "\nUsed external source:\n"); | ||
148 | |||
149 | if (((data >> 22) & 0x07) == 0x07) { | ||
150 | snd_iprintf(buffer, "None\n"); | ||
151 | } else { | ||
152 | switch ((data >> 22) & 0x07) { | ||
153 | case 0x00: | ||
154 | snd_iprintf(buffer, "ADAT1:"); | ||
155 | break; | ||
156 | case 0x01: | ||
157 | snd_iprintf(buffer, "ADAT2:"); | ||
158 | break; | ||
159 | case 0x03: | ||
160 | snd_iprintf(buffer, "S/PDIF:"); | ||
161 | break; | ||
162 | case 0x04: | ||
163 | snd_iprintf(buffer, "Word:"); | ||
164 | break; | ||
165 | case 0x07: | ||
166 | snd_iprintf(buffer, "Nothing:"); | ||
167 | break; | ||
168 | case 0x02: | ||
169 | case 0x05: | ||
170 | case 0x06: | ||
171 | default: | ||
172 | snd_iprintf(buffer, "unknown:"); | ||
173 | break; | ||
174 | } | ||
175 | |||
176 | if ((data >> 25) & 0x07) { | ||
177 | switch ((data >> 25) & 0x07) { | ||
178 | case 0x01: | ||
179 | snd_iprintf(buffer, "32000\n"); | ||
180 | break; | ||
181 | case 0x02: | ||
182 | snd_iprintf(buffer, "44100\n"); | ||
183 | break; | ||
184 | case 0x03: | ||
185 | snd_iprintf(buffer, "48000\n"); | ||
186 | break; | ||
187 | case 0x04: | ||
188 | snd_iprintf(buffer, "64000\n"); | ||
189 | break; | ||
190 | case 0x05: | ||
191 | snd_iprintf(buffer, "88200\n"); | ||
192 | break; | ||
193 | case 0x06: | ||
194 | snd_iprintf(buffer, "96000\n"); | ||
195 | break; | ||
196 | case 0x07: | ||
197 | snd_iprintf(buffer, "128000\n"); | ||
198 | break; | ||
199 | case 0x08: | ||
200 | snd_iprintf(buffer, "176400\n"); | ||
201 | break; | ||
202 | case 0x09: | ||
203 | snd_iprintf(buffer, "192000\n"); | ||
204 | break; | ||
205 | case 0x00: | ||
206 | snd_iprintf(buffer, "unknown\n"); | ||
207 | break; | ||
208 | } | ||
209 | } | ||
210 | } | ||
211 | |||
212 | snd_iprintf(buffer, "Multiplied:"); | ||
213 | snd_iprintf(buffer, "%d\n", (data & 0x3ff) * 250); | ||
214 | } | 34 | } |
215 | 35 | ||
216 | static void add_node(struct snd_ff *ff, struct snd_info_entry *root, | 36 | static void add_node(struct snd_ff *ff, struct snd_info_entry *root, |
@@ -221,12 +41,8 @@ static void add_node(struct snd_ff *ff, struct snd_info_entry *root, | |||
221 | struct snd_info_entry *entry; | 41 | struct snd_info_entry *entry; |
222 | 42 | ||
223 | entry = snd_info_create_card_entry(ff->card, name, root); | 43 | entry = snd_info_create_card_entry(ff->card, name, root); |
224 | if (entry == NULL) | 44 | if (entry) |
225 | return; | 45 | snd_info_set_text_ops(entry, ff, op); |
226 | |||
227 | snd_info_set_text_ops(entry, ff, op); | ||
228 | if (snd_info_register(entry) < 0) | ||
229 | snd_info_free_entry(entry); | ||
230 | } | 46 | } |
231 | 47 | ||
232 | void snd_ff_proc_init(struct snd_ff *ff) | 48 | void snd_ff_proc_init(struct snd_ff *ff) |
@@ -242,11 +58,6 @@ void snd_ff_proc_init(struct snd_ff *ff) | |||
242 | if (root == NULL) | 58 | if (root == NULL) |
243 | return; | 59 | return; |
244 | root->mode = S_IFDIR | 0555; | 60 | root->mode = S_IFDIR | 0555; |
245 | if (snd_info_register(root) < 0) { | ||
246 | snd_info_free_entry(root); | ||
247 | return; | ||
248 | } | ||
249 | 61 | ||
250 | add_node(ff, root, "clock-config", proc_dump_clock_config); | 62 | add_node(ff, root, "status", proc_dump_status); |
251 | add_node(ff, root, "sync-status", proc_dump_sync_status); | ||
252 | } | 63 | } |
diff --git a/sound/firewire/fireface/ff-protocol-ff400.c b/sound/firewire/fireface/ff-protocol-ff400.c deleted file mode 100644 index 2280fab9b3c7..000000000000 --- a/sound/firewire/fireface/ff-protocol-ff400.c +++ /dev/null | |||
@@ -1,161 +0,0 @@ | |||
1 | /* | ||
2 | * ff-protocol-ff400.c - a part of driver for RME Fireface series | ||
3 | * | ||
4 | * Copyright (c) 2015-2017 Takashi Sakamoto | ||
5 | * | ||
6 | * Licensed under the terms of the GNU General Public License, version 2. | ||
7 | */ | ||
8 | |||
9 | #include <linux/delay.h> | ||
10 | #include "ff.h" | ||
11 | |||
12 | #define FF400_STF 0x000080100500ull | ||
13 | #define FF400_RX_PACKET_FORMAT 0x000080100504ull | ||
14 | #define FF400_ISOC_COMM_START 0x000080100508ull | ||
15 | #define FF400_TX_PACKET_FORMAT 0x00008010050cull | ||
16 | #define FF400_ISOC_COMM_STOP 0x000080100510ull | ||
17 | |||
18 | /* | ||
19 | * Fireface 400 manages isochronous channel number in 3 bit field. Therefore, | ||
20 | * we can allocate between 0 and 7 channel. | ||
21 | */ | ||
22 | static int keep_resources(struct snd_ff *ff, unsigned int rate) | ||
23 | { | ||
24 | enum snd_ff_stream_mode mode; | ||
25 | int i; | ||
26 | int err; | ||
27 | |||
28 | // Check whether the given value is supported or not. | ||
29 | for (i = 0; i < CIP_SFC_COUNT; i++) { | ||
30 | if (amdtp_rate_table[i] == rate) | ||
31 | break; | ||
32 | } | ||
33 | if (i >= CIP_SFC_COUNT) | ||
34 | return -EINVAL; | ||
35 | |||
36 | err = snd_ff_stream_get_multiplier_mode(i, &mode); | ||
37 | if (err < 0) | ||
38 | return err; | ||
39 | |||
40 | /* Keep resources for in-stream. */ | ||
41 | ff->tx_resources.channels_mask = 0x00000000000000ffuLL; | ||
42 | err = fw_iso_resources_allocate(&ff->tx_resources, | ||
43 | amdtp_stream_get_max_payload(&ff->tx_stream), | ||
44 | fw_parent_device(ff->unit)->max_speed); | ||
45 | if (err < 0) | ||
46 | return err; | ||
47 | |||
48 | /* Keep resources for out-stream. */ | ||
49 | err = amdtp_ff_set_parameters(&ff->rx_stream, rate, | ||
50 | ff->spec->pcm_playback_channels[mode]); | ||
51 | if (err < 0) | ||
52 | return err; | ||
53 | ff->rx_resources.channels_mask = 0x00000000000000ffuLL; | ||
54 | err = fw_iso_resources_allocate(&ff->rx_resources, | ||
55 | amdtp_stream_get_max_payload(&ff->rx_stream), | ||
56 | fw_parent_device(ff->unit)->max_speed); | ||
57 | if (err < 0) | ||
58 | fw_iso_resources_free(&ff->tx_resources); | ||
59 | |||
60 | return err; | ||
61 | } | ||
62 | |||
63 | static int ff400_begin_session(struct snd_ff *ff, unsigned int rate) | ||
64 | { | ||
65 | __le32 reg; | ||
66 | int err; | ||
67 | |||
68 | err = keep_resources(ff, rate); | ||
69 | if (err < 0) | ||
70 | return err; | ||
71 | |||
72 | /* Set the number of data blocks transferred in a second. */ | ||
73 | reg = cpu_to_le32(rate); | ||
74 | err = snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
75 | FF400_STF, ®, sizeof(reg), 0); | ||
76 | if (err < 0) | ||
77 | return err; | ||
78 | |||
79 | msleep(100); | ||
80 | |||
81 | /* | ||
82 | * Set isochronous channel and the number of quadlets of received | ||
83 | * packets. | ||
84 | */ | ||
85 | reg = cpu_to_le32(((ff->rx_stream.data_block_quadlets << 3) << 8) | | ||
86 | ff->rx_resources.channel); | ||
87 | err = snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
88 | FF400_RX_PACKET_FORMAT, ®, sizeof(reg), 0); | ||
89 | if (err < 0) | ||
90 | return err; | ||
91 | |||
92 | /* | ||
93 | * Set isochronous channel and the number of quadlets of transmitted | ||
94 | * packet. | ||
95 | */ | ||
96 | /* TODO: investigate the purpose of this 0x80. */ | ||
97 | reg = cpu_to_le32((0x80 << 24) | | ||
98 | (ff->tx_resources.channel << 5) | | ||
99 | (ff->tx_stream.data_block_quadlets)); | ||
100 | err = snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
101 | FF400_TX_PACKET_FORMAT, ®, sizeof(reg), 0); | ||
102 | if (err < 0) | ||
103 | return err; | ||
104 | |||
105 | /* Allow to transmit packets. */ | ||
106 | reg = cpu_to_le32(0x00000001); | ||
107 | return snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
108 | FF400_ISOC_COMM_START, ®, sizeof(reg), 0); | ||
109 | } | ||
110 | |||
111 | static void ff400_finish_session(struct snd_ff *ff) | ||
112 | { | ||
113 | __le32 reg; | ||
114 | |||
115 | reg = cpu_to_le32(0x80000000); | ||
116 | snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
117 | FF400_ISOC_COMM_STOP, ®, sizeof(reg), 0); | ||
118 | } | ||
119 | |||
120 | static void ff400_handle_midi_msg(struct snd_ff *ff, __le32 *buf, size_t length) | ||
121 | { | ||
122 | int i; | ||
123 | |||
124 | for (i = 0; i < length / 4; i++) { | ||
125 | u32 quad = le32_to_cpu(buf[i]); | ||
126 | u8 byte; | ||
127 | unsigned int index; | ||
128 | struct snd_rawmidi_substream *substream; | ||
129 | |||
130 | /* Message in first port. */ | ||
131 | /* | ||
132 | * This value may represent the index of this unit when the same | ||
133 | * units are on the same IEEE 1394 bus. This driver doesn't use | ||
134 | * it. | ||
135 | */ | ||
136 | index = (quad >> 8) & 0xff; | ||
137 | if (index > 0) { | ||
138 | substream = READ_ONCE(ff->tx_midi_substreams[0]); | ||
139 | if (substream != NULL) { | ||
140 | byte = quad & 0xff; | ||
141 | snd_rawmidi_receive(substream, &byte, 1); | ||
142 | } | ||
143 | } | ||
144 | |||
145 | /* Message in second port. */ | ||
146 | index = (quad >> 24) & 0xff; | ||
147 | if (index > 0) { | ||
148 | substream = READ_ONCE(ff->tx_midi_substreams[1]); | ||
149 | if (substream != NULL) { | ||
150 | byte = (quad >> 16) & 0xff; | ||
151 | snd_rawmidi_receive(substream, &byte, 1); | ||
152 | } | ||
153 | } | ||
154 | } | ||
155 | } | ||
156 | |||
157 | const struct snd_ff_protocol snd_ff_protocol_ff400 = { | ||
158 | .handle_midi_msg = ff400_handle_midi_msg, | ||
159 | .begin_session = ff400_begin_session, | ||
160 | .finish_session = ff400_finish_session, | ||
161 | }; | ||
diff --git a/sound/firewire/fireface/ff-protocol-ff800.c b/sound/firewire/fireface/ff-protocol-ff800.c deleted file mode 100644 index 2acbf6039770..000000000000 --- a/sound/firewire/fireface/ff-protocol-ff800.c +++ /dev/null | |||
@@ -1,143 +0,0 @@ | |||
1 | /* | ||
2 | * ff-protocol-ff800.c - a part of driver for RME Fireface series | ||
3 | * | ||
4 | * Copyright (c) 2018 Takashi Sakamoto | ||
5 | * | ||
6 | * Licensed under the terms of the GNU General Public License, version 2. | ||
7 | */ | ||
8 | |||
9 | #include <linux/delay.h> | ||
10 | |||
11 | #include "ff.h" | ||
12 | |||
13 | #define FF800_STF 0x0000fc88f000 | ||
14 | #define FF800_RX_PACKET_FORMAT 0x0000fc88f004 | ||
15 | #define FF800_ALLOC_TX_STREAM 0x0000fc88f008 | ||
16 | #define FF800_ISOC_COMM_START 0x0000fc88f00c | ||
17 | #define FF800_TX_S800_FLAG 0x00000800 | ||
18 | #define FF800_ISOC_COMM_STOP 0x0000fc88f010 | ||
19 | |||
20 | #define FF800_TX_PACKET_ISOC_CH 0x0000801c0008 | ||
21 | |||
22 | static int allocate_rx_resources(struct snd_ff *ff) | ||
23 | { | ||
24 | u32 data; | ||
25 | __le32 reg; | ||
26 | int err; | ||
27 | |||
28 | // Controllers should allocate isochronous resources for rx stream. | ||
29 | err = fw_iso_resources_allocate(&ff->rx_resources, | ||
30 | amdtp_stream_get_max_payload(&ff->rx_stream), | ||
31 | fw_parent_device(ff->unit)->max_speed); | ||
32 | if (err < 0) | ||
33 | return err; | ||
34 | |||
35 | // Set isochronous channel and the number of quadlets of rx packets. | ||
36 | data = ff->rx_stream.data_block_quadlets << 3; | ||
37 | data = (data << 8) | ff->rx_resources.channel; | ||
38 | reg = cpu_to_le32(data); | ||
39 | return snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
40 | FF800_RX_PACKET_FORMAT, ®, sizeof(reg), 0); | ||
41 | } | ||
42 | |||
43 | static int allocate_tx_resources(struct snd_ff *ff) | ||
44 | { | ||
45 | __le32 reg; | ||
46 | unsigned int count; | ||
47 | unsigned int tx_isoc_channel; | ||
48 | int err; | ||
49 | |||
50 | reg = cpu_to_le32(ff->tx_stream.data_block_quadlets); | ||
51 | err = snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
52 | FF800_ALLOC_TX_STREAM, ®, sizeof(reg), 0); | ||
53 | if (err < 0) | ||
54 | return err; | ||
55 | |||
56 | // Wait till the format of tx packet is available. | ||
57 | count = 0; | ||
58 | while (count++ < 10) { | ||
59 | u32 data; | ||
60 | err = snd_fw_transaction(ff->unit, TCODE_READ_QUADLET_REQUEST, | ||
61 | FF800_TX_PACKET_ISOC_CH, ®, sizeof(reg), 0); | ||
62 | if (err < 0) | ||
63 | return err; | ||
64 | |||
65 | data = le32_to_cpu(reg); | ||
66 | if (data != 0xffffffff) { | ||
67 | tx_isoc_channel = data; | ||
68 | break; | ||
69 | } | ||
70 | |||
71 | msleep(50); | ||
72 | } | ||
73 | if (count >= 10) | ||
74 | return -ETIMEDOUT; | ||
75 | |||
76 | // NOTE: this is a makeshift to start OHCI 1394 IR context in the | ||
77 | // channel. On the other hand, 'struct fw_iso_resources.allocated' is | ||
78 | // not true and it's not deallocated at stop. | ||
79 | ff->tx_resources.channel = tx_isoc_channel; | ||
80 | |||
81 | return 0; | ||
82 | } | ||
83 | |||
84 | static int ff800_begin_session(struct snd_ff *ff, unsigned int rate) | ||
85 | { | ||
86 | __le32 reg; | ||
87 | int err; | ||
88 | |||
89 | reg = cpu_to_le32(rate); | ||
90 | err = snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
91 | FF800_STF, ®, sizeof(reg), 0); | ||
92 | if (err < 0) | ||
93 | return err; | ||
94 | |||
95 | // If starting isochronous communication immediately, change of STF has | ||
96 | // no effect. In this case, the communication runs based on former STF. | ||
97 | // Let's sleep for a bit. | ||
98 | msleep(100); | ||
99 | |||
100 | err = allocate_rx_resources(ff); | ||
101 | if (err < 0) | ||
102 | return err; | ||
103 | |||
104 | err = allocate_tx_resources(ff); | ||
105 | if (err < 0) | ||
106 | return err; | ||
107 | |||
108 | reg = cpu_to_le32(0x80000000); | ||
109 | reg |= cpu_to_le32(ff->tx_stream.data_block_quadlets); | ||
110 | if (fw_parent_device(ff->unit)->max_speed == SCODE_800) | ||
111 | reg |= cpu_to_le32(FF800_TX_S800_FLAG); | ||
112 | return snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
113 | FF800_ISOC_COMM_START, ®, sizeof(reg), 0); | ||
114 | } | ||
115 | |||
116 | static void ff800_finish_session(struct snd_ff *ff) | ||
117 | { | ||
118 | __le32 reg; | ||
119 | |||
120 | reg = cpu_to_le32(0x80000000); | ||
121 | snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
122 | FF800_ISOC_COMM_STOP, ®, sizeof(reg), 0); | ||
123 | } | ||
124 | |||
125 | static void ff800_handle_midi_msg(struct snd_ff *ff, __le32 *buf, size_t length) | ||
126 | { | ||
127 | int i; | ||
128 | |||
129 | for (i = 0; i < length / 4; i++) { | ||
130 | u8 byte = le32_to_cpu(buf[i]) & 0xff; | ||
131 | struct snd_rawmidi_substream *substream; | ||
132 | |||
133 | substream = READ_ONCE(ff->tx_midi_substreams[0]); | ||
134 | if (substream) | ||
135 | snd_rawmidi_receive(substream, &byte, 1); | ||
136 | } | ||
137 | } | ||
138 | |||
139 | const struct snd_ff_protocol snd_ff_protocol_ff800 = { | ||
140 | .handle_midi_msg = ff800_handle_midi_msg, | ||
141 | .begin_session = ff800_begin_session, | ||
142 | .finish_session = ff800_finish_session, | ||
143 | }; | ||
diff --git a/sound/firewire/fireface/ff-protocol-former.c b/sound/firewire/fireface/ff-protocol-former.c new file mode 100644 index 000000000000..8d1c2c6e907b --- /dev/null +++ b/sound/firewire/fireface/ff-protocol-former.c | |||
@@ -0,0 +1,597 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
2 | // ff-protocol-former.c - a part of driver for RME Fireface series | ||
3 | // | ||
4 | // Copyright (c) 2019 Takashi Sakamoto | ||
5 | // | ||
6 | // Licensed under the terms of the GNU General Public License, version 2. | ||
7 | |||
8 | #include <linux/delay.h> | ||
9 | |||
10 | #include "ff.h" | ||
11 | |||
12 | #define FORMER_REG_SYNC_STATUS 0x0000801c0000ull | ||
13 | /* For block write request. */ | ||
14 | #define FORMER_REG_FETCH_PCM_FRAMES 0x0000801c0000ull | ||
15 | #define FORMER_REG_CLOCK_CONFIG 0x0000801c0004ull | ||
16 | |||
17 | static int parse_clock_bits(u32 data, unsigned int *rate, | ||
18 | enum snd_ff_clock_src *src) | ||
19 | { | ||
20 | static const struct { | ||
21 | unsigned int rate; | ||
22 | u32 mask; | ||
23 | } *rate_entry, rate_entries[] = { | ||
24 | { 32000, 0x00000002, }, | ||
25 | { 44100, 0x00000000, }, | ||
26 | { 48000, 0x00000006, }, | ||
27 | { 64000, 0x0000000a, }, | ||
28 | { 88200, 0x00000008, }, | ||
29 | { 96000, 0x0000000e, }, | ||
30 | { 128000, 0x00000012, }, | ||
31 | { 176400, 0x00000010, }, | ||
32 | { 192000, 0x00000016, }, | ||
33 | }; | ||
34 | static const struct { | ||
35 | enum snd_ff_clock_src src; | ||
36 | u32 mask; | ||
37 | } *clk_entry, clk_entries[] = { | ||
38 | { SND_FF_CLOCK_SRC_ADAT1, 0x00000000, }, | ||
39 | { SND_FF_CLOCK_SRC_ADAT2, 0x00000400, }, | ||
40 | { SND_FF_CLOCK_SRC_SPDIF, 0x00000c00, }, | ||
41 | { SND_FF_CLOCK_SRC_WORD, 0x00001000, }, | ||
42 | { SND_FF_CLOCK_SRC_LTC, 0x00001800, }, | ||
43 | }; | ||
44 | int i; | ||
45 | |||
46 | for (i = 0; i < ARRAY_SIZE(rate_entries); ++i) { | ||
47 | rate_entry = rate_entries + i; | ||
48 | if ((data & 0x0000001e) == rate_entry->mask) { | ||
49 | *rate = rate_entry->rate; | ||
50 | break; | ||
51 | } | ||
52 | } | ||
53 | if (i == ARRAY_SIZE(rate_entries)) | ||
54 | return -EIO; | ||
55 | |||
56 | if (data & 0x00000001) { | ||
57 | *src = SND_FF_CLOCK_SRC_INTERNAL; | ||
58 | } else { | ||
59 | for (i = 0; i < ARRAY_SIZE(clk_entries); ++i) { | ||
60 | clk_entry = clk_entries + i; | ||
61 | if ((data & 0x00001c00) == clk_entry->mask) { | ||
62 | *src = clk_entry->src; | ||
63 | break; | ||
64 | } | ||
65 | } | ||
66 | if (i == ARRAY_SIZE(clk_entries)) | ||
67 | return -EIO; | ||
68 | } | ||
69 | |||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static int former_get_clock(struct snd_ff *ff, unsigned int *rate, | ||
74 | enum snd_ff_clock_src *src) | ||
75 | { | ||
76 | __le32 reg; | ||
77 | u32 data; | ||
78 | int err; | ||
79 | |||
80 | err = snd_fw_transaction(ff->unit, TCODE_READ_QUADLET_REQUEST, | ||
81 | FORMER_REG_CLOCK_CONFIG, ®, sizeof(reg), 0); | ||
82 | if (err < 0) | ||
83 | return err; | ||
84 | data = le32_to_cpu(reg); | ||
85 | |||
86 | return parse_clock_bits(data, rate, src); | ||
87 | } | ||
88 | |||
89 | static int former_switch_fetching_mode(struct snd_ff *ff, bool enable) | ||
90 | { | ||
91 | unsigned int count; | ||
92 | __le32 *reg; | ||
93 | int i; | ||
94 | int err; | ||
95 | |||
96 | count = 0; | ||
97 | for (i = 0; i < SND_FF_STREAM_MODE_COUNT; ++i) | ||
98 | count = max(count, ff->spec->pcm_playback_channels[i]); | ||
99 | |||
100 | reg = kcalloc(count, sizeof(__le32), GFP_KERNEL); | ||
101 | if (!reg) | ||
102 | return -ENOMEM; | ||
103 | |||
104 | if (!enable) { | ||
105 | /* | ||
106 | * Each quadlet is corresponding to data channels in a data | ||
107 | * blocks in reverse order. Precisely, quadlets for available | ||
108 | * data channels should be enabled. Here, I take second best | ||
109 | * to fetch PCM frames from all of data channels regardless of | ||
110 | * stf. | ||
111 | */ | ||
112 | for (i = 0; i < count; ++i) | ||
113 | reg[i] = cpu_to_le32(0x00000001); | ||
114 | } | ||
115 | |||
116 | err = snd_fw_transaction(ff->unit, TCODE_WRITE_BLOCK_REQUEST, | ||
117 | FORMER_REG_FETCH_PCM_FRAMES, reg, | ||
118 | sizeof(__le32) * count, 0); | ||
119 | kfree(reg); | ||
120 | return err; | ||
121 | } | ||
122 | |||
123 | static void dump_clock_config(struct snd_ff *ff, struct snd_info_buffer *buffer) | ||
124 | { | ||
125 | __le32 reg; | ||
126 | u32 data; | ||
127 | unsigned int rate; | ||
128 | enum snd_ff_clock_src src; | ||
129 | const char *label; | ||
130 | int err; | ||
131 | |||
132 | err = snd_fw_transaction(ff->unit, TCODE_READ_BLOCK_REQUEST, | ||
133 | FORMER_REG_CLOCK_CONFIG, ®, sizeof(reg), 0); | ||
134 | if (err < 0) | ||
135 | return; | ||
136 | data = le32_to_cpu(reg); | ||
137 | |||
138 | snd_iprintf(buffer, "Output S/PDIF format: %s (Emphasis: %s)\n", | ||
139 | (data & 0x00000020) ? "Professional" : "Consumer", | ||
140 | (data & 0x00000040) ? "on" : "off"); | ||
141 | |||
142 | snd_iprintf(buffer, "Optical output interface format: %s\n", | ||
143 | (data & 0x00000100) ? "S/PDIF" : "ADAT"); | ||
144 | |||
145 | snd_iprintf(buffer, "Word output single speed: %s\n", | ||
146 | (data & 0x00002000) ? "on" : "off"); | ||
147 | |||
148 | snd_iprintf(buffer, "S/PDIF input interface: %s\n", | ||
149 | (data & 0x00000200) ? "Optical" : "Coaxial"); | ||
150 | |||
151 | err = parse_clock_bits(data, &rate, &src); | ||
152 | if (err < 0) | ||
153 | return; | ||
154 | label = snd_ff_proc_get_clk_label(src); | ||
155 | if (!label) | ||
156 | return; | ||
157 | |||
158 | snd_iprintf(buffer, "Clock configuration: %d %s\n", rate, label); | ||
159 | } | ||
160 | |||
161 | static void dump_sync_status(struct snd_ff *ff, struct snd_info_buffer *buffer) | ||
162 | { | ||
163 | static const struct { | ||
164 | char *const label; | ||
165 | u32 locked_mask; | ||
166 | u32 synced_mask; | ||
167 | } *clk_entry, clk_entries[] = { | ||
168 | { "WDClk", 0x40000000, 0x20000000, }, | ||
169 | { "S/PDIF", 0x00080000, 0x00040000, }, | ||
170 | { "ADAT1", 0x00000400, 0x00001000, }, | ||
171 | { "ADAT2", 0x00000800, 0x00002000, }, | ||
172 | }; | ||
173 | static const struct { | ||
174 | char *const label; | ||
175 | u32 mask; | ||
176 | } *referred_entry, referred_entries[] = { | ||
177 | { "ADAT1", 0x00000000, }, | ||
178 | { "ADAT2", 0x00400000, }, | ||
179 | { "S/PDIF", 0x00c00000, }, | ||
180 | { "WDclk", 0x01000000, }, | ||
181 | { "TCO", 0x01400000, }, | ||
182 | }; | ||
183 | static const struct { | ||
184 | unsigned int rate; | ||
185 | u32 mask; | ||
186 | } *rate_entry, rate_entries[] = { | ||
187 | { 32000, 0x02000000, }, | ||
188 | { 44100, 0x04000000, }, | ||
189 | { 48000, 0x06000000, }, | ||
190 | { 64000, 0x08000000, }, | ||
191 | { 88200, 0x0a000000, }, | ||
192 | { 96000, 0x0c000000, }, | ||
193 | { 128000, 0x0e000000, }, | ||
194 | { 176400, 0x10000000, }, | ||
195 | { 192000, 0x12000000, }, | ||
196 | }; | ||
197 | __le32 reg[2]; | ||
198 | u32 data[2]; | ||
199 | int i; | ||
200 | int err; | ||
201 | |||
202 | err = snd_fw_transaction(ff->unit, TCODE_READ_BLOCK_REQUEST, | ||
203 | FORMER_REG_SYNC_STATUS, reg, sizeof(reg), 0); | ||
204 | if (err < 0) | ||
205 | return; | ||
206 | data[0] = le32_to_cpu(reg[0]); | ||
207 | data[1] = le32_to_cpu(reg[1]); | ||
208 | |||
209 | snd_iprintf(buffer, "External source detection:\n"); | ||
210 | |||
211 | for (i = 0; i < ARRAY_SIZE(clk_entries); ++i) { | ||
212 | const char *state; | ||
213 | |||
214 | clk_entry = clk_entries + i; | ||
215 | if (data[0] & clk_entry->locked_mask) { | ||
216 | if (data[0] & clk_entry->synced_mask) | ||
217 | state = "sync"; | ||
218 | else | ||
219 | state = "lock"; | ||
220 | } else { | ||
221 | state = "none"; | ||
222 | } | ||
223 | |||
224 | snd_iprintf(buffer, "%s: %s\n", clk_entry->label, state); | ||
225 | } | ||
226 | |||
227 | snd_iprintf(buffer, "Referred clock:\n"); | ||
228 | |||
229 | if (data[1] & 0x00000001) { | ||
230 | snd_iprintf(buffer, "Internal\n"); | ||
231 | } else { | ||
232 | unsigned int rate; | ||
233 | const char *label; | ||
234 | |||
235 | for (i = 0; i < ARRAY_SIZE(referred_entries); ++i) { | ||
236 | referred_entry = referred_entries + i; | ||
237 | if ((data[0] & 0x1e0000) == referred_entry->mask) { | ||
238 | label = referred_entry->label; | ||
239 | break; | ||
240 | } | ||
241 | } | ||
242 | if (i == ARRAY_SIZE(referred_entries)) | ||
243 | label = "none"; | ||
244 | |||
245 | for (i = 0; i < ARRAY_SIZE(rate_entries); ++i) { | ||
246 | rate_entry = rate_entries + i; | ||
247 | if ((data[0] & 0x1e000000) == rate_entry->mask) { | ||
248 | rate = rate_entry->rate; | ||
249 | break; | ||
250 | } | ||
251 | } | ||
252 | if (i == ARRAY_SIZE(rate_entries)) | ||
253 | rate = 0; | ||
254 | |||
255 | snd_iprintf(buffer, "%s %d\n", label, rate); | ||
256 | } | ||
257 | } | ||
258 | |||
259 | static void former_dump_status(struct snd_ff *ff, | ||
260 | struct snd_info_buffer *buffer) | ||
261 | { | ||
262 | dump_clock_config(ff, buffer); | ||
263 | dump_sync_status(ff, buffer); | ||
264 | } | ||
265 | |||
266 | static int former_fill_midi_msg(struct snd_ff *ff, | ||
267 | struct snd_rawmidi_substream *substream, | ||
268 | unsigned int port) | ||
269 | { | ||
270 | u8 *buf = (u8 *)ff->msg_buf[port]; | ||
271 | int len; | ||
272 | int i; | ||
273 | |||
274 | len = snd_rawmidi_transmit_peek(substream, buf, | ||
275 | SND_FF_MAXIMIM_MIDI_QUADS); | ||
276 | if (len <= 0) | ||
277 | return len; | ||
278 | |||
279 | // One quadlet includes one byte. | ||
280 | for (i = len - 1; i >= 0; --i) | ||
281 | ff->msg_buf[port][i] = cpu_to_le32(buf[i]); | ||
282 | ff->rx_bytes[port] = len; | ||
283 | |||
284 | return len; | ||
285 | } | ||
286 | |||
287 | #define FF800_STF 0x0000fc88f000 | ||
288 | #define FF800_RX_PACKET_FORMAT 0x0000fc88f004 | ||
289 | #define FF800_ALLOC_TX_STREAM 0x0000fc88f008 | ||
290 | #define FF800_ISOC_COMM_START 0x0000fc88f00c | ||
291 | #define FF800_TX_S800_FLAG 0x00000800 | ||
292 | #define FF800_ISOC_COMM_STOP 0x0000fc88f010 | ||
293 | |||
294 | #define FF800_TX_PACKET_ISOC_CH 0x0000801c0008 | ||
295 | |||
296 | static int allocate_rx_resources(struct snd_ff *ff) | ||
297 | { | ||
298 | u32 data; | ||
299 | __le32 reg; | ||
300 | int err; | ||
301 | |||
302 | // Controllers should allocate isochronous resources for rx stream. | ||
303 | err = fw_iso_resources_allocate(&ff->rx_resources, | ||
304 | amdtp_stream_get_max_payload(&ff->rx_stream), | ||
305 | fw_parent_device(ff->unit)->max_speed); | ||
306 | if (err < 0) | ||
307 | return err; | ||
308 | |||
309 | // Set isochronous channel and the number of quadlets of rx packets. | ||
310 | data = ff->rx_stream.data_block_quadlets << 3; | ||
311 | data = (data << 8) | ff->rx_resources.channel; | ||
312 | reg = cpu_to_le32(data); | ||
313 | return snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
314 | FF800_RX_PACKET_FORMAT, ®, sizeof(reg), 0); | ||
315 | } | ||
316 | |||
317 | static int allocate_tx_resources(struct snd_ff *ff) | ||
318 | { | ||
319 | __le32 reg; | ||
320 | unsigned int count; | ||
321 | unsigned int tx_isoc_channel; | ||
322 | int err; | ||
323 | |||
324 | reg = cpu_to_le32(ff->tx_stream.data_block_quadlets); | ||
325 | err = snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
326 | FF800_ALLOC_TX_STREAM, ®, sizeof(reg), 0); | ||
327 | if (err < 0) | ||
328 | return err; | ||
329 | |||
330 | // Wait till the format of tx packet is available. | ||
331 | count = 0; | ||
332 | while (count++ < 10) { | ||
333 | u32 data; | ||
334 | err = snd_fw_transaction(ff->unit, TCODE_READ_QUADLET_REQUEST, | ||
335 | FF800_TX_PACKET_ISOC_CH, ®, sizeof(reg), 0); | ||
336 | if (err < 0) | ||
337 | return err; | ||
338 | |||
339 | data = le32_to_cpu(reg); | ||
340 | if (data != 0xffffffff) { | ||
341 | tx_isoc_channel = data; | ||
342 | break; | ||
343 | } | ||
344 | |||
345 | msleep(50); | ||
346 | } | ||
347 | if (count >= 10) | ||
348 | return -ETIMEDOUT; | ||
349 | |||
350 | // NOTE: this is a makeshift to start OHCI 1394 IR context in the | ||
351 | // channel. On the other hand, 'struct fw_iso_resources.allocated' is | ||
352 | // not true and it's not deallocated at stop. | ||
353 | ff->tx_resources.channel = tx_isoc_channel; | ||
354 | |||
355 | return 0; | ||
356 | } | ||
357 | |||
358 | static int ff800_begin_session(struct snd_ff *ff, unsigned int rate) | ||
359 | { | ||
360 | __le32 reg; | ||
361 | int err; | ||
362 | |||
363 | reg = cpu_to_le32(rate); | ||
364 | err = snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
365 | FF800_STF, ®, sizeof(reg), 0); | ||
366 | if (err < 0) | ||
367 | return err; | ||
368 | |||
369 | // If starting isochronous communication immediately, change of STF has | ||
370 | // no effect. In this case, the communication runs based on former STF. | ||
371 | // Let's sleep for a bit. | ||
372 | msleep(100); | ||
373 | |||
374 | err = allocate_rx_resources(ff); | ||
375 | if (err < 0) | ||
376 | return err; | ||
377 | |||
378 | err = allocate_tx_resources(ff); | ||
379 | if (err < 0) | ||
380 | return err; | ||
381 | |||
382 | reg = cpu_to_le32(0x80000000); | ||
383 | reg |= cpu_to_le32(ff->tx_stream.data_block_quadlets); | ||
384 | if (fw_parent_device(ff->unit)->max_speed == SCODE_800) | ||
385 | reg |= cpu_to_le32(FF800_TX_S800_FLAG); | ||
386 | return snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
387 | FF800_ISOC_COMM_START, ®, sizeof(reg), 0); | ||
388 | } | ||
389 | |||
390 | static void ff800_finish_session(struct snd_ff *ff) | ||
391 | { | ||
392 | __le32 reg; | ||
393 | |||
394 | reg = cpu_to_le32(0x80000000); | ||
395 | snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
396 | FF800_ISOC_COMM_STOP, ®, sizeof(reg), 0); | ||
397 | } | ||
398 | |||
399 | // Fireface 800 doesn't allow drivers to register lower 4 bytes of destination | ||
400 | // address. | ||
401 | // A write transaction to clear registered higher 4 bytes of destination address | ||
402 | // has an effect to suppress asynchronous transaction from device. | ||
403 | static void ff800_handle_midi_msg(struct snd_ff *ff, unsigned int offset, | ||
404 | __le32 *buf, size_t length) | ||
405 | { | ||
406 | int i; | ||
407 | |||
408 | for (i = 0; i < length / 4; i++) { | ||
409 | u8 byte = le32_to_cpu(buf[i]) & 0xff; | ||
410 | struct snd_rawmidi_substream *substream; | ||
411 | |||
412 | substream = READ_ONCE(ff->tx_midi_substreams[0]); | ||
413 | if (substream) | ||
414 | snd_rawmidi_receive(substream, &byte, 1); | ||
415 | } | ||
416 | } | ||
417 | |||
418 | const struct snd_ff_protocol snd_ff_protocol_ff800 = { | ||
419 | .handle_midi_msg = ff800_handle_midi_msg, | ||
420 | .fill_midi_msg = former_fill_midi_msg, | ||
421 | .get_clock = former_get_clock, | ||
422 | .switch_fetching_mode = former_switch_fetching_mode, | ||
423 | .begin_session = ff800_begin_session, | ||
424 | .finish_session = ff800_finish_session, | ||
425 | .dump_status = former_dump_status, | ||
426 | }; | ||
427 | |||
428 | #define FF400_STF 0x000080100500ull | ||
429 | #define FF400_RX_PACKET_FORMAT 0x000080100504ull | ||
430 | #define FF400_ISOC_COMM_START 0x000080100508ull | ||
431 | #define FF400_TX_PACKET_FORMAT 0x00008010050cull | ||
432 | #define FF400_ISOC_COMM_STOP 0x000080100510ull | ||
433 | |||
434 | /* | ||
435 | * Fireface 400 manages isochronous channel number in 3 bit field. Therefore, | ||
436 | * we can allocate between 0 and 7 channel. | ||
437 | */ | ||
438 | static int keep_resources(struct snd_ff *ff, unsigned int rate) | ||
439 | { | ||
440 | enum snd_ff_stream_mode mode; | ||
441 | int i; | ||
442 | int err; | ||
443 | |||
444 | // Check whether the given value is supported or not. | ||
445 | for (i = 0; i < CIP_SFC_COUNT; i++) { | ||
446 | if (amdtp_rate_table[i] == rate) | ||
447 | break; | ||
448 | } | ||
449 | if (i >= CIP_SFC_COUNT) | ||
450 | return -EINVAL; | ||
451 | |||
452 | err = snd_ff_stream_get_multiplier_mode(i, &mode); | ||
453 | if (err < 0) | ||
454 | return err; | ||
455 | |||
456 | /* Keep resources for in-stream. */ | ||
457 | ff->tx_resources.channels_mask = 0x00000000000000ffuLL; | ||
458 | err = fw_iso_resources_allocate(&ff->tx_resources, | ||
459 | amdtp_stream_get_max_payload(&ff->tx_stream), | ||
460 | fw_parent_device(ff->unit)->max_speed); | ||
461 | if (err < 0) | ||
462 | return err; | ||
463 | |||
464 | /* Keep resources for out-stream. */ | ||
465 | ff->rx_resources.channels_mask = 0x00000000000000ffuLL; | ||
466 | err = fw_iso_resources_allocate(&ff->rx_resources, | ||
467 | amdtp_stream_get_max_payload(&ff->rx_stream), | ||
468 | fw_parent_device(ff->unit)->max_speed); | ||
469 | if (err < 0) | ||
470 | fw_iso_resources_free(&ff->tx_resources); | ||
471 | |||
472 | return err; | ||
473 | } | ||
474 | |||
475 | static int ff400_begin_session(struct snd_ff *ff, unsigned int rate) | ||
476 | { | ||
477 | __le32 reg; | ||
478 | int err; | ||
479 | |||
480 | err = keep_resources(ff, rate); | ||
481 | if (err < 0) | ||
482 | return err; | ||
483 | |||
484 | /* Set the number of data blocks transferred in a second. */ | ||
485 | reg = cpu_to_le32(rate); | ||
486 | err = snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
487 | FF400_STF, ®, sizeof(reg), 0); | ||
488 | if (err < 0) | ||
489 | return err; | ||
490 | |||
491 | msleep(100); | ||
492 | |||
493 | /* | ||
494 | * Set isochronous channel and the number of quadlets of received | ||
495 | * packets. | ||
496 | */ | ||
497 | reg = cpu_to_le32(((ff->rx_stream.data_block_quadlets << 3) << 8) | | ||
498 | ff->rx_resources.channel); | ||
499 | err = snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
500 | FF400_RX_PACKET_FORMAT, ®, sizeof(reg), 0); | ||
501 | if (err < 0) | ||
502 | return err; | ||
503 | |||
504 | /* | ||
505 | * Set isochronous channel and the number of quadlets of transmitted | ||
506 | * packet. | ||
507 | */ | ||
508 | /* TODO: investigate the purpose of this 0x80. */ | ||
509 | reg = cpu_to_le32((0x80 << 24) | | ||
510 | (ff->tx_resources.channel << 5) | | ||
511 | (ff->tx_stream.data_block_quadlets)); | ||
512 | err = snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
513 | FF400_TX_PACKET_FORMAT, ®, sizeof(reg), 0); | ||
514 | if (err < 0) | ||
515 | return err; | ||
516 | |||
517 | /* Allow to transmit packets. */ | ||
518 | reg = cpu_to_le32(0x00000001); | ||
519 | return snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
520 | FF400_ISOC_COMM_START, ®, sizeof(reg), 0); | ||
521 | } | ||
522 | |||
523 | static void ff400_finish_session(struct snd_ff *ff) | ||
524 | { | ||
525 | __le32 reg; | ||
526 | |||
527 | reg = cpu_to_le32(0x80000000); | ||
528 | snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
529 | FF400_ISOC_COMM_STOP, ®, sizeof(reg), 0); | ||
530 | } | ||
531 | |||
532 | // For Fireface 400, lower 4 bytes of destination address is configured by bit | ||
533 | // flag in quadlet register (little endian) at 0x'0000'801'0051c. Drivers can | ||
534 | // select one of 4 options: | ||
535 | // | ||
536 | // bit flags: offset of destination address | ||
537 | // - 0x04000000: 0x'....'....'0000'0000 | ||
538 | // - 0x08000000: 0x'....'....'0000'0080 | ||
539 | // - 0x10000000: 0x'....'....'0000'0100 | ||
540 | // - 0x20000000: 0x'....'....'0000'0180 | ||
541 | // | ||
542 | // Drivers can suppress the device to transfer asynchronous transactions by | ||
543 | // using below 2 bits. | ||
544 | // - 0x01000000: suppress transmission | ||
545 | // - 0x02000000: suppress transmission | ||
546 | // | ||
547 | // Actually, the register is write-only and includes the other options such as | ||
548 | // input attenuation. This driver allocates destination address with '0000'0000 | ||
549 | // in its lower offset and expects userspace application to configure the | ||
550 | // register for it. | ||
551 | static void ff400_handle_midi_msg(struct snd_ff *ff, unsigned int offset, | ||
552 | __le32 *buf, size_t length) | ||
553 | { | ||
554 | int i; | ||
555 | |||
556 | for (i = 0; i < length / 4; i++) { | ||
557 | u32 quad = le32_to_cpu(buf[i]); | ||
558 | u8 byte; | ||
559 | unsigned int index; | ||
560 | struct snd_rawmidi_substream *substream; | ||
561 | |||
562 | /* Message in first port. */ | ||
563 | /* | ||
564 | * This value may represent the index of this unit when the same | ||
565 | * units are on the same IEEE 1394 bus. This driver doesn't use | ||
566 | * it. | ||
567 | */ | ||
568 | index = (quad >> 8) & 0xff; | ||
569 | if (index > 0) { | ||
570 | substream = READ_ONCE(ff->tx_midi_substreams[0]); | ||
571 | if (substream != NULL) { | ||
572 | byte = quad & 0xff; | ||
573 | snd_rawmidi_receive(substream, &byte, 1); | ||
574 | } | ||
575 | } | ||
576 | |||
577 | /* Message in second port. */ | ||
578 | index = (quad >> 24) & 0xff; | ||
579 | if (index > 0) { | ||
580 | substream = READ_ONCE(ff->tx_midi_substreams[1]); | ||
581 | if (substream != NULL) { | ||
582 | byte = (quad >> 16) & 0xff; | ||
583 | snd_rawmidi_receive(substream, &byte, 1); | ||
584 | } | ||
585 | } | ||
586 | } | ||
587 | } | ||
588 | |||
589 | const struct snd_ff_protocol snd_ff_protocol_ff400 = { | ||
590 | .handle_midi_msg = ff400_handle_midi_msg, | ||
591 | .fill_midi_msg = former_fill_midi_msg, | ||
592 | .get_clock = former_get_clock, | ||
593 | .switch_fetching_mode = former_switch_fetching_mode, | ||
594 | .begin_session = ff400_begin_session, | ||
595 | .finish_session = ff400_finish_session, | ||
596 | .dump_status = former_dump_status, | ||
597 | }; | ||
diff --git a/sound/firewire/fireface/ff-protocol-latter.c b/sound/firewire/fireface/ff-protocol-latter.c new file mode 100644 index 000000000000..c8236ff89b7f --- /dev/null +++ b/sound/firewire/fireface/ff-protocol-latter.c | |||
@@ -0,0 +1,430 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
2 | // ff-protocol-latter - a part of driver for RME Fireface series | ||
3 | // | ||
4 | // Copyright (c) 2019 Takashi Sakamoto | ||
5 | // | ||
6 | // Licensed under the terms of the GNU General Public License, version 2. | ||
7 | |||
8 | #include <linux/delay.h> | ||
9 | |||
10 | #include "ff.h" | ||
11 | |||
12 | #define LATTER_STF 0xffff00000004 | ||
13 | #define LATTER_ISOC_CHANNELS 0xffff00000008 | ||
14 | #define LATTER_ISOC_START 0xffff0000000c | ||
15 | #define LATTER_FETCH_MODE 0xffff00000010 | ||
16 | #define LATTER_SYNC_STATUS 0x0000801c0000 | ||
17 | |||
18 | static int parse_clock_bits(u32 data, unsigned int *rate, | ||
19 | enum snd_ff_clock_src *src) | ||
20 | { | ||
21 | static const struct { | ||
22 | unsigned int rate; | ||
23 | u32 flag; | ||
24 | } *rate_entry, rate_entries[] = { | ||
25 | { 32000, 0x00000000, }, | ||
26 | { 44100, 0x01000000, }, | ||
27 | { 48000, 0x02000000, }, | ||
28 | { 64000, 0x04000000, }, | ||
29 | { 88200, 0x05000000, }, | ||
30 | { 96000, 0x06000000, }, | ||
31 | { 128000, 0x08000000, }, | ||
32 | { 176400, 0x09000000, }, | ||
33 | { 192000, 0x0a000000, }, | ||
34 | }; | ||
35 | static const struct { | ||
36 | enum snd_ff_clock_src src; | ||
37 | u32 flag; | ||
38 | } *clk_entry, clk_entries[] = { | ||
39 | { SND_FF_CLOCK_SRC_SPDIF, 0x00000200, }, | ||
40 | { SND_FF_CLOCK_SRC_ADAT1, 0x00000400, }, | ||
41 | { SND_FF_CLOCK_SRC_WORD, 0x00000600, }, | ||
42 | { SND_FF_CLOCK_SRC_INTERNAL, 0x00000e00, }, | ||
43 | }; | ||
44 | int i; | ||
45 | |||
46 | for (i = 0; i < ARRAY_SIZE(rate_entries); ++i) { | ||
47 | rate_entry = rate_entries + i; | ||
48 | if ((data & 0x0f000000) == rate_entry->flag) { | ||
49 | *rate = rate_entry->rate; | ||
50 | break; | ||
51 | } | ||
52 | } | ||
53 | if (i == ARRAY_SIZE(rate_entries)) | ||
54 | return -EIO; | ||
55 | |||
56 | for (i = 0; i < ARRAY_SIZE(clk_entries); ++i) { | ||
57 | clk_entry = clk_entries + i; | ||
58 | if ((data & 0x000e00) == clk_entry->flag) { | ||
59 | *src = clk_entry->src; | ||
60 | break; | ||
61 | } | ||
62 | } | ||
63 | if (i == ARRAY_SIZE(clk_entries)) | ||
64 | return -EIO; | ||
65 | |||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static int latter_get_clock(struct snd_ff *ff, unsigned int *rate, | ||
70 | enum snd_ff_clock_src *src) | ||
71 | { | ||
72 | __le32 reg; | ||
73 | u32 data; | ||
74 | int err; | ||
75 | |||
76 | err = snd_fw_transaction(ff->unit, TCODE_READ_QUADLET_REQUEST, | ||
77 | LATTER_SYNC_STATUS, ®, sizeof(reg), 0); | ||
78 | if (err < 0) | ||
79 | return err; | ||
80 | data = le32_to_cpu(reg); | ||
81 | |||
82 | return parse_clock_bits(data, rate, src); | ||
83 | } | ||
84 | |||
85 | static int latter_switch_fetching_mode(struct snd_ff *ff, bool enable) | ||
86 | { | ||
87 | u32 data; | ||
88 | __le32 reg; | ||
89 | |||
90 | if (enable) | ||
91 | data = 0x00000000; | ||
92 | else | ||
93 | data = 0xffffffff; | ||
94 | reg = cpu_to_le32(data); | ||
95 | |||
96 | return snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
97 | LATTER_FETCH_MODE, ®, sizeof(reg), 0); | ||
98 | } | ||
99 | |||
100 | static int keep_resources(struct snd_ff *ff, unsigned int rate) | ||
101 | { | ||
102 | enum snd_ff_stream_mode mode; | ||
103 | int i; | ||
104 | int err; | ||
105 | |||
106 | // Check whether the given value is supported or not. | ||
107 | for (i = 0; i < CIP_SFC_COUNT; i++) { | ||
108 | if (amdtp_rate_table[i] == rate) | ||
109 | break; | ||
110 | } | ||
111 | if (i >= CIP_SFC_COUNT) | ||
112 | return -EINVAL; | ||
113 | |||
114 | err = snd_ff_stream_get_multiplier_mode(i, &mode); | ||
115 | if (err < 0) | ||
116 | return err; | ||
117 | |||
118 | /* Keep resources for in-stream. */ | ||
119 | ff->tx_resources.channels_mask = 0x00000000000000ffuLL; | ||
120 | err = fw_iso_resources_allocate(&ff->tx_resources, | ||
121 | amdtp_stream_get_max_payload(&ff->tx_stream), | ||
122 | fw_parent_device(ff->unit)->max_speed); | ||
123 | if (err < 0) | ||
124 | return err; | ||
125 | |||
126 | /* Keep resources for out-stream. */ | ||
127 | ff->rx_resources.channels_mask = 0x00000000000000ffuLL; | ||
128 | err = fw_iso_resources_allocate(&ff->rx_resources, | ||
129 | amdtp_stream_get_max_payload(&ff->rx_stream), | ||
130 | fw_parent_device(ff->unit)->max_speed); | ||
131 | if (err < 0) | ||
132 | fw_iso_resources_free(&ff->tx_resources); | ||
133 | |||
134 | return err; | ||
135 | } | ||
136 | |||
137 | static int latter_begin_session(struct snd_ff *ff, unsigned int rate) | ||
138 | { | ||
139 | static const struct { | ||
140 | unsigned int stf; | ||
141 | unsigned int code; | ||
142 | unsigned int flag; | ||
143 | } *entry, rate_table[] = { | ||
144 | { 32000, 0x00, 0x92, }, | ||
145 | { 44100, 0x02, 0x92, }, | ||
146 | { 48000, 0x04, 0x92, }, | ||
147 | { 64000, 0x08, 0x8e, }, | ||
148 | { 88200, 0x0a, 0x8e, }, | ||
149 | { 96000, 0x0c, 0x8e, }, | ||
150 | { 128000, 0x10, 0x8c, }, | ||
151 | { 176400, 0x12, 0x8c, }, | ||
152 | { 192000, 0x14, 0x8c, }, | ||
153 | }; | ||
154 | u32 data; | ||
155 | __le32 reg; | ||
156 | unsigned int count; | ||
157 | int i; | ||
158 | int err; | ||
159 | |||
160 | for (i = 0; i < ARRAY_SIZE(rate_table); ++i) { | ||
161 | entry = rate_table + i; | ||
162 | if (entry->stf == rate) | ||
163 | break; | ||
164 | } | ||
165 | if (i == ARRAY_SIZE(rate_table)) | ||
166 | return -EINVAL; | ||
167 | |||
168 | reg = cpu_to_le32(entry->code); | ||
169 | err = snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
170 | LATTER_STF, ®, sizeof(reg), 0); | ||
171 | if (err < 0) | ||
172 | return err; | ||
173 | |||
174 | // Confirm to shift transmission clock. | ||
175 | count = 0; | ||
176 | while (count++ < 10) { | ||
177 | unsigned int curr_rate; | ||
178 | enum snd_ff_clock_src src; | ||
179 | |||
180 | err = latter_get_clock(ff, &curr_rate, &src); | ||
181 | if (err < 0) | ||
182 | return err; | ||
183 | |||
184 | if (curr_rate == rate) | ||
185 | break; | ||
186 | } | ||
187 | if (count == 10) | ||
188 | return -ETIMEDOUT; | ||
189 | |||
190 | err = keep_resources(ff, rate); | ||
191 | if (err < 0) | ||
192 | return err; | ||
193 | |||
194 | data = (ff->tx_resources.channel << 8) | ff->rx_resources.channel; | ||
195 | reg = cpu_to_le32(data); | ||
196 | err = snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
197 | LATTER_ISOC_CHANNELS, ®, sizeof(reg), 0); | ||
198 | if (err < 0) | ||
199 | return err; | ||
200 | |||
201 | // Always use the maximum number of data channels in data block of | ||
202 | // packet. | ||
203 | reg = cpu_to_le32(entry->flag); | ||
204 | return snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
205 | LATTER_ISOC_START, ®, sizeof(reg), 0); | ||
206 | } | ||
207 | |||
208 | static void latter_finish_session(struct snd_ff *ff) | ||
209 | { | ||
210 | __le32 reg; | ||
211 | |||
212 | reg = cpu_to_le32(0x00000000); | ||
213 | snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST, | ||
214 | LATTER_ISOC_START, ®, sizeof(reg), 0); | ||
215 | } | ||
216 | |||
217 | static void latter_dump_status(struct snd_ff *ff, struct snd_info_buffer *buffer) | ||
218 | { | ||
219 | static const struct { | ||
220 | char *const label; | ||
221 | u32 locked_mask; | ||
222 | u32 synced_mask; | ||
223 | } *clk_entry, clk_entries[] = { | ||
224 | { "S/PDIF", 0x00000001, 0x00000010, }, | ||
225 | { "ADAT", 0x00000002, 0x00000020, }, | ||
226 | { "WDClk", 0x00000004, 0x00000040, }, | ||
227 | }; | ||
228 | __le32 reg; | ||
229 | u32 data; | ||
230 | unsigned int rate; | ||
231 | enum snd_ff_clock_src src; | ||
232 | const char *label; | ||
233 | int i; | ||
234 | int err; | ||
235 | |||
236 | err = snd_fw_transaction(ff->unit, TCODE_READ_QUADLET_REQUEST, | ||
237 | LATTER_SYNC_STATUS, ®, sizeof(reg), 0); | ||
238 | if (err < 0) | ||
239 | return; | ||
240 | data = le32_to_cpu(reg); | ||
241 | |||
242 | snd_iprintf(buffer, "External source detection:\n"); | ||
243 | |||
244 | for (i = 0; i < ARRAY_SIZE(clk_entries); ++i) { | ||
245 | clk_entry = clk_entries + i; | ||
246 | snd_iprintf(buffer, "%s: ", clk_entry->label); | ||
247 | if (data & clk_entry->locked_mask) { | ||
248 | if (data & clk_entry->synced_mask) | ||
249 | snd_iprintf(buffer, "sync\n"); | ||
250 | else | ||
251 | snd_iprintf(buffer, "lock\n"); | ||
252 | } else { | ||
253 | snd_iprintf(buffer, "none\n"); | ||
254 | } | ||
255 | } | ||
256 | |||
257 | err = parse_clock_bits(data, &rate, &src); | ||
258 | if (err < 0) | ||
259 | return; | ||
260 | label = snd_ff_proc_get_clk_label(src); | ||
261 | if (!label) | ||
262 | return; | ||
263 | |||
264 | snd_iprintf(buffer, "Referred clock: %s %d\n", label, rate); | ||
265 | } | ||
266 | |||
267 | // NOTE: transactions are transferred within 0x00-0x7f in allocated range of | ||
268 | // address. This seems to be for check of discontinuity in receiver side. | ||
269 | // | ||
270 | // Like Fireface 400, drivers can select one of 4 options for lower 4 bytes of | ||
271 | // destination address by bit flags in quadlet register (little endian) at | ||
272 | // 0x'ffff'0000'0014: | ||
273 | // | ||
274 | // bit flags: offset of destination address | ||
275 | // - 0x00002000: 0x'....'....'0000'0000 | ||
276 | // - 0x00004000: 0x'....'....'0000'0080 | ||
277 | // - 0x00008000: 0x'....'....'0000'0100 | ||
278 | // - 0x00010000: 0x'....'....'0000'0180 | ||
279 | // | ||
280 | // Drivers can suppress the device to transfer asynchronous transactions by | ||
281 | // clear these bit flags. | ||
282 | // | ||
283 | // Actually, the register is write-only and includes the other settings such as | ||
284 | // input attenuation. This driver allocates for the first option | ||
285 | // (0x'....'....'0000'0000) and expects userspace application to configure the | ||
286 | // register for it. | ||
287 | static void latter_handle_midi_msg(struct snd_ff *ff, unsigned int offset, | ||
288 | __le32 *buf, size_t length) | ||
289 | { | ||
290 | u32 data = le32_to_cpu(*buf); | ||
291 | unsigned int index = (data & 0x000000f0) >> 4; | ||
292 | u8 byte[3]; | ||
293 | struct snd_rawmidi_substream *substream; | ||
294 | unsigned int len; | ||
295 | |||
296 | if (index >= ff->spec->midi_in_ports) | ||
297 | return; | ||
298 | |||
299 | switch (data & 0x0000000f) { | ||
300 | case 0x00000008: | ||
301 | case 0x00000009: | ||
302 | case 0x0000000a: | ||
303 | case 0x0000000b: | ||
304 | case 0x0000000e: | ||
305 | len = 3; | ||
306 | break; | ||
307 | case 0x0000000c: | ||
308 | case 0x0000000d: | ||
309 | len = 2; | ||
310 | break; | ||
311 | default: | ||
312 | len = data & 0x00000003; | ||
313 | if (len == 0) | ||
314 | len = 3; | ||
315 | break; | ||
316 | } | ||
317 | |||
318 | byte[0] = (data & 0x0000ff00) >> 8; | ||
319 | byte[1] = (data & 0x00ff0000) >> 16; | ||
320 | byte[2] = (data & 0xff000000) >> 24; | ||
321 | |||
322 | substream = READ_ONCE(ff->tx_midi_substreams[index]); | ||
323 | if (substream) | ||
324 | snd_rawmidi_receive(substream, byte, len); | ||
325 | } | ||
326 | |||
327 | /* | ||
328 | * When return minus value, given argument is not MIDI status. | ||
329 | * When return 0, given argument is a beginning of system exclusive. | ||
330 | * When return the others, given argument is MIDI data. | ||
331 | */ | ||
332 | static inline int calculate_message_bytes(u8 status) | ||
333 | { | ||
334 | switch (status) { | ||
335 | case 0xf6: /* Tune request. */ | ||
336 | case 0xf8: /* Timing clock. */ | ||
337 | case 0xfa: /* Start. */ | ||
338 | case 0xfb: /* Continue. */ | ||
339 | case 0xfc: /* Stop. */ | ||
340 | case 0xfe: /* Active sensing. */ | ||
341 | case 0xff: /* System reset. */ | ||
342 | return 1; | ||
343 | case 0xf1: /* MIDI time code quarter frame. */ | ||
344 | case 0xf3: /* Song select. */ | ||
345 | return 2; | ||
346 | case 0xf2: /* Song position pointer. */ | ||
347 | return 3; | ||
348 | case 0xf0: /* Exclusive. */ | ||
349 | return 0; | ||
350 | case 0xf7: /* End of exclusive. */ | ||
351 | break; | ||
352 | case 0xf4: /* Undefined. */ | ||
353 | case 0xf5: /* Undefined. */ | ||
354 | case 0xf9: /* Undefined. */ | ||
355 | case 0xfd: /* Undefined. */ | ||
356 | break; | ||
357 | default: | ||
358 | switch (status & 0xf0) { | ||
359 | case 0x80: /* Note on. */ | ||
360 | case 0x90: /* Note off. */ | ||
361 | case 0xa0: /* Polyphonic key pressure. */ | ||
362 | case 0xb0: /* Control change and Mode change. */ | ||
363 | case 0xe0: /* Pitch bend change. */ | ||
364 | return 3; | ||
365 | case 0xc0: /* Program change. */ | ||
366 | case 0xd0: /* Channel pressure. */ | ||
367 | return 2; | ||
368 | default: | ||
369 | break; | ||
370 | } | ||
371 | break; | ||
372 | } | ||
373 | |||
374 | return -EINVAL; | ||
375 | } | ||
376 | |||
377 | static int latter_fill_midi_msg(struct snd_ff *ff, | ||
378 | struct snd_rawmidi_substream *substream, | ||
379 | unsigned int port) | ||
380 | { | ||
381 | u32 data = {0}; | ||
382 | u8 *buf = (u8 *)&data; | ||
383 | int consumed; | ||
384 | |||
385 | buf[0] = port << 4; | ||
386 | consumed = snd_rawmidi_transmit_peek(substream, buf + 1, 3); | ||
387 | if (consumed <= 0) | ||
388 | return consumed; | ||
389 | |||
390 | if (!ff->on_sysex[port]) { | ||
391 | if (buf[1] != 0xf0) { | ||
392 | if (consumed < calculate_message_bytes(buf[1])) | ||
393 | return 0; | ||
394 | } else { | ||
395 | // The beginning of exclusives. | ||
396 | ff->on_sysex[port] = true; | ||
397 | } | ||
398 | |||
399 | buf[0] |= consumed; | ||
400 | } else { | ||
401 | if (buf[1] != 0xf7) { | ||
402 | if (buf[2] == 0xf7 || buf[3] == 0xf7) { | ||
403 | // Transfer end code at next time. | ||
404 | consumed -= 1; | ||
405 | } | ||
406 | |||
407 | buf[0] |= consumed; | ||
408 | } else { | ||
409 | // The end of exclusives. | ||
410 | ff->on_sysex[port] = false; | ||
411 | consumed = 1; | ||
412 | buf[0] |= 0x0f; | ||
413 | } | ||
414 | } | ||
415 | |||
416 | ff->msg_buf[port][0] = cpu_to_le32(data); | ||
417 | ff->rx_bytes[port] = consumed; | ||
418 | |||
419 | return 1; | ||
420 | } | ||
421 | |||
422 | const struct snd_ff_protocol snd_ff_protocol_latter = { | ||
423 | .handle_midi_msg = latter_handle_midi_msg, | ||
424 | .fill_midi_msg = latter_fill_midi_msg, | ||
425 | .get_clock = latter_get_clock, | ||
426 | .switch_fetching_mode = latter_switch_fetching_mode, | ||
427 | .begin_session = latter_begin_session, | ||
428 | .finish_session = latter_finish_session, | ||
429 | .dump_status = latter_dump_status, | ||
430 | }; | ||
diff --git a/sound/firewire/fireface/ff-stream.c b/sound/firewire/fireface/ff-stream.c index a490e4553721..a8a90f1ae09e 100644 --- a/sound/firewire/fireface/ff-stream.c +++ b/sound/firewire/fireface/ff-stream.c | |||
@@ -37,44 +37,10 @@ static void release_resources(struct snd_ff *ff) | |||
37 | fw_iso_resources_free(&ff->rx_resources); | 37 | fw_iso_resources_free(&ff->rx_resources); |
38 | } | 38 | } |
39 | 39 | ||
40 | static int switch_fetching_mode(struct snd_ff *ff, bool enable) | ||
41 | { | ||
42 | unsigned int count; | ||
43 | __le32 *reg; | ||
44 | int i; | ||
45 | int err; | ||
46 | |||
47 | count = 0; | ||
48 | for (i = 0; i < SND_FF_STREAM_MODE_COUNT; ++i) | ||
49 | count = max(count, ff->spec->pcm_playback_channels[i]); | ||
50 | |||
51 | reg = kcalloc(count, sizeof(__le32), GFP_KERNEL); | ||
52 | if (!reg) | ||
53 | return -ENOMEM; | ||
54 | |||
55 | if (!enable) { | ||
56 | /* | ||
57 | * Each quadlet is corresponding to data channels in a data | ||
58 | * blocks in reverse order. Precisely, quadlets for available | ||
59 | * data channels should be enabled. Here, I take second best | ||
60 | * to fetch PCM frames from all of data channels regardless of | ||
61 | * stf. | ||
62 | */ | ||
63 | for (i = 0; i < count; ++i) | ||
64 | reg[i] = cpu_to_le32(0x00000001); | ||
65 | } | ||
66 | |||
67 | err = snd_fw_transaction(ff->unit, TCODE_WRITE_BLOCK_REQUEST, | ||
68 | SND_FF_REG_FETCH_PCM_FRAMES, reg, | ||
69 | sizeof(__le32) * count, 0); | ||
70 | kfree(reg); | ||
71 | return err; | ||
72 | } | ||
73 | |||
74 | static inline void finish_session(struct snd_ff *ff) | 40 | static inline void finish_session(struct snd_ff *ff) |
75 | { | 41 | { |
76 | ff->spec->protocol->finish_session(ff); | 42 | ff->spec->protocol->finish_session(ff); |
77 | switch_fetching_mode(ff, false); | 43 | ff->spec->protocol->switch_fetching_mode(ff, false); |
78 | } | 44 | } |
79 | 45 | ||
80 | static int init_stream(struct snd_ff *ff, enum amdtp_stream_direction dir) | 46 | static int init_stream(struct snd_ff *ff, enum amdtp_stream_direction dir) |
@@ -147,7 +113,7 @@ int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate) | |||
147 | if (ff->substreams_counter == 0) | 113 | if (ff->substreams_counter == 0) |
148 | return 0; | 114 | return 0; |
149 | 115 | ||
150 | err = snd_ff_transaction_get_clock(ff, &curr_rate, &src); | 116 | err = ff->spec->protocol->get_clock(ff, &curr_rate, &src); |
151 | if (err < 0) | 117 | if (err < 0) |
152 | return err; | 118 | return err; |
153 | if (curr_rate != rate || | 119 | if (curr_rate != rate || |
@@ -206,7 +172,7 @@ int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate) | |||
206 | goto error; | 172 | goto error; |
207 | } | 173 | } |
208 | 174 | ||
209 | err = switch_fetching_mode(ff, true); | 175 | err = ff->spec->protocol->switch_fetching_mode(ff, true); |
210 | if (err < 0) | 176 | if (err < 0) |
211 | goto error; | 177 | goto error; |
212 | } | 178 | } |
diff --git a/sound/firewire/fireface/ff-transaction.c b/sound/firewire/fireface/ff-transaction.c index 5f4ddfd55403..0d6ad19363b8 100644 --- a/sound/firewire/fireface/ff-transaction.c +++ b/sound/firewire/fireface/ff-transaction.c | |||
@@ -8,72 +8,6 @@ | |||
8 | 8 | ||
9 | #include "ff.h" | 9 | #include "ff.h" |
10 | 10 | ||
11 | #define SND_FF_REG_MIDI_RX_PORT_0 0x000080180000ull | ||
12 | #define SND_FF_REG_MIDI_RX_PORT_1 0x000080190000ull | ||
13 | |||
14 | int snd_ff_transaction_get_clock(struct snd_ff *ff, unsigned int *rate, | ||
15 | enum snd_ff_clock_src *src) | ||
16 | { | ||
17 | __le32 reg; | ||
18 | u32 data; | ||
19 | int err; | ||
20 | |||
21 | err = snd_fw_transaction(ff->unit, TCODE_READ_QUADLET_REQUEST, | ||
22 | SND_FF_REG_CLOCK_CONFIG, ®, sizeof(reg), 0); | ||
23 | if (err < 0) | ||
24 | return err; | ||
25 | data = le32_to_cpu(reg); | ||
26 | |||
27 | /* Calculate sampling rate. */ | ||
28 | switch ((data >> 1) & 0x03) { | ||
29 | case 0x01: | ||
30 | *rate = 32000; | ||
31 | break; | ||
32 | case 0x00: | ||
33 | *rate = 44100; | ||
34 | break; | ||
35 | case 0x03: | ||
36 | *rate = 48000; | ||
37 | break; | ||
38 | case 0x02: | ||
39 | default: | ||
40 | return -EIO; | ||
41 | } | ||
42 | |||
43 | if (data & 0x08) | ||
44 | *rate *= 2; | ||
45 | else if (data & 0x10) | ||
46 | *rate *= 4; | ||
47 | |||
48 | /* Calculate source of clock. */ | ||
49 | if (data & 0x01) { | ||
50 | *src = SND_FF_CLOCK_SRC_INTERNAL; | ||
51 | } else { | ||
52 | /* TODO: 0x02, 0x06, 0x07? */ | ||
53 | switch ((data >> 10) & 0x07) { | ||
54 | case 0x00: | ||
55 | *src = SND_FF_CLOCK_SRC_ADAT1; | ||
56 | break; | ||
57 | case 0x01: | ||
58 | *src = SND_FF_CLOCK_SRC_ADAT2; | ||
59 | break; | ||
60 | case 0x03: | ||
61 | *src = SND_FF_CLOCK_SRC_SPDIF; | ||
62 | break; | ||
63 | case 0x04: | ||
64 | *src = SND_FF_CLOCK_SRC_WORD; | ||
65 | break; | ||
66 | case 0x05: | ||
67 | *src = SND_FF_CLOCK_SRC_LTC; | ||
68 | break; | ||
69 | default: | ||
70 | return -EIO; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static void finish_transmit_midi_msg(struct snd_ff *ff, unsigned int port, | 11 | static void finish_transmit_midi_msg(struct snd_ff *ff, unsigned int port, |
78 | int rcode) | 12 | int rcode) |
79 | { | 13 | { |
@@ -117,23 +51,17 @@ static void finish_transmit_midi1_msg(struct fw_card *card, int rcode, | |||
117 | finish_transmit_midi_msg(ff, 1, rcode); | 51 | finish_transmit_midi_msg(ff, 1, rcode); |
118 | } | 52 | } |
119 | 53 | ||
120 | static inline void fill_midi_buf(struct snd_ff *ff, unsigned int port, | ||
121 | unsigned int index, u8 byte) | ||
122 | { | ||
123 | ff->msg_buf[port][index] = cpu_to_le32(byte); | ||
124 | } | ||
125 | |||
126 | static void transmit_midi_msg(struct snd_ff *ff, unsigned int port) | 54 | static void transmit_midi_msg(struct snd_ff *ff, unsigned int port) |
127 | { | 55 | { |
128 | struct snd_rawmidi_substream *substream = | 56 | struct snd_rawmidi_substream *substream = |
129 | READ_ONCE(ff->rx_midi_substreams[port]); | 57 | READ_ONCE(ff->rx_midi_substreams[port]); |
130 | u8 *buf = (u8 *)ff->msg_buf[port]; | 58 | int quad_count; |
131 | int i, len; | ||
132 | 59 | ||
133 | struct fw_device *fw_dev = fw_parent_device(ff->unit); | 60 | struct fw_device *fw_dev = fw_parent_device(ff->unit); |
134 | unsigned long long addr; | 61 | unsigned long long addr; |
135 | int generation; | 62 | int generation; |
136 | fw_transaction_callback_t callback; | 63 | fw_transaction_callback_t callback; |
64 | int tcode; | ||
137 | 65 | ||
138 | if (substream == NULL || snd_rawmidi_transmit_empty(substream)) | 66 | if (substream == NULL || snd_rawmidi_transmit_empty(substream)) |
139 | return; | 67 | return; |
@@ -147,26 +75,26 @@ static void transmit_midi_msg(struct snd_ff *ff, unsigned int port) | |||
147 | return; | 75 | return; |
148 | } | 76 | } |
149 | 77 | ||
150 | len = snd_rawmidi_transmit_peek(substream, buf, | 78 | quad_count = ff->spec->protocol->fill_midi_msg(ff, substream, port); |
151 | SND_FF_MAXIMIM_MIDI_QUADS); | 79 | if (quad_count <= 0) |
152 | if (len <= 0) | ||
153 | return; | 80 | return; |
154 | 81 | ||
155 | for (i = len - 1; i >= 0; i--) | ||
156 | fill_midi_buf(ff, port, i, buf[i]); | ||
157 | |||
158 | if (port == 0) { | 82 | if (port == 0) { |
159 | addr = SND_FF_REG_MIDI_RX_PORT_0; | 83 | addr = ff->spec->midi_rx_addrs[0]; |
160 | callback = finish_transmit_midi0_msg; | 84 | callback = finish_transmit_midi0_msg; |
161 | } else { | 85 | } else { |
162 | addr = SND_FF_REG_MIDI_RX_PORT_1; | 86 | addr = ff->spec->midi_rx_addrs[1]; |
163 | callback = finish_transmit_midi1_msg; | 87 | callback = finish_transmit_midi1_msg; |
164 | } | 88 | } |
165 | 89 | ||
166 | /* Set interval to next transaction. */ | 90 | /* Set interval to next transaction. */ |
167 | ff->next_ktime[port] = ktime_add_ns(ktime_get(), | 91 | ff->next_ktime[port] = ktime_add_ns(ktime_get(), |
168 | len * 8 * NSEC_PER_SEC / 31250); | 92 | ff->rx_bytes[port] * 8 * NSEC_PER_SEC / 31250); |
169 | ff->rx_bytes[port] = len; | 93 | |
94 | if (quad_count == 1) | ||
95 | tcode = TCODE_WRITE_QUADLET_REQUEST; | ||
96 | else | ||
97 | tcode = TCODE_WRITE_BLOCK_REQUEST; | ||
170 | 98 | ||
171 | /* | 99 | /* |
172 | * In Linux FireWire core, when generation is updated with memory | 100 | * In Linux FireWire core, when generation is updated with memory |
@@ -178,10 +106,9 @@ static void transmit_midi_msg(struct snd_ff *ff, unsigned int port) | |||
178 | */ | 106 | */ |
179 | generation = fw_dev->generation; | 107 | generation = fw_dev->generation; |
180 | smp_rmb(); | 108 | smp_rmb(); |
181 | fw_send_request(fw_dev->card, &ff->transactions[port], | 109 | fw_send_request(fw_dev->card, &ff->transactions[port], tcode, |
182 | TCODE_WRITE_BLOCK_REQUEST, | ||
183 | fw_dev->node_id, generation, fw_dev->max_speed, | 110 | fw_dev->node_id, generation, fw_dev->max_speed, |
184 | addr, &ff->msg_buf[port], len * 4, | 111 | addr, &ff->msg_buf[port], quad_count * 4, |
185 | callback, &ff->transactions[port]); | 112 | callback, &ff->transactions[port]); |
186 | } | 113 | } |
187 | 114 | ||
@@ -209,7 +136,9 @@ static void handle_midi_msg(struct fw_card *card, struct fw_request *request, | |||
209 | 136 | ||
210 | fw_send_response(card, request, RCODE_COMPLETE); | 137 | fw_send_response(card, request, RCODE_COMPLETE); |
211 | 138 | ||
212 | ff->spec->protocol->handle_midi_msg(ff, buf, length); | 139 | offset -= ff->async_handler.offset; |
140 | ff->spec->protocol->handle_midi_msg(ff, (unsigned int)offset, buf, | ||
141 | length); | ||
213 | } | 142 | } |
214 | 143 | ||
215 | static int allocate_own_address(struct snd_ff *ff, int i) | 144 | static int allocate_own_address(struct snd_ff *ff, int i) |
@@ -217,7 +146,7 @@ static int allocate_own_address(struct snd_ff *ff, int i) | |||
217 | struct fw_address_region midi_msg_region; | 146 | struct fw_address_region midi_msg_region; |
218 | int err; | 147 | int err; |
219 | 148 | ||
220 | ff->async_handler.length = SND_FF_MAXIMIM_MIDI_QUADS * 4; | 149 | ff->async_handler.length = ff->spec->midi_addr_range; |
221 | ff->async_handler.address_callback = handle_midi_msg; | 150 | ff->async_handler.address_callback = handle_midi_msg; |
222 | ff->async_handler.callback_data = ff; | 151 | ff->async_handler.callback_data = ff; |
223 | 152 | ||
@@ -236,35 +165,13 @@ static int allocate_own_address(struct snd_ff *ff, int i) | |||
236 | return err; | 165 | return err; |
237 | } | 166 | } |
238 | 167 | ||
239 | /* | 168 | // Controllers are allowed to register higher 4 bytes of destination address to |
240 | * Controllers are allowed to register higher 4 bytes of address to receive | 169 | // receive asynchronous transactions for MIDI messages, while the way to |
241 | * the transactions. Different models have different registers for this purpose; | 170 | // register lower 4 bytes of address is different depending on protocols. For |
242 | * e.g. 0x'0000'8010'03f4 for Fireface 400. | 171 | // details, please refer to comments in protocol implementations. |
243 | * The controllers are not allowed to register lower 4 bytes of the address. | 172 | // |
244 | * They are forced to select one of 4 options for the part of address by writing | 173 | // This driver expects userspace applications to configure registers for the |
245 | * corresponding bits to 0x'0000'8010'051f. | 174 | // lower address because in most cases such registers has the other settings. |
246 | * | ||
247 | * The 3rd-6th bits of this register are flags to indicate lower 4 bytes of | ||
248 | * address to which the device transferrs the transactions. In short: | ||
249 | * - 0x20: 0x'....'....'0000'0180 | ||
250 | * - 0x10: 0x'....'....'0000'0100 | ||
251 | * - 0x08: 0x'....'....'0000'0080 | ||
252 | * - 0x04: 0x'....'....'0000'0000 | ||
253 | * | ||
254 | * This driver configure 0x'....'....'0000'0000 to receive MIDI messages from | ||
255 | * units. The 3rd bit of the register should be configured, however this driver | ||
256 | * deligates this task to userspace applications due to a restriction that this | ||
257 | * register is write-only and the other bits have own effects. | ||
258 | * | ||
259 | * Unlike Fireface 800, Fireface 400 cancels transferring asynchronous | ||
260 | * transactions when the 1st and 2nd of the register stand. These two bits have | ||
261 | * the same effect. | ||
262 | * - 0x02, 0x01: cancel transferring | ||
263 | * | ||
264 | * On the other hand, the bits have no effect on Fireface 800. This model | ||
265 | * cancels asynchronous transactions when the higher 4 bytes of address is | ||
266 | * overwritten with zero. | ||
267 | */ | ||
268 | int snd_ff_transaction_reregister(struct snd_ff *ff) | 175 | int snd_ff_transaction_reregister(struct snd_ff *ff) |
269 | { | 176 | { |
270 | struct fw_card *fw_card = fw_parent_device(ff->unit)->card; | 177 | struct fw_card *fw_card = fw_parent_device(ff->unit)->card; |
diff --git a/sound/firewire/fireface/ff.c b/sound/firewire/fireface/ff.c index 36575f4159d1..a9611157f4c8 100644 --- a/sound/firewire/fireface/ff.c +++ b/sound/firewire/fireface/ff.c | |||
@@ -153,6 +153,8 @@ static const struct snd_ff_spec spec_ff800 = { | |||
153 | .midi_out_ports = 1, | 153 | .midi_out_ports = 1, |
154 | .protocol = &snd_ff_protocol_ff800, | 154 | .protocol = &snd_ff_protocol_ff800, |
155 | .midi_high_addr = 0x000200000320ull, | 155 | .midi_high_addr = 0x000200000320ull, |
156 | .midi_addr_range = 12, | ||
157 | .midi_rx_addrs = {0x000080180000ull, 0}, | ||
156 | }; | 158 | }; |
157 | 159 | ||
158 | static const struct snd_ff_spec spec_ff400 = { | 160 | static const struct snd_ff_spec spec_ff400 = { |
@@ -163,6 +165,20 @@ static const struct snd_ff_spec spec_ff400 = { | |||
163 | .midi_out_ports = 2, | 165 | .midi_out_ports = 2, |
164 | .protocol = &snd_ff_protocol_ff400, | 166 | .protocol = &snd_ff_protocol_ff400, |
165 | .midi_high_addr = 0x0000801003f4ull, | 167 | .midi_high_addr = 0x0000801003f4ull, |
168 | .midi_addr_range = SND_FF_MAXIMIM_MIDI_QUADS * 4, | ||
169 | .midi_rx_addrs = {0x000080180000ull, 0x000080190000ull}, | ||
170 | }; | ||
171 | |||
172 | static const struct snd_ff_spec spec_ucx = { | ||
173 | .name = "FirefaceUCX", | ||
174 | .pcm_capture_channels = {18, 14, 12}, | ||
175 | .pcm_playback_channels = {18, 14, 12}, | ||
176 | .midi_in_ports = 2, | ||
177 | .midi_out_ports = 2, | ||
178 | .protocol = &snd_ff_protocol_latter, | ||
179 | .midi_high_addr = 0xffff00000034ull, | ||
180 | .midi_addr_range = 0x80, | ||
181 | .midi_rx_addrs = {0xffff00000030ull, 0xffff00000030ull}, | ||
166 | }; | 182 | }; |
167 | 183 | ||
168 | static const struct ieee1394_device_id snd_ff_id_table[] = { | 184 | static const struct ieee1394_device_id snd_ff_id_table[] = { |
@@ -190,6 +206,18 @@ static const struct ieee1394_device_id snd_ff_id_table[] = { | |||
190 | .model_id = 0x101800, | 206 | .model_id = 0x101800, |
191 | .driver_data = (kernel_ulong_t)&spec_ff400, | 207 | .driver_data = (kernel_ulong_t)&spec_ff400, |
192 | }, | 208 | }, |
209 | // Fireface UCX. | ||
210 | { | ||
211 | .match_flags = IEEE1394_MATCH_VENDOR_ID | | ||
212 | IEEE1394_MATCH_SPECIFIER_ID | | ||
213 | IEEE1394_MATCH_VERSION | | ||
214 | IEEE1394_MATCH_MODEL_ID, | ||
215 | .vendor_id = OUI_RME, | ||
216 | .specifier_id = OUI_RME, | ||
217 | .version = 0x000004, | ||
218 | .model_id = 0x101800, | ||
219 | .driver_data = (kernel_ulong_t)&spec_ucx, | ||
220 | }, | ||
193 | {} | 221 | {} |
194 | }; | 222 | }; |
195 | MODULE_DEVICE_TABLE(ieee1394, snd_ff_id_table); | 223 | MODULE_DEVICE_TABLE(ieee1394, snd_ff_id_table); |
diff --git a/sound/firewire/fireface/ff.h b/sound/firewire/fireface/ff.h index 7dfc7745a914..ed8fea0ff5e1 100644 --- a/sound/firewire/fireface/ff.h +++ b/sound/firewire/fireface/ff.h | |||
@@ -35,11 +35,6 @@ | |||
35 | #define SND_FF_IN_MIDI_PORTS 2 | 35 | #define SND_FF_IN_MIDI_PORTS 2 |
36 | #define SND_FF_OUT_MIDI_PORTS 2 | 36 | #define SND_FF_OUT_MIDI_PORTS 2 |
37 | 37 | ||
38 | #define SND_FF_REG_SYNC_STATUS 0x0000801c0000ull | ||
39 | /* For block write request. */ | ||
40 | #define SND_FF_REG_FETCH_PCM_FRAMES 0x0000801c0000ull | ||
41 | #define SND_FF_REG_CLOCK_CONFIG 0x0000801c0004ull | ||
42 | |||
43 | enum snd_ff_stream_mode { | 38 | enum snd_ff_stream_mode { |
44 | SND_FF_STREAM_MODE_LOW = 0, | 39 | SND_FF_STREAM_MODE_LOW = 0, |
45 | SND_FF_STREAM_MODE_MID, | 40 | SND_FF_STREAM_MODE_MID, |
@@ -59,6 +54,8 @@ struct snd_ff_spec { | |||
59 | 54 | ||
60 | const struct snd_ff_protocol *protocol; | 55 | const struct snd_ff_protocol *protocol; |
61 | u64 midi_high_addr; | 56 | u64 midi_high_addr; |
57 | u8 midi_addr_range; | ||
58 | u64 midi_rx_addrs[SND_FF_OUT_MIDI_PORTS]; | ||
62 | }; | 59 | }; |
63 | 60 | ||
64 | struct snd_ff { | 61 | struct snd_ff { |
@@ -78,7 +75,7 @@ struct snd_ff { | |||
78 | 75 | ||
79 | /* TO handle MIDI rx. */ | 76 | /* TO handle MIDI rx. */ |
80 | struct snd_rawmidi_substream *rx_midi_substreams[SND_FF_OUT_MIDI_PORTS]; | 77 | struct snd_rawmidi_substream *rx_midi_substreams[SND_FF_OUT_MIDI_PORTS]; |
81 | u8 running_status[SND_FF_OUT_MIDI_PORTS]; | 78 | bool on_sysex[SND_FF_OUT_MIDI_PORTS]; |
82 | __le32 msg_buf[SND_FF_OUT_MIDI_PORTS][SND_FF_MAXIMIM_MIDI_QUADS]; | 79 | __le32 msg_buf[SND_FF_OUT_MIDI_PORTS][SND_FF_MAXIMIM_MIDI_QUADS]; |
83 | struct work_struct rx_midi_work[SND_FF_OUT_MIDI_PORTS]; | 80 | struct work_struct rx_midi_work[SND_FF_OUT_MIDI_PORTS]; |
84 | struct fw_transaction transactions[SND_FF_OUT_MIDI_PORTS]; | 81 | struct fw_transaction transactions[SND_FF_OUT_MIDI_PORTS]; |
@@ -108,16 +105,23 @@ enum snd_ff_clock_src { | |||
108 | }; | 105 | }; |
109 | 106 | ||
110 | struct snd_ff_protocol { | 107 | struct snd_ff_protocol { |
111 | void (*handle_midi_msg)(struct snd_ff *ff, __le32 *buf, size_t length); | 108 | void (*handle_midi_msg)(struct snd_ff *ff, unsigned int offset, |
109 | __le32 *buf, size_t length); | ||
110 | int (*fill_midi_msg)(struct snd_ff *ff, | ||
111 | struct snd_rawmidi_substream *substream, | ||
112 | unsigned int port); | ||
113 | int (*get_clock)(struct snd_ff *ff, unsigned int *rate, | ||
114 | enum snd_ff_clock_src *src); | ||
115 | int (*switch_fetching_mode)(struct snd_ff *ff, bool enable); | ||
112 | int (*begin_session)(struct snd_ff *ff, unsigned int rate); | 116 | int (*begin_session)(struct snd_ff *ff, unsigned int rate); |
113 | void (*finish_session)(struct snd_ff *ff); | 117 | void (*finish_session)(struct snd_ff *ff); |
118 | void (*dump_status)(struct snd_ff *ff, struct snd_info_buffer *buffer); | ||
114 | }; | 119 | }; |
115 | 120 | ||
116 | extern const struct snd_ff_protocol snd_ff_protocol_ff800; | 121 | extern const struct snd_ff_protocol snd_ff_protocol_ff800; |
117 | extern const struct snd_ff_protocol snd_ff_protocol_ff400; | 122 | extern const struct snd_ff_protocol snd_ff_protocol_ff400; |
123 | extern const struct snd_ff_protocol snd_ff_protocol_latter; | ||
118 | 124 | ||
119 | int snd_ff_transaction_get_clock(struct snd_ff *ff, unsigned int *rate, | ||
120 | enum snd_ff_clock_src *src); | ||
121 | int snd_ff_transaction_register(struct snd_ff *ff); | 125 | int snd_ff_transaction_register(struct snd_ff *ff); |
122 | int snd_ff_transaction_reregister(struct snd_ff *ff); | 126 | int snd_ff_transaction_reregister(struct snd_ff *ff); |
123 | void snd_ff_transaction_unregister(struct snd_ff *ff); | 127 | void snd_ff_transaction_unregister(struct snd_ff *ff); |
@@ -142,6 +146,7 @@ int snd_ff_stream_lock_try(struct snd_ff *ff); | |||
142 | void snd_ff_stream_lock_release(struct snd_ff *ff); | 146 | void snd_ff_stream_lock_release(struct snd_ff *ff); |
143 | 147 | ||
144 | void snd_ff_proc_init(struct snd_ff *ff); | 148 | void snd_ff_proc_init(struct snd_ff *ff); |
149 | const char *snd_ff_proc_get_clk_label(enum snd_ff_clock_src src); | ||
145 | 150 | ||
146 | int snd_ff_create_midi_devices(struct snd_ff *ff); | 151 | int snd_ff_create_midi_devices(struct snd_ff *ff); |
147 | 152 | ||
diff --git a/sound/firewire/fireworks/fireworks_proc.c b/sound/firewire/fireworks/fireworks_proc.c index 779ecec5af62..9fa5c34a9572 100644 --- a/sound/firewire/fireworks/fireworks_proc.c +++ b/sound/firewire/fireworks/fireworks_proc.c | |||
@@ -199,12 +199,8 @@ add_node(struct snd_efw *efw, struct snd_info_entry *root, const char *name, | |||
199 | struct snd_info_entry *entry; | 199 | struct snd_info_entry *entry; |
200 | 200 | ||
201 | entry = snd_info_create_card_entry(efw->card, name, root); | 201 | entry = snd_info_create_card_entry(efw->card, name, root); |
202 | if (entry == NULL) | 202 | if (entry) |
203 | return; | 203 | snd_info_set_text_ops(entry, efw, op); |
204 | |||
205 | snd_info_set_text_ops(entry, efw, op); | ||
206 | if (snd_info_register(entry) < 0) | ||
207 | snd_info_free_entry(entry); | ||
208 | } | 204 | } |
209 | 205 | ||
210 | void snd_efw_proc_init(struct snd_efw *efw) | 206 | void snd_efw_proc_init(struct snd_efw *efw) |
@@ -220,10 +216,6 @@ void snd_efw_proc_init(struct snd_efw *efw) | |||
220 | if (root == NULL) | 216 | if (root == NULL) |
221 | return; | 217 | return; |
222 | root->mode = S_IFDIR | 0555; | 218 | root->mode = S_IFDIR | 0555; |
223 | if (snd_info_register(root) < 0) { | ||
224 | snd_info_free_entry(root); | ||
225 | return; | ||
226 | } | ||
227 | 219 | ||
228 | add_node(efw, root, "clock", proc_read_clock); | 220 | add_node(efw, root, "clock", proc_read_clock); |
229 | add_node(efw, root, "firmware", proc_read_hwinfo); | 221 | add_node(efw, root, "firmware", proc_read_hwinfo); |
diff --git a/sound/firewire/motu/amdtp-motu.c b/sound/firewire/motu/amdtp-motu.c index f0555a24d90e..6c9b743ea74b 100644 --- a/sound/firewire/motu/amdtp-motu.c +++ b/sound/firewire/motu/amdtp-motu.c | |||
@@ -136,7 +136,9 @@ static void read_pcm_s32(struct amdtp_stream *s, | |||
136 | byte = (u8 *)buffer + p->pcm_byte_offset; | 136 | byte = (u8 *)buffer + p->pcm_byte_offset; |
137 | 137 | ||
138 | for (c = 0; c < channels; ++c) { | 138 | for (c = 0; c < channels; ++c) { |
139 | *dst = (byte[0] << 24) | (byte[1] << 16) | byte[2]; | 139 | *dst = (byte[0] << 24) | |
140 | (byte[1] << 16) | | ||
141 | (byte[2] << 8); | ||
140 | byte += 3; | 142 | byte += 3; |
141 | dst++; | 143 | dst++; |
142 | } | 144 | } |
diff --git a/sound/firewire/motu/motu-proc.c b/sound/firewire/motu/motu-proc.c index ab6830a6d242..94327853620a 100644 --- a/sound/firewire/motu/motu-proc.c +++ b/sound/firewire/motu/motu-proc.c | |||
@@ -87,12 +87,8 @@ static void add_node(struct snd_motu *motu, struct snd_info_entry *root, | |||
87 | struct snd_info_entry *entry; | 87 | struct snd_info_entry *entry; |
88 | 88 | ||
89 | entry = snd_info_create_card_entry(motu->card, name, root); | 89 | entry = snd_info_create_card_entry(motu->card, name, root); |
90 | if (entry == NULL) | 90 | if (entry) |
91 | return; | 91 | snd_info_set_text_ops(entry, motu, op); |
92 | |||
93 | snd_info_set_text_ops(entry, motu, op); | ||
94 | if (snd_info_register(entry) < 0) | ||
95 | snd_info_free_entry(entry); | ||
96 | } | 92 | } |
97 | 93 | ||
98 | void snd_motu_proc_init(struct snd_motu *motu) | 94 | void snd_motu_proc_init(struct snd_motu *motu) |
@@ -108,10 +104,6 @@ void snd_motu_proc_init(struct snd_motu *motu) | |||
108 | if (root == NULL) | 104 | if (root == NULL) |
109 | return; | 105 | return; |
110 | root->mode = S_IFDIR | 0555; | 106 | root->mode = S_IFDIR | 0555; |
111 | if (snd_info_register(root) < 0) { | ||
112 | snd_info_free_entry(root); | ||
113 | return; | ||
114 | } | ||
115 | 107 | ||
116 | add_node(motu, root, "clock", proc_read_clock); | 108 | add_node(motu, root, "clock", proc_read_clock); |
117 | add_node(motu, root, "format", proc_read_format); | 109 | add_node(motu, root, "format", proc_read_format); |
diff --git a/sound/firewire/oxfw/oxfw-proc.c b/sound/firewire/oxfw/oxfw-proc.c index 27dac071bc73..644107e3782e 100644 --- a/sound/firewire/oxfw/oxfw-proc.c +++ b/sound/firewire/oxfw/oxfw-proc.c | |||
@@ -83,12 +83,8 @@ static void add_node(struct snd_oxfw *oxfw, struct snd_info_entry *root, | |||
83 | struct snd_info_entry *entry; | 83 | struct snd_info_entry *entry; |
84 | 84 | ||
85 | entry = snd_info_create_card_entry(oxfw->card, name, root); | 85 | entry = snd_info_create_card_entry(oxfw->card, name, root); |
86 | if (entry == NULL) | 86 | if (entry) |
87 | return; | 87 | snd_info_set_text_ops(entry, oxfw, op); |
88 | |||
89 | snd_info_set_text_ops(entry, oxfw, op); | ||
90 | if (snd_info_register(entry) < 0) | ||
91 | snd_info_free_entry(entry); | ||
92 | } | 88 | } |
93 | 89 | ||
94 | void snd_oxfw_proc_init(struct snd_oxfw *oxfw) | 90 | void snd_oxfw_proc_init(struct snd_oxfw *oxfw) |
@@ -104,10 +100,6 @@ void snd_oxfw_proc_init(struct snd_oxfw *oxfw) | |||
104 | if (root == NULL) | 100 | if (root == NULL) |
105 | return; | 101 | return; |
106 | root->mode = S_IFDIR | 0555; | 102 | root->mode = S_IFDIR | 0555; |
107 | if (snd_info_register(root) < 0) { | ||
108 | snd_info_free_entry(root); | ||
109 | return; | ||
110 | } | ||
111 | 103 | ||
112 | add_node(oxfw, root, "formation", proc_read_formation); | 104 | add_node(oxfw, root, "formation", proc_read_formation); |
113 | } | 105 | } |
diff --git a/sound/firewire/tascam/tascam-proc.c b/sound/firewire/tascam/tascam-proc.c index fee3bf32a0da..8bc8d277394a 100644 --- a/sound/firewire/tascam/tascam-proc.c +++ b/sound/firewire/tascam/tascam-proc.c | |||
@@ -58,12 +58,8 @@ static void add_node(struct snd_tscm *tscm, struct snd_info_entry *root, | |||
58 | struct snd_info_entry *entry; | 58 | struct snd_info_entry *entry; |
59 | 59 | ||
60 | entry = snd_info_create_card_entry(tscm->card, name, root); | 60 | entry = snd_info_create_card_entry(tscm->card, name, root); |
61 | if (entry == NULL) | 61 | if (entry) |
62 | return; | 62 | snd_info_set_text_ops(entry, tscm, op); |
63 | |||
64 | snd_info_set_text_ops(entry, tscm, op); | ||
65 | if (snd_info_register(entry) < 0) | ||
66 | snd_info_free_entry(entry); | ||
67 | } | 63 | } |
68 | 64 | ||
69 | void snd_tscm_proc_init(struct snd_tscm *tscm) | 65 | void snd_tscm_proc_init(struct snd_tscm *tscm) |
@@ -79,10 +75,6 @@ void snd_tscm_proc_init(struct snd_tscm *tscm) | |||
79 | if (root == NULL) | 75 | if (root == NULL) |
80 | return; | 76 | return; |
81 | root->mode = S_IFDIR | 0555; | 77 | root->mode = S_IFDIR | 0555; |
82 | if (snd_info_register(root) < 0) { | ||
83 | snd_info_free_entry(root); | ||
84 | return; | ||
85 | } | ||
86 | 78 | ||
87 | add_node(tscm, root, "firmware", proc_read_firmware); | 79 | add_node(tscm, root, "firmware", proc_read_firmware); |
88 | } | 80 | } |
diff --git a/sound/hda/hdac_component.c b/sound/hda/hdac_component.c index a6d37b9d6413..5c95933e739a 100644 --- a/sound/hda/hdac_component.c +++ b/sound/hda/hdac_component.c | |||
@@ -269,7 +269,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_register_notifier); | |||
269 | */ | 269 | */ |
270 | int snd_hdac_acomp_init(struct hdac_bus *bus, | 270 | int snd_hdac_acomp_init(struct hdac_bus *bus, |
271 | const struct drm_audio_component_audio_ops *aops, | 271 | const struct drm_audio_component_audio_ops *aops, |
272 | int (*match_master)(struct device *, void *), | 272 | int (*match_master)(struct device *, int, void *), |
273 | size_t extra_size) | 273 | size_t extra_size) |
274 | { | 274 | { |
275 | struct component_match *match = NULL; | 275 | struct component_match *match = NULL; |
@@ -288,7 +288,7 @@ int snd_hdac_acomp_init(struct hdac_bus *bus, | |||
288 | bus->audio_component = acomp; | 288 | bus->audio_component = acomp; |
289 | devres_add(dev, acomp); | 289 | devres_add(dev, acomp); |
290 | 290 | ||
291 | component_match_add(dev, &match, match_master, bus); | 291 | component_match_add_typed(dev, &match, match_master, bus); |
292 | ret = component_master_add_with_match(dev, &hdac_component_master_ops, | 292 | ret = component_master_add_with_match(dev, &hdac_component_master_ops, |
293 | match); | 293 | match); |
294 | if (ret < 0) | 294 | if (ret < 0) |
diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c index 74244d8e2909..b2e9454f5816 100644 --- a/sound/hda/hdac_controller.c +++ b/sound/hda/hdac_controller.c | |||
@@ -376,7 +376,7 @@ void snd_hdac_bus_exit_link_reset(struct hdac_bus *bus) | |||
376 | { | 376 | { |
377 | unsigned long timeout; | 377 | unsigned long timeout; |
378 | 378 | ||
379 | snd_hdac_chip_updateb(bus, GCTL, 0, AZX_GCTL_RESET); | 379 | snd_hdac_chip_updateb(bus, GCTL, AZX_GCTL_RESET, AZX_GCTL_RESET); |
380 | 380 | ||
381 | timeout = jiffies + msecs_to_jiffies(100); | 381 | timeout = jiffies + msecs_to_jiffies(100); |
382 | while (!snd_hdac_chip_readb(bus, GCTL) && time_before(jiffies, timeout)) | 382 | while (!snd_hdac_chip_readb(bus, GCTL) && time_before(jiffies, timeout)) |
@@ -415,7 +415,7 @@ int snd_hdac_bus_reset_link(struct hdac_bus *bus, bool full_reset) | |||
415 | } | 415 | } |
416 | 416 | ||
417 | /* Accept unsolicited responses */ | 417 | /* Accept unsolicited responses */ |
418 | snd_hdac_chip_updatel(bus, GCTL, 0, AZX_GCTL_UNSOL); | 418 | snd_hdac_chip_updatel(bus, GCTL, AZX_GCTL_UNSOL, AZX_GCTL_UNSOL); |
419 | 419 | ||
420 | /* detect codecs */ | 420 | /* detect codecs */ |
421 | if (!bus->codec_mask) { | 421 | if (!bus->codec_mask) { |
@@ -431,7 +431,9 @@ EXPORT_SYMBOL_GPL(snd_hdac_bus_reset_link); | |||
431 | static void azx_int_enable(struct hdac_bus *bus) | 431 | static void azx_int_enable(struct hdac_bus *bus) |
432 | { | 432 | { |
433 | /* enable controller CIE and GIE */ | 433 | /* enable controller CIE and GIE */ |
434 | snd_hdac_chip_updatel(bus, INTCTL, 0, AZX_INT_CTRL_EN | AZX_INT_GLOBAL_EN); | 434 | snd_hdac_chip_updatel(bus, INTCTL, |
435 | AZX_INT_CTRL_EN | AZX_INT_GLOBAL_EN, | ||
436 | AZX_INT_CTRL_EN | AZX_INT_GLOBAL_EN); | ||
435 | } | 437 | } |
436 | 438 | ||
437 | /* disable interrupts */ | 439 | /* disable interrupts */ |
diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c index 617ff1aa818f..575198bd3cd0 100644 --- a/sound/hda/hdac_i915.c +++ b/sound/hda/hdac_i915.c | |||
@@ -82,9 +82,11 @@ void snd_hdac_i915_set_bclk(struct hdac_bus *bus) | |||
82 | } | 82 | } |
83 | EXPORT_SYMBOL_GPL(snd_hdac_i915_set_bclk); | 83 | EXPORT_SYMBOL_GPL(snd_hdac_i915_set_bclk); |
84 | 84 | ||
85 | static int i915_component_master_match(struct device *dev, void *data) | 85 | static int i915_component_master_match(struct device *dev, int subcomponent, |
86 | void *data) | ||
86 | { | 87 | { |
87 | return !strcmp(dev->driver->name, "i915"); | 88 | return !strcmp(dev->driver->name, "i915") && |
89 | subcomponent == I915_COMPONENT_AUDIO; | ||
88 | } | 90 | } |
89 | 91 | ||
90 | /* check whether intel graphics is present */ | 92 | /* check whether intel graphics is present */ |
@@ -144,9 +146,9 @@ int snd_hdac_i915_init(struct hdac_bus *bus) | |||
144 | return -ENODEV; | 146 | return -ENODEV; |
145 | if (!acomp->ops) { | 147 | if (!acomp->ops) { |
146 | request_module("i915"); | 148 | request_module("i915"); |
147 | /* 10s timeout */ | 149 | /* 60s timeout */ |
148 | wait_for_completion_timeout(&bind_complete, | 150 | wait_for_completion_timeout(&bind_complete, |
149 | msecs_to_jiffies(10 * 1000)); | 151 | msecs_to_jiffies(60 * 1000)); |
150 | } | 152 | } |
151 | if (!acomp->ops) { | 153 | if (!acomp->ops) { |
152 | dev_info(bus->dev, "couldn't bind with audio component\n"); | 154 | dev_info(bus->dev, "couldn't bind with audio component\n"); |
diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c index eee422390d8e..76e9b41fcea2 100644 --- a/sound/hda/hdac_stream.c +++ b/sound/hda/hdac_stream.c | |||
@@ -13,6 +13,40 @@ | |||
13 | #include "trace.h" | 13 | #include "trace.h" |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * snd_hdac_get_stream_stripe_ctl - get stripe control value | ||
17 | * @bus: HD-audio core bus | ||
18 | * @substream: PCM substream | ||
19 | */ | ||
20 | int snd_hdac_get_stream_stripe_ctl(struct hdac_bus *bus, | ||
21 | struct snd_pcm_substream *substream) | ||
22 | { | ||
23 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
24 | unsigned int channels = runtime->channels, | ||
25 | rate = runtime->rate, | ||
26 | bits_per_sample = runtime->sample_bits, | ||
27 | max_sdo_lines, value, sdo_line; | ||
28 | |||
29 | /* T_AZA_GCAP_NSDO is 1:2 bitfields in GCAP */ | ||
30 | max_sdo_lines = snd_hdac_chip_readl(bus, GCAP) & AZX_GCAP_NSDO; | ||
31 | |||
32 | /* following is from HD audio spec */ | ||
33 | for (sdo_line = max_sdo_lines; sdo_line > 0; sdo_line >>= 1) { | ||
34 | if (rate > 48000) | ||
35 | value = (channels * bits_per_sample * | ||
36 | (rate / 48000)) / sdo_line; | ||
37 | else | ||
38 | value = (channels * bits_per_sample) / sdo_line; | ||
39 | |||
40 | if (value >= 8) | ||
41 | break; | ||
42 | } | ||
43 | |||
44 | /* stripe value: 0 for 1SDO, 1 for 2SDO, 2 for 4SDO lines */ | ||
45 | return sdo_line >> 1; | ||
46 | } | ||
47 | EXPORT_SYMBOL_GPL(snd_hdac_get_stream_stripe_ctl); | ||
48 | |||
49 | /** | ||
16 | * snd_hdac_stream_init - initialize each stream (aka device) | 50 | * snd_hdac_stream_init - initialize each stream (aka device) |
17 | * @bus: HD-audio core bus | 51 | * @bus: HD-audio core bus |
18 | * @azx_dev: HD-audio core stream object to initialize | 52 | * @azx_dev: HD-audio core stream object to initialize |
@@ -48,6 +82,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_stream_init); | |||
48 | void snd_hdac_stream_start(struct hdac_stream *azx_dev, bool fresh_start) | 82 | void snd_hdac_stream_start(struct hdac_stream *azx_dev, bool fresh_start) |
49 | { | 83 | { |
50 | struct hdac_bus *bus = azx_dev->bus; | 84 | struct hdac_bus *bus = azx_dev->bus; |
85 | int stripe_ctl; | ||
51 | 86 | ||
52 | trace_snd_hdac_stream_start(bus, azx_dev); | 87 | trace_snd_hdac_stream_start(bus, azx_dev); |
53 | 88 | ||
@@ -56,7 +91,16 @@ void snd_hdac_stream_start(struct hdac_stream *azx_dev, bool fresh_start) | |||
56 | azx_dev->start_wallclk -= azx_dev->period_wallclk; | 91 | azx_dev->start_wallclk -= azx_dev->period_wallclk; |
57 | 92 | ||
58 | /* enable SIE */ | 93 | /* enable SIE */ |
59 | snd_hdac_chip_updatel(bus, INTCTL, 0, 1 << azx_dev->index); | 94 | snd_hdac_chip_updatel(bus, INTCTL, |
95 | 1 << azx_dev->index, | ||
96 | 1 << azx_dev->index); | ||
97 | /* set stripe control */ | ||
98 | if (azx_dev->substream) | ||
99 | stripe_ctl = snd_hdac_get_stream_stripe_ctl(bus, azx_dev->substream); | ||
100 | else | ||
101 | stripe_ctl = 0; | ||
102 | snd_hdac_stream_updateb(azx_dev, SD_CTL_3B, SD_CTL_STRIPE_MASK, | ||
103 | stripe_ctl); | ||
60 | /* set DMA start and interrupt mask */ | 104 | /* set DMA start and interrupt mask */ |
61 | snd_hdac_stream_updateb(azx_dev, SD_CTL, | 105 | snd_hdac_stream_updateb(azx_dev, SD_CTL, |
62 | 0, SD_CTL_DMA_START | SD_INT_MASK); | 106 | 0, SD_CTL_DMA_START | SD_INT_MASK); |
@@ -73,6 +117,7 @@ void snd_hdac_stream_clear(struct hdac_stream *azx_dev) | |||
73 | snd_hdac_stream_updateb(azx_dev, SD_CTL, | 117 | snd_hdac_stream_updateb(azx_dev, SD_CTL, |
74 | SD_CTL_DMA_START | SD_INT_MASK, 0); | 118 | SD_CTL_DMA_START | SD_INT_MASK, 0); |
75 | snd_hdac_stream_writeb(azx_dev, SD_STS, SD_INT_MASK); /* to be sure */ | 119 | snd_hdac_stream_writeb(azx_dev, SD_STS, SD_INT_MASK); /* to be sure */ |
120 | snd_hdac_stream_updateb(azx_dev, SD_CTL_3B, SD_CTL_STRIPE_MASK, 0); | ||
76 | azx_dev->running = false; | 121 | azx_dev->running = false; |
77 | } | 122 | } |
78 | EXPORT_SYMBOL_GPL(snd_hdac_stream_clear); | 123 | EXPORT_SYMBOL_GPL(snd_hdac_stream_clear); |
diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c index 4099e6062d3c..573599d0378d 100644 --- a/sound/i2c/other/ak4113.c +++ b/sound/i2c/other/ak4113.c | |||
@@ -492,9 +492,8 @@ static void snd_ak4113_proc_regs_read(struct snd_info_entry *entry, | |||
492 | 492 | ||
493 | static void snd_ak4113_proc_init(struct ak4113 *ak4113) | 493 | static void snd_ak4113_proc_init(struct ak4113 *ak4113) |
494 | { | 494 | { |
495 | struct snd_info_entry *entry; | 495 | snd_card_ro_proc_new(ak4113->card, "ak4113", ak4113, |
496 | if (!snd_card_proc_new(ak4113->card, "ak4113", &entry)) | 496 | snd_ak4113_proc_regs_read); |
497 | snd_info_set_text_ops(entry, ak4113, snd_ak4113_proc_regs_read); | ||
498 | } | 497 | } |
499 | 498 | ||
500 | int snd_ak4113_build(struct ak4113 *ak4113, | 499 | int snd_ak4113_build(struct ak4113 *ak4113, |
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index 7fb1aeb46915..76afb975782d 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c | |||
@@ -465,9 +465,8 @@ static void snd_ak4114_proc_regs_read(struct snd_info_entry *entry, | |||
465 | 465 | ||
466 | static void snd_ak4114_proc_init(struct ak4114 *ak4114) | 466 | static void snd_ak4114_proc_init(struct ak4114 *ak4114) |
467 | { | 467 | { |
468 | struct snd_info_entry *entry; | 468 | snd_card_ro_proc_new(ak4114->card, "ak4114", ak4114, |
469 | if (!snd_card_proc_new(ak4114->card, "ak4114", &entry)) | 469 | snd_ak4114_proc_regs_read); |
470 | snd_info_set_text_ops(entry, ak4114, snd_ak4114_proc_regs_read); | ||
471 | } | 470 | } |
472 | 471 | ||
473 | int snd_ak4114_build(struct ak4114 *ak4114, | 472 | int snd_ak4114_build(struct ak4114 *ak4114, |
diff --git a/sound/i2c/other/ak4xxx-adda.c b/sound/i2c/other/ak4xxx-adda.c index 7f2761a2e7c8..62a6c5fa96b5 100644 --- a/sound/i2c/other/ak4xxx-adda.c +++ b/sound/i2c/other/ak4xxx-adda.c | |||
@@ -875,13 +875,7 @@ static void proc_regs_read(struct snd_info_entry *entry, | |||
875 | 875 | ||
876 | static int proc_init(struct snd_akm4xxx *ak) | 876 | static int proc_init(struct snd_akm4xxx *ak) |
877 | { | 877 | { |
878 | struct snd_info_entry *entry; | 878 | return snd_card_ro_proc_new(ak->card, ak->name, ak, proc_regs_read); |
879 | int err; | ||
880 | err = snd_card_proc_new(ak->card, ak->name, &entry); | ||
881 | if (err < 0) | ||
882 | return err; | ||
883 | snd_info_set_text_ops(entry, ak, proc_regs_read); | ||
884 | return 0; | ||
885 | } | 879 | } |
886 | 880 | ||
887 | int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak) | 881 | int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak) |
diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index fba6d22f7f4b..94b381a78e9e 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c | |||
@@ -518,7 +518,6 @@ void snd_ad1816a_suspend(struct snd_ad1816a *chip) | |||
518 | int reg; | 518 | int reg; |
519 | unsigned long flags; | 519 | unsigned long flags; |
520 | 520 | ||
521 | snd_pcm_suspend_all(chip->pcm); | ||
522 | spin_lock_irqsave(&chip->lock, flags); | 521 | spin_lock_irqsave(&chip->lock, flags); |
523 | for (reg = 0; reg < 48; reg++) | 522 | for (reg = 0; reg < 48; reg++) |
524 | chip->image[reg] = snd_ad1816a_read(chip, reg); | 523 | chip->image[reg] = snd_ad1816a_read(chip, reg); |
@@ -694,7 +693,7 @@ int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device) | |||
694 | snd_ad1816a_init(chip); | 693 | snd_ad1816a_init(chip); |
695 | 694 | ||
696 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 695 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
697 | snd_dma_isa_data(), | 696 | chip->card->dev, |
698 | 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); | 697 | 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); |
699 | 698 | ||
700 | chip->pcm = pcm; | 699 | chip->pcm = pcm; |
diff --git a/sound/isa/als100.c b/sound/isa/als100.c index f63142ec287e..571108021e9d 100644 --- a/sound/isa/als100.c +++ b/sound/isa/als100.c | |||
@@ -322,7 +322,6 @@ static int snd_als100_pnp_suspend(struct pnp_card_link *pcard, pm_message_t stat | |||
322 | struct snd_sb *chip = acard->chip; | 322 | struct snd_sb *chip = acard->chip; |
323 | 323 | ||
324 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 324 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
325 | snd_pcm_suspend_all(chip->pcm); | ||
326 | snd_sbmixer_suspend(chip); | 325 | snd_sbmixer_suspend(chip); |
327 | return 0; | 326 | return 0; |
328 | } | 327 | } |
diff --git a/sound/isa/cmi8328.c b/sound/isa/cmi8328.c index de6ef1b1cf0e..617977516201 100644 --- a/sound/isa/cmi8328.c +++ b/sound/isa/cmi8328.c | |||
@@ -434,7 +434,6 @@ static int snd_cmi8328_suspend(struct device *pdev, unsigned int n, | |||
434 | cmi = card->private_data; | 434 | cmi = card->private_data; |
435 | snd_cmi8328_cfg_save(cmi->port, cmi->cfg); | 435 | snd_cmi8328_cfg_save(cmi->port, cmi->cfg); |
436 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 436 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
437 | snd_pcm_suspend_all(cmi->wss->pcm); | ||
438 | cmi->wss->suspend(cmi->wss); | 437 | cmi->wss->suspend(cmi->wss); |
439 | 438 | ||
440 | return 0; | 439 | return 0; |
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index 6b8c46942efb..1868b73aa49c 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c | |||
@@ -470,7 +470,7 @@ static int snd_cmi8330_pcm(struct snd_card *card, struct snd_cmi8330 *chip) | |||
470 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &chip->streams[SNDRV_PCM_STREAM_CAPTURE].ops); | 470 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &chip->streams[SNDRV_PCM_STREAM_CAPTURE].ops); |
471 | 471 | ||
472 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 472 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
473 | snd_dma_isa_data(), | 473 | card->dev, |
474 | 64*1024, 128*1024); | 474 | 64*1024, 128*1024); |
475 | chip->pcm = pcm; | 475 | chip->pcm = pcm; |
476 | 476 | ||
@@ -484,7 +484,6 @@ static int snd_cmi8330_suspend(struct snd_card *card) | |||
484 | struct snd_cmi8330 *acard = card->private_data; | 484 | struct snd_cmi8330 *acard = card->private_data; |
485 | 485 | ||
486 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 486 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
487 | snd_pcm_suspend_all(acard->pcm); | ||
488 | acard->wss->suspend(acard->wss); | 487 | acard->wss->suspend(acard->wss); |
489 | snd_sbmixer_suspend(acard->sb); | 488 | snd_sbmixer_suspend(acard->sb); |
490 | return 0; | 489 | return 0; |
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c index 3dfe7e592c25..87527627e059 100644 --- a/sound/isa/es1688/es1688.c +++ b/sound/isa/es1688/es1688.c | |||
@@ -301,10 +301,8 @@ static int snd_es968_pnp_suspend(struct pnp_card_link *pcard, | |||
301 | pm_message_t state) | 301 | pm_message_t state) |
302 | { | 302 | { |
303 | struct snd_card *card = pnp_get_card_drvdata(pcard); | 303 | struct snd_card *card = pnp_get_card_drvdata(pcard); |
304 | struct snd_es1688 *chip = card->private_data; | ||
305 | 304 | ||
306 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 305 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
307 | snd_pcm_suspend_all(chip->pcm); | ||
308 | return 0; | 306 | return 0; |
309 | } | 307 | } |
310 | 308 | ||
diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index 50cdce0e8946..1d9556c045e9 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c | |||
@@ -121,7 +121,7 @@ EXPORT_SYMBOL(snd_es1688_reset); | |||
121 | static int snd_es1688_probe(struct snd_es1688 *chip) | 121 | static int snd_es1688_probe(struct snd_es1688 *chip) |
122 | { | 122 | { |
123 | unsigned long flags; | 123 | unsigned long flags; |
124 | unsigned short major, minor, hw; | 124 | unsigned short major, minor; |
125 | int i; | 125 | int i; |
126 | 126 | ||
127 | /* | 127 | /* |
@@ -166,14 +166,12 @@ static int snd_es1688_probe(struct snd_es1688 *chip) | |||
166 | if (!chip->version) | 166 | if (!chip->version) |
167 | return -ENODEV; /* probably SB */ | 167 | return -ENODEV; /* probably SB */ |
168 | 168 | ||
169 | hw = ES1688_HW_AUTO; | ||
170 | switch (chip->version & 0xfff0) { | 169 | switch (chip->version & 0xfff0) { |
171 | case 0x4880: | 170 | case 0x4880: |
172 | snd_printk(KERN_ERR "[0x%lx] ESS: AudioDrive ES488 detected, " | 171 | snd_printk(KERN_ERR "[0x%lx] ESS: AudioDrive ES488 detected, " |
173 | "but driver is in another place\n", chip->port); | 172 | "but driver is in another place\n", chip->port); |
174 | return -ENODEV; | 173 | return -ENODEV; |
175 | case 0x6880: | 174 | case 0x6880: |
176 | hw = (chip->version & 0x0f) >= 8 ? ES1688_HW_1688 : ES1688_HW_688; | ||
177 | break; | 175 | break; |
178 | default: | 176 | default: |
179 | snd_printk(KERN_ERR "[0x%lx] ESS: unknown AudioDrive chip " | 177 | snd_printk(KERN_ERR "[0x%lx] ESS: unknown AudioDrive chip " |
@@ -746,7 +744,7 @@ int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device) | |||
746 | chip->pcm = pcm; | 744 | chip->pcm = pcm; |
747 | 745 | ||
748 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 746 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
749 | snd_dma_isa_data(), | 747 | card->dev, |
750 | 64*1024, 64*1024); | 748 | 64*1024, 64*1024); |
751 | return 0; | 749 | return 0; |
752 | } | 750 | } |
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 0d103d6f805e..07abc7f7840c 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c | |||
@@ -1717,7 +1717,7 @@ static int snd_es18xx_pcm(struct snd_card *card, int device) | |||
1717 | chip->pcm = pcm; | 1717 | chip->pcm = pcm; |
1718 | 1718 | ||
1719 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1719 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1720 | snd_dma_isa_data(), | 1720 | card->dev, |
1721 | 64*1024, | 1721 | 64*1024, |
1722 | chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); | 1722 | chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); |
1723 | return 0; | 1723 | return 0; |
@@ -1731,8 +1731,6 @@ static int snd_es18xx_suspend(struct snd_card *card, pm_message_t state) | |||
1731 | 1731 | ||
1732 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1732 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1733 | 1733 | ||
1734 | snd_pcm_suspend_all(chip->pcm); | ||
1735 | |||
1736 | /* power down */ | 1734 | /* power down */ |
1737 | chip->pm_reg = (unsigned char)snd_es18xx_read(chip, ES18XX_PM); | 1735 | chip->pm_reg = (unsigned char)snd_es18xx_read(chip, ES18XX_PM); |
1738 | chip->pm_reg |= (ES18XX_PM_FM | ES18XX_PM_SUS); | 1736 | chip->pm_reg |= (ES18XX_PM_FM | ES18XX_PM_SUS); |
diff --git a/sound/isa/gus/gus_irq.c b/sound/isa/gus/gus_irq.c index 2055aff71b50..0ca6c38e2ed9 100644 --- a/sound/isa/gus/gus_irq.c +++ b/sound/isa/gus/gus_irq.c | |||
@@ -140,10 +140,7 @@ static void snd_gus_irq_info_read(struct snd_info_entry *entry, | |||
140 | 140 | ||
141 | void snd_gus_irq_profile_init(struct snd_gus_card *gus) | 141 | void snd_gus_irq_profile_init(struct snd_gus_card *gus) |
142 | { | 142 | { |
143 | struct snd_info_entry *entry; | 143 | snd_card_ro_proc_new(gus->card, "gusirq", gus, snd_gus_irq_info_read); |
144 | |||
145 | if (! snd_card_proc_new(gus->card, "gusirq", &entry)) | ||
146 | snd_info_set_text_ops(entry, gus, snd_gus_irq_info_read); | ||
147 | } | 144 | } |
148 | 145 | ||
149 | #endif | 146 | #endif |
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c index 3b8a0c880db5..33c8b66d5c8a 100644 --- a/sound/isa/gus/gus_main.c +++ b/sound/isa/gus/gus_main.c | |||
@@ -92,8 +92,17 @@ static const struct snd_kcontrol_new snd_gus_joystick_control = { | |||
92 | 92 | ||
93 | static void snd_gus_init_control(struct snd_gus_card *gus) | 93 | static void snd_gus_init_control(struct snd_gus_card *gus) |
94 | { | 94 | { |
95 | if (!gus->ace_flag) | 95 | int ret; |
96 | snd_ctl_add(gus->card, snd_ctl_new1(&snd_gus_joystick_control, gus)); | 96 | |
97 | if (!gus->ace_flag) { | ||
98 | ret = | ||
99 | snd_ctl_add(gus->card, | ||
100 | snd_ctl_new1(&snd_gus_joystick_control, | ||
101 | gus)); | ||
102 | if (ret) | ||
103 | snd_printk(KERN_ERR "gus: snd_ctl_add failed: %d\n", | ||
104 | ret); | ||
105 | } | ||
97 | } | 106 | } |
98 | 107 | ||
99 | /* | 108 | /* |
diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c index af888a022fc0..4ac76f46dd76 100644 --- a/sound/isa/gus/gus_mem.c +++ b/sound/isa/gus/gus_mem.c | |||
@@ -238,9 +238,6 @@ int snd_gf1_mem_init(struct snd_gus_card * gus) | |||
238 | { | 238 | { |
239 | struct snd_gf1_mem *alloc; | 239 | struct snd_gf1_mem *alloc; |
240 | struct snd_gf1_mem_block block; | 240 | struct snd_gf1_mem_block block; |
241 | #ifdef CONFIG_SND_DEBUG | ||
242 | struct snd_info_entry *entry; | ||
243 | #endif | ||
244 | 241 | ||
245 | alloc = &gus->gf1.mem_alloc; | 242 | alloc = &gus->gf1.mem_alloc; |
246 | mutex_init(&alloc->memory_mutex); | 243 | mutex_init(&alloc->memory_mutex); |
@@ -263,8 +260,7 @@ int snd_gf1_mem_init(struct snd_gus_card * gus) | |||
263 | if (snd_gf1_mem_xalloc(alloc, &block) == NULL) | 260 | if (snd_gf1_mem_xalloc(alloc, &block) == NULL) |
264 | return -ENOMEM; | 261 | return -ENOMEM; |
265 | #ifdef CONFIG_SND_DEBUG | 262 | #ifdef CONFIG_SND_DEBUG |
266 | if (! snd_card_proc_new(gus->card, "gusmem", &entry)) | 263 | snd_card_ro_proc_new(gus->card, "gusmem", gus, snd_gf1_mem_info_read); |
267 | snd_info_set_text_ops(entry, gus, snd_gf1_mem_info_read); | ||
268 | #endif | 264 | #endif |
269 | return 0; | 265 | return 0; |
270 | } | 266 | } |
diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c index 131b28997e1d..b9efc6dff45d 100644 --- a/sound/isa/gus/gus_pcm.c +++ b/sound/isa/gus/gus_pcm.c | |||
@@ -891,7 +891,7 @@ int snd_gf1_pcm_new(struct snd_gus_card *gus, int pcm_dev, int control_index) | |||
891 | 891 | ||
892 | for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next) | 892 | for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next) |
893 | snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV, | 893 | snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV, |
894 | snd_dma_isa_data(), | 894 | card->dev, |
895 | 64*1024, gus->gf1.dma1 > 3 ? 128*1024 : 64*1024); | 895 | 64*1024, gus->gf1.dma1 > 3 ? 128*1024 : 64*1024); |
896 | 896 | ||
897 | pcm->info_flags = 0; | 897 | pcm->info_flags = 0; |
@@ -901,7 +901,7 @@ int snd_gf1_pcm_new(struct snd_gus_card *gus, int pcm_dev, int control_index) | |||
901 | if (gus->gf1.dma2 == gus->gf1.dma1) | 901 | if (gus->gf1.dma2 == gus->gf1.dma1) |
902 | pcm->info_flags |= SNDRV_PCM_INFO_HALF_DUPLEX; | 902 | pcm->info_flags |= SNDRV_PCM_INFO_HALF_DUPLEX; |
903 | snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, | 903 | snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, |
904 | SNDRV_DMA_TYPE_DEV, snd_dma_isa_data(), | 904 | SNDRV_DMA_TYPE_DEV, card->dev, |
905 | 64*1024, gus->gf1.dma2 > 3 ? 128*1024 : 64*1024); | 905 | 64*1024, gus->gf1.dma2 > 3 ? 128*1024 : 64*1024); |
906 | } | 906 | } |
907 | strcpy(pcm->name, pcm->id); | 907 | strcpy(pcm->name, pcm->id); |
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index c6136c6b0214..997cdfd7b1ea 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c | |||
@@ -997,10 +997,7 @@ static void snd_miro_proc_read(struct snd_info_entry * entry, | |||
997 | static void snd_miro_proc_init(struct snd_card *card, | 997 | static void snd_miro_proc_init(struct snd_card *card, |
998 | struct snd_miro *miro) | 998 | struct snd_miro *miro) |
999 | { | 999 | { |
1000 | struct snd_info_entry *entry; | 1000 | snd_card_ro_proc_new(card, "miro", miro, snd_miro_proc_read); |
1001 | |||
1002 | if (!snd_card_proc_new(card, "miro", &entry)) | ||
1003 | snd_info_set_text_ops(entry, miro, snd_miro_proc_read); | ||
1004 | } | 1001 | } |
1005 | 1002 | ||
1006 | /* | 1003 | /* |
diff --git a/sound/isa/sb/jazz16.c b/sound/isa/sb/jazz16.c index bfa0055e1fd6..7a313ff589c7 100644 --- a/sound/isa/sb/jazz16.c +++ b/sound/isa/sb/jazz16.c | |||
@@ -356,7 +356,6 @@ static int snd_jazz16_suspend(struct device *pdev, unsigned int n, | |||
356 | struct snd_sb *chip = acard->chip; | 356 | struct snd_sb *chip = acard->chip; |
357 | 357 | ||
358 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 358 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
359 | snd_pcm_suspend_all(chip->pcm); | ||
360 | snd_sbmixer_suspend(chip); | 359 | snd_sbmixer_suspend(chip); |
361 | return 0; | 360 | return 0; |
362 | } | 361 | } |
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index 8f9ebeb998f6..3844d4c02f49 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c | |||
@@ -471,7 +471,6 @@ static int snd_sb16_suspend(struct snd_card *card, pm_message_t state) | |||
471 | struct snd_sb *chip = acard->chip; | 471 | struct snd_sb *chip = acard->chip; |
472 | 472 | ||
473 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 473 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
474 | snd_pcm_suspend_all(chip->pcm); | ||
475 | snd_sbmixer_suspend(chip); | 474 | snd_sbmixer_suspend(chip); |
476 | return 0; | 475 | return 0; |
477 | } | 476 | } |
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c index bf3db0d2ea12..a09ad57b8313 100644 --- a/sound/isa/sb/sb16_csp.c +++ b/sound/isa/sb/sb16_csp.c | |||
@@ -1126,10 +1126,9 @@ static int snd_sb_csp_qsound_transfer(struct snd_sb_csp * p) | |||
1126 | static int init_proc_entry(struct snd_sb_csp * p, int device) | 1126 | static int init_proc_entry(struct snd_sb_csp * p, int device) |
1127 | { | 1127 | { |
1128 | char name[16]; | 1128 | char name[16]; |
1129 | struct snd_info_entry *entry; | 1129 | |
1130 | sprintf(name, "cspD%d", device); | 1130 | sprintf(name, "cspD%d", device); |
1131 | if (! snd_card_proc_new(p->chip->card, name, &entry)) | 1131 | snd_card_ro_proc_new(p->chip->card, name, p, info_read); |
1132 | snd_info_set_text_ops(entry, p, info_read); | ||
1133 | return 0; | 1132 | return 0; |
1134 | } | 1133 | } |
1135 | 1134 | ||
diff --git a/sound/isa/sb/sb16_main.c b/sound/isa/sb/sb16_main.c index 37e6ce7b0b13..473ec74ae48c 100644 --- a/sound/isa/sb/sb16_main.c +++ b/sound/isa/sb/sb16_main.c | |||
@@ -879,13 +879,17 @@ int snd_sb16dsp_pcm(struct snd_sb *chip, int device) | |||
879 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sb16_playback_ops); | 879 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sb16_playback_ops); |
880 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sb16_capture_ops); | 880 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sb16_capture_ops); |
881 | 881 | ||
882 | if (chip->dma16 >= 0 && chip->dma8 != chip->dma16) | 882 | if (chip->dma16 >= 0 && chip->dma8 != chip->dma16) { |
883 | snd_ctl_add(card, snd_ctl_new1(&snd_sb16_dma_control, chip)); | 883 | err = snd_ctl_add(card, snd_ctl_new1( |
884 | else | 884 | &snd_sb16_dma_control, chip)); |
885 | if (err) | ||
886 | return err; | ||
887 | } else { | ||
885 | pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX; | 888 | pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX; |
889 | } | ||
886 | 890 | ||
887 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 891 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
888 | snd_dma_isa_data(), | 892 | card->dev, |
889 | 64*1024, 128*1024); | 893 | 64*1024, 128*1024); |
890 | return 0; | 894 | return 0; |
891 | } | 895 | } |
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index d77dcba276b5..aa2a83eb81a9 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c | |||
@@ -218,7 +218,6 @@ static int snd_sb8_suspend(struct device *dev, unsigned int n, | |||
218 | struct snd_sb *chip = acard->chip; | 218 | struct snd_sb *chip = acard->chip; |
219 | 219 | ||
220 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 220 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
221 | snd_pcm_suspend_all(chip->pcm); | ||
222 | snd_sbmixer_suspend(chip); | 221 | snd_sbmixer_suspend(chip); |
223 | return 0; | 222 | return 0; |
224 | } | 223 | } |
diff --git a/sound/isa/sb/sb8_main.c b/sound/isa/sb/sb8_main.c index 8288fae90085..97645a732a71 100644 --- a/sound/isa/sb/sb8_main.c +++ b/sound/isa/sb/sb8_main.c | |||
@@ -610,7 +610,7 @@ int snd_sb8dsp_pcm(struct snd_sb *chip, int device) | |||
610 | if (chip->dma8 > 3 || chip->dma16 >= 0) | 610 | if (chip->dma8 > 3 || chip->dma16 >= 0) |
611 | max_prealloc = 128 * 1024; | 611 | max_prealloc = 128 * 1024; |
612 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 612 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
613 | snd_dma_isa_data(), | 613 | card->dev, |
614 | 64*1024, max_prealloc); | 614 | 64*1024, max_prealloc); |
615 | 615 | ||
616 | return 0; | 616 | return 0; |
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 733adee5afbf..8181db4db019 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c | |||
@@ -167,12 +167,13 @@ static inline struct soundscape *get_card_soundscape(struct snd_card *c) | |||
167 | * I think this means that the memory has to map to | 167 | * I think this means that the memory has to map to |
168 | * contiguous pages of physical memory. | 168 | * contiguous pages of physical memory. |
169 | */ | 169 | */ |
170 | static struct snd_dma_buffer *get_dmabuf(struct snd_dma_buffer *buf, | 170 | static struct snd_dma_buffer *get_dmabuf(struct soundscape *s, |
171 | struct snd_dma_buffer *buf, | ||
171 | unsigned long size) | 172 | unsigned long size) |
172 | { | 173 | { |
173 | if (buf) { | 174 | if (buf) { |
174 | if (snd_dma_alloc_pages_fallback(SNDRV_DMA_TYPE_DEV, | 175 | if (snd_dma_alloc_pages_fallback(SNDRV_DMA_TYPE_DEV, |
175 | snd_dma_isa_data(), | 176 | s->chip->card->dev, |
176 | size, buf) < 0) { | 177 | size, buf) < 0) { |
177 | snd_printk(KERN_ERR "sscape: Failed to allocate " | 178 | snd_printk(KERN_ERR "sscape: Failed to allocate " |
178 | "%lu bytes for DMA\n", | 179 | "%lu bytes for DMA\n", |
@@ -443,7 +444,7 @@ static int upload_dma_data(struct soundscape *s, const unsigned char *data, | |||
443 | int ret; | 444 | int ret; |
444 | unsigned char val; | 445 | unsigned char val; |
445 | 446 | ||
446 | if (!get_dmabuf(&dma, PAGE_ALIGN(32 * 1024))) | 447 | if (!get_dmabuf(s, &dma, PAGE_ALIGN(32 * 1024))) |
447 | return -ENOMEM; | 448 | return -ENOMEM; |
448 | 449 | ||
449 | spin_lock_irqsave(&s->lock, flags); | 450 | spin_lock_irqsave(&s->lock, flags); |
diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 3a5008837576..0dfb8065b403 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c | |||
@@ -1625,7 +1625,6 @@ static void snd_wss_suspend(struct snd_wss *chip) | |||
1625 | int reg; | 1625 | int reg; |
1626 | unsigned long flags; | 1626 | unsigned long flags; |
1627 | 1627 | ||
1628 | snd_pcm_suspend_all(chip->pcm); | ||
1629 | spin_lock_irqsave(&chip->reg_lock, flags); | 1628 | spin_lock_irqsave(&chip->reg_lock, flags); |
1630 | for (reg = 0; reg < 32; reg++) | 1629 | for (reg = 0; reg < 32; reg++) |
1631 | chip->image[reg] = snd_wss_in(chip, reg); | 1630 | chip->image[reg] = snd_wss_in(chip, reg); |
@@ -1943,7 +1942,7 @@ int snd_wss_pcm(struct snd_wss *chip, int device) | |||
1943 | strcpy(pcm->name, snd_wss_chip_id(chip)); | 1942 | strcpy(pcm->name, snd_wss_chip_id(chip)); |
1944 | 1943 | ||
1945 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1944 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1946 | snd_dma_isa_data(), | 1945 | chip->card->dev, |
1947 | 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); | 1946 | 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); |
1948 | 1947 | ||
1949 | chip->pcm = pcm; | 1948 | chip->pcm = pcm; |
diff --git a/sound/mips/hal2.c b/sound/mips/hal2.c index a4ed54aeaf1d..d63e1565b62b 100644 --- a/sound/mips/hal2.c +++ b/sound/mips/hal2.c | |||
@@ -454,21 +454,22 @@ static inline void hal2_stop_adc(struct snd_hal2 *hal2) | |||
454 | hal2->adc.pbus.pbus->pbdma_ctrl = HPC3_PDMACTRL_LD; | 454 | hal2->adc.pbus.pbus->pbdma_ctrl = HPC3_PDMACTRL_LD; |
455 | } | 455 | } |
456 | 456 | ||
457 | static int hal2_alloc_dmabuf(struct hal2_codec *codec) | 457 | static int hal2_alloc_dmabuf(struct snd_hal2 *hal2, struct hal2_codec *codec) |
458 | { | 458 | { |
459 | struct device *dev = hal2->card->dev; | ||
459 | struct hal2_desc *desc; | 460 | struct hal2_desc *desc; |
460 | dma_addr_t desc_dma, buffer_dma; | 461 | dma_addr_t desc_dma, buffer_dma; |
461 | int count = H2_BUF_SIZE / H2_BLOCK_SIZE; | 462 | int count = H2_BUF_SIZE / H2_BLOCK_SIZE; |
462 | int i; | 463 | int i; |
463 | 464 | ||
464 | codec->buffer = dma_alloc_attrs(NULL, H2_BUF_SIZE, &buffer_dma, | 465 | codec->buffer = dma_alloc_attrs(dev, H2_BUF_SIZE, &buffer_dma, |
465 | GFP_KERNEL, DMA_ATTR_NON_CONSISTENT); | 466 | GFP_KERNEL, DMA_ATTR_NON_CONSISTENT); |
466 | if (!codec->buffer) | 467 | if (!codec->buffer) |
467 | return -ENOMEM; | 468 | return -ENOMEM; |
468 | desc = dma_alloc_attrs(NULL, count * sizeof(struct hal2_desc), | 469 | desc = dma_alloc_attrs(dev, count * sizeof(struct hal2_desc), |
469 | &desc_dma, GFP_KERNEL, DMA_ATTR_NON_CONSISTENT); | 470 | &desc_dma, GFP_KERNEL, DMA_ATTR_NON_CONSISTENT); |
470 | if (!desc) { | 471 | if (!desc) { |
471 | dma_free_attrs(NULL, H2_BUF_SIZE, codec->buffer, buffer_dma, | 472 | dma_free_attrs(dev, H2_BUF_SIZE, codec->buffer, buffer_dma, |
472 | DMA_ATTR_NON_CONSISTENT); | 473 | DMA_ATTR_NON_CONSISTENT); |
473 | return -ENOMEM; | 474 | return -ENOMEM; |
474 | } | 475 | } |
@@ -482,17 +483,19 @@ static int hal2_alloc_dmabuf(struct hal2_codec *codec) | |||
482 | desc_dma : desc_dma + (i + 1) * sizeof(struct hal2_desc); | 483 | desc_dma : desc_dma + (i + 1) * sizeof(struct hal2_desc); |
483 | desc++; | 484 | desc++; |
484 | } | 485 | } |
485 | dma_cache_sync(NULL, codec->desc, count * sizeof(struct hal2_desc), | 486 | dma_cache_sync(dev, codec->desc, count * sizeof(struct hal2_desc), |
486 | DMA_TO_DEVICE); | 487 | DMA_TO_DEVICE); |
487 | codec->desc_count = count; | 488 | codec->desc_count = count; |
488 | return 0; | 489 | return 0; |
489 | } | 490 | } |
490 | 491 | ||
491 | static void hal2_free_dmabuf(struct hal2_codec *codec) | 492 | static void hal2_free_dmabuf(struct snd_hal2 *hal2, struct hal2_codec *codec) |
492 | { | 493 | { |
493 | dma_free_attrs(NULL, codec->desc_count * sizeof(struct hal2_desc), | 494 | struct device *dev = hal2->card->dev; |
495 | |||
496 | dma_free_attrs(dev, codec->desc_count * sizeof(struct hal2_desc), | ||
494 | codec->desc, codec->desc_dma, DMA_ATTR_NON_CONSISTENT); | 497 | codec->desc, codec->desc_dma, DMA_ATTR_NON_CONSISTENT); |
495 | dma_free_attrs(NULL, H2_BUF_SIZE, codec->buffer, codec->buffer_dma, | 498 | dma_free_attrs(dev, H2_BUF_SIZE, codec->buffer, codec->buffer_dma, |
496 | DMA_ATTR_NON_CONSISTENT); | 499 | DMA_ATTR_NON_CONSISTENT); |
497 | } | 500 | } |
498 | 501 | ||
@@ -540,7 +543,7 @@ static int hal2_playback_open(struct snd_pcm_substream *substream) | |||
540 | 543 | ||
541 | runtime->hw = hal2_pcm_hw; | 544 | runtime->hw = hal2_pcm_hw; |
542 | 545 | ||
543 | err = hal2_alloc_dmabuf(&hal2->dac); | 546 | err = hal2_alloc_dmabuf(hal2, &hal2->dac); |
544 | if (err) | 547 | if (err) |
545 | return err; | 548 | return err; |
546 | return 0; | 549 | return 0; |
@@ -550,7 +553,7 @@ static int hal2_playback_close(struct snd_pcm_substream *substream) | |||
550 | { | 553 | { |
551 | struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); | 554 | struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); |
552 | 555 | ||
553 | hal2_free_dmabuf(&hal2->dac); | 556 | hal2_free_dmabuf(hal2, &hal2->dac); |
554 | return 0; | 557 | return 0; |
555 | } | 558 | } |
556 | 559 | ||
@@ -606,7 +609,7 @@ static void hal2_playback_transfer(struct snd_pcm_substream *substream, | |||
606 | unsigned char *buf = hal2->dac.buffer + rec->hw_data; | 609 | unsigned char *buf = hal2->dac.buffer + rec->hw_data; |
607 | 610 | ||
608 | memcpy(buf, substream->runtime->dma_area + rec->sw_data, bytes); | 611 | memcpy(buf, substream->runtime->dma_area + rec->sw_data, bytes); |
609 | dma_cache_sync(NULL, buf, bytes, DMA_TO_DEVICE); | 612 | dma_cache_sync(hal2->card->dev, buf, bytes, DMA_TO_DEVICE); |
610 | 613 | ||
611 | } | 614 | } |
612 | 615 | ||
@@ -629,7 +632,7 @@ static int hal2_capture_open(struct snd_pcm_substream *substream) | |||
629 | 632 | ||
630 | runtime->hw = hal2_pcm_hw; | 633 | runtime->hw = hal2_pcm_hw; |
631 | 634 | ||
632 | err = hal2_alloc_dmabuf(adc); | 635 | err = hal2_alloc_dmabuf(hal2, adc); |
633 | if (err) | 636 | if (err) |
634 | return err; | 637 | return err; |
635 | return 0; | 638 | return 0; |
@@ -639,7 +642,7 @@ static int hal2_capture_close(struct snd_pcm_substream *substream) | |||
639 | { | 642 | { |
640 | struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); | 643 | struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); |
641 | 644 | ||
642 | hal2_free_dmabuf(&hal2->adc); | 645 | hal2_free_dmabuf(hal2, &hal2->adc); |
643 | return 0; | 646 | return 0; |
644 | } | 647 | } |
645 | 648 | ||
@@ -694,7 +697,7 @@ static void hal2_capture_transfer(struct snd_pcm_substream *substream, | |||
694 | struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); | 697 | struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); |
695 | unsigned char *buf = hal2->adc.buffer + rec->hw_data; | 698 | unsigned char *buf = hal2->adc.buffer + rec->hw_data; |
696 | 699 | ||
697 | dma_cache_sync(NULL, buf, bytes, DMA_FROM_DEVICE); | 700 | dma_cache_sync(hal2->card->dev, buf, bytes, DMA_FROM_DEVICE); |
698 | memcpy(substream->runtime->dma_area + rec->sw_data, buf, bytes); | 701 | memcpy(substream->runtime->dma_area + rec->sw_data, buf, bytes); |
699 | } | 702 | } |
700 | 703 | ||
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c index 3ec9391a4736..53a4ee01c522 100644 --- a/sound/mips/sgio2audio.c +++ b/sound/mips/sgio2audio.c | |||
@@ -805,7 +805,7 @@ static int snd_sgio2audio_free(struct snd_sgio2audio *chip) | |||
805 | free_irq(snd_sgio2_isr_table[i].irq, | 805 | free_irq(snd_sgio2_isr_table[i].irq, |
806 | &chip->channel[snd_sgio2_isr_table[i].idx]); | 806 | &chip->channel[snd_sgio2_isr_table[i].idx]); |
807 | 807 | ||
808 | dma_free_coherent(NULL, MACEISA_RINGBUFFERS_SIZE, | 808 | dma_free_coherent(chip->card->dev, MACEISA_RINGBUFFERS_SIZE, |
809 | chip->ring_base, chip->ring_base_dma); | 809 | chip->ring_base, chip->ring_base_dma); |
810 | 810 | ||
811 | /* release card data */ | 811 | /* release card data */ |
@@ -843,8 +843,9 @@ static int snd_sgio2audio_create(struct snd_card *card, | |||
843 | 843 | ||
844 | chip->card = card; | 844 | chip->card = card; |
845 | 845 | ||
846 | chip->ring_base = dma_alloc_coherent(NULL, MACEISA_RINGBUFFERS_SIZE, | 846 | chip->ring_base = dma_alloc_coherent(card->dev, |
847 | &chip->ring_base_dma, GFP_USER); | 847 | MACEISA_RINGBUFFERS_SIZE, |
848 | &chip->ring_base_dma, GFP_KERNEL); | ||
848 | if (chip->ring_base == NULL) { | 849 | if (chip->ring_base == NULL) { |
849 | printk(KERN_ERR | 850 | printk(KERN_ERR |
850 | "sgio2audio: could not allocate ring buffers\n"); | 851 | "sgio2audio: could not allocate ring buffers\n"); |
diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c index f36e7006e00c..a4264b8943f0 100644 --- a/sound/parisc/harmony.c +++ b/sound/parisc/harmony.c | |||
@@ -669,14 +669,8 @@ snd_harmony_pcm_init(struct snd_harmony *h) | |||
669 | } | 669 | } |
670 | 670 | ||
671 | /* pre-allocate space for DMA */ | 671 | /* pre-allocate space for DMA */ |
672 | err = snd_pcm_lib_preallocate_pages_for_all(pcm, h->dma.type, | 672 | snd_pcm_lib_preallocate_pages_for_all(pcm, h->dma.type, h->dma.dev, |
673 | h->dma.dev, | 673 | MAX_BUF_SIZE, MAX_BUF_SIZE); |
674 | MAX_BUF_SIZE, | ||
675 | MAX_BUF_SIZE); | ||
676 | if (err < 0) { | ||
677 | printk(KERN_ERR PFX "buffer allocation error: %d\n", err); | ||
678 | return err; | ||
679 | } | ||
680 | 674 | ||
681 | h->st.format = snd_harmony_set_data_format(h, | 675 | h->st.format = snd_harmony_set_data_format(h, |
682 | SNDRV_PCM_FORMAT_S16_BE, 1); | 676 | SNDRV_PCM_FORMAT_S16_BE, 1); |
diff --git a/sound/pci/ac97/ac97_proc.c b/sound/pci/ac97/ac97_proc.c index e120a11c69e8..20516b6907b5 100644 --- a/sound/pci/ac97/ac97_proc.c +++ b/sound/pci/ac97/ac97_proc.c | |||
@@ -436,25 +436,20 @@ void snd_ac97_proc_init(struct snd_ac97 * ac97) | |||
436 | return; | 436 | return; |
437 | prefix = ac97_is_audio(ac97) ? "ac97" : "mc97"; | 437 | prefix = ac97_is_audio(ac97) ? "ac97" : "mc97"; |
438 | sprintf(name, "%s#%d-%d", prefix, ac97->addr, ac97->num); | 438 | sprintf(name, "%s#%d-%d", prefix, ac97->addr, ac97->num); |
439 | if ((entry = snd_info_create_card_entry(ac97->bus->card, name, ac97->bus->proc)) != NULL) { | 439 | entry = snd_info_create_card_entry(ac97->bus->card, name, |
440 | ac97->bus->proc); | ||
441 | if (entry) | ||
440 | snd_info_set_text_ops(entry, ac97, snd_ac97_proc_read); | 442 | snd_info_set_text_ops(entry, ac97, snd_ac97_proc_read); |
441 | if (snd_info_register(entry) < 0) { | ||
442 | snd_info_free_entry(entry); | ||
443 | entry = NULL; | ||
444 | } | ||
445 | } | ||
446 | ac97->proc = entry; | 443 | ac97->proc = entry; |
447 | sprintf(name, "%s#%d-%d+regs", prefix, ac97->addr, ac97->num); | 444 | sprintf(name, "%s#%d-%d+regs", prefix, ac97->addr, ac97->num); |
448 | if ((entry = snd_info_create_card_entry(ac97->bus->card, name, ac97->bus->proc)) != NULL) { | 445 | entry = snd_info_create_card_entry(ac97->bus->card, name, |
446 | ac97->bus->proc); | ||
447 | if (entry) { | ||
449 | snd_info_set_text_ops(entry, ac97, snd_ac97_proc_regs_read); | 448 | snd_info_set_text_ops(entry, ac97, snd_ac97_proc_regs_read); |
450 | #ifdef CONFIG_SND_DEBUG | 449 | #ifdef CONFIG_SND_DEBUG |
451 | entry->mode |= 0200; | 450 | entry->mode |= 0200; |
452 | entry->c.text.write = snd_ac97_proc_regs_write; | 451 | entry->c.text.write = snd_ac97_proc_regs_write; |
453 | #endif | 452 | #endif |
454 | if (snd_info_register(entry) < 0) { | ||
455 | snd_info_free_entry(entry); | ||
456 | entry = NULL; | ||
457 | } | ||
458 | } | 453 | } |
459 | ac97->proc_regs = entry; | 454 | ac97->proc_regs = entry; |
460 | } | 455 | } |
@@ -473,13 +468,10 @@ void snd_ac97_bus_proc_init(struct snd_ac97_bus * bus) | |||
473 | char name[32]; | 468 | char name[32]; |
474 | 469 | ||
475 | sprintf(name, "codec97#%d", bus->num); | 470 | sprintf(name, "codec97#%d", bus->num); |
476 | if ((entry = snd_info_create_card_entry(bus->card, name, bus->card->proc_root)) != NULL) { | 471 | entry = snd_info_create_card_entry(bus->card, name, |
472 | bus->card->proc_root); | ||
473 | if (entry) | ||
477 | entry->mode = S_IFDIR | 0555; | 474 | entry->mode = S_IFDIR | 0555; |
478 | if (snd_info_register(entry) < 0) { | ||
479 | snd_info_free_entry(entry); | ||
480 | entry = NULL; | ||
481 | } | ||
482 | } | ||
483 | bus->proc = entry; | 475 | bus->proc = entry; |
484 | } | 476 | } |
485 | 477 | ||
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index d9c54c08e2db..fef07ae648e6 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c | |||
@@ -644,16 +644,11 @@ snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device) | |||
644 | chip->psubs = NULL; | 644 | chip->psubs = NULL; |
645 | chip->csubs = NULL; | 645 | chip->csubs = NULL; |
646 | 646 | ||
647 | err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 647 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
648 | snd_dma_pci_data(chip->pci), | 648 | snd_dma_pci_data(chip->pci), |
649 | BUFFER_BYTES_MAX / 2, | 649 | BUFFER_BYTES_MAX / 2, |
650 | BUFFER_BYTES_MAX); | 650 | BUFFER_BYTES_MAX); |
651 | 651 | ||
652 | if (err < 0) { | ||
653 | dev_err(chip->card->dev, "buffer allocation error: %d\n", err); | ||
654 | return err; | ||
655 | } | ||
656 | |||
657 | return 0; | 652 | return 0; |
658 | } | 653 | } |
659 | 654 | ||
@@ -741,10 +736,8 @@ snd_ad1889_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffe | |||
741 | static void | 736 | static void |
742 | snd_ad1889_proc_init(struct snd_ad1889 *chip) | 737 | snd_ad1889_proc_init(struct snd_ad1889 *chip) |
743 | { | 738 | { |
744 | struct snd_info_entry *entry; | 739 | snd_card_ro_proc_new(chip->card, chip->card->driver, |
745 | 740 | chip, snd_ad1889_proc_read); | |
746 | if (!snd_card_proc_new(chip->card, chip->card->driver, &entry)) | ||
747 | snd_info_set_text_ops(entry, chip, snd_ad1889_proc_read); | ||
748 | } | 741 | } |
749 | 742 | ||
750 | static const struct ac97_quirk ac97_quirks[] = { | 743 | static const struct ac97_quirk ac97_quirks[] = { |
diff --git a/sound/pci/ak4531_codec.c b/sound/pci/ak4531_codec.c index 2fb1fbba3e5e..11e902cac71b 100644 --- a/sound/pci/ak4531_codec.c +++ b/sound/pci/ak4531_codec.c | |||
@@ -481,8 +481,5 @@ static void snd_ak4531_proc_read(struct snd_info_entry *entry, | |||
481 | static void | 481 | static void |
482 | snd_ak4531_proc_init(struct snd_card *card, struct snd_ak4531 *ak4531) | 482 | snd_ak4531_proc_init(struct snd_card *card, struct snd_ak4531 *ak4531) |
483 | { | 483 | { |
484 | struct snd_info_entry *entry; | 484 | snd_card_ro_proc_new(card, "ak4531", ak4531, snd_ak4531_proc_read); |
485 | |||
486 | if (! snd_card_proc_new(card, "ak4531", &entry)) | ||
487 | snd_info_set_text_ops(entry, ak4531, snd_ak4531_proc_read); | ||
488 | } | 485 | } |
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index 9f569379b77e..f7fbe05836b3 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c | |||
@@ -1882,10 +1882,8 @@ static int ali_suspend(struct device *dev) | |||
1882 | return 0; | 1882 | return 0; |
1883 | 1883 | ||
1884 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1884 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1885 | for (i = 0; i < chip->num_of_codecs; i++) { | 1885 | for (i = 0; i < chip->num_of_codecs; i++) |
1886 | snd_pcm_suspend_all(chip->pcm[i]); | ||
1887 | snd_ac97_suspend(chip->ac97[i]); | 1886 | snd_ac97_suspend(chip->ac97[i]); |
1888 | } | ||
1889 | 1887 | ||
1890 | spin_lock_irq(&chip->reg_lock); | 1888 | spin_lock_irq(&chip->reg_lock); |
1891 | 1889 | ||
@@ -2051,9 +2049,7 @@ static void snd_ali_proc_read(struct snd_info_entry *entry, | |||
2051 | 2049 | ||
2052 | static void snd_ali_proc_init(struct snd_ali *codec) | 2050 | static void snd_ali_proc_init(struct snd_ali *codec) |
2053 | { | 2051 | { |
2054 | struct snd_info_entry *entry; | 2052 | snd_card_ro_proc_new(codec->card, "ali5451", codec, snd_ali_proc_read); |
2055 | if (!snd_card_proc_new(codec->card, "ali5451", &entry)) | ||
2056 | snd_info_set_text_ops(entry, codec, snd_ali_proc_read); | ||
2057 | } | 2053 | } |
2058 | 2054 | ||
2059 | static int snd_ali_resources(struct snd_ali *codec) | 2055 | static int snd_ali_resources(struct snd_ali *codec) |
diff --git a/sound/pci/als300.c b/sound/pci/als300.c index eaa2d853d922..516b3d9cbfdf 100644 --- a/sound/pci/als300.c +++ b/sound/pci/als300.c | |||
@@ -731,7 +731,6 @@ static int snd_als300_suspend(struct device *dev) | |||
731 | struct snd_als300 *chip = card->private_data; | 731 | struct snd_als300 *chip = card->private_data; |
732 | 732 | ||
733 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 733 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
734 | snd_pcm_suspend_all(chip->pcm); | ||
735 | snd_ac97_suspend(chip->ac97); | 734 | snd_ac97_suspend(chip->ac97); |
736 | return 0; | 735 | return 0; |
737 | } | 736 | } |
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index 26b097edec8c..45fa38382e79 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c | |||
@@ -994,7 +994,6 @@ static int snd_als4000_suspend(struct device *dev) | |||
994 | 994 | ||
995 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 995 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
996 | 996 | ||
997 | snd_pcm_suspend_all(chip->pcm); | ||
998 | snd_sbmixer_suspend(chip); | 997 | snd_sbmixer_suspend(chip); |
999 | return 0; | 998 | return 0; |
1000 | } | 999 | } |
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index aad74e809797..32b2f9802479 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c | |||
@@ -2782,10 +2782,8 @@ snd_asihpi_proc_read(struct snd_info_entry *entry, | |||
2782 | 2782 | ||
2783 | static void snd_asihpi_proc_init(struct snd_card_asihpi *asihpi) | 2783 | static void snd_asihpi_proc_init(struct snd_card_asihpi *asihpi) |
2784 | { | 2784 | { |
2785 | struct snd_info_entry *entry; | 2785 | snd_card_ro_proc_new(asihpi->card, "info", asihpi, |
2786 | 2786 | snd_asihpi_proc_read); | |
2787 | if (!snd_card_proc_new(asihpi->card, "info", &entry)) | ||
2788 | snd_info_set_text_ops(entry, asihpi, snd_asihpi_proc_read); | ||
2789 | } | 2787 | } |
2790 | 2788 | ||
2791 | /*------------------------------------------------------------ | 2789 | /*------------------------------------------------------------ |
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 1a41f8c80243..169763c88f5e 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c | |||
@@ -733,6 +733,10 @@ static int snd_atiixp_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
733 | case SNDRV_PCM_TRIGGER_START: | 733 | case SNDRV_PCM_TRIGGER_START: |
734 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 734 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
735 | case SNDRV_PCM_TRIGGER_RESUME: | 735 | case SNDRV_PCM_TRIGGER_RESUME: |
736 | if (dma->running && dma->suspended && | ||
737 | cmd == SNDRV_PCM_TRIGGER_RESUME) | ||
738 | writel(dma->saved_curptr, chip->remap_addr + | ||
739 | dma->ops->dt_cur); | ||
736 | dma->ops->enable_transfer(chip, 1); | 740 | dma->ops->enable_transfer(chip, 1); |
737 | dma->running = 1; | 741 | dma->running = 1; |
738 | dma->suspended = 0; | 742 | dma->suspended = 0; |
@@ -740,9 +744,12 @@ static int snd_atiixp_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
740 | case SNDRV_PCM_TRIGGER_STOP: | 744 | case SNDRV_PCM_TRIGGER_STOP: |
741 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 745 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
742 | case SNDRV_PCM_TRIGGER_SUSPEND: | 746 | case SNDRV_PCM_TRIGGER_SUSPEND: |
747 | dma->suspended = cmd == SNDRV_PCM_TRIGGER_SUSPEND; | ||
748 | if (dma->running && dma->suspended) | ||
749 | dma->saved_curptr = readl(chip->remap_addr + | ||
750 | dma->ops->dt_cur); | ||
743 | dma->ops->enable_transfer(chip, 0); | 751 | dma->ops->enable_transfer(chip, 0); |
744 | dma->running = 0; | 752 | dma->running = 0; |
745 | dma->suspended = cmd == SNDRV_PCM_TRIGGER_SUSPEND; | ||
746 | break; | 753 | break; |
747 | default: | 754 | default: |
748 | err = -EINVAL; | 755 | err = -EINVAL; |
@@ -1479,14 +1486,6 @@ static int snd_atiixp_suspend(struct device *dev) | |||
1479 | int i; | 1486 | int i; |
1480 | 1487 | ||
1481 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1488 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1482 | for (i = 0; i < NUM_ATI_PCMDEVS; i++) | ||
1483 | if (chip->pcmdevs[i]) { | ||
1484 | struct atiixp_dma *dma = &chip->dmas[i]; | ||
1485 | if (dma->substream && dma->running) | ||
1486 | dma->saved_curptr = readl(chip->remap_addr + | ||
1487 | dma->ops->dt_cur); | ||
1488 | snd_pcm_suspend_all(chip->pcmdevs[i]); | ||
1489 | } | ||
1490 | for (i = 0; i < NUM_ATI_CODECS; i++) | 1489 | for (i = 0; i < NUM_ATI_CODECS; i++) |
1491 | snd_ac97_suspend(chip->ac97[i]); | 1490 | snd_ac97_suspend(chip->ac97[i]); |
1492 | snd_atiixp_aclink_down(chip); | 1491 | snd_atiixp_aclink_down(chip); |
@@ -1514,8 +1513,6 @@ static int snd_atiixp_resume(struct device *dev) | |||
1514 | dma->substream->ops->prepare(dma->substream); | 1513 | dma->substream->ops->prepare(dma->substream); |
1515 | writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN, | 1514 | writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN, |
1516 | chip->remap_addr + dma->ops->llp_offset); | 1515 | chip->remap_addr + dma->ops->llp_offset); |
1517 | writel(dma->saved_curptr, chip->remap_addr + | ||
1518 | dma->ops->dt_cur); | ||
1519 | } | 1516 | } |
1520 | } | 1517 | } |
1521 | 1518 | ||
@@ -1546,10 +1543,7 @@ static void snd_atiixp_proc_read(struct snd_info_entry *entry, | |||
1546 | 1543 | ||
1547 | static void snd_atiixp_proc_init(struct atiixp *chip) | 1544 | static void snd_atiixp_proc_init(struct atiixp *chip) |
1548 | { | 1545 | { |
1549 | struct snd_info_entry *entry; | 1546 | snd_card_ro_proc_new(chip->card, "atiixp", chip, snd_atiixp_proc_read); |
1550 | |||
1551 | if (! snd_card_proc_new(chip->card, "atiixp", &entry)) | ||
1552 | snd_info_set_text_ops(entry, chip, snd_atiixp_proc_read); | ||
1553 | } | 1547 | } |
1554 | 1548 | ||
1555 | 1549 | ||
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index dc1de860cedf..cece66bb3644 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c | |||
@@ -1125,8 +1125,6 @@ static int snd_atiixp_suspend(struct device *dev) | |||
1125 | int i; | 1125 | int i; |
1126 | 1126 | ||
1127 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1127 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1128 | for (i = 0; i < NUM_ATI_PCMDEVS; i++) | ||
1129 | snd_pcm_suspend_all(chip->pcmdevs[i]); | ||
1130 | for (i = 0; i < NUM_ATI_CODECS; i++) | 1128 | for (i = 0; i < NUM_ATI_CODECS; i++) |
1131 | snd_ac97_suspend(chip->ac97[i]); | 1129 | snd_ac97_suspend(chip->ac97[i]); |
1132 | snd_atiixp_aclink_down(chip); | 1130 | snd_atiixp_aclink_down(chip); |
@@ -1172,10 +1170,8 @@ static void snd_atiixp_proc_read(struct snd_info_entry *entry, | |||
1172 | 1170 | ||
1173 | static void snd_atiixp_proc_init(struct atiixp_modem *chip) | 1171 | static void snd_atiixp_proc_init(struct atiixp_modem *chip) |
1174 | { | 1172 | { |
1175 | struct snd_info_entry *entry; | 1173 | snd_card_ro_proc_new(chip->card, "atiixp-modem", chip, |
1176 | 1174 | snd_atiixp_proc_read); | |
1177 | if (! snd_card_proc_new(chip->card, "atiixp-modem", &entry)) | ||
1178 | snd_info_set_text_ops(entry, chip, snd_atiixp_proc_read); | ||
1179 | } | 1175 | } |
1180 | 1176 | ||
1181 | 1177 | ||
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c index 9a49e4243a9c..b07c5fc1da56 100644 --- a/sound/pci/aw2/aw2-alsa.c +++ b/sound/pci/aw2/aw2-alsa.c | |||
@@ -624,15 +624,10 @@ static int snd_aw2_new_pcm(struct aw2 *chip) | |||
624 | 624 | ||
625 | /* pre-allocation of buffers */ | 625 | /* pre-allocation of buffers */ |
626 | /* Preallocate continuous pages. */ | 626 | /* Preallocate continuous pages. */ |
627 | err = snd_pcm_lib_preallocate_pages_for_all(pcm_playback_ana, | 627 | snd_pcm_lib_preallocate_pages_for_all(pcm_playback_ana, |
628 | SNDRV_DMA_TYPE_DEV, | 628 | SNDRV_DMA_TYPE_DEV, |
629 | snd_dma_pci_data | 629 | snd_dma_pci_data(chip->pci), |
630 | (chip->pci), | 630 | 64 * 1024, 64 * 1024); |
631 | 64 * 1024, 64 * 1024); | ||
632 | if (err) | ||
633 | dev_err(chip->card->dev, | ||
634 | "snd_pcm_lib_preallocate_pages_for_all error (0x%X)\n", | ||
635 | err); | ||
636 | 631 | ||
637 | err = snd_pcm_new(chip->card, "Audiowerk2 digital playback", 1, 1, 0, | 632 | err = snd_pcm_new(chip->card, "Audiowerk2 digital playback", 1, 1, 0, |
638 | &pcm_playback_num); | 633 | &pcm_playback_num); |
@@ -661,15 +656,10 @@ static int snd_aw2_new_pcm(struct aw2 *chip) | |||
661 | 656 | ||
662 | /* pre-allocation of buffers */ | 657 | /* pre-allocation of buffers */ |
663 | /* Preallocate continuous pages. */ | 658 | /* Preallocate continuous pages. */ |
664 | err = snd_pcm_lib_preallocate_pages_for_all(pcm_playback_num, | 659 | snd_pcm_lib_preallocate_pages_for_all(pcm_playback_num, |
665 | SNDRV_DMA_TYPE_DEV, | 660 | SNDRV_DMA_TYPE_DEV, |
666 | snd_dma_pci_data | 661 | snd_dma_pci_data(chip->pci), |
667 | (chip->pci), | 662 | 64 * 1024, 64 * 1024); |
668 | 64 * 1024, 64 * 1024); | ||
669 | if (err) | ||
670 | dev_err(chip->card->dev, | ||
671 | "snd_pcm_lib_preallocate_pages_for_all error (0x%X)\n", | ||
672 | err); | ||
673 | 663 | ||
674 | err = snd_pcm_new(chip->card, "Audiowerk2 capture", 2, 0, 1, | 664 | err = snd_pcm_new(chip->card, "Audiowerk2 capture", 2, 0, 1, |
675 | &pcm_capture); | 665 | &pcm_capture); |
@@ -699,16 +689,10 @@ static int snd_aw2_new_pcm(struct aw2 *chip) | |||
699 | 689 | ||
700 | /* pre-allocation of buffers */ | 690 | /* pre-allocation of buffers */ |
701 | /* Preallocate continuous pages. */ | 691 | /* Preallocate continuous pages. */ |
702 | err = snd_pcm_lib_preallocate_pages_for_all(pcm_capture, | 692 | snd_pcm_lib_preallocate_pages_for_all(pcm_capture, |
703 | SNDRV_DMA_TYPE_DEV, | 693 | SNDRV_DMA_TYPE_DEV, |
704 | snd_dma_pci_data | 694 | snd_dma_pci_data(chip->pci), |
705 | (chip->pci), | 695 | 64 * 1024, 64 * 1024); |
706 | 64 * 1024, 64 * 1024); | ||
707 | if (err) | ||
708 | dev_err(chip->card->dev, | ||
709 | "snd_pcm_lib_preallocate_pages_for_all error (0x%X)\n", | ||
710 | err); | ||
711 | |||
712 | 696 | ||
713 | /* Create control */ | 697 | /* Create control */ |
714 | err = snd_ctl_add(chip->card, snd_ctl_new1(&aw2_control, chip)); | 698 | err = snd_ctl_add(chip->card, snd_ctl_new1(&aw2_control, chip)); |
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index fc18c29a8173..90348817f096 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
@@ -2699,10 +2699,6 @@ snd_azf3328_suspend(struct device *dev) | |||
2699 | 2699 | ||
2700 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2700 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2701 | 2701 | ||
2702 | /* same pcm object for playback/capture */ | ||
2703 | snd_pcm_suspend_all(chip->pcm[AZF_CODEC_PLAYBACK]); | ||
2704 | snd_pcm_suspend_all(chip->pcm[AZF_CODEC_I2S_OUT]); | ||
2705 | |||
2706 | snd_azf3328_suspend_ac97(chip); | 2702 | snd_azf3328_suspend_ac97(chip); |
2707 | 2703 | ||
2708 | snd_azf3328_suspend_regs(chip, chip->ctrl_io, | 2704 | snd_azf3328_suspend_regs(chip, chip->ctrl_io, |
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index ba971042f871..0adcba10c067 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c | |||
@@ -714,11 +714,11 @@ static int snd_bt87x_pcm(struct snd_bt87x *chip, int device, char *name) | |||
714 | pcm->private_data = chip; | 714 | pcm->private_data = chip; |
715 | strcpy(pcm->name, name); | 715 | strcpy(pcm->name, name); |
716 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_bt87x_pcm_ops); | 716 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_bt87x_pcm_ops); |
717 | return snd_pcm_lib_preallocate_pages_for_all(pcm, | 717 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
718 | SNDRV_DMA_TYPE_DEV_SG, | 718 | snd_dma_pci_data(chip->pci), |
719 | snd_dma_pci_data(chip->pci), | 719 | 128 * 1024, |
720 | 128 * 1024, | 720 | ALIGN(255 * 4092, 1024)); |
721 | ALIGN(255 * 4092, 1024)); | 721 | return 0; |
722 | } | 722 | } |
723 | 723 | ||
724 | static int snd_bt87x_create(struct snd_card *card, | 724 | static int snd_bt87x_create(struct snd_card *card, |
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index cd27b5536654..11ef0d636405 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -1402,21 +1402,17 @@ static int snd_ca0106_pcm(struct snd_ca0106 *emu, int device) | |||
1402 | for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; | 1402 | for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; |
1403 | substream; | 1403 | substream; |
1404 | substream = substream->next) { | 1404 | substream = substream->next) { |
1405 | if ((err = snd_pcm_lib_preallocate_pages(substream, | 1405 | snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV, |
1406 | SNDRV_DMA_TYPE_DEV, | 1406 | snd_dma_pci_data(emu->pci), |
1407 | snd_dma_pci_data(emu->pci), | 1407 | 64*1024, 64*1024); |
1408 | 64*1024, 64*1024)) < 0) /* FIXME: 32*1024 for sound buffer, between 32and64 for Periods table. */ | ||
1409 | return err; | ||
1410 | } | 1408 | } |
1411 | 1409 | ||
1412 | for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; | 1410 | for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; |
1413 | substream; | 1411 | substream; |
1414 | substream = substream->next) { | 1412 | substream = substream->next) { |
1415 | if ((err = snd_pcm_lib_preallocate_pages(substream, | 1413 | snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV, |
1416 | SNDRV_DMA_TYPE_DEV, | 1414 | snd_dma_pci_data(emu->pci), |
1417 | snd_dma_pci_data(emu->pci), | 1415 | 64*1024, 64*1024); |
1418 | 64*1024, 64*1024)) < 0) | ||
1419 | return err; | ||
1420 | } | 1416 | } |
1421 | 1417 | ||
1422 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2, | 1418 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2, |
@@ -1910,11 +1906,8 @@ static int snd_ca0106_suspend(struct device *dev) | |||
1910 | { | 1906 | { |
1911 | struct snd_card *card = dev_get_drvdata(dev); | 1907 | struct snd_card *card = dev_get_drvdata(dev); |
1912 | struct snd_ca0106 *chip = card->private_data; | 1908 | struct snd_ca0106 *chip = card->private_data; |
1913 | int i; | ||
1914 | 1909 | ||
1915 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1910 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1916 | for (i = 0; i < 4; i++) | ||
1917 | snd_pcm_suspend_all(chip->pcm[i]); | ||
1918 | if (chip->details->ac97) | 1911 | if (chip->details->ac97) |
1919 | snd_ac97_suspend(chip->ac97); | 1912 | snd_ac97_suspend(chip->ac97); |
1920 | snd_ca0106_mixer_suspend(chip); | 1913 | snd_ca0106_mixer_suspend(chip); |
diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c index a2c85cc37972..f5b8934db735 100644 --- a/sound/pci/ca0106/ca0106_proc.c +++ b/sound/pci/ca0106/ca0106_proc.c | |||
@@ -424,30 +424,20 @@ static void snd_ca0106_proc_i2c_write(struct snd_info_entry *entry, | |||
424 | 424 | ||
425 | int snd_ca0106_proc_init(struct snd_ca0106 *emu) | 425 | int snd_ca0106_proc_init(struct snd_ca0106 *emu) |
426 | { | 426 | { |
427 | struct snd_info_entry *entry; | 427 | snd_card_ro_proc_new(emu->card, "iec958", emu, snd_ca0106_proc_iec958); |
428 | 428 | snd_card_rw_proc_new(emu->card, "ca0106_reg32", emu, | |
429 | if(! snd_card_proc_new(emu->card, "iec958", &entry)) | 429 | snd_ca0106_proc_reg_read32, |
430 | snd_info_set_text_ops(entry, emu, snd_ca0106_proc_iec958); | 430 | snd_ca0106_proc_reg_write32); |
431 | if(! snd_card_proc_new(emu->card, "ca0106_reg32", &entry)) { | 431 | snd_card_ro_proc_new(emu->card, "ca0106_reg16", emu, |
432 | snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read32); | 432 | snd_ca0106_proc_reg_read16); |
433 | entry->c.text.write = snd_ca0106_proc_reg_write32; | 433 | snd_card_ro_proc_new(emu->card, "ca0106_reg8", emu, |
434 | entry->mode |= 0200; | 434 | snd_ca0106_proc_reg_read8); |
435 | } | 435 | snd_card_rw_proc_new(emu->card, "ca0106_regs1", emu, |
436 | if(! snd_card_proc_new(emu->card, "ca0106_reg16", &entry)) | 436 | snd_ca0106_proc_reg_read1, |
437 | snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read16); | 437 | snd_ca0106_proc_reg_write); |
438 | if(! snd_card_proc_new(emu->card, "ca0106_reg8", &entry)) | 438 | snd_card_rw_proc_new(emu->card, "ca0106_i2c", emu, NULL, |
439 | snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read8); | 439 | snd_ca0106_proc_i2c_write); |
440 | if(! snd_card_proc_new(emu->card, "ca0106_regs1", &entry)) { | 440 | snd_card_ro_proc_new(emu->card, "ca0106_regs2", emu, |
441 | snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read1); | 441 | snd_ca0106_proc_reg_read2); |
442 | entry->c.text.write = snd_ca0106_proc_reg_write; | ||
443 | entry->mode |= 0200; | ||
444 | } | ||
445 | if(! snd_card_proc_new(emu->card, "ca0106_i2c", &entry)) { | ||
446 | entry->c.text.write = snd_ca0106_proc_i2c_write; | ||
447 | entry->private_data = emu; | ||
448 | entry->mode |= 0200; | ||
449 | } | ||
450 | if(! snd_card_proc_new(emu->card, "ca0106_regs2", &entry)) | ||
451 | snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read2); | ||
452 | return 0; | 442 | return 0; |
453 | } | 443 | } |
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 452cc79b44af..701be04aed53 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c | |||
@@ -2792,10 +2792,7 @@ static void snd_cmipci_proc_read(struct snd_info_entry *entry, | |||
2792 | 2792 | ||
2793 | static void snd_cmipci_proc_init(struct cmipci *cm) | 2793 | static void snd_cmipci_proc_init(struct cmipci *cm) |
2794 | { | 2794 | { |
2795 | struct snd_info_entry *entry; | 2795 | snd_card_ro_proc_new(cm->card, "cmipci", cm, snd_cmipci_proc_read); |
2796 | |||
2797 | if (! snd_card_proc_new(cm->card, "cmipci", &entry)) | ||
2798 | snd_info_set_text_ops(entry, cm, snd_cmipci_proc_read); | ||
2799 | } | 2796 | } |
2800 | 2797 | ||
2801 | static const struct pci_device_id snd_cmipci_ids[] = { | 2798 | static const struct pci_device_id snd_cmipci_ids[] = { |
@@ -3351,10 +3348,6 @@ static int snd_cmipci_suspend(struct device *dev) | |||
3351 | 3348 | ||
3352 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 3349 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
3353 | 3350 | ||
3354 | snd_pcm_suspend_all(cm->pcm); | ||
3355 | snd_pcm_suspend_all(cm->pcm2); | ||
3356 | snd_pcm_suspend_all(cm->pcm_spdif); | ||
3357 | |||
3358 | /* save registers */ | 3351 | /* save registers */ |
3359 | for (i = 0; i < ARRAY_SIZE(saved_regs); i++) | 3352 | for (i = 0; i < ARRAY_SIZE(saved_regs); i++) |
3360 | cm->saved_regs[i] = snd_cmipci_read(cm, saved_regs[i]); | 3353 | cm->saved_regs[i] = snd_cmipci_read(cm, saved_regs[i]); |
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index ec4247638fa1..15bbf9564c82 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c | |||
@@ -1174,8 +1174,7 @@ static void snd_cs4281_proc_init(struct cs4281 *chip) | |||
1174 | { | 1174 | { |
1175 | struct snd_info_entry *entry; | 1175 | struct snd_info_entry *entry; |
1176 | 1176 | ||
1177 | if (! snd_card_proc_new(chip->card, "cs4281", &entry)) | 1177 | snd_card_ro_proc_new(chip->card, "cs4281", chip, snd_cs4281_proc_read); |
1178 | snd_info_set_text_ops(entry, chip, snd_cs4281_proc_read); | ||
1179 | if (! snd_card_proc_new(chip->card, "cs4281_BA0", &entry)) { | 1178 | if (! snd_card_proc_new(chip->card, "cs4281_BA0", &entry)) { |
1180 | entry->content = SNDRV_INFO_CONTENT_DATA; | 1179 | entry->content = SNDRV_INFO_CONTENT_DATA; |
1181 | entry->private_data = chip; | 1180 | entry->private_data = chip; |
@@ -2002,8 +2001,6 @@ static int cs4281_suspend(struct device *dev) | |||
2002 | unsigned int i; | 2001 | unsigned int i; |
2003 | 2002 | ||
2004 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2003 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2005 | snd_pcm_suspend_all(chip->pcm); | ||
2006 | |||
2007 | snd_ac97_suspend(chip->ac97); | 2004 | snd_ac97_suspend(chip->ac97); |
2008 | snd_ac97_suspend(chip->ac97_secondary); | 2005 | snd_ac97_suspend(chip->ac97_secondary); |
2009 | 2006 | ||
diff --git a/sound/pci/cs46xx/cs46xx_dsp_spos.h b/sound/pci/cs46xx/cs46xx_dsp_spos.h index 8008c59288a6..a02e1e19c021 100644 --- a/sound/pci/cs46xx/cs46xx_dsp_spos.h +++ b/sound/pci/cs46xx/cs46xx_dsp_spos.h | |||
@@ -177,22 +177,16 @@ struct dsp_spos_instance { | |||
177 | /* proc fs */ | 177 | /* proc fs */ |
178 | struct snd_card *snd_card; | 178 | struct snd_card *snd_card; |
179 | struct snd_info_entry * proc_dsp_dir; | 179 | struct snd_info_entry * proc_dsp_dir; |
180 | struct snd_info_entry * proc_sym_info_entry; | ||
181 | struct snd_info_entry * proc_modules_info_entry; | ||
182 | struct snd_info_entry * proc_parameter_dump_info_entry; | ||
183 | struct snd_info_entry * proc_sample_dump_info_entry; | ||
184 | 180 | ||
185 | /* SCB's descriptors */ | 181 | /* SCB's descriptors */ |
186 | int nscb; | 182 | int nscb; |
187 | int scb_highest_frag_index; | 183 | int scb_highest_frag_index; |
188 | struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC]; | 184 | struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC]; |
189 | struct snd_info_entry * proc_scb_info_entry; | ||
190 | struct dsp_scb_descriptor * the_null_scb; | 185 | struct dsp_scb_descriptor * the_null_scb; |
191 | 186 | ||
192 | /* Task's descriptors */ | 187 | /* Task's descriptors */ |
193 | int ntask; | 188 | int ntask; |
194 | struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC]; | 189 | struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC]; |
195 | struct snd_info_entry * proc_task_info_entry; | ||
196 | 190 | ||
197 | /* SPDIF status */ | 191 | /* SPDIF status */ |
198 | int spdif_status_out; | 192 | int spdif_status_out; |
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 750eec437a79..a77d4cc44028 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c | |||
@@ -3781,12 +3781,6 @@ static int snd_cs46xx_suspend(struct device *dev) | |||
3781 | 3781 | ||
3782 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 3782 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
3783 | chip->in_suspend = 1; | 3783 | chip->in_suspend = 1; |
3784 | snd_pcm_suspend_all(chip->pcm); | ||
3785 | #ifdef CONFIG_SND_CS46XX_NEW_DSP | ||
3786 | snd_pcm_suspend_all(chip->pcm_rear); | ||
3787 | snd_pcm_suspend_all(chip->pcm_center_lfe); | ||
3788 | snd_pcm_suspend_all(chip->pcm_iec958); | ||
3789 | #endif | ||
3790 | // chip->ac97_powerdown = snd_cs46xx_codec_read(chip, AC97_POWER_CONTROL); | 3784 | // chip->ac97_powerdown = snd_cs46xx_codec_read(chip, AC97_POWER_CONTROL); |
3791 | // chip->ac97_general_purpose = snd_cs46xx_codec_read(chip, BA0_AC97_GENERAL_PURPOSE); | 3785 | // chip->ac97_general_purpose = snd_cs46xx_codec_read(chip, BA0_AC97_GENERAL_PURPOSE); |
3792 | 3786 | ||
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c index 5fc497c6d738..c28e58602679 100644 --- a/sound/pci/cs46xx/dsp_spos.c +++ b/sound/pci/cs46xx/dsp_spos.c | |||
@@ -799,92 +799,49 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) | |||
799 | 799 | ||
800 | ins->snd_card = card; | 800 | ins->snd_card = card; |
801 | 801 | ||
802 | if ((entry = snd_info_create_card_entry(card, "dsp", card->proc_root)) != NULL) { | 802 | entry = snd_info_create_card_entry(card, "dsp", card->proc_root); |
803 | entry->content = SNDRV_INFO_CONTENT_TEXT; | 803 | if (entry) |
804 | entry->mode = S_IFDIR | 0555; | 804 | entry->mode = S_IFDIR | 0555; |
805 | |||
806 | if (snd_info_register(entry) < 0) { | ||
807 | snd_info_free_entry(entry); | ||
808 | entry = NULL; | ||
809 | } | ||
810 | } | ||
811 | |||
812 | ins->proc_dsp_dir = entry; | 805 | ins->proc_dsp_dir = entry; |
813 | 806 | ||
814 | if (!ins->proc_dsp_dir) | 807 | if (!ins->proc_dsp_dir) |
815 | return -ENOMEM; | 808 | return -ENOMEM; |
816 | 809 | ||
817 | if ((entry = snd_info_create_card_entry(card, "spos_symbols", ins->proc_dsp_dir)) != NULL) { | 810 | entry = snd_info_create_card_entry(card, "spos_symbols", |
818 | entry->content = SNDRV_INFO_CONTENT_TEXT; | 811 | ins->proc_dsp_dir); |
819 | entry->private_data = chip; | 812 | if (entry) |
820 | entry->mode = S_IFREG | 0644; | 813 | snd_info_set_text_ops(entry, chip, |
821 | entry->c.text.read = cs46xx_dsp_proc_symbol_table_read; | 814 | cs46xx_dsp_proc_symbol_table_read); |
822 | if (snd_info_register(entry) < 0) { | ||
823 | snd_info_free_entry(entry); | ||
824 | entry = NULL; | ||
825 | } | ||
826 | } | ||
827 | ins->proc_sym_info_entry = entry; | ||
828 | 815 | ||
829 | if ((entry = snd_info_create_card_entry(card, "spos_modules", ins->proc_dsp_dir)) != NULL) { | 816 | entry = snd_info_create_card_entry(card, "spos_modules", |
830 | entry->content = SNDRV_INFO_CONTENT_TEXT; | 817 | ins->proc_dsp_dir); |
831 | entry->private_data = chip; | 818 | if (entry) |
832 | entry->mode = S_IFREG | 0644; | 819 | snd_info_set_text_ops(entry, chip, |
833 | entry->c.text.read = cs46xx_dsp_proc_modules_read; | 820 | cs46xx_dsp_proc_modules_read); |
834 | if (snd_info_register(entry) < 0) { | 821 | |
835 | snd_info_free_entry(entry); | 822 | entry = snd_info_create_card_entry(card, "parameter", |
836 | entry = NULL; | 823 | ins->proc_dsp_dir); |
837 | } | 824 | if (entry) |
838 | } | 825 | snd_info_set_text_ops(entry, chip, |
839 | ins->proc_modules_info_entry = entry; | 826 | cs46xx_dsp_proc_parameter_dump_read); |
840 | 827 | ||
841 | if ((entry = snd_info_create_card_entry(card, "parameter", ins->proc_dsp_dir)) != NULL) { | 828 | entry = snd_info_create_card_entry(card, "sample", |
842 | entry->content = SNDRV_INFO_CONTENT_TEXT; | 829 | ins->proc_dsp_dir); |
843 | entry->private_data = chip; | 830 | if (entry) |
844 | entry->mode = S_IFREG | 0644; | 831 | snd_info_set_text_ops(entry, chip, |
845 | entry->c.text.read = cs46xx_dsp_proc_parameter_dump_read; | 832 | cs46xx_dsp_proc_sample_dump_read); |
846 | if (snd_info_register(entry) < 0) { | 833 | |
847 | snd_info_free_entry(entry); | 834 | entry = snd_info_create_card_entry(card, "task_tree", |
848 | entry = NULL; | 835 | ins->proc_dsp_dir); |
849 | } | 836 | if (entry) |
850 | } | 837 | snd_info_set_text_ops(entry, chip, |
851 | ins->proc_parameter_dump_info_entry = entry; | 838 | cs46xx_dsp_proc_task_tree_read); |
852 | 839 | ||
853 | if ((entry = snd_info_create_card_entry(card, "sample", ins->proc_dsp_dir)) != NULL) { | 840 | entry = snd_info_create_card_entry(card, "scb_info", |
854 | entry->content = SNDRV_INFO_CONTENT_TEXT; | 841 | ins->proc_dsp_dir); |
855 | entry->private_data = chip; | 842 | if (entry) |
856 | entry->mode = S_IFREG | 0644; | 843 | snd_info_set_text_ops(entry, chip, |
857 | entry->c.text.read = cs46xx_dsp_proc_sample_dump_read; | 844 | cs46xx_dsp_proc_scb_read); |
858 | if (snd_info_register(entry) < 0) { | ||
859 | snd_info_free_entry(entry); | ||
860 | entry = NULL; | ||
861 | } | ||
862 | } | ||
863 | ins->proc_sample_dump_info_entry = entry; | ||
864 | |||
865 | if ((entry = snd_info_create_card_entry(card, "task_tree", ins->proc_dsp_dir)) != NULL) { | ||
866 | entry->content = SNDRV_INFO_CONTENT_TEXT; | ||
867 | entry->private_data = chip; | ||
868 | entry->mode = S_IFREG | 0644; | ||
869 | entry->c.text.read = cs46xx_dsp_proc_task_tree_read; | ||
870 | if (snd_info_register(entry) < 0) { | ||
871 | snd_info_free_entry(entry); | ||
872 | entry = NULL; | ||
873 | } | ||
874 | } | ||
875 | ins->proc_task_info_entry = entry; | ||
876 | |||
877 | if ((entry = snd_info_create_card_entry(card, "scb_info", ins->proc_dsp_dir)) != NULL) { | ||
878 | entry->content = SNDRV_INFO_CONTENT_TEXT; | ||
879 | entry->private_data = chip; | ||
880 | entry->mode = S_IFREG | 0644; | ||
881 | entry->c.text.read = cs46xx_dsp_proc_scb_read; | ||
882 | if (snd_info_register(entry) < 0) { | ||
883 | snd_info_free_entry(entry); | ||
884 | entry = NULL; | ||
885 | } | ||
886 | } | ||
887 | ins->proc_scb_info_entry = entry; | ||
888 | 845 | ||
889 | mutex_lock(&chip->spos_mutex); | 846 | mutex_lock(&chip->spos_mutex); |
890 | /* register/update SCB's entries on proc */ | 847 | /* register/update SCB's entries on proc */ |
@@ -906,24 +863,6 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip) | |||
906 | if (!ins) | 863 | if (!ins) |
907 | return 0; | 864 | return 0; |
908 | 865 | ||
909 | snd_info_free_entry(ins->proc_sym_info_entry); | ||
910 | ins->proc_sym_info_entry = NULL; | ||
911 | |||
912 | snd_info_free_entry(ins->proc_modules_info_entry); | ||
913 | ins->proc_modules_info_entry = NULL; | ||
914 | |||
915 | snd_info_free_entry(ins->proc_parameter_dump_info_entry); | ||
916 | ins->proc_parameter_dump_info_entry = NULL; | ||
917 | |||
918 | snd_info_free_entry(ins->proc_sample_dump_info_entry); | ||
919 | ins->proc_sample_dump_info_entry = NULL; | ||
920 | |||
921 | snd_info_free_entry(ins->proc_scb_info_entry); | ||
922 | ins->proc_scb_info_entry = NULL; | ||
923 | |||
924 | snd_info_free_entry(ins->proc_task_info_entry); | ||
925 | ins->proc_task_info_entry = NULL; | ||
926 | |||
927 | mutex_lock(&chip->spos_mutex); | 866 | mutex_lock(&chip->spos_mutex); |
928 | for (i = 0; i < ins->nscb; ++i) { | 867 | for (i = 0; i < ins->nscb; ++i) { |
929 | if (ins->scbs[i].deleted) continue; | 868 | if (ins->scbs[i].deleted) continue; |
diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c index 8d0a3d357345..1d9d610262de 100644 --- a/sound/pci/cs46xx/dsp_spos_scb_lib.c +++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c | |||
@@ -254,8 +254,9 @@ void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip, | |||
254 | if (ins->snd_card != NULL && ins->proc_dsp_dir != NULL && | 254 | if (ins->snd_card != NULL && ins->proc_dsp_dir != NULL && |
255 | scb->proc_info == NULL) { | 255 | scb->proc_info == NULL) { |
256 | 256 | ||
257 | if ((entry = snd_info_create_card_entry(ins->snd_card, scb->scb_name, | 257 | entry = snd_info_create_card_entry(ins->snd_card, scb->scb_name, |
258 | ins->proc_dsp_dir)) != NULL) { | 258 | ins->proc_dsp_dir); |
259 | if (entry) { | ||
259 | scb_info = kmalloc(sizeof(struct proc_scb_info), GFP_KERNEL); | 260 | scb_info = kmalloc(sizeof(struct proc_scb_info), GFP_KERNEL); |
260 | if (!scb_info) { | 261 | if (!scb_info) { |
261 | snd_info_free_entry(entry); | 262 | snd_info_free_entry(entry); |
@@ -265,18 +266,8 @@ void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip, | |||
265 | 266 | ||
266 | scb_info->chip = chip; | 267 | scb_info->chip = chip; |
267 | scb_info->scb_desc = scb; | 268 | scb_info->scb_desc = scb; |
268 | 269 | snd_info_set_text_ops(entry, scb_info, | |
269 | entry->content = SNDRV_INFO_CONTENT_TEXT; | 270 | cs46xx_dsp_proc_scb_info_read); |
270 | entry->private_data = scb_info; | ||
271 | entry->mode = S_IFREG | 0644; | ||
272 | |||
273 | entry->c.text.read = cs46xx_dsp_proc_scb_info_read; | ||
274 | |||
275 | if (snd_info_register(entry) < 0) { | ||
276 | snd_info_free_entry(entry); | ||
277 | kfree (scb_info); | ||
278 | entry = NULL; | ||
279 | } | ||
280 | } | 271 | } |
281 | out: | 272 | out: |
282 | scb->proc_info = entry; | 273 | scb->proc_info = entry; |
diff --git a/sound/pci/cs5535audio/cs5535audio_pm.c b/sound/pci/cs5535audio/cs5535audio_pm.c index 82bd10b68a77..446ef1f1b45a 100644 --- a/sound/pci/cs5535audio/cs5535audio_pm.c +++ b/sound/pci/cs5535audio/cs5535audio_pm.c | |||
@@ -62,7 +62,6 @@ static int __maybe_unused snd_cs5535audio_suspend(struct device *dev) | |||
62 | int i; | 62 | int i; |
63 | 63 | ||
64 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 64 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
65 | snd_pcm_suspend_all(cs5535au->pcm); | ||
66 | snd_ac97_suspend(cs5535au->ac97); | 65 | snd_ac97_suspend(cs5535au->ac97); |
67 | for (i = 0; i < NUM_CS5535AUDIO_DMAS; i++) { | 66 | for (i = 0; i < NUM_CS5535AUDIO_DMAS; i++) { |
68 | struct cs5535audio_dma *dma = &cs5535au->dmas[i]; | 67 | struct cs5535audio_dma *dma = &cs5535au->dmas[i]; |
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c index 2ada8444abd9..e622613ea947 100644 --- a/sound/pci/ctxfi/ctatc.c +++ b/sound/pci/ctxfi/ctatc.c | |||
@@ -1548,18 +1548,10 @@ static void atc_connect_resources(struct ct_atc *atc) | |||
1548 | #ifdef CONFIG_PM_SLEEP | 1548 | #ifdef CONFIG_PM_SLEEP |
1549 | static int atc_suspend(struct ct_atc *atc) | 1549 | static int atc_suspend(struct ct_atc *atc) |
1550 | { | 1550 | { |
1551 | int i; | ||
1552 | struct hw *hw = atc->hw; | 1551 | struct hw *hw = atc->hw; |
1553 | 1552 | ||
1554 | snd_power_change_state(atc->card, SNDRV_CTL_POWER_D3hot); | 1553 | snd_power_change_state(atc->card, SNDRV_CTL_POWER_D3hot); |
1555 | 1554 | ||
1556 | for (i = FRONT; i < NUM_PCMS; i++) { | ||
1557 | if (!atc->pcms[i]) | ||
1558 | continue; | ||
1559 | |||
1560 | snd_pcm_suspend_all(atc->pcms[i]); | ||
1561 | } | ||
1562 | |||
1563 | atc_release_resources(atc); | 1555 | atc_release_resources(atc); |
1564 | 1556 | ||
1565 | hw->suspend(hw); | 1557 | hw->suspend(hw); |
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 907cf1a46712..ea876b0b02b9 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c | |||
@@ -884,17 +884,15 @@ static const struct snd_pcm_ops digital_capture_ops = { | |||
884 | static int snd_echo_preallocate_pages(struct snd_pcm *pcm, struct device *dev) | 884 | static int snd_echo_preallocate_pages(struct snd_pcm *pcm, struct device *dev) |
885 | { | 885 | { |
886 | struct snd_pcm_substream *ss; | 886 | struct snd_pcm_substream *ss; |
887 | int stream, err; | 887 | int stream; |
888 | 888 | ||
889 | for (stream = 0; stream < 2; stream++) | 889 | for (stream = 0; stream < 2; stream++) |
890 | for (ss = pcm->streams[stream].substream; ss; ss = ss->next) { | 890 | for (ss = pcm->streams[stream].substream; ss; ss = ss->next) |
891 | err = snd_pcm_lib_preallocate_pages(ss, SNDRV_DMA_TYPE_DEV_SG, | 891 | snd_pcm_lib_preallocate_pages(ss, SNDRV_DMA_TYPE_DEV_SG, |
892 | dev, | 892 | dev, |
893 | ss->number ? 0 : 128<<10, | 893 | ss->number ? 0 : 128<<10, |
894 | 256<<10); | 894 | 256<<10); |
895 | if (err < 0) | 895 | |
896 | return err; | ||
897 | } | ||
898 | return 0; | 896 | return 0; |
899 | } | 897 | } |
900 | 898 | ||
@@ -2165,9 +2163,6 @@ static int snd_echo_suspend(struct device *dev) | |||
2165 | { | 2163 | { |
2166 | struct echoaudio *chip = dev_get_drvdata(dev); | 2164 | struct echoaudio *chip = dev_get_drvdata(dev); |
2167 | 2165 | ||
2168 | snd_pcm_suspend_all(chip->analog_pcm); | ||
2169 | snd_pcm_suspend_all(chip->digital_pcm); | ||
2170 | |||
2171 | #ifdef ECHOCARD_HAS_MIDI | 2166 | #ifdef ECHOCARD_HAS_MIDI |
2172 | /* This call can sleep */ | 2167 | /* This call can sleep */ |
2173 | if (chip->midi_out) | 2168 | if (chip->midi_out) |
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index d3203df50a1a..3c41a0edcfb0 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c | |||
@@ -224,12 +224,6 @@ static int snd_emu10k1_suspend(struct device *dev) | |||
224 | 224 | ||
225 | cancel_delayed_work_sync(&emu->emu1010.firmware_work); | 225 | cancel_delayed_work_sync(&emu->emu1010.firmware_work); |
226 | 226 | ||
227 | snd_pcm_suspend_all(emu->pcm); | ||
228 | snd_pcm_suspend_all(emu->pcm_mic); | ||
229 | snd_pcm_suspend_all(emu->pcm_efx); | ||
230 | snd_pcm_suspend_all(emu->pcm_multi); | ||
231 | snd_pcm_suspend_all(emu->pcm_p16v); | ||
232 | |||
233 | snd_ac97_suspend(emu->ac97); | 227 | snd_ac97_suspend(emu->ac97); |
234 | 228 | ||
235 | snd_emu10k1_efx_suspend(emu); | 229 | snd_emu10k1_efx_suspend(emu); |
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 611589cbdad6..576c7bd03a1a 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c | |||
@@ -1065,15 +1065,9 @@ static void snd_emu10k1x_proc_reg_write(struct snd_info_entry *entry, | |||
1065 | 1065 | ||
1066 | static int snd_emu10k1x_proc_init(struct emu10k1x *emu) | 1066 | static int snd_emu10k1x_proc_init(struct emu10k1x *emu) |
1067 | { | 1067 | { |
1068 | struct snd_info_entry *entry; | 1068 | snd_card_rw_proc_new(emu->card, "emu10k1x_regs", emu, |
1069 | 1069 | snd_emu10k1x_proc_reg_read, | |
1070 | if(! snd_card_proc_new(emu->card, "emu10k1x_regs", &entry)) { | 1070 | snd_emu10k1x_proc_reg_write); |
1071 | snd_info_set_text_ops(entry, emu, snd_emu10k1x_proc_reg_read); | ||
1072 | entry->c.text.write = snd_emu10k1x_proc_reg_write; | ||
1073 | entry->mode |= 0200; | ||
1074 | entry->private_data = emu; | ||
1075 | } | ||
1076 | |||
1077 | return 0; | 1071 | return 0; |
1078 | } | 1072 | } |
1079 | 1073 | ||
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index 30b3472d0b75..f6b4cb9ac75c 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c | |||
@@ -1427,11 +1427,14 @@ int snd_emu10k1_pcm(struct snd_emu10k1 *emu, int device) | |||
1427 | emu->pcm = pcm; | 1427 | emu->pcm = pcm; |
1428 | 1428 | ||
1429 | for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next) | 1429 | for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next) |
1430 | if ((err = snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV_SG, snd_dma_pci_data(emu->pci), 64*1024, 64*1024)) < 0) | 1430 | snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV_SG, |
1431 | return err; | 1431 | snd_dma_pci_data(emu->pci), |
1432 | 64*1024, 64*1024); | ||
1432 | 1433 | ||
1433 | for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; substream; substream = substream->next) | 1434 | for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; substream; substream = substream->next) |
1434 | snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); | 1435 | snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV, |
1436 | snd_dma_pci_data(emu->pci), | ||
1437 | 64*1024, 64*1024); | ||
1435 | 1438 | ||
1436 | return 0; | 1439 | return 0; |
1437 | } | 1440 | } |
@@ -1455,8 +1458,9 @@ int snd_emu10k1_pcm_multi(struct snd_emu10k1 *emu, int device) | |||
1455 | emu->pcm_multi = pcm; | 1458 | emu->pcm_multi = pcm; |
1456 | 1459 | ||
1457 | for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next) | 1460 | for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next) |
1458 | if ((err = snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV_SG, snd_dma_pci_data(emu->pci), 64*1024, 64*1024)) < 0) | 1461 | snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV_SG, |
1459 | return err; | 1462 | snd_dma_pci_data(emu->pci), |
1463 | 64*1024, 64*1024); | ||
1460 | 1464 | ||
1461 | return 0; | 1465 | return 0; |
1462 | } | 1466 | } |
@@ -1489,7 +1493,9 @@ int snd_emu10k1_pcm_mic(struct snd_emu10k1 *emu, int device) | |||
1489 | strcpy(pcm->name, "Mic Capture"); | 1493 | strcpy(pcm->name, "Mic Capture"); |
1490 | emu->pcm_mic = pcm; | 1494 | emu->pcm_mic = pcm; |
1491 | 1495 | ||
1492 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); | 1496 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1497 | snd_dma_pci_data(emu->pci), | ||
1498 | 64*1024, 64*1024); | ||
1493 | 1499 | ||
1494 | return 0; | 1500 | return 0; |
1495 | } | 1501 | } |
@@ -1862,7 +1868,9 @@ int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device) | |||
1862 | if (err < 0) | 1868 | if (err < 0) |
1863 | return err; | 1869 | return err; |
1864 | 1870 | ||
1865 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); | 1871 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1872 | snd_dma_pci_data(emu->pci), | ||
1873 | 64*1024, 64*1024); | ||
1866 | 1874 | ||
1867 | return 0; | 1875 | return 0; |
1868 | } | 1876 | } |
diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index b57008031792..a3d9f06e8e6a 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c | |||
@@ -568,55 +568,40 @@ int snd_emu10k1_proc_init(struct snd_emu10k1 *emu) | |||
568 | struct snd_info_entry *entry; | 568 | struct snd_info_entry *entry; |
569 | #ifdef CONFIG_SND_DEBUG | 569 | #ifdef CONFIG_SND_DEBUG |
570 | if (emu->card_capabilities->emu_model) { | 570 | if (emu->card_capabilities->emu_model) { |
571 | if (! snd_card_proc_new(emu->card, "emu1010_regs", &entry)) | 571 | snd_card_ro_proc_new(emu->card, "emu1010_regs", |
572 | snd_info_set_text_ops(entry, emu, snd_emu_proc_emu1010_reg_read); | 572 | emu, snd_emu_proc_emu1010_reg_read); |
573 | } | ||
574 | if (! snd_card_proc_new(emu->card, "io_regs", &entry)) { | ||
575 | snd_info_set_text_ops(entry, emu, snd_emu_proc_io_reg_read); | ||
576 | entry->c.text.write = snd_emu_proc_io_reg_write; | ||
577 | entry->mode |= 0200; | ||
578 | } | ||
579 | if (! snd_card_proc_new(emu->card, "ptr_regs00a", &entry)) { | ||
580 | snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read00a); | ||
581 | entry->c.text.write = snd_emu_proc_ptr_reg_write00; | ||
582 | entry->mode |= 0200; | ||
583 | } | ||
584 | if (! snd_card_proc_new(emu->card, "ptr_regs00b", &entry)) { | ||
585 | snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read00b); | ||
586 | entry->c.text.write = snd_emu_proc_ptr_reg_write00; | ||
587 | entry->mode |= 0200; | ||
588 | } | ||
589 | if (! snd_card_proc_new(emu->card, "ptr_regs20a", &entry)) { | ||
590 | snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20a); | ||
591 | entry->c.text.write = snd_emu_proc_ptr_reg_write20; | ||
592 | entry->mode |= 0200; | ||
593 | } | ||
594 | if (! snd_card_proc_new(emu->card, "ptr_regs20b", &entry)) { | ||
595 | snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20b); | ||
596 | entry->c.text.write = snd_emu_proc_ptr_reg_write20; | ||
597 | entry->mode |= 0200; | ||
598 | } | ||
599 | if (! snd_card_proc_new(emu->card, "ptr_regs20c", &entry)) { | ||
600 | snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20c); | ||
601 | entry->c.text.write = snd_emu_proc_ptr_reg_write20; | ||
602 | entry->mode |= 0200; | ||
603 | } | 573 | } |
574 | snd_card_rw_proc_new(emu->card, "io_regs", emu, | ||
575 | snd_emu_proc_io_reg_read, | ||
576 | snd_emu_proc_io_reg_write); | ||
577 | snd_card_rw_proc_new(emu->card, "ptr_regs00a", emu, | ||
578 | snd_emu_proc_ptr_reg_read00a, | ||
579 | snd_emu_proc_ptr_reg_write00); | ||
580 | snd_card_rw_proc_new(emu->card, "ptr_regs00b", emu, | ||
581 | snd_emu_proc_ptr_reg_read00b, | ||
582 | snd_emu_proc_ptr_reg_write00); | ||
583 | snd_card_rw_proc_new(emu->card, "ptr_regs20a", emu, | ||
584 | snd_emu_proc_ptr_reg_read20a, | ||
585 | snd_emu_proc_ptr_reg_write20); | ||
586 | snd_card_rw_proc_new(emu->card, "ptr_regs20b", emu, | ||
587 | snd_emu_proc_ptr_reg_read20b, | ||
588 | snd_emu_proc_ptr_reg_write20); | ||
589 | snd_card_rw_proc_new(emu->card, "ptr_regs20c", emu, | ||
590 | snd_emu_proc_ptr_reg_read20c, | ||
591 | snd_emu_proc_ptr_reg_write20); | ||
604 | #endif | 592 | #endif |
605 | 593 | ||
606 | if (! snd_card_proc_new(emu->card, "emu10k1", &entry)) | 594 | snd_card_ro_proc_new(emu->card, "emu10k1", emu, snd_emu10k1_proc_read); |
607 | snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_read); | ||
608 | 595 | ||
609 | if (emu->card_capabilities->emu10k2_chip) { | 596 | if (emu->card_capabilities->emu10k2_chip) |
610 | if (! snd_card_proc_new(emu->card, "spdif-in", &entry)) | 597 | snd_card_ro_proc_new(emu->card, "spdif-in", emu, |
611 | snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_spdif_read); | 598 | snd_emu10k1_proc_spdif_read); |
612 | } | 599 | if (emu->card_capabilities->ca0151_chip) |
613 | if (emu->card_capabilities->ca0151_chip) { | 600 | snd_card_ro_proc_new(emu->card, "capture-rates", emu, |
614 | if (! snd_card_proc_new(emu->card, "capture-rates", &entry)) | 601 | snd_emu10k1_proc_rates_read); |
615 | snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_rates_read); | ||
616 | } | ||
617 | 602 | ||
618 | if (! snd_card_proc_new(emu->card, "voices", &entry)) | 603 | snd_card_ro_proc_new(emu->card, "voices", emu, |
619 | snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_voices_read); | 604 | snd_emu10k1_proc_voices_read); |
620 | 605 | ||
621 | if (! snd_card_proc_new(emu->card, "fx8010_gpr", &entry)) { | 606 | if (! snd_card_proc_new(emu->card, "fx8010_gpr", &entry)) { |
622 | entry->content = SNDRV_INFO_CONTENT_DATA; | 607 | entry->content = SNDRV_INFO_CONTENT_DATA; |
@@ -646,11 +631,7 @@ int snd_emu10k1_proc_init(struct snd_emu10k1 *emu) | |||
646 | entry->size = emu->audigy ? A_TOTAL_SIZE_CODE : TOTAL_SIZE_CODE; | 631 | entry->size = emu->audigy ? A_TOTAL_SIZE_CODE : TOTAL_SIZE_CODE; |
647 | entry->c.ops = &snd_emu10k1_proc_ops_fx8010; | 632 | entry->c.ops = &snd_emu10k1_proc_ops_fx8010; |
648 | } | 633 | } |
649 | if (! snd_card_proc_new(emu->card, "fx8010_acode", &entry)) { | 634 | snd_card_ro_proc_new(emu->card, "fx8010_acode", emu, |
650 | entry->content = SNDRV_INFO_CONTENT_TEXT; | 635 | snd_emu10k1_proc_acode_read); |
651 | entry->private_data = emu; | ||
652 | entry->mode = S_IFREG | 0444 /*| S_IWUSR*/; | ||
653 | entry->c.text.read = snd_emu10k1_proc_acode_read; | ||
654 | } | ||
655 | return 0; | 636 | return 0; |
656 | } | 637 | } |
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c index 4948b95f6665..672017cac4c7 100644 --- a/sound/pci/emu10k1/p16v.c +++ b/sound/pci/emu10k1/p16v.c | |||
@@ -656,11 +656,10 @@ int snd_p16v_pcm(struct snd_emu10k1 *emu, int device) | |||
656 | for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; | 656 | for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; |
657 | substream; | 657 | substream; |
658 | substream = substream->next) { | 658 | substream = substream->next) { |
659 | if ((err = snd_pcm_lib_preallocate_pages(substream, | 659 | snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV, |
660 | SNDRV_DMA_TYPE_DEV, | 660 | snd_dma_pci_data(emu->pci), |
661 | snd_dma_pci_data(emu->pci), | 661 | (65536 - 64) * 8, |
662 | ((65536 - 64) * 8), ((65536 - 64) * 8))) < 0) | 662 | (65536 - 64) * 8); |
663 | return err; | ||
664 | /* | 663 | /* |
665 | dev_dbg(emu->card->dev, | 664 | dev_dbg(emu->card->dev, |
666 | "preallocate playback substream: err=%d\n", err); | 665 | "preallocate playback substream: err=%d\n", err); |
@@ -670,11 +669,9 @@ int snd_p16v_pcm(struct snd_emu10k1 *emu, int device) | |||
670 | for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; | 669 | for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; |
671 | substream; | 670 | substream; |
672 | substream = substream->next) { | 671 | substream = substream->next) { |
673 | if ((err = snd_pcm_lib_preallocate_pages(substream, | 672 | snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV, |
674 | SNDRV_DMA_TYPE_DEV, | 673 | snd_dma_pci_data(emu->pci), |
675 | snd_dma_pci_data(emu->pci), | 674 | 65536 - 64, 65536 - 64); |
676 | 65536 - 64, 65536 - 64)) < 0) | ||
677 | return err; | ||
678 | /* | 675 | /* |
679 | dev_dbg(emu->card->dev, | 676 | dev_dbg(emu->card->dev, |
680 | "preallocate capture substream: err=%d\n", err); | 677 | "preallocate capture substream: err=%d\n", err); |
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 727eb3da1fda..1cfff35e370e 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c | |||
@@ -1902,10 +1902,8 @@ static void snd_ensoniq_proc_read(struct snd_info_entry *entry, | |||
1902 | 1902 | ||
1903 | static void snd_ensoniq_proc_init(struct ensoniq *ensoniq) | 1903 | static void snd_ensoniq_proc_init(struct ensoniq *ensoniq) |
1904 | { | 1904 | { |
1905 | struct snd_info_entry *entry; | 1905 | snd_card_ro_proc_new(ensoniq->card, "audiopci", ensoniq, |
1906 | 1906 | snd_ensoniq_proc_read); | |
1907 | if (! snd_card_proc_new(ensoniq->card, "audiopci", &entry)) | ||
1908 | snd_info_set_text_ops(entry, ensoniq, snd_ensoniq_proc_read); | ||
1909 | } | 1907 | } |
1910 | 1908 | ||
1911 | /* | 1909 | /* |
@@ -2037,9 +2035,6 @@ static int snd_ensoniq_suspend(struct device *dev) | |||
2037 | 2035 | ||
2038 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2036 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2039 | 2037 | ||
2040 | snd_pcm_suspend_all(ensoniq->pcm1); | ||
2041 | snd_pcm_suspend_all(ensoniq->pcm2); | ||
2042 | |||
2043 | #ifdef CHIP1371 | 2038 | #ifdef CHIP1371 |
2044 | snd_ac97_suspend(ensoniq->u.es1371.ac97); | 2039 | snd_ac97_suspend(ensoniq->u.es1371.ac97); |
2045 | #else | 2040 | #else |
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 9d248eb2e26c..84d07bce581c 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c | |||
@@ -1475,7 +1475,6 @@ static int es1938_suspend(struct device *dev) | |||
1475 | unsigned char *s, *d; | 1475 | unsigned char *s, *d; |
1476 | 1476 | ||
1477 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1477 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1478 | snd_pcm_suspend_all(chip->pcm); | ||
1479 | 1478 | ||
1480 | /* save mixer-related registers */ | 1479 | /* save mixer-related registers */ |
1481 | for (s = saved_regs, d = chip->saved_regs; *s; s++, d++) | 1480 | for (s = saved_regs, d = chip->saved_regs; *s; s++, d++) |
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index 0b1845ca6005..9dcb698fc8c7 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c | |||
@@ -2392,7 +2392,6 @@ static int es1968_suspend(struct device *dev) | |||
2392 | chip->in_suspend = 1; | 2392 | chip->in_suspend = 1; |
2393 | cancel_work_sync(&chip->hwvol_work); | 2393 | cancel_work_sync(&chip->hwvol_work); |
2394 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2394 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2395 | snd_pcm_suspend_all(chip->pcm); | ||
2396 | snd_ac97_suspend(chip->ac97); | 2395 | snd_ac97_suspend(chip->ac97); |
2397 | snd_es1968_bob_stop(chip); | 2396 | snd_es1968_bob_stop(chip); |
2398 | return 0; | 2397 | return 0; |
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index e3fb9c61017c..1317f3183eb1 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c | |||
@@ -1408,7 +1408,6 @@ static int snd_fm801_suspend(struct device *dev) | |||
1408 | if (chip->tea575x_tuner & TUNER_ONLY) { | 1408 | if (chip->tea575x_tuner & TUNER_ONLY) { |
1409 | /* FIXME: tea575x suspend */ | 1409 | /* FIXME: tea575x suspend */ |
1410 | } else { | 1410 | } else { |
1411 | snd_pcm_suspend_all(chip->pcm); | ||
1412 | snd_ac97_suspend(chip->ac97); | 1411 | snd_ac97_suspend(chip->ac97); |
1413 | snd_ac97_suspend(chip->ac97_sec); | 1412 | snd_ac97_suspend(chip->ac97_sec); |
1414 | } | 1413 | } |
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index 066b5b59c4d7..b7d9160ed868 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c | |||
@@ -127,44 +127,6 @@ static void turn_off_beep(struct hda_beep *beep) | |||
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | static void snd_hda_do_detach(struct hda_beep *beep) | ||
131 | { | ||
132 | if (beep->registered) | ||
133 | input_unregister_device(beep->dev); | ||
134 | else | ||
135 | input_free_device(beep->dev); | ||
136 | beep->dev = NULL; | ||
137 | turn_off_beep(beep); | ||
138 | } | ||
139 | |||
140 | static int snd_hda_do_attach(struct hda_beep *beep) | ||
141 | { | ||
142 | struct input_dev *input_dev; | ||
143 | struct hda_codec *codec = beep->codec; | ||
144 | |||
145 | input_dev = input_allocate_device(); | ||
146 | if (!input_dev) | ||
147 | return -ENOMEM; | ||
148 | |||
149 | /* setup digital beep device */ | ||
150 | input_dev->name = "HDA Digital PCBeep"; | ||
151 | input_dev->phys = beep->phys; | ||
152 | input_dev->id.bustype = BUS_PCI; | ||
153 | input_dev->dev.parent = &codec->card->card_dev; | ||
154 | |||
155 | input_dev->id.vendor = codec->core.vendor_id >> 16; | ||
156 | input_dev->id.product = codec->core.vendor_id & 0xffff; | ||
157 | input_dev->id.version = 0x01; | ||
158 | |||
159 | input_dev->evbit[0] = BIT_MASK(EV_SND); | ||
160 | input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE); | ||
161 | input_dev->event = snd_hda_beep_event; | ||
162 | input_set_drvdata(input_dev, beep); | ||
163 | |||
164 | beep->dev = input_dev; | ||
165 | return 0; | ||
166 | } | ||
167 | |||
168 | /** | 130 | /** |
169 | * snd_hda_enable_beep_device - Turn on/off beep sound | 131 | * snd_hda_enable_beep_device - Turn on/off beep sound |
170 | * @codec: the HDA codec | 132 | * @codec: the HDA codec |
@@ -186,6 +148,38 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable) | |||
186 | } | 148 | } |
187 | EXPORT_SYMBOL_GPL(snd_hda_enable_beep_device); | 149 | EXPORT_SYMBOL_GPL(snd_hda_enable_beep_device); |
188 | 150 | ||
151 | static int beep_dev_register(struct snd_device *device) | ||
152 | { | ||
153 | struct hda_beep *beep = device->device_data; | ||
154 | int err; | ||
155 | |||
156 | err = input_register_device(beep->dev); | ||
157 | if (!err) | ||
158 | beep->registered = true; | ||
159 | return err; | ||
160 | } | ||
161 | |||
162 | static int beep_dev_disconnect(struct snd_device *device) | ||
163 | { | ||
164 | struct hda_beep *beep = device->device_data; | ||
165 | |||
166 | if (beep->registered) | ||
167 | input_unregister_device(beep->dev); | ||
168 | else | ||
169 | input_free_device(beep->dev); | ||
170 | turn_off_beep(beep); | ||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | static int beep_dev_free(struct snd_device *device) | ||
175 | { | ||
176 | struct hda_beep *beep = device->device_data; | ||
177 | |||
178 | beep->codec->beep = NULL; | ||
179 | kfree(beep); | ||
180 | return 0; | ||
181 | } | ||
182 | |||
189 | /** | 183 | /** |
190 | * snd_hda_attach_beep_device - Attach a beep input device | 184 | * snd_hda_attach_beep_device - Attach a beep input device |
191 | * @codec: the HDA codec | 185 | * @codec: the HDA codec |
@@ -194,14 +188,16 @@ EXPORT_SYMBOL_GPL(snd_hda_enable_beep_device); | |||
194 | * Attach a beep object to the given widget. If beep hint is turned off | 188 | * Attach a beep object to the given widget. If beep hint is turned off |
195 | * explicitly or beep_mode of the codec is turned off, this doesn't nothing. | 189 | * explicitly or beep_mode of the codec is turned off, this doesn't nothing. |
196 | * | 190 | * |
197 | * The attached beep device has to be registered via | ||
198 | * snd_hda_register_beep_device() and released via snd_hda_detach_beep_device() | ||
199 | * appropriately. | ||
200 | * | ||
201 | * Currently, only one beep device is allowed to each codec. | 191 | * Currently, only one beep device is allowed to each codec. |
202 | */ | 192 | */ |
203 | int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) | 193 | int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) |
204 | { | 194 | { |
195 | static struct snd_device_ops ops = { | ||
196 | .dev_register = beep_dev_register, | ||
197 | .dev_disconnect = beep_dev_disconnect, | ||
198 | .dev_free = beep_dev_free, | ||
199 | }; | ||
200 | struct input_dev *input_dev; | ||
205 | struct hda_beep *beep; | 201 | struct hda_beep *beep; |
206 | int err; | 202 | int err; |
207 | 203 | ||
@@ -226,14 +222,41 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) | |||
226 | INIT_WORK(&beep->beep_work, &snd_hda_generate_beep); | 222 | INIT_WORK(&beep->beep_work, &snd_hda_generate_beep); |
227 | mutex_init(&beep->mutex); | 223 | mutex_init(&beep->mutex); |
228 | 224 | ||
229 | err = snd_hda_do_attach(beep); | 225 | input_dev = input_allocate_device(); |
230 | if (err < 0) { | 226 | if (!input_dev) { |
231 | kfree(beep); | 227 | err = -ENOMEM; |
232 | codec->beep = NULL; | 228 | goto err_free; |
233 | return err; | ||
234 | } | 229 | } |
235 | 230 | ||
231 | /* setup digital beep device */ | ||
232 | input_dev->name = "HDA Digital PCBeep"; | ||
233 | input_dev->phys = beep->phys; | ||
234 | input_dev->id.bustype = BUS_PCI; | ||
235 | input_dev->dev.parent = &codec->card->card_dev; | ||
236 | |||
237 | input_dev->id.vendor = codec->core.vendor_id >> 16; | ||
238 | input_dev->id.product = codec->core.vendor_id & 0xffff; | ||
239 | input_dev->id.version = 0x01; | ||
240 | |||
241 | input_dev->evbit[0] = BIT_MASK(EV_SND); | ||
242 | input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE); | ||
243 | input_dev->event = snd_hda_beep_event; | ||
244 | input_set_drvdata(input_dev, beep); | ||
245 | |||
246 | beep->dev = input_dev; | ||
247 | |||
248 | err = snd_device_new(codec->card, SNDRV_DEV_JACK, beep, &ops); | ||
249 | if (err < 0) | ||
250 | goto err_input; | ||
251 | |||
236 | return 0; | 252 | return 0; |
253 | |||
254 | err_input: | ||
255 | input_free_device(beep->dev); | ||
256 | err_free: | ||
257 | kfree(beep); | ||
258 | codec->beep = NULL; | ||
259 | return err; | ||
237 | } | 260 | } |
238 | EXPORT_SYMBOL_GPL(snd_hda_attach_beep_device); | 261 | EXPORT_SYMBOL_GPL(snd_hda_attach_beep_device); |
239 | 262 | ||
@@ -243,41 +266,11 @@ EXPORT_SYMBOL_GPL(snd_hda_attach_beep_device); | |||
243 | */ | 266 | */ |
244 | void snd_hda_detach_beep_device(struct hda_codec *codec) | 267 | void snd_hda_detach_beep_device(struct hda_codec *codec) |
245 | { | 268 | { |
246 | struct hda_beep *beep = codec->beep; | 269 | if (!codec->bus->shutdown && codec->beep) |
247 | if (beep) { | 270 | snd_device_free(codec->card, codec->beep); |
248 | if (beep->dev) | ||
249 | snd_hda_do_detach(beep); | ||
250 | codec->beep = NULL; | ||
251 | kfree(beep); | ||
252 | } | ||
253 | } | 271 | } |
254 | EXPORT_SYMBOL_GPL(snd_hda_detach_beep_device); | 272 | EXPORT_SYMBOL_GPL(snd_hda_detach_beep_device); |
255 | 273 | ||
256 | /** | ||
257 | * snd_hda_register_beep_device - Register the beep device | ||
258 | * @codec: the HDA codec | ||
259 | */ | ||
260 | int snd_hda_register_beep_device(struct hda_codec *codec) | ||
261 | { | ||
262 | struct hda_beep *beep = codec->beep; | ||
263 | int err; | ||
264 | |||
265 | if (!beep || !beep->dev) | ||
266 | return 0; | ||
267 | |||
268 | err = input_register_device(beep->dev); | ||
269 | if (err < 0) { | ||
270 | codec_err(codec, "hda_beep: unable to register input device\n"); | ||
271 | input_free_device(beep->dev); | ||
272 | codec->beep = NULL; | ||
273 | kfree(beep); | ||
274 | return err; | ||
275 | } | ||
276 | beep->registered = true; | ||
277 | return 0; | ||
278 | } | ||
279 | EXPORT_SYMBOL_GPL(snd_hda_register_beep_device); | ||
280 | |||
281 | static bool ctl_has_mute(struct snd_kcontrol *kcontrol) | 274 | static bool ctl_has_mute(struct snd_kcontrol *kcontrol) |
282 | { | 275 | { |
283 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 276 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
diff --git a/sound/pci/hda/hda_beep.h b/sound/pci/hda/hda_beep.h index f1457c6b3969..a25358a4807a 100644 --- a/sound/pci/hda/hda_beep.h +++ b/sound/pci/hda/hda_beep.h | |||
@@ -34,7 +34,6 @@ struct hda_beep { | |||
34 | int snd_hda_enable_beep_device(struct hda_codec *codec, int enable); | 34 | int snd_hda_enable_beep_device(struct hda_codec *codec, int enable); |
35 | int snd_hda_attach_beep_device(struct hda_codec *codec, int nid); | 35 | int snd_hda_attach_beep_device(struct hda_codec *codec, int nid); |
36 | void snd_hda_detach_beep_device(struct hda_codec *codec); | 36 | void snd_hda_detach_beep_device(struct hda_codec *codec); |
37 | int snd_hda_register_beep_device(struct hda_codec *codec); | ||
38 | #else | 37 | #else |
39 | static inline int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) | 38 | static inline int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) |
40 | { | 39 | { |
@@ -43,9 +42,5 @@ static inline int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) | |||
43 | static inline void snd_hda_detach_beep_device(struct hda_codec *codec) | 42 | static inline void snd_hda_detach_beep_device(struct hda_codec *codec) |
44 | { | 43 | { |
45 | } | 44 | } |
46 | static inline int snd_hda_register_beep_device(struct hda_codec *codec) | ||
47 | { | ||
48 | return 0; | ||
49 | } | ||
50 | #endif | 45 | #endif |
51 | #endif | 46 | #endif |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 9f8d59e7e89f..5f2005098a60 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -813,7 +813,6 @@ void snd_hda_codec_register(struct hda_codec *codec) | |||
813 | if (codec->registered) | 813 | if (codec->registered) |
814 | return; | 814 | return; |
815 | if (device_is_registered(hda_codec_dev(codec))) { | 815 | if (device_is_registered(hda_codec_dev(codec))) { |
816 | snd_hda_register_beep_device(codec); | ||
817 | codec_display_power(codec, true); | 816 | codec_display_power(codec, true); |
818 | pm_runtime_enable(hda_codec_dev(codec)); | 817 | pm_runtime_enable(hda_codec_dev(codec)); |
819 | /* it was powered up in snd_hda_codec_new(), now all done */ | 818 | /* it was powered up in snd_hda_codec_new(), now all done */ |
@@ -828,14 +827,6 @@ static int snd_hda_codec_dev_register(struct snd_device *device) | |||
828 | return 0; | 827 | return 0; |
829 | } | 828 | } |
830 | 829 | ||
831 | static int snd_hda_codec_dev_disconnect(struct snd_device *device) | ||
832 | { | ||
833 | struct hda_codec *codec = device->device_data; | ||
834 | |||
835 | snd_hda_detach_beep_device(codec); | ||
836 | return 0; | ||
837 | } | ||
838 | |||
839 | static int snd_hda_codec_dev_free(struct snd_device *device) | 830 | static int snd_hda_codec_dev_free(struct snd_device *device) |
840 | { | 831 | { |
841 | struct hda_codec *codec = device->device_data; | 832 | struct hda_codec *codec = device->device_data; |
@@ -921,7 +912,6 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card, | |||
921 | int err; | 912 | int err; |
922 | static struct snd_device_ops dev_ops = { | 913 | static struct snd_device_ops dev_ops = { |
923 | .dev_register = snd_hda_codec_dev_register, | 914 | .dev_register = snd_hda_codec_dev_register, |
924 | .dev_disconnect = snd_hda_codec_dev_disconnect, | ||
925 | .dev_free = snd_hda_codec_dev_free, | 915 | .dev_free = snd_hda_codec_dev_free, |
926 | }; | 916 | }; |
927 | 917 | ||
@@ -2917,18 +2907,16 @@ static void hda_call_codec_resume(struct hda_codec *codec) | |||
2917 | hda_jackpoll_work(&codec->jackpoll_work.work); | 2907 | hda_jackpoll_work(&codec->jackpoll_work.work); |
2918 | else | 2908 | else |
2919 | snd_hda_jack_report_sync(codec); | 2909 | snd_hda_jack_report_sync(codec); |
2910 | codec->core.dev.power.power_state = PMSG_ON; | ||
2920 | snd_hdac_leave_pm(&codec->core); | 2911 | snd_hdac_leave_pm(&codec->core); |
2921 | } | 2912 | } |
2922 | 2913 | ||
2923 | static int hda_codec_runtime_suspend(struct device *dev) | 2914 | static int hda_codec_runtime_suspend(struct device *dev) |
2924 | { | 2915 | { |
2925 | struct hda_codec *codec = dev_to_hda_codec(dev); | 2916 | struct hda_codec *codec = dev_to_hda_codec(dev); |
2926 | struct hda_pcm *pcm; | ||
2927 | unsigned int state; | 2917 | unsigned int state; |
2928 | 2918 | ||
2929 | cancel_delayed_work_sync(&codec->jackpoll_work); | 2919 | cancel_delayed_work_sync(&codec->jackpoll_work); |
2930 | list_for_each_entry(pcm, &codec->pcm_list_head, list) | ||
2931 | snd_pcm_suspend_all(pcm->pcm); | ||
2932 | state = hda_call_codec_suspend(codec); | 2920 | state = hda_call_codec_suspend(codec); |
2933 | if (codec->link_down_at_suspend || | 2921 | if (codec->link_down_at_suspend || |
2934 | (codec_has_clkstop(codec) && codec_has_epss(codec) && | 2922 | (codec_has_clkstop(codec) && codec_has_epss(codec) && |
@@ -2950,10 +2938,48 @@ static int hda_codec_runtime_resume(struct device *dev) | |||
2950 | } | 2938 | } |
2951 | #endif /* CONFIG_PM */ | 2939 | #endif /* CONFIG_PM */ |
2952 | 2940 | ||
2941 | #ifdef CONFIG_PM_SLEEP | ||
2942 | static int hda_codec_pm_suspend(struct device *dev) | ||
2943 | { | ||
2944 | dev->power.power_state = PMSG_SUSPEND; | ||
2945 | return pm_runtime_force_suspend(dev); | ||
2946 | } | ||
2947 | |||
2948 | static int hda_codec_pm_resume(struct device *dev) | ||
2949 | { | ||
2950 | dev->power.power_state = PMSG_RESUME; | ||
2951 | return pm_runtime_force_resume(dev); | ||
2952 | } | ||
2953 | |||
2954 | static int hda_codec_pm_freeze(struct device *dev) | ||
2955 | { | ||
2956 | dev->power.power_state = PMSG_FREEZE; | ||
2957 | return pm_runtime_force_suspend(dev); | ||
2958 | } | ||
2959 | |||
2960 | static int hda_codec_pm_thaw(struct device *dev) | ||
2961 | { | ||
2962 | dev->power.power_state = PMSG_THAW; | ||
2963 | return pm_runtime_force_resume(dev); | ||
2964 | } | ||
2965 | |||
2966 | static int hda_codec_pm_restore(struct device *dev) | ||
2967 | { | ||
2968 | dev->power.power_state = PMSG_RESTORE; | ||
2969 | return pm_runtime_force_resume(dev); | ||
2970 | } | ||
2971 | #endif /* CONFIG_PM_SLEEP */ | ||
2972 | |||
2953 | /* referred in hda_bind.c */ | 2973 | /* referred in hda_bind.c */ |
2954 | const struct dev_pm_ops hda_codec_driver_pm = { | 2974 | const struct dev_pm_ops hda_codec_driver_pm = { |
2955 | SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, | 2975 | #ifdef CONFIG_PM_SLEEP |
2956 | pm_runtime_force_resume) | 2976 | .suspend = hda_codec_pm_suspend, |
2977 | .resume = hda_codec_pm_resume, | ||
2978 | .freeze = hda_codec_pm_freeze, | ||
2979 | .thaw = hda_codec_pm_thaw, | ||
2980 | .poweroff = hda_codec_pm_suspend, | ||
2981 | .restore = hda_codec_pm_restore, | ||
2982 | #endif /* CONFIG_PM_SLEEP */ | ||
2957 | SET_RUNTIME_PM_OPS(hda_codec_runtime_suspend, hda_codec_runtime_resume, | 2983 | SET_RUNTIME_PM_OPS(hda_codec_runtime_suspend, hda_codec_runtime_resume, |
2958 | NULL) | 2984 | NULL) |
2959 | }; | 2985 | }; |
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index a65740419650..853842987fa1 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -919,15 +919,8 @@ static void print_codec_info(struct snd_info_entry *entry, | |||
919 | int snd_hda_codec_proc_new(struct hda_codec *codec) | 919 | int snd_hda_codec_proc_new(struct hda_codec *codec) |
920 | { | 920 | { |
921 | char name[32]; | 921 | char name[32]; |
922 | struct snd_info_entry *entry; | ||
923 | int err; | ||
924 | 922 | ||
925 | snprintf(name, sizeof(name), "codec#%d", codec->core.addr); | 923 | snprintf(name, sizeof(name), "codec#%d", codec->core.addr); |
926 | err = snd_card_proc_new(codec->card, name, &entry); | 924 | return snd_card_ro_proc_new(codec->card, name, codec, print_codec_info); |
927 | if (err < 0) | ||
928 | return err; | ||
929 | |||
930 | snd_info_set_text_ops(entry, codec, print_codec_info); | ||
931 | return 0; | ||
932 | } | 925 | } |
933 | 926 | ||
diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index 97a176d817a0..3d68f9ef7694 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/time.h> | 33 | #include <linux/time.h> |
34 | #include <linux/string.h> | 34 | #include <linux/string.h> |
35 | #include <linux/pm_runtime.h> | ||
35 | 36 | ||
36 | #include <sound/core.h> | 37 | #include <sound/core.h> |
37 | #include <sound/initval.h> | 38 | #include <sound/initval.h> |
@@ -218,7 +219,6 @@ disable_hda: | |||
218 | return rc; | 219 | return rc; |
219 | } | 220 | } |
220 | 221 | ||
221 | #ifdef CONFIG_PM_SLEEP | ||
222 | static void hda_tegra_disable_clocks(struct hda_tegra *data) | 222 | static void hda_tegra_disable_clocks(struct hda_tegra *data) |
223 | { | 223 | { |
224 | clk_disable_unprepare(data->hda2hdmi_clk); | 224 | clk_disable_unprepare(data->hda2hdmi_clk); |
@@ -229,43 +229,72 @@ static void hda_tegra_disable_clocks(struct hda_tegra *data) | |||
229 | /* | 229 | /* |
230 | * power management | 230 | * power management |
231 | */ | 231 | */ |
232 | static int hda_tegra_suspend(struct device *dev) | 232 | static int __maybe_unused hda_tegra_suspend(struct device *dev) |
233 | { | 233 | { |
234 | struct snd_card *card = dev_get_drvdata(dev); | 234 | struct snd_card *card = dev_get_drvdata(dev); |
235 | struct azx *chip = card->private_data; | 235 | int rc; |
236 | struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); | ||
237 | struct hdac_bus *bus = azx_bus(chip); | ||
238 | 236 | ||
237 | rc = pm_runtime_force_suspend(dev); | ||
238 | if (rc < 0) | ||
239 | return rc; | ||
239 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 240 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
240 | 241 | ||
241 | azx_stop_chip(chip); | 242 | return 0; |
242 | synchronize_irq(bus->irq); | 243 | } |
243 | azx_enter_link_reset(chip); | 244 | |
244 | hda_tegra_disable_clocks(hda); | 245 | static int __maybe_unused hda_tegra_resume(struct device *dev) |
246 | { | ||
247 | struct snd_card *card = dev_get_drvdata(dev); | ||
248 | int rc; | ||
249 | |||
250 | rc = pm_runtime_force_resume(dev); | ||
251 | if (rc < 0) | ||
252 | return rc; | ||
253 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | ||
245 | 254 | ||
246 | return 0; | 255 | return 0; |
247 | } | 256 | } |
248 | 257 | ||
249 | static int hda_tegra_resume(struct device *dev) | 258 | static int __maybe_unused hda_tegra_runtime_suspend(struct device *dev) |
250 | { | 259 | { |
251 | struct snd_card *card = dev_get_drvdata(dev); | 260 | struct snd_card *card = dev_get_drvdata(dev); |
252 | struct azx *chip = card->private_data; | 261 | struct azx *chip = card->private_data; |
253 | struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); | 262 | struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); |
263 | struct hdac_bus *bus = azx_bus(chip); | ||
254 | 264 | ||
255 | hda_tegra_enable_clocks(hda); | 265 | if (chip && chip->running) { |
266 | azx_stop_chip(chip); | ||
267 | synchronize_irq(bus->irq); | ||
268 | azx_enter_link_reset(chip); | ||
269 | } | ||
270 | hda_tegra_disable_clocks(hda); | ||
256 | 271 | ||
257 | hda_tegra_init(hda); | 272 | return 0; |
273 | } | ||
258 | 274 | ||
259 | azx_init_chip(chip, 1); | 275 | static int __maybe_unused hda_tegra_runtime_resume(struct device *dev) |
276 | { | ||
277 | struct snd_card *card = dev_get_drvdata(dev); | ||
278 | struct azx *chip = card->private_data; | ||
279 | struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); | ||
280 | int rc; | ||
260 | 281 | ||
261 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 282 | rc = hda_tegra_enable_clocks(hda); |
283 | if (rc != 0) | ||
284 | return rc; | ||
285 | if (chip && chip->running) { | ||
286 | hda_tegra_init(hda); | ||
287 | azx_init_chip(chip, 1); | ||
288 | } | ||
262 | 289 | ||
263 | return 0; | 290 | return 0; |
264 | } | 291 | } |
265 | #endif /* CONFIG_PM_SLEEP */ | ||
266 | 292 | ||
267 | static const struct dev_pm_ops hda_tegra_pm = { | 293 | static const struct dev_pm_ops hda_tegra_pm = { |
268 | SET_SYSTEM_SLEEP_PM_OPS(hda_tegra_suspend, hda_tegra_resume) | 294 | SET_SYSTEM_SLEEP_PM_OPS(hda_tegra_suspend, hda_tegra_resume) |
295 | SET_RUNTIME_PM_OPS(hda_tegra_runtime_suspend, | ||
296 | hda_tegra_runtime_resume, | ||
297 | NULL) | ||
269 | }; | 298 | }; |
270 | 299 | ||
271 | static int hda_tegra_dev_disconnect(struct snd_device *device) | 300 | static int hda_tegra_dev_disconnect(struct snd_device *device) |
@@ -303,7 +332,23 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev) | |||
303 | struct hdac_bus *bus = azx_bus(chip); | 332 | struct hdac_bus *bus = azx_bus(chip); |
304 | struct device *dev = hda->dev; | 333 | struct device *dev = hda->dev; |
305 | struct resource *res; | 334 | struct resource *res; |
306 | int err; | 335 | |
336 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
337 | hda->regs = devm_ioremap_resource(dev, res); | ||
338 | if (IS_ERR(hda->regs)) | ||
339 | return PTR_ERR(hda->regs); | ||
340 | |||
341 | bus->remap_addr = hda->regs + HDA_BAR0; | ||
342 | bus->addr = res->start + HDA_BAR0; | ||
343 | |||
344 | hda_tegra_init(hda); | ||
345 | |||
346 | return 0; | ||
347 | } | ||
348 | |||
349 | static int hda_tegra_init_clk(struct hda_tegra *hda) | ||
350 | { | ||
351 | struct device *dev = hda->dev; | ||
307 | 352 | ||
308 | hda->hda_clk = devm_clk_get(dev, "hda"); | 353 | hda->hda_clk = devm_clk_get(dev, "hda"); |
309 | if (IS_ERR(hda->hda_clk)) { | 354 | if (IS_ERR(hda->hda_clk)) { |
@@ -321,22 +366,6 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev) | |||
321 | return PTR_ERR(hda->hda2hdmi_clk); | 366 | return PTR_ERR(hda->hda2hdmi_clk); |
322 | } | 367 | } |
323 | 368 | ||
324 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
325 | hda->regs = devm_ioremap_resource(dev, res); | ||
326 | if (IS_ERR(hda->regs)) | ||
327 | return PTR_ERR(hda->regs); | ||
328 | |||
329 | bus->remap_addr = hda->regs + HDA_BAR0; | ||
330 | bus->addr = res->start + HDA_BAR0; | ||
331 | |||
332 | err = hda_tegra_enable_clocks(hda); | ||
333 | if (err) { | ||
334 | dev_err(dev, "failed to get enable clocks\n"); | ||
335 | return err; | ||
336 | } | ||
337 | |||
338 | hda_tegra_init(hda); | ||
339 | |||
340 | return 0; | 369 | return 0; |
341 | } | 370 | } |
342 | 371 | ||
@@ -347,8 +376,8 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) | |||
347 | int err; | 376 | int err; |
348 | unsigned short gcap; | 377 | unsigned short gcap; |
349 | int irq_id = platform_get_irq(pdev, 0); | 378 | int irq_id = platform_get_irq(pdev, 0); |
350 | const char *sname; | 379 | const char *sname, *drv_name = "tegra-hda"; |
351 | struct device_node *root; | 380 | struct device_node *np = pdev->dev.of_node; |
352 | 381 | ||
353 | err = hda_tegra_init_chip(chip, pdev); | 382 | err = hda_tegra_init_chip(chip, pdev); |
354 | if (err) | 383 | if (err) |
@@ -407,17 +436,11 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) | |||
407 | } | 436 | } |
408 | 437 | ||
409 | /* driver name */ | 438 | /* driver name */ |
410 | strcpy(card->driver, "tegra-hda"); | 439 | strncpy(card->driver, drv_name, sizeof(card->driver)); |
411 | |||
412 | root = of_find_node_by_path("/"); | ||
413 | sname = of_get_property(root, "compatible", NULL); | ||
414 | of_node_put(root); | ||
415 | if (!sname) { | ||
416 | dev_err(card->dev, | ||
417 | "failed to get compatible property from root node\n"); | ||
418 | return -ENODEV; | ||
419 | } | ||
420 | /* shortname for card */ | 440 | /* shortname for card */ |
441 | sname = of_get_property(np, "nvidia,model", NULL); | ||
442 | if (!sname) | ||
443 | sname = drv_name; | ||
421 | if (strlen(sname) > sizeof(card->shortname)) | 444 | if (strlen(sname) > sizeof(card->shortname)) |
422 | dev_info(card->dev, "truncating shortname for card\n"); | 445 | dev_info(card->dev, "truncating shortname for card\n"); |
423 | strncpy(card->shortname, sname, sizeof(card->shortname)); | 446 | strncpy(card->shortname, sname, sizeof(card->shortname)); |
@@ -487,7 +510,8 @@ MODULE_DEVICE_TABLE(of, hda_tegra_match); | |||
487 | 510 | ||
488 | static int hda_tegra_probe(struct platform_device *pdev) | 511 | static int hda_tegra_probe(struct platform_device *pdev) |
489 | { | 512 | { |
490 | const unsigned int driver_flags = AZX_DCAPS_CORBRP_SELF_CLEAR; | 513 | const unsigned int driver_flags = AZX_DCAPS_CORBRP_SELF_CLEAR | |
514 | AZX_DCAPS_PM_RUNTIME; | ||
491 | struct snd_card *card; | 515 | struct snd_card *card; |
492 | struct azx *chip; | 516 | struct azx *chip; |
493 | struct hda_tegra *hda; | 517 | struct hda_tegra *hda; |
@@ -506,12 +530,21 @@ static int hda_tegra_probe(struct platform_device *pdev) | |||
506 | return err; | 530 | return err; |
507 | } | 531 | } |
508 | 532 | ||
533 | err = hda_tegra_init_clk(hda); | ||
534 | if (err < 0) | ||
535 | goto out_free; | ||
536 | |||
509 | err = hda_tegra_create(card, driver_flags, hda); | 537 | err = hda_tegra_create(card, driver_flags, hda); |
510 | if (err < 0) | 538 | if (err < 0) |
511 | goto out_free; | 539 | goto out_free; |
512 | card->private_data = chip; | 540 | card->private_data = chip; |
513 | 541 | ||
514 | dev_set_drvdata(&pdev->dev, card); | 542 | dev_set_drvdata(&pdev->dev, card); |
543 | |||
544 | pm_runtime_enable(hda->dev); | ||
545 | if (!azx_has_pm_runtime(chip)) | ||
546 | pm_runtime_forbid(hda->dev); | ||
547 | |||
515 | schedule_work(&hda->probe_work); | 548 | schedule_work(&hda->probe_work); |
516 | 549 | ||
517 | return 0; | 550 | return 0; |
@@ -528,6 +561,7 @@ static void hda_tegra_probe_work(struct work_struct *work) | |||
528 | struct platform_device *pdev = to_platform_device(hda->dev); | 561 | struct platform_device *pdev = to_platform_device(hda->dev); |
529 | int err; | 562 | int err; |
530 | 563 | ||
564 | pm_runtime_get_sync(hda->dev); | ||
531 | err = hda_tegra_first_init(chip, pdev); | 565 | err = hda_tegra_first_init(chip, pdev); |
532 | if (err < 0) | 566 | if (err < 0) |
533 | goto out_free; | 567 | goto out_free; |
@@ -549,12 +583,18 @@ static void hda_tegra_probe_work(struct work_struct *work) | |||
549 | snd_hda_set_power_save(&chip->bus, power_save * 1000); | 583 | snd_hda_set_power_save(&chip->bus, power_save * 1000); |
550 | 584 | ||
551 | out_free: | 585 | out_free: |
586 | pm_runtime_put(hda->dev); | ||
552 | return; /* no error return from async probe */ | 587 | return; /* no error return from async probe */ |
553 | } | 588 | } |
554 | 589 | ||
555 | static int hda_tegra_remove(struct platform_device *pdev) | 590 | static int hda_tegra_remove(struct platform_device *pdev) |
556 | { | 591 | { |
557 | return snd_card_free(dev_get_drvdata(&pdev->dev)); | 592 | int ret; |
593 | |||
594 | ret = snd_card_free(dev_get_drvdata(&pdev->dev)); | ||
595 | pm_runtime_disable(&pdev->dev); | ||
596 | |||
597 | return ret; | ||
558 | } | 598 | } |
559 | 599 | ||
560 | static void hda_tegra_shutdown(struct platform_device *pdev) | 600 | static void hda_tegra_shutdown(struct platform_device *pdev) |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index a4ee7656d9ee..fb65ad31e86c 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -936,6 +936,9 @@ static const struct snd_pci_quirk cxt5066_fixups[] = { | |||
936 | SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE), | 936 | SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE), |
937 | SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE), | 937 | SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE), |
938 | SND_PCI_QUIRK(0x103c, 0x8455, "HP Z2 G4", CXT_FIXUP_HP_MIC_NO_PRESENCE), | 938 | SND_PCI_QUIRK(0x103c, 0x8455, "HP Z2 G4", CXT_FIXUP_HP_MIC_NO_PRESENCE), |
939 | SND_PCI_QUIRK(0x103c, 0x8456, "HP Z2 G4 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE), | ||
940 | SND_PCI_QUIRK(0x103c, 0x8457, "HP Z2 G4 mini", CXT_FIXUP_HP_MIC_NO_PRESENCE), | ||
941 | SND_PCI_QUIRK(0x103c, 0x8458, "HP Z2 G4 mini premium", CXT_FIXUP_HP_MIC_NO_PRESENCE), | ||
939 | SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN), | 942 | SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN), |
940 | SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO), | 943 | SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO), |
941 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), | 944 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 46f88dc7b7e8..8b3ac690efa3 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -57,10 +57,11 @@ MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info"); | |||
57 | #define is_geminilake(codec) (((codec)->core.vendor_id == 0x8086280d) || \ | 57 | #define is_geminilake(codec) (((codec)->core.vendor_id == 0x8086280d) || \ |
58 | ((codec)->core.vendor_id == 0x80862800)) | 58 | ((codec)->core.vendor_id == 0x80862800)) |
59 | #define is_cannonlake(codec) ((codec)->core.vendor_id == 0x8086280c) | 59 | #define is_cannonlake(codec) ((codec)->core.vendor_id == 0x8086280c) |
60 | #define is_icelake(codec) ((codec)->core.vendor_id == 0x8086280f) | ||
60 | #define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec) \ | 61 | #define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec) \ |
61 | || is_skylake(codec) || is_broxton(codec) \ | 62 | || is_skylake(codec) || is_broxton(codec) \ |
62 | || is_kabylake(codec)) || is_geminilake(codec) \ | 63 | || is_kabylake(codec) || is_geminilake(codec) \ |
63 | || is_cannonlake(codec) | 64 | || is_cannonlake(codec) || is_icelake(codec)) |
64 | #define is_valleyview(codec) ((codec)->core.vendor_id == 0x80862882) | 65 | #define is_valleyview(codec) ((codec)->core.vendor_id == 0x80862882) |
65 | #define is_cherryview(codec) ((codec)->core.vendor_id == 0x80862883) | 66 | #define is_cherryview(codec) ((codec)->core.vendor_id == 0x80862883) |
66 | #define is_valleyview_plus(codec) (is_valleyview(codec) || is_cherryview(codec)) | 67 | #define is_valleyview_plus(codec) (is_valleyview(codec) || is_cherryview(codec)) |
@@ -181,6 +182,8 @@ struct hdmi_spec { | |||
181 | 182 | ||
182 | struct hdac_chmap chmap; | 183 | struct hdac_chmap chmap; |
183 | hda_nid_t vendor_nid; | 184 | hda_nid_t vendor_nid; |
185 | const int *port_map; | ||
186 | int port_num; | ||
184 | }; | 187 | }; |
185 | 188 | ||
186 | #ifdef CONFIG_SND_HDA_COMPONENT | 189 | #ifdef CONFIG_SND_HDA_COMPONENT |
@@ -1865,7 +1868,7 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
1865 | hda_nid_t pin_nid; | 1868 | hda_nid_t pin_nid; |
1866 | struct snd_pcm_runtime *runtime = substream->runtime; | 1869 | struct snd_pcm_runtime *runtime = substream->runtime; |
1867 | bool non_pcm; | 1870 | bool non_pcm; |
1868 | int pinctl; | 1871 | int pinctl, stripe; |
1869 | int err = 0; | 1872 | int err = 0; |
1870 | 1873 | ||
1871 | mutex_lock(&spec->pcm_lock); | 1874 | mutex_lock(&spec->pcm_lock); |
@@ -1909,6 +1912,14 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
1909 | per_pin->channels = substream->runtime->channels; | 1912 | per_pin->channels = substream->runtime->channels; |
1910 | per_pin->setup = true; | 1913 | per_pin->setup = true; |
1911 | 1914 | ||
1915 | if (get_wcaps(codec, cvt_nid) & AC_WCAP_STRIPE) { | ||
1916 | stripe = snd_hdac_get_stream_stripe_ctl(&codec->bus->core, | ||
1917 | substream); | ||
1918 | snd_hda_codec_write(codec, cvt_nid, 0, | ||
1919 | AC_VERB_SET_STRIPE_CONTROL, | ||
1920 | stripe); | ||
1921 | } | ||
1922 | |||
1912 | hdmi_setup_audio_infoframe(codec, per_pin, non_pcm); | 1923 | hdmi_setup_audio_infoframe(codec, per_pin, non_pcm); |
1913 | mutex_unlock(&per_pin->lock); | 1924 | mutex_unlock(&per_pin->lock); |
1914 | if (spec->dyn_pin_out) { | 1925 | if (spec->dyn_pin_out) { |
@@ -2410,12 +2421,11 @@ static void intel_haswell_fixup_connect_list(struct hda_codec *codec, | |||
2410 | snd_hda_override_conn_list(codec, nid, spec->num_cvts, spec->cvt_nids); | 2421 | snd_hda_override_conn_list(codec, nid, spec->num_cvts, spec->cvt_nids); |
2411 | } | 2422 | } |
2412 | 2423 | ||
2413 | #define INTEL_VENDOR_NID 0x08 | 2424 | #define INTEL_GET_VENDOR_VERB 0xf81 |
2414 | #define INTEL_GLK_VENDOR_NID 0x0B | 2425 | #define INTEL_GET_VENDOR_VERB 0xf81 |
2415 | #define INTEL_GET_VENDOR_VERB 0xf81 | 2426 | #define INTEL_SET_VENDOR_VERB 0x781 |
2416 | #define INTEL_SET_VENDOR_VERB 0x781 | 2427 | #define INTEL_EN_DP12 0x02 /* enable DP 1.2 features */ |
2417 | #define INTEL_EN_DP12 0x02 /* enable DP 1.2 features */ | 2428 | #define INTEL_EN_ALL_PIN_CVTS 0x01 /* enable 2nd & 3rd pins and convertors */ |
2418 | #define INTEL_EN_ALL_PIN_CVTS 0x01 /* enable 2nd & 3rd pins and convertors */ | ||
2419 | 2429 | ||
2420 | static void intel_haswell_enable_all_pins(struct hda_codec *codec, | 2430 | static void intel_haswell_enable_all_pins(struct hda_codec *codec, |
2421 | bool update_tree) | 2431 | bool update_tree) |
@@ -2495,11 +2505,29 @@ static int intel_base_nid(struct hda_codec *codec) | |||
2495 | 2505 | ||
2496 | static int intel_pin2port(void *audio_ptr, int pin_nid) | 2506 | static int intel_pin2port(void *audio_ptr, int pin_nid) |
2497 | { | 2507 | { |
2498 | int base_nid = intel_base_nid(audio_ptr); | 2508 | struct hda_codec *codec = audio_ptr; |
2509 | struct hdmi_spec *spec = codec->spec; | ||
2510 | int base_nid, i; | ||
2499 | 2511 | ||
2500 | if (WARN_ON(pin_nid < base_nid || pin_nid >= base_nid + 3)) | 2512 | if (!spec->port_num) { |
2501 | return -1; | 2513 | base_nid = intel_base_nid(codec); |
2502 | return pin_nid - base_nid + 1; /* intel port is 1-based */ | 2514 | if (WARN_ON(pin_nid < base_nid || pin_nid >= base_nid + 3)) |
2515 | return -1; | ||
2516 | return pin_nid - base_nid + 1; /* intel port is 1-based */ | ||
2517 | } | ||
2518 | |||
2519 | /* | ||
2520 | * looking for the pin number in the mapping table and return | ||
2521 | * the index which indicate the port number | ||
2522 | */ | ||
2523 | for (i = 0; i < spec->port_num; i++) { | ||
2524 | if (pin_nid == spec->port_map[i]) | ||
2525 | return i + 1; | ||
2526 | } | ||
2527 | |||
2528 | /* return -1 if pin number exceeds our expectation */ | ||
2529 | codec_info(codec, "Can't find the HDMI/DP port for pin %d\n", pin_nid); | ||
2530 | return -1; | ||
2503 | } | 2531 | } |
2504 | 2532 | ||
2505 | static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe) | 2533 | static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe) |
@@ -2600,7 +2628,8 @@ static int parse_intel_hdmi(struct hda_codec *codec) | |||
2600 | } | 2628 | } |
2601 | 2629 | ||
2602 | /* Intel Haswell and onwards; audio component with eld notifier */ | 2630 | /* Intel Haswell and onwards; audio component with eld notifier */ |
2603 | static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid) | 2631 | static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid, |
2632 | const int *port_map, int port_num) | ||
2604 | { | 2633 | { |
2605 | struct hdmi_spec *spec; | 2634 | struct hdmi_spec *spec; |
2606 | int err; | 2635 | int err; |
@@ -2612,6 +2641,8 @@ static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid) | |||
2612 | codec->dp_mst = true; | 2641 | codec->dp_mst = true; |
2613 | spec->dyn_pcm_assign = true; | 2642 | spec->dyn_pcm_assign = true; |
2614 | spec->vendor_nid = vendor_nid; | 2643 | spec->vendor_nid = vendor_nid; |
2644 | spec->port_map = port_map; | ||
2645 | spec->port_num = port_num; | ||
2615 | 2646 | ||
2616 | intel_haswell_enable_all_pins(codec, true); | 2647 | intel_haswell_enable_all_pins(codec, true); |
2617 | intel_haswell_fixup_enable_dp12(codec); | 2648 | intel_haswell_fixup_enable_dp12(codec); |
@@ -2630,12 +2661,23 @@ static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid) | |||
2630 | 2661 | ||
2631 | static int patch_i915_hsw_hdmi(struct hda_codec *codec) | 2662 | static int patch_i915_hsw_hdmi(struct hda_codec *codec) |
2632 | { | 2663 | { |
2633 | return intel_hsw_common_init(codec, INTEL_VENDOR_NID); | 2664 | return intel_hsw_common_init(codec, 0x08, NULL, 0); |
2634 | } | 2665 | } |
2635 | 2666 | ||
2636 | static int patch_i915_glk_hdmi(struct hda_codec *codec) | 2667 | static int patch_i915_glk_hdmi(struct hda_codec *codec) |
2637 | { | 2668 | { |
2638 | return intel_hsw_common_init(codec, INTEL_GLK_VENDOR_NID); | 2669 | return intel_hsw_common_init(codec, 0x0b, NULL, 0); |
2670 | } | ||
2671 | |||
2672 | static int patch_i915_icl_hdmi(struct hda_codec *codec) | ||
2673 | { | ||
2674 | /* | ||
2675 | * pin to port mapping table where the value indicate the pin number and | ||
2676 | * the index indicate the port number with 1 base. | ||
2677 | */ | ||
2678 | static const int map[] = {0x4, 0x6, 0x8, 0xa, 0xb}; | ||
2679 | |||
2680 | return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map)); | ||
2639 | } | 2681 | } |
2640 | 2682 | ||
2641 | /* Intel Baytrail and Braswell; with eld notifier */ | 2683 | /* Intel Baytrail and Braswell; with eld notifier */ |
@@ -3878,6 +3920,7 @@ HDA_CODEC_ENTRY(0x11069f81, "VX900 HDMI/DP", patch_via_hdmi), | |||
3878 | HDA_CODEC_ENTRY(0x11069f84, "VX11 HDMI/DP", patch_generic_hdmi), | 3920 | HDA_CODEC_ENTRY(0x11069f84, "VX11 HDMI/DP", patch_generic_hdmi), |
3879 | HDA_CODEC_ENTRY(0x11069f85, "VX11 HDMI/DP", patch_generic_hdmi), | 3921 | HDA_CODEC_ENTRY(0x11069f85, "VX11 HDMI/DP", patch_generic_hdmi), |
3880 | HDA_CODEC_ENTRY(0x80860054, "IbexPeak HDMI", patch_i915_cpt_hdmi), | 3922 | HDA_CODEC_ENTRY(0x80860054, "IbexPeak HDMI", patch_i915_cpt_hdmi), |
3923 | HDA_CODEC_ENTRY(0x80862800, "Geminilake HDMI", patch_i915_glk_hdmi), | ||
3881 | HDA_CODEC_ENTRY(0x80862801, "Bearlake HDMI", patch_generic_hdmi), | 3924 | HDA_CODEC_ENTRY(0x80862801, "Bearlake HDMI", patch_generic_hdmi), |
3882 | HDA_CODEC_ENTRY(0x80862802, "Cantiga HDMI", patch_generic_hdmi), | 3925 | HDA_CODEC_ENTRY(0x80862802, "Cantiga HDMI", patch_generic_hdmi), |
3883 | HDA_CODEC_ENTRY(0x80862803, "Eaglelake HDMI", patch_generic_hdmi), | 3926 | HDA_CODEC_ENTRY(0x80862803, "Eaglelake HDMI", patch_generic_hdmi), |
@@ -3891,7 +3934,7 @@ HDA_CODEC_ENTRY(0x8086280a, "Broxton HDMI", patch_i915_hsw_hdmi), | |||
3891 | HDA_CODEC_ENTRY(0x8086280b, "Kabylake HDMI", patch_i915_hsw_hdmi), | 3934 | HDA_CODEC_ENTRY(0x8086280b, "Kabylake HDMI", patch_i915_hsw_hdmi), |
3892 | HDA_CODEC_ENTRY(0x8086280c, "Cannonlake HDMI", patch_i915_glk_hdmi), | 3935 | HDA_CODEC_ENTRY(0x8086280c, "Cannonlake HDMI", patch_i915_glk_hdmi), |
3893 | HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi), | 3936 | HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi), |
3894 | HDA_CODEC_ENTRY(0x80862800, "Geminilake HDMI", patch_i915_glk_hdmi), | 3937 | HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi), |
3895 | HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi), | 3938 | HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi), |
3896 | HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi), | 3939 | HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi), |
3897 | HDA_CODEC_ENTRY(0x80862883, "Braswell HDMI", patch_i915_byt_hdmi), | 3940 | HDA_CODEC_ENTRY(0x80862883, "Braswell HDMI", patch_i915_byt_hdmi), |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 1ffa36e987b4..384719d5c44e 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -118,6 +118,7 @@ struct alc_spec { | |||
118 | unsigned int has_alc5505_dsp:1; | 118 | unsigned int has_alc5505_dsp:1; |
119 | unsigned int no_depop_delay:1; | 119 | unsigned int no_depop_delay:1; |
120 | unsigned int done_hp_init:1; | 120 | unsigned int done_hp_init:1; |
121 | unsigned int no_shutup_pins:1; | ||
121 | 122 | ||
122 | /* for PLL fix */ | 123 | /* for PLL fix */ |
123 | hda_nid_t pll_nid; | 124 | hda_nid_t pll_nid; |
@@ -476,6 +477,14 @@ static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) | |||
476 | set_eapd(codec, *p, on); | 477 | set_eapd(codec, *p, on); |
477 | } | 478 | } |
478 | 479 | ||
480 | static void alc_shutup_pins(struct hda_codec *codec) | ||
481 | { | ||
482 | struct alc_spec *spec = codec->spec; | ||
483 | |||
484 | if (!spec->no_shutup_pins) | ||
485 | snd_hda_shutup_pins(codec); | ||
486 | } | ||
487 | |||
479 | /* generic shutup callback; | 488 | /* generic shutup callback; |
480 | * just turning off EAPD and a little pause for avoiding pop-noise | 489 | * just turning off EAPD and a little pause for avoiding pop-noise |
481 | */ | 490 | */ |
@@ -486,7 +495,7 @@ static void alc_eapd_shutup(struct hda_codec *codec) | |||
486 | alc_auto_setup_eapd(codec, false); | 495 | alc_auto_setup_eapd(codec, false); |
487 | if (!spec->no_depop_delay) | 496 | if (!spec->no_depop_delay) |
488 | msleep(200); | 497 | msleep(200); |
489 | snd_hda_shutup_pins(codec); | 498 | alc_shutup_pins(codec); |
490 | } | 499 | } |
491 | 500 | ||
492 | /* generic EAPD initialization */ | 501 | /* generic EAPD initialization */ |
@@ -814,7 +823,7 @@ static inline void alc_shutup(struct hda_codec *codec) | |||
814 | if (spec && spec->shutup) | 823 | if (spec && spec->shutup) |
815 | spec->shutup(codec); | 824 | spec->shutup(codec); |
816 | else | 825 | else |
817 | snd_hda_shutup_pins(codec); | 826 | alc_shutup_pins(codec); |
818 | } | 827 | } |
819 | 828 | ||
820 | static void alc_reboot_notify(struct hda_codec *codec) | 829 | static void alc_reboot_notify(struct hda_codec *codec) |
@@ -2950,7 +2959,7 @@ static void alc269_shutup(struct hda_codec *codec) | |||
2950 | (alc_get_coef0(codec) & 0x00ff) == 0x018) { | 2959 | (alc_get_coef0(codec) & 0x00ff) == 0x018) { |
2951 | msleep(150); | 2960 | msleep(150); |
2952 | } | 2961 | } |
2953 | snd_hda_shutup_pins(codec); | 2962 | alc_shutup_pins(codec); |
2954 | } | 2963 | } |
2955 | 2964 | ||
2956 | static struct coef_fw alc282_coefs[] = { | 2965 | static struct coef_fw alc282_coefs[] = { |
@@ -3053,14 +3062,15 @@ static void alc282_shutup(struct hda_codec *codec) | |||
3053 | if (hp_pin_sense) | 3062 | if (hp_pin_sense) |
3054 | msleep(85); | 3063 | msleep(85); |
3055 | 3064 | ||
3056 | snd_hda_codec_write(codec, hp_pin, 0, | 3065 | if (!spec->no_shutup_pins) |
3057 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); | 3066 | snd_hda_codec_write(codec, hp_pin, 0, |
3067 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); | ||
3058 | 3068 | ||
3059 | if (hp_pin_sense) | 3069 | if (hp_pin_sense) |
3060 | msleep(100); | 3070 | msleep(100); |
3061 | 3071 | ||
3062 | alc_auto_setup_eapd(codec, false); | 3072 | alc_auto_setup_eapd(codec, false); |
3063 | snd_hda_shutup_pins(codec); | 3073 | alc_shutup_pins(codec); |
3064 | alc_write_coef_idx(codec, 0x78, coef78); | 3074 | alc_write_coef_idx(codec, 0x78, coef78); |
3065 | } | 3075 | } |
3066 | 3076 | ||
@@ -3166,15 +3176,16 @@ static void alc283_shutup(struct hda_codec *codec) | |||
3166 | if (hp_pin_sense) | 3176 | if (hp_pin_sense) |
3167 | msleep(100); | 3177 | msleep(100); |
3168 | 3178 | ||
3169 | snd_hda_codec_write(codec, hp_pin, 0, | 3179 | if (!spec->no_shutup_pins) |
3170 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); | 3180 | snd_hda_codec_write(codec, hp_pin, 0, |
3181 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); | ||
3171 | 3182 | ||
3172 | alc_update_coef_idx(codec, 0x46, 0, 3 << 12); | 3183 | alc_update_coef_idx(codec, 0x46, 0, 3 << 12); |
3173 | 3184 | ||
3174 | if (hp_pin_sense) | 3185 | if (hp_pin_sense) |
3175 | msleep(100); | 3186 | msleep(100); |
3176 | alc_auto_setup_eapd(codec, false); | 3187 | alc_auto_setup_eapd(codec, false); |
3177 | snd_hda_shutup_pins(codec); | 3188 | alc_shutup_pins(codec); |
3178 | alc_write_coef_idx(codec, 0x43, 0x9614); | 3189 | alc_write_coef_idx(codec, 0x43, 0x9614); |
3179 | } | 3190 | } |
3180 | 3191 | ||
@@ -3240,14 +3251,15 @@ static void alc256_shutup(struct hda_codec *codec) | |||
3240 | /* NOTE: call this before clearing the pin, otherwise codec stalls */ | 3251 | /* NOTE: call this before clearing the pin, otherwise codec stalls */ |
3241 | alc_update_coef_idx(codec, 0x46, 0, 3 << 12); | 3252 | alc_update_coef_idx(codec, 0x46, 0, 3 << 12); |
3242 | 3253 | ||
3243 | snd_hda_codec_write(codec, hp_pin, 0, | 3254 | if (!spec->no_shutup_pins) |
3244 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); | 3255 | snd_hda_codec_write(codec, hp_pin, 0, |
3256 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); | ||
3245 | 3257 | ||
3246 | if (hp_pin_sense) | 3258 | if (hp_pin_sense) |
3247 | msleep(100); | 3259 | msleep(100); |
3248 | 3260 | ||
3249 | alc_auto_setup_eapd(codec, false); | 3261 | alc_auto_setup_eapd(codec, false); |
3250 | snd_hda_shutup_pins(codec); | 3262 | alc_shutup_pins(codec); |
3251 | } | 3263 | } |
3252 | 3264 | ||
3253 | static void alc225_init(struct hda_codec *codec) | 3265 | static void alc225_init(struct hda_codec *codec) |
@@ -3334,7 +3346,7 @@ static void alc225_shutup(struct hda_codec *codec) | |||
3334 | msleep(100); | 3346 | msleep(100); |
3335 | 3347 | ||
3336 | alc_auto_setup_eapd(codec, false); | 3348 | alc_auto_setup_eapd(codec, false); |
3337 | snd_hda_shutup_pins(codec); | 3349 | alc_shutup_pins(codec); |
3338 | } | 3350 | } |
3339 | 3351 | ||
3340 | static void alc_default_init(struct hda_codec *codec) | 3352 | static void alc_default_init(struct hda_codec *codec) |
@@ -3388,14 +3400,15 @@ static void alc_default_shutup(struct hda_codec *codec) | |||
3388 | if (hp_pin_sense) | 3400 | if (hp_pin_sense) |
3389 | msleep(85); | 3401 | msleep(85); |
3390 | 3402 | ||
3391 | snd_hda_codec_write(codec, hp_pin, 0, | 3403 | if (!spec->no_shutup_pins) |
3392 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); | 3404 | snd_hda_codec_write(codec, hp_pin, 0, |
3405 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); | ||
3393 | 3406 | ||
3394 | if (hp_pin_sense) | 3407 | if (hp_pin_sense) |
3395 | msleep(100); | 3408 | msleep(100); |
3396 | 3409 | ||
3397 | alc_auto_setup_eapd(codec, false); | 3410 | alc_auto_setup_eapd(codec, false); |
3398 | snd_hda_shutup_pins(codec); | 3411 | alc_shutup_pins(codec); |
3399 | } | 3412 | } |
3400 | 3413 | ||
3401 | static void alc294_hp_init(struct hda_codec *codec) | 3414 | static void alc294_hp_init(struct hda_codec *codec) |
@@ -3412,8 +3425,9 @@ static void alc294_hp_init(struct hda_codec *codec) | |||
3412 | 3425 | ||
3413 | msleep(100); | 3426 | msleep(100); |
3414 | 3427 | ||
3415 | snd_hda_codec_write(codec, hp_pin, 0, | 3428 | if (!spec->no_shutup_pins) |
3416 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); | 3429 | snd_hda_codec_write(codec, hp_pin, 0, |
3430 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); | ||
3417 | 3431 | ||
3418 | alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */ | 3432 | alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */ |
3419 | alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */ | 3433 | alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */ |
@@ -3433,7 +3447,9 @@ static void alc294_init(struct hda_codec *codec) | |||
3433 | { | 3447 | { |
3434 | struct alc_spec *spec = codec->spec; | 3448 | struct alc_spec *spec = codec->spec; |
3435 | 3449 | ||
3436 | if (!spec->done_hp_init) { | 3450 | /* required only at boot or S4 resume time */ |
3451 | if (!spec->done_hp_init || | ||
3452 | codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) { | ||
3437 | alc294_hp_init(codec); | 3453 | alc294_hp_init(codec); |
3438 | spec->done_hp_init = true; | 3454 | spec->done_hp_init = true; |
3439 | } | 3455 | } |
@@ -5007,16 +5023,12 @@ static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, | |||
5007 | } | 5023 | } |
5008 | } | 5024 | } |
5009 | 5025 | ||
5010 | static void alc_no_shutup(struct hda_codec *codec) | ||
5011 | { | ||
5012 | } | ||
5013 | |||
5014 | static void alc_fixup_no_shutup(struct hda_codec *codec, | 5026 | static void alc_fixup_no_shutup(struct hda_codec *codec, |
5015 | const struct hda_fixup *fix, int action) | 5027 | const struct hda_fixup *fix, int action) |
5016 | { | 5028 | { |
5017 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | 5029 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
5018 | struct alc_spec *spec = codec->spec; | 5030 | struct alc_spec *spec = codec->spec; |
5019 | spec->shutup = alc_no_shutup; | 5031 | spec->no_shutup_pins = 1; |
5020 | } | 5032 | } |
5021 | } | 5033 | } |
5022 | 5034 | ||
@@ -5479,7 +5491,7 @@ static void alc_headset_btn_callback(struct hda_codec *codec, | |||
5479 | jack->jack->button_state = report; | 5491 | jack->jack->button_state = report; |
5480 | } | 5492 | } |
5481 | 5493 | ||
5482 | static void alc_fixup_headset_jack(struct hda_codec *codec, | 5494 | static void alc295_fixup_chromebook(struct hda_codec *codec, |
5483 | const struct hda_fixup *fix, int action) | 5495 | const struct hda_fixup *fix, int action) |
5484 | { | 5496 | { |
5485 | 5497 | ||
@@ -5489,6 +5501,16 @@ static void alc_fixup_headset_jack(struct hda_codec *codec, | |||
5489 | alc_headset_btn_callback); | 5501 | alc_headset_btn_callback); |
5490 | snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false, | 5502 | snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false, |
5491 | SND_JACK_HEADSET, alc_headset_btn_keymap); | 5503 | SND_JACK_HEADSET, alc_headset_btn_keymap); |
5504 | switch (codec->core.vendor_id) { | ||
5505 | case 0x10ec0295: | ||
5506 | alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ | ||
5507 | alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); | ||
5508 | break; | ||
5509 | case 0x10ec0236: | ||
5510 | alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ | ||
5511 | alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); | ||
5512 | break; | ||
5513 | } | ||
5492 | break; | 5514 | break; |
5493 | case HDA_FIXUP_ACT_INIT: | 5515 | case HDA_FIXUP_ACT_INIT: |
5494 | switch (codec->core.vendor_id) { | 5516 | switch (codec->core.vendor_id) { |
@@ -5658,9 +5680,13 @@ enum { | |||
5658 | ALC294_FIXUP_ASUS_MIC, | 5680 | ALC294_FIXUP_ASUS_MIC, |
5659 | ALC294_FIXUP_ASUS_HEADSET_MIC, | 5681 | ALC294_FIXUP_ASUS_HEADSET_MIC, |
5660 | ALC294_FIXUP_ASUS_SPK, | 5682 | ALC294_FIXUP_ASUS_SPK, |
5661 | ALC225_FIXUP_HEADSET_JACK, | ||
5662 | ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE, | 5683 | ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE, |
5663 | ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE, | 5684 | ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE, |
5685 | ALC255_FIXUP_ACER_HEADSET_MIC, | ||
5686 | ALC295_FIXUP_CHROME_BOOK, | ||
5687 | ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE, | ||
5688 | ALC225_FIXUP_WYSE_AUTO_MUTE, | ||
5689 | ALC225_FIXUP_WYSE_DISABLE_MIC_VREF, | ||
5664 | }; | 5690 | }; |
5665 | 5691 | ||
5666 | static const struct hda_fixup alc269_fixups[] = { | 5692 | static const struct hda_fixup alc269_fixups[] = { |
@@ -6603,9 +6629,9 @@ static const struct hda_fixup alc269_fixups[] = { | |||
6603 | .chained = true, | 6629 | .chained = true, |
6604 | .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC | 6630 | .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC |
6605 | }, | 6631 | }, |
6606 | [ALC225_FIXUP_HEADSET_JACK] = { | 6632 | [ALC295_FIXUP_CHROME_BOOK] = { |
6607 | .type = HDA_FIXUP_FUNC, | 6633 | .type = HDA_FIXUP_FUNC, |
6608 | .v.func = alc_fixup_headset_jack, | 6634 | .v.func = alc295_fixup_chromebook, |
6609 | }, | 6635 | }, |
6610 | [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = { | 6636 | [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = { |
6611 | .type = HDA_FIXUP_PINS, | 6637 | .type = HDA_FIXUP_PINS, |
@@ -6627,6 +6653,38 @@ static const struct hda_fixup alc269_fixups[] = { | |||
6627 | .chained = true, | 6653 | .chained = true, |
6628 | .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE | 6654 | .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE |
6629 | }, | 6655 | }, |
6656 | [ALC255_FIXUP_ACER_HEADSET_MIC] = { | ||
6657 | .type = HDA_FIXUP_PINS, | ||
6658 | .v.pins = (const struct hda_pintbl[]) { | ||
6659 | { 0x19, 0x03a11130 }, | ||
6660 | { 0x1a, 0x90a60140 }, /* use as internal mic */ | ||
6661 | { } | ||
6662 | }, | ||
6663 | .chained = true, | ||
6664 | .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC | ||
6665 | }, | ||
6666 | [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = { | ||
6667 | .type = HDA_FIXUP_PINS, | ||
6668 | .v.pins = (const struct hda_pintbl[]) { | ||
6669 | { 0x16, 0x01011020 }, /* Rear Line out */ | ||
6670 | { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */ | ||
6671 | { } | ||
6672 | }, | ||
6673 | .chained = true, | ||
6674 | .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE | ||
6675 | }, | ||
6676 | [ALC225_FIXUP_WYSE_AUTO_MUTE] = { | ||
6677 | .type = HDA_FIXUP_FUNC, | ||
6678 | .v.func = alc_fixup_auto_mute_via_amp, | ||
6679 | .chained = true, | ||
6680 | .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF | ||
6681 | }, | ||
6682 | [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = { | ||
6683 | .type = HDA_FIXUP_FUNC, | ||
6684 | .v.func = alc_fixup_disable_mic_vref, | ||
6685 | .chained = true, | ||
6686 | .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC | ||
6687 | }, | ||
6630 | }; | 6688 | }; |
6631 | 6689 | ||
6632 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { | 6690 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
@@ -6646,6 +6704,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
6646 | SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), | 6704 | SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), |
6647 | SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), | 6705 | SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), |
6648 | SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), | 6706 | SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), |
6707 | SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC), | ||
6649 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), | 6708 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
6650 | SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS), | 6709 | SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS), |
6651 | SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X), | 6710 | SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X), |
@@ -6677,6 +6736,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
6677 | SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), | 6736 | SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), |
6678 | SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER), | 6737 | SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER), |
6679 | SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE), | 6738 | SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE), |
6739 | SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP), | ||
6680 | SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), | 6740 | SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), |
6681 | SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME), | 6741 | SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME), |
6682 | SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME), | 6742 | SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME), |
@@ -6689,6 +6749,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
6689 | SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), | 6749 | SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), |
6690 | SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), | 6750 | SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), |
6691 | SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB), | 6751 | SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB), |
6752 | SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE), | ||
6753 | SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE), | ||
6692 | SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), | 6754 | SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), |
6693 | SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 6755 | SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
6694 | SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 6756 | SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
@@ -6751,11 +6813,13 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
6751 | SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 6813 | SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
6752 | SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 6814 | SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
6753 | SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC), | 6815 | SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC), |
6816 | SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE), | ||
6817 | SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE), | ||
6754 | SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), | 6818 | SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), |
6755 | SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC), | 6819 | SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC), |
6756 | SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360), | 6820 | SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360), |
6757 | SND_PCI_QUIRK(0x103c, 0x82bf, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE), | 6821 | SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE), |
6758 | SND_PCI_QUIRK(0x103c, 0x82c0, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE), | 6822 | SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE), |
6759 | SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3), | 6823 | SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3), |
6760 | SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), | 6824 | SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), |
6761 | SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), | 6825 | SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), |
@@ -6771,7 +6835,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
6771 | SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC), | 6835 | SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC), |
6772 | SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC), | 6836 | SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC), |
6773 | SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK), | 6837 | SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK), |
6774 | SND_PCI_QUIRK(0x1043, 0x14a1, "ASUS UX533FD", ALC294_FIXUP_ASUS_SPK), | ||
6775 | SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A), | 6838 | SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A), |
6776 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), | 6839 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), |
6777 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), | 6840 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
@@ -7036,7 +7099,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { | |||
7036 | {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"}, | 7099 | {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"}, |
7037 | {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"}, | 7100 | {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"}, |
7038 | {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"}, | 7101 | {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"}, |
7039 | {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-sense-combo"}, | 7102 | {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-sense-combo"}, |
7040 | {} | 7103 | {} |
7041 | }; | 7104 | }; |
7042 | #define ALC225_STANDARD_PINS \ | 7105 | #define ALC225_STANDARD_PINS \ |
@@ -7391,6 +7454,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { | |||
7391 | SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK, | 7454 | SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK, |
7392 | {0x12, 0x90a60130}, | 7455 | {0x12, 0x90a60130}, |
7393 | {0x17, 0x90170110}, | 7456 | {0x17, 0x90170110}, |
7457 | {0x21, 0x03211020}), | ||
7458 | SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK, | ||
7459 | {0x12, 0x90a60130}, | ||
7460 | {0x17, 0x90170110}, | ||
7394 | {0x21, 0x04211020}), | 7461 | {0x21, 0x04211020}), |
7395 | SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, | 7462 | SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, |
7396 | ALC295_STANDARD_PINS, | 7463 | ALC295_STANDARD_PINS, |
diff --git a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c index b8af747ecb43..7646c93e8268 100644 --- a/sound/pci/ice1712/ews.c +++ b/sound/pci/ice1712/ews.c | |||
@@ -826,7 +826,12 @@ static int snd_ice1712_6fire_read_pca(struct snd_ice1712 *ice, unsigned char reg | |||
826 | 826 | ||
827 | snd_i2c_lock(ice->i2c); | 827 | snd_i2c_lock(ice->i2c); |
828 | byte = reg; | 828 | byte = reg; |
829 | snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1); | 829 | if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1)) { |
830 | snd_i2c_unlock(ice->i2c); | ||
831 | dev_err(ice->card->dev, "cannot send pca\n"); | ||
832 | return -EIO; | ||
833 | } | ||
834 | |||
830 | byte = 0; | 835 | byte = 0; |
831 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) { | 836 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) { |
832 | snd_i2c_unlock(ice->i2c); | 837 | snd_i2c_unlock(ice->i2c); |
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index f1fe497c2f9d..fa7d90ee6e2d 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c | |||
@@ -1603,10 +1603,7 @@ static void snd_ice1712_proc_read(struct snd_info_entry *entry, | |||
1603 | 1603 | ||
1604 | static void snd_ice1712_proc_init(struct snd_ice1712 *ice) | 1604 | static void snd_ice1712_proc_init(struct snd_ice1712 *ice) |
1605 | { | 1605 | { |
1606 | struct snd_info_entry *entry; | 1606 | snd_card_ro_proc_new(ice->card, "ice1712", ice, snd_ice1712_proc_read); |
1607 | |||
1608 | if (!snd_card_proc_new(ice->card, "ice1712", &entry)) | ||
1609 | snd_info_set_text_ops(entry, ice, snd_ice1712_proc_read); | ||
1610 | } | 1607 | } |
1611 | 1608 | ||
1612 | /* | 1609 | /* |
@@ -2792,9 +2789,6 @@ static int snd_ice1712_suspend(struct device *dev) | |||
2792 | 2789 | ||
2793 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2790 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2794 | 2791 | ||
2795 | snd_pcm_suspend_all(ice->pcm); | ||
2796 | snd_pcm_suspend_all(ice->pcm_pro); | ||
2797 | snd_pcm_suspend_all(ice->pcm_ds); | ||
2798 | snd_ac97_suspend(ice->ac97); | 2792 | snd_ac97_suspend(ice->ac97); |
2799 | 2793 | ||
2800 | spin_lock_irq(&ice->reg_lock); | 2794 | spin_lock_irq(&ice->reg_lock); |
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 057c2f394ea7..a7d640ee4a17 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -1571,10 +1571,7 @@ static void snd_vt1724_proc_read(struct snd_info_entry *entry, | |||
1571 | 1571 | ||
1572 | static void snd_vt1724_proc_init(struct snd_ice1712 *ice) | 1572 | static void snd_vt1724_proc_init(struct snd_ice1712 *ice) |
1573 | { | 1573 | { |
1574 | struct snd_info_entry *entry; | 1574 | snd_card_ro_proc_new(ice->card, "ice1724", ice, snd_vt1724_proc_read); |
1575 | |||
1576 | if (!snd_card_proc_new(ice->card, "ice1724", &entry)) | ||
1577 | snd_info_set_text_ops(entry, ice, snd_vt1724_proc_read); | ||
1578 | } | 1575 | } |
1579 | 1576 | ||
1580 | /* | 1577 | /* |
@@ -2804,9 +2801,6 @@ static int snd_vt1724_suspend(struct device *dev) | |||
2804 | 2801 | ||
2805 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2802 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2806 | 2803 | ||
2807 | snd_pcm_suspend_all(ice->pcm); | ||
2808 | snd_pcm_suspend_all(ice->pcm_pro); | ||
2809 | snd_pcm_suspend_all(ice->pcm_ds); | ||
2810 | snd_ac97_suspend(ice->ac97); | 2804 | snd_ac97_suspend(ice->ac97); |
2811 | 2805 | ||
2812 | spin_lock_irq(&ice->reg_lock); | 2806 | spin_lock_irq(&ice->reg_lock); |
diff --git a/sound/pci/ice1712/pontis.c b/sound/pci/ice1712/pontis.c index 93b8cfc6636f..f499f1e8d0c9 100644 --- a/sound/pci/ice1712/pontis.c +++ b/sound/pci/ice1712/pontis.c | |||
@@ -659,12 +659,8 @@ static void wm_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buff | |||
659 | 659 | ||
660 | static void wm_proc_init(struct snd_ice1712 *ice) | 660 | static void wm_proc_init(struct snd_ice1712 *ice) |
661 | { | 661 | { |
662 | struct snd_info_entry *entry; | 662 | snd_card_rw_proc_new(ice->card, "wm_codec", ice, wm_proc_regs_read, |
663 | if (! snd_card_proc_new(ice->card, "wm_codec", &entry)) { | 663 | wm_proc_regs_write); |
664 | snd_info_set_text_ops(entry, ice, wm_proc_regs_read); | ||
665 | entry->mode |= 0200; | ||
666 | entry->c.text.write = wm_proc_regs_write; | ||
667 | } | ||
668 | } | 664 | } |
669 | 665 | ||
670 | static void cs_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | 666 | static void cs_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) |
@@ -684,9 +680,7 @@ static void cs_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buff | |||
684 | 680 | ||
685 | static void cs_proc_init(struct snd_ice1712 *ice) | 681 | static void cs_proc_init(struct snd_ice1712 *ice) |
686 | { | 682 | { |
687 | struct snd_info_entry *entry; | 683 | snd_card_ro_proc_new(ice->card, "cs_codec", ice, cs_proc_regs_read); |
688 | if (! snd_card_proc_new(ice->card, "cs_codec", &entry)) | ||
689 | snd_info_set_text_ops(entry, ice, cs_proc_regs_read); | ||
690 | } | 684 | } |
691 | 685 | ||
692 | 686 | ||
diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c index 3919aed39ca0..d243309029d3 100644 --- a/sound/pci/ice1712/prodigy192.c +++ b/sound/pci/ice1712/prodigy192.c | |||
@@ -651,9 +651,8 @@ static void stac9460_proc_regs_read(struct snd_info_entry *entry, | |||
651 | 651 | ||
652 | static void stac9460_proc_init(struct snd_ice1712 *ice) | 652 | static void stac9460_proc_init(struct snd_ice1712 *ice) |
653 | { | 653 | { |
654 | struct snd_info_entry *entry; | 654 | snd_card_ro_proc_new(ice->card, "stac9460_codec", ice, |
655 | if (!snd_card_proc_new(ice->card, "stac9460_codec", &entry)) | 655 | stac9460_proc_regs_read); |
656 | snd_info_set_text_ops(entry, ice, stac9460_proc_regs_read); | ||
657 | } | 656 | } |
658 | 657 | ||
659 | 658 | ||
diff --git a/sound/pci/ice1712/prodigy_hifi.c b/sound/pci/ice1712/prodigy_hifi.c index c97b5528e4b8..72f252c936e5 100644 --- a/sound/pci/ice1712/prodigy_hifi.c +++ b/sound/pci/ice1712/prodigy_hifi.c | |||
@@ -904,12 +904,8 @@ static void wm_proc_regs_read(struct snd_info_entry *entry, | |||
904 | 904 | ||
905 | static void wm_proc_init(struct snd_ice1712 *ice) | 905 | static void wm_proc_init(struct snd_ice1712 *ice) |
906 | { | 906 | { |
907 | struct snd_info_entry *entry; | 907 | snd_card_rw_proc_new(ice->card, "wm_codec", ice, wm_proc_regs_read, |
908 | if (!snd_card_proc_new(ice->card, "wm_codec", &entry)) { | 908 | wm_proc_regs_write); |
909 | snd_info_set_text_ops(entry, ice, wm_proc_regs_read); | ||
910 | entry->mode |= 0200; | ||
911 | entry->c.text.write = wm_proc_regs_write; | ||
912 | } | ||
913 | } | 909 | } |
914 | 910 | ||
915 | static int prodigy_hifi_add_controls(struct snd_ice1712 *ice) | 911 | static int prodigy_hifi_add_controls(struct snd_ice1712 *ice) |
diff --git a/sound/pci/ice1712/quartet.c b/sound/pci/ice1712/quartet.c index 5bc836241c97..8ad964ee0b65 100644 --- a/sound/pci/ice1712/quartet.c +++ b/sound/pci/ice1712/quartet.c | |||
@@ -502,9 +502,7 @@ static void proc_regs_read(struct snd_info_entry *entry, | |||
502 | 502 | ||
503 | static void proc_init(struct snd_ice1712 *ice) | 503 | static void proc_init(struct snd_ice1712 *ice) |
504 | { | 504 | { |
505 | struct snd_info_entry *entry; | 505 | snd_card_ro_proc_new(ice->card, "quartet", ice, proc_regs_read); |
506 | if (!snd_card_proc_new(ice->card, "quartet", &entry)) | ||
507 | snd_info_set_text_ops(entry, ice, proc_regs_read); | ||
508 | } | 506 | } |
509 | 507 | ||
510 | static int qtet_mute_get(struct snd_kcontrol *kcontrol, | 508 | static int qtet_mute_get(struct snd_kcontrol *kcontrol, |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index ffddcdfe0c66..2784bf48cf5a 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -2614,8 +2614,6 @@ static int intel8x0_suspend(struct device *dev) | |||
2614 | int i; | 2614 | int i; |
2615 | 2615 | ||
2616 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2616 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2617 | for (i = 0; i < chip->pcm_devs; i++) | ||
2618 | snd_pcm_suspend_all(chip->pcm[i]); | ||
2619 | for (i = 0; i < chip->ncodecs; i++) | 2617 | for (i = 0; i < chip->ncodecs; i++) |
2620 | snd_ac97_suspend(chip->ac97[i]); | 2618 | snd_ac97_suspend(chip->ac97[i]); |
2621 | if (chip->device_type == DEVICE_INTEL_ICH4) | 2619 | if (chip->device_type == DEVICE_INTEL_ICH4) |
@@ -2865,10 +2863,8 @@ static void snd_intel8x0_proc_read(struct snd_info_entry * entry, | |||
2865 | 2863 | ||
2866 | static void snd_intel8x0_proc_init(struct intel8x0 *chip) | 2864 | static void snd_intel8x0_proc_init(struct intel8x0 *chip) |
2867 | { | 2865 | { |
2868 | struct snd_info_entry *entry; | 2866 | snd_card_ro_proc_new(chip->card, "intel8x0", chip, |
2869 | 2867 | snd_intel8x0_proc_read); | |
2870 | if (! snd_card_proc_new(chip->card, "intel8x0", &entry)) | ||
2871 | snd_info_set_text_ops(entry, chip, snd_intel8x0_proc_read); | ||
2872 | } | 2868 | } |
2873 | 2869 | ||
2874 | static int snd_intel8x0_dev_free(struct snd_device *device) | 2870 | static int snd_intel8x0_dev_free(struct snd_device *device) |
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index c84629190cba..43c654e15452 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c | |||
@@ -1025,11 +1025,8 @@ static int intel8x0m_suspend(struct device *dev) | |||
1025 | { | 1025 | { |
1026 | struct snd_card *card = dev_get_drvdata(dev); | 1026 | struct snd_card *card = dev_get_drvdata(dev); |
1027 | struct intel8x0m *chip = card->private_data; | 1027 | struct intel8x0m *chip = card->private_data; |
1028 | int i; | ||
1029 | 1028 | ||
1030 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1029 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1031 | for (i = 0; i < chip->pcm_devs; i++) | ||
1032 | snd_pcm_suspend_all(chip->pcm[i]); | ||
1033 | snd_ac97_suspend(chip->ac97); | 1030 | snd_ac97_suspend(chip->ac97); |
1034 | if (chip->irq >= 0) { | 1031 | if (chip->irq >= 0) { |
1035 | free_irq(chip->irq, chip); | 1032 | free_irq(chip->irq, chip); |
@@ -1087,10 +1084,8 @@ static void snd_intel8x0m_proc_read(struct snd_info_entry * entry, | |||
1087 | 1084 | ||
1088 | static void snd_intel8x0m_proc_init(struct intel8x0m *chip) | 1085 | static void snd_intel8x0m_proc_init(struct intel8x0m *chip) |
1089 | { | 1086 | { |
1090 | struct snd_info_entry *entry; | 1087 | snd_card_ro_proc_new(chip->card, "intel8x0m", chip, |
1091 | 1088 | snd_intel8x0m_proc_read); | |
1092 | if (! snd_card_proc_new(chip->card, "intel8x0m", &entry)) | ||
1093 | snd_info_set_text_ops(entry, chip, snd_intel8x0m_proc_read); | ||
1094 | } | 1089 | } |
1095 | 1090 | ||
1096 | static int snd_intel8x0m_dev_free(struct snd_device *device) | 1091 | static int snd_intel8x0m_dev_free(struct snd_device *device) |
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index 4e189a93f475..fe4aba8a08ea 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c | |||
@@ -2090,10 +2090,8 @@ static void snd_korg1212_proc_read(struct snd_info_entry *entry, | |||
2090 | 2090 | ||
2091 | static void snd_korg1212_proc_init(struct snd_korg1212 *korg1212) | 2091 | static void snd_korg1212_proc_init(struct snd_korg1212 *korg1212) |
2092 | { | 2092 | { |
2093 | struct snd_info_entry *entry; | 2093 | snd_card_ro_proc_new(korg1212->card, "korg1212", korg1212, |
2094 | 2094 | snd_korg1212_proc_read); | |
2095 | if (! snd_card_proc_new(korg1212->card, "korg1212", &entry)) | ||
2096 | snd_info_set_text_ops(entry, korg1212, snd_korg1212_proc_read); | ||
2097 | } | 2095 | } |
2098 | 2096 | ||
2099 | static int | 2097 | static int |
diff --git a/sound/pci/lola/lola_proc.c b/sound/pci/lola/lola_proc.c index 904e3c4f4dfe..1603f9c81897 100644 --- a/sound/pci/lola/lola_proc.c +++ b/sound/pci/lola/lola_proc.c | |||
@@ -208,15 +208,9 @@ static void lola_proc_regs_read(struct snd_info_entry *entry, | |||
208 | 208 | ||
209 | void lola_proc_debug_new(struct lola *chip) | 209 | void lola_proc_debug_new(struct lola *chip) |
210 | { | 210 | { |
211 | struct snd_info_entry *entry; | 211 | snd_card_ro_proc_new(chip->card, "codec", chip, lola_proc_codec_read); |
212 | 212 | snd_card_rw_proc_new(chip->card, "codec_rw", chip, | |
213 | if (!snd_card_proc_new(chip->card, "codec", &entry)) | 213 | lola_proc_codec_rw_read, |
214 | snd_info_set_text_ops(entry, chip, lola_proc_codec_read); | 214 | lola_proc_codec_rw_write); |
215 | if (!snd_card_proc_new(chip->card, "codec_rw", &entry)) { | 215 | snd_card_ro_proc_new(chip->card, "regs", chip, lola_proc_regs_read); |
216 | snd_info_set_text_ops(entry, chip, lola_proc_codec_rw_read); | ||
217 | entry->mode |= 0200; | ||
218 | entry->c.text.write = lola_proc_codec_rw_write; | ||
219 | } | ||
220 | if (!snd_card_proc_new(chip->card, "regs", &entry)) | ||
221 | snd_info_set_text_ops(entry, chip, lola_proc_regs_read); | ||
222 | } | 216 | } |
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c index 54f6252faca6..ae23a2dfbdea 100644 --- a/sound/pci/lx6464es/lx6464es.c +++ b/sound/pci/lx6464es/lx6464es.c | |||
@@ -854,11 +854,9 @@ static int lx_pcm_create(struct lx6464es *chip) | |||
854 | pcm->nonatomic = true; | 854 | pcm->nonatomic = true; |
855 | strcpy(pcm->name, card_name); | 855 | strcpy(pcm->name, card_name); |
856 | 856 | ||
857 | err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 857 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
858 | snd_dma_pci_data(chip->pci), | 858 | snd_dma_pci_data(chip->pci), |
859 | size, size); | 859 | size, size); |
860 | if (err < 0) | ||
861 | return err; | ||
862 | 860 | ||
863 | chip->pcm = pcm; | 861 | chip->pcm = pcm; |
864 | chip->capture_stream.is_capture = 1; | 862 | chip->capture_stream.is_capture = 1; |
@@ -948,13 +946,7 @@ static void lx_proc_levels_read(struct snd_info_entry *entry, | |||
948 | 946 | ||
949 | static int lx_proc_create(struct snd_card *card, struct lx6464es *chip) | 947 | static int lx_proc_create(struct snd_card *card, struct lx6464es *chip) |
950 | { | 948 | { |
951 | struct snd_info_entry *entry; | 949 | return snd_card_ro_proc_new(card, "levels", chip, lx_proc_levels_read); |
952 | int err = snd_card_proc_new(card, "levels", &entry); | ||
953 | if (err < 0) | ||
954 | return err; | ||
955 | |||
956 | snd_info_set_text_ops(entry, chip, lx_proc_levels_read); | ||
957 | return 0; | ||
958 | } | 950 | } |
959 | 951 | ||
960 | 952 | ||
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 62962178a9d7..1a9468c14aaf 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c | |||
@@ -2422,7 +2422,6 @@ static int m3_suspend(struct device *dev) | |||
2422 | chip->in_suspend = 1; | 2422 | chip->in_suspend = 1; |
2423 | cancel_work_sync(&chip->hwvol_work); | 2423 | cancel_work_sync(&chip->hwvol_work); |
2424 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2424 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2425 | snd_pcm_suspend_all(chip->pcm); | ||
2426 | snd_ac97_suspend(chip->ac97); | 2425 | snd_ac97_suspend(chip->ac97); |
2427 | 2426 | ||
2428 | msleep(10); /* give the assp a chance to idle.. */ | 2427 | msleep(10); /* give the assp a chance to idle.. */ |
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 9cd297a42f24..92f616df3863 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c | |||
@@ -1220,10 +1220,8 @@ static void snd_mixart_proc_init(struct snd_mixart *chip) | |||
1220 | struct snd_info_entry *entry; | 1220 | struct snd_info_entry *entry; |
1221 | 1221 | ||
1222 | /* text interface to read perf and temp meters */ | 1222 | /* text interface to read perf and temp meters */ |
1223 | if (! snd_card_proc_new(chip->card, "board_info", &entry)) { | 1223 | snd_card_ro_proc_new(chip->card, "board_info", chip, |
1224 | entry->private_data = chip; | 1224 | snd_mixart_proc_read); |
1225 | entry->c.text.read = snd_mixart_proc_read; | ||
1226 | } | ||
1227 | 1225 | ||
1228 | if (! snd_card_proc_new(chip->card, "mixart_BA0", &entry)) { | 1226 | if (! snd_card_proc_new(chip->card, "mixart_BA0", &entry)) { |
1229 | entry->content = SNDRV_INFO_CONTENT_DATA; | 1227 | entry->content = SNDRV_INFO_CONTENT_DATA; |
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index b97f4ea6b56c..85e46ff44ac3 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c | |||
@@ -1413,7 +1413,6 @@ static int nm256_suspend(struct device *dev) | |||
1413 | struct nm256 *chip = card->private_data; | 1413 | struct nm256 *chip = card->private_data; |
1414 | 1414 | ||
1415 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1415 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1416 | snd_pcm_suspend_all(chip->pcm); | ||
1417 | snd_ac97_suspend(chip->ac97); | 1416 | snd_ac97_suspend(chip->ac97); |
1418 | chip->coeffs_current = 0; | 1417 | chip->coeffs_current = 0; |
1419 | return 0; | 1418 | return 0; |
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index b4ef5804212d..3ae9dd4b39e8 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c | |||
@@ -244,10 +244,7 @@ static void oxygen_proc_read(struct snd_info_entry *entry, | |||
244 | 244 | ||
245 | static void oxygen_proc_init(struct oxygen *chip) | 245 | static void oxygen_proc_init(struct oxygen *chip) |
246 | { | 246 | { |
247 | struct snd_info_entry *entry; | 247 | snd_card_ro_proc_new(chip->card, "oxygen", chip, oxygen_proc_read); |
248 | |||
249 | if (!snd_card_proc_new(chip->card, "oxygen", &entry)) | ||
250 | snd_info_set_text_ops(entry, chip, oxygen_proc_read); | ||
251 | } | 248 | } |
252 | 249 | ||
253 | static const struct pci_device_id * | 250 | static const struct pci_device_id * |
@@ -373,7 +370,7 @@ static void oxygen_init(struct oxygen *chip) | |||
373 | for (i = 0; i < 8; ++i) | 370 | for (i = 0; i < 8; ++i) |
374 | chip->dac_volume[i] = chip->model.dac_volume_min; | 371 | chip->dac_volume[i] = chip->model.dac_volume_min; |
375 | chip->dac_mute = 1; | 372 | chip->dac_mute = 1; |
376 | chip->spdif_playback_enable = 1; | 373 | chip->spdif_playback_enable = 0; |
377 | chip->spdif_bits = OXYGEN_SPDIF_C | OXYGEN_SPDIF_ORIGINAL | | 374 | chip->spdif_bits = OXYGEN_SPDIF_C | OXYGEN_SPDIF_ORIGINAL | |
378 | (IEC958_AES1_CON_PCM_CODER << OXYGEN_SPDIF_CATEGORY_SHIFT); | 375 | (IEC958_AES1_CON_PCM_CODER << OXYGEN_SPDIF_CATEGORY_SHIFT); |
379 | chip->spdif_pcm_bits = chip->spdif_bits; | 376 | chip->spdif_pcm_bits = chip->spdif_bits; |
@@ -744,13 +741,10 @@ static int oxygen_pci_suspend(struct device *dev) | |||
744 | { | 741 | { |
745 | struct snd_card *card = dev_get_drvdata(dev); | 742 | struct snd_card *card = dev_get_drvdata(dev); |
746 | struct oxygen *chip = card->private_data; | 743 | struct oxygen *chip = card->private_data; |
747 | unsigned int i, saved_interrupt_mask; | 744 | unsigned int saved_interrupt_mask; |
748 | 745 | ||
749 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 746 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
750 | 747 | ||
751 | for (i = 0; i < PCM_COUNT; ++i) | ||
752 | snd_pcm_suspend(chip->streams[i]); | ||
753 | |||
754 | if (chip->model.suspend) | 748 | if (chip->model.suspend) |
755 | chip->model.suspend(chip); | 749 | chip->model.suspend(chip); |
756 | 750 | ||
diff --git a/sound/pci/oxygen/pcm1796.h b/sound/pci/oxygen/pcm1796.h index 34d07dd2d22e..d5dcb09e44cd 100644 --- a/sound/pci/oxygen/pcm1796.h +++ b/sound/pci/oxygen/pcm1796.h | |||
@@ -10,7 +10,6 @@ | |||
10 | #define PCM1796_MUTE 0x01 | 10 | #define PCM1796_MUTE 0x01 |
11 | #define PCM1796_DME 0x02 | 11 | #define PCM1796_DME 0x02 |
12 | #define PCM1796_DMF_MASK 0x0c | 12 | #define PCM1796_DMF_MASK 0x0c |
13 | #define PCM1796_DMF_DISABLED 0x00 | ||
14 | #define PCM1796_DMF_48 0x04 | 13 | #define PCM1796_DMF_48 0x04 |
15 | #define PCM1796_DMF_441 0x08 | 14 | #define PCM1796_DMF_441 0x08 |
16 | #define PCM1796_DMF_32 0x0c | 15 | #define PCM1796_DMF_32 0x0c |
diff --git a/sound/pci/oxygen/xonar_pcm179x.c b/sound/pci/oxygen/xonar_pcm179x.c index 24109d37ca09..a1c6b98b191e 100644 --- a/sound/pci/oxygen/xonar_pcm179x.c +++ b/sound/pci/oxygen/xonar_pcm179x.c | |||
@@ -331,7 +331,7 @@ static void pcm1796_init(struct oxygen *chip) | |||
331 | struct xonar_pcm179x *data = chip->model_data; | 331 | struct xonar_pcm179x *data = chip->model_data; |
332 | 332 | ||
333 | data->pcm1796_regs[0][18 - PCM1796_REG_BASE] = | 333 | data->pcm1796_regs[0][18 - PCM1796_REG_BASE] = |
334 | PCM1796_DMF_DISABLED | PCM1796_FMT_24_I2S | PCM1796_ATLD; | 334 | PCM1796_FMT_24_I2S | PCM1796_ATLD; |
335 | if (!data->broken_i2c) | 335 | if (!data->broken_i2c) |
336 | data->pcm1796_regs[0][18 - PCM1796_REG_BASE] |= PCM1796_MUTE; | 336 | data->pcm1796_regs[0][18 - PCM1796_REG_BASE] |= PCM1796_MUTE; |
337 | data->pcm1796_regs[0][19 - PCM1796_REG_BASE] = | 337 | data->pcm1796_regs[0][19 - PCM1796_REG_BASE] = |
@@ -621,6 +621,23 @@ static void update_pcm1796_oversampling(struct oxygen *chip) | |||
621 | pcm1796_write_cached(chip, i, 20, reg); | 621 | pcm1796_write_cached(chip, i, 20, reg); |
622 | } | 622 | } |
623 | 623 | ||
624 | static void update_pcm1796_deemph(struct oxygen *chip) | ||
625 | { | ||
626 | struct xonar_pcm179x *data = chip->model_data; | ||
627 | unsigned int i; | ||
628 | u8 reg; | ||
629 | |||
630 | reg = data->pcm1796_regs[0][18 - PCM1796_REG_BASE] & ~PCM1796_DMF_MASK; | ||
631 | if (data->current_rate == 48000) | ||
632 | reg |= PCM1796_DMF_48; | ||
633 | else if (data->current_rate == 44100) | ||
634 | reg |= PCM1796_DMF_441; | ||
635 | else if (data->current_rate == 32000) | ||
636 | reg |= PCM1796_DMF_32; | ||
637 | for (i = 0; i < data->dacs; ++i) | ||
638 | pcm1796_write_cached(chip, i, 18, reg); | ||
639 | } | ||
640 | |||
624 | static void set_pcm1796_params(struct oxygen *chip, | 641 | static void set_pcm1796_params(struct oxygen *chip, |
625 | struct snd_pcm_hw_params *params) | 642 | struct snd_pcm_hw_params *params) |
626 | { | 643 | { |
@@ -629,6 +646,7 @@ static void set_pcm1796_params(struct oxygen *chip, | |||
629 | msleep(1); | 646 | msleep(1); |
630 | data->current_rate = params_rate(params); | 647 | data->current_rate = params_rate(params); |
631 | update_pcm1796_oversampling(chip); | 648 | update_pcm1796_oversampling(chip); |
649 | update_pcm1796_deemph(chip); | ||
632 | } | 650 | } |
633 | 651 | ||
634 | static void update_pcm1796_volume(struct oxygen *chip) | 652 | static void update_pcm1796_volume(struct oxygen *chip) |
@@ -653,9 +671,11 @@ static void update_pcm1796_mute(struct oxygen *chip) | |||
653 | unsigned int i; | 671 | unsigned int i; |
654 | u8 value; | 672 | u8 value; |
655 | 673 | ||
656 | value = PCM1796_DMF_DISABLED | PCM1796_FMT_24_I2S | PCM1796_ATLD; | 674 | value = data->pcm1796_regs[0][18 - PCM1796_REG_BASE]; |
657 | if (chip->dac_mute) | 675 | if (chip->dac_mute) |
658 | value |= PCM1796_MUTE; | 676 | value |= PCM1796_MUTE; |
677 | else | ||
678 | value &= ~PCM1796_MUTE; | ||
659 | for (i = 0; i < data->dacs; ++i) | 679 | for (i = 0; i < data->dacs; ++i) |
660 | pcm1796_write_cached(chip, i, 18, value); | 680 | pcm1796_write_cached(chip, i, 18, value); |
661 | } | 681 | } |
@@ -777,6 +797,49 @@ static const struct snd_kcontrol_new rolloff_control = { | |||
777 | .put = rolloff_put, | 797 | .put = rolloff_put, |
778 | }; | 798 | }; |
779 | 799 | ||
800 | static int deemph_get(struct snd_kcontrol *ctl, | ||
801 | struct snd_ctl_elem_value *value) | ||
802 | { | ||
803 | struct oxygen *chip = ctl->private_data; | ||
804 | struct xonar_pcm179x *data = chip->model_data; | ||
805 | |||
806 | value->value.integer.value[0] = | ||
807 | !!(data->pcm1796_regs[0][18 - PCM1796_REG_BASE] & PCM1796_DME); | ||
808 | return 0; | ||
809 | } | ||
810 | |||
811 | static int deemph_put(struct snd_kcontrol *ctl, | ||
812 | struct snd_ctl_elem_value *value) | ||
813 | { | ||
814 | struct oxygen *chip = ctl->private_data; | ||
815 | struct xonar_pcm179x *data = chip->model_data; | ||
816 | unsigned int i; | ||
817 | int changed; | ||
818 | u8 reg; | ||
819 | |||
820 | mutex_lock(&chip->mutex); | ||
821 | reg = data->pcm1796_regs[0][18 - PCM1796_REG_BASE]; | ||
822 | if (!value->value.integer.value[0]) | ||
823 | reg &= ~PCM1796_DME; | ||
824 | else | ||
825 | reg |= PCM1796_DME; | ||
826 | changed = reg != data->pcm1796_regs[0][18 - PCM1796_REG_BASE]; | ||
827 | if (changed) { | ||
828 | for (i = 0; i < data->dacs; ++i) | ||
829 | pcm1796_write(chip, i, 18, reg); | ||
830 | } | ||
831 | mutex_unlock(&chip->mutex); | ||
832 | return changed; | ||
833 | } | ||
834 | |||
835 | static const struct snd_kcontrol_new deemph_control = { | ||
836 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
837 | .name = "De-emphasis Playback Switch", | ||
838 | .info = snd_ctl_boolean_mono_info, | ||
839 | .get = deemph_get, | ||
840 | .put = deemph_put, | ||
841 | }; | ||
842 | |||
780 | static const struct snd_kcontrol_new hdav_hdmi_control = { | 843 | static const struct snd_kcontrol_new hdav_hdmi_control = { |
781 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 844 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
782 | .name = "HDMI Playback Switch", | 845 | .name = "HDMI Playback Switch", |
@@ -1011,6 +1074,10 @@ static int add_pcm1796_controls(struct oxygen *chip) | |||
1011 | snd_ctl_new1(&rolloff_control, chip)); | 1074 | snd_ctl_new1(&rolloff_control, chip)); |
1012 | if (err < 0) | 1075 | if (err < 0) |
1013 | return err; | 1076 | return err; |
1077 | err = snd_ctl_add(chip->card, | ||
1078 | snd_ctl_new1(&deemph_control, chip)); | ||
1079 | if (err < 0) | ||
1080 | return err; | ||
1014 | } | 1081 | } |
1015 | return 0; | 1082 | return 0; |
1016 | } | 1083 | } |
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index e57da4036231..4ab7efc6e9f7 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c | |||
@@ -1454,21 +1454,14 @@ static void pcxhr_proc_ltc(struct snd_info_entry *entry, | |||
1454 | 1454 | ||
1455 | static void pcxhr_proc_init(struct snd_pcxhr *chip) | 1455 | static void pcxhr_proc_init(struct snd_pcxhr *chip) |
1456 | { | 1456 | { |
1457 | struct snd_info_entry *entry; | 1457 | snd_card_ro_proc_new(chip->card, "info", chip, pcxhr_proc_info); |
1458 | 1458 | snd_card_ro_proc_new(chip->card, "sync", chip, pcxhr_proc_sync); | |
1459 | if (! snd_card_proc_new(chip->card, "info", &entry)) | ||
1460 | snd_info_set_text_ops(entry, chip, pcxhr_proc_info); | ||
1461 | if (! snd_card_proc_new(chip->card, "sync", &entry)) | ||
1462 | snd_info_set_text_ops(entry, chip, pcxhr_proc_sync); | ||
1463 | /* gpio available on stereo sound cards only */ | 1459 | /* gpio available on stereo sound cards only */ |
1464 | if (chip->mgr->is_hr_stereo && | 1460 | if (chip->mgr->is_hr_stereo) |
1465 | !snd_card_proc_new(chip->card, "gpio", &entry)) { | 1461 | snd_card_rw_proc_new(chip->card, "gpio", chip, |
1466 | snd_info_set_text_ops(entry, chip, pcxhr_proc_gpio_read); | 1462 | pcxhr_proc_gpio_read, |
1467 | entry->c.text.write = pcxhr_proc_gpo_write; | 1463 | pcxhr_proc_gpo_write); |
1468 | entry->mode |= 0200; | 1464 | snd_card_ro_proc_new(chip->card, "ltc", chip, pcxhr_proc_ltc); |
1469 | } | ||
1470 | if (!snd_card_proc_new(chip->card, "ltc", &entry)) | ||
1471 | snd_info_set_text_ops(entry, chip, pcxhr_proc_ltc); | ||
1472 | } | 1465 | } |
1473 | /* end of proc interface */ | 1466 | /* end of proc interface */ |
1474 | 1467 | ||
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 23017e3bc76c..8d1a56a9bcfd 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -1158,7 +1158,6 @@ static int riptide_suspend(struct device *dev) | |||
1158 | 1158 | ||
1159 | chip->in_suspend = 1; | 1159 | chip->in_suspend = 1; |
1160 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1160 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1161 | snd_pcm_suspend_all(chip->pcm); | ||
1162 | snd_ac97_suspend(chip->ac97); | 1161 | snd_ac97_suspend(chip->ac97); |
1163 | return 0; | 1162 | return 0; |
1164 | } | 1163 | } |
@@ -1974,10 +1973,8 @@ snd_riptide_proc_read(struct snd_info_entry *entry, | |||
1974 | 1973 | ||
1975 | static void snd_riptide_proc_init(struct snd_riptide *chip) | 1974 | static void snd_riptide_proc_init(struct snd_riptide *chip) |
1976 | { | 1975 | { |
1977 | struct snd_info_entry *entry; | 1976 | snd_card_ro_proc_new(chip->card, "riptide", chip, |
1978 | 1977 | snd_riptide_proc_read); | |
1979 | if (!snd_card_proc_new(chip->card, "riptide", &entry)) | ||
1980 | snd_info_set_text_ops(entry, chip, snd_riptide_proc_read); | ||
1981 | } | 1978 | } |
1982 | 1979 | ||
1983 | static int snd_riptide_mixer(struct snd_riptide *chip) | 1980 | static int snd_riptide_mixer(struct snd_riptide *chip) |
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index 3ac8c71d567c..c6bcc0715716 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c | |||
@@ -1568,10 +1568,7 @@ snd_rme32_proc_read(struct snd_info_entry * entry, struct snd_info_buffer *buffe | |||
1568 | 1568 | ||
1569 | static void snd_rme32_proc_init(struct rme32 *rme32) | 1569 | static void snd_rme32_proc_init(struct rme32 *rme32) |
1570 | { | 1570 | { |
1571 | struct snd_info_entry *entry; | 1571 | snd_card_ro_proc_new(rme32->card, "rme32", rme32, snd_rme32_proc_read); |
1572 | |||
1573 | if (! snd_card_proc_new(rme32->card, "rme32", &entry)) | ||
1574 | snd_info_set_text_ops(entry, rme32, snd_rme32_proc_read); | ||
1575 | } | 1572 | } |
1576 | 1573 | ||
1577 | /* | 1574 | /* |
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index dcfa4d7a73e2..42c6b5e09072 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c | |||
@@ -1868,10 +1868,7 @@ snd_rme96_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer | |||
1868 | 1868 | ||
1869 | static void snd_rme96_proc_init(struct rme96 *rme96) | 1869 | static void snd_rme96_proc_init(struct rme96 *rme96) |
1870 | { | 1870 | { |
1871 | struct snd_info_entry *entry; | 1871 | snd_card_ro_proc_new(rme96->card, "rme96", rme96, snd_rme96_proc_read); |
1872 | |||
1873 | if (! snd_card_proc_new(rme96->card, "rme96", &entry)) | ||
1874 | snd_info_set_text_ops(entry, rme96, snd_rme96_proc_read); | ||
1875 | } | 1872 | } |
1876 | 1873 | ||
1877 | /* | 1874 | /* |
@@ -2388,8 +2385,6 @@ static int rme96_suspend(struct device *dev) | |||
2388 | struct rme96 *rme96 = card->private_data; | 2385 | struct rme96 *rme96 = card->private_data; |
2389 | 2386 | ||
2390 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2387 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2391 | snd_pcm_suspend(rme96->playback_substream); | ||
2392 | snd_pcm_suspend(rme96->capture_substream); | ||
2393 | 2388 | ||
2394 | /* save capture & playback pointers */ | 2389 | /* save capture & playback pointers */ |
2395 | rme96->playback_pointer = readl(rme96->iobase + RME96_IO_GET_PLAY_POS) | 2390 | rme96->playback_pointer = readl(rme96->iobase + RME96_IO_GET_PLAY_POS) |
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index ba99ff0e93e0..29bef48a3af3 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -3708,10 +3708,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | |||
3708 | 3708 | ||
3709 | static void snd_hdsp_proc_init(struct hdsp *hdsp) | 3709 | static void snd_hdsp_proc_init(struct hdsp *hdsp) |
3710 | { | 3710 | { |
3711 | struct snd_info_entry *entry; | 3711 | snd_card_ro_proc_new(hdsp->card, "hdsp", hdsp, snd_hdsp_proc_read); |
3712 | |||
3713 | if (! snd_card_proc_new(hdsp->card, "hdsp", &entry)) | ||
3714 | snd_info_set_text_ops(entry, hdsp, snd_hdsp_proc_read); | ||
3715 | } | 3712 | } |
3716 | 3713 | ||
3717 | static void snd_hdsp_free_buffers(struct hdsp *hdsp) | 3714 | static void snd_hdsp_free_buffers(struct hdsp *hdsp) |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 679ad0415e3b..1209cf0b05e0 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -5287,44 +5287,35 @@ static void snd_hdspm_proc_ports_out(struct snd_info_entry *entry, | |||
5287 | 5287 | ||
5288 | static void snd_hdspm_proc_init(struct hdspm *hdspm) | 5288 | static void snd_hdspm_proc_init(struct hdspm *hdspm) |
5289 | { | 5289 | { |
5290 | struct snd_info_entry *entry; | 5290 | void (*read)(struct snd_info_entry *, struct snd_info_buffer *) = NULL; |
5291 | 5291 | ||
5292 | if (!snd_card_proc_new(hdspm->card, "hdspm", &entry)) { | 5292 | switch (hdspm->io_type) { |
5293 | switch (hdspm->io_type) { | 5293 | case AES32: |
5294 | case AES32: | 5294 | read = snd_hdspm_proc_read_aes32; |
5295 | snd_info_set_text_ops(entry, hdspm, | 5295 | break; |
5296 | snd_hdspm_proc_read_aes32); | 5296 | case MADI: |
5297 | break; | 5297 | read = snd_hdspm_proc_read_madi; |
5298 | case MADI: | 5298 | break; |
5299 | snd_info_set_text_ops(entry, hdspm, | 5299 | case MADIface: |
5300 | snd_hdspm_proc_read_madi); | 5300 | /* read = snd_hdspm_proc_read_madiface; */ |
5301 | break; | 5301 | break; |
5302 | case MADIface: | 5302 | case RayDAT: |
5303 | /* snd_info_set_text_ops(entry, hdspm, | 5303 | read = snd_hdspm_proc_read_raydat; |
5304 | snd_hdspm_proc_read_madiface); */ | 5304 | break; |
5305 | break; | 5305 | case AIO: |
5306 | case RayDAT: | 5306 | break; |
5307 | snd_info_set_text_ops(entry, hdspm, | ||
5308 | snd_hdspm_proc_read_raydat); | ||
5309 | break; | ||
5310 | case AIO: | ||
5311 | break; | ||
5312 | } | ||
5313 | } | ||
5314 | |||
5315 | if (!snd_card_proc_new(hdspm->card, "ports.in", &entry)) { | ||
5316 | snd_info_set_text_ops(entry, hdspm, snd_hdspm_proc_ports_in); | ||
5317 | } | 5307 | } |
5318 | 5308 | ||
5319 | if (!snd_card_proc_new(hdspm->card, "ports.out", &entry)) { | 5309 | snd_card_ro_proc_new(hdspm->card, "hdspm", hdspm, read); |
5320 | snd_info_set_text_ops(entry, hdspm, snd_hdspm_proc_ports_out); | 5310 | snd_card_ro_proc_new(hdspm->card, "ports.in", hdspm, |
5321 | } | 5311 | snd_hdspm_proc_ports_in); |
5312 | snd_card_ro_proc_new(hdspm->card, "ports.out", hdspm, | ||
5313 | snd_hdspm_proc_ports_out); | ||
5322 | 5314 | ||
5323 | #ifdef CONFIG_SND_DEBUG | 5315 | #ifdef CONFIG_SND_DEBUG |
5324 | /* debug file to read all hdspm registers */ | 5316 | /* debug file to read all hdspm registers */ |
5325 | if (!snd_card_proc_new(hdspm->card, "debug", &entry)) | 5317 | snd_card_ro_proc_new(hdspm->card, "debug", hdspm, |
5326 | snd_info_set_text_ops(entry, hdspm, | 5318 | snd_hdspm_proc_read_debug); |
5327 | snd_hdspm_proc_read_debug); | ||
5328 | #endif | 5319 | #endif |
5329 | } | 5320 | } |
5330 | 5321 | ||
@@ -6411,7 +6402,6 @@ static int snd_hdspm_create_hwdep(struct snd_card *card, | |||
6411 | ------------------------------------------------------------*/ | 6402 | ------------------------------------------------------------*/ |
6412 | static int snd_hdspm_preallocate_memory(struct hdspm *hdspm) | 6403 | static int snd_hdspm_preallocate_memory(struct hdspm *hdspm) |
6413 | { | 6404 | { |
6414 | int err; | ||
6415 | struct snd_pcm *pcm; | 6405 | struct snd_pcm *pcm; |
6416 | size_t wanted; | 6406 | size_t wanted; |
6417 | 6407 | ||
@@ -6419,21 +6409,10 @@ static int snd_hdspm_preallocate_memory(struct hdspm *hdspm) | |||
6419 | 6409 | ||
6420 | wanted = HDSPM_DMA_AREA_BYTES; | 6410 | wanted = HDSPM_DMA_AREA_BYTES; |
6421 | 6411 | ||
6422 | err = | 6412 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
6423 | snd_pcm_lib_preallocate_pages_for_all(pcm, | 6413 | snd_dma_pci_data(hdspm->pci), |
6424 | SNDRV_DMA_TYPE_DEV_SG, | 6414 | wanted, wanted); |
6425 | snd_dma_pci_data(hdspm->pci), | 6415 | dev_dbg(hdspm->card->dev, " Preallocated %zd Bytes\n", wanted); |
6426 | wanted, | ||
6427 | wanted); | ||
6428 | if (err < 0) { | ||
6429 | dev_dbg(hdspm->card->dev, | ||
6430 | "Could not preallocate %zd Bytes\n", wanted); | ||
6431 | |||
6432 | return err; | ||
6433 | } else | ||
6434 | dev_dbg(hdspm->card->dev, | ||
6435 | " Preallocated %zd Bytes\n", wanted); | ||
6436 | |||
6437 | return 0; | 6416 | return 0; |
6438 | } | 6417 | } |
6439 | 6418 | ||
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index edd765e22377..5228b982da5a 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c | |||
@@ -1737,10 +1737,8 @@ snd_rme9652_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buff | |||
1737 | 1737 | ||
1738 | static void snd_rme9652_proc_init(struct snd_rme9652 *rme9652) | 1738 | static void snd_rme9652_proc_init(struct snd_rme9652 *rme9652) |
1739 | { | 1739 | { |
1740 | struct snd_info_entry *entry; | 1740 | snd_card_ro_proc_new(rme9652->card, "rme9652", rme9652, |
1741 | 1741 | snd_rme9652_proc_read); | |
1742 | if (! snd_card_proc_new(rme9652->card, "rme9652", &entry)) | ||
1743 | snd_info_set_text_ops(entry, rme9652, snd_rme9652_proc_read); | ||
1744 | } | 1742 | } |
1745 | 1743 | ||
1746 | static void snd_rme9652_free_buffers(struct snd_rme9652 *rme9652) | 1744 | static void snd_rme9652_free_buffers(struct snd_rme9652 *rme9652) |
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index 964acf302479..6b27980d77a8 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c | |||
@@ -1214,7 +1214,6 @@ static int sis_suspend(struct device *dev) | |||
1214 | int i; | 1214 | int i; |
1215 | 1215 | ||
1216 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1216 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1217 | snd_pcm_suspend_all(sis->pcm); | ||
1218 | if (sis->codecs_present & SIS_PRIMARY_CODEC_PRESENT) | 1217 | if (sis->codecs_present & SIS_PRIMARY_CODEC_PRESENT) |
1219 | snd_ac97_suspend(sis->ac97[0]); | 1218 | snd_ac97_suspend(sis->ac97[0]); |
1220 | if (sis->codecs_present & SIS_SECONDARY_CODEC_PRESENT) | 1219 | if (sis->codecs_present & SIS_SECONDARY_CODEC_PRESENT) |
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index 7218f38b59db..71d5ad3cffd6 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c | |||
@@ -1171,10 +1171,8 @@ static void snd_sonicvibes_proc_read(struct snd_info_entry *entry, | |||
1171 | 1171 | ||
1172 | static void snd_sonicvibes_proc_init(struct sonicvibes *sonic) | 1172 | static void snd_sonicvibes_proc_init(struct sonicvibes *sonic) |
1173 | { | 1173 | { |
1174 | struct snd_info_entry *entry; | 1174 | snd_card_ro_proc_new(sonic->card, "sonicvibes", sonic, |
1175 | 1175 | snd_sonicvibes_proc_read); | |
1176 | if (! snd_card_proc_new(sonic->card, "sonicvibes", &entry)) | ||
1177 | snd_info_set_text_ops(entry, sonic, snd_sonicvibes_proc_read); | ||
1178 | } | 1176 | } |
1179 | 1177 | ||
1180 | /* | 1178 | /* |
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index 5523e193d556..0ff32d3f5d3b 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c | |||
@@ -3320,13 +3320,11 @@ static void snd_trident_proc_read(struct snd_info_entry *entry, | |||
3320 | 3320 | ||
3321 | static void snd_trident_proc_init(struct snd_trident *trident) | 3321 | static void snd_trident_proc_init(struct snd_trident *trident) |
3322 | { | 3322 | { |
3323 | struct snd_info_entry *entry; | ||
3324 | const char *s = "trident"; | 3323 | const char *s = "trident"; |
3325 | 3324 | ||
3326 | if (trident->device == TRIDENT_DEVICE_ID_SI7018) | 3325 | if (trident->device == TRIDENT_DEVICE_ID_SI7018) |
3327 | s = "sis7018"; | 3326 | s = "sis7018"; |
3328 | if (! snd_card_proc_new(trident->card, s, &entry)) | 3327 | snd_card_ro_proc_new(trident->card, s, trident, snd_trident_proc_read); |
3329 | snd_info_set_text_ops(entry, trident, snd_trident_proc_read); | ||
3330 | } | 3328 | } |
3331 | 3329 | ||
3332 | static int snd_trident_dev_free(struct snd_device *device) | 3330 | static int snd_trident_dev_free(struct snd_device *device) |
@@ -3915,10 +3913,6 @@ static int snd_trident_suspend(struct device *dev) | |||
3915 | 3913 | ||
3916 | trident->in_suspend = 1; | 3914 | trident->in_suspend = 1; |
3917 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 3915 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
3918 | snd_pcm_suspend_all(trident->pcm); | ||
3919 | snd_pcm_suspend_all(trident->foldback); | ||
3920 | snd_pcm_suspend_all(trident->spdif); | ||
3921 | |||
3922 | snd_ac97_suspend(trident->ac97); | 3916 | snd_ac97_suspend(trident->ac97); |
3923 | snd_ac97_suspend(trident->ac97_sec); | 3917 | snd_ac97_suspend(trident->ac97_sec); |
3924 | return 0; | 3918 | return 0; |
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index c488c5afa195..dee1c487d6ba 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c | |||
@@ -2144,10 +2144,8 @@ static void snd_via82xx_proc_read(struct snd_info_entry *entry, | |||
2144 | 2144 | ||
2145 | static void snd_via82xx_proc_init(struct via82xx *chip) | 2145 | static void snd_via82xx_proc_init(struct via82xx *chip) |
2146 | { | 2146 | { |
2147 | struct snd_info_entry *entry; | 2147 | snd_card_ro_proc_new(chip->card, "via82xx", chip, |
2148 | 2148 | snd_via82xx_proc_read); | |
2149 | if (! snd_card_proc_new(chip->card, "via82xx", &entry)) | ||
2150 | snd_info_set_text_ops(entry, chip, snd_via82xx_proc_read); | ||
2151 | } | 2149 | } |
2152 | 2150 | ||
2153 | /* | 2151 | /* |
@@ -2278,8 +2276,6 @@ static int snd_via82xx_suspend(struct device *dev) | |||
2278 | int i; | 2276 | int i; |
2279 | 2277 | ||
2280 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2278 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2281 | for (i = 0; i < 2; i++) | ||
2282 | snd_pcm_suspend_all(chip->pcms[i]); | ||
2283 | for (i = 0; i < chip->num_devs; i++) | 2279 | for (i = 0; i < chip->num_devs; i++) |
2284 | snd_via82xx_channel_reset(chip, &chip->devs[i]); | 2280 | snd_via82xx_channel_reset(chip, &chip->devs[i]); |
2285 | synchronize_irq(chip->irq); | 2281 | synchronize_irq(chip->irq); |
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index b13c8688cc8d..7e0bebce7b77 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c | |||
@@ -865,11 +865,9 @@ static int snd_via686_pcm_new(struct via82xx_modem *chip) | |||
865 | init_viadev(chip, 0, VIA_REG_MO_STATUS, 0); | 865 | init_viadev(chip, 0, VIA_REG_MO_STATUS, 0); |
866 | init_viadev(chip, 1, VIA_REG_MI_STATUS, 1); | 866 | init_viadev(chip, 1, VIA_REG_MI_STATUS, 1); |
867 | 867 | ||
868 | if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 868 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
869 | snd_dma_pci_data(chip->pci), | 869 | snd_dma_pci_data(chip->pci), |
870 | 64*1024, 128*1024)) < 0) | 870 | 64*1024, 128*1024); |
871 | return err; | ||
872 | |||
873 | return 0; | 871 | return 0; |
874 | } | 872 | } |
875 | 873 | ||
@@ -937,10 +935,8 @@ static void snd_via82xx_proc_read(struct snd_info_entry *entry, struct snd_info_ | |||
937 | 935 | ||
938 | static void snd_via82xx_proc_init(struct via82xx_modem *chip) | 936 | static void snd_via82xx_proc_init(struct via82xx_modem *chip) |
939 | { | 937 | { |
940 | struct snd_info_entry *entry; | 938 | snd_card_ro_proc_new(chip->card, "via82xx", chip, |
941 | 939 | snd_via82xx_proc_read); | |
942 | if (! snd_card_proc_new(chip->card, "via82xx", &entry)) | ||
943 | snd_info_set_text_ops(entry, chip, snd_via82xx_proc_read); | ||
944 | } | 940 | } |
945 | 941 | ||
946 | /* | 942 | /* |
@@ -1038,8 +1034,6 @@ static int snd_via82xx_suspend(struct device *dev) | |||
1038 | int i; | 1034 | int i; |
1039 | 1035 | ||
1040 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1036 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1041 | for (i = 0; i < 2; i++) | ||
1042 | snd_pcm_suspend_all(chip->pcms[i]); | ||
1043 | for (i = 0; i < chip->num_devs; i++) | 1037 | for (i = 0; i < chip->num_devs; i++) |
1044 | snd_via82xx_channel_reset(chip, &chip->devs[i]); | 1038 | snd_via82xx_channel_reset(chip, &chip->devs[i]); |
1045 | synchronize_irq(chip->irq); | 1039 | synchronize_irq(chip->irq); |
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index a4926fb03991..4d48877f211f 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c | |||
@@ -1985,11 +1985,7 @@ static void snd_ymfpci_proc_read(struct snd_info_entry *entry, | |||
1985 | 1985 | ||
1986 | static int snd_ymfpci_proc_init(struct snd_card *card, struct snd_ymfpci *chip) | 1986 | static int snd_ymfpci_proc_init(struct snd_card *card, struct snd_ymfpci *chip) |
1987 | { | 1987 | { |
1988 | struct snd_info_entry *entry; | 1988 | return snd_card_ro_proc_new(card, "ymfpci", chip, snd_ymfpci_proc_read); |
1989 | |||
1990 | if (! snd_card_proc_new(card, "ymfpci", &entry)) | ||
1991 | snd_info_set_text_ops(entry, chip, snd_ymfpci_proc_read); | ||
1992 | return 0; | ||
1993 | } | 1989 | } |
1994 | 1990 | ||
1995 | /* | 1991 | /* |
@@ -2304,10 +2300,6 @@ static int snd_ymfpci_suspend(struct device *dev) | |||
2304 | unsigned int i; | 2300 | unsigned int i; |
2305 | 2301 | ||
2306 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2302 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2307 | snd_pcm_suspend_all(chip->pcm); | ||
2308 | snd_pcm_suspend_all(chip->pcm2); | ||
2309 | snd_pcm_suspend_all(chip->pcm_spdif); | ||
2310 | snd_pcm_suspend_all(chip->pcm_4ch); | ||
2311 | snd_ac97_suspend(chip->ac97); | 2303 | snd_ac97_suspend(chip->ac97); |
2312 | for (i = 0; i < YDSXGR_NUM_SAVED_REGS; i++) | 2304 | for (i = 0; i < YDSXGR_NUM_SAVED_REGS; i++) |
2313 | chip->saved_regs[i] = snd_ymfpci_readl(chip, saved_regs_index[i]); | 2305 | chip->saved_regs[i] = snd_ymfpci_readl(chip, saved_regs_index[i]); |
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c index d724ab0653cf..910478275fd9 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c | |||
@@ -148,10 +148,7 @@ static void pdacf_proc_read(struct snd_info_entry * entry, | |||
148 | 148 | ||
149 | static void pdacf_proc_init(struct snd_pdacf *chip) | 149 | static void pdacf_proc_init(struct snd_pdacf *chip) |
150 | { | 150 | { |
151 | struct snd_info_entry *entry; | 151 | snd_card_ro_proc_new(chip->card, "pdaudiocf", chip, pdacf_proc_read); |
152 | |||
153 | if (! snd_card_proc_new(chip->card, "pdaudiocf", &entry)) | ||
154 | snd_info_set_text_ops(entry, chip, pdacf_proc_read); | ||
155 | } | 152 | } |
156 | 153 | ||
157 | struct snd_pdacf *snd_pdacf_create(struct snd_card *card) | 154 | struct snd_pdacf *snd_pdacf_create(struct snd_card *card) |
@@ -265,7 +262,6 @@ int snd_pdacf_suspend(struct snd_pdacf *chip) | |||
265 | u16 val; | 262 | u16 val; |
266 | 263 | ||
267 | snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); | 264 | snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); |
268 | snd_pcm_suspend_all(chip->pcm); | ||
269 | /* disable interrupts, but use direct write to preserve old register value in chip->regmap */ | 265 | /* disable interrupts, but use direct write to preserve old register value in chip->regmap */ |
270 | val = inw(chip->port + PDAUDIOCF_REG_IER); | 266 | val = inw(chip->port + PDAUDIOCF_REG_IER); |
271 | val &= ~(PDAUDIOCF_IRQOVREN|PDAUDIOCF_IRQAKMEN|PDAUDIOCF_IRQLVLEN0|PDAUDIOCF_IRQLVLEN1); | 267 | val &= ~(PDAUDIOCF_IRQOVREN|PDAUDIOCF_IRQAKMEN|PDAUDIOCF_IRQLVLEN0|PDAUDIOCF_IRQLVLEN1); |
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index d692e4070167..6d420bd3ae17 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c | |||
@@ -1365,7 +1365,6 @@ void snd_pmac_suspend(struct snd_pmac *chip) | |||
1365 | snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); | 1365 | snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); |
1366 | if (chip->suspend) | 1366 | if (chip->suspend) |
1367 | chip->suspend(chip); | 1367 | chip->suspend(chip); |
1368 | snd_pcm_suspend_all(chip->pcm); | ||
1369 | spin_lock_irqsave(&chip->reg_lock, flags); | 1368 | spin_lock_irqsave(&chip->reg_lock, flags); |
1370 | snd_pmac_beep_stop(chip); | 1369 | snd_pmac_beep_stop(chip); |
1371 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1370 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c index abe031c9d592..521236efcc4d 100644 --- a/sound/ppc/snd_ps3.c +++ b/sound/ppc/snd_ps3.c | |||
@@ -1024,15 +1024,11 @@ static int snd_ps3_driver_probe(struct ps3_system_bus_device *dev) | |||
1024 | 1024 | ||
1025 | the_card.pcm->info_flags = SNDRV_PCM_INFO_NONINTERLEAVED; | 1025 | the_card.pcm->info_flags = SNDRV_PCM_INFO_NONINTERLEAVED; |
1026 | /* pre-alloc PCM DMA buffer*/ | 1026 | /* pre-alloc PCM DMA buffer*/ |
1027 | ret = snd_pcm_lib_preallocate_pages_for_all(the_card.pcm, | 1027 | snd_pcm_lib_preallocate_pages_for_all(the_card.pcm, |
1028 | SNDRV_DMA_TYPE_DEV, | 1028 | SNDRV_DMA_TYPE_DEV, |
1029 | &dev->core, | 1029 | &dev->core, |
1030 | SND_PS3_PCM_PREALLOC_SIZE, | 1030 | SND_PS3_PCM_PREALLOC_SIZE, |
1031 | SND_PS3_PCM_PREALLOC_SIZE); | 1031 | SND_PS3_PCM_PREALLOC_SIZE); |
1032 | if (ret < 0) { | ||
1033 | pr_info("%s: prealloc failed\n", __func__); | ||
1034 | goto clean_card; | ||
1035 | } | ||
1036 | 1032 | ||
1037 | /* | 1033 | /* |
1038 | * allocate null buffer | 1034 | * allocate null buffer |
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 6d7ffffcce95..78e5798ae967 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c | |||
@@ -1371,6 +1371,7 @@ int snd_pmac_tumbler_init(struct snd_pmac *chip) | |||
1371 | mix->anded_reset = 1; | 1371 | mix->anded_reset = 1; |
1372 | if (of_get_property(np, "layout-id", NULL)) | 1372 | if (of_get_property(np, "layout-id", NULL)) |
1373 | mix->reset_on_sleep = 0; | 1373 | mix->reset_on_sleep = 0; |
1374 | of_node_put(np); | ||
1374 | break; | 1375 | break; |
1375 | } | 1376 | } |
1376 | } | 1377 | } |
diff --git a/sound/sh/aica.c b/sound/sh/aica.c index 2b26311405a4..e7fef3fce44a 100644 --- a/sound/sh/aica.c +++ b/sound/sh/aica.c | |||
@@ -464,14 +464,12 @@ static int __init snd_aicapcmchip(struct snd_card_aica | |||
464 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, | 464 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
465 | &snd_aicapcm_playback_ops); | 465 | &snd_aicapcm_playback_ops); |
466 | /* Allocate the DMA buffers */ | 466 | /* Allocate the DMA buffers */ |
467 | err = | 467 | snd_pcm_lib_preallocate_pages_for_all(pcm, |
468 | snd_pcm_lib_preallocate_pages_for_all(pcm, | 468 | SNDRV_DMA_TYPE_CONTINUOUS, |
469 | SNDRV_DMA_TYPE_CONTINUOUS, | 469 | snd_dma_continuous_data(GFP_KERNEL), |
470 | snd_dma_continuous_data | 470 | AICA_BUFFER_SIZE, |
471 | (GFP_KERNEL), | 471 | AICA_BUFFER_SIZE); |
472 | AICA_BUFFER_SIZE, | 472 | return 0; |
473 | AICA_BUFFER_SIZE); | ||
474 | return err; | ||
475 | } | 473 | } |
476 | 474 | ||
477 | /* Mixer controls */ | 475 | /* Mixer controls */ |
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index f4011bebc7ec..2391c7f1dd2d 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c | |||
@@ -1142,7 +1142,6 @@ static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd) | |||
1142 | 1142 | ||
1143 | static int acp_dma_new(struct snd_soc_pcm_runtime *rtd) | 1143 | static int acp_dma_new(struct snd_soc_pcm_runtime *rtd) |
1144 | { | 1144 | { |
1145 | int ret; | ||
1146 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, | 1145 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, |
1147 | DRV_NAME); | 1146 | DRV_NAME); |
1148 | struct audio_drv_data *adata = dev_get_drvdata(component->dev); | 1147 | struct audio_drv_data *adata = dev_get_drvdata(component->dev); |
@@ -1150,24 +1149,21 @@ static int acp_dma_new(struct snd_soc_pcm_runtime *rtd) | |||
1150 | 1149 | ||
1151 | switch (adata->asic_type) { | 1150 | switch (adata->asic_type) { |
1152 | case CHIP_STONEY: | 1151 | case CHIP_STONEY: |
1153 | ret = snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, | 1152 | snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, |
1154 | SNDRV_DMA_TYPE_DEV, | 1153 | SNDRV_DMA_TYPE_DEV, |
1155 | parent, | 1154 | parent, |
1156 | ST_MIN_BUFFER, | 1155 | ST_MIN_BUFFER, |
1157 | ST_MAX_BUFFER); | 1156 | ST_MAX_BUFFER); |
1158 | break; | 1157 | break; |
1159 | default: | 1158 | default: |
1160 | ret = snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, | 1159 | snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, |
1161 | SNDRV_DMA_TYPE_DEV, | 1160 | SNDRV_DMA_TYPE_DEV, |
1162 | parent, | 1161 | parent, |
1163 | MIN_BUFFER, | 1162 | MIN_BUFFER, |
1164 | MAX_BUFFER); | 1163 | MAX_BUFFER); |
1165 | break; | 1164 | break; |
1166 | } | 1165 | } |
1167 | if (ret < 0) | 1166 | return 0; |
1168 | dev_err(component->dev, | ||
1169 | "buffer preallocation failure error:%d\n", ret); | ||
1170 | return ret; | ||
1171 | } | 1167 | } |
1172 | 1168 | ||
1173 | static int acp_dma_close(struct snd_pcm_substream *substream) | 1169 | static int acp_dma_close(struct snd_pcm_substream *substream) |
diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c index 3d58338fa3cf..1a2e15ff1456 100644 --- a/sound/soc/amd/raven/acp3x-pcm-dma.c +++ b/sound/soc/amd/raven/acp3x-pcm-dma.c | |||
@@ -367,10 +367,10 @@ static snd_pcm_uframes_t acp3x_dma_pointer(struct snd_pcm_substream *substream) | |||
367 | 367 | ||
368 | static int acp3x_dma_new(struct snd_soc_pcm_runtime *rtd) | 368 | static int acp3x_dma_new(struct snd_soc_pcm_runtime *rtd) |
369 | { | 369 | { |
370 | return snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, | 370 | snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, |
371 | SNDRV_DMA_TYPE_DEV, | 371 | rtd->pcm->card->dev, |
372 | NULL, MIN_BUFFER, | 372 | MIN_BUFFER, MAX_BUFFER); |
373 | MAX_BUFFER); | 373 | return 0; |
374 | } | 374 | } |
375 | 375 | ||
376 | static int acp3x_dma_hw_free(struct snd_pcm_substream *substream) | 376 | static int acp3x_dma_hw_free(struct snd_pcm_substream *substream) |
diff --git a/sound/soc/dwc/dwc-pcm.c b/sound/soc/dwc/dwc-pcm.c index 2cc9632024fc..a9ae91c4597f 100644 --- a/sound/soc/dwc/dwc-pcm.c +++ b/sound/soc/dwc/dwc-pcm.c | |||
@@ -249,9 +249,10 @@ static int dw_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
249 | { | 249 | { |
250 | size_t size = dw_pcm_hardware.buffer_bytes_max; | 250 | size_t size = dw_pcm_hardware.buffer_bytes_max; |
251 | 251 | ||
252 | return snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, | 252 | snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, |
253 | SNDRV_DMA_TYPE_CONTINUOUS, | 253 | SNDRV_DMA_TYPE_CONTINUOUS, |
254 | snd_dma_continuous_data(GFP_KERNEL), size, size); | 254 | snd_dma_continuous_data(GFP_KERNEL), size, size); |
255 | return 0; | ||
255 | } | 256 | } |
256 | 257 | ||
257 | static void dw_pcm_free(struct snd_pcm *pcm) | 258 | static void dw_pcm_free(struct snd_pcm *pcm) |
diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c index b0873fea23ab..08cea5b5cda9 100644 --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c | |||
@@ -687,20 +687,15 @@ static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
687 | { | 687 | { |
688 | struct snd_soc_dai *dai = rtd->cpu_dai; | 688 | struct snd_soc_dai *dai = rtd->cpu_dai; |
689 | struct snd_pcm *pcm = rtd->pcm; | 689 | struct snd_pcm *pcm = rtd->pcm; |
690 | int retval = 0; | ||
691 | 690 | ||
692 | if (dai->driver->playback.channels_min || | 691 | if (dai->driver->playback.channels_min || |
693 | dai->driver->capture.channels_min) { | 692 | dai->driver->capture.channels_min) { |
694 | retval = snd_pcm_lib_preallocate_pages_for_all(pcm, | 693 | snd_pcm_lib_preallocate_pages_for_all(pcm, |
695 | SNDRV_DMA_TYPE_CONTINUOUS, | 694 | SNDRV_DMA_TYPE_CONTINUOUS, |
696 | snd_dma_continuous_data(GFP_DMA), | 695 | snd_dma_continuous_data(GFP_DMA), |
697 | SST_MIN_BUFFER, SST_MAX_BUFFER); | 696 | SST_MIN_BUFFER, SST_MAX_BUFFER); |
698 | if (retval) { | ||
699 | dev_err(rtd->dev, "dma buffer allocation failure\n"); | ||
700 | return retval; | ||
701 | } | ||
702 | } | 697 | } |
703 | return retval; | 698 | return 0; |
704 | } | 699 | } |
705 | 700 | ||
706 | static int sst_soc_probe(struct snd_soc_component *component) | 701 | static int sst_soc_probe(struct snd_soc_component *component) |
diff --git a/sound/soc/intel/baytrail/sst-baytrail-pcm.c b/sound/soc/intel/baytrail/sst-baytrail-pcm.c index 498fb5346f1a..5373605de0af 100644 --- a/sound/soc/intel/baytrail/sst-baytrail-pcm.c +++ b/sound/soc/intel/baytrail/sst-baytrail-pcm.c | |||
@@ -327,23 +327,16 @@ static int sst_byt_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
327 | size_t size; | 327 | size_t size; |
328 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); | 328 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
329 | struct sst_pdata *pdata = dev_get_platdata(component->dev); | 329 | struct sst_pdata *pdata = dev_get_platdata(component->dev); |
330 | int ret = 0; | ||
331 | 330 | ||
332 | if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream || | 331 | if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream || |
333 | pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { | 332 | pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { |
334 | size = sst_byt_pcm_hardware.buffer_bytes_max; | 333 | size = sst_byt_pcm_hardware.buffer_bytes_max; |
335 | ret = snd_pcm_lib_preallocate_pages_for_all(pcm, | 334 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
336 | SNDRV_DMA_TYPE_DEV, | 335 | pdata->dma_dev, |
337 | pdata->dma_dev, | 336 | size, size); |
338 | size, size); | ||
339 | if (ret) { | ||
340 | dev_err(rtd->dev, "dma buffer allocation failed %d\n", | ||
341 | ret); | ||
342 | return ret; | ||
343 | } | ||
344 | } | 337 | } |
345 | 338 | ||
346 | return ret; | 339 | return 0; |
347 | } | 340 | } |
348 | 341 | ||
349 | static struct snd_soc_dai_driver byt_dais[] = { | 342 | static struct snd_soc_dai_driver byt_dais[] = { |
diff --git a/sound/soc/intel/haswell/sst-haswell-pcm.c b/sound/soc/intel/haswell/sst-haswell-pcm.c index 2debcc2ed99a..e023c4c3e5a9 100644 --- a/sound/soc/intel/haswell/sst-haswell-pcm.c +++ b/sound/soc/intel/haswell/sst-haswell-pcm.c | |||
@@ -946,27 +946,21 @@ static int hsw_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
946 | struct sst_pdata *pdata = dev_get_platdata(component->dev); | 946 | struct sst_pdata *pdata = dev_get_platdata(component->dev); |
947 | struct hsw_priv_data *priv_data = dev_get_drvdata(component->dev); | 947 | struct hsw_priv_data *priv_data = dev_get_drvdata(component->dev); |
948 | struct device *dev = pdata->dma_dev; | 948 | struct device *dev = pdata->dma_dev; |
949 | int ret = 0; | ||
950 | 949 | ||
951 | if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream || | 950 | if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream || |
952 | pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { | 951 | pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { |
953 | ret = snd_pcm_lib_preallocate_pages_for_all(pcm, | 952 | snd_pcm_lib_preallocate_pages_for_all(pcm, |
954 | SNDRV_DMA_TYPE_DEV_SG, | 953 | SNDRV_DMA_TYPE_DEV_SG, |
955 | dev, | 954 | dev, |
956 | hsw_pcm_hardware.buffer_bytes_max, | 955 | hsw_pcm_hardware.buffer_bytes_max, |
957 | hsw_pcm_hardware.buffer_bytes_max); | 956 | hsw_pcm_hardware.buffer_bytes_max); |
958 | if (ret) { | ||
959 | dev_err(rtd->dev, "dma buffer allocation failed %d\n", | ||
960 | ret); | ||
961 | return ret; | ||
962 | } | ||
963 | } | 957 | } |
964 | if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) | 958 | if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) |
965 | priv_data->pcm[rtd->cpu_dai->id][SNDRV_PCM_STREAM_PLAYBACK].hsw_pcm = pcm; | 959 | priv_data->pcm[rtd->cpu_dai->id][SNDRV_PCM_STREAM_PLAYBACK].hsw_pcm = pcm; |
966 | if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) | 960 | if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) |
967 | priv_data->pcm[rtd->cpu_dai->id][SNDRV_PCM_STREAM_CAPTURE].hsw_pcm = pcm; | 961 | priv_data->pcm[rtd->cpu_dai->id][SNDRV_PCM_STREAM_CAPTURE].hsw_pcm = pcm; |
968 | 962 | ||
969 | return ret; | 963 | return 0; |
970 | } | 964 | } |
971 | 965 | ||
972 | #define HSW_FORMATS \ | 966 | #define HSW_FORMATS \ |
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index a4284778f117..1ae83f4ccc36 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c | |||
@@ -1289,7 +1289,6 @@ static int skl_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
1289 | struct hdac_bus *bus = dev_get_drvdata(dai->dev); | 1289 | struct hdac_bus *bus = dev_get_drvdata(dai->dev); |
1290 | struct snd_pcm *pcm = rtd->pcm; | 1290 | struct snd_pcm *pcm = rtd->pcm; |
1291 | unsigned int size; | 1291 | unsigned int size; |
1292 | int retval = 0; | ||
1293 | struct skl *skl = bus_to_skl(bus); | 1292 | struct skl *skl = bus_to_skl(bus); |
1294 | 1293 | ||
1295 | if (dai->driver->playback.channels_min || | 1294 | if (dai->driver->playback.channels_min || |
@@ -1298,17 +1297,13 @@ static int skl_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
1298 | size = CONFIG_SND_HDA_PREALLOC_SIZE * 1024; | 1297 | size = CONFIG_SND_HDA_PREALLOC_SIZE * 1024; |
1299 | if (size > MAX_PREALLOC_SIZE) | 1298 | if (size > MAX_PREALLOC_SIZE) |
1300 | size = MAX_PREALLOC_SIZE; | 1299 | size = MAX_PREALLOC_SIZE; |
1301 | retval = snd_pcm_lib_preallocate_pages_for_all(pcm, | 1300 | snd_pcm_lib_preallocate_pages_for_all(pcm, |
1302 | SNDRV_DMA_TYPE_DEV_SG, | 1301 | SNDRV_DMA_TYPE_DEV_SG, |
1303 | snd_dma_pci_data(skl->pci), | 1302 | snd_dma_pci_data(skl->pci), |
1304 | size, MAX_PREALLOC_SIZE); | 1303 | size, MAX_PREALLOC_SIZE); |
1305 | if (retval) { | ||
1306 | dev_err(dai->dev, "dma buffer allocation fail\n"); | ||
1307 | return retval; | ||
1308 | } | ||
1309 | } | 1304 | } |
1310 | 1305 | ||
1311 | return retval; | 1306 | return 0; |
1312 | } | 1307 | } |
1313 | 1308 | ||
1314 | static int skl_get_module_info(struct skl *skl, struct skl_module_cfg *mconfig) | 1309 | static int skl_get_module_info(struct skl *skl, struct skl_module_cfg *mconfig) |
diff --git a/sound/soc/mediatek/common/mtk-afe-platform-driver.c b/sound/soc/mediatek/common/mtk-afe-platform-driver.c index 697aa50aff9a..3ce527ce30ce 100644 --- a/sound/soc/mediatek/common/mtk-afe-platform-driver.c +++ b/sound/soc/mediatek/common/mtk-afe-platform-driver.c | |||
@@ -126,9 +126,9 @@ int mtk_afe_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
126 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | 126 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); |
127 | 127 | ||
128 | size = afe->mtk_afe_hardware->buffer_bytes_max; | 128 | size = afe->mtk_afe_hardware->buffer_bytes_max; |
129 | return snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 129 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
130 | afe->dev, | 130 | afe->dev, size, size); |
131 | size, size); | 131 | return 0; |
132 | } | 132 | } |
133 | EXPORT_SYMBOL_GPL(mtk_afe_pcm_new); | 133 | EXPORT_SYMBOL_GPL(mtk_afe_pcm_new); |
134 | 134 | ||
diff --git a/sound/soc/meson/axg-fifo.c b/sound/soc/meson/axg-fifo.c index 0e4f65e654c4..75e5e480fda2 100644 --- a/sound/soc/meson/axg-fifo.c +++ b/sound/soc/meson/axg-fifo.c | |||
@@ -267,9 +267,10 @@ int axg_fifo_pcm_new(struct snd_soc_pcm_runtime *rtd, unsigned int type) | |||
267 | struct snd_card *card = rtd->card->snd_card; | 267 | struct snd_card *card = rtd->card->snd_card; |
268 | size_t size = axg_fifo_hw.buffer_bytes_max; | 268 | size_t size = axg_fifo_hw.buffer_bytes_max; |
269 | 269 | ||
270 | return snd_pcm_lib_preallocate_pages(rtd->pcm->streams[type].substream, | 270 | snd_pcm_lib_preallocate_pages(rtd->pcm->streams[type].substream, |
271 | SNDRV_DMA_TYPE_DEV, card->dev, | 271 | SNDRV_DMA_TYPE_DEV, card->dev, |
272 | size, size); | 272 | size, size); |
273 | return 0; | ||
273 | } | 274 | } |
274 | EXPORT_SYMBOL_GPL(axg_fifo_pcm_new); | 275 | EXPORT_SYMBOL_GPL(axg_fifo_pcm_new); |
275 | 276 | ||
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index db929b00ae5e..3447dbdba1f1 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c | |||
@@ -1768,11 +1768,12 @@ static const struct snd_pcm_ops fsi_pcm_ops = { | |||
1768 | 1768 | ||
1769 | static int fsi_pcm_new(struct snd_soc_pcm_runtime *rtd) | 1769 | static int fsi_pcm_new(struct snd_soc_pcm_runtime *rtd) |
1770 | { | 1770 | { |
1771 | return snd_pcm_lib_preallocate_pages_for_all( | 1771 | snd_pcm_lib_preallocate_pages_for_all( |
1772 | rtd->pcm, | 1772 | rtd->pcm, |
1773 | SNDRV_DMA_TYPE_DEV, | 1773 | SNDRV_DMA_TYPE_DEV, |
1774 | rtd->card->snd_card->dev, | 1774 | rtd->card->snd_card->dev, |
1775 | PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); | 1775 | PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); |
1776 | return 0; | ||
1776 | } | 1777 | } |
1777 | 1778 | ||
1778 | /* | 1779 | /* |
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 9834474684b1..022996d2db13 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -1573,7 +1573,6 @@ static int rsnd_preallocate_pages(struct snd_soc_pcm_runtime *rtd, | |||
1573 | struct rsnd_priv *priv = rsnd_io_to_priv(io); | 1573 | struct rsnd_priv *priv = rsnd_io_to_priv(io); |
1574 | struct device *dev = rsnd_priv_to_dev(priv); | 1574 | struct device *dev = rsnd_priv_to_dev(priv); |
1575 | struct snd_pcm_substream *substream; | 1575 | struct snd_pcm_substream *substream; |
1576 | int err; | ||
1577 | 1576 | ||
1578 | /* | 1577 | /* |
1579 | * use Audio-DMAC dev if we can use IPMMU | 1578 | * use Audio-DMAC dev if we can use IPMMU |
@@ -1586,12 +1585,10 @@ static int rsnd_preallocate_pages(struct snd_soc_pcm_runtime *rtd, | |||
1586 | for (substream = rtd->pcm->streams[stream].substream; | 1585 | for (substream = rtd->pcm->streams[stream].substream; |
1587 | substream; | 1586 | substream; |
1588 | substream = substream->next) { | 1587 | substream = substream->next) { |
1589 | err = snd_pcm_lib_preallocate_pages(substream, | 1588 | snd_pcm_lib_preallocate_pages(substream, |
1590 | SNDRV_DMA_TYPE_DEV, | 1589 | SNDRV_DMA_TYPE_DEV, |
1591 | dev, | 1590 | dev, |
1592 | PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); | 1591 | PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); |
1593 | if (err < 0) | ||
1594 | return err; | ||
1595 | } | 1592 | } |
1596 | 1593 | ||
1597 | return 0; | 1594 | return 0; |
diff --git a/sound/soc/sh/siu_pcm.c b/sound/soc/sh/siu_pcm.c index e263757e4a69..78c3145b4109 100644 --- a/sound/soc/sh/siu_pcm.c +++ b/sound/soc/sh/siu_pcm.c | |||
@@ -541,15 +541,9 @@ static int siu_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
541 | if (ret < 0) | 541 | if (ret < 0) |
542 | return ret; | 542 | return ret; |
543 | 543 | ||
544 | ret = snd_pcm_lib_preallocate_pages_for_all(pcm, | 544 | snd_pcm_lib_preallocate_pages_for_all(pcm, |
545 | SNDRV_DMA_TYPE_DEV, NULL, | 545 | SNDRV_DMA_TYPE_DEV, card->dev, |
546 | SIU_BUFFER_BYTES_MAX, SIU_BUFFER_BYTES_MAX); | 546 | SIU_BUFFER_BYTES_MAX, SIU_BUFFER_BYTES_MAX); |
547 | if (ret < 0) { | ||
548 | dev_err(card->dev, | ||
549 | "snd_pcm_lib_preallocate_pages_for_all() err=%d", | ||
550 | ret); | ||
551 | goto fail; | ||
552 | } | ||
553 | 547 | ||
554 | (*port_info)->pcm = pcm; | 548 | (*port_info)->pcm = pcm; |
555 | 549 | ||
@@ -562,11 +556,6 @@ static int siu_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
562 | 556 | ||
563 | dev_info(card->dev, "SuperH SIU driver initialized.\n"); | 557 | dev_info(card->dev, "SuperH SIU driver initialized.\n"); |
564 | return 0; | 558 | return 0; |
565 | |||
566 | fail: | ||
567 | siu_free_port(siu_ports[pdev->id]); | ||
568 | dev_err(card->dev, "SIU: failed to initialize.\n"); | ||
569 | return ret; | ||
570 | } | 559 | } |
571 | 560 | ||
572 | static void siu_pcm_free(struct snd_pcm *pcm) | 561 | static void siu_pcm_free(struct snd_pcm *pcm) |
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index f1ab6285a085..748f5f641002 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c | |||
@@ -269,7 +269,6 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
269 | size_t prealloc_buffer_size; | 269 | size_t prealloc_buffer_size; |
270 | size_t max_buffer_size; | 270 | size_t max_buffer_size; |
271 | unsigned int i; | 271 | unsigned int i; |
272 | int ret; | ||
273 | 272 | ||
274 | if (config && config->prealloc_buffer_size) { | 273 | if (config && config->prealloc_buffer_size) { |
275 | prealloc_buffer_size = config->prealloc_buffer_size; | 274 | prealloc_buffer_size = config->prealloc_buffer_size; |
@@ -299,13 +298,11 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
299 | return -EINVAL; | 298 | return -EINVAL; |
300 | } | 299 | } |
301 | 300 | ||
302 | ret = snd_pcm_lib_preallocate_pages(substream, | 301 | snd_pcm_lib_preallocate_pages(substream, |
303 | SNDRV_DMA_TYPE_DEV_IRAM, | 302 | SNDRV_DMA_TYPE_DEV_IRAM, |
304 | dmaengine_dma_dev(pcm, substream), | 303 | dmaengine_dma_dev(pcm, substream), |
305 | prealloc_buffer_size, | 304 | prealloc_buffer_size, |
306 | max_buffer_size); | 305 | max_buffer_size); |
307 | if (ret) | ||
308 | return ret; | ||
309 | 306 | ||
310 | if (!dmaengine_pcm_can_report_residue(dev, pcm->chan[i])) | 307 | if (!dmaengine_pcm_can_report_residue(dev, pcm->chan[i])) |
311 | pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE; | 308 | pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE; |
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index a5b40e82dea4..0d5ec68a1e50 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -3159,6 +3159,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) | |||
3159 | } | 3159 | } |
3160 | 3160 | ||
3161 | pcm->private_free = soc_pcm_private_free; | 3161 | pcm->private_free = soc_pcm_private_free; |
3162 | pcm->no_device_suspend = true; | ||
3162 | out: | 3163 | out: |
3163 | dev_info(rtd->card->dev, "%s <-> %s mapping ok\n", | 3164 | dev_info(rtd->card->dev, "%s <-> %s mapping ok\n", |
3164 | (rtd->num_codecs > 1) ? "multicodec" : rtd->codec_dai->name, | 3165 | (rtd->num_codecs > 1) ? "multicodec" : rtd->codec_dai->name, |
diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c index 706ff005234f..47901983a6ff 100644 --- a/sound/soc/stm/stm32_adfsdm.c +++ b/sound/soc/stm/stm32_adfsdm.c | |||
@@ -262,8 +262,9 @@ static int stm32_adfsdm_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
262 | snd_soc_dai_get_drvdata(rtd->cpu_dai); | 262 | snd_soc_dai_get_drvdata(rtd->cpu_dai); |
263 | unsigned int size = DFSDM_MAX_PERIODS * DFSDM_MAX_PERIOD_SIZE; | 263 | unsigned int size = DFSDM_MAX_PERIODS * DFSDM_MAX_PERIOD_SIZE; |
264 | 264 | ||
265 | return snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 265 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
266 | priv->dev, size, size); | 266 | priv->dev, size, size); |
267 | return 0; | ||
267 | } | 268 | } |
268 | 269 | ||
269 | static void stm32_adfsdm_pcm_free(struct snd_pcm *pcm) | 270 | static void stm32_adfsdm_pcm_free(struct snd_pcm *pcm) |
diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c index 8d31fe628e2f..089bd7518606 100644 --- a/sound/soc/txx9/txx9aclc.c +++ b/sound/soc/txx9/txx9aclc.c | |||
@@ -313,8 +313,10 @@ static int txx9aclc_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
313 | if (ret) | 313 | if (ret) |
314 | goto exit; | 314 | goto exit; |
315 | } | 315 | } |
316 | return snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 316 | |
317 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | ||
317 | card->dev, 64 * 1024, 4 * 1024 * 1024); | 318 | card->dev, 64 * 1024, 4 * 1024 * 1024); |
319 | return 0; | ||
318 | 320 | ||
319 | exit: | 321 | exit: |
320 | for (i = 0; i < 2; i++) { | 322 | for (i = 0; i < 2; i++) { |
diff --git a/sound/soc/uniphier/aio-dma.c b/sound/soc/uniphier/aio-dma.c index 4ec6b65bfb44..fa001d3c1a88 100644 --- a/sound/soc/uniphier/aio-dma.c +++ b/sound/soc/uniphier/aio-dma.c | |||
@@ -235,10 +235,11 @@ static int uniphier_aiodma_new(struct snd_soc_pcm_runtime *rtd) | |||
235 | if (ret) | 235 | if (ret) |
236 | return ret; | 236 | return ret; |
237 | 237 | ||
238 | return snd_pcm_lib_preallocate_pages_for_all(pcm, | 238 | snd_pcm_lib_preallocate_pages_for_all(pcm, |
239 | SNDRV_DMA_TYPE_DEV, dev, | 239 | SNDRV_DMA_TYPE_DEV, dev, |
240 | uniphier_aiodma_hw.buffer_bytes_max, | 240 | uniphier_aiodma_hw.buffer_bytes_max, |
241 | uniphier_aiodma_hw.buffer_bytes_max); | 241 | uniphier_aiodma_hw.buffer_bytes_max); |
242 | return 0; | ||
242 | } | 243 | } |
243 | 244 | ||
244 | static void uniphier_aiodma_free(struct snd_pcm *pcm) | 245 | static void uniphier_aiodma_free(struct snd_pcm *pcm) |
diff --git a/sound/soc/xilinx/xlnx_formatter_pcm.c b/sound/soc/xilinx/xlnx_formatter_pcm.c index 97177d35652e..dc8721f4f56b 100644 --- a/sound/soc/xilinx/xlnx_formatter_pcm.c +++ b/sound/soc/xilinx/xlnx_formatter_pcm.c | |||
@@ -536,10 +536,11 @@ static int xlnx_formatter_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
536 | { | 536 | { |
537 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, | 537 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, |
538 | DRV_NAME); | 538 | DRV_NAME); |
539 | return snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, | 539 | snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, |
540 | SNDRV_DMA_TYPE_DEV, component->dev, | 540 | SNDRV_DMA_TYPE_DEV, component->dev, |
541 | xlnx_pcm_hardware.buffer_bytes_max, | 541 | xlnx_pcm_hardware.buffer_bytes_max, |
542 | xlnx_pcm_hardware.buffer_bytes_max); | 542 | xlnx_pcm_hardware.buffer_bytes_max); |
543 | return 0; | ||
543 | } | 544 | } |
544 | 545 | ||
545 | static const struct snd_pcm_ops xlnx_formatter_pcm_ops = { | 546 | static const struct snd_pcm_ops xlnx_formatter_pcm_ops = { |
diff --git a/sound/soc/xtensa/xtfpga-i2s.c b/sound/soc/xtensa/xtfpga-i2s.c index 503560916620..2f20a02c8d46 100644 --- a/sound/soc/xtensa/xtfpga-i2s.c +++ b/sound/soc/xtensa/xtfpga-i2s.c | |||
@@ -469,9 +469,9 @@ static int xtfpga_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
469 | struct snd_card *card = rtd->card->snd_card; | 469 | struct snd_card *card = rtd->card->snd_card; |
470 | size_t size = xtfpga_pcm_hardware.buffer_bytes_max; | 470 | size_t size = xtfpga_pcm_hardware.buffer_bytes_max; |
471 | 471 | ||
472 | return snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, | 472 | snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, |
473 | SNDRV_DMA_TYPE_DEV, | 473 | card->dev, size, size); |
474 | card->dev, size, size); | 474 | return 0; |
475 | } | 475 | } |
476 | 476 | ||
477 | static const struct snd_pcm_ops xtfpga_pcm_ops = { | 477 | static const struct snd_pcm_ops xtfpga_pcm_ops = { |
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index 9e71d7cda999..2b8ef5fe6688 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c | |||
@@ -2243,12 +2243,9 @@ static int snd_dbri_pcm(struct snd_card *card) | |||
2243 | pcm->info_flags = 0; | 2243 | pcm->info_flags = 0; |
2244 | strcpy(pcm->name, card->shortname); | 2244 | strcpy(pcm->name, card->shortname); |
2245 | 2245 | ||
2246 | if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, | 2246 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, |
2247 | SNDRV_DMA_TYPE_CONTINUOUS, | 2247 | snd_dma_continuous_data(GFP_KERNEL), |
2248 | snd_dma_continuous_data(GFP_KERNEL), | 2248 | 64 * 1024, 64 * 1024); |
2249 | 64 * 1024, 64 * 1024)) < 0) | ||
2250 | return err; | ||
2251 | |||
2252 | return 0; | 2249 | return 0; |
2253 | } | 2250 | } |
2254 | 2251 | ||
@@ -2510,16 +2507,10 @@ static void dbri_debug_read(struct snd_info_entry *entry, | |||
2510 | static void snd_dbri_proc(struct snd_card *card) | 2507 | static void snd_dbri_proc(struct snd_card *card) |
2511 | { | 2508 | { |
2512 | struct snd_dbri *dbri = card->private_data; | 2509 | struct snd_dbri *dbri = card->private_data; |
2513 | struct snd_info_entry *entry; | ||
2514 | |||
2515 | if (!snd_card_proc_new(card, "regs", &entry)) | ||
2516 | snd_info_set_text_ops(entry, dbri, dbri_regs_read); | ||
2517 | 2510 | ||
2511 | snd_card_ro_proc_new(card, "regs", dbri, dbri_regs_read); | ||
2518 | #ifdef DBRI_DEBUG | 2512 | #ifdef DBRI_DEBUG |
2519 | if (!snd_card_proc_new(card, "debug", &entry)) { | 2513 | snd_card_ro_proc_new(card, "debug", dbri, dbri_debug_read); |
2520 | snd_info_set_text_ops(entry, dbri, dbri_debug_read); | ||
2521 | entry->mode = S_IFREG | 0444; /* Readable only. */ | ||
2522 | } | ||
2523 | #endif | 2514 | #endif |
2524 | } | 2515 | } |
2525 | 2516 | ||
diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c index 1ef52edeb538..8707e0108471 100644 --- a/sound/spi/at73c213.c +++ b/sound/spi/at73c213.c | |||
@@ -350,7 +350,7 @@ static int snd_at73c213_pcm_new(struct snd_at73c213 *chip, int device) | |||
350 | 350 | ||
351 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &at73c213_playback_ops); | 351 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &at73c213_playback_ops); |
352 | 352 | ||
353 | retval = snd_pcm_lib_preallocate_pages_for_all(chip->pcm, | 353 | snd_pcm_lib_preallocate_pages_for_all(chip->pcm, |
354 | SNDRV_DMA_TYPE_DEV, &chip->ssc->pdev->dev, | 354 | SNDRV_DMA_TYPE_DEV, &chip->ssc->pdev->dev, |
355 | 64 * 1024, 64 * 1024); | 355 | 64 * 1024, 64 * 1024); |
356 | out: | 356 | out: |
diff --git a/sound/synth/emux/emux_proc.c b/sound/synth/emux/emux_proc.c index a82b4053bee8..c14781ac7941 100644 --- a/sound/synth/emux/emux_proc.c +++ b/sound/synth/emux/emux_proc.c | |||
@@ -115,10 +115,6 @@ void snd_emux_proc_init(struct snd_emux *emu, struct snd_card *card, int device) | |||
115 | entry->content = SNDRV_INFO_CONTENT_TEXT; | 115 | entry->content = SNDRV_INFO_CONTENT_TEXT; |
116 | entry->private_data = emu; | 116 | entry->private_data = emu; |
117 | entry->c.text.read = snd_emux_proc_info_read; | 117 | entry->c.text.read = snd_emux_proc_info_read; |
118 | if (snd_info_register(entry) < 0) | ||
119 | snd_info_free_entry(entry); | ||
120 | else | ||
121 | emu->proc = entry; | ||
122 | } | 118 | } |
123 | 119 | ||
124 | void snd_emux_proc_free(struct snd_emux *emu) | 120 | void snd_emux_proc_free(struct snd_emux *emu) |
diff --git a/sound/usb/card.c b/sound/usb/card.c index 746a72e23cf9..719e10034553 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c | |||
@@ -811,7 +811,6 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) | |||
811 | snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); | 811 | snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); |
812 | if (!chip->num_suspended_intf++) { | 812 | if (!chip->num_suspended_intf++) { |
813 | list_for_each_entry(as, &chip->pcm_list, list) { | 813 | list_for_each_entry(as, &chip->pcm_list, list) { |
814 | snd_pcm_suspend_all(as->pcm); | ||
815 | snd_usb_pcm_suspend(as); | 814 | snd_usb_pcm_suspend(as); |
816 | as->substream[0].need_setup_ep = | 815 | as->substream[0].need_setup_ep = |
817 | as->substream[1].need_setup_ep = true; | 816 | as->substream[1].need_setup_ep = true; |
diff --git a/sound/usb/card.h b/sound/usb/card.h index ac785d15ced4..79fa2a19fb7b 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h | |||
@@ -14,6 +14,7 @@ struct audioformat { | |||
14 | u64 formats; /* ALSA format bits */ | 14 | u64 formats; /* ALSA format bits */ |
15 | unsigned int channels; /* # channels */ | 15 | unsigned int channels; /* # channels */ |
16 | unsigned int fmt_type; /* USB audio format type (1-3) */ | 16 | unsigned int fmt_type; /* USB audio format type (1-3) */ |
17 | unsigned int fmt_bits; /* number of significant bits */ | ||
17 | unsigned int frame_size; /* samples per frame for non-audio */ | 18 | unsigned int frame_size; /* samples per frame for non-audio */ |
18 | int iface; /* interface number */ | 19 | int iface; /* interface number */ |
19 | unsigned char altsetting; /* corresponding alternate setting */ | 20 | unsigned char altsetting; /* corresponding alternate setting */ |
diff --git a/sound/usb/format.c b/sound/usb/format.c index fd13ac11b136..3ee7d6f853b7 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c | |||
@@ -87,6 +87,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, | |||
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | fp->fmt_bits = sample_width; | ||
91 | |||
90 | if ((pcm_formats == 0) && | 92 | if ((pcm_formats == 0) && |
91 | (format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED))) { | 93 | (format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED))) { |
92 | /* some devices don't define this correctly... */ | 94 | /* some devices don't define this correctly... */ |
diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c index c1376bfdc90b..7afe8fae4939 100644 --- a/sound/usb/line6/driver.c +++ b/sound/usb/line6/driver.c | |||
@@ -849,10 +849,8 @@ int line6_suspend(struct usb_interface *interface, pm_message_t message) | |||
849 | if (line6->properties->capabilities & LINE6_CAP_CONTROL) | 849 | if (line6->properties->capabilities & LINE6_CAP_CONTROL) |
850 | line6_stop_listen(line6); | 850 | line6_stop_listen(line6); |
851 | 851 | ||
852 | if (line6pcm != NULL) { | 852 | if (line6pcm != NULL) |
853 | snd_pcm_suspend_all(line6pcm->pcm); | ||
854 | line6pcm->flags = 0; | 853 | line6pcm->flags = 0; |
855 | } | ||
856 | 854 | ||
857 | return 0; | 855 | return 0; |
858 | } | 856 | } |
diff --git a/sound/usb/line6/pod.c b/sound/usb/line6/pod.c index 020c81818951..ce45b6dab651 100644 --- a/sound/usb/line6/pod.c +++ b/sound/usb/line6/pod.c | |||
@@ -320,7 +320,8 @@ static void pod_startup4(struct work_struct *work) | |||
320 | line6_read_serial_number(&pod->line6, &pod->serial_number); | 320 | line6_read_serial_number(&pod->line6, &pod->serial_number); |
321 | 321 | ||
322 | /* ALSA audio interface: */ | 322 | /* ALSA audio interface: */ |
323 | snd_card_register(line6->card); | 323 | if (snd_card_register(line6->card)) |
324 | dev_err(line6->ifcdev, "Failed to register POD card.\n"); | ||
324 | } | 325 | } |
325 | 326 | ||
326 | /* POD special files: */ | 327 | /* POD special files: */ |
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index e7d441d0e839..73d7dff425c1 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -1835,7 +1835,7 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, | |||
1835 | { | 1835 | { |
1836 | int channels, i, j; | 1836 | int channels, i, j; |
1837 | struct usb_audio_term iterm; | 1837 | struct usb_audio_term iterm; |
1838 | unsigned int master_bits, first_ch_bits; | 1838 | unsigned int master_bits; |
1839 | int err, csize; | 1839 | int err, csize; |
1840 | struct uac_feature_unit_descriptor *hdr = _ftr; | 1840 | struct uac_feature_unit_descriptor *hdr = _ftr; |
1841 | __u8 *bmaControls; | 1841 | __u8 *bmaControls; |
@@ -1926,10 +1926,6 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, | |||
1926 | break; | 1926 | break; |
1927 | 1927 | ||
1928 | } | 1928 | } |
1929 | if (channels > 0) | ||
1930 | first_ch_bits = snd_usb_combine_bytes(bmaControls + csize, csize); | ||
1931 | else | ||
1932 | first_ch_bits = 0; | ||
1933 | 1929 | ||
1934 | if (state->mixer->protocol == UAC_VERSION_1) { | 1930 | if (state->mixer->protocol == UAC_VERSION_1) { |
1935 | /* check all control types */ | 1931 | /* check all control types */ |
@@ -3445,7 +3441,6 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, | |||
3445 | .dev_free = snd_usb_mixer_dev_free | 3441 | .dev_free = snd_usb_mixer_dev_free |
3446 | }; | 3442 | }; |
3447 | struct usb_mixer_interface *mixer; | 3443 | struct usb_mixer_interface *mixer; |
3448 | struct snd_info_entry *entry; | ||
3449 | int err; | 3444 | int err; |
3450 | 3445 | ||
3451 | strcpy(chip->card->mixername, "USB Mixer"); | 3446 | strcpy(chip->card->mixername, "USB Mixer"); |
@@ -3501,9 +3496,9 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, | |||
3501 | if (err < 0) | 3496 | if (err < 0) |
3502 | goto _error; | 3497 | goto _error; |
3503 | 3498 | ||
3504 | if (list_empty(&chip->mixer_list) && | 3499 | if (list_empty(&chip->mixer_list)) |
3505 | !snd_card_proc_new(chip->card, "usbmixer", &entry)) | 3500 | snd_card_ro_proc_new(chip->card, "usbmixer", chip, |
3506 | snd_info_set_text_ops(entry, chip, snd_usb_mixer_proc_read); | 3501 | snd_usb_mixer_proc_read); |
3507 | 3502 | ||
3508 | list_add(&mixer->list, &chip->mixer_list); | 3503 | list_add(&mixer->list, &chip->mixer_list); |
3509 | return 0; | 3504 | return 0; |
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index 85ae0ff2382a..a751a18ca4c2 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c | |||
@@ -2195,7 +2195,6 @@ static int snd_rme_controls_create(struct usb_mixer_interface *mixer) | |||
2195 | int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) | 2195 | int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) |
2196 | { | 2196 | { |
2197 | int err = 0; | 2197 | int err = 0; |
2198 | struct snd_info_entry *entry; | ||
2199 | 2198 | ||
2200 | err = snd_usb_soundblaster_remote_init(mixer); | 2199 | err = snd_usb_soundblaster_remote_init(mixer); |
2201 | if (err < 0) | 2200 | if (err < 0) |
@@ -2214,9 +2213,8 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) | |||
2214 | err = snd_audigy2nx_controls_create(mixer); | 2213 | err = snd_audigy2nx_controls_create(mixer); |
2215 | if (err < 0) | 2214 | if (err < 0) |
2216 | break; | 2215 | break; |
2217 | if (!snd_card_proc_new(mixer->chip->card, "audigy2nx", &entry)) | 2216 | snd_card_ro_proc_new(mixer->chip->card, "audigy2nx", |
2218 | snd_info_set_text_ops(entry, mixer, | 2217 | mixer, snd_audigy2nx_proc_read); |
2219 | snd_audigy2nx_proc_read); | ||
2220 | break; | 2218 | break; |
2221 | 2219 | ||
2222 | /* EMU0204 */ | 2220 | /* EMU0204 */ |
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index db114f3977e0..056af0a57b22 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c | |||
@@ -354,6 +354,10 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, | |||
354 | ep = 0x81; | 354 | ep = 0x81; |
355 | ifnum = 1; | 355 | ifnum = 1; |
356 | goto add_sync_ep_from_ifnum; | 356 | goto add_sync_ep_from_ifnum; |
357 | case USB_ID(0x07fd, 0x0004): /* MOTU MicroBook II */ | ||
358 | ep = 0x84; | ||
359 | ifnum = 0; | ||
360 | goto add_sync_ep_from_ifnum; | ||
357 | } | 361 | } |
358 | 362 | ||
359 | if (attr == USB_ENDPOINT_SYNC_ASYNC && | 363 | if (attr == USB_ENDPOINT_SYNC_ASYNC && |
diff --git a/sound/usb/proc.c b/sound/usb/proc.c index 0ac89e294d31..ef9190530fd2 100644 --- a/sound/usb/proc.c +++ b/sound/usb/proc.c | |||
@@ -61,11 +61,10 @@ static void proc_audio_usbid_read(struct snd_info_entry *entry, struct snd_info_ | |||
61 | 61 | ||
62 | void snd_usb_audio_create_proc(struct snd_usb_audio *chip) | 62 | void snd_usb_audio_create_proc(struct snd_usb_audio *chip) |
63 | { | 63 | { |
64 | struct snd_info_entry *entry; | 64 | snd_card_ro_proc_new(chip->card, "usbbus", chip, |
65 | if (!snd_card_proc_new(chip->card, "usbbus", &entry)) | 65 | proc_audio_usbbus_read); |
66 | snd_info_set_text_ops(entry, chip, proc_audio_usbbus_read); | 66 | snd_card_ro_proc_new(chip->card, "usbid", chip, |
67 | if (!snd_card_proc_new(chip->card, "usbid", &entry)) | 67 | proc_audio_usbid_read); |
68 | snd_info_set_text_ops(entry, chip, proc_audio_usbid_read); | ||
69 | } | 68 | } |
70 | 69 | ||
71 | /* | 70 | /* |
@@ -110,6 +109,7 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s | |||
110 | if (subs->speed != USB_SPEED_FULL) | 109 | if (subs->speed != USB_SPEED_FULL) |
111 | snd_iprintf(buffer, " Data packet interval: %d us\n", | 110 | snd_iprintf(buffer, " Data packet interval: %d us\n", |
112 | 125 * (1 << fp->datainterval)); | 111 | 125 * (1 << fp->datainterval)); |
112 | snd_iprintf(buffer, " Bits: %d\n", fp->fmt_bits); | ||
113 | // snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize); | 113 | // snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize); |
114 | // snd_iprintf(buffer, " EP Attribute = %#x\n", fp->attributes); | 114 | // snd_iprintf(buffer, " EP Attribute = %#x\n", fp->attributes); |
115 | } | 115 | } |
@@ -167,12 +167,10 @@ static void proc_pcm_format_read(struct snd_info_entry *entry, struct snd_info_b | |||
167 | 167 | ||
168 | void snd_usb_proc_pcm_format_add(struct snd_usb_stream *stream) | 168 | void snd_usb_proc_pcm_format_add(struct snd_usb_stream *stream) |
169 | { | 169 | { |
170 | struct snd_info_entry *entry; | ||
171 | char name[32]; | 170 | char name[32]; |
172 | struct snd_card *card = stream->chip->card; | 171 | struct snd_card *card = stream->chip->card; |
173 | 172 | ||
174 | sprintf(name, "stream%d", stream->pcm_index); | 173 | sprintf(name, "stream%d", stream->pcm_index); |
175 | if (!snd_card_proc_new(card, name, &entry)) | 174 | snd_card_ro_proc_new(card, name, stream, proc_pcm_format_read); |
176 | snd_info_set_text_ops(entry, stream, proc_pcm_format_read); | ||
177 | } | 175 | } |
178 | 176 | ||
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index b345beb447bd..86e80916a029 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h | |||
@@ -3398,5 +3398,70 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), | |||
3398 | .ifnum = QUIRK_NO_INTERFACE | 3398 | .ifnum = QUIRK_NO_INTERFACE |
3399 | } | 3399 | } |
3400 | }, | 3400 | }, |
3401 | /* MOTU Microbook II */ | ||
3402 | { | ||
3403 | USB_DEVICE(0x07fd, 0x0004), | ||
3404 | .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { | ||
3405 | .vendor_name = "MOTU", | ||
3406 | .product_name = "MicroBookII", | ||
3407 | .ifnum = QUIRK_ANY_INTERFACE, | ||
3408 | .type = QUIRK_COMPOSITE, | ||
3409 | .data = (const struct snd_usb_audio_quirk[]) { | ||
3410 | { | ||
3411 | .ifnum = 0, | ||
3412 | .type = QUIRK_AUDIO_STANDARD_MIXER, | ||
3413 | }, | ||
3414 | { | ||
3415 | .ifnum = 0, | ||
3416 | .type = QUIRK_AUDIO_FIXED_ENDPOINT, | ||
3417 | .data = &(const struct audioformat) { | ||
3418 | .formats = SNDRV_PCM_FMTBIT_S24_3BE, | ||
3419 | .channels = 6, | ||
3420 | .iface = 0, | ||
3421 | .altsetting = 1, | ||
3422 | .altset_idx = 1, | ||
3423 | .attributes = 0, | ||
3424 | .endpoint = 0x84, | ||
3425 | .rates = SNDRV_PCM_RATE_96000, | ||
3426 | .ep_attr = USB_ENDPOINT_XFER_ISOC | | ||
3427 | USB_ENDPOINT_SYNC_ASYNC, | ||
3428 | .rate_min = 96000, | ||
3429 | .rate_max = 96000, | ||
3430 | .nr_rates = 1, | ||
3431 | .maxpacksize = 0x00d8, | ||
3432 | .rate_table = (unsigned int[]) { | ||
3433 | 96000 | ||
3434 | } | ||
3435 | } | ||
3436 | }, | ||
3437 | { | ||
3438 | .ifnum = 0, | ||
3439 | .type = QUIRK_AUDIO_FIXED_ENDPOINT, | ||
3440 | .data = &(const struct audioformat) { | ||
3441 | .formats = SNDRV_PCM_FMTBIT_S24_3BE, | ||
3442 | .channels = 8, | ||
3443 | .iface = 0, | ||
3444 | .altsetting = 1, | ||
3445 | .altset_idx = 1, | ||
3446 | .attributes = 0, | ||
3447 | .endpoint = 0x03, | ||
3448 | .rates = SNDRV_PCM_RATE_96000, | ||
3449 | .ep_attr = USB_ENDPOINT_XFER_ISOC | | ||
3450 | USB_ENDPOINT_SYNC_ASYNC, | ||
3451 | .rate_min = 96000, | ||
3452 | .rate_max = 96000, | ||
3453 | .nr_rates = 1, | ||
3454 | .maxpacksize = 0x0120, | ||
3455 | .rate_table = (unsigned int[]) { | ||
3456 | 96000 | ||
3457 | } | ||
3458 | } | ||
3459 | }, | ||
3460 | { | ||
3461 | .ifnum = -1 | ||
3462 | } | ||
3463 | } | ||
3464 | } | ||
3465 | }, | ||
3401 | 3466 | ||
3402 | #undef USB_DEVICE_VENDOR_SPEC | 3467 | #undef USB_DEVICE_VENDOR_SPEC |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 7e65fe853ee3..e6ce1bbe6ca6 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -1000,6 +1000,105 @@ static int snd_usb_axefx3_boot_quirk(struct usb_device *dev) | |||
1000 | return 0; | 1000 | return 0; |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | |||
1004 | #define MICROBOOK_BUF_SIZE 128 | ||
1005 | |||
1006 | static int snd_usb_motu_microbookii_communicate(struct usb_device *dev, u8 *buf, | ||
1007 | int buf_size, int *length) | ||
1008 | { | ||
1009 | int err, actual_length; | ||
1010 | |||
1011 | err = usb_interrupt_msg(dev, usb_sndintpipe(dev, 0x01), buf, *length, | ||
1012 | &actual_length, 1000); | ||
1013 | if (err < 0) | ||
1014 | return err; | ||
1015 | |||
1016 | print_hex_dump(KERN_DEBUG, "MicroBookII snd: ", DUMP_PREFIX_NONE, 16, 1, | ||
1017 | buf, actual_length, false); | ||
1018 | |||
1019 | memset(buf, 0, buf_size); | ||
1020 | |||
1021 | err = usb_interrupt_msg(dev, usb_rcvintpipe(dev, 0x82), buf, buf_size, | ||
1022 | &actual_length, 1000); | ||
1023 | if (err < 0) | ||
1024 | return err; | ||
1025 | |||
1026 | print_hex_dump(KERN_DEBUG, "MicroBookII rcv: ", DUMP_PREFIX_NONE, 16, 1, | ||
1027 | buf, actual_length, false); | ||
1028 | |||
1029 | *length = actual_length; | ||
1030 | return 0; | ||
1031 | } | ||
1032 | |||
1033 | static int snd_usb_motu_microbookii_boot_quirk(struct usb_device *dev) | ||
1034 | { | ||
1035 | int err, actual_length, poll_attempts = 0; | ||
1036 | static const u8 set_samplerate_seq[] = { 0x00, 0x00, 0x00, 0x00, | ||
1037 | 0x00, 0x00, 0x0b, 0x14, | ||
1038 | 0x00, 0x00, 0x00, 0x01 }; | ||
1039 | static const u8 poll_ready_seq[] = { 0x00, 0x04, 0x00, 0x00, | ||
1040 | 0x00, 0x00, 0x0b, 0x18 }; | ||
1041 | u8 *buf = kzalloc(MICROBOOK_BUF_SIZE, GFP_KERNEL); | ||
1042 | |||
1043 | if (!buf) | ||
1044 | return -ENOMEM; | ||
1045 | |||
1046 | dev_info(&dev->dev, "Waiting for MOTU Microbook II to boot up...\n"); | ||
1047 | |||
1048 | /* First we tell the device which sample rate to use. */ | ||
1049 | memcpy(buf, set_samplerate_seq, sizeof(set_samplerate_seq)); | ||
1050 | actual_length = sizeof(set_samplerate_seq); | ||
1051 | err = snd_usb_motu_microbookii_communicate(dev, buf, MICROBOOK_BUF_SIZE, | ||
1052 | &actual_length); | ||
1053 | |||
1054 | if (err < 0) { | ||
1055 | dev_err(&dev->dev, | ||
1056 | "failed setting the sample rate for Motu MicroBook II: %d\n", | ||
1057 | err); | ||
1058 | goto free_buf; | ||
1059 | } | ||
1060 | |||
1061 | /* Then we poll every 100 ms until the device informs of its readiness. */ | ||
1062 | while (true) { | ||
1063 | if (++poll_attempts > 100) { | ||
1064 | dev_err(&dev->dev, | ||
1065 | "failed booting Motu MicroBook II: timeout\n"); | ||
1066 | err = -ENODEV; | ||
1067 | goto free_buf; | ||
1068 | } | ||
1069 | |||
1070 | memset(buf, 0, MICROBOOK_BUF_SIZE); | ||
1071 | memcpy(buf, poll_ready_seq, sizeof(poll_ready_seq)); | ||
1072 | |||
1073 | actual_length = sizeof(poll_ready_seq); | ||
1074 | err = snd_usb_motu_microbookii_communicate( | ||
1075 | dev, buf, MICROBOOK_BUF_SIZE, &actual_length); | ||
1076 | if (err < 0) { | ||
1077 | dev_err(&dev->dev, | ||
1078 | "failed booting Motu MicroBook II: communication error %d\n", | ||
1079 | err); | ||
1080 | goto free_buf; | ||
1081 | } | ||
1082 | |||
1083 | /* the device signals its readiness through a message of the | ||
1084 | * form | ||
1085 | * XX 06 00 00 00 00 0b 18 00 00 00 01 | ||
1086 | * If the device is not yet ready to accept audio data, the | ||
1087 | * last byte of that sequence is 00. | ||
1088 | */ | ||
1089 | if (actual_length == 12 && buf[actual_length - 1] == 1) | ||
1090 | break; | ||
1091 | |||
1092 | msleep(100); | ||
1093 | } | ||
1094 | |||
1095 | dev_info(&dev->dev, "MOTU MicroBook II ready\n"); | ||
1096 | |||
1097 | free_buf: | ||
1098 | kfree(buf); | ||
1099 | return err; | ||
1100 | } | ||
1101 | |||
1003 | /* | 1102 | /* |
1004 | * Setup quirks | 1103 | * Setup quirks |
1005 | */ | 1104 | */ |
@@ -1177,6 +1276,8 @@ int snd_usb_apply_boot_quirk(struct usb_device *dev, | |||
1177 | return snd_usb_gamecon780_boot_quirk(dev); | 1276 | return snd_usb_gamecon780_boot_quirk(dev); |
1178 | case USB_ID(0x2466, 0x8010): /* Fractal Audio Axe-Fx 3 */ | 1277 | case USB_ID(0x2466, 0x8010): /* Fractal Audio Axe-Fx 3 */ |
1179 | return snd_usb_axefx3_boot_quirk(dev); | 1278 | return snd_usb_axefx3_boot_quirk(dev); |
1279 | case USB_ID(0x07fd, 0x0004): /* MOTU MicroBook II */ | ||
1280 | return snd_usb_motu_microbookii_boot_quirk(dev); | ||
1180 | } | 1281 | } |
1181 | 1282 | ||
1182 | return 0; | 1283 | return 0; |
@@ -1479,10 +1580,6 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, | |||
1479 | /* XMOS based USB DACs */ | 1580 | /* XMOS based USB DACs */ |
1480 | switch (chip->usb_id) { | 1581 | switch (chip->usb_id) { |
1481 | case USB_ID(0x1511, 0x0037): /* AURALiC VEGA */ | 1582 | case USB_ID(0x1511, 0x0037): /* AURALiC VEGA */ |
1482 | case USB_ID(0x20b1, 0x0002): /* Wyred 4 Sound DAC-2 DSD */ | ||
1483 | case USB_ID(0x20b1, 0x2004): /* Matrix Audio X-SPDIF 2 */ | ||
1484 | case USB_ID(0x20b1, 0x2008): /* Matrix Audio X-Sabre */ | ||
1485 | case USB_ID(0x20b1, 0x300a): /* Matrix Audio Mini-i Pro */ | ||
1486 | case USB_ID(0x22d9, 0x0416): /* OPPO HA-1 */ | 1583 | case USB_ID(0x22d9, 0x0416): /* OPPO HA-1 */ |
1487 | case USB_ID(0x22d9, 0x0436): /* OPPO Sonica */ | 1584 | case USB_ID(0x22d9, 0x0436): /* OPPO Sonica */ |
1488 | case USB_ID(0x22d9, 0x0461): /* OPPO UDP-205 */ | 1585 | case USB_ID(0x22d9, 0x0461): /* OPPO UDP-205 */ |
@@ -1492,23 +1589,13 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, | |||
1492 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; | 1589 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; |
1493 | break; | 1590 | break; |
1494 | 1591 | ||
1495 | case USB_ID(0x10cb, 0x0103): /* The Bit Opus #3; with fp->dsd_raw */ | ||
1496 | case USB_ID(0x152a, 0x85de): /* SMSL D1 DAC */ | ||
1497 | case USB_ID(0x16d0, 0x09dd): /* Encore mDSD */ | ||
1498 | case USB_ID(0x0d8c, 0x0316): /* Hegel HD12 DSD */ | 1592 | case USB_ID(0x0d8c, 0x0316): /* Hegel HD12 DSD */ |
1593 | case USB_ID(0x10cb, 0x0103): /* The Bit Opus #3; with fp->dsd_raw */ | ||
1499 | case USB_ID(0x16b0, 0x06b2): /* NuPrime DAC-10 */ | 1594 | case USB_ID(0x16b0, 0x06b2): /* NuPrime DAC-10 */ |
1595 | case USB_ID(0x16d0, 0x09dd): /* Encore mDSD */ | ||
1500 | case USB_ID(0x16d0, 0x0733): /* Furutech ADL Stratos */ | 1596 | case USB_ID(0x16d0, 0x0733): /* Furutech ADL Stratos */ |
1501 | case USB_ID(0x16d0, 0x09db): /* NuPrime Audio DAC-9 */ | 1597 | case USB_ID(0x16d0, 0x09db): /* NuPrime Audio DAC-9 */ |
1502 | case USB_ID(0x1db5, 0x0003): /* Bryston BDA3 */ | 1598 | case USB_ID(0x1db5, 0x0003): /* Bryston BDA3 */ |
1503 | case USB_ID(0x20b1, 0x000a): /* Gustard DAC-X20U */ | ||
1504 | case USB_ID(0x20b1, 0x2005): /* Denafrips Ares DAC */ | ||
1505 | case USB_ID(0x20b1, 0x2009): /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */ | ||
1506 | case USB_ID(0x20b1, 0x2023): /* JLsounds I2SoverUSB */ | ||
1507 | case USB_ID(0x20b1, 0x3021): /* Eastern El. MiniMax Tube DAC Supreme */ | ||
1508 | case USB_ID(0x20b1, 0x3023): /* Aune X1S 32BIT/384 DSD DAC */ | ||
1509 | case USB_ID(0x20b1, 0x302d): /* Unison Research Unico CD Due */ | ||
1510 | case USB_ID(0x20b1, 0x307b): /* CH Precision C1 DAC */ | ||
1511 | case USB_ID(0x20b1, 0x3086): /* Singxer F-1 converter board */ | ||
1512 | case USB_ID(0x22d9, 0x0426): /* OPPO HA-2 */ | 1599 | case USB_ID(0x22d9, 0x0426): /* OPPO HA-2 */ |
1513 | case USB_ID(0x22e1, 0xca01): /* HDTA Serenade DSD */ | 1600 | case USB_ID(0x22e1, 0xca01): /* HDTA Serenade DSD */ |
1514 | case USB_ID(0x249c, 0x9326): /* M2Tech Young MkIII */ | 1601 | case USB_ID(0x249c, 0x9326): /* M2Tech Young MkIII */ |
diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c index b0f8979ff2d2..221adf68bd0c 100644 --- a/sound/usb/usx2y/usb_stream.c +++ b/sound/usb/usx2y/usb_stream.c | |||
@@ -104,7 +104,12 @@ static int init_urbs(struct usb_stream_kernel *sk, unsigned use_packsize, | |||
104 | 104 | ||
105 | for (u = 0; u < USB_STREAM_NURBS; ++u) { | 105 | for (u = 0; u < USB_STREAM_NURBS; ++u) { |
106 | sk->inurb[u] = usb_alloc_urb(sk->n_o_ps, GFP_KERNEL); | 106 | sk->inurb[u] = usb_alloc_urb(sk->n_o_ps, GFP_KERNEL); |
107 | if (!sk->inurb[u]) | ||
108 | return -ENOMEM; | ||
109 | |||
107 | sk->outurb[u] = usb_alloc_urb(sk->n_o_ps, GFP_KERNEL); | 110 | sk->outurb[u] = usb_alloc_urb(sk->n_o_ps, GFP_KERNEL); |
111 | if (!sk->outurb[u]) | ||
112 | return -ENOMEM; | ||
108 | } | 113 | } |
109 | 114 | ||
110 | if (init_pipe_urbs(sk, use_packsize, sk->inurb, indata, dev, in_pipe) || | 115 | if (init_pipe_urbs(sk, use_packsize, sk->inurb, indata, dev, in_pipe) || |
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index 2b833054e3b0..58974d094b27 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c | |||
@@ -981,18 +981,17 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, | |||
981 | 981 | ||
982 | sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usX2Y(card)->pcm_devs); | 982 | sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usX2Y(card)->pcm_devs); |
983 | 983 | ||
984 | if ((playback_endpoint && | 984 | if (playback_endpoint) { |
985 | 0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, | 985 | snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, |
986 | SNDRV_DMA_TYPE_CONTINUOUS, | 986 | SNDRV_DMA_TYPE_CONTINUOUS, |
987 | snd_dma_continuous_data(GFP_KERNEL), | 987 | snd_dma_continuous_data(GFP_KERNEL), |
988 | 64*1024, 128*1024))) || | 988 | 64*1024, 128*1024); |
989 | 0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, | ||
990 | SNDRV_DMA_TYPE_CONTINUOUS, | ||
991 | snd_dma_continuous_data(GFP_KERNEL), | ||
992 | 64*1024, 128*1024))) { | ||
993 | snd_usX2Y_pcm_private_free(pcm); | ||
994 | return err; | ||
995 | } | 989 | } |
990 | |||
991 | snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, | ||
992 | SNDRV_DMA_TYPE_CONTINUOUS, | ||
993 | snd_dma_continuous_data(GFP_KERNEL), | ||
994 | 64*1024, 128*1024); | ||
996 | usX2Y(card)->pcm_devs++; | 995 | usX2Y(card)->pcm_devs++; |
997 | 996 | ||
998 | return 0; | 997 | return 0; |
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index 4fd9276b8e50..714cf50d4a4c 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c | |||
@@ -736,17 +736,14 @@ int usX2Y_hwdep_pcm_new(struct snd_card *card) | |||
736 | pcm->info_flags = 0; | 736 | pcm->info_flags = 0; |
737 | 737 | ||
738 | sprintf(pcm->name, NAME_ALLCAPS" hwdep Audio"); | 738 | sprintf(pcm->name, NAME_ALLCAPS" hwdep Audio"); |
739 | if (0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, | 739 | snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, |
740 | SNDRV_DMA_TYPE_CONTINUOUS, | 740 | SNDRV_DMA_TYPE_CONTINUOUS, |
741 | snd_dma_continuous_data(GFP_KERNEL), | 741 | snd_dma_continuous_data(GFP_KERNEL), |
742 | 64*1024, 128*1024)) || | 742 | 64*1024, 128*1024); |
743 | 0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, | 743 | snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, |
744 | SNDRV_DMA_TYPE_CONTINUOUS, | 744 | SNDRV_DMA_TYPE_CONTINUOUS, |
745 | snd_dma_continuous_data(GFP_KERNEL), | 745 | snd_dma_continuous_data(GFP_KERNEL), |
746 | 64*1024, 128*1024))) { | 746 | 64*1024, 128*1024); |
747 | return err; | ||
748 | } | ||
749 | |||
750 | 747 | ||
751 | return 0; | 748 | return 0; |
752 | } | 749 | } |
diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c index 00c92eb854ce..80f79ecffc71 100644 --- a/sound/x86/intel_hdmi_audio.c +++ b/sound/x86/intel_hdmi_audio.c | |||
@@ -1651,18 +1651,6 @@ static int had_create_jack(struct snd_intelhad *ctx, | |||
1651 | static int __maybe_unused hdmi_lpe_audio_suspend(struct device *dev) | 1651 | static int __maybe_unused hdmi_lpe_audio_suspend(struct device *dev) |
1652 | { | 1652 | { |
1653 | struct snd_intelhad_card *card_ctx = dev_get_drvdata(dev); | 1653 | struct snd_intelhad_card *card_ctx = dev_get_drvdata(dev); |
1654 | int port; | ||
1655 | |||
1656 | for_each_port(card_ctx, port) { | ||
1657 | struct snd_intelhad *ctx = &card_ctx->pcm_ctx[port]; | ||
1658 | struct snd_pcm_substream *substream; | ||
1659 | |||
1660 | substream = had_substream_get(ctx); | ||
1661 | if (substream) { | ||
1662 | snd_pcm_suspend(substream); | ||
1663 | had_substream_put(ctx); | ||
1664 | } | ||
1665 | } | ||
1666 | 1654 | ||
1667 | snd_power_change_state(card_ctx->card, SNDRV_CTL_POWER_D3hot); | 1655 | snd_power_change_state(card_ctx->card, SNDRV_CTL_POWER_D3hot); |
1668 | 1656 | ||
@@ -1824,7 +1812,8 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev) | |||
1824 | * try to allocate 600k buffer as default which is large enough | 1812 | * try to allocate 600k buffer as default which is large enough |
1825 | */ | 1813 | */ |
1826 | snd_pcm_lib_preallocate_pages_for_all(pcm, | 1814 | snd_pcm_lib_preallocate_pages_for_all(pcm, |
1827 | SNDRV_DMA_TYPE_DEV_UC, NULL, | 1815 | SNDRV_DMA_TYPE_DEV_UC, |
1816 | card->dev, | ||
1828 | HAD_DEFAULT_BUFFER, HAD_MAX_BUFFER); | 1817 | HAD_DEFAULT_BUFFER, HAD_MAX_BUFFER); |
1829 | 1818 | ||
1830 | /* create controls */ | 1819 | /* create controls */ |