From: Torstein Hegge <hegge@resisty.net>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH v4] ALSA: usb: Work around CM6631 sample rate change bug
Date: Sun, 24 Mar 2013 21:46:56 +0100 [thread overview]
Message-ID: <20130324204656.GA776@pvv.ntnu.no> (raw)
In-Reply-To: <514C7983.40904@ladisch.de>
On Fri, Mar 22, 2013 at 16:32:19 +0100, Clemens Ladisch wrote:
> Torstein Hegge wrote:
> > + if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
> > + USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
> > + UAC2_CS_CONTROL_SAM_FREQ << 8,
> > + snd_usb_ctrl_intf(chip) | (clock << 8),
> > + data, sizeof(data))) < 0) {
> > + snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n",
> > + dev->devnum, iface, fmt->altsetting);
> > + return err;
> > + }
>
> This code requires that all devices allow reading the sample rate.
>
> When you cannot read the current rate, just assume it needs to be set.
Good point, read failure shouldn't have to be fatal, or cause
set_sample_rate_v2() to return before actually setting the sample rate. But
set_sample_rate_v2() already depends on being able to read the sample rate, and
will propagate errors back to snd_usb_pcm_prepare(), even if the returned rate
isn't used for anything except for a snd_printd.
On the other hand, set_sample_rate_v1() does
return 0; /* some devices don't support reading */
when it fails to read the current rate.
Both the existing sample rate read and the sample rate read added by this patch
could be replaced by
err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
UAC2_CS_CONTROL_SAM_FREQ << 8,
snd_usb_ctrl_intf(chip) | (clock << 8),
data, sizeof(data));
}
if (err < 0) {
snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n",
dev->devnum, iface, fmt->altsetting);
cur_rate = 0;
} else {
cur_rate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
}
Torstein
prev parent reply other threads:[~2013-03-24 20:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-19 21:45 [PATCH v4] ALSA: usb: Work around CM6631 sample rate change bug Torstein Hegge
2013-03-22 15:32 ` Clemens Ladisch
2013-03-24 20:46 ` Torstein Hegge [this message]
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=20130324204656.GA776@pvv.ntnu.no \
--to=hegge@resisty.net \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.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