Commit b80b601f authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (23 commits)
  V4L/DVB (8617): uvcvideo: don't use stack-based buffers for USB transfers.
  V4L/DVB (8616): uvcvideo: Add support for two Bison Electronics webcams
  V4L/DVB (8611): Add suspend/resume to pxa_camera driver
  V4L/DVB (8610): Add suspend/resume capabilities to soc_camera.
  V4L/DVB (8609): media: Clean up platform_driver_unregister() bogosity.
  V4L/DVB (8607): cxusb: fix OOPS and broken tuning regression on FusionHDTV Dual Digital 4
  V4L/DVB (8605): gspca: Fix of gspca_zc3xx oops - 2.6.27-rc1
  V4L/DVB (8604): gspca: Fix of "scheduling while atomic" crash.
  V4L/DVB (8602): gspca: Fix small bugs, simplify and cleanup ov519.
  V4L/DVB (8582): set mts_firmware for em2882 based Pinnacle Hybrid Pro
  V4L/DVB (8574): gspca: Bad bytesperlines of pixelformat in spca505/506/508 and vc023x.
  V4L/DVB (8573): gspca: Bad scan of frame in spca505/506/508.
  V4L/DVB (8572): gspca: Webcam 0c45:6143 in documentation.
  V4L/DVB (8571): gspca: Don't use CONFIG_VIDEO_ADV_DEBUG as a compile option.
  V4L/DVB (8569): gspca: Set back the old values of Sonix sn9c120 and cleanup source.
  V4L/DVB (8567): gspca: hflip and vflip controls added for ov519 - ov7670 plus init cleanup.
  V4L/DVB (8564): fix vino driver build error
  V4L/DVB (8563): fix drivers/media/video/arv.c compilation
  V4L/DVB (8562): DVB_DRX397XD: remove FW_LOADER select
  V4L/DVB (8558): media/video/Kconfig: fix a typo
  ...
parents a06dee41 04793dd0
...@@ -226,6 +226,7 @@ sonixj 0c45:6130 Sonix Pccam ...@@ -226,6 +226,7 @@ sonixj 0c45:6130 Sonix Pccam
sonixj 0c45:6138 Sn9c120 Mo4000 sonixj 0c45:6138 Sn9c120 Mo4000
sonixj 0c45:613b Surfer SN-206 sonixj 0c45:613b Surfer SN-206
sonixj 0c45:613c Sonix Pccam168 sonixj 0c45:613c Sonix Pccam168
sonixj 0c45:6143 Sonix Pccam168
sunplus 0d64:0303 Sunplus FashionCam DXG sunplus 0d64:0303 Sunplus FashionCam DXG
etoms 102c:6151 Qcam Sangha CIF etoms 102c:6151 Qcam Sangha CIF
etoms 102c:6251 Qcam xxxxxx VGA etoms 102c:6251 Qcam xxxxxx VGA
......
...@@ -565,7 +565,8 @@ static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -565,7 +565,8 @@ static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap)
static int dvico_bluebird_xc2028_callback(void *ptr, int command, int arg) static int dvico_bluebird_xc2028_callback(void *ptr, int command, int arg)
{ {
struct dvb_usb_device *d = ptr; struct dvb_usb_adapter *adap = ptr;
struct dvb_usb_device *d = adap->dev;
switch (command) { switch (command) {
case XC2028_TUNER_RESET: case XC2028_TUNER_RESET:
...@@ -593,9 +594,9 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -593,9 +594,9 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
.callback = dvico_bluebird_xc2028_callback, .callback = dvico_bluebird_xc2028_callback,
}; };
static struct xc2028_ctrl ctl = { static struct xc2028_ctrl ctl = {
.fname = "xc3028-dvico-au-01.fw", .fname = "xc3028-v27.fw",
.max_len = 64, .max_len = 64,
.scode_table = XC3028_FE_ZARLINK456, .demod = XC3028_FE_ZARLINK456,
}; };
fe = dvb_attach(xc2028_attach, adap->fe, &cfg); fe = dvb_attach(xc2028_attach, adap->fe, &cfg);
......
...@@ -135,9 +135,8 @@ config DVB_CX22702 ...@@ -135,9 +135,8 @@ config DVB_CX22702
config DVB_DRX397XD config DVB_DRX397XD
tristate "Micronas DRX3975D/DRX3977D based" tristate "Micronas DRX3975D/DRX3977D based"
depends on DVB_CORE && I2C && HOTPLUG depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE default m if DVB_FE_CUSTOMISE
select FW_LOADER
help help
A DVB-T tuner module. Say Y when you want to support this frontend. A DVB-T tuner module. Say Y when you want to support this frontend.
......
...@@ -630,7 +630,7 @@ config VIDEO_ZORAN_ZR36060 ...@@ -630,7 +630,7 @@ config VIDEO_ZORAN_ZR36060
depends on VIDEO_ZORAN depends on VIDEO_ZORAN
help help
Say Y to support Zoran boards based on 36060 chips. Say Y to support Zoran boards based on 36060 chips.
This includes Iomega Bus, Pinnacle DC10, Linux media Labs 33 This includes Iomega Buz, Pinnacle DC10, Linux media Labs 33
and 33 R10 and AverMedia 6 boards. and 33 R10 and AverMedia 6 boards.
config VIDEO_ZORAN_BUZ config VIDEO_ZORAN_BUZ
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/videodev.h> #include <linux/videodev.h>
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -755,7 +756,6 @@ static const struct file_operations ar_fops = { ...@@ -755,7 +756,6 @@ static const struct file_operations ar_fops = {
static struct video_device ar_template = { static struct video_device ar_template = {
.name = "Colour AR VGA", .name = "Colour AR VGA",
.type = VID_TYPE_CAPTURE,
.fops = &ar_fops, .fops = &ar_fops,
.release = ar_release, .release = ar_release,
.minor = -1, .minor = -1,
......
...@@ -1015,6 +1015,7 @@ struct em28xx_board em28xx_boards[] = { ...@@ -1015,6 +1015,7 @@ struct em28xx_board em28xx_boards[] = {
.valid = EM28XX_BOARD_NOT_VALIDATED, .valid = EM28XX_BOARD_NOT_VALIDATED,
.vchannels = 3, .vchannels = 3,
.tuner_type = TUNER_XC2028, .tuner_type = TUNER_XC2028,
.mts_firmware = 1,
.decoder = EM28XX_TVP5150, .decoder = EM28XX_TVP5150,
.input = { { .input = { {
.type = EM28XX_VMUX_TELEVISION, .type = EM28XX_VMUX_TELEVISION,
......
...@@ -123,7 +123,7 @@ static void reg_r(struct gspca_dev *gspca_dev, ...@@ -123,7 +123,7 @@ static void reg_r(struct gspca_dev *gspca_dev,
{ {
struct usb_device *dev = gspca_dev->dev; struct usb_device *dev = gspca_dev->dev;
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef GSPCA_DEBUG
if (len > sizeof gspca_dev->usb_buf) { if (len > sizeof gspca_dev->usb_buf) {
err("reg_r: buffer overflow"); err("reg_r: buffer overflow");
return; return;
...@@ -163,7 +163,7 @@ static void reg_w(struct gspca_dev *gspca_dev, ...@@ -163,7 +163,7 @@ static void reg_w(struct gspca_dev *gspca_dev,
{ {
struct usb_device *dev = gspca_dev->dev; struct usb_device *dev = gspca_dev->dev;
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef GSPCA_DEBUG
if (len > sizeof gspca_dev->usb_buf) { if (len > sizeof gspca_dev->usb_buf) {
err("reg_w: buffer overflow"); err("reg_w: buffer overflow");
return; return;
......
...@@ -233,7 +233,7 @@ static void reg_r(struct gspca_dev *gspca_dev, ...@@ -233,7 +233,7 @@ static void reg_r(struct gspca_dev *gspca_dev,
{ {
struct usb_device *dev = gspca_dev->dev; struct usb_device *dev = gspca_dev->dev;
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef GSPCA_DEBUG
if (len > sizeof gspca_dev->usb_buf) { if (len > sizeof gspca_dev->usb_buf) {
err("reg_r: buffer overflow"); err("reg_r: buffer overflow");
return; return;
...@@ -271,7 +271,7 @@ static void reg_w(struct gspca_dev *gspca_dev, ...@@ -271,7 +271,7 @@ static void reg_w(struct gspca_dev *gspca_dev,
{ {
struct usb_device *dev = gspca_dev->dev; struct usb_device *dev = gspca_dev->dev;
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef GSPCA_DEBUG
if (len > sizeof gspca_dev->usb_buf) { if (len > sizeof gspca_dev->usb_buf) {
err("reg_w: buffer overflow"); err("reg_w: buffer overflow");
return; return;
...@@ -461,6 +461,52 @@ static void Et_init2(struct gspca_dev *gspca_dev) ...@@ -461,6 +461,52 @@ static void Et_init2(struct gspca_dev *gspca_dev)
reg_w_val(gspca_dev, 0x80, 0x20); /* 0x20; */ reg_w_val(gspca_dev, 0x80, 0x20); /* 0x20; */
} }
static void setbrightness(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int i;
__u8 brightness = sd->brightness;
for (i = 0; i < 4; i++)
reg_w_val(gspca_dev, ET_O_RED + i, brightness);
}
static void getbrightness(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int i;
int brightness = 0;
for (i = 0; i < 4; i++) {
reg_r(gspca_dev, ET_O_RED + i, 1);
brightness += gspca_dev->usb_buf[0];
}
sd->brightness = brightness >> 3;
}
static void setcontrast(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
__u8 RGBG[] = { 0x80, 0x80, 0x80, 0x80, 0x00, 0x00 };
__u8 contrast = sd->contrast;
memset(RGBG, contrast, sizeof(RGBG) - 2);
reg_w(gspca_dev, ET_G_RED, RGBG, 6);
}
static void getcontrast(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int i;
int contrast = 0;
for (i = 0; i < 4; i++) {
reg_r(gspca_dev, ET_G_RED + i, 1);
contrast += gspca_dev->usb_buf[0];
}
sd->contrast = contrast >> 2;
}
static void setcolors(struct gspca_dev *gspca_dev) static void setcolors(struct gspca_dev *gspca_dev)
{ {
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
...@@ -492,6 +538,16 @@ static void getcolors(struct gspca_dev *gspca_dev) ...@@ -492,6 +538,16 @@ static void getcolors(struct gspca_dev *gspca_dev)
} }
} }
static void setautogain(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
if (sd->autogain)
sd->ag_cnt = AG_CNT_START;
else
sd->ag_cnt = -1;
}
static void Et_init1(struct gspca_dev *gspca_dev) static void Et_init1(struct gspca_dev *gspca_dev)
{ {
__u8 value; __u8 value;
...@@ -614,6 +670,7 @@ static int sd_config(struct gspca_dev *gspca_dev, ...@@ -614,6 +670,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
sd->contrast = CONTRAST_DEF; sd->contrast = CONTRAST_DEF;
sd->colors = COLOR_DEF; sd->colors = COLOR_DEF;
sd->autogain = AUTOGAIN_DEF; sd->autogain = AUTOGAIN_DEF;
sd->ag_cnt = -1;
return 0; return 0;
} }
...@@ -641,6 +698,8 @@ static void sd_start(struct gspca_dev *gspca_dev) ...@@ -641,6 +698,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
else else
Et_init2(gspca_dev); Et_init2(gspca_dev);
setautogain(gspca_dev);
reg_w_val(gspca_dev, ET_RESET_ALL, 0x08); reg_w_val(gspca_dev, ET_RESET_ALL, 0x08);
et_video(gspca_dev, 1); /* video on */ et_video(gspca_dev, 1); /* video on */
} }
...@@ -658,52 +717,6 @@ static void sd_close(struct gspca_dev *gspca_dev) ...@@ -658,52 +717,6 @@ static void sd_close(struct gspca_dev *gspca_dev)
{ {
} }
static void setbrightness(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int i;
__u8 brightness = sd->brightness;
for (i = 0; i < 4; i++)
reg_w_val(gspca_dev, ET_O_RED + i, brightness);
}
static void getbrightness(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int i;
int brightness = 0;
for (i = 0; i < 4; i++) {
reg_r(gspca_dev, ET_O_RED + i, 1);
brightness += gspca_dev->usb_buf[0];
}
sd->brightness = brightness >> 3;
}
static void setcontrast(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
__u8 RGBG[] = { 0x80, 0x80, 0x80, 0x80, 0x00, 0x00 };
__u8 contrast = sd->contrast;
memset(RGBG, contrast, sizeof(RGBG) - 2);
reg_w(gspca_dev, ET_G_RED, RGBG, 6);
}
static void getcontrast(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int i;
int contrast = 0;
for (i = 0; i < 4; i++) {
reg_r(gspca_dev, ET_G_RED + i, 1);
contrast += gspca_dev->usb_buf[0];
}
sd->contrast = contrast >> 2;
}
static __u8 Et_getgainG(struct gspca_dev *gspca_dev) static __u8 Et_getgainG(struct gspca_dev *gspca_dev)
{ {
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
...@@ -733,15 +746,22 @@ static void Et_setgainG(struct gspca_dev *gspca_dev, __u8 gain) ...@@ -733,15 +746,22 @@ static void Et_setgainG(struct gspca_dev *gspca_dev, __u8 gain)
#define LIMIT(color) \ #define LIMIT(color) \
(unsigned char)((color > 0xff)?0xff:((color < 0)?0:color)) (unsigned char)((color > 0xff)?0xff:((color < 0)?0:color))
static void setautogain(struct gspca_dev *gspca_dev) static void do_autogain(struct gspca_dev *gspca_dev)
{ {
__u8 luma = 0; struct sd *sd = (struct sd *) gspca_dev;
__u8 luma;
__u8 luma_mean = 128; __u8 luma_mean = 128;
__u8 luma_delta = 20; __u8 luma_delta = 20;
__u8 spring = 4; __u8 spring = 4;
int Gbright = 0; int Gbright;
__u8 r, g, b; __u8 r, g, b;
if (sd->ag_cnt < 0)
return;
if (--sd->ag_cnt >= 0)
return;
sd->ag_cnt = AG_CNT_START;
Gbright = Et_getgainG(gspca_dev); Gbright = Et_getgainG(gspca_dev);
reg_r(gspca_dev, ET_LUMA_CENTER, 4); reg_r(gspca_dev, ET_LUMA_CENTER, 4);
g = (gspca_dev->usb_buf[0] + gspca_dev->usb_buf[3]) >> 1; g = (gspca_dev->usb_buf[0] + gspca_dev->usb_buf[3]) >> 1;
...@@ -768,7 +788,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, ...@@ -768,7 +788,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
__u8 *data, /* isoc packet */ __u8 *data, /* isoc packet */
int len) /* iso packet length */ int len) /* iso packet length */
{ {
struct sd *sd;
int seqframe; int seqframe;
seqframe = data[0] & 0x3f; seqframe = data[0] & 0x3f;
...@@ -783,13 +802,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, ...@@ -783,13 +802,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
data, 0); data, 0);
gspca_frame_add(gspca_dev, FIRST_PACKET, frame, data, len); gspca_frame_add(gspca_dev, FIRST_PACKET, frame, data, len);
sd = (struct sd *) gspca_dev;
if (sd->ag_cnt >= 0) {
if (--sd->ag_cnt < 0) {
sd->ag_cnt = AG_CNT_START;
setautogain(gspca_dev);
}
}
return; return;
} }
if (len) { if (len) {
...@@ -862,10 +874,8 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) ...@@ -862,10 +874,8 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
sd->autogain = val; sd->autogain = val;
if (val) if (gspca_dev->streaming)
sd->ag_cnt = AG_CNT_START; setautogain(gspca_dev);
else
sd->ag_cnt = -1;
return 0; return 0;
} }
...@@ -889,6 +899,7 @@ static struct sd_desc sd_desc = { ...@@ -889,6 +899,7 @@ static struct sd_desc sd_desc = {
.stop0 = sd_stop0, .stop0 = sd_stop0,
.close = sd_close, .close = sd_close,
.pkt_scan = sd_pkt_scan, .pkt_scan = sd_pkt_scan,
.dq_callback = do_autogain,
}; };
/* -- module initialisation -- */ /* -- module initialisation -- */
......
...@@ -47,7 +47,7 @@ MODULE_LICENSE("GPL"); ...@@ -47,7 +47,7 @@ MODULE_LICENSE("GPL");
static int video_nr = -1; static int video_nr = -1;
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef GSPCA_DEBUG
int gspca_debug = D_ERR | D_PROBE; int gspca_debug = D_ERR | D_PROBE;
EXPORT_SYMBOL(gspca_debug); EXPORT_SYMBOL(gspca_debug);
...@@ -677,7 +677,7 @@ static int try_fmt_vid_cap(struct gspca_dev *gspca_dev, ...@@ -677,7 +677,7 @@ static int try_fmt_vid_cap(struct gspca_dev *gspca_dev,
w = fmt->fmt.pix.width; w = fmt->fmt.pix.width;
h = fmt->fmt.pix.height; h = fmt->fmt.pix.height;
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef GSPCA_DEBUG
if (gspca_debug & D_CONF) if (gspca_debug & D_CONF)
PDEBUG_MODE("try fmt cap", fmt->fmt.pix.pixelformat, w, h); PDEBUG_MODE("try fmt cap", fmt->fmt.pix.pixelformat, w, h);
#endif #endif
...@@ -785,7 +785,7 @@ static int dev_open(struct inode *inode, struct file *file) ...@@ -785,7 +785,7 @@ static int dev_open(struct inode *inode, struct file *file)
} }
gspca_dev->users++; gspca_dev->users++;
file->private_data = gspca_dev; file->private_data = gspca_dev;
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef GSPCA_DEBUG
/* activate the v4l2 debug */ /* activate the v4l2 debug */
if (gspca_debug & D_V4L2) if (gspca_debug & D_V4L2)
gspca_dev->vdev.debug |= 3; gspca_dev->vdev.debug |= 3;
...@@ -904,7 +904,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, ...@@ -904,7 +904,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
if (ctrl->id != ctrls->qctrl.id) if (ctrl->id != ctrls->qctrl.id)
continue; continue;
if (ctrl->value < ctrls->qctrl.minimum if (ctrl->value < ctrls->qctrl.minimum
&& ctrl->value > ctrls->qctrl.maximum) || ctrl->value > ctrls->qctrl.maximum)
return -ERANGE; return -ERANGE;
PDEBUG(D_CONF, "set ctrl [%08x] = %d", ctrl->id, ctrl->value); PDEBUG(D_CONF, "set ctrl [%08x] = %d", ctrl->id, ctrl->value);
if (mutex_lock_interruptible(&gspca_dev->usb_lock)) if (mutex_lock_interruptible(&gspca_dev->usb_lock))
...@@ -1080,7 +1080,7 @@ static int vidioc_streamon(struct file *file, void *priv, ...@@ -1080,7 +1080,7 @@ static int vidioc_streamon(struct file *file, void *priv,
if (ret < 0) if (ret < 0)
goto out; goto out;
} }
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef GSPCA_DEBUG
if (gspca_debug & D_STREAM) { if (gspca_debug & D_STREAM) {
PDEBUG_MODE("stream on OK", PDEBUG_MODE("stream on OK",
gspca_dev->pixfmt, gspca_dev->pixfmt,
...@@ -1913,7 +1913,7 @@ static void __exit gspca_exit(void) ...@@ -1913,7 +1913,7 @@ static void __exit gspca_exit(void)
module_init(gspca_init); module_init(gspca_init);
module_exit(gspca_exit); module_exit(gspca_exit);
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef GSPCA_DEBUG
module_param_named(debug, gspca_debug, int, 0644); module_param_named(debug, gspca_debug, int, 0644);
MODULE_PARM_DESC(debug, MODULE_PARM_DESC(debug,
"Debug (bit) 0x01:error 0x02:probe 0x04:config" "Debug (bit) 0x01:error 0x02:probe 0x04:config"
......
...@@ -9,7 +9,10 @@ ...@@ -9,7 +9,10 @@
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#ifdef CONFIG_VIDEO_ADV_DEBUG /* compilation option */
#define GSPCA_DEBUG 1
#ifdef GSPCA_DEBUG
/* GSPCA our debug messages */ /* GSPCA our debug messages */
extern int gspca_debug; extern int gspca_debug;
#define PDEBUG(level, fmt, args...) \ #define PDEBUG(level, fmt, args...) \
......
This diff is collapsed.
...@@ -31,7 +31,9 @@ MODULE_LICENSE("GPL"); ...@@ -31,7 +31,9 @@ MODULE_LICENSE("GPL");
struct sd { struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */ struct gspca_dev gspca_dev; /* !! must be the first item */
int avg_lum; int lum_sum;
atomic_t avg_lum;
atomic_t do_gain;
unsigned char brightness; unsigned char brightness;
unsigned char contrast; unsigned char contrast;
...@@ -271,6 +273,7 @@ static int sd_config(struct gspca_dev *gspca_dev, ...@@ -271,6 +273,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
sd->contrast = CONTRAST_DEF; sd->contrast = CONTRAST_DEF;
sd->colors = COLOR_DEF; sd->colors = COLOR_DEF;
sd->autogain = AUTOGAIN_DEF; sd->autogain = AUTOGAIN_DEF;
sd->ag_cnt = -1;
return 0; return 0;
} }
...@@ -311,6 +314,18 @@ static void setcolors(struct gspca_dev *gspca_dev) ...@@ -311,6 +314,18 @@ static void setcolors(struct gspca_dev *gspca_dev)
PDEBUG(D_CONF|D_STREAM, "color: %i", sd->colors); PDEBUG(D_CONF|D_STREAM, "color: %i", sd->colors);
} }
static void setautogain(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
if (sd->autogain) {
sd->lum_sum = 0;
sd->ag_cnt = AG_CNT_START;
} else {
sd->ag_cnt = -1;
}
}
/* this function is called at open time */ /* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev) static int sd_open(struct gspca_dev *gspca_dev)
{ {
...@@ -320,8 +335,6 @@ static int sd_open(struct gspca_dev *gspca_dev) ...@@ -320,8 +335,6 @@ static int sd_open(struct gspca_dev *gspca_dev)
static void sd_start(struct gspca_dev *gspca_dev) static void sd_start(struct gspca_dev *gspca_dev)
{ {
struct sd *sd = (struct sd *) gspca_dev;
reg_w(gspca_dev, 0xff, 0x01); reg_w(gspca_dev, 0xff, 0x01);
reg_w_buf(gspca_dev, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8); reg_w_buf(gspca_dev, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8);
reg_w_buf(gspca_dev, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8); reg_w_buf(gspca_dev, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8);
...@@ -394,6 +407,7 @@ static void sd_start(struct gspca_dev *gspca_dev) ...@@ -394,6 +407,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
setcontrast(gspca_dev); setcontrast(gspca_dev);
setbrightness(gspca_dev); setbrightness(gspca_dev);
setcolors(gspca_dev); setcolors(gspca_dev);
setautogain(gspca_dev);
/* set correct resolution */ /* set correct resolution */
switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
...@@ -431,13 +445,6 @@ static void sd_start(struct gspca_dev *gspca_dev) ...@@ -431,13 +445,6 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0xff, 0x01); reg_w(gspca_dev, 0xff, 0x01);
reg_w(gspca_dev, 0x78, 0x04); reg_w(gspca_dev, 0x78, 0x04);
reg_w(gspca_dev, 0x78, 0x05); reg_w(gspca_dev, 0x78, 0x05);
if (sd->autogain) {
sd->ag_cnt = AG_CNT_START;
sd->avg_lum = 0;
} else {
sd->ag_cnt = -1;
}
} }
static void sd_stopN(struct gspca_dev *gspca_dev) static void sd_stopN(struct gspca_dev *gspca_dev)
...@@ -473,13 +480,20 @@ static void sd_close(struct gspca_dev *gspca_dev) ...@@ -473,13 +480,20 @@ static void sd_close(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */
} }
static void setautogain(struct gspca_dev *gspca_dev, int luma) static void do_autogain(struct gspca_dev *gspca_dev)
{ {
struct sd *sd = (struct sd *) gspca_dev;
int luma;
int luma_mean = 128; int luma_mean = 128;
int luma_delta = 20; int luma_delta = 20;
__u8 spring = 5; __u8 spring = 5;
int Gbright; int Gbright;
if (!atomic_read(&sd->do_gain))
return;
atomic_set(&sd->do_gain, 0);
luma = atomic_read(&sd->avg_lum);
Gbright = reg_r(gspca_dev, 0x02); Gbright = reg_r(gspca_dev, 0x02);
PDEBUG(D_FRAM, "luma mean %d", luma); PDEBUG(D_FRAM, "luma mean %d", luma);
if (luma < luma_mean - luma_delta || if (luma < luma_mean - luma_delta ||
...@@ -523,12 +537,13 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, ...@@ -523,12 +537,13 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
/* start of frame */ /* start of frame */
if (sd->ag_cnt >= 0 && p > 28) { if (sd->ag_cnt >= 0 && p > 28) {
sd->avg_lum += data[p - 23]; sd->lum_sum += data[p - 23];
if (--sd->ag_cnt < 0) { if (--sd->ag_cnt < 0) {
sd->ag_cnt = AG_CNT_START; sd->ag_cnt = AG_CNT_START;
setautogain(gspca_dev, atomic_set(&sd->avg_lum,
sd->avg_lum / AG_CNT_START); sd->lum_sum / AG_CNT_START);
sd->avg_lum = 0; sd->lum_sum = 0;
atomic_set(&sd->do_gain, 1);
} }
} }
...@@ -677,12 +692,8 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) ...@@ -677,12 +692,8 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
sd->autogain = val; sd->autogain = val;
if (val) { if (gspca_dev->streaming)
sd->ag_cnt = AG_CNT_START; setautogain(gspca_dev);
sd->avg_lum = 0;
} else {
sd->ag_cnt = -1;
}
return 0; return 0;
} }
...@@ -706,6 +717,7 @@ static struct sd_desc sd_desc = { ...@@ -706,6 +717,7 @@ static struct sd_desc sd_desc = {
.stop0 = sd_stop0, .stop0 = sd_stop0,
.close = sd_close, .close = sd_close,
.pkt_scan = sd_pkt_scan, .pkt_scan = sd_pkt_scan,
.dq_callback = do_autogain,
}; };
/* -- module initialisation -- */ /* -- module initialisation -- */
......
...@@ -408,7 +408,7 @@ static void reg_w(struct gspca_dev *gspca_dev, ...@@ -408,7 +408,7 @@ static void reg_w(struct gspca_dev *gspca_dev,
const __u8 *buffer, const __u8 *buffer,
int len) int len)
{ {
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef GSPCA_DEBUG
if (len > sizeof gspca_dev->usb_buf) { if (len > sizeof gspca_dev->usb_buf) {
PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow"); PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow");
return; return;
......
This diff is collapsed.
...@@ -61,27 +61,27 @@ static struct ctrl sd_ctrls[] = { ...@@ -61,27 +61,27 @@ static struct ctrl sd_ctrls[] = {
static struct v4l2_pix_format vga_mode[] = { static struct v4l2_pix_format vga_mode[] = {
{160, 120, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE, {160, 120, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
.bytesperline = 160 * 3, .bytesperline = 160,
.sizeimage = 160 * 120 * 3 / 2, .sizeimage = 160 * 120 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 5}, .priv = 5},
{176, 144, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE, {176, 144, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
.bytesperline = 176 * 3, .bytesperline = 176,
.sizeimage = 176 * 144 * 3 / 2, .sizeimage = 176 * 144 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 4}, .priv = 4},
{320, 240, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE, {320, 240, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
.bytesperline = 320 * 3, .bytesperline = 320,
.sizeimage = 320 * 240 * 3 / 2, .sizeimage = 320 * 240 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 2}, .priv = 2},
{352, 288, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE, {352, 288, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
.bytesperline = 352 * 3, .bytesperline = 352,
.sizeimage = 352 * 288 * 3 / 2, .sizeimage = 352 * 288 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 1}, .priv = 1},
{640, 480, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE, {640, 480, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
.bytesperline = 640 * 3, .bytesperline = 640,
.sizeimage = 640 * 480 * 3 / 2, .sizeimage = 640 * 480 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0}, .priv = 0},
...@@ -776,7 +776,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, ...@@ -776,7 +776,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
default: default:
data += 1; data += 1;
len -= 1; len -= 1;
gspca_frame_add(gspca_dev, FIRST_PACKET, frame, gspca_frame_add(gspca_dev, INTER_PACKET, frame,
data, len); data, len);
break; break;
} }
......
...@@ -112,27 +112,27 @@ static struct ctrl sd_ctrls[] = { ...@@ -112,27 +112,27 @@ static struct ctrl sd_ctrls[] = {
static struct v4l2_pix_format vga_mode[] = { static struct v4l2_pix_format vga_mode[] = {
{160, 120, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE, {160, 120, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
.bytesperline = 160 * 3, .bytesperline = 160,
.sizeimage = 160 * 120 * 3 / 2, .sizeimage = 160 * 120 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 5}, .priv = 5},
{176, 144, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE, {176, 144, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
.bytesperline = 176 * 3, .bytesperline = 176,
.sizeimage = 176 * 144 * 3 / 2, .sizeimage = 176 * 144 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 4}, .priv = 4},
{320, 240, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE, {320, 240, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
.bytesperline = 320 * 3, .bytesperline = 320,
.sizeimage = 320 * 240 * 3 / 2, .sizeimage = 320 * 240 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 2}, .priv = 2},
{352, 288, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE, {352, 288, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
.bytesperline = 352 * 3, .bytesperline = 352,
.sizeimage = 352 * 288 * 3 / 2, .sizeimage = 352 * 288 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 1}, .priv = 1},
{640, 480, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE, {640, 480, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
.bytesperline = 640 * 3, .bytesperline = 640,
.sizeimage = 640 * 480 * 3 / 2, .sizeimage = 640 * 480 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0}, .priv = 0},
...@@ -588,7 +588,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, ...@@ -588,7 +588,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
default: default:
data += 1; data += 1;
len -= 1; len -= 1;
gspca_frame_add(gspca_dev, FIRST_PACKET, frame, gspca_frame_add(gspca_dev, INTER_PACKET, frame,
data, len); data, len);
break; break;
} }
......
...@@ -63,23 +63,23 @@ static struct ctrl sd_ctrls[] = { ...@@ -63,23 +63,23 @@ static struct ctrl sd_ctrls[] = {
}; };
static struct v4l2_pix_format sif_mode[] = { static struct v4l2_pix_format sif_mode[] = {
{160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, {160, 120, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
.bytesperline = 160 * 3, .bytesperline = 160,
.sizeimage = 160 * 120 * 3 / 2, .sizeimage = 160 * 120 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 3}, .priv = 3},
{176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, {176, 144, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
.bytesperline = 176 * 3, .bytesperline = 176,
.sizeimage = 176 * 144 * 3 / 2, .sizeimage = 176 * 144 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 2}, .priv = 2},
{320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, {320, 240, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
.bytesperline = 320 * 3, .bytesperline = 320,
.sizeimage = 320 * 240 * 3 / 2, .sizeimage = 320 * 240 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 1}, .priv = 1},
{352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, {352, 288, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
.bytesperline = 352 * 3, .bytesperline = 352,
.sizeimage = 352 * 288 * 3 / 2, .sizeimage = 352 * 288 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0}, .priv = 0},
...@@ -1583,7 +1583,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, ...@@ -1583,7 +1583,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
default: default:
data += 1; data += 1;
len -= 1; len -= 1;
gspca_frame_add(gspca_dev, FIRST_PACKET, frame, gspca_frame_add(gspca_dev, INTER_PACKET, frame,
data, len); data, len);
break; break;
} }
......
...@@ -644,6 +644,18 @@ static void setcontrast(struct gspca_dev *gspca_dev) ...@@ -644,6 +644,18 @@ static void setcontrast(struct gspca_dev *gspca_dev)
} }
} }
static void setautogain(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
if (sd->chip_revision == Rev072A) {
if (sd->autogain)
sd->ag_cnt = AG_CNT_START;
else
sd->ag_cnt = -1;
}
}
static void sd_start(struct gspca_dev *gspca_dev) static void sd_start(struct gspca_dev *gspca_dev)
{ {
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
...@@ -671,6 +683,7 @@ static void sd_start(struct gspca_dev *gspca_dev) ...@@ -671,6 +683,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w_val(dev, 0x8500, mode); /* mode */ reg_w_val(dev, 0x8500, mode); /* mode */
reg_w_val(dev, 0x8700, Clck); /* 0x27 clock */ reg_w_val(dev, 0x8700, Clck); /* 0x27 clock */
reg_w_val(dev, 0x8112, 0x10 | 0x20); reg_w_val(dev, 0x8112, 0x10 | 0x20);
setautogain(gspca_dev);
break; break;
default: default:
/* case Rev012A: */ /* case Rev012A: */
...@@ -720,18 +733,24 @@ static void sd_close(struct gspca_dev *gspca_dev) ...@@ -720,18 +733,24 @@ static void sd_close(struct gspca_dev *gspca_dev)
reg_w_val(gspca_dev->dev, 0x8114, 0); reg_w_val(gspca_dev->dev, 0x8114, 0);
} }
static void setautogain(struct gspca_dev *gspca_dev) static void do_autogain(struct gspca_dev *gspca_dev)
{ {
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
int expotimes = 0; int expotimes;
int pixelclk = 0; int pixelclk;
int gainG = 0; int gainG;
__u8 R, Gr, Gb, B; __u8 R, Gr, Gb, B;
int y; int y;
__u8 luma_mean = 110; __u8 luma_mean = 110;
__u8 luma_delta = 20; __u8 luma_delta = 20;
__u8 spring = 4; __u8 spring = 4;
if (sd->ag_cnt < 0)
return;
if (--sd->ag_cnt >= 0)
return;
sd->ag_cnt = AG_CNT_START;
switch (sd->chip_revision) { switch (sd->chip_revision) {
case Rev072A: case Rev072A:
reg_r(gspca_dev, 0x8621, 1); reg_r(gspca_dev, 0x8621, 1);
...@@ -795,18 +814,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, ...@@ -795,18 +814,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
__u8 *data, /* isoc packet */ __u8 *data, /* isoc packet */
int len) /* iso packet length */ int len) /* iso packet length */
{ {
struct sd *sd = (struct sd *) gspca_dev;
switch (data[0]) { switch (data[0]) {
case 0: /* start of frame */ case 0: /* start of frame */
frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
data, 0); data, 0);
if (sd->ag_cnt >= 0) {
if (--sd->ag_cnt < 0) {
sd->ag_cnt = AG_CNT_START;
setautogain(gspca_dev);
}
}
data += SPCA561_OFFSET_DATA; data += SPCA561_OFFSET_DATA;
len -= SPCA561_OFFSET_DATA; len -= SPCA561_OFFSET_DATA;
if (data[1] & 0x10) { if (data[1] & 0x10) {
...@@ -944,10 +955,8 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) ...@@ -944,10 +955,8 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
sd->autogain = val; sd->autogain = val;
if (val) if (gspca_dev->streaming)
sd->ag_cnt = AG_CNT_START; setautogain(gspca_dev);
else
sd->ag_cnt = -1;
return 0; return 0;
} }
...@@ -971,6 +980,7 @@ static const struct sd_desc sd_desc = { ...@@ -971,6 +980,7 @@ static const struct sd_desc sd_desc = {
.stop0 = sd_stop0, .stop0 = sd_stop0,
.close = sd_close, .close = sd_close,
.pkt_scan = sd_pkt_scan, .pkt_scan = sd_pkt_scan,
.dq_callback = do_autogain,
}; };
/* -- module initialisation -- */ /* -- module initialisation -- */
......
...@@ -88,12 +88,12 @@ static struct ctrl sd_ctrls[] = { ...@@ -88,12 +88,12 @@ static struct ctrl sd_ctrls[] = {
static struct v4l2_pix_format vc0321_mode[] = { static struct v4l2_pix_format vc0321_mode[] = {
{320, 240, V4L2_PIX_FMT_YUV420, V4L2_FIELD_NONE, {320, 240, V4L2_PIX_FMT_YUV420, V4L2_FIELD_NONE,
.bytesperline = 320 * 2, .bytesperline = 320,
.sizeimage = 320 * 240 * 2, .sizeimage = 320 * 240 * 2,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 1}, .priv = 1},
{640, 480, V4L2_PIX_FMT_YUV420, V4L2_FIELD_NONE, {640, 480, V4L2_PIX_FMT_YUV420, V4L2_FIELD_NONE,
.bytesperline = 640 * 2, .bytesperline = 640,
.sizeimage = 640 * 480 * 2, .sizeimage = 640 * 480 * 2,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0}, .priv = 0},
......
...@@ -6469,7 +6469,7 @@ static void setcontrast(struct gspca_dev *gspca_dev) ...@@ -6469,7 +6469,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
NULL, Tgradient_1, Tgradient_2, NULL, Tgradient_1, Tgradient_2,
Tgradient_3, Tgradient_4, Tgradient_5, Tgradient_6 Tgradient_3, Tgradient_4, Tgradient_5, Tgradient_6
}; };
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef GSPCA_DEBUG
__u8 v[16]; __u8 v[16];
#endif #endif
...@@ -6487,7 +6487,7 @@ static void setcontrast(struct gspca_dev *gspca_dev) ...@@ -6487,7 +6487,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
else if (g <= 0) else if (g <= 0)
g = 1; g = 1;
reg_w(dev, g, 0x0120 + i); /* gamma */ reg_w(dev, g, 0x0120 + i); /* gamma */
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef GSPCA_DEBUG
if (gspca_debug & D_CONF) if (gspca_debug & D_CONF)
v[i] = g; v[i] = g;
#endif #endif
...@@ -6507,7 +6507,7 @@ static void setcontrast(struct gspca_dev *gspca_dev) ...@@ -6507,7 +6507,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
g = 1; g = 1;
} }
reg_w(dev, g, 0x0130 + i); /* gradient */ reg_w(dev, g, 0x0130 + i); /* gradient */
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef GSPCA_DEBUG
if (gspca_debug & D_CONF) if (gspca_debug & D_CONF)
v[i] = g; v[i] = g;
#endif #endif
......
...@@ -128,6 +128,8 @@ struct pxa_camera_dev { ...@@ -128,6 +128,8 @@ struct pxa_camera_dev {
struct pxa_buffer *active; struct pxa_buffer *active;
struct pxa_dma_desc *sg_tail[3]; struct pxa_dma_desc *sg_tail[3];
u32 save_cicr[5];
}; };
static const char *pxa_cam_driver_description = "PXA_Camera"; static const char *pxa_cam_driver_description = "PXA_Camera";
...@@ -997,10 +999,64 @@ static int pxa_camera_querycap(struct soc_camera_host *ici, ...@@ -997,10 +999,64 @@ static int pxa_camera_querycap(struct soc_camera_host *ici,
return 0; return 0;
} }
static int pxa_camera_suspend(struct soc_camera_device *icd, pm_message_t state)
{
struct soc_camera_host *ici =
to_soc_camera_host(icd->dev.parent);
struct pxa_camera_dev *pcdev = ici->priv;
int i = 0, ret = 0;
pcdev->save_cicr[i++] = CICR0;
pcdev->save_cicr[i++] = CICR1;
pcdev->save_cicr[i++] = CICR2;
pcdev->save_cicr[i++] = CICR3;
pcdev->save_cicr[i++] = CICR4;
if ((pcdev->icd) && (pcdev->icd->ops->suspend))
ret = pcdev->icd->ops->suspend(pcdev->icd, state);
return ret;
}
static int pxa_camera_resume(struct soc_camera_device *icd)
{
struct soc_camera_host *ici =
to_soc_camera_host(icd->dev.parent);
struct pxa_camera_dev *pcdev = ici->priv;
int i = 0, ret = 0;
DRCMR68 = pcdev->dma_chans[0] | DRCMR_MAPVLD;
DRCMR69 = pcdev->dma_chans[1] | DRCMR_MAPVLD;
DRCMR70 = pcdev->dma_chans[2] | DRCMR_MAPVLD;
CICR0 = pcdev->save_cicr[i++] & ~CICR0_ENB;
CICR1 = pcdev->save_cicr[i++];
CICR2 = pcdev->save_cicr[i++];
CICR3 = pcdev->save_cicr[i++];
CICR4 = pcdev->save_cicr[i++];
if ((pcdev->icd) && (pcdev->icd->ops->resume))
ret = pcdev->icd->ops->resume(pcdev->icd);
/* Restart frame capture if active buffer exists */
if (!ret && pcdev->active) {
/* Reset the FIFOs */
CIFR |= CIFR_RESET_F;
/* Enable End-Of-Frame Interrupt */
CICR0 &= ~CICR0_EOFM;
/* Restart the Capture Interface */
CICR0 |= CICR0_ENB;
}
return ret;
}
static struct soc_camera_host_ops pxa_soc_camera_host_ops = { static struct soc_camera_host_ops pxa_soc_camera_host_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.add = pxa_camera_add_device, .add = pxa_camera_add_device,
.remove = pxa_camera_remove_device, .remove = pxa_camera_remove_device,
.suspend = pxa_camera_suspend,
.resume = pxa_camera_resume,
.set_fmt_cap = pxa_camera_set_fmt_cap, .set_fmt_cap = pxa_camera_set_fmt_cap,
.try_fmt_cap = pxa_camera_try_fmt_cap, .try_fmt_cap = pxa_camera_try_fmt_cap,
.init_videobuf = pxa_camera_init_videobuf, .init_videobuf = pxa_camera_init_videobuf,
...@@ -1198,7 +1254,7 @@ static int __devinit pxa_camera_init(void) ...@@ -1198,7 +1254,7 @@ static int __devinit pxa_camera_init(void)
static void __exit pxa_camera_exit(void) static void __exit pxa_camera_exit(void)
{ {
return platform_driver_unregister(&pxa_camera_driver); platform_driver_unregister(&pxa_camera_driver);
} }
module_init(pxa_camera_init); module_init(pxa_camera_init);
......
...@@ -647,7 +647,7 @@ static int __init sh_mobile_ceu_init(void) ...@@ -647,7 +647,7 @@ static int __init sh_mobile_ceu_init(void)
static void __exit sh_mobile_ceu_exit(void) static void __exit sh_mobile_ceu_exit(void)
{ {
return platform_driver_unregister(&sh_mobile_ceu_driver); platform_driver_unregister(&sh_mobile_ceu_driver);
} }
module_init(sh_mobile_ceu_init); module_init(sh_mobile_ceu_init);
......
...@@ -732,10 +732,36 @@ static int soc_camera_remove(struct device *dev) ...@@ -732,10 +732,36 @@ static int soc_camera_remove(struct device *dev)
return 0; return 0;
} }
static int soc_camera_suspend(struct device *dev, pm_message_t state)
{
struct soc_camera_device *icd = to_soc_camera_dev(dev);
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
int ret = 0;
if (ici->ops->suspend)
ret = ici->ops->suspend(icd, state);
return ret;
}
static int soc_camera_resume(struct device *dev)
{
struct soc_camera_device *icd = to_soc_camera_dev(dev);
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
int ret = 0;
if (ici->ops->resume)
ret = ici->ops->resume(icd);
return ret;
}
static struct bus_type soc_camera_bus_type = { static struct bus_type soc_camera_bus_type = {
.name = "soc-camera", .name = "soc-camera",
.probe = soc_camera_probe, .probe = soc_camera_probe,
.remove = soc_camera_remove, .remove = soc_camera_remove,
.suspend = soc_camera_suspend,
.resume = soc_camera_resume,
}; };
static struct device_driver ic_drv = { static struct device_driver ic_drv = {
......
...@@ -187,7 +187,7 @@ static int __init soc_camera_platform_module_init(void) ...@@ -187,7 +187,7 @@ static int __init soc_camera_platform_module_init(void)
static void __exit soc_camera_platform_module_exit(void) static void __exit soc_camera_platform_module_exit(void)
{ {
return platform_driver_unregister(&soc_camera_platform_driver); platform_driver_unregister(&soc_camera_platform_driver);
} }
module_init(soc_camera_platform_module_init); module_init(soc_camera_platform_module_init);
......
...@@ -585,13 +585,17 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video, ...@@ -585,13 +585,17 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
struct uvc_control_mapping *mapping; struct uvc_control_mapping *mapping;
struct uvc_menu_info *menu; struct uvc_menu_info *menu;
unsigned int i; unsigned int i;
__u8 data[8]; __u8 *data;
int ret; int ret;
ctrl = uvc_find_control(video, v4l2_ctrl->id, &mapping); ctrl = uvc_find_control(video, v4l2_ctrl->id, &mapping);
if (ctrl == NULL) if (ctrl == NULL)
return -EINVAL; return -EINVAL;
data = kmalloc(8, GFP_KERNEL);
if (data == NULL)
return -ENOMEM;
memset(v4l2_ctrl, 0, sizeof *v4l2_ctrl); memset(v4l2_ctrl, 0, sizeof *v4l2_ctrl);
v4l2_ctrl->id = mapping->id; v4l2_ctrl->id = mapping->id;
v4l2_ctrl->type = mapping->v4l2_type; v4l2_ctrl->type = mapping->v4l2_type;
...@@ -604,8 +608,8 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video, ...@@ -604,8 +608,8 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
if (ctrl->info->flags & UVC_CONTROL_GET_DEF) { if (ctrl->info->flags & UVC_CONTROL_GET_DEF) {
if ((ret = uvc_query_ctrl(video->dev, GET_DEF, ctrl->entity->id, if ((ret = uvc_query_ctrl(video->dev, GET_DEF, ctrl->entity->id,
video->dev->intfnum, ctrl->info->selector, video->dev->intfnum, ctrl->info->selector,
&data, ctrl->info->size)) < 0) data, ctrl->info->size)) < 0)
return ret; goto out;
v4l2_ctrl->default_value = uvc_get_le_value(data, mapping); v4l2_ctrl->default_value = uvc_get_le_value(data, mapping);
} }
...@@ -623,13 +627,15 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video, ...@@ -623,13 +627,15 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
} }
} }
return 0; ret = 0;
goto out;
case V4L2_CTRL_TYPE_BOOLEAN: case V4L2_CTRL_TYPE_BOOLEAN:
v4l2_ctrl->minimum = 0; v4l2_ctrl->minimum = 0;
v4l2_ctrl->maximum = 1; v4l2_ctrl->maximum = 1;
v4l2_ctrl->step = 1; v4l2_ctrl->step = 1;
return 0; ret = 0;
goto out;
default: default:
break; break;
...@@ -638,26 +644,29 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video, ...@@ -638,26 +644,29 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
if (ctrl->info->flags & UVC_CONTROL_GET_MIN) { if (ctrl->info->flags & UVC_CONTROL_GET_MIN) {
if ((ret = uvc_query_ctrl(video->dev, GET_MIN, ctrl->entity->id, if ((ret = uvc_query_ctrl(video->dev, GET_MIN, ctrl->entity->id,
video->dev->intfnum, ctrl->info->selector, video->dev->intfnum, ctrl->info->selector,
&data, ctrl->info->size)) < 0) data, ctrl->info->size)) < 0)
return ret; goto out;
v4l2_ctrl->minimum = uvc_get_le_value(data, mapping); v4l2_ctrl->minimum = uvc_get_le_value(data, mapping);
} }
if (ctrl->info->flags & UVC_CONTROL_GET_MAX) { if (ctrl->info->flags & UVC_CONTROL_GET_MAX) {
if ((ret = uvc_query_ctrl(video->dev, GET_MAX, ctrl->entity->id, if ((ret = uvc_query_ctrl(video->dev, GET_MAX, ctrl->entity->id,
video->dev->intfnum, ctrl->info->selector, video->dev->intfnum, ctrl->info->selector,
&data, ctrl->info->size)) < 0) data, ctrl->info->size)) < 0)
return ret; goto out;
v4l2_ctrl->maximum = uvc_get_le_value(data, mapping); v4l2_ctrl->maximum = uvc_get_le_value(data, mapping);
} }
if (ctrl->info->flags & UVC_CONTROL_GET_RES) { if (ctrl->info->flags & UVC_CONTROL_GET_RES) {
if ((ret = uvc_query_ctrl(video->dev, GET_RES, ctrl->entity->id, if ((ret = uvc_query_ctrl(video->dev, GET_RES, ctrl->entity->id,
video->dev->intfnum, ctrl->info->selector, video->dev->intfnum, ctrl->info->selector,
&data, ctrl->info->size)) < 0) data, ctrl->info->size)) < 0)
return ret; goto out;
v4l2_ctrl->step = uvc_get_le_value(data, mapping); v4l2_ctrl->step = uvc_get_le_value(data, mapping);
} }
return 0; ret = 0;
out:
kfree(data);
return ret;
} }
......
...@@ -1884,7 +1884,7 @@ static struct usb_device_id uvc_ids[] = { ...@@ -1884,7 +1884,7 @@ static struct usb_device_id uvc_ids[] = {
.bInterfaceSubClass = 1, .bInterfaceSubClass = 1,
.bInterfaceProtocol = 0, .bInterfaceProtocol = 0,
.driver_info = UVC_QUIRK_PROBE_MINMAX }, .driver_info = UVC_QUIRK_PROBE_MINMAX },
/* Packard Bell OEM Webcam */ /* Packard Bell OEM Webcam - Bison Electronics */
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO, | USB_DEVICE_ID_MATCH_INT_INFO,
.idVendor = 0x5986, .idVendor = 0x5986,
...@@ -1893,7 +1893,7 @@ static struct usb_device_id uvc_ids[] = { ...@@ -1893,7 +1893,7 @@ static struct usb_device_id uvc_ids[] = {
.bInterfaceSubClass = 1, .bInterfaceSubClass = 1,
.bInterfaceProtocol = 0, .bInterfaceProtocol = 0,
.driver_info = UVC_QUIRK_PROBE_MINMAX }, .driver_info = UVC_QUIRK_PROBE_MINMAX },
/* Acer Crystal Eye webcam */ /* Acer Crystal Eye webcam - Bison Electronics */
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO, | USB_DEVICE_ID_MATCH_INT_INFO,
.idVendor = 0x5986, .idVendor = 0x5986,
...@@ -1902,7 +1902,7 @@ static struct usb_device_id uvc_ids[] = { ...@@ -1902,7 +1902,7 @@ static struct usb_device_id uvc_ids[] = {
.bInterfaceSubClass = 1, .bInterfaceSubClass = 1,
.bInterfaceProtocol = 0, .bInterfaceProtocol = 0,
.driver_info = UVC_QUIRK_PROBE_MINMAX }, .driver_info = UVC_QUIRK_PROBE_MINMAX },
/* Medion Akoya Mini E1210 */ /* Medion Akoya Mini E1210 - Bison Electronics */
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO, | USB_DEVICE_ID_MATCH_INT_INFO,
.idVendor = 0x5986, .idVendor = 0x5986,
...@@ -1911,7 +1911,7 @@ static struct usb_device_id uvc_ids[] = { ...@@ -1911,7 +1911,7 @@ static struct usb_device_id uvc_ids[] = {
.bInterfaceSubClass = 1, .bInterfaceSubClass = 1,
.bInterfaceProtocol = 0, .bInterfaceProtocol = 0,
.driver_info = UVC_QUIRK_PROBE_MINMAX }, .driver_info = UVC_QUIRK_PROBE_MINMAX },
/* Acer OrbiCam - Unknown vendor */ /* Acer OrbiCam - Bison Electronics */
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO, | USB_DEVICE_ID_MATCH_INT_INFO,
.idVendor = 0x5986, .idVendor = 0x5986,
...@@ -1920,6 +1920,24 @@ static struct usb_device_id uvc_ids[] = { ...@@ -1920,6 +1920,24 @@ static struct usb_device_id uvc_ids[] = {
.bInterfaceSubClass = 1, .bInterfaceSubClass = 1,
.bInterfaceProtocol = 0, .bInterfaceProtocol = 0,
.driver_info = UVC_QUIRK_PROBE_MINMAX }, .driver_info = UVC_QUIRK_PROBE_MINMAX },
/* Bison Electronics */
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO,
.idVendor = 0x5986,
.idProduct = 0x0300,
.bInterfaceClass = USB_CLASS_VIDEO,
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 0,
.driver_info = UVC_QUIRK_PROBE_MINMAX },
/* Clevo M570TU - Bison Electronics */
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO,
.idVendor = 0x5986,
.idProduct = 0x0303,
.bInterfaceClass = USB_CLASS_VIDEO,
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 0,
.driver_info = UVC_QUIRK_PROBE_MINMAX },
/* Generic USB Video Class */ /* Generic USB Video Class */
{ USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, 0) }, { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, 0) },
{} {}
......
...@@ -90,17 +90,20 @@ static void uvc_fixup_buffer_size(struct uvc_video_device *video, ...@@ -90,17 +90,20 @@ static void uvc_fixup_buffer_size(struct uvc_video_device *video,
static int uvc_get_video_ctrl(struct uvc_video_device *video, static int uvc_get_video_ctrl(struct uvc_video_device *video,
struct uvc_streaming_control *ctrl, int probe, __u8 query) struct uvc_streaming_control *ctrl, int probe, __u8 query)
{ {
__u8 data[34]; __u8 *data;
__u8 size; __u16 size;
int ret; int ret;
size = video->dev->uvc_version >= 0x0110 ? 34 : 26; size = video->dev->uvc_version >= 0x0110 ? 34 : 26;
data = kmalloc(size, GFP_KERNEL);
if (data == NULL)
return -ENOMEM;
ret = __uvc_query_ctrl(video->dev, query, 0, video->streaming->intfnum, ret = __uvc_query_ctrl(video->dev, query, 0, video->streaming->intfnum,
probe ? VS_PROBE_CONTROL : VS_COMMIT_CONTROL, &data, size, probe ? VS_PROBE_CONTROL : VS_COMMIT_CONTROL, data, size,
UVC_CTRL_STREAMING_TIMEOUT); UVC_CTRL_STREAMING_TIMEOUT);
if (ret < 0) if (ret < 0)
return ret; goto out;
ctrl->bmHint = le16_to_cpup((__le16 *)&data[0]); ctrl->bmHint = le16_to_cpup((__le16 *)&data[0]);
ctrl->bFormatIndex = data[2]; ctrl->bFormatIndex = data[2];
...@@ -136,17 +139,22 @@ static int uvc_get_video_ctrl(struct uvc_video_device *video, ...@@ -136,17 +139,22 @@ static int uvc_get_video_ctrl(struct uvc_video_device *video,
*/ */
uvc_fixup_buffer_size(video, ctrl); uvc_fixup_buffer_size(video, ctrl);
return 0; out:
kfree(data);
return ret;
} }
int uvc_set_video_ctrl(struct uvc_video_device *video, int uvc_set_video_ctrl(struct uvc_video_device *video,
struct uvc_streaming_control *ctrl, int probe) struct uvc_streaming_control *ctrl, int probe)
{ {
__u8 data[34]; __u8 *data;
__u8 size; __u16 size;
int ret;
size = video->dev->uvc_version >= 0x0110 ? 34 : 26; size = video->dev->uvc_version >= 0x0110 ? 34 : 26;
memset(data, 0, sizeof data); data = kzalloc(size, GFP_KERNEL);
if (data == NULL)
return -ENOMEM;
*(__le16 *)&data[0] = cpu_to_le16(ctrl->bmHint); *(__le16 *)&data[0] = cpu_to_le16(ctrl->bmHint);
data[2] = ctrl->bFormatIndex; data[2] = ctrl->bFormatIndex;
...@@ -174,10 +182,13 @@ int uvc_set_video_ctrl(struct uvc_video_device *video, ...@@ -174,10 +182,13 @@ int uvc_set_video_ctrl(struct uvc_video_device *video,
data[33] = ctrl->bMaxVersion; data[33] = ctrl->bMaxVersion;
} }
return __uvc_query_ctrl(video->dev, SET_CUR, 0, ret = __uvc_query_ctrl(video->dev, SET_CUR, 0,
video->streaming->intfnum, video->streaming->intfnum,
probe ? VS_PROBE_CONTROL : VS_COMMIT_CONTROL, &data, size, probe ? VS_PROBE_CONTROL : VS_COMMIT_CONTROL, data, size,
UVC_CTRL_STREAMING_TIMEOUT); UVC_CTRL_STREAMING_TIMEOUT);
kfree(data);
return ret;
} }
int uvc_probe_video(struct uvc_video_device *video, int uvc_probe_video(struct uvc_video_device *video,
......
...@@ -222,11 +222,13 @@ int video_register_device(struct video_device *vfd, int type, int nr) ...@@ -222,11 +222,13 @@ int video_register_device(struct video_device *vfd, int type, int nr)
EXPORT_SYMBOL(video_register_device); EXPORT_SYMBOL(video_register_device);
/** /**
* video_register_device - register video4linux devices * video_register_device_index - register video4linux devices
* @vfd: video device structure we want to register * @vfd: video device structure we want to register
* @type: type of device to register * @type: type of device to register
* @nr: which device number (0 == /dev/video0, 1 == /dev/video1, ... * @nr: which device number (0 == /dev/video0, 1 == /dev/video1, ...
* -1 == first free) * -1 == first free)
* @index: stream number based on parent device;
* -1 if auto assign, requested number otherwise
* *
* The registration code assigns minor numbers based on the type * The registration code assigns minor numbers based on the type
* requested. -ENFILE is returned in all the device slots for this * requested. -ENFILE is returned in all the device slots for this
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include <media/v4l2-ioctl.h> #include <media/v4l2-ioctl.h>
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
#include <linux/video_decoder.h> #include <linux/video_decoder.h>
#include <linux/mutex.h> #include <linux/mutex.h>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include <media/videobuf-core.h> #include <media/videobuf-core.h>
#include <linux/pm.h>
struct soc_camera_device { struct soc_camera_device {
struct list_head list; struct list_head list;
...@@ -63,6 +64,8 @@ struct soc_camera_host_ops { ...@@ -63,6 +64,8 @@ struct soc_camera_host_ops {
struct module *owner; struct module *owner;
int (*add)(struct soc_camera_device *); int (*add)(struct soc_camera_device *);
void (*remove)(struct soc_camera_device *); void (*remove)(struct soc_camera_device *);
int (*suspend)(struct soc_camera_device *, pm_message_t state);
int (*resume)(struct soc_camera_device *);
int (*set_fmt_cap)(struct soc_camera_device *, __u32, int (*set_fmt_cap)(struct soc_camera_device *, __u32,
struct v4l2_rect *); struct v4l2_rect *);
int (*try_fmt_cap)(struct soc_camera_device *, struct v4l2_format *); int (*try_fmt_cap)(struct soc_camera_device *, struct v4l2_format *);
...@@ -111,6 +114,8 @@ struct soc_camera_ops { ...@@ -111,6 +114,8 @@ struct soc_camera_ops {
struct module *owner; struct module *owner;
int (*probe)(struct soc_camera_device *); int (*probe)(struct soc_camera_device *);
void (*remove)(struct soc_camera_device *); void (*remove)(struct soc_camera_device *);
int (*suspend)(struct soc_camera_device *, pm_message_t state);
int (*resume)(struct soc_camera_device *);
int (*init)(struct soc_camera_device *); int (*init)(struct soc_camera_device *);
int (*release)(struct soc_camera_device *); int (*release)(struct soc_camera_device *);
int (*start_capture)(struct soc_camera_device *); int (*start_capture)(struct soc_camera_device *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment