Lines Matching refs:lcdif
35 static void lcdif_set_formats(struct lcdif_drm_private *lcdif, in lcdif_set_formats() argument
38 struct drm_device *drm = lcdif->drm; in lcdif_set_formats()
39 const u32 format = lcdif->crtc.primary->state->fb->format->format; in lcdif_set_formats()
41 writel(CSC0_CTRL_BYPASS, lcdif->base + LCDC_V8_CSC0_CTRL); in lcdif_set_formats()
46 lcdif->base + LCDC_V8_DISP_PARA); in lcdif_set_formats()
50 lcdif->base + LCDC_V8_DISP_PARA); in lcdif_set_formats()
54 lcdif->base + LCDC_V8_DISP_PARA); in lcdif_set_formats()
64 lcdif->base + LCDC_V8_CSC0_COEF0); in lcdif_set_formats()
66 lcdif->base + LCDC_V8_CSC0_COEF1); in lcdif_set_formats()
68 lcdif->base + LCDC_V8_CSC0_COEF2); in lcdif_set_formats()
70 lcdif->base + LCDC_V8_CSC0_COEF3); in lcdif_set_formats()
72 lcdif->base + LCDC_V8_CSC0_COEF4); in lcdif_set_formats()
74 lcdif->base + LCDC_V8_CSC0_COEF5); in lcdif_set_formats()
77 lcdif->base + LCDC_V8_CSC0_CTRL); in lcdif_set_formats()
88 lcdif->base + LCDC_V8_CTRLDESCL0_5); in lcdif_set_formats()
92 lcdif->base + LCDC_V8_CTRLDESCL0_5); in lcdif_set_formats()
96 lcdif->base + LCDC_V8_CTRLDESCL0_5); in lcdif_set_formats()
100 lcdif->base + LCDC_V8_CTRLDESCL0_5); in lcdif_set_formats()
104 lcdif->base + LCDC_V8_CTRLDESCL0_5); in lcdif_set_formats()
108 lcdif->base + LCDC_V8_CTRLDESCL0_5); in lcdif_set_formats()
116 static void lcdif_set_mode(struct lcdif_drm_private *lcdif, u32 bus_flags) in lcdif_set_mode() argument
118 struct drm_display_mode *m = &lcdif->crtc.state->adjusted_mode; in lcdif_set_mode()
130 writel(ctrl, lcdif->base + LCDC_V8_CTRL); in lcdif_set_mode()
134 lcdif->base + LCDC_V8_DISP_SIZE); in lcdif_set_mode()
138 lcdif->base + LCDC_V8_HSYN_PARA); in lcdif_set_mode()
142 lcdif->base + LCDC_V8_VSYN_PARA); in lcdif_set_mode()
146 lcdif->base + LCDC_V8_VSYN_HSYN_WIDTH); in lcdif_set_mode()
150 lcdif->base + LCDC_V8_CTRLDESCL0_1); in lcdif_set_mode()
162 CTRLDESCL0_3_PITCH(lcdif->crtc.primary->state->fb->pitches[0]); in lcdif_set_mode()
163 writel(ctrl, lcdif->base + LCDC_V8_CTRLDESCL0_3); in lcdif_set_mode()
166 static void lcdif_enable_controller(struct lcdif_drm_private *lcdif) in lcdif_enable_controller() argument
173 lcdif->base + LCDC_V8_PANIC0_THRES); in lcdif_enable_controller()
180 lcdif->base + LCDC_V8_INT_ENABLE_D1); in lcdif_enable_controller()
182 reg = readl(lcdif->base + LCDC_V8_DISP_PARA); in lcdif_enable_controller()
184 writel(reg, lcdif->base + LCDC_V8_DISP_PARA); in lcdif_enable_controller()
186 reg = readl(lcdif->base + LCDC_V8_CTRLDESCL0_5); in lcdif_enable_controller()
188 writel(reg, lcdif->base + LCDC_V8_CTRLDESCL0_5); in lcdif_enable_controller()
191 static void lcdif_disable_controller(struct lcdif_drm_private *lcdif) in lcdif_disable_controller() argument
196 reg = readl(lcdif->base + LCDC_V8_CTRLDESCL0_5); in lcdif_disable_controller()
198 writel(reg, lcdif->base + LCDC_V8_CTRLDESCL0_5); in lcdif_disable_controller()
200 ret = readl_poll_timeout(lcdif->base + LCDC_V8_CTRLDESCL0_5, in lcdif_disable_controller()
204 drm_err(lcdif->drm, "Failed to disable controller!\n"); in lcdif_disable_controller()
206 reg = readl(lcdif->base + LCDC_V8_DISP_PARA); in lcdif_disable_controller()
208 writel(reg, lcdif->base + LCDC_V8_DISP_PARA); in lcdif_disable_controller()
211 writel(0, lcdif->base + LCDC_V8_INT_ENABLE_D1); in lcdif_disable_controller()
214 static void lcdif_reset_block(struct lcdif_drm_private *lcdif) in lcdif_reset_block() argument
216 writel(CTRL_SW_RESET, lcdif->base + LCDC_V8_CTRL + REG_SET); in lcdif_reset_block()
217 readl(lcdif->base + LCDC_V8_CTRL); in lcdif_reset_block()
218 writel(CTRL_SW_RESET, lcdif->base + LCDC_V8_CTRL + REG_CLR); in lcdif_reset_block()
219 readl(lcdif->base + LCDC_V8_CTRL); in lcdif_reset_block()
222 static void lcdif_crtc_mode_set_nofb(struct lcdif_drm_private *lcdif, in lcdif_crtc_mode_set_nofb() argument
226 struct drm_device *drm = lcdif->crtc.dev; in lcdif_crtc_mode_set_nofb()
227 struct drm_display_mode *m = &lcdif->crtc.state->adjusted_mode; in lcdif_crtc_mode_set_nofb()
230 if (lcdif->bridge && lcdif->bridge->timings) in lcdif_crtc_mode_set_nofb()
231 bus_flags = lcdif->bridge->timings->input_bus_flags; in lcdif_crtc_mode_set_nofb()
237 (int)(clk_get_rate(lcdif->clk) / 1000)); in lcdif_crtc_mode_set_nofb()
243 lcdif_reset_block(lcdif); in lcdif_crtc_mode_set_nofb()
245 lcdif_set_formats(lcdif, bus_format); in lcdif_crtc_mode_set_nofb()
247 lcdif_set_mode(lcdif, bus_flags); in lcdif_crtc_mode_set_nofb()
268 struct lcdif_drm_private *lcdif = to_lcdif_drm_private(crtc->dev); in lcdif_crtc_atomic_flush() local
272 reg = readl(lcdif->base + LCDC_V8_CTRLDESCL0_5); in lcdif_crtc_atomic_flush()
274 writel(reg, lcdif->base + LCDC_V8_CTRLDESCL0_5); in lcdif_crtc_atomic_flush()
293 struct lcdif_drm_private *lcdif = to_lcdif_drm_private(crtc->dev); in lcdif_crtc_atomic_enable() local
296 struct drm_display_mode *m = &lcdif->crtc.state->adjusted_mode; in lcdif_crtc_atomic_enable()
298 struct drm_device *drm = lcdif->drm; in lcdif_crtc_atomic_enable()
303 if (lcdif->bridge) { in lcdif_crtc_atomic_enable()
306 lcdif->bridge); in lcdif_crtc_atomic_enable()
324 clk_set_rate(lcdif->clk, m->crtc_clock * 1000); in lcdif_crtc_atomic_enable()
328 lcdif_crtc_mode_set_nofb(lcdif, bridge_state, bus_format); in lcdif_crtc_atomic_enable()
334 lcdif->base + LCDC_V8_CTRLDESCL_LOW0_4); in lcdif_crtc_atomic_enable()
336 lcdif->base + LCDC_V8_CTRLDESCL_HIGH0_4); in lcdif_crtc_atomic_enable()
338 lcdif_enable_controller(lcdif); in lcdif_crtc_atomic_enable()
346 struct lcdif_drm_private *lcdif = to_lcdif_drm_private(crtc->dev); in lcdif_crtc_atomic_disable() local
347 struct drm_device *drm = lcdif->drm; in lcdif_crtc_atomic_disable()
352 lcdif_disable_controller(lcdif); in lcdif_crtc_atomic_disable()
367 struct lcdif_drm_private *lcdif = to_lcdif_drm_private(crtc->dev); in lcdif_crtc_enable_vblank() local
370 writel(INT_STATUS_D0_VS_BLANK, lcdif->base + LCDC_V8_INT_STATUS_D0); in lcdif_crtc_enable_vblank()
371 writel(INT_ENABLE_D0_VS_BLANK_EN, lcdif->base + LCDC_V8_INT_ENABLE_D0); in lcdif_crtc_enable_vblank()
378 struct lcdif_drm_private *lcdif = to_lcdif_drm_private(crtc->dev); in lcdif_crtc_disable_vblank() local
381 writel(0, lcdif->base + LCDC_V8_INT_ENABLE_D0); in lcdif_crtc_disable_vblank()
382 writel(INT_STATUS_D0_VS_BLANK, lcdif->base + LCDC_V8_INT_STATUS_D0); in lcdif_crtc_disable_vblank()
420 struct lcdif_drm_private *lcdif = to_lcdif_drm_private(plane->dev); in lcdif_plane_atomic_check() local
424 &lcdif->crtc); in lcdif_plane_atomic_check()
435 struct lcdif_drm_private *lcdif = to_lcdif_drm_private(plane->dev); in lcdif_plane_primary_atomic_update() local
443 lcdif->base + LCDC_V8_CTRLDESCL_LOW0_4); in lcdif_plane_primary_atomic_update()
445 lcdif->base + LCDC_V8_CTRLDESCL_HIGH0_4); in lcdif_plane_primary_atomic_update()
489 int lcdif_kms_init(struct lcdif_drm_private *lcdif) in lcdif_kms_init() argument
491 struct drm_encoder *encoder = &lcdif->encoder; in lcdif_kms_init()
492 struct drm_crtc *crtc = &lcdif->crtc; in lcdif_kms_init()
495 drm_plane_helper_add(&lcdif->planes.primary, in lcdif_kms_init()
497 ret = drm_universal_plane_init(lcdif->drm, &lcdif->planes.primary, 1, in lcdif_kms_init()
507 ret = drm_crtc_init_with_planes(lcdif->drm, crtc, in lcdif_kms_init()
508 &lcdif->planes.primary, NULL, in lcdif_kms_init()
514 return drm_encoder_init(lcdif->drm, encoder, &lcdif_encoder_funcs, in lcdif_kms_init()