From: Jung Daehwan <dh10.jung@samsung.com>
To: Puma Hsu <pumahsu@google.com>
Cc: Wesley Cheng <quic_wcheng@quicinc.com>,
srinivas.kandagatla@linaro.org, mathias.nyman@intel.com,
perex@perex.cz, conor+dt@kernel.org, dmitry.torokhov@gmail.com,
corbet@lwn.net, broonie@kernel.org, lgirdwood@gmail.com,
krzk+dt@kernel.org, pierre-louis.bossart@linux.intel.com,
Thinh.Nguyen@synopsys.com, tiwai@suse.com, robh@kernel.org,
gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, linux-sound@vger.kernel.org,
linux-input@vger.kernel.org, linux-usb@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v36 08/31] ALSA: usb-audio: Export USB SND APIs for modules
Date: Tue, 1 Apr 2025 16:53:23 +0900 [thread overview]
Message-ID: <20250401075323.GH98772@ubuntu> (raw)
In-Reply-To: <CAGCq0LYs5=Re74G99n3=Vbdu1Q2M5-SKZqXTgPKJZYtSHjXZPA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 10063 bytes --]
On Fri, Mar 28, 2025 at 03:47:00PM +0800, Puma Hsu wrote:
> On Wed, Mar 19, 2025 at 8:52 AM Wesley Cheng <quic_wcheng@quicinc.com> wrote:
> >
> > Some vendor modules will utilize useful parsing and endpoint management
> > APIs to start audio playback/capture.
> >
> > Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> > Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
>
> Tested-by: Puma Hsu <pumahsu@google.com>
>
Tested-by: Daehwan Jung <dh10.jung@samsung.com>
> > ---
> > sound/usb/card.c | 4 +++
> > sound/usb/endpoint.c | 1 +
> > sound/usb/helper.c | 1 +
> > sound/usb/pcm.c | 75 +++++++++++++++++++++++++++++++-------------
> > sound/usb/pcm.h | 11 +++++++
> > 5 files changed, 71 insertions(+), 21 deletions(-)
> >
> > diff --git a/sound/usb/card.c b/sound/usb/card.c
> > index 9c411b82a218..a0087bde684c 100644
> > --- a/sound/usb/card.c
> > +++ b/sound/usb/card.c
> > @@ -1030,6 +1030,7 @@ int snd_usb_lock_shutdown(struct snd_usb_audio *chip)
> > wake_up(&chip->shutdown_wait);
> > return err;
> > }
> > +EXPORT_SYMBOL_GPL(snd_usb_lock_shutdown);
> >
> > /* autosuspend and unlock the shutdown */
> > void snd_usb_unlock_shutdown(struct snd_usb_audio *chip)
> > @@ -1038,6 +1039,7 @@ void snd_usb_unlock_shutdown(struct snd_usb_audio *chip)
> > if (atomic_dec_and_test(&chip->usage_count))
> > wake_up(&chip->shutdown_wait);
> > }
> > +EXPORT_SYMBOL_GPL(snd_usb_unlock_shutdown);
> >
> > int snd_usb_autoresume(struct snd_usb_audio *chip)
> > {
> > @@ -1060,6 +1062,7 @@ int snd_usb_autoresume(struct snd_usb_audio *chip)
> > }
> > return 0;
> > }
> > +EXPORT_SYMBOL_GPL(snd_usb_autoresume);
> >
> > void snd_usb_autosuspend(struct snd_usb_audio *chip)
> > {
> > @@ -1073,6 +1076,7 @@ void snd_usb_autosuspend(struct snd_usb_audio *chip)
> > for (i = 0; i < chip->num_interfaces; i++)
> > usb_autopm_put_interface(chip->intf[i]);
> > }
> > +EXPORT_SYMBOL_GPL(snd_usb_autosuspend);
> >
> > static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)
> > {
> > diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
> > index a29f28eb7d0c..1fed039b10ed 100644
> > --- a/sound/usb/endpoint.c
> > +++ b/sound/usb/endpoint.c
> > @@ -1524,6 +1524,7 @@ int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
> > mutex_unlock(&chip->mutex);
> > return err;
> > }
> > +EXPORT_SYMBOL_GPL(snd_usb_endpoint_prepare);
> >
> > /* get the current rate set to the given clock by any endpoint */
> > int snd_usb_endpoint_get_clock_rate(struct snd_usb_audio *chip, int clock)
> > diff --git a/sound/usb/helper.c b/sound/usb/helper.c
> > index 72b671fb2c84..497d2b27fb59 100644
> > --- a/sound/usb/helper.c
> > +++ b/sound/usb/helper.c
> > @@ -62,6 +62,7 @@ void *snd_usb_find_csint_desc(void *buffer, int buflen, void *after, u8 dsubtype
> > }
> > return NULL;
> > }
> > +EXPORT_SYMBOL_GPL(snd_usb_find_csint_desc);
> >
> > /*
> > * Wrapper for usb_control_msg().
> > diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
> > index 08bf535ed163..18467da6fd9e 100644
> > --- a/sound/usb/pcm.c
> > +++ b/sound/usb/pcm.c
> > @@ -148,6 +148,16 @@ find_format(struct list_head *fmt_list_head, snd_pcm_format_t format,
> > return found;
> > }
> >
> > +const struct audioformat *
> > +snd_usb_find_format(struct list_head *fmt_list_head, snd_pcm_format_t format,
> > + unsigned int rate, unsigned int channels, bool strict_match,
> > + struct snd_usb_substream *subs)
> > +{
> > + return find_format(fmt_list_head, format, rate, channels, strict_match,
> > + subs);
> > +}
> > +EXPORT_SYMBOL_GPL(snd_usb_find_format);
> > +
> > static const struct audioformat *
> > find_substream_format(struct snd_usb_substream *subs,
> > const struct snd_pcm_hw_params *params)
> > @@ -157,6 +167,14 @@ find_substream_format(struct snd_usb_substream *subs,
> > true, subs);
> > }
> >
> > +const struct audioformat *
> > +snd_usb_find_substream_format(struct snd_usb_substream *subs,
> > + const struct snd_pcm_hw_params *params)
> > +{
> > + return find_substream_format(subs, params);
> > +}
> > +EXPORT_SYMBOL_GPL(snd_usb_find_substream_format);
> > +
> > bool snd_usb_pcm_has_fixed_rate(struct snd_usb_substream *subs)
> > {
> > const struct audioformat *fp;
> > @@ -461,20 +479,9 @@ static void close_endpoints(struct snd_usb_audio *chip,
> > }
> > }
> >
> > -/*
> > - * hw_params callback
> > - *
> > - * allocate a buffer and set the given audio format.
> > - *
> > - * so far we use a physically linear buffer although packetize transfer
> > - * doesn't need a continuous area.
> > - * if sg buffer is supported on the later version of alsa, we'll follow
> > - * that.
> > - */
> > -static int snd_usb_hw_params(struct snd_pcm_substream *substream,
> > - struct snd_pcm_hw_params *hw_params)
> > +int snd_usb_hw_params(struct snd_usb_substream *subs,
> > + struct snd_pcm_hw_params *hw_params)
> > {
> > - struct snd_usb_substream *subs = substream->runtime->private_data;
> > struct snd_usb_audio *chip = subs->stream->chip;
> > const struct audioformat *fmt;
> > const struct audioformat *sync_fmt;
> > @@ -499,7 +506,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
> > if (fmt->implicit_fb) {
> > sync_fmt = snd_usb_find_implicit_fb_sync_format(chip, fmt,
> > hw_params,
> > - !substream->stream,
> > + !subs->direction,
> > &sync_fixed_rate);
> > if (!sync_fmt) {
> > usb_audio_dbg(chip,
> > @@ -579,15 +586,28 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
> >
> > return ret;
> > }
> > +EXPORT_SYMBOL_GPL(snd_usb_hw_params);
> >
> > /*
> > - * hw_free callback
> > + * hw_params callback
> > *
> > - * reset the audio format and release the buffer
> > + * allocate a buffer and set the given audio format.
> > + *
> > + * so far we use a physically linear buffer although packetize transfer
> > + * doesn't need a continuous area.
> > + * if sg buffer is supported on the later version of alsa, we'll follow
> > + * that.
> > */
> > -static int snd_usb_hw_free(struct snd_pcm_substream *substream)
> > +static int snd_usb_pcm_hw_params(struct snd_pcm_substream *substream,
> > + struct snd_pcm_hw_params *hw_params)
> > {
> > struct snd_usb_substream *subs = substream->runtime->private_data;
> > +
> > + return snd_usb_hw_params(subs, hw_params);
> > +}
> > +
> > +int snd_usb_hw_free(struct snd_usb_substream *subs)
> > +{
> > struct snd_usb_audio *chip = subs->stream->chip;
> >
> > snd_media_stop_pipeline(subs);
> > @@ -603,6 +623,19 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream)
> >
> > return 0;
> > }
> > +EXPORT_SYMBOL_GPL(snd_usb_hw_free);
> > +
> > +/*
> > + * hw_free callback
> > + *
> > + * reset the audio format and release the buffer
> > + */
> > +static int snd_usb_pcm_hw_free(struct snd_pcm_substream *substream)
> > +{
> > + struct snd_usb_substream *subs = substream->runtime->private_data;
> > +
> > + return snd_usb_hw_free(subs);
> > +}
> >
> > /* free-wheeling mode? (e.g. dmix) */
> > static int in_free_wheeling_mode(struct snd_pcm_runtime *runtime)
> > @@ -1746,8 +1779,8 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream
> > static const struct snd_pcm_ops snd_usb_playback_ops = {
> > .open = snd_usb_pcm_open,
> > .close = snd_usb_pcm_close,
> > - .hw_params = snd_usb_hw_params,
> > - .hw_free = snd_usb_hw_free,
> > + .hw_params = snd_usb_pcm_hw_params,
> > + .hw_free = snd_usb_pcm_hw_free,
> > .prepare = snd_usb_pcm_prepare,
> > .trigger = snd_usb_substream_playback_trigger,
> > .sync_stop = snd_usb_pcm_sync_stop,
> > @@ -1758,8 +1791,8 @@ static const struct snd_pcm_ops snd_usb_playback_ops = {
> > static const struct snd_pcm_ops snd_usb_capture_ops = {
> > .open = snd_usb_pcm_open,
> > .close = snd_usb_pcm_close,
> > - .hw_params = snd_usb_hw_params,
> > - .hw_free = snd_usb_hw_free,
> > + .hw_params = snd_usb_pcm_hw_params,
> > + .hw_free = snd_usb_pcm_hw_free,
> > .prepare = snd_usb_pcm_prepare,
> > .trigger = snd_usb_substream_capture_trigger,
> > .sync_stop = snd_usb_pcm_sync_stop,
> > diff --git a/sound/usb/pcm.h b/sound/usb/pcm.h
> > index 388fe2ba346d..c096021adb2b 100644
> > --- a/sound/usb/pcm.h
> > +++ b/sound/usb/pcm.h
> > @@ -15,4 +15,15 @@ void snd_usb_preallocate_buffer(struct snd_usb_substream *subs);
> > int snd_usb_audioformat_set_sync_ep(struct snd_usb_audio *chip,
> > struct audioformat *fmt);
> >
> > +const struct audioformat *
> > +snd_usb_find_format(struct list_head *fmt_list_head, snd_pcm_format_t format,
> > + unsigned int rate, unsigned int channels, bool strict_match,
> > + struct snd_usb_substream *subs);
> > +const struct audioformat *
> > +snd_usb_find_substream_format(struct snd_usb_substream *subs,
> > + const struct snd_pcm_hw_params *params);
> > +
> > +int snd_usb_hw_params(struct snd_usb_substream *subs,
> > + struct snd_pcm_hw_params *hw_params);
> > +int snd_usb_hw_free(struct snd_usb_substream *subs);
> > #endif /* __USBAUDIO_PCM_H */
> >
>
>
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2025-04-01 7:44 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-19 0:51 [PATCH v36 00/31] Introduce QC USB SND audio offloading support Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 01/31] xhci: sideband: add initial api to register a secondary interrupter entity Wesley Cheng
2025-03-27 6:27 ` Puma Hsu
2025-03-27 7:02 ` Greg KH
2025-03-27 10:14 ` Puma Hsu
2025-03-27 10:48 ` Greg KH
2025-03-28 4:08 ` Puma Hsu
2025-03-27 16:12 ` Wesley Cheng
2025-03-28 4:11 ` Puma Hsu
2025-04-01 2:23 ` Jung Daehwan
2025-04-01 6:55 ` Greg KH
2025-04-01 7:50 ` Jung Daehwan
2025-03-27 10:13 ` Puma Hsu
2025-03-19 0:51 ` [PATCH v36 02/31] usb: host: xhci-mem: Cleanup pending secondary event ring events Wesley Cheng
2025-03-28 7:42 ` Puma Hsu
2025-04-01 7:51 ` Jung Daehwan
2025-03-19 0:51 ` [PATCH v36 03/31] usb: host: xhci-mem: Allow for interrupter clients to choose specific index Wesley Cheng
2025-03-28 7:43 ` Puma Hsu
2025-04-01 7:51 ` Jung Daehwan
2025-03-19 0:51 ` [PATCH v36 04/31] usb: host: xhci-plat: Set XHCI max interrupters if property is present Wesley Cheng
2025-03-28 7:44 ` Puma Hsu
2025-04-01 7:52 ` Jung Daehwan
2025-03-19 0:51 ` [PATCH v36 05/31] usb: host: xhci: Notify xHCI sideband on transfer ring free Wesley Cheng
2025-03-28 7:45 ` Puma Hsu
2025-04-01 7:52 ` Jung Daehwan
2025-03-19 0:51 ` [PATCH v36 06/31] usb: dwc3: Specify maximum number of XHCI interrupters Wesley Cheng
2025-03-28 7:46 ` Puma Hsu
2025-04-01 7:53 ` Jung Daehwan
2025-03-19 0:51 ` [PATCH v36 07/31] ALSA: Add USB audio device jack type Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 08/31] ALSA: usb-audio: Export USB SND APIs for modules Wesley Cheng
2025-03-28 7:47 ` Puma Hsu
2025-04-01 7:53 ` Jung Daehwan [this message]
2025-03-19 0:51 ` [PATCH v36 09/31] ALSA: usb-audio: Check for support for requested audio format Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 10/31] ALSA: usb-audio: Save UAC sample size information Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 11/31] ALSA: usb-audio: Prevent starting of audio stream if in use Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 12/31] ALSA: usb-audio: Introduce USB SND platform op callbacks Wesley Cheng
2025-03-28 7:48 ` Puma Hsu
2025-04-01 7:53 ` Jung Daehwan
2025-03-19 0:51 ` [PATCH v36 13/31] ALSA: usb-audio: Allow for rediscovery of connected USB SND devices Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 14/31] ASoC: Add SoC USB APIs for adding an USB backend Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 15/31] ASoC: usb: Add PCM format check API for " Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 16/31] ASoC: usb: Create SOC USB SND jack kcontrol Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 17/31] ASoC: usb: Fetch ASoC card and pcm device information Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 18/31] ASoC: usb: Rediscover USB SND devices on USB port add Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 19/31] ASoC: doc: Add documentation for SOC USB Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 20/31] ASoC: dt-bindings: qcom,q6dsp-lpass-ports: Add USB_RX port Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 21/31] ASoC: dt-bindings: Update example for enabling USB offload on SM8250 Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 22/31] ASoC: qcom: qdsp6: Introduce USB AFE port to q6dsp Wesley Cheng
2025-03-25 9:24 ` Stephan Gerhold
2025-03-25 23:18 ` Wesley Cheng
2025-03-26 9:57 ` Stephan Gerhold
2025-03-31 19:52 ` Wesley Cheng
2025-04-01 8:16 ` Stephan Gerhold
2025-04-01 23:47 ` Wesley Cheng
2025-04-02 14:41 ` Stephan Gerhold
2025-04-03 0:23 ` Wesley Cheng
2025-04-03 0:54 ` Wesley Cheng
2025-04-03 13:45 ` Stephan Gerhold
2025-04-03 15:58 ` Wesley Cheng
2025-04-03 18:00 ` Stephan Gerhold
2025-04-03 21:00 ` Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 23/31] ASoC: qcom: qdsp6: q6afe: Increase APR timeout Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 24/31] ASoC: qcom: qdsp6: Add USB backend ASoC driver for Q6 Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 25/31] ASoC: qcom: qdsp6: Add headphone jack for offload connection status Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 26/31] ASoC: qcom: qdsp6: Fetch USB offload mapped card and PCM device Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 27/31] ALSA: usb-audio: qcom: Add USB QMI definitions Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 28/31] ALSA: usb-audio: qcom: Introduce QC USB SND offloading support Wesley Cheng
2025-03-25 9:47 ` Stephan Gerhold
2025-03-26 1:32 ` Wesley Cheng
2025-03-26 10:09 ` Stephan Gerhold
2025-03-27 16:57 ` Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 29/31] ALSA: usb-audio: qcom: Don't allow USB offload path if PCM device is in use Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 30/31] ALSA: usb-audio: qcom: Add USB offload route kcontrol Wesley Cheng
2025-03-25 11:35 ` Stephan Gerhold
2025-03-26 1:42 ` Wesley Cheng
2025-03-19 0:51 ` [PATCH v36 31/31] ALSA: usb-audio: qcom: Notify USB audio devices on USB offload probing Wesley Cheng
2025-03-21 13:13 ` [PATCH v36 00/31] Introduce QC USB SND audio offloading support Luca Weiss
2025-03-21 20:06 ` Wesley Cheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250401075323.GH98772@ubuntu \
--to=dh10.jung@samsung.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=pumahsu@google.com \
--cc=quic_wcheng@quicinc.com \
--cc=robh@kernel.org \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.