Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Chihhao Chen (陳志豪)" <chihhao.chen@mediatek.com>
To: "tiwai@suse.de" <tiwai@suse.de>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: missing sound on kernel-5.15
Date: Fri, 11 Nov 2022 07:58:14 +0000	[thread overview]
Message-ID: <154fcd96e77b4a39ad97575fc37ce90547f06a15.camel@mediatek.com> (raw)
In-Reply-To: <87y1v3fl1s.wl-tiwai@suse.de>

Hi Takashi,

I noticed you applied related patches to kernel-6.1 and reverted the
patch on kernel-5.15. Would you please patch back to kernel-5.15
because there will be more and more kernel-5.15 smart phones?

Thanks
Chihhao

On Thu, 2022-09-01 at 12:25 +0200, Takashi Iwai wrote:
> On Thu, 01 Sep 2022 12:06:25 +0200,
> chihhao chen wrote:
> >
> > Hi Takashi,
> >
> > I tested the patch and USB audio function works well.
> > (Start and stop playback more than 20 times with Samsung USB C
> > Earphone)
>
> Great, thanks for quick testing!
>
>
> Takashi
>
> >
> > Thanks
> >
> > On Thu, 2022-09-01 at 10:28 +0200, Takashi Iwai wrote:
> > > On Thu, 01 Sep 2022 09:51:37 +0200,
> > > Takashi Iwai wrote:
> > > >
> > > > On Thu, 01 Sep 2022 07:50:40 +0200,
> > > > chihhao chen wrote:
> > > > >
> > > > > Hi Takashi,
> > > > >
> > > > > The patch fixes this problem.
> > > > > I tried it with "Product: Samsung USB C Earphone" and missing
> > > > > sound
> > > > > problem cannot be reproduced.
> > > >
> > > > OK, it's a good news.  I'm going to add more information to the
> > > > patch
> > > > description about the regression and submit the patch.
> > >
> > > Could you check whether the below cleanup patch on top of the
> > > previous
> > > one doesn't break things?  I lightly tested on my devices and
> > > don't
> > > believe it would change the actual behavior, but just to be sure.
> > >
> > >
> > > Takashi
> > >
> > > -- 8< --
> > > From: Takashi Iwai <tiwai@suse.de>
> > > Subject: [PATCH] ALSA: usb-audio: Clean up endpoint setups at PCM
> > > prepare
> > >
> > > This patch cleans up the superfluous checks and calls for setting
> > > up
> > > the endpoints at PCM prepare callback:
> > >
> > > - Drop stop_endpoints() and sync_pending_stops() calls; the
> > > stream is
> > >   guaranteed to have been already stopped and synced at each PCM
> > >   prepare call by ALSA PCM core
> > >
> > > - Call snd_usb_endpoint_prepare() unconditionally;
> > >   the check for endpoint->need_setup is done in
> > >   snd_pcm_hw_endpoint_prepare() itself
> > >
> > > - Apply snd_usb_set_format_quirk() only when the endpoint is
> > > actually
> > >   set up (i.e. the return code from snd_usb_endpoint_prepare() >
> > > 0)
> > >
> > > - Move a few lines back into snd_usb_pcm_prepare();
> > >   it's even easier to follow than a small useless function
> > >
> > > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > > ---
> > >  sound/usb/pcm.c | 40 ++++++++++------------------------------
> > >  1 file changed, 10 insertions(+), 30 deletions(-)
> > >
> > > diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
> > > index b604f7e95e82..4ed53a3dc922 100644
> > > --- a/sound/usb/pcm.c
> > > +++ b/sound/usb/pcm.c
> > > @@ -433,35 +433,6 @@ static void close_endpoints(struct
> > > snd_usb_audio
> > > *chip,
> > >  }
> > >  }
> > >
> > > -static int configure_endpoints(struct snd_usb_audio *chip,
> > > -       struct snd_usb_substream *subs)
> > > -{
> > > -int err;
> > > -
> > > -if (subs->data_endpoint->need_setup) {
> > > -/* stop any running stream beforehand */
> > > -if (stop_endpoints(subs, false))
> > > -sync_pending_stops(subs);
> > > -if (subs->sync_endpoint) {
> > > -err = snd_usb_endpoint_prepare(chip, subs-
> > > > sync_endpoint);
> > >
> > > -if (err < 0)
> > > -return err;
> > > -}
> > > -err = snd_usb_endpoint_prepare(chip, subs-
> > > > data_endpoint);
> > >
> > > -if (err < 0)
> > > -return err;
> > > -snd_usb_set_format_quirk(subs, subs->cur_audiofmt);
> > > -} else {
> > > -if (subs->sync_endpoint) {
> > > -err = snd_usb_endpoint_prepare(chip, subs-
> > > > sync_endpoint);
> > >
> > > -if (err < 0)
> > > -return err;
> > > -}
> > > -}
> > > -
> > > -return 0;
> > > -}
> > > -
> > >  /*
> > >   * hw_params callback
> > >   *
> > > @@ -640,9 +611,18 @@ static int snd_usb_pcm_prepare(struct
> > > snd_pcm_substream *substream)
> > >  goto unlock;
> > >  }
> > >
> > > -ret = configure_endpoints(chip, subs);
> > > +if (subs->sync_endpoint) {
> > > +ret = snd_usb_endpoint_prepare(chip, subs-
> > > > sync_endpoint);
> > >
> > > +if (ret < 0)
> > > +goto unlock;
> > > +}
> > > +
> > > +ret = snd_usb_endpoint_prepare(chip, subs->data_endpoint);
> > >  if (ret < 0)
> > >  goto unlock;
> > > +else if (ret > 0)
> > > +snd_usb_set_format_quirk(subs, subs->cur_audiofmt);
> > > +ret = 0;
> > >
> > >  /* reset the pointer */
> > >  subs->buffer_bytes = frames_to_bytes(runtime, runtime-
> > > > buffer_size);


************* MEDIATEK Confidentiality Notice
 ********************
The information contained in this e-mail message (including any
attachments) may be confidential, proprietary, privileged, or otherwise
exempt from disclosure under applicable laws. It is intended to be
conveyed only to the designated recipient(s). Any use, dissemination,
distribution, printing, retaining or copying of this e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited and may
be unlawful. If you are not an intended recipient of this e-mail, or believe

that you have received this e-mail in error, please notify the sender
immediately (by replying to this e-mail), delete any and all copies of
this e-mail (including any attachments) from your system, and do not
disclose the content of this e-mail to any other person. Thank you!

  reply	other threads:[~2022-11-11  7:59 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-22  8:06 missing sound on kernel-5.15 chihhao chen
2022-08-22 11:57 ` Geraldo Nascimento
2022-08-29  7:56   ` chihhao chen
2022-08-29  8:06     ` Takashi Iwai
2022-08-29  8:50       ` chihhao chen
2022-08-29 12:16         ` Takashi Iwai
2022-08-29 18:15           ` Takashi Iwai
2022-08-30  5:54             ` Takashi Iwai
2022-08-30  6:02               ` Takashi Iwai
2022-08-30  6:13               ` chihhao chen
2022-08-30  7:02                 ` Takashi Iwai
2022-08-30  8:08                   ` chihhao chen
2022-08-30  8:24                     ` Takashi Iwai
2022-08-31  3:39                       ` chihhao chen
2022-08-31  5:18                         ` Takashi Iwai
2022-08-31  7:03                           ` chihhao chen
2022-08-31  8:04                             ` Takashi Iwai
2022-08-31  9:26                               ` chihhao chen
2022-08-31 10:48                                 ` Takashi Iwai
2022-08-31 13:16                                   ` chihhao chen
2022-08-31 13:40                                     ` Takashi Iwai
2022-09-01  5:50                                       ` chihhao chen
2022-09-01  7:51                                         ` Takashi Iwai
2022-09-01  8:28                                           ` Takashi Iwai
2022-09-01 10:06                                             ` chihhao chen
2022-09-01 10:25                                               ` Takashi Iwai
2022-11-11  7:58                                                 ` Chihhao Chen (陳志豪) [this message]
     [not found] <1661150747490509987-webhooks-bot@alsa-project.org>
2022-08-22  6:45 ` GitHub issues - opened

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=154fcd96e77b4a39ad97575fc37ce90547f06a15.camel@mediatek.com \
    --to=chihhao.chen@mediatek.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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