Skip to content

Commit a31a66f

Browse files
claudiubezneagregkh
authored andcommitted
drm: atmel-hlcdc: enable clock before configuring timing engine
[ Upstream commit 2c1fb9d ] 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] Signed-off-by: Sasha Levin <[email protected]>
1 parent f6eb1d5 commit a31a66f

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
@@ -79,7 +79,11 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
7979
struct videomode vm;
8080
unsigned long prate;
8181
unsigned int cfg;
82-
int div;
82+
int div, ret;
83+
84+
ret = clk_prepare_enable(crtc->dc->hlcdc->sys_clk);
85+
if (ret)
86+
return;
8387

8488
vm.vfront_porch = adj->crtc_vsync_start - adj->crtc_vdisplay;
8589
vm.vback_porch = adj->crtc_vtotal - adj->crtc_vsync_end;
@@ -138,6 +142,8 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
138142
ATMEL_HLCDC_VSPSU | ATMEL_HLCDC_VSPHO |
139143
ATMEL_HLCDC_GUARDTIME_MASK | ATMEL_HLCDC_MODE_MASK,
140144
cfg);
145+
146+
clk_disable_unprepare(crtc->dc->hlcdc->sys_clk);
141147
}
142148

143149
static enum drm_mode_status

0 commit comments

Comments
 (0)