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

Commit c7722df2 authored by Divya Narayanan Poojary's avatar Divya Narayanan Poojary
Browse files

ASoC: msm: Handle bit_width to configure ASM session for FLAC playback



ASM session is configured with 16 bit for 24 bit flac clips.
Read sample size from compress params passed by the
userspace and configure ASM session accordingly.

CRs-Fixed: 2086257
Change-Id: Id4ae560b423b6f997661836c50989d2996c91b54
Signed-off-by: default avatarDivya Narayanan Poojary <dnaray@codeaurora.org>
parent a9eb03fd
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1062,6 +1062,9 @@ static int msm_compr_configure_dsp_for_playback
	int dir = IN, ret = 0;
	struct audio_client *ac = prtd->audio_client;
	uint32_t stream_index;
	union snd_codec_options *codec_options =
		&(prtd->codec_param.codec.options);

	struct asm_softpause_params softpause = {
		.enable = SOFT_PAUSE_ENABLE,
		.period = SOFT_PAUSE_PERIOD,
@@ -1086,6 +1089,9 @@ static int msm_compr_configure_dsp_for_playback
		bits_per_sample = 24;
	else if (prtd->codec_param.codec.format == SNDRV_PCM_FORMAT_S32_LE)
		bits_per_sample = 32;
	else if (prtd->codec == FORMAT_FLAC && codec_options &&
		(codec_options->flac_dec.sample_size != 0))
		bits_per_sample = codec_options->flac_dec.sample_size;

	if (prtd->compr_passthr != LEGACY_PCM) {
		ret = q6asm_open_write_compressed(ac, prtd->codec,
@@ -1899,6 +1905,8 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)
	int stream_id;
	uint32_t stream_index;
	uint16_t bits_per_sample = 16;
	union snd_codec_options *codec_options =
		&(prtd->codec_param.codec.options);

	spin_lock_irqsave(&prtd->lock, flags);
	if (atomic_read(&prtd->error)) {
@@ -2318,6 +2326,9 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)
		else if (prtd->codec_param.codec.format ==
			 SNDRV_PCM_FORMAT_S32_LE)
			bits_per_sample = 32;
		else if (prtd->codec == FORMAT_FLAC && codec_options &&
			(codec_options->flac_dec.sample_size != 0))
			bits_per_sample = codec_options->flac_dec.sample_size;

		pr_debug("%s: open_write stream_id %d bits_per_sample %d",
				__func__, stream_id, bits_per_sample);