Re: [PATCH v28 25/32] ASoC: qcom: qdsp6: Fetch USB offload mapped card and PCM device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +static int q6usb_update_offload_route(struct snd_soc_component *component, int card,
> +				      int pcm, int direction, long *route)
> +{
> +	struct q6usb_port_data *data = dev_get_drvdata(component->dev);
> +	struct snd_soc_usb_device *sdev;
> +	int ret = 0;
> +	int cidx = -1;
> +	int pidx = -1;
> +
> +	mutex_lock(&data->mutex);
> +
> +	if (list_empty(&data->devices) ||
> +	    direction == SNDRV_PCM_STREAM_CAPTURE) {
> +		ret = -ENODEV;
> +		goto out;
> +	}

well the code above seems to invalidate what I understood earlier, in
that an error code is returned instead of a set of -1 values...

> +
> +	sdev = list_last_entry(&data->devices, struct snd_soc_usb_device, list);
> +
> +	/*
> +	 * Will always look for last PCM device discovered/probed as the
> +	 * active offload index.
> +	 */
> +	if (card == sdev->card_idx &&
> +	    pcm == sdev->ppcm_idx[sdev->num_playback - 1]) {
> +		cidx = component->card->snd_card->number;
> +		pidx = q6usb_get_pcm_id(component);
> +	}
> +
> +	if (cidx < 0 || pidx < 0) {
> +		cidx = -1;
> +		pidx = -1;
> +	}
> +
> +out:
> +	route[0] = cidx;
> +	route[1] = pidx;
> +
> +	mutex_unlock(&data->mutex);
> +
> +	return ret;
> +}
> +



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux