linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: mx25_3ds: Add camera support
@ 2012-11-27 13:21 Fabio Estevam
  2012-11-28  6:05 ` Baruch Siach
  0 siblings, 1 reply; 6+ messages in thread
From: Fabio Estevam @ 2012-11-27 13:21 UTC (permalink / raw)
  To: linux-arm-kernel

mx25_3ds board has a OV2640 camera sensor.

Add support for it.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 arch/arm/mach-imx/mach-mx25_3ds.c |   85 +++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/arch/arm/mach-imx/mach-mx25_3ds.c b/arch/arm/mach-imx/mach-mx25_3ds.c
index b1b03aa..ae25f01 100644
--- a/arch/arm/mach-imx/mach-mx25_3ds.c
+++ b/arch/arm/mach-imx/mach-mx25_3ds.c
@@ -37,6 +37,8 @@
 #include <asm/memory.h>
 #include <asm/mach/map.h>
 
+#include <media/soc_camera.h>
+
 #include "common.h"
 #include "devices-imx25.h"
 #include "hardware.h"
@@ -115,12 +117,85 @@ static iomux_v3_cfg_t mx25pdk_pads[] = {
 	MX25_PAD_GPIO_A__CAN1_TX,
 	MX25_PAD_GPIO_B__CAN1_RX,
 	MX25_PAD_D14__GPIO_4_6,	/* CAN_PWDN */
+
+	/* CSI */
+	MX25_PAD_CSI_D2__CSI_D2,
+	MX25_PAD_CSI_D3__CSI_D3,
+	MX25_PAD_CSI_D4__CSI_D4,
+	MX25_PAD_CSI_D5__CSI_D5,
+	MX25_PAD_CSI_D6__CSI_D6,
+	MX25_PAD_CSI_D7__CSI_D7,
+	MX25_PAD_CSI_D8__CSI_D8,
+	MX25_PAD_CSI_D9__CSI_D9,
+	MX25_PAD_CSI_HSYNC__CSI_HSYNC,
+	MX25_PAD_CSI_MCLK__CSI_MCLK,
+	MX25_PAD_CSI_PIXCLK__CSI_PIXCLK,
+	MX25_PAD_CSI_VSYNC__CSI_VSYNC,
+	MX25_PAD_A19__GPIO_2_5,		/* CSI_PWDN */
+	MX25_PAD_A20__GPIO_2_6,		/* CMOS_RESET_B */
+};
+
+#define MX25_3DS_GPIO_CAMERA_PW	IMX_GPIO_NR(2, 5)
+#define MX25_3DS_GPIO_CAMERA_RST	IMX_GPIO_NR(2, 6)
+
+static struct gpio mx25_3ds_camera_gpios[] = {
+	{ MX25_3DS_GPIO_CAMERA_PW, GPIOF_OUT_INIT_HIGH, "camera-power" },
+	{ MX25_3DS_GPIO_CAMERA_RST, GPIOF_OUT_INIT_HIGH, "camera-reset" },
+};
+
+static const struct mx2_camera_platform_data mx25pdk_camera_pdata = {
+	.flags =  MX2_CAMERA_HSYNC_HIGH |
+		  MX2_CAMERA_GATED_CLOCK |
+		  MX2_CAMERA_PCLK_SAMPLE_RISING,
+	.clk = 13000000,
 };
 
 static const struct fec_platform_data mx25_fec_pdata __initconst = {
 	.phy    = PHY_INTERFACE_MODE_RMII,
 };
 
+static int mx25_3ds_camera_power(struct device *dev, int on)
+{
+	gpio_set_value(MX25_3DS_GPIO_CAMERA_PW, on ? 0 : 1);
+
+	if (!on)
+		goto out;
+
+	/* If enabled, give a reset impulse */
+	gpio_set_value(MX25_3DS_GPIO_CAMERA_RST, 0);
+	msleep(20);
+	gpio_set_value(MX25_3DS_GPIO_CAMERA_RST, 1);
+	msleep(100);
+
+out:
+	return 0;
+}
+
+static struct i2c_board_info mx25_3ds_i2c_camera = {
+	I2C_BOARD_INFO("ov2640", 0x30),
+};
+
+static struct soc_camera_link iclink_ov2640 = {
+	.bus_id		= 0,
+	.board_info	= &mx25_3ds_i2c_camera,
+	.i2c_adapter_id	= 0,
+	.power		= mx25_3ds_camera_power,
+	.regulators	= NULL,
+	.num_regulators	= 0,
+};
+
+static struct platform_device mx25_3ds_ov2640 = {
+	.name	= "soc-camera-pdrv",
+	.id	= 0,
+	.dev	= {
+		.platform_data = &iclink_ov2640,
+	},
+};
+
+static struct platform_device *devices[] __initdata = {
+	&mx25_3ds_ov2640,
+};
+
 #define FEC_ENABLE_GPIO		IMX_GPIO_NR(2, 3)
 #define FEC_RESET_B_GPIO	IMX_GPIO_NR(4, 8)
 
@@ -250,6 +325,16 @@ static void __init mx25pdk_init(void)
 
 	gpio_request_one(MX25PDK_CAN_PWDN, GPIOF_OUT_INIT_LOW, "can-pwdn");
 	imx25_add_flexcan0(NULL);
+
+	platform_add_devices(devices, ARRAY_SIZE(devices));
+
+	/* CSI */
+	if (gpio_request_array(mx25_3ds_camera_gpios,
+			       ARRAY_SIZE(mx25_3ds_camera_gpios))) {
+		pr_err("Failed to request camera gpios");
+		iclink_ov2640.power = NULL;
+	} else
+		imx25_add_mx2_camera(&mx25pdk_camera_pdata);
 }
 
 static void __init mx25pdk_timer_init(void)
-- 
1.7.9.5

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

* [PATCH] ARM: mx25_3ds: Add camera support
  2012-11-27 13:21 [PATCH] ARM: mx25_3ds: Add camera support Fabio Estevam
@ 2012-11-28  6:05 ` Baruch Siach
  2012-11-29 12:38   ` Fabio Estevam
  0 siblings, 1 reply; 6+ messages in thread
From: Baruch Siach @ 2012-11-28  6:05 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Fabio,

On Tue, Nov 27, 2012 at 11:21:49AM -0200, Fabio Estevam wrote:
> mx25_3ds board has a OV2640 camera sensor.
> 
> Add support for it.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Good to see some activity on i.MX25 camera support. Did you test video capture 
with a latest kernel?  You have surely noticed that i.MX25 support in the 
mx2_camera driver is marked BROKEN since 087c78a8.

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

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

* [PATCH] ARM: mx25_3ds: Add camera support
  2012-11-28  6:05 ` Baruch Siach
@ 2012-11-29 12:38   ` Fabio Estevam
  2012-11-29 12:43     ` Baruch Siach
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Fabio Estevam @ 2012-11-29 12:38 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Baruch,

On Wed, Nov 28, 2012 at 4:05 AM, Baruch Siach <baruch@tkos.co.il> wrote:

> Good to see some activity on i.MX25 camera support. Did you test video capture
> with a latest kernel?  You have surely noticed that i.MX25 support in the
> mx2_camera driver is marked BROKEN since 087c78a8.

I basically checked that mx2_camera can be probed:

soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0
mx2-camera imx25-camera.0: Camera driver attached to camera 0
ov2640 0-0030: ov2640 Product ID 26:42 Manufacturer ID 7f:a2
i2c i2c-0: OV2640 Probed
mx2-camera imx25-camera.0: Camera driver detached from camera 0
mx2-camera imx25-camera.0: MX2 Camera (CSI) driver probed, clock
frequency: 22166666

Tried a Gstreamer pipeline but it is failing, but this Gstreamer issue
is not mx25 related as I saw the same issue with mx27/mx31.

Do you still have access to a mx25pdk?

I will try v4l-utils when I get a chance.

Regards,

Fabio Estevam

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

* [PATCH] ARM: mx25_3ds: Add camera support
  2012-11-29 12:38   ` Fabio Estevam
@ 2012-11-29 12:43     ` Baruch Siach
  2012-11-29 13:02     ` Guennadi Liakhovetski
  2013-01-02 12:26     ` Guennadi Liakhovetski
  2 siblings, 0 replies; 6+ messages in thread
From: Baruch Siach @ 2012-11-29 12:43 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Fabio,

On Thu, Nov 29, 2012 at 10:38:36AM -0200, Fabio Estevam wrote:
> On Wed, Nov 28, 2012 at 4:05 AM, Baruch Siach <baruch@tkos.co.il> wrote:
> 
> > Good to see some activity on i.MX25 camera support. Did you test video capture
> > with a latest kernel?  You have surely noticed that i.MX25 support in the
> > mx2_camera driver is marked BROKEN since 087c78a8.
> 
> I basically checked that mx2_camera can be probed:
> 
> soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0
> mx2-camera imx25-camera.0: Camera driver attached to camera 0
> ov2640 0-0030: ov2640 Product ID 26:42 Manufacturer ID 7f:a2
> i2c i2c-0: OV2640 Probed
> mx2-camera imx25-camera.0: Camera driver detached from camera 0
> mx2-camera imx25-camera.0: MX2 Camera (CSI) driver probed, clock
> frequency: 22166666
> 
> Tried a Gstreamer pipeline but it is failing, but this Gstreamer issue
> is not mx25 related as I saw the same issue with mx27/mx31.
> 
> Do you still have access to a mx25pdk?

Not anymore, unfortunately.

> I will try v4l-utils when I get a chance.

Thanks. Keep me posted.

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

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

* [PATCH] ARM: mx25_3ds: Add camera support
  2012-11-29 12:38   ` Fabio Estevam
  2012-11-29 12:43     ` Baruch Siach
@ 2012-11-29 13:02     ` Guennadi Liakhovetski
  2013-01-02 12:26     ` Guennadi Liakhovetski
  2 siblings, 0 replies; 6+ messages in thread
From: Guennadi Liakhovetski @ 2012-11-29 13:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 29 Nov 2012, Fabio Estevam wrote:

> Hi Baruch,
> 
> On Wed, Nov 28, 2012 at 4:05 AM, Baruch Siach <baruch@tkos.co.il> wrote:
> 
> > Good to see some activity on i.MX25 camera support. Did you test video capture
> > with a latest kernel?  You have surely noticed that i.MX25 support in the
> > mx2_camera driver is marked BROKEN since 087c78a8.
> 
> I basically checked that mx2_camera can be probed:
> 
> soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0
> mx2-camera imx25-camera.0: Camera driver attached to camera 0
> ov2640 0-0030: ov2640 Product ID 26:42 Manufacturer ID 7f:a2
> i2c i2c-0: OV2640 Probed
> mx2-camera imx25-camera.0: Camera driver detached from camera 0
> mx2-camera imx25-camera.0: MX2 Camera (CSI) driver probed, clock
> frequency: 22166666
> 
> Tried a Gstreamer pipeline but it is failing, but this Gstreamer issue
> is not mx25 related as I saw the same issue with mx27/mx31.

Can you try mplayer?

Thanks
Guennadi

> Do you still have access to a mx25pdk?
> 
> I will try v4l-utils when I get a chance.
> 
> Regards,
> 
> Fabio Estevam
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

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

* [PATCH] ARM: mx25_3ds: Add camera support
  2012-11-29 12:38   ` Fabio Estevam
  2012-11-29 12:43     ` Baruch Siach
  2012-11-29 13:02     ` Guennadi Liakhovetski
@ 2013-01-02 12:26     ` Guennadi Liakhovetski
  2 siblings, 0 replies; 6+ messages in thread
From: Guennadi Liakhovetski @ 2013-01-02 12:26 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Fabio

On Thu, 29 Nov 2012, Fabio Estevam wrote:

> Hi Baruch,
> 
> On Wed, Nov 28, 2012 at 4:05 AM, Baruch Siach <baruch@tkos.co.il> wrote:
> 
> > Good to see some activity on i.MX25 camera support. Did you test video capture
> > with a latest kernel?  You have surely noticed that i.MX25 support in the
> > mx2_camera driver is marked BROKEN since 087c78a8.
> 
> I basically checked that mx2_camera can be probed:
> 
> soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0
> mx2-camera imx25-camera.0: Camera driver attached to camera 0
> ov2640 0-0030: ov2640 Product ID 26:42 Manufacturer ID 7f:a2
> i2c i2c-0: OV2640 Probed
> mx2-camera imx25-camera.0: Camera driver detached from camera 0
> mx2-camera imx25-camera.0: MX2 Camera (CSI) driver probed, clock
> frequency: 22166666
> 
> Tried a Gstreamer pipeline but it is failing, but this Gstreamer issue
> is not mx25 related as I saw the same issue with mx27/mx31.
> 
> Do you still have access to a mx25pdk?
> 
> I will try v4l-utils when I get a chance.

So, what's the real status of mx25 camera? Is it really working or only 
probing? As you certainly understand, successful probing is by no means a 
sufficient indication of a driver being functional.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

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

end of thread, other threads:[~2013-01-02 12:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-27 13:21 [PATCH] ARM: mx25_3ds: Add camera support Fabio Estevam
2012-11-28  6:05 ` Baruch Siach
2012-11-29 12:38   ` Fabio Estevam
2012-11-29 12:43     ` Baruch Siach
2012-11-29 13:02     ` Guennadi Liakhovetski
2013-01-02 12:26     ` Guennadi Liakhovetski

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).