Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a59cdc9c authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: msm: Add support for AVS version check"

parents bfb7757d d3611a4a
Loading
Loading
Loading
Loading
+27 −4
Original line number Diff line number Diff line
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1017,6 +1017,16 @@ static int msm_compr_send_media_format_block(struct snd_compr_stream *cstream,
			sample_word_size = 16;
			break;
		}
		if (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7)
			ret = q6asm_media_format_block_pcm_format_support_v3(
							prtd->audio_client,
							prtd->sample_rate,
							prtd->num_channels,
							bit_width, stream_id,
							use_default_chmap,
							chmap,
							sample_word_size);
		else
			ret = q6asm_media_format_block_pcm_format_support_v4(
							prtd->audio_client,
							prtd->sample_rate,
@@ -1323,6 +1333,12 @@ static int msm_compr_configure_dsp_for_playback
	} else {
		pr_debug("%s: stream_id %d bits_per_sample %d\n",
				__func__, ac->stream_id, bits_per_sample);
		if (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7)
			ret = q6asm_stream_open_write_v3(ac,
				prtd->codec, bits_per_sample,
				ac->stream_id,
				prtd->gapless_state.use_dsp_gapless_mode);
		else
			ret = q6asm_stream_open_write_v4(ac,
				prtd->codec, bits_per_sample,
				ac->stream_id,
@@ -2639,10 +2655,17 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)

		pr_debug("%s: open_write stream_id %d bits_per_sample %d",
				__func__, stream_id, bits_per_sample);
		if (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7)
			rc = q6asm_stream_open_write_v3(prtd->audio_client,
				prtd->codec, bits_per_sample,
				stream_id,
				prtd->gapless_state.use_dsp_gapless_mode);
		else
			rc = q6asm_stream_open_write_v4(prtd->audio_client,
				prtd->codec, bits_per_sample,
				stream_id,
				prtd->gapless_state.use_dsp_gapless_mode);
			break;
		if (rc < 0) {
			pr_err("%s: Session out open failed for gapless\n",
				 __func__);
+59 −14
Original line number Diff line number Diff line
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -384,6 +384,25 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
			prtd->audio_client = NULL;
			return -ENOMEM;
		}
		ret = q6asm_open_write_v3(prtd->audio_client,
				FORMAT_LINEAR_PCM, bits_per_sample);
		if (ret < 0) {
			pr_err("%s: q6asm_open_write_v3 failed (%d)\n",
			__func__, ret);
			q6asm_audio_client_free(prtd->audio_client);
			prtd->audio_client = NULL;
			return -ENOMEM;
		}
	} else if (q6core_get_avs_version() == Q6_SUBSYS_AVS2_8) {
		ret = q6asm_open_write_v4(prtd->audio_client,
				FORMAT_LINEAR_PCM, bits_per_sample);
		if (ret < 0) {
			pr_err("%s: q6asm_open_write_v4 failed (%d)\n",
			__func__, ret);
			q6asm_audio_client_free(prtd->audio_client);
			prtd->audio_client = NULL;
			return -ENOMEM;
		}
	} else {
		ret = q6asm_open_write_with_retry(prtd->audio_client,
				fmt_type, bits_per_sample);
@@ -433,6 +452,13 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
				prtd->channel_map, bits_per_sample,
				sample_word_size, ASM_LITTLE_ENDIAN,
				DEFAULT_QF);
		else {
			if (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7)
				ret = q6asm_media_format_block_multi_ch_pcm_v3(
				prtd->audio_client, runtime->rate,
				runtime->channels, !prtd->set_channel_map,
				prtd->channel_map, bits_per_sample,
				sample_word_size);
			else
				ret = q6asm_media_format_block_multi_ch_pcm_v4(
				prtd->audio_client, runtime->rate,
@@ -441,6 +467,7 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
				sample_word_size, ASM_LITTLE_ENDIAN,
				DEFAULT_QF);
		}
	}
	if (ret < 0)
		pr_info("%s: CMD Format block failed\n", __func__);

@@ -497,10 +524,19 @@ static int msm_pcm_capture_prepare(struct snd_pcm_substream *substream)
		pr_debug("%s Opening %d-ch PCM read stream, perf_mode %d\n",
				__func__, params_channels(params),
				prtd->audio_client->perf_mode);

		if (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7) {
			ret = q6asm_open_read_v3(prtd->audio_client,
					FORMAT_LINEAR_PCM,
					bits_per_sample);
		} else if (q6core_get_avs_version() == Q6_SUBSYS_AVS2_8) {
			ret = q6asm_open_read_v4(prtd->audio_client,
					FORMAT_LINEAR_PCM,
					bits_per_sample, false);
		} else {
			ret = q6asm_open_read_with_retry(prtd->audio_client,
					FORMAT_LINEAR_PCM,
					bits_per_sample, false);
		}
		if (ret < 0) {
			pr_err("%s: q6asm_open_read failed\n", __func__);
			q6asm_audio_client_free(prtd->audio_client);
@@ -577,6 +613,14 @@ static int msm_pcm_capture_prepare(struct snd_pcm_substream *substream)
					sample_word_size,
					ASM_LITTLE_ENDIAN,
					DEFAULT_QF);
	else {
		if (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7)
			ret = q6asm_enc_cfg_blk_pcm_format_support_v3(
						prtd->audio_client,
						prtd->samp_rate,
						prtd->channel_mode,
						bits_per_sample,
						sample_word_size);
		else
			ret = q6asm_enc_cfg_blk_pcm_format_support_v4(
						prtd->audio_client,
@@ -586,6 +630,7 @@ static int msm_pcm_capture_prepare(struct snd_pcm_substream *substream)
						sample_word_size,
						ASM_LITTLE_ENDIAN,
						DEFAULT_QF);
	}
	if (ret < 0)
		pr_debug("%s: cmd cfg pcm was block failed", __func__);