Lines Matching +full:stih407 +full:- +full:mailbox

1 // SPDX-License-Identifier: GPL-2.0
9 #include <linux/dma-mapping.h>
31 #define HQVDP_FMW_NAME "hqvdp-stih407.bin"
376 * -1 in error cases
381 u32 cmd = hqvdp->hqvdp_cmd_paddr; in sti_hqvdp_get_free_cmd()
384 curr_cmd = readl(hqvdp->regs + HQVDP_MBX_CURRENT_CMD); in sti_hqvdp_get_free_cmd()
385 next_cmd = readl(hqvdp->regs + HQVDP_MBX_NEXT_CMD); in sti_hqvdp_get_free_cmd()
393 return -1; in sti_hqvdp_get_free_cmd()
404 * -1 in error cases
409 u32 cmd = hqvdp->hqvdp_cmd_paddr; in sti_hqvdp_get_curr_cmd()
412 curr_cmd = readl(hqvdp->regs + HQVDP_MBX_CURRENT_CMD); in sti_hqvdp_get_curr_cmd()
421 return -1; in sti_hqvdp_get_curr_cmd()
432 * -1 in error cases
437 dma_addr_t cmd = hqvdp->hqvdp_cmd_paddr; in sti_hqvdp_get_next_cmd()
440 next_cmd = readl(hqvdp->regs + HQVDP_MBX_NEXT_CMD); in sti_hqvdp_get_next_cmd()
449 return -1; in sti_hqvdp_get_next_cmd()
452 #define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
453 readl(hqvdp->regs + reg))
485 seq_printf(s, "\n\t %-20s 0x%08X", "Config", c->top.config); in hqvdp_dbg_dump_cmd()
486 switch (c->top.config) { in hqvdp_dbg_dump_cmd()
501 seq_printf(s, "\n\t %-20s 0x%08X", "MemFormat", c->top.mem_format); in hqvdp_dbg_dump_cmd()
502 seq_printf(s, "\n\t %-20s 0x%08X", "CurrentY", c->top.current_luma); in hqvdp_dbg_dump_cmd()
503 seq_printf(s, "\n\t %-20s 0x%08X", "CurrentC", c->top.current_chroma); in hqvdp_dbg_dump_cmd()
504 seq_printf(s, "\n\t %-20s 0x%08X", "YSrcPitch", c->top.luma_src_pitch); in hqvdp_dbg_dump_cmd()
505 seq_printf(s, "\n\t %-20s 0x%08X", "CSrcPitch", in hqvdp_dbg_dump_cmd()
506 c->top.chroma_src_pitch); in hqvdp_dbg_dump_cmd()
507 seq_printf(s, "\n\t %-20s 0x%08X", "InputFrameSize", in hqvdp_dbg_dump_cmd()
508 c->top.input_frame_size); in hqvdp_dbg_dump_cmd()
510 c->top.input_frame_size & 0x0000FFFF, in hqvdp_dbg_dump_cmd()
511 c->top.input_frame_size >> 16); in hqvdp_dbg_dump_cmd()
512 seq_printf(s, "\n\t %-20s 0x%08X", "InputViewportSize", in hqvdp_dbg_dump_cmd()
513 c->top.input_viewport_size); in hqvdp_dbg_dump_cmd()
514 src_w = c->top.input_viewport_size & 0x0000FFFF; in hqvdp_dbg_dump_cmd()
515 src_h = c->top.input_viewport_size >> 16; in hqvdp_dbg_dump_cmd()
519 seq_printf(s, "\n\t %-20s 0x%08X", "OutputPictureSize", in hqvdp_dbg_dump_cmd()
520 c->hvsrc.output_picture_size); in hqvdp_dbg_dump_cmd()
521 dst_w = c->hvsrc.output_picture_size & 0x0000FFFF; in hqvdp_dbg_dump_cmd()
522 dst_h = c->hvsrc.output_picture_size >> 16; in hqvdp_dbg_dump_cmd()
524 seq_printf(s, "\n\t %-20s 0x%08X", "ParamCtrl", c->hvsrc.param_ctrl); in hqvdp_dbg_dump_cmd()
526 seq_printf(s, "\n\t %-20s %s", "yh_coef", in hqvdp_dbg_dump_cmd()
527 hqvdp_dbg_get_lut(c->hvsrc.yh_coef)); in hqvdp_dbg_dump_cmd()
528 seq_printf(s, "\n\t %-20s %s", "ch_coef", in hqvdp_dbg_dump_cmd()
529 hqvdp_dbg_get_lut(c->hvsrc.ch_coef)); in hqvdp_dbg_dump_cmd()
530 seq_printf(s, "\n\t %-20s %s", "yv_coef", in hqvdp_dbg_dump_cmd()
531 hqvdp_dbg_get_lut(c->hvsrc.yv_coef)); in hqvdp_dbg_dump_cmd()
532 seq_printf(s, "\n\t %-20s %s", "cv_coef", in hqvdp_dbg_dump_cmd()
533 hqvdp_dbg_get_lut(c->hvsrc.cv_coef)); in hqvdp_dbg_dump_cmd()
535 seq_printf(s, "\n\t %-20s", "ScaleH"); in hqvdp_dbg_dump_cmd()
541 seq_printf(s, "\n\t %-20s", "tScaleV"); in hqvdp_dbg_dump_cmd()
548 seq_printf(s, "\n\t %-20s 0x%08X\t", "Config", c->csdi.config); in hqvdp_dbg_dump_cmd()
549 switch (c->csdi.config) { in hqvdp_dbg_dump_cmd()
561 seq_printf(s, "\n\t %-20s 0x%08X", "Config2", c->csdi.config2); in hqvdp_dbg_dump_cmd()
562 seq_printf(s, "\n\t %-20s 0x%08X", "DcdiConfig", c->csdi.dcdi_config); in hqvdp_dbg_dump_cmd()
567 struct drm_info_node *node = s->private; in hqvdp_dbg_show()
568 struct sti_hqvdp *hqvdp = (struct sti_hqvdp *)node->info_ent->data; in hqvdp_dbg_show()
573 sti_plane_to_str(&hqvdp->plane), hqvdp->regs); in hqvdp_dbg_show()
579 infoxp70 = readl(hqvdp->regs + HQVDP_MBX_INFO_XP70); in hqvdp_dbg_show()
592 if (readl(hqvdp->regs + HQVDP_MBX_STARTUP_CTRL1) in hqvdp_dbg_show()
598 if (readl(hqvdp->regs + HQVDP_MBX_STARTUP_CTRL2) in hqvdp_dbg_show()
607 if (!(readl(hqvdp->regs + HQVDP_MBX_SOFT_VSYNC) & 3)) in hqvdp_dbg_show()
613 cmd = readl(hqvdp->regs + HQVDP_MBX_CURRENT_CMD); in hqvdp_dbg_show()
615 if (cmd_offset == -1) { in hqvdp_dbg_show()
618 virt = hqvdp->hqvdp_cmd + cmd_offset; in hqvdp_dbg_show()
625 cmd = readl(hqvdp->regs + HQVDP_MBX_NEXT_CMD); in hqvdp_dbg_show()
627 if (cmd_offset == -1) { in hqvdp_dbg_show()
630 virt = hqvdp->hqvdp_cmd + cmd_offset; in hqvdp_dbg_show()
653 minor->debugfs_root, minor); in hqvdp_debugfs_init()
703 hvsrc->hori_shift = (shift_c << 16) | shift_y; in sti_hqvdp_update_hvsrc()
704 memcpy(hvsrc->yh_coef, coef_y, sizeof(hvsrc->yh_coef)); in sti_hqvdp_update_hvsrc()
705 memcpy(hvsrc->ch_coef, coef_c, sizeof(hvsrc->ch_coef)); in sti_hqvdp_update_hvsrc()
707 hvsrc->vert_shift = (shift_c << 16) | shift_y; in sti_hqvdp_update_hvsrc()
708 memcpy(hvsrc->yv_coef, coef_y, sizeof(hvsrc->yv_coef)); in sti_hqvdp_update_hvsrc()
709 memcpy(hvsrc->cv_coef, coef_c, sizeof(hvsrc->cv_coef)); in sti_hqvdp_update_hvsrc()
742 lfw = mode->htotal * (clk_get_rate(hqvdp->clk) / 1000000); in sti_hqvdp_check_hw_scaling()
743 lfw /= max(src_w, dst_w) * mode->clock / 1000; in sti_hqvdp_check_hw_scaling()
760 DRM_DEBUG_DRIVER("%s\n", sti_plane_to_str(&hqvdp->plane)); in sti_hqvdp_disable()
763 if (sti_vtg_unregister_client(hqvdp->vtg, &hqvdp->vtg_nb)) in sti_hqvdp_disable()
767 writel(0, hqvdp->regs + HQVDP_MBX_NEXT_CMD); in sti_hqvdp_disable()
770 if (readl(hqvdp->regs + HQVDP_MBX_INFO_XP70) in sti_hqvdp_disable()
777 clk_disable_unprepare(hqvdp->clk_pix_main); in sti_hqvdp_disable()
782 hqvdp->plane.status = STI_PLANE_DISABLED; in sti_hqvdp_disable()
783 hqvdp->vtg_registered = false; in sti_hqvdp_disable()
808 if (hqvdp->plane.status == STI_PLANE_FLUSHING) { in sti_hqvdp_vtg_cb()
811 sti_plane_to_str(&hqvdp->plane)); in sti_hqvdp_vtg_cb()
816 if (hqvdp->btm_field_pending) { in sti_hqvdp_vtg_cb()
820 if ((btm_cmd_offset == -1) || (top_cmd_offest == -1)) { in sti_hqvdp_vtg_cb()
822 return -EBUSY; in sti_hqvdp_vtg_cb()
825 btm_cmd = hqvdp->hqvdp_cmd + btm_cmd_offset; in sti_hqvdp_vtg_cb()
826 top_cmd = hqvdp->hqvdp_cmd + top_cmd_offest; in sti_hqvdp_vtg_cb()
830 btm_cmd->top.config = TOP_CONFIG_INTER_BTM; in sti_hqvdp_vtg_cb()
831 btm_cmd->top.current_luma += in sti_hqvdp_vtg_cb()
832 btm_cmd->top.luma_src_pitch / 2; in sti_hqvdp_vtg_cb()
833 btm_cmd->top.current_chroma += in sti_hqvdp_vtg_cb()
834 btm_cmd->top.chroma_src_pitch / 2; in sti_hqvdp_vtg_cb()
836 /* Post the command to mailbox */ in sti_hqvdp_vtg_cb()
837 writel(hqvdp->hqvdp_cmd_paddr + btm_cmd_offset, in sti_hqvdp_vtg_cb()
838 hqvdp->regs + HQVDP_MBX_NEXT_CMD); in sti_hqvdp_vtg_cb()
840 hqvdp->btm_field_pending = false; in sti_hqvdp_vtg_cb()
842 dev_dbg(hqvdp->dev, "%s Posted command:0x%x\n", in sti_hqvdp_vtg_cb()
843 __func__, hqvdp->hqvdp_cmd_paddr); in sti_hqvdp_vtg_cb()
845 sti_plane_update_fps(&hqvdp->plane, false, true); in sti_hqvdp_vtg_cb()
856 hqvdp->vtg_nb.notifier_call = sti_hqvdp_vtg_cb; in sti_hqvdp_init()
860 hqvdp->hqvdp_cmd = dma_alloc_wc(hqvdp->dev, size, in sti_hqvdp_init()
863 if (!hqvdp->hqvdp_cmd) { in sti_hqvdp_init()
868 hqvdp->hqvdp_cmd_paddr = (u32)dma_addr; in sti_hqvdp_init()
869 memset(hqvdp->hqvdp_cmd, 0, size); in sti_hqvdp_init()
875 writel(PLUG_PAGE_SIZE_256, hqvdp->regs + HQVDP_RD_PLUG_PAGE_SIZE); in sti_hqvdp_init_plugs()
876 writel(PLUG_MIN_OPC_8, hqvdp->regs + HQVDP_RD_PLUG_MIN_OPC); in sti_hqvdp_init_plugs()
877 writel(PLUG_MAX_OPC_64, hqvdp->regs + HQVDP_RD_PLUG_MAX_OPC); in sti_hqvdp_init_plugs()
878 writel(PLUG_MAX_CHK_2X, hqvdp->regs + HQVDP_RD_PLUG_MAX_CHK); in sti_hqvdp_init_plugs()
879 writel(PLUG_MAX_MSG_1X, hqvdp->regs + HQVDP_RD_PLUG_MAX_MSG); in sti_hqvdp_init_plugs()
880 writel(PLUG_MIN_SPACE_1, hqvdp->regs + HQVDP_RD_PLUG_MIN_SPACE); in sti_hqvdp_init_plugs()
881 writel(PLUG_CONTROL_ENABLE, hqvdp->regs + HQVDP_RD_PLUG_CONTROL); in sti_hqvdp_init_plugs()
883 writel(PLUG_PAGE_SIZE_256, hqvdp->regs + HQVDP_WR_PLUG_PAGE_SIZE); in sti_hqvdp_init_plugs()
884 writel(PLUG_MIN_OPC_8, hqvdp->regs + HQVDP_WR_PLUG_MIN_OPC); in sti_hqvdp_init_plugs()
885 writel(PLUG_MAX_OPC_64, hqvdp->regs + HQVDP_WR_PLUG_MAX_OPC); in sti_hqvdp_init_plugs()
886 writel(PLUG_MAX_CHK_2X, hqvdp->regs + HQVDP_WR_PLUG_MAX_CHK); in sti_hqvdp_init_plugs()
887 writel(PLUG_MAX_MSG_1X, hqvdp->regs + HQVDP_WR_PLUG_MAX_MSG); in sti_hqvdp_init_plugs()
888 writel(PLUG_MIN_SPACE_1, hqvdp->regs + HQVDP_WR_PLUG_MIN_SPACE); in sti_hqvdp_init_plugs()
889 writel(PLUG_CONTROL_ENABLE, hqvdp->regs + HQVDP_WR_PLUG_CONTROL); in sti_hqvdp_init_plugs()
913 if (hqvdp->xp70_initialized) { in sti_hqvdp_start_xp70()
919 if (request_firmware(&firmware, HQVDP_FMW_NAME, hqvdp->dev)) { in sti_hqvdp_start_xp70()
930 header = (struct fw_header *)firmware->data; in sti_hqvdp_start_xp70()
931 if (firmware->size < sizeof(*header)) { in sti_hqvdp_start_xp70()
932 DRM_ERROR("Invalid firmware size (%zu)\n", firmware->size); in sti_hqvdp_start_xp70()
935 if ((sizeof(*header) + header->rd_size + header->wr_size + in sti_hqvdp_start_xp70()
936 header->pmem_size + header->dmem_size) != firmware->size) { in sti_hqvdp_start_xp70()
938 sizeof(*header), header->rd_size, header->wr_size, in sti_hqvdp_start_xp70()
939 header->pmem_size, header->dmem_size, in sti_hqvdp_start_xp70()
940 firmware->size); in sti_hqvdp_start_xp70()
944 data = (u8 *)firmware->data; in sti_hqvdp_start_xp70()
947 data += header->rd_size; in sti_hqvdp_start_xp70()
949 data += header->wr_size; in sti_hqvdp_start_xp70()
951 data += header->pmem_size; in sti_hqvdp_start_xp70()
955 if (clk_prepare_enable(hqvdp->clk)) in sti_hqvdp_start_xp70()
959 writel(SW_RESET_CTRL_FULL, hqvdp->regs + HQVDP_MBX_SW_RESET_CTRL); in sti_hqvdp_start_xp70()
962 if (readl(hqvdp->regs + HQVDP_MBX_STARTUP_CTRL1) in sti_hqvdp_start_xp70()
969 clk_disable_unprepare(hqvdp->clk); in sti_hqvdp_start_xp70()
974 for (i = 0; i < header->rd_size / 4; i++) in sti_hqvdp_start_xp70()
975 writel(fw_rd_plug[i], hqvdp->regs + HQVDP_RD_PLUG + i * 4); in sti_hqvdp_start_xp70()
976 for (i = 0; i < header->wr_size / 4; i++) in sti_hqvdp_start_xp70()
977 writel(fw_wr_plug[i], hqvdp->regs + HQVDP_WR_PLUG + i * 4); in sti_hqvdp_start_xp70()
982 writel(STARTUP_CTRL1_AUTH_IDLE, hqvdp->regs + HQVDP_MBX_STARTUP_CTRL1); in sti_hqvdp_start_xp70()
985 writel(SOFT_VSYNC_SW_CTRL_IRQ, hqvdp->regs + HQVDP_MBX_SOFT_VSYNC); in sti_hqvdp_start_xp70()
986 writel(0, hqvdp->regs + HQVDP_MBX_NEXT_CMD); in sti_hqvdp_start_xp70()
989 for (i = 0; i < header->pmem_size / 4; i++) in sti_hqvdp_start_xp70()
990 writel(fw_pmem[i], hqvdp->regs + HQVDP_PMEM + i * 4); in sti_hqvdp_start_xp70()
991 for (i = 0; i < header->dmem_size / 4; i++) in sti_hqvdp_start_xp70()
992 writel(fw_dmem[i], hqvdp->regs + HQVDP_DMEM + i * 4); in sti_hqvdp_start_xp70()
995 writel(STARTUP_CTRL2_FETCH_EN, hqvdp->regs + HQVDP_MBX_STARTUP_CTRL2); in sti_hqvdp_start_xp70()
999 if (readl(hqvdp->regs + HQVDP_MBX_INFO_XP70) in sti_hqvdp_start_xp70()
1006 clk_disable_unprepare(hqvdp->clk); in sti_hqvdp_start_xp70()
1011 writel(SOFT_VSYNC_HW, hqvdp->regs + HQVDP_MBX_SOFT_VSYNC); in sti_hqvdp_start_xp70()
1015 hqvdp->xp70_initialized = true; in sti_hqvdp_start_xp70()
1028 struct drm_crtc *crtc = new_plane_state->crtc; in sti_hqvdp_atomic_check()
1029 struct drm_framebuffer *fb = new_plane_state->fb; in sti_hqvdp_atomic_check()
1043 mode = &crtc_state->mode; in sti_hqvdp_atomic_check()
1044 dst_x = new_plane_state->crtc_x; in sti_hqvdp_atomic_check()
1045 dst_y = new_plane_state->crtc_y; in sti_hqvdp_atomic_check()
1046 dst_w = clamp_val(new_plane_state->crtc_w, 0, mode->hdisplay - dst_x); in sti_hqvdp_atomic_check()
1047 dst_h = clamp_val(new_plane_state->crtc_h, 0, mode->vdisplay - dst_y); in sti_hqvdp_atomic_check()
1049 src_x = new_plane_state->src_x >> 16; in sti_hqvdp_atomic_check()
1050 src_y = new_plane_state->src_y >> 16; in sti_hqvdp_atomic_check()
1051 src_w = new_plane_state->src_w >> 16; in sti_hqvdp_atomic_check()
1052 src_h = new_plane_state->src_h >> 16; in sti_hqvdp_atomic_check()
1054 if (mode->clock && !sti_hqvdp_check_hw_scaling(hqvdp, mode, in sti_hqvdp_atomic_check()
1058 return -EINVAL; in sti_hqvdp_atomic_check()
1063 return -EINVAL; in sti_hqvdp_atomic_check()
1077 DRM_ERROR("Invalid in/out size %dx%d -> %dx%d\n", in sti_hqvdp_atomic_check()
1080 return -EINVAL; in sti_hqvdp_atomic_check()
1083 if (!hqvdp->xp70_initialized) in sti_hqvdp_atomic_check()
1087 if (!hqvdp->vtg_registered) { in sti_hqvdp_atomic_check()
1089 if (clk_prepare_enable(hqvdp->clk_pix_main)) { in sti_hqvdp_atomic_check()
1091 return -EINVAL; in sti_hqvdp_atomic_check()
1095 if (sti_vtg_register_client(hqvdp->vtg, in sti_hqvdp_atomic_check()
1096 &hqvdp->vtg_nb, in sti_hqvdp_atomic_check()
1099 clk_disable_unprepare(hqvdp->clk_pix_main); in sti_hqvdp_atomic_check()
1100 return -EINVAL; in sti_hqvdp_atomic_check()
1102 hqvdp->vtg_registered = true; in sti_hqvdp_atomic_check()
1106 crtc->base.id, sti_mixer_to_str(to_sti_mixer(crtc)), in sti_hqvdp_atomic_check()
1107 drm_plane->base.id, sti_plane_to_str(plane)); in sti_hqvdp_atomic_check()
1108 DRM_DEBUG_KMS("%s dst=(%dx%d)@(%d,%d) - src=(%dx%d)@(%d,%d)\n", in sti_hqvdp_atomic_check()
1125 struct drm_crtc *crtc = newstate->crtc; in sti_hqvdp_atomic_update()
1126 struct drm_framebuffer *fb = newstate->fb; in sti_hqvdp_atomic_update()
1138 if ((oldstate->fb == newstate->fb) && in sti_hqvdp_atomic_update()
1139 (oldstate->crtc_x == newstate->crtc_x) && in sti_hqvdp_atomic_update()
1140 (oldstate->crtc_y == newstate->crtc_y) && in sti_hqvdp_atomic_update()
1141 (oldstate->crtc_w == newstate->crtc_w) && in sti_hqvdp_atomic_update()
1142 (oldstate->crtc_h == newstate->crtc_h) && in sti_hqvdp_atomic_update()
1143 (oldstate->src_x == newstate->src_x) && in sti_hqvdp_atomic_update()
1144 (oldstate->src_y == newstate->src_y) && in sti_hqvdp_atomic_update()
1145 (oldstate->src_w == newstate->src_w) && in sti_hqvdp_atomic_update()
1146 (oldstate->src_h == newstate->src_h)) { in sti_hqvdp_atomic_update()
1149 plane->status = STI_PLANE_UPDATED; in sti_hqvdp_atomic_update()
1153 mode = &crtc->mode; in sti_hqvdp_atomic_update()
1154 dst_x = newstate->crtc_x; in sti_hqvdp_atomic_update()
1155 dst_y = newstate->crtc_y; in sti_hqvdp_atomic_update()
1156 dst_w = clamp_val(newstate->crtc_w, 0, mode->hdisplay - dst_x); in sti_hqvdp_atomic_update()
1157 dst_h = clamp_val(newstate->crtc_h, 0, mode->vdisplay - dst_y); in sti_hqvdp_atomic_update()
1159 src_x = newstate->src_x >> 16; in sti_hqvdp_atomic_update()
1160 src_y = newstate->src_y >> 16; in sti_hqvdp_atomic_update()
1161 src_w = newstate->src_w >> 16; in sti_hqvdp_atomic_update()
1162 src_h = newstate->src_h >> 16; in sti_hqvdp_atomic_update()
1165 if (cmd_offset == -1) { in sti_hqvdp_atomic_update()
1169 cmd = hqvdp->hqvdp_cmd + cmd_offset; in sti_hqvdp_atomic_update()
1172 cmd->top.config = TOP_CONFIG_PROGRESSIVE; in sti_hqvdp_atomic_update()
1173 cmd->top.mem_format = TOP_MEM_FORMAT_DFLT; in sti_hqvdp_atomic_update()
1174 cmd->hvsrc.param_ctrl = HVSRC_PARAM_CTRL_DFLT; in sti_hqvdp_atomic_update()
1175 cmd->csdi.config = CSDI_CONFIG_PROG; in sti_hqvdp_atomic_update()
1179 cmd->iqi.config = IQI_CONFIG_DFLT; in sti_hqvdp_atomic_update()
1180 cmd->iqi.con_bri = IQI_CON_BRI_DFLT; in sti_hqvdp_atomic_update()
1181 cmd->iqi.sat_gain = IQI_SAT_GAIN_DFLT; in sti_hqvdp_atomic_update()
1182 cmd->iqi.pxf_conf = IQI_PXF_CONF_DFLT; in sti_hqvdp_atomic_update()
1186 DRM_DEBUG_DRIVER("drm FB:%d format:%.4s phys@:0x%lx\n", fb->base.id, in sti_hqvdp_atomic_update()
1187 (char *)&fb->format->format, in sti_hqvdp_atomic_update()
1188 (unsigned long) dma_obj->dma_addr); in sti_hqvdp_atomic_update()
1191 cmd->top.current_luma = (u32) dma_obj->dma_addr + fb->offsets[0]; in sti_hqvdp_atomic_update()
1192 cmd->top.current_chroma = (u32) dma_obj->dma_addr + fb->offsets[1]; in sti_hqvdp_atomic_update()
1195 cmd->top.luma_processed_pitch = fb->pitches[0]; in sti_hqvdp_atomic_update()
1196 cmd->top.luma_src_pitch = fb->pitches[0]; in sti_hqvdp_atomic_update()
1197 cmd->top.chroma_processed_pitch = fb->pitches[1]; in sti_hqvdp_atomic_update()
1198 cmd->top.chroma_src_pitch = fb->pitches[1]; in sti_hqvdp_atomic_update()
1205 cmd->top.input_viewport_size = src_h << 16 | src_w; in sti_hqvdp_atomic_update()
1206 cmd->top.input_frame_size = src_h << 16 | src_w; in sti_hqvdp_atomic_update()
1207 cmd->hvsrc.output_picture_size = dst_h << 16 | dst_w; in sti_hqvdp_atomic_update()
1208 cmd->top.input_viewport_ori = src_y << 16 | src_x; in sti_hqvdp_atomic_update()
1211 if (fb->flags & DRM_MODE_FB_INTERLACED) { in sti_hqvdp_atomic_update()
1213 cmd->top.config = TOP_CONFIG_INTER_TOP; in sti_hqvdp_atomic_update()
1216 cmd->top.input_frame_size = (src_h / 2) << 16 | src_w; in sti_hqvdp_atomic_update()
1217 cmd->top.luma_processed_pitch *= 2; in sti_hqvdp_atomic_update()
1218 cmd->top.luma_src_pitch *= 2; in sti_hqvdp_atomic_update()
1219 cmd->top.chroma_processed_pitch *= 2; in sti_hqvdp_atomic_update()
1220 cmd->top.chroma_src_pitch *= 2; in sti_hqvdp_atomic_update()
1223 cmd->csdi.config = CSDI_CONFIG_INTER_DIR; in sti_hqvdp_atomic_update()
1224 cmd->csdi.config2 = CSDI_CONFIG2_DFLT; in sti_hqvdp_atomic_update()
1225 cmd->csdi.dcdi_config = CSDI_DCDI_CONFIG_DFLT; in sti_hqvdp_atomic_update()
1230 sti_hqvdp_update_hvsrc(HVSRC_HORI, scale_h, &cmd->hvsrc); in sti_hqvdp_atomic_update()
1233 sti_hqvdp_update_hvsrc(HVSRC_VERT, scale_v, &cmd->hvsrc); in sti_hqvdp_atomic_update()
1235 writel(hqvdp->hqvdp_cmd_paddr + cmd_offset, in sti_hqvdp_atomic_update()
1236 hqvdp->regs + HQVDP_MBX_NEXT_CMD); in sti_hqvdp_atomic_update()
1239 if (fb->flags & DRM_MODE_FB_INTERLACED) in sti_hqvdp_atomic_update()
1240 hqvdp->btm_field_pending = true; in sti_hqvdp_atomic_update()
1242 dev_dbg(hqvdp->dev, "%s Posted command:0x%x\n", in sti_hqvdp_atomic_update()
1243 __func__, hqvdp->hqvdp_cmd_paddr + cmd_offset); in sti_hqvdp_atomic_update()
1247 plane->status = STI_PLANE_UPDATED; in sti_hqvdp_atomic_update()
1257 if (!oldstate->crtc) { in sti_hqvdp_atomic_disable()
1259 drm_plane->base.id); in sti_hqvdp_atomic_disable()
1264 oldstate->crtc->base.id, in sti_hqvdp_atomic_disable()
1265 sti_mixer_to_str(to_sti_mixer(oldstate->crtc)), in sti_hqvdp_atomic_disable()
1266 drm_plane->base.id, sti_plane_to_str(plane)); in sti_hqvdp_atomic_disable()
1268 plane->status = STI_PLANE_DISABLING; in sti_hqvdp_atomic_disable()
1282 hqvdp_debugfs_init(hqvdp, drm_plane->dev->primary); in sti_hqvdp_late_register()
1303 hqvdp->plane.desc = desc; in sti_hqvdp_create()
1304 hqvdp->plane.status = STI_PLANE_DISABLED; in sti_hqvdp_create()
1308 res = drm_universal_plane_init(drm_dev, &hqvdp->plane.drm_plane, 1, in sti_hqvdp_create()
1318 drm_plane_helper_add(&hqvdp->plane.drm_plane, &sti_hqvdp_helpers_funcs); in sti_hqvdp_create()
1320 sti_plane_init_property(&hqvdp->plane, DRM_PLANE_TYPE_OVERLAY); in sti_hqvdp_create()
1322 return &hqvdp->plane.drm_plane; in sti_hqvdp_create()
1333 hqvdp->drm_dev = drm_dev; in sti_hqvdp_bind()
1336 plane = sti_hqvdp_create(drm_dev, hqvdp->dev, STI_HQVDP_0); in sti_hqvdp_bind()
1356 struct device *dev = &pdev->dev; in sti_hqvdp_probe()
1366 return -ENOMEM; in sti_hqvdp_probe()
1369 hqvdp->dev = dev; in sti_hqvdp_probe()
1375 return -ENXIO; in sti_hqvdp_probe()
1377 hqvdp->regs = devm_ioremap(dev, res->start, resource_size(res)); in sti_hqvdp_probe()
1378 if (!hqvdp->regs) { in sti_hqvdp_probe()
1380 return -ENXIO; in sti_hqvdp_probe()
1384 hqvdp->clk = devm_clk_get(dev, "hqvdp"); in sti_hqvdp_probe()
1385 hqvdp->clk_pix_main = devm_clk_get(dev, "pix_main"); in sti_hqvdp_probe()
1386 if (IS_ERR(hqvdp->clk) || IS_ERR(hqvdp->clk_pix_main)) { in sti_hqvdp_probe()
1388 return -ENXIO; in sti_hqvdp_probe()
1392 hqvdp->reset = devm_reset_control_get(dev, "hqvdp"); in sti_hqvdp_probe()
1393 if (!IS_ERR(hqvdp->reset)) in sti_hqvdp_probe()
1394 reset_control_deassert(hqvdp->reset); in sti_hqvdp_probe()
1396 vtg_np = of_parse_phandle(pdev->dev.of_node, "st,vtg", 0); in sti_hqvdp_probe()
1398 hqvdp->vtg = of_vtg_find(vtg_np); in sti_hqvdp_probe()
1403 return component_add(&pdev->dev, &sti_hqvdp_ops); in sti_hqvdp_probe()
1408 component_del(&pdev->dev, &sti_hqvdp_ops); in sti_hqvdp_remove()
1412 { .compatible = "st,stih407-hqvdp", },
1419 .name = "sti-hqvdp",