Skip to content

Commit 5d6e14f

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 24e9e6b commit 5d6e14f

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
@@ -81,7 +81,11 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
8181
struct videomode vm;
8282
unsigned long prate;
8383
unsigned int cfg;
84-
int div;
84+
int div, ret;
85+
86+
ret = clk_prepare_enable(crtc->dc->hlcdc->sys_clk);
87+
if (ret)
88+
return;
8589

8690
vm.vfront_porch = adj->crtc_vsync_start - adj->crtc_vdisplay;
8791
vm.vback_porch = adj->crtc_vtotal - adj->crtc_vsync_end;
@@ -140,6 +144,8 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
140144
ATMEL_HLCDC_VSPSU | ATMEL_HLCDC_VSPHO |
141145
ATMEL_HLCDC_GUARDTIME_MASK | ATMEL_HLCDC_MODE_MASK,
142146
cfg);
147+
148+
clk_disable_unprepare(crtc->dc->hlcdc->sys_clk);
143149
}
144150

145151
static bool atmel_hlcdc_crtc_mode_fixup(struct drm_crtc *c,

0 commit comments

Comments
 (0)