summaryrefslogtreecommitdiffstats
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.c54
1 files changed, 48 insertions, 6 deletions
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index d8da18a9e98b..cb0c23a6b473 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -332,7 +332,6 @@ int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid)
return snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_HDMI_DIP_SIZE,
AC_DIPSIZE_ELD_BUF);
}
-EXPORT_SYMBOL_HDA(snd_hdmi_get_eld_size);
int snd_hdmi_get_eld(struct hdmi_eld *eld,
struct hda_codec *codec, hda_nid_t nid)
@@ -368,7 +367,6 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld,
kfree(buf);
return ret;
}
-EXPORT_SYMBOL_HDA(snd_hdmi_get_eld);
static void hdmi_show_short_audio_desc(struct cea_sad *a)
{
@@ -407,7 +405,6 @@ void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen)
}
buf[j] = '\0'; /* necessary when j == 0 */
}
-EXPORT_SYMBOL_HDA(snd_print_channel_allocation);
void snd_hdmi_show_eld(struct hdmi_eld *e)
{
@@ -426,7 +423,6 @@ void snd_hdmi_show_eld(struct hdmi_eld *e)
for (i = 0; i < e->sad_count; i++)
hdmi_show_short_audio_desc(e->sad + i);
}
-EXPORT_SYMBOL_HDA(snd_hdmi_show_eld);
#ifdef CONFIG_PROC_FS
@@ -585,7 +581,6 @@ int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld,
return 0;
}
-EXPORT_SYMBOL_HDA(snd_hda_eld_proc_new);
void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld)
{
@@ -594,6 +589,53 @@ void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld)
eld->proc_entry = NULL;
}
}
-EXPORT_SYMBOL_HDA(snd_hda_eld_proc_free);
#endif /* CONFIG_PROC_FS */
+
+/* update PCM info based on ELD */
+void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm,
+ struct hda_pcm_stream *codec_pars)
+{
+ int i;
+
+ pcm->rates = 0;
+ pcm->formats = 0;
+ pcm->maxbps = 0;
+ pcm->channels_min = -1;
+ pcm->channels_max = 0;
+ for (i = 0; i < eld->sad_count; i++) {
+ struct cea_sad *a = &eld->sad[i];
+ pcm->rates |= a->rates;
+ if (a->channels < pcm->channels_min)
+ pcm->channels_min = a->channels;
+ if (a->channels > pcm->channels_max)
+ pcm->channels_max = a->channels;
+ if (a->format == AUDIO_CODING_TYPE_LPCM) {
+ if (a->sample_bits & AC_SUPPCM_BITS_16) {
+ pcm->formats |= SNDRV_PCM_FMTBIT_S16_LE;
+ if (pcm->maxbps < 16)
+ pcm->maxbps = 16;
+ }
+ if (a->sample_bits & AC_SUPPCM_BITS_20) {
+ pcm->formats |= SNDRV_PCM_FMTBIT_S32_LE;
+ if (pcm->maxbps < 20)
+ pcm->maxbps = 20;
+ }
+ if (a->sample_bits & AC_SUPPCM_BITS_24) {
+ pcm->formats |= SNDRV_PCM_FMTBIT_S32_LE;
+ if (pcm->maxbps < 24)
+ pcm->maxbps = 24;
+ }
+ }
+ }
+
+ if (!codec_pars)
+ return;
+
+ /* restrict the parameters by the values the codec provides */
+ pcm->rates &= codec_pars->rates;
+ 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->maxbps = min(pcm->maxbps, codec_pars->maxbps);
+}