drm/i915: Fix audio component initialization
authorjsg <jsg@openbsd.org>
Mon, 24 Jun 2024 03:57:38 +0000 (03:57 +0000)
committerjsg <jsg@openbsd.org>
Mon, 24 Jun 2024 03:57:38 +0000 (03:57 +0000)
From Imre Deak
f287b1e34f1dd910723ca720300548c27a9a72d7 in linux-6.6.y/6.6.35
75800e2e4203ea83bbc9d4f63ad97ea582244a08 in mainline linux

sys/dev/pci/drm/i915/display/intel_audio.c
sys/dev/pci/drm/i915/display/intel_audio.h
sys/dev/pci/drm/i915/display/intel_display_driver.c

index 294acf8..7e75b38 100644 (file)
@@ -1256,17 +1256,6 @@ static void i915_audio_component_init(struct drm_i915_private *i915)
 {
 #ifdef notyet
        u32 aud_freq, aud_freq_init;
-       int ret;
-
-       ret = component_add_typed(i915->drm.dev,
-                                 &i915_audio_component_bind_ops,
-                                 I915_COMPONENT_AUDIO);
-       if (ret < 0) {
-               drm_err(&i915->drm,
-                       "failed to add audio component (%d)\n", ret);
-               /* continue with reduced functionality */
-               return;
-       }
 
        if (DISPLAY_VER(i915) >= 9) {
                aud_freq_init = intel_de_read(i915, AUD_FREQ_CNTRL);
@@ -1289,6 +1278,23 @@ static void i915_audio_component_init(struct drm_i915_private *i915)
 
        /* init with current cdclk */
        intel_audio_cdclk_change_post(i915);
+#endif
+}
+
+static void i915_audio_component_register(struct drm_i915_private *i915)
+{
+#ifdef notyet
+       int ret;
+
+       ret = component_add_typed(i915->drm.dev,
+                                 &i915_audio_component_bind_ops,
+                                 I915_COMPONENT_AUDIO);
+       if (ret < 0) {
+               drm_err(&i915->drm,
+                       "failed to add audio component (%d)\n", ret);
+               /* continue with reduced functionality */
+               return;
+       }
 
        i915->display.audio.component_registered = true;
 #endif
@@ -1322,6 +1328,12 @@ void intel_audio_init(struct drm_i915_private *i915)
                i915_audio_component_init(i915);
 }
 
+void intel_audio_register(struct drm_i915_private *i915)
+{
+       if (!i915->display.audio.lpe.platdev)
+               i915_audio_component_register(i915);
+}
+
 /**
  * intel_audio_deinit() - deinitialize the audio driver
  * @i915: the i915 drm device private data
index 9bb9a19..289e744 100644 (file)
@@ -30,6 +30,7 @@ void intel_audio_codec_get_config(struct intel_encoder *encoder,
 void intel_audio_cdclk_change_pre(struct drm_i915_private *dev_priv);
 void intel_audio_cdclk_change_post(struct drm_i915_private *dev_priv);
 void intel_audio_init(struct drm_i915_private *dev_priv);
+void intel_audio_register(struct drm_i915_private *i915);
 void intel_audio_deinit(struct drm_i915_private *dev_priv);
 void intel_audio_sdp_split_update(struct intel_encoder *encoder,
                                  const struct intel_crtc_state *crtc_state);
index 69b5cef..4b71b39 100644 (file)
@@ -388,6 +388,8 @@ void intel_display_driver_register(struct drm_i915_private *i915)
 
        intel_audio_init(i915);
 
+       intel_audio_register(i915);
+
        intel_display_debugfs_register(i915);
 
        /*