Lines Matching +full:bcm2835 +full:- +full:vc4
1 // SPDX-License-Identifier: GPL-2.0-only
7 * DOC: VC4 HVS module.
31 #include <soc/bcm2835/raspberrypi-firmware.h>
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()
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()
230 struct drm_debugfs_entry *entry = m->private; in vc4_hvs_debugfs_underrun()
231 struct drm_device *dev = entry->dev; in vc4_hvs_debugfs_underrun()
232 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_hvs_debugfs_underrun() local
235 drm_printf(&p, "%d\n", atomic_read(&vc4->underrun)); in vc4_hvs_debugfs_underrun()
242 struct drm_debugfs_entry *entry = m->private; in vc4_hvs_debugfs_dlist()
243 struct drm_device *dev = entry->dev; in vc4_hvs_debugfs_dlist()
244 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_hvs_debugfs_dlist() local
245 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_debugfs_dlist()
247 unsigned int dlist_mem_size = hvs->dlist_mem_size; in vc4_hvs_debugfs_dlist()
265 dlist_word = readl((u32 __iomem *)vc4->hvs->dlist + j); in vc4_hvs_debugfs_dlist()
284 struct drm_info_node *node = m->private; in vc6_hvs_debugfs_dlist()
285 struct drm_device *dev = node->minor->dev; in vc6_hvs_debugfs_dlist()
286 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc6_hvs_debugfs_dlist() local
287 struct vc4_hvs *hvs = vc4->hvs; in vc6_hvs_debugfs_dlist()
289 unsigned int dlist_mem_size = hvs->dlist_mem_size; in vc6_hvs_debugfs_dlist()
314 dlist_word = readl((u32 __iomem *)vc4->hvs->dlist + j); in vc6_hvs_debugfs_dlist()
333 struct drm_debugfs_entry *entry = m->private; in vc6_hvs_debugfs_upm_allocs()
334 struct drm_device *dev = entry->dev; in vc6_hvs_debugfs_upm_allocs()
335 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc6_hvs_debugfs_upm_allocs() local
336 struct vc4_hvs *hvs = vc4->hvs; in vc6_hvs_debugfs_upm_allocs()
343 refcount = &hvs->upm_refcounts[i]; in vc6_hvs_debugfs_upm_allocs()
345 i, refcount_read(&refcount->refcount), refcount->size, in vc6_hvs_debugfs_upm_allocs()
346 refcount->upm.start, refcount->upm.size); in vc6_hvs_debugfs_upm_allocs()
352 /* The filter kernel is composed of dwords each containing 3 9-bit
361 /* The whole filter kernel is arranged as the coefficients 0-16 going
362 * up, then a pad, then 17-31 going down and reversed within the
377 #define VC4_KERNEL_DWORDS (VC4_LINEAR_PHASE_KERNEL_DWORDS * 2 - 1)
383 VC4_LINEAR_PHASE_KERNEL(0, -2, -6, -8, -10, -8, -3, 2, 18,
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()
411 writel(kernel[VC4_KERNEL_DWORDS - i - 1], in vc4_hvs_upload_linear_kernel()
422 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_lut_load() local
423 struct drm_device *drm = &vc4->base; in vc4_hvs_lut_load()
424 struct drm_crtc *crtc = &vc4_crtc->base; in vc4_hvs_lut_load()
425 struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state); in vc4_hvs_lut_load()
429 WARN_ON_ONCE(vc4->gen > VC4_GEN_5); in vc4_hvs_lut_load()
434 if (hvs->vc4->gen != VC4_GEN_4) in vc4_hvs_lut_load()
443 (vc4_state->assigned_channel * 3 * crtc->gamma_size)); in vc4_hvs_lut_load()
445 for (i = 0; i < crtc->gamma_size; i++) in vc4_hvs_lut_load()
446 HVS_WRITE(SCALER_GAMDATA, vc4_crtc->lut_r[i]); in vc4_hvs_lut_load()
447 for (i = 0; i < crtc->gamma_size; i++) in vc4_hvs_lut_load()
448 HVS_WRITE(SCALER_GAMDATA, vc4_crtc->lut_g[i]); in vc4_hvs_lut_load()
449 for (i = 0; i < crtc->gamma_size; i++) in vc4_hvs_lut_load()
450 HVS_WRITE(SCALER_GAMDATA, vc4_crtc->lut_b[i]); in vc4_hvs_lut_load()
459 struct drm_crtc_state *crtc_state = vc4_crtc->base.state; in vc4_hvs_update_gamma_lut()
460 struct drm_color_lut *lut = crtc_state->gamma_lut->data; in vc4_hvs_update_gamma_lut()
461 u32 length = drm_color_lut_size(crtc_state->gamma_lut); in vc4_hvs_update_gamma_lut()
465 vc4_crtc->lut_r[i] = drm_color_lut_extract(lut[i].red, 8); in vc4_hvs_update_gamma_lut()
466 vc4_crtc->lut_g[i] = drm_color_lut_extract(lut[i].green, 8); in vc4_hvs_update_gamma_lut()
467 vc4_crtc->lut_b[i] = drm_color_lut_extract(lut[i].blue, 8); in vc4_hvs_update_gamma_lut()
475 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_get_fifo_frame_count() local
476 struct drm_device *drm = &vc4->base; in vc4_hvs_get_fifo_frame_count()
480 WARN_ON_ONCE(vc4->gen > VC4_GEN_6_D); in vc4_hvs_get_fifo_frame_count()
485 switch (vc4->gen) { in vc4_hvs_get_fifo_frame_count()
524 drm_err(drm, "Unknown VC4 generation: %d", vc4->gen); in vc4_hvs_get_fifo_frame_count()
534 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_get_fifo_from_output() local
538 WARN_ON_ONCE(vc4->gen > VC4_GEN_6_D); in vc4_hvs_get_fifo_from_output()
540 switch (vc4->gen) { in vc4_hvs_get_fifo_from_output()
571 return -EPIPE; in vc4_hvs_get_fifo_from_output()
579 return -EPIPE; in vc4_hvs_get_fifo_from_output()
587 return -EPIPE; in vc4_hvs_get_fifo_from_output()
592 return -EPIPE; in vc4_hvs_get_fifo_from_output()
610 return -EPIPE; in vc4_hvs_get_fifo_from_output()
614 return -EPIPE; in vc4_hvs_get_fifo_from_output()
621 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_init_channel() local
622 struct drm_device *drm = &vc4->base; in vc4_hvs_init_channel()
624 struct vc4_crtc_state *vc4_crtc_state = to_vc4_crtc_state(crtc->state); in vc4_hvs_init_channel()
625 unsigned int chan = vc4_crtc_state->assigned_channel; in vc4_hvs_init_channel()
626 bool interlace = mode->flags & DRM_MODE_FLAG_INTERLACE; in vc4_hvs_init_channel()
631 WARN_ON_ONCE(vc4->gen > VC4_GEN_5); in vc4_hvs_init_channel()
634 return -ENODEV; in vc4_hvs_init_channel()
648 if (vc4->gen == VC4_GEN_4) { in vc4_hvs_init_channel()
649 dispctrl |= VC4_SET_FIELD(mode->hdisplay, in vc4_hvs_init_channel()
651 VC4_SET_FIELD(mode->vdisplay, in vc4_hvs_init_channel()
656 dispctrl |= VC4_SET_FIELD(mode->hdisplay, in vc4_hvs_init_channel()
658 VC4_SET_FIELD(mode->vdisplay, in vc4_hvs_init_channel()
670 ((vc4->gen == VC4_GEN_4) ? SCALER_DISPBKGND_GAMMA : 0) | in vc4_hvs_init_channel()
686 struct vc4_dev *vc4 = hvs->vc4; in vc6_hvs_init_channel() local
687 struct drm_device *drm = &vc4->base; in vc6_hvs_init_channel()
688 struct vc4_crtc_state *vc4_crtc_state = to_vc4_crtc_state(crtc->state); in vc6_hvs_init_channel()
689 unsigned int chan = vc4_crtc_state->assigned_channel; in vc6_hvs_init_channel()
690 bool interlace = mode->flags & DRM_MODE_FLAG_INTERLACE; in vc6_hvs_init_channel()
694 WARN_ON_ONCE(vc4->gen < VC4_GEN_6_C); in vc6_hvs_init_channel()
697 return -ENODEV; in vc6_hvs_init_channel()
708 VC4_SET_FIELD(mode->hdisplay - 1, in vc6_hvs_init_channel()
711 VC4_SET_FIELD(mode->vdisplay - 1, in vc6_hvs_init_channel()
721 struct vc4_dev *vc4 = hvs->vc4; in __vc4_hvs_stop_channel() local
722 struct drm_device *drm = &vc4->base; in __vc4_hvs_stop_channel()
725 WARN_ON_ONCE(vc4->gen > VC4_GEN_5); in __vc4_hvs_stop_channel()
753 struct vc4_dev *vc4 = hvs->vc4; in __vc6_hvs_stop_channel() local
754 struct drm_device *drm = &vc4->base; in __vc6_hvs_stop_channel()
757 WARN_ON_ONCE(vc4->gen < VC4_GEN_6_C); in __vc6_hvs_stop_channel()
781 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_stop_channel() local
783 if (vc4->gen >= VC4_GEN_6_C) in vc4_hvs_stop_channel()
793 struct drm_device *dev = crtc->dev; in vc4_hvs_atomic_check()
794 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_hvs_atomic_check() local
804 if (hweight32(crtc_state->connector_mask) > 1) in vc4_hvs_atomic_check()
805 return -EINVAL; in vc4_hvs_atomic_check()
811 crtc->base.id, crtc->name, in vc4_hvs_atomic_check()
812 plane->base.id, plane->name, in vc4_hvs_atomic_check()
821 crtc->base.id, crtc->name, dlist_count); in vc4_hvs_atomic_check()
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()
836 struct drm_device *dev = crtc->dev; in vc4_hvs_install_dlist()
837 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_hvs_install_dlist() local
838 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_install_dlist()
839 struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state); in vc4_hvs_install_dlist()
845 if (vc4->gen >= VC4_GEN_6_C) in vc4_hvs_install_dlist()
846 HVS_WRITE(SCALER6_DISPX_LPTRS(vc4_state->assigned_channel), in vc4_hvs_install_dlist()
847 VC4_SET_FIELD(vc4_state->mm.start, in vc4_hvs_install_dlist()
850 HVS_WRITE(SCALER_DISPLISTX(vc4_state->assigned_channel), in vc4_hvs_install_dlist()
851 vc4_state->mm.start); in vc4_hvs_install_dlist()
858 struct drm_device *dev = crtc->dev; in vc4_hvs_update_dlist()
860 struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state); in vc4_hvs_update_dlist()
863 if (crtc->state->event) { in vc4_hvs_update_dlist()
864 crtc->state->event->pipe = drm_crtc_index(crtc); in vc4_hvs_update_dlist()
868 spin_lock_irqsave(&dev->event_lock, flags); in vc4_hvs_update_dlist()
870 if (!vc4_crtc->feeds_txp || vc4_state->txp_armed) { in vc4_hvs_update_dlist()
871 vc4_crtc->event = crtc->state->event; in vc4_hvs_update_dlist()
872 crtc->state->event = NULL; in vc4_hvs_update_dlist()
875 spin_unlock_irqrestore(&dev->event_lock, flags); in vc4_hvs_update_dlist()
878 spin_lock_irqsave(&vc4_crtc->irq_lock, flags); in vc4_hvs_update_dlist()
879 vc4_crtc->current_dlist = vc4_state->mm.start; in vc4_hvs_update_dlist()
880 spin_unlock_irqrestore(&vc4_crtc->irq_lock, flags); in vc4_hvs_update_dlist()
887 struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state); in vc4_hvs_atomic_begin()
890 spin_lock_irqsave(&vc4_crtc->irq_lock, flags); in vc4_hvs_atomic_begin()
891 vc4_crtc->current_hvs_channel = vc4_state->assigned_channel; in vc4_hvs_atomic_begin()
892 spin_unlock_irqrestore(&vc4_crtc->irq_lock, flags); in vc4_hvs_atomic_begin()
898 struct drm_device *dev = crtc->dev; in vc4_hvs_atomic_enable()
899 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_hvs_atomic_enable() local
900 struct drm_display_mode *mode = &crtc->state->adjusted_mode; in vc4_hvs_atomic_enable()
902 bool oneshot = vc4_crtc->feeds_txp; in vc4_hvs_atomic_enable()
907 if (vc4->gen >= VC4_GEN_6_C) in vc4_hvs_atomic_enable()
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()
916 struct drm_device *dev = crtc->dev; in vc4_hvs_atomic_disable()
917 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_hvs_atomic_disable() local
920 unsigned int chan = vc4_state->assigned_channel; in vc4_hvs_atomic_disable()
922 vc4_hvs_stop_channel(vc4->hvs, chan); in vc4_hvs_atomic_disable()
930 struct drm_device *dev = crtc->dev; in vc4_hvs_atomic_flush()
931 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_hvs_atomic_flush() local
932 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_atomic_flush()
934 struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state); in vc4_hvs_atomic_flush()
935 unsigned int channel = vc4_state->assigned_channel; in vc4_hvs_atomic_flush()
940 u32 __iomem *dlist_start = vc4->hvs->dlist + vc4_state->mm.start; in vc4_hvs_atomic_flush()
946 WARN_ON_ONCE(vc4->gen > VC4_GEN_6_D); in vc4_hvs_atomic_flush()
953 if (vc4_state->assigned_channel == VC4_HVS_CHANNEL_DISABLED) in vc4_hvs_atomic_flush()
966 if (plane->state->normalized_zpos != zpos) in vc4_hvs_atomic_flush()
979 vc4_plane_state = to_vc4_plane_state(plane->state); in vc4_hvs_atomic_flush()
980 enable_bg_fill = vc4_plane_state->needs_bg_fill; in vc4_hvs_atomic_flush()
994 WARN_ON_ONCE(dlist_next - dlist_start != vc4_state->mm.size); in vc4_hvs_atomic_flush()
996 if (vc4->gen >= VC4_GEN_6_C) { in vc4_hvs_atomic_flush()
1020 * re-enabling VBLANK interrupts and before enabling the engine. in vc4_hvs_atomic_flush()
1024 if (crtc->state->active && old_state->active) { in vc4_hvs_atomic_flush()
1029 if (crtc->state->color_mgmt_changed) { in vc4_hvs_atomic_flush()
1032 WARN_ON_ONCE(vc4->gen > VC4_GEN_5); in vc4_hvs_atomic_flush()
1034 if (crtc->state->gamma_lut) { in vc4_hvs_atomic_flush()
1058 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_mask_underrun() local
1059 struct drm_device *drm = &vc4->base; in vc4_hvs_mask_underrun()
1063 WARN_ON(vc4->gen > VC4_GEN_5); in vc4_hvs_mask_underrun()
1069 dispctrl &= ~((vc4->gen == VC4_GEN_5) ? in vc4_hvs_mask_underrun()
1080 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_unmask_underrun() local
1081 struct drm_device *drm = &vc4->base; in vc4_hvs_unmask_underrun()
1085 WARN_ON(vc4->gen > VC4_GEN_5); in vc4_hvs_unmask_underrun()
1091 dispctrl |= ((vc4->gen == VC4_GEN_5) ? in vc4_hvs_unmask_underrun()
1104 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_hvs_report_underrun() local
1106 atomic_inc(&vc4->underrun); in vc4_hvs_report_underrun()
1107 DRM_DEV_ERROR(dev->dev, "HVS underrun\n"); in vc4_hvs_report_underrun()
1113 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_hvs_irq_handler() local
1114 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_irq_handler()
1121 WARN_ON(vc4->gen > VC4_GEN_5); in vc4_hvs_irq_handler()
1138 dspeislur = (vc4->gen == VC4_GEN_5) ? in vc4_hvs_irq_handler()
1152 /* Clear every per-channel interrupt flag. */ in vc4_hvs_irq_handler()
1162 struct drm_device *drm = minor->dev; in vc4_hvs_debugfs_init()
1163 struct vc4_dev *vc4 = to_vc4_dev(drm); in vc4_hvs_debugfs_init() local
1164 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_debugfs_init()
1166 if (!vc4->hvs) in vc4_hvs_debugfs_init()
1167 return -ENODEV; in vc4_hvs_debugfs_init()
1169 if (vc4->gen == VC4_GEN_4) in vc4_hvs_debugfs_init()
1171 minor->debugfs_root, in vc4_hvs_debugfs_init()
1172 &vc4->load_tracker_enabled); in vc4_hvs_debugfs_init()
1174 if (vc4->gen >= VC4_GEN_6_C) { in vc4_hvs_debugfs_init()
1183 vc4_debugfs_add_regset32(drm, "hvs_regs", &hvs->regset); in vc4_hvs_debugfs_init()
1188 struct vc4_hvs *__vc4_hvs_alloc(struct vc4_dev *vc4, in __vc4_hvs_alloc() argument
1192 struct drm_device *drm = &vc4->base; in __vc4_hvs_alloc()
1201 return ERR_PTR(-ENOMEM); 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()
1209 switch (vc4->gen) { in __vc4_hvs_alloc()
1219 dlist_size = (SCALER_DLIST_SIZE >> 2) - HVS_BOOTLOADER_DLIST_END; 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()
1243 drm_err(drm, "Unknown VC4 generation: %d", vc4->gen); in __vc4_hvs_alloc()
1244 return ERR_PTR(-ENODEV); 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()
1257 switch (vc4->gen) { in __vc4_hvs_alloc()
1259 /* 48k words of 2x12-bit pixels */ in __vc4_hvs_alloc()
1264 /* 60k words of 4x12-bit pixels */ in __vc4_hvs_alloc()
1278 drm_err(drm, "Unknown VC4 generation: %d", vc4->gen); in __vc4_hvs_alloc()
1279 return ERR_PTR(-ENODEV); in __vc4_hvs_alloc()
1282 drm_mm_init(&hvs->lbm_mm, 0, lbm_size); in __vc4_hvs_alloc()
1284 if (vc4->gen >= VC4_GEN_6_C) { 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()
1305 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_hw_init() local
1337 if (vc4->gen == VC4_GEN_4) in vc4_hvs_hw_init()
1367 * VC4 panics when < 2 lines in FIFO. in vc4_hvs_hw_init()
1378 * VC4 panics when < 2 lines in FIFO. in vc4_hvs_hw_init()
1491 if (hvs->vc4->gen == VC4_GEN_6_C) { in vc6_hvs_hw_init()
1495 HVS_WRITE(CFC1_N_MA_CSC_COEFF_C00(i), coeffs->csc[0][0]); in vc6_hvs_hw_init()
1496 HVS_WRITE(CFC1_N_MA_CSC_COEFF_C01(i), coeffs->csc[0][1]); in vc6_hvs_hw_init()
1497 HVS_WRITE(CFC1_N_MA_CSC_COEFF_C02(i), coeffs->csc[0][2]); in vc6_hvs_hw_init()
1498 HVS_WRITE(CFC1_N_MA_CSC_COEFF_C03(i), coeffs->csc[0][3]); in vc6_hvs_hw_init()
1499 HVS_WRITE(CFC1_N_MA_CSC_COEFF_C04(i), coeffs->csc[0][4]); in vc6_hvs_hw_init()
1501 HVS_WRITE(CFC1_N_MA_CSC_COEFF_C10(i), coeffs->csc[1][0]); in vc6_hvs_hw_init()
1502 HVS_WRITE(CFC1_N_MA_CSC_COEFF_C11(i), coeffs->csc[1][1]); in vc6_hvs_hw_init()
1503 HVS_WRITE(CFC1_N_MA_CSC_COEFF_C12(i), coeffs->csc[1][2]); in vc6_hvs_hw_init()
1504 HVS_WRITE(CFC1_N_MA_CSC_COEFF_C13(i), coeffs->csc[1][3]); in vc6_hvs_hw_init()
1505 HVS_WRITE(CFC1_N_MA_CSC_COEFF_C14(i), coeffs->csc[1][4]); in vc6_hvs_hw_init()
1507 HVS_WRITE(CFC1_N_MA_CSC_COEFF_C20(i), coeffs->csc[2][0]); in vc6_hvs_hw_init()
1508 HVS_WRITE(CFC1_N_MA_CSC_COEFF_C21(i), coeffs->csc[2][1]); in vc6_hvs_hw_init()
1509 HVS_WRITE(CFC1_N_MA_CSC_COEFF_C22(i), coeffs->csc[2][2]); in vc6_hvs_hw_init()
1510 HVS_WRITE(CFC1_N_MA_CSC_COEFF_C23(i), coeffs->csc[2][3]); in vc6_hvs_hw_init()
1511 HVS_WRITE(CFC1_N_MA_CSC_COEFF_C24(i), coeffs->csc[2][4]); in vc6_hvs_hw_init()
1535 struct vc4_dev *vc4 = hvs->vc4; in vc4_hvs_cob_init() local
1542 switch (vc4->gen) { in vc4_hvs_cob_init()
1557 reg |= (top - 1) << 16; in vc4_hvs_cob_init()
1561 reg |= (top - 1) << 16; in vc4_hvs_cob_init()
1565 reg |= (top - 1) << 16; in vc4_hvs_cob_init()
1624 return -EINVAL; in vc4_hvs_cob_init()
1634 struct vc4_dev *vc4 = to_vc4_dev(drm); in vc4_hvs_bind() local
1643 hvs = __vc4_hvs_alloc(vc4, regs, pdev); in vc4_hvs_bind()
1647 hvs->regset.base = hvs->regs; in vc4_hvs_bind()
1649 if (vc4->gen == VC4_GEN_6_C) { 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()
1655 vc4->gen = VC4_GEN_6_D; 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()
1664 if (vc4->gen >= VC4_GEN_5) { in vc4_hvs_bind()
1671 return -EINVAL; in vc4_hvs_bind()
1676 return -EPROBE_DEFER; in vc4_hvs_bind()
1678 hvs->core_clk = devm_clk_get(&pdev->dev, in vc4_hvs_bind()
1679 (vc4->gen >= VC4_GEN_6_C) ? "core" : NULL); in vc4_hvs_bind()
1680 if (IS_ERR(hvs->core_clk)) { in vc4_hvs_bind()
1681 dev_err(&pdev->dev, "Couldn't get core clock\n"); 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()
1686 (vc4->gen >= VC4_GEN_6_C) ? "disp" : NULL); in vc4_hvs_bind()
1687 if (IS_ERR(hvs->disp_clk)) { in vc4_hvs_bind()
1688 dev_err(&pdev->dev, "Couldn't get disp clock\n"); 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()
1705 dev_err(&pdev->dev, "Couldn't enable the core clock\n"); in vc4_hvs_bind()
1709 ret = clk_prepare_enable(hvs->disp_clk); in vc4_hvs_bind()
1711 dev_err(&pdev->dev, "Couldn't enable the disp clock\n"); in vc4_hvs_bind()
1716 if (vc4->gen >= VC4_GEN_5) 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()
1721 if (vc4->gen >= VC4_GEN_6_C) in vc4_hvs_bind()
1732 &hvs->mitchell_netravali_filter, in vc4_hvs_bind()
1741 if (vc4->gen < VC4_GEN_6_C) { in vc4_hvs_bind()
1743 vc4_hvs_irq_handler, 0, "vc4 hvs", drm); in vc4_hvs_bind()
1755 struct vc4_dev *vc4 = to_vc4_dev(drm); in vc4_hvs_unbind() local
1756 struct vc4_hvs *hvs = vc4->hvs; in vc4_hvs_unbind()
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()
1784 return component_add(&pdev->dev, &vc4_hvs_ops); in vc4_hvs_dev_probe()
1789 component_del(&pdev->dev, &vc4_hvs_ops); in vc4_hvs_dev_remove()
1793 { .compatible = "brcm,bcm2711-hvs" },
1794 { .compatible = "brcm,bcm2712-hvs" },
1795 { .compatible = "brcm,bcm2835-hvs" },