media: video: tegra: Check sensor ID when power on.
Frank Chen [Thu, 14 Feb 2013 21:42:30 +0000 (13:42 -0800)]
Read the sensor ID after power on so we can return
failure as quick as possible if the sensor is not
present.

Bug 1188665

Change-Id: Ic4c21f38bd4895c15ec1891c26b265f02c587332
Reviewed-on: http://git-master/r/200890
(cherry picked from commit 583b5f4cb5abeddfacf028c30c81952f348e962f)
Signed-off-by: Frank Chen <frankc@nvidia.com>
Reviewed-on: http://git-master/r/206009
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Robert Lin <robertl@nvidia.com>
Reviewed-by: Michael Stewart <mstewart@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/media/video/tegra/imx091.c

index 7d7c8b8..ac815a4 100644 (file)
@@ -1803,6 +1803,7 @@ static int imx091_pm_wr(struct imx091_info *info, int pwr)
 {
        int ret;
        int err = 0;
+       u16 val;
 
        if ((info->pdata->cfg & (NVC_CFG_OFF2STDBY | NVC_CFG_BOOT_INIT)) &&
                        (pwr == NVC_PWR_OFF ||
@@ -1841,6 +1842,9 @@ static int imx091_pm_wr(struct imx091_info *info, int pwr)
                ret &= !imx091_gpio_reset(info, 1);
                if (ret) /* if no reset && pwrdn changed states then delay */
                        msleep(IMX091_STARTUP_DELAY_MS);
+               if (err > 0)
+                       err = imx091_i2c_rd16(info->i2c_client,
+                                             IMX091_ID_ADDRESS, &val);
                break;
 
        default: