From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Oh Eomji <eomji.oh@samsung.com>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
open list <linux-kernel@vger.kernel.org>,
alsa-devel@alsa-project.org, Leon Romanovsky <leon@kernel.org>,
Pavel Skripkin <paskripkin@gmail.com>
Subject: Re: [PATCH v1 2/3] sound: usb: Calling vendor's call-back function within usb audio operation.
Date: Thu, 24 Mar 2022 09:34:22 +0100 [thread overview]
Message-ID: <YjwtDo7b/RMHr45e@kroah.com> (raw)
In-Reply-To: <1648109444-196321-3-git-send-email-eomji.oh@samsung.com>
On Thu, Mar 24, 2022 at 05:10:43PM +0900, Oh Eomji wrote:
> When a new interface is connected or removed, the call-back functions
> are called to transmit a command to the hardware.
>
> Signed-off-by: Oh Eomji <eomji.oh@samsung.com>
> ---
> sound/usb/pcm.c | 37 +++++++++++++++++++++++++++++++++++++
> sound/usb/stream.c | 2 ++
> 2 files changed, 39 insertions(+)
>
> diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
> index cec6e91a..4bae4ba 100644
> --- a/sound/usb/pcm.c
> +++ b/sound/usb/pcm.c
> @@ -144,6 +144,8 @@ find_format(struct list_head *fmt_list_head, snd_pcm_format_t format,
> found = fp;
> cur_attr = attr;
> }
> +
> + snd_vendor_set_pcm_binterval(fp, found, &cur_attr, &attr);
> }
> return found;
> }
> @@ -434,6 +436,7 @@ static int configure_endpoints(struct snd_usb_audio *chip,
> struct snd_usb_substream *subs)
> {
> int err;
> + struct usb_interface *iface;
>
> if (subs->data_endpoint->need_setup) {
> /* stop any running stream beforehand */
> @@ -442,6 +445,13 @@ static int configure_endpoints(struct snd_usb_audio *chip,
> err = snd_usb_endpoint_configure(chip, subs->data_endpoint);
> if (err < 0)
> return err;
> +
> + iface = usb_ifnum_to_if(chip->dev, subs->data_endpoint->iface);
> + err = snd_vendor_set_pcm_intf(iface, subs->data_endpoint->iface,
> + subs->data_endpoint->altsetting, subs->direction);
> + if (err < 0)
> + return err;
> +
> snd_usb_set_format_quirk(subs, subs->cur_audiofmt);
> }
>
> @@ -616,8 +626,18 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
> struct snd_pcm_runtime *runtime = substream->runtime;
> struct snd_usb_substream *subs = runtime->private_data;
> struct snd_usb_audio *chip = subs->stream->chip;
> + struct snd_usb_endpoint *ep = subs->data_endpoint;
> int ret;
>
> + ret = snd_vendor_set_pcm_buf(subs->dev, subs->cur_audiofmt->iface);
> + if (ret)
> + return ret;
> +
> + if (!subs->cur_audiofmt) {
> + dev_err(&subs->dev->dev, "no format is specified\n");
> + return -ENXIO;
> + }
> +
> ret = snd_usb_lock_shutdown(chip);
> if (ret < 0)
> return ret;
> @@ -630,6 +650,13 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
> if (ret < 0)
> goto unlock;
>
> + if (snd_vendor_get_ops()) {
> + ret = snd_vendor_set_rate(ep->cur_audiofmt->iface,
> + ep->cur_rate, ep->cur_audiofmt->altsetting);
> + if (!ret)
> + goto unlock;
> + }
> +
> /* reset the pointer */
> subs->buffer_bytes = frames_to_bytes(runtime, runtime->buffer_size);
> subs->inflight_bytes = 0;
> @@ -1104,6 +1131,11 @@ static int snd_usb_pcm_open(struct snd_pcm_substream *substream)
> struct snd_usb_substream *subs = &as->substream[direction];
> int ret;
>
> + ret = snd_vendor_set_pcm_connection(subs->dev, SOUND_PCM_OPEN,
> + direction);
> + if (ret)
> + return ret;
> +
> runtime->hw = snd_usb_hardware;
> /* need an explicit sync to catch applptr update in low-latency mode */
> if (direction == SNDRV_PCM_STREAM_PLAYBACK &&
> @@ -1137,6 +1169,11 @@ static int snd_usb_pcm_close(struct snd_pcm_substream *substream)
> struct snd_usb_substream *subs = &as->substream[direction];
> int ret;
>
> + ret = snd_vendor_set_pcm_connection(subs->dev, SOUND_PCM_CLOSE,
> + direction);
> + if (ret)
> + return ret;
> +
> snd_media_stop_pipeline(subs);
>
> if (!snd_usb_lock_shutdown(subs->stream->chip)) {
> diff --git a/sound/usb/stream.c b/sound/usb/stream.c
> index ceb93d7..26ca696 100644
> --- a/sound/usb/stream.c
> +++ b/sound/usb/stream.c
> @@ -1227,6 +1227,8 @@ static int __snd_usb_parse_audio_interface(struct snd_usb_audio *chip,
> snd_usb_init_pitch(chip, fp);
> snd_usb_init_sample_rate(chip, fp, fp->rate_max);
> usb_set_interface(chip->dev, iface_no, altno);
> + if (protocol > UAC_VERSION_1)
Why the protocol check? That's not documented in your changelog
anywhere :(
next prev parent reply other threads:[~2022-03-24 8:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20220324081208epcas2p41916730b7e386f24e5548fac53e5bc41@epcas2p4.samsung.com>
2022-03-24 8:10 ` [PATCH v1 0/3] Exynos Usb Audio Offloading Support Oh Eomji
2022-03-24 8:10 ` [PATCH v1 1/3] sound: usb: Add vendor's hooking interface Oh Eomji
2022-03-24 8:32 ` Greg Kroah-Hartman
2022-03-25 18:47 ` Krzysztof Kozlowski
2022-03-24 8:33 ` Greg Kroah-Hartman
2022-03-25 6:44 ` Oh Eomji
2022-03-25 6:51 ` Greg Kroah-Hartman
2022-03-25 8:01 ` Christoph Hellwig
2022-03-24 8:10 ` [PATCH v1 2/3] sound: usb: Calling vendor's call-back function within usb audio operation Oh Eomji
2022-03-24 8:34 ` Greg Kroah-Hartman [this message]
2022-03-25 7:13 ` Oh Eomji
2022-03-25 7:33 ` Greg Kroah-Hartman
2022-03-24 8:10 ` [PATCH v1 3/3] sound: usb: Exynos usb audio offloading driver Oh Eomji
2022-03-24 8:41 ` Greg Kroah-Hartman
2022-03-28 6:49 ` Oh Eomji
2022-03-25 18:44 ` Krzysztof Kozlowski
2022-03-28 6:59 ` Oh Eomji
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=YjwtDo7b/RMHr45e@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=alsa-devel@alsa-project.org \
--cc=eomji.oh@samsung.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paskripkin@gmail.com \
--cc=perex@perex.cz \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox