Commit 4b0dbdb1 authored by Anssi Hannula's avatar Anssi Hannula Committed by Takashi Iwai

ALSA: hda - Do not wrongly restrict min_channels based on ELD

Commit bbbe3390 added functionality to restrict PCM parameters
based on ELD info (derived from EDID data) of the audio sink.

However, it wrongly assumes that the bits 0-2 of the first byte of
CEA Short Audio Descriptors mean a supported number of channels. In
reality, they mean the maximum number of channels (as per CEA-861-D
7.5.2). This means that the channel count can only be used to restrict
max_channels, not min_channels.

Restricting min_channels causes us to deny opening the device in stereo
mode if the sink only has SADs that declare larger numbers of channels
(like Primare SP32 AV Processor does).

Fix that by not restricting min_channels based on ELD information.
Signed-off-by: default avatarAnssi Hannula <anssi.hannula@iki.fi>
Reported-by: default avatarJean-Yves Avenard <jyavenard@gmail.com>
Tested-by: default avatarJean-Yves Avenard <jyavenard@gmail.com>
Cc: stable@kernel.org
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent dd5a089e
...@@ -601,13 +601,10 @@ void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm, ...@@ -601,13 +601,10 @@ void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm,
pcm->rates = 0; pcm->rates = 0;
pcm->formats = 0; pcm->formats = 0;
pcm->maxbps = 0; pcm->maxbps = 0;
pcm->channels_min = -1;
pcm->channels_max = 0; pcm->channels_max = 0;
for (i = 0; i < eld->sad_count; i++) { for (i = 0; i < eld->sad_count; i++) {
struct cea_sad *a = &eld->sad[i]; struct cea_sad *a = &eld->sad[i];
pcm->rates |= a->rates; pcm->rates |= a->rates;
if (a->channels < pcm->channels_min)
pcm->channels_min = a->channels;
if (a->channels > pcm->channels_max) if (a->channels > pcm->channels_max)
pcm->channels_max = a->channels; pcm->channels_max = a->channels;
if (a->format == AUDIO_CODING_TYPE_LPCM) { if (a->format == AUDIO_CODING_TYPE_LPCM) {
...@@ -635,7 +632,6 @@ void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm, ...@@ -635,7 +632,6 @@ void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm,
/* restrict the parameters by the values the codec provides */ /* restrict the parameters by the values the codec provides */
pcm->rates &= codec_pars->rates; pcm->rates &= codec_pars->rates;
pcm->formats &= codec_pars->formats; pcm->formats &= codec_pars->formats;
pcm->channels_min = max(pcm->channels_min, codec_pars->channels_min);
pcm->channels_max = min(pcm->channels_max, codec_pars->channels_max); pcm->channels_max = min(pcm->channels_max, codec_pars->channels_max);
pcm->maxbps = min(pcm->maxbps, codec_pars->maxbps); pcm->maxbps = min(pcm->maxbps, codec_pars->maxbps);
} }
...@@ -834,7 +834,6 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, ...@@ -834,7 +834,6 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
return -ENODEV; return -ENODEV;
} else { } else {
/* fallback to the codec default */ /* fallback to the codec default */
hinfo->channels_min = codec_pars->channels_min;
hinfo->channels_max = codec_pars->channels_max; hinfo->channels_max = codec_pars->channels_max;
hinfo->rates = codec_pars->rates; hinfo->rates = codec_pars->rates;
hinfo->formats = codec_pars->formats; hinfo->formats = codec_pars->formats;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment