media: video: tegra: ov5650: Disable OTP readout on broken hw.

Disabled reading bad OTP data from sensors on known-bad HW.

Change-Id: I08d35ff6ff13bd2c0c0a4a1a50cd92e6e663efc8
Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
This commit is contained in:
Andrei Warkentin
2010-11-22 15:16:35 -06:00
committed by Colin Cross
parent 20393f2c72
commit bd680338eb
3 changed files with 33 additions and 20 deletions

View File

@@ -34,6 +34,7 @@
#include <mach/gpio.h>
#include "board-stingray.h"
#include "gpio-names.h"
#define KXTF9_IRQ_GPIO TEGRA_GPIO_PV3
@@ -47,23 +48,6 @@
#define SOC2030_RESETN_GPIO TEGRA_GPIO_PD5
#define SOC2030_PWRDN_GPIO TEGRA_GPIO_PBB5
static int stingray_ov5650_init(void)
{
tegra_gpio_enable(OV5650_RESETN_GPIO);
gpio_request(OV5650_RESETN_GPIO, "ov5650_reset");
gpio_direction_output(OV5650_RESETN_GPIO, 0);
gpio_export(OV5650_RESETN_GPIO, false);
tegra_gpio_enable(OV5650_PWRDN_GPIO);
gpio_request(OV5650_PWRDN_GPIO, "ov5650_pwrdn");
gpio_direction_output(OV5650_PWRDN_GPIO, 1);
gpio_export(OV5650_PWRDN_GPIO, false);
pr_info("initialize the ov5650 sensor\n");
return 0;
}
static int stingray_ov5650_power_on(void)
{
msleep(20);
@@ -92,8 +76,31 @@ static int stingray_ov5650_power_off(void)
struct ov5650_platform_data stingray_ov5650_data = {
.power_on = stingray_ov5650_power_on,
.power_off = stingray_ov5650_power_off,
.ignore_otp = false
};
static int stingray_ov5650_init(void)
{
tegra_gpio_enable(OV5650_RESETN_GPIO);
gpio_request(OV5650_RESETN_GPIO, "ov5650_reset");
gpio_direction_output(OV5650_RESETN_GPIO, 0);
gpio_export(OV5650_RESETN_GPIO, false);
tegra_gpio_enable(OV5650_PWRDN_GPIO);
gpio_request(OV5650_PWRDN_GPIO, "ov5650_pwrdn");
gpio_direction_output(OV5650_PWRDN_GPIO, 1);
gpio_export(OV5650_PWRDN_GPIO, false);
if (stingray_revision() <= STINGRAY_REVISION_P1) {
stingray_ov5650_data.ignore_otp = true;
pr_info("running on old hardware, ignoring OTP data\n");
}
pr_info("initialize the ov5650 sensor\n");
return 0;
}
static int stingray_soc2030_init(void)
{
tegra_gpio_enable(SOC2030_RESETN_GPIO);

View File

@@ -578,7 +578,9 @@ static int ov5650_get_otp(struct ov5650_info *info, void __user *ubuffer)
otpp = (uint8_t *)&info->otp_data;
/* Either we never read the OTP or CRC failure. */
/* If we've already read the OTP successfully (and CRC matched).
Alternatively this is set also if ignore_otp was provided in
platform data, so we don't try to read OTP on known-bad hardware. */
if (info->otp_valid)
goto end;
@@ -765,7 +767,8 @@ static int ov5650_probe(struct i2c_client *client,
info->pdata = client->dev.platform_data;
info->i2c_client = client;
info->otp_valid = false;
if (info->pdata->ignore_otp)
info->otp_valid = true;
i2c_set_clientdata(client, info);
return 0;

View File

@@ -67,9 +67,12 @@ struct ov5650_mode {
};
#ifdef __KERNEL__
struct ov5650_platform_data {
/* Assume OTP data are corrupted, so just
return an empty block when asked. */
bool ignore_otp;
int (*power_on)(void);
int (*power_off)(void);
};
#endif /* __KERNEL__ */