ALSA: hda/hdmi - Clean up Intel platform-specific fixup checks
diff mbox series

Message ID 20191111190937.19186-1-tiwai@suse.de
State New
Headers show
Series
  • ALSA: hda/hdmi - Clean up Intel platform-specific fixup checks
Related show

Commit Message

Takashi Iwai Nov. 11, 2019, 7:09 p.m. UTC
Introduce a new flag in hdmi_spec to indicate the Intel platform-
specific fixups so that we can get rid of the lengthy codec ID
checks.  The flag is set in intel_hsw_common_init() commonly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_hdmi.c | 27 +++++----------------------
 1 file changed, 5 insertions(+), 22 deletions(-)

Comments

Kai Vehmanen Nov. 14, 2019, 2:38 p.m. UTC | #1
Hi Takashi,

On Mon, 11 Nov 2019, Takashi Iwai wrote:

> Introduce a new flag in hdmi_spec to indicate the Intel platform-
> specific fixups so that we can get rid of the lengthy codec ID
> checks.  The flag is set in intel_hsw_common_init() commonly.

looks good and a really welcome change. No issues found in testing:

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>

Br, Kai
Takashi Iwai Nov. 14, 2019, 2:57 p.m. UTC | #2
On Thu, 14 Nov 2019 15:38:38 +0100,
Kai Vehmanen wrote:
> 
> Hi Takashi,
> 
> On Mon, 11 Nov 2019, Takashi Iwai wrote:
> 
> > Introduce a new flag in hdmi_spec to indicate the Intel platform-
> > specific fixups so that we can get rid of the lengthy codec ID
> > checks.  The flag is set in intel_hsw_common_init() commonly.
> 
> looks good and a really welcome change. No issues found in testing:
> 
> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>

OK, now queued.  Thanks for checking!


Takashi

Patch
diff mbox series

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 78bd2e3722c7..d05529a429a5 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -37,25 +37,6 @@  static bool static_hdmi_pcm;
 module_param(static_hdmi_pcm, bool, 0644);
 MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info");
 
-#define is_haswell(codec)  ((codec)->core.vendor_id == 0x80862807)
-#define is_broadwell(codec)    ((codec)->core.vendor_id == 0x80862808)
-#define is_skylake(codec) ((codec)->core.vendor_id == 0x80862809)
-#define is_broxton(codec) ((codec)->core.vendor_id == 0x8086280a)
-#define is_kabylake(codec) ((codec)->core.vendor_id == 0x8086280b)
-#define is_geminilake(codec) (((codec)->core.vendor_id == 0x8086280d) || \
-				((codec)->core.vendor_id == 0x80862800))
-#define is_cannonlake(codec) ((codec)->core.vendor_id == 0x8086280c)
-#define is_icelake(codec) ((codec)->core.vendor_id == 0x8086280f)
-#define is_tigerlake(codec) ((codec)->core.vendor_id == 0x80862812)
-#define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec) \
-				|| is_skylake(codec) || is_broxton(codec) \
-				|| is_kabylake(codec) || is_geminilake(codec) \
-				|| is_cannonlake(codec) || is_icelake(codec) \
-				|| is_tigerlake(codec))
-#define is_valleyview(codec) ((codec)->core.vendor_id == 0x80862882)
-#define is_cherryview(codec) ((codec)->core.vendor_id == 0x80862883)
-#define is_valleyview_plus(codec) (is_valleyview(codec) || is_cherryview(codec))
-
 struct hdmi_spec_per_cvt {
 	hda_nid_t cvt_nid;
 	int assigned;
@@ -162,6 +143,7 @@  struct hdmi_spec {
 
 	bool dyn_pin_out;
 	bool dyn_pcm_assign;
+	bool intel_hsw_fixup;	/* apply Intel platform-specific fixups */
 	/*
 	 * Non-generic VIA/NVIDIA specific
 	 */
@@ -925,7 +907,7 @@  static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
 		return err;
 	}
 
-	if (is_haswell_plus(codec)) {
+	if (spec->intel_hsw_fixup) {
 
 		/*
 		 * on recent platforms IEC Coding Type is required for HBR
@@ -1709,7 +1691,7 @@  static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
 	 * To simplify the implementation, malloc all
 	 * the virtual pins in the initialization statically
 	 */
-	if (is_haswell_plus(codec)) {
+	if (spec->intel_hsw_fixup) {
 		/*
 		 * On Intel platforms, device entries number is
 		 * changed dynamically. If there is a DP MST
@@ -1758,7 +1740,7 @@  static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
 		per_pin->dev_id = i;
 		per_pin->non_pcm = false;
 		snd_hda_set_dev_select(codec, pin_nid, i);
-		if (is_haswell_plus(codec))
+		if (spec->intel_hsw_fixup)
 			intel_haswell_fixup_connect_list(codec, pin_nid);
 		err = hdmi_read_pin_conn(codec, pin_idx);
 		if (err < 0)
@@ -2816,6 +2798,7 @@  static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid,
 	spec->vendor_nid = vendor_nid;
 	spec->port_map = port_map;
 	spec->port_num = port_num;
+	spec->intel_hsw_fixup = true;
 
 	intel_haswell_enable_all_pins(codec, true);
 	intel_haswell_fixup_enable_dp12(codec);