@@ -57,14 +57,21 @@ void dcp_drm_crtc_vblank(struct apple_crtc *crtc)
5757void dcp_set_dimensions (struct apple_dcp * dcp )
5858{
5959 int i ;
60+ int width_mm = dcp -> width_mm ;
61+ int height_mm = dcp -> height_mm ;
62+
63+ if (width_mm == 0 || height_mm == 0 ) {
64+ width_mm = dcp -> panel .width_mm ;
65+ height_mm = dcp -> panel .height_mm ;
66+ }
6067
6168 /* Set the connector info */
6269 if (dcp -> connector ) {
6370 struct drm_connector * connector = & dcp -> connector -> base ;
6471
6572 mutex_lock (& connector -> dev -> mode_config .mutex );
66- connector -> display_info .width_mm = dcp -> width_mm ;
67- connector -> display_info .height_mm = dcp -> height_mm ;
73+ connector -> display_info .width_mm = width_mm ;
74+ connector -> display_info .height_mm = height_mm ;
6875 mutex_unlock (& connector -> dev -> mode_config .mutex );
6976 }
7077
@@ -74,8 +81,8 @@ void dcp_set_dimensions(struct apple_dcp *dcp)
7481 * DisplayAttributes, and TimingElements may be sent first
7582 */
7683 for (i = 0 ; i < dcp -> nr_modes ; ++ i ) {
77- dcp -> modes [i ].mode .width_mm = dcp -> width_mm ;
78- dcp -> modes [i ].mode .height_mm = dcp -> height_mm ;
84+ dcp -> modes [i ].mode .width_mm = width_mm ;
85+ dcp -> modes [i ].mode .height_mm = height_mm ;
7986 }
8087}
8188
@@ -434,7 +441,7 @@ static int dcp_comp_bind(struct device *dev, struct device *main, void *data)
434441 dcp -> brightness .scale = 65536 ;
435442 panel_np = of_get_compatible_child (dev -> of_node , "apple,panel-mini-led" );
436443 if (panel_np )
437- dcp -> has_mini_led = true;
444+ dcp -> panel . has_mini_led = true;
438445 else
439446 panel_np = of_get_compatible_child (dev -> of_node , "apple,panel" );
440447
@@ -448,10 +455,10 @@ static int dcp_comp_bind(struct device *dev, struct device *main, void *data)
448455 dev_err (dev , "Missing property 'apple,max-brightness'\n" );
449456 }
450457
451- of_property_read_u32 (panel_np , "width-mm" , & dcp -> width_mm );
458+ of_property_read_u32 (panel_np , "width-mm" , & dcp -> panel . width_mm );
452459 /* use adjusted height as long as the notch is hidden */
453460 of_property_read_u32 (panel_np , height_prop [!dcp -> notch_height ],
454- & dcp -> height_mm );
461+ & dcp -> panel . height_mm );
455462
456463 of_node_put (panel_np );
457464 dcp -> connector_type = DRM_MODE_CONNECTOR_eDP ;
0 commit comments