53
53
#include <linux/reset.h>
54
54
#include <sound/dmaengine_pcm.h>
55
55
#include <sound/hdmi-codec.h>
56
+ #include <sound/jack.h>
56
57
#include <sound/pcm_drm_eld.h>
57
58
#include <sound/pcm_params.h>
58
59
#include <sound/soc.h>
@@ -392,6 +393,12 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi,
392
393
struct drm_connector * connector = & vc4_hdmi -> connector ;
393
394
int ret ;
394
395
396
+ /*
397
+ * Needs to be called for both connects and disconnects for HDMI
398
+ * audio hotplug to work correctly.
399
+ */
400
+ drm_atomic_helper_connector_hdmi_hotplug (connector , status );
401
+
395
402
/*
396
403
* NOTE: This function should really be called with vc4_hdmi->mutex
397
404
* held, but doing so results in reentrancy issues since
@@ -411,8 +418,6 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi,
411
418
return ;
412
419
}
413
420
414
- drm_atomic_helper_connector_hdmi_hotplug (connector , status );
415
-
416
421
cec_s_phys_addr (vc4_hdmi -> cec_adap ,
417
422
connector -> display_info .source_physical_address , false);
418
423
@@ -2234,6 +2239,22 @@ static const struct drm_connector_hdmi_audio_funcs vc4_hdmi_audio_funcs = {
2234
2239
.shutdown = vc4_hdmi_audio_shutdown ,
2235
2240
};
2236
2241
2242
+ static int vc4_hdmi_codec_init (struct snd_soc_pcm_runtime * rtd )
2243
+ {
2244
+ struct vc4_hdmi * vc4_hdmi = snd_soc_card_get_drvdata (rtd -> card );
2245
+ struct snd_soc_component * component = snd_soc_rtd_to_codec (rtd , 0 )-> component ;
2246
+ int ret ;
2247
+
2248
+ ret = snd_soc_card_jack_new (rtd -> card , "HDMI Jack" , SND_JACK_LINEOUT ,
2249
+ & vc4_hdmi -> hdmi_jack );
2250
+ if (ret ) {
2251
+ dev_err (rtd -> dev , "HDMI Jack creation failed: %d\n" , ret );
2252
+ return ret ;
2253
+ }
2254
+
2255
+ return snd_soc_component_set_jack (component , & vc4_hdmi -> hdmi_jack , NULL );
2256
+ }
2257
+
2237
2258
static int vc4_hdmi_audio_init (struct vc4_hdmi * vc4_hdmi )
2238
2259
{
2239
2260
const struct vc4_hdmi_register * mai_data =
@@ -2348,6 +2369,8 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi)
2348
2369
dai_link -> codecs -> name = dev_name (& vc4_hdmi -> connector .hdmi_audio .codec_pdev -> dev );
2349
2370
dai_link -> platforms -> name = dev_name (dev );
2350
2371
2372
+ dai_link -> init = vc4_hdmi_codec_init ;
2373
+
2351
2374
card -> dai_link = dai_link ;
2352
2375
card -> num_links = 1 ;
2353
2376
card -> name = vc4_hdmi -> variant -> card_name ;
0 commit comments