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 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D65BACDB482 for ; Tue, 17 Oct 2023 23:28:45 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1E21E1D7; Wed, 18 Oct 2023 01:27:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1E21E1D7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1697585324; bh=7I1Y4nnQBV4/2CN7n+iQSuwae/PdMJVhORVRJRUVvoo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=b+uPF5MdJW/12RIh6Oz+kr3Wuiq6tkAR9TeB6x49jkQthwOO3MorH6rqk+kX2QGaj ikHkwbv0IB1no2w1hJ/7RwUwaYklOUrK4btQstQHXN8R5XtW3AKV/tyVdHTacZ2q6U e7GXdsb1fS4mBJrZDIksucc4VUjF6A7KT/HmYZhI= Received: by alsa1.perex.cz (Postfix, from userid 50401) id DF710F80624; Wed, 18 Oct 2023 01:24:17 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 319E0F80619; Wed, 18 Oct 2023 01:24:17 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 29C96F8061D; Wed, 18 Oct 2023 01:24:14 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3718FF80536 for ; Wed, 18 Oct 2023 01:23:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3718FF80536 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Iyp9sWGd DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697585003; x=1729121003; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=7I1Y4nnQBV4/2CN7n+iQSuwae/PdMJVhORVRJRUVvoo=; b=Iyp9sWGdXDBksgoSbkDsug92Lj123wk+91uuXYo//580shLl2BiBmWvV ToM681qSMsWzyJkm8xX6anxggnqm+Kh7b29CE0np8UB8I5ZZh2qvJndcF gZ9coMd/X6GyBrSFmq5Xu/yOUjjfjw9rF5Q6JoEjD7yBp3m5timlomq5s dR0LasS/XcWPVMCe1nApKW/aq5YjdbEu/qb8tGqyd7jcGIR+YqCv2m/Ek DbxXnGPv/7Ho9OxUe0fy3i20t3nz/RJkjrYe09cNkZ1CBuGrWBNA4tWXP Hn2a1H1KyEEC++7G2WJlM8logPRMC+UsvrwveRdEm6wlCKhE6D9+EeQm4 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="384778120" X-IronPort-AV: E=Sophos;i="6.03,233,1694761200"; d="scan'208";a="384778120" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2023 16:23:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="826637471" X-IronPort-AV: E=Sophos;i="6.03,233,1694761200"; d="scan'208";a="826637471" Received: from asprado-mobl2.amr.corp.intel.com (HELO [10.212.55.179]) ([10.212.55.179]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2023 16:23:18 -0700 Message-ID: Date: Tue, 17 Oct 2023 17:33:25 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 21/34] ASoC: usb: Add PCM format check API for USB backend Content-Language: en-US To: Wesley Cheng , mathias.nyman@intel.com, gregkh@linuxfoundation.org, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, srinivas.kandagatla@linaro.org, bgoswami@quicinc.com, Thinh.Nguyen@synopsys.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org References: <20231017200109.11407-1-quic_wcheng@quicinc.com> <20231017200109.11407-22-quic_wcheng@quicinc.com> From: Pierre-Louis Bossart In-Reply-To: <20231017200109.11407-22-quic_wcheng@quicinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Message-ID-Hash: CKWTCFZDL5UTA34CTFMY6YSF2D37T6RR X-Message-ID-Hash: CKWTCFZDL5UTA34CTFMY6YSF2D37T6RR X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 10/17/23 15:00, Wesley Cheng wrote: > Introduce a check for if a particular PCM format is supported by the USB Introduce a helper to check if a ... > audio device connected. If the USB audio device does not have an audio > profile which can support the requested format, then notify the USB > backend. > > Signed-off-by: Wesley Cheng > --- > include/sound/soc-usb.h | 3 +++ > sound/soc/soc-usb.c | 13 +++++++++++++ > 2 files changed, 16 insertions(+) > > diff --git a/include/sound/soc-usb.h b/include/sound/soc-usb.h > index 58c686f4f7ba..c6ddc055c4cd 100644 > --- a/include/sound/soc-usb.h > +++ b/include/sound/soc-usb.h > @@ -37,6 +37,9 @@ struct snd_soc_usb { > void *priv_data; > }; > > +int snd_soc_usb_find_format(int card_idx, struct snd_pcm_hw_params *params, > + int direction); > + > int snd_soc_usb_connect(struct device *usbdev, struct snd_soc_usb_device *sdev); > int snd_soc_usb_disconnect(struct device *usbdev, struct snd_soc_usb_device *sdev); > void *snd_soc_usb_find_priv_data(struct device *usbdev); > diff --git a/sound/soc/soc-usb.c b/sound/soc/soc-usb.c > index 73b1bcc3b506..7407678a993e 100644 > --- a/sound/soc/soc-usb.c > +++ b/sound/soc/soc-usb.c > @@ -63,6 +63,19 @@ void *snd_soc_usb_find_priv_data(struct device *dev) > } > EXPORT_SYMBOL_GPL(snd_soc_usb_find_priv_data); > > +int snd_soc_usb_find_format(int card_idx, struct snd_pcm_hw_params *params, > + int direction) > +{ > + struct snd_usb_stream *as; > + > + as = snd_usb_find_suppported_substream(card_idx, params, direction); > + if (!as) > + return -EOPNOTSUPP; > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(snd_soc_usb_find_format); Is this the right way to check for formats? formats are defined within the scope of an endpoint, and those endpoints are themselves defined within the scope of an interface? I don't see a notion of endpoint here. Does this assume all endpoints are valid, or maybe the existence of a single endpoint in a device? Confused.