From 2def8172c6611f2577260287ebf5dd3b63f7ef55 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Wed, 1 Jun 2011 11:14:20 -0600 Subject: ALSA: hda: hdmi_eld_update_pcm_info: update a stream in place A future change won't store an entire hda_pcm_stream just to represent the capabilities of a codec; a custom data-structure will be used. To ease that transition, modify hdmi_eld_update_pcm_info to expect the hda_pcm_stream to be pre-initialized with the codec's capabilities, and to update those capabilities in-place based on the ELD. Signed-off-by: Stephen Warren Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_hdmi.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'sound/pci/hda/patch_hdmi.c') diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 92fb105da1e..338546531c1 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -815,20 +815,22 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, if (!codec_pars->rates) *codec_pars = *hinfo; + /* Initially set the converter's capabilities */ + hinfo->channels_min = codec_pars->channels_min; + hinfo->channels_max = codec_pars->channels_max; + hinfo->rates = codec_pars->rates; + hinfo->formats = codec_pars->formats; + hinfo->maxbps = codec_pars->maxbps; + eld = &spec->sink_eld[idx]; if (!static_hdmi_pcm && eld->eld_valid) { - hdmi_eld_update_pcm_info(eld, hinfo, codec_pars); + snd_hdmi_eld_update_pcm_info(eld, hinfo); if (hinfo->channels_min > hinfo->channels_max || !hinfo->rates || !hinfo->formats) return -ENODEV; - } else { - /* fallback to the codec default */ - hinfo->channels_max = codec_pars->channels_max; - hinfo->rates = codec_pars->rates; - hinfo->formats = codec_pars->formats; - hinfo->maxbps = codec_pars->maxbps; } - /* store the updated parameters */ + + /* Store the updated parameters */ runtime->hw.channels_min = hinfo->channels_min; runtime->hw.channels_max = hinfo->channels_max; runtime->hw.formats = hinfo->formats; -- cgit v1.2.3-70-g09d2