[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87cyecc6ks.fsf@intel.com>
Date: Thu, 20 Mar 2025 12:57:55 +0200
From: Jani Nikula <jani.nikula@...ux.intel.com>
To: Lu Yao <yaolu@...inos.cn>, rodrigo.vivi@...el.com,
joonas.lahtinen@...ux.intel.com, tursulin@...ulin.net
Cc: intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, Lu Yao <yaolu@...inos.cn>
Subject: Re: [PATCH] drm/i915/display: add audio dis/enable when connector
hotplug
On Tue, 18 Mar 2025, Lu Yao <yaolu@...inos.cn> wrote:
> Now audio enable/disable depends on an atomic commit, it doesn't make
> sence. For wayland, there will trigering an atomic commit, so it
> works well. But for Xorg using modesetting, there won't. In this
> case, unplug the HDMI/DP and the audio jack event is not triggered,
> resulting in still having a HDMI/DP audio output choice.
As it is, the implementation is not acceptable, but with this
description I also don't understand the problem.
Please file a bug at [1], attach dmesg from boot exhibiting the problem.
BR,
Jani.
[1] https://drm.pages.freedesktop.org/intel-docs/how-to-file-i915-bugs.html
> Signed-off-by: Lu Yao <yaolu@...inos.cn>
> ---
> drivers/gpu/drm/i915/display/intel_hotplug.c | 31 ++++++++++++++++++++
> 1 file changed, 31 insertions(+)
> ---
> Test hardware:
> CPU: i5-12500
> GPU: UHD Graphics 770
>
>
> diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c b/drivers/gpu/drm/i915/display/intel_hotplug.c
> index 3adc791d3776..332d6e1a99cd 100644
> --- a/drivers/gpu/drm/i915/display/intel_hotplug.c
> +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
> @@ -32,6 +32,7 @@
> #include "intel_display_types.h"
> #include "intel_hotplug.h"
> #include "intel_hotplug_irq.h"
> +#include "intel_audio.h"
>
> /**
> * DOC: Hotplug
> @@ -415,6 +416,35 @@ void intel_hpd_trigger_irq(struct intel_digital_port *dig_port)
> queue_work(i915->display.hotplug.dp_wq, &i915->display.hotplug.dig_port_work);
> }
>
> +/*
> + * when connector hotplug state changed, audio need changed too.
> + */
> +static void i915_audio_hotplug(struct intel_connector *connector)
> +{
> + struct drm_crtc *crtc;
> + struct drm_device *dev = connector->base.dev;
> +
> + drm_for_each_crtc(crtc, dev) {
> + if (connector->base.state->crtc == crtc) {
> + struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> + struct intel_crtc_state *pipe_config =
> + to_intel_crtc_state(intel_crtc->base.state);
> + struct intel_encoder *encoder =
> + intel_attached_encoder(connector);
> +
> + if (pipe_config && pipe_config->has_audio) {
> + if (connector->base.status == connector_status_disconnected)
> + intel_audio_codec_disable(encoder, pipe_config,
> + connector->base.state);
> + else if (connector->base.status == connector_status_connected)
> + intel_audio_codec_enable(encoder, pipe_config,
> + connector->base.state);
> + }
> + break;
> + }
> + }
> +}
> +
> /*
> * Handle hotplug events outside the interrupt handler proper.
> */
> @@ -487,6 +517,7 @@ static void i915_hotplug_work_func(struct work_struct *work)
> drm_connector_get(&connector->base);
> first_changed_connector = &connector->base;
> }
> + i915_audio_hotplug(connector);
> break;
> case INTEL_HOTPLUG_RETRY:
> retry |= hpd_bit;
--
Jani Nikula, Intel
Powered by blists - more mailing lists