linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i.MX35-PDK: Add Camera support
@ 2012-03-12 16:28 Alex
  2012-03-13 13:33 ` Sascha Hauer
  2012-03-13 13:37 ` Fabio Estevam
  0 siblings, 2 replies; 5+ messages in thread
From: Alex @ 2012-03-12 16:28 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: linux-kernel, g.liakhovetski, fabio.estevam, linux-media, Alex

In i.MX35-PDK, OV2640  camera is populated on the
personality board. This camera is registered as a subdevice via soc-camera interface.

Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
---
 arch/arm/mach-imx/mach-mx35_3ds.c |   87 +++++++++++++++++++++++++++++++++++++
 1 files changed, 87 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c
index a477e46..55f5b0a 100644
--- a/arch/arm/mach-imx/mach-mx35_3ds.c
+++ b/arch/arm/mach-imx/mach-mx35_3ds.c
@@ -35,6 +35,8 @@
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
 
+#include <asm/memblock.h>
+
 #include <mach/hardware.h>
 #include <mach/common.h>
 #include <mach/iomux-mx35.h>
@@ -43,6 +45,8 @@
 
 #include "devices-imx35.h"
 
+#include <media/soc_camera.h>
+
 #define EXPIO_PARENT_INT	gpio_to_irq(IMX_GPIO_NR(1, 1))
 
 static const struct imxuart_platform_data uart_pdata __initconst = {
@@ -145,6 +149,21 @@ static iomux_v3_cfg_t mx35pdk_pads[] = {
 	MX35_PAD_CONTRAST__IPU_DISPB_CONTR,
 	MX35_PAD_D3_REV__IPU_DISPB_D3_REV,
 	MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS,
+	/* CSI */
+	MX35_PAD_TX1__IPU_CSI_D_6,
+	MX35_PAD_TX0__IPU_CSI_D_7,
+	MX35_PAD_CSI_D8__IPU_CSI_D_8,
+	MX35_PAD_CSI_D9__IPU_CSI_D_9,
+	MX35_PAD_CSI_D10__IPU_CSI_D_10,
+	MX35_PAD_CSI_D11__IPU_CSI_D_11,
+	MX35_PAD_CSI_D12__IPU_CSI_D_12,
+	MX35_PAD_CSI_D13__IPU_CSI_D_13,
+	MX35_PAD_CSI_D14__IPU_CSI_D_14,
+	MX35_PAD_CSI_D15__IPU_CSI_D_15,
+	MX35_PAD_CSI_HSYNC__IPU_CSI_HSYNC,
+	MX35_PAD_CSI_MCLK__IPU_CSI_MCLK,
+	MX35_PAD_CSI_PIXCLK__IPU_CSI_PIXCLK,
+	MX35_PAD_CSI_VSYNC__IPU_CSI_VSYNC,
 };
 
 static const struct fb_videomode fb_modedb[] = {
@@ -177,6 +196,64 @@ static struct mx3fb_platform_data mx3fb_pdata __initdata = {
 	.num_modes	= ARRAY_SIZE(fb_modedb),
 };
 
+/*
+ * Camera support
+ */
+static phys_addr_t mx3_camera_base __initdata;
+#define MX35_3DS_CAMERA_BUF_SIZE SZ_8M
+
+static const struct mx3_camera_pdata mx35_3ds_camera_pdata __initconst = {
+	.flags = MX3_CAMERA_DATAWIDTH_8,
+	.mclk_10khz = 2000,
+};
+
+static int __init imx35_3ds_init_camera(void)
+{
+	int dma, ret = -ENOMEM;
+	struct platform_device *pdev =
+		imx35_alloc_mx3_camera(&mx35_3ds_camera_pdata);
+
+	if (IS_ERR(pdev))
+		return PTR_ERR(pdev);
+
+	if (!mx3_camera_base)
+		goto err;
+
+	dma = dma_declare_coherent_memory(&pdev->dev,
+					mx3_camera_base, mx3_camera_base,
+					MX35_3DS_CAMERA_BUF_SIZE,
+					DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
+
+	if (!(dma & DMA_MEMORY_MAP))
+		goto err;
+
+	ret = platform_device_add(pdev);
+	if (ret)
+err:
+		platform_device_put(pdev);
+
+	return ret;
+}
+
+static struct i2c_board_info mx35_3ds_i2c_camera = {
+	I2C_BOARD_INFO("ov2640", 0x30),
+};
+
+static struct soc_camera_link iclink_ov2640 = {
+	.bus_id		= 0,
+	.board_info	= &mx35_3ds_i2c_camera,
+	.i2c_adapter_id	= 0,
+	.power		= NULL,
+};
+
+static struct platform_device mx35_3ds_ov2640 = {
+	.name	= "soc-camera-pdrv",
+	.id	= 0,
+	.dev	= {
+		.platform_data = &iclink_ov2640,
+	},
+};
+
 static int mx35_3ds_otg_init(struct platform_device *pdev)
 {
 	return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY);
@@ -261,6 +338,8 @@ static void __init mx35_3ds_init(void)
 	imx35_add_imx_i2c0(&mx35_3ds_i2c0_data);
 	imx35_add_ipu_core(&mx35_3ds_ipu_data);
 	imx35_add_mx3_sdc_fb(&mx3fb_pdata);
+	platform_device_register(&mx35_3ds_ov2640);
+	imx35_3ds_init_camera();
 }
 
 static void __init mx35pdk_timer_init(void)
@@ -272,6 +351,13 @@ struct sys_timer mx35pdk_timer = {
 	.init	= mx35pdk_timer_init,
 };
 
+static void __init mx35_3ds_reserve(void)
+{
+	/* reserve MX35_3DS_CAMERA_BUF_SIZE bytes for mx3-camera */
+	mx3_camera_base = arm_memblock_steal(MX35_3DS_CAMERA_BUF_SIZE,
+					 MX35_3DS_CAMERA_BUF_SIZE);
+}
+
 MACHINE_START(MX35_3DS, "Freescale MX35PDK")
 	/* Maintainer: Freescale Semiconductor, Inc */
 	.atag_offset = 0x100,
@@ -281,5 +367,6 @@ MACHINE_START(MX35_3DS, "Freescale MX35PDK")
 	.handle_irq = imx35_handle_irq,
 	.timer = &mx35pdk_timer,
 	.init_machine = mx35_3ds_init,
+	.reserve = mx35_3ds_reserve,
 	.restart	= mxc_restart,
 MACHINE_END
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] i.MX35-PDK: Add Camera support
  2012-03-12 16:28 [PATCH] i.MX35-PDK: Add Camera support Alex
@ 2012-03-13 13:33 ` Sascha Hauer
  2012-03-13 13:50   ` Alex Gershgorin
  2012-03-13 13:37 ` Fabio Estevam
  1 sibling, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2012-03-13 13:33 UTC (permalink / raw)
  To: Alex; +Cc: linux-kernel, g.liakhovetski, fabio.estevam, linux-media

On Mon, Mar 12, 2012 at 06:28:51PM +0200, Alex wrote:
> In i.MX35-PDK, OV2640  camera is populated on the
> personality board. This camera is registered as a subdevice via soc-camera interface.
> 
> Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
> ---
>  arch/arm/mach-imx/mach-mx35_3ds.c |   87 +++++++++++++++++++++++++++++++++++++
>  1 files changed, 87 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c

This one does not apply as it is obviously based on (an earlier version
of) the framebuffer patches of this board. Please always base your stuff
on some -rc kernel. We can resolve conflicts later upstream, but we
cannot easily apply a patch when we do not have the correct base.

Please add the linux arm kernel mailing list next time.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] i.MX35-PDK: Add Camera support
  2012-03-12 16:28 [PATCH] i.MX35-PDK: Add Camera support Alex
  2012-03-13 13:33 ` Sascha Hauer
@ 2012-03-13 13:37 ` Fabio Estevam
  2012-03-13 14:04   ` Alex Gershgorin
  1 sibling, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2012-03-13 13:37 UTC (permalink / raw)
  To: Alex
  Cc: Sascha Hauer, linux-kernel, g.liakhovetski, fabio.estevam, linux-media

Hi Alex,

On Mon, Mar 12, 2012 at 1:28 PM, Alex <alexg@meprolight.com> wrote:
> In i.MX35-PDK, OV2640  camera is populated on the
> personality board. This camera is registered as a subdevice via soc-camera interface.
>
> Signed-off-by: Alex Gershgorin <alexg@meprolight.com>

Are you able to get the camera working correctly now?

Or are you still facing the issues you reported earlier?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] i.MX35-PDK: Add Camera support
  2012-03-13 13:33 ` Sascha Hauer
@ 2012-03-13 13:50   ` Alex Gershgorin
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Gershgorin @ 2012-03-13 13:50 UTC (permalink / raw)
  To: 'Sascha Hauer'
  Cc: linux-kernel, g.liakhovetski, fabio.estevam, linux-media,
	'linux-arm-kernel@lists.infradead.org'

Hi Sascha,

Thanks for you comments.
 
> In i.MX35-PDK, OV2640  camera is populated on the
> personality board. This camera is registered as a subdevice via soc-camera interface.
> 
> Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
> ---
>  arch/arm/mach-imx/mach-mx35_3ds.c |   87 +++++++++++++++++++++++++++++++++++++
>  1 files changed, 87 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c

> > This one does not apply as it is obviously based on (an earlier version
> > of) the framebuffer patches of this board. Please always base your stuff
> > on some -rc kernel. We can resolve conflicts later upstream, but we
> > cannot easily apply a patch when we do not have the correct base.

> >Please add the linux arm kernel mailing list next time.

Oh what a stupid mistake, I will correct it.

Regards,

Alex Gershgorin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] i.MX35-PDK: Add Camera support
  2012-03-13 13:37 ` Fabio Estevam
@ 2012-03-13 14:04   ` Alex Gershgorin
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Gershgorin @ 2012-03-13 14:04 UTC (permalink / raw)
  To: 'Fabio Estevam'
  Cc: Sascha Hauer, linux-kernel, g.liakhovetski, fabio.estevam,
	linux-media, 'linux-arm-kernel@lists.infradead.org'

Hi Fabio,



On Mon, Mar 12, 2012 at 1:28 PM, Alex <alexg@meprolight.com> wrote:
> In i.MX35-PDK, OV2640  camera is populated on the
> personality board. This camera is registered as a subdevice via soc-camera interface.
>
> Signed-off-by: Alex Gershgorin <alexg@meprolight.com>

> >Are you able to get the camera working correctly now?

> >Or are you still facing the issues you reported earlier?

This problem not solved, I'm still doing testing

Thanks
Alex Gershgorin

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-13 14:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-12 16:28 [PATCH] i.MX35-PDK: Add Camera support Alex
2012-03-13 13:33 ` Sascha Hauer
2012-03-13 13:50   ` Alex Gershgorin
2012-03-13 13:37 ` Fabio Estevam
2012-03-13 14:04   ` Alex Gershgorin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).