diff options
author | Hans de Goede <hdegoede@redhat.com> | 2012-04-27 10:32:24 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-07 15:11:48 -0400 |
commit | a648e310df9ff088d949befc8d1306264d970826 (patch) | |
tree | 264031cb8ec47aad286d35dd9f2d758993d3bc33 /drivers | |
parent | 4fd466a13008823648cf2ec6f06a03d90e6412ab (diff) |
[media] gspca/autogain_functions.h: Allow users to declare what they want
Allow users of gspca/autogain_functions.h to declare which of the autogain
algoritms they are going to use. This allows us to remove the hacks from
drivers which don't use coarse_grained_expo_autogain.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/gspca/autogain_functions.h | 6 | ||||
-rw-r--r-- | drivers/media/video/gspca/nw80x.c | 2 | ||||
-rw-r--r-- | drivers/media/video/gspca/pac7302.c | 4 | ||||
-rw-r--r-- | drivers/media/video/gspca/sonixb.c | 2 | ||||
-rw-r--r-- | drivers/media/video/gspca/sonixj.c | 5 | ||||
-rw-r--r-- | drivers/media/video/gspca/topro.c | 6 |
6 files changed, 13 insertions, 12 deletions
diff --git a/drivers/media/video/gspca/autogain_functions.h b/drivers/media/video/gspca/autogain_functions.h index 46777eee678b..d625eafe63eb 100644 --- a/drivers/media/video/gspca/autogain_functions.h +++ b/drivers/media/video/gspca/autogain_functions.h | |||
@@ -18,6 +18,7 @@ | |||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifdef WANT_REGULAR_AUTOGAIN | ||
21 | /* auto gain and exposure algorithm based on the knee algorithm described here: | 22 | /* auto gain and exposure algorithm based on the knee algorithm described here: |
22 | http://ytse.tricolour.net/docs/LowLightOptimization.html | 23 | http://ytse.tricolour.net/docs/LowLightOptimization.html |
23 | 24 | ||
@@ -91,7 +92,9 @@ static inline int auto_gain_n_exposure( | |||
91 | gain, exposure); | 92 | gain, exposure); |
92 | return retval; | 93 | return retval; |
93 | } | 94 | } |
95 | #endif | ||
94 | 96 | ||
97 | #ifdef WANT_COARSE_EXPO_AUTOGAIN | ||
95 | /* Autogain + exposure algorithm for cameras with a coarse exposure control | 98 | /* Autogain + exposure algorithm for cameras with a coarse exposure control |
96 | (usually this means we can only control the clockdiv to change exposure) | 99 | (usually this means we can only control the clockdiv to change exposure) |
97 | As changing the clockdiv so that the fps drops from 30 to 15 fps for | 100 | As changing the clockdiv so that the fps drops from 30 to 15 fps for |
@@ -103,7 +106,7 @@ static inline int auto_gain_n_exposure( | |||
103 | which leads to oscilating as one exposure step is huge. | 106 | which leads to oscilating as one exposure step is huge. |
104 | 107 | ||
105 | Note this assumes that the sd struct for the cam in question has | 108 | Note this assumes that the sd struct for the cam in question has |
106 | exp_too_high_cnt and exp_too_high_cnt int members for use by this function. | 109 | exp_too_low_cnt and exp_too_high_cnt int members for use by this function. |
107 | 110 | ||
108 | Returns 0 if no changes were made, 1 if the gain and or exposure settings | 111 | Returns 0 if no changes were made, 1 if the gain and or exposure settings |
109 | where changed. */ | 112 | where changed. */ |
@@ -177,3 +180,4 @@ static inline int coarse_grained_expo_autogain( | |||
177 | gain, exposure); | 180 | gain, exposure); |
178 | return retval; | 181 | return retval; |
179 | } | 182 | } |
183 | #endif | ||
diff --git a/drivers/media/video/gspca/nw80x.c b/drivers/media/video/gspca/nw80x.c index 7167cac7359c..42e021931e60 100644 --- a/drivers/media/video/gspca/nw80x.c +++ b/drivers/media/video/gspca/nw80x.c | |||
@@ -2001,6 +2001,8 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) | |||
2001 | return gspca_dev->usb_err; | 2001 | return gspca_dev->usb_err; |
2002 | } | 2002 | } |
2003 | 2003 | ||
2004 | #define WANT_REGULAR_AUTOGAIN | ||
2005 | #define WANT_COARSE_EXPO_AUTOGAIN | ||
2004 | #include "autogain_functions.h" | 2006 | #include "autogain_functions.h" |
2005 | 2007 | ||
2006 | static void do_autogain(struct gspca_dev *gspca_dev) | 2008 | static void do_autogain(struct gspca_dev *gspca_dev) |
diff --git a/drivers/media/video/gspca/pac7302.c b/drivers/media/video/gspca/pac7302.c index 30662fccb0cf..856cdd987f42 100644 --- a/drivers/media/video/gspca/pac7302.c +++ b/drivers/media/video/gspca/pac7302.c | |||
@@ -729,9 +729,7 @@ static void sd_stop0(struct gspca_dev *gspca_dev) | |||
729 | reg_w(gspca_dev, 0x78, 0x40); | 729 | reg_w(gspca_dev, 0x78, 0x40); |
730 | } | 730 | } |
731 | 731 | ||
732 | /* !! coarse_grained_expo_autogain is not used !! */ | 732 | #define WANT_REGULAR_AUTOGAIN |
733 | #define exp_too_low_cnt flags | ||
734 | #define exp_too_high_cnt sof_read | ||
735 | #include "autogain_functions.h" | 733 | #include "autogain_functions.h" |
736 | 734 | ||
737 | static void do_autogain(struct gspca_dev *gspca_dev) | 735 | static void do_autogain(struct gspca_dev *gspca_dev) |
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c index 6a1148d7fe92..e2bdf8f632f4 100644 --- a/drivers/media/video/gspca/sonixb.c +++ b/drivers/media/video/gspca/sonixb.c | |||
@@ -1000,6 +1000,8 @@ static void setfreq(struct gspca_dev *gspca_dev) | |||
1000 | } | 1000 | } |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | #define WANT_REGULAR_AUTOGAIN | ||
1004 | #define WANT_COARSE_EXPO_AUTOGAIN | ||
1003 | #include "autogain_functions.h" | 1005 | #include "autogain_functions.h" |
1004 | 1006 | ||
1005 | static void do_autogain(struct gspca_dev *gspca_dev) | 1007 | static void do_autogain(struct gspca_dev *gspca_dev) |
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index db8e5084df06..05c6d0c004d4 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
@@ -2800,10 +2800,7 @@ static void sd_stop0(struct gspca_dev *gspca_dev) | |||
2800 | } | 2800 | } |
2801 | } | 2801 | } |
2802 | 2802 | ||
2803 | /* !! coarse_grained_expo_autogain is not used !! */ | 2803 | #define WANT_REGULAR_AUTOGAIN |
2804 | #define exp_too_low_cnt bridge | ||
2805 | #define exp_too_high_cnt sensor | ||
2806 | |||
2807 | #include "autogain_functions.h" | 2804 | #include "autogain_functions.h" |
2808 | 2805 | ||
2809 | static void do_autogain(struct gspca_dev *gspca_dev) | 2806 | static void do_autogain(struct gspca_dev *gspca_dev) |
diff --git a/drivers/media/video/gspca/topro.c b/drivers/media/video/gspca/topro.c index 444d3c5b9079..c6326d177a3d 100644 --- a/drivers/media/video/gspca/topro.c +++ b/drivers/media/video/gspca/topro.c | |||
@@ -4675,11 +4675,9 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
4675 | /* -- do autogain -- */ | 4675 | /* -- do autogain -- */ |
4676 | /* gain setting is done in setexposure() for tp6810 */ | 4676 | /* gain setting is done in setexposure() for tp6810 */ |
4677 | static void setgain(struct gspca_dev *gspca_dev) {} | 4677 | static void setgain(struct gspca_dev *gspca_dev) {} |
4678 | /* !! coarse_grained_expo_autogain is not used !! */ | 4678 | #define WANT_REGULAR_AUTOGAIN |
4679 | #define exp_too_low_cnt bridge | ||
4680 | #define exp_too_high_cnt sensor | ||
4681 | |||
4682 | #include "autogain_functions.h" | 4679 | #include "autogain_functions.h" |
4680 | |||
4683 | static void sd_dq_callback(struct gspca_dev *gspca_dev) | 4681 | static void sd_dq_callback(struct gspca_dev *gspca_dev) |
4684 | { | 4682 | { |
4685 | struct sd *sd = (struct sd *) gspca_dev; | 4683 | struct sd *sd = (struct sd *) gspca_dev; |