diff options
author | Junzhi Zhao <junzhi.zhao@mediatek.com> | 2016-09-28 23:02:15 -0400 |
---|---|---|
committer | CK Hu <ck.hu@mediatek.com> | 2016-10-18 21:07:08 -0400 |
commit | 0d2200794f0a2c1ebb3b6613842914d8ce4b67f9 (patch) | |
tree | e872f270f260e84c4cacde3e93a957708f9f274d | |
parent | 968253bd7caae5621f6806dd5055353fe33d366e (diff) |
drm/mediatek: modify the factor to make the pll_rate set in the 1G-2G range
Currently, the code sets the "pll" to the desired multiple
of the pixel clock manully(4*3m 8*3,etc). The valid range
of the pll is 1G-2G, however, when the pixel clock is bigger
than 167MHz, the "pll" will be set to a invalid value( > 2G),
then the "pll" will be 2GHz, thus the pixel clock will be in
correct. Change the factor to make the "pll" be set in the
(1G, 2G) range.
Signed-off-by: Junzhi Zhao <junzhi.zhao@mediatek.com>
Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
-rw-r--r-- | drivers/gpu/drm/mediatek/mtk_dpi.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c index 0186e500d2a5..90fb831ef031 100644 --- a/drivers/gpu/drm/mediatek/mtk_dpi.c +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c | |||
@@ -432,11 +432,16 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi, | |||
432 | unsigned long pll_rate; | 432 | unsigned long pll_rate; |
433 | unsigned int factor; | 433 | unsigned int factor; |
434 | 434 | ||
435 | /* let pll_rate can fix the valid range of tvdpll (1G~2GHz) */ | ||
435 | pix_rate = 1000UL * mode->clock; | 436 | pix_rate = 1000UL * mode->clock; |
436 | if (mode->clock <= 74000) | 437 | if (mode->clock <= 27000) |
438 | factor = 16 * 3; | ||
439 | else if (mode->clock <= 84000) | ||
437 | factor = 8 * 3; | 440 | factor = 8 * 3; |
438 | else | 441 | else if (mode->clock <= 167000) |
439 | factor = 4 * 3; | 442 | factor = 4 * 3; |
443 | else | ||
444 | factor = 2 * 3; | ||
440 | pll_rate = pix_rate * factor; | 445 | pll_rate = pix_rate * factor; |
441 | 446 | ||
442 | dev_dbg(dpi->dev, "Want PLL %lu Hz, pixel clock %lu Hz\n", | 447 | dev_dbg(dpi->dev, "Want PLL %lu Hz, pixel clock %lu Hz\n", |