@@ -1821,6 +1821,7 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
1821
1821
struct drm_connector * connector = & vc4_hdmi -> connector ;
1822
1822
struct drm_connector_state * old_conn_state = drm_atomic_get_old_connector_state (conn_state -> state , connector );
1823
1823
struct vc4_hdmi_connector_state * old_vc4_state = conn_state_to_vc4_hdmi_conn_state (old_conn_state );
1824
+ struct vc4_dev * vc4 = to_vc4_dev (connector -> dev );
1824
1825
unsigned long long pixel_rate = mode -> clock * 1000 ;
1825
1826
unsigned long long tmds_rate ;
1826
1827
int ret ;
@@ -1845,6 +1846,12 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
1845
1846
return - EINVAL ;
1846
1847
}
1847
1848
1849
+ /* 4096x2160@60 is not reliable without overclocking core */
1850
+ if (mode -> hdisplay > 3840 && mode -> vdisplay >= 2160 &&
1851
+ drm_mode_vrefresh (mode ) >= 50 &&
1852
+ !vc4 -> hvs -> vc5_hdmi_enable_4096by2160 )
1853
+ return - EINVAL ;
1854
+
1848
1855
/*
1849
1856
* The 1440p@60 pixel rate is in the same range than the first
1850
1857
* WiFi channel (between 2.4GHz and 2.422GHz with 22MHz
@@ -1876,13 +1883,20 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encoder,
1876
1883
const struct drm_display_mode * mode )
1877
1884
{
1878
1885
struct vc4_hdmi * vc4_hdmi = encoder_to_vc4_hdmi (encoder );
1886
+ const struct drm_connector * connector = & vc4_hdmi -> connector ;
1887
+ struct vc4_dev * vc4 = to_vc4_dev (connector -> dev );
1879
1888
1880
1889
if (vc4_hdmi -> variant -> unsupported_odd_h_timings &&
1881
1890
!(mode -> flags & DRM_MODE_FLAG_DBLCLK ) &&
1882
1891
((mode -> hdisplay % 2 ) || (mode -> hsync_start % 2 ) ||
1883
1892
(mode -> hsync_end % 2 ) || (mode -> htotal % 2 )))
1884
1893
return MODE_H_ILLEGAL ;
1885
1894
1895
+ if (mode -> hdisplay > 3840 && mode -> vdisplay >= 2160 &&
1896
+ drm_mode_vrefresh (mode ) >= 50 &&
1897
+ !vc4 -> hvs -> vc5_hdmi_enable_4096by2160 )
1898
+ return MODE_CLOCK_HIGH ;
1899
+
1886
1900
return vc4_hdmi_encoder_clock_valid (vc4_hdmi , mode -> clock * 1000 );
1887
1901
}
1888
1902
0 commit comments