aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorPatrik Jakobsson <patrik.r.jakobsson@gmail.com>2013-03-13 18:32:36 -0400
committerPatrik Jakobsson <patrik.r.jakobsson@gmail.com>2013-03-17 13:32:55 -0400
commit1548060f48421f2faec75d431d447a090a30bf63 (patch)
treeece60dae0326f669d0909c7e18bfdb2feb48f5f4 /drivers/gpu/drm
parent4e6bb70d7bb080714ae5f849c89f3fb37c1ed6db (diff)
drm/gma500: Calculate clock in one function instead of three identical
i9xx_clock() and i8xx_clock() did the same calc and psb_intel_clock() just called i9xx_clock() so just move it all into psb_intel_clock(). The same calculation is duplicated in cdv_intel_display.c as well so maybe we can share it later on. Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/gma500/psb_intel_display.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c
index 414df48e592b..b29be00832a7 100644
--- a/drivers/gpu/drm/gma500/psb_intel_display.c
+++ b/drivers/gpu/drm/gma500/psb_intel_display.c
@@ -127,19 +127,7 @@ static const struct psb_intel_limit_t *psb_intel_limit(struct drm_crtc *crtc)
127 return limit; 127 return limit;
128} 128}
129 129
130/** Derive the pixel clock for the given refclk and divisors for 8xx chips. */ 130static void psb_intel_clock(int refclk, struct psb_intel_clock_t *clock)
131
132static void i8xx_clock(int refclk, struct psb_intel_clock_t *clock)
133{
134 clock->m = 5 * (clock->m1 + 2) + (clock->m2 + 2);
135 clock->p = clock->p1 * clock->p2;
136 clock->vco = refclk * clock->m / (clock->n + 2);
137 clock->dot = clock->vco / clock->p;
138}
139
140/** Derive the pixel clock for the given refclk and divisors for 9xx chips. */
141
142static void i9xx_clock(int refclk, struct psb_intel_clock_t *clock)
143{ 131{
144 clock->m = 5 * (clock->m1 + 2) + (clock->m2 + 2); 132 clock->m = 5 * (clock->m1 + 2) + (clock->m2 + 2);
145 clock->p = clock->p1 * clock->p2; 133 clock->p = clock->p1 * clock->p2;
@@ -147,12 +135,6 @@ static void i9xx_clock(int refclk, struct psb_intel_clock_t *clock)
147 clock->dot = clock->vco / clock->p; 135 clock->dot = clock->vco / clock->p;
148} 136}
149 137
150static void psb_intel_clock(struct drm_device *dev, int refclk,
151 struct psb_intel_clock_t *clock)
152{
153 return i9xx_clock(refclk, clock);
154}
155
156/** 138/**
157 * Returns whether any output on the specified pipe is of the specified type 139 * Returns whether any output on the specified pipe is of the specified type
158 */ 140 */
@@ -258,7 +240,7 @@ static bool psb_intel_find_best_PLL(struct drm_crtc *crtc, int target,
258 clock.p1++) { 240 clock.p1++) {
259 int this_err; 241 int this_err;
260 242
261 psb_intel_clock(dev, refclk, &clock); 243 psb_intel_clock(refclk, &clock);
262 244
263 if (!psb_intel_PLL_is_valid 245 if (!psb_intel_PLL_is_valid
264 (crtc, &clock)) 246 (crtc, &clock))
@@ -1099,9 +1081,9 @@ static int psb_intel_crtc_clock_get(struct drm_device *dev,
1099 if ((dpll & PLL_REF_INPUT_MASK) == 1081 if ((dpll & PLL_REF_INPUT_MASK) ==
1100 PLLB_REF_INPUT_SPREADSPECTRUMIN) { 1082 PLLB_REF_INPUT_SPREADSPECTRUMIN) {
1101 /* XXX: might not be 66MHz */ 1083 /* XXX: might not be 66MHz */
1102 i8xx_clock(66000, &clock); 1084 psb_intel_clock(66000, &clock);
1103 } else 1085 } else
1104 i8xx_clock(48000, &clock); 1086 psb_intel_clock(48000, &clock);
1105 } else { 1087 } else {
1106 if (dpll & PLL_P1_DIVIDE_BY_TWO) 1088 if (dpll & PLL_P1_DIVIDE_BY_TWO)
1107 clock.p1 = 2; 1089 clock.p1 = 2;
@@ -1116,7 +1098,7 @@ static int psb_intel_crtc_clock_get(struct drm_device *dev,
1116 else 1098 else
1117 clock.p2 = 2; 1099 clock.p2 = 2;
1118 1100
1119 i8xx_clock(48000, &clock); 1101 psb_intel_clock(48000, &clock);
1120 } 1102 }
1121 1103
1122 /* XXX: It would be nice to validate the clocks, but we can't reuse 1104 /* XXX: It would be nice to validate the clocks, but we can't reuse