From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423234AbcBZUuW (ORCPT ); Fri, 26 Feb 2016 15:50:22 -0500 Received: from mx2.suse.de ([195.135.220.15]:35723 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422625AbcBZUuU (ORCPT ); Fri, 26 Feb 2016 15:50:20 -0500 Date: Fri, 26 Feb 2016 21:50:11 +0100 Message-ID: From: Takashi Iwai To: Shuah Khan Cc: hans.verkuil@cisco.com, laurent.pinchart@ideasonboard.com, clemens@ladisch.de, sakari.ailus@linux.intel.com, javier@osg.samsung.com, mchehab@osg.samsung.com, geliangtang@163.com, alsa-devel@alsa-project.org, arnd@arndb.de, ricard.wanderlof@axis.com, labbott@fedoraproject.org, chehabrafael@gmail.com, klock.android@gmail.com, misterpib@gmail.com, prabhakar.csengg@gmail.com, ricardo.ribalda@gmail.com, ruchandani.tina@gmail.com, takamichiho@gmail.com, tvboxspy@gmail.com, dominic.sacre@gmx.de, albert@huitsing.nl, crope@iki.fi, julian@jusst.de, pierre-louis.bossart@linux.intel.com, corbet@lwn.net, joe@oampo.co.uk, johan@oljud.se, dan.carpenter@oracle.com, pawel@osciak.com, p.zabel@pengutronix.de, perex@perex.cz, stefanr@s5r6.in-berlin.de, inki.dae@samsung.com, j.anaszewski@samsung.com, jh1009.sung@samsung.com, k.kozlowski@samsung.com, kyungmin.park@samsung.com, m.szyprowski@samsung.com, nenggun.kim@samsung.com, sw0312.kim@samsung.com, elfring@users.sourceforge.net, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linuxbugs@vittgam.net, gtmkramer@xs4all.nl, normalperson@yhbt.net, daniel@zonque.org Subject: Re: [PATCH v3 22/22] sound/usb: Use Media Controller API to share media resources In-Reply-To: <56D0B0CB.8060709@osg.samsung.com> References: <0822f80e0acc5119e6f6deccf002ccadeb3b145b.1455233156.git.shuahkh@osg.samsung.com> <56D0B0CB.8060709@osg.samsung.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 26 Feb 2016 21:08:43 +0100, Shuah Khan wrote: > > On 02/26/2016 12:55 PM, Takashi Iwai wrote: > > On Fri, 12 Feb 2016 00:41:38 +0100, > > Shuah Khan wrote: > >> > >> 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 > >> --- > >> sound/usb/Kconfig | 4 + > >> sound/usb/Makefile | 2 + > >> sound/usb/card.c | 14 +++ > >> sound/usb/card.h | 3 + > >> sound/usb/media.c | 318 +++++++++++++++++++++++++++++++++++++++++++++++ > >> sound/usb/media.h | 72 +++++++++++ > >> sound/usb/mixer.h | 3 + > >> sound/usb/pcm.c | 28 ++++- > >> sound/usb/quirks-table.h | 1 + > >> sound/usb/stream.c | 2 + > >> sound/usb/usbaudio.h | 6 + > >> 11 files changed, 448 insertions(+), 5 deletions(-) > >> create mode 100644 sound/usb/media.c > >> create mode 100644 sound/usb/media.h > >> > >> diff --git a/sound/usb/Kconfig b/sound/usb/Kconfig > >> index a452ad7..ba117f5 100644 > >> --- a/sound/usb/Kconfig > >> +++ b/sound/usb/Kconfig > >> @@ -15,6 +15,7 @@ config SND_USB_AUDIO > >> select SND_RAWMIDI > >> select SND_PCM > >> select BITREVERSE > >> + select SND_USB_AUDIO_USE_MEDIA_CONTROLLER if MEDIA_CONTROLLER && MEDIA_SUPPORT > > > > Looking at the media Kconfig again, this would be broken if > > MEDIA_SUPPORT=m and SND_USB_AUDIO=y. The ugly workaround is something > > like: > > select SND_USB_AUDIO_USE_MEDIA_CONTROLLER \ > > if MEDIA_CONTROLLER && (MEDIA_SUPPORT=y || MEDIA_SUPPORT=SND) > > My current config is MEDIA_SUPPORT=m and SND_USB_AUDIO=y > It is working and I didn't see any issues so far. Hmm, how does it be? In drivers/media/Makefile: ifeq ($(CONFIG_MEDIA_CONTROLLER),y) obj-$(CONFIG_MEDIA_SUPPORT) += media.o endif So it's a module. Meanwhile you have reference from usb-audio driver that is built-in kernel. How is the symbol resolved? > Maybe > the current change is good. I am hoping kbuild-bot can > find issues (if any) once it gets merged. > > > > > Other than that, it looks more or less OK to me. > > The way how media_stream_init() gets called is a bit worrisome, but it > > should work practically. Another concern is about the disconnection. > > Can all function calls in media_device_delete() be safe even if it's > > called while the application still opens the MC device? > > Right. I have been looking into device removal path when > ioctls are active and I can resolve any issues that might > surface while an audio app is active when device is removed. So, it's 100% safe to call all these media_*() functions while the device is being accessed before closing? Takashi