From: jsg Date: Mon, 24 Jun 2024 03:57:38 +0000 (+0000) Subject: drm/i915: Fix audio component initialization X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f6d48bfef753f50ff588f15b25ad7fce03be0434;p=openbsd drm/i915: Fix audio component initialization From Imre Deak f287b1e34f1dd910723ca720300548c27a9a72d7 in linux-6.6.y/6.6.35 75800e2e4203ea83bbc9d4f63ad97ea582244a08 in mainline linux --- diff --git a/sys/dev/pci/drm/i915/display/intel_audio.c b/sys/dev/pci/drm/i915/display/intel_audio.c index 294acf81213..7e75b38670a 100644 --- a/sys/dev/pci/drm/i915/display/intel_audio.c +++ b/sys/dev/pci/drm/i915/display/intel_audio.c @@ -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 diff --git a/sys/dev/pci/drm/i915/display/intel_audio.h b/sys/dev/pci/drm/i915/display/intel_audio.h index 9bb9a19a4d5..289e74447bf 100644 --- a/sys/dev/pci/drm/i915/display/intel_audio.h +++ b/sys/dev/pci/drm/i915/display/intel_audio.h @@ -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); diff --git a/sys/dev/pci/drm/i915/display/intel_display_driver.c b/sys/dev/pci/drm/i915/display/intel_display_driver.c index 69b5cef7060..4b71b395dd0 100644 --- a/sys/dev/pci/drm/i915/display/intel_display_driver.c +++ b/sys/dev/pci/drm/i915/display/intel_display_driver.c @@ -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); /*