diff options
| author | Anssi Hannula <anssi.hannula@iki.fi> | 2010-12-07 14:19:23 -0500 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2010-12-08 02:36:20 -0500 |
| commit | 0bbaee3a58c379c4f7bab9635c71d7bad9c422a2 (patch) | |
| tree | 143b422842c08ce1deb32fc78529924a24b26823 | |
| parent | 3dc86429032910bdf762adeb2969112bb303924c (diff) | |
ALSA: hda - Reset sample sizes and max bitrates when reading ELD
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>
| -rw-r--r-- | sound/pci/hda/hda_eld.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index 009031fae2b..4a663471dad 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
| @@ -189,6 +189,9 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a, | |||
| 189 | a->channels = GRAB_BITS(buf, 0, 0, 3); | 189 | a->channels = GRAB_BITS(buf, 0, 0, 3); |
| 190 | a->channels++; | 190 | a->channels++; |
| 191 | 191 | ||
| 192 | a->sample_bits = 0; | ||
| 193 | a->max_bitrate = 0; | ||
| 194 | |||
| 192 | a->format = GRAB_BITS(buf, 0, 3, 4); | 195 | a->format = GRAB_BITS(buf, 0, 3, 4); |
| 193 | switch (a->format) { | 196 | switch (a->format) { |
| 194 | case AUDIO_CODING_TYPE_REF_STREAM_HEADER: | 197 | case AUDIO_CODING_TYPE_REF_STREAM_HEADER: |
| @@ -198,7 +201,6 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a, | |||
| 198 | 201 | ||
| 199 | case AUDIO_CODING_TYPE_LPCM: | 202 | case AUDIO_CODING_TYPE_LPCM: |
| 200 | val = GRAB_BITS(buf, 2, 0, 3); | 203 | val = GRAB_BITS(buf, 2, 0, 3); |
| 201 | a->sample_bits = 0; | ||
| 202 | for (i = 0; i < 3; i++) | 204 | for (i = 0; i < 3; i++) |
| 203 | if (val & (1 << i)) | 205 | if (val & (1 << i)) |
| 204 | a->sample_bits |= cea_sample_sizes[i + 1]; | 206 | a->sample_bits |= cea_sample_sizes[i + 1]; |
