summaryrefslogtreecommitdiff
path: root/sound/usb/card.c
diff options
context:
space:
mode:
authorShuah Khan <shuahkh@osg.samsung.com>2016-03-02 19:50:31 +0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-03-03 21:01:13 +0300
commitaebb2b89bff0fdeb4e7ddd73dcbccde1a0f27554 (patch)
treeaad7f1862beb01250032ac02d46d1dac11ccaa18 /sound/usb/card.c
parent6ede20f9683c55dac8281b63d80b5cc669640252 (diff)
downloadlinux-aebb2b89bff0fdeb4e7ddd73dcbccde1a0f27554.tar.xz
[media] sound/usb: Use Media Controller API to share media resources
Change ALSA driver to use Media Controller API to share media resources with DVB and V4L2 drivers on a AU0828 media device. Media Controller specific initialization is done after sound card is registered. ALSA creates Media interface and entity function graph nodes for Control, Mixer, PCM Playback, and PCM Capture devices. snd_usb_hw_params() will call Media Controller enable source handler interface to request the media resource. If resource request is granted, it will release it from snd_usb_hw_free(). If resource is busy, -EBUSY is returned. Media specific cleanup is done in usb_audio_disconnect(). Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Acked-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'sound/usb/card.c')
-rw-r--r--sound/usb/card.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 1f09d9591276..258cf7015ce2 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -66,6 +66,7 @@
#include "format.h"
#include "power.h"
#include "stream.h"
+#include "media.h"
MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
MODULE_DESCRIPTION("USB Audio");
@@ -561,6 +562,11 @@ static int usb_audio_probe(struct usb_interface *intf,
if (err < 0)
goto __error;
+ if (quirk->media_device) {
+ /* don't want to fail when media_snd_device_create() fails */
+ media_snd_device_create(chip, intf);
+ }
+
usb_chip[chip->index] = chip;
chip->num_interfaces++;
usb_set_intfdata(intf, chip);
@@ -617,6 +623,14 @@ static void usb_audio_disconnect(struct usb_interface *intf)
list_for_each(p, &chip->midi_list) {
snd_usbmidi_disconnect(p);
}
+ /*
+ * Nice to check quirk && quirk->media_device
+ * need some special handlings. Doesn't look like
+ * we have access to quirk here
+ * Acceses mixer_list
+ */
+ media_snd_device_delete(chip);
+
/* release mixer resources */
list_for_each_entry(mixer, &chip->mixer_list, list) {
snd_usb_mixer_disconnect(mixer);