diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2011-11-08 23:35:14 -0500 |
---|---|---|
committer | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2011-11-21 18:43:21 -0500 |
commit | 5e47431aabf716c9ad9eacf1a966e1fc1469c809 (patch) | |
tree | f2d588fe8e00656b83dc8ee30d17c4777a9b1e9e /drivers/video/sh_mipi_dsi.c | |
parent | 08750617badd03fd95f33921a5213a5632022178 (diff) |
fbdev: sh_mipi_dsi: add set_dot_clock() for each platform
Dot clock of SH MIPI are depends on each platform board.
This patch adds set_dot_clock() function for it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/sh_mipi_dsi.c')
-rw-r--r-- | drivers/video/sh_mipi_dsi.c | 45 |
1 files changed, 11 insertions, 34 deletions
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c index 190e941cf25d..77743f4388a0 100644 --- a/drivers/video/sh_mipi_dsi.c +++ b/drivers/video/sh_mipi_dsi.c | |||
@@ -53,7 +53,6 @@ struct sh_mipi { | |||
53 | void __iomem *base; | 53 | void __iomem *base; |
54 | void __iomem *linkbase; | 54 | void __iomem *linkbase; |
55 | struct clk *dsit_clk; | 55 | struct clk *dsit_clk; |
56 | struct clk *dsip_clk; | ||
57 | struct device *dev; | 56 | struct device *dev; |
58 | 57 | ||
59 | void *next_board_data; | 58 | void *next_board_data; |
@@ -307,8 +306,8 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, | |||
307 | /* DSI-Tx bias on */ | 306 | /* DSI-Tx bias on */ |
308 | iowrite32(0x00000001, base + PHYCTRL); | 307 | iowrite32(0x00000001, base + PHYCTRL); |
309 | udelay(200); | 308 | udelay(200); |
310 | /* Deassert resets, power on, set multiplier */ | 309 | /* Deassert resets, power on */ |
311 | iowrite32(0x03070b01, base + PHYCTRL); | 310 | iowrite32(0x03070001, base + PHYCTRL); |
312 | 311 | ||
313 | /* setup l-bridge */ | 312 | /* setup l-bridge */ |
314 | 313 | ||
@@ -421,6 +420,9 @@ static int __init sh_mipi_probe(struct platform_device *pdev) | |||
421 | if (!res || !res2 || idx >= ARRAY_SIZE(mipi_dsi) || !pdata) | 420 | if (!res || !res2 || idx >= ARRAY_SIZE(mipi_dsi) || !pdata) |
422 | return -ENODEV; | 421 | return -ENODEV; |
423 | 422 | ||
423 | if (!pdata->set_dot_clock) | ||
424 | return -EINVAL; | ||
425 | |||
424 | mutex_lock(&array_lock); | 426 | mutex_lock(&array_lock); |
425 | if (idx < 0) | 427 | if (idx < 0) |
426 | for (idx = 0; idx < ARRAY_SIZE(mipi_dsi) && mipi_dsi[idx]; idx++) | 428 | for (idx = 0; idx < ARRAY_SIZE(mipi_dsi) && mipi_dsi[idx]; idx++) |
@@ -481,34 +483,10 @@ static int __init sh_mipi_probe(struct platform_device *pdev) | |||
481 | 483 | ||
482 | dev_dbg(&pdev->dev, "DSI-T clk %lu -> %lu\n", f_current, rate); | 484 | dev_dbg(&pdev->dev, "DSI-T clk %lu -> %lu\n", f_current, rate); |
483 | 485 | ||
484 | mipi->dsip_clk = clk_get(&pdev->dev, "dsip_clk"); | ||
485 | if (IS_ERR(mipi->dsip_clk)) { | ||
486 | ret = PTR_ERR(mipi->dsip_clk); | ||
487 | goto eclkpget; | ||
488 | } | ||
489 | |||
490 | f_current = clk_get_rate(mipi->dsip_clk); | ||
491 | /* Between 10 and 50MHz */ | ||
492 | rate = clk_round_rate(mipi->dsip_clk, 24000000); | ||
493 | if (rate > 0 && rate != f_current) | ||
494 | ret = clk_set_rate(mipi->dsip_clk, rate); | ||
495 | else | ||
496 | ret = rate; | ||
497 | if (ret < 0) | ||
498 | goto esetprate; | ||
499 | |||
500 | dev_dbg(&pdev->dev, "DSI-P clk %lu -> %lu\n", f_current, rate); | ||
501 | |||
502 | msleep(10); | ||
503 | |||
504 | ret = clk_enable(mipi->dsit_clk); | 486 | ret = clk_enable(mipi->dsit_clk); |
505 | if (ret < 0) | 487 | if (ret < 0) |
506 | goto eclkton; | 488 | goto eclkton; |
507 | 489 | ||
508 | ret = clk_enable(mipi->dsip_clk); | ||
509 | if (ret < 0) | ||
510 | goto eclkpon; | ||
511 | |||
512 | mipi_dsi[idx] = mipi; | 490 | mipi_dsi[idx] = mipi; |
513 | 491 | ||
514 | pm_runtime_enable(&pdev->dev); | 492 | pm_runtime_enable(&pdev->dev); |
@@ -518,6 +496,10 @@ static int __init sh_mipi_probe(struct platform_device *pdev) | |||
518 | if (ret < 0) | 496 | if (ret < 0) |
519 | goto emipisetup; | 497 | goto emipisetup; |
520 | 498 | ||
499 | ret = pdata->set_dot_clock(pdev, mipi->base, 1); | ||
500 | if (ret < 0) | ||
501 | goto emipisetup; | ||
502 | |||
521 | mutex_unlock(&array_lock); | 503 | mutex_unlock(&array_lock); |
522 | platform_set_drvdata(pdev, mipi); | 504 | platform_set_drvdata(pdev, mipi); |
523 | 505 | ||
@@ -537,13 +519,8 @@ static int __init sh_mipi_probe(struct platform_device *pdev) | |||
537 | emipisetup: | 519 | emipisetup: |
538 | mipi_dsi[idx] = NULL; | 520 | mipi_dsi[idx] = NULL; |
539 | pm_runtime_disable(&pdev->dev); | 521 | pm_runtime_disable(&pdev->dev); |
540 | clk_disable(mipi->dsip_clk); | ||
541 | eclkpon: | ||
542 | clk_disable(mipi->dsit_clk); | 522 | clk_disable(mipi->dsit_clk); |
543 | eclkton: | 523 | eclkton: |
544 | esetprate: | ||
545 | clk_put(mipi->dsip_clk); | ||
546 | eclkpget: | ||
547 | esettrate: | 524 | esettrate: |
548 | clk_put(mipi->dsit_clk); | 525 | clk_put(mipi->dsit_clk); |
549 | eclktget: | 526 | eclktget: |
@@ -594,10 +571,10 @@ static int __exit sh_mipi_remove(struct platform_device *pdev) | |||
594 | pdata->lcd_chan->board_cfg.board_data = NULL; | 571 | pdata->lcd_chan->board_cfg.board_data = NULL; |
595 | 572 | ||
596 | pm_runtime_disable(&pdev->dev); | 573 | pm_runtime_disable(&pdev->dev); |
597 | clk_disable(mipi->dsip_clk); | ||
598 | clk_disable(mipi->dsit_clk); | 574 | clk_disable(mipi->dsit_clk); |
599 | clk_put(mipi->dsit_clk); | 575 | clk_put(mipi->dsit_clk); |
600 | clk_put(mipi->dsip_clk); | 576 | pdata->set_dot_clock(pdev, mipi->base, 0); |
577 | |||
601 | iounmap(mipi->linkbase); | 578 | iounmap(mipi->linkbase); |
602 | if (res2) | 579 | if (res2) |
603 | release_mem_region(res2->start, resource_size(res2)); | 580 | release_mem_region(res2->start, resource_size(res2)); |