Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2202604pxb; Fri, 25 Mar 2022 12:58:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQ7dkDX0gX2mRVSrsvYgAgyymPSeoPlcFzqXxtFi+aHyu161bSXd6nOsiCE4N/kIm1hMZk X-Received: by 2002:a17:902:ea52:b0:153:fd04:c158 with SMTP id r18-20020a170902ea5200b00153fd04c158mr13282430plg.83.1648238310271; Fri, 25 Mar 2022 12:58:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648238310; cv=none; d=google.com; s=arc-20160816; b=n2V1UUNHY7zYIfbmciEQrNOtApgjNDQ9MaYHSUFccO6dO7jEb9lTMPL+D18isvuNu4 ZGSyzKlQ4GrKlY6DNuHoIPCXgylO9wYtNr2AAsOVMopSDQuZfFBrDFWINWJY1v9cnGPW xtoYG2R3PnRmgXoX7aV/tVaL0zWidqhq0QGiHhG/HNVufI0LJq9k50otKPoIbEm+52Dd wTwYnVkyAKsbhKQRrFHg94CNKfTa29gZAfkpcfWVcrMaBpc65ncuKXxHyX9BnubrtrFJ DLE8Uwh+yUgw8wzcLV7I6v8Td2k/6j7sxkqbyoFS9dy4b/I78aUt6+auDE6xZ7jsNmWJ JJUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5yrMIvYqmOPyc0ld0NhN6BmCzCvqZ3B+GQ3+lJ6ZtQQ=; b=UGNWb1CEvwa4gtFfAiIj1PEshml57WwPPMct/R9BN388qcasW/k8tDNCKZrVM17pkh mB5NjTS6lqmDIqx63lJvRtJvqC3PeQuTvOcKNp+kQBcG+KqZ6+736P9eJKBKW9rAjXLI 4U88IKGzVI97PItyo7KuzKhyboEA/ReSocl10W9f/oOKj6VTbhnNsMr6UYOFrIZW3Gny 88fXKEiNHYffGB1dvRK+BnA+FjzZK6q8uOsRXkK6V9W3e4/x5p5gbIYlobZSzs7rnUtw hvHHseigfthavzBkUVFoZCI3pUlgFZHf7MkKbq8N8ctHBU98UcqaUOcijzh6ost+Vnks B3iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dyNJAOkF; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id me13-20020a17090b17cd00b001c5c6abfe10si7637078pjb.12.2022.03.25.12.58.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 12:58:30 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dyNJAOkF; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 01C7434A134; Fri, 25 Mar 2022 11:47:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347523AbiCYGxP (ORCPT + 99 others); Fri, 25 Mar 2022 02:53:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239394AbiCYGxO (ORCPT ); Fri, 25 Mar 2022 02:53:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4235BC6ED8 for ; Thu, 24 Mar 2022 23:51:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 99A33B82702 for ; Fri, 25 Mar 2022 06:51:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0694C340E9; Fri, 25 Mar 2022 06:51:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1648191098; bh=iOYpW2r2TXPqYZsJm7XlKET/eYtmrwsybPJRWJcX5Eo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dyNJAOkFhqdJrVuMz+RCt+j0OsF0YEmx3HK+SvsMrHLc7GNimjO3aOR/Nv7bfcvI+ Tf3gN06hkmlp2Vp0/wwI6/KHpAhge/rgJAZnp7AsjWpdNk9tX8ViOi2sz+3lbXuNq6 3lgWYI2lSwTAvnQo3qzpLMnNj+9JR9UEiTJJxUKA= Date: Fri, 25 Mar 2022 07:51:35 +0100 From: Greg Kroah-Hartman To: Oh Eomji Cc: Jaroslav Kysela , Takashi Iwai , open list , alsa-devel@alsa-project.org, Leon Romanovsky , Pavel Skripkin , JaeHun Jung Subject: Re: [PATCH v1 1/3] sound: usb: Add vendor's hooking interface Message-ID: References: <1648109444-196321-1-git-send-email-eomji.oh@samsung.com> <1648109444-196321-2-git-send-email-eomji.oh@samsung.com> <20220325064413.GA123495@ubuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220325064413.GA123495@ubuntu> X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 25, 2022 at 03:44:13PM +0900, Oh Eomji wrote: > On Thu, Mar 24, 2022 at 09:33:40AM +0100, Greg Kroah-Hartman wrote: > > On Thu, Mar 24, 2022 at 05:10:42PM +0900, Oh Eomji wrote: > > > In mobile, a co-processor can be used with USB audio to improve power > > > consumption. To support this type of hardware, hooks need to be added > > > to the USB audio subsystem to be able to call into the hardware when > > > needed. > > > > > > The main operation of the call-backs are: > > > - Initialize the co-processor by transmitting data when initializing. > > > - Change the co-processor setting value through the interface > > > function. > > > - Configure sampling rate > > > - pcm open/close > > > - other housekeeping > > > > > > Known issues: > > > - This only supports one set of callback hooks, meaning that this only > > > works if there is one type of USB controller in the system. This > > > should be changed to be a per-host-controller interface instead of > > > one global set of callbacks. > > > > > > Signed-off-by: JaeHun Jung > > > Signed-off-by: Oh Eomji > > > --- > > > sound/usb/card.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++ > > > sound/usb/card.h | 20 +++++++++ > > > sound/usb/usbaudio.h | 45 +++++++++++++++++++ > > > 3 files changed, 184 insertions(+) > > > > > > diff --git a/sound/usb/card.c b/sound/usb/card.c > > > index 3769622..bd59311 100644 > > > --- a/sound/usb/card.c > > > +++ b/sound/usb/card.c > > > @@ -117,6 +117,117 @@ MODULE_PARM_DESC(skip_validation, "Skip unit descriptor validation (default: no) > > > static DEFINE_MUTEX(register_mutex); > > > static struct snd_usb_audio *usb_chip[SNDRV_CARDS]; > > > static struct usb_driver usb_audio_driver; > > > +static struct snd_usb_audio_vendor_ops *usb_vendor_ops; > > > + > > > +int snd_vendor_set_ops(struct snd_usb_audio_vendor_ops *ops) > > > +{ > > > + if ((!ops->connect) || > > > + (!ops->disconnect) || > > > + (!ops->set_interface) || > > > + (!ops->set_rate) || > > > + (!ops->set_pcm_buf) || > > > + (!ops->set_pcm_intf) || > > > + (!ops->set_pcm_connection) || > > > + (!ops->set_pcm_binterval) || > > > + (!ops->usb_add_ctls)) > > > + return -EINVAL; > > > + > > > + usb_vendor_ops = ops; > > > + return 0; > > > +} > > > +EXPORT_SYMBOL_GPL(snd_vendor_set_ops); > > > + > > > +struct snd_usb_audio_vendor_ops *snd_vendor_get_ops(void) > > > +{ > > > + return usb_vendor_ops; > > > +} > > > > This is the function you need to fix up, and add proper reference > > counting to, in order to solve your "this breaks with multiple USB > > controllers" problem. So this really should not be all that difficult > > of a task. Why has it taken years to do so? > > > > thanks, > > > > greg k-h > > > Hi, > > Is that mean the scenario when two or more usb audio devices are > connected through the hub? I have no idea, it's your hardware and code to test, not mine :) greg k-h