#include <mach/gpio.h>
+#include "board-stingray.h"
#include "gpio-names.h"
#define KXTF9_IRQ_GPIO TEGRA_GPIO_PV3
#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);
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);
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;
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;