]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
media: tegra: ov5693: create node if HW is present
authorShreshtha SAHU <ssahu@nvidia.com>
Mon, 16 Nov 2015 15:46:31 +0000 (21:16 +0530)
committermobile promotions <svcmobile_promotions@nvidia.com>
Mon, 14 Dec 2015 17:17:58 +0000 (09:17 -0800)
Create video dev node ov5693.1 only if HW is present/detected.

Bug 1693452
Bug 1692979

Change-Id: Ic4c9172798f243471d2d87b6eddab81e79a240aa
Signed-off-by: Shreshtha SAHU <ssahu@nvidia.com>
Reviewed-on: http://git-master/r/833358
(cherry picked from commit ddc3a10206b81a62692822adf91804432edfa0fb)
Reviewed-on: http://git-master/r/842667
Reviewed-by: Rakesh Sharma <rasharma@nvidia.com>
Tested-by: Rakesh Sharma <rasharma@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venu Byravarasu <vbyravarasu@nvidia.com>
drivers/media/platform/tegra/ov5693.c

index 1b3a013158f87d382b85f415553e3101c80c8a82..1fdf43cbf429c6395c37460add9fb7b28a7553af 100644 (file)
@@ -3257,6 +3257,21 @@ ov5693_write_eeprom(struct ov5693_info *info, u16 addr, u8 val)
        return regmap_write(info->eeprom[addr >> 8].regmap, addr & 0xFF, val);
 }
 
+static int
+ov5693_hw_detect(struct ov5693_info *info)
+{
+       if (ov5693_power_on(info, false))
+               return -1;
+
+       if (ov5693_get_fuse_id(info))
+               return -1;
+
+       if (ov5693_power_off(info))
+               return -1;
+
+       return 0;
+}
+
 static long ov5693_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        struct ov5693_info *info = file->private_data;
@@ -3655,7 +3670,6 @@ static int ov5693_probe(
                .val_bits = 8,
        };
 
-
        dev_dbg(&client->dev, "%s\n", __func__);
        info = devm_kzalloc(&client->dev, sizeof(*info), GFP_KERNEL);
        if (info == NULL) {
@@ -3742,6 +3756,9 @@ static int ov5693_probe(
                snprintf(info->devname, sizeof(info->devname), "%s.%u",
                         info->devname, info->pdata->num);
 
+       if (ov5693_hw_detect(info))
+               return -ENODEV;
+
        info->miscdev.name = info->devname;
        info->miscdev.fops = &ov5693_fileops;
        info->miscdev.minor = MISC_DYNAMIC_MINOR;