]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
ARM: tegra12: OV7695 sensor bring up for Loki
authorFrank Chen <frankc@nvidia.com>
Mon, 4 Nov 2013 19:43:26 +0000 (11:43 -0800)
committerSachin Nikam <snikam@nvidia.com>
Wed, 13 Nov 2013 11:18:16 +0000 (03:18 -0800)
- Enable PBB3 and PBB6 GPIO
- Add regulator name for OV7695
- Update Loki board file

Bug 1327952

Change-Id: Ib3a0b47336305e76af29fbc553800f184939f05c
Signed-off-by: Frank Chen <frankc@nvidia.com>
Reviewed-on: http://git-master/r/329302
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Tested-by: Sachin Nikam <snikam@nvidia.com>
arch/arm/mach-tegra/board-loki-pinmux-t12x.h
arch/arm/mach-tegra/board-loki-power.c
arch/arm/mach-tegra/board-loki-sensors.c

index 3e70ce06e7646670c299f4b0e501c32bdaacfbe4..d7cc3598d4b732b5b539aa0ea45b5938d375c029 100644 (file)
@@ -172,6 +172,8 @@ static __initdata struct tegra_pingroup_config loki_pinmux_common[] = {
        GPIO_PINMUX(GPIO_X7_AUD, PULL_DOWN, NORMAL, OUTPUT, DISABLE),
        GPIO_PINMUX(GPIO_W3_AUD, NORMAL, NORMAL, INPUT, DISABLE),
        GPIO_PINMUX(GPIO_X1_AUD, PULL_DOWN, NORMAL, OUTPUT, DISABLE),
+       GPIO_PINMUX(GPIO_PBB3, NORMAL, NORMAL, OUTPUT, DISABLE),
+       GPIO_PINMUX(GPIO_PBB6, NORMAL, NORMAL, OUTPUT, DISABLE),
        GPIO_PINMUX(GPIO_PG0, NORMAL, NORMAL, INPUT, DISABLE),
        GPIO_PINMUX(GPIO_PG1, NORMAL, NORMAL, INPUT, DISABLE),
        GPIO_PINMUX(GPIO_PH4, NORMAL, NORMAL, OUTPUT, DISABLE),
@@ -252,10 +254,8 @@ static __initdata struct tegra_pingroup_config unused_pins_lowpower[] = {
        UNUSED_PINMUX(ULPI_DATA7),
        VI_PINMUX(CAM_MCLK, VI_ALT3, NORMAL, NORMAL, OUTPUT, DEFAULT, DISABLE),
        UNUSED_PINMUX(GPIO_PBB0),
-       UNUSED_PINMUX(GPIO_PBB3),
        UNUSED_PINMUX(GPIO_PBB4),
        UNUSED_PINMUX(GPIO_PBB5),
-       UNUSED_PINMUX(GPIO_PBB6),
        UNUSED_PINMUX(GPIO_PBB7),
        UNUSED_PINMUX(GPIO_PCC1),
        UNUSED_PINMUX(GPIO_PCC2),
@@ -288,6 +288,8 @@ static struct gpio_init_pin_info init_gpio_mode_loki_common[] = {
        GPIO_INIT_PIN_MODE(TEGRA_GPIO_PX7, false, 0),
        GPIO_INIT_PIN_MODE(TEGRA_GPIO_PW3, true, 0),
        GPIO_INIT_PIN_MODE(TEGRA_GPIO_PX1, false, 0),
+       GPIO_INIT_PIN_MODE(TEGRA_GPIO_PBB3, false, 0),
+       GPIO_INIT_PIN_MODE(TEGRA_GPIO_PBB6, false, 0),
        GPIO_INIT_PIN_MODE(TEGRA_GPIO_PG0, true, 0),
        GPIO_INIT_PIN_MODE(TEGRA_GPIO_PG1, true, 0),
        GPIO_INIT_PIN_MODE(TEGRA_GPIO_PH2, false, 0),
index 1ce7c3fd3f7f665b13f0c2f53af8bf5653c71dce..fd7a6e633aeff308210fa627d88724a65f5ea99e 100644 (file)
@@ -103,6 +103,7 @@ static struct regulator_consumer_supply palmas_smps8_supply[] = {
        REGULATOR_SUPPLY("vid", "0-000c"),
        REGULATOR_SUPPLY("vddio", "0-0077"),
        REGULATOR_SUPPLY("vif", "2-0048"),
+       REGULATOR_SUPPLY("vif2", "2-0021"),
 };
 
 static struct regulator_consumer_supply palmas_smps9_supply[] = {
@@ -142,8 +143,7 @@ static struct regulator_consumer_supply palmas_ldo2_supply[] = {
 static struct regulator_consumer_supply palmas_ldo3_supply[] = {
        REGULATOR_SUPPLY("avdd_dsi_csi", "tegradc.0"),
        REGULATOR_SUPPLY("avdd_dsi_csi", "tegradc.1"),
-       REGULATOR_SUPPLY("avdd_dsi_csi", "vi.0"),
-       REGULATOR_SUPPLY("avdd_dsi_csi", "vi.1"),
+       REGULATOR_SUPPLY("avdd_dsi_csi", "vi"),
        REGULATOR_SUPPLY("vddio_hsic", "tegra-ehci.1"),
        REGULATOR_SUPPLY("vddio_hsic", "tegra-ehci.2"),
        REGULATOR_SUPPLY("vddio_hsic", "tegra-xhci"),
@@ -163,6 +163,7 @@ static struct regulator_consumer_supply palmas_ldo6_supply[] = {
        REGULATOR_SUPPLY("vdd", "0-0077"),
        REGULATOR_SUPPLY("vdd", "0-004c"),
        REGULATOR_SUPPLY("vdd", "0-0068"),
+       REGULATOR_SUPPLY("vana", "2-0021"),
 };
 
 static struct regulator_consumer_supply palmas_ldo8_supply[] = {
index 7f27e733b328a61bafbc88a443b1e307f2e12b3d..f7e7c558200ee302a8316f8a78ae0421029d476f 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/nct1008.h>
 #include <linux/tegra-fuse.h>
 #include <media/mt9m114.h>
+#include <media/ov7695.h>
 #include <mach/gpio-tegra.h>
 #include <mach/edp.h>
 #include <linux/gpio.h>
@@ -193,11 +194,70 @@ struct mt9m114_platform_data loki_mt9m114_pdata = {
        .power_off = loki_mt9m114_power_off,
 };
 
+static int loki_ov7695_power_on(struct ov7695_power_rail *pw)
+{
+       int err;
+
+       if (unlikely(WARN_ON(!pw || !pw->avdd || !pw->iovdd)))
+               return -EFAULT;
+
+       gpio_set_value(CAM2_PWDN, 0);
+       usleep_range(1000, 1020);
+
+       err = regulator_enable(pw->avdd);
+       if (unlikely(err))
+               goto ov7695_avdd_fail;
+       usleep_range(300, 320);
+
+       err = regulator_enable(pw->iovdd);
+       if (unlikely(err))
+               goto ov7695_iovdd_fail;
+       usleep_range(1000, 1020);
+
+       gpio_set_value(CAM2_PWDN, 1);
+       usleep_range(1000, 1020);
+
+       return 0;
+
+ov7695_iovdd_fail:
+       regulator_disable(pw->avdd);
+
+ov7695_avdd_fail:
+
+       gpio_set_value(CAM_RSTN, 0);
+       return -ENODEV;
+}
+
+static int loki_ov7695_power_off(struct ov7695_power_rail *pw)
+{
+       if (unlikely(WARN_ON(!pw || !pw->avdd || !pw->iovdd)))
+               return -EFAULT;
+       usleep_range(100, 120);
+
+       regulator_disable(pw->iovdd);
+       usleep_range(100, 120);
+
+       regulator_disable(pw->avdd);
+       usleep_range(100, 120);
+
+       gpio_set_value(CAM2_PWDN, 0);
+       return 0;
+}
+
+struct ov7695_platform_data loki_ov7695_pdata = {
+       .power_on = loki_ov7695_power_on,
+       .power_off = loki_ov7695_power_off,
+};
+
 static struct i2c_board_info loki_i2c_board_info_e2548[] = {
        {
                I2C_BOARD_INFO("mt9m114", 0x48),
                .platform_data = &loki_mt9m114_pdata,
        },
+       {
+               I2C_BOARD_INFO("ov7695", 0x21),
+               .platform_data = &loki_ov7695_pdata,
+       },
 };
 
 static int loki_camera_init(void)