msm: camera: Enable camera on 8064
Camera requires a platform device as well as
i2c, clock, and gpio configuration information,
so these must be added for 8064 if camera
is to be supported on that target.
Also added i2c_mux configuration for 2D camera,
to initialize i2c mux controller on 8064.
Change-Id: I680c277b6631af85448a49ae6a04c4b40297e370
Signed-off-by: Kevin Chan <ktchan@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-8064-camera.c b/arch/arm/mach-msm/board-8064-camera.c
index cd84722..109ed2c 100644
--- a/arch/arm/mach-msm/board-8064-camera.c
+++ b/arch/arm/mach-msm/board-8064-camera.c
@@ -41,8 +41,8 @@
},
{
- .func = GPIOMUX_FUNC_1, /*active 3*/
- .drv = GPIOMUX_DRV_8MA,
+ .func = GPIOMUX_FUNC_2, /*active 3*/
+ .drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_NONE,
},
@@ -76,6 +76,27 @@
.pull = GPIOMUX_PULL_KEEPER,
},
+ {
+ .func = GPIOMUX_FUNC_9, /*active 9*/
+ .drv = GPIOMUX_DRV_8MA,
+ .pull = GPIOMUX_PULL_NONE,
+ },
+ {
+ .func = GPIOMUX_FUNC_A, /*active 10*/
+ .drv = GPIOMUX_DRV_8MA,
+ .pull = GPIOMUX_PULL_NONE,
+ },
+ {
+ .func = GPIOMUX_FUNC_6, /*active 11*/
+ .drv = GPIOMUX_DRV_8MA,
+ .pull = GPIOMUX_PULL_NONE,
+ },
+ {
+ .func = GPIOMUX_FUNC_4, /*active 12*/
+ .drv = GPIOMUX_DRV_2MA,
+ .pull = GPIOMUX_PULL_NONE,
+ },
+
};
@@ -83,7 +104,7 @@
{
.gpio = 2,
.settings = {
- [GPIOMUX_ACTIVE] = &cam_settings[2],
+ [GPIOMUX_ACTIVE] = &cam_settings[12],
[GPIOMUX_SUSPENDED] = &cam_settings[0],
},
},
@@ -97,7 +118,7 @@
{
.gpio = 4,
.settings = {
- [GPIOMUX_ACTIVE] = &cam_settings[1],
+ [GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &cam_settings[0],
},
},
@@ -109,7 +130,7 @@
},
},
{
- .gpio = 76,
+ .gpio = 34,
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[2],
[GPIOMUX_SUSPENDED] = &cam_settings[0],
@@ -122,39 +143,39 @@
[GPIOMUX_SUSPENDED] = &cam_settings[0],
},
},
-};
-
-static struct msm_gpiomux_config apq8064_cam_2d_configs[] = {
{
.gpio = 10,
.settings = {
- [GPIOMUX_ACTIVE] = &cam_settings[3],
+ [GPIOMUX_ACTIVE] = &cam_settings[9],
[GPIOMUX_SUSPENDED] = &cam_settings[8],
},
},
{
.gpio = 11,
.settings = {
- [GPIOMUX_ACTIVE] = &cam_settings[3],
+ [GPIOMUX_ACTIVE] = &cam_settings[10],
[GPIOMUX_SUSPENDED] = &cam_settings[8],
},
},
{
.gpio = 12,
.settings = {
- [GPIOMUX_ACTIVE] = &cam_settings[3],
+ [GPIOMUX_ACTIVE] = &cam_settings[11],
[GPIOMUX_SUSPENDED] = &cam_settings[8],
},
},
{
.gpio = 13,
.settings = {
- [GPIOMUX_ACTIVE] = &cam_settings[3],
+ [GPIOMUX_ACTIVE] = &cam_settings[11],
[GPIOMUX_SUSPENDED] = &cam_settings[8],
},
},
};
+static struct msm_gpiomux_config apq8064_cam_2d_configs[] = {
+};
+
#ifdef CONFIG_MSM_CAMERA
static struct msm_bus_vectors cam_init_vectors[] = {
@@ -310,27 +331,36 @@
},
};
-static struct camera_vreg_t msm_8064_back_cam_vreg[] = {
+static struct camera_vreg_t apq_8064_back_cam_vreg[] = {
{"mipi_csi_vdd", REG_LDO, 1200000, 1200000, 20000},
{"cam_vana", REG_LDO, 2800000, 2850000, 85600},
- {"cam_vio", REG_LDO, 1800000, 1800000, 16000},
+ {"cam_vio", REG_VS, 0, 0, 0},
{"cam_vdig", REG_LDO, 1200000, 1200000, 105000},
{"cam_vaf", REG_LDO, 2800000, 2850000, 300000},
};
+static struct camera_vreg_t apq_8064_front_cam_vreg[] = {
+ {"mipi_csi_vdd", REG_LDO, 1200000, 1200000, 20000},
+ {"cam_vana", REG_LDO, 2800000, 2850000, 85600},
+ {"cam_vio", REG_VS, 0, 0, 0},
+ {"cam_vdig", REG_LDO, 1200000, 1200000, 105000},
+ {"cam_vaf", REG_LDO, 2800000, 2850000, 300000},
+};
+
+#define CAML_RSTN PM8921_GPIO_PM_TO_SYS(28)
+#define CAMR_RSTN 34
+
static struct gpio apq8064_common_cam_gpio[] = {
- {5, GPIOF_DIR_IN, "CAMIF_MCLK"},
- {20, GPIOF_DIR_IN, "CAMIF_I2C_DATA"},
- {21, GPIOF_DIR_IN, "CAMIF_I2C_CLK"},
};
static struct gpio apq8064_back_cam_gpio[] = {
- {107, GPIOF_DIR_OUT, "CAM_RESET"},
+ {5, GPIOF_DIR_IN, "CAMIF_MCLK"},
+ {CAML_RSTN, GPIOF_DIR_OUT, "CAM_RESET"},
};
static struct msm_gpio_set_tbl apq8064_back_cam_gpio_set_tbl[] = {
- {107, GPIOF_OUT_INIT_LOW, 1000},
- {107, GPIOF_OUT_INIT_HIGH, 4000},
+ {CAML_RSTN, GPIOF_OUT_INIT_LOW, 10000},
+ {CAML_RSTN, GPIOF_OUT_INIT_HIGH, 10000},
};
static struct msm_camera_gpio_conf apq8064_back_cam_gpio_conf = {
@@ -344,6 +374,41 @@
.cam_gpio_set_tbl_size = ARRAY_SIZE(apq8064_back_cam_gpio_set_tbl),
};
+static struct gpio apq8064_front_cam_gpio[] = {
+ {4, GPIOF_DIR_IN, "CAMIF_MCLK"},
+ {12, GPIOF_DIR_IN, "CAMIF_I2C_DATA"},
+ {13, GPIOF_DIR_IN, "CAMIF_I2C_CLK"},
+ {CAMR_RSTN, GPIOF_DIR_OUT, "CAM_RESET"},
+};
+
+static struct msm_gpio_set_tbl apq8064_front_cam_gpio_set_tbl[] = {
+ {CAMR_RSTN, GPIOF_OUT_INIT_LOW, 10000},
+ {CAMR_RSTN, GPIOF_OUT_INIT_HIGH, 10000},
+};
+
+static struct msm_camera_gpio_conf apq8064_front_cam_gpio_conf = {
+ .cam_gpiomux_conf_tbl = apq8064_cam_2d_configs,
+ .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(apq8064_cam_2d_configs),
+ .cam_gpio_common_tbl = apq8064_common_cam_gpio,
+ .cam_gpio_common_tbl_size = ARRAY_SIZE(apq8064_common_cam_gpio),
+ .cam_gpio_req_tbl = apq8064_front_cam_gpio,
+ .cam_gpio_req_tbl_size = ARRAY_SIZE(apq8064_front_cam_gpio),
+ .cam_gpio_set_tbl = apq8064_front_cam_gpio_set_tbl,
+ .cam_gpio_set_tbl_size = ARRAY_SIZE(apq8064_front_cam_gpio_set_tbl),
+};
+
+static struct msm_camera_i2c_conf apq8064_back_cam_i2c_conf = {
+ .use_i2c_mux = 1,
+ .mux_dev = &msm8960_device_i2c_mux_gsbi4,
+ .i2c_mux_mode = MODE_L,
+};
+
+static struct msm_camera_i2c_conf apq8064_front_cam_i2c_conf = {
+ .use_i2c_mux = 1,
+ .mux_dev = &msm8960_device_i2c_mux_gsbi4,
+ .i2c_mux_mode = MODE_L,
+};
+
#ifdef CONFIG_IMX074
static struct msm_camera_sensor_flash_data flash_imx074 = {
.flash_type = MSM_CAMERA_FLASH_NONE,
@@ -351,9 +416,10 @@
static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
.mount_angle = 90,
- .cam_vreg = msm_8064_back_cam_vreg,
- .num_vreg = ARRAY_SIZE(msm_8064_back_cam_vreg),
+ .cam_vreg = apq_8064_back_cam_vreg,
+ .num_vreg = ARRAY_SIZE(apq_8064_back_cam_vreg),
.gpio_conf = &apq8064_back_cam_gpio_conf,
+ .i2c_conf = &apq8064_back_cam_i2c_conf,
};
static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
@@ -366,11 +432,36 @@
};
#endif
+#ifdef CONFIG_OV2720
+static struct msm_camera_sensor_flash_data flash_ov2720 = {
+ .flash_type = MSM_CAMERA_FLASH_NONE,
+};
+
+static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
+ .mount_angle = 0,
+ .cam_vreg = apq_8064_front_cam_vreg,
+ .num_vreg = ARRAY_SIZE(apq_8064_front_cam_vreg),
+ .gpio_conf = &apq8064_front_cam_gpio_conf,
+ .i2c_conf = &apq8064_front_cam_i2c_conf,
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
+ .sensor_name = "ov2720",
+ .pdata = &msm_camera_csi_device_data[1],
+ .flash_data = &flash_ov2720,
+ .sensor_platform_info = &sensor_board_info_ov2720,
+ .csi_if = 1,
+ .camera_type = FRONT_CAMERA_2D,
+};
+#endif
+
+
void __init apq8064_init_cam(void)
{
msm_gpiomux_install(apq8064_cam_common_configs,
ARRAY_SIZE(apq8064_cam_common_configs));
+ platform_device_register(&msm8960_device_i2c_mux_gsbi4);
platform_device_register(&msm8960_device_csiphy0);
platform_device_register(&msm8960_device_csiphy1);
platform_device_register(&msm8960_device_csid0);
@@ -388,6 +479,12 @@
.platform_data = &msm_camera_sensor_imx074_data,
},
#endif
+#ifdef CONFIG_OV2720
+ {
+ I2C_BOARD_INFO("ov2720", 0x6C),
+ .platform_data = &msm_camera_sensor_ov2720_data,
+ },
+#endif
};
struct msm_camera_board_info apq8064_camera_board_info = {
diff --git a/arch/arm/mach-msm/board-8064.c b/arch/arm/mach-msm/board-8064.c
index 0cb8c9e..2c8f147 100644
--- a/arch/arm/mach-msm/board-8064.c
+++ b/arch/arm/mach-msm/board-8064.c
@@ -1576,6 +1576,14 @@
u8 mach_mask = 0;
int i;
+#ifdef CONFIG_MSM_CAMERA
+ struct i2c_registry apq8064_camera_i2c_devices = {
+ I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
+ APQ_8064_GSBI4_QUP_I2C_BUS_ID,
+ apq8064_camera_board_info.board_info,
+ apq8064_camera_board_info.num_i2c_board_info,
+ };
+#endif
/* Build the matching 'supported_machs' bitmask */
if (machine_is_apq8064_cdp())
mach_mask = I2C_SURF;
@@ -1597,6 +1605,12 @@
apq8064_i2c_devices[i].info,
apq8064_i2c_devices[i].len);
}
+#ifdef CONFIG_MSM_CAMERA
+ if (apq8064_camera_i2c_devices.machs & mach_mask)
+ i2c_register_board_info(apq8064_camera_i2c_devices.bus,
+ apq8064_camera_i2c_devices.info,
+ apq8064_camera_i2c_devices.len);
+#endif
}
static void __init apq8064_common_init(void)
@@ -1679,6 +1693,7 @@
apq8064_init_gpu();
platform_add_devices(msm_footswitch_devices,
msm_num_footswitch_devices);
+ apq8064_init_cam();
}
MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
diff --git a/arch/arm/mach-msm/clock-8960.c b/arch/arm/mach-msm/clock-8960.c
index 3cfe411..aca582e 100644
--- a/arch/arm/mach-msm/clock-8960.c
+++ b/arch/arm/mach-msm/clock-8960.c
@@ -4925,7 +4925,7 @@
CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, ""),
CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, ""),
CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"),
- CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, ""),
+ CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"),
CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, "spi_qsd.0"),
CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, ""),
CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, ""),
@@ -4958,7 +4958,7 @@
CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "msm_serial_hsl.1"),
CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, ""),
CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"),
- CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, ""),
+ CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"),
CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "spi_qsd.0"),
CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, ""),
CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, "msm_serial_hsl.0"),
@@ -4979,32 +4979,31 @@
CLK_LOOKUP("core_clk", pmic_ssbi2_clk.c, ""),
CLK_LOOKUP("mem_clk", rpm_msg_ram_p_clk.c, ""),
CLK_LOOKUP("core_clk", amp_clk.c, ""),
- CLK_LOOKUP("cam_clk", cam0_clk.c, ""),
- CLK_LOOKUP("cam_clk", cam1_clk.c, ""),
- CLK_LOOKUP("cam_clk", cam0_clk.c, ""),
- CLK_LOOKUP("cam_clk", cam0_clk.c, ""),
- CLK_LOOKUP("cam_clk", cam0_clk.c, ""),
- CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, ""),
- CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, ""),
- CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, ""),
- CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, ""),
- CLK_LOOKUP("csi_clk", csi0_clk.c, ""),
- CLK_LOOKUP("csi_clk", csi1_clk.c, ""),
- CLK_LOOKUP("csi_clk", csi1_clk.c, ""),
- CLK_LOOKUP("csi_clk", csi2_clk.c, ""),
- CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, ""),
- CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, ""),
- CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, ""),
- CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, ""),
- CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, ""),
- CLK_LOOKUP("csi_pix_clk", csi_pix1_clk.c, ""),
- CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, ""),
- CLK_LOOKUP("csi_rdi_clk", csi_rdi1_clk.c, ""),
- CLK_LOOKUP("csi_rdi_clk", csi_rdi2_clk.c, ""),
- CLK_LOOKUP("csiphy_timer_src_clk", csiphy_timer_src_clk.c, ""),
- CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, ""),
- CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, ""),
- CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, ""),
+ CLK_LOOKUP("cam_clk", cam0_clk.c, "4-001a"),
+ CLK_LOOKUP("cam_clk", cam1_clk.c, "4-006c"),
+ CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_csid.0"),
+ CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_csid.1"),
+ CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, "msm_csid.2"),
+ CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_csid.0"),
+ CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
+ CLK_LOOKUP("csi_clk", csi2_clk.c, "msm_csid.2"),
+ CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_csid.0"),
+ CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_csid.1"),
+ CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, "msm_csid.2"),
+ CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, "msm_ispif.0"),
+ CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, "msm_ispif.0"),
+ CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, "msm_ispif.0"),
+ CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, "msm_ispif.0"),
+ CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, "msm_ispif.0"),
+ CLK_LOOKUP("csiphy_timer_src_clk",
+ csiphy_timer_src_clk.c, "msm_csiphy.0"),
+ CLK_LOOKUP("csiphy_timer_src_clk",
+ csiphy_timer_src_clk.c, "msm_csiphy.1"),
+ CLK_LOOKUP("csiphy_timer_src_clk",
+ csiphy_timer_src_clk.c, "msm_csiphy.2"),
+ CLK_LOOKUP("csiphy_timer_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
+ CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
+ CLK_LOOKUP("csiphy_timer_clk", csi2phy_timer_clk.c, "msm_csiphy.2"),
CLK_LOOKUP("dsi_byte_div_clk", dsi1_byte_clk.c, NULL),
CLK_LOOKUP("dsi_byte_div_clk", dsi2_byte_clk.c, NULL),
CLK_LOOKUP("dsi_esc_clk", dsi1_esc_clk.c, NULL),
@@ -5044,9 +5043,9 @@
CLK_LOOKUP("core_clk", hdmi_app_clk.c, ""),
CLK_LOOKUP("vpe_clk", vpe_clk.c, ""),
CLK_LOOKUP("core_clk", vpe_clk.c, "footswitch-8x60.9"),
- CLK_LOOKUP("vfe_clk", vfe_clk.c, ""),
+ CLK_LOOKUP("vfe_clk", vfe_clk.c, "msm_vfe.0"),
CLK_LOOKUP("core_clk", vfe_clk.c, "footswitch-8x60.8"),
- CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, ""),
+ CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, "msm_vfe.0"),
CLK_LOOKUP("bus_clk", vfe_axi_clk.c, "footswitch-8x60.8"),
CLK_LOOKUP("bus_clk", mdp_axi_clk.c, "footswitch-8x60.4"),
CLK_LOOKUP("bus_clk", rot_axi_clk.c, "footswitch-8x60.6"),
@@ -5055,7 +5054,9 @@
CLK_LOOKUP("bus_b_clk", vcodec_axi_b_clk.c, "footswitch-8x60.7"),
CLK_LOOKUP("bus_clk", vpe_axi_clk.c, "footswitch-8x60.9"),
CLK_LOOKUP("amp_pclk", amp_p_clk.c, NULL),
- CLK_LOOKUP("csi_pclk", csi_p_clk.c, ""),
+ CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
+ CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
+ CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.2"),
CLK_LOOKUP("dsi_m_pclk", dsi1_m_p_clk.c, NULL),
CLK_LOOKUP("dsi_s_pclk", dsi1_s_p_clk.c, NULL),
CLK_LOOKUP("dsi_m_pclk", dsi2_m_p_clk.c, NULL),
@@ -5075,7 +5076,7 @@
CLK_LOOKUP("iface_clk", rot_p_clk.c, "footswitch-8x60.6"),
CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "msm_vidc.0"),
CLK_LOOKUP("iface_clk", vcodec_p_clk.c, "footswitch-8x60.7"),
- CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, ""),
+ CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, "msm_vfe.0"),
CLK_LOOKUP("iface_clk", vfe_p_clk.c, "footswitch-8x60.8"),
CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, ""),
CLK_LOOKUP("iface_pclk", vpe_p_clk.c, "footswitch-8x60.9"),
diff --git a/arch/arm/mach-msm/devices-8064.c b/arch/arm/mach-msm/devices-8064.c
index 7915b5f..cab4b25 100644
--- a/arch/arm/mach-msm/devices-8064.c
+++ b/arch/arm/mach-msm/devices-8064.c
@@ -221,6 +221,18 @@
.end = GSBI4_QUP_IRQ,
.flags = IORESOURCE_IRQ,
},
+ {
+ .name = "i2c_clk",
+ .start = 11,
+ .end = 11,
+ .flags = IORESOURCE_IO,
+ },
+ {
+ .name = "i2c_sda",
+ .start = 10,
+ .end = 10,
+ .flags = IORESOURCE_IO,
+ },
};
struct platform_device apq8064_device_qup_i2c_gsbi4 = {