drm/i915/audio: Clean up the PCH type checks
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 24 Jan 2023 14:46:28 +0000 (16:46 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 25 Jan 2023 10:23:48 +0000 (12:23 +0200)
Use explicit PCH type checks to make it more clear
which platforms use which codepaths.

Also reorder the branches in ibx_audio_regs_init()
a bit to be more in chronological order.

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124144628.4649-14-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/display/intel_audio.c

index 99a3ed8..a9335c8 100644 (file)
@@ -666,21 +666,21 @@ static void ibx_audio_regs_init(struct drm_i915_private *i915,
                                enum pipe pipe,
                                struct ibx_audio_regs *regs)
 {
-       if (HAS_PCH_IBX(i915)) {
-               regs->hdmiw_hdmiedid = IBX_HDMIW_HDMIEDID(pipe);
-               regs->aud_config = IBX_AUD_CFG(pipe);
-               regs->aud_cntl_st = IBX_AUD_CNTL_ST(pipe);
-               regs->aud_cntrl_st2 = IBX_AUD_CNTL_ST2;
-       } else if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915)) {
+       if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915)) {
                regs->hdmiw_hdmiedid = VLV_HDMIW_HDMIEDID(pipe);
                regs->aud_config = VLV_AUD_CFG(pipe);
                regs->aud_cntl_st = VLV_AUD_CNTL_ST(pipe);
                regs->aud_cntrl_st2 = VLV_AUD_CNTL_ST2;
-       } else {
+       } else if (HAS_PCH_CPT(i915)) {
                regs->hdmiw_hdmiedid = CPT_HDMIW_HDMIEDID(pipe);
                regs->aud_config = CPT_AUD_CFG(pipe);
                regs->aud_cntl_st = CPT_AUD_CNTL_ST(pipe);
                regs->aud_cntrl_st2 = CPT_AUD_CNTRL_ST2;
+       } else if (HAS_PCH_IBX(i915)) {
+               regs->hdmiw_hdmiedid = IBX_HDMIW_HDMIEDID(pipe);
+               regs->aud_config = IBX_AUD_CFG(pipe);
+               regs->aud_cntl_st = IBX_AUD_CNTL_ST(pipe);
+               regs->aud_cntrl_st2 = IBX_AUD_CNTL_ST2;
        }
 }
 
@@ -965,12 +965,11 @@ void intel_audio_hooks_init(struct drm_i915_private *i915)
 {
        if (IS_G4X(i915))
                i915->display.funcs.audio = &g4x_audio_funcs;
-       else if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
+       else if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915) ||
+                HAS_PCH_CPT(i915) || HAS_PCH_IBX(i915))
                i915->display.funcs.audio = &ibx_audio_funcs;
        else if (IS_HASWELL(i915) || DISPLAY_VER(i915) >= 8)
                i915->display.funcs.audio = &hsw_audio_funcs;
-       else if (HAS_PCH_SPLIT(i915))
-               i915->display.funcs.audio = &ibx_audio_funcs;
 }
 
 struct aud_ts_cdclk_m_n {