.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * |
---|
3 | 4 | * patch_hdmi.c - routines for HDMI/DisplayPort codecs |
---|
.. | .. |
---|
13 | 14 | * |
---|
14 | 15 | * Maintained by: |
---|
15 | 16 | * Wu Fengguang <wfg@linux.intel.com> |
---|
16 | | - * |
---|
17 | | - * This program is free software; you can redistribute it and/or modify it |
---|
18 | | - * under the terms of the GNU General Public License as published by the Free |
---|
19 | | - * Software Foundation; either version 2 of the License, or (at your option) |
---|
20 | | - * any later version. |
---|
21 | | - * |
---|
22 | | - * This program is distributed in the hope that it will be useful, but |
---|
23 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
---|
24 | | - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
---|
25 | | - * for more details. |
---|
26 | | - * |
---|
27 | | - * You should have received a copy of the GNU General Public License |
---|
28 | | - * along with this program; if not, write to the Free Software Foundation, |
---|
29 | | - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
30 | 17 | */ |
---|
31 | 18 | |
---|
32 | 19 | #include <linux/init.h> |
---|
33 | 20 | #include <linux/delay.h> |
---|
| 21 | +#include <linux/pci.h> |
---|
34 | 22 | #include <linux/slab.h> |
---|
35 | 23 | #include <linux/module.h> |
---|
36 | 24 | #include <linux/pm_runtime.h> |
---|
.. | .. |
---|
41 | 29 | #include <sound/hdaudio.h> |
---|
42 | 30 | #include <sound/hda_i915.h> |
---|
43 | 31 | #include <sound/hda_chmap.h> |
---|
44 | | -#include "hda_codec.h" |
---|
| 32 | +#include <sound/hda_codec.h> |
---|
45 | 33 | #include "hda_local.h" |
---|
46 | 34 | #include "hda_jack.h" |
---|
| 35 | +#include "hda_controller.h" |
---|
47 | 36 | |
---|
48 | 37 | static bool static_hdmi_pcm; |
---|
49 | 38 | module_param(static_hdmi_pcm, bool, 0644); |
---|
50 | 39 | MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info"); |
---|
51 | 40 | |
---|
52 | | -#define is_haswell(codec) ((codec)->core.vendor_id == 0x80862807) |
---|
53 | | -#define is_broadwell(codec) ((codec)->core.vendor_id == 0x80862808) |
---|
54 | | -#define is_skylake(codec) ((codec)->core.vendor_id == 0x80862809) |
---|
55 | | -#define is_broxton(codec) ((codec)->core.vendor_id == 0x8086280a) |
---|
56 | | -#define is_kabylake(codec) ((codec)->core.vendor_id == 0x8086280b) |
---|
57 | | -#define is_geminilake(codec) (((codec)->core.vendor_id == 0x8086280d) || \ |
---|
58 | | - ((codec)->core.vendor_id == 0x80862800)) |
---|
59 | | -#define is_cannonlake(codec) ((codec)->core.vendor_id == 0x8086280c) |
---|
60 | | -#define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec) \ |
---|
61 | | - || is_skylake(codec) || is_broxton(codec) \ |
---|
62 | | - || is_kabylake(codec)) || is_geminilake(codec) \ |
---|
63 | | - || is_cannonlake(codec) |
---|
64 | | -#define is_valleyview(codec) ((codec)->core.vendor_id == 0x80862882) |
---|
65 | | -#define is_cherryview(codec) ((codec)->core.vendor_id == 0x80862883) |
---|
66 | | -#define is_valleyview_plus(codec) (is_valleyview(codec) || is_cherryview(codec)) |
---|
| 41 | +static bool enable_acomp = true; |
---|
| 42 | +module_param(enable_acomp, bool, 0444); |
---|
| 43 | +MODULE_PARM_DESC(enable_acomp, "Enable audio component binding (default=yes)"); |
---|
| 44 | + |
---|
| 45 | +static bool enable_silent_stream = |
---|
| 46 | +IS_ENABLED(CONFIG_SND_HDA_INTEL_HDMI_SILENT_STREAM); |
---|
| 47 | +module_param(enable_silent_stream, bool, 0644); |
---|
| 48 | +MODULE_PARM_DESC(enable_silent_stream, "Enable Silent Stream for HDMI devices"); |
---|
67 | 49 | |
---|
68 | 50 | struct hdmi_spec_per_cvt { |
---|
69 | 51 | hda_nid_t cvt_nid; |
---|
.. | .. |
---|
96 | 78 | int pcm_idx; /* which pcm is attached. -1 means no pcm is attached */ |
---|
97 | 79 | int repoll_count; |
---|
98 | 80 | bool setup; /* the stream has been set up by prepare callback */ |
---|
| 81 | + bool silent_stream; |
---|
99 | 82 | int channels; /* current number of channels */ |
---|
100 | 83 | bool non_pcm; |
---|
101 | 84 | bool chmap_set; /* channel-map override by ALSA API? */ |
---|
.. | .. |
---|
108 | 91 | /* operations used by generic code that can be overridden by patches */ |
---|
109 | 92 | struct hdmi_ops { |
---|
110 | 93 | int (*pin_get_eld)(struct hda_codec *codec, hda_nid_t pin_nid, |
---|
111 | | - unsigned char *buf, int *eld_size); |
---|
| 94 | + int dev_id, unsigned char *buf, int *eld_size); |
---|
112 | 95 | |
---|
113 | 96 | void (*pin_setup_infoframe)(struct hda_codec *codec, hda_nid_t pin_nid, |
---|
| 97 | + int dev_id, |
---|
114 | 98 | int ca, int active_channels, int conn_type); |
---|
115 | 99 | |
---|
116 | 100 | /* enable/disable HBR (HD passthrough) */ |
---|
117 | | - int (*pin_hbr_setup)(struct hda_codec *codec, hda_nid_t pin_nid, bool hbr); |
---|
| 101 | + int (*pin_hbr_setup)(struct hda_codec *codec, hda_nid_t pin_nid, |
---|
| 102 | + int dev_id, bool hbr); |
---|
118 | 103 | |
---|
119 | 104 | int (*setup_stream)(struct hda_codec *codec, hda_nid_t cvt_nid, |
---|
120 | | - hda_nid_t pin_nid, u32 stream_tag, int format); |
---|
| 105 | + hda_nid_t pin_nid, int dev_id, u32 stream_tag, |
---|
| 106 | + int format); |
---|
121 | 107 | |
---|
122 | 108 | void (*pin_cvt_fixup)(struct hda_codec *codec, |
---|
123 | 109 | struct hdmi_spec_per_pin *per_pin, |
---|
.. | .. |
---|
131 | 117 | }; |
---|
132 | 118 | |
---|
133 | 119 | struct hdmi_spec { |
---|
| 120 | + struct hda_codec *codec; |
---|
134 | 121 | int num_cvts; |
---|
135 | 122 | struct snd_array cvts; /* struct hdmi_spec_per_cvt */ |
---|
136 | 123 | hda_nid_t cvt_nids[4]; /* only for haswell fix */ |
---|
.. | .. |
---|
155 | 142 | struct snd_array pins; /* struct hdmi_spec_per_pin */ |
---|
156 | 143 | struct hdmi_pcm pcm_rec[16]; |
---|
157 | 144 | struct mutex pcm_lock; |
---|
| 145 | + struct mutex bind_lock; /* for audio component binding */ |
---|
158 | 146 | /* pcm_bitmap means which pcms have been assigned to pins*/ |
---|
159 | 147 | unsigned long pcm_bitmap; |
---|
160 | 148 | int pcm_used; /* counter of pcm_rec[] */ |
---|
.. | .. |
---|
169 | 157 | |
---|
170 | 158 | bool dyn_pin_out; |
---|
171 | 159 | bool dyn_pcm_assign; |
---|
| 160 | + bool dyn_pcm_no_legacy; |
---|
| 161 | + bool nv_dp_workaround; /* workaround DP audio infoframe for Nvidia */ |
---|
| 162 | + |
---|
| 163 | + bool intel_hsw_fixup; /* apply Intel platform-specific fixups */ |
---|
172 | 164 | /* |
---|
173 | 165 | * Non-generic VIA/NVIDIA specific |
---|
174 | 166 | */ |
---|
175 | 167 | struct hda_multi_out multiout; |
---|
176 | 168 | struct hda_pcm_stream pcm_playback; |
---|
177 | 169 | |
---|
178 | | - /* i915/powerwell (Haswell+/Valleyview+) specific */ |
---|
179 | | - bool use_acomp_notifier; /* use i915 eld_notify callback for hotplug */ |
---|
| 170 | + bool use_acomp_notifier; /* use eld_notify callback for hotplug */ |
---|
| 171 | + bool acomp_registered; /* audio component registered in this driver */ |
---|
| 172 | + bool force_connect; /* force connectivity */ |
---|
180 | 173 | struct drm_audio_component_audio_ops drm_audio_ops; |
---|
| 174 | + int (*port2pin)(struct hda_codec *, int); /* reverse port/pin mapping */ |
---|
181 | 175 | |
---|
182 | 176 | struct hdac_chmap chmap; |
---|
183 | 177 | hda_nid_t vendor_nid; |
---|
| 178 | + const int *port_map; |
---|
| 179 | + int port_num; |
---|
| 180 | + bool send_silent_stream; /* Flag to enable silent stream feature */ |
---|
184 | 181 | }; |
---|
185 | 182 | |
---|
186 | 183 | #ifdef CONFIG_SND_HDA_COMPONENT |
---|
.. | .. |
---|
273 | 270 | if (get_pcm_rec(spec, pcm_idx)->stream == hinfo) |
---|
274 | 271 | return pcm_idx; |
---|
275 | 272 | |
---|
276 | | - codec_warn(codec, "HDMI: hinfo %p not registered\n", hinfo); |
---|
| 273 | + codec_warn(codec, "HDMI: hinfo %p not tied to a PCM\n", hinfo); |
---|
277 | 274 | return -EINVAL; |
---|
278 | 275 | } |
---|
279 | 276 | |
---|
.. | .. |
---|
291 | 288 | return pin_idx; |
---|
292 | 289 | } |
---|
293 | 290 | |
---|
294 | | - codec_dbg(codec, "HDMI: hinfo %p not registered\n", hinfo); |
---|
| 291 | + codec_dbg(codec, "HDMI: hinfo %p (pcm %d) not registered\n", hinfo, |
---|
| 292 | + hinfo_to_pcm_index(codec, hinfo)); |
---|
295 | 293 | return -EINVAL; |
---|
296 | 294 | } |
---|
297 | 295 | |
---|
.. | .. |
---|
389 | 387 | } |
---|
390 | 388 | |
---|
391 | 389 | static const struct snd_kcontrol_new eld_bytes_ctl = { |
---|
392 | | - .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, |
---|
| 390 | + .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE | |
---|
| 391 | + SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK, |
---|
393 | 392 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
---|
394 | 393 | .name = "ELD", |
---|
395 | 394 | .info = hdmi_eld_ctl_info, |
---|
.. | .. |
---|
657 | 656 | return true; |
---|
658 | 657 | } |
---|
659 | 658 | |
---|
| 659 | +static int hdmi_pin_get_eld(struct hda_codec *codec, hda_nid_t nid, |
---|
| 660 | + int dev_id, unsigned char *buf, int *eld_size) |
---|
| 661 | +{ |
---|
| 662 | + snd_hda_set_dev_select(codec, nid, dev_id); |
---|
| 663 | + |
---|
| 664 | + return snd_hdmi_get_eld(codec, nid, buf, eld_size); |
---|
| 665 | +} |
---|
| 666 | + |
---|
660 | 667 | static void hdmi_pin_setup_infoframe(struct hda_codec *codec, |
---|
661 | | - hda_nid_t pin_nid, |
---|
| 668 | + hda_nid_t pin_nid, int dev_id, |
---|
662 | 669 | int ca, int active_channels, |
---|
663 | 670 | int conn_type) |
---|
664 | 671 | { |
---|
| 672 | + struct hdmi_spec *spec = codec->spec; |
---|
665 | 673 | union audio_infoframe ai; |
---|
666 | 674 | |
---|
667 | 675 | memset(&ai, 0, sizeof(ai)); |
---|
668 | | - if (conn_type == 0) { /* HDMI */ |
---|
| 676 | + if ((conn_type == 0) || /* HDMI */ |
---|
| 677 | + /* Nvidia DisplayPort: Nvidia HW expects same layout as HDMI */ |
---|
| 678 | + (conn_type == 1 && spec->nv_dp_workaround)) { |
---|
669 | 679 | struct hdmi_audio_infoframe *hdmi_ai = &ai.hdmi; |
---|
670 | 680 | |
---|
671 | | - hdmi_ai->type = 0x84; |
---|
672 | | - hdmi_ai->ver = 0x01; |
---|
673 | | - hdmi_ai->len = 0x0a; |
---|
| 681 | + if (conn_type == 0) { /* HDMI */ |
---|
| 682 | + hdmi_ai->type = 0x84; |
---|
| 683 | + hdmi_ai->ver = 0x01; |
---|
| 684 | + hdmi_ai->len = 0x0a; |
---|
| 685 | + } else {/* Nvidia DP */ |
---|
| 686 | + hdmi_ai->type = 0x84; |
---|
| 687 | + hdmi_ai->ver = 0x1b; |
---|
| 688 | + hdmi_ai->len = 0x11 << 2; |
---|
| 689 | + } |
---|
674 | 690 | hdmi_ai->CC02_CT47 = active_channels - 1; |
---|
675 | 691 | hdmi_ai->CA = ca; |
---|
676 | 692 | hdmi_checksum_audio_infoframe(hdmi_ai); |
---|
.. | .. |
---|
687 | 703 | pin_nid); |
---|
688 | 704 | return; |
---|
689 | 705 | } |
---|
| 706 | + |
---|
| 707 | + snd_hda_set_dev_select(codec, pin_nid, dev_id); |
---|
690 | 708 | |
---|
691 | 709 | /* |
---|
692 | 710 | * sizeof(ai) is used instead of sizeof(*hdmi_ai) or |
---|
.. | .. |
---|
713 | 731 | struct hdmi_spec *spec = codec->spec; |
---|
714 | 732 | struct hdac_chmap *chmap = &spec->chmap; |
---|
715 | 733 | hda_nid_t pin_nid = per_pin->pin_nid; |
---|
| 734 | + int dev_id = per_pin->dev_id; |
---|
716 | 735 | int channels = per_pin->channels; |
---|
717 | 736 | int active_channels; |
---|
718 | 737 | struct hdmi_eld *eld; |
---|
.. | .. |
---|
720 | 739 | |
---|
721 | 740 | if (!channels) |
---|
722 | 741 | return; |
---|
| 742 | + |
---|
| 743 | + snd_hda_set_dev_select(codec, pin_nid, dev_id); |
---|
723 | 744 | |
---|
724 | 745 | /* some HW (e.g. HSW+) needs reprogramming the amp at each time */ |
---|
725 | 746 | if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP) |
---|
.. | .. |
---|
746 | 767 | pin_nid, non_pcm, ca, channels, |
---|
747 | 768 | per_pin->chmap, per_pin->chmap_set); |
---|
748 | 769 | |
---|
749 | | - spec->ops.pin_setup_infoframe(codec, pin_nid, ca, active_channels, |
---|
750 | | - eld->info.conn_type); |
---|
| 770 | + spec->ops.pin_setup_infoframe(codec, pin_nid, dev_id, |
---|
| 771 | + ca, active_channels, eld->info.conn_type); |
---|
751 | 772 | |
---|
752 | 773 | per_pin->non_pcm = non_pcm; |
---|
753 | 774 | } |
---|
.. | .. |
---|
756 | 777 | * Unsolicited events |
---|
757 | 778 | */ |
---|
758 | 779 | |
---|
759 | | -static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll); |
---|
| 780 | +static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll); |
---|
760 | 781 | |
---|
761 | 782 | static void check_presence_and_report(struct hda_codec *codec, hda_nid_t nid, |
---|
762 | 783 | int dev_id) |
---|
.. | .. |
---|
767 | 788 | if (pin_idx < 0) |
---|
768 | 789 | return; |
---|
769 | 790 | mutex_lock(&spec->pcm_lock); |
---|
770 | | - if (hdmi_present_sense(get_pin(spec, pin_idx), 1)) |
---|
771 | | - snd_hda_jack_report_sync(codec); |
---|
| 791 | + hdmi_present_sense(get_pin(spec, pin_idx), 1); |
---|
772 | 792 | mutex_unlock(&spec->pcm_lock); |
---|
773 | 793 | } |
---|
774 | 794 | |
---|
775 | 795 | static void jack_callback(struct hda_codec *codec, |
---|
776 | 796 | struct hda_jack_callback *jack) |
---|
777 | 797 | { |
---|
778 | | - /* hda_jack don't support DP MST */ |
---|
779 | | - check_presence_and_report(codec, jack->nid, 0); |
---|
| 798 | + /* stop polling when notification is enabled */ |
---|
| 799 | + if (codec_has_acomp(codec)) |
---|
| 800 | + return; |
---|
| 801 | + |
---|
| 802 | + check_presence_and_report(codec, jack->nid, jack->dev_id); |
---|
780 | 803 | } |
---|
781 | 804 | |
---|
782 | | -static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) |
---|
| 805 | +static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res, |
---|
| 806 | + struct hda_jack_tbl *jack) |
---|
783 | 807 | { |
---|
784 | | - int tag = res >> AC_UNSOL_RES_TAG_SHIFT; |
---|
785 | | - struct hda_jack_tbl *jack; |
---|
786 | | - int dev_entry = (res & AC_UNSOL_RES_DE) >> AC_UNSOL_RES_DE_SHIFT; |
---|
787 | | - |
---|
788 | | - /* |
---|
789 | | - * assume DP MST uses dyn_pcm_assign and acomp and |
---|
790 | | - * never comes here |
---|
791 | | - * if DP MST supports unsol event, below code need |
---|
792 | | - * consider dev_entry |
---|
793 | | - */ |
---|
794 | | - jack = snd_hda_jack_tbl_get_from_tag(codec, tag); |
---|
795 | | - if (!jack) |
---|
796 | | - return; |
---|
797 | 808 | jack->jack_dirty = 1; |
---|
798 | 809 | |
---|
799 | 810 | codec_dbg(codec, |
---|
800 | 811 | "HDMI hot plug event: Codec=%d Pin=%d Device=%d Inactive=%d Presence_Detect=%d ELD_Valid=%d\n", |
---|
801 | | - codec->addr, jack->nid, dev_entry, !!(res & AC_UNSOL_RES_IA), |
---|
| 812 | + codec->addr, jack->nid, jack->dev_id, !!(res & AC_UNSOL_RES_IA), |
---|
802 | 813 | !!(res & AC_UNSOL_RES_PD), !!(res & AC_UNSOL_RES_ELDV)); |
---|
803 | 814 | |
---|
804 | | - /* hda_jack don't support DP MST */ |
---|
805 | | - check_presence_and_report(codec, jack->nid, 0); |
---|
| 815 | + check_presence_and_report(codec, jack->nid, jack->dev_id); |
---|
806 | 816 | } |
---|
807 | 817 | |
---|
808 | 818 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) |
---|
.. | .. |
---|
821 | 831 | cp_ready); |
---|
822 | 832 | |
---|
823 | 833 | /* TODO */ |
---|
824 | | - if (cp_state) |
---|
| 834 | + if (cp_state) { |
---|
825 | 835 | ; |
---|
826 | | - if (cp_ready) |
---|
| 836 | + } |
---|
| 837 | + if (cp_ready) { |
---|
827 | 838 | ; |
---|
| 839 | + } |
---|
828 | 840 | } |
---|
829 | 841 | |
---|
830 | 842 | |
---|
.. | .. |
---|
832 | 844 | { |
---|
833 | 845 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; |
---|
834 | 846 | int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; |
---|
| 847 | + struct hda_jack_tbl *jack; |
---|
835 | 848 | |
---|
836 | | - if (!snd_hda_jack_tbl_get_from_tag(codec, tag)) { |
---|
| 849 | + if (codec_has_acomp(codec)) |
---|
| 850 | + return; |
---|
| 851 | + |
---|
| 852 | + if (codec->dp_mst) { |
---|
| 853 | + int dev_entry = |
---|
| 854 | + (res & AC_UNSOL_RES_DE) >> AC_UNSOL_RES_DE_SHIFT; |
---|
| 855 | + |
---|
| 856 | + jack = snd_hda_jack_tbl_get_from_tag(codec, tag, dev_entry); |
---|
| 857 | + } else { |
---|
| 858 | + jack = snd_hda_jack_tbl_get_from_tag(codec, tag, 0); |
---|
| 859 | + } |
---|
| 860 | + |
---|
| 861 | + if (!jack) { |
---|
837 | 862 | codec_dbg(codec, "Unexpected HDMI event tag 0x%x\n", tag); |
---|
838 | 863 | return; |
---|
839 | 864 | } |
---|
840 | 865 | |
---|
841 | 866 | if (subtag == 0) |
---|
842 | | - hdmi_intrinsic_event(codec, res); |
---|
| 867 | + hdmi_intrinsic_event(codec, res, jack); |
---|
843 | 868 | else |
---|
844 | 869 | hdmi_non_intrinsic_event(codec, res); |
---|
845 | 870 | } |
---|
.. | .. |
---|
874 | 899 | ((format & AC_FMT_TYPE_NON_PCM) && (format & AC_FMT_CHAN_MASK) == 7) |
---|
875 | 900 | |
---|
876 | 901 | static int hdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid, |
---|
877 | | - bool hbr) |
---|
| 902 | + int dev_id, bool hbr) |
---|
878 | 903 | { |
---|
879 | 904 | int pinctl, new_pinctl; |
---|
880 | 905 | |
---|
881 | 906 | if (snd_hda_query_pin_caps(codec, pin_nid) & AC_PINCAP_HBR) { |
---|
| 907 | + snd_hda_set_dev_select(codec, pin_nid, dev_id); |
---|
882 | 908 | pinctl = snd_hda_codec_read(codec, pin_nid, 0, |
---|
883 | 909 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
---|
884 | 910 | |
---|
.. | .. |
---|
908 | 934 | } |
---|
909 | 935 | |
---|
910 | 936 | static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid, |
---|
911 | | - hda_nid_t pin_nid, u32 stream_tag, int format) |
---|
| 937 | + hda_nid_t pin_nid, int dev_id, |
---|
| 938 | + u32 stream_tag, int format) |
---|
912 | 939 | { |
---|
913 | 940 | struct hdmi_spec *spec = codec->spec; |
---|
914 | 941 | unsigned int param; |
---|
915 | 942 | int err; |
---|
916 | 943 | |
---|
917 | | - err = spec->ops.pin_hbr_setup(codec, pin_nid, is_hbr_format(format)); |
---|
| 944 | + err = spec->ops.pin_hbr_setup(codec, pin_nid, dev_id, |
---|
| 945 | + is_hbr_format(format)); |
---|
918 | 946 | |
---|
919 | 947 | if (err) { |
---|
920 | 948 | codec_dbg(codec, "hdmi_setup_stream: HBR is not supported\n"); |
---|
921 | 949 | return err; |
---|
922 | 950 | } |
---|
923 | 951 | |
---|
924 | | - if (is_haswell_plus(codec)) { |
---|
| 952 | + if (spec->intel_hsw_fixup) { |
---|
925 | 953 | |
---|
926 | 954 | /* |
---|
927 | 955 | * on recent platforms IEC Coding Type is required for HBR |
---|
.. | .. |
---|
963 | 991 | per_pin = NULL; |
---|
964 | 992 | else |
---|
965 | 993 | per_pin = get_pin(spec, pin_idx); |
---|
| 994 | + |
---|
| 995 | + if (per_pin && per_pin->silent_stream) { |
---|
| 996 | + cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid); |
---|
| 997 | + if (cvt_id) |
---|
| 998 | + *cvt_id = cvt_idx; |
---|
| 999 | + return 0; |
---|
| 1000 | + } |
---|
966 | 1001 | |
---|
967 | 1002 | /* Dynamically assign converter to stream */ |
---|
968 | 1003 | for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) { |
---|
.. | .. |
---|
1234 | 1269 | set_bit(pcm_idx, &spec->pcm_in_use); |
---|
1235 | 1270 | per_pin = get_pin(spec, pin_idx); |
---|
1236 | 1271 | per_pin->cvt_nid = per_cvt->cvt_nid; |
---|
| 1272 | + per_pin->silent_stream = false; |
---|
1237 | 1273 | hinfo->nid = per_cvt->cvt_nid; |
---|
| 1274 | + |
---|
| 1275 | + /* flip stripe flag for the assigned stream if supported */ |
---|
| 1276 | + if (get_wcaps(codec, per_cvt->cvt_nid) & AC_WCAP_STRIPE) |
---|
| 1277 | + azx_stream(get_azx_dev(substream))->stripe = 1; |
---|
1238 | 1278 | |
---|
1239 | 1279 | snd_hda_set_dev_select(codec, per_pin->pin_nid, per_pin->dev_id); |
---|
1240 | 1280 | snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0, |
---|
.. | .. |
---|
1288 | 1328 | struct hdmi_spec *spec = codec->spec; |
---|
1289 | 1329 | struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx); |
---|
1290 | 1330 | hda_nid_t pin_nid = per_pin->pin_nid; |
---|
| 1331 | + int dev_id = per_pin->dev_id; |
---|
| 1332 | + int conns; |
---|
1291 | 1333 | |
---|
1292 | 1334 | if (!(get_wcaps(codec, pin_nid) & AC_WCAP_CONN_LIST)) { |
---|
1293 | 1335 | codec_warn(codec, |
---|
.. | .. |
---|
1296 | 1338 | return -EINVAL; |
---|
1297 | 1339 | } |
---|
1298 | 1340 | |
---|
| 1341 | + snd_hda_set_dev_select(codec, pin_nid, dev_id); |
---|
| 1342 | + |
---|
| 1343 | + if (spec->intel_hsw_fixup) { |
---|
| 1344 | + conns = spec->num_cvts; |
---|
| 1345 | + memcpy(per_pin->mux_nids, spec->cvt_nids, |
---|
| 1346 | + sizeof(hda_nid_t) * conns); |
---|
| 1347 | + } else { |
---|
| 1348 | + conns = snd_hda_get_raw_connections(codec, pin_nid, |
---|
| 1349 | + per_pin->mux_nids, |
---|
| 1350 | + HDA_MAX_CONNECTIONS); |
---|
| 1351 | + } |
---|
| 1352 | + |
---|
1299 | 1353 | /* all the device entries on the same pin have the same conn list */ |
---|
1300 | | - per_pin->num_mux_nids = snd_hda_get_connections(codec, pin_nid, |
---|
1301 | | - per_pin->mux_nids, |
---|
1302 | | - HDA_MAX_CONNECTIONS); |
---|
| 1354 | + per_pin->num_mux_nids = conns; |
---|
1303 | 1355 | |
---|
1304 | 1356 | return 0; |
---|
1305 | 1357 | } |
---|
1306 | 1358 | |
---|
1307 | 1359 | static int hdmi_find_pcm_slot(struct hdmi_spec *spec, |
---|
1308 | | - struct hdmi_spec_per_pin *per_pin) |
---|
| 1360 | + struct hdmi_spec_per_pin *per_pin) |
---|
1309 | 1361 | { |
---|
1310 | 1362 | int i; |
---|
1311 | 1363 | |
---|
1312 | | - /* try the prefer PCM */ |
---|
1313 | | - if (!test_bit(per_pin->pin_nid_idx, &spec->pcm_bitmap)) |
---|
1314 | | - return per_pin->pin_nid_idx; |
---|
| 1364 | + /* on the new machines, try to assign the pcm slot dynamically, |
---|
| 1365 | + * not use the preferred fixed map (legacy way) anymore. |
---|
| 1366 | + */ |
---|
| 1367 | + if (spec->dyn_pcm_no_legacy) |
---|
| 1368 | + goto last_try; |
---|
1315 | 1369 | |
---|
1316 | | - /* have a second try; check the "reserved area" over num_pins */ |
---|
| 1370 | + /* |
---|
| 1371 | + * generic_hdmi_build_pcms() may allocate extra PCMs on some |
---|
| 1372 | + * platforms (with maximum of 'num_nids + dev_num - 1') |
---|
| 1373 | + * |
---|
| 1374 | + * The per_pin of pin_nid_idx=n and dev_id=m prefers to get pcm-n |
---|
| 1375 | + * if m==0. This guarantees that dynamic pcm assignments are compatible |
---|
| 1376 | + * with the legacy static per_pin-pcm assignment that existed in the |
---|
| 1377 | + * days before DP-MST. |
---|
| 1378 | + * |
---|
| 1379 | + * Intel DP-MST prefers this legacy behavior for compatibility, too. |
---|
| 1380 | + * |
---|
| 1381 | + * per_pin of m!=0 prefers to get pcm=(num_nids + (m - 1)). |
---|
| 1382 | + */ |
---|
| 1383 | + |
---|
| 1384 | + if (per_pin->dev_id == 0 || spec->intel_hsw_fixup) { |
---|
| 1385 | + if (!test_bit(per_pin->pin_nid_idx, &spec->pcm_bitmap)) |
---|
| 1386 | + return per_pin->pin_nid_idx; |
---|
| 1387 | + } else { |
---|
| 1388 | + i = spec->num_nids + (per_pin->dev_id - 1); |
---|
| 1389 | + if (i < spec->pcm_used && !(test_bit(i, &spec->pcm_bitmap))) |
---|
| 1390 | + return i; |
---|
| 1391 | + } |
---|
| 1392 | + |
---|
| 1393 | + /* have a second try; check the area over num_nids */ |
---|
1317 | 1394 | for (i = spec->num_nids; i < spec->pcm_used; i++) { |
---|
1318 | 1395 | if (!test_bit(i, &spec->pcm_bitmap)) |
---|
1319 | 1396 | return i; |
---|
1320 | 1397 | } |
---|
1321 | 1398 | |
---|
| 1399 | + last_try: |
---|
1322 | 1400 | /* the last try; check the empty slots in pins */ |
---|
1323 | | - for (i = 0; i < spec->num_nids; i++) { |
---|
| 1401 | + for (i = 0; i < spec->pcm_used; i++) { |
---|
1324 | 1402 | if (!test_bit(i, &spec->pcm_bitmap)) |
---|
1325 | 1403 | return i; |
---|
1326 | 1404 | } |
---|
.. | .. |
---|
1428 | 1506 | per_pin->channels = 0; |
---|
1429 | 1507 | } |
---|
1430 | 1508 | |
---|
| 1509 | +static struct snd_jack *pin_idx_to_pcm_jack(struct hda_codec *codec, |
---|
| 1510 | + struct hdmi_spec_per_pin *per_pin) |
---|
| 1511 | +{ |
---|
| 1512 | + struct hdmi_spec *spec = codec->spec; |
---|
| 1513 | + |
---|
| 1514 | + if (per_pin->pcm_idx >= 0) |
---|
| 1515 | + return spec->pcm_rec[per_pin->pcm_idx].jack; |
---|
| 1516 | + else |
---|
| 1517 | + return NULL; |
---|
| 1518 | +} |
---|
| 1519 | + |
---|
1431 | 1520 | /* update per_pin ELD from the given new ELD; |
---|
1432 | 1521 | * setup info frame and notification accordingly |
---|
| 1522 | + * also notify ELD kctl and report jack status changes |
---|
1433 | 1523 | */ |
---|
1434 | 1524 | static void update_eld(struct hda_codec *codec, |
---|
1435 | 1525 | struct hdmi_spec_per_pin *per_pin, |
---|
1436 | | - struct hdmi_eld *eld) |
---|
| 1526 | + struct hdmi_eld *eld, |
---|
| 1527 | + int repoll) |
---|
1437 | 1528 | { |
---|
1438 | 1529 | struct hdmi_eld *pin_eld = &per_pin->sink_eld; |
---|
1439 | 1530 | struct hdmi_spec *spec = codec->spec; |
---|
| 1531 | + struct snd_jack *pcm_jack; |
---|
1440 | 1532 | bool old_eld_valid = pin_eld->eld_valid; |
---|
1441 | 1533 | bool eld_changed; |
---|
1442 | | - int pcm_idx = -1; |
---|
| 1534 | + int pcm_idx; |
---|
| 1535 | + |
---|
| 1536 | + if (eld->eld_valid) { |
---|
| 1537 | + if (eld->eld_size <= 0 || |
---|
| 1538 | + snd_hdmi_parse_eld(codec, &eld->info, eld->eld_buffer, |
---|
| 1539 | + eld->eld_size) < 0) { |
---|
| 1540 | + eld->eld_valid = false; |
---|
| 1541 | + if (repoll) { |
---|
| 1542 | + schedule_delayed_work(&per_pin->work, |
---|
| 1543 | + msecs_to_jiffies(300)); |
---|
| 1544 | + return; |
---|
| 1545 | + } |
---|
| 1546 | + } |
---|
| 1547 | + } |
---|
| 1548 | + |
---|
| 1549 | + if (!eld->eld_valid || eld->eld_size <= 0) { |
---|
| 1550 | + eld->eld_valid = false; |
---|
| 1551 | + eld->eld_size = 0; |
---|
| 1552 | + } |
---|
1443 | 1553 | |
---|
1444 | 1554 | /* for monitor disconnection, save pcm_idx firstly */ |
---|
1445 | 1555 | pcm_idx = per_pin->pcm_idx; |
---|
| 1556 | + |
---|
| 1557 | + /* |
---|
| 1558 | + * pcm_idx >=0 before update_eld() means it is in monitor |
---|
| 1559 | + * disconnected event. Jack must be fetched before update_eld(). |
---|
| 1560 | + */ |
---|
| 1561 | + pcm_jack = pin_idx_to_pcm_jack(codec, per_pin); |
---|
| 1562 | + |
---|
1446 | 1563 | if (spec->dyn_pcm_assign) { |
---|
1447 | 1564 | if (eld->eld_valid) { |
---|
1448 | 1565 | hdmi_attach_hda_pcm(spec, per_pin); |
---|
.. | .. |
---|
1457 | 1574 | */ |
---|
1458 | 1575 | if (pcm_idx == -1) |
---|
1459 | 1576 | pcm_idx = per_pin->pcm_idx; |
---|
| 1577 | + if (!pcm_jack) |
---|
| 1578 | + pcm_jack = pin_idx_to_pcm_jack(codec, per_pin); |
---|
1460 | 1579 | |
---|
1461 | 1580 | if (eld->eld_valid) |
---|
1462 | 1581 | snd_hdmi_show_eld(codec, &eld->info); |
---|
1463 | 1582 | |
---|
1464 | 1583 | eld_changed = (pin_eld->eld_valid != eld->eld_valid); |
---|
1465 | | - if (eld->eld_valid && pin_eld->eld_valid) |
---|
| 1584 | + eld_changed |= (pin_eld->monitor_present != eld->monitor_present); |
---|
| 1585 | + if (!eld_changed && eld->eld_valid && pin_eld->eld_valid) |
---|
1466 | 1586 | if (pin_eld->eld_size != eld->eld_size || |
---|
1467 | 1587 | memcmp(pin_eld->eld_buffer, eld->eld_buffer, |
---|
1468 | 1588 | eld->eld_size) != 0) |
---|
1469 | 1589 | eld_changed = true; |
---|
1470 | 1590 | |
---|
1471 | | - pin_eld->monitor_present = eld->monitor_present; |
---|
1472 | | - pin_eld->eld_valid = eld->eld_valid; |
---|
1473 | | - pin_eld->eld_size = eld->eld_size; |
---|
1474 | | - if (eld->eld_valid) |
---|
1475 | | - memcpy(pin_eld->eld_buffer, eld->eld_buffer, eld->eld_size); |
---|
1476 | | - pin_eld->info = eld->info; |
---|
| 1591 | + if (eld_changed) { |
---|
| 1592 | + pin_eld->monitor_present = eld->monitor_present; |
---|
| 1593 | + pin_eld->eld_valid = eld->eld_valid; |
---|
| 1594 | + pin_eld->eld_size = eld->eld_size; |
---|
| 1595 | + if (eld->eld_valid) |
---|
| 1596 | + memcpy(pin_eld->eld_buffer, eld->eld_buffer, |
---|
| 1597 | + eld->eld_size); |
---|
| 1598 | + pin_eld->info = eld->info; |
---|
| 1599 | + } |
---|
1477 | 1600 | |
---|
1478 | 1601 | /* |
---|
1479 | 1602 | * Re-setup pin and infoframe. This is needed e.g. when |
---|
.. | .. |
---|
1491 | 1614 | SNDRV_CTL_EVENT_MASK_VALUE | |
---|
1492 | 1615 | SNDRV_CTL_EVENT_MASK_INFO, |
---|
1493 | 1616 | &get_hdmi_pcm(spec, pcm_idx)->eld_ctl->id); |
---|
| 1617 | + |
---|
| 1618 | + if (eld_changed && pcm_jack) |
---|
| 1619 | + snd_jack_report(pcm_jack, |
---|
| 1620 | + (eld->monitor_present && eld->eld_valid) ? |
---|
| 1621 | + SND_JACK_AVOUT : 0); |
---|
1494 | 1622 | } |
---|
1495 | 1623 | |
---|
1496 | 1624 | /* update ELD and jack state via HD-audio verbs */ |
---|
1497 | | -static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin, |
---|
| 1625 | +static void hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin, |
---|
1498 | 1626 | int repoll) |
---|
1499 | 1627 | { |
---|
1500 | | - struct hda_jack_tbl *jack; |
---|
1501 | 1628 | struct hda_codec *codec = per_pin->codec; |
---|
1502 | 1629 | struct hdmi_spec *spec = codec->spec; |
---|
1503 | 1630 | struct hdmi_eld *eld = &spec->temp_eld; |
---|
| 1631 | + struct device *dev = hda_codec_dev(codec); |
---|
1504 | 1632 | hda_nid_t pin_nid = per_pin->pin_nid; |
---|
| 1633 | + int dev_id = per_pin->dev_id; |
---|
1505 | 1634 | /* |
---|
1506 | 1635 | * Always execute a GetPinSense verb here, even when called from |
---|
1507 | 1636 | * hdmi_intrinsic_event; for some NVIDIA HW, the unsolicited |
---|
.. | .. |
---|
1511 | 1640 | * the unsolicited response to avoid custom WARs. |
---|
1512 | 1641 | */ |
---|
1513 | 1642 | int present; |
---|
1514 | | - bool ret; |
---|
1515 | | - bool do_repoll = false; |
---|
| 1643 | + int ret; |
---|
1516 | 1644 | |
---|
1517 | | - present = snd_hda_pin_sense(codec, pin_nid); |
---|
| 1645 | +#ifdef CONFIG_PM |
---|
| 1646 | + if (dev->power.runtime_status == RPM_SUSPENDING) |
---|
| 1647 | + return; |
---|
| 1648 | +#endif |
---|
| 1649 | + |
---|
| 1650 | + ret = snd_hda_power_up_pm(codec); |
---|
| 1651 | + if (ret < 0 && pm_runtime_suspended(dev)) |
---|
| 1652 | + goto out; |
---|
| 1653 | + |
---|
| 1654 | + present = snd_hda_jack_pin_sense(codec, pin_nid, dev_id); |
---|
1518 | 1655 | |
---|
1519 | 1656 | mutex_lock(&per_pin->lock); |
---|
1520 | 1657 | eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE); |
---|
.. | .. |
---|
1528 | 1665 | codec->addr, pin_nid, eld->monitor_present, eld->eld_valid); |
---|
1529 | 1666 | |
---|
1530 | 1667 | if (eld->eld_valid) { |
---|
1531 | | - if (spec->ops.pin_get_eld(codec, pin_nid, eld->eld_buffer, |
---|
1532 | | - &eld->eld_size) < 0) |
---|
| 1668 | + if (spec->ops.pin_get_eld(codec, pin_nid, dev_id, |
---|
| 1669 | + eld->eld_buffer, &eld->eld_size) < 0) |
---|
1533 | 1670 | eld->eld_valid = false; |
---|
1534 | | - else { |
---|
1535 | | - if (snd_hdmi_parse_eld(codec, &eld->info, eld->eld_buffer, |
---|
1536 | | - eld->eld_size) < 0) |
---|
1537 | | - eld->eld_valid = false; |
---|
1538 | | - } |
---|
1539 | | - if (!eld->eld_valid && repoll) |
---|
1540 | | - do_repoll = true; |
---|
1541 | 1671 | } |
---|
1542 | 1672 | |
---|
1543 | | - if (do_repoll) |
---|
1544 | | - schedule_delayed_work(&per_pin->work, msecs_to_jiffies(300)); |
---|
1545 | | - else |
---|
1546 | | - update_eld(codec, per_pin, eld); |
---|
1547 | | - |
---|
1548 | | - ret = !repoll || !eld->monitor_present || eld->eld_valid; |
---|
1549 | | - |
---|
1550 | | - jack = snd_hda_jack_tbl_get(codec, pin_nid); |
---|
1551 | | - if (jack) { |
---|
1552 | | - jack->block_report = !ret; |
---|
1553 | | - jack->pin_sense = (eld->monitor_present && eld->eld_valid) ? |
---|
1554 | | - AC_PINSENSE_PRESENCE : 0; |
---|
1555 | | - } |
---|
| 1673 | + update_eld(codec, per_pin, eld, repoll); |
---|
1556 | 1674 | mutex_unlock(&per_pin->lock); |
---|
1557 | | - return ret; |
---|
| 1675 | + out: |
---|
| 1676 | + snd_hda_power_down_pm(codec); |
---|
1558 | 1677 | } |
---|
1559 | 1678 | |
---|
1560 | | -static struct snd_jack *pin_idx_to_jack(struct hda_codec *codec, |
---|
| 1679 | +#define I915_SILENT_RATE 48000 |
---|
| 1680 | +#define I915_SILENT_CHANNELS 2 |
---|
| 1681 | +#define I915_SILENT_FORMAT SNDRV_PCM_FORMAT_S16_LE |
---|
| 1682 | +#define I915_SILENT_FORMAT_BITS 16 |
---|
| 1683 | +#define I915_SILENT_FMT_MASK 0xf |
---|
| 1684 | + |
---|
| 1685 | +static void silent_stream_enable(struct hda_codec *codec, |
---|
1561 | 1686 | struct hdmi_spec_per_pin *per_pin) |
---|
1562 | 1687 | { |
---|
1563 | 1688 | struct hdmi_spec *spec = codec->spec; |
---|
1564 | | - struct snd_jack *jack = NULL; |
---|
1565 | | - struct hda_jack_tbl *jack_tbl; |
---|
| 1689 | + struct hdmi_spec_per_cvt *per_cvt; |
---|
| 1690 | + int cvt_idx, pin_idx, err; |
---|
| 1691 | + unsigned int format; |
---|
1566 | 1692 | |
---|
1567 | | - /* if !dyn_pcm_assign, get jack from hda_jack_tbl |
---|
1568 | | - * in !dyn_pcm_assign case, spec->pcm_rec[].jack is not |
---|
1569 | | - * NULL even after snd_hda_jack_tbl_clear() is called to |
---|
1570 | | - * free snd_jack. This may cause access invalid memory |
---|
1571 | | - * when calling snd_jack_report |
---|
1572 | | - */ |
---|
1573 | | - if (per_pin->pcm_idx >= 0 && spec->dyn_pcm_assign) |
---|
1574 | | - jack = spec->pcm_rec[per_pin->pcm_idx].jack; |
---|
1575 | | - else if (!spec->dyn_pcm_assign) { |
---|
1576 | | - /* |
---|
1577 | | - * jack tbl doesn't support DP MST |
---|
1578 | | - * DP MST will use dyn_pcm_assign, |
---|
1579 | | - * so DP MST will never come here |
---|
1580 | | - */ |
---|
1581 | | - jack_tbl = snd_hda_jack_tbl_get(codec, per_pin->pin_nid); |
---|
1582 | | - if (jack_tbl) |
---|
1583 | | - jack = jack_tbl->jack; |
---|
| 1693 | + mutex_lock(&per_pin->lock); |
---|
| 1694 | + |
---|
| 1695 | + if (per_pin->setup) { |
---|
| 1696 | + codec_dbg(codec, "hdmi: PCM already open, no silent stream\n"); |
---|
| 1697 | + goto unlock_out; |
---|
1584 | 1698 | } |
---|
1585 | | - return jack; |
---|
| 1699 | + |
---|
| 1700 | + pin_idx = pin_id_to_pin_index(codec, per_pin->pin_nid, per_pin->dev_id); |
---|
| 1701 | + err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx); |
---|
| 1702 | + if (err) { |
---|
| 1703 | + codec_err(codec, "hdmi: no free converter to enable silent mode\n"); |
---|
| 1704 | + goto unlock_out; |
---|
| 1705 | + } |
---|
| 1706 | + |
---|
| 1707 | + per_cvt = get_cvt(spec, cvt_idx); |
---|
| 1708 | + per_cvt->assigned = 1; |
---|
| 1709 | + per_pin->cvt_nid = per_cvt->cvt_nid; |
---|
| 1710 | + per_pin->silent_stream = true; |
---|
| 1711 | + |
---|
| 1712 | + codec_dbg(codec, "hdmi: enabling silent stream pin-NID=0x%x cvt-NID=0x%x\n", |
---|
| 1713 | + per_pin->pin_nid, per_cvt->cvt_nid); |
---|
| 1714 | + |
---|
| 1715 | + snd_hda_set_dev_select(codec, per_pin->pin_nid, per_pin->dev_id); |
---|
| 1716 | + snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0, |
---|
| 1717 | + AC_VERB_SET_CONNECT_SEL, |
---|
| 1718 | + per_pin->mux_idx); |
---|
| 1719 | + |
---|
| 1720 | + /* configure unused pins to choose other converters */ |
---|
| 1721 | + pin_cvt_fixup(codec, per_pin, 0); |
---|
| 1722 | + |
---|
| 1723 | + snd_hdac_sync_audio_rate(&codec->core, per_pin->pin_nid, |
---|
| 1724 | + per_pin->dev_id, I915_SILENT_RATE); |
---|
| 1725 | + |
---|
| 1726 | + /* trigger silent stream generation in hw */ |
---|
| 1727 | + format = snd_hdac_calc_stream_format(I915_SILENT_RATE, I915_SILENT_CHANNELS, |
---|
| 1728 | + I915_SILENT_FORMAT, I915_SILENT_FORMAT_BITS, 0); |
---|
| 1729 | + snd_hda_codec_setup_stream(codec, per_pin->cvt_nid, |
---|
| 1730 | + I915_SILENT_FMT_MASK, I915_SILENT_FMT_MASK, format); |
---|
| 1731 | + usleep_range(100, 200); |
---|
| 1732 | + snd_hda_codec_setup_stream(codec, per_pin->cvt_nid, I915_SILENT_FMT_MASK, 0, format); |
---|
| 1733 | + |
---|
| 1734 | + per_pin->channels = I915_SILENT_CHANNELS; |
---|
| 1735 | + hdmi_setup_audio_infoframe(codec, per_pin, per_pin->non_pcm); |
---|
| 1736 | + |
---|
| 1737 | + unlock_out: |
---|
| 1738 | + mutex_unlock(&per_pin->lock); |
---|
| 1739 | +} |
---|
| 1740 | + |
---|
| 1741 | +static void silent_stream_disable(struct hda_codec *codec, |
---|
| 1742 | + struct hdmi_spec_per_pin *per_pin) |
---|
| 1743 | +{ |
---|
| 1744 | + struct hdmi_spec *spec = codec->spec; |
---|
| 1745 | + struct hdmi_spec_per_cvt *per_cvt; |
---|
| 1746 | + int cvt_idx; |
---|
| 1747 | + |
---|
| 1748 | + mutex_lock(&per_pin->lock); |
---|
| 1749 | + if (!per_pin->silent_stream) |
---|
| 1750 | + goto unlock_out; |
---|
| 1751 | + |
---|
| 1752 | + codec_dbg(codec, "HDMI: disable silent stream on pin-NID=0x%x cvt-NID=0x%x\n", |
---|
| 1753 | + per_pin->pin_nid, per_pin->cvt_nid); |
---|
| 1754 | + |
---|
| 1755 | + cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid); |
---|
| 1756 | + if (cvt_idx >= 0 && cvt_idx < spec->num_cvts) { |
---|
| 1757 | + per_cvt = get_cvt(spec, cvt_idx); |
---|
| 1758 | + per_cvt->assigned = 0; |
---|
| 1759 | + } |
---|
| 1760 | + |
---|
| 1761 | + per_pin->cvt_nid = 0; |
---|
| 1762 | + per_pin->silent_stream = false; |
---|
| 1763 | + |
---|
| 1764 | + unlock_out: |
---|
| 1765 | + mutex_unlock(&per_pin->lock); |
---|
1586 | 1766 | } |
---|
1587 | 1767 | |
---|
1588 | 1768 | /* update ELD and jack state via audio component */ |
---|
.. | .. |
---|
1591 | 1771 | { |
---|
1592 | 1772 | struct hdmi_spec *spec = codec->spec; |
---|
1593 | 1773 | struct hdmi_eld *eld = &spec->temp_eld; |
---|
1594 | | - struct snd_jack *jack = NULL; |
---|
1595 | | - int size; |
---|
| 1774 | + bool monitor_prev, monitor_next; |
---|
1596 | 1775 | |
---|
1597 | 1776 | mutex_lock(&per_pin->lock); |
---|
1598 | 1777 | eld->monitor_present = false; |
---|
1599 | | - size = snd_hdac_acomp_get_eld(&codec->core, per_pin->pin_nid, |
---|
| 1778 | + monitor_prev = per_pin->sink_eld.monitor_present; |
---|
| 1779 | + eld->eld_size = snd_hdac_acomp_get_eld(&codec->core, per_pin->pin_nid, |
---|
1600 | 1780 | per_pin->dev_id, &eld->monitor_present, |
---|
1601 | 1781 | eld->eld_buffer, ELD_MAX_SIZE); |
---|
1602 | | - if (size > 0) { |
---|
1603 | | - size = min(size, ELD_MAX_SIZE); |
---|
1604 | | - if (snd_hdmi_parse_eld(codec, &eld->info, |
---|
1605 | | - eld->eld_buffer, size) < 0) |
---|
1606 | | - size = -EINVAL; |
---|
1607 | | - } |
---|
1608 | | - |
---|
1609 | | - if (size > 0) { |
---|
1610 | | - eld->eld_valid = true; |
---|
1611 | | - eld->eld_size = size; |
---|
1612 | | - } else { |
---|
1613 | | - eld->eld_valid = false; |
---|
1614 | | - eld->eld_size = 0; |
---|
1615 | | - } |
---|
1616 | | - |
---|
1617 | | - /* pcm_idx >=0 before update_eld() means it is in monitor |
---|
1618 | | - * disconnected event. Jack must be fetched before update_eld() |
---|
1619 | | - */ |
---|
1620 | | - jack = pin_idx_to_jack(codec, per_pin); |
---|
1621 | | - update_eld(codec, per_pin, eld); |
---|
1622 | | - if (jack == NULL) |
---|
1623 | | - jack = pin_idx_to_jack(codec, per_pin); |
---|
1624 | | - if (jack == NULL) |
---|
1625 | | - goto unlock; |
---|
1626 | | - snd_jack_report(jack, |
---|
1627 | | - eld->monitor_present ? SND_JACK_AVOUT : 0); |
---|
1628 | | - unlock: |
---|
| 1782 | + eld->eld_valid = (eld->eld_size > 0); |
---|
| 1783 | + update_eld(codec, per_pin, eld, 0); |
---|
| 1784 | + monitor_next = per_pin->sink_eld.monitor_present; |
---|
1629 | 1785 | mutex_unlock(&per_pin->lock); |
---|
1630 | | -} |
---|
1631 | 1786 | |
---|
1632 | | -static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) |
---|
1633 | | -{ |
---|
1634 | | - struct hda_codec *codec = per_pin->codec; |
---|
1635 | | - int ret; |
---|
| 1787 | + /* |
---|
| 1788 | + * Power-up will call hdmi_present_sense, so the PM calls |
---|
| 1789 | + * have to be done without mutex held. |
---|
| 1790 | + */ |
---|
1636 | 1791 | |
---|
1637 | | - /* no temporary power up/down needed for component notifier */ |
---|
1638 | | - if (!codec_has_acomp(codec)) { |
---|
1639 | | - ret = snd_hda_power_up_pm(codec); |
---|
1640 | | - if (ret < 0 && pm_runtime_suspended(hda_codec_dev(codec))) { |
---|
1641 | | - snd_hda_power_down_pm(codec); |
---|
1642 | | - return false; |
---|
| 1792 | + if (spec->send_silent_stream) { |
---|
| 1793 | + int pm_ret; |
---|
| 1794 | + |
---|
| 1795 | + if (!monitor_prev && monitor_next) { |
---|
| 1796 | + pm_ret = snd_hda_power_up_pm(codec); |
---|
| 1797 | + if (pm_ret < 0) |
---|
| 1798 | + codec_err(codec, |
---|
| 1799 | + "Monitor plugged-in, Failed to power up codec ret=[%d]\n", |
---|
| 1800 | + pm_ret); |
---|
| 1801 | + silent_stream_enable(codec, per_pin); |
---|
| 1802 | + } else if (monitor_prev && !monitor_next) { |
---|
| 1803 | + silent_stream_disable(codec, per_pin); |
---|
| 1804 | + pm_ret = snd_hda_power_down_pm(codec); |
---|
| 1805 | + if (pm_ret < 0) |
---|
| 1806 | + codec_err(codec, |
---|
| 1807 | + "Monitor plugged-out, Failed to power down codec ret=[%d]\n", |
---|
| 1808 | + pm_ret); |
---|
1643 | 1809 | } |
---|
1644 | 1810 | } |
---|
| 1811 | +} |
---|
1645 | 1812 | |
---|
1646 | | - if (codec_has_acomp(codec)) { |
---|
1647 | | - sync_eld_via_acomp(codec, per_pin); |
---|
1648 | | - ret = false; /* don't call snd_hda_jack_report_sync() */ |
---|
1649 | | - } else { |
---|
1650 | | - ret = hdmi_present_sense_via_verbs(per_pin, repoll); |
---|
1651 | | - } |
---|
| 1813 | +static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) |
---|
| 1814 | +{ |
---|
| 1815 | + struct hda_codec *codec = per_pin->codec; |
---|
1652 | 1816 | |
---|
1653 | 1817 | if (!codec_has_acomp(codec)) |
---|
1654 | | - snd_hda_power_down_pm(codec); |
---|
1655 | | - |
---|
1656 | | - return ret; |
---|
| 1818 | + hdmi_present_sense_via_verbs(per_pin, repoll); |
---|
| 1819 | + else |
---|
| 1820 | + sync_eld_via_acomp(codec, per_pin); |
---|
1657 | 1821 | } |
---|
1658 | 1822 | |
---|
1659 | 1823 | static void hdmi_repoll_eld(struct work_struct *work) |
---|
.. | .. |
---|
1664 | 1828 | struct hdmi_spec *spec = codec->spec; |
---|
1665 | 1829 | struct hda_jack_tbl *jack; |
---|
1666 | 1830 | |
---|
1667 | | - jack = snd_hda_jack_tbl_get(codec, per_pin->pin_nid); |
---|
| 1831 | + jack = snd_hda_jack_tbl_get_mst(codec, per_pin->pin_nid, |
---|
| 1832 | + per_pin->dev_id); |
---|
1668 | 1833 | if (jack) |
---|
1669 | 1834 | jack->jack_dirty = 1; |
---|
1670 | 1835 | |
---|
.. | .. |
---|
1672 | 1837 | per_pin->repoll_count = 0; |
---|
1673 | 1838 | |
---|
1674 | 1839 | mutex_lock(&spec->pcm_lock); |
---|
1675 | | - if (hdmi_present_sense(per_pin, per_pin->repoll_count)) |
---|
1676 | | - snd_hda_jack_report_sync(per_pin->codec); |
---|
| 1840 | + hdmi_present_sense(per_pin, per_pin->repoll_count); |
---|
1677 | 1841 | mutex_unlock(&spec->pcm_lock); |
---|
1678 | 1842 | } |
---|
1679 | | - |
---|
1680 | | -static void intel_haswell_fixup_connect_list(struct hda_codec *codec, |
---|
1681 | | - hda_nid_t nid); |
---|
1682 | 1843 | |
---|
1683 | 1844 | static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) |
---|
1684 | 1845 | { |
---|
.. | .. |
---|
1698 | 1859 | * all device entries on the same pin |
---|
1699 | 1860 | */ |
---|
1700 | 1861 | config = snd_hda_codec_get_pincfg(codec, pin_nid); |
---|
1701 | | - if (get_defcfg_connect(config) == AC_JACK_PORT_NONE) |
---|
| 1862 | + if (get_defcfg_connect(config) == AC_JACK_PORT_NONE && |
---|
| 1863 | + !spec->force_connect) |
---|
1702 | 1864 | return 0; |
---|
1703 | 1865 | |
---|
1704 | 1866 | /* |
---|
1705 | 1867 | * To simplify the implementation, malloc all |
---|
1706 | 1868 | * the virtual pins in the initialization statically |
---|
1707 | 1869 | */ |
---|
1708 | | - if (is_haswell_plus(codec)) { |
---|
| 1870 | + if (spec->intel_hsw_fixup) { |
---|
1709 | 1871 | /* |
---|
1710 | 1872 | * On Intel platforms, device entries number is |
---|
1711 | 1873 | * changed dynamically. If there is a DP MST |
---|
.. | .. |
---|
1754 | 1916 | per_pin->dev_id = i; |
---|
1755 | 1917 | per_pin->non_pcm = false; |
---|
1756 | 1918 | snd_hda_set_dev_select(codec, pin_nid, i); |
---|
1757 | | - if (is_haswell_plus(codec)) |
---|
1758 | | - intel_haswell_fixup_connect_list(codec, pin_nid); |
---|
1759 | 1919 | err = hdmi_read_pin_conn(codec, pin_idx); |
---|
1760 | 1920 | if (err < 0) |
---|
1761 | 1921 | return err; |
---|
.. | .. |
---|
1802 | 1962 | return 0; |
---|
1803 | 1963 | } |
---|
1804 | 1964 | |
---|
| 1965 | +static const struct snd_pci_quirk force_connect_list[] = { |
---|
| 1966 | + SND_PCI_QUIRK(0x103c, 0x870f, "HP", 1), |
---|
| 1967 | + SND_PCI_QUIRK(0x103c, 0x871a, "HP", 1), |
---|
| 1968 | + SND_PCI_QUIRK(0x1462, 0xec94, "MS-7C94", 1), |
---|
| 1969 | + {} |
---|
| 1970 | +}; |
---|
| 1971 | + |
---|
1805 | 1972 | static int hdmi_parse_codec(struct hda_codec *codec) |
---|
1806 | 1973 | { |
---|
1807 | | - hda_nid_t nid; |
---|
| 1974 | + struct hdmi_spec *spec = codec->spec; |
---|
| 1975 | + hda_nid_t start_nid; |
---|
| 1976 | + unsigned int caps; |
---|
1808 | 1977 | int i, nodes; |
---|
| 1978 | + const struct snd_pci_quirk *q; |
---|
1809 | 1979 | |
---|
1810 | | - nodes = snd_hda_get_sub_nodes(codec, codec->core.afg, &nid); |
---|
1811 | | - if (!nid || nodes < 0) { |
---|
| 1980 | + nodes = snd_hda_get_sub_nodes(codec, codec->core.afg, &start_nid); |
---|
| 1981 | + if (!start_nid || nodes < 0) { |
---|
1812 | 1982 | codec_warn(codec, "HDMI: failed to get afg sub nodes\n"); |
---|
1813 | 1983 | return -EINVAL; |
---|
1814 | 1984 | } |
---|
1815 | 1985 | |
---|
1816 | | - for (i = 0; i < nodes; i++, nid++) { |
---|
1817 | | - unsigned int caps; |
---|
1818 | | - unsigned int type; |
---|
| 1986 | + q = snd_pci_quirk_lookup(codec->bus->pci, force_connect_list); |
---|
| 1987 | + |
---|
| 1988 | + if (q && q->value) |
---|
| 1989 | + spec->force_connect = true; |
---|
| 1990 | + |
---|
| 1991 | + /* |
---|
| 1992 | + * hdmi_add_pin() assumes total amount of converters to |
---|
| 1993 | + * be known, so first discover all converters |
---|
| 1994 | + */ |
---|
| 1995 | + for (i = 0; i < nodes; i++) { |
---|
| 1996 | + hda_nid_t nid = start_nid + i; |
---|
1819 | 1997 | |
---|
1820 | 1998 | caps = get_wcaps(codec, nid); |
---|
1821 | | - type = get_wcaps_type(caps); |
---|
1822 | 1999 | |
---|
1823 | 2000 | if (!(caps & AC_WCAP_DIGITAL)) |
---|
1824 | 2001 | continue; |
---|
1825 | 2002 | |
---|
1826 | | - switch (type) { |
---|
1827 | | - case AC_WID_AUD_OUT: |
---|
| 2003 | + if (get_wcaps_type(caps) == AC_WID_AUD_OUT) |
---|
1828 | 2004 | hdmi_add_cvt(codec, nid); |
---|
1829 | | - break; |
---|
1830 | | - case AC_WID_PIN: |
---|
| 2005 | + } |
---|
| 2006 | + |
---|
| 2007 | + /* discover audio pins */ |
---|
| 2008 | + for (i = 0; i < nodes; i++) { |
---|
| 2009 | + hda_nid_t nid = start_nid + i; |
---|
| 2010 | + |
---|
| 2011 | + caps = get_wcaps(codec, nid); |
---|
| 2012 | + |
---|
| 2013 | + if (!(caps & AC_WCAP_DIGITAL)) |
---|
| 2014 | + continue; |
---|
| 2015 | + |
---|
| 2016 | + if (get_wcaps_type(caps) == AC_WID_PIN) |
---|
1831 | 2017 | hdmi_add_pin(codec, nid); |
---|
1832 | | - break; |
---|
1833 | | - } |
---|
1834 | 2018 | } |
---|
1835 | 2019 | |
---|
1836 | 2020 | return 0; |
---|
.. | .. |
---|
1871 | 2055 | struct hdmi_spec *spec = codec->spec; |
---|
1872 | 2056 | int pin_idx; |
---|
1873 | 2057 | struct hdmi_spec_per_pin *per_pin; |
---|
1874 | | - hda_nid_t pin_nid; |
---|
1875 | 2058 | struct snd_pcm_runtime *runtime = substream->runtime; |
---|
1876 | 2059 | bool non_pcm; |
---|
1877 | | - int pinctl; |
---|
| 2060 | + int pinctl, stripe; |
---|
1878 | 2061 | int err = 0; |
---|
1879 | 2062 | |
---|
1880 | 2063 | mutex_lock(&spec->pcm_lock); |
---|
.. | .. |
---|
1895 | 2078 | goto unlock; |
---|
1896 | 2079 | } |
---|
1897 | 2080 | per_pin = get_pin(spec, pin_idx); |
---|
1898 | | - pin_nid = per_pin->pin_nid; |
---|
1899 | 2081 | |
---|
1900 | 2082 | /* Verify pin:cvt selections to avoid silent audio after S3. |
---|
1901 | 2083 | * After S3, the audio driver restores pin:cvt selections |
---|
.. | .. |
---|
1910 | 2092 | /* Call sync_audio_rate to set the N/CTS/M manually if necessary */ |
---|
1911 | 2093 | /* Todo: add DP1.2 MST audio support later */ |
---|
1912 | 2094 | if (codec_has_acomp(codec)) |
---|
1913 | | - snd_hdac_sync_audio_rate(&codec->core, pin_nid, per_pin->dev_id, |
---|
1914 | | - runtime->rate); |
---|
| 2095 | + snd_hdac_sync_audio_rate(&codec->core, per_pin->pin_nid, |
---|
| 2096 | + per_pin->dev_id, runtime->rate); |
---|
1915 | 2097 | |
---|
1916 | 2098 | non_pcm = check_non_pcm_per_cvt(codec, cvt_nid); |
---|
1917 | 2099 | mutex_lock(&per_pin->lock); |
---|
1918 | 2100 | per_pin->channels = substream->runtime->channels; |
---|
1919 | 2101 | per_pin->setup = true; |
---|
1920 | 2102 | |
---|
| 2103 | + if (get_wcaps(codec, cvt_nid) & AC_WCAP_STRIPE) { |
---|
| 2104 | + stripe = snd_hdac_get_stream_stripe_ctl(&codec->bus->core, |
---|
| 2105 | + substream); |
---|
| 2106 | + snd_hda_codec_write(codec, cvt_nid, 0, |
---|
| 2107 | + AC_VERB_SET_STRIPE_CONTROL, |
---|
| 2108 | + stripe); |
---|
| 2109 | + } |
---|
| 2110 | + |
---|
1921 | 2111 | hdmi_setup_audio_infoframe(codec, per_pin, non_pcm); |
---|
1922 | 2112 | mutex_unlock(&per_pin->lock); |
---|
1923 | 2113 | if (spec->dyn_pin_out) { |
---|
1924 | | - pinctl = snd_hda_codec_read(codec, pin_nid, 0, |
---|
| 2114 | + snd_hda_set_dev_select(codec, per_pin->pin_nid, |
---|
| 2115 | + per_pin->dev_id); |
---|
| 2116 | + pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0, |
---|
1925 | 2117 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
---|
1926 | | - snd_hda_codec_write(codec, pin_nid, 0, |
---|
| 2118 | + snd_hda_codec_write(codec, per_pin->pin_nid, 0, |
---|
1927 | 2119 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
---|
1928 | 2120 | pinctl | PIN_OUT); |
---|
1929 | 2121 | } |
---|
1930 | 2122 | |
---|
1931 | 2123 | /* snd_hda_set_dev_select() has been called before */ |
---|
1932 | | - err = spec->ops.setup_stream(codec, cvt_nid, pin_nid, |
---|
1933 | | - stream_tag, format); |
---|
| 2124 | + err = spec->ops.setup_stream(codec, cvt_nid, per_pin->pin_nid, |
---|
| 2125 | + per_pin->dev_id, stream_tag, format); |
---|
1934 | 2126 | unlock: |
---|
1935 | 2127 | mutex_unlock(&spec->pcm_lock); |
---|
1936 | 2128 | return err; |
---|
.. | .. |
---|
1968 | 2160 | goto unlock; |
---|
1969 | 2161 | } |
---|
1970 | 2162 | per_cvt = get_cvt(spec, cvt_idx); |
---|
1971 | | - snd_BUG_ON(!per_cvt->assigned); |
---|
1972 | 2163 | per_cvt->assigned = 0; |
---|
1973 | 2164 | hinfo->nid = 0; |
---|
| 2165 | + |
---|
| 2166 | + azx_stream(get_azx_dev(substream))->stripe = 0; |
---|
1974 | 2167 | |
---|
1975 | 2168 | snd_hda_spdif_ctls_unassign(codec, pcm_idx); |
---|
1976 | 2169 | clear_bit(pcm_idx, &spec->pcm_in_use); |
---|
.. | .. |
---|
1985 | 2178 | per_pin = get_pin(spec, pin_idx); |
---|
1986 | 2179 | |
---|
1987 | 2180 | if (spec->dyn_pin_out) { |
---|
| 2181 | + snd_hda_set_dev_select(codec, per_pin->pin_nid, |
---|
| 2182 | + per_pin->dev_id); |
---|
1988 | 2183 | pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0, |
---|
1989 | 2184 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
---|
1990 | 2185 | snd_hda_codec_write(codec, per_pin->pin_nid, 0, |
---|
.. | .. |
---|
2016 | 2211 | |
---|
2017 | 2212 | static int hdmi_get_spk_alloc(struct hdac_device *hdac, int pcm_idx) |
---|
2018 | 2213 | { |
---|
2019 | | - struct hda_codec *codec = container_of(hdac, struct hda_codec, core); |
---|
| 2214 | + struct hda_codec *codec = hdac_to_hda_codec(hdac); |
---|
2020 | 2215 | struct hdmi_spec *spec = codec->spec; |
---|
2021 | 2216 | struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx); |
---|
2022 | 2217 | |
---|
.. | .. |
---|
2029 | 2224 | static void hdmi_get_chmap(struct hdac_device *hdac, int pcm_idx, |
---|
2030 | 2225 | unsigned char *chmap) |
---|
2031 | 2226 | { |
---|
2032 | | - struct hda_codec *codec = container_of(hdac, struct hda_codec, core); |
---|
| 2227 | + struct hda_codec *codec = hdac_to_hda_codec(hdac); |
---|
2033 | 2228 | struct hdmi_spec *spec = codec->spec; |
---|
2034 | 2229 | struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx); |
---|
2035 | 2230 | |
---|
.. | .. |
---|
2043 | 2238 | static void hdmi_set_chmap(struct hdac_device *hdac, int pcm_idx, |
---|
2044 | 2239 | unsigned char *chmap, int prepared) |
---|
2045 | 2240 | { |
---|
2046 | | - struct hda_codec *codec = container_of(hdac, struct hda_codec, core); |
---|
| 2241 | + struct hda_codec *codec = hdac_to_hda_codec(hdac); |
---|
2047 | 2242 | struct hdmi_spec *spec = codec->spec; |
---|
2048 | 2243 | struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx); |
---|
2049 | 2244 | |
---|
.. | .. |
---|
2059 | 2254 | |
---|
2060 | 2255 | static bool is_hdmi_pcm_attached(struct hdac_device *hdac, int pcm_idx) |
---|
2061 | 2256 | { |
---|
2062 | | - struct hda_codec *codec = container_of(hdac, struct hda_codec, core); |
---|
| 2257 | + struct hda_codec *codec = hdac_to_hda_codec(hdac); |
---|
2063 | 2258 | struct hdmi_spec *spec = codec->spec; |
---|
2064 | 2259 | struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx); |
---|
2065 | 2260 | |
---|
.. | .. |
---|
2069 | 2264 | static int generic_hdmi_build_pcms(struct hda_codec *codec) |
---|
2070 | 2265 | { |
---|
2071 | 2266 | struct hdmi_spec *spec = codec->spec; |
---|
2072 | | - int idx; |
---|
| 2267 | + int idx, pcm_num; |
---|
2073 | 2268 | |
---|
2074 | 2269 | /* |
---|
2075 | 2270 | * for non-mst mode, pcm number is the same as before |
---|
2076 | | - * for DP MST mode, pcm number is (nid number + dev_num - 1) |
---|
2077 | | - * dev_num is the device entry number in a pin |
---|
2078 | | - * |
---|
| 2271 | + * for DP MST mode without extra PCM, pcm number is same |
---|
| 2272 | + * for DP MST mode with extra PCMs, pcm number is |
---|
| 2273 | + * (nid number + dev_num - 1) |
---|
| 2274 | + * dev_num is the device entry number in a pin |
---|
2079 | 2275 | */ |
---|
2080 | | - for (idx = 0; idx < spec->num_nids + spec->dev_num - 1; idx++) { |
---|
| 2276 | + |
---|
| 2277 | + if (spec->dyn_pcm_no_legacy && codec->mst_no_extra_pcms) |
---|
| 2278 | + pcm_num = spec->num_cvts; |
---|
| 2279 | + else if (codec->mst_no_extra_pcms) |
---|
| 2280 | + pcm_num = spec->num_nids; |
---|
| 2281 | + else |
---|
| 2282 | + pcm_num = spec->num_nids + spec->dev_num - 1; |
---|
| 2283 | + |
---|
| 2284 | + codec_dbg(codec, "hdmi: pcm_num set to %d\n", pcm_num); |
---|
| 2285 | + |
---|
| 2286 | + for (idx = 0; idx < pcm_num; idx++) { |
---|
2081 | 2287 | struct hda_pcm *info; |
---|
2082 | 2288 | struct hda_pcm_stream *pstr; |
---|
2083 | 2289 | |
---|
.. | .. |
---|
2109 | 2315 | pcm->jack = NULL; |
---|
2110 | 2316 | } |
---|
2111 | 2317 | |
---|
2112 | | -static int add_hdmi_jack_kctl(struct hda_codec *codec, |
---|
2113 | | - struct hdmi_spec *spec, |
---|
2114 | | - int pcm_idx, |
---|
2115 | | - const char *name) |
---|
| 2318 | +static int generic_hdmi_build_jack(struct hda_codec *codec, int pcm_idx) |
---|
2116 | 2319 | { |
---|
| 2320 | + char hdmi_str[32] = "HDMI/DP"; |
---|
| 2321 | + struct hdmi_spec *spec = codec->spec; |
---|
| 2322 | + struct hdmi_spec_per_pin *per_pin = get_pin(spec, pcm_idx); |
---|
2117 | 2323 | struct snd_jack *jack; |
---|
| 2324 | + int pcmdev = get_pcm_rec(spec, pcm_idx)->device; |
---|
2118 | 2325 | int err; |
---|
2119 | 2326 | |
---|
2120 | | - err = snd_jack_new(codec->card, name, SND_JACK_AVOUT, &jack, |
---|
| 2327 | + if (pcmdev > 0) |
---|
| 2328 | + sprintf(hdmi_str + strlen(hdmi_str), ",pcm=%d", pcmdev); |
---|
| 2329 | + if (!spec->dyn_pcm_assign && |
---|
| 2330 | + !is_jack_detectable(codec, per_pin->pin_nid)) |
---|
| 2331 | + strncat(hdmi_str, " Phantom", |
---|
| 2332 | + sizeof(hdmi_str) - strlen(hdmi_str) - 1); |
---|
| 2333 | + |
---|
| 2334 | + err = snd_jack_new(codec->card, hdmi_str, SND_JACK_AVOUT, &jack, |
---|
2121 | 2335 | true, false); |
---|
2122 | 2336 | if (err < 0) |
---|
2123 | 2337 | return err; |
---|
.. | .. |
---|
2125 | 2339 | spec->pcm_rec[pcm_idx].jack = jack; |
---|
2126 | 2340 | jack->private_data = &spec->pcm_rec[pcm_idx]; |
---|
2127 | 2341 | jack->private_free = free_hdmi_jack_priv; |
---|
2128 | | - return 0; |
---|
2129 | | -} |
---|
2130 | | - |
---|
2131 | | -static int generic_hdmi_build_jack(struct hda_codec *codec, int pcm_idx) |
---|
2132 | | -{ |
---|
2133 | | - char hdmi_str[32] = "HDMI/DP"; |
---|
2134 | | - struct hdmi_spec *spec = codec->spec; |
---|
2135 | | - struct hdmi_spec_per_pin *per_pin; |
---|
2136 | | - struct hda_jack_tbl *jack; |
---|
2137 | | - int pcmdev = get_pcm_rec(spec, pcm_idx)->device; |
---|
2138 | | - bool phantom_jack; |
---|
2139 | | - int ret; |
---|
2140 | | - |
---|
2141 | | - if (pcmdev > 0) |
---|
2142 | | - sprintf(hdmi_str + strlen(hdmi_str), ",pcm=%d", pcmdev); |
---|
2143 | | - |
---|
2144 | | - if (spec->dyn_pcm_assign) |
---|
2145 | | - return add_hdmi_jack_kctl(codec, spec, pcm_idx, hdmi_str); |
---|
2146 | | - |
---|
2147 | | - /* for !dyn_pcm_assign, we still use hda_jack for compatibility */ |
---|
2148 | | - /* if !dyn_pcm_assign, it must be non-MST mode. |
---|
2149 | | - * This means pcms and pins are statically mapped. |
---|
2150 | | - * And pcm_idx is pin_idx. |
---|
2151 | | - */ |
---|
2152 | | - per_pin = get_pin(spec, pcm_idx); |
---|
2153 | | - phantom_jack = !is_jack_detectable(codec, per_pin->pin_nid); |
---|
2154 | | - if (phantom_jack) |
---|
2155 | | - strncat(hdmi_str, " Phantom", |
---|
2156 | | - sizeof(hdmi_str) - strlen(hdmi_str) - 1); |
---|
2157 | | - ret = snd_hda_jack_add_kctl(codec, per_pin->pin_nid, hdmi_str, |
---|
2158 | | - phantom_jack); |
---|
2159 | | - if (ret < 0) |
---|
2160 | | - return ret; |
---|
2161 | | - jack = snd_hda_jack_tbl_get(codec, per_pin->pin_nid); |
---|
2162 | | - if (jack == NULL) |
---|
2163 | | - return 0; |
---|
2164 | | - /* assign jack->jack to pcm_rec[].jack to |
---|
2165 | | - * align with dyn_pcm_assign mode |
---|
2166 | | - */ |
---|
2167 | | - spec->pcm_rec[pcm_idx].jack = jack->jack; |
---|
2168 | 2342 | return 0; |
---|
2169 | 2343 | } |
---|
2170 | 2344 | |
---|
.. | .. |
---|
2257 | 2431 | struct hdmi_spec *spec = codec->spec; |
---|
2258 | 2432 | int pin_idx; |
---|
2259 | 2433 | |
---|
| 2434 | + mutex_lock(&spec->bind_lock); |
---|
2260 | 2435 | for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { |
---|
2261 | 2436 | struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx); |
---|
2262 | 2437 | hda_nid_t pin_nid = per_pin->pin_nid; |
---|
.. | .. |
---|
2264 | 2439 | |
---|
2265 | 2440 | snd_hda_set_dev_select(codec, pin_nid, dev_id); |
---|
2266 | 2441 | hdmi_init_pin(codec, pin_nid); |
---|
2267 | | - if (!codec_has_acomp(codec)) |
---|
2268 | | - snd_hda_jack_detect_enable_callback(codec, pin_nid, |
---|
2269 | | - codec->jackpoll_interval > 0 ? |
---|
2270 | | - jack_callback : NULL); |
---|
| 2442 | + if (codec_has_acomp(codec)) |
---|
| 2443 | + continue; |
---|
| 2444 | + snd_hda_jack_detect_enable_callback_mst(codec, pin_nid, dev_id, |
---|
| 2445 | + jack_callback); |
---|
2271 | 2446 | } |
---|
| 2447 | + mutex_unlock(&spec->bind_lock); |
---|
2272 | 2448 | return 0; |
---|
2273 | 2449 | } |
---|
2274 | 2450 | |
---|
.. | .. |
---|
2301 | 2477 | struct hdmi_spec *spec = codec->spec; |
---|
2302 | 2478 | int pin_idx, pcm_idx; |
---|
2303 | 2479 | |
---|
2304 | | - if (codec_has_acomp(codec)) { |
---|
| 2480 | + if (spec->acomp_registered) { |
---|
| 2481 | + snd_hdac_acomp_exit(&codec->bus->core); |
---|
| 2482 | + } else if (codec_has_acomp(codec)) { |
---|
2305 | 2483 | snd_hdac_acomp_register_notifier(&codec->bus->core, NULL); |
---|
2306 | | - codec->relaxed_resume = 0; |
---|
2307 | 2484 | } |
---|
| 2485 | + codec->relaxed_resume = 0; |
---|
2308 | 2486 | |
---|
2309 | 2487 | for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { |
---|
2310 | 2488 | struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx); |
---|
.. | .. |
---|
2344 | 2522 | int pin_idx; |
---|
2345 | 2523 | |
---|
2346 | 2524 | codec->patch_ops.init(codec); |
---|
2347 | | - regcache_sync(codec->core.regmap); |
---|
| 2525 | + snd_hda_regmap_sync(codec); |
---|
2348 | 2526 | |
---|
2349 | 2527 | for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { |
---|
2350 | 2528 | struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx); |
---|
.. | .. |
---|
2367 | 2545 | }; |
---|
2368 | 2546 | |
---|
2369 | 2547 | static const struct hdmi_ops generic_standard_hdmi_ops = { |
---|
2370 | | - .pin_get_eld = snd_hdmi_get_eld, |
---|
| 2548 | + .pin_get_eld = hdmi_pin_get_eld, |
---|
2371 | 2549 | .pin_setup_infoframe = hdmi_pin_setup_infoframe, |
---|
2372 | 2550 | .pin_hbr_setup = hdmi_pin_hbr_setup, |
---|
2373 | 2551 | .setup_stream = hdmi_setup_stream, |
---|
.. | .. |
---|
2382 | 2560 | if (!spec) |
---|
2383 | 2561 | return -ENOMEM; |
---|
2384 | 2562 | |
---|
| 2563 | + spec->codec = codec; |
---|
2385 | 2564 | spec->ops = generic_standard_hdmi_ops; |
---|
2386 | 2565 | spec->dev_num = 1; /* initialize to 1 */ |
---|
2387 | 2566 | mutex_init(&spec->pcm_lock); |
---|
| 2567 | + mutex_init(&spec->bind_lock); |
---|
2388 | 2568 | snd_hdac_register_chmap_ops(&codec->core, &spec->chmap); |
---|
2389 | 2569 | |
---|
2390 | 2570 | spec->chmap.ops.get_chmap = hdmi_get_chmap; |
---|
2391 | 2571 | spec->chmap.ops.set_chmap = hdmi_set_chmap; |
---|
2392 | 2572 | spec->chmap.ops.is_pcm_attached = is_hdmi_pcm_attached; |
---|
2393 | | - spec->chmap.ops.get_spk_alloc = hdmi_get_spk_alloc, |
---|
| 2573 | + spec->chmap.ops.get_spk_alloc = hdmi_get_spk_alloc; |
---|
2394 | 2574 | |
---|
2395 | 2575 | codec->spec = spec; |
---|
2396 | 2576 | hdmi_array_init(spec, 4); |
---|
.. | .. |
---|
2420 | 2600 | } |
---|
2421 | 2601 | |
---|
2422 | 2602 | /* |
---|
| 2603 | + * generic audio component binding |
---|
| 2604 | + */ |
---|
| 2605 | + |
---|
| 2606 | +/* turn on / off the unsol event jack detection dynamically */ |
---|
| 2607 | +static void reprogram_jack_detect(struct hda_codec *codec, hda_nid_t nid, |
---|
| 2608 | + int dev_id, bool use_acomp) |
---|
| 2609 | +{ |
---|
| 2610 | + struct hda_jack_tbl *tbl; |
---|
| 2611 | + |
---|
| 2612 | + tbl = snd_hda_jack_tbl_get_mst(codec, nid, dev_id); |
---|
| 2613 | + if (tbl) { |
---|
| 2614 | + /* clear unsol even if component notifier is used, or re-enable |
---|
| 2615 | + * if notifier is cleared |
---|
| 2616 | + */ |
---|
| 2617 | + unsigned int val = use_acomp ? 0 : (AC_USRSP_EN | tbl->tag); |
---|
| 2618 | + snd_hda_codec_write_cache(codec, nid, 0, |
---|
| 2619 | + AC_VERB_SET_UNSOLICITED_ENABLE, val); |
---|
| 2620 | + } |
---|
| 2621 | +} |
---|
| 2622 | + |
---|
| 2623 | +/* set up / clear component notifier dynamically */ |
---|
| 2624 | +static void generic_acomp_notifier_set(struct drm_audio_component *acomp, |
---|
| 2625 | + bool use_acomp) |
---|
| 2626 | +{ |
---|
| 2627 | + struct hdmi_spec *spec; |
---|
| 2628 | + int i; |
---|
| 2629 | + |
---|
| 2630 | + spec = container_of(acomp->audio_ops, struct hdmi_spec, drm_audio_ops); |
---|
| 2631 | + mutex_lock(&spec->bind_lock); |
---|
| 2632 | + spec->use_acomp_notifier = use_acomp; |
---|
| 2633 | + spec->codec->relaxed_resume = use_acomp; |
---|
| 2634 | + spec->codec->bus->keep_power = 0; |
---|
| 2635 | + /* reprogram each jack detection logic depending on the notifier */ |
---|
| 2636 | + for (i = 0; i < spec->num_pins; i++) |
---|
| 2637 | + reprogram_jack_detect(spec->codec, |
---|
| 2638 | + get_pin(spec, i)->pin_nid, |
---|
| 2639 | + get_pin(spec, i)->dev_id, |
---|
| 2640 | + use_acomp); |
---|
| 2641 | + mutex_unlock(&spec->bind_lock); |
---|
| 2642 | +} |
---|
| 2643 | + |
---|
| 2644 | +/* enable / disable the notifier via master bind / unbind */ |
---|
| 2645 | +static int generic_acomp_master_bind(struct device *dev, |
---|
| 2646 | + struct drm_audio_component *acomp) |
---|
| 2647 | +{ |
---|
| 2648 | + generic_acomp_notifier_set(acomp, true); |
---|
| 2649 | + return 0; |
---|
| 2650 | +} |
---|
| 2651 | + |
---|
| 2652 | +static void generic_acomp_master_unbind(struct device *dev, |
---|
| 2653 | + struct drm_audio_component *acomp) |
---|
| 2654 | +{ |
---|
| 2655 | + generic_acomp_notifier_set(acomp, false); |
---|
| 2656 | +} |
---|
| 2657 | + |
---|
| 2658 | +/* check whether both HD-audio and DRM PCI devices belong to the same bus */ |
---|
| 2659 | +static int match_bound_vga(struct device *dev, int subtype, void *data) |
---|
| 2660 | +{ |
---|
| 2661 | + struct hdac_bus *bus = data; |
---|
| 2662 | + struct pci_dev *pci, *master; |
---|
| 2663 | + |
---|
| 2664 | + if (!dev_is_pci(dev) || !dev_is_pci(bus->dev)) |
---|
| 2665 | + return 0; |
---|
| 2666 | + master = to_pci_dev(bus->dev); |
---|
| 2667 | + pci = to_pci_dev(dev); |
---|
| 2668 | + return master->bus == pci->bus; |
---|
| 2669 | +} |
---|
| 2670 | + |
---|
| 2671 | +/* audio component notifier for AMD/Nvidia HDMI codecs */ |
---|
| 2672 | +static void generic_acomp_pin_eld_notify(void *audio_ptr, int port, int dev_id) |
---|
| 2673 | +{ |
---|
| 2674 | + struct hda_codec *codec = audio_ptr; |
---|
| 2675 | + struct hdmi_spec *spec = codec->spec; |
---|
| 2676 | + hda_nid_t pin_nid = spec->port2pin(codec, port); |
---|
| 2677 | + |
---|
| 2678 | + if (!pin_nid) |
---|
| 2679 | + return; |
---|
| 2680 | + if (get_wcaps_type(get_wcaps(codec, pin_nid)) != AC_WID_PIN) |
---|
| 2681 | + return; |
---|
| 2682 | + /* skip notification during system suspend (but not in runtime PM); |
---|
| 2683 | + * the state will be updated at resume |
---|
| 2684 | + */ |
---|
| 2685 | + if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND) |
---|
| 2686 | + return; |
---|
| 2687 | + |
---|
| 2688 | + check_presence_and_report(codec, pin_nid, dev_id); |
---|
| 2689 | +} |
---|
| 2690 | + |
---|
| 2691 | +/* set up the private drm_audio_ops from the template */ |
---|
| 2692 | +static void setup_drm_audio_ops(struct hda_codec *codec, |
---|
| 2693 | + const struct drm_audio_component_audio_ops *ops) |
---|
| 2694 | +{ |
---|
| 2695 | + struct hdmi_spec *spec = codec->spec; |
---|
| 2696 | + |
---|
| 2697 | + spec->drm_audio_ops.audio_ptr = codec; |
---|
| 2698 | + /* intel_audio_codec_enable() or intel_audio_codec_disable() |
---|
| 2699 | + * will call pin_eld_notify with using audio_ptr pointer |
---|
| 2700 | + * We need make sure audio_ptr is really setup |
---|
| 2701 | + */ |
---|
| 2702 | + wmb(); |
---|
| 2703 | + spec->drm_audio_ops.pin2port = ops->pin2port; |
---|
| 2704 | + spec->drm_audio_ops.pin_eld_notify = ops->pin_eld_notify; |
---|
| 2705 | + spec->drm_audio_ops.master_bind = ops->master_bind; |
---|
| 2706 | + spec->drm_audio_ops.master_unbind = ops->master_unbind; |
---|
| 2707 | +} |
---|
| 2708 | + |
---|
| 2709 | +/* initialize the generic HDMI audio component */ |
---|
| 2710 | +static void generic_acomp_init(struct hda_codec *codec, |
---|
| 2711 | + const struct drm_audio_component_audio_ops *ops, |
---|
| 2712 | + int (*port2pin)(struct hda_codec *, int)) |
---|
| 2713 | +{ |
---|
| 2714 | + struct hdmi_spec *spec = codec->spec; |
---|
| 2715 | + |
---|
| 2716 | + if (!enable_acomp) { |
---|
| 2717 | + codec_info(codec, "audio component disabled by module option\n"); |
---|
| 2718 | + return; |
---|
| 2719 | + } |
---|
| 2720 | + |
---|
| 2721 | + spec->port2pin = port2pin; |
---|
| 2722 | + setup_drm_audio_ops(codec, ops); |
---|
| 2723 | + if (!snd_hdac_acomp_init(&codec->bus->core, &spec->drm_audio_ops, |
---|
| 2724 | + match_bound_vga, 0)) { |
---|
| 2725 | + spec->acomp_registered = true; |
---|
| 2726 | + } |
---|
| 2727 | +} |
---|
| 2728 | + |
---|
| 2729 | +/* |
---|
2423 | 2730 | * Intel codec parsers and helpers |
---|
2424 | 2731 | */ |
---|
2425 | 2732 | |
---|
2426 | | -static void intel_haswell_fixup_connect_list(struct hda_codec *codec, |
---|
2427 | | - hda_nid_t nid) |
---|
2428 | | -{ |
---|
2429 | | - struct hdmi_spec *spec = codec->spec; |
---|
2430 | | - hda_nid_t conns[4]; |
---|
2431 | | - int nconns; |
---|
2432 | | - |
---|
2433 | | - nconns = snd_hda_get_connections(codec, nid, conns, ARRAY_SIZE(conns)); |
---|
2434 | | - if (nconns == spec->num_cvts && |
---|
2435 | | - !memcmp(conns, spec->cvt_nids, spec->num_cvts * sizeof(hda_nid_t))) |
---|
2436 | | - return; |
---|
2437 | | - |
---|
2438 | | - /* override pins connection list */ |
---|
2439 | | - codec_dbg(codec, "hdmi: haswell: override pin connection 0x%x\n", nid); |
---|
2440 | | - snd_hda_override_conn_list(codec, nid, spec->num_cvts, spec->cvt_nids); |
---|
2441 | | -} |
---|
2442 | | - |
---|
2443 | | -#define INTEL_VENDOR_NID 0x08 |
---|
2444 | | -#define INTEL_GLK_VENDOR_NID 0x0B |
---|
2445 | | -#define INTEL_GET_VENDOR_VERB 0xf81 |
---|
2446 | | -#define INTEL_SET_VENDOR_VERB 0x781 |
---|
2447 | | -#define INTEL_EN_DP12 0x02 /* enable DP 1.2 features */ |
---|
2448 | | -#define INTEL_EN_ALL_PIN_CVTS 0x01 /* enable 2nd & 3rd pins and convertors */ |
---|
| 2733 | +#define INTEL_GET_VENDOR_VERB 0xf81 |
---|
| 2734 | +#define INTEL_SET_VENDOR_VERB 0x781 |
---|
| 2735 | +#define INTEL_EN_DP12 0x02 /* enable DP 1.2 features */ |
---|
| 2736 | +#define INTEL_EN_ALL_PIN_CVTS 0x01 /* enable 2nd & 3rd pins and convertors */ |
---|
2449 | 2737 | |
---|
2450 | 2738 | static void intel_haswell_enable_all_pins(struct hda_codec *codec, |
---|
2451 | 2739 | bool update_tree) |
---|
.. | .. |
---|
2525 | 2813 | |
---|
2526 | 2814 | static int intel_pin2port(void *audio_ptr, int pin_nid) |
---|
2527 | 2815 | { |
---|
2528 | | - int base_nid = intel_base_nid(audio_ptr); |
---|
| 2816 | + struct hda_codec *codec = audio_ptr; |
---|
| 2817 | + struct hdmi_spec *spec = codec->spec; |
---|
| 2818 | + int base_nid, i; |
---|
2529 | 2819 | |
---|
2530 | | - if (WARN_ON(pin_nid < base_nid || pin_nid >= base_nid + 3)) |
---|
2531 | | - return -1; |
---|
2532 | | - return pin_nid - base_nid + 1; /* intel port is 1-based */ |
---|
| 2820 | + if (!spec->port_num) { |
---|
| 2821 | + base_nid = intel_base_nid(codec); |
---|
| 2822 | + if (WARN_ON(pin_nid < base_nid || pin_nid >= base_nid + 3)) |
---|
| 2823 | + return -1; |
---|
| 2824 | + return pin_nid - base_nid + 1; |
---|
| 2825 | + } |
---|
| 2826 | + |
---|
| 2827 | + /* |
---|
| 2828 | + * looking for the pin number in the mapping table and return |
---|
| 2829 | + * the index which indicate the port number |
---|
| 2830 | + */ |
---|
| 2831 | + for (i = 0; i < spec->port_num; i++) { |
---|
| 2832 | + if (pin_nid == spec->port_map[i]) |
---|
| 2833 | + return i; |
---|
| 2834 | + } |
---|
| 2835 | + |
---|
| 2836 | + codec_info(codec, "Can't find the HDMI/DP port for pin %d\n", pin_nid); |
---|
| 2837 | + return -1; |
---|
| 2838 | +} |
---|
| 2839 | + |
---|
| 2840 | +static int intel_port2pin(struct hda_codec *codec, int port) |
---|
| 2841 | +{ |
---|
| 2842 | + struct hdmi_spec *spec = codec->spec; |
---|
| 2843 | + |
---|
| 2844 | + if (!spec->port_num) { |
---|
| 2845 | + /* we assume only from port-B to port-D */ |
---|
| 2846 | + if (port < 1 || port > 3) |
---|
| 2847 | + return 0; |
---|
| 2848 | + return port + intel_base_nid(codec) - 1; |
---|
| 2849 | + } |
---|
| 2850 | + |
---|
| 2851 | + if (port < 0 || port >= spec->port_num) |
---|
| 2852 | + return 0; |
---|
| 2853 | + return spec->port_map[port]; |
---|
2533 | 2854 | } |
---|
2534 | 2855 | |
---|
2535 | 2856 | static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe) |
---|
.. | .. |
---|
2538 | 2859 | int pin_nid; |
---|
2539 | 2860 | int dev_id = pipe; |
---|
2540 | 2861 | |
---|
2541 | | - /* we assume only from port-B to port-D */ |
---|
2542 | | - if (port < 1 || port > 3) |
---|
| 2862 | + pin_nid = intel_port2pin(codec, port); |
---|
| 2863 | + if (!pin_nid) |
---|
2543 | 2864 | return; |
---|
2544 | | - |
---|
2545 | | - pin_nid = port + intel_base_nid(codec) - 1; /* intel port is 1-based */ |
---|
2546 | | - |
---|
2547 | 2865 | /* skip notification during system suspend (but not in runtime PM); |
---|
2548 | 2866 | * the state will be updated at resume |
---|
2549 | 2867 | */ |
---|
2550 | | - if (snd_power_get_state(codec->card) != SNDRV_CTL_POWER_D0) |
---|
2551 | | - return; |
---|
2552 | | - /* ditto during suspend/resume process itself */ |
---|
2553 | | - if (snd_hdac_is_in_pm(&codec->core)) |
---|
| 2868 | + if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND) |
---|
2554 | 2869 | return; |
---|
2555 | 2870 | |
---|
2556 | 2871 | snd_hdac_i915_set_bclk(&codec->bus->core); |
---|
2557 | 2872 | check_presence_and_report(codec, pin_nid, dev_id); |
---|
2558 | 2873 | } |
---|
| 2874 | + |
---|
| 2875 | +static const struct drm_audio_component_audio_ops intel_audio_ops = { |
---|
| 2876 | + .pin2port = intel_pin2port, |
---|
| 2877 | + .pin_eld_notify = intel_pin_eld_notify, |
---|
| 2878 | +}; |
---|
2559 | 2879 | |
---|
2560 | 2880 | /* register i915 component pin_eld_notify callback */ |
---|
2561 | 2881 | static void register_i915_notifier(struct hda_codec *codec) |
---|
.. | .. |
---|
2563 | 2883 | struct hdmi_spec *spec = codec->spec; |
---|
2564 | 2884 | |
---|
2565 | 2885 | spec->use_acomp_notifier = true; |
---|
2566 | | - spec->drm_audio_ops.audio_ptr = codec; |
---|
2567 | | - /* intel_audio_codec_enable() or intel_audio_codec_disable() |
---|
2568 | | - * will call pin_eld_notify with using audio_ptr pointer |
---|
2569 | | - * We need make sure audio_ptr is really setup |
---|
2570 | | - */ |
---|
2571 | | - wmb(); |
---|
2572 | | - spec->drm_audio_ops.pin2port = intel_pin2port; |
---|
2573 | | - spec->drm_audio_ops.pin_eld_notify = intel_pin_eld_notify; |
---|
| 2886 | + spec->port2pin = intel_port2pin; |
---|
| 2887 | + setup_drm_audio_ops(codec, &intel_audio_ops); |
---|
2574 | 2888 | snd_hdac_acomp_register_notifier(&codec->bus->core, |
---|
2575 | 2889 | &spec->drm_audio_ops); |
---|
2576 | 2890 | /* no need for forcible resume for jack check thanks to notifier */ |
---|
.. | .. |
---|
2579 | 2893 | |
---|
2580 | 2894 | /* setup_stream ops override for HSW+ */ |
---|
2581 | 2895 | static int i915_hsw_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid, |
---|
2582 | | - hda_nid_t pin_nid, u32 stream_tag, int format) |
---|
| 2896 | + hda_nid_t pin_nid, int dev_id, u32 stream_tag, |
---|
| 2897 | + int format) |
---|
2583 | 2898 | { |
---|
2584 | 2899 | haswell_verify_D0(codec, cvt_nid, pin_nid); |
---|
2585 | | - return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format); |
---|
| 2900 | + return hdmi_setup_stream(codec, cvt_nid, pin_nid, dev_id, |
---|
| 2901 | + stream_tag, format); |
---|
2586 | 2902 | } |
---|
2587 | 2903 | |
---|
2588 | 2904 | /* pin_cvt_fixup ops override for HSW+ and VLV+ */ |
---|
.. | .. |
---|
2643 | 2959 | } |
---|
2644 | 2960 | |
---|
2645 | 2961 | /* Intel Haswell and onwards; audio component with eld notifier */ |
---|
2646 | | -static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid) |
---|
| 2962 | +static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid, |
---|
| 2963 | + const int *port_map, int port_num) |
---|
2647 | 2964 | { |
---|
2648 | 2965 | struct hdmi_spec *spec; |
---|
2649 | 2966 | int err; |
---|
.. | .. |
---|
2655 | 2972 | codec->dp_mst = true; |
---|
2656 | 2973 | spec->dyn_pcm_assign = true; |
---|
2657 | 2974 | spec->vendor_nid = vendor_nid; |
---|
| 2975 | + spec->port_map = port_map; |
---|
| 2976 | + spec->port_num = port_num; |
---|
| 2977 | + spec->intel_hsw_fixup = true; |
---|
2658 | 2978 | |
---|
2659 | 2979 | intel_haswell_enable_all_pins(codec, true); |
---|
2660 | 2980 | intel_haswell_fixup_enable_dp12(codec); |
---|
2661 | 2981 | |
---|
2662 | | - /* For Haswell/Broadwell, the controller is also in the power well and |
---|
2663 | | - * can cover the codec power request, and so need not set this flag. |
---|
2664 | | - */ |
---|
2665 | | - if (!is_haswell(codec) && !is_broadwell(codec)) |
---|
2666 | | - codec->core.link_power_control = 1; |
---|
| 2982 | + codec->display_power_control = 1; |
---|
2667 | 2983 | |
---|
2668 | 2984 | codec->patch_ops.set_power_state = haswell_set_power_state; |
---|
2669 | 2985 | codec->depop_delay = 0; |
---|
.. | .. |
---|
2672 | 2988 | spec->ops.setup_stream = i915_hsw_setup_stream; |
---|
2673 | 2989 | spec->ops.pin_cvt_fixup = i915_pin_cvt_fixup; |
---|
2674 | 2990 | |
---|
| 2991 | + /* |
---|
| 2992 | + * Enable silent stream feature, if it is enabled via |
---|
| 2993 | + * module param or Kconfig option |
---|
| 2994 | + */ |
---|
| 2995 | + if (enable_silent_stream) |
---|
| 2996 | + spec->send_silent_stream = true; |
---|
| 2997 | + |
---|
2675 | 2998 | return parse_intel_hdmi(codec); |
---|
2676 | 2999 | } |
---|
2677 | 3000 | |
---|
2678 | 3001 | static int patch_i915_hsw_hdmi(struct hda_codec *codec) |
---|
2679 | 3002 | { |
---|
2680 | | - return intel_hsw_common_init(codec, INTEL_VENDOR_NID); |
---|
| 3003 | + return intel_hsw_common_init(codec, 0x08, NULL, 0); |
---|
2681 | 3004 | } |
---|
2682 | 3005 | |
---|
2683 | 3006 | static int patch_i915_glk_hdmi(struct hda_codec *codec) |
---|
2684 | 3007 | { |
---|
2685 | | - return intel_hsw_common_init(codec, INTEL_GLK_VENDOR_NID); |
---|
| 3008 | + return intel_hsw_common_init(codec, 0x0b, NULL, 0); |
---|
| 3009 | +} |
---|
| 3010 | + |
---|
| 3011 | +static int patch_i915_icl_hdmi(struct hda_codec *codec) |
---|
| 3012 | +{ |
---|
| 3013 | + /* |
---|
| 3014 | + * pin to port mapping table where the value indicate the pin number and |
---|
| 3015 | + * the index indicate the port number. |
---|
| 3016 | + */ |
---|
| 3017 | + static const int map[] = {0x0, 0x4, 0x6, 0x8, 0xa, 0xb}; |
---|
| 3018 | + |
---|
| 3019 | + return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map)); |
---|
| 3020 | +} |
---|
| 3021 | + |
---|
| 3022 | +static int patch_i915_tgl_hdmi(struct hda_codec *codec) |
---|
| 3023 | +{ |
---|
| 3024 | + /* |
---|
| 3025 | + * pin to port mapping table where the value indicate the pin number and |
---|
| 3026 | + * the index indicate the port number. |
---|
| 3027 | + */ |
---|
| 3028 | + static const int map[] = {0x4, 0x6, 0x8, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf}; |
---|
| 3029 | + int ret; |
---|
| 3030 | + |
---|
| 3031 | + ret = intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map)); |
---|
| 3032 | + if (!ret) { |
---|
| 3033 | + struct hdmi_spec *spec = codec->spec; |
---|
| 3034 | + |
---|
| 3035 | + spec->dyn_pcm_no_legacy = true; |
---|
| 3036 | + } |
---|
| 3037 | + |
---|
| 3038 | + return ret; |
---|
2686 | 3039 | } |
---|
2687 | 3040 | |
---|
2688 | 3041 | /* Intel Baytrail and Braswell; with eld notifier */ |
---|
.. | .. |
---|
2699 | 3052 | /* For Valleyview/Cherryview, only the display codec is in the display |
---|
2700 | 3053 | * power well and can use link_power ops to request/release the power. |
---|
2701 | 3054 | */ |
---|
2702 | | - codec->core.link_power_control = 1; |
---|
| 3055 | + codec->display_power_control = 1; |
---|
2703 | 3056 | |
---|
2704 | 3057 | codec->depop_delay = 0; |
---|
2705 | 3058 | codec->auto_runtime_pm = 1; |
---|
.. | .. |
---|
2790 | 3143 | if (get_wcaps(codec, pin) & AC_WCAP_OUT_AMP) |
---|
2791 | 3144 | snd_hda_codec_write(codec, pin, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
---|
2792 | 3145 | AMP_OUT_UNMUTE); |
---|
2793 | | - snd_hda_jack_detect_enable(codec, pin); |
---|
| 3146 | + snd_hda_jack_detect_enable(codec, pin, per_pin->dev_id); |
---|
2794 | 3147 | return 0; |
---|
2795 | 3148 | } |
---|
2796 | 3149 | |
---|
.. | .. |
---|
2969 | 3322 | if (!spec) |
---|
2970 | 3323 | return -ENOMEM; |
---|
2971 | 3324 | |
---|
| 3325 | + spec->codec = codec; |
---|
2972 | 3326 | codec->spec = spec; |
---|
2973 | 3327 | hdmi_array_init(spec, 1); |
---|
2974 | 3328 | |
---|
.. | .. |
---|
3180 | 3534 | spec->pcm_playback.rates = SUPPORTED_RATES; |
---|
3181 | 3535 | spec->pcm_playback.maxbps = SUPPORTED_MAXBPS; |
---|
3182 | 3536 | spec->pcm_playback.formats = SUPPORTED_FORMATS; |
---|
| 3537 | + spec->nv_dp_workaround = true; |
---|
3183 | 3538 | return 0; |
---|
3184 | 3539 | } |
---|
3185 | 3540 | |
---|
.. | .. |
---|
3273 | 3628 | return 0; |
---|
3274 | 3629 | } |
---|
3275 | 3630 | |
---|
| 3631 | +/* map from pin NID to port; port is 0-based */ |
---|
| 3632 | +/* for Nvidia: assume widget NID starting from 4, with step 1 (4, 5, 6, ...) */ |
---|
| 3633 | +static int nvhdmi_pin2port(void *audio_ptr, int pin_nid) |
---|
| 3634 | +{ |
---|
| 3635 | + return pin_nid - 4; |
---|
| 3636 | +} |
---|
| 3637 | + |
---|
| 3638 | +/* reverse-map from port to pin NID: see above */ |
---|
| 3639 | +static int nvhdmi_port2pin(struct hda_codec *codec, int port) |
---|
| 3640 | +{ |
---|
| 3641 | + return port + 4; |
---|
| 3642 | +} |
---|
| 3643 | + |
---|
| 3644 | +static const struct drm_audio_component_audio_ops nvhdmi_audio_ops = { |
---|
| 3645 | + .pin2port = nvhdmi_pin2port, |
---|
| 3646 | + .pin_eld_notify = generic_acomp_pin_eld_notify, |
---|
| 3647 | + .master_bind = generic_acomp_master_bind, |
---|
| 3648 | + .master_unbind = generic_acomp_master_unbind, |
---|
| 3649 | +}; |
---|
| 3650 | + |
---|
3276 | 3651 | static int patch_nvhdmi(struct hda_codec *codec) |
---|
| 3652 | +{ |
---|
| 3653 | + struct hdmi_spec *spec; |
---|
| 3654 | + int err; |
---|
| 3655 | + |
---|
| 3656 | + err = alloc_generic_hdmi(codec); |
---|
| 3657 | + if (err < 0) |
---|
| 3658 | + return err; |
---|
| 3659 | + codec->dp_mst = true; |
---|
| 3660 | + |
---|
| 3661 | + spec = codec->spec; |
---|
| 3662 | + spec->dyn_pcm_assign = true; |
---|
| 3663 | + |
---|
| 3664 | + err = hdmi_parse_codec(codec); |
---|
| 3665 | + if (err < 0) { |
---|
| 3666 | + generic_spec_free(codec); |
---|
| 3667 | + return err; |
---|
| 3668 | + } |
---|
| 3669 | + |
---|
| 3670 | + generic_hdmi_init_per_pins(codec); |
---|
| 3671 | + |
---|
| 3672 | + spec->dyn_pin_out = true; |
---|
| 3673 | + |
---|
| 3674 | + spec->chmap.ops.chmap_cea_alloc_validate_get_type = |
---|
| 3675 | + nvhdmi_chmap_cea_alloc_validate_get_type; |
---|
| 3676 | + spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; |
---|
| 3677 | + spec->nv_dp_workaround = true; |
---|
| 3678 | + |
---|
| 3679 | + codec->link_down_at_suspend = 1; |
---|
| 3680 | + |
---|
| 3681 | + generic_acomp_init(codec, &nvhdmi_audio_ops, nvhdmi_port2pin); |
---|
| 3682 | + |
---|
| 3683 | + return 0; |
---|
| 3684 | +} |
---|
| 3685 | + |
---|
| 3686 | +static int patch_nvhdmi_legacy(struct hda_codec *codec) |
---|
3277 | 3687 | { |
---|
3278 | 3688 | struct hdmi_spec *spec; |
---|
3279 | 3689 | int err; |
---|
.. | .. |
---|
3288 | 3698 | spec->chmap.ops.chmap_cea_alloc_validate_get_type = |
---|
3289 | 3699 | nvhdmi_chmap_cea_alloc_validate_get_type; |
---|
3290 | 3700 | spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; |
---|
| 3701 | + spec->nv_dp_workaround = true; |
---|
3291 | 3702 | |
---|
3292 | 3703 | codec->link_down_at_suspend = 1; |
---|
3293 | 3704 | |
---|
.. | .. |
---|
3455 | 3866 | if (err) |
---|
3456 | 3867 | return err; |
---|
3457 | 3868 | |
---|
| 3869 | + codec->depop_delay = 10; |
---|
3458 | 3870 | codec->patch_ops.build_pcms = tegra_hdmi_build_pcms; |
---|
3459 | 3871 | spec = codec->spec; |
---|
3460 | 3872 | spec->chmap.ops.chmap_cea_alloc_validate_get_type = |
---|
3461 | 3873 | nvhdmi_chmap_cea_alloc_validate_get_type; |
---|
3462 | 3874 | spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; |
---|
| 3875 | + spec->nv_dp_workaround = true; |
---|
3463 | 3876 | |
---|
3464 | 3877 | return 0; |
---|
3465 | 3878 | } |
---|
.. | .. |
---|
3512 | 3925 | #define ATI_HBR_ENABLE 0x10 |
---|
3513 | 3926 | |
---|
3514 | 3927 | static int atihdmi_pin_get_eld(struct hda_codec *codec, hda_nid_t nid, |
---|
3515 | | - unsigned char *buf, int *eld_size) |
---|
| 3928 | + int dev_id, unsigned char *buf, int *eld_size) |
---|
3516 | 3929 | { |
---|
| 3930 | + WARN_ON(dev_id != 0); |
---|
3517 | 3931 | /* call hda_eld.c ATI/AMD-specific function */ |
---|
3518 | 3932 | return snd_hdmi_get_eld_ati(codec, nid, buf, eld_size, |
---|
3519 | 3933 | is_amdhdmi_rev3_or_later(codec)); |
---|
3520 | 3934 | } |
---|
3521 | 3935 | |
---|
3522 | | -static void atihdmi_pin_setup_infoframe(struct hda_codec *codec, hda_nid_t pin_nid, int ca, |
---|
| 3936 | +static void atihdmi_pin_setup_infoframe(struct hda_codec *codec, |
---|
| 3937 | + hda_nid_t pin_nid, int dev_id, int ca, |
---|
3523 | 3938 | int active_channels, int conn_type) |
---|
3524 | 3939 | { |
---|
| 3940 | + WARN_ON(dev_id != 0); |
---|
3525 | 3941 | snd_hda_codec_write(codec, pin_nid, 0, ATI_VERB_SET_CHANNEL_ALLOCATION, ca); |
---|
3526 | 3942 | } |
---|
3527 | 3943 | |
---|
.. | .. |
---|
3593 | 4009 | static int atihdmi_pin_set_slot_channel(struct hdac_device *hdac, |
---|
3594 | 4010 | hda_nid_t pin_nid, int hdmi_slot, int stream_channel) |
---|
3595 | 4011 | { |
---|
3596 | | - struct hda_codec *codec = container_of(hdac, struct hda_codec, core); |
---|
| 4012 | + struct hda_codec *codec = hdac_to_hda_codec(hdac); |
---|
3597 | 4013 | int verb; |
---|
3598 | 4014 | int ati_channel_setup = 0; |
---|
3599 | 4015 | |
---|
.. | .. |
---|
3629 | 4045 | static int atihdmi_pin_get_slot_channel(struct hdac_device *hdac, |
---|
3630 | 4046 | hda_nid_t pin_nid, int asp_slot) |
---|
3631 | 4047 | { |
---|
3632 | | - struct hda_codec *codec = container_of(hdac, struct hda_codec, core); |
---|
| 4048 | + struct hda_codec *codec = hdac_to_hda_codec(hdac); |
---|
3633 | 4049 | bool was_odd = false; |
---|
3634 | 4050 | int ati_asp_slot = asp_slot; |
---|
3635 | 4051 | int verb; |
---|
.. | .. |
---|
3712 | 4128 | } |
---|
3713 | 4129 | |
---|
3714 | 4130 | static int atihdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid, |
---|
3715 | | - bool hbr) |
---|
| 4131 | + int dev_id, bool hbr) |
---|
3716 | 4132 | { |
---|
3717 | 4133 | int hbr_ctl, hbr_ctl_new; |
---|
| 4134 | + |
---|
| 4135 | + WARN_ON(dev_id != 0); |
---|
3718 | 4136 | |
---|
3719 | 4137 | hbr_ctl = snd_hda_codec_read(codec, pin_nid, 0, ATI_VERB_GET_HBR_CONTROL, 0); |
---|
3720 | 4138 | if (hbr_ctl >= 0 && (hbr_ctl & ATI_HBR_CAPABLE)) { |
---|
.. | .. |
---|
3741 | 4159 | } |
---|
3742 | 4160 | |
---|
3743 | 4161 | static int atihdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid, |
---|
3744 | | - hda_nid_t pin_nid, u32 stream_tag, int format) |
---|
| 4162 | + hda_nid_t pin_nid, int dev_id, |
---|
| 4163 | + u32 stream_tag, int format) |
---|
3745 | 4164 | { |
---|
3746 | | - |
---|
3747 | 4165 | if (is_amdhdmi_rev3_or_later(codec)) { |
---|
3748 | 4166 | int ramp_rate = 180; /* default as per AMD spec */ |
---|
3749 | 4167 | /* disable ramp-up/down for non-pcm as per AMD spec */ |
---|
.. | .. |
---|
3753 | 4171 | snd_hda_codec_write(codec, cvt_nid, 0, ATI_VERB_SET_RAMP_RATE, ramp_rate); |
---|
3754 | 4172 | } |
---|
3755 | 4173 | |
---|
3756 | | - return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format); |
---|
| 4174 | + return hdmi_setup_stream(codec, cvt_nid, pin_nid, dev_id, |
---|
| 4175 | + stream_tag, format); |
---|
3757 | 4176 | } |
---|
3758 | 4177 | |
---|
3759 | 4178 | |
---|
.. | .. |
---|
3779 | 4198 | ATI_VERB_SET_MULTICHANNEL_MODE, |
---|
3780 | 4199 | ATI_MULTICHANNEL_MODE_SINGLE); |
---|
3781 | 4200 | } |
---|
| 4201 | + codec->auto_runtime_pm = 1; |
---|
3782 | 4202 | |
---|
3783 | 4203 | return 0; |
---|
3784 | 4204 | } |
---|
| 4205 | + |
---|
| 4206 | +/* map from pin NID to port; port is 0-based */ |
---|
| 4207 | +/* for AMD: assume widget NID starting from 3, with step 2 (3, 5, 7, ...) */ |
---|
| 4208 | +static int atihdmi_pin2port(void *audio_ptr, int pin_nid) |
---|
| 4209 | +{ |
---|
| 4210 | + return pin_nid / 2 - 1; |
---|
| 4211 | +} |
---|
| 4212 | + |
---|
| 4213 | +/* reverse-map from port to pin NID: see above */ |
---|
| 4214 | +static int atihdmi_port2pin(struct hda_codec *codec, int port) |
---|
| 4215 | +{ |
---|
| 4216 | + return port * 2 + 3; |
---|
| 4217 | +} |
---|
| 4218 | + |
---|
| 4219 | +static const struct drm_audio_component_audio_ops atihdmi_audio_ops = { |
---|
| 4220 | + .pin2port = atihdmi_pin2port, |
---|
| 4221 | + .pin_eld_notify = generic_acomp_pin_eld_notify, |
---|
| 4222 | + .master_bind = generic_acomp_master_bind, |
---|
| 4223 | + .master_unbind = generic_acomp_master_unbind, |
---|
| 4224 | +}; |
---|
3785 | 4225 | |
---|
3786 | 4226 | static int patch_atihdmi(struct hda_codec *codec) |
---|
3787 | 4227 | { |
---|
.. | .. |
---|
3831 | 4271 | */ |
---|
3832 | 4272 | codec->link_down_at_suspend = 1; |
---|
3833 | 4273 | |
---|
| 4274 | + generic_acomp_init(codec, &atihdmi_audio_ops, atihdmi_port2pin); |
---|
| 4275 | + |
---|
3834 | 4276 | return 0; |
---|
3835 | 4277 | } |
---|
3836 | 4278 | |
---|
.. | .. |
---|
3861 | 4303 | HDA_CODEC_ENTRY(0x10de0005, "MCP77/78 HDMI", patch_nvhdmi_8ch_7x), |
---|
3862 | 4304 | HDA_CODEC_ENTRY(0x10de0006, "MCP77/78 HDMI", patch_nvhdmi_8ch_7x), |
---|
3863 | 4305 | HDA_CODEC_ENTRY(0x10de0007, "MCP79/7A HDMI", patch_nvhdmi_8ch_7x), |
---|
3864 | | -HDA_CODEC_ENTRY(0x10de0008, "GPU 08 HDMI/DP", patch_nvhdmi), |
---|
3865 | | -HDA_CODEC_ENTRY(0x10de0009, "GPU 09 HDMI/DP", patch_nvhdmi), |
---|
3866 | | -HDA_CODEC_ENTRY(0x10de000a, "GPU 0a HDMI/DP", patch_nvhdmi), |
---|
3867 | | -HDA_CODEC_ENTRY(0x10de000b, "GPU 0b HDMI/DP", patch_nvhdmi), |
---|
3868 | | -HDA_CODEC_ENTRY(0x10de000c, "MCP89 HDMI", patch_nvhdmi), |
---|
3869 | | -HDA_CODEC_ENTRY(0x10de000d, "GPU 0d HDMI/DP", patch_nvhdmi), |
---|
3870 | | -HDA_CODEC_ENTRY(0x10de0010, "GPU 10 HDMI/DP", patch_nvhdmi), |
---|
3871 | | -HDA_CODEC_ENTRY(0x10de0011, "GPU 11 HDMI/DP", patch_nvhdmi), |
---|
3872 | | -HDA_CODEC_ENTRY(0x10de0012, "GPU 12 HDMI/DP", patch_nvhdmi), |
---|
3873 | | -HDA_CODEC_ENTRY(0x10de0013, "GPU 13 HDMI/DP", patch_nvhdmi), |
---|
3874 | | -HDA_CODEC_ENTRY(0x10de0014, "GPU 14 HDMI/DP", patch_nvhdmi), |
---|
3875 | | -HDA_CODEC_ENTRY(0x10de0015, "GPU 15 HDMI/DP", patch_nvhdmi), |
---|
3876 | | -HDA_CODEC_ENTRY(0x10de0016, "GPU 16 HDMI/DP", patch_nvhdmi), |
---|
| 4306 | +HDA_CODEC_ENTRY(0x10de0008, "GPU 08 HDMI/DP", patch_nvhdmi_legacy), |
---|
| 4307 | +HDA_CODEC_ENTRY(0x10de0009, "GPU 09 HDMI/DP", patch_nvhdmi_legacy), |
---|
| 4308 | +HDA_CODEC_ENTRY(0x10de000a, "GPU 0a HDMI/DP", patch_nvhdmi_legacy), |
---|
| 4309 | +HDA_CODEC_ENTRY(0x10de000b, "GPU 0b HDMI/DP", patch_nvhdmi_legacy), |
---|
| 4310 | +HDA_CODEC_ENTRY(0x10de000c, "MCP89 HDMI", patch_nvhdmi_legacy), |
---|
| 4311 | +HDA_CODEC_ENTRY(0x10de000d, "GPU 0d HDMI/DP", patch_nvhdmi_legacy), |
---|
| 4312 | +HDA_CODEC_ENTRY(0x10de0010, "GPU 10 HDMI/DP", patch_nvhdmi_legacy), |
---|
| 4313 | +HDA_CODEC_ENTRY(0x10de0011, "GPU 11 HDMI/DP", patch_nvhdmi_legacy), |
---|
| 4314 | +HDA_CODEC_ENTRY(0x10de0012, "GPU 12 HDMI/DP", patch_nvhdmi_legacy), |
---|
| 4315 | +HDA_CODEC_ENTRY(0x10de0013, "GPU 13 HDMI/DP", patch_nvhdmi_legacy), |
---|
| 4316 | +HDA_CODEC_ENTRY(0x10de0014, "GPU 14 HDMI/DP", patch_nvhdmi_legacy), |
---|
| 4317 | +HDA_CODEC_ENTRY(0x10de0015, "GPU 15 HDMI/DP", patch_nvhdmi_legacy), |
---|
| 4318 | +HDA_CODEC_ENTRY(0x10de0016, "GPU 16 HDMI/DP", patch_nvhdmi_legacy), |
---|
3877 | 4319 | /* 17 is known to be absent */ |
---|
3878 | | -HDA_CODEC_ENTRY(0x10de0018, "GPU 18 HDMI/DP", patch_nvhdmi), |
---|
3879 | | -HDA_CODEC_ENTRY(0x10de0019, "GPU 19 HDMI/DP", patch_nvhdmi), |
---|
3880 | | -HDA_CODEC_ENTRY(0x10de001a, "GPU 1a HDMI/DP", patch_nvhdmi), |
---|
3881 | | -HDA_CODEC_ENTRY(0x10de001b, "GPU 1b HDMI/DP", patch_nvhdmi), |
---|
3882 | | -HDA_CODEC_ENTRY(0x10de001c, "GPU 1c HDMI/DP", patch_nvhdmi), |
---|
| 4320 | +HDA_CODEC_ENTRY(0x10de0018, "GPU 18 HDMI/DP", patch_nvhdmi_legacy), |
---|
| 4321 | +HDA_CODEC_ENTRY(0x10de0019, "GPU 19 HDMI/DP", patch_nvhdmi_legacy), |
---|
| 4322 | +HDA_CODEC_ENTRY(0x10de001a, "GPU 1a HDMI/DP", patch_nvhdmi_legacy), |
---|
| 4323 | +HDA_CODEC_ENTRY(0x10de001b, "GPU 1b HDMI/DP", patch_nvhdmi_legacy), |
---|
| 4324 | +HDA_CODEC_ENTRY(0x10de001c, "GPU 1c HDMI/DP", patch_nvhdmi_legacy), |
---|
3883 | 4325 | HDA_CODEC_ENTRY(0x10de0020, "Tegra30 HDMI", patch_tegra_hdmi), |
---|
3884 | 4326 | HDA_CODEC_ENTRY(0x10de0022, "Tegra114 HDMI", patch_tegra_hdmi), |
---|
3885 | 4327 | HDA_CODEC_ENTRY(0x10de0028, "Tegra124 HDMI", patch_tegra_hdmi), |
---|
3886 | 4328 | HDA_CODEC_ENTRY(0x10de0029, "Tegra210 HDMI/DP", patch_tegra_hdmi), |
---|
| 4329 | +HDA_CODEC_ENTRY(0x10de002d, "Tegra186 HDMI/DP0", patch_tegra_hdmi), |
---|
| 4330 | +HDA_CODEC_ENTRY(0x10de002e, "Tegra186 HDMI/DP1", patch_tegra_hdmi), |
---|
| 4331 | +HDA_CODEC_ENTRY(0x10de002f, "Tegra194 HDMI/DP2", patch_tegra_hdmi), |
---|
| 4332 | +HDA_CODEC_ENTRY(0x10de0030, "Tegra194 HDMI/DP3", patch_tegra_hdmi), |
---|
3887 | 4333 | HDA_CODEC_ENTRY(0x10de0040, "GPU 40 HDMI/DP", patch_nvhdmi), |
---|
3888 | 4334 | HDA_CODEC_ENTRY(0x10de0041, "GPU 41 HDMI/DP", patch_nvhdmi), |
---|
3889 | 4335 | HDA_CODEC_ENTRY(0x10de0042, "GPU 42 HDMI/DP", patch_nvhdmi), |
---|
.. | .. |
---|
3933 | 4379 | HDA_CODEC_ENTRY(0x11069f84, "VX11 HDMI/DP", patch_generic_hdmi), |
---|
3934 | 4380 | HDA_CODEC_ENTRY(0x11069f85, "VX11 HDMI/DP", patch_generic_hdmi), |
---|
3935 | 4381 | HDA_CODEC_ENTRY(0x80860054, "IbexPeak HDMI", patch_i915_cpt_hdmi), |
---|
| 4382 | +HDA_CODEC_ENTRY(0x80862800, "Geminilake HDMI", patch_i915_glk_hdmi), |
---|
3936 | 4383 | HDA_CODEC_ENTRY(0x80862801, "Bearlake HDMI", patch_generic_hdmi), |
---|
3937 | 4384 | HDA_CODEC_ENTRY(0x80862802, "Cantiga HDMI", patch_generic_hdmi), |
---|
3938 | 4385 | HDA_CODEC_ENTRY(0x80862803, "Eaglelake HDMI", patch_generic_hdmi), |
---|
.. | .. |
---|
3946 | 4393 | HDA_CODEC_ENTRY(0x8086280b, "Kabylake HDMI", patch_i915_hsw_hdmi), |
---|
3947 | 4394 | HDA_CODEC_ENTRY(0x8086280c, "Cannonlake HDMI", patch_i915_glk_hdmi), |
---|
3948 | 4395 | HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi), |
---|
3949 | | -HDA_CODEC_ENTRY(0x80862800, "Geminilake HDMI", patch_i915_glk_hdmi), |
---|
| 4396 | +HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi), |
---|
| 4397 | +HDA_CODEC_ENTRY(0x80862812, "Tigerlake HDMI", patch_i915_tgl_hdmi), |
---|
| 4398 | +HDA_CODEC_ENTRY(0x80862814, "DG1 HDMI", patch_i915_tgl_hdmi), |
---|
| 4399 | +HDA_CODEC_ENTRY(0x80862815, "Alderlake HDMI", patch_i915_tgl_hdmi), |
---|
| 4400 | +HDA_CODEC_ENTRY(0x80862816, "Rocketlake HDMI", patch_i915_tgl_hdmi), |
---|
| 4401 | +HDA_CODEC_ENTRY(0x80862819, "DG2 HDMI", patch_i915_tgl_hdmi), |
---|
| 4402 | +HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI", patch_i915_icl_hdmi), |
---|
| 4403 | +HDA_CODEC_ENTRY(0x8086281b, "Elkhartlake HDMI", patch_i915_icl_hdmi), |
---|
| 4404 | +HDA_CODEC_ENTRY(0x8086281c, "Alderlake-P HDMI", patch_i915_tgl_hdmi), |
---|
3950 | 4405 | HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi), |
---|
3951 | 4406 | HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi), |
---|
3952 | 4407 | HDA_CODEC_ENTRY(0x80862883, "Braswell HDMI", patch_i915_byt_hdmi), |
---|