From: Jani Nikula <jani.nikula@linux.intel.com>
To: Lu Yao <yaolu@kylinos.cn>,
rodrigo.vivi@intel.com, joonas.lahtinen@linux.intel.com,
tursulin@ursulin.net
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, Lu Yao <yaolu@kylinos.cn>
Subject: Re: [PATCH] drm/i915/display: add audio dis/enable when connector hotplug
Date: Thu, 20 Mar 2025 12:57:55 +0200 [thread overview]
Message-ID: <87cyecc6ks.fsf@intel.com> (raw)
In-Reply-To: <20250318070435.347383-1-yaolu@kylinos.cn>
On Tue, 18 Mar 2025, Lu Yao <yaolu@kylinos.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@kylinos.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
prev parent reply other threads:[~2025-03-20 10:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 7:04 [PATCH] drm/i915/display: add audio dis/enable when connector hotplug Lu Yao
2025-03-20 10:57 ` Jani Nikula [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87cyecc6ks.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=tursulin@ursulin.net \
--cc=yaolu@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox