ASoC: SOF: Intel: Switch to new stream-format interface
To provide option for selecting different bit-per-sample than just the maximum one, use the new format calculation mechanism. Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Acked-by: Jaroslav Kysela <perex@perex.cz> Link: https://lore.kernel.org/r/20231117120610.1755254-13-cezary.rojewski@intel.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
71fd0fbaf6
commit
176d138811
@ -208,14 +208,16 @@ static unsigned int hda_calc_stream_format(struct snd_sof_dev *sdev,
|
||||
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
|
||||
unsigned int link_bps;
|
||||
unsigned int format_val;
|
||||
unsigned int bits;
|
||||
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
link_bps = codec_dai->driver->playback.sig_bits;
|
||||
else
|
||||
link_bps = codec_dai->driver->capture.sig_bits;
|
||||
|
||||
format_val = snd_hdac_calc_stream_format(params_rate(params), params_channels(params),
|
||||
params_format(params), link_bps, 0);
|
||||
bits = snd_hdac_stream_format_bits(params_format(params), SNDRV_PCM_SUBFORMAT_STD,
|
||||
link_bps);
|
||||
format_val = snd_hdac_stream_format(params_channels(params), bits, params_rate(params));
|
||||
|
||||
dev_dbg(sdev->dev, "format_val=%#x, rate=%d, ch=%d, format=%d\n", format_val,
|
||||
params_rate(params), params_channels(params), params_format(params));
|
||||
@ -238,11 +240,11 @@ static unsigned int generic_calc_stream_format(struct snd_sof_dev *sdev,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
unsigned int format_val;
|
||||
unsigned int bits;
|
||||
|
||||
format_val = snd_hdac_calc_stream_format(params_rate(params), params_channels(params),
|
||||
params_format(params),
|
||||
params_physical_width(params),
|
||||
0);
|
||||
bits = snd_hdac_stream_format_bits(params_format(params), SNDRV_PCM_SUBFORMAT_STD,
|
||||
params_physical_width(params));
|
||||
format_val = snd_hdac_stream_format(params_channels(params), bits, params_rate(params));
|
||||
|
||||
dev_dbg(sdev->dev, "format_val=%#x, rate=%d, ch=%d, format=%d\n", format_val,
|
||||
params_rate(params), params_channels(params), params_format(params));
|
||||
@ -258,6 +260,7 @@ static unsigned int dmic_calc_stream_format(struct snd_sof_dev *sdev,
|
||||
snd_pcm_format_t format;
|
||||
unsigned int channels;
|
||||
unsigned int width;
|
||||
unsigned int bits;
|
||||
|
||||
channels = params_channels(params);
|
||||
format = params_format(params);
|
||||
@ -269,10 +272,8 @@ static unsigned int dmic_calc_stream_format(struct snd_sof_dev *sdev,
|
||||
width = 32;
|
||||
}
|
||||
|
||||
format_val = snd_hdac_calc_stream_format(params_rate(params), channels,
|
||||
format,
|
||||
width,
|
||||
0);
|
||||
bits = snd_hdac_stream_format_bits(format, SNDRV_PCM_SUBFORMAT_STD, width);
|
||||
format_val = snd_hdac_stream_format(channels, bits, params_rate(params));
|
||||
|
||||
dev_dbg(sdev->dev, "format_val=%#x, rate=%d, ch=%d, format=%d\n", format_val,
|
||||
params_rate(params), channels, format);
|
||||
|
Loading…
Reference in New Issue
Block a user