Lines Matching refs:vop2

141 	struct vop2 *vop2;  member
159 struct vop2 *vop2; member
177 struct vop2 { struct
252 static void vop2_lock(struct vop2 *vop2) in vop2_lock() argument
254 mutex_lock(&vop2->vop2_lock); in vop2_lock()
257 static void vop2_unlock(struct vop2 *vop2) in vop2_unlock() argument
259 mutex_unlock(&vop2->vop2_lock); in vop2_unlock()
262 static void vop2_writel(struct vop2 *vop2, u32 offset, u32 v) in vop2_writel() argument
264 regmap_write(vop2->map, offset, v); in vop2_writel()
269 regmap_write(vp->vop2->map, vp->data->offset + offset, v); in vop2_vp_write()
272 static u32 vop2_readl(struct vop2 *vop2, u32 offset) in vop2_readl() argument
276 regmap_read(vop2->map, offset, &val); in vop2_readl()
302 struct vop2 *vop2 = vp->vop2; in vop2_cfg_done() local
307 regmap_set_bits(vop2->map, RK3568_REG_CFG_DONE, val); in vop2_cfg_done()
498 static bool vop2_output_rg_swap(struct vop2 *vop2, u32 bus_format) in vop2_output_rg_swap() argument
500 if (vop2->data->soc_id == 3588) { in vop2_output_rg_swap()
548 struct vop2 *vop2 = win->vop2; in rockchip_vop2_mod_supported() local
557 drm_dbg_kms(vop2->drm, "Unsupported format modifier 0x%llx\n", in rockchip_vop2_mod_supported()
702 static void vop2_setup_scale(struct vop2 *vop2, const struct vop2_win *win, in vop2_setup_scale() argument
744 drm_dbg(vop2->drm, "%s dst_w[%d] should align as 2 pixel\n", in vop2_setup_scale()
886 struct vop2 *vop2 = vp->vop2; in vop2_crtc_enable_irq() local
888 vop2_writel(vop2, RK3568_VP_INT_CLR(vp->id), irq << 16 | irq); in vop2_crtc_enable_irq()
889 vop2_writel(vop2, RK3568_VP_INT_EN(vp->id), irq << 16 | irq); in vop2_crtc_enable_irq()
894 struct vop2 *vop2 = vp->vop2; in vop2_crtc_disable_irq() local
896 vop2_writel(vop2, RK3568_VP_INT_EN(vp->id), irq << 16); in vop2_crtc_disable_irq()
899 static int vop2_core_clks_prepare_enable(struct vop2 *vop2) in vop2_core_clks_prepare_enable() argument
903 ret = clk_prepare_enable(vop2->hclk); in vop2_core_clks_prepare_enable()
905 drm_err(vop2->drm, "failed to enable hclk - %d\n", ret); in vop2_core_clks_prepare_enable()
909 ret = clk_prepare_enable(vop2->aclk); in vop2_core_clks_prepare_enable()
911 drm_err(vop2->drm, "failed to enable aclk - %d\n", ret); in vop2_core_clks_prepare_enable()
915 ret = clk_prepare_enable(vop2->pclk); in vop2_core_clks_prepare_enable()
917 drm_err(vop2->drm, "failed to enable pclk - %d\n", ret); in vop2_core_clks_prepare_enable()
923 clk_disable_unprepare(vop2->aclk); in vop2_core_clks_prepare_enable()
925 clk_disable_unprepare(vop2->hclk); in vop2_core_clks_prepare_enable()
930 static void rk3588_vop2_power_domain_enable_all(struct vop2 *vop2) in rk3588_vop2_power_domain_enable_all() argument
934 pd = vop2_readl(vop2, RK3588_SYS_PD_CTRL); in rk3588_vop2_power_domain_enable_all()
938 vop2_writel(vop2, RK3588_SYS_PD_CTRL, pd); in rk3588_vop2_power_domain_enable_all()
941 static void vop2_enable(struct vop2 *vop2) in vop2_enable() argument
945 ret = pm_runtime_resume_and_get(vop2->dev); in vop2_enable()
947 drm_err(vop2->drm, "failed to get pm runtime: %d\n", ret); in vop2_enable()
951 ret = vop2_core_clks_prepare_enable(vop2); in vop2_enable()
953 pm_runtime_put_sync(vop2->dev); in vop2_enable()
957 ret = rockchip_drm_dma_attach_device(vop2->drm, vop2->dev); in vop2_enable()
959 drm_err(vop2->drm, "failed to attach dma mapping, %d\n", ret); in vop2_enable()
963 if (vop2->data->soc_id == 3566) in vop2_enable()
964 vop2_writel(vop2, RK3568_OTP_WIN_EN, 1); in vop2_enable()
966 if (vop2->data->soc_id == 3588) in vop2_enable()
967 rk3588_vop2_power_domain_enable_all(vop2); in vop2_enable()
969 vop2_writel(vop2, RK3568_REG_CFG_DONE, RK3568_REG_CFG_DONE__GLB_CFG_DONE_EN); in vop2_enable()
975 regmap_clear_bits(vop2->map, RK3568_SYS_AUTO_GATING_CTRL, in vop2_enable()
978 vop2_writel(vop2, RK3568_SYS0_INT_CLR, in vop2_enable()
980 vop2_writel(vop2, RK3568_SYS0_INT_EN, in vop2_enable()
982 vop2_writel(vop2, RK3568_SYS1_INT_CLR, in vop2_enable()
984 vop2_writel(vop2, RK3568_SYS1_INT_EN, in vop2_enable()
988 static void vop2_disable(struct vop2 *vop2) in vop2_disable() argument
990 rockchip_drm_dma_detach_device(vop2->drm, vop2->dev); in vop2_disable()
992 pm_runtime_put_sync(vop2->dev); in vop2_disable()
994 regcache_drop_region(vop2->map, 0, vop2_regmap_config.max_register); in vop2_disable()
996 clk_disable_unprepare(vop2->pclk); in vop2_disable()
997 clk_disable_unprepare(vop2->aclk); in vop2_disable()
998 clk_disable_unprepare(vop2->hclk); in vop2_disable()
1005 struct vop2 *vop2 = vp->vop2; in vop2_crtc_atomic_disable() local
1009 vop2_lock(vop2); in vop2_crtc_atomic_disable()
1032 drm_info(vop2->drm, "wait for vp%d dsp_hold timeout\n", vp->id); in vop2_crtc_atomic_disable()
1038 vop2->enable_count--; in vop2_crtc_atomic_disable()
1040 if (!vop2->enable_count) in vop2_crtc_atomic_disable()
1041 vop2_disable(vop2); in vop2_crtc_atomic_disable()
1043 vop2_unlock(vop2); in vop2_crtc_atomic_disable()
1062 struct vop2 *vop2; in vop2_plane_atomic_check() local
1075 vop2 = vp->vop2; in vop2_plane_atomic_check()
1076 vop2_data = vop2->data; in vop2_plane_atomic_check()
1097 drm_err(vop2->drm, "Invalid size: %dx%d->%dx%d, min size is 4x4\n", in vop2_plane_atomic_check()
1106 drm_err(vop2->drm, "Invalid source: %dx%d. max input: %dx%d\n", in vop2_plane_atomic_check()
1119 drm_err(vop2->drm, "Invalid Source: Yuv format not support odd xpos\n"); in vop2_plane_atomic_check()
1131 struct vop2 *vop2 = win->vop2; in vop2_plane_atomic_disable() local
1133 drm_dbg(vop2->drm, "%s disable\n", win->data->name); in vop2_plane_atomic_disable()
1202 struct vop2 *vop2 = win->vop2; in vop2_plane_atomic_update() local
1274 drm_err(vop2->drm, "vp%d %s dest->x1[%d] + dsp_w[%d] exceed mode hdisplay[%d]\n", in vop2_plane_atomic_update()
1285 drm_err(vop2->drm, "vp%d %s dest->y1[%d] + dsp_h[%d] exceed mode vdisplay[%d]\n", in vop2_plane_atomic_update()
1299 drm_err(vop2->drm, "vp%d %s act_w[%d] MODE 16 == 1\n", in vop2_plane_atomic_update()
1306 drm_err(vop2->drm, "vp%d %s actual_w[%d] not 4 pixel aligned\n", in vop2_plane_atomic_update()
1317 drm_dbg(vop2->drm, "vp%d update %s[%dx%d->%dx%d@%dx%d] fmt[%p4cc_%s] addr[%pad]\n", in vop2_plane_atomic_update()
1344 drm_err(vop2->drm, "vp%d %s stride[%d] not 64 pixel aligned\n", in vop2_plane_atomic_update()
1372 if (vop2->data->soc_id == 3566 || vop2->data->soc_id == 3568) in vop2_plane_atomic_update()
1421 vop2_setup_scale(vop2, win, actual_w, actual_h, dsp_w, dsp_h, fb->format->format); in vop2_plane_atomic_update()
1534 vop2_writel(vp->vop2, RK3568_VP_BG_MIX_CTRL(vp->id), in vop2_post_config()
1576 struct vop2 *vop2 = vp->vop2; in rk3568_set_intf_mux() local
1580 die = vop2_readl(vop2, RK3568_DSP_IF_EN); in rk3568_set_intf_mux()
1581 dip = vop2_readl(vop2, RK3568_DSP_IF_POL); in rk3568_set_intf_mux()
1591 regmap_write(vop2->sys_grf, RK3568_GRF_VO_CON1, BIT(3 + 16) | BIT(3)); in rk3568_set_intf_mux()
1593 regmap_write(vop2->sys_grf, RK3568_GRF_VO_CON1, BIT(3 + 16)); in rk3568_set_intf_mux()
1638 drm_err(vop2->drm, "Invalid interface id %d on vp%d\n", id, vp->id); in rk3568_set_intf_mux()
1644 vop2_writel(vop2, RK3568_DSP_IF_EN, die); in rk3568_set_intf_mux()
1645 vop2_writel(vop2, RK3568_DSP_IF_POL, dip); in rk3568_set_intf_mux()
1676 struct vop2 *vop2 = vp->vop2; in rk3588_calc_cru_cfg() local
1726 drm_err(vop2->drm, "DP dclk_out_rate out of range, dclk_out_rate: %ld KHZ\n", in rk3588_calc_cru_cfg()
1743 drm_err(vop2->drm, "MIPI dclk out of range, dclk_out_rate: %ld KHZ\n", in rk3588_calc_cru_cfg()
1762 drm_dbg(vop2->drm, "dclk: %ld, pixclk_div: %d, dclk_div: %d\n", in rk3588_calc_cru_cfg()
1796 struct vop2 *vop2 = vp->vop2; in rk3588_set_intf_mux() local
1809 die = vop2_readl(vop2, RK3568_DSP_IF_EN); in rk3588_set_intf_mux()
1810 dip = vop2_readl(vop2, RK3568_DSP_IF_POL); in rk3588_set_intf_mux()
1811 div = vop2_readl(vop2, RK3568_DSP_IF_CTRL); in rk3588_set_intf_mux()
1823 regmap_write(vop2->vop_grf, RK3588_GRF_VOP_CON2, HIWORD_UPDATE(1, 1, 1)); in rk3588_set_intf_mux()
1824 regmap_write(vop2->vo1_grf, RK3588_GRF_VO1_CON0, HIWORD_UPDATE(val, 6, 5)); in rk3588_set_intf_mux()
1835 regmap_write(vop2->vop_grf, RK3588_GRF_VOP_CON2, HIWORD_UPDATE(1, 4, 4)); in rk3588_set_intf_mux()
1836 regmap_write(vop2->vo1_grf, RK3588_GRF_VO1_CON0, HIWORD_UPDATE(val, 8, 7)); in rk3588_set_intf_mux()
1846 regmap_write(vop2->vop_grf, RK3588_GRF_VOP_CON2, HIWORD_UPDATE(1, 0, 0)); in rk3588_set_intf_mux()
1856 regmap_write(vop2->vop_grf, RK3588_GRF_VOP_CON2, HIWORD_UPDATE(1, 3, 3)); in rk3588_set_intf_mux()
1889 drm_err(vop2->drm, "Invalid interface id %d on vp%d\n", id, vp->id); in rk3588_set_intf_mux()
1896 vop2_writel(vop2, RK3568_DSP_IF_EN, die); in rk3588_set_intf_mux()
1897 vop2_writel(vop2, RK3568_DSP_IF_CTRL, div); in rk3588_set_intf_mux()
1898 vop2_writel(vop2, RK3568_DSP_IF_POL, dip); in rk3588_set_intf_mux()
1905 struct vop2 *vop2 = vp->vop2; in vop2_set_intf_mux() local
1907 if (vop2->data->soc_id == 3566 || vop2->data->soc_id == 3568) in vop2_set_intf_mux()
1909 else if (vop2->data->soc_id == 3588) in vop2_set_intf_mux()
1924 struct vop2 *vop2 = vp->vop2; in vop2_crtc_atomic_enable() local
1925 const struct vop2_data *vop2_data = vop2->data; in vop2_crtc_atomic_enable()
1948 drm_dbg(vop2->drm, "Update mode to %dx%d%s%d, type: %d for vp%d\n", in vop2_crtc_atomic_enable()
1952 vop2_lock(vop2); in vop2_crtc_atomic_enable()
1956 drm_err(vop2->drm, "failed to enable dclk for video port%d - %d\n", in vop2_crtc_atomic_enable()
1958 vop2_unlock(vop2); in vop2_crtc_atomic_enable()
1962 if (!vop2->enable_count) in vop2_crtc_atomic_enable()
1963 vop2_enable(vop2); in vop2_crtc_atomic_enable()
1965 vop2->enable_count++; in vop2_crtc_atomic_enable()
1991 vop2_unlock(vop2); in vop2_crtc_atomic_enable()
2005 if (vop2_output_rg_swap(vop2, vcstate->bus_format)) in vop2_crtc_atomic_enable()
2040 vop2_writel(vop2, RK3568_VP_LINE_FLAG(vp->id), in vop2_crtc_atomic_enable()
2062 vop2_unlock(vop2); in vop2_crtc_atomic_enable()
2146 static int vop2_find_start_mixer_id_for_vp(struct vop2 *vop2, u8 port_id) in vop2_find_start_mixer_id_for_vp() argument
2153 vp = &vop2->vps[i]; in vop2_find_start_mixer_id_for_vp()
2160 static void vop2_setup_cluster_alpha(struct vop2 *vop2, struct vop2_win *main_win) in vop2_setup_cluster_alpha() argument
2188 vop2_writel(vop2, RK3568_CLUSTER0_MIX_SRC_COLOR_CTRL + offset, in vop2_setup_cluster_alpha()
2190 vop2_writel(vop2, RK3568_CLUSTER0_MIX_DST_COLOR_CTRL + offset, in vop2_setup_cluster_alpha()
2192 vop2_writel(vop2, RK3568_CLUSTER0_MIX_SRC_ALPHA_CTRL + offset, in vop2_setup_cluster_alpha()
2194 vop2_writel(vop2, RK3568_CLUSTER0_MIX_DST_ALPHA_CTRL + offset, in vop2_setup_cluster_alpha()
2200 struct vop2 *vop2 = vp->vop2; in vop2_setup_alpha() local
2212 mixer_id = vop2_find_start_mixer_id_for_vp(vop2, vp->id); in vop2_setup_alpha()
2271 vop2_writel(vop2, RK3568_MIX0_SRC_COLOR_CTRL + offset, in vop2_setup_alpha()
2273 vop2_writel(vop2, RK3568_MIX0_DST_COLOR_CTRL + offset, in vop2_setup_alpha()
2275 vop2_writel(vop2, RK3568_MIX0_SRC_ALPHA_CTRL + offset, in vop2_setup_alpha()
2277 vop2_writel(vop2, RK3568_MIX0_DST_ALPHA_CTRL + offset, in vop2_setup_alpha()
2291 vop2_writel(vop2, RK3568_HDR0_SRC_COLOR_CTRL, in vop2_setup_alpha()
2293 vop2_writel(vop2, RK3568_HDR0_DST_COLOR_CTRL, in vop2_setup_alpha()
2295 vop2_writel(vop2, RK3568_HDR0_SRC_ALPHA_CTRL, in vop2_setup_alpha()
2297 vop2_writel(vop2, RK3568_HDR0_DST_ALPHA_CTRL, in vop2_setup_alpha()
2300 vop2_writel(vop2, RK3568_HDR0_SRC_COLOR_CTRL, 0); in vop2_setup_alpha()
2307 struct vop2 *vop2 = vp->vop2; in vop2_setup_layer_mixer() local
2314 struct vop2_video_port *vp0 = &vop2->vps[0]; in vop2_setup_layer_mixer()
2315 struct vop2_video_port *vp1 = &vop2->vps[1]; in vop2_setup_layer_mixer()
2316 struct vop2_video_port *vp2 = &vop2->vps[2]; in vop2_setup_layer_mixer()
2319 ovl_ctrl = vop2_readl(vop2, RK3568_OVL_CTRL); in vop2_setup_layer_mixer()
2326 vop2_writel(vop2, RK3568_OVL_CTRL, ovl_ctrl); in vop2_setup_layer_mixer()
2328 port_sel = vop2_readl(vop2, RK3568_OVL_PORT_SEL); in vop2_setup_layer_mixer()
2349 layer_sel = vop2_readl(vop2, RK3568_OVL_LAYER_SEL); in vop2_setup_layer_mixer()
2353 ofs += vop2->vps[i].nlayers; in vop2_setup_layer_mixer()
2415 vop2_writel(vop2, RK3568_OVL_LAYER_SEL, layer_sel); in vop2_setup_layer_mixer()
2416 vop2_writel(vop2, RK3568_OVL_PORT_SEL, port_sel); in vop2_setup_layer_mixer()
2419 static void vop2_setup_dly_for_windows(struct vop2 *vop2) in vop2_setup_dly_for_windows() argument
2425 for (i = 0; i < vop2->data->win_size; i++) { in vop2_setup_dly_for_windows()
2428 win = &vop2->win[i]; in vop2_setup_dly_for_windows()
2455 vop2_writel(vop2, RK3568_CLUSTER_DLY_NUM, cdly); in vop2_setup_dly_for_windows()
2456 vop2_writel(vop2, RK3568_SMART_DLY_NUM, sdly); in vop2_setup_dly_for_windows()
2463 struct vop2 *vop2 = vp->vop2; in vop2_crtc_atomic_begin() local
2476 vop2_setup_cluster_alpha(vop2, win); in vop2_crtc_atomic_begin()
2484 vop2_setup_dly_for_windows(vop2); in vop2_crtc_atomic_begin()
2569 struct vop2 *vop2 = data; in vop2_isr() local
2570 const struct vop2_data *vop2_data = vop2->data; in vop2_isr()
2579 if (!pm_runtime_get_if_in_use(vop2->dev)) in vop2_isr()
2583 struct vop2_video_port *vp = &vop2->vps[i]; in vop2_isr()
2587 irqs = vop2_readl(vop2, RK3568_VP_INT_STATUS(vp->id)); in vop2_isr()
2588 vop2_writel(vop2, RK3568_VP_INT_CLR(vp->id), irqs << 16 | irqs); in vop2_isr()
2599 u32 val = vop2_readl(vop2, RK3568_REG_CFG_DONE); in vop2_isr()
2613 drm_err_ratelimited(vop2->drm, in vop2_isr()
2620 axi_irqs[0] = vop2_readl(vop2, RK3568_SYS0_INT_STATUS); in vop2_isr()
2621 vop2_writel(vop2, RK3568_SYS0_INT_CLR, axi_irqs[0] << 16 | axi_irqs[0]); in vop2_isr()
2622 axi_irqs[1] = vop2_readl(vop2, RK3568_SYS1_INT_STATUS); in vop2_isr()
2623 vop2_writel(vop2, RK3568_SYS1_INT_CLR, axi_irqs[1] << 16 | axi_irqs[1]); in vop2_isr()
2627 drm_err_ratelimited(vop2->drm, "BUS_ERROR irq err\n"); in vop2_isr()
2632 pm_runtime_put(vop2->dev); in vop2_isr()
2637 static int vop2_plane_init(struct vop2 *vop2, struct vop2_win *win, in vop2_plane_init() argument
2646 ret = drm_universal_plane_init(vop2->drm, &win->base, possible_crtcs, in vop2_plane_init()
2652 drm_err(vop2->drm, "failed to initialize plane %d\n", ret); in vop2_plane_init()
2665 vop2->registered_num_wins - 1); in vop2_plane_init()
2670 static struct vop2_video_port *find_vp_without_primary(struct vop2 *vop2) in find_vp_without_primary() argument
2674 for (i = 0; i < vop2->data->nr_vps; i++) { in find_vp_without_primary()
2675 struct vop2_video_port *vp = &vop2->vps[i]; in find_vp_without_primary()
2688 static int vop2_create_crtcs(struct vop2 *vop2) in vop2_create_crtcs() argument
2690 const struct vop2_data *vop2_data = vop2->data; in vop2_create_crtcs()
2691 struct drm_device *drm = vop2->drm; in vop2_create_crtcs()
2692 struct device *dev = vop2->dev; in vop2_create_crtcs()
2705 vp = &vop2->vps[i]; in vop2_create_crtcs()
2706 vp->vop2 = vop2; in vop2_create_crtcs()
2711 vp->dclk = devm_clk_get(vop2->dev, dclk_name); in vop2_create_crtcs()
2713 drm_err(vop2->drm, "failed to get %s\n", dclk_name); in vop2_create_crtcs()
2719 drm_dbg(vop2->drm, "%s: No remote for vp%d\n", __func__, i); in vop2_create_crtcs()
2726 drm_err(vop2->drm, "no port node found for video_port%d\n", i); in vop2_create_crtcs()
2735 for (i = 0; i < vop2->registered_num_wins; i++) { in vop2_create_crtcs()
2736 struct vop2_win *win = &vop2->win[i]; in vop2_create_crtcs()
2739 if (vop2->data->soc_id == 3566) { in vop2_create_crtcs()
2754 vp = find_vp_without_primary(vop2); in vop2_create_crtcs()
2768 ret = vop2_plane_init(vop2, win, possible_crtcs); in vop2_create_crtcs()
2770 drm_err(vop2->drm, "failed to init plane %s: %d\n", in vop2_create_crtcs()
2777 vp = &vop2->vps[i]; in vop2_create_crtcs()
2788 drm_err(vop2->drm, "crtc init for video_port%d failed\n", i); in vop2_create_crtcs()
2802 for (i = 0; i < vop2->data->nr_vps; i++) { in vop2_create_crtcs()
2803 struct vop2_video_port *vp = &vop2->vps[i]; in vop2_create_crtcs()
2812 static void vop2_destroy_crtcs(struct vop2 *vop2) in vop2_destroy_crtcs() argument
2814 struct drm_device *drm = vop2->drm; in vop2_destroy_crtcs()
2833 static int vop2_find_rgb_encoder(struct vop2 *vop2) in vop2_find_rgb_encoder() argument
2835 struct device_node *node = vop2->dev->of_node; in vop2_find_rgb_encoder()
2839 for (i = 0; i < vop2->data->nr_vps; i++) { in vop2_find_rgb_encoder()
2918 struct vop2 *vop2 = win->vop2; in vop2_cluster_init() local
2931 ret = devm_regmap_field_bulk_alloc(vop2->dev, vop2->map, win->reg, in vop2_cluster_init()
3002 struct vop2 *vop2 = win->vop2; in vop2_esmart_init() local
3015 ret = devm_regmap_field_bulk_alloc(vop2->dev, vop2->map, win->reg, in vop2_esmart_init()
3024 static int vop2_win_init(struct vop2 *vop2) in vop2_win_init() argument
3026 const struct vop2_data *vop2_data = vop2->data; in vop2_win_init()
3033 win = &vop2->win[i]; in vop2_win_init()
3038 win->vop2 = vop2; in vop2_win_init()
3047 vop2->registered_num_wins = vop2_data->win_size; in vop2_win_init()
3082 struct vop2 *vop2; in vop2_bind() local
3092 alloc_size = struct_size(vop2, win, vop2_data->win_size); in vop2_bind()
3093 vop2 = devm_kzalloc(dev, alloc_size, GFP_KERNEL); in vop2_bind()
3094 if (!vop2) in vop2_bind()
3097 vop2->dev = dev; in vop2_bind()
3098 vop2->data = vop2_data; in vop2_bind()
3099 vop2->drm = drm; in vop2_bind()
3101 dev_set_drvdata(dev, vop2); in vop2_bind()
3105 drm_err(vop2->drm, "failed to get vop2 register byname\n"); in vop2_bind()
3109 vop2->regs = devm_ioremap_resource(dev, res); in vop2_bind()
3110 if (IS_ERR(vop2->regs)) in vop2_bind()
3111 return PTR_ERR(vop2->regs); in vop2_bind()
3112 vop2->len = resource_size(res); in vop2_bind()
3114 vop2->map = devm_regmap_init_mmio(dev, vop2->regs, &vop2_regmap_config); in vop2_bind()
3115 if (IS_ERR(vop2->map)) in vop2_bind()
3116 return PTR_ERR(vop2->map); in vop2_bind()
3118 ret = vop2_win_init(vop2); in vop2_bind()
3124 vop2->lut_regs = devm_ioremap_resource(dev, res); in vop2_bind()
3125 if (IS_ERR(vop2->lut_regs)) in vop2_bind()
3126 return PTR_ERR(vop2->lut_regs); in vop2_bind()
3129 vop2->sys_grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf"); in vop2_bind()
3130 if (IS_ERR(vop2->sys_grf)) in vop2_bind()
3131 return dev_err_probe(dev, PTR_ERR(vop2->sys_grf), "cannot get sys_grf"); in vop2_bind()
3135 vop2->vop_grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,vop-grf"); in vop2_bind()
3136 if (IS_ERR(vop2->vop_grf)) in vop2_bind()
3137 return dev_err_probe(dev, PTR_ERR(vop2->vop_grf), "cannot get vop_grf"); in vop2_bind()
3141 vop2->vo1_grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,vo1-grf"); in vop2_bind()
3142 if (IS_ERR(vop2->vo1_grf)) in vop2_bind()
3143 return dev_err_probe(dev, PTR_ERR(vop2->vo1_grf), "cannot get vo1_grf"); in vop2_bind()
3147 vop2->sys_pmu = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,pmu"); in vop2_bind()
3148 if (IS_ERR(vop2->sys_pmu)) in vop2_bind()
3149 return dev_err_probe(dev, PTR_ERR(vop2->sys_pmu), "cannot get sys_pmu"); in vop2_bind()
3152 vop2->hclk = devm_clk_get(vop2->dev, "hclk"); in vop2_bind()
3153 if (IS_ERR(vop2->hclk)) { in vop2_bind()
3154 drm_err(vop2->drm, "failed to get hclk source\n"); in vop2_bind()
3155 return PTR_ERR(vop2->hclk); in vop2_bind()
3158 vop2->aclk = devm_clk_get(vop2->dev, "aclk"); in vop2_bind()
3159 if (IS_ERR(vop2->aclk)) { in vop2_bind()
3160 drm_err(vop2->drm, "failed to get aclk source\n"); in vop2_bind()
3161 return PTR_ERR(vop2->aclk); in vop2_bind()
3164 vop2->pclk = devm_clk_get_optional(vop2->dev, "pclk_vop"); in vop2_bind()
3165 if (IS_ERR(vop2->pclk)) { in vop2_bind()
3166 drm_err(vop2->drm, "failed to get pclk source\n"); in vop2_bind()
3167 return PTR_ERR(vop2->pclk); in vop2_bind()
3170 vop2->irq = platform_get_irq(pdev, 0); in vop2_bind()
3171 if (vop2->irq < 0) { in vop2_bind()
3172 drm_err(vop2->drm, "cannot find irq for vop2\n"); in vop2_bind()
3173 return vop2->irq; in vop2_bind()
3176 mutex_init(&vop2->vop2_lock); in vop2_bind()
3178 ret = devm_request_irq(dev, vop2->irq, vop2_isr, IRQF_SHARED, dev_name(dev), vop2); in vop2_bind()
3182 ret = vop2_create_crtcs(vop2); in vop2_bind()
3186 ret = vop2_find_rgb_encoder(vop2); in vop2_bind()
3188 vop2->rgb = rockchip_rgb_init(dev, &vop2->vps[ret].crtc, in vop2_bind()
3189 vop2->drm, ret); in vop2_bind()
3190 if (IS_ERR(vop2->rgb)) { in vop2_bind()
3191 if (PTR_ERR(vop2->rgb) == -EPROBE_DEFER) { in vop2_bind()
3192 ret = PTR_ERR(vop2->rgb); in vop2_bind()
3195 vop2->rgb = NULL; in vop2_bind()
3199 rockchip_drm_dma_init_device(vop2->drm, vop2->dev); in vop2_bind()
3206 vop2_destroy_crtcs(vop2); in vop2_bind()
3213 struct vop2 *vop2 = dev_get_drvdata(dev); in vop2_unbind() local
3217 if (vop2->rgb) in vop2_unbind()
3218 rockchip_rgb_fini(vop2->rgb); in vop2_unbind()
3220 vop2_destroy_crtcs(vop2); in vop2_unbind()