@@ -41,56 +41,6 @@ struct rockchip_hdmi {
4141
4242#define to_rockchip_hdmi (x ) container_of(x, struct rockchip_hdmi, x)
4343
44- #define CLK_SLOP (clk ) ((clk) / 1000)
45- #define CLK_PLUS_SLOP (clk ) ((clk) + CLK_SLOP(clk))
46-
47- static const int dw_hdmi_rates [] = {
48- 25176471 , /* for 25.175 MHz, 0.006% off */
49- 25200000 ,
50- 27000000 ,
51- 28320000 ,
52- 30240000 ,
53- 31500000 ,
54- 32000000 ,
55- 33750000 ,
56- 36000000 ,
57- 40000000 ,
58- 49500000 ,
59- 50000000 ,
60- 54000000 ,
61- 57290323 , /* for 57.284 MHz, .011 % off */
62- 65000000 ,
63- 68250000 ,
64- 71000000 ,
65- 72000000 ,
66- 73250000 ,
67- 74250000 ,
68- 74437500 , /* for 74.44 MHz, .003% off */
69- 75000000 ,
70- 78750000 ,
71- 78800000 ,
72- 79500000 ,
73- 83500000 ,
74- 85500000 ,
75- 88750000 ,
76- 97750000 ,
77- 101000000 ,
78- 106500000 ,
79- 108000000 ,
80- 115500000 ,
81- 118666667 , /* for 118.68 MHz, .011% off */
82- 119000000 ,
83- 121714286 , /* for 121.75 MHz, .029% off */
84- 135000000 ,
85- 136800000 , /* for 136.75 MHz, .037% off */
86- 146250000 ,
87- 148500000 ,
88- 154000000 ,
89- 162000000 ,
90- 297000000 ,
91- 594000000 ,
92- };
93-
9444/*
9545 * There are some rates that would be ranged for better clock jitter at
9646 * Chrome OS tree, like 25.175Mhz would range to 25.170732Mhz. But due
@@ -266,14 +216,11 @@ static enum drm_mode_status
266216dw_hdmi_rockchip_mode_valid (struct drm_connector * connector ,
267217 struct drm_display_mode * mode )
268218{
269- int pclk = mode -> clock * 1000 ;
270- int num_rates = ARRAY_SIZE (dw_hdmi_rates );
271219 struct drm_encoder * encoder = connector -> encoder ;
272220 enum drm_mode_status status = MODE_OK ;
273221 struct drm_device * dev = connector -> dev ;
274222 struct rockchip_drm_private * priv = dev -> dev_private ;
275223 struct drm_crtc * crtc ;
276- int i ;
277224
278225 /*
279226 * Pixel clocks we support are always < 2GHz and so fit in an
@@ -283,14 +230,6 @@ dw_hdmi_rockchip_mode_valid(struct drm_connector *connector,
283230 if (mode -> clock > INT_MAX / 1000 )
284231 return MODE_BAD ;
285232
286- for (i = 0 ; i < num_rates ; i ++ ) {
287- int slop = CLK_SLOP (pclk );
288-
289- if ((pclk >= dw_hdmi_rates [i ] - slop ) &&
290- (pclk <= dw_hdmi_rates [i ] + slop ))
291- return MODE_BAD ;
292- }
293-
294233 if (!encoder ) {
295234 const struct drm_connector_helper_funcs * funcs ;
296235
@@ -336,46 +275,6 @@ static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder)
336275{
337276}
338277
339- static bool
340- dw_hdmi_rockchip_encoder_mode_fixup (struct drm_encoder * encoder ,
341- const struct drm_display_mode * mode ,
342- struct drm_display_mode * adj_mode )
343- {
344- struct rockchip_hdmi * hdmi = to_rockchip_hdmi (encoder );
345- int pclk = adj_mode -> clock * 1000 ;
346- int best_diff = INT_MAX ;
347- int best_clock = 0 ;
348- int slop ;
349- int i ;
350-
351- /* Pick the best clock */
352- for (i = 0 ; i < ARRAY_SIZE (dw_hdmi_rates ); i ++ ) {
353- int diff = dw_hdmi_rates [i ] - pclk ;
354-
355- if (diff < 0 )
356- diff = - diff ;
357- if (diff < best_diff ) {
358- best_diff = diff ;
359- best_clock = dw_hdmi_rates [i ];
360-
361- /* Bail early if we're exact */
362- if (best_diff == 0 )
363- return true;
364- }
365- }
366-
367- /* Double check that it's OK */
368- slop = CLK_SLOP (pclk );
369- if ((pclk >= best_clock - slop ) && (pclk <= best_clock + slop )) {
370- adj_mode -> clock = DIV_ROUND_UP (best_clock , 1000 );
371- return true;
372- }
373-
374- /* Shoudn't be here; we should have said rate wasn't valid */
375- dev_warn (hdmi -> dev , "tried to set invalid rate %d\n" , adj_mode -> clock );
376- return false;
377- }
378-
379278static void dw_hdmi_rockchip_encoder_mode_set (struct drm_encoder * encoder ,
380279 struct drm_display_mode * mode ,
381280 struct drm_display_mode * adj_mode )
@@ -439,7 +338,6 @@ dw_hdmi_rockchip_encoder_atomic_check(struct drm_encoder *encoder,
439338}
440339
441340static const struct drm_encoder_helper_funcs dw_hdmi_rockchip_encoder_helper_funcs = {
442- .mode_fixup = dw_hdmi_rockchip_encoder_mode_fixup ,
443341 .mode_set = dw_hdmi_rockchip_encoder_mode_set ,
444342 .enable = dw_hdmi_rockchip_encoder_enable ,
445343 .disable = dw_hdmi_rockchip_encoder_disable ,
0 commit comments