Skip to contentSkip to conversation

omap24xx camera cleanup

PATCH In review Komal Shah 1 participant 2 messages Mar 22, 2006

Subsystems (4)
lore
Share & tools
lore

Komal Shah

author
#0 lore raw

PATCH 1/1 omap24xx camera cleanup

Patch should be applied on top of previous patches on 24xx camera driver.
Tested on H4 and it is working.

---
Move common vout functions to omap24xxlib.c (Taken from TI 2.6.10) Convert sem to mutex apis.

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

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

drivers/media/video/omap/Makefile +1 -1
index 164700e..454b056 100644
@@ -4,7 +4,7 @@ obj-$(CONFIG_VIDEO_OMAP_CAMERA) += omapc
 obj-$(CONFIG_VIDEO_CAMERA_SENSOR_OV9640) += sensor_ov9640.o
 
 objs-y$(CONFIG_ARCH_OMAP16XX) += camera_core.o omap16xxcam.o
-objs-y$(CONFIG_ARCH_OMAP24XX) += omap24xxcam.o
+objs-y$(CONFIG_ARCH_OMAP24XX) += omap24xxcam.o omap24xxlib.o
 objs-y$(CONFIG_MACH_OMAP_H3) += h3_sensor_power.o
 objs-y$(CONFIG_MACH_OMAP_H4) += h4_sensor_power.o
 
drivers/media/video/omap/omap24xxcam.c +28 -266

376 lines not on this page · raw message

drivers/media/video/omap/omap24xxlib.c new file +264 -0

264 lines not on this page · raw message

drivers/media/video/omap/omap24xxlib.h new file +39 -0
new file mode 100644
index 0000000..f778291
@@ -0,0 +1,39 @@
+/*
+ * drivers/media/video/omap/omap24xxlib.h
+ *
+ * Copyright (C) 2005-2006 Texas Instruments.
+ *
+ * This file is licensed under the terms of the GNU General Public License 
+ * version 2. This program is licensed "as is" without any warranty of any 
+ * kind, whether express or implied.
+ *
+ */
+
+#ifndef OMAP24XXLIB_VIDEO_H
+#define OMAP24XXLIB_VIDEO_H
+
+extern void
+ omap24xxvout_default_crop(struct v4l2_pix_format *pix,
+				struct v4l2_framebuffer *fbuf,
+				struct v4l2_rect *crop);
+
+extern int
+ omap24xxvout_new_crop(struct v4l2_pix_format *pix, struct v4l2_rect *crop,
+			struct v4l2_window *win, struct v4l2_framebuffer *fbuf,
+			const struct v4l2_rect *new_crop);
+
+extern int
+ omap24xxvout_try_window(struct v4l2_framebuffer *fbuf,
+				 struct v4l2_window *new_win);
+
+extern int
+ omap24xxvout_new_window(struct v4l2_rect *crop,struct v4l2_window *win,
+				struct v4l2_framebuffer *fbuf,
+				struct v4l2_window *new_win);
+
+extern void
+ omap24xxvout_new_format(struct v4l2_pix_format *pix,
+			 	struct v4l2_framebuffer *fbuf,
+				struct v4l2_rect *crop,
+				struct v4l2_window *win);
+#endif
author
#1 lore raw
Quoted 10 lines · --- Komal Shah

Patch should be applied on top of previous patches on 24xx camera driver.
Tested on H4 and it is working.

---
Move common vout functions to omap24xxlib.c (Taken from TI 2.6.10) Convert sem to mutex apis.

Please ignore the last patch.

Attached new patch is a further cleanup to 24xx camera driver which populates the _remove function, uses schedule_timeout_interruptible api, adds proper check on error return path in _probe function and few cosmetic changes. Tested on H4 and it works.

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

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

arch/arm/mach-omap2/devices.c +35 -0
index def9e53..0ce0705 100644
@@ -28,6 +28,40 @@
 extern void omap_nop_release(struct device *dev);
 
 /*-------------------------------------------------------------------------*/
+#if defined(CONFIG_VIDEO_OMAP_CAMERA) || defined(CONFIG_VIDEO_OMAP_CAMERA_MODULE)
+
+#define OMAP2_CAM_BASE		0x48052000
+#define OMAP2_CAM_MPU_IRQ	24
+
+static struct resource cam_resources[] = {
+	{
+		.start		= OMAP2_CAM_BASE,
+		.end		= OMAP2_CAM_BASE + 0xfff,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP2_CAM_MPU_IRQ,
+		.flags		= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device omap_cam_device = {
+	.name		= "cam_omap",
+	.id		= -1,
+	.dev = {
+		.release	= omap_nop_release,
+	},
+	.num_resources	= ARRAY_SIZE(cam_resources),
+	.resource	= cam_resources,
+};
+
+static inline void omap_init_camera(void)
+{
+	platform_device_register(&omap_cam_device);
+}
+#else
+static inline void omap_init_camera(void) {}
+#endif
 
 #if 	defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
 
@@ -122,6 +156,7 @@ static int __init omap2_init_devices(voi
 	/* please keep these calls, and their implementations above,
 	 * in alphabetical order so they're easier to sort through.
 	 */
+	omap_init_camera();
 	omap_init_i2c();
 	omap_init_sti();
 
drivers/media/video/omap/Makefile +1 -1
index 164700e..454b056 100644
@@ -4,7 +4,7 @@ obj-$(CONFIG_VIDEO_OMAP_CAMERA) += omapc
 obj-$(CONFIG_VIDEO_CAMERA_SENSOR_OV9640) += sensor_ov9640.o
 
 objs-y$(CONFIG_ARCH_OMAP16XX) += camera_core.o omap16xxcam.o
-objs-y$(CONFIG_ARCH_OMAP24XX) += omap24xxcam.o
+objs-y$(CONFIG_ARCH_OMAP24XX) += omap24xxcam.o omap24xxlib.o
 objs-y$(CONFIG_MACH_OMAP_H3) += h3_sensor_power.o
 objs-y$(CONFIG_MACH_OMAP_H4) += h4_sensor_power.o
 
drivers/media/video/omap/omap24xxcam.c +185 -449

944 lines not on this page · raw message

drivers/media/video/omap/omap24xxcam.h +3 -2
index 85c10e6..2e4bb9b 100644
@@ -423,8 +423,6 @@ struct omap24xxcam_device {
 	unsigned int irq;
 
 	unsigned long cam_mmio_base;
-	unsigned long cam_mmio_base_phys;
-	unsigned long cam_mmio_size;
 
 	unsigned long dispc_mmio_base;
 	unsigned long dispc_mmio_base_phys;
@@ -547,6 +545,9 @@ struct omap24xxcam_device {
 	/* value of GFX_ATTRIBUTES register from display controller */
 	unsigned long gfx_attributes;
 
+	struct clk *cam_fck;
+	struct clk *cam_ick;
+
 	/* video 2 layer of the display controller is also configured through
 	 ** it */
 	int vid2;
drivers/media/video/omap/omap24xxlib.c new file +264 -0

264 lines not on this page · raw message

drivers/media/video/omap/omap24xxlib.h new file +39 -0
new file mode 100644
index 0000000..f778291
@@ -0,0 +1,39 @@
+/*
+ * drivers/media/video/omap/omap24xxlib.h
+ *
+ * Copyright (C) 2005-2006 Texas Instruments.
+ *
+ * This file is licensed under the terms of the GNU General Public License 
+ * version 2. This program is licensed "as is" without any warranty of any 
+ * kind, whether express or implied.
+ *
+ */
+
+#ifndef OMAP24XXLIB_VIDEO_H
+#define OMAP24XXLIB_VIDEO_H
+
+extern void
+ omap24xxvout_default_crop(struct v4l2_pix_format *pix,
+				struct v4l2_framebuffer *fbuf,
+				struct v4l2_rect *crop);
+
+extern int
+ omap24xxvout_new_crop(struct v4l2_pix_format *pix, struct v4l2_rect *crop,
+			struct v4l2_window *win, struct v4l2_framebuffer *fbuf,
+			const struct v4l2_rect *new_crop);
+
+extern int
+ omap24xxvout_try_window(struct v4l2_framebuffer *fbuf,
+				 struct v4l2_window *new_win);
+
+extern int
+ omap24xxvout_new_window(struct v4l2_rect *crop,struct v4l2_window *win,
+				struct v4l2_framebuffer *fbuf,
+				struct v4l2_window *new_win);
+
+extern void
+ omap24xxvout_new_format(struct v4l2_pix_format *pix,
+			 	struct v4l2_framebuffer *fbuf,
+				struct v4l2_rect *crop,
+				struct v4l2_window *win);
+#endif