Commit fb87fa3a authored by Mengdong Lin's avatar Mengdong Lin Committed by Takashi Iwai

ALSA: hda - define is_haswell() to check if a display audio codec is Haswell

To apply Haswell specific fixings, this patch defines is_haswell() to check
whether a display audio codec is Haswell, to avoid explicitly checking Haswell
vendor ID everywhere.
Signed-off-by: default avatarMengdong Lin <mengdong.lin@intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 7bba2157
...@@ -44,6 +44,8 @@ static bool static_hdmi_pcm; ...@@ -44,6 +44,8 @@ static bool static_hdmi_pcm;
module_param(static_hdmi_pcm, bool, 0644); module_param(static_hdmi_pcm, bool, 0644);
MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info"); MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info");
#define is_haswell(codec) ((codec)->vendor_id == 0x80862807)
struct hdmi_spec_per_cvt { struct hdmi_spec_per_cvt {
hda_nid_t cvt_nid; hda_nid_t cvt_nid;
int assigned; int assigned;
...@@ -1087,7 +1089,7 @@ static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid, ...@@ -1087,7 +1089,7 @@ static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
int pinctl; int pinctl;
int new_pinctl = 0; int new_pinctl = 0;
if (codec->vendor_id == 0x80862807) if (is_haswell(codec))
haswell_verify_pin_D0(codec, cvt_nid, pin_nid); haswell_verify_pin_D0(codec, cvt_nid, pin_nid);
if (snd_hda_query_pin_caps(codec, pin_nid) & AC_PINCAP_HBR) { if (snd_hda_query_pin_caps(codec, pin_nid) & AC_PINCAP_HBR) {
...@@ -1227,7 +1229,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, ...@@ -1227,7 +1229,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
mux_idx); mux_idx);
/* configure unused pins to choose other converters */ /* configure unused pins to choose other converters */
if (codec->vendor_id == 0x80862807) if (is_haswell(codec))
haswell_config_cvts(codec, pin_idx, mux_idx); haswell_config_cvts(codec, pin_idx, mux_idx);
snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid); snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid);
...@@ -1358,7 +1360,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) ...@@ -1358,7 +1360,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
/* Haswell-specific workaround: re-setup when the transcoder is /* Haswell-specific workaround: re-setup when the transcoder is
* changed during the stream playback * changed during the stream playback
*/ */
if (codec->vendor_id == 0x80862807 && if (is_haswell(codec) &&
eld->eld_valid && !old_eld_valid && per_pin->setup) { eld->eld_valid && !old_eld_valid && per_pin->setup) {
snd_hda_codec_write(codec, pin_nid, 0, snd_hda_codec_write(codec, pin_nid, 0,
AC_VERB_SET_AMP_GAIN_MUTE, AC_VERB_SET_AMP_GAIN_MUTE,
...@@ -1405,7 +1407,7 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) ...@@ -1405,7 +1407,7 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
if (get_defcfg_connect(config) == AC_JACK_PORT_NONE) if (get_defcfg_connect(config) == AC_JACK_PORT_NONE)
return 0; return 0;
if (codec->vendor_id == 0x80862807) if (is_haswell(codec))
intel_haswell_fixup_connect_list(codec, pin_nid); intel_haswell_fixup_connect_list(codec, pin_nid);
pin_idx = spec->num_pins; pin_idx = spec->num_pins;
...@@ -2011,7 +2013,7 @@ static int patch_generic_hdmi(struct hda_codec *codec) ...@@ -2011,7 +2013,7 @@ static int patch_generic_hdmi(struct hda_codec *codec)
codec->spec = spec; codec->spec = spec;
hdmi_array_init(spec, 4); hdmi_array_init(spec, 4);
if (codec->vendor_id == 0x80862807) { if (is_haswell(codec)) {
intel_haswell_enable_all_pins(codec, true); intel_haswell_enable_all_pins(codec, true);
intel_haswell_fixup_enable_dp12(codec); intel_haswell_fixup_enable_dp12(codec);
} }
...@@ -2022,7 +2024,7 @@ static int patch_generic_hdmi(struct hda_codec *codec) ...@@ -2022,7 +2024,7 @@ static int patch_generic_hdmi(struct hda_codec *codec)
return -EINVAL; return -EINVAL;
} }
codec->patch_ops = generic_hdmi_patch_ops; codec->patch_ops = generic_hdmi_patch_ops;
if (codec->vendor_id == 0x80862807) { if (is_haswell(codec)) {
codec->patch_ops.set_power_state = haswell_set_power_state; codec->patch_ops.set_power_state = haswell_set_power_state;
codec->dp_mst = true; codec->dp_mst = true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment