struct dpu_hw_mdp *dpu_hw_mdptop_init(enum dpu_mdp idx, void __iomem *addr, const struct dpu_mdss_cfg *m) { struct dpu_hw_mdp *mdp; const struct dpu_mdp_cfg *cfg; if (!addr || !m) return ERR_PTR(-EINVAL); mdp = kzalloc(sizeof(*mdp), GFP_KERNEL); if (!mdp) return ERR_PTR(-ENOMEM); cfg = _top_offset(idx, m, addr, &mdp->hw); if (IS_ERR_OR_NULL(cfg)) { kfree(mdp); return ERR_PTR(-EINVAL); } /* * Assign ops */ mdp->idx = idx; mdp->caps = cfg; _setup_mdp_ops(&mdp->ops, mdp->caps->features); dpu_hw_blk_init(&mdp->base, DPU_HW_BLK_TOP, idx, &dpu_hw_ops); return mdp; }
struct dpu_hw_mdp *dpu_hw_mdptop_init(enum dpu_mdp idx, void __iomem *addr, const struct dpu_mdss_cfg *m) { struct dpu_hw_mdp *mdp; const struct dpu_mdp_cfg *cfg; int rc; if (!addr || !m) return ERR_PTR(-EINVAL); mdp = kzalloc(sizeof(*mdp), GFP_KERNEL); if (!mdp) return ERR_PTR(-ENOMEM); cfg = _top_offset(idx, m, addr, &mdp->hw); if (IS_ERR_OR_NULL(cfg)) { kfree(mdp); return ERR_PTR(-EINVAL); } /* * Assign ops */ mdp->idx = idx; mdp->caps = cfg; _setup_mdp_ops(&mdp->ops, mdp->caps->features); rc = dpu_hw_blk_init(&mdp->base, DPU_HW_BLK_TOP, idx, &dpu_hw_ops); if (rc) { DPU_ERROR("failed to init hw blk %d\n", rc); goto blk_init_error; } dpu_dbg_set_dpu_top_offset(mdp->hw.blk_off); return mdp; blk_init_error: kzfree(mdp); return ERR_PTR(rc); }