aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 14:51:39 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 14:51:39 -0500
commitd01e4afdbb65e030fd6f1f96c30a558e2eb0f279 (patch)
tree02ef82b2740cf93a98199eded5ef765fa6e03052 /drivers/media
parent8287361abca36504da813638310d2547469283eb (diff)
parent794b175fc0c0c4844dbb7b137a73bbfd01f6c608 (diff)
Merge tag 'cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC cleanups on various subarchitectures from Olof Johansson: "Cleanup patches for various ARM platforms and some of their associated drivers. There's also a branch in here that enables Freescale i.MX to be part of the multiplatform support -- the first "big" SoC that is moved over (more multiplatform work comes in a separate branch later during the merge window)." Conflicts fixed as per Olof, including a silent semantic one in arch/arm/mach-omap2/board-generic.c (omap_prcm_restart() was renamed to omap3xxx_restart(), and a new user of the old name was added). * tag 'cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (189 commits) ARM: omap: fix typo on timer cleanup ARM: EXYNOS: Remove unused regs-mem.h file ARM: EXYNOS: Remove unused non-dt support for dwmci controller ARM: Kirkwood: Use hw_pci.ops instead of hw_pci.scan ARM: OMAP3: cm-t3517: use GPTIMER for system clock ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER ARM: SAMSUNG: use devm_ functions for ADC driver ARM: EXYNOS: no duplicate mask/unmask in eint0_15 ARM: S3C24XX: SPI clock channel setup is fixed for S3C2443 ARM: EXYNOS: Remove i2c0 resource information and setting of device names ARM: Kirkwood: checkpatch cleanups ARM: Kirkwood: Fix sparse warnings. ARM: Kirkwood: Remove unused includes ARM: kirkwood: cleanup lsxl board includes ARM: integrator: use BUG_ON where possible ARM: integrator: push down SC dependencies ARM: integrator: delete static UART1 mapping ARM: integrator: delete SC mapping on the CP ARM: integrator: remove static CP syscon mapping ARM: integrator: remove static AP syscon mapping ...
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/soc_camera/mx2_camera.c95
-rw-r--r--drivers/media/platform/soc_camera/mx3_camera.c2
2 files changed, 72 insertions, 25 deletions
diff --git a/drivers/media/platform/soc_camera/mx2_camera.c b/drivers/media/platform/soc_camera/mx2_camera.c
index 9a55f4c4c7f4..8ac9b72b5ec7 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;
@@ -934,7 +966,7 @@ static int mx2_stop_streaming(struct vb2_queue *q)
934 void *b; 966 void *b;
935 u32 cntl; 967 u32 cntl;
936 968
937 if (cpu_is_mx27()) { 969 if (is_imx27_camera(pcdev)) {
938 spin_lock_irqsave(&pcdev->lock, flags); 970 spin_lock_irqsave(&pcdev->lock, flags);
939 971
940 cntl = readl(pcdev->base_emma + PRP_CNTL); 972 cntl = readl(pcdev->base_emma + PRP_CNTL);
@@ -1086,11 +1118,11 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd)
1086 if (bytesperline < 0) 1118 if (bytesperline < 0)
1087 return bytesperline; 1119 return bytesperline;
1088 1120
1089 if (cpu_is_mx27()) { 1121 if (is_imx27_camera(pcdev)) {
1090 ret = mx27_camera_emma_prp_reset(pcdev); 1122 ret = mx27_camera_emma_prp_reset(pcdev);
1091 if (ret) 1123 if (ret)
1092 return ret; 1124 return ret;
1093 } else if (cpu_is_mx25()) { 1125 } else if (is_imx25_camera(pcdev)) {
1094 writel((bytesperline * icd->user_height) >> 2, 1126 writel((bytesperline * icd->user_height) >> 2,
1095 pcdev->base_csi + CSIRXCNT); 1127 pcdev->base_csi + CSIRXCNT);
1096 writel((bytesperline << 16) | icd->user_height, 1128 writel((bytesperline << 16) | icd->user_height,
@@ -1397,7 +1429,7 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
1397 /* FIXME: implement MX27 limits */ 1429 /* FIXME: implement MX27 limits */
1398 1430
1399 /* limit to MX25 hardware capabilities */ 1431 /* limit to MX25 hardware capabilities */
1400 if (cpu_is_mx25()) { 1432 if (is_imx25_camera(pcdev)) {
1401 if (xlate->host_fmt->bits_per_sample <= 8) 1433 if (xlate->host_fmt->bits_per_sample <= 8)
1402 width_limit = 0xffff * 4; 1434 width_limit = 0xffff * 4;
1403 else 1435 else
@@ -1731,6 +1763,20 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
1731 goto exit; 1763 goto exit;
1732 } 1764 }
1733 1765
1766 pcdev->devtype = pdev->id_entry->driver_data;
1767 switch (pcdev->devtype) {
1768 case IMX25_CAMERA:
1769 pcdev->reg_csisr = CSISR_IMX25;
1770 pcdev->reg_csicr3 = CSICR3_IMX25;
1771 break;
1772 case IMX27_CAMERA:
1773 pcdev->reg_csisr = CSISR_IMX27;
1774 pcdev->reg_csicr3 = CSICR3_IMX27;
1775 break;
1776 default:
1777 break;
1778 }
1779
1734 pcdev->clk_csi = devm_clk_get(&pdev->dev, "ahb"); 1780 pcdev->clk_csi = devm_clk_get(&pdev->dev, "ahb");
1735 if (IS_ERR(pcdev->clk_csi)) { 1781 if (IS_ERR(pcdev->clk_csi)) {
1736 dev_err(&pdev->dev, "Could not get csi clock\n"); 1782 dev_err(&pdev->dev, "Could not get csi clock\n");
@@ -1768,7 +1814,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
1768 pcdev->dev = &pdev->dev; 1814 pcdev->dev = &pdev->dev;
1769 platform_set_drvdata(pdev, pcdev); 1815 platform_set_drvdata(pdev, pcdev);
1770 1816
1771 if (cpu_is_mx25()) { 1817 if (is_imx25_camera(pcdev)) {
1772 err = devm_request_irq(&pdev->dev, irq_csi, mx25_camera_irq, 0, 1818 err = devm_request_irq(&pdev->dev, irq_csi, mx25_camera_irq, 0,
1773 MX2_CAM_DRV_NAME, pcdev); 1819 MX2_CAM_DRV_NAME, pcdev);
1774 if (err) { 1820 if (err) {
@@ -1777,7 +1823,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
1777 } 1823 }
1778 } 1824 }
1779 1825
1780 if (cpu_is_mx27()) { 1826 if (is_imx27_camera(pcdev)) {
1781 err = mx27_camera_emma_init(pdev); 1827 err = mx27_camera_emma_init(pdev);
1782 if (err) 1828 if (err)
1783 goto exit; 1829 goto exit;
@@ -1794,7 +1840,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
1794 pcdev->soc_host.priv = pcdev; 1840 pcdev->soc_host.priv = pcdev;
1795 pcdev->soc_host.v4l2_dev.dev = &pdev->dev; 1841 pcdev->soc_host.v4l2_dev.dev = &pdev->dev;
1796 pcdev->soc_host.nr = pdev->id; 1842 pcdev->soc_host.nr = pdev->id;
1797 if (cpu_is_mx25()) 1843 if (is_imx25_camera(pcdev))
1798 pcdev->soc_host.capabilities = SOCAM_HOST_CAP_STRIDE; 1844 pcdev->soc_host.capabilities = SOCAM_HOST_CAP_STRIDE;
1799 1845
1800 pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); 1846 pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
@@ -1814,7 +1860,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
1814exit_free_emma: 1860exit_free_emma:
1815 vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); 1861 vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx);
1816eallocctx: 1862eallocctx:
1817 if (cpu_is_mx27()) { 1863 if (is_imx27_camera(pcdev)) {
1818 clk_disable_unprepare(pcdev->clk_emma_ipg); 1864 clk_disable_unprepare(pcdev->clk_emma_ipg);
1819 clk_disable_unprepare(pcdev->clk_emma_ahb); 1865 clk_disable_unprepare(pcdev->clk_emma_ahb);
1820 } 1866 }
@@ -1832,7 +1878,7 @@ static int __devexit mx2_camera_remove(struct platform_device *pdev)
1832 1878
1833 vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); 1879 vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx);
1834 1880
1835 if (cpu_is_mx27()) { 1881 if (is_imx27_camera(pcdev)) {
1836 clk_disable_unprepare(pcdev->clk_emma_ipg); 1882 clk_disable_unprepare(pcdev->clk_emma_ipg);
1837 clk_disable_unprepare(pcdev->clk_emma_ahb); 1883 clk_disable_unprepare(pcdev->clk_emma_ahb);
1838 } 1884 }
@@ -1846,6 +1892,7 @@ static struct platform_driver mx2_camera_driver = {
1846 .driver = { 1892 .driver = {
1847 .name = MX2_CAM_DRV_NAME, 1893 .name = MX2_CAM_DRV_NAME,
1848 }, 1894 },
1895 .id_table = mx2_camera_devtype,
1849 .remove = __devexit_p(mx2_camera_remove), 1896 .remove = __devexit_p(mx2_camera_remove),
1850}; 1897};
1851 1898
diff --git a/drivers/media/platform/soc_camera/mx3_camera.c b/drivers/media/platform/soc_camera/mx3_camera.c
index 261f6e9e1b17..06d16de76377 100644
--- a/drivers/media/platform/soc_camera/mx3_camera.c
+++ b/drivers/media/platform/soc_camera/mx3_camera.c
@@ -17,6 +17,7 @@
17#include <linux/vmalloc.h> 17#include <linux/vmalloc.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/sched.h> 19#include <linux/sched.h>
20#include <linux/dma/ipu-dma.h>
20 21
21#include <media/v4l2-common.h> 22#include <media/v4l2-common.h>
22#include <media/v4l2-dev.h> 23#include <media/v4l2-dev.h>
@@ -24,7 +25,6 @@
24#include <media/soc_camera.h> 25#include <media/soc_camera.h>
25#include <media/soc_mediabus.h> 26#include <media/soc_mediabus.h>
26 27
27#include <mach/ipu.h>
28#include <linux/platform_data/camera-mx3.h> 28#include <linux/platform_data/camera-mx3.h>
29#include <linux/platform_data/dma-imx.h> 29#include <linux/platform_data/dma-imx.h>
30 30