H A D | sti_hqvdp.c | 23 #define HQVDP_FMW_NAME "hqvdp-stih407.bin" 325 * @layer: layer structure for hqvdp it self 374 * @hqvdp: hqvdp structure 382 static int sti_hqvdp_get_free_cmd(struct sti_hqvdp *hqvdp) sti_hqvdp_get_free_cmd() argument 385 dma_addr_t cmd = hqvdp->hqvdp_cmd_paddr; sti_hqvdp_get_free_cmd() 388 curr_cmd = readl(hqvdp->regs + HQVDP_MBX_CURRENT_CMD); sti_hqvdp_get_free_cmd() 389 next_cmd = readl(hqvdp->regs + HQVDP_MBX_NEXT_CMD); sti_hqvdp_get_free_cmd() 402 * @hqvdp: hqvdp structure 410 static int sti_hqvdp_get_curr_cmd(struct sti_hqvdp *hqvdp) sti_hqvdp_get_curr_cmd() argument 413 dma_addr_t cmd = hqvdp->hqvdp_cmd_paddr; sti_hqvdp_get_curr_cmd() 416 curr_cmd = readl(hqvdp->regs + HQVDP_MBX_CURRENT_CMD); sti_hqvdp_get_curr_cmd() 487 * @layer: hqvdp layer 503 struct sti_hqvdp *hqvdp = to_sti_hqvdp(layer); sti_hqvdp_check_hw_scaling() local 507 lfw = layer->mode->htotal * (clk_get_rate(hqvdp->clk) / 1000000); sti_hqvdp_check_hw_scaling() 517 * @layer: hqvdp layer 527 struct sti_hqvdp *hqvdp = to_sti_hqvdp(layer); sti_hqvdp_prepare_layer() local 532 dev_dbg(hqvdp->dev, "%s %s\n", __func__, sti_layer_to_str(layer)); sti_hqvdp_prepare_layer() 535 hqvdp->vid_plane->funcs->update_plane(hqvdp->vid_plane, sti_hqvdp_prepare_layer() 542 cmd_offset = sti_hqvdp_get_free_cmd(hqvdp); sti_hqvdp_prepare_layer() 547 cmd = hqvdp->hqvdp_cmd + cmd_offset; sti_hqvdp_prepare_layer() 624 if (clk_prepare_enable(hqvdp->clk_pix_main)) { sti_hqvdp_prepare_layer() 631 sti_vtg_register_client(hqvdp->vtg, sti_hqvdp_prepare_layer() 632 &hqvdp->vtg_nb, layer->mixer_id)) { sti_hqvdp_prepare_layer() 643 struct sti_hqvdp *hqvdp = to_sti_hqvdp(layer); sti_hqvdp_commit_layer() local 646 dev_dbg(hqvdp->dev, "%s %s\n", __func__, sti_layer_to_str(layer)); sti_hqvdp_commit_layer() 648 cmd_offset = sti_hqvdp_get_free_cmd(hqvdp); sti_hqvdp_commit_layer() 654 writel(hqvdp->hqvdp_cmd_paddr + cmd_offset, sti_hqvdp_commit_layer() 655 hqvdp->regs + HQVDP_MBX_NEXT_CMD); sti_hqvdp_commit_layer() 657 hqvdp->curr_field_count++; sti_hqvdp_commit_layer() 661 hqvdp->btm_field_pending = true; sti_hqvdp_commit_layer() 663 dev_dbg(hqvdp->dev, "%s Posted command:0x%x\n", sti_hqvdp_commit_layer() 664 __func__, hqvdp->hqvdp_cmd_paddr + cmd_offset); sti_hqvdp_commit_layer() 671 struct sti_hqvdp *hqvdp = to_sti_hqvdp(layer); sti_hqvdp_disable_layer() local 678 sti_vtg_unregister_client(hqvdp->vtg, &hqvdp->vtg_nb)) sti_hqvdp_disable_layer() 682 writel(0, hqvdp->regs + HQVDP_MBX_NEXT_CMD); sti_hqvdp_disable_layer() 685 if (readl(hqvdp->regs + HQVDP_MBX_INFO_XP70) sti_hqvdp_disable_layer() 692 clk_disable_unprepare(hqvdp->clk_pix_main); sti_hqvdp_disable_layer() 700 hqvdp->vid_plane->funcs->disable_plane(hqvdp->vid_plane); sti_hqvdp_disable_layer() 718 struct sti_hqvdp *hqvdp = container_of(nb, struct sti_hqvdp, vtg_nb); sti_hqvdp_vtg_cb() local 727 if (hqvdp->btm_field_pending) { sti_hqvdp_vtg_cb() 729 btm_cmd_offset = sti_hqvdp_get_free_cmd(hqvdp); sti_hqvdp_vtg_cb() 730 top_cmd_offest = sti_hqvdp_get_curr_cmd(hqvdp); sti_hqvdp_vtg_cb() 736 btm_cmd = hqvdp->hqvdp_cmd + btm_cmd_offset; sti_hqvdp_vtg_cb() 737 top_cmd = hqvdp->hqvdp_cmd + top_cmd_offest; sti_hqvdp_vtg_cb() 748 writel(hqvdp->hqvdp_cmd_paddr + btm_cmd_offset, sti_hqvdp_vtg_cb() 749 hqvdp->regs + HQVDP_MBX_NEXT_CMD); sti_hqvdp_vtg_cb() 751 hqvdp->curr_field_count++; sti_hqvdp_vtg_cb() 752 hqvdp->btm_field_pending = false; sti_hqvdp_vtg_cb() 754 dev_dbg(hqvdp->dev, "%s Posted command:0x%x\n", sti_hqvdp_vtg_cb() 755 __func__, hqvdp->hqvdp_cmd_paddr); sti_hqvdp_vtg_cb() 777 struct sti_hqvdp *hqvdp = to_sti_hqvdp(layer); sti_hqvd_init() local 781 hqvdp->vid_plane = sti_hqvdp_find_vid(hqvdp->drm_dev, STI_VID_0); sti_hqvd_init() 782 if (!hqvdp->vid_plane) { sti_hqvd_init() 787 hqvdp->vtg_nb.notifier_call = sti_hqvdp_vtg_cb; sti_hqvd_init() 791 hqvdp->hqvdp_cmd = dma_alloc_writecombine(hqvdp->dev, size, sti_hqvd_init() 792 &hqvdp->hqvdp_cmd_paddr, sti_hqvd_init() 794 if (!hqvdp->hqvdp_cmd) { sti_hqvd_init() 799 memset(hqvdp->hqvdp_cmd, 0, size); sti_hqvd_init() 813 struct sti_hqvdp *hqvdp = dev_get_drvdata(dev); sti_hqvdp_create() local 815 hqvdp->layer.ops = &hqvdp_ops; sti_hqvdp_create() 817 return &hqvdp->layer; sti_hqvdp_create() 821 static void sti_hqvdp_init_plugs(struct sti_hqvdp *hqvdp) sti_hqvdp_init_plugs() argument 824 writel(PLUG_PAGE_SIZE_256, hqvdp->regs + HQVDP_RD_PLUG_PAGE_SIZE); sti_hqvdp_init_plugs() 825 writel(PLUG_MIN_OPC_8, hqvdp->regs + HQVDP_RD_PLUG_MIN_OPC); sti_hqvdp_init_plugs() 826 writel(PLUG_MAX_OPC_64, hqvdp->regs + HQVDP_RD_PLUG_MAX_OPC); sti_hqvdp_init_plugs() 827 writel(PLUG_MAX_CHK_2X, hqvdp->regs + HQVDP_RD_PLUG_MAX_CHK); sti_hqvdp_init_plugs() 828 writel(PLUG_MAX_MSG_1X, hqvdp->regs + HQVDP_RD_PLUG_MAX_MSG); sti_hqvdp_init_plugs() 829 writel(PLUG_MIN_SPACE_1, hqvdp->regs + HQVDP_RD_PLUG_MIN_SPACE); sti_hqvdp_init_plugs() 830 writel(PLUG_CONTROL_ENABLE, hqvdp->regs + HQVDP_RD_PLUG_CONTROL); sti_hqvdp_init_plugs() 832 writel(PLUG_PAGE_SIZE_256, hqvdp->regs + HQVDP_WR_PLUG_PAGE_SIZE); sti_hqvdp_init_plugs() 833 writel(PLUG_MIN_OPC_8, hqvdp->regs + HQVDP_WR_PLUG_MIN_OPC); sti_hqvdp_init_plugs() 834 writel(PLUG_MAX_OPC_64, hqvdp->regs + HQVDP_WR_PLUG_MAX_OPC); sti_hqvdp_init_plugs() 835 writel(PLUG_MAX_CHK_2X, hqvdp->regs + HQVDP_WR_PLUG_MAX_CHK); sti_hqvdp_init_plugs() 836 writel(PLUG_MAX_MSG_1X, hqvdp->regs + HQVDP_WR_PLUG_MAX_MSG); sti_hqvdp_init_plugs() 837 writel(PLUG_MIN_SPACE_1, hqvdp->regs + HQVDP_WR_PLUG_MIN_SPACE); sti_hqvdp_init_plugs() 838 writel(PLUG_CONTROL_ENABLE, hqvdp->regs + HQVDP_WR_PLUG_CONTROL); sti_hqvdp_init_plugs() 844 * @ctxt: hqvdp structure 850 struct sti_hqvdp *hqvdp = ctxt; sti_hqvdp_start_xp70() local 893 if (clk_prepare_enable(hqvdp->clk)) sti_hqvdp_start_xp70() 897 writel(SW_RESET_CTRL_FULL, hqvdp->regs + HQVDP_MBX_SW_RESET_CTRL); sti_hqvdp_start_xp70() 900 if (readl(hqvdp->regs + HQVDP_MBX_STARTUP_CTRL1) sti_hqvdp_start_xp70() 912 writel(fw_rd_plug[i], hqvdp->regs + HQVDP_RD_PLUG + i * 4); sti_hqvdp_start_xp70() 914 writel(fw_wr_plug[i], hqvdp->regs + HQVDP_WR_PLUG + i * 4); sti_hqvdp_start_xp70() 916 sti_hqvdp_init_plugs(hqvdp); sti_hqvdp_start_xp70() 919 writel(STARTUP_CTRL1_AUTH_IDLE, hqvdp->regs + HQVDP_MBX_STARTUP_CTRL1); sti_hqvdp_start_xp70() 922 writel(SOFT_VSYNC_SW_CTRL_IRQ, hqvdp->regs + HQVDP_MBX_SOFT_VSYNC); sti_hqvdp_start_xp70() 923 writel(0, hqvdp->regs + HQVDP_MBX_NEXT_CMD); sti_hqvdp_start_xp70() 927 writel(fw_pmem[i], hqvdp->regs + HQVDP_PMEM + i * 4); sti_hqvdp_start_xp70() 929 writel(fw_dmem[i], hqvdp->regs + HQVDP_DMEM + i * 4); sti_hqvdp_start_xp70() 932 writel(STARTUP_CTRL2_FETCH_EN, hqvdp->regs + HQVDP_MBX_STARTUP_CTRL2); sti_hqvdp_start_xp70() 936 if (readl(hqvdp->regs + HQVDP_MBX_INFO_XP70) sti_hqvdp_start_xp70() 947 writel(SOFT_VSYNC_HW, hqvdp->regs + HQVDP_MBX_SOFT_VSYNC); sti_hqvdp_start_xp70() 956 struct sti_hqvdp *hqvdp = dev_get_drvdata(dev); sti_hqvdp_bind() local 963 hqvdp->drm_dev = drm_dev; sti_hqvdp_bind() 967 HQVDP_FMW_NAME, hqvdp->dev, sti_hqvdp_bind() 968 GFP_KERNEL, hqvdp, sti_hqvdp_start_xp70); sti_hqvdp_bind() 974 layer = sti_layer_create(hqvdp->dev, STI_HQVDP_0, hqvdp->regs); sti_hqvdp_bind() 1000 struct sti_hqvdp *hqvdp; sti_hqvdp_probe() local 1005 hqvdp = devm_kzalloc(dev, sizeof(*hqvdp), GFP_KERNEL); sti_hqvdp_probe() 1006 if (!hqvdp) { sti_hqvdp_probe() 1011 hqvdp->dev = dev; sti_hqvdp_probe() 1019 hqvdp->regs = devm_ioremap(dev, res->start, resource_size(res)); sti_hqvdp_probe() 1020 if (hqvdp->regs == NULL) { sti_hqvdp_probe() 1026 hqvdp->clk = devm_clk_get(dev, "hqvdp"); sti_hqvdp_probe() 1027 hqvdp->clk_pix_main = devm_clk_get(dev, "pix_main"); sti_hqvdp_probe() 1028 if (IS_ERR(hqvdp->clk) || IS_ERR(hqvdp->clk_pix_main)) { sti_hqvdp_probe() 1034 hqvdp->reset = devm_reset_control_get(dev, "hqvdp"); sti_hqvdp_probe() 1035 if (!IS_ERR(hqvdp->reset)) sti_hqvdp_probe() 1036 reset_control_deassert(hqvdp->reset); sti_hqvdp_probe() 1040 hqvdp->vtg = of_vtg_find(vtg_np); sti_hqvdp_probe() 1042 platform_set_drvdata(pdev, hqvdp); sti_hqvdp_probe() 1054 { .compatible = "st,stih407-hqvdp", }, 1061 .name = "sti-hqvdp",
|