Lines Matching full:hvs

7  * DOC: VC4 HVS module.
9 * The Hardware Video Scaler (HVS) is the piece of hardware that does
16 * There is a single global HVS, with multiple output FIFOs that can
18 * the HVS, while the vc4_crtc.c code actually drives HVS setup for
204 void vc4_hvs_dump_state(struct vc4_hvs *hvs) in vc4_hvs_dump_state() argument
206 struct drm_device *drm = &hvs->vc4->base; in vc4_hvs_dump_state()
207 struct drm_printer p = drm_info_printer(&hvs->pdev->dev); in vc4_hvs_dump_state()
213 drm_print_regset32(&p, &hvs->regset); in vc4_hvs_dump_state()
215 DRM_INFO("HVS ctx:\n"); in vc4_hvs_dump_state()
219 readl((u32 __iomem *)hvs->dlist + i + 0), in vc4_hvs_dump_state()
220 readl((u32 __iomem *)hvs->dlist + i + 1), in vc4_hvs_dump_state()
221 readl((u32 __iomem *)hvs->dlist + i + 2), in vc4_hvs_dump_state()
222 readl((u32 __iomem *)hvs->dlist + i + 3)); in vc4_hvs_dump_state()
245 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_debugfs_dlist() local
247 unsigned int dlist_mem_size = hvs->dlist_mem_size; in vc4_hvs_debugfs_dlist()
257 drm_printf(&p, "HVS chan %u disabled\n", i); in vc4_hvs_debugfs_dlist()
261 drm_printf(&p, "HVS chan %u:\n", i); in vc4_hvs_debugfs_dlist()
265 dlist_word = readl((u32 __iomem *)vc4->hvs->dlist + j); in vc4_hvs_debugfs_dlist()
287 struct vc4_hvs *hvs = vc4->hvs; in vc6_hvs_debugfs_dlist() local
289 unsigned int dlist_mem_size = hvs->dlist_mem_size; in vc6_hvs_debugfs_dlist()
301 drm_printf(&p, "HVS chan %u disabled\n", i); in vc6_hvs_debugfs_dlist()
305 drm_printf(&p, "HVS chan %u:\n", i); in vc6_hvs_debugfs_dlist()
314 dlist_word = readl((u32 __iomem *)vc4->hvs->dlist + j); in vc6_hvs_debugfs_dlist()
336 struct vc4_hvs *hvs = vc4->hvs; in vc6_hvs_debugfs_upm_allocs() local
343 refcount = &hvs->upm_refcounts[i]; in vc6_hvs_debugfs_upm_allocs()
386 static int vc4_hvs_upload_linear_kernel(struct vc4_hvs *hvs, in vc4_hvs_upload_linear_kernel() argument
398 ret = drm_mm_insert_node(&hvs->dlist_mm, space, VC4_KERNEL_DWORDS); in vc4_hvs_upload_linear_kernel()
400 drm_err(&hvs->vc4->base, "Failed to allocate space for filter kernel: %d\n", in vc4_hvs_upload_linear_kernel()
405 dst_kernel = hvs->dlist + space->start; in vc4_hvs_upload_linear_kernel()
419 static void vc4_hvs_lut_load(struct vc4_hvs *hvs, in vc4_hvs_lut_load() argument
422 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_lut_load()
434 if (hvs->vc4->gen != VC4_GEN_4) in vc4_hvs_lut_load()
437 /* The LUT memory is laid out with each HVS channel in order, in vc4_hvs_lut_load()
456 static void vc4_hvs_update_gamma_lut(struct vc4_hvs *hvs, in vc4_hvs_update_gamma_lut() argument
470 vc4_hvs_lut_load(hvs, vc4_crtc); in vc4_hvs_update_gamma_lut()
473 u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, unsigned int fifo) in vc4_hvs_get_fifo_frame_count() argument
475 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_get_fifo_frame_count()
532 int vc4_hvs_get_fifo_from_output(struct vc4_hvs *hvs, unsigned int output) in vc4_hvs_get_fifo_from_output() argument
534 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_get_fifo_from_output()
618 static int vc4_hvs_init_channel(struct vc4_hvs *hvs, struct drm_crtc *crtc, in vc4_hvs_init_channel() argument
621 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_init_channel()
676 vc4_hvs_lut_load(hvs, vc4_crtc); in vc4_hvs_init_channel()
683 static int vc6_hvs_init_channel(struct vc4_hvs *hvs, struct drm_crtc *crtc, in vc6_hvs_init_channel() argument
686 struct vc4_dev *vc4 = hvs->vc4; in vc6_hvs_init_channel()
719 static void __vc4_hvs_stop_channel(struct vc4_hvs *hvs, unsigned int chan) in __vc4_hvs_stop_channel() argument
721 struct vc4_dev *vc4 = hvs->vc4; in __vc4_hvs_stop_channel()
751 static void __vc6_hvs_stop_channel(struct vc4_hvs *hvs, unsigned int chan) in __vc6_hvs_stop_channel() argument
753 struct vc4_dev *vc4 = hvs->vc4; in __vc6_hvs_stop_channel()
779 void vc4_hvs_stop_channel(struct vc4_hvs *hvs, unsigned int chan) in vc4_hvs_stop_channel() argument
781 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_stop_channel()
784 __vc6_hvs_stop_channel(hvs, chan); in vc4_hvs_stop_channel()
786 __vc4_hvs_stop_channel(hvs, chan); in vc4_hvs_stop_channel()
822 spin_lock_irqsave(&vc4->hvs->mm_lock, flags); in vc4_hvs_atomic_check()
823 ret = drm_mm_insert_node(&vc4->hvs->dlist_mm, &vc4_state->mm, in vc4_hvs_atomic_check()
825 spin_unlock_irqrestore(&vc4->hvs->mm_lock, flags); in vc4_hvs_atomic_check()
838 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_install_dlist() local
908 vc6_hvs_init_channel(vc4->hvs, crtc, mode, oneshot); in vc4_hvs_atomic_enable()
910 vc4_hvs_init_channel(vc4->hvs, crtc, mode, oneshot); in vc4_hvs_atomic_enable()
922 vc4_hvs_stop_channel(vc4->hvs, chan); in vc4_hvs_atomic_disable()
932 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_atomic_flush() local
940 u32 __iomem *dlist_start = vc4->hvs->dlist + vc4_state->mm.start; in vc4_hvs_atomic_flush()
957 DRM_INFO("CRTC %d HVS before:\n", drm_crtc_index(crtc)); in vc4_hvs_atomic_flush()
958 vc4_hvs_dump_state(hvs); in vc4_hvs_atomic_flush()
1035 vc4_hvs_update_gamma_lut(hvs, vc4_crtc); in vc4_hvs_atomic_flush()
1048 DRM_INFO("CRTC %d HVS after:\n", drm_crtc_index(crtc)); in vc4_hvs_atomic_flush()
1049 vc4_hvs_dump_state(hvs); in vc4_hvs_atomic_flush()
1056 void vc4_hvs_mask_underrun(struct vc4_hvs *hvs, int channel) in vc4_hvs_mask_underrun() argument
1058 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_mask_underrun()
1078 void vc4_hvs_unmask_underrun(struct vc4_hvs *hvs, int channel) in vc4_hvs_unmask_underrun() argument
1080 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_unmask_underrun()
1107 DRM_DEV_ERROR(dev->dev, "HVS underrun\n"); in vc4_hvs_report_underrun()
1114 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_irq_handler() local
1145 vc4_hvs_mask_underrun(hvs, channel); in vc4_hvs_irq_handler()
1164 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_debugfs_init() local
1166 if (!vc4->hvs) in vc4_hvs_debugfs_init()
1183 vc4_debugfs_add_regset32(drm, "hvs_regs", &hvs->regset); in vc4_hvs_debugfs_init()
1193 struct vc4_hvs *hvs; in __vc4_hvs_alloc() local
1199 hvs = drmm_kzalloc(drm, sizeof(*hvs), GFP_KERNEL); in __vc4_hvs_alloc()
1200 if (!hvs) in __vc4_hvs_alloc()
1203 hvs->vc4 = vc4; in __vc4_hvs_alloc()
1204 hvs->regs = regs; in __vc4_hvs_alloc()
1205 hvs->pdev = pdev; in __vc4_hvs_alloc()
1207 spin_lock_init(&hvs->mm_lock); in __vc4_hvs_alloc()
1212 /* Set up the HVS display list memory manager. We never in __vc4_hvs_alloc()
1236 refcount_set(&hvs->upm_refcounts[i].refcount, 0); in __vc4_hvs_alloc()
1237 hvs->upm_refcounts[i].hvs = hvs; in __vc4_hvs_alloc()
1247 drm_mm_init(&hvs->dlist_mm, dlist_start, dlist_size); in __vc4_hvs_alloc()
1249 hvs->dlist_mem_size = dlist_size; in __vc4_hvs_alloc()
1251 /* Set up the HVS LBM memory manager. We could have some more in __vc4_hvs_alloc()
1282 drm_mm_init(&hvs->lbm_mm, 0, lbm_size); in __vc4_hvs_alloc()
1285 ida_init(&hvs->upm_handles); in __vc4_hvs_alloc()
1294 drm_mm_init(&hvs->upm_mm, 0, 1024 * HVS_UBM_WORD_SIZE); in __vc4_hvs_alloc()
1298 vc4->hvs = hvs; in __vc4_hvs_alloc()
1300 return hvs; in __vc4_hvs_alloc()
1303 static int vc4_hvs_hw_init(struct vc4_hvs *hvs) in vc4_hvs_hw_init() argument
1305 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_hw_init()
1477 static int vc6_hvs_hw_init(struct vc4_hvs *hvs) in vc6_hvs_hw_init() argument
1487 /* Set HVS arbiter priority to max */ in vc6_hvs_hw_init()
1491 if (hvs->vc4->gen == VC4_GEN_6_C) { in vc6_hvs_hw_init()
1533 static int vc4_hvs_cob_init(struct vc4_hvs *hvs) in vc4_hvs_cob_init() argument
1535 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_cob_init()
1635 struct vc4_hvs *hvs = NULL; in vc4_hvs_bind() local
1643 hvs = __vc4_hvs_alloc(vc4, regs, pdev); in vc4_hvs_bind()
1644 if (IS_ERR(hvs)) in vc4_hvs_bind()
1645 return PTR_ERR(hvs); in vc4_hvs_bind()
1647 hvs->regset.base = hvs->regs; in vc4_hvs_bind()
1650 hvs->regset.regs = vc6_hvs_regs; in vc4_hvs_bind()
1651 hvs->regset.nregs = ARRAY_SIZE(vc6_hvs_regs); in vc4_hvs_bind()
1656 hvs->regset.regs = vc6_d_hvs_regs; in vc4_hvs_bind()
1657 hvs->regset.nregs = ARRAY_SIZE(vc6_d_hvs_regs); in vc4_hvs_bind()
1660 hvs->regset.regs = vc4_hvs_regs; in vc4_hvs_bind()
1661 hvs->regset.nregs = ARRAY_SIZE(vc4_hvs_regs); in vc4_hvs_bind()
1678 hvs->core_clk = devm_clk_get(&pdev->dev, in vc4_hvs_bind()
1680 if (IS_ERR(hvs->core_clk)) { in vc4_hvs_bind()
1682 return PTR_ERR(hvs->core_clk); in vc4_hvs_bind()
1685 hvs->disp_clk = devm_clk_get(&pdev->dev, in vc4_hvs_bind()
1687 if (IS_ERR(hvs->disp_clk)) { in vc4_hvs_bind()
1689 return PTR_ERR(hvs->disp_clk); in vc4_hvs_bind()
1696 hvs->vc5_hdmi_enable_hdmi_20 = true; in vc4_hvs_bind()
1699 hvs->vc5_hdmi_enable_4096by2160 = true; in vc4_hvs_bind()
1701 hvs->max_core_rate = max_rate; in vc4_hvs_bind()
1703 ret = clk_prepare_enable(hvs->core_clk); in vc4_hvs_bind()
1709 ret = clk_prepare_enable(hvs->disp_clk); in vc4_hvs_bind()
1717 hvs->dlist = hvs->regs + SCALER5_DLIST_START; in vc4_hvs_bind()
1719 hvs->dlist = hvs->regs + SCALER_DLIST_START; in vc4_hvs_bind()
1722 ret = vc6_hvs_hw_init(hvs); in vc4_hvs_bind()
1724 ret = vc4_hvs_hw_init(hvs); in vc4_hvs_bind()
1731 ret = vc4_hvs_upload_linear_kernel(hvs, in vc4_hvs_bind()
1732 &hvs->mitchell_netravali_filter, in vc4_hvs_bind()
1737 ret = vc4_hvs_cob_init(hvs); in vc4_hvs_bind()
1743 vc4_hvs_irq_handler, 0, "vc4 hvs", drm); in vc4_hvs_bind()
1756 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_unbind() local
1759 if (drm_mm_node_allocated(&vc4->hvs->mitchell_netravali_filter)) in vc4_hvs_unbind()
1760 drm_mm_remove_node(&vc4->hvs->mitchell_netravali_filter); in vc4_hvs_unbind()
1762 drm_mm_for_each_node_safe(node, next, &vc4->hvs->dlist_mm) in vc4_hvs_unbind()
1765 drm_mm_takedown(&vc4->hvs->dlist_mm); in vc4_hvs_unbind()
1767 drm_mm_for_each_node_safe(node, next, &vc4->hvs->lbm_mm) in vc4_hvs_unbind()
1769 drm_mm_takedown(&vc4->hvs->lbm_mm); in vc4_hvs_unbind()
1771 clk_disable_unprepare(hvs->disp_clk); in vc4_hvs_unbind()
1772 clk_disable_unprepare(hvs->core_clk); in vc4_hvs_unbind()
1774 vc4->hvs = NULL; in vc4_hvs_unbind()
1793 { .compatible = "brcm,bcm2711-hvs" },
1794 { .compatible = "brcm,bcm2712-hvs" },
1795 { .compatible = "brcm,bcm2835-hvs" },