diff options
-rw-r--r-- | include/sound/pcm.h | 2 | ||||
-rw-r--r-- | sound/aoa/soundbus/i2sbus/pcm.c | 5 | ||||
-rw-r--r-- | sound/core/pcm.c | 38 | ||||
-rw-r--r-- | sound/pci/hda/hda_controller.c | 3 | ||||
-rw-r--r-- | sound/soc/intel/sst-mfld-platform-pcm.c | 1 |
5 files changed, 22 insertions, 27 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index b429b73e875e..735bd0cc7347 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -449,6 +449,7 @@ struct snd_pcm_str { | |||
449 | #endif | 449 | #endif |
450 | #endif | 450 | #endif |
451 | struct snd_kcontrol *chmap_kctl; /* channel-mapping controls */ | 451 | struct snd_kcontrol *chmap_kctl; /* channel-mapping controls */ |
452 | struct device dev; | ||
452 | }; | 453 | }; |
453 | 454 | ||
454 | struct snd_pcm { | 455 | struct snd_pcm { |
@@ -465,7 +466,6 @@ struct snd_pcm { | |||
465 | wait_queue_head_t open_wait; | 466 | wait_queue_head_t open_wait; |
466 | void *private_data; | 467 | void *private_data; |
467 | void (*private_free) (struct snd_pcm *pcm); | 468 | void (*private_free) (struct snd_pcm *pcm); |
468 | struct device *dev; /* actual hw device this belongs to */ | ||
469 | bool internal; /* pcm is for internal use only */ | 469 | bool internal; /* pcm is for internal use only */ |
470 | bool nonatomic; /* whole PCM operations are in non-atomic context */ | 470 | bool nonatomic; /* whole PCM operations are in non-atomic context */ |
471 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | 471 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) |
diff --git a/sound/aoa/soundbus/i2sbus/pcm.c b/sound/aoa/soundbus/i2sbus/pcm.c index 7b74a4ba75f8..a02b7b8d3532 100644 --- a/sound/aoa/soundbus/i2sbus/pcm.c +++ b/sound/aoa/soundbus/i2sbus/pcm.c | |||
@@ -968,7 +968,6 @@ i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card, | |||
968 | printk(KERN_DEBUG "i2sbus: failed to create pcm\n"); | 968 | printk(KERN_DEBUG "i2sbus: failed to create pcm\n"); |
969 | goto out_put_ci_module; | 969 | goto out_put_ci_module; |
970 | } | 970 | } |
971 | dev->pcm->dev = &dev->ofdev.dev; | ||
972 | } | 971 | } |
973 | 972 | ||
974 | /* ALSA yet again sucks. | 973 | /* ALSA yet again sucks. |
@@ -988,6 +987,8 @@ i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card, | |||
988 | goto out_put_ci_module; | 987 | goto out_put_ci_module; |
989 | snd_pcm_set_ops(dev->pcm, SNDRV_PCM_STREAM_PLAYBACK, | 988 | snd_pcm_set_ops(dev->pcm, SNDRV_PCM_STREAM_PLAYBACK, |
990 | &i2sbus_playback_ops); | 989 | &i2sbus_playback_ops); |
990 | dev->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].dev.parent = | ||
991 | &dev->ofdev.dev; | ||
991 | i2sdev->out.created = 1; | 992 | i2sdev->out.created = 1; |
992 | } | 993 | } |
993 | 994 | ||
@@ -1003,6 +1004,8 @@ i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card, | |||
1003 | goto out_put_ci_module; | 1004 | goto out_put_ci_module; |
1004 | snd_pcm_set_ops(dev->pcm, SNDRV_PCM_STREAM_CAPTURE, | 1005 | snd_pcm_set_ops(dev->pcm, SNDRV_PCM_STREAM_CAPTURE, |
1005 | &i2sbus_record_ops); | 1006 | &i2sbus_record_ops); |
1007 | dev->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].dev.parent = | ||
1008 | &dev->ofdev.dev; | ||
1006 | i2sdev->in.created = 1; | 1009 | i2sdev->in.created = 1; |
1007 | } | 1010 | } |
1008 | 1011 | ||
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 1b7c473720fa..4d5120f7a8ab 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -673,6 +673,8 @@ static inline int snd_pcm_substream_proc_init(struct snd_pcm_substream *substrea | |||
673 | static inline int snd_pcm_substream_proc_done(struct snd_pcm_substream *substream) { return 0; } | 673 | static inline int snd_pcm_substream_proc_done(struct snd_pcm_substream *substream) { return 0; } |
674 | #endif /* CONFIG_SND_VERBOSE_PROCFS */ | 674 | #endif /* CONFIG_SND_VERBOSE_PROCFS */ |
675 | 675 | ||
676 | static const struct attribute_group *pcm_dev_attr_groups[]; | ||
677 | |||
676 | /** | 678 | /** |
677 | * snd_pcm_new_stream - create a new PCM stream | 679 | * snd_pcm_new_stream - create a new PCM stream |
678 | * @pcm: the pcm instance | 680 | * @pcm: the pcm instance |
@@ -698,7 +700,15 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) | |||
698 | pstr->stream = stream; | 700 | pstr->stream = stream; |
699 | pstr->pcm = pcm; | 701 | pstr->pcm = pcm; |
700 | pstr->substream_count = substream_count; | 702 | pstr->substream_count = substream_count; |
701 | if (substream_count > 0 && !pcm->internal) { | 703 | if (!substream_count) |
704 | return 0; | ||
705 | |||
706 | snd_device_initialize(&pstr->dev, pcm->card); | ||
707 | pstr->dev.groups = pcm_dev_attr_groups; | ||
708 | dev_set_name(&pstr->dev, "pcmC%iD%i%c", pcm->card->number, pcm->device, | ||
709 | stream == SNDRV_PCM_STREAM_PLAYBACK ? 'p' : 'c'); | ||
710 | |||
711 | if (!pcm->internal) { | ||
702 | err = snd_pcm_stream_proc_init(pstr); | 712 | err = snd_pcm_stream_proc_init(pstr); |
703 | if (err < 0) { | 713 | if (err < 0) { |
704 | pcm_err(pcm, "Error in snd_pcm_stream_proc_init\n"); | 714 | pcm_err(pcm, "Error in snd_pcm_stream_proc_init\n"); |
@@ -868,6 +878,8 @@ static void snd_pcm_free_stream(struct snd_pcm_str * pstr) | |||
868 | kfree(setup); | 878 | kfree(setup); |
869 | } | 879 | } |
870 | #endif | 880 | #endif |
881 | if (pstr->substream_count) | ||
882 | put_device(&pstr->dev); | ||
871 | } | 883 | } |
872 | 884 | ||
873 | static int snd_pcm_free(struct snd_pcm *pcm) | 885 | static int snd_pcm_free(struct snd_pcm *pcm) |
@@ -1069,9 +1081,7 @@ static int snd_pcm_dev_register(struct snd_device *device) | |||
1069 | int cidx, err; | 1081 | int cidx, err; |
1070 | struct snd_pcm_substream *substream; | 1082 | struct snd_pcm_substream *substream; |
1071 | struct snd_pcm_notify *notify; | 1083 | struct snd_pcm_notify *notify; |
1072 | char str[16]; | ||
1073 | struct snd_pcm *pcm; | 1084 | struct snd_pcm *pcm; |
1074 | struct device *dev; | ||
1075 | 1085 | ||
1076 | if (snd_BUG_ON(!device || !device->device_data)) | 1086 | if (snd_BUG_ON(!device || !device->device_data)) |
1077 | return -ENXIO; | 1087 | return -ENXIO; |
@@ -1088,42 +1098,24 @@ static int snd_pcm_dev_register(struct snd_device *device) | |||
1088 | continue; | 1098 | continue; |
1089 | switch (cidx) { | 1099 | switch (cidx) { |
1090 | case SNDRV_PCM_STREAM_PLAYBACK: | 1100 | case SNDRV_PCM_STREAM_PLAYBACK: |
1091 | sprintf(str, "pcmC%iD%ip", pcm->card->number, pcm->device); | ||
1092 | devtype = SNDRV_DEVICE_TYPE_PCM_PLAYBACK; | 1101 | devtype = SNDRV_DEVICE_TYPE_PCM_PLAYBACK; |
1093 | break; | 1102 | break; |
1094 | case SNDRV_PCM_STREAM_CAPTURE: | 1103 | case SNDRV_PCM_STREAM_CAPTURE: |
1095 | sprintf(str, "pcmC%iD%ic", pcm->card->number, pcm->device); | ||
1096 | devtype = SNDRV_DEVICE_TYPE_PCM_CAPTURE; | 1104 | devtype = SNDRV_DEVICE_TYPE_PCM_CAPTURE; |
1097 | break; | 1105 | break; |
1098 | } | 1106 | } |
1099 | /* device pointer to use, pcm->dev takes precedence if | ||
1100 | * it is assigned, otherwise fall back to card's device | ||
1101 | * if possible */ | ||
1102 | dev = pcm->dev; | ||
1103 | if (!dev) | ||
1104 | dev = snd_card_get_device_link(pcm->card); | ||
1105 | /* register pcm */ | 1107 | /* register pcm */ |
1106 | err = snd_register_device_for_dev(devtype, pcm->card, | 1108 | err = snd_register_device_for_dev(devtype, pcm->card, |
1107 | pcm->device, | 1109 | pcm->device, |
1108 | &snd_pcm_f_ops[cidx], | 1110 | &snd_pcm_f_ops[cidx], |
1109 | pcm, NULL, dev, str); | 1111 | pcm, &pcm->streams[cidx].dev, |
1112 | NULL, NULL); | ||
1110 | if (err < 0) { | 1113 | if (err < 0) { |
1111 | list_del(&pcm->list); | 1114 | list_del(&pcm->list); |
1112 | mutex_unlock(®ister_mutex); | 1115 | mutex_unlock(®ister_mutex); |
1113 | return err; | 1116 | return err; |
1114 | } | 1117 | } |
1115 | 1118 | ||
1116 | dev = snd_get_device(devtype, pcm->card, pcm->device); | ||
1117 | if (dev) { | ||
1118 | err = sysfs_create_groups(&dev->kobj, | ||
1119 | pcm_dev_attr_groups); | ||
1120 | if (err < 0) | ||
1121 | dev_warn(dev, | ||
1122 | "pcm %d:%d: cannot create sysfs groups\n", | ||
1123 | pcm->card->number, pcm->device); | ||
1124 | put_device(dev); | ||
1125 | } | ||
1126 | |||
1127 | for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) | 1119 | for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) |
1128 | snd_pcm_timer_init(substream); | 1120 | snd_pcm_timer_init(substream); |
1129 | } | 1121 | } |
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index 0cfc9c8c4b4e..712ec5ceba46 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c | |||
@@ -939,7 +939,8 @@ static int azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec, | |||
939 | chip->card->dev, | 939 | chip->card->dev, |
940 | size, MAX_PREALLOC_SIZE); | 940 | size, MAX_PREALLOC_SIZE); |
941 | /* link to codec */ | 941 | /* link to codec */ |
942 | pcm->dev = &codec->dev; | 942 | for (s = 0; s < 2; s++) |
943 | pcm->streams[s].dev.parent = &codec->dev; | ||
943 | return 0; | 944 | return 0; |
944 | } | 945 | } |
945 | 946 | ||
diff --git a/sound/soc/intel/sst-mfld-platform-pcm.c b/sound/soc/intel/sst-mfld-platform-pcm.c index a1a8d9d91539..2d80c4e12997 100644 --- a/sound/soc/intel/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/sst-mfld-platform-pcm.c | |||
@@ -645,7 +645,6 @@ static struct snd_pcm_ops sst_platform_ops = { | |||
645 | 645 | ||
646 | static void sst_pcm_free(struct snd_pcm *pcm) | 646 | static void sst_pcm_free(struct snd_pcm *pcm) |
647 | { | 647 | { |
648 | dev_dbg(pcm->dev, "sst_pcm_free called\n"); | ||
649 | snd_pcm_lib_preallocate_free_for_all(pcm); | 648 | snd_pcm_lib_preallocate_free_for_all(pcm); |
650 | } | 649 | } |
651 | 650 | ||