Re: [PATCH] RFC: mx27: Add soc_camera support

2010-02-04 Thread Baruch Siach
Hi Alan,

On Tue, Dec 15, 2009 at 12:07:43PM -0200, Alan Carvalho de Assis wrote:
 Please note: I just get it compiling and loaded correctly on the
 mainline kernel.
 
 If you have a board powered by i.MX27 and with a camera supported by
 soc_camera driver, I will be glad case you can do a try.

I'm now in the process of making this driver work on i.MX25. The CSI hardware 
of the i.MX25 is very similar to the i.MX27 one. If you have any updates for 
this driver please let me know.

baruch

-- 
 ~. .~   Tk Open Systems
=}ooO--U--Ooo{=
   - bar...@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
--
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] RFC: mx27: Add soc_camera support

2010-01-14 Thread Alan Carvalho de Assis
Hi Javier,

On 1/14/10, javier Martin javier.mar...@vista-silicon.com wrote:
 No idea what can be causing this. Maybe I2C address is bad in board specific
 code?


I don't know, I will check carefully.

 Linux video capture interface: v2.00
 write: -5
 MT9T31 Read register 0xFF = -5
 Forcing mt9t031_video_probe to return OK!
 mx27-camera mx27-camera.0: initialising
 mx27-camera: probe of mx27-camera.0 failed with error -2


 As far as I know, video buffers are allocated in probe() function. Maybe you
 have a memory fragmentation problem and you need to move buffer allocation
 to init().
 We have faced this problem many times in the past.


Hmm, great Javier, in fact it could be the issue!

Thank you very much.

Best Regards,

Alan
--
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] RFC: mx27: Add soc_camera support

2010-01-13 Thread Alan Carvalho de Assis
Hi Javier,

On 1/4/10, javier Martin javier.mar...@vista-silicon.com wrote:
 2010/1/4 javier Martin javier.mar...@vista-silicon.com



 2010/1/4 Alan Carvalho de Assis acas...@gmail.com

 Hi Javier,

 On 1/4/10, javier Martin javier.mar...@vista-silicon.com wrote:
  Alan,
  please, could you point me against which kernel version did you exactly
 test
  this patch?

 It applies on current kernel from
 git.pengutronix.de/git/imx/linux-2.6.git

 Thank you for your feedback Alan.

  Also it would be fine to know which video sensor did you use.
 

 I'm planning to use an OV2640 camera.

 Does this mean that this patch you are sending has been only
 compile-tested?


 Argh, sorry, you pointed this in your previous mail.

 Too bad we don't have any sensor available currently in mainline to do a
 fast test.


Unfortunately my camera is not responding to I2C commands, I already
slow it down to 10kbps with no success. I can see on oscilloscope
i.MX27 send I2C commands, but the camera doesn't respond to it.

Then I tested using the MT9T31 driver and change the it to my I2C
commands, as I2C is failing I force the probe to return 0. But the
soc_camera still failing:

Linux video capture interface: v2.00
write: -5
MT9T31 Read register 0xFF = -5
Forcing mt9t031_video_probe to return OK!
mx27-camera mx27-camera.0: initialising
mx27-camera: probe of mx27-camera.0 failed with error -2

Best Regards,

Alan
--
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] RFC: mx27: Add soc_camera support

2010-01-04 Thread Alan Carvalho de Assis
Hi Javier,

On 1/4/10, javier Martin javier.mar...@vista-silicon.com wrote:
 Alan,
 please, could you point me against which kernel version did you exactly test
 this patch?

It applies on current kernel from git.pengutronix.de/git/imx/linux-2.6.git

 Also it would be fine to know which video sensor did you use.


I'm planning to use an OV2640 camera.

 We are planning to improve this if it works.


Yes, this is the idea :)

 Thank you.


You are welcome,

Alan
--
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] RFC: mx27: Add soc_camera support

2009-12-15 Thread Alan Carvalho de Assis
This is the soc_camera support developed by Sascha Hauer.
I just modified original driver to get it working on recent kernel.

Signed-off-by: Alan Carvalho de Assis acas...@gmail.com
---
 arch/arm/mach-mx2/clock_imx27.c  |2 +-
 arch/arm/mach-mx2/devices.c  |   32 +
 arch/arm/mach-mx2/devices.h  |1 +
 arch/arm/plat-mxc/include/mach/imx_cam.h |   47 ++
 drivers/media/video/Kconfig  |   13 +
 drivers/media/video/Makefile |3 +
 drivers/media/video/mx27_camera.c| 1224 ++
 7 files changed, 1321 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/plat-mxc/include/mach/imx_cam.h
 create mode 100644 drivers/media/video/mx27_camera.c

diff --git a/arch/arm/mach-mx2/clock_imx27.c b/arch/arm/mach-mx2/clock_imx27.c
index b010bf9..1ad0408 100644
--- a/arch/arm/mach-mx2/clock_imx27.c
+++ b/arch/arm/mach-mx2/clock_imx27.c
@@ -642,7 +642,7 @@ static struct clk_lookup lookups[] = {
_REGISTER_CLOCK(spi_imx.1, NULL, cspi2_clk)
_REGISTER_CLOCK(spi_imx.2, NULL, cspi3_clk)
_REGISTER_CLOCK(imx-fb.0, NULL, lcdc_clk)
-   _REGISTER_CLOCK(NULL, csi, csi_clk)
+   _REGISTER_CLOCK(mx27-camera.0, NULL, csi_clk)
_REGISTER_CLOCK(fsl-usb2-udc, usb, usb_clk)
_REGISTER_CLOCK(fsl-usb2-udc, usb_ahb, usb_clk1)
_REGISTER_CLOCK(mxc-ehci.0, usb, usb_clk)
diff --git a/arch/arm/mach-mx2/devices.c b/arch/arm/mach-mx2/devices.c
index 3d398ce..d47ea55 100644
--- a/arch/arm/mach-mx2/devices.c
+++ b/arch/arm/mach-mx2/devices.c
@@ -31,6 +31,7 @@
 #include linux/init.h
 #include linux/platform_device.h
 #include linux/gpio.h
+#include linux/dma-mapping.h
 
 #include mach/irqs.h
 #include mach/hardware.h
@@ -39,6 +40,37 @@
 
 #include devices.h
 
+#ifdef CONFIG_MACH_MX27
+static struct resource mx27_camera_resources[] = {
+   {
+  .start = CSI_BASE_ADDR,
+  .end = CSI_BASE_ADDR + 0x1f,
+  .flags = IORESOURCE_MEM,
+   }, {
+  .start = EMMA_PRP_BASE_ADDR,
+  .end = EMMA_PRP_BASE_ADDR + 0x1f,
+  .flags = IORESOURCE_MEM,
+   }, {
+  .start = MXC_INT_CSI,
+  .end = MXC_INT_CSI,
+  .flags = IORESOURCE_IRQ,
+   },{
+  .start = MXC_INT_EMMAPRP,
+  .end = MXC_INT_EMMAPRP,
+  .flags = IORESOURCE_IRQ,
+   },
+};
+struct platform_device mx27_camera_device = {
+   .name = mx27-camera,
+   .id = 0,
+   .num_resources = ARRAY_SIZE(mx27_camera_resources),
+   .resource = mx27_camera_resources,
+   .dev = {
+   .coherent_dma_mask = 0x,
+   },
+};
+#endif
+
 /*
  * SPI master controller
  *
diff --git a/arch/arm/mach-mx2/devices.h b/arch/arm/mach-mx2/devices.h
index 97306aa..58ce4dc 100644
--- a/arch/arm/mach-mx2/devices.h
+++ b/arch/arm/mach-mx2/devices.h
@@ -20,6 +20,7 @@ extern struct platform_device mxc_i2c_device1;
 extern struct platform_device mxc_sdhc_device0;
 extern struct platform_device mxc_sdhc_device1;
 extern struct platform_device mxc_otg_udc_device;
+extern struct platform_device mx27_camera_device;
 extern struct platform_device mxc_otg_host;
 extern struct platform_device mxc_usbh1;
 extern struct platform_device mxc_usbh2;
diff --git a/arch/arm/plat-mxc/include/mach/imx_cam.h 
b/arch/arm/plat-mxc/include/mach/imx_cam.h
new file mode 100644
index 000..2d704ae
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/imx_cam.h
@@ -0,0 +1,47 @@
+/*
+imx-cam.h - i.MX27 camera driver header file
+
+Copyright (C) 2003, Intel Corporation
+Copyright (C) 2008, Sascha Hauer s.ha...@pengutronix.de
+
+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.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __ASM_ARCH_CAMERA_H_
+#define __ASM_ARCH_CAMERA_H_
+
+#define MX27_CAMERA_SWAP16 (1  0)
+#define MX27_CAMERA_EXT_VSYNC  (1  1)
+#define MX27_CAMERA_CCIR   (1  2)
+#define MX27_CAMERA_CCIR_INTERLACE (1  3)
+#define MX27_CAMERA_HSYNC_HIGH (1  4)
+#define MX27_CAMERA_GATED_CLOCK(1  5)
+#define MX27_CAMERA_INV_DATA   (1  6)
+#define MX27_CAMERA_PCLK_SAMPLE_RISING (1  7)
+#define MX27_CAMERA_PACK_DIR_MSB   (1  8)
+
+struct mx27_camera_platform_data {
+   int (*init)(struct platform_device *);
+   int 

Re: [PATCH] RFC: mx27: Add soc_camera support

2009-12-15 Thread Alan Carvalho de Assis
Please note: I just get it compiling and loaded correctly on the
mainline kernel.

If you have a board powered by i.MX27 and with a camera supported by
soc_camera driver, I will be glad case you can do a try.

On 12/15/09, Alan Carvalho de Assis acas...@gmail.com wrote:
 This is the soc_camera support developed by Sascha Hauer.
 I just modified original driver to get it working on recent kernel.

 Signed-off-by: Alan Carvalho de Assis acas...@gmail.com
 ---
  arch/arm/mach-mx2/clock_imx27.c  |2 +-
  arch/arm/mach-mx2/devices.c  |   32 +
  arch/arm/mach-mx2/devices.h  |1 +
  arch/arm/plat-mxc/include/mach/imx_cam.h |   47 ++
  drivers/media/video/Kconfig  |   13 +
  drivers/media/video/Makefile |3 +
  drivers/media/video/mx27_camera.c| 1224
 ++
  7 files changed, 1321 insertions(+), 1 deletions(-)
  create mode 100644 arch/arm/plat-mxc/include/mach/imx_cam.h
  create mode 100644 drivers/media/video/mx27_camera.c

 diff --git a/arch/arm/mach-mx2/clock_imx27.c
 b/arch/arm/mach-mx2/clock_imx27.c
 index b010bf9..1ad0408 100644
 --- a/arch/arm/mach-mx2/clock_imx27.c
 +++ b/arch/arm/mach-mx2/clock_imx27.c
 @@ -642,7 +642,7 @@ static struct clk_lookup lookups[] = {
   _REGISTER_CLOCK(spi_imx.1, NULL, cspi2_clk)
   _REGISTER_CLOCK(spi_imx.2, NULL, cspi3_clk)
   _REGISTER_CLOCK(imx-fb.0, NULL, lcdc_clk)
 - _REGISTER_CLOCK(NULL, csi, csi_clk)
 + _REGISTER_CLOCK(mx27-camera.0, NULL, csi_clk)
   _REGISTER_CLOCK(fsl-usb2-udc, usb, usb_clk)
   _REGISTER_CLOCK(fsl-usb2-udc, usb_ahb, usb_clk1)
   _REGISTER_CLOCK(mxc-ehci.0, usb, usb_clk)
 diff --git a/arch/arm/mach-mx2/devices.c b/arch/arm/mach-mx2/devices.c
 index 3d398ce..d47ea55 100644
 --- a/arch/arm/mach-mx2/devices.c
 +++ b/arch/arm/mach-mx2/devices.c
 @@ -31,6 +31,7 @@
  #include linux/init.h
  #include linux/platform_device.h
  #include linux/gpio.h
 +#include linux/dma-mapping.h

  #include mach/irqs.h
  #include mach/hardware.h
 @@ -39,6 +40,37 @@

  #include devices.h

 +#ifdef CONFIG_MACH_MX27
 +static struct resource mx27_camera_resources[] = {
 + {
 +.start = CSI_BASE_ADDR,
 +.end = CSI_BASE_ADDR + 0x1f,
 +.flags = IORESOURCE_MEM,
 + }, {
 +.start = EMMA_PRP_BASE_ADDR,
 +.end = EMMA_PRP_BASE_ADDR + 0x1f,
 +.flags = IORESOURCE_MEM,
 + }, {
 +.start = MXC_INT_CSI,
 +.end = MXC_INT_CSI,
 +.flags = IORESOURCE_IRQ,
 + },{
 +.start = MXC_INT_EMMAPRP,
 +.end = MXC_INT_EMMAPRP,
 +.flags = IORESOURCE_IRQ,
 + },
 +};
 +struct platform_device mx27_camera_device = {
 + .name = mx27-camera,
 + .id = 0,
 + .num_resources = ARRAY_SIZE(mx27_camera_resources),
 + .resource = mx27_camera_resources,
 + .dev = {
 + .coherent_dma_mask = 0x,
 + },
 +};
 +#endif
 +
  /*
   * SPI master controller
   *
 diff --git a/arch/arm/mach-mx2/devices.h b/arch/arm/mach-mx2/devices.h
 index 97306aa..58ce4dc 100644
 --- a/arch/arm/mach-mx2/devices.h
 +++ b/arch/arm/mach-mx2/devices.h
 @@ -20,6 +20,7 @@ extern struct platform_device mxc_i2c_device1;
  extern struct platform_device mxc_sdhc_device0;
  extern struct platform_device mxc_sdhc_device1;
  extern struct platform_device mxc_otg_udc_device;
 +extern struct platform_device mx27_camera_device;
  extern struct platform_device mxc_otg_host;
  extern struct platform_device mxc_usbh1;
  extern struct platform_device mxc_usbh2;
 diff --git a/arch/arm/plat-mxc/include/mach/imx_cam.h
 b/arch/arm/plat-mxc/include/mach/imx_cam.h
 new file mode 100644
 index 000..2d704ae
 --- /dev/null
 +++ b/arch/arm/plat-mxc/include/mach/imx_cam.h
 @@ -0,0 +1,47 @@
 +/*
 +imx-cam.h - i.MX27 camera driver header file
 +
 +Copyright (C) 2003, Intel Corporation
 +Copyright (C) 2008, Sascha Hauer s.ha...@pengutronix.de
 +
 +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.
 +
 +This program is distributed in the hope that it will be useful,
 +but WITHOUT ANY WARRANTY; without even the implied warranty of
 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +GNU General Public License for more details.
 +
 +You should have received a copy of the GNU General Public License
 +along with this program; if not, write to the Free Software
 +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 +*/
 +
 +#ifndef __ASM_ARCH_CAMERA_H_
 +#define __ASM_ARCH_CAMERA_H_
 +
 +#define MX27_CAMERA_SWAP16   (1  0)
 +#define MX27_CAMERA_EXT_VSYNC(1  1)
 +#define MX27_CAMERA_CCIR (1  2)
 +#define MX27_CAMERA_CCIR_INTERLACE   (1  3)
 +#define