diff options
Diffstat (limited to 'sound/pci/hda/hda_eld.c')
-rw-r--r-- | sound/pci/hda/hda_eld.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index d8da18a9e98b..803b298f7411 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
@@ -596,4 +596,53 @@ void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld) | |||
596 | } | 596 | } |
597 | EXPORT_SYMBOL_HDA(snd_hda_eld_proc_free); | 597 | EXPORT_SYMBOL_HDA(snd_hda_eld_proc_free); |
598 | 598 | ||
599 | /* update PCM info based on ELD */ | ||
600 | void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm, | ||
601 | struct hda_pcm_stream *codec_pars) | ||
602 | { | ||
603 | int i; | ||
604 | |||
605 | pcm->rates = 0; | ||
606 | pcm->formats = 0; | ||
607 | pcm->maxbps = 0; | ||
608 | pcm->channels_min = -1; | ||
609 | pcm->channels_max = 0; | ||
610 | for (i = 0; i < eld->sad_count; i++) { | ||
611 | struct cea_sad *a = &eld->sad[i]; | ||
612 | pcm->rates |= a->rates; | ||
613 | if (a->channels < pcm->channels_min) | ||
614 | pcm->channels_min = a->channels; | ||
615 | if (a->channels > pcm->channels_max) | ||
616 | pcm->channels_max = a->channels; | ||
617 | if (a->format == AUDIO_CODING_TYPE_LPCM) { | ||
618 | if (a->sample_bits & AC_SUPPCM_BITS_16) { | ||
619 | pcm->formats |= SNDRV_PCM_FMTBIT_S16_LE; | ||
620 | if (pcm->maxbps < 16) | ||
621 | pcm->maxbps = 16; | ||
622 | } | ||
623 | if (a->sample_bits & AC_SUPPCM_BITS_20) { | ||
624 | pcm->formats |= SNDRV_PCM_FMTBIT_S32_LE; | ||
625 | if (pcm->maxbps < 20) | ||
626 | pcm->maxbps = 20; | ||
627 | } | ||
628 | if (a->sample_bits & AC_SUPPCM_BITS_24) { | ||
629 | pcm->formats |= SNDRV_PCM_FMTBIT_S32_LE; | ||
630 | if (pcm->maxbps < 24) | ||
631 | pcm->maxbps = 24; | ||
632 | } | ||
633 | } | ||
634 | } | ||
635 | |||
636 | if (!codec_pars) | ||
637 | return; | ||
638 | |||
639 | /* restrict the parameters by the values the codec provides */ | ||
640 | pcm->rates &= codec_pars->rates; | ||
641 | pcm->formats &= codec_pars->formats; | ||
642 | pcm->channels_min = max(pcm->channels_min, codec_pars->channels_min); | ||
643 | pcm->channels_max = min(pcm->channels_max, codec_pars->channels_max); | ||
644 | pcm->maxbps = min(pcm->maxbps, codec_pars->maxbps); | ||
645 | } | ||
646 | EXPORT_SYMBOL_HDA(hdmi_eld_update_pcm_info); | ||
647 | |||
599 | #endif /* CONFIG_PROC_FS */ | 648 | #endif /* CONFIG_PROC_FS */ |