| Laxman Dewangan | 353d543 | 2010-12-22 15:32:30 +0530 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-tegra/board-cardhu-sensors.c |
| 3 | * |
| Maria Gutowski | 5e3afb1 | 2011-05-26 18:44:51 -0700 | [diff] [blame] | 4 | * Copyright (c) 2010-2011, NVIDIA CORPORATION, All rights reserved. |
| Laxman Dewangan | 353d543 | 2010-12-22 15:32:30 +0530 | [diff] [blame] | 5 | * |
| Maria Gutowski | 5e3afb1 | 2011-05-26 18:44:51 -0700 | [diff] [blame] | 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions are |
| 8 | * met: |
| Laxman Dewangan | 353d543 | 2010-12-22 15:32:30 +0530 | [diff] [blame] | 9 | * |
| Maria Gutowski | 5e3afb1 | 2011-05-26 18:44:51 -0700 | [diff] [blame] | 10 | * Redistributions of source code must retain the above copyright notice, |
| 11 | * this list of conditions and the following disclaimer. |
| Laxman Dewangan | 353d543 | 2010-12-22 15:32:30 +0530 | [diff] [blame] | 12 | * |
| Maria Gutowski | 5e3afb1 | 2011-05-26 18:44:51 -0700 | [diff] [blame] | 13 | * Redistributions in binary form must reproduce the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer in the |
| 15 | * documentation and/or other materials provided with the distribution. |
| Laxman Dewangan | 353d543 | 2010-12-22 15:32:30 +0530 | [diff] [blame] | 16 | * |
| Maria Gutowski | 5e3afb1 | 2011-05-26 18:44:51 -0700 | [diff] [blame] | 17 | * Neither the name of NVIDIA CORPORATION nor the names of its contributors |
| 18 | * may be used to endorse or promote products derived from this software |
| 19 | * without specific prior written permission. |
| 20 | * |
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
| 22 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
| 23 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
| 24 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 25 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
| 27 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 28 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 29 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 30 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 31 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| Laxman Dewangan | 353d543 | 2010-12-22 15:32:30 +0530 | [diff] [blame] | 32 | */ |
| 33 | |
| 34 | #include <linux/i2c.h> |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 35 | #include <linux/delay.h> |
| 36 | #include <linux/regulator/consumer.h> |
| Laxman Dewangan | 8e01bcc | 2011-01-18 19:37:19 +0530 | [diff] [blame] | 37 | #include <linux/i2c/pca954x.h> |
| Laxman Dewangan | 39b4ede | 2011-02-05 17:02:09 +0530 | [diff] [blame] | 38 | #include <linux/i2c/pca953x.h> |
| Bitan Biswas | 5730ac4 | 2011-02-09 18:01:59 +0530 | [diff] [blame] | 39 | #include <linux/nct1008.h> |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 40 | #include <mach/fb.h> |
| 41 | #include <mach/gpio.h> |
| 42 | #include <media/ov5650.h> |
| kdivvela | 1e757fd | 2011-09-30 18:34:14 +0530 | [diff] [blame] | 43 | #include <media/ov14810.h> |
| Prayas Mohanty | e3171a6 | 2011-02-25 04:30:01 +0530 | [diff] [blame] | 44 | #include <media/ov2710.h> |
| Danielle Sun | 4a56b6e | 2011-05-26 16:52:24 -0700 | [diff] [blame] | 45 | #include <media/tps61050.h> |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 46 | #include <generated/mach-types.h> |
| 47 | #include "gpio-names.h" |
| Laxman Dewangan | 39b4ede | 2011-02-05 17:02:09 +0530 | [diff] [blame] | 48 | #include "board.h" |
| Robert Collins | 31d1195 | 2011-02-01 10:37:48 -0800 | [diff] [blame] | 49 | #include <linux/mpu.h> |
| Laxman Dewangan | 2520365 | 2011-05-03 14:24:58 +0530 | [diff] [blame] | 50 | #include <media/sh532u.h> |
| Pritesh Raithatha | c19b8f1 | 2011-06-04 19:03:16 +0530 | [diff] [blame] | 51 | #include <linux/bq27x00.h> |
| Robert Collins | 31d1195 | 2011-02-01 10:37:48 -0800 | [diff] [blame] | 52 | #include <mach/gpio.h> |
| Varun Wadekar | 3c7b542 | 2011-05-12 14:25:01 +0530 | [diff] [blame] | 53 | #include <mach/edp.h> |
| Joshua Primero | 0a892e2 | 2011-10-13 17:49:20 -0700 | [diff] [blame] | 54 | #include <mach/thermal.h> |
| Robert Collins | 31d1195 | 2011-02-01 10:37:48 -0800 | [diff] [blame] | 55 | |
| 56 | #include "gpio-names.h" |
| Laxman Dewangan | 8e01bcc | 2011-01-18 19:37:19 +0530 | [diff] [blame] | 57 | #include "board-cardhu.h" |
| Robert Morell | 2c3d709 | 2011-05-19 09:31:45 -0700 | [diff] [blame] | 58 | #include "cpu-tegra.h" |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 59 | |
| 60 | static struct regulator *cardhu_1v8_cam1 = NULL; |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 61 | static struct regulator *cardhu_1v8_cam2 = NULL; |
| Prayas Mohanty | dc4ae78 | 2011-03-15 19:44:54 +0530 | [diff] [blame] | 62 | static struct regulator *cardhu_1v8_cam3 = NULL; |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 63 | static struct regulator *cardhu_vdd_2v8_cam1 = NULL; |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 64 | static struct regulator *cardhu_vdd_2v8_cam2 = NULL; |
| Prayas Mohanty | dc4ae78 | 2011-03-15 19:44:54 +0530 | [diff] [blame] | 65 | static struct regulator *cardhu_vdd_cam3 = NULL; |
| Laxman Dewangan | 8e01bcc | 2011-01-18 19:37:19 +0530 | [diff] [blame] | 66 | |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 67 | static struct board_info board_info; |
| 68 | |
| Laxman Dewangan | 8e01bcc | 2011-01-18 19:37:19 +0530 | [diff] [blame] | 69 | static struct pca954x_platform_mode cardhu_pca954x_modes[] = { |
| Laxman Dewangan | d5965af | 2011-05-02 14:58:16 +0530 | [diff] [blame] | 70 | { .adap_id = PCA954x_I2C_BUS0, .deselect_on_exit = true, }, |
| 71 | { .adap_id = PCA954x_I2C_BUS1, .deselect_on_exit = true, }, |
| 72 | { .adap_id = PCA954x_I2C_BUS2, .deselect_on_exit = true, }, |
| 73 | { .adap_id = PCA954x_I2C_BUS3, .deselect_on_exit = true, }, |
| Laxman Dewangan | 8e01bcc | 2011-01-18 19:37:19 +0530 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | static struct pca954x_platform_data cardhu_pca954x_data = { |
| 77 | .modes = cardhu_pca954x_modes, |
| 78 | .num_modes = ARRAY_SIZE(cardhu_pca954x_modes), |
| 79 | }; |
| Laxman Dewangan | 8e01bcc | 2011-01-18 19:37:19 +0530 | [diff] [blame] | 80 | |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 81 | static int cardhu_camera_init(void) |
| 82 | { |
| 83 | int ret; |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 84 | |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 85 | /* Boards E1198 and E1291 are of Cardhu personality |
| 86 | * and donot have TCA6416 exp for camera */ |
| 87 | if ((board_info.board_id == BOARD_E1198) || |
| 88 | (board_info.board_id == BOARD_E1291)) { |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 89 | tegra_gpio_enable(CAM1_POWER_DWN_GPIO); |
| 90 | ret = gpio_request(CAM1_POWER_DWN_GPIO, "camera_power_en"); |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 91 | if (ret < 0) |
| 92 | pr_err("%s: gpio_request failed for gpio %s\n", |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 93 | __func__, "CAM1_POWER_DWN_GPIO"); |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 94 | tegra_gpio_enable(CAM3_POWER_DWN_GPIO); |
| Prayas Mohanty | dc4ae78 | 2011-03-15 19:44:54 +0530 | [diff] [blame] | 95 | ret = gpio_request(CAM3_POWER_DWN_GPIO, "cam3_power_en"); |
| 96 | if (ret < 0) |
| 97 | pr_err("%s: gpio_request failed for gpio %s\n", |
| 98 | __func__, "CAM3_POWER_DWN_GPIO"); |
| 99 | |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 100 | tegra_gpio_enable(CAM2_POWER_DWN_GPIO); |
| 101 | ret = gpio_request(CAM2_POWER_DWN_GPIO, "camera2_power_en"); |
| 102 | if (ret < 0) |
| 103 | pr_err("%s: gpio_request failed for gpio %s\n", |
| 104 | __func__, "CAM2_POWER_DWN_GPIO"); |
| 105 | |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 106 | tegra_gpio_enable(OV5650_RESETN_GPIO); |
| 107 | ret = gpio_request(OV5650_RESETN_GPIO, "camera_reset"); |
| 108 | if (ret < 0) |
| 109 | pr_err("%s: gpio_request failed for gpio %s\n", |
| 110 | __func__, "OV5650_RESETN_GPIO"); |
| Prayas Mohanty | dc4ae78 | 2011-03-15 19:44:54 +0530 | [diff] [blame] | 111 | |
| 112 | gpio_direction_output(CAM3_POWER_DWN_GPIO, 1); |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 113 | gpio_direction_output(CAM1_POWER_DWN_GPIO, 1); |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 114 | gpio_direction_output(CAM2_POWER_DWN_GPIO, 1); |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 115 | mdelay(10); |
| 116 | |
| 117 | gpio_direction_output(OV5650_RESETN_GPIO, 1); |
| 118 | mdelay(5); |
| 119 | gpio_direction_output(OV5650_RESETN_GPIO, 0); |
| 120 | mdelay(5); |
| 121 | gpio_direction_output(OV5650_RESETN_GPIO, 1); |
| 122 | mdelay(5); |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | /* To select the CSIB MUX either for cam2 or cam3 */ |
| 126 | tegra_gpio_enable(CAMERA_CSI_MUX_SEL_GPIO); |
| 127 | ret = gpio_request(CAMERA_CSI_MUX_SEL_GPIO, "camera_csi_sel"); |
| 128 | if (ret < 0) |
| 129 | pr_err("%s: gpio_request failed for gpio %s\n", |
| 130 | __func__, "CAMERA_CSI_MUX_SEL_GPIO"); |
| 131 | gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 0); |
| 132 | gpio_export(CAMERA_CSI_MUX_SEL_GPIO, false); |
| 133 | |
| 134 | return 0; |
| 135 | } |
| 136 | |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 137 | static int cardhu_left_ov5650_power_on(void) |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 138 | { |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 139 | /* Boards E1198 and E1291 are of Cardhu personality |
| 140 | * and donot have TCA6416 exp for camera */ |
| 141 | if ((board_info.board_id == BOARD_E1198) || |
| 142 | (board_info.board_id == BOARD_E1291)) { |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 143 | |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 144 | if (cardhu_vdd_2v8_cam1 == NULL) { |
| 145 | cardhu_vdd_2v8_cam1 = regulator_get(NULL, "vdd_2v8_cam1"); |
| 146 | if (WARN_ON(IS_ERR(cardhu_vdd_2v8_cam1))) { |
| 147 | pr_err("%s: couldn't get regulator vdd_2v8_cam1: %ld\n", |
| 148 | __func__, PTR_ERR(cardhu_vdd_2v8_cam1)); |
| 149 | goto reg_alloc_fail; |
| 150 | } |
| 151 | } |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 152 | regulator_enable(cardhu_vdd_2v8_cam1); |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 153 | mdelay(5); |
| 154 | } |
| Prayas Mohanty | dc4ae78 | 2011-03-15 19:44:54 +0530 | [diff] [blame] | 155 | |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 156 | /* Enable VDD_1V8_Cam1 */ |
| 157 | if (cardhu_1v8_cam1 == NULL) { |
| 158 | cardhu_1v8_cam1 = regulator_get(NULL, "vdd_1v8_cam1"); |
| 159 | if (WARN_ON(IS_ERR(cardhu_1v8_cam1))) { |
| 160 | pr_err("%s: couldn't get regulator vdd_1v8_cam1: %ld\n", |
| 161 | __func__, PTR_ERR(cardhu_1v8_cam1)); |
| 162 | goto reg_alloc_fail; |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 163 | } |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 164 | } |
| 165 | regulator_enable(cardhu_1v8_cam1); |
| Laxman Dewangan | 576b252 | 2011-02-14 18:51:14 +0530 | [diff] [blame] | 166 | |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 167 | mdelay(5); |
| Laxman Dewangan | 2520365 | 2011-05-03 14:24:58 +0530 | [diff] [blame] | 168 | if ((board_info.board_id == BOARD_E1198) || |
| 169 | (board_info.board_id == BOARD_E1291)) { |
| 170 | gpio_direction_output(CAM1_POWER_DWN_GPIO, 0); |
| 171 | mdelay(20); |
| 172 | gpio_direction_output(OV5650_RESETN_GPIO, 0); |
| 173 | mdelay(100); |
| 174 | gpio_direction_output(OV5650_RESETN_GPIO, 1); |
| 175 | } |
| Frank Chen | f237f2f | 2011-08-24 18:04:52 -0700 | [diff] [blame] | 176 | |
| 177 | if (board_info.board_id == BOARD_PM269) { |
| 178 | gpio_direction_output(CAM1_RST_L_GPIO, 0); |
| 179 | mdelay(100); |
| 180 | gpio_direction_output(CAM1_RST_L_GPIO, 1); |
| 181 | } |
| 182 | |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 183 | return 0; |
| Laxman Dewangan | 576b252 | 2011-02-14 18:51:14 +0530 | [diff] [blame] | 184 | |
| 185 | reg_alloc_fail: |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 186 | if (cardhu_1v8_cam1) { |
| 187 | regulator_put(cardhu_1v8_cam1); |
| 188 | cardhu_1v8_cam1 = NULL; |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 189 | } |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 190 | if (cardhu_vdd_2v8_cam1) { |
| 191 | regulator_put(cardhu_vdd_2v8_cam1); |
| 192 | cardhu_vdd_2v8_cam1 = NULL; |
| 193 | } |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 194 | |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 195 | return -ENODEV; |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 196 | |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 197 | } |
| 198 | |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 199 | static int cardhu_left_ov5650_power_off(void) |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 200 | { |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 201 | /* Boards E1198 and E1291 are of Cardhu personality |
| 202 | * and donot have TCA6416 exp for camera */ |
| 203 | if ((board_info.board_id == BOARD_E1198) || |
| 204 | (board_info.board_id == BOARD_E1291)) { |
| 205 | gpio_direction_output(CAM1_POWER_DWN_GPIO, 1); |
| Jin Qian | 1ecfe33 | 2011-05-10 11:16:18 -0700 | [diff] [blame] | 206 | gpio_direction_output(CAM2_POWER_DWN_GPIO, 1); |
| 207 | gpio_direction_output(CAM3_POWER_DWN_GPIO, 1); |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 208 | } |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 209 | if (cardhu_1v8_cam1) |
| 210 | regulator_disable(cardhu_1v8_cam1); |
| Abhiruchi | 6e45581 | 2011-02-15 20:06:43 -0800 | [diff] [blame] | 211 | if (cardhu_vdd_2v8_cam1) |
| 212 | regulator_disable(cardhu_vdd_2v8_cam1); |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 213 | |
| 214 | return 0; |
| 215 | } |
| 216 | |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 217 | struct ov5650_platform_data cardhu_left_ov5650_data = { |
| 218 | .power_on = cardhu_left_ov5650_power_on, |
| 219 | .power_off = cardhu_left_ov5650_power_off, |
| 220 | }; |
| 221 | |
| kdivvela | 1e757fd | 2011-09-30 18:34:14 +0530 | [diff] [blame] | 222 | #ifdef CONFIG_VIDEO_OV14810 |
| 223 | static int cardhu_ov14810_power_on(void) |
| 224 | { |
| 225 | if (board_info.board_id == BOARD_E1198) { |
| 226 | gpio_direction_output(CAM1_POWER_DWN_GPIO, 1); |
| 227 | mdelay(20); |
| 228 | gpio_direction_output(OV14810_RESETN_GPIO, 0); |
| 229 | mdelay(100); |
| 230 | gpio_direction_output(OV14810_RESETN_GPIO, 1); |
| 231 | } |
| 232 | |
| 233 | return 0; |
| 234 | } |
| 235 | |
| 236 | static int cardhu_ov14810_power_off(void) |
| 237 | { |
| 238 | if (board_info.board_id == BOARD_E1198) { |
| 239 | gpio_direction_output(CAM1_POWER_DWN_GPIO, 1); |
| 240 | gpio_direction_output(CAM2_POWER_DWN_GPIO, 1); |
| 241 | gpio_direction_output(CAM3_POWER_DWN_GPIO, 1); |
| 242 | } |
| 243 | |
| 244 | return 0; |
| 245 | } |
| 246 | |
| 247 | struct ov14810_platform_data cardhu_ov14810_data = { |
| 248 | .power_on = cardhu_ov14810_power_on, |
| 249 | .power_off = cardhu_ov14810_power_off, |
| 250 | }; |
| 251 | |
| 252 | struct ov14810_platform_data cardhu_ov14810uC_data = { |
| 253 | .power_on = NULL, |
| 254 | .power_off = NULL, |
| 255 | }; |
| 256 | |
| 257 | struct ov14810_platform_data cardhu_ov14810SlaveDev_data = { |
| 258 | .power_on = NULL, |
| 259 | .power_off = NULL, |
| 260 | }; |
| 261 | |
| 262 | static struct i2c_board_info cardhu_i2c_board_info_e1214[] = { |
| 263 | { |
| 264 | I2C_BOARD_INFO("ov14810", 0x36), |
| 265 | .platform_data = &cardhu_ov14810_data, |
| 266 | }, |
| 267 | { |
| 268 | I2C_BOARD_INFO("ov14810uC", 0x67), |
| 269 | .platform_data = &cardhu_ov14810uC_data, |
| 270 | }, |
| 271 | { |
| 272 | I2C_BOARD_INFO("ov14810SlaveDev", 0x69), |
| 273 | .platform_data = &cardhu_ov14810SlaveDev_data, |
| 274 | } |
| 275 | }; |
| 276 | #endif |
| 277 | |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 278 | static int cardhu_right_ov5650_power_on(void) |
| 279 | { |
| Anton Kondratenko | e3794ce | 2011-12-12 19:06:17 -0800 | [diff] [blame^] | 280 | /* CSI-B and front sensor are muxed on cardhu */ |
| 281 | gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 0); |
| 282 | |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 283 | /* Boards E1198 and E1291 are of Cardhu personality |
| 284 | * and donot have TCA6416 exp for camera */ |
| 285 | if ((board_info.board_id == BOARD_E1198) || |
| 286 | (board_info.board_id == BOARD_E1291)) { |
| 287 | |
| Jin Qian | 1ecfe33 | 2011-05-10 11:16:18 -0700 | [diff] [blame] | 288 | gpio_direction_output(CAM1_POWER_DWN_GPIO, 0); |
| 289 | gpio_direction_output(CAM2_POWER_DWN_GPIO, 0); |
| 290 | mdelay(10); |
| 291 | |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 292 | if (cardhu_vdd_2v8_cam2 == NULL) { |
| 293 | cardhu_vdd_2v8_cam2 = regulator_get(NULL, "vdd_2v8_cam2"); |
| 294 | if (WARN_ON(IS_ERR(cardhu_vdd_2v8_cam2))) { |
| 295 | pr_err("%s: couldn't get regulator vdd_2v8_cam2: %ld\n", |
| 296 | __func__, PTR_ERR(cardhu_vdd_2v8_cam2)); |
| 297 | goto reg_alloc_fail; |
| 298 | } |
| 299 | } |
| 300 | regulator_enable(cardhu_vdd_2v8_cam2); |
| 301 | mdelay(5); |
| 302 | } |
| 303 | |
| 304 | /* Enable VDD_1V8_Cam2 */ |
| 305 | if (cardhu_1v8_cam2 == NULL) { |
| 306 | cardhu_1v8_cam2 = regulator_get(NULL, "vdd_1v8_cam2"); |
| 307 | if (WARN_ON(IS_ERR(cardhu_1v8_cam2))) { |
| 308 | pr_err("%s: couldn't get regulator vdd_1v8_cam2: %ld\n", |
| 309 | __func__, PTR_ERR(cardhu_1v8_cam2)); |
| 310 | goto reg_alloc_fail; |
| 311 | } |
| 312 | } |
| 313 | regulator_enable(cardhu_1v8_cam2); |
| 314 | |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 315 | mdelay(5); |
| Frank Chen | f237f2f | 2011-08-24 18:04:52 -0700 | [diff] [blame] | 316 | |
| 317 | if (board_info.board_id == BOARD_PM269) { |
| 318 | gpio_direction_output(CAM2_RST_L_GPIO, 0); |
| 319 | mdelay(100); |
| 320 | gpio_direction_output(CAM2_RST_L_GPIO, 1); |
| 321 | } |
| 322 | |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 323 | return 0; |
| 324 | |
| 325 | reg_alloc_fail: |
| 326 | if (cardhu_1v8_cam2) { |
| 327 | regulator_put(cardhu_1v8_cam2); |
| 328 | cardhu_1v8_cam2 = NULL; |
| 329 | } |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 330 | if (cardhu_vdd_2v8_cam2) { |
| 331 | regulator_put(cardhu_vdd_2v8_cam2); |
| 332 | cardhu_vdd_2v8_cam2 = NULL; |
| 333 | } |
| 334 | |
| 335 | return -ENODEV; |
| 336 | |
| 337 | } |
| 338 | |
| 339 | static int cardhu_right_ov5650_power_off(void) |
| 340 | { |
| Anton Kondratenko | e3794ce | 2011-12-12 19:06:17 -0800 | [diff] [blame^] | 341 | /* CSI-B and front sensor are muxed on cardhu */ |
| 342 | gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 0); |
| 343 | |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 344 | /* Boards E1198 and E1291 are of Cardhu personality |
| 345 | * and donot have TCA6416 exp for camera */ |
| Jin Qian | 1ecfe33 | 2011-05-10 11:16:18 -0700 | [diff] [blame] | 346 | if ((board_info.board_id == BOARD_E1198) || |
| 347 | (board_info.board_id == BOARD_E1291)) { |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 348 | gpio_direction_output(CAM1_POWER_DWN_GPIO, 1); |
| 349 | gpio_direction_output(CAM2_POWER_DWN_GPIO, 1); |
| garyz | 353a610 | 2011-06-01 18:41:35 -0700 | [diff] [blame] | 350 | gpio_direction_output(CAM3_POWER_DWN_GPIO, 1); |
| Jin Qian | 1ecfe33 | 2011-05-10 11:16:18 -0700 | [diff] [blame] | 351 | } |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 352 | |
| 353 | if (cardhu_1v8_cam2) |
| 354 | regulator_disable(cardhu_1v8_cam2); |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 355 | if (cardhu_vdd_2v8_cam2) |
| 356 | regulator_disable(cardhu_vdd_2v8_cam2); |
| 357 | |
| 358 | return 0; |
| 359 | } |
| 360 | |
| Prayas Mohanty | 56c62f4 | 2011-05-18 17:52:29 +0530 | [diff] [blame] | 361 | static void cardhu_ov5650_synchronize_sensors(void) |
| 362 | { |
| 363 | if (board_info.board_id == BOARD_E1198) { |
| 364 | gpio_direction_output(CAM1_POWER_DWN_GPIO, 1); |
| 365 | mdelay(50); |
| 366 | gpio_direction_output(CAM1_POWER_DWN_GPIO, 0); |
| 367 | mdelay(50); |
| 368 | } |
| 369 | else if (board_info.board_id == BOARD_E1291) { |
| 370 | gpio_direction_output(CAM1_POWER_DWN_GPIO, 1); |
| 371 | gpio_direction_output(CAM2_POWER_DWN_GPIO, 1); |
| 372 | mdelay(50); |
| 373 | gpio_direction_output(CAM1_POWER_DWN_GPIO, 0); |
| 374 | gpio_direction_output(CAM2_POWER_DWN_GPIO, 0); |
| 375 | mdelay(50); |
| 376 | } |
| 377 | else |
| 378 | pr_err("%s: UnSupported BoardId\n", __func__); |
| 379 | } |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 380 | |
| 381 | struct ov5650_platform_data cardhu_right_ov5650_data = { |
| 382 | .power_on = cardhu_right_ov5650_power_on, |
| 383 | .power_off = cardhu_right_ov5650_power_off, |
| Prayas Mohanty | 56c62f4 | 2011-05-18 17:52:29 +0530 | [diff] [blame] | 384 | .synchronize_sensors = cardhu_ov5650_synchronize_sensors, |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 385 | }; |
| 386 | |
| Prayas Mohanty | e3171a6 | 2011-02-25 04:30:01 +0530 | [diff] [blame] | 387 | static int cardhu_ov2710_power_on(void) |
| 388 | { |
| Anton Kondratenko | e3794ce | 2011-12-12 19:06:17 -0800 | [diff] [blame^] | 389 | /* CSI-B and front sensor are muxed on cardhu */ |
| Prayas Mohanty | e3171a6 | 2011-02-25 04:30:01 +0530 | [diff] [blame] | 390 | gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 1); |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 391 | |
| 392 | /* Boards E1198 and E1291 are of Cardhu personality |
| 393 | * and donot have TCA6416 exp for camera */ |
| 394 | if ((board_info.board_id == BOARD_E1198) || |
| 395 | (board_info.board_id == BOARD_E1291)) { |
| Jin Qian | 1ecfe33 | 2011-05-10 11:16:18 -0700 | [diff] [blame] | 396 | |
| 397 | gpio_direction_output(CAM1_POWER_DWN_GPIO, 0); |
| 398 | gpio_direction_output(CAM2_POWER_DWN_GPIO, 0); |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 399 | gpio_direction_output(CAM3_POWER_DWN_GPIO, 0); |
| 400 | mdelay(10); |
| 401 | |
| 402 | if (cardhu_vdd_cam3 == NULL) { |
| 403 | cardhu_vdd_cam3 = regulator_get(NULL, "vdd_cam3"); |
| 404 | if (WARN_ON(IS_ERR(cardhu_vdd_cam3))) { |
| 405 | pr_err("%s: couldn't get regulator vdd_cam3: %ld\n", |
| 406 | __func__, PTR_ERR(cardhu_vdd_cam3)); |
| 407 | goto reg_alloc_fail; |
| 408 | } |
| 409 | } |
| 410 | regulator_enable(cardhu_vdd_cam3); |
| 411 | } |
| 412 | |
| 413 | /* Enable VDD_1V8_Cam3 */ |
| 414 | if (cardhu_1v8_cam3 == NULL) { |
| 415 | cardhu_1v8_cam3 = regulator_get(NULL, "vdd_1v8_cam3"); |
| 416 | if (WARN_ON(IS_ERR(cardhu_1v8_cam3))) { |
| 417 | pr_err("%s: couldn't get regulator vdd_1v8_cam3: %ld\n", |
| 418 | __func__, PTR_ERR(cardhu_1v8_cam3)); |
| 419 | goto reg_alloc_fail; |
| 420 | } |
| 421 | } |
| 422 | regulator_enable(cardhu_1v8_cam3); |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 423 | mdelay(5); |
| 424 | |
| Prayas Mohanty | e3171a6 | 2011-02-25 04:30:01 +0530 | [diff] [blame] | 425 | return 0; |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 426 | |
| 427 | reg_alloc_fail: |
| 428 | if (cardhu_1v8_cam3) { |
| 429 | regulator_put(cardhu_1v8_cam3); |
| 430 | cardhu_1v8_cam3 = NULL; |
| 431 | } |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 432 | if (cardhu_vdd_cam3) { |
| 433 | regulator_put(cardhu_vdd_cam3); |
| 434 | cardhu_vdd_cam3 = NULL; |
| 435 | } |
| 436 | |
| 437 | return -ENODEV; |
| Prayas Mohanty | e3171a6 | 2011-02-25 04:30:01 +0530 | [diff] [blame] | 438 | } |
| 439 | |
| 440 | static int cardhu_ov2710_power_off(void) |
| 441 | { |
| Anton Kondratenko | e3794ce | 2011-12-12 19:06:17 -0800 | [diff] [blame^] | 442 | /* CSI-B and front sensor are muxed on cardhu */ |
| Jin Qian | 1ecfe33 | 2011-05-10 11:16:18 -0700 | [diff] [blame] | 443 | gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 1); |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 444 | |
| 445 | /* Boards E1198 and E1291 are of Cardhu personality |
| 446 | * and donot have TCA6416 exp for camera */ |
| 447 | if ((board_info.board_id == BOARD_E1198) || |
| Jin Qian | 1ecfe33 | 2011-05-10 11:16:18 -0700 | [diff] [blame] | 448 | (board_info.board_id == BOARD_E1291)) { |
| 449 | gpio_direction_output(CAM1_POWER_DWN_GPIO, 1); |
| 450 | gpio_direction_output(CAM2_POWER_DWN_GPIO, 1); |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 451 | gpio_direction_output(CAM3_POWER_DWN_GPIO, 1); |
| Jin Qian | 1ecfe33 | 2011-05-10 11:16:18 -0700 | [diff] [blame] | 452 | } |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 453 | |
| 454 | if (cardhu_1v8_cam3) |
| 455 | regulator_disable(cardhu_1v8_cam3); |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 456 | if (cardhu_vdd_cam3) |
| 457 | regulator_disable(cardhu_vdd_cam3); |
| 458 | |
| Prayas Mohanty | e3171a6 | 2011-02-25 04:30:01 +0530 | [diff] [blame] | 459 | return 0; |
| 460 | } |
| 461 | |
| 462 | struct ov2710_platform_data cardhu_ov2710_data = { |
| 463 | .power_on = cardhu_ov2710_power_on, |
| 464 | .power_off = cardhu_ov2710_power_off, |
| 465 | }; |
| 466 | |
| Laxman Dewangan | 8e01bcc | 2011-01-18 19:37:19 +0530 | [diff] [blame] | 467 | static const struct i2c_board_info cardhu_i2c3_board_info[] = { |
| Laxman Dewangan | 8e01bcc | 2011-01-18 19:37:19 +0530 | [diff] [blame] | 468 | { |
| 469 | I2C_BOARD_INFO("pca9546", 0x70), |
| 470 | .platform_data = &cardhu_pca954x_data, |
| 471 | }, |
| Laxman Dewangan | 8e01bcc | 2011-01-18 19:37:19 +0530 | [diff] [blame] | 472 | }; |
| Laxman Dewangan | 2520365 | 2011-05-03 14:24:58 +0530 | [diff] [blame] | 473 | |
| Erik Lilliebjerg | f07b43f | 2011-11-22 04:06:03 -0700 | [diff] [blame] | 474 | static struct sh532u_platform_data sh532u_left_pdata = { |
| 475 | .num = 1, |
| 476 | .sync = 2, |
| 477 | .dev_name = "focuser", |
| 478 | .gpio_reset = TEGRA_GPIO_PBB0, |
| Laxman Dewangan | 2520365 | 2011-05-03 14:24:58 +0530 | [diff] [blame] | 479 | }; |
| Danielle Sun | 4a56b6e | 2011-05-26 16:52:24 -0700 | [diff] [blame] | 480 | |
| Erik Lilliebjerg | f07b43f | 2011-11-22 04:06:03 -0700 | [diff] [blame] | 481 | static struct sh532u_platform_data sh532u_right_pdata = { |
| 482 | .num = 2, |
| 483 | .sync = 1, |
| 484 | .dev_name = "focuser", |
| 485 | .gpio_reset = TEGRA_GPIO_PBB0, |
| garyz | 353a610 | 2011-06-01 18:41:35 -0700 | [diff] [blame] | 486 | }; |
| Danielle Sun | 4a56b6e | 2011-05-26 16:52:24 -0700 | [diff] [blame] | 487 | |
| Erik Lilliebjerg | fb24a74 | 2011-12-01 05:44:07 -0700 | [diff] [blame] | 488 | static struct nvc_torch_pin_state cardhu_tps61050_pinstate = { |
| Danielle Sun | 4a56b6e | 2011-05-26 16:52:24 -0700 | [diff] [blame] | 489 | .mask = 0x0008, /*VGP3*/ |
| 490 | .values = 0x0008, |
| 491 | }; |
| 492 | |
| Erik Lilliebjerg | fb24a74 | 2011-12-01 05:44:07 -0700 | [diff] [blame] | 493 | static struct tps61050_platform_data cardhu_tps61050_pdata = { |
| 494 | .dev_name = "torch", |
| Danielle Sun | 4a56b6e | 2011-05-26 16:52:24 -0700 | [diff] [blame] | 495 | .pinstate = &cardhu_tps61050_pinstate, |
| Danielle Sun | 4a56b6e | 2011-05-26 16:52:24 -0700 | [diff] [blame] | 496 | }; |
| 497 | |
| 498 | static const struct i2c_board_info cardhu_i2c_board_info_tps61050[] = { |
| 499 | { |
| 500 | I2C_BOARD_INFO("tps61050", 0x33), |
| Erik Lilliebjerg | fb24a74 | 2011-12-01 05:44:07 -0700 | [diff] [blame] | 501 | .platform_data = &cardhu_tps61050_pdata, |
| Danielle Sun | 4a56b6e | 2011-05-26 16:52:24 -0700 | [diff] [blame] | 502 | }, |
| 503 | }; |
| 504 | |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 505 | static struct i2c_board_info cardhu_i2c6_board_info[] = { |
| 506 | { |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 507 | I2C_BOARD_INFO("ov5650L", 0x36), |
| 508 | .platform_data = &cardhu_left_ov5650_data, |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 509 | }, |
| Abhiruchi Birajdar | b17f850 | 2011-03-18 14:39:50 +0530 | [diff] [blame] | 510 | { |
| Erik Lilliebjerg | f07b43f | 2011-11-22 04:06:03 -0700 | [diff] [blame] | 511 | I2C_BOARD_INFO("sh532u", 0x72), |
| garyz | 353a610 | 2011-06-01 18:41:35 -0700 | [diff] [blame] | 512 | .platform_data = &sh532u_left_pdata, |
| Abhiruchi Birajdar | b17f850 | 2011-03-18 14:39:50 +0530 | [diff] [blame] | 513 | }, |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 514 | }; |
| Laxman Dewangan | 8e01bcc | 2011-01-18 19:37:19 +0530 | [diff] [blame] | 515 | |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 516 | static struct i2c_board_info cardhu_i2c7_board_info[] = { |
| 517 | { |
| 518 | I2C_BOARD_INFO("ov5650R", 0x36), |
| 519 | .platform_data = &cardhu_right_ov5650_data, |
| 520 | }, |
| garyz | 353a610 | 2011-06-01 18:41:35 -0700 | [diff] [blame] | 521 | { |
| Erik Lilliebjerg | f07b43f | 2011-11-22 04:06:03 -0700 | [diff] [blame] | 522 | I2C_BOARD_INFO("sh532u", 0x72), |
| garyz | 353a610 | 2011-06-01 18:41:35 -0700 | [diff] [blame] | 523 | .platform_data = &sh532u_right_pdata, |
| 524 | }, |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 525 | }; |
| 526 | |
| Prayas Mohanty | e3171a6 | 2011-02-25 04:30:01 +0530 | [diff] [blame] | 527 | static struct i2c_board_info cardhu_i2c8_board_info[] = { |
| 528 | { |
| 529 | I2C_BOARD_INFO("ov2710", 0x36), |
| 530 | .platform_data = &cardhu_ov2710_data, |
| 531 | }, |
| 532 | }; |
| 533 | |
| Joshua Primero | 0a892e2 | 2011-10-13 17:49:20 -0700 | [diff] [blame] | 534 | #ifndef CONFIG_TEGRA_INTERNAL_TSENSOR_EDP_SUPPORT |
| 535 | static int nct_get_temp(void *_data, long *temp) |
| 536 | { |
| 537 | struct nct1008_data *data = _data; |
| 538 | return nct1008_thermal_get_temp(data, temp); |
| 539 | } |
| 540 | |
| 541 | static int nct_set_limits(void *_data, |
| 542 | long lo_limit_milli, |
| 543 | long hi_limit_milli) |
| 544 | { |
| 545 | struct nct1008_data *data = _data; |
| 546 | return nct1008_thermal_set_limits(data, |
| 547 | lo_limit_milli, |
| 548 | hi_limit_milli); |
| 549 | } |
| 550 | |
| 551 | static int nct_set_alert(void *_data, |
| 552 | void (*alert_func)(void *), |
| 553 | void *alert_data) |
| 554 | { |
| 555 | struct nct1008_data *data = _data; |
| 556 | return nct1008_thermal_set_alert(data, alert_func, alert_data); |
| 557 | } |
| 558 | |
| 559 | static int nct_set_shutdown_temp(void *_data, long shutdown_temp) |
| 560 | { |
| 561 | struct nct1008_data *data = _data; |
| 562 | return nct1008_thermal_set_shutdown_temp(data, shutdown_temp); |
| 563 | } |
| 564 | static void nct1008_probe_callback(struct nct1008_data *data) |
| 565 | { |
| 566 | struct tegra_thermal_device *thermal_device; |
| 567 | |
| 568 | thermal_device = kzalloc(sizeof(struct tegra_thermal_device), |
| 569 | GFP_KERNEL); |
| 570 | if (!thermal_device) { |
| 571 | pr_err("unable to allocate thermal device\n"); |
| 572 | return; |
| 573 | } |
| 574 | |
| 575 | thermal_device->data = data; |
| 576 | thermal_device->offset = TDIODE_OFFSET; |
| 577 | thermal_device->get_temp = nct_get_temp; |
| 578 | thermal_device->set_limits = nct_set_limits; |
| 579 | thermal_device->set_alert = nct_set_alert; |
| 580 | thermal_device->set_shutdown_temp = nct_set_shutdown_temp; |
| 581 | |
| 582 | tegra_thermal_set_device(thermal_device); |
| 583 | } |
| 584 | #endif |
| 585 | |
| Bitan Biswas | 5730ac4 | 2011-02-09 18:01:59 +0530 | [diff] [blame] | 586 | static struct nct1008_platform_data cardhu_nct1008_pdata = { |
| 587 | .supported_hwrev = true, |
| Bitan Biswas | 0513cd6 | 2011-07-12 13:00:19 +0530 | [diff] [blame] | 588 | .ext_range = true, |
| Bitan Biswas | 5730ac4 | 2011-02-09 18:01:59 +0530 | [diff] [blame] | 589 | .conv_rate = 0x08, |
| Diwakar Tundlam | 609ccce | 2011-09-08 10:59:56 -0700 | [diff] [blame] | 590 | .offset = 8, /* 4 * 2C. Bug 844025 - 1C for device accuracies */ |
| Joshua Primero | 0a892e2 | 2011-10-13 17:49:20 -0700 | [diff] [blame] | 591 | #ifndef CONFIG_TEGRA_INTERNAL_TSENSOR_EDP_SUPPORT |
| 592 | .probe_callback = nct1008_probe_callback, |
| 593 | #endif |
| Bitan Biswas | 5730ac4 | 2011-02-09 18:01:59 +0530 | [diff] [blame] | 594 | }; |
| 595 | |
| Laxman Dewangan | 12bf37c | 2011-03-25 14:50:15 +0530 | [diff] [blame] | 596 | static struct i2c_board_info cardhu_i2c4_bq27510_board_info[] = { |
| Bitan Biswas | 5730ac4 | 2011-02-09 18:01:59 +0530 | [diff] [blame] | 597 | { |
| syed rafiuddin | e451d76 | 2011-03-21 15:08:26 +0530 | [diff] [blame] | 598 | I2C_BOARD_INFO("bq27510", 0x55), |
| 599 | }, |
| Laxman Dewangan | 12bf37c | 2011-03-25 14:50:15 +0530 | [diff] [blame] | 600 | }; |
| 601 | |
| Varun Wadekar | 3c7b542 | 2011-05-12 14:25:01 +0530 | [diff] [blame] | 602 | static struct i2c_board_info cardhu_i2c4_nct1008_board_info[] = { |
| syed rafiuddin | e451d76 | 2011-03-21 15:08:26 +0530 | [diff] [blame] | 603 | { |
| Bitan Biswas | 5730ac4 | 2011-02-09 18:01:59 +0530 | [diff] [blame] | 604 | I2C_BOARD_INFO("nct1008", 0x4C), |
| 605 | .platform_data = &cardhu_nct1008_pdata, |
| 606 | .irq = -1, |
| 607 | } |
| 608 | }; |
| 609 | |
| 610 | static int cardhu_nct1008_init(void) |
| 611 | { |
| 612 | int nct1008_port = -1; |
| Bitan Biswas | 5730ac4 | 2011-02-09 18:01:59 +0530 | [diff] [blame] | 613 | int ret; |
| 614 | |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 615 | if ((board_info.board_id == BOARD_E1198) || |
| Laxman Dewangan | 9fc8822 | 2011-08-17 15:59:34 +0530 | [diff] [blame] | 616 | (board_info.board_id == BOARD_E1291) || |
| Laxman Dewangan | abc4aac | 2011-09-09 11:08:01 +0530 | [diff] [blame] | 617 | (board_info.board_id == BOARD_E1257) || |
| Laxman Dewangan | 2de5dd8 | 2011-08-30 15:11:20 +0530 | [diff] [blame] | 618 | (board_info.board_id == BOARD_PM269) || |
| Laxman Dewangan | 6b57c93f | 2011-08-31 11:46:43 +0530 | [diff] [blame] | 619 | (board_info.board_id == BOARD_PM305) || |
| 620 | (board_info.board_id == BOARD_PM311)) { |
| Bitan Biswas | 5730ac4 | 2011-02-09 18:01:59 +0530 | [diff] [blame] | 621 | nct1008_port = TEGRA_GPIO_PCC2; |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 622 | } else if ((board_info.board_id == BOARD_E1186) || |
| Laxman Dewangan | 3187bb1 | 2011-07-11 18:22:39 +0530 | [diff] [blame] | 623 | (board_info.board_id == BOARD_E1187) || |
| 624 | (board_info.board_id == BOARD_E1256)) { |
| Bitan Biswas | 5730ac4 | 2011-02-09 18:01:59 +0530 | [diff] [blame] | 625 | /* FIXME: seems to be conflicting with usb3 vbus on E1186 */ |
| 626 | /* nct1008_port = TEGRA_GPIO_PH7; */ |
| 627 | } |
| 628 | |
| 629 | if (nct1008_port >= 0) { |
| 630 | /* FIXME: enable irq when throttling is supported */ |
| Varun Wadekar | 3c7b542 | 2011-05-12 14:25:01 +0530 | [diff] [blame] | 631 | cardhu_i2c4_nct1008_board_info[0].irq = TEGRA_GPIO_TO_IRQ(nct1008_port); |
| Bitan Biswas | 5730ac4 | 2011-02-09 18:01:59 +0530 | [diff] [blame] | 632 | |
| 633 | ret = gpio_request(nct1008_port, "temp_alert"); |
| 634 | if (ret < 0) |
| 635 | return ret; |
| 636 | |
| 637 | ret = gpio_direction_input(nct1008_port); |
| 638 | if (ret < 0) |
| 639 | gpio_free(nct1008_port); |
| 640 | else |
| 641 | tegra_gpio_enable(nct1008_port); |
| Bitan Biswas | 5730ac4 | 2011-02-09 18:01:59 +0530 | [diff] [blame] | 642 | } |
| Varun Wadekar | 3c7b542 | 2011-05-12 14:25:01 +0530 | [diff] [blame] | 643 | |
| Bitan Biswas | 5730ac4 | 2011-02-09 18:01:59 +0530 | [diff] [blame] | 644 | return ret; |
| 645 | } |
| 646 | |
| Laxman Dewangan | 39b4ede | 2011-02-05 17:02:09 +0530 | [diff] [blame] | 647 | #if defined(CONFIG_GPIO_PCA953X) |
| 648 | static struct pca953x_platform_data cardhu_pmu_tca6416_data = { |
| 649 | .gpio_base = PMU_TCA6416_GPIO_BASE, |
| 650 | }; |
| 651 | |
| 652 | static const struct i2c_board_info cardhu_i2c4_board_info_tca6416[] = { |
| 653 | { |
| 654 | I2C_BOARD_INFO("tca6416", 0x20), |
| 655 | .platform_data = &cardhu_pmu_tca6416_data, |
| 656 | }, |
| 657 | }; |
| 658 | |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 659 | static struct pca953x_platform_data cardhu_cam_tca6416_data = { |
| 660 | .gpio_base = CAM_TCA6416_GPIO_BASE, |
| 661 | }; |
| 662 | |
| 663 | static const struct i2c_board_info cardhu_i2c2_board_info_tca6416[] = { |
| 664 | { |
| 665 | I2C_BOARD_INFO("tca6416", 0x20), |
| 666 | .platform_data = &cardhu_cam_tca6416_data, |
| 667 | }, |
| 668 | }; |
| 669 | |
| Laxman Dewangan | 39b4ede | 2011-02-05 17:02:09 +0530 | [diff] [blame] | 670 | static int __init pmu_tca6416_init(void) |
| 671 | { |
| Laxman Dewangan | 39b4ede | 2011-02-05 17:02:09 +0530 | [diff] [blame] | 672 | if ((board_info.board_id == BOARD_E1198) || |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 673 | (board_info.board_id == BOARD_E1291)) |
| 674 | return 0; |
| Laxman Dewangan | 39b4ede | 2011-02-05 17:02:09 +0530 | [diff] [blame] | 675 | |
| 676 | pr_info("Registering pmu pca6416\n"); |
| 677 | i2c_register_board_info(4, cardhu_i2c4_board_info_tca6416, |
| 678 | ARRAY_SIZE(cardhu_i2c4_board_info_tca6416)); |
| 679 | return 0; |
| 680 | } |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 681 | |
| 682 | static int __init cam_tca6416_init(void) |
| 683 | { |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 684 | /* Boards E1198 and E1291 are of Cardhu personality |
| 685 | * and donot have TCA6416 exp for camera */ |
| 686 | if ((board_info.board_id == BOARD_E1198) || |
| 687 | (board_info.board_id == BOARD_E1291)) |
| 688 | return 0; |
| 689 | |
| 690 | pr_info("Registering cam pca6416\n"); |
| 691 | i2c_register_board_info(2, cardhu_i2c2_board_info_tca6416, |
| 692 | ARRAY_SIZE(cardhu_i2c2_board_info_tca6416)); |
| 693 | return 0; |
| 694 | } |
| Laxman Dewangan | 39b4ede | 2011-02-05 17:02:09 +0530 | [diff] [blame] | 695 | #else |
| 696 | static int __init pmu_tca6416_init(void) |
| 697 | { |
| 698 | return 0; |
| 699 | } |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 700 | |
| 701 | static int __init cam_tca6416_init(void) |
| 702 | { |
| 703 | return 0; |
| 704 | } |
| Laxman Dewangan | 39b4ede | 2011-02-05 17:02:09 +0530 | [diff] [blame] | 705 | #endif |
| 706 | |
| Robert Collins | 96a2824 | 2011-03-18 14:29:07 -0700 | [diff] [blame] | 707 | #ifdef CONFIG_MPU_SENSORS_MPU3050 |
| Robert Collins | 5d901d9 | 2011-11-09 13:59:33 -0800 | [diff] [blame] | 708 | static struct mpu_platform_data mpu3050_data = { |
| 709 | .int_config = 0x10, |
| 710 | .level_shifter = 0, |
| 711 | .orientation = MPU_GYRO_ORIENTATION, /* Located in board_[platformname].h */ |
| Robert Collins | 31d1195 | 2011-02-01 10:37:48 -0800 | [diff] [blame] | 712 | }; |
| 713 | |
| Robert Collins | 5d901d9 | 2011-11-09 13:59:33 -0800 | [diff] [blame] | 714 | static struct ext_slave_platform_data mpu3050_accel_data = { |
| 715 | .address = MPU_ACCEL_ADDR, |
| 716 | .irq = 0, |
| 717 | .adapt_num = MPU_ACCEL_BUS_NUM, |
| 718 | .bus = EXT_SLAVE_BUS_SECONDARY, |
| 719 | .orientation = MPU_ACCEL_ORIENTATION, /* Located in board_[platformname].h */ |
| 720 | }; |
| 721 | |
| 722 | static struct ext_slave_platform_data mpu_compass_data = { |
| 723 | .address = MPU_COMPASS_ADDR, |
| 724 | .irq = 0, |
| 725 | .adapt_num = MPU_COMPASS_BUS_NUM, |
| 726 | .bus = EXT_SLAVE_BUS_PRIMARY, |
| 727 | .orientation = MPU_COMPASS_ORIENTATION, /* Located in board_[platformname].h */ |
| 728 | }; |
| 729 | |
| 730 | static struct i2c_board_info __initdata inv_mpu_i2c2_board_info[] = { |
| Robert Collins | 31d1195 | 2011-02-01 10:37:48 -0800 | [diff] [blame] | 731 | { |
| Robert Collins | 5d901d9 | 2011-11-09 13:59:33 -0800 | [diff] [blame] | 732 | I2C_BOARD_INFO(MPU_GYRO_NAME, MPU_GYRO_ADDR), |
| 733 | .irq = TEGRA_GPIO_TO_IRQ(MPU_GYRO_IRQ_GPIO), |
| Robert Collins | 31d1195 | 2011-02-01 10:37:48 -0800 | [diff] [blame] | 734 | .platform_data = &mpu3050_data, |
| 735 | }, |
| Robert Collins | 5d901d9 | 2011-11-09 13:59:33 -0800 | [diff] [blame] | 736 | { |
| 737 | I2C_BOARD_INFO(MPU_ACCEL_NAME, MPU_ACCEL_ADDR), |
| 738 | #if MPU_ACCEL_IRQ_GPIO |
| 739 | .irq = TEGRA_GPIO_TO_IRQ(MPU_ACCEL_IRQ_GPIO), |
| 740 | #endif |
| 741 | .platform_data = &mpu3050_accel_data, |
| 742 | }, |
| 743 | { |
| 744 | I2C_BOARD_INFO(MPU_COMPASS_NAME, MPU_COMPASS_ADDR), |
| 745 | #if MPU_COMPASS_IRQ_GPIO |
| 746 | .irq = TEGRA_GPIO_TO_IRQ(MPU_COMPASS_IRQ_GPIO), |
| 747 | #endif |
| 748 | .platform_data = &mpu_compass_data, |
| 749 | }, |
| Robert Collins | 31d1195 | 2011-02-01 10:37:48 -0800 | [diff] [blame] | 750 | }; |
| 751 | |
| Robert Collins | 5d901d9 | 2011-11-09 13:59:33 -0800 | [diff] [blame] | 752 | static void mpuirq_init(void) |
| Robert Collins | 31d1195 | 2011-02-01 10:37:48 -0800 | [diff] [blame] | 753 | { |
| Robert Collins | 5d901d9 | 2011-11-09 13:59:33 -0800 | [diff] [blame] | 754 | int ret = 0; |
| Laxman Dewangan | 67e36c2 | 2011-04-13 14:08:48 +0530 | [diff] [blame] | 755 | |
| Robert Collins | 5d901d9 | 2011-11-09 13:59:33 -0800 | [diff] [blame] | 756 | pr_info("*** MPU START *** mpuirq_init...\n"); |
| 757 | |
| 758 | #if MPU_ACCEL_IRQ_GPIO |
| 759 | /* ACCEL-IRQ assignment */ |
| 760 | tegra_gpio_enable(MPU_ACCEL_IRQ_GPIO); |
| 761 | ret = gpio_request(MPU_ACCEL_IRQ_GPIO, MPU_ACCEL_NAME); |
| 762 | if (ret < 0) { |
| 763 | pr_err("%s: gpio_request failed %d\n", __func__, ret); |
| 764 | return; |
| 765 | } |
| 766 | |
| 767 | ret = gpio_direction_input(MPU_ACCEL_IRQ_GPIO); |
| 768 | if (ret < 0) { |
| 769 | pr_err("%s: gpio_direction_input failed %d\n", __func__, ret); |
| 770 | gpio_free(MPU_ACCEL_IRQ_GPIO); |
| 771 | return; |
| 772 | } |
| 773 | #endif |
| 774 | |
| 775 | /* MPU-IRQ assignment */ |
| 776 | tegra_gpio_enable(MPU_GYRO_IRQ_GPIO); |
| 777 | ret = gpio_request(MPU_GYRO_IRQ_GPIO, MPU_GYRO_NAME); |
| 778 | if (ret < 0) { |
| 779 | pr_err("%s: gpio_request failed %d\n", __func__, ret); |
| 780 | return; |
| 781 | } |
| 782 | |
| 783 | ret = gpio_direction_input(MPU_GYRO_IRQ_GPIO); |
| 784 | if (ret < 0) { |
| 785 | pr_err("%s: gpio_direction_input failed %d\n", __func__, ret); |
| 786 | gpio_free(MPU_GYRO_IRQ_GPIO); |
| 787 | return; |
| 788 | } |
| 789 | pr_info("*** MPU END *** mpuirq_init...\n"); |
| 790 | |
| 791 | i2c_register_board_info(MPU_GYRO_BUS_NUM, inv_mpu_i2c2_board_info, |
| 792 | ARRAY_SIZE(inv_mpu_i2c2_board_info)); |
| Robert Collins | 31d1195 | 2011-02-01 10:37:48 -0800 | [diff] [blame] | 793 | } |
| 794 | #endif |
| 795 | |
| 796 | |
| Laxman Dewangan | 8e85dfa | 2011-03-22 18:40:06 +0530 | [diff] [blame] | 797 | static struct i2c_board_info cardhu_i2c2_isl_board_info[] = { |
| 798 | { |
| 799 | I2C_BOARD_INFO("isl29028", 0x44), |
| 800 | } |
| 801 | }; |
| 802 | |
| Laxman Dewangan | 353d543 | 2010-12-22 15:32:30 +0530 | [diff] [blame] | 803 | int __init cardhu_sensors_init(void) |
| 804 | { |
| Bitan Biswas | 5730ac4 | 2011-02-09 18:01:59 +0530 | [diff] [blame] | 805 | int err; |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 806 | |
| Laxman Dewangan | 12bf37c | 2011-03-25 14:50:15 +0530 | [diff] [blame] | 807 | tegra_get_board_info(&board_info); |
| Laxman Dewangan | 39b4ede | 2011-02-05 17:02:09 +0530 | [diff] [blame] | 808 | |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 809 | cardhu_camera_init(); |
| 810 | cam_tca6416_init(); |
| 811 | |
| 812 | i2c_register_board_info(2, cardhu_i2c3_board_info, |
| 813 | ARRAY_SIZE(cardhu_i2c3_board_info)); |
| 814 | |
| Danielle Sun | 4a56b6e | 2011-05-26 16:52:24 -0700 | [diff] [blame] | 815 | i2c_register_board_info(2, cardhu_i2c_board_info_tps61050, |
| 816 | ARRAY_SIZE(cardhu_i2c_board_info_tps61050)); |
| 817 | |
| kdivvela | 1e757fd | 2011-09-30 18:34:14 +0530 | [diff] [blame] | 818 | #ifdef CONFIG_VIDEO_OV14810 |
| 819 | /* This is disabled by default; To enable this change Kconfig; |
| 820 | * there should be some way to detect dynamically which board |
| 821 | * is connected (E1211/E1214), till that time sensor selection |
| 822 | * logic is static; |
| 823 | * e1214 corresponds to ov14810 sensor */ |
| 824 | i2c_register_board_info(2, cardhu_i2c_board_info_e1214, |
| 825 | ARRAY_SIZE(cardhu_i2c_board_info_e1214)); |
| 826 | #else |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 827 | /* Left camera is on PCA954x's I2C BUS0, Right camera is on BUS1 & |
| 828 | * Front camera is on BUS2 */ |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 829 | i2c_register_board_info(PCA954x_I2C_BUS0, cardhu_i2c6_board_info, |
| 830 | ARRAY_SIZE(cardhu_i2c6_board_info)); |
| Laxman Dewangan | 8e01bcc | 2011-01-18 19:37:19 +0530 | [diff] [blame] | 831 | |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 832 | i2c_register_board_info(PCA954x_I2C_BUS1, cardhu_i2c7_board_info, |
| 833 | ARRAY_SIZE(cardhu_i2c7_board_info)); |
| 834 | |
| Prayas Mohanty | e3171a6 | 2011-02-25 04:30:01 +0530 | [diff] [blame] | 835 | i2c_register_board_info(PCA954x_I2C_BUS2, cardhu_i2c8_board_info, |
| 836 | ARRAY_SIZE(cardhu_i2c8_board_info)); |
| 837 | |
| kdivvela | 1e757fd | 2011-09-30 18:34:14 +0530 | [diff] [blame] | 838 | #endif |
| Laxman Dewangan | 39b4ede | 2011-02-05 17:02:09 +0530 | [diff] [blame] | 839 | pmu_tca6416_init(); |
| Bitan Biswas | 5730ac4 | 2011-02-09 18:01:59 +0530 | [diff] [blame] | 840 | |
| Laxman Dewangan | 12bf37c | 2011-03-25 14:50:15 +0530 | [diff] [blame] | 841 | if (board_info.board_id == BOARD_E1291) |
| 842 | i2c_register_board_info(4, cardhu_i2c4_bq27510_board_info, |
| 843 | ARRAY_SIZE(cardhu_i2c4_bq27510_board_info)); |
| 844 | |
| Laxman Dewangan | 8e85dfa | 2011-03-22 18:40:06 +0530 | [diff] [blame] | 845 | i2c_register_board_info(2, cardhu_i2c2_isl_board_info, |
| 846 | ARRAY_SIZE(cardhu_i2c2_isl_board_info)); |
| 847 | |
| Bitan Biswas | 5730ac4 | 2011-02-09 18:01:59 +0530 | [diff] [blame] | 848 | err = cardhu_nct1008_init(); |
| 849 | if (err) |
| 850 | return err; |
| 851 | |
| Varun Wadekar | 3c7b542 | 2011-05-12 14:25:01 +0530 | [diff] [blame] | 852 | i2c_register_board_info(4, cardhu_i2c4_nct1008_board_info, |
| 853 | ARRAY_SIZE(cardhu_i2c4_nct1008_board_info)); |
| 854 | |
| Robert Collins | 96a2824 | 2011-03-18 14:29:07 -0700 | [diff] [blame] | 855 | #ifdef CONFIG_MPU_SENSORS_MPU3050 |
| Robert Collins | 5d901d9 | 2011-11-09 13:59:33 -0800 | [diff] [blame] | 856 | mpuirq_init(); |
| Robert Collins | 31d1195 | 2011-02-01 10:37:48 -0800 | [diff] [blame] | 857 | #endif |
| Laxman Dewangan | 353d543 | 2010-12-22 15:32:30 +0530 | [diff] [blame] | 858 | return 0; |
| 859 | } |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 860 | |
| 861 | #if defined(CONFIG_GPIO_PCA953X) |
| 862 | struct ov5650_gpios { |
| 863 | const char *name; |
| 864 | int gpio; |
| 865 | int enabled; |
| 866 | }; |
| 867 | |
| 868 | #define OV5650_GPIO(_name, _gpio, _enabled) \ |
| 869 | { \ |
| 870 | .name = _name, \ |
| 871 | .gpio = _gpio, \ |
| 872 | .enabled = _enabled, \ |
| 873 | } |
| 874 | |
| 875 | static struct ov5650_gpios ov5650_gpio_keys[] = { |
| 876 | [0] = OV5650_GPIO("cam1_pwdn", CAM1_PWR_DN_GPIO, 0), |
| 877 | [1] = OV5650_GPIO("cam1_rst_lo", CAM1_RST_L_GPIO, 1), |
| Prayas Mohanty | bd02767 | 2011-06-22 16:35:43 +0530 | [diff] [blame] | 878 | [2] = OV5650_GPIO("cam1_af_pwdn_lo", CAM1_AF_PWR_DN_L_GPIO, 0), |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 879 | [3] = OV5650_GPIO("cam1_ldo_shdn_lo", CAM1_LDO_SHUTDN_L_GPIO, 1), |
| 880 | [4] = OV5650_GPIO("cam2_pwdn", CAM2_PWR_DN_GPIO, 0), |
| 881 | [5] = OV5650_GPIO("cam2_rst_lo", CAM2_RST_L_GPIO, 1), |
| Prayas Mohanty | bd02767 | 2011-06-22 16:35:43 +0530 | [diff] [blame] | 882 | [6] = OV5650_GPIO("cam2_af_pwdn_lo", CAM2_AF_PWR_DN_L_GPIO, 0), |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 883 | [7] = OV5650_GPIO("cam2_ldo_shdn_lo", CAM2_LDO_SHUTDN_L_GPIO, 1), |
| 884 | [8] = OV5650_GPIO("cam3_pwdn", CAM_FRONT_PWR_DN_GPIO, 0), |
| 885 | [9] = OV5650_GPIO("cam3_rst_lo", CAM_FRONT_RST_L_GPIO, 1), |
| Prayas Mohanty | bd02767 | 2011-06-22 16:35:43 +0530 | [diff] [blame] | 886 | [10] = OV5650_GPIO("cam3_af_pwdn_lo", CAM_FRONT_AF_PWR_DN_L_GPIO, 0), |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 887 | [11] = OV5650_GPIO("cam3_ldo_shdn_lo", CAM_FRONT_LDO_SHUTDN_L_GPIO, 1), |
| 888 | [12] = OV5650_GPIO("cam_led_exp", CAM_FRONT_LED_EXP, 1), |
| 889 | [13] = OV5650_GPIO("cam_led_rear_exp", CAM_SNN_LED_REAR_EXP, 1), |
| 890 | [14] = OV5650_GPIO("cam_i2c_mux_rst", CAM_I2C_MUX_RST_EXP, 1), |
| 891 | }; |
| 892 | |
| 893 | int __init cardhu_ov5650_late_init(void) |
| 894 | { |
| 895 | int ret; |
| 896 | int i; |
| 897 | |
| Dan Willemsen | a4f6c55 | 2011-10-24 14:32:09 -0700 | [diff] [blame] | 898 | if (!machine_is_cardhu()) |
| 899 | return 0; |
| 900 | |
| Abhiruchi Birajdar | bb5f1a9 | 2011-06-08 19:36:37 +0530 | [diff] [blame] | 901 | if ((board_info.board_id == BOARD_E1198) || |
| 902 | (board_info.board_id == BOARD_E1291)) |
| 903 | return 0; |
| 904 | |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 905 | printk("%s: \n", __func__); |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 906 | for (i = 0; i < ARRAY_SIZE(ov5650_gpio_keys); i++) { |
| 907 | ret = gpio_request(ov5650_gpio_keys[i].gpio, |
| 908 | ov5650_gpio_keys[i].name); |
| 909 | if (ret < 0) { |
| 910 | printk("%s: gpio_request failed for gpio #%d\n", |
| 911 | __func__, i); |
| 912 | goto fail; |
| 913 | } |
| Prayas Mohanty | 98a127e | 2011-04-13 12:30:56 +0530 | [diff] [blame] | 914 | printk("%s: enable - %d\n", __func__, i); |
| Prayas Mohanty | 309cf66 | 2011-02-11 00:05:42 +0530 | [diff] [blame] | 915 | gpio_direction_output(ov5650_gpio_keys[i].gpio, |
| 916 | ov5650_gpio_keys[i].enabled); |
| 917 | gpio_export(ov5650_gpio_keys[i].gpio, false); |
| 918 | } |
| 919 | |
| 920 | return 0; |
| 921 | |
| 922 | fail: |
| 923 | while (i--) |
| 924 | gpio_free(ov5650_gpio_keys[i].gpio); |
| 925 | return ret; |
| 926 | } |
| 927 | |
| 928 | late_initcall(cardhu_ov5650_late_init); |
| 929 | #endif |