aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca
diff options
context:
space:
mode:
authorHans de Goede <j.w.r.degoede@hhs.nl>2008-07-14 09:11:42 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:26:28 -0400
commitad5ef80dd79851ea683e2d30ca4ebdc0c043a675 (patch)
tree6e1891b60ea558d70a9c8d855919a06d1727bc8f /drivers/media/video/gspca
parent4b972d29bbccc86877221164c7f39d52694d4a81 (diff)
V4L/DVB (8354): gspca: Better gain for bridge sn9c10x - sensor ov6650.
sonixb: Better gain for ov6650. Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl> Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/gspca')
-rw-r--r--drivers/media/video/gspca/sonixb.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c
index cfa62aef4700..6c97c8356d7f 100644
--- a/drivers/media/video/gspca/sonixb.c
+++ b/drivers/media/video/gspca/sonixb.c
@@ -39,8 +39,8 @@ struct sd {
39 sensor, so we use a per cam copy */ 39 sensor, so we use a per cam copy */
40 atomic_t avg_lum; 40 atomic_t avg_lum;
41 41
42 unsigned short gain; 42 unsigned char gain;
43 unsigned short exposure; 43 unsigned char exposure;
44 unsigned char brightness; 44 unsigned char brightness;
45 unsigned char autogain; 45 unsigned char autogain;
46 unsigned char autogain_ignore_frames; 46 unsigned char autogain_ignore_frames;
@@ -73,7 +73,7 @@ struct sd {
73 ignore atleast the 2 next frames for the new settings to come into effect 73 ignore atleast the 2 next frames for the new settings to come into effect
74 before doing any other adjustments */ 74 before doing any other adjustments */
75#define AUTOGAIN_IGNORE_FRAMES 3 75#define AUTOGAIN_IGNORE_FRAMES 3
76#define AUTOGAIN_DEADZONE 500 76#define AUTOGAIN_DEADZONE 1000
77#define DESIRED_AVG_LUM 7000 77#define DESIRED_AVG_LUM 7000
78 78
79/* V4L2 controls supported by the driver */ 79/* V4L2 controls supported by the driver */
@@ -107,10 +107,10 @@ static struct ctrl sd_ctrls[] = {
107 .type = V4L2_CTRL_TYPE_INTEGER, 107 .type = V4L2_CTRL_TYPE_INTEGER,
108 .name = "Gain", 108 .name = "Gain",
109 .minimum = 0, 109 .minimum = 0,
110 .maximum = 511, 110 .maximum = 255,
111 .step = 1, 111 .step = 1,
112#define GAIN_DEF 255 112#define GAIN_DEF 127
113#define GAIN_KNEE 400 113#define GAIN_KNEE 200
114 .default_value = GAIN_DEF, 114 .default_value = GAIN_DEF,
115 }, 115 },
116 .set = sd_setgain, 116 .set = sd_setgain,
@@ -122,9 +122,9 @@ static struct ctrl sd_ctrls[] = {
122 .type = V4L2_CTRL_TYPE_INTEGER, 122 .type = V4L2_CTRL_TYPE_INTEGER,
123 .name = "Exposure", 123 .name = "Exposure",
124#define EXPOSURE_DEF 0 124#define EXPOSURE_DEF 0
125#define EXPOSURE_KNEE 353 /* 10 fps */ 125#define EXPOSURE_KNEE 176 /* 10 fps */
126 .minimum = 0, 126 .minimum = 0,
127 .maximum = 511, 127 .maximum = 255,
128 .step = 1, 128 .step = 1,
129 .default_value = EXPOSURE_DEF, 129 .default_value = EXPOSURE_DEF,
130 .flags = 0, 130 .flags = 0,
@@ -563,11 +563,6 @@ err:
563static void setsensorgain(struct gspca_dev *gspca_dev) 563static void setsensorgain(struct gspca_dev *gspca_dev)
564{ 564{
565 struct sd *sd = (struct sd *) gspca_dev; 565 struct sd *sd = (struct sd *) gspca_dev;
566 unsigned short gain;
567
568 gain = (sd->gain + 1) >> 1;
569 if (gain > 255)
570 gain = 255;
571 566
572 switch (sd->sensor) { 567 switch (sd->sensor) {
573 568
@@ -575,14 +570,15 @@ static void setsensorgain(struct gspca_dev *gspca_dev)
575 __u8 i2c[] = 570 __u8 i2c[] =
576 {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10}; 571 {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10};
577 572
578 i2c[4] = 255 - gain; 573 i2c[4] = 255 - sd->gain;
579 if (i2c_w(gspca_dev, i2c) < 0) 574 if (i2c_w(gspca_dev, i2c) < 0)
580 goto err; 575 goto err;
581 break; 576 break;
582 } 577 }
583 case SENSOR_OV6650: { 578 case SENSOR_OV6650: {
584 __u8 i2c[] = {0xa0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}; 579 __u8 i2c[] = {0xa0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10};
585 i2c[3] = gain; 580
581 i2c[3] = sd->gain >> 3;
586 if (i2c_w(gspca_dev, i2c) < 0) 582 if (i2c_w(gspca_dev, i2c) < 0)
587 goto err; 583 goto err;
588 break; 584 break;
@@ -599,7 +595,7 @@ static void setgain(struct gspca_dev *gspca_dev)
599 __u8 gain; 595 __u8 gain;
600 __u8 rgb_value; 596 __u8 rgb_value;
601 597
602 gain = sd->gain >> 5; 598 gain = sd->gain >> 4;
603 599
604 /* red and blue gain */ 600 /* red and blue gain */
605 rgb_value = gain << 4 | gain; 601 rgb_value = gain << 4 | gain;
@@ -616,7 +612,7 @@ static void setexposure(struct gspca_dev *gspca_dev)
616{ 612{
617 struct sd *sd = (struct sd *) gspca_dev; 613 struct sd *sd = (struct sd *) gspca_dev;
618 /* translate 0 - 255 to a number of fps in a 30 - 1 scale */ 614 /* translate 0 - 255 to a number of fps in a 30 - 1 scale */
619 int fps = 30 - sd->exposure * 29 / 511; 615 int fps = 30 - sd->exposure * 29 / 255;
620 616
621 switch (sd->sensor) { 617 switch (sd->sensor) {
622 case SENSOR_TAS5110: { 618 case SENSOR_TAS5110: {