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

Unverified Commit b5453e8c authored by Takashi Iwai's avatar Takashi Iwai Committed by Mark Brown
Browse files

ASoC: intel: Fix snd_pcm_format_t handling



As sparse warns, the PCM format type can't be dealt as integer as
found in Intel SST driver codes.

Fix them in the following two ways:

- The open code with snd_mask_set() and params->masks reference is
  replaced with params_set_format()

- The rest codes with snd_mask_set(fmt, SNDRV_PCM_FORMAT_XXX) are
  replaced with the new helper, snd_mask_set_format().

Reported-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 533a9274
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -154,9 +154,7 @@ static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,
	channels->min = channels->max = 2;

	/* set SSP0 to 16 bit */
	snd_mask_set(&params->masks[SNDRV_PCM_HW_PARAM_FORMAT -
				    SNDRV_PCM_HW_PARAM_FIRST_MASK],
				    SNDRV_PCM_FORMAT_S16_LE);
	params_set_format(params, SNDRV_PCM_FORMAT_S16_LE);
	return 0;
}

+1 −1
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@ static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd,

	/* set SSP to 24 bit */
	snd_mask_none(fmt);
	snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
	snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);

	return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -221,7 +221,7 @@ static int broxton_ssp5_fixup(struct snd_soc_pcm_runtime *rtd,

	/* set SSP5 to 24 bit */
	snd_mask_none(fmt);
	snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
	snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);

	return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,

	/* set SSP to 24 bit */
	snd_mask_none(fmt);
	snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
	snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);

	return 0;
}
+2 −2
Original line number Diff line number Diff line
@@ -434,14 +434,14 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
		rate->min = rate->max = 48000;
		channels->min = channels->max = 2;
		snd_mask_none(fmt);
		snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
		snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
	}
	/*
	 * The speaker on the SSP0 supports S16_LE and not S24_LE.
	 * thus changing the mask here
	 */
	if (!strcmp(be_dai_link->name, "SSP0-Codec"))
		snd_mask_set(fmt, SNDRV_PCM_FORMAT_S16_LE);
		snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);

	return 0;
}
Loading