diff options
Diffstat (limited to 'sound/pci/hda/patch_hdmi.c')
-rw-r--r-- | sound/pci/hda/patch_hdmi.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 522e0748ee99..2bc0f07cf33f 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -46,6 +46,7 @@ struct hdmi_spec { | |||
46 | * export one pcm per pipe | 46 | * export one pcm per pipe |
47 | */ | 47 | */ |
48 | struct hda_pcm pcm_rec[MAX_HDMI_CVTS]; | 48 | struct hda_pcm pcm_rec[MAX_HDMI_CVTS]; |
49 | struct hda_pcm_stream codec_pcm_pars[MAX_HDMI_CVTS]; | ||
49 | 50 | ||
50 | /* | 51 | /* |
51 | * nvhdmi specific | 52 | * nvhdmi specific |
@@ -766,6 +767,47 @@ static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t nid, | |||
766 | } | 767 | } |
767 | 768 | ||
768 | /* | 769 | /* |
770 | * HDA PCM callbacks | ||
771 | */ | ||
772 | static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, | ||
773 | struct hda_codec *codec, | ||
774 | struct snd_pcm_substream *substream) | ||
775 | { | ||
776 | struct hdmi_spec *spec = codec->spec; | ||
777 | struct hdmi_eld *eld; | ||
778 | struct hda_pcm_stream *codec_pars; | ||
779 | unsigned int idx; | ||
780 | |||
781 | for (idx = 0; idx < spec->num_cvts; idx++) | ||
782 | if (hinfo->nid == spec->cvt[idx]) | ||
783 | break; | ||
784 | if (snd_BUG_ON(idx >= spec->num_cvts) || | ||
785 | snd_BUG_ON(idx >= spec->num_pins)) | ||
786 | return -EINVAL; | ||
787 | |||
788 | /* save the PCM info the codec provides */ | ||
789 | codec_pars = &spec->codec_pcm_pars[idx]; | ||
790 | if (!codec_pars->rates) | ||
791 | *codec_pars = *hinfo; | ||
792 | |||
793 | eld = &spec->sink_eld[idx]; | ||
794 | if (eld->sad_count > 0) { | ||
795 | hdmi_eld_update_pcm_info(eld, hinfo, codec_pars); | ||
796 | if (hinfo->channels_min > hinfo->channels_max || | ||
797 | !hinfo->rates || !hinfo->formats) | ||
798 | return -ENODEV; | ||
799 | } else { | ||
800 | /* fallback to the codec default */ | ||
801 | hinfo->channels_min = codec_pars->channels_min; | ||
802 | hinfo->channels_max = codec_pars->channels_max; | ||
803 | hinfo->rates = codec_pars->rates; | ||
804 | hinfo->formats = codec_pars->formats; | ||
805 | hinfo->maxbps = codec_pars->maxbps; | ||
806 | } | ||
807 | return 0; | ||
808 | } | ||
809 | |||
810 | /* | ||
769 | * HDA/HDMI auto parsing | 811 | * HDA/HDMI auto parsing |
770 | */ | 812 | */ |
771 | 813 | ||