Skip to contentSkip to conversation

ARM: OMAP2: Camera: Fixes compile errors and adds little improvements

PATCH In review Eduardo Valentin 4 participants 7 messages Nov 21, 2007 – Nov 23, 2007

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

cover ARM: OMAP2: Camera: Fixes compile errors and adds little improvements

Hi All,

This patch set fixes compile erros and adds little improvements
camera code for omap2. Here is the overall description:

V4l2:
- Updates this camera driver to use correctly the new videobuf API. Corrently, changed to use videobuf_gen and videobuf_dma_sg.
- Removed VIDEO_BUF reference from Kconfig.

S/G:
- Update this code to sg_* helper functions.

ov9640:
- Removes unecessary structures and functions when config OV9640 is not selected.
- Reduces powerset code for ov9640.

Overall diffstat:

 arch/arm/mach-omap2/board-h4.c    |   71 +++++++++++---------------------------
 drivers/media/video/Kconfig       |    3 +
 drivers/media/video/omap24xxcam.c |   68 +++++++++++++++++++-----------------
 drivers/media/video/omap24xxcam.h |    3 -
 4 files changed, 61 insertions(+), 84 deletions(-)
#1 lore raw

PATCH 1/2 ARM: OMAP2: Camera: Update camera driver for correct use of API's

From: Eduardo Valentin <[email protected]>

V4l2:
- Updates this camera driver to use correctly the new videobuf API. Currently, changed to use videobuf_gen and videobuf_dma_sg.
- Removed VIDEO_BUF reference from Kconfig.

S/G:
- Update this code to sg_* helper functions.

---
 drivers/media/video/Kconfig       |    3 +-
 drivers/media/video/omap24xxcam.c |   68 +++++++++++++++++++-----------------
 drivers/media/video/omap24xxcam.h |    2 +-
 3 files changed, 39 insertions(+), 34 deletions(-)
drivers/media/video/Kconfig +2 -1
index 7285f08..3fd1d98 100644
@@ -712,7 +712,8 @@ config VIDEO_CAFE_CCIC
 
 config VIDEO_OMAP2
 	tristate "OMAP 2 Camera support (EXPERIMENTAL)"
-	select VIDEO_BUF
+	select VIDEOBUF_GEN
+	select VIDEOBUF_DMA_SG
 	depends on VIDEO_V4L2 && ARCH_OMAP24XX
 	---help---
 	  Driver for an OMAP 2 camera controller.
drivers/media/video/omap24xxcam.c +36 -32

180 lines not on this page · raw message

drivers/media/video/omap24xxcam.h +1 -1
index 7799733..00d0e31 100644
@@ -27,7 +27,7 @@
 #ifndef OMAP24XXCAM_H
 #define OMAP24XXCAM_H
 
-#include <media/video-buf.h>
+#include <media/videobuf-dma-sg.h>
 #include <media/v4l2-int-device.h>
 
 /*
Signature · 1 line
1.5.3.4.206.g58ba4
#2 lore raw

PATCH 2/2 ARM: OMAP2: Camera: Improve ov9640 code on board-h4.c

From: Eduardo Valentin <[email protected]>

- Removes unnecessary structures and functions when config OV9640 is not selected.
- Reduces powerset code for ov9640.

---
 arch/arm/mach-omap2/board-h4.c |   70 ++++++++++++---------------------------
 1 files changed, 22 insertions(+), 48 deletions(-)
arch/arm/mach-omap2/board-h4.c +22 -48
index 85649bb..8fde838 100644
@@ -525,6 +525,7 @@ static void __init tusb_evm_setup(void)
 
 #endif
 
+#if defined(CONFIG_VIDEO_OV9640) || defined(CONFIG_VIDEO_OV9640_MODULE)
 /*
  * Common OV9640 register initialization for all image sizes, pixel formats,
  * and frame rates
@@ -563,63 +564,37 @@ const static struct ov9640_reg ov9640_common[] = {
 	{ OV9640_REG_TERM, OV9640_VAL_TERM }
 };
 
-#if defined(CONFIG_VIDEO_OV9640) || defined(CONFIG_VIDEO_OV9640_MODULE)
-static int ov9640_sensor_powerup(void)
+static int ov9640_sensor_power_set(int power)
 {
 	unsigned char expa;
 	int err;
 
 	/* read current state of GPIO EXPA outputs */
 	if ((err = read_gpio_expa(&expa, 0x20))) {
-		printk(KERN_ERR "Error reading GPIO EXPA\n");
-		return err;
-	}
-	/* Set GPIO EXPA P3 (CAMERA_MODULE_EN) to power-up sensor */
-	if ((err = write_gpio_expa(expa | 0x08, 0x20))) {
-		printk(KERN_ERR "Error writing to GPIO EXPA\n");
-		return err;
-	}
-
-	/* read current state of GPIO EXPA outputs */
-	if ((err = read_gpio_expa(&expa, 0x22))) {
-		printk(KERN_ERR "Error reading GPIO EXPA\n");
-		return err;
-	}
-	/* Clear GPIO EXPA P7 (CAM_RST) */
-	if ((err = write_gpio_expa(expa & ~0x80, 0x22))) {
-		printk(KERN_ERR "Error writing to GPIO EXPA\n");
+		printk(KERN_ERR "Error reading GPIO EXPA 0x20\n");
 		return err;
 	}
 
-	return 0;
-}
-static int ov9640_sensor_powerdown(void)
-{
-	unsigned char expa;
-	int err;
+	expa = power ? expa | 0x80 : expa & ~0x08;
 
-	/* read current state of GPIO EXPA outputs */
-	if ((err = read_gpio_expa(&expa, 0x20))) {
-		printk(KERN_ERR "Error reading GPIO EXPA\n");
-		return err;
-	}
-	/* Clear GPIO EXPA P3 (CAMERA_MODULE_EN) to power-down sensor */
-	if ((err = write_gpio_expa(expa & ~0x08, 0x20))) {
-		printk(KERN_ERR "Error writing to GPIO EXPA\n");
+	/* Set GPIO EXPA P3 (CAMERA_MODULE_EN) to power-up sensor */
+	if ((err = write_gpio_expa(expa, 0x20))) {
+		printk(KERN_ERR "Error writing to GPIO EXPA 0x20\n");
 		return err;
 	}
 
-	return 0;
-}
-
-static int ov9640_sensor_power_set(int power)
-{
-	int err = 0;
-
-	if (power)
-		err = ov9640_sensor_powerup();
-	else
-		err = ov9640_sensor_powerdown();
+	if (power) {
+		/* read current state of GPIO EXPA outputs */
+		if ((err = read_gpio_expa(&expa, 0x22))) {
+			printk(KERN_ERR "Error reading GPIO EXPA\n");
+			return err;
+		}
+		/* Clear GPIO EXPA P7 (CAM_RST) */
+		if ((err = write_gpio_expa(expa & ~0x80, 0x22))) {
+			printk(KERN_ERR "Error writing to GPIO EXPA\n");
+			return err;
+		}
+	}
 
 	return err;
 }
@@ -643,16 +618,13 @@ static int ov9640_ifparm(struct v4l2_ifparm *p)
 
 	return 0;
 }
-#else
-static int ov9640_sensor_power_set(int power) { return 0; }
-static int ov9640_ifparm(struct v4l2_ifparm *p) { return 0; }
-#endif
 
 static struct ov9640_platform_data h4_ov9640_platform_data = {
 	.power_set	= ov9640_sensor_power_set,
 	.default_regs	= ov9640_common,
 	.ifparm		= ov9640_ifparm,
 };
+#endif
 
 static struct i2c_board_info __initdata h4_i2c_board_info[] = {
 	{
@@ -664,10 +636,12 @@ static struct i2c_board_info __initdata h4_i2c_board_info[] = {
 		I2C_BOARD_INFO("menelaus", 0x72),
 		.irq = INT_24XX_SYS_NIRQ,
 	},
+#if defined(CONFIG_VIDEO_OV9640) || defined(CONFIG_VIDEO_OV9640_MODULE)
 	{
 		I2C_BOARD_INFO("ov9640", 0x30),
 		.platform_data = &h4_ov9640_platform_data,
 	},
+#endif
 };
 
 static void __init omap_h4_init(void)
Signature · 1 line
1.5.3.4.206.g58ba4
Acked-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] ARM: OMAP2: Camera: Improve ov9640 code on board-h4.c

Hi Eduardo,

Quoted 8 lines · Eduardo Valentin

From: Eduardo Valentin <[email protected]>

- Removes unnecessary structures and functions when config OV9640 is not selected.
- Reduces powerset code for ov9640.

---

Thanx for the changes. Looks good to me. We have to make changes related to gpio expander apis if gpiolib goes upstrem by David Brownell.

Signature · 1 line
--Trilok Soni
#4 lore raw

Re: [PATCH 1/2] ARM: OMAP2: Camera: Update camera driver for correct use of API's

In reply to Eduardo Valentin
Quoted 11 lines · Eduardo Valentin

From: Eduardo Valentin <[email protected]>

V4l2:
- Updates this camera driver to use correctly the new videobuf API. Currently, changed to use videobuf_gen and videobuf_dma_sg.
- Removed VIDEO_BUF reference from Kconfig.

S/G:
- Update this code to sg_* helper functions.

Thanks for the patch, Eduardo!

I was actually preparing a fix but perhaps a bit late. I was waiting for the MUSB patch to make testing it a bit easier. ;)

There's one a bit subtle change in new videobuf code (?): videobuf_mmap_setup now returns the number of buffers instead of zero when it succeeds. (I ran into this...)

Cheers,

Signature · 2 lines
Sakari Ailus
[email protected]
#5 lore raw

PATCH 1/1 OMAP2: Camera: Adapt to use new videobuf and scatterlist code

Also take into account that videobuf_reqbufs now returns number of buffers when it succeeds.

(Thanks for Eduardo Valentin for initial patch.)

---
 drivers/media/video/Kconfig       |    3 +-
 drivers/media/video/omap24xxcam.c |   75 ++++++++++++++++++-------------------
 drivers/media/video/omap24xxcam.h |    2 +-
 3 files changed, 40 insertions(+), 40 deletions(-)
drivers/media/video/Kconfig +2 -1
index 0cb82fd..29eb904 100644
@@ -712,7 +712,8 @@ config VIDEO_CAFE_CCIC
 
 config VIDEO_OMAP2
 	tristate "OMAP 2 Camera support (EXPERIMENTAL)"
-	select VIDEO_BUF
+	select VIDEOBUF_GEN
+	select VIDEOBUF_DMA_SG
 	depends on VIDEO_V4L2 && ARCH_OMAP24XX
 	---help---
 	  Driver for an OMAP 2 camera controller.
drivers/media/video/omap24xxcam.c +37 -38

183 lines not on this page · raw message

drivers/media/video/omap24xxcam.h +1 -1
index 7799733..00d0e31 100644
@@ -27,7 +27,7 @@
 #ifndef OMAP24XXCAM_H
 #define OMAP24XXCAM_H
 
-#include <media/video-buf.h>
+#include <media/videobuf-dma-sg.h>
 #include <media/v4l2-int-device.h>
 
 /*
Signature · 1 line
1.5.0.6
maintainer
#6 lore raw

Re: [PATCH] OMAP2: Camera: Adapt to use new videobuf and scatterlist code

Quoted 4 lines · Sakari Ailus

Also take into account that videobuf_reqbufs now returns number of buffers when it succeeds.

(Thanks for Eduardo Valentin for initial patch.)

Pushing this and Eduardo's second patch today.

Tony