Re: [PATCH] V4L/DVB: v4l: Add driver for Marvell PXA910 CCIC
On Fri, Jun 10, 2011 at 6:47 AM, Jonathan Corbet cor...@lwn.net wrote: Hi, Kassey, I've been looking at the driver some to understand how you're using the hardware. One quick question: The driver is based on soc-camera + videobuf2 frame work, and only USERPTR is supported. Since you're limited to contiguous DMA (does the PXA910 even support scatter/gather mode?), PXA910 supports scatter/gather mode, but we did not use that. USERPTR is going to be very limiting. Is the application mapping I/O memory elsewhere in the system with the expectation of having the video frames go directly there? Could you tell me how that works? I'd like to understand the use case here. USERPTR is popular on Android Camera HAL implementation.. we alloc memory in user space by PMEM, and QBUF to driver, once DMA finished the buffer, we DQBUF and send the buffer address to display DMA directly. or doing encode. MMAP can not offer big size memory, for 720P resolution, when running Android. FWIW, I believe that videobuf2 would support the MMAP mode with no additional effort on your part; any reason why you haven't enabled that? you are right. I just enabled it on videobuf, and I will try to enable it on videobuf2, too. thanks. Thanks, jon -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best regards Kassey Application Processor Systems Engineering, Marvell Technology Group Ltd. Shanghai, China. -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] V4L/DVB: v4l: Add driver for Marvell PXA910 CCIC
Guennadi, Jon: thanks! we hope to work out a common ccic core, and then re base the code. : On Wed, Jun 8, 2011 at 7:30 PM, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote: Hi Kassey Thanks for the new version, but, IIUC, you agreed to reimplement your driver on top of a common ccic core, which means, a lot of code will change. So, it doesn't really make much sense now to make and review new stand-alone versions of your driver, right? So, shall we wait until Jon's CCIC code stabilises a bit and you rebase your driver on top of it? Of course, you can also work together with Jon on the drivers to get them faster in shape and in a way, suitable fou you both. Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best regards Kassey Application Processor Systems Engineering, Marvell Technology Group Ltd. Shanghai, China. -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] V4L/DVB: v4l: Add driver for Marvell PXA910 CCIC
On Thu, 9 Jun 2011, Kassey Lee wrote: Guennadi, Jon: thanks! we hope to work out a common ccic core, and then re base the code. ok, so, we agree, that I don't review your last version, ok? Thanks Guennadi : On Wed, Jun 8, 2011 at 7:30 PM, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote: Hi Kassey Thanks for the new version, but, IIUC, you agreed to reimplement your driver on top of a common ccic core, which means, a lot of code will change. So, it doesn't really make much sense now to make and review new stand-alone versions of your driver, right? So, shall we wait until Jon's CCIC code stabilises a bit and you rebase your driver on top of it? Of course, you can also work together with Jon on the drivers to get them faster in shape and in a way, suitable fou you both. Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best regards Kassey Application Processor Systems Engineering, Marvell Technology Group Ltd. Shanghai, China. --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] V4L/DVB: v4l: Add driver for Marvell PXA910 CCIC
On Thu, Jun 9, 2011 at 4:42 PM, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote: On Thu, 9 Jun 2011, Kassey Lee wrote: Guennadi, Jon: thanks! we hope to work out a common ccic core, and then re base the code. ok, so, we agree, that I don't review your last version, ok? Guennadi, Jon your comments are always welcome and valuable for us. As Jon will convert cafe_ccic.c to videobuf2 too, I wish He can review this driver too, if it is useful for him. and find the common ccic core. Just Mark it. Thanks Thanks Guennadi : On Wed, Jun 8, 2011 at 7:30 PM, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote: Hi Kassey Thanks for the new version, but, IIUC, you agreed to reimplement your driver on top of a common ccic core, which means, a lot of code will change. So, it doesn't really make much sense now to make and review new stand-alone versions of your driver, right? So, shall we wait until Jon's CCIC code stabilises a bit and you rebase your driver on top of it? Of course, you can also work together with Jon on the drivers to get them faster in shape and in a way, suitable fou you both. Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best regards Kassey Application Processor Systems Engineering, Marvell Technology Group Ltd. Shanghai, China. --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- Best regards Kassey Application Processor Systems Engineering, Marvell Technology Group Ltd. Shanghai, China. -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] V4L/DVB: v4l: Add driver for Marvell PXA910 CCIC
On Thu, 9 Jun 2011 16:46:47 +0800 Kassey Lee kassey1...@gmail.com wrote: As Jon will convert cafe_ccic.c to videobuf2 too, I wish He can review this driver too, if it is useful for him. and find the common ccic core. Just Mark it. I do plan to take a close look at the driver; if nothing else, I want to be sure that the core code can support it with minimal pain. I tend to be busy early in the week, but much of today is set aside for work in this area. Thanks, jon -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] V4L/DVB: v4l: Add driver for Marvell PXA910 CCIC
Hi, Kassey, I've been looking at the driver some to understand how you're using the hardware. One quick question: The driver is based on soc-camera + videobuf2 frame work, and only USERPTR is supported. Since you're limited to contiguous DMA (does the PXA910 even support scatter/gather mode?), USERPTR is going to be very limiting. Is the application mapping I/O memory elsewhere in the system with the expectation of having the video frames go directly there? Could you tell me how that works? I'd like to understand the use case here. FWIW, I believe that videobuf2 would support the MMAP mode with no additional effort on your part; any reason why you haven't enabled that? Thanks, jon -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] V4L/DVB: v4l: Add driver for Marvell PXA910 CCIC
Hi Kassey Thanks for the new version, but, IIUC, you agreed to reimplement your driver on top of a common ccic core, which means, a lot of code will change. So, it doesn't really make much sense now to make and review new stand-alone versions of your driver, right? So, shall we wait until Jon's CCIC code stabilises a bit and you rebase your driver on top of it? Of course, you can also work together with Jon on the drivers to get them faster in shape and in a way, suitable fou you both. Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] V4L/DVB: v4l: Add driver for Marvell PXA910 CCIC
This driver exports a video device node per each CCIC (CMOS Camera Interface Controller) device contained in Marvell Mobile PXA910 SoC The driver is based on soc-camera + videobuf2 frame work, and only USERPTR is supported. Signed-off-by: Kassey Lee y...@marvell.com --- arch/arm/mach-mmp/include/mach/camera.h | 37 ++ drivers/media/video/Kconfig |7 + drivers/media/video/Makefile|1 + drivers/media/video/mv_camera.c | 1071 +++ 4 files changed, 1116 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-mmp/include/mach/camera.h create mode 100644 drivers/media/video/mv_camera.c V3 Changes: 1) add cafe-ccic copyright 2) add VSYNC, HSYNC, PCLK check for CCIC 3) code style fix as Guennadi's comments diff --git a/arch/arm/mach-mmp/include/mach/camera.h b/arch/arm/mach-mmp/include/mach/camera.h new file mode 100644 index 000..ff8cde1 --- /dev/null +++ b/arch/arm/mach-mmp/include/mach/camera.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2011, Marvell International Ltd. + * Kassey Lee y...@marvell.com + * Angela Wan j...@marvell.com + * Lei Wen lei...@marvell.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#ifndef __ASM_ARCH_CAMERA_H__ +#define __ASM_ARCH_CAMERA_H__ + +#define MV_CAMERA_MASTER 1 +#define MV_CAMERA_DATAWIDTH_8 8 +#define MV_CAMERA_DATAWIDTH_10 0x20 +#define MV_CAMERA_PCLK_EN 0x40 +#define MV_CAMERA_MCLK_EN 0x80 +#define MV_CAMERA_PCP 0x100 +#define MV_CAMERA_HSP 0x200 +#define MV_CAMERA_VSP 0x400 + +struct mv_cam_pdata { + int dphy[3]; + unsigned long flags; + int dma_burst; + int mclk_min; + int mclk_src; + int (*init_clk) (struct device *dev, int init); + void (*enable_clk) (struct device *dev, int on); + int (*get_mclk_src) (int src); +}; + +#endif diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 3be180b..18ab3a5 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -891,6 +891,13 @@ config VIDEO_MX3 ---help--- This is a v4l2 driver for the i.MX3x Camera Sensor Interface +config VIDEO_MV_CCIC + tristate Marvell CMOS Camera Interface Controller driver + depends on VIDEO_DEV CPU_PXA910 SOC_CAMERA + select VIDEOBUF2_DMA_CONTIG + ---help--- + This is a v4l2 driver for the Marvell CCIC Interface + config VIDEO_PXA27x tristate PXA27x Quick Capture Interface driver depends on VIDEO_DEV PXA27x SOC_CAMERA diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 9519160..e3251c3 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -161,6 +161,7 @@ obj-$(CONFIG_SOC_CAMERA_PLATFORM) += soc_camera_platform.o obj-$(CONFIG_VIDEO_MX1)+= mx1_camera.o obj-$(CONFIG_VIDEO_MX2)+= mx2_camera.o obj-$(CONFIG_VIDEO_MX3)+= mx3_camera.o +obj-$(CONFIG_VIDEO_MV_CCIC)+= mv_camera.o obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o obj-$(CONFIG_VIDEO_SH_MOBILE_CSI2) += sh_mobile_csi2.o obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o diff --git a/drivers/media/video/mv_camera.c b/drivers/media/video/mv_camera.c new file mode 100644 index 000..3a03a40 --- /dev/null +++ b/drivers/media/video/mv_camera.c @@ -0,0 +1,1071 @@ +/* + * V4L2 Driver for Marvell Mobile SoC PXA910 CCIC + * (CMOS Capture Interface Controller) + * + * This driver is based on soc_camera and videobuf2 + * framework, but part of the low level register function + * is base on cafe_ccic.c + * + * Copyright (C) 2011, Marvell International Ltd. + * Kassey Lee y...@marvell.com + * Angela Wan j...@marvell.com + * Lei Wen lei...@marvell.com + * + * Copyright 2006 One Laptop Per Child Association, Inc. + * Copyright 2006-7 Jonathan Corbet cor...@lwn.net + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#include linux/clk.h +#include linux/delay.h +#include linux/device.h +#include linux/dma-mapping.h +#include linux/errno.h +#include linux/fs.h +#include linux/init.h +#include linux/interrupt.h +#include linux/io.h +#include linux/kernel.h +#include linux/mm.h +#include linux/module.h +#include linux/platform_device.h +#include linux/slab.h +#include linux/time.h +#include linux/videodev2.h + +#include media/soc_camera.h +#include media/soc_mediabus.h +#include media/v4l2-common.h +#include media/v4l2-dev.h +#include
Re: [PATCH] V4L/DVB: v4l: Add driver for Marvell PXA910 CCIC
Guennadi: thanks for your detail review and comments. I updated one by one, and will send out the patch later. thanks 2011/5/31 Guennadi Liakhovetski g.liakhovet...@gmx.de: On Fri, 27 May 2011, Kassey Lee wrote: This driver exports a video device node per each CCIC (CMOS Camera Interface Controller) device contained in Marvell Mobile PXA910 SoC The driver is based on v4l2-mem2mem framework, and only What does it have to do with mem2mem? [kassey] sorry, I will change it to this driver is based on soc-camera and videobuf2 framework USERPTR is supported. Signed-off-by: Kassey Lee y...@marvell.com --- arch/arm/mach-mmp/include/mach/camera.h | 33 + drivers/media/video/Kconfig | 7 + drivers/media/video/Makefile | 1 + drivers/media/video/mv_camera.c | 1120 +++ 4 files changed, 1161 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-mmp/include/mach/camera.h create mode 100644 drivers/media/video/mv_camera.c diff --git a/arch/arm/mach-mmp/include/mach/camera.h b/arch/arm/mach-mmp/include/mach/camera.h new file mode 100644 index 000..b008f3f --- /dev/null +++ b/arch/arm/mach-mmp/include/mach/camera.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2011, Marvell International Ltd. + * Kassey Lee y...@marvell.com + * Angela Wan j...@marvell.com + * Lei Wen lei...@marvell.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#ifndef __ASM_ARCH_CAMERA_H__ +#define __ASM_ARCH_CAMERA_H__ + +#define MAX_CAM_CLK 3 +struct mv_cam_pdata { + struct clk *clk[MAX_CAM_CLK]; + char *name; + int clk_enabled; None of the above fields seem to be used [kassey] OK, i will remove them. + int dphy[3]; + int bus_type; Hm, you're running a bit ahead of time with this one;) SOCAM_MIPI is _not_ a bus-type, but yes, I'm thinking about adding a bus_type field to struct soc_camera_device, in fact, I've been doing that just a couple of hours before reviewing this code:) So far I forsee having 3 bus-types: normal PARALLEL, BT656 and MIPI_CSI2, sounds reasonable? Even though I don't think we explicitly support BT656 anywhere in soc-camera yet. [kassey]appreciate your patch for the bus_type, for now, how about change it to flags, where the platform will define the but attribute that this board supports ? + int dma_burst; + int qos_req_min; Unused? [kassey] qos_req_min removed. + int mclk_min; + int mclk_src; + int (*clk_init) (struct device *dev, int init); + void (*set_clock) (struct device *dev, int on); + int (*get_mclk_src) (int src); +}; + +#endif diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 3be180b..3b7a70e 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -891,6 +891,13 @@ config VIDEO_MX3 ---help--- This is a v4l2 driver for the i.MX3x Camera Sensor Interface +config VIDEO_MV Maybe choose a more specific name? Either with CCIC or with PXA910 in it - whatever you feel is more appropriate. Same holds for the filename and, ideally, for the whole used namespace. We hope this is not the last V4L2 driver from Marvell:-) [kassey] OK, how aboutVIDEO_MV_CCIC ? + tristate Marvell CMOS Camera Interface Controller driver + depends on VIDEO_DEV CPU_PXA910 SOC_CAMERA + select VIDEOBUF2_DMA_CONTIG + ---help--- + This is a v4l2 driver for the Marvell CCIC Interface + config VIDEO_PXA27x tristate PXA27x Quick Capture Interface driver depends on VIDEO_DEV PXA27x SOC_CAMERA diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 9519160..373b706 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -161,6 +161,7 @@ obj-$(CONFIG_SOC_CAMERA_PLATFORM) += soc_camera_platform.o obj-$(CONFIG_VIDEO_MX1) += mx1_camera.o obj-$(CONFIG_VIDEO_MX2) += mx2_camera.o obj-$(CONFIG_VIDEO_MX3) += mx3_camera.o +obj-$(CONFIG_VIDEO_MV) += mv_camera.o obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o obj-$(CONFIG_VIDEO_SH_MOBILE_CSI2) += sh_mobile_csi2.o obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o diff --git a/drivers/media/video/mv_camera.c b/drivers/media/video/mv_camera.c new file mode 100644 index 000..1a8f73e --- /dev/null +++ b/drivers/media/video/mv_camera.c @@ -0,0 +1,1120 @@ +/* + * V4L2 Driver for Marvell Mobile SoC PXA910 CCIC + * (CMOS Capture Interface Controller) + * + * Copyright (C) 2011, Marvell International Ltd. + * Kassey Lee y...@marvell.com + * Angela Wan j...@marvell.com + *
Re: [PATCH] V4L/DVB: v4l: Add driver for Marvell PXA910 CCIC
This patch is to enable Marvell Mobile SoC PXA910 CMOS Cmera Interface Controller driver support. - Using soc-camera framework with videobuf2 dma-contig allocator - Supporting video streaming of YUV packed format - Tested on PXA910 TTC_DKB board with OV5642 hi, Guennadi, Hans, as you suggested to prefer improved videobuf2, we converted the Marvell SoC PXA910 CCIC driver from videobuf to videobuf2, and verified OK. would you please help to review ? thanks! 2011/5/27 Kassey Lee y...@marvell.com: This driver exports a video device node per each CCIC (CMOS Camera Interface Controller) device contained in Marvell Mobile PXA910 SoC The driver is based on v4l2-mem2mem framework, and only USERPTR is supported. Signed-off-by: Kassey Lee y...@marvell.com --- arch/arm/mach-mmp/include/mach/camera.h | 33 + drivers/media/video/Kconfig | 7 + drivers/media/video/Makefile | 1 + drivers/media/video/mv_camera.c | 1120 +++ 4 files changed, 1161 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-mmp/include/mach/camera.h create mode 100644 drivers/media/video/mv_camera.c diff --git a/arch/arm/mach-mmp/include/mach/camera.h b/arch/arm/mach-mmp/include/mach/camera.h new file mode 100644 index 000..b008f3f --- /dev/null +++ b/arch/arm/mach-mmp/include/mach/camera.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2011, Marvell International Ltd. + * Kassey Lee y...@marvell.com + * Angela Wan j...@marvell.com + * Lei Wen lei...@marvell.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#ifndef __ASM_ARCH_CAMERA_H__ +#define __ASM_ARCH_CAMERA_H__ + +#define MAX_CAM_CLK 3 +struct mv_cam_pdata { + struct clk *clk[MAX_CAM_CLK]; + char *name; + int clk_enabled; + int dphy[3]; + int bus_type; + int dma_burst; + int qos_req_min; + int mclk_min; + int mclk_src; + int (*clk_init) (struct device *dev, int init); + void (*set_clock) (struct device *dev, int on); + int (*get_mclk_src) (int src); +}; + +#endif diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 3be180b..3b7a70e 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -891,6 +891,13 @@ config VIDEO_MX3 ---help--- This is a v4l2 driver for the i.MX3x Camera Sensor Interface +config VIDEO_MV + tristate Marvell CMOS Camera Interface Controller driver + depends on VIDEO_DEV CPU_PXA910 SOC_CAMERA + select VIDEOBUF2_DMA_CONTIG + ---help--- + This is a v4l2 driver for the Marvell CCIC Interface + config VIDEO_PXA27x tristate PXA27x Quick Capture Interface driver depends on VIDEO_DEV PXA27x SOC_CAMERA diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 9519160..373b706 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -161,6 +161,7 @@ obj-$(CONFIG_SOC_CAMERA_PLATFORM) += soc_camera_platform.o obj-$(CONFIG_VIDEO_MX1) += mx1_camera.o obj-$(CONFIG_VIDEO_MX2) += mx2_camera.o obj-$(CONFIG_VIDEO_MX3) += mx3_camera.o +obj-$(CONFIG_VIDEO_MV) += mv_camera.o obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o obj-$(CONFIG_VIDEO_SH_MOBILE_CSI2) += sh_mobile_csi2.o obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o diff --git a/drivers/media/video/mv_camera.c b/drivers/media/video/mv_camera.c new file mode 100644 index 000..1a8f73e --- /dev/null +++ b/drivers/media/video/mv_camera.c @@ -0,0 +1,1120 @@ +/* + * V4L2 Driver for Marvell Mobile SoC PXA910 CCIC + * (CMOS Capture Interface Controller) + * + * Copyright (C) 2011, Marvell International Ltd. + * Kassey Lee y...@marvell.com + * Angela Wan j...@marvell.com + * Lei Wen lei...@marvell.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#include linux/init.h +#include linux/module.h +#include linux/io.h +#include linux/delay.h +#include linux/dma-mapping.h +#include linux/errno.h +#include linux/fs.h +#include linux/interrupt.h +#include linux/kernel.h +#include linux/mm.h +#include linux/time.h +#include linux/device.h +#include linux/platform_device.h +#include linux/clk.h +#include linux/slab.h +#include linux/videodev2.h + +#include media/v4l2-common.h +#include media/v4l2-dev.h +#include
Re: [PATCH] V4L/DVB: v4l: Add driver for Marvell PXA910 CCIC
Hi On Mon, 30 May 2011, Kassey Lee wrote: This patch is to enable Marvell Mobile SoC PXA910 CMOS Cmera Interface Controller driver support. - Using soc-camera framework with videobuf2 dma-contig allocator - Supporting video streaming of YUV packed format - Tested on PXA910 TTC_DKB board with OV5642 hi, Guennadi, Hans, as you suggested to prefer improved videobuf2, we converted the Marvell SoC PXA910 CCIC driver from videobuf to videobuf2, and verified OK. would you please help to review ? thanks! Review is in work, will try to finish it within the next couple of days. Thanks Guennadi 2011/5/27 Kassey Lee y...@marvell.com: This driver exports a video device node per each CCIC (CMOS Camera Interface Controller) device contained in Marvell Mobile PXA910 SoC The driver is based on v4l2-mem2mem framework, and only USERPTR is supported. Signed-off-by: Kassey Lee y...@marvell.com --- arch/arm/mach-mmp/include/mach/camera.h | 33 + drivers/media/video/Kconfig | 7 + drivers/media/video/Makefile | 1 + drivers/media/video/mv_camera.c | 1120 +++ 4 files changed, 1161 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-mmp/include/mach/camera.h create mode 100644 drivers/media/video/mv_camera.c diff --git a/arch/arm/mach-mmp/include/mach/camera.h b/arch/arm/mach-mmp/include/mach/camera.h new file mode 100644 index 000..b008f3f --- /dev/null +++ b/arch/arm/mach-mmp/include/mach/camera.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2011, Marvell International Ltd. + * Kassey Lee y...@marvell.com + * Angela Wan j...@marvell.com + * Lei Wen lei...@marvell.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#ifndef __ASM_ARCH_CAMERA_H__ +#define __ASM_ARCH_CAMERA_H__ + +#define MAX_CAM_CLK 3 +struct mv_cam_pdata { + struct clk *clk[MAX_CAM_CLK]; + char *name; + int clk_enabled; + int dphy[3]; + int bus_type; + int dma_burst; + int qos_req_min; + int mclk_min; + int mclk_src; + int (*clk_init) (struct device *dev, int init); + void (*set_clock) (struct device *dev, int on); + int (*get_mclk_src) (int src); +}; + +#endif diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 3be180b..3b7a70e 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -891,6 +891,13 @@ config VIDEO_MX3 ---help--- This is a v4l2 driver for the i.MX3x Camera Sensor Interface +config VIDEO_MV + tristate Marvell CMOS Camera Interface Controller driver + depends on VIDEO_DEV CPU_PXA910 SOC_CAMERA + select VIDEOBUF2_DMA_CONTIG + ---help--- + This is a v4l2 driver for the Marvell CCIC Interface + config VIDEO_PXA27x tristate PXA27x Quick Capture Interface driver depends on VIDEO_DEV PXA27x SOC_CAMERA diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 9519160..373b706 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -161,6 +161,7 @@ obj-$(CONFIG_SOC_CAMERA_PLATFORM) += soc_camera_platform.o obj-$(CONFIG_VIDEO_MX1) += mx1_camera.o obj-$(CONFIG_VIDEO_MX2) += mx2_camera.o obj-$(CONFIG_VIDEO_MX3) += mx3_camera.o +obj-$(CONFIG_VIDEO_MV) += mv_camera.o obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o obj-$(CONFIG_VIDEO_SH_MOBILE_CSI2) += sh_mobile_csi2.o obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o diff --git a/drivers/media/video/mv_camera.c b/drivers/media/video/mv_camera.c new file mode 100644 index 000..1a8f73e --- /dev/null +++ b/drivers/media/video/mv_camera.c @@ -0,0 +1,1120 @@ +/* + * V4L2 Driver for Marvell Mobile SoC PXA910 CCIC + * (CMOS Capture Interface Controller) + * + * Copyright (C) 2011, Marvell International Ltd. + * Kassey Lee y...@marvell.com + * Angela Wan j...@marvell.com + * Lei Wen lei...@marvell.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#include linux/init.h +#include linux/module.h +#include linux/io.h +#include linux/delay.h +#include linux/dma-mapping.h +#include linux/errno.h +#include linux/fs.h +#include linux/interrupt.h
Re: [PATCH] V4L/DVB: v4l: Add driver for Marvell PXA910 CCIC
thanks for your time. 2011/5/30 Guennadi Liakhovetski g.liakhovet...@gmx.de: Hi On Mon, 30 May 2011, Kassey Lee wrote: This patch is to enable Marvell Mobile SoC PXA910 CMOS Cmera Interface Controller driver support. - Using soc-camera framework with videobuf2 dma-contig allocator - Supporting video streaming of YUV packed format - Tested on PXA910 TTC_DKB board with OV5642 hi, Guennadi, Hans, as you suggested to prefer improved videobuf2, we converted the Marvell SoC PXA910 CCIC driver from videobuf to videobuf2, and verified OK. would you please help to review ? thanks! Review is in work, will try to finish it within the next couple of days. Thanks Guennadi 2011/5/27 Kassey Lee y...@marvell.com: This driver exports a video device node per each CCIC (CMOS Camera Interface Controller) device contained in Marvell Mobile PXA910 SoC The driver is based on v4l2-mem2mem framework, and only USERPTR is supported. Signed-off-by: Kassey Lee y...@marvell.com --- arch/arm/mach-mmp/include/mach/camera.h | 33 + drivers/media/video/Kconfig | 7 + drivers/media/video/Makefile | 1 + drivers/media/video/mv_camera.c | 1120 +++ 4 files changed, 1161 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-mmp/include/mach/camera.h create mode 100644 drivers/media/video/mv_camera.c diff --git a/arch/arm/mach-mmp/include/mach/camera.h b/arch/arm/mach-mmp/include/mach/camera.h new file mode 100644 index 000..b008f3f --- /dev/null +++ b/arch/arm/mach-mmp/include/mach/camera.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2011, Marvell International Ltd. + * Kassey Lee y...@marvell.com + * Angela Wan j...@marvell.com + * Lei Wen lei...@marvell.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#ifndef __ASM_ARCH_CAMERA_H__ +#define __ASM_ARCH_CAMERA_H__ + +#define MAX_CAM_CLK 3 +struct mv_cam_pdata { + struct clk *clk[MAX_CAM_CLK]; + char *name; + int clk_enabled; + int dphy[3]; + int bus_type; + int dma_burst; + int qos_req_min; + int mclk_min; + int mclk_src; + int (*clk_init) (struct device *dev, int init); + void (*set_clock) (struct device *dev, int on); + int (*get_mclk_src) (int src); +}; + +#endif diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 3be180b..3b7a70e 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -891,6 +891,13 @@ config VIDEO_MX3 ---help--- This is a v4l2 driver for the i.MX3x Camera Sensor Interface +config VIDEO_MV + tristate Marvell CMOS Camera Interface Controller driver + depends on VIDEO_DEV CPU_PXA910 SOC_CAMERA + select VIDEOBUF2_DMA_CONTIG + ---help--- + This is a v4l2 driver for the Marvell CCIC Interface + config VIDEO_PXA27x tristate PXA27x Quick Capture Interface driver depends on VIDEO_DEV PXA27x SOC_CAMERA diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 9519160..373b706 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -161,6 +161,7 @@ obj-$(CONFIG_SOC_CAMERA_PLATFORM) += soc_camera_platform.o obj-$(CONFIG_VIDEO_MX1) += mx1_camera.o obj-$(CONFIG_VIDEO_MX2) += mx2_camera.o obj-$(CONFIG_VIDEO_MX3) += mx3_camera.o +obj-$(CONFIG_VIDEO_MV) += mv_camera.o obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o obj-$(CONFIG_VIDEO_SH_MOBILE_CSI2) += sh_mobile_csi2.o obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o diff --git a/drivers/media/video/mv_camera.c b/drivers/media/video/mv_camera.c new file mode 100644 index 000..1a8f73e --- /dev/null +++ b/drivers/media/video/mv_camera.c @@ -0,0 +1,1120 @@ +/* + * V4L2 Driver for Marvell Mobile SoC PXA910 CCIC + * (CMOS Capture Interface Controller) + * + * Copyright (C) 2011, Marvell International Ltd. + * Kassey Lee y...@marvell.com + * Angela Wan j...@marvell.com + * Lei Wen lei...@marvell.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#include linux/init.h +#include linux/module.h +#include linux/io.h +#include linux/delay.h +#include linux/dma-mapping.h
Re: [PATCH] V4L/DVB: v4l: Add driver for Marvell PXA910 CCIC
On Fri, 27 May 2011, Kassey Lee wrote: This driver exports a video device node per each CCIC (CMOS Camera Interface Controller) device contained in Marvell Mobile PXA910 SoC The driver is based on v4l2-mem2mem framework, and only What does it have to do with mem2mem? USERPTR is supported. Signed-off-by: Kassey Lee y...@marvell.com --- arch/arm/mach-mmp/include/mach/camera.h | 33 + drivers/media/video/Kconfig |7 + drivers/media/video/Makefile|1 + drivers/media/video/mv_camera.c | 1120 +++ 4 files changed, 1161 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-mmp/include/mach/camera.h create mode 100644 drivers/media/video/mv_camera.c diff --git a/arch/arm/mach-mmp/include/mach/camera.h b/arch/arm/mach-mmp/include/mach/camera.h new file mode 100644 index 000..b008f3f --- /dev/null +++ b/arch/arm/mach-mmp/include/mach/camera.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2011, Marvell International Ltd. + * Kassey Lee y...@marvell.com + * Angela Wan j...@marvell.com + * Lei Wen lei...@marvell.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#ifndef __ASM_ARCH_CAMERA_H__ +#define __ASM_ARCH_CAMERA_H__ + +#define MAX_CAM_CLK 3 +struct mv_cam_pdata { + struct clk *clk[MAX_CAM_CLK]; + char *name; + int clk_enabled; None of the above fields seem to be used + int dphy[3]; + int bus_type; Hm, you're running a bit ahead of time with this one;) SOCAM_MIPI is _not_ a bus-type, but yes, I'm thinking about adding a bus_type field to struct soc_camera_device, in fact, I've been doing that just a couple of hours before reviewing this code:) So far I forsee having 3 bus-types: normal PARALLEL, BT656 and MIPI_CSI2, sounds reasonable? Even though I don't think we explicitly support BT656 anywhere in soc-camera yet. + int dma_burst; + int qos_req_min; Unused? + int mclk_min; + int mclk_src; + int (*clk_init) (struct device *dev, int init); + void (*set_clock) (struct device *dev, int on); + int (*get_mclk_src) (int src); +}; + +#endif diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 3be180b..3b7a70e 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -891,6 +891,13 @@ config VIDEO_MX3 ---help--- This is a v4l2 driver for the i.MX3x Camera Sensor Interface +config VIDEO_MV Maybe choose a more specific name? Either with CCIC or with PXA910 in it - whatever you feel is more appropriate. Same holds for the filename and, ideally, for the whole used namespace. We hope this is not the last V4L2 driver from Marvell:-) + tristate Marvell CMOS Camera Interface Controller driver + depends on VIDEO_DEV CPU_PXA910 SOC_CAMERA + select VIDEOBUF2_DMA_CONTIG + ---help--- + This is a v4l2 driver for the Marvell CCIC Interface + config VIDEO_PXA27x tristate PXA27x Quick Capture Interface driver depends on VIDEO_DEV PXA27x SOC_CAMERA diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 9519160..373b706 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -161,6 +161,7 @@ obj-$(CONFIG_SOC_CAMERA_PLATFORM) += soc_camera_platform.o obj-$(CONFIG_VIDEO_MX1) += mx1_camera.o obj-$(CONFIG_VIDEO_MX2) += mx2_camera.o obj-$(CONFIG_VIDEO_MX3) += mx3_camera.o +obj-$(CONFIG_VIDEO_MV) += mv_camera.o obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o obj-$(CONFIG_VIDEO_SH_MOBILE_CSI2) += sh_mobile_csi2.o obj-$(CONFIG_VIDEO_SH_MOBILE_CEU)+= sh_mobile_ceu_camera.o diff --git a/drivers/media/video/mv_camera.c b/drivers/media/video/mv_camera.c new file mode 100644 index 000..1a8f73e --- /dev/null +++ b/drivers/media/video/mv_camera.c @@ -0,0 +1,1120 @@ +/* + * V4L2 Driver for Marvell Mobile SoC PXA910 CCIC + * (CMOS Capture Interface Controller) + * + * Copyright (C) 2011, Marvell International Ltd. + * Kassey Lee y...@marvell.com + * Angela Wan j...@marvell.com + * Lei Wen lei...@marvell.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#include linux/init.h +#include linux/module.h +#include linux/io.h +#include linux/delay.h +#include linux/dma-mapping.h +#include linux/errno.h +#include linux/fs.h +#include linux/interrupt.h +#include linux/kernel.h +#include linux/mm.h
[PATCH] V4L/DVB: v4l: Add driver for Marvell PXA910 CCIC
This driver exports a video device node per each CCIC (CMOS Camera Interface Controller) device contained in Marvell Mobile PXA910 SoC The driver is based on v4l2-mem2mem framework, and only USERPTR is supported. Signed-off-by: Kassey Lee y...@marvell.com --- arch/arm/mach-mmp/include/mach/camera.h | 33 + drivers/media/video/Kconfig |7 + drivers/media/video/Makefile|1 + drivers/media/video/mv_camera.c | 1120 +++ 4 files changed, 1161 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-mmp/include/mach/camera.h create mode 100644 drivers/media/video/mv_camera.c diff --git a/arch/arm/mach-mmp/include/mach/camera.h b/arch/arm/mach-mmp/include/mach/camera.h new file mode 100644 index 000..b008f3f --- /dev/null +++ b/arch/arm/mach-mmp/include/mach/camera.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2011, Marvell International Ltd. + * Kassey Lee y...@marvell.com + * Angela Wan j...@marvell.com + * Lei Wen lei...@marvell.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#ifndef __ASM_ARCH_CAMERA_H__ +#define __ASM_ARCH_CAMERA_H__ + +#define MAX_CAM_CLK 3 +struct mv_cam_pdata { + struct clk *clk[MAX_CAM_CLK]; + char *name; + int clk_enabled; + int dphy[3]; + int bus_type; + int dma_burst; + int qos_req_min; + int mclk_min; + int mclk_src; + int (*clk_init) (struct device *dev, int init); + void (*set_clock) (struct device *dev, int on); + int (*get_mclk_src) (int src); +}; + +#endif diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 3be180b..3b7a70e 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -891,6 +891,13 @@ config VIDEO_MX3 ---help--- This is a v4l2 driver for the i.MX3x Camera Sensor Interface +config VIDEO_MV + tristate Marvell CMOS Camera Interface Controller driver + depends on VIDEO_DEV CPU_PXA910 SOC_CAMERA + select VIDEOBUF2_DMA_CONTIG + ---help--- + This is a v4l2 driver for the Marvell CCIC Interface + config VIDEO_PXA27x tristate PXA27x Quick Capture Interface driver depends on VIDEO_DEV PXA27x SOC_CAMERA diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 9519160..373b706 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -161,6 +161,7 @@ obj-$(CONFIG_SOC_CAMERA_PLATFORM) += soc_camera_platform.o obj-$(CONFIG_VIDEO_MX1)+= mx1_camera.o obj-$(CONFIG_VIDEO_MX2)+= mx2_camera.o obj-$(CONFIG_VIDEO_MX3)+= mx3_camera.o +obj-$(CONFIG_VIDEO_MV) += mv_camera.o obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o obj-$(CONFIG_VIDEO_SH_MOBILE_CSI2) += sh_mobile_csi2.o obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o diff --git a/drivers/media/video/mv_camera.c b/drivers/media/video/mv_camera.c new file mode 100644 index 000..1a8f73e --- /dev/null +++ b/drivers/media/video/mv_camera.c @@ -0,0 +1,1120 @@ +/* + * V4L2 Driver for Marvell Mobile SoC PXA910 CCIC + * (CMOS Capture Interface Controller) + * + * Copyright (C) 2011, Marvell International Ltd. + * Kassey Lee y...@marvell.com + * Angela Wan j...@marvell.com + * Lei Wen lei...@marvell.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#include linux/init.h +#include linux/module.h +#include linux/io.h +#include linux/delay.h +#include linux/dma-mapping.h +#include linux/errno.h +#include linux/fs.h +#include linux/interrupt.h +#include linux/kernel.h +#include linux/mm.h +#include linux/time.h +#include linux/device.h +#include linux/platform_device.h +#include linux/clk.h +#include linux/slab.h +#include linux/videodev2.h + +#include media/v4l2-common.h +#include media/v4l2-dev.h +#include media/videobuf2-dma-contig.h +#include media/soc_camera.h +#include media/soc_mediabus.h + +#include mach/camera.h +#include cafe_ccic-regs.h + +/* Register definition for PXA910 */ + +#define REG_U0BAR 0x0c +#define REG_U1BAR 0x10 +#define REG_U2BAR 0x14 +#define REG_V0BAR 0x18 +#define REG_V1BAR 0x1C +#define REG_V2BAR 0x20 + +/* for MIPI enable */ +#define REG_CSI2_CTRL0 0x100 +#define REG_CSI2_DPHY0 0x120 +#define REG_CSI2_DPHY1 0x124 +#define REG_CSI2_DPHY2 0x128 +#define REG_CSI2_DPHY3 0x12c +#define REG_CSI2_DPHY4 0x130 +#define REG_CSI2_DPHY5 0x134 +#define REG_CSI2_DPHY6 0x138 +/*