diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2013-03-04 21:10:24 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2013-06-30 23:43:47 -0400 |
commit | 7ada785f186b5e68309c402249cd86b910a131c7 (patch) | |
tree | a1efe876060dd6632eed5266b5ec12bd56372b32 | |
parent | aca78e91581c05a4bddc5118cfea55d1cd740bd6 (diff) |
drm/nouveau: pass generic subdev to calculation routines
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 files changed, 17 insertions, 18 deletions
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c index b7fd1151166e..3c2fb68255a8 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c | |||
@@ -297,7 +297,7 @@ nv04_clock_pll_calc(struct nouveau_clock *clock, struct nvbios_pll *info, | |||
297 | int clk, struct nouveau_pll_vals *pv) | 297 | int clk, struct nouveau_pll_vals *pv) |
298 | { | 298 | { |
299 | int N1, M1, N2, M2, P; | 299 | int N1, M1, N2, M2, P; |
300 | int ret = nv04_pll_calc(clock, info, clk, &N1, &M1, &N2, &M2, &P); | 300 | int ret = nv04_pll_calc(nv_subdev(clock), info, clk, &N1, &M1, &N2, &M2, &P); |
301 | if (ret) { | 301 | if (ret) { |
302 | pv->refclk = info->refclk; | 302 | pv->refclk = info->refclk; |
303 | pv->N1 = N1; | 303 | pv->N1 = N1; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nv50.c index f4147f67eda6..5e9d5e283dc4 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/clock/nv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nv50.c | |||
@@ -47,7 +47,7 @@ nv50_clock_pll_set(struct nouveau_clock *clk, u32 type, u32 freq) | |||
47 | return ret; | 47 | return ret; |
48 | } | 48 | } |
49 | 49 | ||
50 | ret = nv04_pll_calc(clk, &info, freq, &N1, &M1, &N2, &M2, &P); | 50 | ret = nv04_pll_calc(nv_subdev(clk), &info, freq, &N1, &M1, &N2, &M2, &P); |
51 | if (!ret) { | 51 | if (!ret) { |
52 | nv_error(clk, "failed pll calculation\n"); | 52 | nv_error(clk, "failed pll calculation\n"); |
53 | return ret; | 53 | return ret; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c index 9068c98b96f6..2cedfd7020a0 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c | |||
@@ -45,7 +45,7 @@ nva3_clock_pll_set(struct nouveau_clock *clk, u32 type, u32 freq) | |||
45 | if (ret) | 45 | if (ret) |
46 | return ret; | 46 | return ret; |
47 | 47 | ||
48 | ret = nva3_pll_calc(clk, &info, freq, &N, &fN, &M, &P); | 48 | ret = nva3_pll_calc(nv_subdev(clk), &info, freq, &N, &fN, &M, &P); |
49 | if (ret < 0) | 49 | if (ret < 0) |
50 | return ret; | 50 | return ret; |
51 | 51 | ||
@@ -72,7 +72,7 @@ nva3_clock_pll_calc(struct nouveau_clock *clock, struct nvbios_pll *info, | |||
72 | { | 72 | { |
73 | int ret, N, M, P; | 73 | int ret, N, M, P; |
74 | 74 | ||
75 | ret = nva3_pll_calc(clock, info, clk, &N, NULL, &M, &P); | 75 | ret = nva3_pll_calc(nv_subdev(clock), info, clk, &N, NULL, &M, &P); |
76 | 76 | ||
77 | if (ret > 0) { | 77 | if (ret > 0) { |
78 | pv->refclk = info->refclk; | 78 | pv->refclk = info->refclk; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c index 7c9626258a46..495b21f27662 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c | |||
@@ -45,7 +45,7 @@ nvc0_clock_pll_set(struct nouveau_clock *clk, u32 type, u32 freq) | |||
45 | if (ret) | 45 | if (ret) |
46 | return ret; | 46 | return ret; |
47 | 47 | ||
48 | ret = nva3_pll_calc(clk, &info, freq, &N, &fN, &M, &P); | 48 | ret = nva3_pll_calc(nv_subdev(clk), &info, freq, &N, &fN, &M, &P); |
49 | if (ret < 0) | 49 | if (ret < 0) |
50 | return ret; | 50 | return ret; |
51 | 51 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/pll.h b/drivers/gpu/drm/nouveau/core/subdev/clock/pll.h index ef2c0078f337..445b14c33a98 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/clock/pll.h +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/pll.h | |||
@@ -1,9 +1,9 @@ | |||
1 | #ifndef __NOUVEAU_PLL_H__ | 1 | #ifndef __NOUVEAU_PLL_H__ |
2 | #define __NOUVEAU_PLL_H__ | 2 | #define __NOUVEAU_PLL_H__ |
3 | 3 | ||
4 | int nv04_pll_calc(struct nouveau_clock *, struct nvbios_pll *, u32 freq, | 4 | int nv04_pll_calc(struct nouveau_subdev *, struct nvbios_pll *, u32 freq, |
5 | int *N1, int *M1, int *N2, int *M2, int *P); | 5 | int *N1, int *M1, int *N2, int *M2, int *P); |
6 | int nva3_pll_calc(struct nouveau_clock *, struct nvbios_pll *, u32 freq, | 6 | int nva3_pll_calc(struct nouveau_subdev *, struct nvbios_pll *, u32 freq, |
7 | int *N, int *fN, int *M, int *P); | 7 | int *N, int *fN, int *M, int *P); |
8 | 8 | ||
9 | #endif | 9 | #endif |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/pllnv04.c b/drivers/gpu/drm/nouveau/core/subdev/clock/pllnv04.c index a2ab6d051ba8..cf1ed0dc9bc9 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/clock/pllnv04.c +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/pllnv04.c | |||
@@ -21,14 +21,13 @@ | |||
21 | * SOFTWARE. | 21 | * SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <subdev/clock.h> | ||
25 | #include <subdev/bios.h> | 24 | #include <subdev/bios.h> |
26 | #include <subdev/bios/pll.h> | 25 | #include <subdev/bios/pll.h> |
27 | 26 | ||
28 | #include "pll.h" | 27 | #include "pll.h" |
29 | 28 | ||
30 | static int | 29 | static int |
31 | getMNP_single(struct nouveau_clock *clock, struct nvbios_pll *info, int clk, | 30 | getMNP_single(struct nouveau_subdev *subdev, struct nvbios_pll *info, int clk, |
32 | int *pN, int *pM, int *pP) | 31 | int *pN, int *pM, int *pP) |
33 | { | 32 | { |
34 | /* Find M, N and P for a single stage PLL | 33 | /* Find M, N and P for a single stage PLL |
@@ -39,7 +38,7 @@ getMNP_single(struct nouveau_clock *clock, struct nvbios_pll *info, int clk, | |||
39 | * "clk" parameter in kHz | 38 | * "clk" parameter in kHz |
40 | * returns calculated clock | 39 | * returns calculated clock |
41 | */ | 40 | */ |
42 | int cv = nouveau_bios(clock)->version.chip; | 41 | int cv = nouveau_bios(subdev)->version.chip; |
43 | int minvco = info->vco1.min_freq, maxvco = info->vco1.max_freq; | 42 | int minvco = info->vco1.min_freq, maxvco = info->vco1.max_freq; |
44 | int minM = info->vco1.min_m, maxM = info->vco1.max_m; | 43 | int minM = info->vco1.min_m, maxM = info->vco1.max_m; |
45 | int minN = info->vco1.min_n, maxN = info->vco1.max_n; | 44 | int minN = info->vco1.min_n, maxN = info->vco1.max_n; |
@@ -124,7 +123,7 @@ getMNP_single(struct nouveau_clock *clock, struct nvbios_pll *info, int clk, | |||
124 | } | 123 | } |
125 | 124 | ||
126 | static int | 125 | static int |
127 | getMNP_double(struct nouveau_clock *clock, struct nvbios_pll *info, int clk, | 126 | getMNP_double(struct nouveau_subdev *subdev, struct nvbios_pll *info, int clk, |
128 | int *pN1, int *pM1, int *pN2, int *pM2, int *pP) | 127 | int *pN1, int *pM1, int *pN2, int *pM2, int *pP) |
129 | { | 128 | { |
130 | /* Find M, N and P for a two stage PLL | 129 | /* Find M, N and P for a two stage PLL |
@@ -135,7 +134,7 @@ getMNP_double(struct nouveau_clock *clock, struct nvbios_pll *info, int clk, | |||
135 | * "clk" parameter in kHz | 134 | * "clk" parameter in kHz |
136 | * returns calculated clock | 135 | * returns calculated clock |
137 | */ | 136 | */ |
138 | int chip_version = nouveau_bios(clock)->version.chip; | 137 | int chip_version = nouveau_bios(subdev)->version.chip; |
139 | int minvco1 = info->vco1.min_freq, maxvco1 = info->vco1.max_freq; | 138 | int minvco1 = info->vco1.min_freq, maxvco1 = info->vco1.max_freq; |
140 | int minvco2 = info->vco2.min_freq, maxvco2 = info->vco2.max_freq; | 139 | int minvco2 = info->vco2.min_freq, maxvco2 = info->vco2.max_freq; |
141 | int minU1 = info->vco1.min_inputfreq, minU2 = info->vco2.min_inputfreq; | 140 | int minU1 = info->vco1.min_inputfreq, minU2 = info->vco2.min_inputfreq; |
@@ -223,20 +222,20 @@ getMNP_double(struct nouveau_clock *clock, struct nvbios_pll *info, int clk, | |||
223 | } | 222 | } |
224 | 223 | ||
225 | int | 224 | int |
226 | nv04_pll_calc(struct nouveau_clock *clk, struct nvbios_pll *info, u32 freq, | 225 | nv04_pll_calc(struct nouveau_subdev *subdev, struct nvbios_pll *info, u32 freq, |
227 | int *N1, int *M1, int *N2, int *M2, int *P) | 226 | int *N1, int *M1, int *N2, int *M2, int *P) |
228 | { | 227 | { |
229 | int ret; | 228 | int ret; |
230 | 229 | ||
231 | if (!info->vco2.max_freq) { | 230 | if (!info->vco2.max_freq) { |
232 | ret = getMNP_single(clk, info, freq, N1, M1, P); | 231 | ret = getMNP_single(subdev, info, freq, N1, M1, P); |
233 | *N2 = 1; | 232 | *N2 = 1; |
234 | *M2 = 1; | 233 | *M2 = 1; |
235 | } else { | 234 | } else { |
236 | ret = getMNP_double(clk, info, freq, N1, M1, N2, M2, P); | 235 | ret = getMNP_double(subdev, info, freq, N1, M1, N2, M2, P); |
237 | } | 236 | } |
238 | 237 | ||
239 | if (!ret) | 238 | if (!ret) |
240 | nv_error(clk, "unable to compute acceptable pll values\n"); | 239 | nv_error(subdev, "unable to compute acceptable pll values\n"); |
241 | return ret; | 240 | return ret; |
242 | } | 241 | } |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/pllnva3.c b/drivers/gpu/drm/nouveau/core/subdev/clock/pllnva3.c index eed5c16cf610..4497378ba1e8 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/clock/pllnva3.c +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/pllnva3.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include "pll.h" | 29 | #include "pll.h" |
30 | 30 | ||
31 | int | 31 | int |
32 | nva3_pll_calc(struct nouveau_clock *clock, struct nvbios_pll *info, | 32 | nva3_pll_calc(struct nouveau_subdev *subdev, struct nvbios_pll *info, |
33 | u32 freq, int *pN, int *pfN, int *pM, int *P) | 33 | u32 freq, int *pN, int *pfN, int *pM, int *P) |
34 | { | 34 | { |
35 | u32 best_err = ~0, err; | 35 | u32 best_err = ~0, err; |
@@ -72,7 +72,7 @@ nva3_pll_calc(struct nouveau_clock *clock, struct nvbios_pll *info, | |||
72 | } | 72 | } |
73 | 73 | ||
74 | if (unlikely(best_err == ~0)) { | 74 | if (unlikely(best_err == ~0)) { |
75 | nv_error(clock, "unable to find matching pll values\n"); | 75 | nv_error(subdev, "unable to find matching pll values\n"); |
76 | return -EINVAL; | 76 | return -EINVAL; |
77 | } | 77 | } |
78 | 78 | ||