@@ -120,6 +120,7 @@ struct mtk_dpi_yc_limit {
120
120
struct mtk_dpi_conf {
121
121
unsigned int (* cal_factor )(int clock );
122
122
u32 reg_h_fre_con ;
123
+ u32 max_clock_khz ;
123
124
bool edge_sel_en ;
124
125
};
125
126
@@ -557,9 +558,23 @@ static void mtk_dpi_bridge_enable(struct drm_bridge *bridge)
557
558
mtk_dpi_set_display_mode (dpi , & dpi -> mode );
558
559
}
559
560
561
+ static enum drm_mode_status
562
+ mtk_dpi_bridge_mode_valid (struct drm_bridge * bridge ,
563
+ const struct drm_display_info * info ,
564
+ const struct drm_display_mode * mode )
565
+ {
566
+ struct mtk_dpi * dpi = bridge_to_dpi (bridge );
567
+
568
+ if (mode -> clock > dpi -> conf -> max_clock_khz )
569
+ return MODE_CLOCK_HIGH ;
570
+
571
+ return MODE_OK ;
572
+ }
573
+
560
574
static const struct drm_bridge_funcs mtk_dpi_bridge_funcs = {
561
575
.attach = mtk_dpi_bridge_attach ,
562
576
.mode_set = mtk_dpi_bridge_mode_set ,
577
+ .mode_valid = mtk_dpi_bridge_mode_valid ,
563
578
.disable = mtk_dpi_bridge_disable ,
564
579
.enable = mtk_dpi_bridge_enable ,
565
580
};
@@ -668,17 +683,20 @@ static unsigned int mt8183_calculate_factor(int clock)
668
683
static const struct mtk_dpi_conf mt8173_conf = {
669
684
.cal_factor = mt8173_calculate_factor ,
670
685
.reg_h_fre_con = 0xe0 ,
686
+ .max_clock_khz = 300000 ,
671
687
};
672
688
673
689
static const struct mtk_dpi_conf mt2701_conf = {
674
690
.cal_factor = mt2701_calculate_factor ,
675
691
.reg_h_fre_con = 0xb0 ,
676
692
.edge_sel_en = true,
693
+ .max_clock_khz = 150000 ,
677
694
};
678
695
679
696
static const struct mtk_dpi_conf mt8183_conf = {
680
697
.cal_factor = mt8183_calculate_factor ,
681
698
.reg_h_fre_con = 0xe0 ,
699
+ .max_clock_khz = 100000 ,
682
700
};
683
701
684
702
static int mtk_dpi_probe (struct platform_device * pdev )
0 commit comments