aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_eld.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/hda_eld.c')
-rw-r--r--sound/pci/hda/hda_eld.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index e3e853153d14..28ce17d09c33 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -580,43 +580,45 @@ void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld)
580#endif /* CONFIG_PROC_FS */ 580#endif /* CONFIG_PROC_FS */
581 581
582/* update PCM info based on ELD */ 582/* update PCM info based on ELD */
583void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm, 583void snd_hdmi_eld_update_pcm_info(struct hdmi_eld *eld,
584 struct hda_pcm_stream *codec_pars) 584 struct hda_pcm_stream *hinfo)
585{ 585{
586 u32 rates;
587 u64 formats;
588 unsigned int maxbps;
589 unsigned int channels_max;
586 int i; 590 int i;
587 591
588 /* assume basic audio support (the basic audio flag is not in ELD; 592 /* assume basic audio support (the basic audio flag is not in ELD;
589 * however, all audio capable sinks are required to support basic 593 * however, all audio capable sinks are required to support basic
590 * audio) */ 594 * audio) */
591 pcm->rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000; 595 rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |
592 pcm->formats = SNDRV_PCM_FMTBIT_S16_LE; 596 SNDRV_PCM_RATE_48000;
593 pcm->maxbps = 16; 597 formats = SNDRV_PCM_FMTBIT_S16_LE;
594 pcm->channels_max = 2; 598 maxbps = 16;
599 channels_max = 2;
595 for (i = 0; i < eld->sad_count; i++) { 600 for (i = 0; i < eld->sad_count; i++) {
596 struct cea_sad *a = &eld->sad[i]; 601 struct cea_sad *a = &eld->sad[i];
597 pcm->rates |= a->rates; 602 rates |= a->rates;
598 if (a->channels > pcm->channels_max) 603 if (a->channels > channels_max)
599 pcm->channels_max = a->channels; 604 channels_max = a->channels;
600 if (a->format == AUDIO_CODING_TYPE_LPCM) { 605 if (a->format == AUDIO_CODING_TYPE_LPCM) {
601 if (a->sample_bits & AC_SUPPCM_BITS_20) { 606 if (a->sample_bits & AC_SUPPCM_BITS_20) {
602 pcm->formats |= SNDRV_PCM_FMTBIT_S32_LE; 607 formats |= SNDRV_PCM_FMTBIT_S32_LE;
603 if (pcm->maxbps < 20) 608 if (maxbps < 20)
604 pcm->maxbps = 20; 609 maxbps = 20;
605 } 610 }
606 if (a->sample_bits & AC_SUPPCM_BITS_24) { 611 if (a->sample_bits & AC_SUPPCM_BITS_24) {
607 pcm->formats |= SNDRV_PCM_FMTBIT_S32_LE; 612 formats |= SNDRV_PCM_FMTBIT_S32_LE;
608 if (pcm->maxbps < 24) 613 if (maxbps < 24)
609 pcm->maxbps = 24; 614 maxbps = 24;
610 } 615 }
611 } 616 }
612 } 617 }
613 618
614 if (!codec_pars)
615 return;
616
617 /* restrict the parameters by the values the codec provides */ 619 /* restrict the parameters by the values the codec provides */
618 pcm->rates &= codec_pars->rates; 620 hinfo->rates &= rates;
619 pcm->formats &= codec_pars->formats; 621 hinfo->formats &= formats;
620 pcm->channels_max = min(pcm->channels_max, codec_pars->channels_max); 622 hinfo->maxbps = min(hinfo->maxbps, maxbps);
621 pcm->maxbps = min(pcm->maxbps, codec_pars->maxbps); 623 hinfo->channels_max = min(hinfo->channels_max, channels_max);
622} 624}