Skip to contentSkip to conversation

ARM: OMAP1: Camera: Updates API usage and removes unused files

PATCH In review Eduardo Valentin 2 participants 7 messages Nov 21, 2007 – Dec 1, 2007 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

cover ARM: OMAP1: Camera: Updates API usage and removes unused files

This patch set updates v4l2 API usage and removes unused
files on camera code for omap1. Here is an overall description:

There are two updates on v4l2 API usage: on the use of videobuf and
v4l2-int-device deattach.

As the ov9640 is already moved to the v4l2-int-device API and
the camera code for omap1 too, this patch set also removes unused and duplicated files. The info from this removed files already moved to board specific files and to other files (see previous related patches).

Here is its overall diffstat:

 b/drivers/media/video/omap/Kconfig         |    3
 b/drivers/media/video/omap/camera_core.c   |   11
 b/drivers/media/video/omap/camera_core.h   |    3
 drivers/media/video/omap/camera_core.c     |   13
 drivers/media/video/omap/h3_sensor_power.c |   63 -
 drivers/media/video/omap/h3sensorpower.h   |   17
 drivers/media/video/omap/h4_sensor_power.c |   76 -
 drivers/media/video/omap/h4sensorpower.h   |   17
 drivers/media/video/omap/ov9640.h          |  179 ----
 drivers/media/video/omap/sensor_if.h       |   50 -
 drivers/media/video/omap/sensor_ov9640.c   | 1221 -----------------------------
 11 files changed, 14 insertions(+), 1639 deletions(-)

BR,

---
Eduardo Bezerra Valentin
OpenBossa - INdT
+55 92 21261118

#1 lore raw

PATCH 1/3 ARM: OMAP1: Camera: Update videobuf utilization

From: Eduardo Valentin <[email protected]>

This patch updates the camera_core.[c,h] to use corretly the new v4l2 videobuf API.

Also removes VIDEO_BUF reference from Kconfig and adds the correct dependencies.

---
 drivers/media/video/omap/Kconfig       |    3 ++-
 drivers/media/video/omap/camera_core.c |   11 ++++++-----
 drivers/media/video/omap/camera_core.h |    2 +-
 3 files changed, 9 insertions(+), 7 deletions(-)
drivers/media/video/omap/Kconfig +2 -1
index 0fb0686..c8d1f4c 100644
@@ -1,6 +1,7 @@
 config VIDEO_OMAP_CAMERA
 	tristate "OMAP Camera support (EXPERIMENTAL)"
-	select VIDEO_BUF
+	select VIDEOBUF_GEN
+	select VIDEOBUF_DMA_SG
 	depends on VIDEO_DEV && (ARCH_OMAP16XX || ARCH_OMAP24XX)
 	help
 	  V4L2 camera driver support for OMAP1/2 based boards.
drivers/media/video/omap/camera_core.c +6 -5
index 1d47212..6e5d8bd 100644
@@ -393,9 +393,10 @@ static void camera_core_vbq_complete(void *arg1, void *arg)
 static void camera_core_vbq_release(struct videobuf_queue *q,
 				    struct videobuf_buffer *vb)
 {
+	struct videobuf_dmabuf *dma = videobuf_to_dma(vb);
 	videobuf_waiton(vb, 0, 0);
-	videobuf_dma_unmap(q, &vb->dma);
-	videobuf_dma_free(&vb->dma);
+	videobuf_dma_unmap(q, dma);
+	videobuf_dma_free(dma);
 
 	vb->state = STATE_NEEDS_INIT;
 }
@@ -459,13 +460,14 @@ static int camera_core_vbq_prepare(struct videobuf_queue *q,
 static void camera_core_vbq_queue(struct videobuf_queue *q,
 				  struct videobuf_buffer *vb)
 {
+	struct videobuf_dmabuf *dma = videobuf_to_dma(vb);
 	struct camera_fh *fh = q->priv_data;
 	struct camera_device *cam = fh->cam;
 	enum videobuf_state state = vb->state;
 	int err;
 
 	vb->state = STATE_QUEUED;
-	err = camera_core_sgdma_queue(cam, vb->dma.sglist, vb->dma.sglen,
+	err = camera_core_sgdma_queue(cam, dma->sglist, dma->sglen,
 				      camera_core_vbq_complete, vb);
 	if (err) {
 		/* Oops.  We're not supposed to get any errors here.  The only
@@ -915,7 +917,7 @@ static int camera_core_open(struct inode *inode, struct file *file)
 	vidioc_int_g_fmt_cap(cam->sdev, &format);
 	spin_unlock(&cam->img_lock);
 
-	videobuf_queue_init(&fh->vbq, &cam->vbq_ops, NULL, &cam->vbq_lock,
+	videobuf_queue_pci_init(&fh->vbq, &cam->vbq_ops, NULL, &cam->vbq_lock,
 			    fh->type, V4L2_FIELD_NONE,
 			    sizeof(struct videobuf_buffer), fh);
 
@@ -1045,7 +1047,6 @@ static int camera_device_register(struct v4l2_int_device *ctl,
 	vfd->type = VID_TYPE_CAPTURE | VID_TYPE_OVERLAY | VID_TYPE_CHROMAKEY;
 
 	/* Need to register for a VID_HARDWARE_* ID in videodev.h */
-	vfd->hardware = 0;
 	vfd->fops = &camera_core_fops;
 	video_set_drvdata(vfd, cam);
 	vfd->minor = -1;
drivers/media/video/omap/camera_core.h +1 -1
index e156cc3..02ed5be 100644
@@ -17,8 +17,8 @@
 
 struct camera_fh;
 
-#include <media/video-buf.h>
 #include <asm/scatterlist.h>
+#include <media/videobuf-dma-sg.h>
 #include <media/v4l2-int-device.h>
 
 struct camera_device;
Signature · 1 line
1.5.3.4.206.g58ba4
#2 lore raw

PATCH 2/3 ARM: OMAP1: Camera: Fix v4l2 int device detach

From: Eduardo Valentin <[email protected]>

camera_device_unregister expected the argument to be its own device structure but it's actually that of its slave.

Also get master from slave's structure in camera_device_register.

---
 drivers/media/video/omap/camera_core.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
drivers/media/video/omap/camera_core.c +5 -6
index 6e5d8bd..be033be 100644
@@ -1007,17 +1007,16 @@ static ssize_t camera_streaming_show(struct device *dev,
 
 static DEVICE_ATTR(streaming, S_IRUGO, camera_streaming_show, NULL);
 
-static void camera_device_unregister(struct v4l2_int_device *ctl)
+static void camera_device_unregister(struct v4l2_int_device *s)
 {
-	struct camera_device *cam = ctl->priv;
+	struct camera_device *cam = s->u.slave->master->priv;
 
 	camera_sensor_exit(cam);
 }
 
-static int camera_device_register(struct v4l2_int_device *ctl,
-				  struct v4l2_int_device *s)
+static int camera_device_register(struct v4l2_int_device *s)
 {
-	struct camera_device *cam = ctl->priv;
+	struct camera_device *cam = s->u.slave->master->priv;
 	struct video_device *vfd;
 	int rval;
 
@@ -1092,7 +1091,7 @@ static int camera_device_register(struct v4l2_int_device *ctl,
 	return 0;
 
 err:
-	camera_device_unregister(ctl);
+	camera_device_unregister(s);
 
 	return rval;
 }
Signature · 1 line
1.5.3.4.206.g58ba4
#3 lore raw

PATCH 3/3 ARM: OMAP1: Camera: Removes unused files

From: Eduardo Valentin <[email protected]>

Removing duplicated and unused files from camera driver for omap1.

---
 drivers/media/video/omap/camera_core.c     |    1 -
 drivers/media/video/omap/h3_sensor_power.c |   63 --
 drivers/media/video/omap/h3sensorpower.h   |   17 -
 drivers/media/video/omap/h4_sensor_power.c |   76 --
 drivers/media/video/omap/h4sensorpower.h   |   17 -
 drivers/media/video/omap/ov9640.h          |  179 ----
 drivers/media/video/omap/sensor_if.h       |   50 --
 drivers/media/video/omap/sensor_ov9640.c   | 1220 ----------------------------
 8 files changed, 0 insertions(+), 1623 deletions(-)
 delete mode 100644 drivers/media/video/omap/h3_sensor_power.c
 delete mode 100644 drivers/media/video/omap/h3sensorpower.h
 delete mode 100644 drivers/media/video/omap/h4_sensor_power.c
 delete mode 100644 drivers/media/video/omap/h4sensorpower.h
 delete mode 100644 drivers/media/video/omap/ov9640.h
 delete mode 100644 drivers/media/video/omap/sensor_if.h
 delete mode 100644 drivers/media/video/omap/sensor_ov9640.c
drivers/media/video/omap/camera_core.c +0 -1
index be033be..dce47fc 100644
@@ -31,7 +31,6 @@
 
 #include <asm/io.h>
 
-#include "sensor_if.h"
 #include "camera_hw_if.h"
 #include "camera_core.h"
 
drivers/media/video/omap/h3_sensor_power.c deleted +0 -63

63 lines not on this page · raw message

drivers/media/video/omap/h3sensorpower.h deleted +0 -17
deleted file mode 100644
index 8587729..0000000
@@ -1,17 +0,0 @@
-/*
- * drivers/media/video/omap/h3sensorpower.h
- *
- * Copyright (C) 2005 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 H3SENSORPOWER_H
-#define H3SENSORPOWER_H
-
-int h3_sensor_powerup(void);
-int h3_sensor_powerdown(void);
-
-#endif /*H3SENSORPOWER_H*/
drivers/media/video/omap/h4_sensor_power.c deleted +0 -76

76 lines not on this page · raw message

drivers/media/video/omap/h4sensorpower.h deleted +0 -17
deleted file mode 100644
index 4eeae11..0000000
@@ -1,17 +0,0 @@
-/*
- * drivers/media/video/omap/h4sensorpower.h
- *
- * Copyright (C) 2005 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 H4SENSORPOWER_H
-#define H4SENSORPOWER_H
-
-int h4_sensor_powerup(void);
-int h4_sensor_powerdown(void);
-
-#endif /*H4SENSORPOWER_H*/
drivers/media/video/omap/ov9640.h deleted +0 -179

179 lines not on this page · raw message

drivers/media/video/omap/sensor_if.h deleted +0 -50

50 lines not on this page · raw message

drivers/media/video/omap/sensor_ov9640.c deleted +0 -1220

1,220 lines not on this page · raw message

Signature · 1 line
1.5.3.4.206.g58ba4
#4 lore raw
In reply to Eduardo Valentin
Quoted 14 lines · Eduardo Valentin

This patch set updates v4l2 API usage and removes unused
files on camera code for omap1. Here is an overall description:

There are two updates on v4l2 API usage: on the use of videobuf and
v4l2-int-device deattach.

As the ov9640 is already moved to the v4l2-int-device API and
the camera code for omap1 too, this patch set also removes unused and duplicated files. The info from this removed files already moved to board specific files and to other files (see previous related patches).

Here is its overall diffstat:

Quoted 13 lines
 b/drivers/media/video/omap/Kconfig         |    3
 b/drivers/media/video/omap/camera_core.c   |   11
 b/drivers/media/video/omap/camera_core.h   |    3
 drivers/media/video/omap/camera_core.c     |   13
 drivers/media/video/omap/h3_sensor_power.c |   63 -
 drivers/media/video/omap/h3sensorpower.h   |   17
 drivers/media/video/omap/h4_sensor_power.c |   76 -
 drivers/media/video/omap/h4sensorpower.h   |   17
 drivers/media/video/omap/ov9640.h          |  179 ----
 drivers/media/video/omap/sensor_if.h       |   50 -
 drivers/media/video/omap/sensor_ov9640.c   | 1221 -----------------------------
 11 files changed, 14 insertions(+), 1639 deletions(-)

Pushing thise series today. Is there anything else that can be removed now regarding the camera stuff?

Tony

#5 lore raw

Hi Tony,

Sorry for the delayed answer.

Quoted 29 lines · Tony Lindgren
Quoted 14 lines · Eduardo Valentin

This patch set updates v4l2 API usage and removes unused
files on camera code for omap1. Here is an overall description:

There are two updates on v4l2 API usage: on the use of videobuf and
v4l2-int-device deattach.

As the ov9640 is already moved to the v4l2-int-device API and
the camera code for omap1 too, this patch set also removes unused and duplicated files. The info from this removed files already moved to board specific files and to other files (see previous related patches).

Here is its overall diffstat:

Quoted 13 lines
 b/drivers/media/video/omap/Kconfig         |    3
 b/drivers/media/video/omap/camera_core.c   |   11
 b/drivers/media/video/omap/camera_core.h   |    3
 drivers/media/video/omap/camera_core.c     |   13
 drivers/media/video/omap/h3_sensor_power.c |   63 -
 drivers/media/video/omap/h3sensorpower.h   |   17
 drivers/media/video/omap/h4_sensor_power.c |   76 -
 drivers/media/video/omap/h4sensorpower.h   |   17
 drivers/media/video/omap/ov9640.h          |  179 ----
 drivers/media/video/omap/sensor_if.h       |   50 -
 drivers/media/video/omap/sensor_ov9640.c   | 1221 -----------------------------
 11 files changed, 14 insertions(+), 1639 deletions(-)
Quoted 2 lines

Pushing thise series today. Is there anything else that can be removed now regarding the camera stuff?

The code for the omap1 is clean. All unused files were removed. However, I'd ask what you think about merging the code of

drivers/media/video/omap/camera_core.[c,h]
drivers/media/video/omap/omap16xxcam.[c,h]

and removing the drivers/media/video/omap/ directory. I'm suggesting this change 'cause the code for omap2 is outside this directory.

Quoted 3 lines

Tony

Signature · 1 line
Eduardo Bezerra Valentin
#6 lore raw
Quoted 37 lines · Eduardo Valentin

Hi Tony,

Sorry for the delayed answer.

Quoted 29 lines · Tony Lindgren
Quoted 14 lines · Eduardo Valentin

This patch set updates v4l2 API usage and removes unused
files on camera code for omap1. Here is an overall description:

There are two updates on v4l2 API usage: on the use of videobuf and
v4l2-int-device deattach.

As the ov9640 is already moved to the v4l2-int-device API and
the camera code for omap1 too, this patch set also removes unused and duplicated files. The info from this removed files already moved to board specific files and to other files (see previous related patches).

Here is its overall diffstat:

Quoted 13 lines
 b/drivers/media/video/omap/Kconfig         |    3
 b/drivers/media/video/omap/camera_core.c   |   11
 b/drivers/media/video/omap/camera_core.h   |    3
 drivers/media/video/omap/camera_core.c     |   13
 drivers/media/video/omap/h3_sensor_power.c |   63 -
 drivers/media/video/omap/h3sensorpower.h   |   17
 drivers/media/video/omap/h4_sensor_power.c |   76 -
 drivers/media/video/omap/h4sensorpower.h   |   17
 drivers/media/video/omap/ov9640.h          |  179 ----
 drivers/media/video/omap/sensor_if.h       |   50 -
 drivers/media/video/omap/sensor_ov9640.c   | 1221 -----------------------------
 11 files changed, 14 insertions(+), 1639 deletions(-)
Quoted 2 lines

Pushing thise series today. Is there anything else that can be removed now regarding the camera stuff?

Quoted 8 lines

The code for the omap1 is clean. All unused files were removed. However, I'd ask what you think about merging the code of

drivers/media/video/omap/camera_core.[c,h]
drivers/media/video/omap/omap16xxcam.[c,h]

and removing the drivers/media/video/omap/ directory. I'm suggesting this change 'cause the code for omap2 is outside this directory.

Sure, works for me.

Tony