Skip to content

Commit

Permalink
ALSA: hda - Reset sample sizes and max bitrates when reading ELD
Browse files Browse the repository at this point in the history
When a new HDMI/DP device is plugged in, hdmi_update_short_audio_desc()
is called for every SAD (Short Audio Descriptor) in the ELD data. For
LPCM coding type SAD defines the supported sample sizes. For several
other coding types (such as AC-3), a maximum bitrate is defined.

The maximum bitrate and sample size fields are not always cleared.
Therefore, if a device is unplugged and a different one is plugged in,
and the coding types of some SAD positions differ between the devices,
the old max_bitrate or sample_bits values will persist if the new SADs
do not define those values.

The leftover max_bitrate and sample_bits do not cause any issues other
than wrongly showing up in eld#X.Y procfs file and kernel log.

Fix that by always clearing sample_bits and max_bitrate when reading
SADs.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Anssi Hannula authored and Takashi Iwai committed Dec 8, 2010
1 parent 3dc8642 commit 0bbaee3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sound/pci/hda/hda_eld.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a,
a->channels = GRAB_BITS(buf, 0, 0, 3);
a->channels++;

a->sample_bits = 0;
a->max_bitrate = 0;

a->format = GRAB_BITS(buf, 0, 3, 4);
switch (a->format) {
case AUDIO_CODING_TYPE_REF_STREAM_HEADER:
Expand All @@ -198,7 +201,6 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a,

case AUDIO_CODING_TYPE_LPCM:
val = GRAB_BITS(buf, 2, 0, 3);
a->sample_bits = 0;
for (i = 0; i < 3; i++)
if (val & (1 << i))
a->sample_bits |= cea_sample_sizes[i + 1];
Expand Down

0 comments on commit 0bbaee3

Please sign in to comment.