diff options
-rw-r--r-- | drivers/media/platform/soc_camera/tegra_camera/common.c | 10 | ||||
-rw-r--r-- | drivers/media/platform/soc_camera/tegra_camera/vi2.c | 25 | ||||
-rw-r--r-- | drivers/video/tegra/host/vi/tegra_vi.c | 11 |
3 files changed, 19 insertions, 27 deletions
diff --git a/drivers/media/platform/soc_camera/tegra_camera/common.c b/drivers/media/platform/soc_camera/tegra_camera/common.c index d257115258b9..50ba778f6cef 100644 --- a/drivers/media/platform/soc_camera/tegra_camera/common.c +++ b/drivers/media/platform/soc_camera/tegra_camera/common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -802,6 +802,12 @@ static int tegra_camera_probe(struct platform_device *pdev) match = of_match_device(tegra_vi_of_match, &pdev->dev); if (match) ndata = (struct nvhost_device_data *) match->data; + + /* + * Device Tree will initialize this ID as -1 + * Set it to the right value for future usage + */ + pdev->id = pdev->dev.id; } else ndata = pdev->dev.platform_data; @@ -823,7 +829,7 @@ static int tegra_camera_probe(struct platform_device *pdev) cam->ici.priv = cam; cam->ici.v4l2_dev.dev = &pdev->dev; - cam->ici.nr = pdev->dev.id; + cam->ici.nr = pdev->id; cam->ici.drv_name = dev_name(&pdev->dev); cam->ici.ops = &tegra_soc_camera_host_ops; diff --git a/drivers/media/platform/soc_camera/tegra_camera/vi2.c b/drivers/media/platform/soc_camera/tegra_camera/vi2.c index f58c03bff8a5..60bdaa4dabc7 100644 --- a/drivers/media/platform/soc_camera/tegra_camera/vi2.c +++ b/drivers/media/platform/soc_camera/tegra_camera/vi2.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -329,20 +329,10 @@ static struct tegra_camera_clk vi2_clks1[] = { static int vi2_clks_init(struct tegra_camera_dev *cam) { struct platform_device *pdev = cam->ndev; - char devname[MAX_DEVID_LENGTH]; - const char *pdev_name; struct tegra_camera_clk *clks; - int i, dev_id, ret; - - pdev_name = dev_name(&pdev->dev); - ret = sscanf(pdev_name, "vi.%1d", &dev_id); - if (ret != 1) { - dev_err(&pdev->dev, "Read dev_id failed!\n"); - return -ENODEV; - } - snprintf(devname, MAX_DEVID_LENGTH, "tegra_%s", pdev_name); + int i; - switch (dev_id) { + switch (pdev->id) { case 0: cam->num_clks = ARRAY_SIZE(vi2_clks0); cam->clks = vi2_clks0; @@ -352,16 +342,19 @@ static int vi2_clks_init(struct tegra_camera_dev *cam) cam->clks = vi2_clks1; break; default: - dev_err(&pdev->dev, "Wrong device ID %d\n", dev_id); + dev_err(&pdev->dev, "Wrong device ID %d\n", pdev->id); return -ENODEV; } for (i = 0; i < cam->num_clks; i++) { clks = &cam->clks[i]; - if (clks->use_devname) + if (clks->use_devname) { + char devname[MAX_DEVID_LENGTH]; + snprintf(devname, MAX_DEVID_LENGTH, + "tegra_%s", dev_name(&pdev->dev)); clks->clk = clk_get_sys(devname, clks->name); - else + } else clks->clk = clk_get(&pdev->dev, clks->name); if (IS_ERR_OR_NULL(clks->clk)) { dev_err(&pdev->dev, "Failed to get clock %s.\n", diff --git a/drivers/video/tegra/host/vi/tegra_vi.c b/drivers/video/tegra/host/vi/tegra_vi.c index d4f5c47ede6a..9e2e14bd301c 100644 --- a/drivers/video/tegra/host/vi/tegra_vi.c +++ b/drivers/video/tegra/host/vi/tegra_vi.c @@ -89,15 +89,8 @@ void nvhost_vi_deinit(struct platform_device *dev) int nvhost_vi_finalize_poweron(struct platform_device *dev) { - int ret = 0, dev_id; + int ret = 0; struct vi *tegra_vi; - const char *devname = dev_name(&dev->dev); - - ret = sscanf(devname, "vi.%1d", &dev_id); - if (ret != 1) { - dev_err(&dev->dev, "Read dev_id failed!\n"); - return -ENODEV; - } tegra_vi = (struct vi *)nvhost_get_private_data(dev); if (tegra_vi && tegra_vi->reg) { @@ -111,7 +104,7 @@ int nvhost_vi_finalize_poweron(struct platform_device *dev) } /* Only do this for vi.0 not for slave device vi.1 */ - if (dev_id == 0) + if (dev->id == 0) host1x_writel(dev, T12_VI_CFG_CG_CTRL, T12_CG_2ND_LEVEL_EN); fail: |