ASoC: Intel: avs: Switch to new stream-format interface
commit 615d13cb4f3e499fb5c270a7db66917286f7d0ec upstream. 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-14-cezary.rojewski@intel.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
3645c0d185
commit
1826fff91f
|
@ -371,7 +371,7 @@ int avs_hda_load_basefw(struct avs_dev *adev, struct firmware *fw)
|
|||
hstream = hdac_stream(estream);
|
||||
|
||||
/* code loading performed with default format */
|
||||
sdfmt = snd_hdac_calc_stream_format(48000, 1, SNDRV_PCM_FORMAT_S32_LE, 32, 0);
|
||||
sdfmt = snd_hdac_stream_format(1, 32, 48000);
|
||||
ret = snd_hdac_dsp_prepare(hstream, sdfmt, fw->size, &dmab);
|
||||
if (ret < 0)
|
||||
goto release_stream;
|
||||
|
@ -438,7 +438,7 @@ int avs_hda_load_library(struct avs_dev *adev, struct firmware *lib, u32 id)
|
|||
stream = hdac_stream(estream);
|
||||
|
||||
/* code loading performed with default format */
|
||||
sdfmt = snd_hdac_calc_stream_format(48000, 1, SNDRV_PCM_FORMAT_S32_LE, 32, 0);
|
||||
sdfmt = snd_hdac_stream_format(1, 32, 48000);
|
||||
ret = snd_hdac_dsp_prepare(stream, sdfmt, lib->size, &dmab);
|
||||
if (ret < 0)
|
||||
goto release_stream;
|
||||
|
|
|
@ -87,7 +87,7 @@ static bool avs_test_hw_params(struct snd_pcm_hw_params *params,
|
|||
return (params_rate(params) == fmt->sampling_freq &&
|
||||
params_channels(params) == fmt->num_channels &&
|
||||
params_physical_width(params) == fmt->bit_depth &&
|
||||
params_width(params) == fmt->valid_bit_depth);
|
||||
snd_pcm_hw_params_bits(params) == fmt->valid_bit_depth);
|
||||
}
|
||||
|
||||
static struct avs_tplg_path *
|
||||
|
|
|
@ -337,20 +337,25 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct sn
|
|||
{
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct hdac_ext_stream *link_stream = runtime->private_data;
|
||||
struct snd_soc_pcm_stream *stream_info;
|
||||
struct hdac_ext_stream *link_stream;
|
||||
struct hdac_ext_link *link;
|
||||
struct hda_codec *codec;
|
||||
struct hdac_bus *bus;
|
||||
unsigned int format_val;
|
||||
unsigned int bits;
|
||||
int ret;
|
||||
|
||||
link_stream = runtime->private_data;
|
||||
if (link_stream->link_prepared)
|
||||
return 0;
|
||||
|
||||
codec = dev_to_hda_codec(asoc_rtd_to_codec(rtd, 0)->dev);
|
||||
bus = &codec->bus->core;
|
||||
format_val = snd_hdac_calc_stream_format(runtime->rate, runtime->channels, runtime->format,
|
||||
runtime->sample_bits, 0);
|
||||
stream_info = snd_soc_dai_get_pcm_stream(dai, substream->stream);
|
||||
bits = snd_hdac_stream_format_bits(runtime->format, runtime->subformat,
|
||||
stream_info->sig_bits);
|
||||
format_val = snd_hdac_stream_format(runtime->channels, bits, runtime->rate);
|
||||
|
||||
snd_hdac_ext_stream_reset(link_stream);
|
||||
snd_hdac_ext_stream_setup(link_stream, format_val);
|
||||
|
@ -602,10 +607,12 @@ static int avs_dai_fe_hw_free(struct snd_pcm_substream *substream, struct snd_so
|
|||
static int avs_dai_fe_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_soc_pcm_stream *stream_info;
|
||||
struct avs_dma_data *data;
|
||||
struct avs_dev *adev = to_avs_dev(dai->dev);
|
||||
struct hdac_ext_stream *host_stream;
|
||||
unsigned int format_val;
|
||||
unsigned int bits;
|
||||
int ret;
|
||||
|
||||
data = snd_soc_dai_get_dma_data(dai, substream);
|
||||
|
@ -616,8 +623,10 @@ static int avs_dai_fe_prepare(struct snd_pcm_substream *substream, struct snd_so
|
|||
|
||||
snd_hdac_stream_reset(hdac_stream(host_stream));
|
||||
|
||||
format_val = snd_hdac_calc_stream_format(runtime->rate, runtime->channels, runtime->format,
|
||||
runtime->sample_bits, 0);
|
||||
stream_info = snd_soc_dai_get_pcm_stream(dai, substream->stream);
|
||||
bits = snd_hdac_stream_format_bits(runtime->format, runtime->subformat,
|
||||
stream_info->sig_bits);
|
||||
format_val = snd_hdac_stream_format(runtime->channels, bits, runtime->rate);
|
||||
|
||||
ret = snd_hdac_stream_set_params(hdac_stream(host_stream), format_val);
|
||||
if (ret < 0)
|
||||
|
|
|
@ -140,8 +140,7 @@ static int avs_probe_compr_set_params(struct snd_compr_stream *cstream,
|
|||
bps = snd_pcm_format_physical_width(format);
|
||||
if (bps < 0)
|
||||
return bps;
|
||||
format_val = snd_hdac_calc_stream_format(params->codec.sample_rate, params->codec.ch_out,
|
||||
format, bps, 0);
|
||||
format_val = snd_hdac_stream_format(params->codec.ch_out, bps, params->codec.sample_rate);
|
||||
ret = snd_hdac_stream_set_params(hdac_stream(host_stream), format_val);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue