From: Maxime Ripard <mripard@kernel.org>
To: Stefan Wahren <wahrenst@gmx.net>
Cc: "Dave Stevenson" <dave.stevenson@raspberrypi.com>,
"Maíra Canal" <mcanal@igalia.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
"David Turner" <david.turner@raspberrypi.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
dri-devel@lists.freedesktop.org, kernel-list@raspberrypi.com,
linux-sound@vger.kernel.org
Subject: Re: [PATCH V2 2/2] drm/vc4: hdmi: Add jack detection to HDMI audio driver
Date: Thu, 6 Mar 2025 14:39:39 +0100 [thread overview]
Message-ID: <20250306-delectable-quixotic-polecat-ecd2c3@houat> (raw)
In-Reply-To: <20250304193912.5696-3-wahrenst@gmx.net>
[-- Attachment #1: Type: text/plain, Size: 2989 bytes --]
Hi,
On Tue, Mar 04, 2025 at 08:39:12PM +0100, Stefan Wahren wrote:
> From: David Turner <david.turner@raspberrypi.com>
>
> Add ALSA jack detection to the vc4-hdmi audio driver so userspace knows
> when to add/remove HDMI audio devices.
>
> Signed-off-by: David Turner <david.turner@raspberrypi.com>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---
> drivers/gpu/drm/vc4/vc4_hdmi.c | 18 ++++++++++++++++++
> drivers/gpu/drm/vc4/vc4_hdmi.h | 7 +++++++
> 2 files changed, 25 insertions(+)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> index e4b027616d04..f46a135568b2 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -51,6 +51,7 @@
> #include <linux/reset.h>
> #include <sound/dmaengine_pcm.h>
> #include <sound/hdmi-codec.h>
> +#include <sound/jack.h>
> #include <sound/pcm_drm_eld.h>
> #include <sound/pcm_params.h>
> #include <sound/soc.h>
> @@ -2203,6 +2204,22 @@ static const struct drm_connector_hdmi_audio_funcs vc4_hdmi_audio_funcs = {
> .shutdown = vc4_hdmi_audio_shutdown,
> };
>
> +static int vc4_hdmi_codec_init(struct snd_soc_pcm_runtime *rtd)
> +{
> + struct vc4_hdmi *vc4_hdmi = snd_soc_card_get_drvdata(rtd->card);
> + struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component;
> + int ret;
> +
> + ret = snd_soc_card_jack_new(rtd->card, "HDMI Jack", SND_JACK_LINEOUT,
> + &vc4_hdmi->hdmi_jack);
> + if (ret) {
> + dev_err(rtd->dev, "HDMI Jack creation failed: %d\n", ret);
> + return ret;
> + }
> +
> + return snd_soc_component_set_jack(component, &vc4_hdmi->hdmi_jack, NULL);
> +}
> +
> static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi)
> {
> const struct vc4_hdmi_register *mai_data =
> @@ -2316,6 +2333,7 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi)
> dai_link->cpus->dai_name = dev_name(dev);
> dai_link->codecs->name = dev_name(&vc4_hdmi->connector.hdmi_audio.codec_pdev->dev);
> dai_link->platforms->name = dev_name(dev);
> + dai_link->init = vc4_hdmi_codec_init;
>
> card->dai_link = dai_link;
> card->num_links = 1;
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h
> index e3d989ca302b..a31157c99bee 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.h
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
> @@ -4,6 +4,7 @@
> #include <drm/drm_connector.h>
> #include <media/cec.h>
> #include <sound/dmaengine_pcm.h>
> +#include <sound/hdmi-codec.h>
> #include <sound/soc.h>
>
> #include "vc4_drv.h"
> @@ -211,6 +212,12 @@ struct vc4_hdmi {
> * KMS hooks. Protected by @mutex.
> */
> enum hdmi_colorspace output_format;
> +
> + /**
> + * @hdmi_jack: Represents the connection state of the HDMI plug, for
> + * ALSA jack detection.
> + */
> + struct snd_soc_jack hdmi_jack;
> };
It looks fairly generic to me. Is there any reason you didn't put it in
the HDMI audio helpers?
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
next prev parent reply other threads:[~2025-03-06 13:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-04 19:39 [PATCH V2 0/2] drm/vc4: hdmi: Add jack detection to HDMI audio driver Stefan Wahren
2025-03-04 19:39 ` [PATCH V2 1/2] drm/vc4: hdmi: Call HDMI hotplug helper on disconnect Stefan Wahren
2025-03-06 13:38 ` Maxime Ripard
2025-03-04 19:39 ` [PATCH V2 2/2] drm/vc4: hdmi: Add jack detection to HDMI audio driver Stefan Wahren
2025-03-06 13:39 ` Maxime Ripard [this message]
2025-03-06 15:47 ` David Turner
2025-03-10 13:51 ` Maxime Ripard
2025-03-06 16:25 ` Dmitry Baryshkov
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=20250306-delectable-quixotic-polecat-ecd2c3@houat \
--to=mripard@kernel.org \
--cc=airlied@gmail.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=david.turner@raspberrypi.com \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-list@raspberrypi.com \
--cc=linux-sound@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mcanal@igalia.com \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
--cc=wahrenst@gmx.net \
/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