9d0361c426164af81066593fecacbb61bc9d70a2
[openwrt/staging/robimarko.git] /
1 From 68522ed7c1135fd5ea5b4541d557bdbdcba80669 Mon Sep 17 00:00:00 2001
2 From: popcornmix <popcornmix@gmail.com>
3 Date: Wed, 8 Dec 2021 15:57:15 +0000
4 Subject: [PATCH] vc4/drm: Ignore vc4_hdmi->output_enabled for allowing
5 audio (#4759)
6
7 Otherwise we reject audio playback when switching hdmi modes
8
9 Signed-off-by: Dom Cobley <popcornmix@gmail.com>
10 ---
11 drivers/gpu/drm/vc4/vc4_hdmi.c | 29 ++---------------------------
12 drivers/gpu/drm/vc4/vc4_hdmi.h | 6 ------
13 2 files changed, 2 insertions(+), 33 deletions(-)
14
15 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
16 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
17 @@ -210,6 +210,7 @@ vc4_hdmi_connector_detect(struct drm_con
18 connected = true;
19 }
20
21 + vc4_hdmi->encoder.hdmi_monitor = false;
22 if (connected) {
23 if (connector->status != connector_status_connected) {
24 struct edid *edid = drm_get_edid(connector, vc4_hdmi->ddc);
25 @@ -730,15 +731,6 @@ static void vc4_hdmi_encoder_post_crtc_p
26 mutex_unlock(&vc4_hdmi->mutex);
27 }
28
29 -static void vc4_hdmi_encoder_disable(struct drm_encoder *encoder)
30 -{
31 - struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
32 -
33 - mutex_lock(&vc4_hdmi->mutex);
34 - vc4_hdmi->output_enabled = false;
35 - mutex_unlock(&vc4_hdmi->mutex);
36 -}
37 -
38 static void vc4_hdmi_csc_setup(struct vc4_hdmi *vc4_hdmi, bool enable)
39 {
40 unsigned long flags;
41 @@ -1218,15 +1210,6 @@ static void vc4_hdmi_encoder_post_crtc_e
42 mutex_unlock(&vc4_hdmi->mutex);
43 }
44
45 -static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder)
46 -{
47 - struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
48 -
49 - mutex_lock(&vc4_hdmi->mutex);
50 - vc4_hdmi->output_enabled = true;
51 - mutex_unlock(&vc4_hdmi->mutex);
52 -}
53 -
54 static void vc4_hdmi_encoder_atomic_mode_set(struct drm_encoder *encoder,
55 struct drm_crtc_state *crtc_state,
56 struct drm_connector_state *conn_state)
57 @@ -1320,8 +1303,6 @@ static const struct drm_encoder_helper_f
58 .atomic_check = vc4_hdmi_encoder_atomic_check,
59 .atomic_mode_set = vc4_hdmi_encoder_atomic_mode_set,
60 .mode_valid = vc4_hdmi_encoder_mode_valid,
61 - .disable = vc4_hdmi_encoder_disable,
62 - .enable = vc4_hdmi_encoder_enable,
63 };
64
65 static u32 vc4_hdmi_channel_map(struct vc4_hdmi *vc4_hdmi, u32 channel_mask)
66 @@ -1421,16 +1402,10 @@ static bool vc4_hdmi_audio_can_stream(st
67 lockdep_assert_held(&vc4_hdmi->mutex);
68
69 /*
70 - * If the controller is disabled, prevent any ALSA output.
71 - */
72 - if (!vc4_hdmi->output_enabled)
73 - return false;
74 -
75 - /*
76 * If the encoder is currently in DVI mode, treat the codec DAI
77 * as missing.
78 */
79 - if (!(HDMI_READ(HDMI_RAM_PACKET_CONFIG) & VC4_HDMI_RAM_PACKET_ENABLE))
80 + if (!vc4_hdmi->encoder.hdmi_monitor)
81 return false;
82
83 return true;
84 --- a/drivers/gpu/drm/vc4/vc4_hdmi.h
85 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
86 @@ -209,12 +209,6 @@ struct vc4_hdmi {
87 struct drm_display_mode saved_adjusted_mode;
88
89 /**
90 - * @output_enabled: Is the HDMI controller currently active?
91 - * Protected by @mutex.
92 - */
93 - bool output_enabled;
94 -
95 - /**
96 * @scdc_enabled: Is the HDMI controller currently running with
97 * the scrambler on? Protected by @mutex.
98 */