[media] gspca: Remove gspca_auto_gain_n_exposure function
authorHans de Goede <hdegoede@redhat.com>
Thu, 10 May 2012 11:39:28 +0000 (08:39 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 14 May 2012 12:44:21 +0000 (09:44 -0300)
Now that the pac207 driver has been converted to the control framework, there
are no remaining users.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/gspca.c
drivers/media/video/gspca/gspca.h

index 38b124ec23a3c50627e4af1423aaf2498be972ac..2b393b2cf62de9f824d68a1ddffe98927028ba61 100644 (file)
@@ -2435,95 +2435,6 @@ int gspca_resume(struct usb_interface *intf)
 }
 EXPORT_SYMBOL(gspca_resume);
 #endif
-/* -- cam driver utility functions -- */
-
-/* auto gain and exposure algorithm based on the knee algorithm described here:
-   http://ytse.tricolour.net/docs/LowLightOptimization.html
-
-   Returns 0 if no changes were made, 1 if the gain and or exposure settings
-   where changed. */
-int gspca_auto_gain_n_exposure(struct gspca_dev *gspca_dev, int avg_lum,
-       int desired_avg_lum, int deadzone, int gain_knee, int exposure_knee)
-{
-       int i, steps, gain, orig_gain, exposure, orig_exposure, autogain;
-       const struct ctrl *gain_ctrl = NULL;
-       const struct ctrl *exposure_ctrl = NULL;
-       const struct ctrl *autogain_ctrl = NULL;
-       int retval = 0;
-
-       for (i = 0; i < gspca_dev->sd_desc->nctrls; i++) {
-               if (gspca_dev->ctrl_dis & (1 << i))
-                       continue;
-               if (gspca_dev->sd_desc->ctrls[i].qctrl.id == V4L2_CID_GAIN)
-                       gain_ctrl = &gspca_dev->sd_desc->ctrls[i];
-               if (gspca_dev->sd_desc->ctrls[i].qctrl.id == V4L2_CID_EXPOSURE)
-                       exposure_ctrl = &gspca_dev->sd_desc->ctrls[i];
-               if (gspca_dev->sd_desc->ctrls[i].qctrl.id == V4L2_CID_AUTOGAIN)
-                       autogain_ctrl = &gspca_dev->sd_desc->ctrls[i];
-       }
-       if (!gain_ctrl || !exposure_ctrl || !autogain_ctrl) {
-               PDEBUG(D_ERR, "Error: gspca_auto_gain_n_exposure called "
-                       "on cam without (auto)gain/exposure");
-               return 0;
-       }
-
-       if (gain_ctrl->get(gspca_dev, &gain) ||
-                       exposure_ctrl->get(gspca_dev, &exposure) ||
-                       autogain_ctrl->get(gspca_dev, &autogain) || !autogain)
-               return 0;
-
-       orig_gain = gain;
-       orig_exposure = exposure;
-
-       /* If we are of a multiple of deadzone, do multiple steps to reach the
-          desired lumination fast (with the risc of a slight overshoot) */
-       steps = abs(desired_avg_lum - avg_lum) / deadzone;
-
-       PDEBUG(D_FRAM, "autogain: lum: %d, desired: %d, steps: %d",
-               avg_lum, desired_avg_lum, steps);
-
-       for (i = 0; i < steps; i++) {
-               if (avg_lum > desired_avg_lum) {
-                       if (gain > gain_knee)
-                               gain--;
-                       else if (exposure > exposure_knee)
-                               exposure--;
-                       else if (gain > gain_ctrl->qctrl.default_value)
-                               gain--;
-                       else if (exposure > exposure_ctrl->qctrl.minimum)
-                               exposure--;
-                       else if (gain > gain_ctrl->qctrl.minimum)
-                               gain--;
-                       else
-                               break;
-               } else {
-                       if (gain < gain_ctrl->qctrl.default_value)
-                               gain++;
-                       else if (exposure < exposure_knee)
-                               exposure++;
-                       else if (gain < gain_knee)
-                               gain++;
-                       else if (exposure < exposure_ctrl->qctrl.maximum)
-                               exposure++;
-                       else if (gain < gain_ctrl->qctrl.maximum)
-                               gain++;
-                       else
-                               break;
-               }
-       }
-
-       if (gain != orig_gain) {
-               gain_ctrl->set(gspca_dev, gain);
-               retval = 1;
-       }
-       if (exposure != orig_exposure) {
-               exposure_ctrl->set(gspca_dev, exposure);
-               retval = 1;
-       }
-
-       return retval;
-}
-EXPORT_SYMBOL(gspca_auto_gain_n_exposure);
 
 /* -- module insert / remove -- */
 static int __init gspca_init(void)
index dd15e07d4666824eaebb376c442f21980f35696b..dc688c7f5e4811845ce5f8add9de98a3ea2cdeec 100644 (file)
@@ -251,8 +251,6 @@ void gspca_frame_add(struct gspca_dev *gspca_dev,
 int gspca_suspend(struct usb_interface *intf, pm_message_t message);
 int gspca_resume(struct usb_interface *intf);
 #endif
-int gspca_auto_gain_n_exposure(struct gspca_dev *gspca_dev, int avg_lum,
-       int desired_avg_lum, int deadzone, int gain_knee, int exposure_knee);
 int gspca_expo_autogain(struct gspca_dev *gspca_dev, int avg_lum,
        int desired_avg_lum, int deadzone, int gain_knee, int exposure_knee);
 int gspca_coarse_grained_expo_autogain(struct gspca_dev *gspca_dev,