]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/mediatek: add mt8183 dpi clock factor
authorJitao Shi <jitao.shi@mediatek.com>
Tue, 25 Feb 2020 09:40:56 +0000 (17:40 +0800)
committerCK Hu <ck.hu@mediatek.com>
Wed, 26 Feb 2020 01:29:05 +0000 (09:29 +0800)
The factor depends on the divider of DPI in MT8183, therefore,
we should fix this factor to the right and new one.

Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
Signed-off-by: CK Hu <ck.hu@mediatek.com>
drivers/gpu/drm/mediatek/mtk_dpi.c

index 01fa8b8d763d182ac9b33dfe3a8f81e11702fb2a..087f5ce732e182780db138e4d5f5b4c2d8fbb6ff 100644 (file)
@@ -664,6 +664,16 @@ static unsigned int mt2701_calculate_factor(int clock)
                return 1;
 }
 
+static unsigned int mt8183_calculate_factor(int clock)
+{
+       if (clock <= 27000)
+               return 8;
+       else if (clock <= 167000)
+               return 4;
+       else
+               return 2;
+}
+
 static const struct mtk_dpi_conf mt8173_conf = {
        .cal_factor = mt8173_calculate_factor,
        .reg_h_fre_con = 0xe0,
@@ -675,6 +685,11 @@ static const struct mtk_dpi_conf mt2701_conf = {
        .edge_sel_en = true,
 };
 
+static const struct mtk_dpi_conf mt8183_conf = {
+       .cal_factor = mt8183_calculate_factor,
+       .reg_h_fre_con = 0xe0,
+};
+
 static int mtk_dpi_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
@@ -770,6 +785,9 @@ static const struct of_device_id mtk_dpi_of_ids[] = {
        { .compatible = "mediatek,mt8173-dpi",
          .data = &mt8173_conf,
        },
+       { .compatible = "mediatek,mt8183-dpi",
+         .data = &mt8183_conf,
+       },
        { },
 };