aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2012-09-16 04:26:20 -0400
committerShawn Guo <shawn.guo@linaro.org>2012-10-14 22:05:41 -0400
commit27b76486a3e5be1cfd19dc59452e4185c5d43dff (patch)
tree7751490f66c7f52dc3f7e516d1fcd1b7f7076102
parente51d0f0ac4b7f513808743c6a62f0387eebd0144 (diff)
media: mx2_camera: remove cpu_is_xxx by using platform_device_id
It changes the driver to use platform_device_id rather than cpu_is_xxx to determine the controller type, and updates the platform code accordingly. As the result, mach/hardware.h inclusion gets removed from the driver. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Tested-by: Javier Martin <javier.martin@vista-silicon.com> Cc: linux-media@vger.kernel.org
-rw-r--r--arch/arm/mach-imx/clk-imx25.c6
-rw-r--r--arch/arm/mach-imx/clk-imx27.c6
-rw-r--r--arch/arm/mach-imx/devices/devices-common.h1
-rw-r--r--arch/arm/mach-imx/devices/platform-mx2-camera.c12
-rw-r--r--drivers/media/platform/soc_camera/mx2_camera.c95
5 files changed, 85 insertions, 35 deletions
diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c
index f0f82f204de7..2add1ea22d44 100644
--- a/arch/arm/mach-imx/clk-imx25.c
+++ b/arch/arm/mach-imx/clk-imx25.c
@@ -231,9 +231,9 @@ int __init mx25_clocks_init(void)
231 clk_register_clkdev(clk[esdhc2_ipg_per], "per", "sdhci-esdhc-imx25.1"); 231 clk_register_clkdev(clk[esdhc2_ipg_per], "per", "sdhci-esdhc-imx25.1");
232 clk_register_clkdev(clk[esdhc2_ipg], "ipg", "sdhci-esdhc-imx25.1"); 232 clk_register_clkdev(clk[esdhc2_ipg], "ipg", "sdhci-esdhc-imx25.1");
233 clk_register_clkdev(clk[esdhc2_ahb], "ahb", "sdhci-esdhc-imx25.1"); 233 clk_register_clkdev(clk[esdhc2_ahb], "ahb", "sdhci-esdhc-imx25.1");
234 clk_register_clkdev(clk[csi_ipg_per], "per", "mx2-camera.0"); 234 clk_register_clkdev(clk[csi_ipg_per], "per", "imx25-camera.0");
235 clk_register_clkdev(clk[csi_ipg], "ipg", "mx2-camera.0"); 235 clk_register_clkdev(clk[csi_ipg], "ipg", "imx25-camera.0");
236 clk_register_clkdev(clk[csi_ahb], "ahb", "mx2-camera.0"); 236 clk_register_clkdev(clk[csi_ahb], "ahb", "imx25-camera.0");
237 clk_register_clkdev(clk[dummy], "audmux", NULL); 237 clk_register_clkdev(clk[dummy], "audmux", NULL);
238 clk_register_clkdev(clk[can1_ipg], NULL, "flexcan.0"); 238 clk_register_clkdev(clk[can1_ipg], NULL, "flexcan.0");
239 clk_register_clkdev(clk[can2_ipg], NULL, "flexcan.1"); 239 clk_register_clkdev(clk[can2_ipg], NULL, "flexcan.1");
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index a5f0e3b6dec6..6170c03d4905 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -224,7 +224,7 @@ int __init mx27_clocks_init(unsigned long fref)
224 clk_register_clkdev(clk[per3_gate], "per", "imx-fb.0"); 224 clk_register_clkdev(clk[per3_gate], "per", "imx-fb.0");
225 clk_register_clkdev(clk[lcdc_ipg_gate], "ipg", "imx-fb.0"); 225 clk_register_clkdev(clk[lcdc_ipg_gate], "ipg", "imx-fb.0");
226 clk_register_clkdev(clk[lcdc_ahb_gate], "ahb", "imx-fb.0"); 226 clk_register_clkdev(clk[lcdc_ahb_gate], "ahb", "imx-fb.0");
227 clk_register_clkdev(clk[csi_ahb_gate], "ahb", "mx2-camera.0"); 227 clk_register_clkdev(clk[csi_ahb_gate], "ahb", "imx27-camera.0");
228 clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc"); 228 clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc");
229 clk_register_clkdev(clk[usb_ipg_gate], "ipg", "fsl-usb2-udc"); 229 clk_register_clkdev(clk[usb_ipg_gate], "ipg", "fsl-usb2-udc");
230 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "fsl-usb2-udc"); 230 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "fsl-usb2-udc");
@@ -251,8 +251,8 @@ int __init mx27_clocks_init(unsigned long fref)
251 clk_register_clkdev(clk[i2c2_ipg_gate], NULL, "imx21-i2c.1"); 251 clk_register_clkdev(clk[i2c2_ipg_gate], NULL, "imx21-i2c.1");
252 clk_register_clkdev(clk[owire_ipg_gate], NULL, "mxc_w1.0"); 252 clk_register_clkdev(clk[owire_ipg_gate], NULL, "mxc_w1.0");
253 clk_register_clkdev(clk[kpp_ipg_gate], NULL, "imx-keypad"); 253 clk_register_clkdev(clk[kpp_ipg_gate], NULL, "imx-keypad");
254 clk_register_clkdev(clk[emma_ahb_gate], "emma-ahb", "mx2-camera.0"); 254 clk_register_clkdev(clk[emma_ahb_gate], "emma-ahb", "imx27-camera.0");
255 clk_register_clkdev(clk[emma_ipg_gate], "emma-ipg", "mx2-camera.0"); 255 clk_register_clkdev(clk[emma_ipg_gate], "emma-ipg", "imx27-camera.0");
256 clk_register_clkdev(clk[emma_ahb_gate], "ahb", "m2m-emmaprp.0"); 256 clk_register_clkdev(clk[emma_ahb_gate], "ahb", "m2m-emmaprp.0");
257 clk_register_clkdev(clk[emma_ipg_gate], "ipg", "m2m-emmaprp.0"); 257 clk_register_clkdev(clk[emma_ipg_gate], "ipg", "m2m-emmaprp.0");
258 clk_register_clkdev(clk[iim_ipg_gate], "iim", NULL); 258 clk_register_clkdev(clk[iim_ipg_gate], "iim", NULL);
diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h
index 36eb3f09f5d7..d213da9dfd93 100644
--- a/arch/arm/mach-imx/devices/devices-common.h
+++ b/arch/arm/mach-imx/devices/devices-common.h
@@ -220,6 +220,7 @@ struct platform_device *__init imx_add_mx1_camera(
220 220
221#include <linux/platform_data/camera-mx2.h> 221#include <linux/platform_data/camera-mx2.h>
222struct imx_mx2_camera_data { 222struct imx_mx2_camera_data {
223 const char *devid;
223 resource_size_t iobasecsi; 224 resource_size_t iobasecsi;
224 resource_size_t iosizecsi; 225 resource_size_t iosizecsi;
225 resource_size_t irqcsi; 226 resource_size_t irqcsi;
diff --git a/arch/arm/mach-imx/devices/platform-mx2-camera.c b/arch/arm/mach-imx/devices/platform-mx2-camera.c
index 9ad5b2d97054..b88877d54d7f 100644
--- a/arch/arm/mach-imx/devices/platform-mx2-camera.c
+++ b/arch/arm/mach-imx/devices/platform-mx2-camera.c
@@ -9,14 +9,16 @@
9#include <mach/hardware.h> 9#include <mach/hardware.h>
10#include "devices-common.h" 10#include "devices-common.h"
11 11
12#define imx_mx2_camera_data_entry_single(soc) \ 12#define imx_mx2_camera_data_entry_single(soc, _devid) \
13 { \ 13 { \
14 .devid = _devid, \
14 .iobasecsi = soc ## _CSI_BASE_ADDR, \ 15 .iobasecsi = soc ## _CSI_BASE_ADDR, \
15 .iosizecsi = SZ_4K, \ 16 .iosizecsi = SZ_4K, \
16 .irqcsi = soc ## _INT_CSI, \ 17 .irqcsi = soc ## _INT_CSI, \
17 } 18 }
18#define imx_mx2_camera_data_entry_single_emma(soc) \ 19#define imx_mx2_camera_data_entry_single_emma(soc, _devid) \
19 { \ 20 { \
21 .devid = _devid, \
20 .iobasecsi = soc ## _CSI_BASE_ADDR, \ 22 .iobasecsi = soc ## _CSI_BASE_ADDR, \
21 .iosizecsi = SZ_32, \ 23 .iosizecsi = SZ_32, \
22 .irqcsi = soc ## _INT_CSI, \ 24 .irqcsi = soc ## _INT_CSI, \
@@ -27,12 +29,12 @@
27 29
28#ifdef CONFIG_SOC_IMX25 30#ifdef CONFIG_SOC_IMX25
29const struct imx_mx2_camera_data imx25_mx2_camera_data __initconst = 31const struct imx_mx2_camera_data imx25_mx2_camera_data __initconst =
30 imx_mx2_camera_data_entry_single(MX25); 32 imx_mx2_camera_data_entry_single(MX25, "imx25-camera");
31#endif /* ifdef CONFIG_SOC_IMX25 */ 33#endif /* ifdef CONFIG_SOC_IMX25 */
32 34
33#ifdef CONFIG_SOC_IMX27 35#ifdef CONFIG_SOC_IMX27
34const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst = 36const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst =
35 imx_mx2_camera_data_entry_single_emma(MX27); 37 imx_mx2_camera_data_entry_single_emma(MX27, "imx27-camera");
36#endif /* ifdef CONFIG_SOC_IMX27 */ 38#endif /* ifdef CONFIG_SOC_IMX27 */
37 39
38struct platform_device *__init imx_add_mx2_camera( 40struct platform_device *__init imx_add_mx2_camera(
@@ -58,7 +60,7 @@ struct platform_device *__init imx_add_mx2_camera(
58 .flags = IORESOURCE_IRQ, 60 .flags = IORESOURCE_IRQ,
59 }, 61 },
60 }; 62 };
61 return imx_add_platform_device_dmamask("mx2-camera", 0, 63 return imx_add_platform_device_dmamask(data->devid, 0,
62 res, data->iobaseemmaprp ? 4 : 2, 64 res, data->iobaseemmaprp ? 4 : 2,
63 pdata, sizeof(*pdata), DMA_BIT_MASK(32)); 65 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
64} 66}
diff --git a/drivers/media/platform/soc_camera/mx2_camera.c b/drivers/media/platform/soc_camera/mx2_camera.c
index 9fd9d1c5b218..e575ae82771d 100644
--- a/drivers/media/platform/soc_camera/mx2_camera.c
+++ b/drivers/media/platform/soc_camera/mx2_camera.c
@@ -41,7 +41,6 @@
41#include <linux/videodev2.h> 41#include <linux/videodev2.h>
42 42
43#include <linux/platform_data/camera-mx2.h> 43#include <linux/platform_data/camera-mx2.h>
44#include <mach/hardware.h>
45 44
46#include <asm/dma.h> 45#include <asm/dma.h>
47 46
@@ -121,11 +120,13 @@
121 120
122#define CSICR1 0x00 121#define CSICR1 0x00
123#define CSICR2 0x04 122#define CSICR2 0x04
124#define CSISR (cpu_is_mx27() ? 0x08 : 0x18) 123#define CSISR_IMX25 0x18
124#define CSISR_IMX27 0x08
125#define CSISTATFIFO 0x0c 125#define CSISTATFIFO 0x0c
126#define CSIRFIFO 0x10 126#define CSIRFIFO 0x10
127#define CSIRXCNT 0x14 127#define CSIRXCNT 0x14
128#define CSICR3 (cpu_is_mx27() ? 0x1C : 0x08) 128#define CSICR3_IMX25 0x08
129#define CSICR3_IMX27 0x1c
129#define CSIDMASA_STATFIFO 0x20 130#define CSIDMASA_STATFIFO 0x20
130#define CSIDMATA_STATFIFO 0x24 131#define CSIDMATA_STATFIFO 0x24
131#define CSIDMASA_FB1 0x28 132#define CSIDMASA_FB1 0x28
@@ -268,6 +269,11 @@ struct mx2_buffer {
268 struct mx2_buf_internal internal; 269 struct mx2_buf_internal internal;
269}; 270};
270 271
272enum mx2_camera_type {
273 IMX25_CAMERA,
274 IMX27_CAMERA,
275};
276
271struct mx2_camera_dev { 277struct mx2_camera_dev {
272 struct device *dev; 278 struct device *dev;
273 struct soc_camera_host soc_host; 279 struct soc_camera_host soc_host;
@@ -291,6 +297,9 @@ struct mx2_camera_dev {
291 struct mx2_buffer *fb2_active; 297 struct mx2_buffer *fb2_active;
292 298
293 u32 csicr1; 299 u32 csicr1;
300 u32 reg_csisr;
301 u32 reg_csicr3;
302 enum mx2_camera_type devtype;
294 303
295 struct mx2_buf_internal buf_discard[2]; 304 struct mx2_buf_internal buf_discard[2];
296 void *discard_buffer; 305 void *discard_buffer;
@@ -303,6 +312,29 @@ struct mx2_camera_dev {
303 struct vb2_alloc_ctx *alloc_ctx; 312 struct vb2_alloc_ctx *alloc_ctx;
304}; 313};
305 314
315static struct platform_device_id mx2_camera_devtype[] = {
316 {
317 .name = "imx25-camera",
318 .driver_data = IMX25_CAMERA,
319 }, {
320 .name = "imx27-camera",
321 .driver_data = IMX27_CAMERA,
322 }, {
323 /* sentinel */
324 }
325};
326MODULE_DEVICE_TABLE(platform, mx2_camera_devtype);
327
328static inline int is_imx25_camera(struct mx2_camera_dev *pcdev)
329{
330 return pcdev->devtype == IMX25_CAMERA;
331}
332
333static inline int is_imx27_camera(struct mx2_camera_dev *pcdev)
334{
335 return pcdev->devtype == IMX27_CAMERA;
336}
337
306static struct mx2_buffer *mx2_ibuf_to_buf(struct mx2_buf_internal *int_buf) 338static struct mx2_buffer *mx2_ibuf_to_buf(struct mx2_buf_internal *int_buf)
307{ 339{
308 return container_of(int_buf, struct mx2_buffer, internal); 340 return container_of(int_buf, struct mx2_buffer, internal);
@@ -434,9 +466,9 @@ static void mx2_camera_deactivate(struct mx2_camera_dev *pcdev)
434 466
435 clk_disable_unprepare(pcdev->clk_csi); 467 clk_disable_unprepare(pcdev->clk_csi);
436 writel(0, pcdev->base_csi + CSICR1); 468 writel(0, pcdev->base_csi + CSICR1);
437 if (cpu_is_mx27()) { 469 if (is_imx27_camera(pcdev)) {
438 writel(0, pcdev->base_emma + PRP_CNTL); 470 writel(0, pcdev->base_emma + PRP_CNTL);
439 } else if (cpu_is_mx25()) { 471 } else if (is_imx25_camera(pcdev)) {
440 spin_lock_irqsave(&pcdev->lock, flags); 472 spin_lock_irqsave(&pcdev->lock, flags);
441 pcdev->fb1_active = NULL; 473 pcdev->fb1_active = NULL;
442 pcdev->fb2_active = NULL; 474 pcdev->fb2_active = NULL;
@@ -466,7 +498,7 @@ static int mx2_camera_add_device(struct soc_camera_device *icd)
466 498
467 csicr1 = CSICR1_MCLKEN; 499 csicr1 = CSICR1_MCLKEN;
468 500
469 if (cpu_is_mx27()) 501 if (is_imx27_camera(pcdev))
470 csicr1 |= CSICR1_PRP_IF_EN | CSICR1_FCC | 502 csicr1 |= CSICR1_PRP_IF_EN | CSICR1_FCC |
471 CSICR1_RXFF_LEVEL(0); 503 CSICR1_RXFF_LEVEL(0);
472 504
@@ -542,7 +574,7 @@ out:
542static irqreturn_t mx25_camera_irq(int irq_csi, void *data) 574static irqreturn_t mx25_camera_irq(int irq_csi, void *data)
543{ 575{
544 struct mx2_camera_dev *pcdev = data; 576 struct mx2_camera_dev *pcdev = data;
545 u32 status = readl(pcdev->base_csi + CSISR); 577 u32 status = readl(pcdev->base_csi + pcdev->reg_csisr);
546 578
547 if (status & CSISR_DMA_TSF_FB1_INT) 579 if (status & CSISR_DMA_TSF_FB1_INT)
548 mx25_camera_frame_done(pcdev, 1, MX2_STATE_DONE); 580 mx25_camera_frame_done(pcdev, 1, MX2_STATE_DONE);
@@ -551,7 +583,7 @@ static irqreturn_t mx25_camera_irq(int irq_csi, void *data)
551 583
552 /* FIXME: handle CSISR_RFF_OR_INT */ 584 /* FIXME: handle CSISR_RFF_OR_INT */
553 585
554 writel(status, pcdev->base_csi + CSISR); 586 writel(status, pcdev->base_csi + pcdev->reg_csisr);
555 587
556 return IRQ_HANDLED; 588 return IRQ_HANDLED;
557} 589}
@@ -636,7 +668,7 @@ static void mx2_videobuf_queue(struct vb2_buffer *vb)
636 buf->state = MX2_STATE_QUEUED; 668 buf->state = MX2_STATE_QUEUED;
637 list_add_tail(&buf->internal.queue, &pcdev->capture); 669 list_add_tail(&buf->internal.queue, &pcdev->capture);
638 670
639 if (cpu_is_mx25()) { 671 if (is_imx25_camera(pcdev)) {
640 u32 csicr3, dma_inten = 0; 672 u32 csicr3, dma_inten = 0;
641 673
642 if (pcdev->fb1_active == NULL) { 674 if (pcdev->fb1_active == NULL) {
@@ -655,20 +687,20 @@ static void mx2_videobuf_queue(struct vb2_buffer *vb)
655 list_del(&buf->internal.queue); 687 list_del(&buf->internal.queue);
656 buf->state = MX2_STATE_ACTIVE; 688 buf->state = MX2_STATE_ACTIVE;
657 689
658 csicr3 = readl(pcdev->base_csi + CSICR3); 690 csicr3 = readl(pcdev->base_csi + pcdev->reg_csicr3);
659 691
660 /* Reflash DMA */ 692 /* Reflash DMA */
661 writel(csicr3 | CSICR3_DMA_REFLASH_RFF, 693 writel(csicr3 | CSICR3_DMA_REFLASH_RFF,
662 pcdev->base_csi + CSICR3); 694 pcdev->base_csi + pcdev->reg_csicr3);
663 695
664 /* clear & enable interrupts */ 696 /* clear & enable interrupts */
665 writel(dma_inten, pcdev->base_csi + CSISR); 697 writel(dma_inten, pcdev->base_csi + pcdev->reg_csisr);
666 pcdev->csicr1 |= dma_inten; 698 pcdev->csicr1 |= dma_inten;
667 writel(pcdev->csicr1, pcdev->base_csi + CSICR1); 699 writel(pcdev->csicr1, pcdev->base_csi + CSICR1);
668 700
669 /* enable DMA */ 701 /* enable DMA */
670 csicr3 |= CSICR3_DMA_REQ_EN_RFF | CSICR3_RXFF_LEVEL(1); 702 csicr3 |= CSICR3_DMA_REQ_EN_RFF | CSICR3_RXFF_LEVEL(1);
671 writel(csicr3, pcdev->base_csi + CSICR3); 703 writel(csicr3, pcdev->base_csi + pcdev->reg_csicr3);
672 } 704 }
673 } 705 }
674 706
@@ -712,7 +744,7 @@ static void mx2_videobuf_release(struct vb2_buffer *vb)
712 */ 744 */
713 745
714 spin_lock_irqsave(&pcdev->lock, flags); 746 spin_lock_irqsave(&pcdev->lock, flags);
715 if (cpu_is_mx25() && buf->state == MX2_STATE_ACTIVE) { 747 if (is_imx25_camera(pcdev) && buf->state == MX2_STATE_ACTIVE) {
716 if (pcdev->fb1_active == buf) { 748 if (pcdev->fb1_active == buf) {
717 pcdev->csicr1 &= ~CSICR1_FB1_DMA_INTEN; 749 pcdev->csicr1 &= ~CSICR1_FB1_DMA_INTEN;
718 writel(0, pcdev->base_csi + CSIDMASA_FB1); 750 writel(0, pcdev->base_csi + CSIDMASA_FB1);
@@ -835,7 +867,7 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count)
835 unsigned long phys; 867 unsigned long phys;
836 int bytesperline; 868 int bytesperline;
837 869
838 if (cpu_is_mx27()) { 870 if (is_imx27_camera(pcdev)) {
839 unsigned long flags; 871 unsigned long flags;
840 if (count < 2) 872 if (count < 2)
841 return -EINVAL; 873 return -EINVAL;
@@ -930,7 +962,7 @@ static int mx2_stop_streaming(struct vb2_queue *q)
930 void *b; 962 void *b;
931 u32 cntl; 963 u32 cntl;
932 964
933 if (cpu_is_mx27()) { 965 if (is_imx27_camera(pcdev)) {
934 spin_lock_irqsave(&pcdev->lock, flags); 966 spin_lock_irqsave(&pcdev->lock, flags);
935 967
936 cntl = readl(pcdev->base_emma + PRP_CNTL); 968 cntl = readl(pcdev->base_emma + PRP_CNTL);
@@ -1082,11 +1114,11 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd)
1082 if (bytesperline < 0) 1114 if (bytesperline < 0)
1083 return bytesperline; 1115 return bytesperline;
1084 1116
1085 if (cpu_is_mx27()) { 1117 if (is_imx27_camera(pcdev)) {
1086 ret = mx27_camera_emma_prp_reset(pcdev); 1118 ret = mx27_camera_emma_prp_reset(pcdev);
1087 if (ret) 1119 if (ret)
1088 return ret; 1120 return ret;
1089 } else if (cpu_is_mx25()) { 1121 } else if (is_imx25_camera(pcdev)) {
1090 writel((bytesperline * icd->user_height) >> 2, 1122 writel((bytesperline * icd->user_height) >> 2,
1091 pcdev->base_csi + CSIRXCNT); 1123 pcdev->base_csi + CSIRXCNT);
1092 writel((bytesperline << 16) | icd->user_height, 1124 writel((bytesperline << 16) | icd->user_height,
@@ -1392,7 +1424,7 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
1392 /* FIXME: implement MX27 limits */ 1424 /* FIXME: implement MX27 limits */
1393 1425
1394 /* limit to MX25 hardware capabilities */ 1426 /* limit to MX25 hardware capabilities */
1395 if (cpu_is_mx25()) { 1427 if (is_imx25_camera(pcdev)) {
1396 if (xlate->host_fmt->bits_per_sample <= 8) 1428 if (xlate->host_fmt->bits_per_sample <= 8)
1397 width_limit = 0xffff * 4; 1429 width_limit = 0xffff * 4;
1398 else 1430 else
@@ -1726,6 +1758,20 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
1726 goto exit; 1758 goto exit;
1727 } 1759 }
1728 1760
1761 pcdev->devtype = pdev->id_entry->driver_data;
1762 switch (pcdev->devtype) {
1763 case IMX25_CAMERA:
1764 pcdev->reg_csisr = CSISR_IMX25;
1765 pcdev->reg_csicr3 = CSICR3_IMX25;
1766 break;
1767 case IMX27_CAMERA:
1768 pcdev->reg_csisr = CSISR_IMX27;
1769 pcdev->reg_csicr3 = CSICR3_IMX27;
1770 break;
1771 default:
1772 break;
1773 }
1774
1729 pcdev->clk_csi = devm_clk_get(&pdev->dev, "ahb"); 1775 pcdev->clk_csi = devm_clk_get(&pdev->dev, "ahb");
1730 if (IS_ERR(pcdev->clk_csi)) { 1776 if (IS_ERR(pcdev->clk_csi)) {
1731 dev_err(&pdev->dev, "Could not get csi clock\n"); 1777 dev_err(&pdev->dev, "Could not get csi clock\n");
@@ -1763,7 +1809,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
1763 pcdev->dev = &pdev->dev; 1809 pcdev->dev = &pdev->dev;
1764 platform_set_drvdata(pdev, pcdev); 1810 platform_set_drvdata(pdev, pcdev);
1765 1811
1766 if (cpu_is_mx25()) { 1812 if (is_imx25_camera(pcdev)) {
1767 err = devm_request_irq(&pdev->dev, irq_csi, mx25_camera_irq, 0, 1813 err = devm_request_irq(&pdev->dev, irq_csi, mx25_camera_irq, 0,
1768 MX2_CAM_DRV_NAME, pcdev); 1814 MX2_CAM_DRV_NAME, pcdev);
1769 if (err) { 1815 if (err) {
@@ -1772,7 +1818,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
1772 } 1818 }
1773 } 1819 }
1774 1820
1775 if (cpu_is_mx27()) { 1821 if (is_imx27_camera(pcdev)) {
1776 err = mx27_camera_emma_init(pdev); 1822 err = mx27_camera_emma_init(pdev);
1777 if (err) 1823 if (err)
1778 goto exit; 1824 goto exit;
@@ -1789,7 +1835,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
1789 pcdev->soc_host.priv = pcdev; 1835 pcdev->soc_host.priv = pcdev;
1790 pcdev->soc_host.v4l2_dev.dev = &pdev->dev; 1836 pcdev->soc_host.v4l2_dev.dev = &pdev->dev;
1791 pcdev->soc_host.nr = pdev->id; 1837 pcdev->soc_host.nr = pdev->id;
1792 if (cpu_is_mx25()) 1838 if (is_imx25_camera(pcdev))
1793 pcdev->soc_host.capabilities = SOCAM_HOST_CAP_STRIDE; 1839 pcdev->soc_host.capabilities = SOCAM_HOST_CAP_STRIDE;
1794 1840
1795 pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); 1841 pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
@@ -1809,7 +1855,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
1809exit_free_emma: 1855exit_free_emma:
1810 vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); 1856 vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx);
1811eallocctx: 1857eallocctx:
1812 if (cpu_is_mx27()) { 1858 if (is_imx27_camera(pcdev)) {
1813 clk_disable_unprepare(pcdev->clk_emma_ipg); 1859 clk_disable_unprepare(pcdev->clk_emma_ipg);
1814 clk_disable_unprepare(pcdev->clk_emma_ahb); 1860 clk_disable_unprepare(pcdev->clk_emma_ahb);
1815 } 1861 }
@@ -1827,7 +1873,7 @@ static int __devexit mx2_camera_remove(struct platform_device *pdev)
1827 1873
1828 vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); 1874 vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx);
1829 1875
1830 if (cpu_is_mx27()) { 1876 if (is_imx27_camera(pcdev)) {
1831 clk_disable_unprepare(pcdev->clk_emma_ipg); 1877 clk_disable_unprepare(pcdev->clk_emma_ipg);
1832 clk_disable_unprepare(pcdev->clk_emma_ahb); 1878 clk_disable_unprepare(pcdev->clk_emma_ahb);
1833 } 1879 }
@@ -1841,6 +1887,7 @@ static struct platform_driver mx2_camera_driver = {
1841 .driver = { 1887 .driver = {
1842 .name = MX2_CAM_DRV_NAME, 1888 .name = MX2_CAM_DRV_NAME,
1843 }, 1889 },
1890 .id_table = mx2_camera_devtype,
1844 .remove = __devexit_p(mx2_camera_remove), 1891 .remove = __devexit_p(mx2_camera_remove),
1845}; 1892};
1846 1893