Skip to content

Commit 021b9c8

Browse files
HiassofTpopcornmix
authored andcommitted
drm/vc4: move setup from hw_params to prepare
Configuring HDMI audio registers in prepare allows us to take IEC958 bits into account which are set by the alsa hook after the hw_params call. Signed-off-by: Matthias Reichl <hias@horus.com>
1 parent 80bb36b commit 021b9c8

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

‎drivers/gpu/drm/vc4/vc4_hdmi.c‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -955,8 +955,7 @@ static int sample_rate_to_mai_fmt(int samplerate)
955955
}
956956

957957
/* HDMI audio codec callbacks */
958-
static int vc4_hdmi_audio_hw_params(struct snd_pcm_substream *substream,
959-
struct snd_pcm_hw_params *params,
958+
static int vc4_hdmi_audio_prepare(struct snd_pcm_substream *substream,
960959
struct snd_soc_dai *dai)
961960
{
962961
struct vc4_hdmi *vc4_hdmi = dai_to_hdmi(dai);
@@ -969,12 +968,15 @@ static int vc4_hdmi_audio_hw_params(struct snd_pcm_substream *substream,
969968
if (substream != vc4_hdmi->audio.substream)
970969
return -EINVAL;
971970

972-
dev_dbg(dev, "%s: %u Hz, %d bit, %d channels\n", __func__,
973-
params_rate(params), params_width(params),
974-
params_channels(params));
971+
dev_dbg(dev, "%s: %u Hz, %d bit, %d channels AES0=%02x\n",
972+
__func__,
973+
substream->runtime->rate,
974+
snd_pcm_format_width(substream->runtime->format),
975+
substream->runtime->channels,
976+
vc4_hdmi->audio.iec_status[0]);
975977

976-
vc4_hdmi->audio.channels = params_channels(params);
977-
vc4_hdmi->audio.samplerate = params_rate(params);
978+
vc4_hdmi->audio.channels = substream->runtime->channels;
979+
vc4_hdmi->audio.samplerate = substream->runtime->rate;
978980

979981
HDMI_WRITE(HDMI_MAI_CTL,
980982
VC4_HD_MAI_CTL_RESET |
@@ -1193,7 +1195,7 @@ static const struct snd_soc_component_driver vc4_hdmi_audio_component_drv = {
11931195
static const struct snd_soc_dai_ops vc4_hdmi_audio_dai_ops = {
11941196
.startup = vc4_hdmi_audio_startup,
11951197
.shutdown = vc4_hdmi_audio_shutdown,
1196-
.hw_params = vc4_hdmi_audio_hw_params,
1198+
.prepare = vc4_hdmi_audio_prepare,
11971199
.set_fmt = vc4_hdmi_audio_set_fmt,
11981200
.trigger = vc4_hdmi_audio_trigger,
11991201
};

0 commit comments

Comments
 (0)