From: Olivier Lorin <olorin75@gmail.com>
To: LMML <linux-media@vger.kernel.org>
Subject: [PATCH 3/3] gspca_gl860
Date: Sat, 03 Oct 2009 15:03:28 +0200 [thread overview]
Message-ID: <4AC74BA0.6090606@gmail.com> (raw)
In-Reply-To: <4AC74B36.4080407@gmail.com>
gspca - gl860: add flip/mirror for OV2640
From: Olivier Lorin <o.lorin@laposte.net>
- add flip/mirror support for OV2640
- fix for backlight value range
- fix for red-blue inversion hue mode with V4L1 applications
diff -rupN ../gspca-msrc2/linux/drivers/media/video/gspca/gl860/gl860.h
./linux/drivers/media/video/gspca/gl860/gl860.h
--- ../gspca-msrc2/linux/drivers/media/video/gspca/gl860/gl860.h
2009-09-24 23:16:10.000000000 +0200
+++ ./linux/drivers/media/video/gspca/gl860/gl860.h 2009-09-24
23:55:32.000000000 +0200
@@ -23,7 +23,7 @@
#include "gspca.h"
#define MODULE_NAME "gspca_gl860"
-#define DRIVER_VERSION "0.9d11"
+#define DRIVER_VERSION "0.9e"
#define ctrl_in gl860_RTx
#define ctrl_out gl860_RTx
diff -rupN
../gspca-msrc2/linux/drivers/media/video/gspca/gl860/gl860-ov2640.c
./linux/drivers/media/video/gspca/gl860/gl860-ov2640.c
---
../gspca-msrc2/linux/drivers/media/video/gspca/gl860/gl860-ov2640.c
2009-09-24 23:34:57.000000000 +0200
+++ ./linux/drivers/media/video/gspca/gl860/gl860-ov2640.c 2009-09-30
00:40:49.000000000 +0200
@@ -107,36 +107,6 @@ static struct validx tbl_sensor_settings
{0x6001, 0x00ff}, {0x6038, 0x000c},
{10, 0xffff},
{0x6000, 0x0011},
- /* backlight=31/64 */
- {0x6001, 0x00ff}, {0x603e, 0x0024}, {0x6034, 0x0025},
- /* bright=0/256 */
- {0x6000, 0x00ff}, {0x6009, 0x007c}, {0x6000, 0x007d},
- /* wbal=64/128 */
- {0x6000, 0x00ff}, {0x6003, 0x007c}, {0x6040, 0x007d},
- /* cntr=0/256 */
- {0x6000, 0x00ff}, {0x6007, 0x007c}, {0x6000, 0x007d},
- /* sat=128/256 */
- {0x6000, 0x00ff}, {0x6001, 0x007c}, {0x6080, 0x007d},
- /* sharpness=0/32 */
- {0x6000, 0x00ff}, {0x6001, 0x0092}, {0x60c0, 0x0093},
- /* hue=0/256 */
- {0x6000, 0x00ff}, {0x6002, 0x007c}, {0x6000, 0x007d},
- /* gam=32/64 */
- {0x6000, 0x00ff}, {0x6008, 0x007c}, {0x6020, 0x007d},
- /* image right up */
- {0xffff, 0xffff},
- {15, 0xffff},
- {0x6001, 0x00ff}, {0x6000, 0x8004},
- {0xffff, 0xffff},
- {0x60a8, 0x0004},
- {15, 0xffff},
- {0x6001, 0x00ff}, {0x6000, 0x8004},
- {0xffff, 0xffff},
- {0x60f8, 0x0004},
- /* image right up */
- {0xffff, 0xffff},
- /* backlight=31/64 */
- {0x6001, 0x00ff}, {0x603e, 0x0024}, {0x6034, 0x0025},
};
static struct validx tbl_640[] = {
@@ -222,17 +192,19 @@ void ov2640_init_settings(struct gspca_d
sd->vcur.hue = 0;
sd->vcur.saturation = 128;
sd->vcur.whitebal = 64;
+ sd->vcur.mirror = 0;
+ sd->vcur.flip = 0;
sd->vmax.backlight = 64;
sd->vmax.brightness = 255;
sd->vmax.sharpness = 31;
sd->vmax.contrast = 255;
sd->vmax.gamma = 64;
- sd->vmax.hue = 255 + 1;
+ sd->vmax.hue = 254 + 2;
sd->vmax.saturation = 255;
sd->vmax.whitebal = 128;
- sd->vmax.mirror = 0;
- sd->vmax.flip = 0;
+ sd->vmax.mirror = 1;
+ sd->vmax.flip = 1;
sd->vmax.AC50Hz = 0;
sd->dev_camera_settings = ov2640_camera_settings;
@@ -284,6 +256,8 @@ static int ov2640_init_pre_alt(struct gs
sd->vold.gamma = -1;
sd->vold.hue = -1;
sd->vold.whitebal = -1;
+ sd->vold.mirror = -1;
+ sd->vold.flip = -1;
ov2640_init_post_alt(gspca_dev);
@@ -346,18 +320,6 @@ static int ov2640_init_post_alt(struct g
n = fetch_validx(gspca_dev, tbl_sensor_settings_common2,
ARRAY_SIZE(tbl_sensor_settings_common2));
- ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0000, 1, c50);
- keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common2,
- ARRAY_SIZE(tbl_sensor_settings_common2), n);
- ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x8004, 1, c28);
- keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common2,
- ARRAY_SIZE(tbl_sensor_settings_common2), n);
- ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x8004, 1, ca8);
- keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common2,
- ARRAY_SIZE(tbl_sensor_settings_common2), n);
- ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0000, 1, c50);
- keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common2,
- ARRAY_SIZE(tbl_sensor_settings_common2), n);
ov2640_camera_settings(gspca_dev);
@@ -394,6 +356,8 @@ static int ov2640_camera_settings(struct
s32 sat = sd->vcur.saturation;
s32 hue = sd->vcur.hue;
s32 wbal = sd->vcur.whitebal;
+ s32 mirror = (((sd->vcur.mirror > 0) ^ sd->mirrorMask) == 0);
+ s32 flip = (((sd->vcur.flip > 0) ^ sd->mirrorMask) == 0);
if (backlight != sd->vold.backlight) {
/* No sd->vold.backlight=backlight; (to be done again later) */
@@ -402,9 +366,9 @@ static int ov2640_camera_settings(struct
ctrl_out(gspca_dev, 0x40, 1, 0x6001 , 0x00ff,
0, NULL);
- ctrl_out(gspca_dev, 0x40, 1, 0x601f + backlight , 0x0024,
+ ctrl_out(gspca_dev, 0x40, 1, 0x601e + backlight , 0x0024,
0, NULL);
- ctrl_out(gspca_dev, 0x40, 1, 0x601f + backlight - 10, 0x0025,
+ ctrl_out(gspca_dev, 0x40, 1, 0x601e + backlight - 10, 0x0025,
0, NULL);
}
@@ -467,7 +431,7 @@ static int ov2640_camera_settings(struct
ctrl_out(gspca_dev, 0x40, 1, 0x6002 , 0x007c, 0, NULL);
ctrl_out(gspca_dev, 0x40, 1, 0x6000 + hue * (hue < 255), 0x007d,
0, NULL);
- if (hue >= sd->vmax.hue)
+ if (hue >= 255)
sd->swapRB = 1;
else
sd->swapRB = 0;
@@ -483,14 +447,33 @@ static int ov2640_camera_settings(struct
ctrl_out(gspca_dev, 0x40, 1, 0x6000 + gam, 0x007d, 0, NULL);
}
+ if (mirror != sd->vold.mirror || flip != sd->vold.flip) {
+ sd->vold.mirror = mirror;
+ sd->vold.flip = flip;
+
+ mirror = 0x80 * mirror;
+ ctrl_out(gspca_dev, 0x40, 1, 0x6001, 0x00ff, 0, NULL);
+ ctrl_out(gspca_dev, 0x40, 1, 0x6000, 0x8004, 0, NULL);
+ ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x8004, 1, &c28);
+ ctrl_out(gspca_dev, 0x40, 1, 0x6028 + mirror, 0x0004, 0, NULL);
+
+ flip = 0x50 * flip + mirror;
+ ctrl_out(gspca_dev, 0x40, 1, 0x6001, 0x00ff, 0, NULL);
+ ctrl_out(gspca_dev, 0x40, 1, 0x6000, 0x8004, 0, NULL);
+ ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x8004, 1, &ca8);
+ ctrl_out(gspca_dev, 0x40, 1, 0x6028 + flip, 0x0004, 0, NULL);
+
+ ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0000, 1, &c50);
+ }
+
if (backlight != sd->vold.backlight) {
sd->vold.backlight = backlight;
ctrl_out(gspca_dev, 0x40, 1, 0x6001 , 0x00ff,
0, NULL);
- ctrl_out(gspca_dev, 0x40, 1, 0x601f + backlight , 0x0024,
+ ctrl_out(gspca_dev, 0x40, 1, 0x601e + backlight , 0x0024,
0, NULL);
- ctrl_out(gspca_dev, 0x40, 1, 0x601f + backlight - 10, 0x0025,
+ ctrl_out(gspca_dev, 0x40, 1, 0x601e + backlight - 10, 0x0025,
0, NULL);
}
next prev parent reply other threads:[~2009-10-03 13:03 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-16 1:00 [2.6.31] ir-kbd-i2c oops Paweł Sikora
2009-09-16 1:00 ` Paweł Sikora
[not found] ` <200909160300.28382.pluto-PIIpFW8S9c0@public.gmane.org>
2009-09-16 6:57 ` Jean Delvare
2009-09-16 6:57 ` Jean Delvare
[not found] ` <20090916085701.6e883600-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-09-16 8:03 ` Paweł Sikora
2009-09-16 8:03 ` Paweł Sikora
[not found] ` <200909161003.33090.pluto-PIIpFW8S9c0@public.gmane.org>
2009-09-29 14:16 ` Jean Delvare
2009-09-29 14:16 ` Jean Delvare
[not found] ` <20090929161629.2a5c8d30-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-09-29 23:26 ` Hermann Pitton
2009-09-29 23:26 ` Hermann Pitton
2009-09-30 8:16 ` Paweł Sikora
2009-09-30 10:57 ` Jean Delvare
2009-09-30 11:52 ` Paweł Sikora
2009-09-30 12:25 ` Jean Delvare
2009-09-30 16:22 ` Paweł Sikora
2009-09-30 23:52 ` Andy Walls
2009-10-01 11:43 ` Jean Delvare
2009-10-03 10:08 ` Paweł Sikora
2009-10-03 12:04 ` Jean Delvare
2009-10-03 12:57 ` [PATCH 1/3] gspca_gl860 Olivier Lorin
2009-10-03 13:01 ` [PATCH 2/3] gspca_gl860 Olivier Lorin
2009-10-03 13:03 ` Olivier Lorin [this message]
[not found] ` <200910031730.45021.pluto@agmk.net>
2009-10-03 18:15 ` [2.6.31] ir-kbd-i2c oops Jean Delvare
2009-10-03 19:09 ` Paweł Sikora
2009-10-03 22:52 ` Hermann Pitton
2009-10-04 4:19 ` hermann pitton
2009-10-04 7:08 ` Paweł Sikora
2009-10-04 22:34 ` Hermann Pitton
2009-09-30 23:42 ` Andy Walls
2009-10-01 10:06 ` Jean Delvare
2009-10-01 10:17 ` Paweł Sikora
2009-10-01 10:42 ` Jean Delvare
2009-10-01 10:47 ` Paweł Sikora
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AC74BA0.6090606@gmail.com \
--to=olorin75@gmail.com \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.