···12611261}12621262EXPORT_SYMBOL_HDA(snd_hda_codec_setup_stream);1263126312641264+static void really_cleanup_stream(struct hda_codec *codec,12651265+ struct hda_cvt_setup *q);12661266+12641267/**12651265- * snd_hda_codec_cleanup_stream - clean up the codec for closing12681268+ * __snd_hda_codec_cleanup_stream - clean up the codec for closing12661269 * @codec: the CODEC to clean up12671270 * @nid: the NID to clean up12711271+ * @do_now: really clean up the stream instead of clearing the active flag12681272 */12691269-void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid)12731273+void __snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid,12741274+ int do_now)12701275{12711276 struct hda_cvt_setup *p;12721277···12791274 return;1280127512811276 snd_printdd("hda_codec_cleanup_stream: NID=0x%x\n", nid);12821282- /* here we just clear the active flag; actual clean-ups will be done12831283- * in purify_inactive_streams()12841284- */12851277 p = get_hda_cvt_setup(codec, nid);12861286- if (p)12871287- p->active = 0;12781278+ if (p) {12791279+ /* here we just clear the active flag when do_now isn't set;12801280+ * actual clean-ups will be done later in12811281+ * purify_inactive_streams() called from snd_hda_codec_prpapre()12821282+ */12831283+ if (do_now)12841284+ really_cleanup_stream(codec, p);12851285+ else12861286+ p->active = 0;12871287+ }12881288}12891289-EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream);12891289+EXPORT_SYMBOL_HDA(__snd_hda_codec_cleanup_stream);1290129012911291static void really_cleanup_stream(struct hda_codec *codec,12921292 struct hda_cvt_setup *q)
+4-1
sound/pci/hda/hda_codec.h
···963963void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid,964964 u32 stream_tag,965965 int channel_id, int format);966966-void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid);966966+void __snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid,967967+ int do_now);968968+#define snd_hda_codec_cleanup_stream(codec, nid) \969969+ __snd_hda_codec_cleanup_stream(codec, nid, 0)967970unsigned int snd_hda_calc_stream_format(unsigned int rate,968971 unsigned int channels,969972 unsigned int format,
+49
sound/pci/hda/hda_eld.c
···596596}597597EXPORT_SYMBOL_HDA(snd_hda_eld_proc_free);598598599599+/* update PCM info based on ELD */600600+void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm,601601+ struct hda_pcm_stream *codec_pars)602602+{603603+ int i;604604+605605+ pcm->rates = 0;606606+ pcm->formats = 0;607607+ pcm->maxbps = 0;608608+ pcm->channels_min = -1;609609+ pcm->channels_max = 0;610610+ for (i = 0; i < eld->sad_count; i++) {611611+ struct cea_sad *a = &eld->sad[i];612612+ pcm->rates |= a->rates;613613+ if (a->channels < pcm->channels_min)614614+ pcm->channels_min = a->channels;615615+ if (a->channels > pcm->channels_max)616616+ pcm->channels_max = a->channels;617617+ if (a->format == AUDIO_CODING_TYPE_LPCM) {618618+ if (a->sample_bits & AC_SUPPCM_BITS_16) {619619+ pcm->formats |= SNDRV_PCM_FMTBIT_S16_LE;620620+ if (pcm->maxbps < 16)621621+ pcm->maxbps = 16;622622+ }623623+ if (a->sample_bits & AC_SUPPCM_BITS_20) {624624+ pcm->formats |= SNDRV_PCM_FMTBIT_S32_LE;625625+ if (pcm->maxbps < 20)626626+ pcm->maxbps = 20;627627+ }628628+ if (a->sample_bits & AC_SUPPCM_BITS_24) {629629+ pcm->formats |= SNDRV_PCM_FMTBIT_S32_LE;630630+ if (pcm->maxbps < 24)631631+ pcm->maxbps = 24;632632+ }633633+ }634634+ }635635+636636+ if (!codec_pars)637637+ return;638638+639639+ /* restrict the parameters by the values the codec provides */640640+ pcm->rates &= codec_pars->rates;641641+ pcm->formats &= codec_pars->formats;642642+ pcm->channels_min = max(pcm->channels_min, codec_pars->channels_min);643643+ pcm->channels_max = min(pcm->channels_max, codec_pars->channels_max);644644+ pcm->maxbps = min(pcm->maxbps, codec_pars->maxbps);645645+}646646+EXPORT_SYMBOL_HDA(hdmi_eld_update_pcm_info);647647+599648#endif /* CONFIG_PROC_FS */