diff options
author | Frank Chen <frankc@nvidia.com> | 2011-04-04 12:43:13 -0700 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-04-11 11:10:37 -0700 |
commit | f994ecd2aef906490a935edc9711d51ab49209ec (patch) | |
tree | 1d9d6e77966083984b35c19b4158d0d682fdfe0c | |
parent | d50a05a3d7609b2fde866d0c02e732fa718a42b5 (diff) |
ARM: tegra: whistler: Update ov5650 driver
- Set vddio_vi voltage to 1.8v
- Enable vddio_mipi regulator
- Adjust camera power on sequence
- Update copyright info
Bug 783488
Change-Id: If5d61879a33131d4b5f99cf232d0b246f0524e2e
Reviewed-on: http://git-master/r/26618
Reviewed-by: Daniel Willemsen <dwillemsen@nvidia.com>
Tested-by: Daniel Willemsen <dwillemsen@nvidia.com>
Tested-by: Frank Chen <frankc@nvidia.com>
-rw-r--r-- | arch/arm/mach-tegra/board-whistler-power.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-whistler-sensors.c | 77 |
2 files changed, 63 insertions, 19 deletions
diff --git a/arch/arm/mach-tegra/board-whistler-power.c b/arch/arm/mach-tegra/board-whistler-power.c index 901e28325d38..425a5e6d8828 100644 --- a/arch/arm/mach-tegra/board-whistler-power.c +++ b/arch/arm/mach-tegra/board-whistler-power.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 NVIDIA, Inc. + * Copyright (C) 2010-2011 NVIDIA, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -36,7 +36,7 @@ #include "board.h" #define PMC_CTRL 0x0 - #define PMC_CTRL_INTR_LOW (1 << 17) +#define PMC_CTRL_INTR_LOW (1 << 17) static struct regulator_consumer_supply max8907c_SD1_supply[] = { REGULATOR_SUPPLY("vdd_cpu", NULL), @@ -122,6 +122,7 @@ static struct regulator_consumer_supply max8907c_LDO17_supply[] = { }; static struct regulator_consumer_supply max8907c_LDO18_supply[] = { + REGULATOR_SUPPLY("vddio_vi", NULL), REGULATOR_SUPPLY("vcsi", "tegra_camera"), }; diff --git a/arch/arm/mach-tegra/board-whistler-sensors.c b/arch/arm/mach-tegra/board-whistler-sensors.c index cae4d04bdb0c..f077822bb2df 100644 --- a/arch/arm/mach-tegra/board-whistler-sensors.c +++ b/arch/arm/mach-tegra/board-whistler-sensors.c @@ -1,7 +1,7 @@ /* * arch/arm/mach-tegra/board-whistler-sensors.c * - * Copyright (c) 2010, NVIDIA, All Rights Reserved. + * Copyright (c) 2010-2011, NVIDIA, All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,12 +18,14 @@ * */ +#include <linux/delay.h> #include <linux/i2c.h> #include <mach/gpio.h> #include <media/ov5650.h> #include <linux/regulator/consumer.h> #include <linux/err.h> #include <linux/adt7461.h> +#include <generated/mach-types.h> #include "gpio-names.h" @@ -35,12 +37,14 @@ #define ADXL34X_IRQ_GPIO TEGRA_GPIO_PAA1 #define ISL29018_IRQ_GPIO TEGRA_GPIO_PK2 -#define ADT7461_IRQ_GPIO TEGRA_GPIO_PI2 +#define ADT7461_IRQ_GPIO TEGRA_GPIO_PI2 extern void tegra_throttling_enable(bool enable); static struct regulator *reg_avdd_cam1; /* LDO9 */ static struct regulator *reg_vdd_af; /* LDO13 */ +static struct regulator *reg_vdd_mipi; /* LDO17 */ +static struct regulator *reg_vddio_vi; /* LDO18 */ static int whistler_camera_init(void) { @@ -67,14 +71,15 @@ static int whistler_camera_init(void) gpio_direction_output(CAMERA_FLASH_EN2_GPIO, 0); gpio_export(CAMERA_FLASH_EN2_GPIO, false); + gpio_set_value(CAMERA1_PWDN_GPIO, 1); + mdelay(5); + return 0; } static int whistler_ov5650_power_on(void) { - gpio_set_value(CAMERA1_PWDN_GPIO, 1); - gpio_set_value(CAMERA1_RESET_GPIO, 1); - gpio_set_value(CAMERA_AF_PD_GPIO, 1); + gpio_set_value(CAMERA1_PWDN_GPIO, 0); if (!reg_avdd_cam1) { reg_avdd_cam1 = regulator_get(NULL, "vdd_cam1"); @@ -85,25 +90,31 @@ static int whistler_ov5650_power_on(void) } regulator_enable(reg_avdd_cam1); } - - if (!reg_vdd_af) { - reg_vdd_af = regulator_get(NULL, "vdd_vcore_af"); - if (IS_ERR_OR_NULL(reg_vdd_af)) { - pr_err("whistler_ov5650_power_on: vdd_vcore_af failed\n"); - reg_vdd_af = NULL; - return PTR_ERR(reg_vdd_af); + mdelay(5); + if (!reg_vdd_mipi) { + reg_vdd_mipi = regulator_get(NULL, "vddio_mipi"); + if (IS_ERR_OR_NULL(reg_vdd_mipi)) { + pr_err("whistler_ov5650_power_on: vddio_mipi failed\n"); + reg_vdd_mipi = NULL; + return PTR_ERR(reg_vdd_mipi); } - regulator_enable(reg_vdd_af); + regulator_enable(reg_vdd_mipi); } + gpio_set_value(CAMERA1_RESET_GPIO, 1); + mdelay(10); + gpio_set_value(CAMERA1_RESET_GPIO, 0); + mdelay(5); + gpio_set_value(CAMERA1_RESET_GPIO, 1); + mdelay(20); + return 0; } static int whistler_ov5650_power_off(void) { - gpio_set_value(CAMERA1_PWDN_GPIO, 0); + gpio_set_value(CAMERA1_PWDN_GPIO, 1); gpio_set_value(CAMERA1_RESET_GPIO, 0); - gpio_set_value(CAMERA_AF_PD_GPIO, 0); if (reg_avdd_cam1) { regulator_disable(reg_avdd_cam1); @@ -116,6 +127,7 @@ static int whistler_ov5650_power_off(void) regulator_put(reg_vdd_af); reg_vdd_af = NULL; } + return 0; } @@ -197,11 +209,42 @@ int __init whistler_sensors_init(void) i2c_register_board_info(0, whistler_i2c1_board_info, ARRAY_SIZE(whistler_i2c1_board_info)); + i2c_register_board_info(4, whistler_i2c4_board_info, + ARRAY_SIZE(whistler_i2c4_board_info)); + i2c_register_board_info(3, whistler_i2c3_board_info, ARRAY_SIZE(whistler_i2c3_board_info)); - i2c_register_board_info(4, whistler_i2c4_board_info, - ARRAY_SIZE(whistler_i2c4_board_info)); + return 0; +} + +int __init whistler_sensor_late_init(void) +{ + int ret; + + if (!machine_is_whistler()) + return 0; + reg_vddio_vi = regulator_get(NULL, "vddio_vi"); + if (IS_ERR_OR_NULL(reg_vddio_vi)) { + pr_err("%s: Couldn't get regulator vddio_vi\n", __func__); + return PTR_ERR(reg_vddio_vi); + } + + /* set vddio_vi voltage to 1.8v */ + ret = regulator_set_voltage(reg_vddio_vi, 1800*1000, 1800*1000); + if (ret) { + pr_err("%s: Failed to set vddio_vi to 1.8v\n", __func__); + goto fail_put_regulator; + } + + regulator_put(reg_vddio_vi); return 0; + +fail_put_regulator: + regulator_put(reg_vddio_vi); + return ret; } + +late_initcall(whistler_sensor_late_init); + |