Joel Stanley | e50183f | 2017-02-28 12:17:46 +1030 | [diff] [blame] | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | From: Benjamin Herrenschmidt <benh@kernel.crashing.org> |
| 3 | Date: Fri, 17 Feb 2017 13:57:30 +1100 |
Joel Stanley | 8d5acef | 2017-03-15 16:24:09 +1030 | [diff] [blame] | 4 | Subject: [PATCH 05/12] drm/ast: Fix calculation of MCLK |
Joel Stanley | e50183f | 2017-02-28 12:17:46 +1030 | [diff] [blame] | 5 | |
| 6 | Some braces were missing causing an incorrect calculation. |
| 7 | |
| 8 | Y.C. Chen from Aspeed provided me with the right formula |
| 9 | which I tested on AST2400 and 2500. |
| 10 | |
| 11 | The MCLK isn't currently used by the driver (it will eventually |
| 12 | to filter modes) so the issue isn't catastrophic. |
| 13 | |
| 14 | Also make the printed value a bit more meaningful |
| 15 | |
| 16 | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> |
| 17 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
| 18 | --- |
| 19 | drivers/gpu/drm/ast/ast_main.c | 6 ++++-- |
| 20 | 1 file changed, 4 insertions(+), 2 deletions(-) |
| 21 | |
| 22 | diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c |
| 23 | index f01a937165b7..8d87d3ca439b 100644 |
| 24 | --- a/drivers/gpu/drm/ast/ast_main.c |
| 25 | +++ b/drivers/gpu/drm/ast/ast_main.c |
| 26 | @@ -354,7 +354,7 @@ static int ast_get_dram_info(struct drm_device *dev) |
| 27 | div = 0x1; |
| 28 | break; |
| 29 | } |
| 30 | - ast->mclk = ref_pll * (num + 2) / (denum + 2) * (div * 1000); |
| 31 | + ast->mclk = ref_pll * (num + 2) / ((denum + 2) * (div * 1000)); |
| 32 | return 0; |
| 33 | } |
| 34 | |
| 35 | @@ -498,7 +498,9 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) |
| 36 | if (ret) |
| 37 | goto out_free; |
| 38 | ast->vram_size = ast_get_vram_info(dev); |
| 39 | - DRM_INFO("dram %d %d %d %08x\n", ast->mclk, ast->dram_type, ast->dram_bus_width, ast->vram_size); |
| 40 | + DRM_INFO("dram MCLK=%u Mhz type=%d bus_width=%d size=%08x\n", |
| 41 | + ast->mclk, ast->dram_type, |
| 42 | + ast->dram_bus_width, ast->vram_size); |
| 43 | } |
| 44 | |
| 45 | if (need_post) |
| 46 | -- |
| 47 | 2.11.0 |
| 48 | |