@@ -222,8 +222,14 @@ static int ade_power_down(struct hisi_drm_ade_crtc *crtc_ade)
222
222
223
223
static int hisi_drm_crtc_ade_enable (struct hisi_drm_ade_crtc * crtc_ade )
224
224
{
225
+ struct drm_framebuffer * fb = crtc_ade -> crtc .primary -> fb ;
225
226
int ret ;
226
227
228
+ if (fb -> width != crtc_ade -> dmode -> hdisplay ) {
229
+ DRM_ERROR ("mode and fb width don't match\n" );
230
+ return - EINVAL ;
231
+ }
232
+
227
233
if (!crtc_ade -> power_on ) {
228
234
ret = ade_power_up (crtc_ade );
229
235
if (ret ) {
@@ -235,8 +241,9 @@ static int hisi_drm_crtc_ade_enable(struct hisi_drm_ade_crtc *crtc_ade)
235
241
ade_set_medianoc_qos (crtc_ade );
236
242
ade_init (crtc_ade );
237
243
ldi_init (crtc_ade );
238
- if (crtc_ade -> crtc . primary -> fb )
244
+ if (fb )
239
245
hisi_drm_crtc_mode_set_base (& crtc_ade -> crtc , 0 , 0 , NULL );
246
+
240
247
return 0 ;
241
248
}
242
249
@@ -323,17 +330,19 @@ static void hisi_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
323
330
{
324
331
struct hisi_drm_ade_crtc * crtc_ade = to_hisi_crtc (crtc );
325
332
bool enable = (mode == DRM_MODE_DPMS_ON );
333
+ int ret ;
326
334
327
335
DRM_DEBUG_DRIVER ("crtc_dpms enter successfully.\n" );
328
336
if (crtc_ade -> enable == enable )
329
337
return ;
330
338
331
339
if (enable )
332
- hisi_drm_crtc_ade_enable (crtc_ade );
340
+ ret = hisi_drm_crtc_ade_enable (crtc_ade );
333
341
else
334
- hisi_drm_crtc_ade_disable (crtc_ade );
342
+ ret = hisi_drm_crtc_ade_disable (crtc_ade );
335
343
336
- crtc_ade -> enable = enable ;
344
+ if (!ret )
345
+ crtc_ade -> enable = enable ;
337
346
DRM_DEBUG_DRIVER ("crtc_dpms exit successfully.\n" );
338
347
}
339
348
0 commit comments