Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/vc4: hdmi: Add jack detection to HDMI audio driver

Add ALSA jack detection to the vc4-hdmi audio driver so userspace knows
when to add/remove HDMI audio devices.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: David Turner <david.turner@raspberrypi.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250317-vc4_hotplug-v4-3-2af625629186@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

authored by

David Turner and committed by
Dave Stevenson
2f9d5174 34f051ac

+25
+18
drivers/gpu/drm/vc4/vc4_hdmi.c
··· 51 51 #include <linux/reset.h> 52 52 #include <sound/dmaengine_pcm.h> 53 53 #include <sound/hdmi-codec.h> 54 + #include <sound/jack.h> 54 55 #include <sound/pcm_drm_eld.h> 55 56 #include <sound/pcm_params.h> 56 57 #include <sound/soc.h> ··· 2176 2175 .shutdown = vc4_hdmi_audio_shutdown, 2177 2176 }; 2178 2177 2178 + static int vc4_hdmi_codec_init(struct snd_soc_pcm_runtime *rtd) 2179 + { 2180 + struct vc4_hdmi *vc4_hdmi = snd_soc_card_get_drvdata(rtd->card); 2181 + struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component; 2182 + int ret; 2183 + 2184 + ret = snd_soc_card_jack_new(rtd->card, "HDMI Jack", SND_JACK_LINEOUT, 2185 + &vc4_hdmi->hdmi_jack); 2186 + if (ret) { 2187 + dev_err(rtd->dev, "HDMI Jack creation failed: %d\n", ret); 2188 + return ret; 2189 + } 2190 + 2191 + return snd_soc_component_set_jack(component, &vc4_hdmi->hdmi_jack, NULL); 2192 + } 2193 + 2179 2194 static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) 2180 2195 { 2181 2196 const struct vc4_hdmi_register *mai_data = ··· 2305 2288 dai_link->cpus->dai_name = dev_name(dev); 2306 2289 dai_link->codecs->name = dev_name(&vc4_hdmi->connector.hdmi_audio.codec_pdev->dev); 2307 2290 dai_link->platforms->name = dev_name(dev); 2291 + dai_link->init = vc4_hdmi_codec_init; 2308 2292 2309 2293 card->dai_link = dai_link; 2310 2294 card->num_links = 1;
+7
drivers/gpu/drm/vc4/vc4_hdmi.h
··· 4 4 #include <drm/drm_connector.h> 5 5 #include <media/cec.h> 6 6 #include <sound/dmaengine_pcm.h> 7 + #include <sound/hdmi-codec.h> 7 8 #include <sound/soc.h> 8 9 9 10 #include "vc4_drv.h" ··· 212 211 * KMS hooks. Protected by @mutex. 213 212 */ 214 213 enum hdmi_colorspace output_format; 214 + 215 + /** 216 + * @hdmi_jack: Represents the connection state of the HDMI plug, for 217 + * ALSA jack detection. 218 + */ 219 + struct snd_soc_jack hdmi_jack; 215 220 }; 216 221 217 222 #define connector_to_vc4_hdmi(_connector) \