BZ: 27473
With some hardware, gpio pins are not properly configured to supply
power to the lens driver chip and consequently the chip will not
respond to i2c commands. This caused the drv201 detection function
to fail and whole ov8830 driver to fail functioning at all, even
from driving the sensor.
This patch allows ov8830 driver to drive sensor even if the lens driver
chip detection fails by ignoring the error code returned by the drv201
detection function. In this case only the focus functionality is disabled.
Change-Id: I552f638d8b7f84017feee62858094bc6b8d0726f
Signed-off-by: Tuukka Toivonen <tuukka.toivonen@intel.com>
Reviewed-on: http://android.intel.com:8080/43578
Reviewed-by: Cohen, David A <david.a.cohen@intel.com>
Reviewed-by: Koski, Anttu <anttu.koski@intel.com>
Tested-by: Koski, Anttu <anttu.koski@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
}
dev->focus = DRV201_MAX_FOCUS_POS;
+ dev->initialized = true;
v4l2_info(client, "detected drv201\n");
return 0;
struct drv201_device *dev = to_drv201_device(sd);
int r;
+ if (!dev->initialized)
+ return -ENODEV;
+
value = clamp(value, 0, DRV201_MAX_FOCUS_POS);
r = drv201_write16(sd, DRV201_VCM_CURRENT,
DRV201_MAX_FOCUS_POS - value);
ret = power_up(sd);
if (ret)
return ret;
- ret = drv201_power_up(sd);
- if (ret)
- return ret;
+ drv201_power_up(sd);
dev->power = 1;
/* init motor initial position */
/* drv201 device structure */
struct drv201_device {
+ bool initialized; /* true if drv201 is detected */
s32 focus; /* Current focus value */
struct timespec focus_time; /* Time when focus was last time set */
__u8 buffer[4]; /* Used for i2c transactions */