public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mt9m111: Add automatic white balance control
@ 2008-12-01 21:15 Robert Jarzmik
  2008-12-17 18:20 ` Robert Jarzmik
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Jarzmik @ 2008-12-01 21:15 UTC (permalink / raw)
  To: g.liakhovetski; +Cc: video4linux-list

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/media/video/mt9m111.c |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c
index 9b9b377..208ec6c 100644
--- a/drivers/media/video/mt9m111.c
+++ b/drivers/media/video/mt9m111.c
@@ -90,7 +90,7 @@
 #define MT9M111_OUTPUT_FORMAT_CTRL2_B	0x19b
 
 #define MT9M111_OPMODE_AUTOEXPO_EN	(1 << 14)
-
+#define MT9M111_OPMODE_AUTOWHITEBAL_EN	(1 << 1)
 
 #define MT9M111_OUTFMT_PROCESSED_BAYER	(1 << 14)
 #define MT9M111_OUTFMT_BYPASS_IFP	(1 << 10)
@@ -163,6 +163,7 @@ struct mt9m111 {
 	unsigned int swap_rgb_red_blue:1;
 	unsigned int swap_yuv_y_chromas:1;
 	unsigned int swap_yuv_cb_cr:1;
+	unsigned int autowhitebalance:1;
 };
 
 static int reg_page_map_set(struct i2c_client *client, const u16 reg)
@@ -701,6 +702,23 @@ static int mt9m111_set_autoexposure(struct soc_camera_device *icd, int on)
 
 	return ret;
 }
+
+static int mt9m111_set_autowhitebalance(struct soc_camera_device *icd, int on)
+{
+	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
+	int ret;
+
+	if (on)
+		ret = reg_set(OPER_MODE_CTRL, MT9M111_OPMODE_AUTOWHITEBAL_EN);
+	else
+		ret = reg_clear(OPER_MODE_CTRL, MT9M111_OPMODE_AUTOWHITEBAL_EN);
+
+	if (!ret)
+		mt9m111->autowhitebalance = on;
+
+	return ret;
+}
+
 static int mt9m111_get_control(struct soc_camera_device *icd,
 			       struct v4l2_control *ctrl)
 {
@@ -737,6 +755,9 @@ static int mt9m111_get_control(struct soc_camera_device *icd,
 	case V4L2_CID_EXPOSURE_AUTO:
 		ctrl->value = mt9m111->autoexposure;
 		break;
+	case V4L2_CID_AUTO_WHITE_BALANCE:
+		ctrl->value = mt9m111->autowhitebalance;
+		break;
 	}
 	return 0;
 }
@@ -770,6 +791,9 @@ static int mt9m111_set_control(struct soc_camera_device *icd,
 	case V4L2_CID_EXPOSURE_AUTO:
 		ret =  mt9m111_set_autoexposure(icd, ctrl->value);
 		break;
+	case V4L2_CID_AUTO_WHITE_BALANCE:
+		ret =  mt9m111_set_autowhitebalance(icd, ctrl->value);
+		break;
 	default:
 		ret = -EINVAL;
 	}
@@ -788,6 +812,7 @@ static int mt9m111_restore_state(struct soc_camera_device *icd)
 	mt9m111_set_flip(icd, mt9m111->vflip, MT9M111_RMB_MIRROR_ROWS);
 	mt9m111_set_global_gain(icd, icd->gain);
 	mt9m111_set_autoexposure(icd, mt9m111->autoexposure);
+	mt9m111_set_autowhitebalance(icd, mt9m111->autowhitebalance);
 	return 0;
 }
 
@@ -882,6 +907,7 @@ static int mt9m111_video_probe(struct soc_camera_device *icd)
 		goto eisis;
 
 	mt9m111->autoexposure = 1;
+	mt9m111->autowhitebalance = 1;
 
 	mt9m111->swap_rgb_even_odd = 1;
 	mt9m111->swap_rgb_red_blue = 1;
-- 
1.5.6.5

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] mt9m111: Add automatic white balance control
  2008-12-01 21:15 [PATCH] mt9m111: Add automatic white balance control Robert Jarzmik
@ 2008-12-17 18:20 ` Robert Jarzmik
  2008-12-17 18:30   ` soc-camera: current stack (was Re: [PATCH] mt9m111: Add automatic white balance control) Guennadi Liakhovetski
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Jarzmik @ 2008-12-17 18:20 UTC (permalink / raw)
  To: g.liakhovetski; +Cc: video4linux-list

Robert Jarzmik <robert.jarzmik@free.fr> writes:

> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
> ---
>  drivers/media/video/mt9m111.c |   28 +++++++++++++++++++++++++++-
>  1 files changed, 27 insertions(+), 1 deletions(-)

Hi Guennadi,

As I see you working for the next tree submission, I wonder if you had seen that
patch a couple of days ago ?

Cheers.

--
Robert

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 8+ messages in thread

* soc-camera: current stack (was Re: [PATCH] mt9m111: Add automatic white balance control)
  2008-12-17 18:20 ` Robert Jarzmik
@ 2008-12-17 18:30   ` Guennadi Liakhovetski
  2008-12-20  1:14     ` soc-camera: current stack Guennadi Liakhovetski
  0 siblings, 1 reply; 8+ messages in thread
From: Guennadi Liakhovetski @ 2008-12-17 18:30 UTC (permalink / raw)
  To: Robert Jarzmik; +Cc: video4linux-list

On Wed, 17 Dec 2008, Robert Jarzmik wrote:

> Robert Jarzmik <robert.jarzmik@free.fr> writes:
> 
> > Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
> > ---
> >  drivers/media/video/mt9m111.c |   28 +++++++++++++++++++++++++++-
> >  1 files changed, 27 insertions(+), 1 deletions(-)
> 
> Hi Guennadi,
> 
> As I see you working for the next tree submission, I wonder if you had seen that
> patch a couple of days ago ?

Yes. My current stack is at

http://gross-embedded.homelinux.org/~lyakh/v4l-20081217/

the first 9 of those patch have been pushed upstream with a previous 
request.

Everyone who has contributed to soc-camera is kindly requested to have a 
look, if I have missed anything, besides, we should very well test it - 
there are a lot of changes there in the core and in all drivers.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: soc-camera: current stack
  2008-12-17 18:30   ` soc-camera: current stack (was Re: [PATCH] mt9m111: Add automatic white balance control) Guennadi Liakhovetski
@ 2008-12-20  1:14     ` Guennadi Liakhovetski
  2008-12-24 17:26       ` Robert Jarzmik
  0 siblings, 1 reply; 8+ messages in thread
From: Guennadi Liakhovetski @ 2008-12-20  1:14 UTC (permalink / raw)
  To: video4linux-list

I uploaded an updated version of the soc-camera patch stack at

http://gross-embedded.homelinux.org/~lyakh/v4l-20081219/

This should produce an equivalent of what is currently in my hg tree - at 
least in what soc-camera concerns. If there's any interest, I might look 
into installing a git-server and providing a git-tree with soc-camera 
patches on that server, for 3 users to pull 5 putches every 2 weeks my 
400MHz ARM9 on a dyndns ADSL line should be enough:-)

Next on queue (not yet in any of the directories on that server)

mt9t031
tw9910
i.MX31
prepare pxa, sh, and all cameras to handle extra SOCAM_ flags being 
	checked in soc_camera_bus_param_compatible()
check extra SOCAM_ flags in soc_camera_bus_param_compatible()

we'll try to do the latter two slowly and carefully...

Thanks
Guennadi
---
Guennadi Liakhovetski

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: soc-camera: current stack
  2008-12-20  1:14     ` soc-camera: current stack Guennadi Liakhovetski
@ 2008-12-24 17:26       ` Robert Jarzmik
  2008-12-24 17:34         ` Guennadi Liakhovetski
  2008-12-24 17:36         ` Robert Jarzmik
  0 siblings, 2 replies; 8+ messages in thread
From: Robert Jarzmik @ 2008-12-24 17:26 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: video4linux-list

Guennadi Liakhovetski <g.liakhovetski@gmx.de> writes:

> This should produce an equivalent of what is currently in my hg tree - at 
> least in what soc-camera concerns. If there's any interest, I might look 
> into installing a git-server and providing a git-tree with soc-camera 
> patches on that server, for 3 users to pull 5 putches every 2 weeks my 
> 400MHz ARM9 on a dyndns ADSL line should be enough:-)
>
> Next on queue (not yet in any of the directories on that server)

Hi Guennadi,

I made some tests of your patches against mainline tree (2.6.28-rc4 actually),
on pxa271 + mt9m111.

I have one little problem I can't remember having before :

[  728.372987] Backtrace:
[  728.378014] [<bf05f230>] (mt9m111_set_register+0x0/0x80 [mt9m111]) from [<bf056300>] (soc_camera_s_register+0x2c/0x38 [soc_camera])
[  728.388248]  r5:039e6cf0 r4:00000018
[  728.393278] [<bf0562d4>] (soc_camera_s_register+0x0/0x38 [soc_camera]) from [<c0164734>] (__video_ioctl2+0x684/0x39a4)
[  728.403419] [<c01640b0>] (__video_ioctl2+0x0/0x39a4) from [<c0167a70>] (video_ioctl2+0x1c/0x20)
[  728.413404] [<c0167a54>] (video_ioctl2+0x0/0x20) from [<c009a8fc>] (vfs_ioctl+0x74/0x78)
[  728.423393] [<c009a888>] (vfs_ioctl+0x0/0x78) from [<c009acb8>] (do_vfs_ioctl+0x390/0x4ac)
[  728.433342]  r5:039e6cf0 r4:c39d3340
[  728.438221] [<c009a928>] (do_vfs_ioctl+0x0/0x4ac) from [<c009ae14>] (sys_ioctl+0x40/0x68)
[  728.447976] [<c009add4>] (sys_ioctl+0x0/0x68) from [<c0024e80>] (ret_fast_syscall+0x0/0x2c)
[  728.457785]  r7:00000036 r6:4018564f r5:039e6cf0 r4:00000000
[  728.462692] Code: e89da800 e1a0c00d e92dd830 e24cb004 (e5913000)
[  728.468135] ---[ end trace a231255d0862dac6 ]---

I'm not sure whether the problem is not on my setup, I hadn't touched it for
days. I know after opening the video device, I setup a camera register before
taking the picture (to set up the test pattern and automate my non-regression
tests).

Will check after Christmas :)

Cheers.

--
Robert

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: soc-camera: current stack
  2008-12-24 17:26       ` Robert Jarzmik
@ 2008-12-24 17:34         ` Guennadi Liakhovetski
  2008-12-24 17:36         ` Robert Jarzmik
  1 sibling, 0 replies; 8+ messages in thread
From: Guennadi Liakhovetski @ 2008-12-24 17:34 UTC (permalink / raw)
  To: Robert Jarzmik; +Cc: video4linux-list

On Wed, 24 Dec 2008, Robert Jarzmik wrote:

> Guennadi Liakhovetski <g.liakhovetski@gmx.de> writes:
> 
> > This should produce an equivalent of what is currently in my hg tree - at 
> > least in what soc-camera concerns. If there's any interest, I might look 
> > into installing a git-server and providing a git-tree with soc-camera 
> > patches on that server, for 3 users to pull 5 putches every 2 weeks my 
> > 400MHz ARM9 on a dyndns ADSL line should be enough:-)
> >
> > Next on queue (not yet in any of the directories on that server)
> 
> Hi Guennadi,
> 
> I made some tests of your patches against mainline tree (2.6.28-rc4 actually),
> on pxa271 + mt9m111.
> 
> I have one little problem I can't remember having before :
> 
> [  728.372987] Backtrace:
> [  728.378014] [<bf05f230>] (mt9m111_set_register+0x0/0x80 [mt9m111]) from [<bf056300>] (soc_camera_s_register+0x2c/0x38 [soc_camera])
> [  728.388248]  r5:039e6cf0 r4:00000018
> [  728.393278] [<bf0562d4>] (soc_camera_s_register+0x0/0x38 [soc_camera]) from [<c0164734>] (__video_ioctl2+0x684/0x39a4)
> [  728.403419] [<c01640b0>] (__video_ioctl2+0x0/0x39a4) from [<c0167a70>] (video_ioctl2+0x1c/0x20)
> [  728.413404] [<c0167a54>] (video_ioctl2+0x0/0x20) from [<c009a8fc>] (vfs_ioctl+0x74/0x78)
> [  728.423393] [<c009a888>] (vfs_ioctl+0x0/0x78) from [<c009acb8>] (do_vfs_ioctl+0x390/0x4ac)
> [  728.433342]  r5:039e6cf0 r4:c39d3340
> [  728.438221] [<c009a928>] (do_vfs_ioctl+0x0/0x4ac) from [<c009ae14>] (sys_ioctl+0x40/0x68)
> [  728.447976] [<c009add4>] (sys_ioctl+0x0/0x68) from [<c0024e80>] (ret_fast_syscall+0x0/0x2c)
> [  728.457785]  r7:00000036 r6:4018564f r5:039e6cf0 r4:00000000
> [  728.462692] Code: e89da800 e1a0c00d e92dd830 e24cb004 (e5913000)
> [  728.468135] ---[ end trace a231255d0862dac6 ]---

You didn't post the top part - from ---[ start trace ... ]--- (or whatever 
it is marked), it shows the exact PC and the reason for the Oops. But it's 
strange - I don't think anything has changed aroung controls / 
get/set_register. Have you replaced both the kernel and the modules? 
Sorry, stupid question, but it really looks strange.

> I'm not sure whether the problem is not on my setup, I hadn't touched it for
> days. I know after opening the video device, I setup a camera register before
> taking the picture (to set up the test pattern and automate my non-regression
> tests).
> 
> Will check after Christmas :)

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: soc-camera: current stack
  2008-12-24 17:26       ` Robert Jarzmik
  2008-12-24 17:34         ` Guennadi Liakhovetski
@ 2008-12-24 17:36         ` Robert Jarzmik
  2008-12-24 17:39           ` Guennadi Liakhovetski
  1 sibling, 1 reply; 8+ messages in thread
From: Robert Jarzmik @ 2008-12-24 17:36 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: video4linux-list

Robert Jarzmik <robert.jarzmik@free.fr> writes:

> I made some tests of your patches against mainline tree (2.6.28-rc4 actually),
> on pxa271 + mt9m111.
>
> I'm not sure whether the problem is not on my setup, I hadn't touched it for
> days. I know after opening the video device, I setup a camera register before
> taking the picture (to set up the test pattern and automate my non-regression
> tests).

OK, I found. Was on my side, my kernel and my modules were not in sync (the
CONFIG_VIDEO_ADV_DEBUG was in modules, not in kernel).

So you should know the whole serie is working fine on my setup :)))

Cheers.

--
Robert

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: soc-camera: current stack
  2008-12-24 17:36         ` Robert Jarzmik
@ 2008-12-24 17:39           ` Guennadi Liakhovetski
  0 siblings, 0 replies; 8+ messages in thread
From: Guennadi Liakhovetski @ 2008-12-24 17:39 UTC (permalink / raw)
  To: Robert Jarzmik; +Cc: video4linux-list

On Wed, 24 Dec 2008, Robert Jarzmik wrote:

> Robert Jarzmik <robert.jarzmik@free.fr> writes:
> 
> > I made some tests of your patches against mainline tree (2.6.28-rc4 actually),
> > on pxa271 + mt9m111.
> >
> > I'm not sure whether the problem is not on my setup, I hadn't touched it for
> > days. I know after opening the video device, I setup a camera register before
> > taking the picture (to set up the test pattern and automate my non-regression
> > tests).
> 
> OK, I found. Was on my side, my kernel and my modules were not in sync (the
> CONFIG_VIDEO_ADV_DEBUG was in modules, not in kernel).

So, my guess was right:-)

> So you should know the whole serie is working fine on my setup :)))

Great, thanks for testing!

Regards
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-12-24 17:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-01 21:15 [PATCH] mt9m111: Add automatic white balance control Robert Jarzmik
2008-12-17 18:20 ` Robert Jarzmik
2008-12-17 18:30   ` soc-camera: current stack (was Re: [PATCH] mt9m111: Add automatic white balance control) Guennadi Liakhovetski
2008-12-20  1:14     ` soc-camera: current stack Guennadi Liakhovetski
2008-12-24 17:26       ` Robert Jarzmik
2008-12-24 17:34         ` Guennadi Liakhovetski
2008-12-24 17:36         ` Robert Jarzmik
2008-12-24 17:39           ` Guennadi Liakhovetski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox