/* Linux driver for Philips webcam
USB and Video4Linux interface part.
(C) 1999-2004 Nemosoft Unv.
(C) 2004-2006 Luc Saillard (luc@saillard.org)
(C) 2011 Hans de Goede <hdegoede@redhat.com>
NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
driver and thus may have bugs that are not present in the original version.
Please send bug reports and support requests to <luc@saillard.org>.
The decompression routines have been implemented by reverse-engineering the
Nemosoft binary pwcx module. Caveat emptor.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/poll.h>
#include <linux/vmalloc.h>
#include <linux/jiffies.h>
#include <asm/io.h>
#include "pwc.h"
#define PWC_CID_CUSTOM(ctrl) ((V4L2_CID_USER_BASE | 0xf000) + custom_ ## ctrl)
static int pwc_g_volatile_ctrl(struct v4l2_ctrl *ctrl);
static int pwc_s_ctrl(struct v4l2_ctrl *ctrl);
static const struct v4l2_ctrl_ops pwc_ctrl_ops = {
.g_volatile_ctrl = pwc_g_volatile_ctrl,
.s_ctrl = pwc_s_ctrl,
};
enum { awb_indoor, awb_outdoor, awb_fl, awb_manual, awb_auto };
enum { custom_autocontour, custom_contour, custom_noise_reduction,
custom_save_user, custom_restore_user, custom_restore_factory };
const char * const pwc_auto_whitebal_qmenu[] = {
"Indoor (Incandescant Lighting) Mode",
"Outdoor (Sunlight) Mode",
"Indoor (Fluorescent Lighting) Mode",
"Manual Mode",
"Auto Mode",
NULL
};
static const struct v4l2_ctrl_config pwc_auto_white_balance_cfg = {
.ops = &pwc_ctrl_ops,
.id = V4L2_CID_AUTO_WHITE_BALANCE,
.type = V4L2_CTRL_TYPE_MENU,
.max = awb_auto,
.qmenu = pwc_auto_whitebal_qmenu,
};
static const struct v4l2_ctrl_config pwc_autocontour_cfg = {
.ops = &pwc_ctrl_ops,
.id = PWC_CID_CUSTOM(autocontour),
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "Auto contour",
.min = 0,
.max = 1,
.step = 1,
};
static const struct v4l2_ctrl_config pwc_contour_cfg = {
.ops = &pwc_ctrl_ops,
.id = PWC_CID_CUSTOM(contour),
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Contour",
.min = 0,
.max = 63,
.step = 1,
};
static const struct v4l2_ctrl_config pwc_backlight_cfg = {
.ops = &pwc_ctrl_ops,
.id = V4L2_CID_BACKLIGHT_COMPENSATION,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.min = 0,
.max = 1,
.step = 1,
};
static const struct v4l2_ctrl_config pwc_flicker_cfg = {
.ops = &pwc_ctrl_ops,
.id = V4L2_CID_BAND_STOP_FILTER,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.min = 0,
.max = 1,
.step = 1,
};
static const struct v4l2_ctrl_config pwc_noise_reduction_cfg = {
.ops = &pwc_ctrl_ops,
.id = PWC_CID_CUSTOM(noise_reduction),
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Dynamic Noise Reduction",
.min = 0,
.max = 3,
.step = 1,
};
static const struct v4l2_ctrl_config pwc_save_user_cfg = {
.ops = &pwc_ctrl_ops,
.id = PWC_CID_CUSTOM(save_user),
.type = V4L2_CTRL_TYPE_BUTTON,
<