Skip to content

Commit

Permalink
ASoC: Intel: avs: Unhardcode HDAudio BE DAI drivers description
Browse files Browse the repository at this point in the history
To not expose more than in fact is supported by the codec, update CPU
DAI initialization procedure to rely on codec capabilities instead of
hardcoding them. This includes subformat which is currently ignored.

As capabilities for HDMI streams are initialized on PCM open, leave it
as is for now.

Signed-off-by: Cezary Rojewski <[email protected]>
  • Loading branch information
crojewsk-intel committed Aug 22, 2023
1 parent f623575 commit 03d751b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sound/soc/intel/avs/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "avs.h"
#include "path.h"
#include "topology.h"
#include "../../codecs/hda.h"

struct avs_dma_data {
struct avs_tplg_path_template *template;
Expand Down Expand Up @@ -1378,6 +1379,15 @@ static int avs_component_hda_probe(struct snd_soc_component *component)
ret = -ENOMEM;
goto exit;
}

if (!hda_codec_is_display(codec)) {
dais[i].playback.formats = pcm->stream[0].formats;
dais[i].playback.subformats = pcm->stream[0].subformats;
dais[i].playback.rates = pcm->stream[0].rates;
dais[i].playback.channels_min = pcm->stream[0].channels_min;
dais[i].playback.channels_max = pcm->stream[0].channels_max;
dais[i].playback.sig_bits = pcm->stream[0].maxbps;
}
}

if (pcm->stream[1].substreams) {
Expand All @@ -1388,6 +1398,15 @@ static int avs_component_hda_probe(struct snd_soc_component *component)
ret = -ENOMEM;
goto exit;
}

if (!hda_codec_is_display(codec)) {
dais[i].capture.formats = pcm->stream[1].formats;
dais[i].capture.subformats = pcm->stream[1].subformats;
dais[i].capture.rates = pcm->stream[1].rates;
dais[i].capture.channels_min = pcm->stream[1].channels_min;
dais[i].capture.channels_max = pcm->stream[1].channels_max;
dais[i].capture.sig_bits = pcm->stream[1].maxbps;
}
}

dai = snd_soc_register_dai(component, &dais[i], false);
Expand Down

0 comments on commit 03d751b

Please sign in to comment.