Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 109530
b: refs/heads/master
c: dff6d32
h: refs/heads/master
v: v3
  • Loading branch information
Jean-Francois Moine authored and Mauro Carvalho Chehab committed Sep 3, 2008
1 parent 4e0d581 commit ffea73e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3a1ea7050345734acc3a33b2b00a611b9b7bf640
refs/heads/master: dff6d321d421c4c059aea72be70df3a8a200b8a3
43 changes: 37 additions & 6 deletions trunk/drivers/media/video/gspca/pac7311.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ static struct ctrl sd_ctrls[] = {
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Contrast",
.minimum = 0,
.maximum = 255,
#define CONTRAST_MAX 255
.maximum = CONTRAST_MAX,
.step = 1,
#define CONTRAST_DEF 127
#define CONTRAST_DEF 60
.default_value = CONTRAST_DEF,
},
.set = sd_setcontrast,
Expand All @@ -94,7 +95,7 @@ static struct ctrl sd_ctrls[] = {
{
.id = V4L2_CID_SATURATION,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Color",
.name = "Saturation",
.minimum = 0,
.maximum = 255,
.step = 1,
Expand Down Expand Up @@ -429,13 +430,42 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0;
}

/* rev 12a only */
static void setbrightcont(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int i, v;
static const __u8 max[10] =
{0x29, 0x33, 0x42, 0x5a, 0x6e, 0x80, 0x9f, 0xbb,
0xd4, 0xec};
static const __u8 delta[10] =
{0x35, 0x33, 0x33, 0x2f, 0x2a, 0x25, 0x1e, 0x17,
0x11, 0x0b};

reg_w(gspca_dev, 0xff, 0x00); /* page 0 */
for (i = 0; i < 10; i++) {
v = max[i];
v += (sd->brightness - BRIGHTNESS_MAX)
* 150 / BRIGHTNESS_MAX; /* 200 ? */
v -= delta[i] * sd->contrast / CONTRAST_MAX;
if (v < 0)
v = 0;
else if (v > 0xff)
v = 0xff;
reg_w(gspca_dev, 0xa2 + i, v);
}
reg_w(gspca_dev, 0xdc, 0x01);
}

static void setbrightness(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int brightness;

if (sd->sensor == SENSOR_PAC7302)
if (sd->sensor == SENSOR_PAC7302) {
setbrightcont(gspca_dev);
return;
}
/*jfm: inverted?*/
brightness = BRIGHTNESS_MAX - sd->brightness;
reg_w(gspca_dev, 0xff, 0x04);
Expand All @@ -449,13 +479,14 @@ static void setcontrast(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;

if (sd->sensor == SENSOR_PAC7302)
if (sd->sensor == SENSOR_PAC7302) {
setbrightcont(gspca_dev);
return;
}
reg_w(gspca_dev, 0xff, 0x01);
reg_w(gspca_dev, 0x80, sd->contrast);
/* load registers to sensor (Bit 0, auto clear) */
reg_w(gspca_dev, 0x11, 0x01);
PDEBUG(D_CONF|D_STREAM, "contrast: %i", sd->contrast);
}

static void setcolors(struct gspca_dev *gspca_dev)
Expand Down

0 comments on commit ffea73e

Please sign in to comment.