summaryrefslogtreecommitdiffstats
path: root/recipes/linux/linux-openmoko-2.6.32/0012-Report-all-FB-modes-given-by-the-lower-levels.patch
blob: ac19dbd5d2fa169ef0948e3cb17e1f2078a83c4b (plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
From f8448d2b08c1e2cfd0faba0e3f3c4c58e4ecaa9f Mon Sep 17 00:00:00 2001
From: Thomas White <taw@bitwiz.org.uk>
Date: Mon, 1 Mar 2010 22:02:26 +0100
Subject: [PATCH 12/13] Report all FB modes given by the lower levels

Signed-off-by: Thomas White <taw@bitwiz.org.uk>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 drivers/mfd/glamo/glamo-display.c |   70 +++++++++++++++++++++----------------
 1 files changed, 40 insertions(+), 30 deletions(-)

diff --git a/drivers/mfd/glamo/glamo-display.c b/drivers/mfd/glamo/glamo-display.c
index a384c8b..bc3a2ea 100644
--- a/drivers/mfd/glamo/glamo-display.c
+++ b/drivers/mfd/glamo/glamo-display.c
@@ -456,43 +456,53 @@ static void glamo_connector_destroy(struct drm_connector *connector)
 
 static int glamo_connector_get_modes(struct drm_connector *connector)
 {
-	struct drm_display_mode *mode;
 	struct glamo_fb_platform_data *fb_info;
 	struct glamo_output *goutput = to_glamo_output(connector);
 	struct glamodrm_handle *gdrm = goutput->gdrm;
+	int i;
 
 	/* Dig out the record which will tell us about the hardware */
 	fb_info = gdrm->glamo_core->pdata->fb_data;
 
-	mode = drm_mode_create(connector->dev);
-	if (!mode)
-		return 0;
-	/* Fill in 'mode' here */
-	mode->type = DRM_MODE_TYPE_DEFAULT | DRM_MODE_TYPE_PREFERRED;
-
-	/* Convert framebuffer timings into KMS timings */
-	mode->clock = 1000000000UL / fb_info->modes[0].pixclock; /* ps -> kHz */
-	mode->clock *= 1000; /* kHz -> Hz */
-	mode->hdisplay = fb_info->modes[0].xres;
-	mode->hsync_start = fb_info->modes[0].right_margin + mode->hdisplay;
-	mode->hsync_end = mode->hsync_start + fb_info->modes[0].hsync_len;
-	mode->htotal = mode->hsync_end + fb_info->modes[0].left_margin;
-	mode->hskew = 0;
-
-	mode->vdisplay = fb_info->modes[0].yres;
-	mode->vsync_start = fb_info->modes[0].lower_margin + mode->vdisplay;
-	mode->vsync_end = mode->vsync_start + fb_info->modes[0].vsync_len;
-	mode->vtotal = mode->vsync_end + fb_info->modes[0].upper_margin;
-	mode->vscan = 0;
-
-	/* Physical size */
-	mode->width_mm = fb_info->width;
-	mode->height_mm = fb_info->height;
-
-	drm_mode_set_name(mode);
-	drm_mode_probed_add(connector, mode);
-
-	return 1;	/* one mode, for now */
+	for ( i=0; i<fb_info->num_modes; i++ ) {
+
+		struct drm_display_mode *mode;
+
+		mode = drm_mode_create(connector->dev);
+		if ( !mode ) continue;
+
+		mode->type = DRM_MODE_TYPE_DEFAULT | DRM_MODE_TYPE_PREFERRED;
+
+		/* Convert framebuffer timings into KMS timings.
+		 * First:  ps -> kHz */
+		mode->clock = 1000000000UL / fb_info->modes[i].pixclock;
+		mode->clock *= 1000; /* then kHz -> Hz */
+		mode->hdisplay = fb_info->modes[i].xres;
+		mode->hsync_start = fb_info->modes[i].right_margin
+		                     + mode->hdisplay;
+		mode->hsync_end = mode->hsync_start
+		                     + fb_info->modes[i].hsync_len;
+		mode->htotal = mode->hsync_end + fb_info->modes[i].left_margin;
+		mode->hskew = 0;
+
+		mode->vdisplay = fb_info->modes[i].yres;
+		mode->vsync_start = fb_info->modes[i].lower_margin
+		                     + mode->vdisplay;
+		mode->vsync_end = mode->vsync_start
+		                   + fb_info->modes[i].vsync_len;
+		mode->vtotal = mode->vsync_end + fb_info->modes[i].upper_margin;
+		mode->vscan = 0;
+
+		/* Physical size */
+		mode->width_mm = fb_info->width;
+		mode->height_mm = fb_info->height;
+
+		drm_mode_set_name(mode);
+		drm_mode_probed_add(connector, mode);
+
+	}
+
+	return fb_info->num_modes;
 }
 
 
-- 
1.7.0