ALSA: hda: Switch to new stream-format interface
commit 61b52df4b64fa1c8860cdfbc548cd0bbe7310082 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-6-cezary.rojewski@intel.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
8f362f3483
commit
c1e4b8ffa0
|
@ -151,7 +151,7 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream)
|
||||||
struct azx_dev *azx_dev = get_azx_dev(substream);
|
struct azx_dev *azx_dev = get_azx_dev(substream);
|
||||||
struct hda_pcm_stream *hinfo = to_hda_pcm_stream(substream);
|
struct hda_pcm_stream *hinfo = to_hda_pcm_stream(substream);
|
||||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||||
unsigned int format_val, stream_tag;
|
unsigned int format_val, stream_tag, bits;
|
||||||
int err;
|
int err;
|
||||||
struct hda_spdif_out *spdif =
|
struct hda_spdif_out *spdif =
|
||||||
snd_hda_spdif_out_of_nid(apcm->codec, hinfo->nid);
|
snd_hda_spdif_out_of_nid(apcm->codec, hinfo->nid);
|
||||||
|
@ -165,11 +165,9 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream)
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_hdac_stream_reset(azx_stream(azx_dev));
|
snd_hdac_stream_reset(azx_stream(azx_dev));
|
||||||
format_val = snd_hdac_calc_stream_format(runtime->rate,
|
bits = snd_hdac_stream_format_bits(runtime->format, SNDRV_PCM_SUBFORMAT_STD, hinfo->maxbps);
|
||||||
runtime->channels,
|
|
||||||
runtime->format,
|
format_val = snd_hdac_spdif_stream_format(runtime->channels, bits, runtime->rate, ctls);
|
||||||
hinfo->maxbps,
|
|
||||||
ctls);
|
|
||||||
if (!format_val) {
|
if (!format_val) {
|
||||||
dev_err(chip->card->dev,
|
dev_err(chip->card->dev,
|
||||||
"invalid format_val, rate=%d, ch=%d, format=%d\n",
|
"invalid format_val, rate=%d, ch=%d, format=%d\n",
|
||||||
|
|
Loading…
Reference in New Issue