static int mdss_mdp_probe(struct platform_device *pdev) { struct resource *res; int rc; struct mdss_data_type *mdata; if (!pdev->dev.of_node) { pr_err("MDP driver only supports device tree probe\n"); return -ENOTSUPP; } if (mdss_res) { pr_err("MDP already initialized\n"); return -EINVAL; } mdata = devm_kzalloc(&pdev->dev, sizeof(*mdata), GFP_KERNEL); if (mdata == NULL) return -ENOMEM; pdev->id = 0; mdata->pdev = pdev; platform_set_drvdata(pdev, mdata); mdss_res = mdata; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mdp_phys"); if (!res) { pr_err("unable to get MDP base address\n"); rc = -ENOMEM; goto probe_done; } mdata->mdp_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); if (unlikely(!mdata->mdp_base)) { pr_err("unable to map MDP base\n"); rc = -ENOMEM; goto probe_done; } pr_info("MDP HW Base phy_Address=0x%x virt=0x%x\n", (int) res->start, (int) mdata->mdp_base); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vbif_phys"); if (!res) { pr_err("unable to get MDSS VBIF base address\n"); rc = -ENOMEM; goto probe_done; } mdata->vbif_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); if (unlikely(!mdata->vbif_base)) { pr_err("unable to map MDSS VBIF base\n"); rc = -ENOMEM; goto probe_done; } pr_info("MDSS VBIF HW Base phy_Address=0x%x virt=0x%x\n", (int) res->start, (int) mdata->vbif_base); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!res) { pr_err("unable to get MDSS irq\n"); rc = -ENOMEM; goto probe_done; } mdata->irq = res->start; rc = mdss_mdp_res_init(mdata); if (rc) { pr_err("unable to initialize mdss mdp resources\n"); goto probe_done; } rc = mdss_mdp_bus_scale_register(mdata); probe_done: if (IS_ERR_VALUE(rc)) mdss_res = NULL; return rc; }
static int mdss_mdp_probe(struct platform_device *pdev) { struct resource *res; int rc; struct mdss_data_type *mdata; if (!pdev->dev.of_node) { pr_err("MDP driver only supports device tree probe\n"); return -ENOTSUPP; } if (mdss_res) { pr_err("MDP already initialized\n"); return -EINVAL; } mdata = devm_kzalloc(&pdev->dev, sizeof(*mdata), GFP_KERNEL); if (mdata == NULL) return -ENOMEM; pdev->id = 0; mdata->pdev = pdev; platform_set_drvdata(pdev, mdata); mdss_res = mdata; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mdp_phys"); if (!res) { pr_err("unable to get MDP base address\n"); rc = -ENOMEM; goto probe_done; } mdata->mdp_reg_size = resource_size(res); mdata->mdp_base = devm_ioremap(&pdev->dev, res->start, mdata->mdp_reg_size); if (unlikely(!mdata->mdp_base)) { pr_err("unable to map MDP base\n"); rc = -ENOMEM; goto probe_done; } pr_info("MDP HW Base phy_Address=0x%x virt=0x%x\n", (int) res->start, (int) mdata->mdp_base); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vbif_phys"); if (!res) { pr_err("unable to get MDSS VBIF base address\n"); rc = -ENOMEM; goto probe_done; } mdata->vbif_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); if (unlikely(!mdata->vbif_base)) { pr_err("unable to map MDSS VBIF base\n"); rc = -ENOMEM; goto probe_done; } pr_info("MDSS VBIF HW Base phy_Address=0x%x virt=0x%x\n", (int) res->start, (int) mdata->vbif_base); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!res) { pr_err("unable to get MDSS irq\n"); rc = -ENOMEM; goto probe_done; } mdata->irq = res->start; mdss_mdp_hw.ptr = mdata; /*populate hw iomem base info from device tree*/ rc = mdss_mdp_parse_dt(pdev); if (rc) { pr_err("unable to parse device tree\n"); goto probe_done; } rc = mdss_mdp_res_init(mdata); if (rc) { pr_err("unable to initialize mdss mdp resources\n"); goto probe_done; } rc = mdss_mdp_pp_init(&pdev->dev); if (rc) { pr_err("unable to initialize mdss pp resources\n"); goto probe_done; } rc = mdss_mdp_bus_scale_register(mdata); if (rc) { pr_err("unable to register bus scaling\n"); goto probe_done; } mdss_mdp_bus_scale_set_quota(AB_QUOTA, IB_QUOTA); rc = mdss_mdp_debug_init(mdata); if (rc) { pr_err("unable to initialize mdp debugging\n"); goto probe_done; } pm_runtime_set_suspended(&pdev->dev); pm_runtime_enable(&pdev->dev); if (!pm_runtime_enabled(&pdev->dev)) mdss_mdp_footswitch_ctrl(mdata, true); rc = mdss_mdp_register_sysfs(mdata); if (rc) pr_err("unable to register mdp sysfs nodes\n"); rc = mdss_fb_register_mdp_instance(&mdp5); if (rc) pr_err("unable to register mdp instance\n"); rc = mdss_register_irq(&mdss_mdp_hw); if (rc) pr_err("mdss_register_irq failed.\n"); probe_done: if (IS_ERR_VALUE(rc)) { mdss_mdp_hw.ptr = NULL; mdss_res = NULL; mdss_mdp_pp_term(&pdev->dev); } return rc; }
static int mdss_mdp_probe(struct platform_device *pdev) { struct resource *mdss_mdp_mres; struct resource *mdss_mdp_ires; resource_size_t size; int rc; if (!mdss_res) { mdss_res = devm_kzalloc(&pdev->dev, sizeof(*mdss_res), GFP_KERNEL); if (mdss_res == NULL) return -ENOMEM; } if (pdev->dev.of_node) { pdev->id = 0; mdp_pdata = mdss_mdp_populate_pdata(&pdev->dev); mdss_mdp_mres = platform_get_resource(pdev, IORESOURCE_MEM, 0); mdss_mdp_ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!mdss_mdp_mres || !mdss_mdp_ires) { pr_err("unable to get the MDSS resources"); rc = -ENOMEM; goto probe_done; } mdss_reg_base = ioremap(mdss_mdp_mres->start, resource_size(mdss_mdp_mres)); pr_info("MDP HW Base phy_Address=0x%x virt=0x%x\n", (int) mdss_mdp_mres->start, (int) mdss_reg_base); mdss_res->irq = mdss_mdp_ires->start; } else if ((pdev->id == 0) && (pdev->num_resources > 0)) { mdp_pdata = pdev->dev.platform_data; size = resource_size(&pdev->resource[0]); mdss_reg_base = ioremap(pdev->resource[0].start, size); pr_info("MDP HW Base phy_Address=0x%x virt=0x%x\n", (int) pdev->resource[0].start, (int) mdss_reg_base); mdss_res->irq = platform_get_irq(pdev, 0); if (mdss_res->irq < 0) { pr_err("can not get mdp irq\n"); rc = -ENOMEM; goto probe_done; } } if (unlikely(!mdss_reg_base)) { rc = -ENOMEM; goto probe_done; } rc = mdss_mdp_res_init(pdev); if (rc) { pr_err("unable to initialize mdss mdp resources\n"); goto probe_done; } rc = mdss_mdp_bus_scale_register(); probe_done: if (IS_ERR_VALUE(rc)) { if (mdss_res) { devm_kfree(&pdev->dev, mdss_res); mdss_res = NULL; } } return rc; }