Lines Matching refs:gdp

182 static struct sti_gdp_node_list *sti_gdp_get_free_nodes(struct sti_gdp *gdp)  in sti_gdp_get_free_nodes()  argument
187 hw_nvn = readl(gdp->regs + GAM_GDP_NVN_OFFSET); in sti_gdp_get_free_nodes()
192 if ((hw_nvn != gdp->node_list[i].btm_field_paddr) && in sti_gdp_get_free_nodes()
193 (hw_nvn != gdp->node_list[i].top_field_paddr)) in sti_gdp_get_free_nodes()
194 return &gdp->node_list[i]; in sti_gdp_get_free_nodes()
198 sti_plane_to_str(&gdp->plane), hw_nvn); in sti_gdp_get_free_nodes()
201 return &gdp->node_list[0]; in sti_gdp_get_free_nodes()
214 struct sti_gdp_node_list *sti_gdp_get_current_nodes(struct sti_gdp *gdp) in sti_gdp_get_current_nodes() argument
219 hw_nvn = readl(gdp->regs + GAM_GDP_NVN_OFFSET); in sti_gdp_get_current_nodes()
224 if ((hw_nvn == gdp->node_list[i].btm_field_paddr) || in sti_gdp_get_current_nodes()
225 (hw_nvn == gdp->node_list[i].top_field_paddr)) in sti_gdp_get_current_nodes()
226 return &gdp->node_list[i]; in sti_gdp_get_current_nodes()
230 hw_nvn, sti_plane_to_str(&gdp->plane)); in sti_gdp_get_current_nodes()
241 static void sti_gdp_disable(struct sti_gdp *gdp) in sti_gdp_disable() argument
243 struct drm_plane *drm_plane = &gdp->plane.drm_plane; in sti_gdp_disable()
245 struct sti_compositor *compo = dev_get_drvdata(gdp->dev); in sti_gdp_disable()
248 DRM_DEBUG_DRIVER("%s\n", sti_plane_to_str(&gdp->plane)); in sti_gdp_disable()
252 gdp->node_list[i].top_field->gam_gdp_ppt |= GAM_GDP_PPT_IGNORE; in sti_gdp_disable()
253 gdp->node_list[i].btm_field->gam_gdp_ppt |= GAM_GDP_PPT_IGNORE; in sti_gdp_disable()
257 compo->vtg_main : compo->vtg_aux, &gdp->vtg_field_nb)) in sti_gdp_disable()
260 if (gdp->clk_pix) in sti_gdp_disable()
261 clk_disable_unprepare(gdp->clk_pix); in sti_gdp_disable()
263 gdp->plane.status = STI_PLANE_DISABLED; in sti_gdp_disable()
280 struct sti_gdp *gdp = container_of(nb, struct sti_gdp, vtg_field_nb); in sti_gdp_field_cb() local
282 if (gdp->plane.status == STI_PLANE_FLUSHING) { in sti_gdp_field_cb()
285 sti_plane_to_str(&gdp->plane)); in sti_gdp_field_cb()
287 sti_gdp_disable(gdp); in sti_gdp_field_cb()
292 gdp->is_curr_top = true; in sti_gdp_field_cb()
295 gdp->is_curr_top = false; in sti_gdp_field_cb()
305 static void sti_gdp_init(struct sti_gdp *gdp) in sti_gdp_init() argument
307 struct device_node *np = gdp->dev->of_node; in sti_gdp_init()
315 base = dma_alloc_writecombine(gdp->dev, in sti_gdp_init()
329 gdp->node_list[i].top_field = base; in sti_gdp_init()
330 gdp->node_list[i].top_field_paddr = dma_addr; in sti_gdp_init()
340 gdp->node_list[i].btm_field = base; in sti_gdp_init()
341 gdp->node_list[i].btm_field_paddr = dma_addr; in sti_gdp_init()
351 switch (gdp->plane.desc) { in sti_gdp_init()
369 gdp->clk_pix = devm_clk_get(gdp->dev, clk_name); in sti_gdp_init()
370 if (IS_ERR(gdp->clk_pix)) in sti_gdp_init()
373 gdp->clk_main_parent = devm_clk_get(gdp->dev, "main_parent"); in sti_gdp_init()
374 if (IS_ERR(gdp->clk_main_parent)) in sti_gdp_init()
377 gdp->clk_aux_parent = devm_clk_get(gdp->dev, "aux_parent"); in sti_gdp_init()
378 if (IS_ERR(gdp->clk_aux_parent)) in sti_gdp_init()
388 struct sti_gdp *gdp = to_sti_gdp(plane); in sti_gdp_atomic_update() local
390 struct sti_compositor *compo = dev_get_drvdata(gdp->dev); in sti_gdp_atomic_update()
432 list = sti_gdp_get_free_nodes(gdp); in sti_gdp_atomic_update()
436 dev_dbg(gdp->dev, "%s %s top_node:0x%p btm_node:0x%p\n", __func__, in sti_gdp_atomic_update()
495 &gdp->vtg_field_nb, crtc)) { in sti_gdp_atomic_update()
501 if (gdp->clk_pix) { in sti_gdp_atomic_update()
508 clkp = gdp->clk_main_parent; in sti_gdp_atomic_update()
510 clkp = gdp->clk_aux_parent; in sti_gdp_atomic_update()
513 clk_set_parent(gdp->clk_pix, clkp); in sti_gdp_atomic_update()
515 res = clk_set_rate(gdp->clk_pix, rate); in sti_gdp_atomic_update()
522 if (clk_prepare_enable(gdp->clk_pix)) { in sti_gdp_atomic_update()
538 curr_list = sti_gdp_get_current_nodes(gdp); in sti_gdp_atomic_update()
542 dev_dbg(gdp->dev, "Current NVN:0x%X\n", in sti_gdp_atomic_update()
543 readl(gdp->regs + GAM_GDP_NVN_OFFSET)); in sti_gdp_atomic_update()
544 dev_dbg(gdp->dev, "Posted buff: %lx current buff: %x\n", in sti_gdp_atomic_update()
546 readl(gdp->regs + GAM_GDP_PML_OFFSET)); in sti_gdp_atomic_update()
554 writel(gdp->is_curr_top ? in sti_gdp_atomic_update()
556 gdp->regs + GAM_GDP_NVN_OFFSET); in sti_gdp_atomic_update()
561 if (gdp->is_curr_top) { in sti_gdp_atomic_update()
569 gdp->regs + GAM_GDP_NVN_OFFSET); in sti_gdp_atomic_update()
573 writel(dma_updated_top, gdp->regs + GAM_GDP_NVN_OFFSET); in sti_gdp_atomic_update()
610 struct sti_gdp *gdp; in sti_gdp_create() local
613 gdp = devm_kzalloc(dev, sizeof(*gdp), GFP_KERNEL); in sti_gdp_create()
614 if (!gdp) { in sti_gdp_create()
619 gdp->dev = dev; in sti_gdp_create()
620 gdp->regs = baseaddr; in sti_gdp_create()
621 gdp->plane.desc = desc; in sti_gdp_create()
622 gdp->plane.status = STI_PLANE_DISABLED; in sti_gdp_create()
624 gdp->vtg_field_nb.notifier_call = sti_gdp_field_cb; in sti_gdp_create()
626 sti_gdp_init(gdp); in sti_gdp_create()
628 res = drm_universal_plane_init(drm_dev, &gdp->plane.drm_plane, in sti_gdp_create()
639 drm_plane_helper_add(&gdp->plane.drm_plane, &sti_gdp_helpers_funcs); in sti_gdp_create()
641 sti_plane_init_property(&gdp->plane, type); in sti_gdp_create()
643 return &gdp->plane.drm_plane; in sti_gdp_create()
646 devm_kfree(dev, gdp); in sti_gdp_create()