int tegra_camera_isomgr_register(struct tegra_camera *camera) { dev_dbg(camera->dev, "%s++\n", __func__); /* Dedicated bw is what VI could ask for at most */ camera->isomgr_handle = tegra_isomgr_register(TEGRA_ISO_CLIENT_VI_0, /* dedicated bw, KBps*/ tegra_camera_get_max_bw(camera), NULL, /* tegra_isomgr_renegotiate */ NULL); /* *priv */ if (!camera->isomgr_handle) { dev_err(camera->dev, "%s: unable to register isomgr\n", __func__); return -ENOMEM; } return 0; }
struct tegra_camera *tegra_camera_register(struct platform_device *ndev) { struct tegra_camera *camera = NULL; int ret = 0; int i; dev_info(&ndev->dev, "%s: ++\n", __func__); camera = kzalloc(sizeof(struct tegra_camera), GFP_KERNEL); if (!camera) { dev_err(&ndev->dev, "can't allocate memory for tegra_camera\n"); return camera; } mutex_init(&camera->tegra_camera_lock); /* Powergate VE when boot */ mutex_lock(&camera->tegra_camera_lock); #ifndef CONFIG_ARCH_TEGRA_2x_SOC ret = tegra_camera_powergate_init(camera); if (ret) goto regulator_fail; #endif mutex_unlock(&camera->tegra_camera_lock); camera->dev = &ndev->dev; /* Get regulator pointer */ #ifdef CONFIG_ARCH_TEGRA_2x_SOC camera->reg = regulator_get(&ndev->dev, "vcsi"); #else camera->reg = regulator_get(&ndev->dev, "avdd_dsi_csi"); #endif if (IS_ERR_OR_NULL(camera->reg)) { ret = -ENODEV; if (camera->reg == ERR_PTR(-ENODEV)) { camera->reg = NULL; dev_info(&ndev->dev, "%s: no regulator device, overriding\n", __func__); } else { dev_err(&ndev->dev, "%s: couldn't get regulator\n", __func__); goto regulator_fail; } } camera->misc_dev.minor = MISC_DYNAMIC_MINOR; camera->misc_dev.name = TEGRA_CAMERA_NAME; camera->misc_dev.fops = &tegra_camera_fops; camera->misc_dev.parent = &ndev->dev; ret = misc_register(&camera->misc_dev); if (ret) { dev_err(&ndev->dev, "%s: unable to register misc device!\n", TEGRA_CAMERA_NAME); goto misc_register_fail; } for (i = 0; i < CAMERA_CLK_MAX; i++) { ret = tegra_camera_clk_get(ndev, clock_init[i].name, &camera->clock[clock_init[i].index].clk); if (ret) goto clk_get_fail; } #ifdef CONFIG_ARCH_TEGRA_11x_SOC /* Dedicated bw is what VI could ask for at most */ camera->isomgr_handle = tegra_isomgr_register(TEGRA_ISO_CLIENT_VI_0, /* dedicated bw, KBps*/ tegra_camera_get_max_bw(camera), NULL, /* tegra_isomgr_renegotiate */ NULL); /* *priv */ if (!camera->isomgr_handle) { dev_err(&ndev->dev, "%s: unable to register isomgr\n", __func__); goto clk_get_fail; } #endif return camera; clk_get_fail: for (; i > 0; i--) clk_put(camera->clock[clock_init[i].index].clk); misc_deregister(&camera->misc_dev); misc_register_fail: regulator_put(camera->reg); regulator_fail: kfree(camera); camera = NULL; return camera; }