Skip to content

Commit 2c1fb9d

Browse files
claudiubezneasravnborg
authored andcommitted
drm: atmel-hlcdc: enable clock before configuring timing engine
Changing pixel clock source without having this clock source enabled will block the timing engine and the next operations after (in this case setting ATMEL_HLCDC_CFG(5) settings in atmel_hlcdc_crtc_mode_set_nofb() will fail). It is recomended (although in datasheet this is not present) to actually enabled pixel clock source before doing any changes on timing enginge (only SAM9X60 datasheet specifies that the peripheral clock and pixel clock must be enabled before using LCD controller). Fixes: 1a39678 ("drm: add Atmel HLCDC Display Controller support") Signed-off-by: Claudiu Beznea <[email protected]> Signed-off-by: Sam Ravnborg <[email protected]> Cc: Boris Brezillon <[email protected]> Cc: <[email protected]> # v4.0+ Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 07acf4b commit 2c1fb9d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
7373
unsigned long prate;
7474
unsigned int mask = ATMEL_HLCDC_CLKDIV_MASK | ATMEL_HLCDC_CLKPOL;
7575
unsigned int cfg = 0;
76-
int div;
76+
int div, ret;
77+
78+
ret = clk_prepare_enable(crtc->dc->hlcdc->sys_clk);
79+
if (ret)
80+
return;
7781

7882
vm.vfront_porch = adj->crtc_vsync_start - adj->crtc_vdisplay;
7983
vm.vback_porch = adj->crtc_vtotal - adj->crtc_vsync_end;
@@ -147,6 +151,8 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
147151
ATMEL_HLCDC_VSPSU | ATMEL_HLCDC_VSPHO |
148152
ATMEL_HLCDC_GUARDTIME_MASK | ATMEL_HLCDC_MODE_MASK,
149153
cfg);
154+
155+
clk_disable_unprepare(crtc->dc->hlcdc->sys_clk);
150156
}
151157

152158
static enum drm_mode_status

0 commit comments

Comments
 (0)