From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7583C43387 for ; Wed, 19 Dec 2018 13:51:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB19321841 for ; Wed, 19 Dec 2018 13:51:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728438AbeLSNvg (ORCPT ); Wed, 19 Dec 2018 08:51:36 -0500 Received: from mx2.suse.de ([195.135.220.15]:60144 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726555AbeLSNvg (ORCPT ); Wed, 19 Dec 2018 08:51:36 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 38F2BAF7B; Wed, 19 Dec 2018 13:51:34 +0000 (UTC) Date: Wed, 19 Dec 2018 14:51:33 +0100 Message-ID: From: Takashi Iwai To: shuah@kernel.org Cc: mchehab@kernel.org, perex@perex.cz, tiwai@suse.com, hverkuil@xs4all.nl, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: Re: [alsa-devel] [PATCH v9 4/4] sound/usb: Use Media Controller API to share media resources In-Reply-To: <2fb40852e4035b2a58010ce7416448918f12804f.1545154778.git.shuah@kernel.org> References: <2fb40852e4035b2a58010ce7416448918f12804f.1545154778.git.shuah@kernel.org> 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/26 (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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 18 Dec 2018 18:59:39 +0100, shuah@kernel.org wrote: > > From: Shuah Khan > > Media Device Allocator API to allows multiple drivers share a media device. > This API solves a very common use-case for media devices where one physical > device (an USB stick) provides both audio and video. When such media device > exposes a standard USB Audio class, a proprietary Video class, two or more > independent drivers will share a single physical USB bridge. In such cases, > it is necessary to coordinate access to the shared resource. > > Using this API, drivers can allocate a media device with the shared struct > device as the key. Once the media device is allocated by a driver, other > drivers can get a reference to it. The media device is released when all > the references are released. > > Change the ALSA driver to use the Media Controller API to share media > resources with DVB, and V4L2 drivers on a AU0828 media device. > > The 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 Feel free to take my ack regarding the sound stuff: Reviewed-by: Takashi Iwai Thanks! Takashi