|
@@ -580,43 +580,45 @@ void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld)
|
|
|
#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)
|
|
|
+void snd_hdmi_eld_update_pcm_info(struct hdmi_eld *eld,
|
|
|
+ struct hda_pcm_stream *hinfo)
|
|
|
{
|
|
|
+ u32 rates;
|
|
|
+ u64 formats;
|
|
|
+ unsigned int maxbps;
|
|
|
+ unsigned int channels_max;
|
|
|
int i;
|
|
|
|
|
|
/* assume basic audio support (the basic audio flag is not in ELD;
|
|
|
* however, all audio capable sinks are required to support basic
|
|
|
* audio) */
|
|
|
- pcm->rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000;
|
|
|
- pcm->formats = SNDRV_PCM_FMTBIT_S16_LE;
|
|
|
- pcm->maxbps = 16;
|
|
|
- pcm->channels_max = 2;
|
|
|
+ rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |
|
|
|
+ SNDRV_PCM_RATE_48000;
|
|
|
+ formats = SNDRV_PCM_FMTBIT_S16_LE;
|
|
|
+ maxbps = 16;
|
|
|
+ channels_max = 2;
|
|
|
for (i = 0; i < eld->sad_count; i++) {
|
|
|
struct cea_sad *a = &eld->sad[i];
|
|
|
- pcm->rates |= a->rates;
|
|
|
- if (a->channels > pcm->channels_max)
|
|
|
- pcm->channels_max = a->channels;
|
|
|
+ rates |= a->rates;
|
|
|
+ if (a->channels > channels_max)
|
|
|
+ channels_max = a->channels;
|
|
|
if (a->format == AUDIO_CODING_TYPE_LPCM) {
|
|
|
if (a->sample_bits & AC_SUPPCM_BITS_20) {
|
|
|
- pcm->formats |= SNDRV_PCM_FMTBIT_S32_LE;
|
|
|
- if (pcm->maxbps < 20)
|
|
|
- pcm->maxbps = 20;
|
|
|
+ formats |= SNDRV_PCM_FMTBIT_S32_LE;
|
|
|
+ if (maxbps < 20)
|
|
|
+ maxbps = 20;
|
|
|
}
|
|
|
if (a->sample_bits & AC_SUPPCM_BITS_24) {
|
|
|
- pcm->formats |= SNDRV_PCM_FMTBIT_S32_LE;
|
|
|
- if (pcm->maxbps < 24)
|
|
|
- pcm->maxbps = 24;
|
|
|
+ formats |= SNDRV_PCM_FMTBIT_S32_LE;
|
|
|
+ if (maxbps < 24)
|
|
|
+ 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_max = min(pcm->channels_max, codec_pars->channels_max);
|
|
|
- pcm->maxbps = min(pcm->maxbps, codec_pars->maxbps);
|
|
|
+ hinfo->rates &= rates;
|
|
|
+ hinfo->formats &= formats;
|
|
|
+ hinfo->maxbps = min(hinfo->maxbps, maxbps);
|
|
|
+ hinfo->channels_max = min(hinfo->channels_max, channels_max);
|
|
|
}
|