aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2008-10-22 03:59:29 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-29 14:53:28 -0500
commit5017c7bde46abc859e0a350bcd591f502442d6af (patch)
tree5f0793ca027a44a3df90f42ea72035596bc152e8 /drivers
parent0cae89647e3f601029474b99c21b38a7ca781f07 (diff)
V4L/DVB (9543): gspca: Adjust autoexpo values for cams with a vga sensor in sonixb.
- This patch makes sonixb.c strife to different values during autoexposure for sif versus vga sensors. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/gspca/sonixb.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c
index 6c69bc7778fc..6608fc5a1939 100644
--- a/drivers/media/video/gspca/sonixb.c
+++ b/drivers/media/video/gspca/sonixb.c
@@ -132,8 +132,6 @@ struct sensor_data {
132 ignore atleast the 2 next frames for the new settings to come into effect 132 ignore atleast the 2 next frames for the new settings to come into effect
133 before doing any other adjustments */ 133 before doing any other adjustments */
134#define AUTOGAIN_IGNORE_FRAMES 3 134#define AUTOGAIN_IGNORE_FRAMES 3
135#define AUTOGAIN_DEADZONE 1000
136#define DESIRED_AVG_LUM 7000
137 135
138/* V4L2 controls supported by the driver */ 136/* V4L2 controls supported by the driver */
139static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); 137static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
@@ -827,17 +825,28 @@ static void setfreq(struct gspca_dev *gspca_dev)
827 825
828static void do_autogain(struct gspca_dev *gspca_dev) 826static void do_autogain(struct gspca_dev *gspca_dev)
829{ 827{
828 int deadzone, desired_avg_lum;
830 struct sd *sd = (struct sd *) gspca_dev; 829 struct sd *sd = (struct sd *) gspca_dev;
831 int avg_lum = atomic_read(&sd->avg_lum); 830 int avg_lum = atomic_read(&sd->avg_lum);
832 831
833 if (avg_lum == -1) 832 if (avg_lum == -1)
834 return; 833 return;
835 834
835 /* SIF / VGA sensors have a different autoexposure area and thus
836 different avg_lum values for the same picture brightness */
837 if (sensor_data[sd->sensor].flags & F_SIF) {
838 deadzone = 1000;
839 desired_avg_lum = 7000;
840 } else {
841 deadzone = 3000;
842 desired_avg_lum = 23000;
843 }
844
836 if (sd->autogain_ignore_frames > 0) 845 if (sd->autogain_ignore_frames > 0)
837 sd->autogain_ignore_frames--; 846 sd->autogain_ignore_frames--;
838 else if (gspca_auto_gain_n_exposure(gspca_dev, avg_lum, 847 else if (gspca_auto_gain_n_exposure(gspca_dev, avg_lum,
839 sd->brightness * DESIRED_AVG_LUM / 127, 848 sd->brightness * desired_avg_lum / 127,
840 AUTOGAIN_DEADZONE, GAIN_KNEE, EXPOSURE_KNEE)) { 849 deadzone, GAIN_KNEE, EXPOSURE_KNEE)) {
841 PDEBUG(D_FRAM, "autogain: gain changed: gain: %d expo: %d\n", 850 PDEBUG(D_FRAM, "autogain: gain changed: gain: %d expo: %d\n",
842 (int)sd->gain, (int)sd->exposure); 851 (int)sd->gain, (int)sd->exposure);
843 sd->autogain_ignore_frames = AUTOGAIN_IGNORE_FRAMES; 852 sd->autogain_ignore_frames = AUTOGAIN_IGNORE_FRAMES;