Revert "ALSA: usb-audio: Split endpoint setups for hw_params and prepare"
commit 79764ec772bc1346441ae1c4b1f3bd1991d634e8 upstream.
This reverts commit ff878b408a03bef5d610b7e2302702e16a53636e.
Unfortunately the recent fix seems bringing another regressions with
PulseAudio / pipewire, at least for Steinberg and MOTU devices.
As a temporary solution, do a straight revert. The issue for Android
will be revisited again later by another different fix (if any).
Fixes: ff878b408a03 ("ALSA: usb-audio: Split endpoint setups for hw_params and prepare")
Cc: <stable@vger.kernel.org>
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=216500
Link: https://lore.kernel.org/r/20220920113929.25162-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
06c0204a6e
commit
10a8c5d7d3
@@ -731,8 +731,7 @@ bool snd_usb_endpoint_compatible(struct snd_usb_audio *chip,
|
|||||||
* The endpoint needs to be closed via snd_usb_endpoint_close() later.
|
* The endpoint needs to be closed via snd_usb_endpoint_close() later.
|
||||||
*
|
*
|
||||||
* Note that this function doesn't configure the endpoint. The substream
|
* Note that this function doesn't configure the endpoint. The substream
|
||||||
* needs to set it up later via snd_usb_endpoint_set_params() and
|
* needs to set it up later via snd_usb_endpoint_configure().
|
||||||
* snd_usb_endpoint_prepare().
|
|
||||||
*/
|
*/
|
||||||
struct snd_usb_endpoint *
|
struct snd_usb_endpoint *
|
||||||
snd_usb_endpoint_open(struct snd_usb_audio *chip,
|
snd_usb_endpoint_open(struct snd_usb_audio *chip,
|
||||||
@@ -1255,12 +1254,11 @@ out_of_memory:
|
|||||||
/*
|
/*
|
||||||
* snd_usb_endpoint_set_params: configure an snd_usb_endpoint
|
* snd_usb_endpoint_set_params: configure an snd_usb_endpoint
|
||||||
*
|
*
|
||||||
* It's called either from hw_params callback.
|
|
||||||
* Determine the number of URBs to be used on this endpoint.
|
* Determine the number of URBs to be used on this endpoint.
|
||||||
* An endpoint must be configured before it can be started.
|
* An endpoint must be configured before it can be started.
|
||||||
* An endpoint that is already running can not be reconfigured.
|
* An endpoint that is already running can not be reconfigured.
|
||||||
*/
|
*/
|
||||||
int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
|
static int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
|
||||||
struct snd_usb_endpoint *ep)
|
struct snd_usb_endpoint *ep)
|
||||||
{
|
{
|
||||||
const struct audioformat *fmt = ep->cur_audiofmt;
|
const struct audioformat *fmt = ep->cur_audiofmt;
|
||||||
@@ -1317,17 +1315,17 @@ int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* snd_usb_endpoint_prepare: Prepare the endpoint
|
* snd_usb_endpoint_configure: Configure the endpoint
|
||||||
*
|
*
|
||||||
* This function sets up the EP to be fully usable state.
|
* This function sets up the EP to be fully usable state.
|
||||||
* It's called either from prepare callback.
|
* It's called either from hw_params or prepare callback.
|
||||||
* The function checks need_setup flag, and performs nothing unless needed,
|
* The function checks need_setup flag, and performs nothing unless needed,
|
||||||
* so it's safe to call this multiple times.
|
* so it's safe to call this multiple times.
|
||||||
*
|
*
|
||||||
* This returns zero if unchanged, 1 if the configuration has changed,
|
* This returns zero if unchanged, 1 if the configuration has changed,
|
||||||
* or a negative error code.
|
* or a negative error code.
|
||||||
*/
|
*/
|
||||||
int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
|
int snd_usb_endpoint_configure(struct snd_usb_audio *chip,
|
||||||
struct snd_usb_endpoint *ep)
|
struct snd_usb_endpoint *ep)
|
||||||
{
|
{
|
||||||
bool iface_first;
|
bool iface_first;
|
||||||
@@ -1350,6 +1348,9 @@ int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
err = snd_usb_endpoint_set_params(chip, ep);
|
||||||
|
if (err < 0)
|
||||||
|
goto unlock;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1377,6 +1378,10 @@ int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto unlock;
|
goto unlock;
|
||||||
|
|
||||||
|
err = snd_usb_endpoint_set_params(chip, ep);
|
||||||
|
if (err < 0)
|
||||||
|
goto unlock;
|
||||||
|
|
||||||
err = snd_usb_select_mode_quirk(chip, ep->cur_audiofmt);
|
err = snd_usb_select_mode_quirk(chip, ep->cur_audiofmt);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto unlock;
|
goto unlock;
|
||||||
|
|||||||
@@ -17,9 +17,7 @@ snd_usb_endpoint_open(struct snd_usb_audio *chip,
|
|||||||
bool is_sync_ep);
|
bool is_sync_ep);
|
||||||
void snd_usb_endpoint_close(struct snd_usb_audio *chip,
|
void snd_usb_endpoint_close(struct snd_usb_audio *chip,
|
||||||
struct snd_usb_endpoint *ep);
|
struct snd_usb_endpoint *ep);
|
||||||
int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
|
int snd_usb_endpoint_configure(struct snd_usb_audio *chip,
|
||||||
struct snd_usb_endpoint *ep);
|
|
||||||
int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
|
|
||||||
struct snd_usb_endpoint *ep);
|
struct snd_usb_endpoint *ep);
|
||||||
int snd_usb_endpoint_get_clock_rate(struct snd_usb_audio *chip, int clock);
|
int snd_usb_endpoint_get_clock_rate(struct snd_usb_audio *chip, int clock);
|
||||||
|
|
||||||
|
|||||||
@@ -443,17 +443,17 @@ static int configure_endpoints(struct snd_usb_audio *chip,
|
|||||||
if (stop_endpoints(subs, false))
|
if (stop_endpoints(subs, false))
|
||||||
sync_pending_stops(subs);
|
sync_pending_stops(subs);
|
||||||
if (subs->sync_endpoint) {
|
if (subs->sync_endpoint) {
|
||||||
err = snd_usb_endpoint_prepare(chip, subs->sync_endpoint);
|
err = snd_usb_endpoint_configure(chip, subs->sync_endpoint);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
err = snd_usb_endpoint_prepare(chip, subs->data_endpoint);
|
err = snd_usb_endpoint_configure(chip, subs->data_endpoint);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
snd_usb_set_format_quirk(subs, subs->cur_audiofmt);
|
snd_usb_set_format_quirk(subs, subs->cur_audiofmt);
|
||||||
} else {
|
} else {
|
||||||
if (subs->sync_endpoint) {
|
if (subs->sync_endpoint) {
|
||||||
err = snd_usb_endpoint_prepare(chip, subs->sync_endpoint);
|
err = snd_usb_endpoint_configure(chip, subs->sync_endpoint);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -551,13 +551,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
|
|||||||
subs->cur_audiofmt = fmt;
|
subs->cur_audiofmt = fmt;
|
||||||
mutex_unlock(&chip->mutex);
|
mutex_unlock(&chip->mutex);
|
||||||
|
|
||||||
if (subs->sync_endpoint) {
|
ret = configure_endpoints(chip, subs);
|
||||||
ret = snd_usb_endpoint_set_params(chip, subs->sync_endpoint);
|
|
||||||
if (ret < 0)
|
|
||||||
goto unlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = snd_usb_endpoint_set_params(chip, subs->data_endpoint);
|
|
||||||
|
|
||||||
unlock:
|
unlock:
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user