Skip to contentSkip to conversation

soc-camera driver for i.MX25

PATCH Arno Euteneuer 2 participants 6 messages Mar 9, 2010 – Apr 20, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hi,
I wrote a soc-camera driver for the i.MX25 which seems to work well on my setup with a monochrome mt9m001 camera chip if I use the full resolution of 10bits x 1280 x 1024 and up to three buffers. However, reducing the frame size to e.g. 640 x 480 leads to corrupted pictures sometimes when using multiple buffers. Using only one buffer for single shots seems to work always. Unfortunately for my application I don't need streaming at all and single shots is all I need, which is why I will have to stop working on this topic soon and focus on my user space problem again. Furthermore I will not be able to test it with other camera chips.
Nevertheless I would like to contribute my work. Maybe somebody is interested or even is able to improve it.
The patch is against kernel 2.6.31 (sorry).

Regards,
Arno

arch/arm/plat-mxc/include/mach/memory.h +10 -0
index 6065e00..5cb9ac1 100644
@@ -22,6 +22,8 @@
 #endif
 #elif defined CONFIG_ARCH_MX3
 #define PHYS_OFFSET		UL(0x80000000)
+#elif defined CONFIG_ARCH_MX25
+#define PHYS_OFFSET		UL(0x80000000)
 #endif
 
 #if defined(CONFIG_MX1_VIDEO)
@@ -40,4 +42,12 @@
 #define CONSISTENT_DMA_SIZE SZ_8M
 #endif /* CONFIG_MX3_VIDEO */
 
+#if defined(CONFIG_MX25_VIDEO)
+/*
+ * Increase size of DMA-consistent memory region.
+ * This is required for mx25 camera driver to capture at least two QXGA frames.
+ */
+#define CONSISTENT_DMA_SIZE SZ_8M
+#endif /* CONFIG_MX25_VIDEO */
+
 #endif /* __ASM_ARCH_MXC_MEMORY_H__ */
arch/arm/plat-mxc/include/mach/mx25_camera.h new file +39 -0
new file mode 100644
index 0000000..3dc3219
@@ -0,0 +1,39 @@
+/*
+ * mx25_camera.h - i.MX25 driver header file
+ * Copyright (C) 2009, Arno Euteneuer <[email protected]>
+ *
+ * Based on i.MXL/i.MXL camera (CSI) host driver
+ * Copyright (c) 2008, Paulius Zaleckas <[email protected]>
+ * Copyright (C) 2009, Darius Augulis <[email protected]>
+ *
+ * Based on PXA camera.h file:
+ * Copyright (C) 2003, Intel Corporation
+ * Copyright (C) 2008, Guennadi Liakhovetski <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __ASM_ARCH_CAMERA_H_
+#define __ASM_ARCH_CAMERA_H_
+
+#define MX25_CAMERA_DATA_HIGH	1
+#define MX25_CAMERA_PCLK_RISING	2
+#define MX25_CAMERA_VSYNC_HIGH	4
+#define MX25_CAMERA_DATAWIDTH_8		8
+#define MX25_CAMERA_DATAWIDTH_10	16
+#define MX25_CAMERA_DATAWIDTH_16	32
+
+
+/**
+ * struct mx1_camera_pdata - i.MX25/i.MXL camera platform data
+ * @mclk_10khz:	master clock frequency in 10kHz units
+ * @flags:	MX25 camera platform flags
+ */
+struct mx25_camera_pdata {
+	unsigned long mclk_10khz;
+	unsigned long flags;
+};
+
+#endif /* __ASM_ARCH_CAMERA_H_ */
drivers/media/video/Kconfig +12 -0
index dcf9fa9..c81285e 100644
@@ -784,6 +784,18 @@ config VIDEO_MX1
 	---help---
 	  This is a v4l2 driver for the i.MX1/i.MXL CMOS Sensor Interface
 
+
+config MX25_VIDEO
+	bool
+
+config VIDEO_MX25
+	tristate "i.MX25 CMOS Sensor Interface driver"
+	depends on VIDEO_DEV && ARCH_MX25 && SOC_CAMERA
+	select VIDEOBUF_DMA_CONTIG
+	select MX25_VIDEO
+	---help---
+	  This is a v4l2 driver for the i.MX25 CMOS Sensor Interface
+
 config MX3_VIDEO
 	bool
 
drivers/media/video/Makefile +1 -0
index 9f2e321..3b992af 100644
@@ -150,6 +150,7 @@ obj-$(CONFIG_SOC_CAMERA)		+= soc_camera.o
 obj-$(CONFIG_SOC_CAMERA_PLATFORM)	+= soc_camera_platform.o
 # soc-camera host drivers have to be linked after camera drivers
 obj-$(CONFIG_VIDEO_MX1)			+= mx1_camera.o
+obj-$(CONFIG_VIDEO_MX25)		+= mx25_camera.o
 obj-$(CONFIG_VIDEO_MX3)			+= mx3_camera.o
 obj-$(CONFIG_VIDEO_PXA27x)		+= pxa_camera.o
 obj-$(CONFIG_VIDEO_SH_MOBILE_CEU)	+= sh_mobile_ceu_camera.o
drivers/media/video/mx25_camera.c new file +925 -0

925 lines not on this page · raw message

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#2 lore raw
In reply to Arno Euteneuer
Quoted 5 lines · Arno Euteneuer

Hi,
I wrote a soc-camera driver for the i.MX25 which seems to work well on my setup with a monochrome mt9m001 camera chip if I use the full resolution of 10bits x 1280 x 1024 and up to three buffers. However, reducing the frame size to e.g. 640 x 480 leads to corrupted pictures sometimes when using multiple

Quoted 8 lines

buffers. Using only one buffer for single shots seems to work always. Unfortunately for my application I don't need streaming at all and single shots is all I need, which is why I will have to stop working on this topic soon and focus on my user space problem again. Furthermore I will not be able to test it with other camera chips.
Nevertheless I would like to contribute my work. Maybe somebody is interested or even is able to improve it.
The patch is against kernel 2.6.31 (sorry).

Nice, thanks for the patch! Now, you'd have to formalise the submission - add your Signed-off-by line, provide a suitable patch description. More importantly, it certainly has to be updated for 2.6.32 and 2.6.33 - the biggest change since 2.6.31 has been the conversion to the v4l2-subdev API, and a smaller one - the addition of the mediabus API. For a single driver these are not very big changes, I could help you with them, but you certainly would have to re-test your setup with the current kernel. Would you be able to do that? And then, of course, we'd also have to pass your driver through the usual review rounds.

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

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#3 lore raw

Thanks for your interest!

Quoted 2 lines

Nice, thanks for the patch! Now, you'd have to formalise the submission - add your Signed-off-by line, provide a suitable patch description.

Ok. That sounds like the easy part ;)

Quoted 4 lines

More
importantly, it certainly has to be updated for 2.6.32 and 2.6.33 - the biggest change since 2.6.31 has been the conversion to the v4l2-subdev API, and a smaller one - the addition of the mediabus API.

I already suspected that I have to update it :D Currently I'm using a 2.6.31 kernel that has been patched with a BSP from the board supplier. So, I have to first update these patches in order to be able to run my system with a current kernel,I guess. I will try that ...

Quoted 6 lines

For a single
driver these are not very big changes, I could help you with them, but you certainly would have to re-test your setup with the current kernel. Would you be able to do that? And then, of course, we'd also have to pass your driver through the usual review rounds.

Thanks for your encouraging answer. I never before submitted a driver and any help is highly appreciated.

Thanks
Arno

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#4 lore raw
Quoted 6 lines · Arno Euteneuer

Thanks for your interest!

Quoted 2 lines

Nice, thanks for the patch! Now, you'd have to formalise the submission - add your Signed-off-by line, provide a suitable patch description.

Ok. That sounds like the easy part ;)

Quoted 8 lines
Quoted 4 lines

More
importantly, it certainly has to be updated for 2.6.32 and 2.6.33 - the biggest change since 2.6.31 has been the conversion to the v4l2-subdev API, and a smaller one - the addition of the mediabus API.

I already suspected that I have to update it :D Currently I'm using a 2.6.31 kernel that has been patched with a BSP from the board supplier. So, I have to first update these patches in order to be able to run my system with a current kernel,I guess. I will try that ...

Good, looking forward to an updated patch;)

Quoted 8 lines
Quoted 6 lines

For a single
driver these are not very big changes, I could help you with them, but you certainly would have to re-test your setup with the current kernel. Would you be able to do that? And then, of course, we'd also have to pass your driver through the usual review rounds.

Thanks for your encouraging answer. I never before submitted a driver and any help is highly appreciated.

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

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#5 lore raw

Hi,

Quoted 10 lines
Quoted 8 lines
Quoted 4 lines

More
importantly, it certainly has to be updated for 2.6.32 and 2.6.33 - the biggest change since 2.6.31 has been the conversion to the v4l2-subdev API, and a smaller one - the addition of the mediabus API.

I already suspected that I have to update it :D Currently I'm using a 2.6.31 kernel that has been patched with a BSP from the board supplier. So, I have to first update these patches in order to be able to run my system with a current kernel,I guess. I will try that ...

Good, looking forward to an updated patch;)

It seems that I will not find the time for preparing my driver for a newer kernel in the near future :( I started upgrading the BSP of my board a few weeks ago, but was interrupted by urgent work on several other things. I will now have to use my driver rather than updating and improving it. Sorry. But I'm sure I will have to update it sooner or later and will hopefully come back then ;)

Regards,
Arno

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list