From: Oh Eomji <eomji.oh@samsung.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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: Fri, 25 Mar 2022 16:13:57 +0900 [thread overview]
Message-ID: <20220325071357.GB123495@ubuntu> (raw)
In-Reply-To: <YjwtDo7b/RMHr45e@kroah.com>
[-- Attachment #1: Type: text/plain, Size: 4581 bytes --]
On Thu, Mar 24, 2022 at 09:34:22AM +0100, Greg Kroah-Hartman wrote:
> 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 :(
>
>
Hi,
In kernel 5.10, set_interface is performed when the protocol is more
than UAC_VERSION_1 in the snd_usb_init_sample_rate function.
There was an issue here, so there is a history of adding to perform
snd_vendor_set_interface when the protocol is more than UAC_VERSION_1.
But I don't think I need this in kerenel 5.15, so I'll delete it.
Thanks,
Eomji Oh
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2022-03-25 7:15 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
[not found] ` <CGME20220324081212epcas2p4d2ed1f3a1bb020606cf65016efec085b@epcas2p4.samsung.com>
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
[not found] ` <CGME20220324081348epcas2p48d3a24dfdfd8d01e9bf350571b18ffff@epcas2p4.samsung.com>
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
2022-03-25 7:13 ` Oh Eomji [this message]
2022-03-25 7:33 ` Greg Kroah-Hartman
[not found] ` <CGME20220324081350epcas2p227458cb1b530f04a9990bcfc8c3b5703@epcas2p2.samsung.com>
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=20220325071357.GB123495@ubuntu \
--to=eomji.oh@samsung.com \
--cc=alsa-devel@alsa-project.org \
--cc=gregkh@linuxfoundation.org \
--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
all inboxes | Powered by JetHome®