Skip to contentSkip to conversation

ALCHEMY: Alchemy Camera Interface (CIM) driver

PATCH In review Jordan Crouse 3 participants 4 messages Dec 2, 2005 – Dec 5, 2005

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

PATCH 1/1 ALCHEMY: Alchemy Camera Interface (CIM) driver

A driver for the AU1200 Camera Interface (CIM). Definately should be postponed post 2.6.15. This is the most complex one I'm sending up right now, so comments and flames are definately welcome.

---

 drivers/Makefile                          |    2 
 drivers/char/Kconfig                      |    4 
 drivers/char/Makefile                     |    1 
 drivers/char/au1xxx_cameras.h             |  572 ++++++++++++++++++++++++++
 drivers/char/au1xxx_cim.c                 |  647 +++++++++++++++++++++++++++++
 include/asm-mips/mach-au1x00/au1xxx_cim.h |  190 +++++++++
 6 files changed, 1415 insertions(+), 1 deletions(-)
drivers/Makefile +1 -1
index fac1e16..7ab1608 100644
@@ -16,6 +16,7 @@ obj-$(CONFIG_PNP)		+= pnp/
 
 # char/ comes before serial/ etc so that the VT console is the boot-time
 # default.
+obj-$(CONFIG_I2C)               += i2c/
 obj-y				+= char/
 
 obj-$(CONFIG_CONNECTOR)		+= connector/
@@ -53,7 +54,6 @@ obj-$(CONFIG_USB_GADGET)	+= usb/gadget/
 obj-$(CONFIG_GAMEPORT)		+= input/gameport/
 obj-$(CONFIG_INPUT)		+= input/
 obj-$(CONFIG_I2O)		+= message/
-obj-$(CONFIG_I2C)		+= i2c/
 obj-$(CONFIG_W1)		+= w1/
 obj-$(CONFIG_HWMON)		+= hwmon/
 obj-$(CONFIG_PHONE)		+= telephony/
drivers/char/Kconfig +4 -0
index 9424f62..2b0cf62 100644
@@ -347,6 +347,10 @@ config AU1X00_USB_RAW
 	tristate "Au1000 USB Raw Device support"
 	depends on MIPS && MIPS_AU1000 && AU1000_USB_DEVICE=y && AU1000_USB_TTY!=y && AU1X00_USB_DEVICE
 
+config AU1XXX_CIM
+       tristate "Au1200 Camera Interface Module (CIM)"
+       depends on MIPS && SOC_AU1X00 && I2C_AU1550
+
 config SIBYTE_SB1250_DUART
 	bool "Support for BCM1xxx onchip DUART"
 	depends on MIPS && SIBYTE_SB1xxx_SOC=y
drivers/char/Makefile +1 -0
index ecc5670..6629394 100644
@@ -82,6 +82,7 @@ obj-$(CONFIG_ITE_GPIO) += ite_gpio.o
 obj-$(CONFIG_AU1000_GPIO) += au1000_gpio.o
 obj-$(CONFIG_AU1000_USB_TTY) += au1000_usbtty.o
 obj-$(CONFIG_AU1000_USB_RAW) += au1000_usbraw.o
+obj-$(CONFIG_AU1XXX_CIM) += au1xxx_cim.o
 obj-$(CONFIG_PPDEV) += ppdev.o
 obj-$(CONFIG_NWBUTTON) += nwbutton.o
 obj-$(CONFIG_NWFLASH) += nwflash.o
drivers/char/au1xxx_cameras.h new file +572 -0

572 lines not on this page · raw message

drivers/char/au1xxx_cim.c new file +647 -0

647 lines not on this page · raw message

include/asm-mips/mach-au1x00/au1xxx_cim.h new file +190 -0

190 lines not on this page · raw message

#1 lore raw

Hi

Quoted 1 line

A driver for the AU1200 Camera Interface (CIM).

Great news!

Quoted 2 lines

I'm sending up right now, so comments and flames are definately welcome.

Wouldn't it be wise to support V4L2?
This way, many existing application could use AU1200s camera interface.

Quoted 7 lines
drivers/char/au1xxx_cim.c new file +7 -0
+int __init
+au1xxxcim_init(void)
+{
+	int retval, error;
+	unsigned long page;
+	CAMERA_RUNTIME *cam_init;
+	CAMERA *cim_ptr;

drivers/char/au1xxx_cim.c line 580

Quoted 10 lines
drivers/char/au1xxx_cim.c new file +10 -0
+
+	cam_init = &cam_base;
+	cam_init->cmos_camera = OrigCimArryPtr + prev_mode;
+	cim_ptr = cam_init->cmos_camera;
+
+	/*Allocating memory for MMAP */
+	mem_buf = (unsigned long *)Camera_mem_alloc(2 * MAX_FRAME_SIZE);
+	if (mem_buf == NULL) {
+		printk(KERN_ERR "MMAP unable to allocate memory \n");
+	}

IMHO this is a waste of memory, because if the user is going to use the camera in 320x240 mode and this allocates memory for the biggest size. Wouldn't it be better to set some default configuration and allocate memory for this? Later if the user changes the mode those pages are freed and new (for requested size) are allocated. Or even allocate memory AFTER the configuration has been set?

BR,
Matej

#2 lore raw
Quoted 2 lines · Matej Kupljen

Wouldn't it be wise to support V4L2?
This way, many existing application could use AU1200s camera interface.

Thats possible, but for now this solution has been reasonable enough for us to send it upstream. I'm sure that somebody more familiar with V4L2 could make short work of adapting it to the existing infrastructure.

Quoted 16 lines
Quoted 16 lines
drivers/char/au1xxx_cim.c new file +16 -0
+int __init
+au1xxxcim_init(void)
+{
+	int retval, error;
+	unsigned long page;
+	CAMERA_RUNTIME *cam_init;
+	CAMERA *cim_ptr;
+
+	cam_init = &cam_base;
+	cam_init->cmos_camera = OrigCimArryPtr + prev_mode;
+	cim_ptr = cam_init->cmos_camera;
+
+	/*Allocating memory for MMAP */
+	mem_buf = (unsigned long *)Camera_mem_alloc(2 * MAX_FRAME_SIZE);
+	if (mem_buf == NULL) {
+		printk(KERN_ERR "MMAP unable to allocate memory \n");
Quoted 8 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	}

IMHO this is a waste of memory, because if the user is going to use the camera in 320x240 mode and this allocates memory for the biggest size. Wouldn't it be better to set some default configuration and allocate memory for this? Later if the user changes the mode those pages are freed and new (for requested size) are allocated. Or even allocate memory AFTER the configuration has been set?

I agree, that could be handled better.

Thanks,

Jordan

Signature · 4 lines
Jordan Crouse
Senior Linux Engineer
AMD - Personal Connectivity Solutions Group
<www.amd.com/embeddedprocessors>
#3 lore raw
In reply to Jordan Crouse

--- Jordan Crouse <[email protected]> wrote:

and values

drivers/char/au1xxx_cameras.h line 32

Quoted 10 lines

*/

drivers/char/au1xxx_cameras.h new file +6 -0
+} CAMERA;
+
+
+
+static CAMERA au1xxx_cameras[] = {
+	/* Omnivision OV9640 Camera 1280x960 Mode (SXGA) in "Pass Thru

Mode"

drivers/char/au1xxx_cameras.h new file +2 -0
+	   1.3 MP at 15 Fps
+	*/

There is already nice way to separate sensor interface from the camera core and ov9640 camera sensor driver is available at OMAP tree.

Could you please look at that and see if that can be re-used?
http://source.mvista.com/git/gitweb.cgi?p=linux-omap-2.6.git;a=blob;h=c7691d19356f9c5d8cb724a924e8bdebaed7fc65;hb=279a7045accc927dbb2b1d41691424c4d345489c;f=drivers/media/video/omap/sensor_ov9640.c

---Komal Shah
http://komalshah.blogspot.com/

__________________________________________
Yahoo! DSL – Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com