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