u16 c_bottom;
 };
 
+struct mtk_dpi_factor {
+       u32 clock;
+       u8 factor;
+};
+
 /**
  * struct mtk_dpi_conf - Configuration of mediatek dpi.
- * @cal_factor: Callback function to calculate factor value.
+ * @dpi_factor: SoC-specific pixel clock PLL factor values.
+ * @num_dpi_factor: Number of pixel clock PLL factor values.
  * @reg_h_fre_con: Register address of frequency control.
  * @max_clock_khz: Max clock frequency supported for this SoCs in khz units.
  * @edge_sel_en: Enable of edge selection.
  * @edge_cfg_in_mmsys: If the edge configuration for DPI's output needs to be set in MMSYS.
  */
 struct mtk_dpi_conf {
-       unsigned int (*cal_factor)(int clock);
+       const struct mtk_dpi_factor *dpi_factor;
+       const u8 num_dpi_factor;
        u32 reg_h_fre_con;
        u32 max_clock_khz;
        bool edge_sel_en;
        return ret;
 }
 
+static unsigned int mtk_dpi_calculate_factor(struct mtk_dpi *dpi, int mode_clk)
+{
+       const struct mtk_dpi_factor *dpi_factor = dpi->conf->dpi_factor;
+       int i;
+
+       for (i = 0; i < dpi->conf->num_dpi_factor; i++) {
+               if (mode_clk <= dpi_factor[i].clock)
+                       return dpi_factor[i].factor;
+       }
+
+       /* If no match try the lowest possible factor */
+       return dpi_factor[dpi->conf->num_dpi_factor - 1].factor;
+}
+
 static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
                                    struct drm_display_mode *mode)
 {
        unsigned int factor;
 
        /* let pll_rate can fix the valid range of tvdpll (1G~2GHz) */
-       factor = dpi->conf->cal_factor(mode->clock);
+       factor = mtk_dpi_calculate_factor(dpi, mode->clock);
        drm_display_mode_to_videomode(mode, &vm);
        pll_rate = vm.pixelclock * factor;
 
        .unbind = mtk_dpi_unbind,
 };
 
-static unsigned int mt8173_calculate_factor(int clock)
-{
-       if (clock <= 27000)
-               return 3 << 4;
-       else if (clock <= 84000)
-               return 3 << 3;
-       else if (clock <= 167000)
-               return 3 << 2;
-       else
-               return 3 << 1;
-}
-
-static unsigned int mt2701_calculate_factor(int clock)
-{
-       if (clock <= 64000)
-               return 4;
-       else if (clock <= 128000)
-               return 2;
-       else
-               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 unsigned int mt8195_dpintf_calculate_factor(int clock)
-{
-       if (clock < 70000)
-               return 4;
-       else if (clock < 200000)
-               return 2;
-       else
-               return 1;
-}
-
 static const u32 mt8173_output_fmts[] = {
        MEDIA_BUS_FMT_RGB888_1X24,
 };
        MEDIA_BUS_FMT_YUYV8_1X16,
 };
 
+static const struct mtk_dpi_factor dpi_factor_mt2701[] = {
+       { 64000, 4 }, { 128000, 2 }, { U32_MAX, 1 }
+};
+
+static const struct mtk_dpi_factor dpi_factor_mt8173[] = {
+       { 27000, 48 }, { 84000, 24 }, { 167000, 12 }, { U32_MAX, 6 }
+};
+
+static const struct mtk_dpi_factor dpi_factor_mt8183[] = {
+       { 27000, 8 }, { 167000, 4 }, { U32_MAX, 2 }
+};
+
+static const struct mtk_dpi_factor dpi_factor_mt8195_dp_intf[] = {
+       { 70000 - 1, 4 }, { 200000 - 1, 2 }, { U32_MAX, 1 }
+};
+
 static const struct mtk_dpi_conf mt8173_conf = {
-       .cal_factor = mt8173_calculate_factor,
+       .dpi_factor = dpi_factor_mt8173,
+       .num_dpi_factor = ARRAY_SIZE(dpi_factor_mt8173),
        .reg_h_fre_con = 0xe0,
        .max_clock_khz = 300000,
        .output_fmts = mt8173_output_fmts,
 };
 
 static const struct mtk_dpi_conf mt2701_conf = {
-       .cal_factor = mt2701_calculate_factor,
+       .dpi_factor = dpi_factor_mt2701,
+       .num_dpi_factor = ARRAY_SIZE(dpi_factor_mt2701),
        .reg_h_fre_con = 0xb0,
        .edge_sel_en = true,
        .max_clock_khz = 150000,
 };
 
 static const struct mtk_dpi_conf mt8183_conf = {
-       .cal_factor = mt8183_calculate_factor,
+       .dpi_factor = dpi_factor_mt8183,
+       .num_dpi_factor = ARRAY_SIZE(dpi_factor_mt8183),
        .reg_h_fre_con = 0xe0,
        .max_clock_khz = 100000,
        .output_fmts = mt8183_output_fmts,
 };
 
 static const struct mtk_dpi_conf mt8186_conf = {
-       .cal_factor = mt8183_calculate_factor,
+       .dpi_factor = dpi_factor_mt8183,
+       .num_dpi_factor = ARRAY_SIZE(dpi_factor_mt8183),
        .reg_h_fre_con = 0xe0,
        .max_clock_khz = 150000,
        .output_fmts = mt8183_output_fmts,
 };
 
 static const struct mtk_dpi_conf mt8192_conf = {
-       .cal_factor = mt8183_calculate_factor,
+       .dpi_factor = dpi_factor_mt8183,
+       .num_dpi_factor = ARRAY_SIZE(dpi_factor_mt8183),
        .reg_h_fre_con = 0xe0,
        .max_clock_khz = 150000,
        .output_fmts = mt8183_output_fmts,
 };
 
 static const struct mtk_dpi_conf mt8195_dpintf_conf = {
-       .cal_factor = mt8195_dpintf_calculate_factor,
+       .dpi_factor = dpi_factor_mt8195_dp_intf,
+       .num_dpi_factor = ARRAY_SIZE(dpi_factor_mt8195_dp_intf),
        .max_clock_khz = 600000,
        .output_fmts = mt8195_output_fmts,
        .num_output_fmts = ARRAY_SIZE(mt8195_output_fmts),