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
68 void vc4_hvs_dump_state(struct vc4_hvs *hvs) in vc4_hvs_dump_state() argument
70 struct drm_device *drm = &hvs->vc4->base; in vc4_hvs_dump_state()
71 struct drm_printer p = drm_info_printer(&hvs->pdev->dev); in vc4_hvs_dump_state()
77 drm_print_regset32(&p, &hvs->regset); in vc4_hvs_dump_state()
79 DRM_INFO("HVS ctx:\n"); in vc4_hvs_dump_state()
83 readl((u32 __iomem *)hvs->dlist + i + 0), in vc4_hvs_dump_state()
84 readl((u32 __iomem *)hvs->dlist + i + 1), in vc4_hvs_dump_state()
85 readl((u32 __iomem *)hvs->dlist + i + 2), in vc4_hvs_dump_state()
86 readl((u32 __iomem *)hvs->dlist + i + 3)); in vc4_hvs_dump_state()
109 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_debugfs_dlist() local
120 drm_printf(&p, "HVS chan %u disabled\n", i); in vc4_hvs_debugfs_dlist()
124 drm_printf(&p, "HVS chan %u:\n", i); in vc4_hvs_debugfs_dlist()
127 dlist_word = readl((u32 __iomem *)vc4->hvs->dlist + j); in vc4_hvs_debugfs_dlist()
178 static int vc4_hvs_upload_linear_kernel(struct vc4_hvs *hvs, in vc4_hvs_upload_linear_kernel() argument
190 ret = drm_mm_insert_node(&hvs->dlist_mm, space, VC4_KERNEL_DWORDS); in vc4_hvs_upload_linear_kernel()
197 dst_kernel = hvs->dlist + space->start; in vc4_hvs_upload_linear_kernel()
211 static void vc4_hvs_lut_load(struct vc4_hvs *hvs, in vc4_hvs_lut_load() argument
214 struct drm_device *drm = &hvs->vc4->base; in vc4_hvs_lut_load()
223 /* The LUT memory is laid out with each HVS channel in order, in vc4_hvs_lut_load()
241 static void vc4_hvs_update_gamma_lut(struct vc4_hvs *hvs, in vc4_hvs_update_gamma_lut() argument
255 vc4_hvs_lut_load(hvs, vc4_crtc); in vc4_hvs_update_gamma_lut()
258 u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, unsigned int fifo) in vc4_hvs_get_fifo_frame_count() argument
260 struct drm_device *drm = &hvs->vc4->base; in vc4_hvs_get_fifo_frame_count()
286 int vc4_hvs_get_fifo_from_output(struct vc4_hvs *hvs, unsigned int output) in vc4_hvs_get_fifo_from_output() argument
288 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_get_fifo_from_output()
345 static int vc4_hvs_init_channel(struct vc4_hvs *hvs, struct drm_crtc *crtc, in vc4_hvs_init_channel() argument
348 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_init_channel()
399 vc4_hvs_lut_load(hvs, vc4_crtc); in vc4_hvs_init_channel()
406 void vc4_hvs_stop_channel(struct vc4_hvs *hvs, unsigned int chan) in vc4_hvs_stop_channel() argument
408 struct drm_device *drm = &hvs->vc4->base; in vc4_hvs_stop_channel()
460 spin_lock_irqsave(&vc4->hvs->mm_lock, flags); in vc4_hvs_atomic_check()
461 ret = drm_mm_insert_node(&vc4->hvs->dlist_mm, &vc4_state->mm, in vc4_hvs_atomic_check()
463 spin_unlock_irqrestore(&vc4->hvs->mm_lock, flags); in vc4_hvs_atomic_check()
474 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_install_dlist() local
537 vc4_hvs_init_channel(vc4->hvs, crtc, mode, oneshot); in vc4_hvs_atomic_enable()
549 vc4_hvs_stop_channel(vc4->hvs, chan); in vc4_hvs_atomic_disable()
559 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_atomic_flush() local
567 u32 __iomem *dlist_start = vc4->hvs->dlist + vc4_state->mm.start; in vc4_hvs_atomic_flush()
577 DRM_INFO("CRTC %d HVS before:\n", drm_crtc_index(crtc)); in vc4_hvs_atomic_flush()
578 vc4_hvs_dump_state(hvs); in vc4_hvs_atomic_flush()
629 vc4_hvs_update_gamma_lut(hvs, vc4_crtc); in vc4_hvs_atomic_flush()
642 DRM_INFO("CRTC %d HVS after:\n", drm_crtc_index(crtc)); in vc4_hvs_atomic_flush()
643 vc4_hvs_dump_state(hvs); in vc4_hvs_atomic_flush()
649 void vc4_hvs_mask_underrun(struct vc4_hvs *hvs, int channel) in vc4_hvs_mask_underrun() argument
651 struct drm_device *drm = &hvs->vc4->base; in vc4_hvs_mask_underrun()
666 void vc4_hvs_unmask_underrun(struct vc4_hvs *hvs, int channel) in vc4_hvs_unmask_underrun() argument
668 struct drm_device *drm = &hvs->vc4->base; in vc4_hvs_unmask_underrun()
690 DRM_DEV_ERROR(dev->dev, "HVS underrun\n"); in vc4_hvs_report_underrun()
697 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_irq_handler() local
721 vc4_hvs_mask_underrun(hvs, channel); in vc4_hvs_irq_handler()
740 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_debugfs_init() local
743 if (!vc4->hvs) in vc4_hvs_debugfs_init()
762 &hvs->regset); in vc4_hvs_debugfs_init()
774 struct vc4_hvs *hvs = NULL; in vc4_hvs_bind() local
779 hvs = drmm_kzalloc(drm, sizeof(*hvs), GFP_KERNEL); in vc4_hvs_bind()
780 if (!hvs) in vc4_hvs_bind()
782 hvs->vc4 = vc4; in vc4_hvs_bind()
783 hvs->pdev = pdev; in vc4_hvs_bind()
785 hvs->regs = vc4_ioremap_regs(pdev, 0); in vc4_hvs_bind()
786 if (IS_ERR(hvs->regs)) in vc4_hvs_bind()
787 return PTR_ERR(hvs->regs); in vc4_hvs_bind()
789 hvs->regset.base = hvs->regs; in vc4_hvs_bind()
790 hvs->regset.regs = hvs_regs; in vc4_hvs_bind()
791 hvs->regset.nregs = ARRAY_SIZE(hvs_regs); in vc4_hvs_bind()
794 hvs->core_clk = devm_clk_get(&pdev->dev, NULL); in vc4_hvs_bind()
795 if (IS_ERR(hvs->core_clk)) { in vc4_hvs_bind()
797 return PTR_ERR(hvs->core_clk); in vc4_hvs_bind()
800 ret = clk_prepare_enable(hvs->core_clk); in vc4_hvs_bind()
808 hvs->dlist = hvs->regs + SCALER_DLIST_START; in vc4_hvs_bind()
810 hvs->dlist = hvs->regs + SCALER5_DLIST_START; in vc4_hvs_bind()
812 spin_lock_init(&hvs->mm_lock); in vc4_hvs_bind()
814 /* Set up the HVS display list memory manager. We never in vc4_hvs_bind()
819 drm_mm_init(&hvs->dlist_mm, in vc4_hvs_bind()
823 /* Set up the HVS LBM memory manager. We could have some more in vc4_hvs_bind()
830 drm_mm_init(&hvs->lbm_mm, 0, 48 * 1024); in vc4_hvs_bind()
833 drm_mm_init(&hvs->lbm_mm, 0, 60 * 1024); in vc4_hvs_bind()
838 ret = vc4_hvs_upload_linear_kernel(hvs, in vc4_hvs_bind()
839 &hvs->mitchell_netravali_filter, in vc4_hvs_bind()
844 vc4->hvs = hvs; in vc4_hvs_bind()
890 vc4_hvs_irq_handler, 0, "vc4 hvs", drm); in vc4_hvs_bind()
902 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_unbind() local
905 if (drm_mm_node_allocated(&vc4->hvs->mitchell_netravali_filter)) in vc4_hvs_unbind()
906 drm_mm_remove_node(&vc4->hvs->mitchell_netravali_filter); in vc4_hvs_unbind()
908 drm_mm_for_each_node_safe(node, next, &vc4->hvs->dlist_mm) in vc4_hvs_unbind()
911 drm_mm_takedown(&vc4->hvs->dlist_mm); in vc4_hvs_unbind()
913 drm_mm_for_each_node_safe(node, next, &vc4->hvs->lbm_mm) in vc4_hvs_unbind()
915 drm_mm_takedown(&vc4->hvs->lbm_mm); in vc4_hvs_unbind()
917 clk_disable_unprepare(hvs->core_clk); in vc4_hvs_unbind()
919 vc4->hvs = NULL; in vc4_hvs_unbind()
939 { .compatible = "brcm,bcm2711-hvs" },
940 { .compatible = "brcm,bcm2835-hvs" },