diff options
author | Bryan Wu <pengw@nvidia.com> | 2013-11-14 17:00:15 -0800 |
---|---|---|
committer | Bryan Wu <pengw@nvidia.com> | 2013-11-27 10:16:04 -0800 |
commit | 3bfd43b3ac577b8fa41f3bb7ed5c1b21dd3e1afb (patch) | |
tree | 78246c5204b6c8dea43b0e0492a2cd9d11433f86 /drivers/media/platform/soc_camera/tegra_camera/vi2.c | |
parent | a2b443aec3c0600905ce81a3d434461899ca0a8e (diff) |
media: tegra_camera: use pdev->dev.id after using DT
VI device tree node was added into tegra124.dtsi.
- use pdev->dev.id to match sensor driver's bus_id, otherwise it
will fail to start to probe sensor driver.
- the name of VI platform device changed, as a result clock
probing will fail during driver starting. So correct dev_id by
using the name of pdev->dev.
- check the cam->reg_base mapping, if it's NULL further register
operation will cause oops
Bug 1377330
Change-Id: Iacf93f88b4f37bbca1d310c16c6ed2ed0b786758
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/335947
GVS: Gerrit_Virtual_Submit
Reviewed-by: Allen Martin <amartin@nvidia.com>
Diffstat (limited to 'drivers/media/platform/soc_camera/tegra_camera/vi2.c')
-rw-r--r-- | drivers/media/platform/soc_camera/tegra_camera/vi2.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/media/platform/soc_camera/tegra_camera/vi2.c b/drivers/media/platform/soc_camera/tegra_camera/vi2.c index 754a4bef9a71..f58c03bff8a5 100644 --- a/drivers/media/platform/soc_camera/tegra_camera/vi2.c +++ b/drivers/media/platform/soc_camera/tegra_camera/vi2.c @@ -330,14 +330,19 @@ 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; + int i, dev_id, ret; - snprintf(devname, MAX_DEVID_LENGTH, - (pdev->id <= 0) ? "tegra_%s" : "tegra_%s.%d", - pdev->name, pdev->id); + 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); - switch (pdev->id) { + switch (dev_id) { case 0: cam->num_clks = ARRAY_SIZE(vi2_clks0); cam->clks = vi2_clks0; @@ -347,7 +352,7 @@ 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", pdev->id); + dev_err(&pdev->dev, "Wrong device ID %d\n", dev_id); return -ENODEV; } |