arch: arm: add bonaire sensor board file
Wei Chen [Mon, 29 Apr 2013 17:43:44 +0000 (10:43 -0700)]
Add bonaire sensor board file for FPGA bringup

bug 1205344

Change-Id: If9b4a830cbc89ed2ff7419dbbf783b235651196d
Signed-off-by: Wei Chen <wechen@nvidia.com>
Reviewed-on: http://git-master/r/219615
Reviewed-by: Alexander Van Brunt <avanbrunt@nvidia.com>

arch/arm/configs/tegra_bonaire_android_defconfig
arch/arm/mach-tegra/Makefile
arch/arm/mach-tegra/board-bonaire-sensors.c [new file with mode: 0644]
arch/arm/mach-tegra/board-bonaire.c

index 34e8a4c..9feb7db 100644 (file)
@@ -173,6 +173,8 @@ CONFIG_MEDIA_SUPPORT=y
 CONFIG_V4L_PLATFORM_DRIVERS=y
 # CONFIG_TEGRA_RPC is not set
 CONFIG_TEGRA_NVAVP=y
+CONFIG_VIDEO_IMX091=y
+CONFIG_VIDEO_OV9772=y
 CONFIG_VIDEO_OUTPUT_CONTROL=y
 CONFIG_FB=y
 CONFIG_TEGRA_GRHOST=y
index 0ce5219..cfc7d49 100644 (file)
@@ -198,6 +198,7 @@ obj-${CONFIG_MACH_BONAIRE}              += board-bonaire-panel.o
 obj-${CONFIG_MACH_BONAIRE}              += board-bonaire-pinmux.o
 obj-${CONFIG_MACH_BONAIRE}              += board-bonaire-power.o
 obj-${CONFIG_MACH_BONAIRE}              += board-bonaire-sdhci.o
+obj-${CONFIG_MACH_BONAIRE}              += board-bonaire-sensors.o
 
 obj-${CONFIG_MACH_CURACAO}              += board-curacao.o
 obj-${CONFIG_MACH_CURACAO}              += board-curacao-panel.o
diff --git a/arch/arm/mach-tegra/board-bonaire-sensors.c b/arch/arm/mach-tegra/board-bonaire-sensors.c
new file mode 100644 (file)
index 0000000..f62b2a3
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+ * arch/arm/mach-tegra/board-bonaire-sensors.c
+ *
+ * Copyright (c) 2011-2013 NVIDIA CORPORATION, All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of NVIDIA CORPORATION nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <linux/i2c.h>
+#include <linux/delay.h>
+#include <media/imx091.h>
+#include <media/ov9772.h>
+#include "board.h"
+#include "board-bonaire.h"
+
+static int bonaire_imx091_power_on(struct nvc_regulator *vreg)
+{
+       return 0;
+}
+
+static int bonaire_imx091_power_off(struct nvc_regulator *vreg)
+{
+       return 0;
+}
+
+static struct nvc_imager_cap imx091_cap = {
+       .identifier             = "IMX091",
+       .sensor_nvc_interface   = NVC_IMAGER_SENSOR_INTERFACE_SERIAL_A,
+       .pixel_types[0]         = 0x100,
+       .orientation            = 0,
+       .direction              = 0,
+       .initial_clock_rate_khz = 6000,
+       .clock_profiles[0] = {
+               .external_clock_khz     = 24000,
+               .clock_multiplier       = 10416667, /* value / 1,000,000 */
+       },
+       .clock_profiles[1] = {
+               .external_clock_khz     = 0,
+               .clock_multiplier       = 0,
+       },
+       .h_sync_edge            = 0,
+       .v_sync_edge            = 0,
+       .mclk_on_vgp0           = 0,
+       .csi_port               = 0,
+       .data_lanes             = 4,
+       .virtual_channel_id     = 0,
+       .discontinuous_clk_mode = 1,
+       .cil_threshold_settle   = 0xc,
+       .min_blank_time_width   = 16,
+       .min_blank_time_height  = 16,
+       .preferred_mode_index   = 0,
+       .focuser_guid           = 0,
+       .torch_guid             = 0,
+       .cap_version            = NVC_IMAGER_CAPABILITIES_VERSION2,
+};
+
+static struct imx091_platform_data bonaire_imx091_data = {
+       .num                    = 0,
+       .sync                   = 0,
+       .dev_name               = "camera",
+       .gpio_count             = 0,
+       .gpio                   = 0,
+       .cap                    = &imx091_cap,
+       .power_on               = bonaire_imx091_power_on,
+       .power_off              = bonaire_imx091_power_off,
+};
+
+static int bonaire_ov9772_power_on(struct nvc_regulator *vreg)
+{
+       return 0;
+}
+
+static int bonaire_ov9772_power_off(struct nvc_regulator *vreg)
+{
+       return 0;
+}
+
+static struct nvc_imager_cap ov9772_cap = {
+       .identifier             = "OV9772",
+       /* refer to NvOdmImagerSensorInterface enum in ODM nvodm_imager.h */
+       .sensor_nvc_interface   = NVC_IMAGER_SENSOR_INTERFACE_SERIAL_C,
+       /* refer to NvOdmImagerPixelType enum in ODM nvodm_imager.h */
+       .pixel_types[0]         = 0x103,
+       /* refer to NvOdmImagerOrientation enum in ODM nvodm_imager.h */
+       .orientation            = 0,
+       /* refer to NvOdmImagerDirection enum in ODM nvodm_imager.h */
+       .direction              = 0,
+       .initial_clock_rate_khz = 6000,
+       .clock_profiles[0] = {
+               .external_clock_khz     = 24000,
+               .clock_multiplier       = 1162020, /* value / 1,000,000 */
+       },
+       .clock_profiles[1] = {
+               .external_clock_khz     = 0,
+               .clock_multiplier       = 0,
+       },
+       .h_sync_edge            = 0,
+       .v_sync_edge            = 0,
+       .mclk_on_vgp0           = 0,
+       .csi_port               = 1,
+       .data_lanes             = 1,
+       .virtual_channel_id     = 0,
+       .discontinuous_clk_mode = 0, /* use continuous clock */
+       .cil_threshold_settle   = 0xc,
+       .min_blank_time_width   = 16,
+       .min_blank_time_height  = 16,
+       .preferred_mode_index   = 0,
+       .focuser_guid           = 0,
+       .torch_guid             = 0,
+       .cap_version            = NVC_IMAGER_CAPABILITIES_VERSION2,
+};
+
+static struct ov9772_platform_data bonaire_ov9772_data = {
+       .num                    = 1,
+       .sync                   = 0,
+       .dev_name               = "camera",
+       .gpio_count             = 0,
+       .gpio                   = 0,
+       .cap                    = &ov9772_cap,
+       .power_on               = bonaire_ov9772_power_on,
+       .power_off              = bonaire_ov9772_power_off,
+};
+
+
+static struct i2c_board_info bonaire_i2c_board_info[] = {
+       {
+               I2C_BOARD_INFO("imx091", 0x36),
+               .platform_data = &bonaire_imx091_data,
+       },
+       {
+               I2C_BOARD_INFO("ov9772", 0x10),
+               .platform_data = &bonaire_ov9772_data,
+       },
+};
+
+int __init bonaire_sensors_init(void)
+{
+       i2c_register_board_info(4, bonaire_i2c_board_info,
+               ARRAY_SIZE(bonaire_i2c_board_info));
+       return 0;
+}
index 879e18f..c9313be 100644 (file)
@@ -609,6 +609,7 @@ static void __init tegra_bonaire_init(void)
        bonaire_touch_init();
        bonaire_usb_init();
        bonaire_panel_init();
+       bonaire_sensors_init();
        bonaire_bt_rfkill();
        bonaire_pcie_init();
        tegra_register_fuse();