Skip to contentSkip to conversation

OMAP3 ISP and camera drivers

RFC In review Sakari Ailus 6 participants 28 messages Mar 3, 2009 – Mar 7, 2009 Page 2 of 2

Subsystems (4)
lore
Share & tools
lore
#24 lore raw
In reply to Hiremath, Vaibhav

Hi,

You are right. I checked with my JTAG debugger.
It crashes just exactly there because of the reason you issued. Cheers,

Nate

Quoted 155 lines · Vaibhav

Thanks,
Vaibhav Hiremath

Quoted 9 lines

-----Original Message-----
From: DongSoo(Nathaniel) Kim [mailto:[email protected]]
Sent: Thursday, March 05, 2009 5:41 AM
To: Sakari Ailus
Cc: Hiremath, Vaibhav; [email protected]; linux- [email protected]; Aguirre Rodriguez, Sergio Alberto; Toivonen Tuukka Olli Artturi; Hiroshi DOYU
Subject: Re: [RFC 0/9] OMAP3 ISP and camera drivers

Quoted 6 lines

Hi Sakari,

I'm also facing same issue with Hiremath.

Here you are my kernel stack dump.

[Hiremath, Vaibhav] I was getting same kernel crash,  The reason is -

Since  isp_probe doesn't get called, leaving omap3isp = NULL. So isp_get will return -EBUSY from the very beginning of function.  And the function "omap34xxcam_device_register" which calls isp_get tries to access vdev->vfd->dev where it crashes. Which is completely wrong, since the vfd gets initialize later part of function

if (hwc.dev_type == OMAP34XXCAM_SLAVE_SENSOR) {
   rval = isp_get();
   if (rval < 0) {
       dev_err(&vdev->vfd->dev, "can't get ISP, sensor init                                    failed\n"); [Vaibhav] - Here it crashes.
        goto err;
    }
}

There are some instances where vdev->vfd is being accessed before initializing.

Quoted 117 lines

Cheers,

Nate

[    6.465606] [<c019e194>] (dev_driver_string+0x0/0x44) from [<c01cc5e0>] (omap34xxcam_device_register+0x110/0x2f8)
[    6.475952] [<c01cc4d0>] (omap34xxcam_device_register+0x0/0x2f8) from [<c01b91a0>] (__v4l2_int_device_try_attach_all+0xb0/0x108) [    6.487609]  r7:00000000 r6:c03e4fcc r5:cfbbf834 r4:c03e4f94 [    6.493347] [<c01b90f0>] (__v4l2_int_device_try_attach_all+0x0/0x108) from [<c01b9258>] (v4l2_int_device_register+0x60/0x7c)
[    6.504638]  r7:c03e4eec r6:cf9e5020 r5:c03e4f94 r4:c03e03f8 [    6.510375] [<c01b91f8>] (v4l2_int_device_register+0x0/0x7c) from [<c00182e4>] (ce131f_probe+0x88/0xa8)
[    6.519836]  r5:00000000 r4:cf9e5000
[    6.523437] [<c001825c>] (ce131f_probe+0x0/0xa8) from [<c01cefa4>]
(i2c_device_probe+0x78/0x90)
[    6.532226]  r5:cf9e5000 r4:c001825c
[    6.535827] [<c01cef2c>] (i2c_device_probe+0x0/0x90) from [<c01a1634>] (driver_probe_device+0xd4/0x180)
[    6.545318]  r7:c03e4eec r6:c03e4eec r5:cf9e50a8 r4:cf9e5020 [    6.551025] [<c01a1560>] (driver_probe_device+0x0/0x180) from [<c01a1748>] (__driver_attach+0x68/0x8c)
[    6.560394]  r7:c03e4eec r6:c03e4eec r5:cf9e50a8 r4:cf9e5020 [    6.566131] [<c01a16e0>] (__driver_attach+0x0/0x8c) from [<c01a0a8c>] (bus_for_each_dev+0x4c/0x84)
[    6.575164]  r7:c03e4eec r6:c01a16e0 r5:cf821cc8 r4:00000000 [    6.580871] [<c01a0a40>] (bus_for_each_dev+0x0/0x84) from [<c01a1478>] (driver_attach+0x20/0x28)
[    6.589721]  r7:cfb121a0 r6:c0018224 r5:c03e4eec r4:00000000 [    6.595458] [<c01a1458>] (driver_attach+0x0/0x28) from [<c01a1054>]
(bus_add_driver+0xa8/0x214)
[    6.604217] [<c01a0fac>] (bus_add_driver+0x0/0x214) from [<c01a196c>] (driver_register+0x98/0x120)
[    6.613250]  r8:00000000 r7:c03ef760 r6:c0018224 r5:c03e4eec r4:c03e4ec0
[    6.620025] [<c01a18d4>] (driver_register+0x0/0x120) from [<c01cfffc>] (i2c_register_driver+0x98/0xfc)
[    6.629425] [<c01cff64>] (i2c_register_driver+0x0/0xfc) from [<c001823c>] (ce131f_isp_init+0x18/0x38)
[    6.638702]  r7:c03ef760 r6:c0018224 r5:c0022d78 r4:c0023128 [    6.644439] [<c0018224>] (ce131f_isp_init+0x0/0x38) from [<c002a2d0>] (do_one_initcall+0x78/0x1d8)
[    6.653472]  r5:c0022d78 r4:c0023128
[    6.657073] [<c002a258>] (do_one_initcall+0x0/0x1d8) from [<c0008720>] (kernel_init+0x74/0xe0)
[    6.665740]  r8:00000000 r7:00000000 r6:00000000 r5:c0022d78 r4:c0023128
[    6.672515] [<c00086ac>] (kernel_init+0x0/0xe0) from [<c005c234>] (do_exit+0x0/0x684)
[    6.680419]  r5:00000000 r4:00000000
[    6.684020] Code: c036e993 e1a0c00d e92dd800 e24cb004 (e5903098) [    6.690246] ---[ end trace cc13b15a4191e849 ]---
[    6.694915] Kernel panic - not syncing: Attempted to kill init!

Quoted 3 lines · Sakari Ailus
Quoted 2 lines · Vaibhav

[Hiremath, Vaibhav] Sakari, Let me ask you basic question, have

you

Quoted 3 lines
Quoted 1 line

tested/verified these patch-sets?

For the ISP and camera drivers, yes. That's actually the only

thing that's

Quoted 3 lines

contained in the patchset.

Quoted 1 line

The reason I am asking this question is, for me it was not

working. I

Quoted 3 lines
Quoted 3 lines

had to debug this and found that -

- Changes missing in devices.c file, so isp_probe function will

not

Quoted 4 lines
Quoted 2 lines

be called at all, keeping omap3isp = NULL. You will end up into kernel crash in omap34xxcam_device_register.

Anyway a crash shouldn't happen here. Could I see the kernel oops

if there

Quoted 3 lines

was such?

Quoted 1 line

- The patches from Hiroshi DOYU doesn't build as is, you need to

add

Quoted 1 line
Quoted 1 line

one include line #include <linux/hardirq.h> in iovmmu.c (I am

using

Quoted 3 lines
Quoted 1 line

the patches submitted on 16th Jan 2009)

Just pull the iommu branch, the Hiroshi's original patches are

missing some

Quoted 1 line

hacks that you need to use them now. I'd expect Hiroshi to update

the

Quoted 3 lines

patchset when he comes back.

Quoted 1 line

I have attached "git diff" output here with this mail for

reference.

Quoted 7 lines

Please pull also the "base" branch.

--
Sakari Ailus
[email protected]

--
========================================================
DongSoo(Nathaniel), Kim
Engineer
Mobile S/W Platform Lab. S/W centre
Telecommunication R&D Centre
Samsung Electronics CO., LTD.
e-mail : [email protected]
          [email protected]
========================================================

Signature · 9 lines
========================================================
DongSoo(Nathaniel), Kim
Engineer
Mobile S/W Platform Lab. S/W Team.
DMC
Samsung Electronics CO., LTD.
e-mail : [email protected]
          [email protected]
========================================================
#25 lore raw
In reply to Hiremath, Vaibhav
Quoted 33 lines · Vaibhav

Thanks,
Vaibhav Hiremath

Quoted 9 lines

-----Original Message-----
From: DongSoo(Nathaniel) Kim [mailto:[email protected]]
Sent: Thursday, March 05, 2009 5:41 AM
To: Sakari Ailus
Cc: Hiremath, Vaibhav; [email protected]; linux- [email protected]; Aguirre Rodriguez, Sergio Alberto; Toivonen Tuukka Olli Artturi; Hiroshi DOYU
Subject: Re: [RFC 0/9] OMAP3 ISP and camera drivers

Quoted 6 lines

Hi Sakari,

I'm also facing same issue with Hiremath.

Here you are my kernel stack dump.

[Hiremath, Vaibhav] I was getting same kernel crash, The reason is -

Since isp_probe doesn't get called, leaving omap3isp = NULL. So isp_get will return -EBUSY from the very beginning of function. And the function "omap34xxcam_device_register" which calls isp_get tries to access vdev->vfd->dev where it crashes. Which is completely wrong, since the vfd gets initialize later part of function

if (hwc.dev_type == OMAP34XXCAM_SLAVE_SENSOR) {
    rval = isp_get();
    if (rval < 0) {
        dev_err(&vdev->vfd->dev, "can't get ISP, sensor init 					failed\n");
[Vaibhav] - Here it crashes.
         goto err;
     }
}
Quoted 1 line

There are some instances where vdev->vfd is being accessed before initializing.

Ooops.

Some parts of those dev_* were just mechanically changed from something else. And I think Alexey Klimov already notified me about that problem. I'm surprised that it was hit it so soon. ;)

Just removing the dev_err helps to resolve the crash, I guess. You could use late_initcall instead of module_init in the sensor, but that's just a hack, too.

If you are using modules, please load iommu2 and omap3-iommu before isp-mod.

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

PATCH 1/1 omap34xxcam: Don't use dev_err before we have a video device

In reply to Hiremath, Vaibhav

Also return -ENOMEM instead of -ENODEV if kzalloc fails.

Thanks to Alexey Klimov <[email protected]> for noticing this.

---
 drivers/media/video/omap34xxcam.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
drivers/media/video/omap34xxcam.c +9 -9
index 586718a..8398819 100644
@@ -1793,8 +1793,8 @@ static int omap34xxcam_device_register(struct v4l2_int_device *s)
 
 	mutex_lock(&vdev->mutex);
 	if (atomic_read(&vdev->users)) {
-		dev_err(&vdev->vfd->dev, "we're open (%d), can't register\n",
-			atomic_read(&vdev->users));
+		printk(KERN_ERR "%s: we're open (%d), can't register\n",
+		       __func__, atomic_read(&vdev->users));
 		mutex_unlock(&vdev->mutex);
 		return -EBUSY;
 	}
@@ -1806,8 +1806,8 @@ static int omap34xxcam_device_register(struct v4l2_int_device *s)
 	if (hwc.dev_type == OMAP34XXCAM_SLAVE_SENSOR) {
 		rval = isp_get();
 		if (rval < 0) {
-			dev_err(&vdev->vfd->dev,
-				"can't get ISP, sensor init failed\n");
+			printk(KERN_ERR "%s: can't get ISP, "
+			       "sensor init failed\n", __func__);
 			goto err;
 		}
 	}
@@ -1837,8 +1837,8 @@ static int omap34xxcam_device_register(struct v4l2_int_device *s)
 		/* initialize the video_device struct */
 		vdev->vfd = video_device_alloc();
 		if (!vdev->vfd) {
-			dev_err(&vdev->vfd->dev,
-				"could not allocate video device struct\n");
+			printk(KERN_ERR "%s: could not allocate "
+			       "video device struct\n", __func__);
 			return -ENOMEM;
 		}
 		vdev->vfd->release	= video_device_release;
@@ -1849,8 +1849,8 @@ static int omap34xxcam_device_register(struct v4l2_int_device *s)
 
 		if (video_register_device(vdev->vfd, VFL_TYPE_GRABBER,
 					  hwc.dev_minor) < 0) {
-			dev_err(&vdev->vfd->dev,
-				"could not register V4L device\n");
+			printk(KERN_ERR "%s: could not register V4L device\n",
+				__func__);
 			vdev->vfd->minor = -1;
 			rval = -EBUSY;
 			goto err;
@@ -1919,7 +1919,7 @@ static int __init omap34xxcam_init(void)
 	cam = kzalloc(sizeof(*cam), GFP_KERNEL);
 	if (!cam) {
 		printk(KERN_ERR "%s: could not allocate memory\n", __func__);
-		goto err;
+		return -ENOMEM;
 	}
 
 	omap34xxcam = cam;
Signature · 1 line
1.5.6.5
#27 lore raw
In reply to Sakari Ailus

Hi Sakari,

Reviewing your driver, I couldn't find JPEG sync mode or where to make programme ISP_CTRL with ISPCTRL_JPEG_FLUSH.
Is JPEG sync mode is not the coverage of this version? or I'm missing something. If JPEG sync mode is not considered yet please let me know.
Cheers,

Nate

Quoted 55 lines · Sakari Ailus

Hi,

So here's the patchset for OMAP 3 ISP and camera drivers plus the associated V4L changes. Sergio Aguirre has been posting a related patchset earlier, containing also sensor and lens driver used on SDP. This patchset is agains the linux-omap tree:

<URL:http://www.muru.com/linux/omap/README_OMAP_GIT>

So I and Sergio have synchronised our versions of the ISP and camera drivers and this is the end result. There is still a lot of work to do, though. You can find some comments in individual patch descriptions. If the todo list for a patch is empty it doesn't mean there wouldn't be anything left to do. ;)

There's at least one major change to Sergio Aguirre's earlier patches which is that the ISP driver now uses the IOMMU from Hiroshi Doyu. Hiroshi is away for some time now so there are just some hacks on top of Hiroshi's older iommu patches to use with current linux-omap.

This patchset does not contain the resizer or preview wrappers from TI but they have been left intentionally out. A proper interface (V4L) should be used for those and the camera driver should be somehow involved --- the wrappers are just duplicating much of the camera driver's functionality.

I don't have any sensor or lens drivers to publish at this time.

This patchset should work with the SDP and OMAPZoom boards although you need the associated sensor drivers + the board code from Sergio Aguirre to use it. You'll also need the IOMMU patchset from Hiroshi Doyu. Everything except the sensor / board stuff is available here:

<URL:http://www.gitorious.org/projects/omap3camera>

In short, on linux-omap:

$ git pull http://git.gitorious.org/omap3camera/mainline.git v4l \
 iommu omap3camera base

Hiroshi's original iommu tree is here (branch iommu):

<URL:http://git.gitorious.org/lk/mainline.git>

Some of the camera and ISP driver development history is available, too. See the first link.

Any feedback is appreciated.

Sincerely,

--
Sakari Ailus
[email protected]

Signature · 9 lines
========================================================
DongSoo(Nathaniel), Kim
Engineer
Mobile S/W Platform Lab. S/W Team.
DMC
Samsung Electronics CO., LTD.
e-mail : [email protected]
          [email protected]
========================================================