/
0021-tilcdc-More-refined-audio-mode-compatibility-check.patch
73 lines (64 loc) · 2.36 KB
/
0021-tilcdc-More-refined-audio-mode-compatibility-check.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From a774989da6914958b9e61c48b284419dc93a0110 Mon Sep 17 00:00:00 2001
From: Pantelis Antoniou <panto@antoniou-consulting.com>
Date: Thu, 6 Jun 2013 22:55:04 +0300
Subject: [PATCH 21/27] tilcdc: More refined audio mode compatibility check.
Allow audio modes more selectively. This should end up in DT instead
but it will do for release.
---
drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 023092f..375986e 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -440,6 +440,25 @@ int tilcdc_crtc_max_width(struct drm_crtc *crtc)
return max_width;
}
+/* this should find it's way to DT */
+static int audio_mode_check(int hdisplay, int vdisplay, int refresh,
+ int cea_mode)
+{
+ /* only cea modes can handle audio */
+ if (cea_mode <= 0)
+ return 0;
+
+ /* hardcoded mode that supports audio (at 24Hz) */
+ if (hdisplay == 1920 && vdisplay == 1080 && refresh == 24)
+ return 1;
+
+ /* from the rest, only those modes that refresh at 50/60 */
+ if (refresh != 50 && refresh != 60)
+ return 0;
+
+ return 1;
+}
+
int tilcdc_crtc_mode_valid(struct drm_crtc *crtc, struct drm_display_mode *mode,
int rb_check, int audio, struct edid *edid)
{
@@ -447,6 +466,7 @@ int tilcdc_crtc_mode_valid(struct drm_crtc *crtc, struct drm_display_mode *mode,
unsigned int bandwidth;
uint32_t hbp, hfp, hsw, vbp, vfp, vsw;
int has_audio, is_cea_mode, can_output_audio, refresh;
+ uint8_t cea_mode;
int rb;
@@ -469,14 +489,16 @@ int tilcdc_crtc_mode_valid(struct drm_crtc *crtc, struct drm_display_mode *mode,
refresh = drm_mode_vrefresh(mode);
/* set if it's a cea mode */
- is_cea_mode = drm_match_cea_mode(mode) > 0;
+ cea_mode = drm_match_cea_mode(mode);
+ is_cea_mode = cea_mode > 0;
/* set if we can output audio */
- can_output_audio = edid && has_audio && is_cea_mode &&
- (refresh == 50 || refresh == 60);
+ can_output_audio = edid && has_audio &&
+ audio_mode_check(mode->hdisplay, mode->vdisplay,
+ refresh, cea_mode);
DBG("mode %dx%d@%d pixel-clock %d audio %s cea %s can_output %s",
- mode->hdisplay, mode->vdisplay,refresh,
+ mode->hdisplay, mode->vdisplay, refresh,
mode->clock,
has_audio ? "true" : "false",
is_cea_mode ? "true" : "false",
--
1.8.2.1