msm: camera: Convert CSIPHY into platform device
Make CSIPHY 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: Ie7cb68fb0ef41735c07ee2001b75cb6c139a3eb4
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 3636963..41f8879 100644
--- a/arch/arm/mach-msm/board-msm8960.c
+++ b/arch/arm/mach-msm/board-msm8960.c
@@ -1419,6 +1419,9 @@
msm_get_cam_resources(s_info);
platform_device_register(cam_dev[i]);
}
+
+ platform_device_register(&msm8960_device_csiphy0);
+ platform_device_register(&msm8960_device_csiphy1);
}
#endif
diff --git a/arch/arm/mach-msm/clock-8960.c b/arch/arm/mach-msm/clock-8960.c
index 60ddc52..5cc2d1b 100644
--- a/arch/arm/mach-msm/clock-8960.c
+++ b/arch/arm/mach-msm/clock-8960.c
@@ -5396,9 +5396,12 @@
CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_camera_ov2720.0"),
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", csiphy_timer_src_clk.c, NULL),
- CLK_LOOKUP("csi0phy_timer_clk", csi0phy_timer_clk.c, NULL),
- CLK_LOOKUP("csi1phy_timer_clk", csi1phy_timer_clk.c, NULL),
+ 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_clk", csi0phy_timer_clk.c, "msm_csiphy.0"),
+ CLK_LOOKUP("csiphy_timer_clk", csi1phy_timer_clk.c, "msm_csiphy.1"),
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),
diff --git a/arch/arm/mach-msm/devices-8960.c b/arch/arm/mach-msm/devices-8960.c
index 5d0a13c..d9bf7db 100644
--- a/arch/arm/mach-msm/devices-8960.c
+++ b/arch/arm/mach-msm/devices-8960.c
@@ -1035,18 +1035,6 @@
.flags = IORESOURCE_IRQ,
},
{
- .name = "csiphy0",
- .start = 0x04800C00,
- .end = 0x04800C00 + SZ_1K - 1,
- .flags = IORESOURCE_MEM,
- },
- {
- .name = "csiphy0",
- .start = CSIPHY_4LN_IRQ,
- .end = CSIPHY_4LN_IRQ,
- .flags = IORESOURCE_IRQ,
- },
- {
.name = "csid1",
.start = 0x04800400,
.end = 0x04800400 + SZ_1K - 1,
@@ -1059,18 +1047,6 @@
.flags = IORESOURCE_IRQ,
},
{
- .name = "csiphy1",
- .start = 0x04801000,
- .end = 0x04801000 + SZ_1K - 1,
- .flags = IORESOURCE_MEM,
- },
- {
- .name = "csiphy1",
- .start = MSM8960_CSIPHY_2LN_IRQ,
- .end = MSM8960_CSIPHY_2LN_IRQ,
- .flags = IORESOURCE_IRQ,
- },
- {
.name = "s3d_rw",
.start = 0x008003E0,
.end = 0x008003E0 + SZ_16 - 1,
@@ -1091,6 +1067,50 @@
s_info->num_resources = ARRAY_SIZE(msm_camera_resources);
return 0;
}
+
+static struct resource msm_csiphy0_resources[] = {
+ {
+ .name = "csiphy",
+ .start = 0x04800C00,
+ .end = 0x04800C00 + SZ_1K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .name = "csiphy",
+ .start = CSIPHY_4LN_IRQ,
+ .end = CSIPHY_4LN_IRQ,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct resource msm_csiphy1_resources[] = {
+ {
+ .name = "csiphy",
+ .start = 0x04801000,
+ .end = 0x04801000 + SZ_1K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .name = "csiphy",
+ .start = MSM8960_CSIPHY_2LN_IRQ,
+ .end = MSM8960_CSIPHY_2LN_IRQ,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device msm8960_device_csiphy0 = {
+ .name = "msm_csiphy",
+ .id = 0,
+ .resource = msm_csiphy0_resources,
+ .num_resources = ARRAY_SIZE(msm_csiphy0_resources),
+};
+
+struct platform_device msm8960_device_csiphy1 = {
+ .name = "msm_csiphy",
+ .id = 1,
+ .resource = msm_csiphy1_resources,
+ .num_resources = ARRAY_SIZE(msm_csiphy1_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 4af3e68..b706fcd 100644
--- a/arch/arm/mach-msm/devices.h
+++ b/arch/arm/mach-msm/devices.h
@@ -58,6 +58,8 @@
extern struct platform_device msm8960_device_qup_i2c_gsbi12;
extern struct platform_device msm8960_device_qup_spi_gsbi1;
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 apq8064_device_uart_gsbi1;
extern struct platform_device apq8064_device_uart_gsbi3;