msm: camera: Convert CSID into platform device
Make CSID platform devices as well as
v4l2 sub-devices. They are created at system boot-up,
and registered during camera open.
The subdevices are decoupled from the v4l2 devices by
using device model APIs to find and register them.
Change-Id: Icdb7d878456e749500b3e7a9e183997dba651cfd
Signed-off-by: Kevin Chan <ktchan@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-msm8960.c b/arch/arm/mach-msm/board-msm8960.c
index 537605b..507bc32 100644
--- a/arch/arm/mach-msm/board-msm8960.c
+++ b/arch/arm/mach-msm/board-msm8960.c
@@ -1422,6 +1422,8 @@
platform_device_register(&msm8960_device_csiphy0);
platform_device_register(&msm8960_device_csiphy1);
+ platform_device_register(&msm8960_device_csid0);
+ platform_device_register(&msm8960_device_csid1);
}
#endif
diff --git a/arch/arm/mach-msm/clock-8960.c b/arch/arm/mach-msm/clock-8960.c
index 5cc2d1b..52d8f63 100644
--- a/arch/arm/mach-msm/clock-8960.c
+++ b/arch/arm/mach-msm/clock-8960.c
@@ -5379,21 +5379,12 @@
CLK_LOOKUP("cam_clk", cam0_clk.c, "msm_camera_imx074.0"),
CLK_LOOKUP("cam_clk", cam0_clk.c, "msm_camera_ov2720.0"),
CLK_LOOKUP("cam_clk", cam0_clk.c, "msm_camera_qs_mt9p017.0"),
- CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, NULL),
- CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, NULL),
- CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_camera_imx074.0"),
- CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_camera_qs_mt9p017.0"),
- CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_camera_ov2720.0"),
- CLK_LOOKUP("csi_clk", csi0_clk.c, NULL),
- CLK_LOOKUP("csi_clk", csi1_clk.c, NULL),
- CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_camera_imx074.0"),
- CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_camera_qs_mt9p017.0"),
- CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_camera_ov2720.0"),
- CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, NULL),
- CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, NULL),
- CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_camera_imx074.0"),
- CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_camera_qs_mt9p017.0"),
- CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_camera_ov2720.0"),
+ 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_clk", csi0_clk.c, "msm_csid.0"),
+ CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_csid.1"),
+ 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_pix_clk", csi_pix_clk.c, NULL),
CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, NULL),
CLK_LOOKUP("csiphy_timer_src_clk",
@@ -5450,7 +5441,8 @@
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, NULL),
+ CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.0"),
+ CLK_LOOKUP("csi_pclk", csi_p_clk.c, "msm_csid.1"),
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),
diff --git a/arch/arm/mach-msm/devices-8960.c b/arch/arm/mach-msm/devices-8960.c
index c5eee63..1b314f2 100644
--- a/arch/arm/mach-msm/devices-8960.c
+++ b/arch/arm/mach-msm/devices-8960.c
@@ -1023,30 +1023,6 @@
.flags = IORESOURCE_IRQ,
},
{
- .name = "csid0",
- .start = 0x04800000,
- .end = 0x04800000 + SZ_1K - 1,
- .flags = IORESOURCE_MEM,
- },
- {
- .name = "csid0",
- .start = CSI_0_IRQ,
- .end = CSI_0_IRQ,
- .flags = IORESOURCE_IRQ,
- },
- {
- .name = "csid1",
- .start = 0x04800400,
- .end = 0x04800400 + SZ_1K - 1,
- .flags = IORESOURCE_MEM,
- },
- {
- .name = "csid1",
- .start = CSI_1_IRQ,
- .end = CSI_1_IRQ,
- .flags = IORESOURCE_IRQ,
- },
- {
.name = "s3d_rw",
.start = 0x008003E0,
.end = 0x008003E0 + SZ_16 - 1,
@@ -1058,7 +1034,6 @@
.end = 0x008020B8 + SZ_16 - 1,
.flags = IORESOURCE_MEM,
},
-
};
int __init msm_get_cam_resources(struct msm_camera_sensor_info *s_info)
@@ -1111,6 +1086,50 @@
.resource = msm_csiphy1_resources,
.num_resources = ARRAY_SIZE(msm_csiphy1_resources),
};
+
+static struct resource msm_csid0_resources[] = {
+ {
+ .name = "csid",
+ .start = 0x04800000,
+ .end = 0x04800000 + SZ_1K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .name = "csid",
+ .start = CSI_0_IRQ,
+ .end = CSI_0_IRQ,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct resource msm_csid1_resources[] = {
+ {
+ .name = "csid",
+ .start = 0x04800400,
+ .end = 0x04800400 + SZ_1K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .name = "csid",
+ .start = CSI_1_IRQ,
+ .end = CSI_1_IRQ,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device msm8960_device_csid0 = {
+ .name = "msm_csid",
+ .id = 0,
+ .resource = msm_csid0_resources,
+ .num_resources = ARRAY_SIZE(msm_csid0_resources),
+};
+
+struct platform_device msm8960_device_csid1 = {
+ .name = "msm_csid",
+ .id = 1,
+ .resource = msm_csid1_resources,
+ .num_resources = ARRAY_SIZE(msm_csid1_resources),
+};
#endif
static struct resource resources_ssbi_pm8921[] = {
diff --git a/arch/arm/mach-msm/devices.h b/arch/arm/mach-msm/devices.h
index 7196224..fbbcd70 100644
--- a/arch/arm/mach-msm/devices.h
+++ b/arch/arm/mach-msm/devices.h
@@ -60,6 +60,8 @@
extern struct platform_device msm8960_gemini_device;
extern struct platform_device msm8960_device_csiphy0;
extern struct platform_device msm8960_device_csiphy1;
+extern struct platform_device msm8960_device_csid0;
+extern struct platform_device msm8960_device_csid1;
extern struct platform_device apq8064_device_uart_gsbi1;
extern struct platform_device apq8064_device_uart_gsbi3;