aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchunhui dai <chunhui.dai@mediatek.com>2018-10-02 23:41:46 -0400
committerCK Hu <ck.hu@mediatek.com>2018-10-02 23:56:32 -0400
commitd08b5ab972449b0ab494600fa985979e91e090ca (patch)
tree3cc9cbac565615817c971f88a03d33767f2a7ea3
parentbcc97daee6b8120d1ffeee0073b49bfbd3df026d (diff)
drm/mediatek: add dpi driver for mt2701 and mt7623
This patch adds dpi dirver suppot for both mt2701 and mt7623. And also support other (existing or future) chips that use the same binding and driver. Signed-off-by: chunhui dai <chunhui.dai@mediatek.com> Signed-off-by: CK Hu <ck.hu@mediatek.com>
-rw-r--r--drivers/gpu/drm/mediatek/mtk_dpi.c21
-rw-r--r--drivers/gpu/drm/mediatek/mtk_drm_drv.c2
2 files changed, 23 insertions, 0 deletions
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 08915e1765f8..62a9d47df948 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -659,11 +659,29 @@ static unsigned int mt8173_calculate_factor(int clock)
659 return 3 << 1; 659 return 3 << 1;
660} 660}
661 661
662static unsigned int mt2701_calculate_factor(int clock)
663{
664 if (clock <= 64000)
665 return 16;
666 else if (clock <= 128000)
667 return 8;
668 else if (clock <= 256000)
669 return 4;
670 else
671 return 2;
672}
673
662static const struct mtk_dpi_conf mt8173_conf = { 674static const struct mtk_dpi_conf mt8173_conf = {
663 .cal_factor = mt8173_calculate_factor, 675 .cal_factor = mt8173_calculate_factor,
664 .reg_h_fre_con = 0xe0, 676 .reg_h_fre_con = 0xe0,
665}; 677};
666 678
679static const struct mtk_dpi_conf mt2701_conf = {
680 .cal_factor = mt2701_calculate_factor,
681 .reg_h_fre_con = 0xb0,
682 .edge_sel_en = true,
683};
684
667static int mtk_dpi_probe(struct platform_device *pdev) 685static int mtk_dpi_probe(struct platform_device *pdev)
668{ 686{
669 struct device *dev = &pdev->dev; 687 struct device *dev = &pdev->dev;
@@ -753,6 +771,9 @@ static int mtk_dpi_remove(struct platform_device *pdev)
753} 771}
754 772
755static const struct of_device_id mtk_dpi_of_ids[] = { 773static const struct of_device_id mtk_dpi_of_ids[] = {
774 { .compatible = "mediatek,mt2701-dpi",
775 .data = &mt2701_conf,
776 },
756 { .compatible = "mediatek,mt8173-dpi", 777 { .compatible = "mediatek,mt8173-dpi",
757 .data = &mt8173_conf, 778 .data = &mt8173_conf,
758 }, 779 },
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 47ec604289b7..6422e99952fe 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -424,6 +424,8 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = {
424 .data = (void *)MTK_DSI }, 424 .data = (void *)MTK_DSI },
425 { .compatible = "mediatek,mt8173-dsi", 425 { .compatible = "mediatek,mt8173-dsi",
426 .data = (void *)MTK_DSI }, 426 .data = (void *)MTK_DSI },
427 { .compatible = "mediatek,mt2701-dpi",
428 .data = (void *)MTK_DPI },
427 { .compatible = "mediatek,mt8173-dpi", 429 { .compatible = "mediatek,mt8173-dpi",
428 .data = (void *)MTK_DPI }, 430 .data = (void *)MTK_DPI },
429 { .compatible = "mediatek,mt2701-disp-mutex", 431 { .compatible = "mediatek,mt2701-disp-mutex",