V4L/DVB (3599b): Whitespace cleanups under drivers/media
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
parent
9f6933be66
commit
d56410e0a5
@ -370,7 +370,7 @@ config VIDEO_SAA7127
|
|||||||
#
|
#
|
||||||
|
|
||||||
menu "V4L USB devices"
|
menu "V4L USB devices"
|
||||||
depends on USB && VIDEO_DEV
|
depends on USB && VIDEO_DEV
|
||||||
|
|
||||||
source "drivers/media/video/em28xx/Kconfig"
|
source "drivers/media/video/em28xx/Kconfig"
|
||||||
|
|
||||||
@ -528,17 +528,17 @@ config USB_W9968CF
|
|||||||
---help---
|
---help---
|
||||||
Say Y here if you want support for cameras based on OV681 or
|
Say Y here if you want support for cameras based on OV681 or
|
||||||
Winbond W9967CF/W9968CF JPEG USB Dual Mode Camera Chips.
|
Winbond W9967CF/W9968CF JPEG USB Dual Mode Camera Chips.
|
||||||
|
|
||||||
This driver has an optional plugin, which is distributed as a
|
This driver has an optional plugin, which is distributed as a
|
||||||
separate module only (released under GPL). It allows to use higher
|
separate module only (released under GPL). It allows to use higher
|
||||||
resolutions and framerates, but cannot be included in the official
|
resolutions and framerates, but cannot be included in the official
|
||||||
Linux kernel for performance purposes.
|
Linux kernel for performance purposes.
|
||||||
|
|
||||||
See <file:Documentation/usb/w9968cf.txt> for more informations.
|
See <file:Documentation/usb/w9968cf.txt> for more informations.
|
||||||
|
|
||||||
This driver uses the Video For Linux and the I2C APIs. It needs the
|
This driver uses the Video For Linux and the I2C APIs. It needs the
|
||||||
OmniVision Camera Chip support as well. You must say Y or M to
|
OmniVision Camera Chip support as well. You must say Y or M to
|
||||||
"Video For Linux", "I2C Support" and "OmniVision Camera Chip
|
"Video For Linux", "I2C Support" and "OmniVision Camera Chip
|
||||||
support" to use this driver.
|
support" to use this driver.
|
||||||
|
|
||||||
To compile this driver as a module, choose M here: the
|
To compile this driver as a module, choose M here: the
|
||||||
@ -564,20 +564,20 @@ config USB_PWC
|
|||||||
depends on USB && VIDEO_DEV
|
depends on USB && VIDEO_DEV
|
||||||
---help---
|
---help---
|
||||||
Say Y or M here if you want to use one of these Philips & OEM
|
Say Y or M here if you want to use one of these Philips & OEM
|
||||||
webcams:
|
webcams:
|
||||||
* Philips PCA645, PCA646
|
* Philips PCA645, PCA646
|
||||||
* Philips PCVC675, PCVC680, PCVC690
|
* Philips PCVC675, PCVC680, PCVC690
|
||||||
* Philips PCVC720/40, PCVC730, PCVC740, PCVC750
|
* Philips PCVC720/40, PCVC730, PCVC740, PCVC750
|
||||||
* Askey VC010
|
* Askey VC010
|
||||||
* Logitech QuickCam Pro 3000, 4000, 'Zoom', 'Notebook Pro'
|
* Logitech QuickCam Pro 3000, 4000, 'Zoom', 'Notebook Pro'
|
||||||
and 'Orbit'/'Sphere'
|
and 'Orbit'/'Sphere'
|
||||||
* Samsung MPC-C10, MPC-C30
|
* Samsung MPC-C10, MPC-C30
|
||||||
* Creative Webcam 5, Pro Ex
|
* Creative Webcam 5, Pro Ex
|
||||||
* SOTEC Afina Eye
|
* SOTEC Afina Eye
|
||||||
* Visionite VCS-UC300, VCS-UM100
|
* Visionite VCS-UC300, VCS-UM100
|
||||||
|
|
||||||
The PCA635, PCVC665 and PCVC720/20 are not supported by this driver
|
The PCA635, PCVC665 and PCVC720/20 are not supported by this driver
|
||||||
and never will be, but the 665 and 720/20 are supported by other
|
and never will be, but the 665 and 720/20 are supported by other
|
||||||
drivers.
|
drivers.
|
||||||
|
|
||||||
See <file:Documentation/usb/philips.txt> for more information and
|
See <file:Documentation/usb/philips.txt> for more information and
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* adv7170 - adv7170, adv7171 video encoder driver version 0.0.1
|
* adv7170 - adv7170, adv7171 video encoder driver version 0.0.1
|
||||||
*
|
*
|
||||||
* Copyright (C) 2002 Maxim Yevtyushkin <max@linuxmedialabs.com>
|
* Copyright (C) 2002 Maxim Yevtyushkin <max@linuxmedialabs.com>
|
||||||
*
|
*
|
||||||
* Based on adv7176 driver by:
|
* Based on adv7176 driver by:
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 Dave Perks <dperks@ibm.net>
|
* Copyright (C) 1998 Dave Perks <dperks@ibm.net>
|
||||||
* Copyright (C) 1999 Wolfgang Scherr <scherr@net4you.net>
|
* Copyright (C) 1999 Wolfgang Scherr <scherr@net4you.net>
|
||||||
@ -173,7 +173,7 @@ adv7170_write_block (struct i2c_client *client,
|
|||||||
static const unsigned char init_NTSC[] = {
|
static const unsigned char init_NTSC[] = {
|
||||||
0x00, 0x10, // MR0
|
0x00, 0x10, // MR0
|
||||||
0x01, 0x20, // MR1
|
0x01, 0x20, // MR1
|
||||||
0x02, 0x0e, // MR2 RTC control: bits 2 and 1
|
0x02, 0x0e, // MR2 RTC control: bits 2 and 1
|
||||||
0x03, 0x80, // MR3
|
0x03, 0x80, // MR3
|
||||||
0x04, 0x30, // MR4
|
0x04, 0x30, // MR4
|
||||||
0x05, 0x00, // Reserved
|
0x05, 0x00, // Reserved
|
||||||
@ -196,7 +196,7 @@ static const unsigned char init_NTSC[] = {
|
|||||||
0x16, 0x00, // CGMS_WSS_0
|
0x16, 0x00, // CGMS_WSS_0
|
||||||
0x17, 0x00, // CGMS_WSS_1
|
0x17, 0x00, // CGMS_WSS_1
|
||||||
0x18, 0x00, // CGMS_WSS_2
|
0x18, 0x00, // CGMS_WSS_2
|
||||||
0x19, 0x00, // Teletext Ctl
|
0x19, 0x00, // Teletext Ctl
|
||||||
};
|
};
|
||||||
|
|
||||||
static const unsigned char init_PAL[] = {
|
static const unsigned char init_PAL[] = {
|
||||||
@ -381,7 +381,7 @@ static unsigned short normal_i2c[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
static unsigned short ignore = I2C_CLIENT_END;
|
static unsigned short ignore = I2C_CLIENT_END;
|
||||||
|
|
||||||
static struct i2c_client_address_data addr_data = {
|
static struct i2c_client_address_data addr_data = {
|
||||||
.normal_i2c = normal_i2c,
|
.normal_i2c = normal_i2c,
|
||||||
.probe = &ignore,
|
.probe = &ignore,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* adv7175 - adv7175a video encoder driver version 0.0.3
|
* adv7175 - adv7175a video encoder driver version 0.0.3
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 Dave Perks <dperks@ibm.net>
|
* Copyright (C) 1998 Dave Perks <dperks@ibm.net>
|
||||||
@ -233,7 +233,7 @@ adv7175_command (struct i2c_client *client,
|
|||||||
sizeof(init_common));
|
sizeof(init_common));
|
||||||
adv7175_write(client, 0x07, TR0MODE | TR0RST);
|
adv7175_write(client, 0x07, TR0MODE | TR0RST);
|
||||||
adv7175_write(client, 0x07, TR0MODE);
|
adv7175_write(client, 0x07, TR0MODE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENCODER_GET_CAPABILITIES:
|
case ENCODER_GET_CAPABILITIES:
|
||||||
{
|
{
|
||||||
@ -399,7 +399,7 @@ static unsigned short normal_i2c[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
static unsigned short ignore = I2C_CLIENT_END;
|
static unsigned short ignore = I2C_CLIENT_END;
|
||||||
|
|
||||||
static struct i2c_client_address_data addr_data = {
|
static struct i2c_client_address_data addr_data = {
|
||||||
.normal_i2c = normal_i2c,
|
.normal_i2c = normal_i2c,
|
||||||
.probe = &ignore,
|
.probe = &ignore,
|
||||||
|
@ -161,39 +161,39 @@ void iic(int n, unsigned long addr, unsigned long data1, unsigned long data2,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Slave Address */
|
/* Slave Address */
|
||||||
ar_outl(addr, PLDI2CDATA);
|
ar_outl(addr, PLDI2CDATA);
|
||||||
wait_for_vsync();
|
wait_for_vsync();
|
||||||
|
|
||||||
/* Start */
|
/* Start */
|
||||||
ar_outl(1, PLDI2CCND);
|
ar_outl(1, PLDI2CCND);
|
||||||
wait_acknowledge();
|
wait_acknowledge();
|
||||||
|
|
||||||
/* Transfer data 1 */
|
/* Transfer data 1 */
|
||||||
ar_outl(data1, PLDI2CDATA);
|
ar_outl(data1, PLDI2CDATA);
|
||||||
wait_for_vsync();
|
wait_for_vsync();
|
||||||
ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN);
|
ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN);
|
||||||
wait_acknowledge();
|
wait_acknowledge();
|
||||||
|
|
||||||
/* Transfer data 2 */
|
/* Transfer data 2 */
|
||||||
ar_outl(data2, PLDI2CDATA);
|
ar_outl(data2, PLDI2CDATA);
|
||||||
wait_for_vsync();
|
wait_for_vsync();
|
||||||
ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN);
|
ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN);
|
||||||
wait_acknowledge();
|
wait_acknowledge();
|
||||||
|
|
||||||
if (n == 3) {
|
if (n == 3) {
|
||||||
/* Transfer data 3 */
|
/* Transfer data 3 */
|
||||||
ar_outl(data3, PLDI2CDATA);
|
ar_outl(data3, PLDI2CDATA);
|
||||||
wait_for_vsync();
|
wait_for_vsync();
|
||||||
ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN);
|
ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN);
|
||||||
wait_acknowledge();
|
wait_acknowledge();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stop */
|
/* Stop */
|
||||||
for (i = 0; i < 100; i++)
|
for (i = 0; i < 100; i++)
|
||||||
cpu_relax();
|
cpu_relax();
|
||||||
ar_outl(2, PLDI2CCND);
|
ar_outl(2, PLDI2CCND);
|
||||||
ar_outl(2, PLDI2CCND);
|
ar_outl(2, PLDI2CCND);
|
||||||
|
|
||||||
while (ar_inl(PLDI2CSTS) & PLDI2CSTS_BB)
|
while (ar_inl(PLDI2CSTS) & PLDI2CSTS_BB)
|
||||||
cpu_relax();
|
cpu_relax();
|
||||||
@ -204,24 +204,24 @@ void init_iic(void)
|
|||||||
{
|
{
|
||||||
DEBUG(1, "init_iic:\n");
|
DEBUG(1, "init_iic:\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ICU Setting (iic)
|
* ICU Setting (iic)
|
||||||
*/
|
*/
|
||||||
/* I2C Setting */
|
/* I2C Setting */
|
||||||
ar_outl(0x0, PLDI2CCR); /* I2CCR Disable */
|
ar_outl(0x0, PLDI2CCR); /* I2CCR Disable */
|
||||||
ar_outl(0x0300, PLDI2CMOD); /* I2CMOD ACK/8b-data/7b-addr/auto */
|
ar_outl(0x0300, PLDI2CMOD); /* I2CMOD ACK/8b-data/7b-addr/auto */
|
||||||
ar_outl(0x1, PLDI2CACK); /* I2CACK ACK */
|
ar_outl(0x1, PLDI2CACK); /* I2CACK ACK */
|
||||||
|
|
||||||
/* I2C CLK */
|
/* I2C CLK */
|
||||||
/* 50MH-100k */
|
/* 50MH-100k */
|
||||||
if (freq == 75) {
|
if (freq == 75) {
|
||||||
ar_outl(369, PLDI2CFREQ); /* BCLK = 75MHz */
|
ar_outl(369, PLDI2CFREQ); /* BCLK = 75MHz */
|
||||||
} else if (freq == 50) {
|
} else if (freq == 50) {
|
||||||
ar_outl(244, PLDI2CFREQ); /* BCLK = 50MHz */
|
ar_outl(244, PLDI2CFREQ); /* BCLK = 50MHz */
|
||||||
} else {
|
} else {
|
||||||
ar_outl(244, PLDI2CFREQ); /* default: BCLK = 50MHz */
|
ar_outl(244, PLDI2CFREQ); /* default: BCLK = 50MHz */
|
||||||
}
|
}
|
||||||
ar_outl(0x1, PLDI2CCR); /* I2CCR Enable */
|
ar_outl(0x1, PLDI2CCR); /* I2CCR Enable */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
@ -253,7 +253,7 @@ static inline void wait_for_vertical_sync(int exp_line)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* check HCOUNT because we cannot check vertical sync.
|
* check HCOUNT because we cannot check vertical sync.
|
||||||
*/
|
*/
|
||||||
for (; tmout >= 0; tmout--) {
|
for (; tmout >= 0; tmout--) {
|
||||||
l = ar_inl(ARVHCOUNT);
|
l = ar_inl(ARVHCOUNT);
|
||||||
if (l == exp_line)
|
if (l == exp_line)
|
||||||
@ -562,8 +562,8 @@ static void ar_interrupt(int irq, void *dev, struct pt_regs *regs)
|
|||||||
/* operations for interlace mode */
|
/* operations for interlace mode */
|
||||||
if ( line_count < (AR_HEIGHT_VGA/2) ) /* even line */
|
if ( line_count < (AR_HEIGHT_VGA/2) ) /* even line */
|
||||||
line_number = (line_count << 1);
|
line_number = (line_count << 1);
|
||||||
else /* odd line */
|
else /* odd line */
|
||||||
line_number =
|
line_number =
|
||||||
(((line_count - (AR_HEIGHT_VGA/2)) << 1) + 1);
|
(((line_count - (AR_HEIGHT_VGA/2)) << 1) + 1);
|
||||||
} else {
|
} else {
|
||||||
line_number = line_count;
|
line_number = line_count;
|
||||||
@ -651,7 +651,7 @@ static int ar_initialize(struct video_device *dev)
|
|||||||
cr |= ARVCR1_NORMAL;
|
cr |= ARVCR1_NORMAL;
|
||||||
ar_outl(cr, ARVCR1);
|
ar_outl(cr, ARVCR1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize IIC so that CPU can communicate with AR LSI,
|
* Initialize IIC so that CPU can communicate with AR LSI,
|
||||||
* and send boot commands to AR LSI.
|
* and send boot commands to AR LSI.
|
||||||
*/
|
*/
|
||||||
@ -846,7 +846,7 @@ static int __init ar_init(void)
|
|||||||
* so register video device as a frame grabber type.
|
* so register video device as a frame grabber type.
|
||||||
* device is named "video[0-64]".
|
* device is named "video[0-64]".
|
||||||
* video_register_device() initializes h/w using ar_initialize().
|
* video_register_device() initializes h/w using ar_initialize().
|
||||||
*/
|
*/
|
||||||
if (video_register_device(ar->vdev, VFL_TYPE_GRABBER, video_nr) != 0) {
|
if (video_register_device(ar->vdev, VFL_TYPE_GRABBER, video_nr) != 0) {
|
||||||
/* return -1, -ENFILE(full) or others */
|
/* return -1, -ENFILE(full) or others */
|
||||||
printk("arv: register video (Colour AR) failed.\n");
|
printk("arv: register video (Colour AR) failed.\n");
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* bt819 - BT819A VideoStream Decoder (Rockwell Part)
|
* bt819 - BT819A VideoStream Decoder (Rockwell Part)
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Mike Bernson <mike@mlb.org>
|
* Copyright (C) 1999 Mike Bernson <mike@mlb.org>
|
||||||
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Modifications for LML33/DC10plus unified driver
|
* Modifications for LML33/DC10plus unified driver
|
||||||
* Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
|
* Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
|
||||||
*
|
*
|
||||||
* Changes by Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Changes by Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
* - moved over to linux>=2.4.x i2c protocol (9/9/2002)
|
* - moved over to linux>=2.4.x i2c protocol (9/9/2002)
|
||||||
*
|
*
|
||||||
@ -206,9 +206,9 @@ bt819_init (struct i2c_client *client)
|
|||||||
Bug in the bt819 stepping on my board?
|
Bug in the bt819 stepping on my board?
|
||||||
*/
|
*/
|
||||||
0x14, 0x00, /* 0x14 Vertial Scaling lsb */
|
0x14, 0x00, /* 0x14 Vertial Scaling lsb */
|
||||||
0x16, 0x07, /* 0x16 Video Timing Polarity
|
0x16, 0x07, /* 0x16 Video Timing Polarity
|
||||||
ACTIVE=active low
|
ACTIVE=active low
|
||||||
FIELD: high=odd,
|
FIELD: high=odd,
|
||||||
vreset=active high,
|
vreset=active high,
|
||||||
hreset=active high */
|
hreset=active high */
|
||||||
0x18, 0x68, /* 0x18 AGC Delay */
|
0x18, 0x68, /* 0x18 AGC Delay */
|
||||||
@ -497,7 +497,7 @@ static unsigned short normal_i2c[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static unsigned short ignore = I2C_CLIENT_END;
|
static unsigned short ignore = I2C_CLIENT_END;
|
||||||
|
|
||||||
static struct i2c_client_address_data addr_data = {
|
static struct i2c_client_address_data addr_data = {
|
||||||
.normal_i2c = normal_i2c,
|
.normal_i2c = normal_i2c,
|
||||||
.probe = &ignore,
|
.probe = &ignore,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* bt856 - BT856A Digital Video Encoder (Rockwell Part)
|
* bt856 - BT856A Digital Video Encoder (Rockwell Part)
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Mike Bernson <mike@mlb.org>
|
* Copyright (C) 1999 Mike Bernson <mike@mlb.org>
|
||||||
@ -285,7 +285,7 @@ bt856_command (struct i2c_client *client,
|
|||||||
static unsigned short normal_i2c[] = { I2C_BT856 >> 1, I2C_CLIENT_END };
|
static unsigned short normal_i2c[] = { I2C_BT856 >> 1, I2C_CLIENT_END };
|
||||||
|
|
||||||
static unsigned short ignore = I2C_CLIENT_END;
|
static unsigned short ignore = I2C_CLIENT_END;
|
||||||
|
|
||||||
static struct i2c_client_address_data addr_data = {
|
static struct i2c_client_address_data addr_data = {
|
||||||
.normal_i2c = normal_i2c,
|
.normal_i2c = normal_i2c,
|
||||||
.probe = &ignore,
|
.probe = &ignore,
|
||||||
|
@ -150,7 +150,7 @@ static int qc_calibrate(struct qcam_device *q)
|
|||||||
static struct qcam_device *qcam_init(struct parport *port)
|
static struct qcam_device *qcam_init(struct parport *port)
|
||||||
{
|
{
|
||||||
struct qcam_device *q;
|
struct qcam_device *q;
|
||||||
|
|
||||||
q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL);
|
q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL);
|
||||||
if(q==NULL)
|
if(q==NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -158,16 +158,16 @@ static struct qcam_device *qcam_init(struct parport *port)
|
|||||||
q->pport = port;
|
q->pport = port;
|
||||||
q->pdev = parport_register_device(port, "bw-qcam", NULL, NULL,
|
q->pdev = parport_register_device(port, "bw-qcam", NULL, NULL,
|
||||||
NULL, 0, NULL);
|
NULL, 0, NULL);
|
||||||
if (q->pdev == NULL)
|
if (q->pdev == NULL)
|
||||||
{
|
{
|
||||||
printk(KERN_ERR "bw-qcam: couldn't register for %s.\n",
|
printk(KERN_ERR "bw-qcam: couldn't register for %s.\n",
|
||||||
port->name);
|
port->name);
|
||||||
kfree(q);
|
kfree(q);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&q->vdev, &qcam_template, sizeof(qcam_template));
|
memcpy(&q->vdev, &qcam_template, sizeof(qcam_template));
|
||||||
|
|
||||||
mutex_init(&q->lock);
|
mutex_init(&q->lock);
|
||||||
|
|
||||||
q->port_mode = (QC_ANY | QC_NOTSET);
|
q->port_mode = (QC_ANY | QC_NOTSET);
|
||||||
@ -236,12 +236,12 @@ static int qc_waithand(struct qcam_device *q, int val)
|
|||||||
while (!((status = read_lpstatus(q)) & 8))
|
while (!((status = read_lpstatus(q)) & 8))
|
||||||
{
|
{
|
||||||
/* 1000 is enough spins on the I/O for all normal
|
/* 1000 is enough spins on the I/O for all normal
|
||||||
cases, at that point we start to poll slowly
|
cases, at that point we start to poll slowly
|
||||||
until the camera wakes up. However, we are
|
until the camera wakes up. However, we are
|
||||||
busy blocked until the camera responds, so
|
busy blocked until the camera responds, so
|
||||||
setting it lower is much better for interactive
|
setting it lower is much better for interactive
|
||||||
response. */
|
response. */
|
||||||
|
|
||||||
if(runs++>maxpoll)
|
if(runs++>maxpoll)
|
||||||
{
|
{
|
||||||
msleep_interruptible(5);
|
msleep_interruptible(5);
|
||||||
@ -255,12 +255,12 @@ static int qc_waithand(struct qcam_device *q, int val)
|
|||||||
while (((status = read_lpstatus(q)) & 8))
|
while (((status = read_lpstatus(q)) & 8))
|
||||||
{
|
{
|
||||||
/* 1000 is enough spins on the I/O for all normal
|
/* 1000 is enough spins on the I/O for all normal
|
||||||
cases, at that point we start to poll slowly
|
cases, at that point we start to poll slowly
|
||||||
until the camera wakes up. However, we are
|
until the camera wakes up. However, we are
|
||||||
busy blocked until the camera responds, so
|
busy blocked until the camera responds, so
|
||||||
setting it lower is much better for interactive
|
setting it lower is much better for interactive
|
||||||
response. */
|
response. */
|
||||||
|
|
||||||
if(runs++>maxpoll)
|
if(runs++>maxpoll)
|
||||||
{
|
{
|
||||||
msleep_interruptible(5);
|
msleep_interruptible(5);
|
||||||
@ -282,17 +282,17 @@ static unsigned int qc_waithand2(struct qcam_device *q, int val)
|
|||||||
{
|
{
|
||||||
unsigned int status;
|
unsigned int status;
|
||||||
int runs=0;
|
int runs=0;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
status = read_lpdata(q);
|
status = read_lpdata(q);
|
||||||
/* 1000 is enough spins on the I/O for all normal
|
/* 1000 is enough spins on the I/O for all normal
|
||||||
cases, at that point we start to poll slowly
|
cases, at that point we start to poll slowly
|
||||||
until the camera wakes up. However, we are
|
until the camera wakes up. However, we are
|
||||||
busy blocked until the camera responds, so
|
busy blocked until the camera responds, so
|
||||||
setting it lower is much better for interactive
|
setting it lower is much better for interactive
|
||||||
response. */
|
response. */
|
||||||
|
|
||||||
if(runs++>maxpoll)
|
if(runs++>maxpoll)
|
||||||
{
|
{
|
||||||
msleep_interruptible(5);
|
msleep_interruptible(5);
|
||||||
@ -321,7 +321,7 @@ static int qc_detect(struct qcam_device *q)
|
|||||||
|
|
||||||
lastreg = reg = read_lpstatus(q) & 0xf0;
|
lastreg = reg = read_lpstatus(q) & 0xf0;
|
||||||
|
|
||||||
for (i = 0; i < 500; i++)
|
for (i = 0; i < 500; i++)
|
||||||
{
|
{
|
||||||
reg = read_lpstatus(q) & 0xf0;
|
reg = read_lpstatus(q) & 0xf0;
|
||||||
if (reg != lastreg)
|
if (reg != lastreg)
|
||||||
@ -357,7 +357,7 @@ static int qc_detect(struct qcam_device *q)
|
|||||||
|
|
||||||
static void qc_reset(struct qcam_device *q)
|
static void qc_reset(struct qcam_device *q)
|
||||||
{
|
{
|
||||||
switch (q->port_mode & QC_FORCE_MASK)
|
switch (q->port_mode & QC_FORCE_MASK)
|
||||||
{
|
{
|
||||||
case QC_FORCE_UNIDIR:
|
case QC_FORCE_UNIDIR:
|
||||||
q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR;
|
q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR;
|
||||||
@ -370,7 +370,7 @@ static void qc_reset(struct qcam_device *q)
|
|||||||
case QC_ANY:
|
case QC_ANY:
|
||||||
write_lpcontrol(q, 0x20);
|
write_lpcontrol(q, 0x20);
|
||||||
write_lpdata(q, 0x75);
|
write_lpdata(q, 0x75);
|
||||||
|
|
||||||
if (read_lpdata(q) != 0x75) {
|
if (read_lpdata(q) != 0x75) {
|
||||||
q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR;
|
q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR;
|
||||||
} else {
|
} else {
|
||||||
@ -398,8 +398,8 @@ static void qc_reset(struct qcam_device *q)
|
|||||||
static int qc_setscanmode(struct qcam_device *q)
|
static int qc_setscanmode(struct qcam_device *q)
|
||||||
{
|
{
|
||||||
int old_mode = q->mode;
|
int old_mode = q->mode;
|
||||||
|
|
||||||
switch (q->transfer_scale)
|
switch (q->transfer_scale)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
q->mode = 0;
|
q->mode = 0;
|
||||||
@ -412,7 +412,7 @@ static int qc_setscanmode(struct qcam_device *q)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (q->bpp)
|
switch (q->bpp)
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
break;
|
break;
|
||||||
@ -421,7 +421,7 @@ static int qc_setscanmode(struct qcam_device *q)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (q->port_mode & QC_MODE_MASK)
|
switch (q->port_mode & QC_MODE_MASK)
|
||||||
{
|
{
|
||||||
case QC_BIDIR:
|
case QC_BIDIR:
|
||||||
q->mode += 1;
|
q->mode += 1;
|
||||||
@ -430,10 +430,10 @@ static int qc_setscanmode(struct qcam_device *q)
|
|||||||
case QC_UNIDIR:
|
case QC_UNIDIR:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (q->mode != old_mode)
|
if (q->mode != old_mode)
|
||||||
q->status |= QC_PARAM_CHANGE;
|
q->status |= QC_PARAM_CHANGE;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ static void qc_set(struct qcam_device *q)
|
|||||||
/* Set the brightness. Yes, this is repetitive, but it works.
|
/* Set the brightness. Yes, this is repetitive, but it works.
|
||||||
* Shorter versions seem to fail subtly. Feel free to try :-). */
|
* Shorter versions seem to fail subtly. Feel free to try :-). */
|
||||||
/* I think the problem was in qc_command, not here -- bls */
|
/* I think the problem was in qc_command, not here -- bls */
|
||||||
|
|
||||||
qc_command(q, 0xb);
|
qc_command(q, 0xb);
|
||||||
qc_command(q, q->brightness);
|
qc_command(q, q->brightness);
|
||||||
|
|
||||||
@ -502,13 +502,13 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[])
|
|||||||
unsigned int hi2, lo2;
|
unsigned int hi2, lo2;
|
||||||
static int state = 0;
|
static int state = 0;
|
||||||
|
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
{
|
{
|
||||||
state = 0;
|
state = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (q->port_mode & QC_MODE_MASK)
|
switch (q->port_mode & QC_MODE_MASK)
|
||||||
{
|
{
|
||||||
case QC_BIDIR: /* Bi-directional Port */
|
case QC_BIDIR: /* Bi-directional Port */
|
||||||
write_lpcontrol(q, 0x26);
|
write_lpcontrol(q, 0x26);
|
||||||
@ -517,7 +517,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[])
|
|||||||
write_lpcontrol(q, 0x2e);
|
write_lpcontrol(q, 0x2e);
|
||||||
lo2 = (qc_waithand2(q, 0) >> 1);
|
lo2 = (qc_waithand2(q, 0) >> 1);
|
||||||
hi2 = (read_lpstatus(q) >> 3) & 0x1f;
|
hi2 = (read_lpstatus(q) >> 3) & 0x1f;
|
||||||
switch (q->bpp)
|
switch (q->bpp)
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
buffer[0] = lo & 0xf;
|
buffer[0] = lo & 0xf;
|
||||||
@ -544,7 +544,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[])
|
|||||||
write_lpcontrol(q, 0xe);
|
write_lpcontrol(q, 0xe);
|
||||||
hi = (qc_waithand(q, 0) & 0xf0) >> 4;
|
hi = (qc_waithand(q, 0) & 0xf0) >> 4;
|
||||||
|
|
||||||
switch (q->bpp)
|
switch (q->bpp)
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
buffer[0] = lo;
|
buffer[0] = lo;
|
||||||
@ -552,7 +552,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[])
|
|||||||
ret = 2;
|
ret = 2;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
buffer[0] = (lo << 2) | ((hi & 0xc) >> 2);
|
buffer[0] = (lo << 2) | ((hi & 0xc) >> 2);
|
||||||
@ -604,13 +604,13 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l
|
|||||||
int shift=8-q->bpp;
|
int shift=8-q->bpp;
|
||||||
char invert;
|
char invert;
|
||||||
|
|
||||||
if (q->mode == -1)
|
if (q->mode == -1)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
|
||||||
qc_command(q, 0x7);
|
qc_command(q, 0x7);
|
||||||
qc_command(q, q->mode);
|
qc_command(q, q->mode);
|
||||||
|
|
||||||
if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR)
|
if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR)
|
||||||
{
|
{
|
||||||
write_lpcontrol(q, 0x2e); /* turn port around */
|
write_lpcontrol(q, 0x2e); /* turn port around */
|
||||||
write_lpcontrol(q, 0x26);
|
write_lpcontrol(q, 0x26);
|
||||||
@ -618,7 +618,7 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l
|
|||||||
write_lpcontrol(q, 0x2e);
|
write_lpcontrol(q, 0x2e);
|
||||||
(void) qc_waithand(q, 0);
|
(void) qc_waithand(q, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* strange -- should be 15:63 below, but 4bpp is odd */
|
/* strange -- should be 15:63 below, but 4bpp is odd */
|
||||||
invert = (q->bpp == 4) ? 16 : 63;
|
invert = (q->bpp == 4) ? 16 : 63;
|
||||||
|
|
||||||
@ -629,15 +629,15 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l
|
|||||||
q->transfer_scale;
|
q->transfer_scale;
|
||||||
transperline = (transperline + divisor - 1) / divisor;
|
transperline = (transperline + divisor - 1) / divisor;
|
||||||
|
|
||||||
for (i = 0, yield = yieldlines; i < linestotrans; i++)
|
for (i = 0, yield = yieldlines; i < linestotrans; i++)
|
||||||
{
|
{
|
||||||
for (pixels_read = j = 0; j < transperline; j++)
|
for (pixels_read = j = 0; j < transperline; j++)
|
||||||
{
|
{
|
||||||
bytes = qc_readbytes(q, buffer);
|
bytes = qc_readbytes(q, buffer);
|
||||||
for (k = 0; k < bytes && (pixels_read + k) < pixels_per_line; k++)
|
for (k = 0; k < bytes && (pixels_read + k) < pixels_per_line; k++)
|
||||||
{
|
{
|
||||||
int o;
|
int o;
|
||||||
if (buffer[k] == 0 && invert == 16)
|
if (buffer[k] == 0 && invert == 16)
|
||||||
{
|
{
|
||||||
/* 4bpp is odd (again) -- inverter is 16, not 15, but output
|
/* 4bpp is odd (again) -- inverter is 16, not 15, but output
|
||||||
must be 0-15 -- bls */
|
must be 0-15 -- bls */
|
||||||
@ -653,7 +653,7 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l
|
|||||||
pixels_read += bytes;
|
pixels_read += bytes;
|
||||||
}
|
}
|
||||||
(void) qc_readbytes(q, NULL); /* reset state machine */
|
(void) qc_readbytes(q, NULL); /* reset state machine */
|
||||||
|
|
||||||
/* Grabbing an entire frame from the quickcam is a lengthy
|
/* Grabbing an entire frame from the quickcam is a lengthy
|
||||||
process. We don't (usually) want to busy-block the
|
process. We don't (usually) want to busy-block the
|
||||||
processor for the entire frame. yieldlines is a module
|
processor for the entire frame. yieldlines is a module
|
||||||
@ -666,7 +666,7 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR)
|
if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR)
|
||||||
{
|
{
|
||||||
write_lpcontrol(q, 2);
|
write_lpcontrol(q, 2);
|
||||||
write_lpcontrol(q, 6);
|
write_lpcontrol(q, 6);
|
||||||
@ -687,7 +687,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
{
|
{
|
||||||
struct video_device *dev = video_devdata(file);
|
struct video_device *dev = video_devdata(file);
|
||||||
struct qcam_device *qcam=(struct qcam_device *)dev;
|
struct qcam_device *qcam=(struct qcam_device *)dev;
|
||||||
|
|
||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
case VIDIOCGCAP:
|
case VIDIOCGCAP:
|
||||||
@ -762,7 +762,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if(p->depth!=4 && p->depth!=6)
|
if(p->depth!=4 && p->depth!=6)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now load the camera.
|
* Now load the camera.
|
||||||
*/
|
*/
|
||||||
@ -790,11 +790,11 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if(vw->width<80||vw->width>320)
|
if(vw->width<80||vw->width>320)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
qcam->width = 320;
|
qcam->width = 320;
|
||||||
qcam->height = 240;
|
qcam->height = 240;
|
||||||
qcam->transfer_scale = 4;
|
qcam->transfer_scale = 4;
|
||||||
|
|
||||||
if(vw->width>=160 && vw->height>=120)
|
if(vw->width>=160 && vw->height>=120)
|
||||||
{
|
{
|
||||||
qcam->transfer_scale = 2;
|
qcam->transfer_scale = 2;
|
||||||
@ -808,11 +808,11 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
mutex_lock(&qcam->lock);
|
mutex_lock(&qcam->lock);
|
||||||
qc_setscanmode(qcam);
|
qc_setscanmode(qcam);
|
||||||
mutex_unlock(&qcam->lock);
|
mutex_unlock(&qcam->lock);
|
||||||
|
|
||||||
/* We must update the camera before we grab. We could
|
/* We must update the camera before we grab. We could
|
||||||
just have changed the grab size */
|
just have changed the grab size */
|
||||||
qcam->status |= QC_PARAM_CHANGE;
|
qcam->status |= QC_PARAM_CHANGE;
|
||||||
|
|
||||||
/* Ok we figured out what to use from our wide choice */
|
/* Ok we figured out what to use from our wide choice */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -853,9 +853,9 @@ static ssize_t qcam_read(struct file *file, char __user *buf,
|
|||||||
struct qcam_device *qcam=(struct qcam_device *)v;
|
struct qcam_device *qcam=(struct qcam_device *)v;
|
||||||
int len;
|
int len;
|
||||||
parport_claim_or_block(qcam->pdev);
|
parport_claim_or_block(qcam->pdev);
|
||||||
|
|
||||||
mutex_lock(&qcam->lock);
|
mutex_lock(&qcam->lock);
|
||||||
|
|
||||||
qc_reset(qcam);
|
qc_reset(qcam);
|
||||||
|
|
||||||
/* Update the camera parameters if we need to */
|
/* Update the camera parameters if we need to */
|
||||||
@ -863,13 +863,13 @@ static ssize_t qcam_read(struct file *file, char __user *buf,
|
|||||||
qc_set(qcam);
|
qc_set(qcam);
|
||||||
|
|
||||||
len=qc_capture(qcam, buf,count);
|
len=qc_capture(qcam, buf,count);
|
||||||
|
|
||||||
mutex_unlock(&qcam->lock);
|
mutex_unlock(&qcam->lock);
|
||||||
|
|
||||||
parport_release(qcam->pdev);
|
parport_release(qcam->pdev);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct file_operations qcam_fops = {
|
static struct file_operations qcam_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.open = video_exclusive_open,
|
.open = video_exclusive_open,
|
||||||
@ -905,11 +905,11 @@ static int init_bwqcam(struct parport *port)
|
|||||||
qcam=qcam_init(port);
|
qcam=qcam_init(port);
|
||||||
if(qcam==NULL)
|
if(qcam==NULL)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
parport_claim_or_block(qcam->pdev);
|
parport_claim_or_block(qcam->pdev);
|
||||||
|
|
||||||
qc_reset(qcam);
|
qc_reset(qcam);
|
||||||
|
|
||||||
if(qc_detect(qcam)==0)
|
if(qc_detect(qcam)==0)
|
||||||
{
|
{
|
||||||
parport_release(qcam->pdev);
|
parport_release(qcam->pdev);
|
||||||
@ -920,9 +920,9 @@ static int init_bwqcam(struct parport *port)
|
|||||||
qc_calibrate(qcam);
|
qc_calibrate(qcam);
|
||||||
|
|
||||||
parport_release(qcam->pdev);
|
parport_release(qcam->pdev);
|
||||||
|
|
||||||
printk(KERN_INFO "Connectix Quickcam on %s\n", qcam->pport->name);
|
printk(KERN_INFO "Connectix Quickcam on %s\n", qcam->pport->name);
|
||||||
|
|
||||||
if(video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1)
|
if(video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1)
|
||||||
{
|
{
|
||||||
parport_unregister_device(qcam->pdev);
|
parport_unregister_device(qcam->pdev);
|
||||||
@ -1013,7 +1013,7 @@ static int __init init_bw_qcams(void)
|
|||||||
printk("Connectix Quickcam max-poll was above 5000. Using 5000.\n");
|
printk("Connectix Quickcam max-poll was above 5000. Using 5000.\n");
|
||||||
maxpoll = 5000;
|
maxpoll = 5000;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yieldlines < 1) {
|
if (yieldlines < 1) {
|
||||||
printk("Connectix Quickcam yieldlines was less than 1. Using 1.\n");
|
printk("Connectix Quickcam yieldlines was less than 1. Using 1.\n");
|
||||||
yieldlines = 1;
|
yieldlines = 1;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* The parport parameter controls which parports will be scanned.
|
* The parport parameter controls which parports will be scanned.
|
||||||
* Scanning all parports causes some printers to print a garbage page.
|
* Scanning all parports causes some printers to print a garbage page.
|
||||||
* -- March 14, 1999 Billy Donahue <billy@escape.com>
|
* -- March 14, 1999 Billy Donahue <billy@escape.com>
|
||||||
*
|
*
|
||||||
* Fixed data format to BGR, added force_rgb parameter. Added missing
|
* Fixed data format to BGR, added force_rgb parameter. Added missing
|
||||||
* parport_unregister_driver() on module removal.
|
* parport_unregister_driver() on module removal.
|
||||||
@ -88,7 +88,7 @@ static inline unsigned int qcam_ready2(struct qcam_device *qcam)
|
|||||||
return (parport_read_data(qcam->pport) & 0x1)?1:0;
|
return (parport_read_data(qcam->pport) & 0x1)?1:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int qcam_await_ready1(struct qcam_device *qcam,
|
static unsigned int qcam_await_ready1(struct qcam_device *qcam,
|
||||||
int value)
|
int value)
|
||||||
{
|
{
|
||||||
unsigned long oldjiffies = jiffies;
|
unsigned long oldjiffies = jiffies;
|
||||||
@ -98,7 +98,7 @@ static unsigned int qcam_await_ready1(struct qcam_device *qcam,
|
|||||||
if (qcam_ready1(qcam) == value)
|
if (qcam_ready1(qcam) == value)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* If the camera didn't respond within 1/25 second, poll slowly
|
/* If the camera didn't respond within 1/25 second, poll slowly
|
||||||
for a while. */
|
for a while. */
|
||||||
for (i = 0; i < 50; i++)
|
for (i = 0; i < 50; i++)
|
||||||
{
|
{
|
||||||
@ -123,7 +123,7 @@ static unsigned int qcam_await_ready2(struct qcam_device *qcam, int value)
|
|||||||
if (qcam_ready2(qcam) == value)
|
if (qcam_ready2(qcam) == value)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* If the camera didn't respond within 1/25 second, poll slowly
|
/* If the camera didn't respond within 1/25 second, poll slowly
|
||||||
for a while. */
|
for a while. */
|
||||||
for (i = 0; i < 50; i++)
|
for (i = 0; i < 50; i++)
|
||||||
{
|
{
|
||||||
@ -157,12 +157,12 @@ static int qcam_write_data(struct qcam_device *qcam, unsigned int data)
|
|||||||
unsigned int idata;
|
unsigned int idata;
|
||||||
parport_write_data(qcam->pport, data);
|
parport_write_data(qcam->pport, data);
|
||||||
idata = qcam_read_data(qcam);
|
idata = qcam_read_data(qcam);
|
||||||
if (data != idata)
|
if (data != idata)
|
||||||
{
|
{
|
||||||
printk(KERN_WARNING "cqcam: sent %x but received %x\n", data,
|
printk(KERN_WARNING "cqcam: sent %x but received %x\n", data,
|
||||||
idata);
|
idata);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,12 +193,12 @@ static int qc_detect(struct qcam_device *qcam)
|
|||||||
no device was found". Fix this one day. */
|
no device was found". Fix this one day. */
|
||||||
if (qcam->pport->probe_info[0].class == PARPORT_CLASS_MEDIA
|
if (qcam->pport->probe_info[0].class == PARPORT_CLASS_MEDIA
|
||||||
&& qcam->pport->probe_info[0].model
|
&& qcam->pport->probe_info[0].model
|
||||||
&& !strcmp(qcam->pdev->port->probe_info[0].model,
|
&& !strcmp(qcam->pdev->port->probe_info[0].model,
|
||||||
"Color QuickCam 2.0")) {
|
"Color QuickCam 2.0")) {
|
||||||
printk(KERN_DEBUG "QuickCam: Found by IEEE1284 probe.\n");
|
printk(KERN_DEBUG "QuickCam: Found by IEEE1284 probe.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (probe < 2)
|
if (probe < 2)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -206,11 +206,11 @@ static int qc_detect(struct qcam_device *qcam)
|
|||||||
|
|
||||||
/* look for a heartbeat */
|
/* look for a heartbeat */
|
||||||
ostat = stat = parport_read_status(qcam->pport);
|
ostat = stat = parport_read_status(qcam->pport);
|
||||||
for (i=0; i<250; i++)
|
for (i=0; i<250; i++)
|
||||||
{
|
{
|
||||||
mdelay(1);
|
mdelay(1);
|
||||||
stat = parport_read_status(qcam->pport);
|
stat = parport_read_status(qcam->pport);
|
||||||
if (ostat != stat)
|
if (ostat != stat)
|
||||||
{
|
{
|
||||||
if (++count >= 3) return 1;
|
if (++count >= 3) return 1;
|
||||||
ostat = stat;
|
ostat = stat;
|
||||||
@ -226,11 +226,11 @@ static int qc_detect(struct qcam_device *qcam)
|
|||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
ostat = stat = parport_read_status(qcam->pport);
|
ostat = stat = parport_read_status(qcam->pport);
|
||||||
for (i=0; i<250; i++)
|
for (i=0; i<250; i++)
|
||||||
{
|
{
|
||||||
mdelay(1);
|
mdelay(1);
|
||||||
stat = parport_read_status(qcam->pport);
|
stat = parport_read_status(qcam->pport);
|
||||||
if (ostat != stat)
|
if (ostat != stat)
|
||||||
{
|
{
|
||||||
if (++count >= 3) return 1;
|
if (++count >= 3) return 1;
|
||||||
ostat = stat;
|
ostat = stat;
|
||||||
@ -247,7 +247,7 @@ static void qc_reset(struct qcam_device *qcam)
|
|||||||
parport_write_control(qcam->pport, 0x8);
|
parport_write_control(qcam->pport, 0x8);
|
||||||
mdelay(1);
|
mdelay(1);
|
||||||
parport_write_control(qcam->pport, 0xc);
|
parport_write_control(qcam->pport, 0xc);
|
||||||
mdelay(1);
|
mdelay(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset the QuickCam and program for brightness, contrast,
|
/* Reset the QuickCam and program for brightness, contrast,
|
||||||
@ -258,7 +258,7 @@ static void qc_setup(struct qcam_device *q)
|
|||||||
qc_reset(q);
|
qc_reset(q);
|
||||||
|
|
||||||
/* Set the brightness. */
|
/* Set the brightness. */
|
||||||
qcam_set(q, 11, q->brightness);
|
qcam_set(q, 11, q->brightness);
|
||||||
|
|
||||||
/* Set the height and width. These refer to the actual
|
/* Set the height and width. These refer to the actual
|
||||||
CCD area *before* applying the selected decimation. */
|
CCD area *before* applying the selected decimation. */
|
||||||
@ -272,12 +272,12 @@ static void qc_setup(struct qcam_device *q)
|
|||||||
/* Set contrast and white balance. */
|
/* Set contrast and white balance. */
|
||||||
qcam_set(q, 0x19, q->contrast);
|
qcam_set(q, 0x19, q->contrast);
|
||||||
qcam_set(q, 0x1f, q->whitebal);
|
qcam_set(q, 0x1f, q->whitebal);
|
||||||
|
|
||||||
/* Set the speed. */
|
/* Set the speed. */
|
||||||
qcam_set(q, 45, 2);
|
qcam_set(q, 45, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read some bytes from the camera and put them in the buffer.
|
/* Read some bytes from the camera and put them in the buffer.
|
||||||
nbytes should be a multiple of 3, because bidirectional mode gives
|
nbytes should be a multiple of 3, because bidirectional mode gives
|
||||||
us three bytes at a time. */
|
us three bytes at a time. */
|
||||||
|
|
||||||
@ -383,7 +383,7 @@ static long qc_capture(struct qcam_device *q, char __user *buf, unsigned long le
|
|||||||
|
|
||||||
if (qcam_set(q, 7, (q->mode | (is_bi_dir?1:0)) + 1))
|
if (qcam_set(q, 7, (q->mode | (is_bi_dir?1:0)) + 1))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
lines = q->height;
|
lines = q->height;
|
||||||
pixelsperline = q->width;
|
pixelsperline = q->width;
|
||||||
bitsperxfer = (is_bi_dir) ? 24 : 8;
|
bitsperxfer = (is_bi_dir) ? 24 : 8;
|
||||||
@ -499,7 +499,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
{
|
{
|
||||||
struct video_device *dev = video_devdata(file);
|
struct video_device *dev = video_devdata(file);
|
||||||
struct qcam_device *qcam=(struct qcam_device *)dev;
|
struct qcam_device *qcam=(struct qcam_device *)dev;
|
||||||
|
|
||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
case VIDIOCGCAP:
|
case VIDIOCGCAP:
|
||||||
@ -574,7 +574,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
*/
|
*/
|
||||||
if (p->depth != 24 || p->palette != VIDEO_PALETTE_RGB24)
|
if (p->depth != 24 || p->palette != VIDEO_PALETTE_RGB24)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now load the camera.
|
* Now load the camera.
|
||||||
*/
|
*/
|
||||||
@ -584,7 +584,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
|
|
||||||
mutex_lock(&qcam->lock);
|
mutex_lock(&qcam->lock);
|
||||||
parport_claim_or_block(qcam->pdev);
|
parport_claim_or_block(qcam->pdev);
|
||||||
qc_setup(qcam);
|
qc_setup(qcam);
|
||||||
parport_release(qcam->pdev);
|
parport_release(qcam->pdev);
|
||||||
mutex_unlock(&qcam->lock);
|
mutex_unlock(&qcam->lock);
|
||||||
return 0;
|
return 0;
|
||||||
@ -601,11 +601,11 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if(vw->width<80||vw->width>320)
|
if(vw->width<80||vw->width>320)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
qcam->width = 80;
|
qcam->width = 80;
|
||||||
qcam->height = 60;
|
qcam->height = 60;
|
||||||
qcam->mode = QC_DECIMATION_4;
|
qcam->mode = QC_DECIMATION_4;
|
||||||
|
|
||||||
if(vw->width>=160 && vw->height>=120)
|
if(vw->width>=160 && vw->height>=120)
|
||||||
{
|
{
|
||||||
qcam->width = 160;
|
qcam->width = 160;
|
||||||
@ -627,7 +627,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
qcam->mode = QC_BILLIONS | QC_DECIMATION_1;
|
qcam->mode = QC_BILLIONS | QC_DECIMATION_1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Ok we figured out what to use from our
|
/* Ok we figured out what to use from our
|
||||||
wide choice */
|
wide choice */
|
||||||
mutex_lock(&qcam->lock);
|
mutex_lock(&qcam->lock);
|
||||||
parport_claim_or_block(qcam->pdev);
|
parport_claim_or_block(qcam->pdev);
|
||||||
@ -676,7 +676,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf,
|
|||||||
mutex_lock(&qcam->lock);
|
mutex_lock(&qcam->lock);
|
||||||
parport_claim_or_block(qcam->pdev);
|
parport_claim_or_block(qcam->pdev);
|
||||||
/* Probably should have a semaphore against multiple users */
|
/* Probably should have a semaphore against multiple users */
|
||||||
len = qc_capture(qcam, buf,count);
|
len = qc_capture(qcam, buf,count);
|
||||||
parport_release(qcam->pdev);
|
parport_release(qcam->pdev);
|
||||||
mutex_unlock(&qcam->lock);
|
mutex_unlock(&qcam->lock);
|
||||||
return len;
|
return len;
|
||||||
@ -707,7 +707,7 @@ static struct video_device qcam_template=
|
|||||||
static struct qcam_device *qcam_init(struct parport *port)
|
static struct qcam_device *qcam_init(struct parport *port)
|
||||||
{
|
{
|
||||||
struct qcam_device *q;
|
struct qcam_device *q;
|
||||||
|
|
||||||
q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL);
|
q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL);
|
||||||
if(q==NULL)
|
if(q==NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -718,14 +718,14 @@ static struct qcam_device *qcam_init(struct parport *port)
|
|||||||
|
|
||||||
q->bidirectional = (q->pport->modes & PARPORT_MODE_TRISTATE)?1:0;
|
q->bidirectional = (q->pport->modes & PARPORT_MODE_TRISTATE)?1:0;
|
||||||
|
|
||||||
if (q->pdev == NULL)
|
if (q->pdev == NULL)
|
||||||
{
|
{
|
||||||
printk(KERN_ERR "c-qcam: couldn't register for %s.\n",
|
printk(KERN_ERR "c-qcam: couldn't register for %s.\n",
|
||||||
port->name);
|
port->name);
|
||||||
kfree(q);
|
kfree(q);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&q->vdev, &qcam_template, sizeof(qcam_template));
|
memcpy(&q->vdev, &qcam_template, sizeof(qcam_template));
|
||||||
|
|
||||||
mutex_init(&q->lock);
|
mutex_init(&q->lock);
|
||||||
@ -766,11 +766,11 @@ static int init_cqcam(struct parport *port)
|
|||||||
qcam = qcam_init(port);
|
qcam = qcam_init(port);
|
||||||
if (qcam==NULL)
|
if (qcam==NULL)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
parport_claim_or_block(qcam->pdev);
|
parport_claim_or_block(qcam->pdev);
|
||||||
|
|
||||||
qc_reset(qcam);
|
qc_reset(qcam);
|
||||||
|
|
||||||
if (probe && qc_detect(qcam)==0)
|
if (probe && qc_detect(qcam)==0)
|
||||||
{
|
{
|
||||||
parport_release(qcam->pdev);
|
parport_release(qcam->pdev);
|
||||||
@ -782,7 +782,7 @@ static int init_cqcam(struct parport *port)
|
|||||||
qc_setup(qcam);
|
qc_setup(qcam);
|
||||||
|
|
||||||
parport_release(qcam->pdev);
|
parport_release(qcam->pdev);
|
||||||
|
|
||||||
if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1)
|
if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1)
|
||||||
{
|
{
|
||||||
printk(KERN_ERR "Unable to register Colour QuickCam on %s\n",
|
printk(KERN_ERR "Unable to register Colour QuickCam on %s\n",
|
||||||
@ -792,9 +792,9 @@ static int init_cqcam(struct parport *port)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_INFO "video%d: Colour QuickCam found on %s\n",
|
printk(KERN_INFO "video%d: Colour QuickCam found on %s\n",
|
||||||
qcam->vdev.minor, qcam->pport->name);
|
qcam->vdev.minor, qcam->pport->name);
|
||||||
|
|
||||||
qcams[num_cams++] = qcam;
|
qcams[num_cams++] = qcam;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -52,10 +52,10 @@
|
|||||||
struct cpia_camera_ops
|
struct cpia_camera_ops
|
||||||
{
|
{
|
||||||
/* open sets privdata to point to structure for this camera.
|
/* open sets privdata to point to structure for this camera.
|
||||||
* Returns negative value on error, otherwise 0.
|
* Returns negative value on error, otherwise 0.
|
||||||
*/
|
*/
|
||||||
int (*open)(void *privdata);
|
int (*open)(void *privdata);
|
||||||
|
|
||||||
/* Registers callback function cb to be called with cbdata
|
/* Registers callback function cb to be called with cbdata
|
||||||
* when an image is ready. If cb is NULL, only single image grabs
|
* when an image is ready. If cb is NULL, only single image grabs
|
||||||
* should be used. cb should immediately call streamRead to read
|
* should be used. cb should immediately call streamRead to read
|
||||||
@ -63,8 +63,8 @@ struct cpia_camera_ops
|
|||||||
* otherwise 0.
|
* otherwise 0.
|
||||||
*/
|
*/
|
||||||
int (*registerCallback)(void *privdata, void (*cb)(void *cbdata),
|
int (*registerCallback)(void *privdata, void (*cb)(void *cbdata),
|
||||||
void *cbdata);
|
void *cbdata);
|
||||||
|
|
||||||
/* transferCmd sends commands to the camera. command MUST point to
|
/* transferCmd sends commands to the camera. command MUST point to
|
||||||
* an 8 byte buffer in kernel space. data can be NULL if no extra
|
* an 8 byte buffer in kernel space. data can be NULL if no extra
|
||||||
* data is needed. The size of the data is given by the last 2
|
* data is needed. The size of the data is given by the last 2
|
||||||
@ -77,30 +77,30 @@ struct cpia_camera_ops
|
|||||||
* Returns negative value on error, otherwise 0.
|
* Returns negative value on error, otherwise 0.
|
||||||
*/
|
*/
|
||||||
int (*streamStart)(void *privdata);
|
int (*streamStart)(void *privdata);
|
||||||
|
|
||||||
/* streamStop terminates stream capture mode.
|
/* streamStop terminates stream capture mode.
|
||||||
* Returns negative value on error, otherwise 0.
|
* Returns negative value on error, otherwise 0.
|
||||||
*/
|
*/
|
||||||
int (*streamStop)(void *privdata);
|
int (*streamStop)(void *privdata);
|
||||||
|
|
||||||
/* streamRead reads a frame from the camera. buffer points to a
|
/* streamRead reads a frame from the camera. buffer points to a
|
||||||
* buffer large enough to hold a complete frame in kernel space.
|
* buffer large enough to hold a complete frame in kernel space.
|
||||||
* noblock indicates if this should be a non blocking read.
|
* noblock indicates if this should be a non blocking read.
|
||||||
* Returns the number of bytes read, or negative value on error.
|
* Returns the number of bytes read, or negative value on error.
|
||||||
*/
|
*/
|
||||||
int (*streamRead)(void *privdata, u8 *buffer, int noblock);
|
int (*streamRead)(void *privdata, u8 *buffer, int noblock);
|
||||||
|
|
||||||
/* close disables the device until open() is called again.
|
/* close disables the device until open() is called again.
|
||||||
* Returns negative value on error, otherwise 0.
|
* Returns negative value on error, otherwise 0.
|
||||||
*/
|
*/
|
||||||
int (*close)(void *privdata);
|
int (*close)(void *privdata);
|
||||||
|
|
||||||
/* If wait_for_stream_ready is non-zero, wait until the streamState
|
/* If wait_for_stream_ready is non-zero, wait until the streamState
|
||||||
* is STREAM_READY before calling streamRead.
|
* is STREAM_READY before calling streamRead.
|
||||||
*/
|
*/
|
||||||
int wait_for_stream_ready;
|
int wait_for_stream_ready;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Used to maintain lowlevel module usage counts
|
* Used to maintain lowlevel module usage counts
|
||||||
*/
|
*/
|
||||||
struct module *owner;
|
struct module *owner;
|
||||||
@ -215,14 +215,14 @@ struct cam_params {
|
|||||||
u8 videoSize; /* CIF/QCIF */
|
u8 videoSize; /* CIF/QCIF */
|
||||||
u8 subSample;
|
u8 subSample;
|
||||||
u8 yuvOrder;
|
u8 yuvOrder;
|
||||||
} format;
|
} format;
|
||||||
struct { /* Intel QX3 specific data */
|
struct { /* Intel QX3 specific data */
|
||||||
u8 qx3_detected; /* a QX3 is present */
|
u8 qx3_detected; /* a QX3 is present */
|
||||||
u8 toplight; /* top light lit , R/W */
|
u8 toplight; /* top light lit , R/W */
|
||||||
u8 bottomlight; /* bottom light lit, R/W */
|
u8 bottomlight; /* bottom light lit, R/W */
|
||||||
u8 button; /* snapshot button pressed (R/O) */
|
u8 button; /* snapshot button pressed (R/O) */
|
||||||
u8 cradled; /* microscope is in cradle (R/O) */
|
u8 cradled; /* microscope is in cradle (R/O) */
|
||||||
} qx3;
|
} qx3;
|
||||||
struct {
|
struct {
|
||||||
u8 colStart; /* skip first 8*colStart pixels */
|
u8 colStart; /* skip first 8*colStart pixels */
|
||||||
u8 colEnd; /* finish at 8*colEnd pixels */
|
u8 colEnd; /* finish at 8*colEnd pixels */
|
||||||
@ -247,13 +247,13 @@ enum v4l_camstates {
|
|||||||
struct cam_data {
|
struct cam_data {
|
||||||
struct list_head cam_data_list;
|
struct list_head cam_data_list;
|
||||||
|
|
||||||
struct mutex busy_lock; /* guard against SMP multithreading */
|
struct mutex busy_lock; /* guard against SMP multithreading */
|
||||||
struct cpia_camera_ops *ops; /* lowlevel driver operations */
|
struct cpia_camera_ops *ops; /* lowlevel driver operations */
|
||||||
void *lowlevel_data; /* private data for lowlevel driver */
|
void *lowlevel_data; /* private data for lowlevel driver */
|
||||||
u8 *raw_image; /* buffer for raw image data */
|
u8 *raw_image; /* buffer for raw image data */
|
||||||
struct cpia_frame decompressed_frame;
|
struct cpia_frame decompressed_frame;
|
||||||
/* buffer to hold decompressed frame */
|
/* buffer to hold decompressed frame */
|
||||||
int image_size; /* sizeof last decompressed image */
|
int image_size; /* sizeof last decompressed image */
|
||||||
int open_count; /* # of process that have camera open */
|
int open_count; /* # of process that have camera open */
|
||||||
|
|
||||||
/* camera status */
|
/* camera status */
|
||||||
@ -265,7 +265,7 @@ struct cam_data {
|
|||||||
struct mutex param_lock; /* params lock for this camera */
|
struct mutex param_lock; /* params lock for this camera */
|
||||||
struct cam_params params; /* camera settings */
|
struct cam_params params; /* camera settings */
|
||||||
struct proc_dir_entry *proc_entry; /* /proc/cpia/videoX */
|
struct proc_dir_entry *proc_entry; /* /proc/cpia/videoX */
|
||||||
|
|
||||||
/* v4l */
|
/* v4l */
|
||||||
int video_size; /* VIDEO_SIZE_ */
|
int video_size; /* VIDEO_SIZE_ */
|
||||||
volatile enum v4l_camstates camstate; /* v4l layer status */
|
volatile enum v4l_camstates camstate; /* v4l layer status */
|
||||||
@ -277,7 +277,7 @@ struct cam_data {
|
|||||||
/* mmap interface */
|
/* mmap interface */
|
||||||
int curframe; /* the current frame to grab into */
|
int curframe; /* the current frame to grab into */
|
||||||
u8 *frame_buf; /* frame buffer data */
|
u8 *frame_buf; /* frame buffer data */
|
||||||
struct cpia_frame frame[FRAME_NUM];
|
struct cpia_frame frame[FRAME_NUM];
|
||||||
/* FRAME_NUM-buffering, so we need a array */
|
/* FRAME_NUM-buffering, so we need a array */
|
||||||
|
|
||||||
int first_frame;
|
int first_frame;
|
||||||
@ -424,7 +424,7 @@ void cpia_unregister_camera(struct cam_data *cam);
|
|||||||
#define DEB_BYTE(p)\
|
#define DEB_BYTE(p)\
|
||||||
DBG("%1d %1d %1d %1d %1d %1d %1d %1d \n",\
|
DBG("%1d %1d %1d %1d %1d %1d %1d %1d \n",\
|
||||||
(p)&0x80?1:0, (p)&0x40?1:0, (p)&0x20?1:0, (p)&0x10?1:0,\
|
(p)&0x80?1:0, (p)&0x40?1:0, (p)&0x20?1:0, (p)&0x10?1:0,\
|
||||||
(p)&0x08?1:0, (p)&0x04?1:0, (p)&0x02?1:0, (p)&0x01?1:0);
|
(p)&0x08?1:0, (p)&0x04?1:0, (p)&0x02?1:0, (p)&0x01?1:0);
|
||||||
|
|
||||||
#endif /* __KERNEL__ */
|
#endif /* __KERNEL__ */
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */
|
/* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */
|
||||||
/* #define _CPIA_DEBUG_ 1 */
|
/* #define _CPIA_DEBUG_ 1 */
|
||||||
|
|
||||||
#include <linux/config.h>
|
#include <linux/config.h>
|
||||||
|
|
||||||
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
static int cpia_pp_open(void *privdata);
|
static int cpia_pp_open(void *privdata);
|
||||||
static int cpia_pp_registerCallback(void *privdata, void (*cb) (void *cbdata),
|
static int cpia_pp_registerCallback(void *privdata, void (*cb) (void *cbdata),
|
||||||
void *cbdata);
|
void *cbdata);
|
||||||
static int cpia_pp_transferCmd(void *privdata, u8 *command, u8 *data);
|
static int cpia_pp_transferCmd(void *privdata, u8 *command, u8 *data);
|
||||||
static int cpia_pp_streamStart(void *privdata);
|
static int cpia_pp_streamStart(void *privdata);
|
||||||
static int cpia_pp_streamStop(void *privdata);
|
static int cpia_pp_streamStop(void *privdata);
|
||||||
@ -93,7 +93,7 @@ struct pp_cam_entry {
|
|||||||
int stream_irq;
|
int stream_irq;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct cpia_camera_ops cpia_pp_ops =
|
static struct cpia_camera_ops cpia_pp_ops =
|
||||||
{
|
{
|
||||||
cpia_pp_open,
|
cpia_pp_open,
|
||||||
cpia_pp_registerCallback,
|
cpia_pp_registerCallback,
|
||||||
@ -123,7 +123,7 @@ static void cpia_parport_disable_irq( struct parport *port ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Special CPiA PPC modes: These are invoked by using the 1284 Extensibility
|
/* Special CPiA PPC modes: These are invoked by using the 1284 Extensibility
|
||||||
* Link Flag during negotiation */
|
* Link Flag during negotiation */
|
||||||
#define UPLOAD_FLAG 0x08
|
#define UPLOAD_FLAG 0x08
|
||||||
#define NIBBLE_TRANSFER 0x01
|
#define NIBBLE_TRANSFER 0x01
|
||||||
#define ECP_TRANSFER 0x03
|
#define ECP_TRANSFER 0x03
|
||||||
@ -139,17 +139,17 @@ static void cpia_parport_disable_irq( struct parport *port ) {
|
|||||||
/* CPiA nonstandard "Nibble" mode (no nDataAvail signal after each byte). */
|
/* CPiA nonstandard "Nibble" mode (no nDataAvail signal after each byte). */
|
||||||
/* The standard kernel parport_ieee1284_read_nibble() fails with the CPiA... */
|
/* The standard kernel parport_ieee1284_read_nibble() fails with the CPiA... */
|
||||||
|
|
||||||
static size_t cpia_read_nibble (struct parport *port,
|
static size_t cpia_read_nibble (struct parport *port,
|
||||||
void *buffer, size_t len,
|
void *buffer, size_t len,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
/* adapted verbatim, with one change, from
|
/* adapted verbatim, with one change, from
|
||||||
parport_ieee1284_read_nibble() in drivers/parport/ieee1284-ops.c */
|
parport_ieee1284_read_nibble() in drivers/parport/ieee1284-ops.c */
|
||||||
|
|
||||||
unsigned char *buf = buffer;
|
unsigned char *buf = buffer;
|
||||||
int i;
|
int i;
|
||||||
unsigned char byte = 0;
|
unsigned char byte = 0;
|
||||||
|
|
||||||
len *= 2; /* in nibbles */
|
len *= 2; /* in nibbles */
|
||||||
for (i=0; i < len; i++) {
|
for (i=0; i < len; i++) {
|
||||||
unsigned char nibble;
|
unsigned char nibble;
|
||||||
@ -158,12 +158,12 @@ static size_t cpia_read_nibble (struct parport *port,
|
|||||||
* after every second nibble to signal that more
|
* after every second nibble to signal that more
|
||||||
* data is available. (the total number of Bytes that
|
* data is available. (the total number of Bytes that
|
||||||
* should be sent is known; if too few are received, an error
|
* should be sent is known; if too few are received, an error
|
||||||
* will be recorded after a timeout).
|
* will be recorded after a timeout).
|
||||||
* This is incompatible with parport_ieee1284_read_nibble(),
|
* This is incompatible with parport_ieee1284_read_nibble(),
|
||||||
* which expects to find nFault LO after every second nibble.
|
* which expects to find nFault LO after every second nibble.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Solution: modify cpia_read_nibble to only check for
|
/* Solution: modify cpia_read_nibble to only check for
|
||||||
* nDataAvail before the first nibble is sent.
|
* nDataAvail before the first nibble is sent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ static size_t cpia_read_nibble (struct parport *port,
|
|||||||
/* Second nibble */
|
/* Second nibble */
|
||||||
byte |= nibble << 4;
|
byte |= nibble << 4;
|
||||||
*buf++ = byte;
|
*buf++ = byte;
|
||||||
} else
|
} else
|
||||||
byte = nibble;
|
byte = nibble;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,18 +238,18 @@ static size_t cpia_read_nibble (struct parport *port,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* CPiA nonstandard "Nibble Stream" mode (2 nibbles per cycle, instead of 1)
|
/* CPiA nonstandard "Nibble Stream" mode (2 nibbles per cycle, instead of 1)
|
||||||
* (See CPiA Data sheet p. 31)
|
* (See CPiA Data sheet p. 31)
|
||||||
*
|
*
|
||||||
* "Nibble Stream" mode used by CPiA for uploads to non-ECP ports is a
|
* "Nibble Stream" mode used by CPiA for uploads to non-ECP ports is a
|
||||||
* nonstandard variant of nibble mode which allows the same (mediocre)
|
* nonstandard variant of nibble mode which allows the same (mediocre)
|
||||||
* data flow of 8 bits per cycle as software-enabled ECP by TRISTATE-capable
|
* data flow of 8 bits per cycle as software-enabled ECP by TRISTATE-capable
|
||||||
* parallel ports, but works also for non-TRISTATE-capable ports.
|
* parallel ports, but works also for non-TRISTATE-capable ports.
|
||||||
* (Standard nibble mode only send 4 bits per cycle)
|
* (Standard nibble mode only send 4 bits per cycle)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static size_t cpia_read_nibble_stream(struct parport *port,
|
static size_t cpia_read_nibble_stream(struct parport *port,
|
||||||
void *buffer, size_t len,
|
void *buffer, size_t len,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -260,7 +260,7 @@ static size_t cpia_read_nibble_stream(struct parport *port,
|
|||||||
unsigned char nibble[2], byte = 0;
|
unsigned char nibble[2], byte = 0;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
/* Image Data is complete when 4 consecutive EOI bytes (0xff) are seen */
|
/* Image Data is complete when 4 consecutive EOI bytes (0xff) are seen */
|
||||||
if (endseen > 3 )
|
if (endseen > 3 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ static size_t cpia_read_nibble_stream(struct parport *port,
|
|||||||
parport_frob_control (port,
|
parport_frob_control (port,
|
||||||
PARPORT_CONTROL_AUTOFD,
|
PARPORT_CONTROL_AUTOFD,
|
||||||
PARPORT_CONTROL_AUTOFD);
|
PARPORT_CONTROL_AUTOFD);
|
||||||
|
|
||||||
/* Event 9: nAck goes low. */
|
/* Event 9: nAck goes low. */
|
||||||
port->ieee1284.phase = IEEE1284_PH_REV_DATA;
|
port->ieee1284.phase = IEEE1284_PH_REV_DATA;
|
||||||
if (parport_wait_peripheral (port,
|
if (parport_wait_peripheral (port,
|
||||||
@ -282,7 +282,7 @@ static size_t cpia_read_nibble_stream(struct parport *port,
|
|||||||
|
|
||||||
/* Read lower nibble */
|
/* Read lower nibble */
|
||||||
nibble[0] = parport_read_status (port) >>3;
|
nibble[0] = parport_read_status (port) >>3;
|
||||||
|
|
||||||
/* Event 10: Set nAutoFd high. */
|
/* Event 10: Set nAutoFd high. */
|
||||||
parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0);
|
parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0);
|
||||||
|
|
||||||
@ -295,10 +295,10 @@ static size_t cpia_read_nibble_stream(struct parport *port,
|
|||||||
port->name);
|
port->name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read upper nibble */
|
/* Read upper nibble */
|
||||||
nibble[1] = parport_read_status (port) >>3;
|
nibble[1] = parport_read_status (port) >>3;
|
||||||
|
|
||||||
/* reassemble the byte */
|
/* reassemble the byte */
|
||||||
for (j = 0; j < 2 ; j++ ) {
|
for (j = 0; j < 2 ; j++ ) {
|
||||||
nibble[j] &= ~8;
|
nibble[j] &= ~8;
|
||||||
@ -335,8 +335,8 @@ static void EndTransferMode(struct pp_cam_entry *cam)
|
|||||||
static int ForwardSetup(struct pp_cam_entry *cam)
|
static int ForwardSetup(struct pp_cam_entry *cam)
|
||||||
{
|
{
|
||||||
int retry;
|
int retry;
|
||||||
|
|
||||||
/* The CPiA uses ECP protocol for Downloads from the Host to the camera.
|
/* The CPiA uses ECP protocol for Downloads from the Host to the camera.
|
||||||
* This will be software-emulated if ECP hardware is not present
|
* This will be software-emulated if ECP hardware is not present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -375,9 +375,9 @@ static int ReverseSetup(struct pp_cam_entry *cam, int extensibility)
|
|||||||
upload_mode = mode;
|
upload_mode = mode;
|
||||||
if(extensibility) mode = UPLOAD_FLAG|transfer_mode|IEEE1284_EXT_LINK;
|
if(extensibility) mode = UPLOAD_FLAG|transfer_mode|IEEE1284_EXT_LINK;
|
||||||
|
|
||||||
/* the usual camera maximum response time is 10ms, but after
|
/* the usual camera maximum response time is 10ms, but after
|
||||||
* receiving some commands, it needs up to 40ms. */
|
* receiving some commands, it needs up to 40ms. */
|
||||||
|
|
||||||
for(retry = 0; retry < 4; ++retry) {
|
for(retry = 0; retry < 4; ++retry) {
|
||||||
if(!parport_negotiate(cam->port, mode)) {
|
if(!parport_negotiate(cam->port, mode)) {
|
||||||
break;
|
break;
|
||||||
@ -439,10 +439,10 @@ static int ReadPacket(struct pp_cam_entry *cam, u8 *packet, size_t size)
|
|||||||
|
|
||||||
/* support for CPiA variant nibble reads */
|
/* support for CPiA variant nibble reads */
|
||||||
if(cam->port->ieee1284.mode == IEEE1284_MODE_NIBBLE) {
|
if(cam->port->ieee1284.mode == IEEE1284_MODE_NIBBLE) {
|
||||||
if(cpia_read_nibble(cam->port, packet, size, 0) != size)
|
if(cpia_read_nibble(cam->port, packet, size, 0) != size)
|
||||||
retval = -EIO;
|
retval = -EIO;
|
||||||
} else {
|
} else {
|
||||||
if(parport_read(cam->port, packet, size) != size)
|
if(parport_read(cam->port, packet, size) != size)
|
||||||
retval = -EIO;
|
retval = -EIO;
|
||||||
}
|
}
|
||||||
EndTransferMode(cam);
|
EndTransferMode(cam);
|
||||||
@ -542,18 +542,18 @@ static int cpia_pp_streamRead(void *privdata, u8 *buffer, int noblock)
|
|||||||
block_size = PARPORT_CHUNK_SIZE;
|
block_size = PARPORT_CHUNK_SIZE;
|
||||||
while( !cam->image_complete ) {
|
while( !cam->image_complete ) {
|
||||||
cond_resched();
|
cond_resched();
|
||||||
|
|
||||||
new_bytes = cpia_pp_read(cam->port, buffer, block_size );
|
new_bytes = cpia_pp_read(cam->port, buffer, block_size );
|
||||||
if( new_bytes <= 0 ) {
|
if( new_bytes <= 0 ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i=-1;
|
i=-1;
|
||||||
while(++i<new_bytes && endseen<4) {
|
while(++i<new_bytes && endseen<4) {
|
||||||
if(*buffer==EOI) {
|
if(*buffer==EOI) {
|
||||||
endseen++;
|
endseen++;
|
||||||
} else {
|
} else {
|
||||||
endseen=0;
|
endseen=0;
|
||||||
}
|
}
|
||||||
buffer++;
|
buffer++;
|
||||||
}
|
}
|
||||||
read_bytes += i;
|
read_bytes += i;
|
||||||
@ -601,7 +601,7 @@ static int cpia_pp_transferCmd(void *privdata, u8 *command, u8 *data)
|
|||||||
}
|
}
|
||||||
if((err = ReadPacket(cam, buffer, 8)) < 0) {
|
if((err = ReadPacket(cam, buffer, 8)) < 0) {
|
||||||
DBG("Error reading command result\n");
|
DBG("Error reading command result\n");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
memcpy(data, buffer, databytes);
|
memcpy(data, buffer, databytes);
|
||||||
} else if(command[0] == DATA_OUT) {
|
} else if(command[0] == DATA_OUT) {
|
||||||
@ -631,10 +631,10 @@ static int cpia_pp_transferCmd(void *privdata, u8 *command, u8 *data)
|
|||||||
static int cpia_pp_open(void *privdata)
|
static int cpia_pp_open(void *privdata)
|
||||||
{
|
{
|
||||||
struct pp_cam_entry *cam = (struct pp_cam_entry *)privdata;
|
struct pp_cam_entry *cam = (struct pp_cam_entry *)privdata;
|
||||||
|
|
||||||
if (cam == NULL)
|
if (cam == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if(cam->open_count == 0) {
|
if(cam->open_count == 0) {
|
||||||
if (parport_claim(cam->pdev)) {
|
if (parport_claim(cam->pdev)) {
|
||||||
DBG("failed to claim the port\n");
|
DBG("failed to claim the port\n");
|
||||||
@ -645,12 +645,12 @@ static int cpia_pp_open(void *privdata)
|
|||||||
parport_write_control(cam->port, PARPORT_CONTROL_SELECT);
|
parport_write_control(cam->port, PARPORT_CONTROL_SELECT);
|
||||||
udelay(50);
|
udelay(50);
|
||||||
parport_write_control(cam->port,
|
parport_write_control(cam->port,
|
||||||
PARPORT_CONTROL_SELECT
|
PARPORT_CONTROL_SELECT
|
||||||
| PARPORT_CONTROL_INIT);
|
| PARPORT_CONTROL_INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
++cam->open_count;
|
++cam->open_count;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -663,7 +663,7 @@ static int cpia_pp_registerCallback(void *privdata, void (*cb)(void *cbdata), vo
|
|||||||
{
|
{
|
||||||
struct pp_cam_entry *cam = privdata;
|
struct pp_cam_entry *cam = privdata;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
if(cam->port->irq != PARPORT_IRQ_NONE) {
|
if(cam->port->irq != PARPORT_IRQ_NONE) {
|
||||||
INIT_WORK(&cam->cb_task, cb, cbdata);
|
INIT_WORK(&cam->cb_task, cb, cbdata);
|
||||||
} else {
|
} else {
|
||||||
@ -707,9 +707,9 @@ static int cpia_pp_register(struct parport *port)
|
|||||||
LOG("failed to allocate camera structure\n");
|
LOG("failed to allocate camera structure\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdev = parport_register_device(port, "cpia_pp", NULL, NULL,
|
pdev = parport_register_device(port, "cpia_pp", NULL, NULL,
|
||||||
NULL, 0, cam);
|
NULL, 0, cam);
|
||||||
|
|
||||||
if (!pdev) {
|
if (!pdev) {
|
||||||
LOG("failed to parport_register_device\n");
|
LOG("failed to parport_register_device\n");
|
||||||
@ -753,19 +753,19 @@ static void cpia_pp_detach (struct parport *port)
|
|||||||
}
|
}
|
||||||
cpia = NULL;
|
cpia = NULL;
|
||||||
}
|
}
|
||||||
spin_unlock( &cam_list_lock_pp );
|
spin_unlock( &cam_list_lock_pp );
|
||||||
|
|
||||||
if (!cpia) {
|
if (!cpia) {
|
||||||
DBG("cpia_pp_detach failed to find cam_data in cam_list\n");
|
DBG("cpia_pp_detach failed to find cam_data in cam_list\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cam = (struct pp_cam_entry *) cpia->lowlevel_data;
|
cam = (struct pp_cam_entry *) cpia->lowlevel_data;
|
||||||
cpia_unregister_camera(cpia);
|
cpia_unregister_camera(cpia);
|
||||||
if(cam->open_count > 0)
|
if(cam->open_count > 0)
|
||||||
cpia_pp_close(cam);
|
cpia_pp_close(cam);
|
||||||
parport_unregister_device(cam->pdev);
|
parport_unregister_device(cam->pdev);
|
||||||
cpia->lowlevel_data = NULL;
|
cpia->lowlevel_data = NULL;
|
||||||
kfree(cam);
|
kfree(cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -805,14 +805,14 @@ static struct parport_driver cpia_pp_driver = {
|
|||||||
|
|
||||||
int cpia_pp_init(void)
|
int cpia_pp_init(void)
|
||||||
{
|
{
|
||||||
printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT,
|
printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT,
|
||||||
CPIA_PP_MAJ_VER,CPIA_PP_MIN_VER,CPIA_PP_PATCH_VER);
|
CPIA_PP_MAJ_VER,CPIA_PP_MIN_VER,CPIA_PP_PATCH_VER);
|
||||||
|
|
||||||
if(parport_nr[0] == PPCPIA_PARPORT_OFF) {
|
if(parport_nr[0] == PPCPIA_PARPORT_OFF) {
|
||||||
printk(" disabled\n");
|
printk(" disabled\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_lock_init( &cam_list_lock_pp );
|
spin_lock_init( &cam_list_lock_pp );
|
||||||
|
|
||||||
if (parport_register_driver (&cpia_pp_driver)) {
|
if (parport_register_driver (&cpia_pp_driver)) {
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */
|
/* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */
|
||||||
/* #define _CPIA_DEBUG_ 1 */
|
/* #define _CPIA_DEBUG_ 1 */
|
||||||
|
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
@ -85,7 +85,7 @@ struct usb_cpia {
|
|||||||
|
|
||||||
static int cpia_usb_open(void *privdata);
|
static int cpia_usb_open(void *privdata);
|
||||||
static int cpia_usb_registerCallback(void *privdata, void (*cb) (void *cbdata),
|
static int cpia_usb_registerCallback(void *privdata, void (*cb) (void *cbdata),
|
||||||
void *cbdata);
|
void *cbdata);
|
||||||
static int cpia_usb_transferCmd(void *privdata, u8 *command, u8 *data);
|
static int cpia_usb_transferCmd(void *privdata, u8 *command, u8 *data);
|
||||||
static int cpia_usb_streamStart(void *privdata);
|
static int cpia_usb_streamStart(void *privdata);
|
||||||
static int cpia_usb_streamStop(void *privdata);
|
static int cpia_usb_streamStop(void *privdata);
|
||||||
@ -127,7 +127,7 @@ static void cpia_usb_complete(struct urb *urb, struct pt_regs *regs)
|
|||||||
ucpia->workbuff->status = FRAME_READING;
|
ucpia->workbuff->status = FRAME_READING;
|
||||||
ucpia->workbuff->length = 0;
|
ucpia->workbuff->length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < urb->number_of_packets; i++) {
|
for (i = 0; i < urb->number_of_packets; i++) {
|
||||||
int n = urb->iso_frame_desc[i].actual_length;
|
int n = urb->iso_frame_desc[i].actual_length;
|
||||||
int st = urb->iso_frame_desc[i].status;
|
int st = urb->iso_frame_desc[i].status;
|
||||||
@ -141,9 +141,9 @@ static void cpia_usb_complete(struct urb *urb, struct pt_regs *regs)
|
|||||||
printk(KERN_DEBUG "cpia: scratch buf overflow!scr_len: %d, n: %d\n", ucpia->workbuff->length, n);
|
printk(KERN_DEBUG "cpia: scratch buf overflow!scr_len: %d, n: %d\n", ucpia->workbuff->length, n);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n) {
|
if (n) {
|
||||||
if ((ucpia->workbuff->length > 0) ||
|
if ((ucpia->workbuff->length > 0) ||
|
||||||
(0x19 == cdata[0] && 0x68 == cdata[1])) {
|
(0x19 == cdata[0] && 0x68 == cdata[1])) {
|
||||||
memcpy(ucpia->workbuff->data + ucpia->workbuff->length, cdata, n);
|
memcpy(ucpia->workbuff->data + ucpia->workbuff->length, cdata, n);
|
||||||
ucpia->workbuff->length += n;
|
ucpia->workbuff->length += n;
|
||||||
@ -160,7 +160,7 @@ static void cpia_usb_complete(struct urb *urb, struct pt_regs *regs)
|
|||||||
ucpia->workbuff = ucpia->workbuff->next;
|
ucpia->workbuff = ucpia->workbuff->next;
|
||||||
ucpia->workbuff->status = FRAME_EMPTY;
|
ucpia->workbuff->status = FRAME_EMPTY;
|
||||||
ucpia->workbuff->length = 0;
|
ucpia->workbuff->length = 0;
|
||||||
|
|
||||||
if (waitqueue_active(&ucpia->wq_stream))
|
if (waitqueue_active(&ucpia->wq_stream))
|
||||||
wake_up_interruptible(&ucpia->wq_stream);
|
wake_up_interruptible(&ucpia->wq_stream);
|
||||||
}
|
}
|
||||||
@ -178,7 +178,7 @@ static int cpia_usb_open(void *privdata)
|
|||||||
struct usb_cpia *ucpia = (struct usb_cpia *) privdata;
|
struct usb_cpia *ucpia = (struct usb_cpia *) privdata;
|
||||||
struct urb *urb;
|
struct urb *urb;
|
||||||
int ret, retval = 0, fx, err;
|
int ret, retval = 0, fx, err;
|
||||||
|
|
||||||
if (!ucpia)
|
if (!ucpia)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ static int cpia_usb_open(void *privdata)
|
|||||||
retval = -EINVAL;
|
retval = -EINVAL;
|
||||||
goto error_0;
|
goto error_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = usb_set_interface(ucpia->dev, ucpia->iface, 3);
|
ret = usb_set_interface(ucpia->dev, ucpia->iface, 3);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
printk(KERN_ERR "cpia_usb_open: usb_set_interface error (ret = %d)\n", ret);
|
printk(KERN_ERR "cpia_usb_open: usb_set_interface error (ret = %d)\n", ret);
|
||||||
@ -286,7 +286,7 @@ error_1:
|
|||||||
error_0:
|
error_0:
|
||||||
kfree (ucpia->sbuf[0].data);
|
kfree (ucpia->sbuf[0].data);
|
||||||
ucpia->sbuf[0].data = NULL;
|
ucpia->sbuf[0].data = NULL;
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,7 +307,7 @@ static int WritePacket(struct usb_device *udev, const u8 *packet, u8 *buf, size_
|
|||||||
return usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
|
return usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
|
||||||
packet[1] + (packet[0] << 8),
|
packet[1] + (packet[0] << 8),
|
||||||
USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||||
packet[2] + (packet[3] << 8),
|
packet[2] + (packet[3] << 8),
|
||||||
packet[4] + (packet[5] << 8), buf, size, 1000);
|
packet[4] + (packet[5] << 8), buf, size, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ static int ReadPacket(struct usb_device *udev, u8 *packet, u8 *buf, size_t size)
|
|||||||
return usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
|
return usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
|
||||||
packet[1] + (packet[0] << 8),
|
packet[1] + (packet[0] << 8),
|
||||||
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||||
packet[2] + (packet[3] << 8),
|
packet[2] + (packet[3] << 8),
|
||||||
packet[4] + (packet[5] << 8), buf, size, 1000);
|
packet[4] + (packet[5] << 8), buf, size, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ static int cpia_usb_streamRead(void *privdata, u8 *frame, int noblock)
|
|||||||
|
|
||||||
if (!ucpia || !ucpia->present)
|
if (!ucpia || !ucpia->present)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (ucpia->curbuff->status != FRAME_READY)
|
if (ucpia->curbuff->status != FRAME_READY)
|
||||||
interruptible_sleep_on(&ucpia->wq_stream);
|
interruptible_sleep_on(&ucpia->wq_stream);
|
||||||
else
|
else
|
||||||
@ -403,7 +403,7 @@ static int cpia_usb_streamRead(void *privdata, u8 *frame, int noblock)
|
|||||||
|
|
||||||
if (!mybuff)
|
if (!mybuff)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (mybuff->status != FRAME_READY || mybuff->length < 4) {
|
if (mybuff->status != FRAME_READY || mybuff->length < 4) {
|
||||||
DBG("Something went wrong!\n");
|
DBG("Something went wrong!\n");
|
||||||
return -1;
|
return -1;
|
||||||
@ -411,7 +411,7 @@ static int cpia_usb_streamRead(void *privdata, u8 *frame, int noblock)
|
|||||||
|
|
||||||
memcpy(frame, mybuff->data, mybuff->length);
|
memcpy(frame, mybuff->data, mybuff->length);
|
||||||
mybuff->status = FRAME_EMPTY;
|
mybuff->status = FRAME_EMPTY;
|
||||||
|
|
||||||
/* DBG("read done, %d bytes, Header: %x/%x, Footer: %x%x%x%x\n", */
|
/* DBG("read done, %d bytes, Header: %x/%x, Footer: %x%x%x%x\n", */
|
||||||
/* mybuff->length, frame[0], frame[1], */
|
/* mybuff->length, frame[0], frame[1], */
|
||||||
/* frame[mybuff->length-4], frame[mybuff->length-3], */
|
/* frame[mybuff->length-4], frame[mybuff->length-3], */
|
||||||
@ -447,7 +447,7 @@ static void cpia_usb_free_resources(struct usb_cpia *ucpia, int try)
|
|||||||
|
|
||||||
kfree(ucpia->sbuf[1].data);
|
kfree(ucpia->sbuf[1].data);
|
||||||
ucpia->sbuf[1].data = NULL;
|
ucpia->sbuf[1].data = NULL;
|
||||||
|
|
||||||
if (ucpia->sbuf[0].urb) {
|
if (ucpia->sbuf[0].urb) {
|
||||||
usb_kill_urb(ucpia->sbuf[0].urb);
|
usb_kill_urb(ucpia->sbuf[0].urb);
|
||||||
usb_free_urb(ucpia->sbuf[0].urb);
|
usb_free_urb(ucpia->sbuf[0].urb);
|
||||||
@ -490,7 +490,7 @@ static int cpia_probe(struct usb_interface *intf,
|
|||||||
struct usb_cpia *ucpia;
|
struct usb_cpia *ucpia;
|
||||||
struct cam_data *cam;
|
struct cam_data *cam;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* A multi-config CPiA camera? */
|
/* A multi-config CPiA camera? */
|
||||||
if (udev->descriptor.bNumConfigurations != 1)
|
if (udev->descriptor.bNumConfigurations != 1)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
@ -539,7 +539,7 @@ static int cpia_probe(struct usb_interface *intf,
|
|||||||
|
|
||||||
/* Before register_camera, important */
|
/* Before register_camera, important */
|
||||||
ucpia->present = 1;
|
ucpia->present = 1;
|
||||||
|
|
||||||
cam = cpia_register_camera(&cpia_usb_ops, ucpia);
|
cam = cpia_register_camera(&cpia_usb_ops, ucpia);
|
||||||
if (!cam) {
|
if (!cam) {
|
||||||
LOG("failed to cpia_register_camera\n");
|
LOG("failed to cpia_register_camera\n");
|
||||||
@ -591,7 +591,7 @@ static void cpia_disconnect(struct usb_interface *intf)
|
|||||||
struct cam_data *cam = usb_get_intfdata(intf);
|
struct cam_data *cam = usb_get_intfdata(intf);
|
||||||
struct usb_cpia *ucpia;
|
struct usb_cpia *ucpia;
|
||||||
struct usb_device *udev;
|
struct usb_device *udev;
|
||||||
|
|
||||||
usb_set_intfdata(intf, NULL);
|
usb_set_intfdata(intf, NULL);
|
||||||
if (!cam)
|
if (!cam)
|
||||||
return;
|
return;
|
||||||
@ -600,7 +600,7 @@ static void cpia_disconnect(struct usb_interface *intf)
|
|||||||
spin_lock( &cam_list_lock_usb );
|
spin_lock( &cam_list_lock_usb );
|
||||||
list_del(&cam->cam_data_list);
|
list_del(&cam->cam_data_list);
|
||||||
spin_unlock( &cam_list_lock_usb );
|
spin_unlock( &cam_list_lock_usb );
|
||||||
|
|
||||||
ucpia->present = 0;
|
ucpia->present = 0;
|
||||||
|
|
||||||
cpia_unregister_camera(cam);
|
cpia_unregister_camera(cam);
|
||||||
@ -631,7 +631,7 @@ static void cpia_disconnect(struct usb_interface *intf)
|
|||||||
|
|
||||||
static int __init usb_cpia_init(void)
|
static int __init usb_cpia_init(void)
|
||||||
{
|
{
|
||||||
printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT,
|
printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT,
|
||||||
CPIA_USB_MAJ_VER,CPIA_USB_MIN_VER,CPIA_USB_PATCH_VER);
|
CPIA_USB_MAJ_VER,CPIA_USB_MIN_VER,CPIA_USB_PATCH_VER);
|
||||||
|
|
||||||
spin_lock_init(&cam_list_lock_usb);
|
spin_lock_init(&cam_list_lock_usb);
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#define __CS8420_H__
|
#define __CS8420_H__
|
||||||
|
|
||||||
/* Initialization Sequence */
|
/* Initialization Sequence */
|
||||||
|
|
||||||
static __u8 init8420[] = {
|
static __u8 init8420[] = {
|
||||||
1, 0x01, 2, 0x02, 3, 0x00, 4, 0x46,
|
1, 0x01, 2, 0x02, 3, 0x00, 4, 0x46,
|
||||||
5, 0x24, 6, 0x84, 18, 0x18, 19, 0x13,
|
5, 0x24, 6, 0x84, 18, 0x18, 19, 0x13,
|
||||||
|
@ -86,7 +86,7 @@ static int dabusb_add_buf_tail (pdabusb_t s, struct list_head *dst, struct list_
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static void dump_urb (struct urb *urb)
|
static void dump_urb (struct urb *urb)
|
||||||
{
|
{
|
||||||
dbg("urb :%p", urb);
|
dbg("urb :%p", urb);
|
||||||
@ -136,7 +136,7 @@ static int dabusb_free_queue (struct list_head *q)
|
|||||||
for (p = q->next; p != q;) {
|
for (p = q->next; p != q;) {
|
||||||
b = list_entry (p, buff_t, buff_list);
|
b = list_entry (p, buff_t, buff_list);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
dump_urb(b->purb);
|
dump_urb(b->purb);
|
||||||
#endif
|
#endif
|
||||||
kfree(b->purb->transfer_buffer);
|
kfree(b->purb->transfer_buffer);
|
||||||
@ -287,7 +287,7 @@ static int dabusb_bulk (pdabusb_t s, pbulk_transfer_t pb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ret == -EPIPE ) {
|
if( ret == -EPIPE ) {
|
||||||
warn("CLEAR_FEATURE request to remove STALL condition.");
|
warn("CLEAR_FEATURE request to remove STALL condition.");
|
||||||
if(usb_clear_halt(s->usbdev, usb_pipeendpoint(pipe)))
|
if(usb_clear_halt(s->usbdev, usb_pipeendpoint(pipe)))
|
||||||
@ -328,7 +328,7 @@ static int dabusb_loadmem (pdabusb_t s, const char *fname)
|
|||||||
PINTEL_HEX_RECORD ptr = firmware;
|
PINTEL_HEX_RECORD ptr = firmware;
|
||||||
|
|
||||||
dbg("Enter dabusb_loadmem (internal)");
|
dbg("Enter dabusb_loadmem (internal)");
|
||||||
|
|
||||||
ret = dabusb_8051_reset (s, 1);
|
ret = dabusb_8051_reset (s, 1);
|
||||||
while (ptr->Type == 0) {
|
while (ptr->Type == 0) {
|
||||||
|
|
||||||
@ -449,7 +449,7 @@ static int dabusb_startrek (pdabusb_t s)
|
|||||||
if (!list_empty (&s->free_buff_list)) {
|
if (!list_empty (&s->free_buff_list)) {
|
||||||
pbuff_t end;
|
pbuff_t end;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
while (!dabusb_add_buf_tail (s, &s->rec_buff_list, &s->free_buff_list)) {
|
while (!dabusb_add_buf_tail (s, &s->rec_buff_list, &s->free_buff_list)) {
|
||||||
|
|
||||||
dbg("submitting: end:%p s->rec_buff_list:%p", s->rec_buff_list.prev, &s->rec_buff_list);
|
dbg("submitting: end:%p s->rec_buff_list:%p", s->rec_buff_list.prev, &s->rec_buff_list);
|
||||||
@ -506,7 +506,7 @@ static ssize_t dabusb_read (struct file *file, char __user *buf, size_t count, l
|
|||||||
err("error: rec_buf_list is empty");
|
err("error: rec_buf_list is empty");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
b = list_entry (s->rec_buff_list.next, buff_t, buff_list);
|
b = list_entry (s->rec_buff_list.next, buff_t, buff_list);
|
||||||
purb = b->purb;
|
purb = b->purb;
|
||||||
|
|
||||||
@ -783,9 +783,9 @@ static void dabusb_disconnect (struct usb_interface *intf)
|
|||||||
pdabusb_t s = usb_get_intfdata (intf);
|
pdabusb_t s = usb_get_intfdata (intf);
|
||||||
|
|
||||||
dbg("dabusb_disconnect");
|
dbg("dabusb_disconnect");
|
||||||
|
|
||||||
init_waitqueue_entry(&__wait, current);
|
init_waitqueue_entry(&__wait, current);
|
||||||
|
|
||||||
usb_set_intfdata (intf, NULL);
|
usb_set_intfdata (intf, NULL);
|
||||||
if (s) {
|
if (s) {
|
||||||
usb_deregister_dev (intf, &dabusb_class);
|
usb_deregister_dev (intf, &dabusb_class);
|
||||||
@ -797,7 +797,7 @@ static void dabusb_disconnect (struct usb_interface *intf)
|
|||||||
schedule();
|
schedule();
|
||||||
current->state = TASK_RUNNING;
|
current->state = TASK_RUNNING;
|
||||||
remove_wait_queue(&s->remove_ok, &__wait);
|
remove_wait_queue(&s->remove_ok, &__wait);
|
||||||
|
|
||||||
s->usbdev = NULL;
|
s->usbdev = NULL;
|
||||||
s->overruns = 0;
|
s->overruns = 0;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ typedef struct
|
|||||||
#define DABUSB_VERSION 0x1000
|
#define DABUSB_VERSION 0x1000
|
||||||
#define IOCTL_DAB_BULK _IOWR('d', 0x30, bulk_transfer_t)
|
#define IOCTL_DAB_BULK _IOWR('d', 0x30, bulk_transfer_t)
|
||||||
#define IOCTL_DAB_OVERRUNS _IOR('d', 0x15, int)
|
#define IOCTL_DAB_OVERRUNS _IOR('d', 0x15, int)
|
||||||
#define IOCTL_DAB_VERSION _IOR('d', 0x3f, int)
|
#define IOCTL_DAB_VERSION _IOR('d', 0x3f, int)
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ typedef struct
|
|||||||
struct list_head rec_buff_list;
|
struct list_head rec_buff_list;
|
||||||
} dabusb_t,*pdabusb_t;
|
} dabusb_t,*pdabusb_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
pdabusb_t s;
|
pdabusb_t s;
|
||||||
struct urb *purb;
|
struct urb *purb;
|
||||||
|
@ -37,28 +37,28 @@
|
|||||||
Markus: Updates for 2.6.x kernels, code layout changes, name sanitizing
|
Markus: Updates for 2.6.x kernels, code layout changes, name sanitizing
|
||||||
|
|
||||||
Version 0.30:
|
Version 0.30:
|
||||||
Markus: Updates for 2.5.x kernel and more ISO compliant source
|
Markus: Updates for 2.5.x kernel and more ISO compliant source
|
||||||
|
|
||||||
Version 0.25:
|
Version 0.25:
|
||||||
PSL and Markus: Cleanup, radio now doesn't stop on device close
|
PSL and Markus: Cleanup, radio now doesn't stop on device close
|
||||||
|
|
||||||
Version 0.24:
|
Version 0.24:
|
||||||
Markus: Hope I got these silly VIDEO_TUNER_LOW issues finally
|
Markus: Hope I got these silly VIDEO_TUNER_LOW issues finally
|
||||||
right. Some minor cleanup, improved standalone compilation
|
right. Some minor cleanup, improved standalone compilation
|
||||||
|
|
||||||
Version 0.23:
|
Version 0.23:
|
||||||
Markus: Sign extension bug fixed by declaring transfer_buffer unsigned
|
Markus: Sign extension bug fixed by declaring transfer_buffer unsigned
|
||||||
|
|
||||||
Version 0.22:
|
Version 0.22:
|
||||||
Markus: Some (brown bag) cleanup in what VIDIOCSTUNER returns,
|
Markus: Some (brown bag) cleanup in what VIDIOCSTUNER returns,
|
||||||
thanks to Mike Cox for pointing the problem out.
|
thanks to Mike Cox for pointing the problem out.
|
||||||
|
|
||||||
Version 0.21:
|
Version 0.21:
|
||||||
Markus: Minor cleanup, warnings if something goes wrong, lame attempt
|
Markus: Minor cleanup, warnings if something goes wrong, lame attempt
|
||||||
to adhere to Documentation/CodingStyle
|
to adhere to Documentation/CodingStyle
|
||||||
|
|
||||||
Version 0.2:
|
Version 0.2:
|
||||||
Brad Hards <bradh@dynamite.com.au>: Fixes to make it work as non-module
|
Brad Hards <bradh@dynamite.com.au>: Fixes to make it work as non-module
|
||||||
Markus: Copyright clarification
|
Markus: Copyright clarification
|
||||||
|
|
||||||
Version 0.01: Markus: initial release
|
Version 0.01: Markus: initial release
|
||||||
@ -163,11 +163,11 @@ static struct usb_driver usb_dsbr100_driver = {
|
|||||||
static int dsbr100_start(dsbr100_device *radio)
|
static int dsbr100_start(dsbr100_device *radio)
|
||||||
{
|
{
|
||||||
if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
|
if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
|
||||||
USB_REQ_GET_STATUS,
|
USB_REQ_GET_STATUS,
|
||||||
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
|
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
|
||||||
0x00, 0xC7, radio->transfer_buffer, 8, 300)<0 ||
|
0x00, 0xC7, radio->transfer_buffer, 8, 300)<0 ||
|
||||||
usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
|
usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
|
||||||
DSB100_ONOFF,
|
DSB100_ONOFF,
|
||||||
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
|
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
|
||||||
0x01, 0x00, radio->transfer_buffer, 8, 300)<0)
|
0x01, 0x00, radio->transfer_buffer, 8, 300)<0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -179,11 +179,11 @@ static int dsbr100_start(dsbr100_device *radio)
|
|||||||
static int dsbr100_stop(dsbr100_device *radio)
|
static int dsbr100_stop(dsbr100_device *radio)
|
||||||
{
|
{
|
||||||
if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
|
if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
|
||||||
USB_REQ_GET_STATUS,
|
USB_REQ_GET_STATUS,
|
||||||
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
|
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
|
||||||
0x16, 0x1C, radio->transfer_buffer, 8, 300)<0 ||
|
0x16, 0x1C, radio->transfer_buffer, 8, 300)<0 ||
|
||||||
usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
|
usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
|
||||||
DSB100_ONOFF,
|
DSB100_ONOFF,
|
||||||
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
|
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
|
||||||
0x00, 0x00, radio->transfer_buffer, 8, 300)<0)
|
0x00, 0x00, radio->transfer_buffer, 8, 300)<0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -195,16 +195,16 @@ static int dsbr100_setfreq(dsbr100_device *radio, int freq)
|
|||||||
{
|
{
|
||||||
freq = (freq/16*80)/1000+856;
|
freq = (freq/16*80)/1000+856;
|
||||||
if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
|
if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
|
||||||
DSB100_TUNE,
|
DSB100_TUNE,
|
||||||
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
|
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
|
||||||
(freq>>8)&0x00ff, freq&0xff,
|
(freq>>8)&0x00ff, freq&0xff,
|
||||||
radio->transfer_buffer, 8, 300)<0 ||
|
radio->transfer_buffer, 8, 300)<0 ||
|
||||||
usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
|
usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
|
||||||
USB_REQ_GET_STATUS,
|
USB_REQ_GET_STATUS,
|
||||||
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
|
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
|
||||||
0x96, 0xB7, radio->transfer_buffer, 8, 300)<0 ||
|
0x96, 0xB7, radio->transfer_buffer, 8, 300)<0 ||
|
||||||
usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
|
usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
|
||||||
USB_REQ_GET_STATUS,
|
USB_REQ_GET_STATUS,
|
||||||
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
|
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
|
||||||
0x00, 0x24, radio->transfer_buffer, 8, 300)<0) {
|
0x00, 0x24, radio->transfer_buffer, 8, 300)<0) {
|
||||||
radio->stereo = -1;
|
radio->stereo = -1;
|
||||||
@ -219,7 +219,7 @@ sees a stereo signal or not. Pity. */
|
|||||||
static void dsbr100_getstat(dsbr100_device *radio)
|
static void dsbr100_getstat(dsbr100_device *radio)
|
||||||
{
|
{
|
||||||
if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
|
if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
|
||||||
USB_REQ_GET_STATUS,
|
USB_REQ_GET_STATUS,
|
||||||
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
|
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
|
||||||
0x00 , 0x24, radio->transfer_buffer, 8, 300)<0)
|
0x00 , 0x24, radio->transfer_buffer, 8, 300)<0)
|
||||||
radio->stereo = -1;
|
radio->stereo = -1;
|
||||||
@ -232,7 +232,7 @@ static void dsbr100_getstat(dsbr100_device *radio)
|
|||||||
|
|
||||||
/* check if the device is present and register with v4l and
|
/* check if the device is present and register with v4l and
|
||||||
usb if it is */
|
usb if it is */
|
||||||
static int usb_dsbr100_probe(struct usb_interface *intf,
|
static int usb_dsbr100_probe(struct usb_interface *intf,
|
||||||
const struct usb_device_id *id)
|
const struct usb_device_id *id)
|
||||||
{
|
{
|
||||||
dsbr100_device *radio;
|
dsbr100_device *radio;
|
||||||
@ -243,7 +243,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf,
|
|||||||
kfree(radio);
|
kfree(radio);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
memcpy(radio->videodev, &dsbr100_videodev_template,
|
memcpy(radio->videodev, &dsbr100_videodev_template,
|
||||||
sizeof(dsbr100_videodev_template));
|
sizeof(dsbr100_videodev_template));
|
||||||
radio->removed = 0;
|
radio->removed = 0;
|
||||||
radio->users = 0;
|
radio->users = 0;
|
||||||
@ -310,7 +310,7 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
struct video_tuner *v = arg;
|
struct video_tuner *v = arg;
|
||||||
|
|
||||||
dsbr100_getstat(radio);
|
dsbr100_getstat(radio);
|
||||||
if(v->tuner) /* Only 1 tuner */
|
if(v->tuner) /* Only 1 tuner */
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
v->rangelow = FREQ_MIN*FREQ_MUL;
|
v->rangelow = FREQ_MIN*FREQ_MUL;
|
||||||
v->rangehigh = FREQ_MAX*FREQ_MUL;
|
v->rangehigh = FREQ_MAX*FREQ_MUL;
|
||||||
@ -355,12 +355,12 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
v->volume = 1;
|
v->volume = 1;
|
||||||
v->step = 1;
|
v->step = 1;
|
||||||
strcpy(v->name, "Radio");
|
strcpy(v->name, "Radio");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCSAUDIO: {
|
case VIDIOCSAUDIO: {
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
|
|
||||||
if (v->audio)
|
if (v->audio)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (v->flags&VIDEO_AUDIO_MUTE) {
|
if (v->flags&VIDEO_AUDIO_MUTE) {
|
||||||
if (dsbr100_stop(radio)==-1)
|
if (dsbr100_stop(radio)==-1)
|
||||||
|
@ -180,7 +180,7 @@ et61x251_match_id(struct et61x251_device* cam, const struct usb_device_id *id)
|
|||||||
|
|
||||||
void
|
void
|
||||||
et61x251_attach_sensor(struct et61x251_device* cam,
|
et61x251_attach_sensor(struct et61x251_device* cam,
|
||||||
struct et61x251_sensor* sensor)
|
struct et61x251_sensor* sensor)
|
||||||
{
|
{
|
||||||
memcpy(&cam->sensor, sensor, sizeof(struct et61x251_sensor));
|
memcpy(&cam->sensor, sensor, sizeof(struct et61x251_sensor));
|
||||||
}
|
}
|
||||||
@ -199,7 +199,7 @@ do { \
|
|||||||
dev_info(&cam->usbdev->dev, fmt "\n", ## args); \
|
dev_info(&cam->usbdev->dev, fmt "\n", ## args); \
|
||||||
else if ((level) >= 3) \
|
else if ((level) >= 3) \
|
||||||
dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
|
dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
|
||||||
__FUNCTION__, __LINE__ , ## args); \
|
__FUNCTION__, __LINE__ , ## args); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
# define KDBG(level, fmt, args...) \
|
# define KDBG(level, fmt, args...) \
|
||||||
@ -209,7 +209,7 @@ do { \
|
|||||||
pr_info("et61x251: " fmt "\n", ## args); \
|
pr_info("et61x251: " fmt "\n", ## args); \
|
||||||
else if ((level) == 3) \
|
else if ((level) == 3) \
|
||||||
pr_debug("et61x251: [%s:%d] " fmt "\n", __FUNCTION__, \
|
pr_debug("et61x251: [%s:%d] " fmt "\n", __FUNCTION__, \
|
||||||
__LINE__ , ## args); \
|
__LINE__ , ## args); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
# define V4LDBG(level, name, cmd) \
|
# define V4LDBG(level, name, cmd) \
|
||||||
@ -226,7 +226,7 @@ do { \
|
|||||||
#undef PDBG
|
#undef PDBG
|
||||||
#define PDBG(fmt, args...) \
|
#define PDBG(fmt, args...) \
|
||||||
dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
|
dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
|
||||||
__FUNCTION__, __LINE__ , ## args)
|
__FUNCTION__, __LINE__ , ## args)
|
||||||
|
|
||||||
#undef PDBGG
|
#undef PDBGG
|
||||||
#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */
|
#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define ET61X251_MODULE_NAME "V4L2 driver for ET61X[12]51 " \
|
#define ET61X251_MODULE_NAME "V4L2 driver for ET61X[12]51 " \
|
||||||
"PC Camera Controllers"
|
"PC Camera Controllers"
|
||||||
#define ET61X251_MODULE_AUTHOR "(C) 2006 Luca Risolia"
|
#define ET61X251_MODULE_AUTHOR "(C) 2006 Luca Risolia"
|
||||||
#define ET61X251_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"
|
#define ET61X251_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"
|
||||||
#define ET61X251_MODULE_LICENSE "GPL"
|
#define ET61X251_MODULE_LICENSE "GPL"
|
||||||
@ -63,68 +63,68 @@ MODULE_LICENSE(ET61X251_MODULE_LICENSE);
|
|||||||
static short video_nr[] = {[0 ... ET61X251_MAX_DEVICES-1] = -1};
|
static short video_nr[] = {[0 ... ET61X251_MAX_DEVICES-1] = -1};
|
||||||
module_param_array(video_nr, short, NULL, 0444);
|
module_param_array(video_nr, short, NULL, 0444);
|
||||||
MODULE_PARM_DESC(video_nr,
|
MODULE_PARM_DESC(video_nr,
|
||||||
"\n<-1|n[,...]> Specify V4L2 minor mode number."
|
"\n<-1|n[,...]> Specify V4L2 minor mode number."
|
||||||
"\n -1 = use next available (default)"
|
"\n -1 = use next available (default)"
|
||||||
"\n n = use minor number n (integer >= 0)"
|
"\n n = use minor number n (integer >= 0)"
|
||||||
"\nYou can specify up to "
|
"\nYou can specify up to "
|
||||||
__MODULE_STRING(ET61X251_MAX_DEVICES) " cameras this way."
|
__MODULE_STRING(ET61X251_MAX_DEVICES) " cameras this way."
|
||||||
"\nFor example:"
|
"\nFor example:"
|
||||||
"\nvideo_nr=-1,2,-1 would assign minor number 2 to"
|
"\nvideo_nr=-1,2,-1 would assign minor number 2 to"
|
||||||
"\nthe second registered camera and use auto for the first"
|
"\nthe second registered camera and use auto for the first"
|
||||||
"\none and for every other camera."
|
"\none and for every other camera."
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
static short force_munmap[] = {[0 ... ET61X251_MAX_DEVICES-1] =
|
static short force_munmap[] = {[0 ... ET61X251_MAX_DEVICES-1] =
|
||||||
ET61X251_FORCE_MUNMAP};
|
ET61X251_FORCE_MUNMAP};
|
||||||
module_param_array(force_munmap, bool, NULL, 0444);
|
module_param_array(force_munmap, bool, NULL, 0444);
|
||||||
MODULE_PARM_DESC(force_munmap,
|
MODULE_PARM_DESC(force_munmap,
|
||||||
"\n<0|1[,...]> Force the application to unmap previously"
|
"\n<0|1[,...]> Force the application to unmap previously"
|
||||||
"\nmapped buffer memory before calling any VIDIOC_S_CROP or"
|
"\nmapped buffer memory before calling any VIDIOC_S_CROP or"
|
||||||
"\nVIDIOC_S_FMT ioctl's. Not all the applications support"
|
"\nVIDIOC_S_FMT ioctl's. Not all the applications support"
|
||||||
"\nthis feature. This parameter is specific for each"
|
"\nthis feature. This parameter is specific for each"
|
||||||
"\ndetected camera."
|
"\ndetected camera."
|
||||||
"\n 0 = do not force memory unmapping"
|
"\n 0 = do not force memory unmapping"
|
||||||
"\n 1 = force memory unmapping (save memory)"
|
"\n 1 = force memory unmapping (save memory)"
|
||||||
"\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"."
|
"\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"."
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
static unsigned int frame_timeout[] = {[0 ... ET61X251_MAX_DEVICES-1] =
|
static unsigned int frame_timeout[] = {[0 ... ET61X251_MAX_DEVICES-1] =
|
||||||
ET61X251_FRAME_TIMEOUT};
|
ET61X251_FRAME_TIMEOUT};
|
||||||
module_param_array(frame_timeout, uint, NULL, 0644);
|
module_param_array(frame_timeout, uint, NULL, 0644);
|
||||||
MODULE_PARM_DESC(frame_timeout,
|
MODULE_PARM_DESC(frame_timeout,
|
||||||
"\n<n[,...]> Timeout for a video frame in seconds."
|
"\n<n[,...]> Timeout for a video frame in seconds."
|
||||||
"\nThis parameter is specific for each detected camera."
|
"\nThis parameter is specific for each detected camera."
|
||||||
"\nDefault value is "
|
"\nDefault value is "
|
||||||
__MODULE_STRING(ET61X251_FRAME_TIMEOUT)"."
|
__MODULE_STRING(ET61X251_FRAME_TIMEOUT)"."
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#ifdef ET61X251_DEBUG
|
#ifdef ET61X251_DEBUG
|
||||||
static unsigned short debug = ET61X251_DEBUG_LEVEL;
|
static unsigned short debug = ET61X251_DEBUG_LEVEL;
|
||||||
module_param(debug, ushort, 0644);
|
module_param(debug, ushort, 0644);
|
||||||
MODULE_PARM_DESC(debug,
|
MODULE_PARM_DESC(debug,
|
||||||
"\n<n> Debugging information level, from 0 to 3:"
|
"\n<n> Debugging information level, from 0 to 3:"
|
||||||
"\n0 = none (use carefully)"
|
"\n0 = none (use carefully)"
|
||||||
"\n1 = critical errors"
|
"\n1 = critical errors"
|
||||||
"\n2 = significant informations"
|
"\n2 = significant informations"
|
||||||
"\n3 = more verbose messages"
|
"\n3 = more verbose messages"
|
||||||
"\nLevel 3 is useful for testing only, when only "
|
"\nLevel 3 is useful for testing only, when only "
|
||||||
"one device is used."
|
"one device is used."
|
||||||
"\nDefault value is "__MODULE_STRING(ET61X251_DEBUG_LEVEL)"."
|
"\nDefault value is "__MODULE_STRING(ET61X251_DEBUG_LEVEL)"."
|
||||||
"\n");
|
"\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static u32
|
static u32
|
||||||
et61x251_request_buffers(struct et61x251_device* cam, u32 count,
|
et61x251_request_buffers(struct et61x251_device* cam, u32 count,
|
||||||
enum et61x251_io_method io)
|
enum et61x251_io_method io)
|
||||||
{
|
{
|
||||||
struct v4l2_pix_format* p = &(cam->sensor.pix_format);
|
struct v4l2_pix_format* p = &(cam->sensor.pix_format);
|
||||||
struct v4l2_rect* r = &(cam->sensor.cropcap.bounds);
|
struct v4l2_rect* r = &(cam->sensor.cropcap.bounds);
|
||||||
const size_t imagesize = cam->module_param.force_munmap ||
|
const size_t imagesize = cam->module_param.force_munmap ||
|
||||||
io == IO_READ ?
|
io == IO_READ ?
|
||||||
(p->width * p->height * p->priv) / 8 :
|
(p->width * p->height * p->priv) / 8 :
|
||||||
(r->width * r->height * p->priv) / 8;
|
(r->width * r->height * p->priv) / 8;
|
||||||
void* buff = NULL;
|
void* buff = NULL;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ int et61x251_write_reg(struct et61x251_device* cam, u8 value, u16 index)
|
|||||||
*buff = value;
|
*buff = value;
|
||||||
|
|
||||||
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
|
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
|
||||||
0, index, buff, 1, ET61X251_CTRL_TIMEOUT);
|
0, index, buff, 1, ET61X251_CTRL_TIMEOUT);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
DBG(3, "Failed to write a register (value 0x%02X, index "
|
DBG(3, "Failed to write a register (value 0x%02X, index "
|
||||||
"0x%02X, error %d)", value, index, res);
|
"0x%02X, error %d)", value, index, res);
|
||||||
@ -234,7 +234,7 @@ int et61x251_read_reg(struct et61x251_device* cam, u16 index)
|
|||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1,
|
res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1,
|
||||||
0, index, buff, 1, ET61X251_CTRL_TIMEOUT);
|
0, index, buff, 1, ET61X251_CTRL_TIMEOUT);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
DBG(3, "Failed to read a register (index 0x%02X, error %d)",
|
DBG(3, "Failed to read a register (index 0x%02X, error %d)",
|
||||||
index, res);
|
index, res);
|
||||||
@ -269,7 +269,7 @@ et61x251_i2c_wait(struct et61x251_device* cam, struct et61x251_sensor* sensor)
|
|||||||
|
|
||||||
int
|
int
|
||||||
et61x251_i2c_try_read(struct et61x251_device* cam,
|
et61x251_i2c_try_read(struct et61x251_device* cam,
|
||||||
struct et61x251_sensor* sensor, u8 address)
|
struct et61x251_sensor* sensor, u8 address)
|
||||||
{
|
{
|
||||||
struct usb_device* udev = cam->usbdev;
|
struct usb_device* udev = cam->usbdev;
|
||||||
u8* data = cam->control_buffer;
|
u8* data = cam->control_buffer;
|
||||||
@ -280,14 +280,14 @@ et61x251_i2c_try_read(struct et61x251_device* cam,
|
|||||||
data[2] = cam->sensor.rsta | 0x10;
|
data[2] = cam->sensor.rsta | 0x10;
|
||||||
data[3] = !(et61x251_read_reg(cam, 0x8b) & 0x02);
|
data[3] = !(et61x251_read_reg(cam, 0x8b) & 0x02);
|
||||||
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
|
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
|
||||||
0, 0x88, data, 4, ET61X251_CTRL_TIMEOUT);
|
0, 0x88, data, 4, ET61X251_CTRL_TIMEOUT);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
err += res;
|
err += res;
|
||||||
|
|
||||||
err += et61x251_i2c_wait(cam, sensor);
|
err += et61x251_i2c_wait(cam, sensor);
|
||||||
|
|
||||||
res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1,
|
res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1,
|
||||||
0, 0x80, data, 8, ET61X251_CTRL_TIMEOUT);
|
0, 0x80, data, 8, ET61X251_CTRL_TIMEOUT);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
err += res;
|
err += res;
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ et61x251_i2c_try_read(struct et61x251_device* cam,
|
|||||||
|
|
||||||
int
|
int
|
||||||
et61x251_i2c_try_write(struct et61x251_device* cam,
|
et61x251_i2c_try_write(struct et61x251_device* cam,
|
||||||
struct et61x251_sensor* sensor, u8 address, u8 value)
|
struct et61x251_sensor* sensor, u8 address, u8 value)
|
||||||
{
|
{
|
||||||
struct usb_device* udev = cam->usbdev;
|
struct usb_device* udev = cam->usbdev;
|
||||||
u8* data = cam->control_buffer;
|
u8* data = cam->control_buffer;
|
||||||
@ -312,13 +312,13 @@ et61x251_i2c_try_write(struct et61x251_device* cam,
|
|||||||
data[1] = cam->sensor.i2c_slave_id;
|
data[1] = cam->sensor.i2c_slave_id;
|
||||||
data[2] = cam->sensor.rsta | 0x12;
|
data[2] = cam->sensor.rsta | 0x12;
|
||||||
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
|
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
|
||||||
0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT);
|
0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
err += res;
|
err += res;
|
||||||
|
|
||||||
data[0] = value;
|
data[0] = value;
|
||||||
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
|
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
|
||||||
0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT);
|
0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
err += res;
|
err += res;
|
||||||
|
|
||||||
@ -335,8 +335,8 @@ et61x251_i2c_try_write(struct et61x251_device* cam,
|
|||||||
|
|
||||||
int
|
int
|
||||||
et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2,
|
et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2,
|
||||||
u8 data3, u8 data4, u8 data5, u8 data6, u8 data7,
|
u8 data3, u8 data4, u8 data5, u8 data6, u8 data7,
|
||||||
u8 data8, u8 address)
|
u8 data8, u8 address)
|
||||||
{
|
{
|
||||||
struct usb_device* udev = cam->usbdev;
|
struct usb_device* udev = cam->usbdev;
|
||||||
u8* data = cam->control_buffer;
|
u8* data = cam->control_buffer;
|
||||||
@ -350,7 +350,7 @@ et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2,
|
|||||||
data[5] = data7;
|
data[5] = data7;
|
||||||
data[6] = data8;
|
data[6] = data8;
|
||||||
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
|
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
|
||||||
0, 0x81, data, n-1, ET61X251_CTRL_TIMEOUT);
|
0, 0x81, data, n-1, ET61X251_CTRL_TIMEOUT);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
err += res;
|
err += res;
|
||||||
|
|
||||||
@ -358,14 +358,14 @@ et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2,
|
|||||||
data[1] = cam->sensor.i2c_slave_id;
|
data[1] = cam->sensor.i2c_slave_id;
|
||||||
data[2] = cam->sensor.rsta | 0x02 | (n << 4);
|
data[2] = cam->sensor.rsta | 0x02 | (n << 4);
|
||||||
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
|
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
|
||||||
0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT);
|
0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
err += res;
|
err += res;
|
||||||
|
|
||||||
/* Start writing through the serial interface */
|
/* Start writing through the serial interface */
|
||||||
data[0] = data1;
|
data[0] = data1;
|
||||||
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
|
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
|
||||||
0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT);
|
0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
err += res;
|
err += res;
|
||||||
|
|
||||||
@ -432,11 +432,11 @@ static void et61x251_urb_complete(struct urb *urb, struct pt_regs* regs)
|
|||||||
|
|
||||||
if (!(*f))
|
if (!(*f))
|
||||||
(*f) = list_entry(cam->inqueue.next, struct et61x251_frame_t,
|
(*f) = list_entry(cam->inqueue.next, struct et61x251_frame_t,
|
||||||
frame);
|
frame);
|
||||||
|
|
||||||
imagesize = (cam->sensor.pix_format.width *
|
imagesize = (cam->sensor.pix_format.width *
|
||||||
cam->sensor.pix_format.height *
|
cam->sensor.pix_format.height *
|
||||||
cam->sensor.pix_format.priv) / 8;
|
cam->sensor.pix_format.priv) / 8;
|
||||||
|
|
||||||
for (i = 0; i < urb->number_of_packets; i++) {
|
for (i = 0; i < urb->number_of_packets; i++) {
|
||||||
unsigned int len, status;
|
unsigned int len, status;
|
||||||
@ -476,7 +476,7 @@ start_of_frame:
|
|||||||
if ((*f)->state == F_GRABBING) {
|
if ((*f)->state == F_GRABBING) {
|
||||||
if (sof && (*f)->buf.bytesused) {
|
if (sof && (*f)->buf.bytesused) {
|
||||||
if (cam->sensor.pix_format.pixelformat ==
|
if (cam->sensor.pix_format.pixelformat ==
|
||||||
V4L2_PIX_FMT_ET61X251)
|
V4L2_PIX_FMT_ET61X251)
|
||||||
goto end_of_frame;
|
goto end_of_frame;
|
||||||
else {
|
else {
|
||||||
DBG(3, "Not expected SOF detected "
|
DBG(3, "Not expected SOF detected "
|
||||||
@ -508,8 +508,8 @@ end_of_frame:
|
|||||||
list_move_tail(&(*f)->frame, &cam->outqueue);
|
list_move_tail(&(*f)->frame, &cam->outqueue);
|
||||||
if (!list_empty(&cam->inqueue))
|
if (!list_empty(&cam->inqueue))
|
||||||
(*f) = list_entry(cam->inqueue.next,
|
(*f) = list_entry(cam->inqueue.next,
|
||||||
struct et61x251_frame_t,
|
struct et61x251_frame_t,
|
||||||
frame);
|
frame);
|
||||||
else
|
else
|
||||||
(*f) = NULL;
|
(*f) = NULL;
|
||||||
spin_unlock(&cam->queue_lock);
|
spin_unlock(&cam->queue_lock);
|
||||||
@ -521,7 +521,7 @@ end_of_frame:
|
|||||||
|
|
||||||
if (sof &&
|
if (sof &&
|
||||||
cam->sensor.pix_format.pixelformat ==
|
cam->sensor.pix_format.pixelformat ==
|
||||||
V4L2_PIX_FMT_ET61X251)
|
V4L2_PIX_FMT_ET61X251)
|
||||||
goto start_of_frame;
|
goto start_of_frame;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -544,15 +544,15 @@ static int et61x251_start_transfer(struct et61x251_device* cam)
|
|||||||
struct usb_device *udev = cam->usbdev;
|
struct usb_device *udev = cam->usbdev;
|
||||||
struct urb* urb;
|
struct urb* urb;
|
||||||
const unsigned int wMaxPacketSize[] = {0, 256, 384, 512, 640, 768, 832,
|
const unsigned int wMaxPacketSize[] = {0, 256, 384, 512, 640, 768, 832,
|
||||||
864, 896, 920, 956, 980, 1000,
|
864, 896, 920, 956, 980, 1000,
|
||||||
1022};
|
1022};
|
||||||
const unsigned int psz = wMaxPacketSize[ET61X251_ALTERNATE_SETTING];
|
const unsigned int psz = wMaxPacketSize[ET61X251_ALTERNATE_SETTING];
|
||||||
s8 i, j;
|
s8 i, j;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
for (i = 0; i < ET61X251_URBS; i++) {
|
for (i = 0; i < ET61X251_URBS; i++) {
|
||||||
cam->transfer_buffer[i] = kzalloc(ET61X251_ISO_PACKETS * psz,
|
cam->transfer_buffer[i] = kzalloc(ET61X251_ISO_PACKETS * psz,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!cam->transfer_buffer[i]) {
|
if (!cam->transfer_buffer[i]) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
DBG(1, "Not enough memory");
|
DBG(1, "Not enough memory");
|
||||||
@ -653,9 +653,9 @@ static int et61x251_stream_interrupt(struct et61x251_device* cam)
|
|||||||
|
|
||||||
cam->stream = STREAM_INTERRUPT;
|
cam->stream = STREAM_INTERRUPT;
|
||||||
timeout = wait_event_timeout(cam->wait_stream,
|
timeout = wait_event_timeout(cam->wait_stream,
|
||||||
(cam->stream == STREAM_OFF) ||
|
(cam->stream == STREAM_OFF) ||
|
||||||
(cam->state & DEV_DISCONNECTED),
|
(cam->state & DEV_DISCONNECTED),
|
||||||
ET61X251_URB_TIMEOUT);
|
ET61X251_URB_TIMEOUT);
|
||||||
if (cam->state & DEV_DISCONNECTED)
|
if (cam->state & DEV_DISCONNECTED)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
else if (cam->stream != STREAM_OFF) {
|
else if (cam->stream != STREAM_OFF) {
|
||||||
@ -699,7 +699,7 @@ static u8 et61x251_strtou8(const char* buff, size_t len, ssize_t* count)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
NOTE 1: being inside one of the following methods implies that the v4l
|
NOTE 1: being inside one of the following methods implies that the v4l
|
||||||
device exists for sure (see kobjects and reference counters)
|
device exists for sure (see kobjects and reference counters)
|
||||||
NOTE 2: buffers are PAGE_SIZE long
|
NOTE 2: buffers are PAGE_SIZE long
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -964,13 +964,13 @@ et61x251_store_i2c_val(struct class_device* cd, const char* buf, size_t len)
|
|||||||
|
|
||||||
|
|
||||||
static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR,
|
static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR,
|
||||||
et61x251_show_reg, et61x251_store_reg);
|
et61x251_show_reg, et61x251_store_reg);
|
||||||
static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR,
|
static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR,
|
||||||
et61x251_show_val, et61x251_store_val);
|
et61x251_show_val, et61x251_store_val);
|
||||||
static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR,
|
static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR,
|
||||||
et61x251_show_i2c_reg, et61x251_store_i2c_reg);
|
et61x251_show_i2c_reg, et61x251_store_i2c_reg);
|
||||||
static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR,
|
static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR,
|
||||||
et61x251_show_i2c_val, et61x251_store_i2c_val);
|
et61x251_show_i2c_val, et61x251_store_i2c_val);
|
||||||
|
|
||||||
|
|
||||||
static void et61x251_create_sysfs(struct et61x251_device* cam)
|
static void et61x251_create_sysfs(struct et61x251_device* cam)
|
||||||
@ -990,7 +990,7 @@ static void et61x251_create_sysfs(struct et61x251_device* cam)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
et61x251_set_pix_format(struct et61x251_device* cam,
|
et61x251_set_pix_format(struct et61x251_device* cam,
|
||||||
struct v4l2_pix_format* pix)
|
struct v4l2_pix_format* pix)
|
||||||
{
|
{
|
||||||
int r, err = 0;
|
int r, err = 0;
|
||||||
|
|
||||||
@ -1007,7 +1007,7 @@ et61x251_set_pix_format(struct et61x251_device* cam,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
et61x251_set_compression(struct et61x251_device* cam,
|
et61x251_set_compression(struct et61x251_device* cam,
|
||||||
struct v4l2_jpegcompression* compression)
|
struct v4l2_jpegcompression* compression)
|
||||||
{
|
{
|
||||||
int r, err = 0;
|
int r, err = 0;
|
||||||
|
|
||||||
@ -1049,9 +1049,9 @@ et61x251_set_crop(struct et61x251_device* cam, struct v4l2_rect* rect)
|
|||||||
{
|
{
|
||||||
struct et61x251_sensor* s = &cam->sensor;
|
struct et61x251_sensor* s = &cam->sensor;
|
||||||
u16 fmw_sx = (u16)(rect->left - s->cropcap.bounds.left +
|
u16 fmw_sx = (u16)(rect->left - s->cropcap.bounds.left +
|
||||||
s->active_pixel.left),
|
s->active_pixel.left),
|
||||||
fmw_sy = (u16)(rect->top - s->cropcap.bounds.top +
|
fmw_sy = (u16)(rect->top - s->cropcap.bounds.top +
|
||||||
s->active_pixel.top),
|
s->active_pixel.top),
|
||||||
fmw_length = (u16)(rect->width),
|
fmw_length = (u16)(rect->width),
|
||||||
fmw_height = (u16)(rect->height);
|
fmw_height = (u16)(rect->height);
|
||||||
int err = 0;
|
int err = 0;
|
||||||
@ -1061,8 +1061,8 @@ et61x251_set_crop(struct et61x251_device* cam, struct v4l2_rect* rect)
|
|||||||
err += et61x251_write_reg(cam, fmw_length & 0xff, 0x6b);
|
err += et61x251_write_reg(cam, fmw_length & 0xff, 0x6b);
|
||||||
err += et61x251_write_reg(cam, fmw_height & 0xff, 0x6c);
|
err += et61x251_write_reg(cam, fmw_height & 0xff, 0x6c);
|
||||||
err += et61x251_write_reg(cam, (fmw_sx >> 8) | ((fmw_sy & 0x300) >> 6)
|
err += et61x251_write_reg(cam, (fmw_sx >> 8) | ((fmw_sy & 0x300) >> 6)
|
||||||
| ((fmw_length & 0x300) >> 4)
|
| ((fmw_length & 0x300) >> 4)
|
||||||
| ((fmw_height & 0x300) >> 2), 0x6d);
|
| ((fmw_height & 0x300) >> 2), 0x6d);
|
||||||
if (err)
|
if (err)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
@ -1203,8 +1203,8 @@ static int et61x251_open(struct inode* inode, struct file* filp)
|
|||||||
}
|
}
|
||||||
mutex_unlock(&cam->dev_mutex);
|
mutex_unlock(&cam->dev_mutex);
|
||||||
err = wait_event_interruptible_exclusive(cam->open,
|
err = wait_event_interruptible_exclusive(cam->open,
|
||||||
cam->state & DEV_DISCONNECTED
|
cam->state & DEV_DISCONNECTED
|
||||||
|| !cam->users);
|
|| !cam->users);
|
||||||
if (err) {
|
if (err) {
|
||||||
up_read(&et61x251_disconnect);
|
up_read(&et61x251_disconnect);
|
||||||
return err;
|
return err;
|
||||||
@ -1277,7 +1277,7 @@ static int et61x251_release(struct inode* inode, struct file* filp)
|
|||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
et61x251_read(struct file* filp, char __user * buf,
|
et61x251_read(struct file* filp, char __user * buf,
|
||||||
size_t count, loff_t* f_pos)
|
size_t count, loff_t* f_pos)
|
||||||
{
|
{
|
||||||
struct et61x251_device* cam = video_get_drvdata(video_devdata(filp));
|
struct et61x251_device* cam = video_get_drvdata(video_devdata(filp));
|
||||||
struct et61x251_frame_t* f, * i;
|
struct et61x251_frame_t* f, * i;
|
||||||
@ -1310,7 +1310,7 @@ et61x251_read(struct file* filp, char __user * buf,
|
|||||||
|
|
||||||
if (cam->io == IO_NONE) {
|
if (cam->io == IO_NONE) {
|
||||||
if (!et61x251_request_buffers(cam, cam->nreadbuffers,
|
if (!et61x251_request_buffers(cam, cam->nreadbuffers,
|
||||||
IO_READ)) {
|
IO_READ)) {
|
||||||
DBG(1, "read() failed, not enough memory");
|
DBG(1, "read() failed, not enough memory");
|
||||||
mutex_unlock(&cam->fileop_mutex);
|
mutex_unlock(&cam->fileop_mutex);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -1336,12 +1336,12 @@ et61x251_read(struct file* filp, char __user * buf,
|
|||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
timeout = wait_event_interruptible_timeout
|
timeout = wait_event_interruptible_timeout
|
||||||
( cam->wait_frame,
|
( cam->wait_frame,
|
||||||
(!list_empty(&cam->outqueue)) ||
|
(!list_empty(&cam->outqueue)) ||
|
||||||
(cam->state & DEV_DISCONNECTED) ||
|
(cam->state & DEV_DISCONNECTED) ||
|
||||||
(cam->state & DEV_MISCONFIGURED),
|
(cam->state & DEV_MISCONFIGURED),
|
||||||
cam->module_param.frame_timeout *
|
cam->module_param.frame_timeout *
|
||||||
1000 * msecs_to_jiffies(1) );
|
1000 * msecs_to_jiffies(1) );
|
||||||
if (timeout < 0) {
|
if (timeout < 0) {
|
||||||
mutex_unlock(&cam->fileop_mutex);
|
mutex_unlock(&cam->fileop_mutex);
|
||||||
return timeout;
|
return timeout;
|
||||||
@ -1408,7 +1408,7 @@ static unsigned int et61x251_poll(struct file *filp, poll_table *wait)
|
|||||||
|
|
||||||
if (cam->io == IO_NONE) {
|
if (cam->io == IO_NONE) {
|
||||||
if (!et61x251_request_buffers(cam, cam->nreadbuffers,
|
if (!et61x251_request_buffers(cam, cam->nreadbuffers,
|
||||||
IO_READ)) {
|
IO_READ)) {
|
||||||
DBG(1, "poll() failed, not enough memory");
|
DBG(1, "poll() failed, not enough memory");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -1465,7 +1465,7 @@ static int et61x251_mmap(struct file* filp, struct vm_area_struct *vma)
|
|||||||
{
|
{
|
||||||
struct et61x251_device* cam = video_get_drvdata(video_devdata(filp));
|
struct et61x251_device* cam = video_get_drvdata(video_devdata(filp));
|
||||||
unsigned long size = vma->vm_end - vma->vm_start,
|
unsigned long size = vma->vm_end - vma->vm_start,
|
||||||
start = vma->vm_start;
|
start = vma->vm_start;
|
||||||
void *pos;
|
void *pos;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
@ -1533,13 +1533,13 @@ et61x251_vidioc_querycap(struct et61x251_device* cam, void __user * arg)
|
|||||||
.driver = "et61x251",
|
.driver = "et61x251",
|
||||||
.version = ET61X251_MODULE_VERSION_CODE,
|
.version = ET61X251_MODULE_VERSION_CODE,
|
||||||
.capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
|
.capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
|
||||||
V4L2_CAP_STREAMING,
|
V4L2_CAP_STREAMING,
|
||||||
};
|
};
|
||||||
|
|
||||||
strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card));
|
strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card));
|
||||||
if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0)
|
if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0)
|
||||||
strlcpy(cap.bus_info, cam->usbdev->dev.bus_id,
|
strlcpy(cap.bus_info, cam->usbdev->dev.bus_id,
|
||||||
sizeof(cap.bus_info));
|
sizeof(cap.bus_info));
|
||||||
|
|
||||||
if (copy_to_user(arg, &cap, sizeof(cap)))
|
if (copy_to_user(arg, &cap, sizeof(cap)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
@ -1871,7 +1871,7 @@ et61x251_vidioc_g_fmt(struct et61x251_device* cam, void __user * arg)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_ET61X251)
|
pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_ET61X251)
|
||||||
? 0 : (pfmt->width * pfmt->priv) / 8;
|
? 0 : (pfmt->width * pfmt->priv) / 8;
|
||||||
pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8);
|
pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8);
|
||||||
pfmt->field = V4L2_FIELD_NONE;
|
pfmt->field = V4L2_FIELD_NONE;
|
||||||
memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt));
|
memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt));
|
||||||
@ -1885,7 +1885,7 @@ et61x251_vidioc_g_fmt(struct et61x251_device* cam, void __user * arg)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd,
|
et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd,
|
||||||
void __user * arg)
|
void __user * arg)
|
||||||
{
|
{
|
||||||
struct et61x251_sensor* s = &cam->sensor;
|
struct et61x251_sensor* s = &cam->sensor;
|
||||||
struct v4l2_format format;
|
struct v4l2_format format;
|
||||||
@ -1947,7 +1947,7 @@ et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd,
|
|||||||
pix->priv = pfmt->priv; /* bpp */
|
pix->priv = pfmt->priv; /* bpp */
|
||||||
pix->colorspace = pfmt->colorspace;
|
pix->colorspace = pfmt->colorspace;
|
||||||
pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_ET61X251)
|
pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_ET61X251)
|
||||||
? 0 : (pix->width * pix->priv) / 8;
|
? 0 : (pix->width * pix->priv) / 8;
|
||||||
pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8);
|
pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8);
|
||||||
pix->field = V4L2_FIELD_NONE;
|
pix->field = V4L2_FIELD_NONE;
|
||||||
|
|
||||||
@ -2020,7 +2020,7 @@ static int
|
|||||||
et61x251_vidioc_g_jpegcomp(struct et61x251_device* cam, void __user * arg)
|
et61x251_vidioc_g_jpegcomp(struct et61x251_device* cam, void __user * arg)
|
||||||
{
|
{
|
||||||
if (copy_to_user(arg, &cam->compression,
|
if (copy_to_user(arg, &cam->compression,
|
||||||
sizeof(cam->compression)))
|
sizeof(cam->compression)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -2169,7 +2169,7 @@ et61x251_vidioc_qbuf(struct et61x251_device* cam, void __user * arg)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
et61x251_vidioc_dqbuf(struct et61x251_device* cam, struct file* filp,
|
et61x251_vidioc_dqbuf(struct et61x251_device* cam, struct file* filp,
|
||||||
void __user * arg)
|
void __user * arg)
|
||||||
{
|
{
|
||||||
struct v4l2_buffer b;
|
struct v4l2_buffer b;
|
||||||
struct et61x251_frame_t *f;
|
struct et61x251_frame_t *f;
|
||||||
@ -2188,12 +2188,12 @@ et61x251_vidioc_dqbuf(struct et61x251_device* cam, struct file* filp,
|
|||||||
if (filp->f_flags & O_NONBLOCK)
|
if (filp->f_flags & O_NONBLOCK)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
timeout = wait_event_interruptible_timeout
|
timeout = wait_event_interruptible_timeout
|
||||||
( cam->wait_frame,
|
( cam->wait_frame,
|
||||||
(!list_empty(&cam->outqueue)) ||
|
(!list_empty(&cam->outqueue)) ||
|
||||||
(cam->state & DEV_DISCONNECTED) ||
|
(cam->state & DEV_DISCONNECTED) ||
|
||||||
(cam->state & DEV_MISCONFIGURED),
|
(cam->state & DEV_MISCONFIGURED),
|
||||||
cam->module_param.frame_timeout *
|
cam->module_param.frame_timeout *
|
||||||
1000 * msecs_to_jiffies(1) );
|
1000 * msecs_to_jiffies(1) );
|
||||||
if (timeout < 0)
|
if (timeout < 0)
|
||||||
return timeout;
|
return timeout;
|
||||||
if (cam->state & DEV_DISCONNECTED)
|
if (cam->state & DEV_DISCONNECTED)
|
||||||
@ -2317,7 +2317,7 @@ et61x251_vidioc_s_parm(struct et61x251_device* cam, void __user * arg)
|
|||||||
|
|
||||||
|
|
||||||
static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp,
|
static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp,
|
||||||
unsigned int cmd, void __user * arg)
|
unsigned int cmd, void __user * arg)
|
||||||
{
|
{
|
||||||
struct et61x251_device* cam = video_get_drvdata(video_devdata(filp));
|
struct et61x251_device* cam = video_get_drvdata(video_devdata(filp));
|
||||||
|
|
||||||
@ -2411,7 +2411,7 @@ static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp,
|
|||||||
|
|
||||||
|
|
||||||
static int et61x251_ioctl(struct inode* inode, struct file* filp,
|
static int et61x251_ioctl(struct inode* inode, struct file* filp,
|
||||||
unsigned int cmd, unsigned long arg)
|
unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
struct et61x251_device* cam = video_get_drvdata(video_devdata(filp));
|
struct et61x251_device* cam = video_get_drvdata(video_devdata(filp));
|
||||||
int err = 0;
|
int err = 0;
|
||||||
@ -2518,7 +2518,7 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
|
|||||||
mutex_lock(&cam->dev_mutex);
|
mutex_lock(&cam->dev_mutex);
|
||||||
|
|
||||||
err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER,
|
err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER,
|
||||||
video_nr[dev_nr]);
|
video_nr[dev_nr]);
|
||||||
if (err) {
|
if (err) {
|
||||||
DBG(1, "V4L2 device registration failed");
|
DBG(1, "V4L2 device registration failed");
|
||||||
if (err == -ENFILE && video_nr[dev_nr] == -1)
|
if (err == -ENFILE && video_nr[dev_nr] == -1)
|
||||||
|
@ -47,7 +47,7 @@ et61x251_match_id(struct et61x251_device* cam, const struct usb_device_id *id);
|
|||||||
|
|
||||||
extern void
|
extern void
|
||||||
et61x251_attach_sensor(struct et61x251_device* cam,
|
et61x251_attach_sensor(struct et61x251_device* cam,
|
||||||
struct et61x251_sensor* sensor);
|
struct et61x251_sensor* sensor);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
@ -56,13 +56,13 @@ extern int et61x251_read_reg(struct et61x251_device*, u16 index);
|
|||||||
extern int et61x251_i2c_write(struct et61x251_device*, u8 address, u8 value);
|
extern int et61x251_i2c_write(struct et61x251_device*, u8 address, u8 value);
|
||||||
extern int et61x251_i2c_read(struct et61x251_device*, u8 address);
|
extern int et61x251_i2c_read(struct et61x251_device*, u8 address);
|
||||||
extern int et61x251_i2c_try_write(struct et61x251_device*,
|
extern int et61x251_i2c_try_write(struct et61x251_device*,
|
||||||
struct et61x251_sensor*, u8 address,
|
struct et61x251_sensor*, u8 address,
|
||||||
u8 value);
|
u8 value);
|
||||||
extern int et61x251_i2c_try_read(struct et61x251_device*,
|
extern int et61x251_i2c_try_read(struct et61x251_device*,
|
||||||
struct et61x251_sensor*, u8 address);
|
struct et61x251_sensor*, u8 address);
|
||||||
extern int et61x251_i2c_raw_write(struct et61x251_device*, u8 n, u8 data1,
|
extern int et61x251_i2c_raw_write(struct et61x251_device*, u8 n, u8 data1,
|
||||||
u8 data2, u8 data3, u8 data4, u8 data5,
|
u8 data2, u8 data3, u8 data4, u8 data5,
|
||||||
u8 data6, u8 data7, u8 data8, u8 address);
|
u8 data6, u8 data7, u8 data8, u8 address);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
@ -100,13 +100,13 @@ struct et61x251_sensor {
|
|||||||
|
|
||||||
int (*init)(struct et61x251_device* cam);
|
int (*init)(struct et61x251_device* cam);
|
||||||
int (*get_ctrl)(struct et61x251_device* cam,
|
int (*get_ctrl)(struct et61x251_device* cam,
|
||||||
struct v4l2_control* ctrl);
|
struct v4l2_control* ctrl);
|
||||||
int (*set_ctrl)(struct et61x251_device* cam,
|
int (*set_ctrl)(struct et61x251_device* cam,
|
||||||
const struct v4l2_control* ctrl);
|
const struct v4l2_control* ctrl);
|
||||||
int (*set_crop)(struct et61x251_device* cam,
|
int (*set_crop)(struct et61x251_device* cam,
|
||||||
const struct v4l2_rect* rect);
|
const struct v4l2_rect* rect);
|
||||||
int (*set_pix_format)(struct et61x251_device* cam,
|
int (*set_pix_format)(struct et61x251_device* cam,
|
||||||
const struct v4l2_pix_format* pix);
|
const struct v4l2_pix_format* pix);
|
||||||
|
|
||||||
/* Private */
|
/* Private */
|
||||||
struct v4l2_queryctrl _qctrl[ET61X251_MAX_CTRLS];
|
struct v4l2_queryctrl _qctrl[ET61X251_MAX_CTRLS];
|
||||||
|
@ -46,20 +46,20 @@ static int tas5130d1b_init(struct et61x251_device* cam)
|
|||||||
|
|
||||||
|
|
||||||
static int tas5130d1b_set_ctrl(struct et61x251_device* cam,
|
static int tas5130d1b_set_ctrl(struct et61x251_device* cam,
|
||||||
const struct v4l2_control* ctrl)
|
const struct v4l2_control* ctrl)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
switch (ctrl->id) {
|
switch (ctrl->id) {
|
||||||
case V4L2_CID_GAIN:
|
case V4L2_CID_GAIN:
|
||||||
err += et61x251_i2c_raw_write(cam, 2, 0x20,
|
err += et61x251_i2c_raw_write(cam, 2, 0x20,
|
||||||
0xf6-ctrl->value, 0, 0, 0,
|
0xf6-ctrl->value, 0, 0, 0,
|
||||||
0, 0, 0, 0);
|
0, 0, 0, 0);
|
||||||
break;
|
break;
|
||||||
case V4L2_CID_EXPOSURE:
|
case V4L2_CID_EXPOSURE:
|
||||||
err += et61x251_i2c_raw_write(cam, 2, 0x40,
|
err += et61x251_i2c_raw_write(cam, 2, 0x40,
|
||||||
0x47-ctrl->value, 0, 0, 0,
|
0x47-ctrl->value, 0, 0, 0,
|
||||||
0, 0, 0, 0);
|
0, 0, 0, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*
|
*
|
||||||
* Based on the Linux CPiA driver written by Peter Pregler,
|
* Based on the Linux CPiA driver written by Peter Pregler,
|
||||||
* Scott J. Bertin and Johannes Erdfelt.
|
* Scott J. Bertin and Johannes Erdfelt.
|
||||||
*
|
*
|
||||||
* Please see the file: Documentation/usb/ov511.txt
|
* Please see the file: Documentation/usb/ov511.txt
|
||||||
* and the website at: http://alpha.dyndns.org/ov511
|
* and the website at: http://alpha.dyndns.org/ov511
|
||||||
* for more info.
|
* for more info.
|
||||||
@ -433,7 +433,7 @@ reg_w_mask(struct usb_ov511 *ov,
|
|||||||
return (reg_w(ov, reg, newval));
|
return (reg_w(ov, reg, newval));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes multiple (n) byte value to a single register. Only valid with certain
|
* Writes multiple (n) byte value to a single register. Only valid with certain
|
||||||
* registers (0x30 and 0xc4 - 0xce).
|
* registers (0x30 and 0xc4 - 0xce).
|
||||||
*/
|
*/
|
||||||
@ -629,7 +629,7 @@ ov511_i2c_write_internal(struct usb_ov511 *ov,
|
|||||||
/* Retry until idle */
|
/* Retry until idle */
|
||||||
do
|
do
|
||||||
rc = reg_r(ov, R511_I2C_CTL);
|
rc = reg_r(ov, R511_I2C_CTL);
|
||||||
while (rc > 0 && ((rc&1) == 0));
|
while (rc > 0 && ((rc&1) == 0));
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1752,7 +1752,7 @@ sensor_set_picture(struct usb_ov511 *ov, struct video_picture *p)
|
|||||||
ov->whiteness = p->whiteness;
|
ov->whiteness = p->whiteness;
|
||||||
|
|
||||||
/* Don't return error if a setting is unsupported, or rest of settings
|
/* Don't return error if a setting is unsupported, or rest of settings
|
||||||
* will not be performed */
|
* will not be performed */
|
||||||
|
|
||||||
rc = sensor_set_contrast(ov, p->contrast);
|
rc = sensor_set_contrast(ov, p->contrast);
|
||||||
if (FATAL_ERROR(rc))
|
if (FATAL_ERROR(rc))
|
||||||
@ -1781,7 +1781,7 @@ sensor_get_picture(struct usb_ov511 *ov, struct video_picture *p)
|
|||||||
PDEBUG(4, "sensor_get_picture");
|
PDEBUG(4, "sensor_get_picture");
|
||||||
|
|
||||||
/* Don't return error if a setting is unsupported, or rest of settings
|
/* Don't return error if a setting is unsupported, or rest of settings
|
||||||
* will not be performed */
|
* will not be performed */
|
||||||
|
|
||||||
rc = sensor_get_contrast(ov, &(p->contrast));
|
rc = sensor_get_contrast(ov, &(p->contrast));
|
||||||
if (FATAL_ERROR(rc))
|
if (FATAL_ERROR(rc))
|
||||||
@ -2251,7 +2251,7 @@ mode_init_ov_sensor_regs(struct usb_ov511 *ov, int width, int height,
|
|||||||
|
|
||||||
/******** Clock programming ********/
|
/******** Clock programming ********/
|
||||||
|
|
||||||
/* The OV6620 needs special handling. This prevents the
|
/* The OV6620 needs special handling. This prevents the
|
||||||
* severe banding that normally occurs */
|
* severe banding that normally occurs */
|
||||||
if (ov->sensor == SEN_OV6620 || ov->sensor == SEN_OV6630)
|
if (ov->sensor == SEN_OV6620 || ov->sensor == SEN_OV6630)
|
||||||
{
|
{
|
||||||
@ -2326,7 +2326,7 @@ set_ov_sensor_window(struct usb_ov511 *ov, int width, int height, int mode,
|
|||||||
int sub_flag)
|
int sub_flag)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int hwsbase, hwebase, vwsbase, vwebase, hwsize, vwsize;
|
int hwsbase, hwebase, vwsbase, vwebase, hwsize, vwsize;
|
||||||
int hoffset, voffset, hwscale = 0, vwscale = 0;
|
int hoffset, voffset, hwscale = 0, vwscale = 0;
|
||||||
|
|
||||||
/* The different sensor ICs handle setting up of window differently.
|
/* The different sensor ICs handle setting up of window differently.
|
||||||
@ -2575,7 +2575,7 @@ ov518_mode_init_regs(struct usb_ov511 *ov,
|
|||||||
/* OV518 needs U and V swapped */
|
/* OV518 needs U and V swapped */
|
||||||
i2c_w_mask(ov, 0x15, 0x00, 0x01);
|
i2c_w_mask(ov, 0x15, 0x00, 0x01);
|
||||||
|
|
||||||
if (mode == VIDEO_PALETTE_GREY) {
|
if (mode == VIDEO_PALETTE_GREY) {
|
||||||
/* Set 16-bit input format (UV data are ignored) */
|
/* Set 16-bit input format (UV data are ignored) */
|
||||||
reg_w_mask(ov, 0x20, 0x00, 0x08);
|
reg_w_mask(ov, 0x20, 0x00, 0x08);
|
||||||
|
|
||||||
@ -2894,7 +2894,7 @@ make_8x8(unsigned char *pIn, unsigned char *pOut, int w)
|
|||||||
* ... ... ...
|
* ... ... ...
|
||||||
* 56 57 ... 63 120 121 ... 127 248 249 ... 255
|
* 56 57 ... 63 120 121 ... 127 248 249 ... 255
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
yuv400raw_to_yuv400p(struct ov511_frame *frame,
|
yuv400raw_to_yuv400p(struct ov511_frame *frame,
|
||||||
unsigned char *pIn0, unsigned char *pOut0)
|
unsigned char *pIn0, unsigned char *pOut0)
|
||||||
@ -2923,7 +2923,7 @@ yuv400raw_to_yuv400p(struct ov511_frame *frame,
|
|||||||
*
|
*
|
||||||
* 0 1 ... 7
|
* 0 1 ... 7
|
||||||
* 8 9 ... 15
|
* 8 9 ... 15
|
||||||
* ...
|
* ...
|
||||||
* 56 57 ... 63
|
* 56 57 ... 63
|
||||||
*
|
*
|
||||||
* U and V are shipped at half resolution (1 U,V sample -> one 2x2 block).
|
* U and V are shipped at half resolution (1 U,V sample -> one 2x2 block).
|
||||||
@ -3034,7 +3034,7 @@ decompress(struct usb_ov511 *ov, struct ov511_frame *frame,
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
deinterlace(struct ov511_frame *frame, int rawformat,
|
deinterlace(struct ov511_frame *frame, int rawformat,
|
||||||
unsigned char *pIn0, unsigned char *pOut0)
|
unsigned char *pIn0, unsigned char *pOut0)
|
||||||
{
|
{
|
||||||
const int fieldheight = frame->rawheight / 2;
|
const int fieldheight = frame->rawheight / 2;
|
||||||
const int fieldpix = fieldheight * frame->rawwidth;
|
const int fieldpix = fieldheight * frame->rawwidth;
|
||||||
@ -3112,7 +3112,7 @@ ov51x_postprocess_grey(struct usb_ov511 *ov, struct ov511_frame *frame)
|
|||||||
frame->tempdata);
|
frame->tempdata);
|
||||||
|
|
||||||
deinterlace(frame, RAWFMT_YUV400, frame->tempdata,
|
deinterlace(frame, RAWFMT_YUV400, frame->tempdata,
|
||||||
frame->data);
|
frame->data);
|
||||||
} else {
|
} else {
|
||||||
if (frame->compressed)
|
if (frame->compressed)
|
||||||
decompress(ov, frame, frame->rawdata,
|
decompress(ov, frame, frame->rawdata,
|
||||||
@ -3136,7 +3136,7 @@ ov51x_postprocess_yuv420(struct usb_ov511 *ov, struct ov511_frame *frame)
|
|||||||
frame->tempdata);
|
frame->tempdata);
|
||||||
|
|
||||||
deinterlace(frame, RAWFMT_YUV420, frame->tempdata,
|
deinterlace(frame, RAWFMT_YUV420, frame->tempdata,
|
||||||
frame->data);
|
frame->data);
|
||||||
} else {
|
} else {
|
||||||
if (frame->compressed)
|
if (frame->compressed)
|
||||||
decompress(ov, frame, frame->rawdata, frame->data);
|
decompress(ov, frame, frame->rawdata, frame->data);
|
||||||
@ -3226,7 +3226,7 @@ ov511_move_data(struct usb_ov511 *ov, unsigned char *in, int n)
|
|||||||
frame->rawwidth = ((int)(in[9]) + 1) * 8;
|
frame->rawwidth = ((int)(in[9]) + 1) * 8;
|
||||||
frame->rawheight = ((int)(in[10]) + 1) * 8;
|
frame->rawheight = ((int)(in[10]) + 1) * 8;
|
||||||
|
|
||||||
PDEBUG(4, "Frame end, frame=%d, pnum=%d, w=%d, h=%d, recvd=%d",
|
PDEBUG(4, "Frame end, frame=%d, pnum=%d, w=%d, h=%d, recvd=%d",
|
||||||
ov->curframe, pnum, frame->rawwidth, frame->rawheight,
|
ov->curframe, pnum, frame->rawwidth, frame->rawheight,
|
||||||
frame->bytes_recvd);
|
frame->bytes_recvd);
|
||||||
|
|
||||||
@ -3527,10 +3527,10 @@ ov51x_isoc_irq(struct urb *urb, struct pt_regs *regs)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (urb->status == -ENOENT || urb->status == -ECONNRESET) {
|
if (urb->status == -ENOENT || urb->status == -ECONNRESET) {
|
||||||
PDEBUG(4, "URB unlinked");
|
PDEBUG(4, "URB unlinked");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (urb->status != -EINPROGRESS && urb->status != 0) {
|
if (urb->status != -EINPROGRESS && urb->status != 0) {
|
||||||
err("ERROR: urb->status=%d: %s", urb->status,
|
err("ERROR: urb->status=%d: %s", urb->status,
|
||||||
@ -4627,8 +4627,8 @@ ov51x_v4l1_mmap(struct file *file, struct vm_area_struct *vma)
|
|||||||
PDEBUG(4, "mmap: %ld (%lX) bytes", size, size);
|
PDEBUG(4, "mmap: %ld (%lX) bytes", size, size);
|
||||||
|
|
||||||
if (size > (((OV511_NUMFRAMES
|
if (size > (((OV511_NUMFRAMES
|
||||||
* MAX_DATA_SIZE(ov->maxwidth, ov->maxheight)
|
* MAX_DATA_SIZE(ov->maxwidth, ov->maxheight)
|
||||||
+ PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))))
|
+ PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (mutex_lock_interruptible(&ov->lock))
|
if (mutex_lock_interruptible(&ov->lock))
|
||||||
@ -5062,7 +5062,7 @@ ov6xx0_configure(struct usb_ov511 *ov)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This initializes the KS0127 and KS0127B video decoders. */
|
/* This initializes the KS0127 and KS0127B video decoders. */
|
||||||
static int
|
static int
|
||||||
ks0127_configure(struct usb_ov511 *ov)
|
ks0127_configure(struct usb_ov511 *ov)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
@ -5193,7 +5193,7 @@ saa7111a_configure(struct usb_ov511 *ov)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Detect version of decoder. This must be done after writing the
|
/* Detect version of decoder. This must be done after writing the
|
||||||
* initial regs or the decoder will lock up. */
|
* initial regs or the decoder will lock up. */
|
||||||
rc = i2c_r(ov, 0x00);
|
rc = i2c_r(ov, 0x00);
|
||||||
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
@ -5216,13 +5216,13 @@ saa7111a_configure(struct usb_ov511 *ov)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This initializes the OV511/OV511+ and the sensor */
|
/* This initializes the OV511/OV511+ and the sensor */
|
||||||
static int
|
static int
|
||||||
ov511_configure(struct usb_ov511 *ov)
|
ov511_configure(struct usb_ov511 *ov)
|
||||||
{
|
{
|
||||||
static struct ov511_regvals aRegvalsInit511[] = {
|
static struct ov511_regvals aRegvalsInit511[] = {
|
||||||
{ OV511_REG_BUS, R51x_SYS_RESET, 0x7f },
|
{ OV511_REG_BUS, R51x_SYS_RESET, 0x7f },
|
||||||
{ OV511_REG_BUS, R51x_SYS_INIT, 0x01 },
|
{ OV511_REG_BUS, R51x_SYS_INIT, 0x01 },
|
||||||
{ OV511_REG_BUS, R51x_SYS_RESET, 0x7f },
|
{ OV511_REG_BUS, R51x_SYS_RESET, 0x7f },
|
||||||
{ OV511_REG_BUS, R51x_SYS_INIT, 0x01 },
|
{ OV511_REG_BUS, R51x_SYS_INIT, 0x01 },
|
||||||
{ OV511_REG_BUS, R51x_SYS_RESET, 0x3f },
|
{ OV511_REG_BUS, R51x_SYS_RESET, 0x3f },
|
||||||
{ OV511_REG_BUS, R51x_SYS_INIT, 0x01 },
|
{ OV511_REG_BUS, R51x_SYS_INIT, 0x01 },
|
||||||
@ -5269,7 +5269,7 @@ ov511_configure(struct usb_ov511 *ov)
|
|||||||
err("Please notify " EMAIL " of the name,");
|
err("Please notify " EMAIL " of the name,");
|
||||||
err("manufacturer, model, and this number of your camera.");
|
err("manufacturer, model, and this number of your camera.");
|
||||||
err("Also include the output of the detection process.");
|
err("Also include the output of the detection process.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ov->customid == 70) /* USB Life TV (PAL/SECAM) */
|
if (ov->customid == 70) /* USB Life TV (PAL/SECAM) */
|
||||||
ov->pal = 1;
|
ov->pal = 1;
|
||||||
@ -5336,17 +5336,17 @@ ov511_configure(struct usb_ov511 *ov)
|
|||||||
|
|
||||||
if (i2c_w(ov, 0x10, 0x00) < 0) {
|
if (i2c_w(ov, 0x10, 0x00) < 0) {
|
||||||
err("Can't determine sensor slave IDs");
|
err("Can't determine sensor slave IDs");
|
||||||
goto error;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
if (ks0127_configure(ov) < 0) {
|
if (ks0127_configure(ov) < 0) {
|
||||||
err("Failed to configure KS0127");
|
err("Failed to configure KS0127");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (saa7111a_configure(ov) < 0) {
|
if (saa7111a_configure(ov) < 0) {
|
||||||
err("Failed to configure SAA7111A");
|
err("Failed to configure SAA7111A");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -5356,13 +5356,13 @@ ov511_configure(struct usb_ov511 *ov)
|
|||||||
} else {
|
} else {
|
||||||
if (ov6xx0_configure(ov) < 0) {
|
if (ov6xx0_configure(ov) < 0) {
|
||||||
err("Failed to configure OV6xx0");
|
err("Failed to configure OV6xx0");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ov7xx0_configure(ov) < 0) {
|
if (ov7xx0_configure(ov) < 0) {
|
||||||
err("Failed to configure OV7xx0");
|
err("Failed to configure OV7xx0");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5381,12 +5381,12 @@ ov518_configure(struct usb_ov511 *ov)
|
|||||||
/* For 518 and 518+ */
|
/* For 518 and 518+ */
|
||||||
static struct ov511_regvals aRegvalsInit518[] = {
|
static struct ov511_regvals aRegvalsInit518[] = {
|
||||||
{ OV511_REG_BUS, R51x_SYS_RESET, 0x40 },
|
{ OV511_REG_BUS, R51x_SYS_RESET, 0x40 },
|
||||||
{ OV511_REG_BUS, R51x_SYS_INIT, 0xe1 },
|
{ OV511_REG_BUS, R51x_SYS_INIT, 0xe1 },
|
||||||
{ OV511_REG_BUS, R51x_SYS_RESET, 0x3e },
|
{ OV511_REG_BUS, R51x_SYS_RESET, 0x3e },
|
||||||
{ OV511_REG_BUS, R51x_SYS_INIT, 0xe1 },
|
{ OV511_REG_BUS, R51x_SYS_INIT, 0xe1 },
|
||||||
{ OV511_REG_BUS, R51x_SYS_RESET, 0x00 },
|
{ OV511_REG_BUS, R51x_SYS_RESET, 0x00 },
|
||||||
{ OV511_REG_BUS, R51x_SYS_INIT, 0xe1 },
|
{ OV511_REG_BUS, R51x_SYS_INIT, 0xe1 },
|
||||||
{ OV511_REG_BUS, 0x46, 0x00 },
|
{ OV511_REG_BUS, 0x46, 0x00 },
|
||||||
{ OV511_REG_BUS, 0x5d, 0x03 },
|
{ OV511_REG_BUS, 0x5d, 0x03 },
|
||||||
{ OV511_DONE_BUS, 0x0, 0x00},
|
{ OV511_DONE_BUS, 0x0, 0x00},
|
||||||
};
|
};
|
||||||
@ -5517,7 +5517,7 @@ ov518_configure(struct usb_ov511 *ov)
|
|||||||
|
|
||||||
if (init_ov_sensor(ov) < 0) {
|
if (init_ov_sensor(ov) < 0) {
|
||||||
err("Can't determine sensor slave IDs");
|
err("Can't determine sensor slave IDs");
|
||||||
goto error;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
err("Detected unsupported OV8xx0 sensor");
|
err("Detected unsupported OV8xx0 sensor");
|
||||||
goto error;
|
goto error;
|
||||||
@ -5525,13 +5525,13 @@ ov518_configure(struct usb_ov511 *ov)
|
|||||||
} else {
|
} else {
|
||||||
if (ov6xx0_configure(ov) < 0) {
|
if (ov6xx0_configure(ov) < 0) {
|
||||||
err("Failed to configure OV6xx0");
|
err("Failed to configure OV6xx0");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ov7xx0_configure(ov) < 0) {
|
if (ov7xx0_configure(ov) < 0) {
|
||||||
err("Failed to configure OV7xx0");
|
err("Failed to configure OV7xx0");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5564,28 +5564,28 @@ static ssize_t show_custom_id(struct class_device *cd, char *buf)
|
|||||||
{
|
{
|
||||||
struct usb_ov511 *ov = cd_to_ov(cd);
|
struct usb_ov511 *ov = cd_to_ov(cd);
|
||||||
return sprintf(buf, "%d\n", ov->customid);
|
return sprintf(buf, "%d\n", ov->customid);
|
||||||
}
|
}
|
||||||
static CLASS_DEVICE_ATTR(custom_id, S_IRUGO, show_custom_id, NULL);
|
static CLASS_DEVICE_ATTR(custom_id, S_IRUGO, show_custom_id, NULL);
|
||||||
|
|
||||||
static ssize_t show_model(struct class_device *cd, char *buf)
|
static ssize_t show_model(struct class_device *cd, char *buf)
|
||||||
{
|
{
|
||||||
struct usb_ov511 *ov = cd_to_ov(cd);
|
struct usb_ov511 *ov = cd_to_ov(cd);
|
||||||
return sprintf(buf, "%s\n", ov->desc);
|
return sprintf(buf, "%s\n", ov->desc);
|
||||||
}
|
}
|
||||||
static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL);
|
static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL);
|
||||||
|
|
||||||
static ssize_t show_bridge(struct class_device *cd, char *buf)
|
static ssize_t show_bridge(struct class_device *cd, char *buf)
|
||||||
{
|
{
|
||||||
struct usb_ov511 *ov = cd_to_ov(cd);
|
struct usb_ov511 *ov = cd_to_ov(cd);
|
||||||
return sprintf(buf, "%s\n", symbolic(brglist, ov->bridge));
|
return sprintf(buf, "%s\n", symbolic(brglist, ov->bridge));
|
||||||
}
|
}
|
||||||
static CLASS_DEVICE_ATTR(bridge, S_IRUGO, show_bridge, NULL);
|
static CLASS_DEVICE_ATTR(bridge, S_IRUGO, show_bridge, NULL);
|
||||||
|
|
||||||
static ssize_t show_sensor(struct class_device *cd, char *buf)
|
static ssize_t show_sensor(struct class_device *cd, char *buf)
|
||||||
{
|
{
|
||||||
struct usb_ov511 *ov = cd_to_ov(cd);
|
struct usb_ov511 *ov = cd_to_ov(cd);
|
||||||
return sprintf(buf, "%s\n", symbolic(senlist, ov->sensor));
|
return sprintf(buf, "%s\n", symbolic(senlist, ov->sensor));
|
||||||
}
|
}
|
||||||
static CLASS_DEVICE_ATTR(sensor, S_IRUGO, show_sensor, NULL);
|
static CLASS_DEVICE_ATTR(sensor, S_IRUGO, show_sensor, NULL);
|
||||||
|
|
||||||
static ssize_t show_brightness(struct class_device *cd, char *buf)
|
static ssize_t show_brightness(struct class_device *cd, char *buf)
|
||||||
@ -5597,7 +5597,7 @@ static ssize_t show_brightness(struct class_device *cd, char *buf)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
sensor_get_brightness(ov, &x);
|
sensor_get_brightness(ov, &x);
|
||||||
return sprintf(buf, "%d\n", x >> 8);
|
return sprintf(buf, "%d\n", x >> 8);
|
||||||
}
|
}
|
||||||
static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL);
|
static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL);
|
||||||
|
|
||||||
static ssize_t show_saturation(struct class_device *cd, char *buf)
|
static ssize_t show_saturation(struct class_device *cd, char *buf)
|
||||||
@ -5609,7 +5609,7 @@ static ssize_t show_saturation(struct class_device *cd, char *buf)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
sensor_get_saturation(ov, &x);
|
sensor_get_saturation(ov, &x);
|
||||||
return sprintf(buf, "%d\n", x >> 8);
|
return sprintf(buf, "%d\n", x >> 8);
|
||||||
}
|
}
|
||||||
static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL);
|
static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL);
|
||||||
|
|
||||||
static ssize_t show_contrast(struct class_device *cd, char *buf)
|
static ssize_t show_contrast(struct class_device *cd, char *buf)
|
||||||
@ -5621,7 +5621,7 @@ static ssize_t show_contrast(struct class_device *cd, char *buf)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
sensor_get_contrast(ov, &x);
|
sensor_get_contrast(ov, &x);
|
||||||
return sprintf(buf, "%d\n", x >> 8);
|
return sprintf(buf, "%d\n", x >> 8);
|
||||||
}
|
}
|
||||||
static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL);
|
static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL);
|
||||||
|
|
||||||
static ssize_t show_hue(struct class_device *cd, char *buf)
|
static ssize_t show_hue(struct class_device *cd, char *buf)
|
||||||
@ -5633,7 +5633,7 @@ static ssize_t show_hue(struct class_device *cd, char *buf)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
sensor_get_hue(ov, &x);
|
sensor_get_hue(ov, &x);
|
||||||
return sprintf(buf, "%d\n", x >> 8);
|
return sprintf(buf, "%d\n", x >> 8);
|
||||||
}
|
}
|
||||||
static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL);
|
static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL);
|
||||||
|
|
||||||
static ssize_t show_exposure(struct class_device *cd, char *buf)
|
static ssize_t show_exposure(struct class_device *cd, char *buf)
|
||||||
@ -5645,7 +5645,7 @@ static ssize_t show_exposure(struct class_device *cd, char *buf)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
sensor_get_exposure(ov, &exp);
|
sensor_get_exposure(ov, &exp);
|
||||||
return sprintf(buf, "%d\n", exp >> 8);
|
return sprintf(buf, "%d\n", exp >> 8);
|
||||||
}
|
}
|
||||||
static CLASS_DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL);
|
static CLASS_DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL);
|
||||||
|
|
||||||
static void ov_create_sysfs(struct video_device *vdev)
|
static void ov_create_sysfs(struct video_device *vdev)
|
||||||
|
@ -130,7 +130,7 @@
|
|||||||
#define R511_COMP_QVY 0x76
|
#define R511_COMP_QVY 0x76
|
||||||
#define R511_COMP_QVUV 0x77
|
#define R511_COMP_QVUV 0x77
|
||||||
#define R511_COMP_EN 0x78
|
#define R511_COMP_EN 0x78
|
||||||
#define R511_COMP_LUT_EN 0x79
|
#define R511_COMP_LUT_EN 0x79
|
||||||
#define R511_COMP_LUT_BEGIN 0x80
|
#define R511_COMP_LUT_BEGIN 0x80
|
||||||
|
|
||||||
/* --------------------------------- */
|
/* --------------------------------- */
|
||||||
@ -459,14 +459,14 @@ struct usb_ov511 {
|
|||||||
int subh; /* Pix Array subcapture height */
|
int subh; /* Pix Array subcapture height */
|
||||||
|
|
||||||
int curframe; /* Current receiving sbuf */
|
int curframe; /* Current receiving sbuf */
|
||||||
struct ov511_frame frame[OV511_NUMFRAMES];
|
struct ov511_frame frame[OV511_NUMFRAMES];
|
||||||
|
|
||||||
struct ov511_sbuf sbuf[OV511_NUMSBUF];
|
struct ov511_sbuf sbuf[OV511_NUMSBUF];
|
||||||
|
|
||||||
wait_queue_head_t wq; /* Processes waiting */
|
wait_queue_head_t wq; /* Processes waiting */
|
||||||
|
|
||||||
int snap_enabled; /* Snapshot mode enabled */
|
int snap_enabled; /* Snapshot mode enabled */
|
||||||
|
|
||||||
int bridge; /* Type of bridge (BRG_*) */
|
int bridge; /* Type of bridge (BRG_*) */
|
||||||
int bclass; /* Class of bridge (BCL_*) */
|
int bclass; /* Class of bridge (BCL_*) */
|
||||||
int sensor; /* Type of image sensor chip (SEN_*) */
|
int sensor; /* Type of image sensor chip (SEN_*) */
|
||||||
@ -512,7 +512,7 @@ struct symbolic_list {
|
|||||||
/* Returns the name of the matching element in the symbolic_list array. The
|
/* Returns the name of the matching element in the symbolic_list array. The
|
||||||
* end of the list must be marked with an element that has a NULL name.
|
* end of the list must be marked with an element that has a NULL name.
|
||||||
*/
|
*/
|
||||||
static inline char *
|
static inline char *
|
||||||
symbolic(struct symbolic_list list[], int num)
|
symbolic(struct symbolic_list list[], int num)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ovcamchip-objs := ovcamchip_core.o ov6x20.o ov6x30.o ov7x10.o ov7x20.o \
|
ovcamchip-objs := ovcamchip_core.o ov6x20.o ov6x30.o ov7x10.o ov7x20.o \
|
||||||
ov76be.o
|
ov76be.o
|
||||||
|
|
||||||
obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip.o
|
obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip.o
|
||||||
|
@ -266,17 +266,17 @@ static int ovcamchip_detect(struct i2c_client *c)
|
|||||||
PDEBUG(3, "Testing for 0V6xx0");
|
PDEBUG(3, "Testing for 0V6xx0");
|
||||||
c->addr = OV6xx0_SID;
|
c->addr = OV6xx0_SID;
|
||||||
if (init_camchip(c) < 0) {
|
if (init_camchip(c) < 0) {
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
} else {
|
} else {
|
||||||
if (ov6xx0_detect(c) < 0) {
|
if (ov6xx0_detect(c) < 0) {
|
||||||
PERROR("Failed to init OV6xx0");
|
PERROR("Failed to init OV6xx0");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ov7xx0_detect(c) < 0) {
|
if (ov7xx0_detect(c) < 0) {
|
||||||
PERROR("Failed to init OV7xx0");
|
PERROR("Failed to init OV7xx0");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,6 +82,6 @@ extern int ov_write_regvals(struct i2c_client *c,
|
|||||||
struct ovcamchip_regvals *rvals);
|
struct ovcamchip_regvals *rvals);
|
||||||
|
|
||||||
extern int ov_write_mask(struct i2c_client *c, unsigned char reg,
|
extern int ov_write_mask(struct i2c_client *c, unsigned char reg,
|
||||||
unsigned char value, unsigned char mask);
|
unsigned char value, unsigned char mask);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
planb - PlanB frame grabber driver
|
planb - PlanB frame grabber driver
|
||||||
|
|
||||||
PlanB is used in the 7x00/8x00 series of PowerMacintosh
|
PlanB is used in the 7x00/8x00 series of PowerMacintosh
|
||||||
@ -584,7 +584,7 @@ finish:
|
|||||||
wake_up_interruptible(&pb->suspendq);
|
wake_up_interruptible(&pb->suspendq);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_clip(struct planb *pb, struct video_clip *clip)
|
static void add_clip(struct planb *pb, struct video_clip *clip)
|
||||||
{
|
{
|
||||||
volatile unsigned char *base;
|
volatile unsigned char *base;
|
||||||
int xc = clip->x, yc = clip->y;
|
int xc = clip->x, yc = clip->y;
|
||||||
@ -758,7 +758,7 @@ static void cmd_buff(struct planb *pb)
|
|||||||
PLANB_SET(CH_SYNC));
|
PLANB_SET(CH_SYNC));
|
||||||
tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
|
tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
|
||||||
PLANB_SET(DMA_ABORT));
|
PLANB_SET(DMA_ABORT));
|
||||||
|
|
||||||
/* odd field data: */
|
/* odd field data: */
|
||||||
jump = virt_to_bus(c1 + nlines / 2);
|
jump = virt_to_bus(c1 + nlines / 2);
|
||||||
for (i=1; i < nlines; i += stepsize, c1++)
|
for (i=1; i < nlines; i += stepsize, c1++)
|
||||||
@ -1247,7 +1247,7 @@ static volatile struct dbdma_cmd *setup_grab_cmd(int fr, struct planb *pb)
|
|||||||
tab_cmd_dbdma(c1, DBDMA_NOP | BR_IFCLR, virt_to_bus(c1-3)); c1++;
|
tab_cmd_dbdma(c1, DBDMA_NOP | BR_IFCLR, virt_to_bus(c1-3)); c1++;
|
||||||
tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
|
tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
|
||||||
PLANB_SET(DMA_ABORT));
|
PLANB_SET(DMA_ABORT));
|
||||||
|
|
||||||
/* odd field data: */
|
/* odd field data: */
|
||||||
jump_addr = c1 + TAB_FACTOR * nlines / 2;
|
jump_addr = c1 + TAB_FACTOR * nlines / 2;
|
||||||
jump = virt_to_bus(jump_addr);
|
jump = virt_to_bus(jump_addr);
|
||||||
@ -1383,7 +1383,7 @@ static int planb_open(struct video_device *dev, int mode)
|
|||||||
pb->user++;
|
pb->user++;
|
||||||
|
|
||||||
DEBUG("PlanB: device opened\n");
|
DEBUG("PlanB: device opened\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void planb_close(struct video_device *dev)
|
static void planb_close(struct video_device *dev)
|
||||||
@ -1424,9 +1424,9 @@ static long planb_write(struct video_device *v, const char *buf,
|
|||||||
static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
|
static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
|
||||||
{
|
{
|
||||||
struct planb *pb=(struct planb *)dev;
|
struct planb *pb=(struct planb *)dev;
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case VIDIOCGCAP:
|
case VIDIOCGCAP:
|
||||||
{
|
{
|
||||||
struct video_capability b;
|
struct video_capability b;
|
||||||
@ -1440,26 +1440,26 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
|
|||||||
b.channels = 2; /* composite & svhs */
|
b.channels = 2; /* composite & svhs */
|
||||||
b.audios = 0;
|
b.audios = 0;
|
||||||
b.maxwidth = PLANB_MAXPIXELS;
|
b.maxwidth = PLANB_MAXPIXELS;
|
||||||
b.maxheight = PLANB_MAXLINES;
|
b.maxheight = PLANB_MAXLINES;
|
||||||
b.minwidth = 32; /* wild guess */
|
b.minwidth = 32; /* wild guess */
|
||||||
b.minheight = 32;
|
b.minheight = 32;
|
||||||
if (copy_to_user(arg,&b,sizeof(b)))
|
if (copy_to_user(arg,&b,sizeof(b)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCSFBUF:
|
case VIDIOCSFBUF:
|
||||||
{
|
{
|
||||||
struct video_buffer v;
|
struct video_buffer v;
|
||||||
unsigned short bpp;
|
unsigned short bpp;
|
||||||
unsigned int fmt;
|
unsigned int fmt;
|
||||||
|
|
||||||
DEBUG("PlanB: IOCTL VIDIOCSFBUF\n");
|
DEBUG("PlanB: IOCTL VIDIOCSFBUF\n");
|
||||||
|
|
||||||
if (!capable(CAP_SYS_ADMIN)
|
if (!capable(CAP_SYS_ADMIN)
|
||||||
|| !capable(CAP_SYS_RAWIO))
|
|| !capable(CAP_SYS_RAWIO))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
if (copy_from_user(&v, arg,sizeof(v)))
|
if (copy_from_user(&v, arg,sizeof(v)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
planb_lock(pb);
|
planb_lock(pb);
|
||||||
switch(v.depth) {
|
switch(v.depth) {
|
||||||
case 8:
|
case 8:
|
||||||
@ -1478,7 +1478,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
planb_unlock(pb);
|
planb_unlock(pb);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (bpp * v.width > v.bytesperline) {
|
if (bpp * v.width > v.bytesperline) {
|
||||||
planb_unlock(pb);
|
planb_unlock(pb);
|
||||||
@ -1493,7 +1493,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
|
|||||||
pb->win.bpl = pb->win.bpp * pb->win.swidth;
|
pb->win.bpl = pb->win.bpp * pb->win.swidth;
|
||||||
pb->win.pad = v.bytesperline - pb->win.bpl;
|
pb->win.pad = v.bytesperline - pb->win.bpl;
|
||||||
|
|
||||||
DEBUG("PlanB: Display at %p is %d by %d, bytedepth %d,"
|
DEBUG("PlanB: Display at %p is %d by %d, bytedepth %d,"
|
||||||
" bpl %d (+ %d)\n", v.base, v.width,v.height,
|
" bpl %d (+ %d)\n", v.base, v.width,v.height,
|
||||||
pb->win.bpp, pb->win.bpl, pb->win.pad);
|
pb->win.bpp, pb->win.bpl, pb->win.pad);
|
||||||
|
|
||||||
@ -1504,11 +1504,11 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
|
|||||||
resume_overlay(pb);
|
resume_overlay(pb);
|
||||||
}
|
}
|
||||||
planb_unlock(pb);
|
planb_unlock(pb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCGFBUF:
|
case VIDIOCGFBUF:
|
||||||
{
|
{
|
||||||
struct video_buffer v;
|
struct video_buffer v;
|
||||||
|
|
||||||
DEBUG("PlanB: IOCTL VIDIOCGFBUF\n");
|
DEBUG("PlanB: IOCTL VIDIOCGFBUF\n");
|
||||||
|
|
||||||
@ -1518,15 +1518,15 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
|
|||||||
v.depth = pb->win.depth;
|
v.depth = pb->win.depth;
|
||||||
v.bytesperline = pb->win.bpl + pb->win.pad;
|
v.bytesperline = pb->win.bpl + pb->win.pad;
|
||||||
if (copy_to_user(arg, &v, sizeof(v)))
|
if (copy_to_user(arg, &v, sizeof(v)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCCAPTURE:
|
case VIDIOCCAPTURE:
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(copy_from_user(&i, arg, sizeof(i)))
|
if(copy_from_user(&i, arg, sizeof(i)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
if(i==0) {
|
if(i==0) {
|
||||||
DEBUG("PlanB: IOCTL VIDIOCCAPTURE Stop\n");
|
DEBUG("PlanB: IOCTL VIDIOCCAPTURE Stop\n");
|
||||||
|
|
||||||
@ -1695,7 +1695,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
|
|||||||
struct video_window vw;
|
struct video_window vw;
|
||||||
struct video_clip clip;
|
struct video_clip clip;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
DEBUG("PlanB: IOCTL VIDIOCSWIN\n");
|
DEBUG("PlanB: IOCTL VIDIOCSWIN\n");
|
||||||
|
|
||||||
if(copy_from_user(&vw,arg,sizeof(vw)))
|
if(copy_from_user(&vw,arg,sizeof(vw)))
|
||||||
@ -1749,7 +1749,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
|
|||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCSYNC: {
|
case VIDIOCSYNC: {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
IDEBUG("PlanB: IOCTL VIDIOCSYNC\n");
|
IDEBUG("PlanB: IOCTL VIDIOCSYNC\n");
|
||||||
@ -1759,42 +1759,42 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
|
|||||||
|
|
||||||
IDEBUG("PlanB: sync to frame %d\n", i);
|
IDEBUG("PlanB: sync to frame %d\n", i);
|
||||||
|
|
||||||
if(i > (MAX_GBUFFERS - 1) || i < 0)
|
if(i > (MAX_GBUFFERS - 1) || i < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
chk_grab:
|
chk_grab:
|
||||||
switch (pb->frame_stat[i]) {
|
switch (pb->frame_stat[i]) {
|
||||||
case GBUFFER_UNUSED:
|
case GBUFFER_UNUSED:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
case GBUFFER_GRABBING:
|
case GBUFFER_GRABBING:
|
||||||
IDEBUG("PlanB: waiting for grab"
|
IDEBUG("PlanB: waiting for grab"
|
||||||
" done (%d)\n", i);
|
" done (%d)\n", i);
|
||||||
interruptible_sleep_on(&pb->capq);
|
interruptible_sleep_on(&pb->capq);
|
||||||
if(signal_pending(current))
|
if(signal_pending(current))
|
||||||
return -EINTR;
|
return -EINTR;
|
||||||
goto chk_grab;
|
goto chk_grab;
|
||||||
case GBUFFER_DONE:
|
case GBUFFER_DONE:
|
||||||
pb->frame_stat[i] = GBUFFER_UNUSED;
|
pb->frame_stat[i] = GBUFFER_UNUSED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCMCAPTURE:
|
case VIDIOCMCAPTURE:
|
||||||
{
|
{
|
||||||
struct video_mmap vm;
|
struct video_mmap vm;
|
||||||
volatile unsigned int status;
|
volatile unsigned int status;
|
||||||
|
|
||||||
IDEBUG("PlanB: IOCTL VIDIOCMCAPTURE\n");
|
IDEBUG("PlanB: IOCTL VIDIOCMCAPTURE\n");
|
||||||
|
|
||||||
if(copy_from_user((void *) &vm,(void *)arg,sizeof(vm)))
|
if(copy_from_user((void *) &vm,(void *)arg,sizeof(vm)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
status = pb->frame_stat[vm.frame];
|
status = pb->frame_stat[vm.frame];
|
||||||
if (status != GBUFFER_UNUSED)
|
if (status != GBUFFER_UNUSED)
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
return vgrab(pb, &vm);
|
return vgrab(pb, &vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCGMBUF:
|
case VIDIOCGMBUF:
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -1811,7 +1811,7 @@ chk_grab:
|
|||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PLANBIOCGSAAREGS:
|
case PLANBIOCGSAAREGS:
|
||||||
{
|
{
|
||||||
struct planb_saa_regs preg;
|
struct planb_saa_regs preg;
|
||||||
@ -1828,7 +1828,7 @@ chk_grab:
|
|||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PLANBIOCSSAAREGS:
|
case PLANBIOCSSAAREGS:
|
||||||
{
|
{
|
||||||
struct planb_saa_regs preg;
|
struct planb_saa_regs preg;
|
||||||
@ -1842,7 +1842,7 @@ chk_grab:
|
|||||||
saa_set (preg.addr, preg.val, pb);
|
saa_set (preg.addr, preg.val, pb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PLANBIOCGSTAT:
|
case PLANBIOCGSTAT:
|
||||||
{
|
{
|
||||||
struct planb_stat_regs pstat;
|
struct planb_stat_regs pstat;
|
||||||
@ -1859,7 +1859,7 @@ chk_grab:
|
|||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PLANBIOCSMODE: {
|
case PLANBIOCSMODE: {
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
@ -1985,10 +1985,10 @@ static int planb_mmap(struct vm_area_struct *vma, struct video_device *dev, cons
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct planb *pb = (struct planb *)dev;
|
struct planb *pb = (struct planb *)dev;
|
||||||
unsigned long start = (unsigned long)adr;
|
unsigned long start = (unsigned long)adr;
|
||||||
|
|
||||||
if (size > MAX_GBUFFERS * PLANB_MAX_FBUF)
|
if (size > MAX_GBUFFERS * PLANB_MAX_FBUF)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (!pb->rawbuf) {
|
if (!pb->rawbuf) {
|
||||||
int err;
|
int err;
|
||||||
if((err=grabbuf_alloc(pb)))
|
if((err=grabbuf_alloc(pb)))
|
||||||
@ -2091,10 +2091,10 @@ static int init_planb(struct planb *pb)
|
|||||||
/* clear interrupt mask */
|
/* clear interrupt mask */
|
||||||
pb->intr_mask = PLANB_CLR_IRQ;
|
pb->intr_mask = PLANB_CLR_IRQ;
|
||||||
|
|
||||||
result = request_irq(pb->irq, planb_irq, 0, "PlanB", (void *)pb);
|
result = request_irq(pb->irq, planb_irq, 0, "PlanB", (void *)pb);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
if (result==-EINVAL)
|
if (result==-EINVAL)
|
||||||
printk(KERN_ERR "PlanB: Bad irq number (%d) "
|
printk(KERN_ERR "PlanB: Bad irq number (%d) "
|
||||||
"or handler\n", (int)pb->irq);
|
"or handler\n", (int)pb->irq);
|
||||||
else if (result==-EBUSY)
|
else if (result==-EBUSY)
|
||||||
printk(KERN_ERR "PlanB: I don't know why, "
|
printk(KERN_ERR "PlanB: I don't know why, "
|
||||||
@ -2102,7 +2102,7 @@ static int init_planb(struct planb *pb)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
disable_irq(pb->irq);
|
disable_irq(pb->irq);
|
||||||
|
|
||||||
/* Now add the template and register the device unit. */
|
/* Now add the template and register the device unit. */
|
||||||
memcpy(&pb->video_dev,&planb_template,sizeof(planb_template));
|
memcpy(&pb->video_dev,&planb_template,sizeof(planb_template));
|
||||||
|
|
||||||
@ -2143,7 +2143,7 @@ static int init_planb(struct planb *pb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan for a PlanB controller, request the irq and map the io memory
|
* Scan for a PlanB controller, request the irq and map the io memory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int find_planb(void)
|
static int find_planb(void)
|
||||||
@ -2171,9 +2171,9 @@ static int find_planb(void)
|
|||||||
pb = &planbs[0];
|
pb = &planbs[0];
|
||||||
planb_num = 1;
|
planb_num = 1;
|
||||||
|
|
||||||
if (planb_devices->n_addrs != 1) {
|
if (planb_devices->n_addrs != 1) {
|
||||||
printk (KERN_WARNING "PlanB: expecting 1 address for planb "
|
printk (KERN_WARNING "PlanB: expecting 1 address for planb "
|
||||||
"(got %d)", planb_devices->n_addrs);
|
"(got %d)", planb_devices->n_addrs);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2236,7 +2236,7 @@ static int find_planb(void)
|
|||||||
pb->planb_base = planb_regs;
|
pb->planb_base = planb_regs;
|
||||||
pb->planb_base_phys = (struct planb_registers *)new_base;
|
pb->planb_base_phys = (struct planb_registers *)new_base;
|
||||||
pb->irq = irq;
|
pb->irq = irq;
|
||||||
|
|
||||||
return planb_num;
|
return planb_num;
|
||||||
|
|
||||||
err_out_disable:
|
err_out_disable:
|
||||||
@ -2251,7 +2251,7 @@ static void release_planb(void)
|
|||||||
int i;
|
int i;
|
||||||
struct planb *pb;
|
struct planb *pb;
|
||||||
|
|
||||||
for (i=0;i<planb_num; i++)
|
for (i=0;i<planb_num; i++)
|
||||||
{
|
{
|
||||||
pb=&planbs[i];
|
pb=&planbs[i];
|
||||||
|
|
||||||
@ -2278,7 +2278,7 @@ static void release_planb(void)
|
|||||||
static int __init init_planbs(void)
|
static int __init init_planbs(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (find_planb()<=0)
|
if (find_planb()<=0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
@ -2288,9 +2288,9 @@ static int __init init_planbs(void)
|
|||||||
" with v4l\n", i);
|
" with v4l\n", i);
|
||||||
release_planb();
|
release_planb();
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
printk(KERN_INFO "PlanB: registered device %d with v4l\n", i);
|
printk(KERN_INFO "PlanB: registered device %d with v4l\n", i);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
planb - PlanB frame grabber driver
|
planb - PlanB frame grabber driver
|
||||||
|
|
||||||
PlanB is used in the 7x00/8x00 series of PowerMacintosh
|
PlanB is used in the 7x00/8x00 series of PowerMacintosh
|
||||||
@ -167,7 +167,7 @@ struct planb {
|
|||||||
struct video_device video_dev;
|
struct video_device video_dev;
|
||||||
struct video_picture picture; /* Current picture params */
|
struct video_picture picture; /* Current picture params */
|
||||||
struct video_audio audio_dev; /* Current audio params */
|
struct video_audio audio_dev; /* Current audio params */
|
||||||
|
|
||||||
volatile struct planb_registers *planb_base; /* virt base of planb */
|
volatile struct planb_registers *planb_base; /* virt base of planb */
|
||||||
struct planb_registers *planb_base_phys; /* phys base of planb */
|
struct planb_registers *planb_base_phys; /* phys base of planb */
|
||||||
void *priv_space; /* Org. alloc. mem for kfree */
|
void *priv_space; /* Org. alloc. mem for kfree */
|
||||||
@ -209,7 +209,7 @@ struct planb {
|
|||||||
int gwidth[MAX_GBUFFERS], gheight[MAX_GBUFFERS];
|
int gwidth[MAX_GBUFFERS], gheight[MAX_GBUFFERS];
|
||||||
unsigned int gfmt[MAX_GBUFFERS];
|
unsigned int gfmt[MAX_GBUFFERS];
|
||||||
int gnorm_switch[MAX_GBUFFERS];
|
int gnorm_switch[MAX_GBUFFERS];
|
||||||
volatile unsigned int *frame_stat;
|
volatile unsigned int *frame_stat;
|
||||||
#define GBUFFER_UNUSED 0x00U
|
#define GBUFFER_UNUSED 0x00U
|
||||||
#define GBUFFER_GRABBING 0x01U
|
#define GBUFFER_GRABBING 0x01U
|
||||||
#define GBUFFER_DONE 0x02U
|
#define GBUFFER_DONE 0x02U
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
* Most of this code is directly derived from his userspace driver.
|
* Most of this code is directly derived from his userspace driver.
|
||||||
* His driver works so send any reports to alan@redhat.com unless the
|
* His driver works so send any reports to alan@redhat.com unless the
|
||||||
* userspace driver also doesn't work for you...
|
* userspace driver also doesn't work for you...
|
||||||
*
|
*
|
||||||
* Changes:
|
* Changes:
|
||||||
* 08/07/2003 Daniele Bellucci <bellucda@tiscali.it>
|
* 08/07/2003 Daniele Bellucci <bellucda@tiscali.it>
|
||||||
* - pms_capture: report back -EFAULT
|
* - pms_capture: report back -EFAULT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
@ -66,14 +66,14 @@ static int standard = 0; /* 0 - auto 1 - ntsc 2 - pal 3 - secam */
|
|||||||
/*
|
/*
|
||||||
* I/O ports and Shared Memory
|
* I/O ports and Shared Memory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int io_port = 0x250;
|
static int io_port = 0x250;
|
||||||
static int data_port = 0x251;
|
static int data_port = 0x251;
|
||||||
static int mem_base = 0xC8000;
|
static int mem_base = 0xC8000;
|
||||||
static void __iomem *mem;
|
static void __iomem *mem;
|
||||||
static int video_nr = -1;
|
static int video_nr = -1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static inline void mvv_write(u8 index, u8 value)
|
static inline void mvv_write(u8 index, u8 value)
|
||||||
{
|
{
|
||||||
@ -90,9 +90,9 @@ static int pms_i2c_stat(u8 slave)
|
|||||||
{
|
{
|
||||||
int counter;
|
int counter;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
outb(0x28, io_port);
|
outb(0x28, io_port);
|
||||||
|
|
||||||
counter=0;
|
counter=0;
|
||||||
while((inb(data_port)&0x01)==0)
|
while((inb(data_port)&0x01)==0)
|
||||||
if(counter++==256)
|
if(counter++==256)
|
||||||
@ -101,9 +101,9 @@ static int pms_i2c_stat(u8 slave)
|
|||||||
while((inb(data_port)&0x01)!=0)
|
while((inb(data_port)&0x01)!=0)
|
||||||
if(counter++==256)
|
if(counter++==256)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
outb(slave, io_port);
|
outb(slave, io_port);
|
||||||
|
|
||||||
counter=0;
|
counter=0;
|
||||||
while((inb(data_port)&0x01)==0)
|
while((inb(data_port)&0x01)==0)
|
||||||
if(counter++==256)
|
if(counter++==256)
|
||||||
@ -112,7 +112,7 @@ static int pms_i2c_stat(u8 slave)
|
|||||||
while((inb(data_port)&0x01)!=0)
|
while((inb(data_port)&0x01)!=0)
|
||||||
if(counter++==256)
|
if(counter++==256)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for(i=0;i<12;i++)
|
for(i=0;i<12;i++)
|
||||||
{
|
{
|
||||||
char st=inb(data_port);
|
char st=inb(data_port);
|
||||||
@ -122,7 +122,7 @@ static int pms_i2c_stat(u8 slave)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
outb(0x29, io_port);
|
outb(0x29, io_port);
|
||||||
return inb(data_port);
|
return inb(data_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pms_i2c_write(u16 slave, u16 sub, u16 data)
|
static int pms_i2c_write(u16 slave, u16 sub, u16 data)
|
||||||
@ -130,19 +130,19 @@ static int pms_i2c_write(u16 slave, u16 sub, u16 data)
|
|||||||
int skip=0;
|
int skip=0;
|
||||||
int count;
|
int count;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0;i<i2c_count;i++)
|
for(i=0;i<i2c_count;i++)
|
||||||
{
|
{
|
||||||
if((i2cinfo[i].slave==slave) &&
|
if((i2cinfo[i].slave==slave) &&
|
||||||
(i2cinfo[i].sub == sub))
|
(i2cinfo[i].sub == sub))
|
||||||
{
|
{
|
||||||
if(i2cinfo[i].data==data)
|
if(i2cinfo[i].data==data)
|
||||||
skip=1;
|
skip=1;
|
||||||
i2cinfo[i].data=data;
|
i2cinfo[i].data=data;
|
||||||
i=i2c_count+1;
|
i=i2c_count+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i==i2c_count && i2c_count<64)
|
if(i==i2c_count && i2c_count<64)
|
||||||
{
|
{
|
||||||
i2cinfo[i2c_count].slave=slave;
|
i2cinfo[i2c_count].slave=slave;
|
||||||
@ -150,16 +150,16 @@ static int pms_i2c_write(u16 slave, u16 sub, u16 data)
|
|||||||
i2cinfo[i2c_count].data=data;
|
i2cinfo[i2c_count].data=data;
|
||||||
i2c_count++;
|
i2c_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(skip)
|
if(skip)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
mvv_write(0x29, sub);
|
mvv_write(0x29, sub);
|
||||||
mvv_write(0x2A, data);
|
mvv_write(0x2A, data);
|
||||||
mvv_write(0x28, slave);
|
mvv_write(0x28, slave);
|
||||||
|
|
||||||
outb(0x28, io_port);
|
outb(0x28, io_port);
|
||||||
|
|
||||||
count=0;
|
count=0;
|
||||||
while((inb(data_port)&1)==0)
|
while((inb(data_port)&1)==0)
|
||||||
if(count>255)
|
if(count>255)
|
||||||
@ -167,9 +167,9 @@ static int pms_i2c_write(u16 slave, u16 sub, u16 data)
|
|||||||
while((inb(data_port)&1)!=0)
|
while((inb(data_port)&1)!=0)
|
||||||
if(count>255)
|
if(count>255)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
count=inb(data_port);
|
count=inb(data_port);
|
||||||
|
|
||||||
if(count&2)
|
if(count&2)
|
||||||
return -1;
|
return -1;
|
||||||
return count;
|
return count;
|
||||||
@ -189,8 +189,8 @@ static int pms_i2c_read(int slave, int sub)
|
|||||||
|
|
||||||
static void pms_i2c_andor(int slave, int sub, int and, int or)
|
static void pms_i2c_andor(int slave, int sub, int and, int or)
|
||||||
{
|
{
|
||||||
u8 tmp;
|
u8 tmp;
|
||||||
|
|
||||||
tmp=pms_i2c_read(slave, sub);
|
tmp=pms_i2c_read(slave, sub);
|
||||||
tmp = (tmp&and)|or;
|
tmp = (tmp&and)|or;
|
||||||
pms_i2c_write(slave, sub, tmp);
|
pms_i2c_write(slave, sub, tmp);
|
||||||
@ -199,7 +199,7 @@ static void pms_i2c_andor(int slave, int sub, int and, int or)
|
|||||||
/*
|
/*
|
||||||
* Control functions
|
* Control functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
static void pms_videosource(short source)
|
static void pms_videosource(short source)
|
||||||
{
|
{
|
||||||
@ -234,8 +234,8 @@ static void pms_colour(short colour)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void pms_contrast(short contrast)
|
static void pms_contrast(short contrast)
|
||||||
{
|
{
|
||||||
switch(decoder)
|
switch(decoder)
|
||||||
@ -269,14 +269,14 @@ static void pms_format(short format)
|
|||||||
{
|
{
|
||||||
int target;
|
int target;
|
||||||
standard = format;
|
standard = format;
|
||||||
|
|
||||||
if(decoder==PHILIPS1)
|
if(decoder==PHILIPS1)
|
||||||
target=0x42;
|
target=0x42;
|
||||||
else if(decoder==PHILIPS2)
|
else if(decoder==PHILIPS2)
|
||||||
target=0x8A;
|
target=0x8A;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch(format)
|
switch(format)
|
||||||
{
|
{
|
||||||
case 0: /* Auto */
|
case 0: /* Auto */
|
||||||
@ -302,7 +302,7 @@ static void pms_format(short format)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* These features of the PMS card are not currently exposes. They
|
* These features of the PMS card are not currently exposes. They
|
||||||
* could become a private v4l ioctl for PMSCONFIG or somesuch if
|
* could become a private v4l ioctl for PMSCONFIG or somesuch if
|
||||||
* people need it. We also don't yet use the PMS interrupt.
|
* people need it. We also don't yet use the PMS interrupt.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ static void pms_hstart(short start)
|
|||||||
/*
|
/*
|
||||||
* Bandpass filters
|
* Bandpass filters
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void pms_bandpass(short pass)
|
static void pms_bandpass(short pass)
|
||||||
{
|
{
|
||||||
if(decoder==PHILIPS2)
|
if(decoder==PHILIPS2)
|
||||||
@ -493,7 +493,7 @@ static void pms_vert(u8 deciden, u8 decinum)
|
|||||||
/*
|
/*
|
||||||
* Turn 16bit ratios into best small ratio the chipset can grok
|
* Turn 16bit ratios into best small ratio the chipset can grok
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void pms_vertdeci(unsigned short decinum, unsigned short deciden)
|
static void pms_vertdeci(unsigned short decinum, unsigned short deciden)
|
||||||
{
|
{
|
||||||
/* Knock it down by /5 once */
|
/* Knock it down by /5 once */
|
||||||
@ -546,7 +546,7 @@ static void pms_horzdeci(short decinum, short deciden)
|
|||||||
decinum=512;
|
decinum=512;
|
||||||
deciden=640; /* 768 would be ideal */
|
deciden=640; /* 768 would be ideal */
|
||||||
}
|
}
|
||||||
|
|
||||||
while(((decinum|deciden)&1)==0)
|
while(((decinum|deciden)&1)==0)
|
||||||
{
|
{
|
||||||
decinum>>=1;
|
decinum>>=1;
|
||||||
@ -559,7 +559,7 @@ static void pms_horzdeci(short decinum, short deciden)
|
|||||||
}
|
}
|
||||||
if(deciden==32)
|
if(deciden==32)
|
||||||
deciden--;
|
deciden--;
|
||||||
|
|
||||||
mvv_write(0x24, 0x80|deciden);
|
mvv_write(0x24, 0x80|deciden);
|
||||||
mvv_write(0x25, decinum);
|
mvv_write(0x25, decinum);
|
||||||
}
|
}
|
||||||
@ -567,14 +567,14 @@ static void pms_horzdeci(short decinum, short deciden)
|
|||||||
static void pms_resolution(short width, short height)
|
static void pms_resolution(short width, short height)
|
||||||
{
|
{
|
||||||
int fg_height;
|
int fg_height;
|
||||||
|
|
||||||
fg_height=height;
|
fg_height=height;
|
||||||
if(fg_height>280)
|
if(fg_height>280)
|
||||||
fg_height=280;
|
fg_height=280;
|
||||||
|
|
||||||
mvv_write(0x18, fg_height);
|
mvv_write(0x18, fg_height);
|
||||||
mvv_write(0x19, fg_height>>8);
|
mvv_write(0x19, fg_height>>8);
|
||||||
|
|
||||||
if(standard==1)
|
if(standard==1)
|
||||||
{
|
{
|
||||||
mvv_write(0x1A, 0xFC);
|
mvv_write(0x1A, 0xFC);
|
||||||
@ -598,7 +598,7 @@ static void pms_resolution(short width, short height)
|
|||||||
mvv_write(0x42, 0x00);
|
mvv_write(0x42, 0x00);
|
||||||
mvv_write(0x43, 0x00);
|
mvv_write(0x43, 0x00);
|
||||||
mvv_write(0x44, MVVMEMORYWIDTH);
|
mvv_write(0x44, MVVMEMORYWIDTH);
|
||||||
|
|
||||||
mvv_write(0x22, width+8);
|
mvv_write(0x22, width+8);
|
||||||
mvv_write(0x23, (width+8)>> 8);
|
mvv_write(0x23, (width+8)>> 8);
|
||||||
|
|
||||||
@ -618,7 +618,7 @@ static void pms_resolution(short width, short height)
|
|||||||
/*
|
/*
|
||||||
* Set Input
|
* Set Input
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void pms_vcrinput(short input)
|
static void pms_vcrinput(short input)
|
||||||
{
|
{
|
||||||
if(decoder==PHILIPS2)
|
if(decoder==PHILIPS2)
|
||||||
@ -643,20 +643,20 @@ static int pms_capture(struct pms_device *dev, char __user *buf, int rgb555, int
|
|||||||
mvv_write(0x08,r8); /* capture rgb555/565, init DRAM, PC enable */
|
mvv_write(0x08,r8); /* capture rgb555/565, init DRAM, PC enable */
|
||||||
|
|
||||||
/* printf("%d %d %d %d %d %x %x\n",width,height,voff,nom,den,mvv_buf); */
|
/* printf("%d %d %d %d %d %x %x\n",width,height,voff,nom,den,mvv_buf); */
|
||||||
|
|
||||||
for (y = 0; y < dev->height; y++ )
|
for (y = 0; y < dev->height; y++ )
|
||||||
{
|
{
|
||||||
writeb(0, mem); /* synchronisiert neue Zeile */
|
writeb(0, mem); /* synchronisiert neue Zeile */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is in truth a fifo, be very careful as if you
|
* This is in truth a fifo, be very careful as if you
|
||||||
* forgot this odd things will occur 8)
|
* forgot this odd things will occur 8)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
memcpy_fromio(tmp, mem, dw+32); /* discard 16 word */
|
memcpy_fromio(tmp, mem, dw+32); /* discard 16 word */
|
||||||
cnt -= dev->height;
|
cnt -= dev->height;
|
||||||
while (cnt <= 0)
|
while (cnt <= 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Don't copy too far
|
* Don't copy too far
|
||||||
*/
|
*/
|
||||||
@ -666,7 +666,7 @@ static int pms_capture(struct pms_device *dev, char __user *buf, int rgb555, int
|
|||||||
cnt += dev->height;
|
cnt += dev->height;
|
||||||
if (copy_to_user(buf, tmp+32, dt))
|
if (copy_to_user(buf, tmp+32, dt))
|
||||||
return len ? len : -EFAULT;
|
return len ? len : -EFAULT;
|
||||||
buf += dt;
|
buf += dt;
|
||||||
len += dt;
|
len += dt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -683,7 +683,7 @@ static int pms_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
{
|
{
|
||||||
struct video_device *dev = video_devdata(file);
|
struct video_device *dev = video_devdata(file);
|
||||||
struct pms_device *pd=(struct pms_device *)dev;
|
struct pms_device *pd=(struct pms_device *)dev;
|
||||||
|
|
||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
case VIDIOCGCAP:
|
case VIDIOCGCAP:
|
||||||
@ -806,7 +806,7 @@ static int pms_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
||(p->palette==VIDEO_PALETTE_RGB555 && p->depth==15)))
|
||(p->palette==VIDEO_PALETTE_RGB555 && p->depth==15)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
pd->picture= *p;
|
pd->picture= *p;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now load the card.
|
* Now load the card.
|
||||||
*/
|
*/
|
||||||
@ -815,7 +815,7 @@ static int pms_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
pms_brightness(p->brightness>>8);
|
pms_brightness(p->brightness>>8);
|
||||||
pms_hue(p->hue>>8);
|
pms_hue(p->hue>>8);
|
||||||
pms_colour(p->colour>>8);
|
pms_colour(p->colour>>8);
|
||||||
pms_contrast(p->contrast>>8);
|
pms_contrast(p->contrast>>8);
|
||||||
mutex_unlock(&pd->lock);
|
mutex_unlock(&pd->lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -873,7 +873,7 @@ static ssize_t pms_read(struct file *file, char __user *buf,
|
|||||||
struct video_device *v = video_devdata(file);
|
struct video_device *v = video_devdata(file);
|
||||||
struct pms_device *pd=(struct pms_device *)v;
|
struct pms_device *pd=(struct pms_device *)v;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
mutex_lock(&pd->lock);
|
mutex_lock(&pd->lock);
|
||||||
len=pms_capture(pd, buf, (pd->picture.depth==16)?0:1,count);
|
len=pms_capture(pd, buf, (pd->picture.depth==16)?0:1,count);
|
||||||
mutex_unlock(&pd->lock);
|
mutex_unlock(&pd->lock);
|
||||||
@ -905,13 +905,13 @@ static struct pms_device pms_device;
|
|||||||
/*
|
/*
|
||||||
* Probe for and initialise the Mediavision PMS
|
* Probe for and initialise the Mediavision PMS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int init_mediavision(void)
|
static int init_mediavision(void)
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
int idec, decst;
|
int idec, decst;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
unsigned char i2c_defs[]={
|
unsigned char i2c_defs[]={
|
||||||
0x4C,0x30,0x00,0xE8,
|
0x4C,0x30,0x00,0xE8,
|
||||||
0xB6,0xE2,0x00,0x00,
|
0xB6,0xE2,0x00,0x00,
|
||||||
@ -925,7 +925,7 @@ static int init_mediavision(void)
|
|||||||
mem = ioremap(mem_base, 0x800);
|
mem = ioremap(mem_base, 0x800);
|
||||||
if (!mem)
|
if (!mem)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
if (!request_region(0x9A01, 1, "Mediavision PMS config"))
|
if (!request_region(0x9A01, 1, "Mediavision PMS config"))
|
||||||
{
|
{
|
||||||
printk(KERN_WARNING "mediavision: unable to detect: 0x9A01 in use.\n");
|
printk(KERN_WARNING "mediavision: unable to detect: 0x9A01 in use.\n");
|
||||||
@ -941,18 +941,18 @@ static int init_mediavision(void)
|
|||||||
}
|
}
|
||||||
outb(0xB8, 0x9A01); /* Unlock */
|
outb(0xB8, 0x9A01); /* Unlock */
|
||||||
outb(io_port>>4, 0x9A01); /* Set IO port */
|
outb(io_port>>4, 0x9A01); /* Set IO port */
|
||||||
|
|
||||||
|
|
||||||
id=mvv_read(3);
|
id=mvv_read(3);
|
||||||
decst=pms_i2c_stat(0x43);
|
decst=pms_i2c_stat(0x43);
|
||||||
|
|
||||||
if(decst!=-1)
|
if(decst!=-1)
|
||||||
idec=2;
|
idec=2;
|
||||||
else if(pms_i2c_stat(0xb9)!=-1)
|
else if(pms_i2c_stat(0xb9)!=-1)
|
||||||
idec=3;
|
idec=3;
|
||||||
else if(pms_i2c_stat(0x8b)!=-1)
|
else if(pms_i2c_stat(0x8b)!=-1)
|
||||||
idec=1;
|
idec=1;
|
||||||
else
|
else
|
||||||
idec=0;
|
idec=0;
|
||||||
|
|
||||||
printk(KERN_INFO "PMS type is %d\n", idec);
|
printk(KERN_INFO "PMS type is %d\n", idec);
|
||||||
@ -966,11 +966,11 @@ static int init_mediavision(void)
|
|||||||
/*
|
/*
|
||||||
* Ok we have a PMS of some sort
|
* Ok we have a PMS of some sort
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mvv_write(0x04, mem_base>>12); /* Set the memory area */
|
mvv_write(0x04, mem_base>>12); /* Set the memory area */
|
||||||
|
|
||||||
/* Ok now load the defaults */
|
/* Ok now load the defaults */
|
||||||
|
|
||||||
for(i=0;i<0x19;i++)
|
for(i=0;i<0x19;i++)
|
||||||
{
|
{
|
||||||
if(i2c_defs[i]==0xFF)
|
if(i2c_defs[i]==0xFF)
|
||||||
@ -978,7 +978,7 @@ static int init_mediavision(void)
|
|||||||
else
|
else
|
||||||
pms_i2c_write(0x8A, i, i2c_defs[i]);
|
pms_i2c_write(0x8A, i, i2c_defs[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
pms_i2c_write(0xB8,0x00,0x12);
|
pms_i2c_write(0xB8,0x00,0x12);
|
||||||
pms_i2c_write(0xB8,0x04,0x00);
|
pms_i2c_write(0xB8,0x04,0x00);
|
||||||
pms_i2c_write(0xB8,0x07,0x00);
|
pms_i2c_write(0xB8,0x07,0x00);
|
||||||
@ -987,18 +987,18 @@ static int init_mediavision(void)
|
|||||||
pms_i2c_write(0xB8,0x0A,0x00);
|
pms_i2c_write(0xB8,0x0A,0x00);
|
||||||
pms_i2c_write(0xB8,0x0B,0x10);
|
pms_i2c_write(0xB8,0x0B,0x10);
|
||||||
pms_i2c_write(0xB8,0x10,0x03);
|
pms_i2c_write(0xB8,0x10,0x03);
|
||||||
|
|
||||||
mvv_write(0x01, 0x00);
|
mvv_write(0x01, 0x00);
|
||||||
mvv_write(0x05, 0xA0);
|
mvv_write(0x05, 0xA0);
|
||||||
mvv_write(0x08, 0x25);
|
mvv_write(0x08, 0x25);
|
||||||
mvv_write(0x09, 0x00);
|
mvv_write(0x09, 0x00);
|
||||||
mvv_write(0x0A, 0x20|MVVMEMORYWIDTH);
|
mvv_write(0x0A, 0x20|MVVMEMORYWIDTH);
|
||||||
|
|
||||||
mvv_write(0x10, 0x02);
|
mvv_write(0x10, 0x02);
|
||||||
mvv_write(0x1E, 0x0C);
|
mvv_write(0x1E, 0x0C);
|
||||||
mvv_write(0x1F, 0x03);
|
mvv_write(0x1F, 0x03);
|
||||||
mvv_write(0x26, 0x06);
|
mvv_write(0x26, 0x06);
|
||||||
|
|
||||||
mvv_write(0x2B, 0x00);
|
mvv_write(0x2B, 0x00);
|
||||||
mvv_write(0x2C, 0x20);
|
mvv_write(0x2C, 0x20);
|
||||||
mvv_write(0x2D, 0x00);
|
mvv_write(0x2D, 0x00);
|
||||||
@ -1018,13 +1018,13 @@ static int init_mediavision(void)
|
|||||||
/*
|
/*
|
||||||
* Initialization and module stuff
|
* Initialization and module stuff
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int __init init_pms_cards(void)
|
static int __init init_pms_cards(void)
|
||||||
{
|
{
|
||||||
printk(KERN_INFO "Mediavision Pro Movie Studio driver 0.02\n");
|
printk(KERN_INFO "Mediavision Pro Movie Studio driver 0.02\n");
|
||||||
|
|
||||||
data_port = io_port +1;
|
data_port = io_port +1;
|
||||||
|
|
||||||
if(init_mediavision())
|
if(init_mediavision())
|
||||||
{
|
{
|
||||||
printk(KERN_INFO "Board not found.\n");
|
printk(KERN_INFO "Board not found.\n");
|
||||||
|
@ -15,6 +15,6 @@ default:
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.[oas] .*.flags *.ko .*.cmd .*.d .*.tmp *.mod.c
|
rm -f *.[oas] .*.flags *.ko .*.cmd .*.d .*.tmp *.mod.c
|
||||||
rm -rf .tmp_versions
|
rm -rf .tmp_versions
|
||||||
|
|
||||||
|
@ -47,17 +47,17 @@ don't know how to set it properly in the driver. The options are:
|
|||||||
size
|
size
|
||||||
Can be one of 'sqcif', 'qsif', 'qcif', 'sif', 'cif' or
|
Can be one of 'sqcif', 'qsif', 'qcif', 'sif', 'cif' or
|
||||||
'vga', for an image size of resp. 128x96, 160x120, 176x144,
|
'vga', for an image size of resp. 128x96, 160x120, 176x144,
|
||||||
320x240, 352x288 and 640x480 (of course, only for those cameras that
|
320x240, 352x288 and 640x480 (of course, only for those cameras that
|
||||||
support these resolutions).
|
support these resolutions).
|
||||||
|
|
||||||
fps
|
fps
|
||||||
Specifies the desired framerate. Is an integer in the range of 4-30.
|
Specifies the desired framerate. Is an integer in the range of 4-30.
|
||||||
|
|
||||||
fbufs
|
fbufs
|
||||||
This paramter specifies the number of internal buffers to use for storing
|
This paramter specifies the number of internal buffers to use for storing
|
||||||
frames from the cam. This will help if the process that reads images from
|
frames from the cam. This will help if the process that reads images from
|
||||||
the cam is a bit slow or momentarely busy. However, on slow machines it
|
the cam is a bit slow or momentarely busy. However, on slow machines it
|
||||||
only introduces lag, so choose carefully. The default is 3, which is
|
only introduces lag, so choose carefully. The default is 3, which is
|
||||||
reasonable. You can set it between 2 and 5.
|
reasonable. You can set it between 2 and 5.
|
||||||
|
|
||||||
mbufs
|
mbufs
|
||||||
@ -65,9 +65,9 @@ mbufs
|
|||||||
buffers to reserve for mmap(), VIDIOCCGMBUF, VIDIOCMCAPTURE and friends.
|
buffers to reserve for mmap(), VIDIOCCGMBUF, VIDIOCMCAPTURE and friends.
|
||||||
The default is 2, which is adequate for most applications (double
|
The default is 2, which is adequate for most applications (double
|
||||||
buffering).
|
buffering).
|
||||||
|
|
||||||
Should you experience a lot of 'Dumping frame...' messages during
|
Should you experience a lot of 'Dumping frame...' messages during
|
||||||
grabbing with a tool that uses mmap(), you might want to increase if.
|
grabbing with a tool that uses mmap(), you might want to increase if.
|
||||||
However, it doesn't really buffer images, it just gives you a bit more
|
However, it doesn't really buffer images, it just gives you a bit more
|
||||||
slack when your program is behind. But you need a multi-threaded or
|
slack when your program is behind. But you need a multi-threaded or
|
||||||
forked program to really take advantage of these buffers.
|
forked program to really take advantage of these buffers.
|
||||||
@ -88,15 +88,15 @@ power_save
|
|||||||
|
|
||||||
compression (only useful with the plugin)
|
compression (only useful with the plugin)
|
||||||
With this option you can control the compression factor that the camera
|
With this option you can control the compression factor that the camera
|
||||||
uses to squeeze the image through the USB bus. You can set the
|
uses to squeeze the image through the USB bus. You can set the
|
||||||
parameter between 0 and 3:
|
parameter between 0 and 3:
|
||||||
0 = prefer uncompressed images; if the requested mode is not available
|
0 = prefer uncompressed images; if the requested mode is not available
|
||||||
in an uncompressed format, the driver will silently switch to low
|
in an uncompressed format, the driver will silently switch to low
|
||||||
compression.
|
compression.
|
||||||
1 = low compression.
|
1 = low compression.
|
||||||
2 = medium compression.
|
2 = medium compression.
|
||||||
3 = high compression.
|
3 = high compression.
|
||||||
|
|
||||||
High compression takes less bandwidth of course, but it could also
|
High compression takes less bandwidth of course, but it could also
|
||||||
introduce some unwanted artefacts. The default is 2, medium compression.
|
introduce some unwanted artefacts. The default is 2, medium compression.
|
||||||
See the FAQ on the website for an overview of which modes require
|
See the FAQ on the website for an overview of which modes require
|
||||||
@ -112,7 +112,7 @@ leds
|
|||||||
this is let the LED blink while the camera is in use. This:
|
this is let the LED blink while the camera is in use. This:
|
||||||
|
|
||||||
leds=500,500
|
leds=500,500
|
||||||
|
|
||||||
will blink the LED once every second. But with:
|
will blink the LED once every second. But with:
|
||||||
|
|
||||||
leds=0,0
|
leds=0,0
|
||||||
@ -123,7 +123,7 @@ leds
|
|||||||
when the camera is not used anymore.
|
when the camera is not used anymore.
|
||||||
|
|
||||||
This parameter works only with the ToUCam range of cameras (720, 730, 740,
|
This parameter works only with the ToUCam range of cameras (720, 730, 740,
|
||||||
750) and OEMs. For other cameras this command is silently ignored, and
|
750) and OEMs. For other cameras this command is silently ignored, and
|
||||||
the LED cannot be controlled.
|
the LED cannot be controlled.
|
||||||
|
|
||||||
Finally: this parameters does not take effect UNTIL the first time you
|
Finally: this parameters does not take effect UNTIL the first time you
|
||||||
@ -144,35 +144,35 @@ dev_hint
|
|||||||
format:
|
format:
|
||||||
|
|
||||||
[type[.serialnumber]:]node
|
[type[.serialnumber]:]node
|
||||||
|
|
||||||
The square brackets mean that both the type and the serialnumber are
|
The square brackets mean that both the type and the serialnumber are
|
||||||
optional, but a serialnumber cannot be specified without a type (which
|
optional, but a serialnumber cannot be specified without a type (which
|
||||||
would be rather pointless). The serialnumber is separated from the type
|
would be rather pointless). The serialnumber is separated from the type
|
||||||
by a '.'; the node number by a ':'.
|
by a '.'; the node number by a ':'.
|
||||||
|
|
||||||
This somewhat cryptic syntax is best explained by a few examples:
|
This somewhat cryptic syntax is best explained by a few examples:
|
||||||
|
|
||||||
dev_hint=3,5 The first detected cam gets assigned
|
dev_hint=3,5 The first detected cam gets assigned
|
||||||
/dev/video3, the second /dev/video5. Any
|
/dev/video3, the second /dev/video5. Any
|
||||||
other cameras will get the first free
|
other cameras will get the first free
|
||||||
available slot (see below).
|
available slot (see below).
|
||||||
|
|
||||||
dev_hint=645:1,680:2 The PCA645 camera will get /dev/video1,
|
dev_hint=645:1,680:2 The PCA645 camera will get /dev/video1,
|
||||||
and a PCVC680 /dev/video2.
|
and a PCVC680 /dev/video2.
|
||||||
|
|
||||||
dev_hint=645.0123:3,645.4567:0 The PCA645 camera with serialnumber
|
|
||||||
0123 goes to /dev/video3, the same
|
|
||||||
camera model with the 4567 serial
|
|
||||||
gets /dev/video0.
|
|
||||||
|
|
||||||
dev_hint=750:1,4,5,6 The PCVC750 camera will get /dev/video1, the
|
dev_hint=645.0123:3,645.4567:0 The PCA645 camera with serialnumber
|
||||||
next 3 Philips cams will use /dev/video4
|
0123 goes to /dev/video3, the same
|
||||||
through /dev/video6.
|
camera model with the 4567 serial
|
||||||
|
gets /dev/video0.
|
||||||
|
|
||||||
|
dev_hint=750:1,4,5,6 The PCVC750 camera will get /dev/video1, the
|
||||||
|
next 3 Philips cams will use /dev/video4
|
||||||
|
through /dev/video6.
|
||||||
|
|
||||||
Some points worth knowing:
|
Some points worth knowing:
|
||||||
- Serialnumbers are case sensitive and must be written full, including
|
- Serialnumbers are case sensitive and must be written full, including
|
||||||
leading zeroes (it's treated as a string).
|
leading zeroes (it's treated as a string).
|
||||||
- If a device node is already occupied, registration will fail and
|
- If a device node is already occupied, registration will fail and
|
||||||
the webcam is not available.
|
the webcam is not available.
|
||||||
- You can have up to 64 video devices; be sure to make enough device
|
- You can have up to 64 video devices; be sure to make enough device
|
||||||
nodes in /dev if you want to spread the numbers (this does not apply
|
nodes in /dev if you want to spread the numbers (this does not apply
|
||||||
@ -186,13 +186,13 @@ trace
|
|||||||
kernel log at debug level.
|
kernel log at debug level.
|
||||||
|
|
||||||
The trace variable is a bitmask; each bit represents a certain feature.
|
The trace variable is a bitmask; each bit represents a certain feature.
|
||||||
If you want to trace something, look up the bit value(s) in the table
|
If you want to trace something, look up the bit value(s) in the table
|
||||||
below, add the values together and supply that to the trace variable.
|
below, add the values together and supply that to the trace variable.
|
||||||
|
|
||||||
Value Value Description Default
|
Value Value Description Default
|
||||||
(dec) (hex)
|
(dec) (hex)
|
||||||
1 0x1 Module initialization; this will log messages On
|
1 0x1 Module initialization; this will log messages On
|
||||||
while loading and unloading the module
|
while loading and unloading the module
|
||||||
|
|
||||||
2 0x2 probe() and disconnect() traces On
|
2 0x2 probe() and disconnect() traces On
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ trace
|
|||||||
16 0x10 Memory allocation of buffers, etc. Off
|
16 0x10 Memory allocation of buffers, etc. Off
|
||||||
|
|
||||||
32 0x20 Showing underflow, overflow and Dumping frame On
|
32 0x20 Showing underflow, overflow and Dumping frame On
|
||||||
messages
|
messages
|
||||||
|
|
||||||
64 0x40 Show viewport and image sizes Off
|
64 0x40 Show viewport and image sizes Off
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ trace
|
|||||||
|
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
# modprobe pwc size=cif fps=15 power_save=1
|
# modprobe pwc size=cif fps=15 power_save=1
|
||||||
|
|
||||||
The fbufs, mbufs and trace parameters are global and apply to all connected
|
The fbufs, mbufs and trace parameters are global and apply to all connected
|
||||||
|
@ -31,17 +31,17 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Changes
|
Changes
|
||||||
2001/08/03 Alvarado Added methods for changing white balance and
|
2001/08/03 Alvarado Added methods for changing white balance and
|
||||||
red/green gains
|
red/green gains
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Control functions for the cam; brightness, contrast, video mode, etc. */
|
/* Control functions for the cam; brightness, contrast, video mode, etc. */
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
#endif
|
#endif
|
||||||
#include <asm/errno.h>
|
#include <asm/errno.h>
|
||||||
|
|
||||||
#include "pwc.h"
|
#include "pwc.h"
|
||||||
#include "pwc-ioctl.h"
|
#include "pwc-ioctl.h"
|
||||||
#include "pwc-uncompress.h"
|
#include "pwc-uncompress.h"
|
||||||
@ -116,13 +116,13 @@ static const char *size2name[PSZ_MAX] =
|
|||||||
"SIF",
|
"SIF",
|
||||||
"CIF",
|
"CIF",
|
||||||
"VGA",
|
"VGA",
|
||||||
};
|
};
|
||||||
|
|
||||||
/********/
|
/********/
|
||||||
|
|
||||||
/* Entries for the Nala (645/646) camera; the Nala doesn't have compression
|
/* Entries for the Nala (645/646) camera; the Nala doesn't have compression
|
||||||
preferences, so you either get compressed or non-compressed streams.
|
preferences, so you either get compressed or non-compressed streams.
|
||||||
|
|
||||||
An alternate value of 0 means this mode is not available at all.
|
An alternate value of 0 means this mode is not available at all.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -205,13 +205,13 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra
|
|||||||
{ /* closest match of framerate */
|
{ /* closest match of framerate */
|
||||||
0, 0, 0, 0, 4, /* 0-4 */
|
0, 0, 0, 0, 4, /* 0-4 */
|
||||||
5, 5, 7, 7, 10, /* 5-9 */
|
5, 5, 7, 7, 10, /* 5-9 */
|
||||||
10, 10, 12, 12, 15, /* 10-14 */
|
10, 10, 12, 12, 15, /* 10-14 */
|
||||||
15, 15, 15, 20, 20, /* 15-19 */
|
15, 15, 15, 20, 20, /* 15-19 */
|
||||||
20, 20, 20, 24, 24, /* 20-24 */
|
20, 20, 20, 24, 24, /* 20-24 */
|
||||||
24, 24, 24, 24, 24, /* 25-29 */
|
24, 24, 24, 24, 24, /* 25-29 */
|
||||||
24 /* 30 */
|
24 /* 30 */
|
||||||
};
|
};
|
||||||
int frames2table[31] =
|
int frames2table[31] =
|
||||||
{ 0, 0, 0, 0, 0, /* 0-4 */
|
{ 0, 0, 0, 0, 0, /* 0-4 */
|
||||||
1, 1, 1, 2, 2, /* 5-9 */
|
1, 1, 1, 2, 2, /* 5-9 */
|
||||||
3, 3, 4, 4, 4, /* 10-14 */
|
3, 3, 4, 4, 4, /* 10-14 */
|
||||||
@ -220,7 +220,7 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra
|
|||||||
7, 7, 7, 7, 7, /* 25-29 */
|
7, 7, 7, 7, 7, /* 25-29 */
|
||||||
7 /* 30 */
|
7 /* 30 */
|
||||||
};
|
};
|
||||||
|
|
||||||
if (size < 0 || size > PSZ_CIF || frames < 4 || frames > 25)
|
if (size < 0 || size > PSZ_CIF || frames < 4 || frames > 25)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
frames = frames2frames[frames];
|
frames = frames2frames[frames];
|
||||||
@ -232,7 +232,7 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra
|
|||||||
if (pEntry->compressed)
|
if (pEntry->compressed)
|
||||||
return -ENOENT; /* Not supported. */
|
return -ENOENT; /* Not supported. */
|
||||||
|
|
||||||
memcpy(buf, pEntry->mode, 3);
|
memcpy(buf, pEntry->mode, 3);
|
||||||
ret = send_video_command(pdev->udev, pdev->vendpoint, buf, 3);
|
ret = send_video_command(pdev->udev, pdev->vendpoint, buf, 3);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
Debug("Failed to send video command... %d\n", ret);
|
Debug("Failed to send video command... %d\n", ret);
|
||||||
@ -257,7 +257,7 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pdev->cmd_len = 3;
|
pdev->cmd_len = 3;
|
||||||
memcpy(pdev->cmd_buf, buf, 3);
|
memcpy(pdev->cmd_buf, buf, 3);
|
||||||
|
|
||||||
@ -352,13 +352,13 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr
|
|||||||
/* special case: VGA @ 5 fps and snapshot is raw bayer mode */
|
/* special case: VGA @ 5 fps and snapshot is raw bayer mode */
|
||||||
if (size == PSZ_VGA && frames == 5 && snapshot)
|
if (size == PSZ_VGA && frames == 5 && snapshot)
|
||||||
{
|
{
|
||||||
/* Only available in case the raw palette is selected or
|
/* Only available in case the raw palette is selected or
|
||||||
we have the decompressor available. This mode is
|
we have the decompressor available. This mode is
|
||||||
only available in compressed form
|
only available in compressed form
|
||||||
*/
|
*/
|
||||||
if (pdev->vpalette == VIDEO_PALETTE_RAW)
|
if (pdev->vpalette == VIDEO_PALETTE_RAW)
|
||||||
{
|
{
|
||||||
Info("Choosing VGA/5 BAYER mode (%d).\n", pdev->vpalette);
|
Info("Choosing VGA/5 BAYER mode (%d).\n", pdev->vpalette);
|
||||||
pChoose = &RawEntry;
|
pChoose = &RawEntry;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -368,9 +368,9 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Find a supported framerate with progressively higher compression ratios
|
/* Find a supported framerate with progressively higher compression ratios
|
||||||
if the preferred ratio is not available.
|
if the preferred ratio is not available.
|
||||||
Skip this step when using RAW modes.
|
Skip this step when using RAW modes.
|
||||||
*/
|
*/
|
||||||
while (compression <= 3) {
|
while (compression <= 3) {
|
||||||
pChoose = &Kiara_table[size][fps][compression];
|
pChoose = &Kiara_table[size][fps][compression];
|
||||||
@ -383,7 +383,7 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr
|
|||||||
return -ENOENT; /* Not supported. */
|
return -ENOENT; /* Not supported. */
|
||||||
|
|
||||||
Debug("Using alternate setting %d.\n", pChoose->alternate);
|
Debug("Using alternate setting %d.\n", pChoose->alternate);
|
||||||
|
|
||||||
/* usb_control_msg won't take staticly allocated arrays as argument?? */
|
/* usb_control_msg won't take staticly allocated arrays as argument?? */
|
||||||
memcpy(buf, pChoose->mode, 12);
|
memcpy(buf, pChoose->mode, 12);
|
||||||
if (snapshot)
|
if (snapshot)
|
||||||
@ -463,9 +463,9 @@ static void pwc_set_image_buffer_size(struct pwc_device *pdev)
|
|||||||
*/
|
*/
|
||||||
int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot)
|
int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot)
|
||||||
{
|
{
|
||||||
int ret, size;
|
int ret, size;
|
||||||
|
|
||||||
Trace(TRACE_FLOW, "set_video_mode(%dx%d @ %d, palette %d).\n", width, height, frames, pdev->vpalette);
|
Trace(TRACE_FLOW, "set_video_mode(%dx%d @ %d, palette %d).\n", width, height, frames, pdev->vpalette);
|
||||||
size = pwc_decode_size(pdev, width, height);
|
size = pwc_decode_size(pdev, width, height);
|
||||||
if (size < 0) {
|
if (size < 0) {
|
||||||
Debug("Could not find suitable size.\n");
|
Debug("Could not find suitable size.\n");
|
||||||
@ -473,7 +473,7 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame
|
|||||||
}
|
}
|
||||||
Debug("decode_size = %d.\n", size);
|
Debug("decode_size = %d.\n", size);
|
||||||
|
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
switch(pdev->type) {
|
switch(pdev->type) {
|
||||||
case 645:
|
case 645:
|
||||||
case 646:
|
case 646:
|
||||||
@ -485,7 +485,7 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame
|
|||||||
case 690:
|
case 690:
|
||||||
ret = set_video_mode_Timon(pdev, size, frames, compression, snapshot);
|
ret = set_video_mode_Timon(pdev, size, frames, compression, snapshot);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 720:
|
case 720:
|
||||||
case 730:
|
case 730:
|
||||||
case 740:
|
case 740:
|
||||||
@ -517,7 +517,7 @@ int pwc_get_brightness(struct pwc_device *pdev)
|
|||||||
char buf;
|
char buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = RecvControlMsg(GET_LUM_CTL, BRIGHTNESS_FORMATTER, 1);
|
ret = RecvControlMsg(GET_LUM_CTL, BRIGHTNESS_FORMATTER, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
return buf << 9;
|
return buf << 9;
|
||||||
@ -566,7 +566,7 @@ int pwc_get_gamma(struct pwc_device *pdev)
|
|||||||
{
|
{
|
||||||
char buf;
|
char buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = RecvControlMsg(GET_LUM_CTL, GAMMA_FORMATTER, 1);
|
ret = RecvControlMsg(GET_LUM_CTL, GAMMA_FORMATTER, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -622,14 +622,14 @@ static inline int pwc_set_agc(struct pwc_device *pdev, int mode, int value)
|
|||||||
{
|
{
|
||||||
char buf;
|
char buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (mode)
|
if (mode)
|
||||||
buf = 0x0; /* auto */
|
buf = 0x0; /* auto */
|
||||||
else
|
else
|
||||||
buf = 0xff; /* fixed */
|
buf = 0xff; /* fixed */
|
||||||
|
|
||||||
ret = SendControlMsg(SET_LUM_CTL, AGC_MODE_FORMATTER, 1);
|
ret = SendControlMsg(SET_LUM_CTL, AGC_MODE_FORMATTER, 1);
|
||||||
|
|
||||||
if (!mode && ret >= 0) {
|
if (!mode && ret >= 0) {
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
value = 0;
|
value = 0;
|
||||||
@ -647,7 +647,7 @@ static inline int pwc_get_agc(struct pwc_device *pdev, int *value)
|
|||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = RecvControlMsg(GET_LUM_CTL, AGC_MODE_FORMATTER, 1);
|
ret = RecvControlMsg(GET_LUM_CTL, AGC_MODE_FORMATTER, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -658,7 +658,7 @@ static inline int pwc_get_agc(struct pwc_device *pdev, int *value)
|
|||||||
return ret;
|
return ret;
|
||||||
if (buf > 0x3F)
|
if (buf > 0x3F)
|
||||||
buf = 0x3F;
|
buf = 0x3F;
|
||||||
*value = (buf << 10);
|
*value = (buf << 10);
|
||||||
}
|
}
|
||||||
else { /* auto */
|
else { /* auto */
|
||||||
ret = RecvControlMsg(GET_STATUS_CTL, READ_AGC_FORMATTER, 1);
|
ret = RecvControlMsg(GET_STATUS_CTL, READ_AGC_FORMATTER, 1);
|
||||||
@ -683,7 +683,7 @@ static inline int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int v
|
|||||||
buf[0] = 0x0; /* auto */
|
buf[0] = 0x0; /* auto */
|
||||||
else
|
else
|
||||||
buf[0] = 0xff; /* fixed */
|
buf[0] = 0xff; /* fixed */
|
||||||
|
|
||||||
ret = SendControlMsg(SET_LUM_CTL, SHUTTER_MODE_FORMATTER, 1);
|
ret = SendControlMsg(SET_LUM_CTL, SHUTTER_MODE_FORMATTER, 1);
|
||||||
|
|
||||||
if (!mode && ret >= 0) {
|
if (!mode && ret >= 0) {
|
||||||
@ -713,7 +713,7 @@ static inline int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int v
|
|||||||
ret = SendControlMsg(SET_LUM_CTL, PRESET_SHUTTER_FORMATTER, 2);
|
ret = SendControlMsg(SET_LUM_CTL, PRESET_SHUTTER_FORMATTER, 2);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* POWER */
|
/* POWER */
|
||||||
@ -765,22 +765,22 @@ static inline int pwc_restore_factory(struct pwc_device *pdev)
|
|||||||
* 02: fluorescent lighting
|
* 02: fluorescent lighting
|
||||||
* 03: manual
|
* 03: manual
|
||||||
* 04: auto
|
* 04: auto
|
||||||
*/
|
*/
|
||||||
static inline int pwc_set_awb(struct pwc_device *pdev, int mode)
|
static inline int pwc_set_awb(struct pwc_device *pdev, int mode)
|
||||||
{
|
{
|
||||||
char buf;
|
char buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (mode < 0)
|
if (mode < 0)
|
||||||
mode = 0;
|
mode = 0;
|
||||||
|
|
||||||
if (mode > 4)
|
if (mode > 4)
|
||||||
mode = 4;
|
mode = 4;
|
||||||
|
|
||||||
buf = mode & 0x07; /* just the lowest three bits */
|
buf = mode & 0x07; /* just the lowest three bits */
|
||||||
|
|
||||||
ret = SendControlMsg(SET_CHROM_CTL, WB_MODE_FORMATTER, 1);
|
ret = SendControlMsg(SET_CHROM_CTL, WB_MODE_FORMATTER, 1);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
return 0;
|
return 0;
|
||||||
@ -790,17 +790,17 @@ static inline int pwc_get_awb(struct pwc_device *pdev)
|
|||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = RecvControlMsg(GET_CHROM_CTL, WB_MODE_FORMATTER, 1);
|
ret = RecvControlMsg(GET_CHROM_CTL, WB_MODE_FORMATTER, 1);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int pwc_set_red_gain(struct pwc_device *pdev, int value)
|
static inline int pwc_set_red_gain(struct pwc_device *pdev, int value)
|
||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
|
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
value = 0;
|
value = 0;
|
||||||
@ -815,7 +815,7 @@ static inline int pwc_get_red_gain(struct pwc_device *pdev, int *value)
|
|||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, 1);
|
ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -841,7 +841,7 @@ static inline int pwc_get_blue_gain(struct pwc_device *pdev, int *value)
|
|||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, 1);
|
ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -851,14 +851,14 @@ static inline int pwc_get_blue_gain(struct pwc_device *pdev, int *value)
|
|||||||
|
|
||||||
|
|
||||||
/* The following two functions are different, since they only read the
|
/* The following two functions are different, since they only read the
|
||||||
internal red/blue gains, which may be different from the manual
|
internal red/blue gains, which may be different from the manual
|
||||||
gains set or read above.
|
gains set or read above.
|
||||||
*/
|
*/
|
||||||
static inline int pwc_read_red_gain(struct pwc_device *pdev, int *value)
|
static inline int pwc_read_red_gain(struct pwc_device *pdev, int *value)
|
||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = RecvControlMsg(GET_STATUS_CTL, READ_RED_GAIN_FORMATTER, 1);
|
ret = RecvControlMsg(GET_STATUS_CTL, READ_RED_GAIN_FORMATTER, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -870,7 +870,7 @@ static inline int pwc_read_blue_gain(struct pwc_device *pdev, int *value)
|
|||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = RecvControlMsg(GET_STATUS_CTL, READ_BLUE_GAIN_FORMATTER, 1);
|
ret = RecvControlMsg(GET_STATUS_CTL, READ_BLUE_GAIN_FORMATTER, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -882,7 +882,7 @@ static inline int pwc_read_blue_gain(struct pwc_device *pdev, int *value)
|
|||||||
static inline int pwc_set_wb_speed(struct pwc_device *pdev, int speed)
|
static inline int pwc_set_wb_speed(struct pwc_device *pdev, int speed)
|
||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
|
|
||||||
/* useful range is 0x01..0x20 */
|
/* useful range is 0x01..0x20 */
|
||||||
buf = speed / 0x7f0;
|
buf = speed / 0x7f0;
|
||||||
return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1);
|
return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1);
|
||||||
@ -892,7 +892,7 @@ static inline int pwc_get_wb_speed(struct pwc_device *pdev, int *value)
|
|||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1);
|
ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -904,7 +904,7 @@ static inline int pwc_get_wb_speed(struct pwc_device *pdev, int *value)
|
|||||||
static inline int pwc_set_wb_delay(struct pwc_device *pdev, int delay)
|
static inline int pwc_set_wb_delay(struct pwc_device *pdev, int delay)
|
||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
|
|
||||||
/* useful range is 0x01..0x3F */
|
/* useful range is 0x01..0x3F */
|
||||||
buf = (delay >> 10);
|
buf = (delay >> 10);
|
||||||
return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1);
|
return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1);
|
||||||
@ -914,7 +914,7 @@ static inline int pwc_get_wb_delay(struct pwc_device *pdev, int *value)
|
|||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1);
|
ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -950,7 +950,7 @@ static int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value)
|
|||||||
{
|
{
|
||||||
unsigned char buf[2];
|
unsigned char buf[2];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (pdev->type < 730) {
|
if (pdev->type < 730) {
|
||||||
*on_value = -1;
|
*on_value = -1;
|
||||||
*off_value = -1;
|
*off_value = -1;
|
||||||
@ -969,7 +969,7 @@ static inline int pwc_set_contour(struct pwc_device *pdev, int contour)
|
|||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (contour < 0)
|
if (contour < 0)
|
||||||
buf = 0xff; /* auto contour on */
|
buf = 0xff; /* auto contour on */
|
||||||
else
|
else
|
||||||
@ -977,16 +977,16 @@ static inline int pwc_set_contour(struct pwc_device *pdev, int contour)
|
|||||||
ret = SendControlMsg(SET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1);
|
ret = SendControlMsg(SET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (contour < 0)
|
if (contour < 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (contour > 0xffff)
|
if (contour > 0xffff)
|
||||||
contour = 0xffff;
|
contour = 0xffff;
|
||||||
|
|
||||||
buf = (contour >> 10); /* contour preset is [0..3f] */
|
buf = (contour >> 10); /* contour preset is [0..3f] */
|
||||||
ret = SendControlMsg(SET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1);
|
ret = SendControlMsg(SET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -994,7 +994,7 @@ static inline int pwc_get_contour(struct pwc_device *pdev, int *contour)
|
|||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = RecvControlMsg(GET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1);
|
ret = RecvControlMsg(GET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -1002,7 +1002,7 @@ static inline int pwc_get_contour(struct pwc_device *pdev, int *contour)
|
|||||||
if (buf == 0) {
|
if (buf == 0) {
|
||||||
/* auto mode off, query current preset value */
|
/* auto mode off, query current preset value */
|
||||||
ret = RecvControlMsg(GET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1);
|
ret = RecvControlMsg(GET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
*contour = buf << 10;
|
*contour = buf << 10;
|
||||||
}
|
}
|
||||||
@ -1015,7 +1015,7 @@ static inline int pwc_get_contour(struct pwc_device *pdev, int *contour)
|
|||||||
static inline int pwc_set_backlight(struct pwc_device *pdev, int backlight)
|
static inline int pwc_set_backlight(struct pwc_device *pdev, int backlight)
|
||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
|
|
||||||
if (backlight)
|
if (backlight)
|
||||||
buf = 0xff;
|
buf = 0xff;
|
||||||
else
|
else
|
||||||
@ -1027,7 +1027,7 @@ static inline int pwc_get_backlight(struct pwc_device *pdev, int *backlight)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
|
|
||||||
ret = RecvControlMsg(GET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, 1);
|
ret = RecvControlMsg(GET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -1039,7 +1039,7 @@ static inline int pwc_get_backlight(struct pwc_device *pdev, int *backlight)
|
|||||||
static inline int pwc_set_flicker(struct pwc_device *pdev, int flicker)
|
static inline int pwc_set_flicker(struct pwc_device *pdev, int flicker)
|
||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
|
|
||||||
if (flicker)
|
if (flicker)
|
||||||
buf = 0xff;
|
buf = 0xff;
|
||||||
else
|
else
|
||||||
@ -1051,7 +1051,7 @@ static inline int pwc_get_flicker(struct pwc_device *pdev, int *flicker)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
|
|
||||||
ret = RecvControlMsg(GET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, 1);
|
ret = RecvControlMsg(GET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -1076,7 +1076,7 @@ static inline int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
|
|
||||||
ret = RecvControlMsg(GET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, 1);
|
ret = RecvControlMsg(GET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -1087,7 +1087,7 @@ static inline int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise)
|
|||||||
static int pwc_mpt_reset(struct pwc_device *pdev, int flags)
|
static int pwc_mpt_reset(struct pwc_device *pdev, int flags)
|
||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
|
|
||||||
buf = flags & 0x03; // only lower two bits are currently used
|
buf = flags & 0x03; // only lower two bits are currently used
|
||||||
return SendControlMsg(SET_MPT_CTL, PT_RESET_CONTROL_FORMATTER, 1);
|
return SendControlMsg(SET_MPT_CTL, PT_RESET_CONTROL_FORMATTER, 1);
|
||||||
}
|
}
|
||||||
@ -1095,7 +1095,7 @@ static int pwc_mpt_reset(struct pwc_device *pdev, int flags)
|
|||||||
static inline int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt)
|
static inline int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt)
|
||||||
{
|
{
|
||||||
unsigned char buf[4];
|
unsigned char buf[4];
|
||||||
|
|
||||||
/* set new relative angle; angles are expressed in degrees * 100,
|
/* set new relative angle; angles are expressed in degrees * 100,
|
||||||
but cam as .5 degree resolution, hence divide by 200. Also
|
but cam as .5 degree resolution, hence divide by 200. Also
|
||||||
the angle must be multiplied by 64 before it's send to
|
the angle must be multiplied by 64 before it's send to
|
||||||
@ -1114,7 +1114,7 @@ static inline int pwc_mpt_get_status(struct pwc_device *pdev, struct pwc_mpt_sta
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
unsigned char buf[5];
|
unsigned char buf[5];
|
||||||
|
|
||||||
ret = RecvControlMsg(GET_MPT_CTL, PT_STATUS_FORMATTER, 5);
|
ret = RecvControlMsg(GET_MPT_CTL, PT_STATUS_FORMATTER, 5);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -1129,14 +1129,14 @@ int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor)
|
|||||||
{
|
{
|
||||||
unsigned char buf;
|
unsigned char buf;
|
||||||
int ret = -1, request;
|
int ret = -1, request;
|
||||||
|
|
||||||
if (pdev->type < 675)
|
if (pdev->type < 675)
|
||||||
request = SENSOR_TYPE_FORMATTER1;
|
request = SENSOR_TYPE_FORMATTER1;
|
||||||
else if (pdev->type < 730)
|
else if (pdev->type < 730)
|
||||||
return -1; /* The Vesta series doesn't have this call */
|
return -1; /* The Vesta series doesn't have this call */
|
||||||
else
|
else
|
||||||
request = SENSOR_TYPE_FORMATTER2;
|
request = SENSOR_TYPE_FORMATTER2;
|
||||||
|
|
||||||
ret = RecvControlMsg(GET_STATUS_CTL, request, 1);
|
ret = RecvControlMsg(GET_STATUS_CTL, request, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -1163,23 +1163,23 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
|
|||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCSUSER:
|
case VIDIOCPWCSUSER:
|
||||||
{
|
{
|
||||||
if (pwc_save_user(pdev))
|
if (pwc_save_user(pdev))
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCFACTORY:
|
case VIDIOCPWCFACTORY:
|
||||||
{
|
{
|
||||||
if (pwc_restore_factory(pdev))
|
if (pwc_restore_factory(pdev))
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCSCQUAL:
|
case VIDIOCPWCSCQUAL:
|
||||||
{
|
{
|
||||||
int *qual = arg;
|
int *qual = arg;
|
||||||
|
|
||||||
if (*qual < 0 || *qual > 3)
|
if (*qual < 0 || *qual > 3)
|
||||||
@ -1190,14 +1190,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
|
|||||||
pdev->vcompression = *qual;
|
pdev->vcompression = *qual;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCGCQUAL:
|
case VIDIOCPWCGCQUAL:
|
||||||
{
|
{
|
||||||
int *qual = arg;
|
int *qual = arg;
|
||||||
*qual = pdev->vcompression;
|
*qual = pdev->vcompression;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCPROBE:
|
case VIDIOCPWCPROBE:
|
||||||
{
|
{
|
||||||
struct pwc_probe *probe = arg;
|
struct pwc_probe *probe = arg;
|
||||||
@ -1220,27 +1220,27 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
|
|||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCGAGC:
|
case VIDIOCPWCGAGC:
|
||||||
{
|
{
|
||||||
int *agc = arg;
|
int *agc = arg;
|
||||||
|
|
||||||
if (pwc_get_agc(pdev, agc))
|
if (pwc_get_agc(pdev, agc))
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCSSHUTTER:
|
case VIDIOCPWCSSHUTTER:
|
||||||
{
|
{
|
||||||
int *shutter_speed = arg;
|
int *shutter_speed = arg;
|
||||||
ret = pwc_set_shutter_speed(pdev, *shutter_speed < 0 ? 1 : 0, *shutter_speed);
|
ret = pwc_set_shutter_speed(pdev, *shutter_speed < 0 ? 1 : 0, *shutter_speed);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCSAWB:
|
case VIDIOCPWCSAWB:
|
||||||
{
|
{
|
||||||
struct pwc_whitebalance *wb = arg;
|
struct pwc_whitebalance *wb = arg;
|
||||||
|
|
||||||
ret = pwc_set_awb(pdev, wb->mode);
|
ret = pwc_set_awb(pdev, wb->mode);
|
||||||
if (ret >= 0 && wb->mode == PWC_WB_MANUAL) {
|
if (ret >= 0 && wb->mode == PWC_WB_MANUAL) {
|
||||||
pwc_set_red_gain(pdev, wb->manual_red);
|
pwc_set_red_gain(pdev, wb->manual_red);
|
||||||
@ -1270,18 +1270,18 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
|
|||||||
ret = pwc_read_red_gain(pdev, &wb->read_red);
|
ret = pwc_read_red_gain(pdev, &wb->read_red);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
break;
|
break;
|
||||||
ret = pwc_read_blue_gain(pdev, &wb->read_blue);
|
ret = pwc_read_blue_gain(pdev, &wb->read_blue);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCSAWBSPEED:
|
case VIDIOCPWCSAWBSPEED:
|
||||||
{
|
{
|
||||||
struct pwc_wb_speed *wbs = arg;
|
struct pwc_wb_speed *wbs = arg;
|
||||||
|
|
||||||
if (wbs->control_speed > 0) {
|
if (wbs->control_speed > 0) {
|
||||||
ret = pwc_set_wb_speed(pdev, wbs->control_speed);
|
ret = pwc_set_wb_speed(pdev, wbs->control_speed);
|
||||||
}
|
}
|
||||||
@ -1290,11 +1290,11 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCGAWBSPEED:
|
case VIDIOCPWCGAWBSPEED:
|
||||||
{
|
{
|
||||||
struct pwc_wb_speed *wbs = arg;
|
struct pwc_wb_speed *wbs = arg;
|
||||||
|
|
||||||
ret = pwc_get_wb_speed(pdev, &wbs->control_speed);
|
ret = pwc_get_wb_speed(pdev, &wbs->control_speed);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
break;
|
break;
|
||||||
@ -1304,7 +1304,7 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCSLED:
|
case VIDIOCPWCSLED:
|
||||||
{
|
{
|
||||||
struct pwc_leds *leds = arg;
|
struct pwc_leds *leds = arg;
|
||||||
ret = pwc_set_leds(pdev, leds->led_on, leds->led_off);
|
ret = pwc_set_leds(pdev, leds->led_on, leds->led_off);
|
||||||
@ -1325,14 +1325,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
|
|||||||
ret = pwc_set_contour(pdev, *contour);
|
ret = pwc_set_contour(pdev, *contour);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCGCONTOUR:
|
case VIDIOCPWCGCONTOUR:
|
||||||
{
|
{
|
||||||
int *contour = arg;
|
int *contour = arg;
|
||||||
ret = pwc_get_contour(pdev, contour);
|
ret = pwc_get_contour(pdev, contour);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCSBACKLIGHT:
|
case VIDIOCPWCSBACKLIGHT:
|
||||||
{
|
{
|
||||||
int *backlight = arg;
|
int *backlight = arg;
|
||||||
@ -1346,7 +1346,7 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
|
|||||||
ret = pwc_get_backlight(pdev, backlight);
|
ret = pwc_get_backlight(pdev, backlight);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCSFLICKER:
|
case VIDIOCPWCSFLICKER:
|
||||||
{
|
{
|
||||||
int *flicker = arg;
|
int *flicker = arg;
|
||||||
@ -1360,14 +1360,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
|
|||||||
ret = pwc_get_flicker(pdev, flicker);
|
ret = pwc_get_flicker(pdev, flicker);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCSDYNNOISE:
|
case VIDIOCPWCSDYNNOISE:
|
||||||
{
|
{
|
||||||
int *dynnoise = arg;
|
int *dynnoise = arg;
|
||||||
ret = pwc_set_dynamic_noise(pdev, *dynnoise);
|
ret = pwc_set_dynamic_noise(pdev, *dynnoise);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCGDYNNOISE:
|
case VIDIOCPWCGDYNNOISE:
|
||||||
{
|
{
|
||||||
int *dynnoise = arg;
|
int *dynnoise = arg;
|
||||||
@ -1381,61 +1381,61 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
|
|||||||
size->width = pdev->image.x;
|
size->width = pdev->image.x;
|
||||||
size->height = pdev->image.y;
|
size->height = pdev->image.y;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCMPTRESET:
|
case VIDIOCPWCMPTRESET:
|
||||||
{
|
{
|
||||||
if (pdev->features & FEATURE_MOTOR_PANTILT)
|
if (pdev->features & FEATURE_MOTOR_PANTILT)
|
||||||
{
|
{
|
||||||
int *flags = arg;
|
int *flags = arg;
|
||||||
|
|
||||||
ret = pwc_mpt_reset(pdev, *flags);
|
ret = pwc_mpt_reset(pdev, *flags);
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
pdev->pan_angle = 0;
|
pdev->pan_angle = 0;
|
||||||
pdev->tilt_angle = 0;
|
pdev->tilt_angle = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = -ENXIO;
|
ret = -ENXIO;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCMPTGRANGE:
|
case VIDIOCPWCMPTGRANGE:
|
||||||
{
|
{
|
||||||
if (pdev->features & FEATURE_MOTOR_PANTILT)
|
if (pdev->features & FEATURE_MOTOR_PANTILT)
|
||||||
{
|
{
|
||||||
struct pwc_mpt_range *range = arg;
|
struct pwc_mpt_range *range = arg;
|
||||||
*range = pdev->angle_range;
|
*range = pdev->angle_range;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = -ENXIO;
|
ret = -ENXIO;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCMPTSANGLE:
|
case VIDIOCPWCMPTSANGLE:
|
||||||
{
|
{
|
||||||
int new_pan, new_tilt;
|
int new_pan, new_tilt;
|
||||||
|
|
||||||
if (pdev->features & FEATURE_MOTOR_PANTILT)
|
if (pdev->features & FEATURE_MOTOR_PANTILT)
|
||||||
{
|
{
|
||||||
struct pwc_mpt_angles *angles = arg;
|
struct pwc_mpt_angles *angles = arg;
|
||||||
/* The camera can only set relative angles, so
|
/* The camera can only set relative angles, so
|
||||||
do some calculations when getting an absolute angle .
|
do some calculations when getting an absolute angle .
|
||||||
*/
|
*/
|
||||||
if (angles->absolute)
|
if (angles->absolute)
|
||||||
{
|
{
|
||||||
new_pan = angles->pan;
|
new_pan = angles->pan;
|
||||||
new_tilt = angles->tilt;
|
new_tilt = angles->tilt;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new_pan = pdev->pan_angle + angles->pan;
|
new_pan = pdev->pan_angle + angles->pan;
|
||||||
new_tilt = pdev->tilt_angle + angles->tilt;
|
new_tilt = pdev->tilt_angle + angles->tilt;
|
||||||
}
|
}
|
||||||
/* check absolute ranges */
|
/* check absolute ranges */
|
||||||
if (new_pan < pdev->angle_range.pan_min ||
|
if (new_pan < pdev->angle_range.pan_min ||
|
||||||
@ -1463,53 +1463,53 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
|
|||||||
pdev->tilt_angle += new_tilt;
|
pdev->tilt_angle += new_tilt;
|
||||||
}
|
}
|
||||||
if (ret == -EPIPE) /* stall -> out of range */
|
if (ret == -EPIPE) /* stall -> out of range */
|
||||||
ret = -ERANGE;
|
ret = -ERANGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = -ENXIO;
|
ret = -ENXIO;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCMPTGANGLE:
|
case VIDIOCPWCMPTGANGLE:
|
||||||
{
|
{
|
||||||
|
|
||||||
if (pdev->features & FEATURE_MOTOR_PANTILT)
|
|
||||||
{
|
|
||||||
struct pwc_mpt_angles *angles = arg;
|
|
||||||
|
|
||||||
angles->absolute = 1;
|
if (pdev->features & FEATURE_MOTOR_PANTILT)
|
||||||
angles->pan = pdev->pan_angle;
|
{
|
||||||
angles->tilt = pdev->tilt_angle;
|
struct pwc_mpt_angles *angles = arg;
|
||||||
}
|
|
||||||
else
|
angles->absolute = 1;
|
||||||
{
|
angles->pan = pdev->pan_angle;
|
||||||
ret = -ENXIO;
|
angles->tilt = pdev->tilt_angle;
|
||||||
}
|
}
|
||||||
break;
|
else
|
||||||
}
|
{
|
||||||
|
ret = -ENXIO;
|
||||||
case VIDIOCPWCMPTSTATUS:
|
}
|
||||||
{
|
break;
|
||||||
if (pdev->features & FEATURE_MOTOR_PANTILT)
|
}
|
||||||
{
|
|
||||||
struct pwc_mpt_status *status = arg;
|
case VIDIOCPWCMPTSTATUS:
|
||||||
ret = pwc_mpt_get_status(pdev, status);
|
{
|
||||||
}
|
if (pdev->features & FEATURE_MOTOR_PANTILT)
|
||||||
else
|
{
|
||||||
{
|
struct pwc_mpt_status *status = arg;
|
||||||
ret = -ENXIO;
|
ret = pwc_mpt_get_status(pdev, status);
|
||||||
}
|
}
|
||||||
break;
|
else
|
||||||
|
{
|
||||||
|
ret = -ENXIO;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCPWCGVIDCMD:
|
case VIDIOCPWCGVIDCMD:
|
||||||
{
|
{
|
||||||
struct pwc_video_command *cmd = arg;
|
struct pwc_video_command *cmd = arg;
|
||||||
|
|
||||||
cmd->type = pdev->type;
|
cmd->type = pdev->type;
|
||||||
cmd->release = pdev->release;
|
cmd->release = pdev->release;
|
||||||
cmd->command_len = pdev->cmd_len;
|
cmd->command_len = pdev->cmd_len;
|
||||||
memcpy(&cmd->command_buf, pdev->cmd_buf, pdev->cmd_len);
|
memcpy(&cmd->command_buf, pdev->cmd_buf, pdev->cmd_len);
|
||||||
@ -1531,7 +1531,7 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
|
|||||||
ret = -ENOIOCTLCMD;
|
ret = -ENOIOCTLCMD;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
return 0;
|
return 0;
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -25,18 +25,18 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This code forms the interface between the USB layers and the Philips
|
This code forms the interface between the USB layers and the Philips
|
||||||
specific stuff. Some adanved stuff of the driver falls under an
|
specific stuff. Some adanved stuff of the driver falls under an
|
||||||
NDA, signed between me and Philips B.V., Eindhoven, the Netherlands, and
|
NDA, signed between me and Philips B.V., Eindhoven, the Netherlands, and
|
||||||
is thus not distributed in source form. The binary pwcx.o module
|
is thus not distributed in source form. The binary pwcx.o module
|
||||||
contains the code that falls under the NDA.
|
contains the code that falls under the NDA.
|
||||||
|
|
||||||
In case you're wondering: 'pwc' stands for "Philips WebCam", but
|
In case you're wondering: 'pwc' stands for "Philips WebCam", but
|
||||||
I really didn't want to type 'philips_web_cam' every time (I'm lazy as
|
I really didn't want to type 'philips_web_cam' every time (I'm lazy as
|
||||||
any Linux kernel hacker, but I don't like uncomprehensible abbreviations
|
any Linux kernel hacker, but I don't like uncomprehensible abbreviations
|
||||||
without explanation).
|
without explanation).
|
||||||
|
|
||||||
Oh yes, convention: to disctinguish between all the various pointers to
|
Oh yes, convention: to disctinguish between all the various pointers to
|
||||||
device-structures, I use these names for the pointer variables:
|
device-structures, I use these names for the pointer variables:
|
||||||
udev: struct usb_device *
|
udev: struct usb_device *
|
||||||
@ -170,14 +170,14 @@ static struct video_device pwc_template = {
|
|||||||
|
|
||||||
/* Okay, this is some magic that I worked out and the reasoning behind it...
|
/* Okay, this is some magic that I worked out and the reasoning behind it...
|
||||||
|
|
||||||
The biggest problem with any USB device is of course: "what to do
|
The biggest problem with any USB device is of course: "what to do
|
||||||
when the user unplugs the device while it is in use by an application?"
|
when the user unplugs the device while it is in use by an application?"
|
||||||
We have several options:
|
We have several options:
|
||||||
1) Curse them with the 7 plagues when they do (requires divine intervention)
|
1) Curse them with the 7 plagues when they do (requires divine intervention)
|
||||||
2) Tell them not to (won't work: they'll do it anyway)
|
2) Tell them not to (won't work: they'll do it anyway)
|
||||||
3) Oops the kernel (this will have a negative effect on a user's uptime)
|
3) Oops the kernel (this will have a negative effect on a user's uptime)
|
||||||
4) Do something sensible.
|
4) Do something sensible.
|
||||||
|
|
||||||
Of course, we go for option 4.
|
Of course, we go for option 4.
|
||||||
|
|
||||||
It happens that this device will be linked to two times, once from
|
It happens that this device will be linked to two times, once from
|
||||||
@ -185,15 +185,15 @@ static struct video_device pwc_template = {
|
|||||||
pointers. This is done when the device is probed() and all initialization
|
pointers. This is done when the device is probed() and all initialization
|
||||||
succeeded. The pwc_device struct links back to both structures.
|
succeeded. The pwc_device struct links back to both structures.
|
||||||
|
|
||||||
When a device is unplugged while in use it will be removed from the
|
When a device is unplugged while in use it will be removed from the
|
||||||
list of known USB devices; I also de-register it as a V4L device, but
|
list of known USB devices; I also de-register it as a V4L device, but
|
||||||
unfortunately I can't free the memory since the struct is still in use
|
unfortunately I can't free the memory since the struct is still in use
|
||||||
by the file descriptor. This free-ing is then deferend until the first
|
by the file descriptor. This free-ing is then deferend until the first
|
||||||
opportunity. Crude, but it works.
|
opportunity. Crude, but it works.
|
||||||
|
|
||||||
A small 'advantage' is that if a user unplugs the cam and plugs it back
|
A small 'advantage' is that if a user unplugs the cam and plugs it back
|
||||||
in, it should get assigned the same video device minor, but unfortunately
|
in, it should get assigned the same video device minor, but unfortunately
|
||||||
it's non-trivial to re-link the cam back to the video device... (that
|
it's non-trivial to re-link the cam back to the video device... (that
|
||||||
would surely be magic! :))
|
would surely be magic! :))
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -203,14 +203,14 @@ static struct video_device pwc_template = {
|
|||||||
/* Here we want the physical address of the memory.
|
/* Here we want the physical address of the memory.
|
||||||
* This is used when initializing the contents of the area.
|
* This is used when initializing the contents of the area.
|
||||||
*/
|
*/
|
||||||
static inline unsigned long kvirt_to_pa(unsigned long adr)
|
static inline unsigned long kvirt_to_pa(unsigned long adr)
|
||||||
{
|
{
|
||||||
unsigned long kva, ret;
|
unsigned long kva, ret;
|
||||||
|
|
||||||
kva = (unsigned long) page_address(vmalloc_to_page((void *)adr));
|
kva = (unsigned long) page_address(vmalloc_to_page((void *)adr));
|
||||||
kva |= adr & (PAGE_SIZE-1); /* restore the offset */
|
kva |= adr & (PAGE_SIZE-1); /* restore the offset */
|
||||||
ret = __pa(kva);
|
ret = __pa(kva);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void * rvmalloc(unsigned long size)
|
static void * rvmalloc(unsigned long size)
|
||||||
@ -219,13 +219,13 @@ static void * rvmalloc(unsigned long size)
|
|||||||
unsigned long adr;
|
unsigned long adr;
|
||||||
|
|
||||||
size=PAGE_ALIGN(size);
|
size=PAGE_ALIGN(size);
|
||||||
mem=vmalloc_32(size);
|
mem=vmalloc_32(size);
|
||||||
if (mem)
|
if (mem)
|
||||||
{
|
{
|
||||||
memset(mem, 0, size); /* Clear the ram out, no junk to the user */
|
memset(mem, 0, size); /* Clear the ram out, no junk to the user */
|
||||||
adr=(unsigned long) mem;
|
adr=(unsigned long) mem;
|
||||||
while (size > 0)
|
while (size > 0)
|
||||||
{
|
{
|
||||||
SetPageReserved(vmalloc_to_page((void *)adr));
|
SetPageReserved(vmalloc_to_page((void *)adr));
|
||||||
adr+=PAGE_SIZE;
|
adr+=PAGE_SIZE;
|
||||||
size-=PAGE_SIZE;
|
size-=PAGE_SIZE;
|
||||||
@ -236,13 +236,13 @@ static void * rvmalloc(unsigned long size)
|
|||||||
|
|
||||||
static void rvfree(void * mem, unsigned long size)
|
static void rvfree(void * mem, unsigned long size)
|
||||||
{
|
{
|
||||||
unsigned long adr;
|
unsigned long adr;
|
||||||
|
|
||||||
if (mem)
|
if (mem)
|
||||||
{
|
{
|
||||||
adr=(unsigned long) mem;
|
adr=(unsigned long) mem;
|
||||||
while ((long) size > 0)
|
while ((long) size > 0)
|
||||||
{
|
{
|
||||||
ClearPageReserved(vmalloc_to_page((void *)adr));
|
ClearPageReserved(vmalloc_to_page((void *)adr));
|
||||||
adr+=PAGE_SIZE;
|
adr+=PAGE_SIZE;
|
||||||
size-=PAGE_SIZE;
|
size-=PAGE_SIZE;
|
||||||
@ -263,13 +263,13 @@ static int pwc_allocate_buffers(struct pwc_device *pdev)
|
|||||||
|
|
||||||
if (pdev == NULL)
|
if (pdev == NULL)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
|
||||||
#ifdef PWC_MAGIC
|
#ifdef PWC_MAGIC
|
||||||
if (pdev->magic != PWC_MAGIC) {
|
if (pdev->magic != PWC_MAGIC) {
|
||||||
Err("allocate_buffers(): magic failed.\n");
|
Err("allocate_buffers(): magic failed.\n");
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Allocate Isochronous pipe buffers */
|
/* Allocate Isochronous pipe buffers */
|
||||||
for (i = 0; i < MAX_ISO_BUFS; i++) {
|
for (i = 0; i < MAX_ISO_BUFS; i++) {
|
||||||
if (pdev->sbuf[i].data == NULL) {
|
if (pdev->sbuf[i].data == NULL) {
|
||||||
@ -308,7 +308,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev)
|
|||||||
memset(kbuf, 128, PWC_FRAME_SIZE);
|
memset(kbuf, 128, PWC_FRAME_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate decompressor table space */
|
/* Allocate decompressor table space */
|
||||||
kbuf = NULL;
|
kbuf = NULL;
|
||||||
switch (pdev->type)
|
switch (pdev->type)
|
||||||
@ -320,7 +320,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev)
|
|||||||
case 730:
|
case 730:
|
||||||
case 740:
|
case 740:
|
||||||
case 750:
|
case 750:
|
||||||
#if 0
|
#if 0
|
||||||
Trace(TRACE_MEMORY,"private_data(%zu)\n",sizeof(struct pwc_dec23_private));
|
Trace(TRACE_MEMORY,"private_data(%zu)\n",sizeof(struct pwc_dec23_private));
|
||||||
kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); /* Timon & Kiara */
|
kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); /* Timon & Kiara */
|
||||||
break;
|
break;
|
||||||
@ -329,11 +329,11 @@ static int pwc_allocate_buffers(struct pwc_device *pdev)
|
|||||||
/* TODO & FIXME */
|
/* TODO & FIXME */
|
||||||
kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL);
|
kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
pdev->decompress_data = kbuf;
|
pdev->decompress_data = kbuf;
|
||||||
|
|
||||||
/* Allocate image buffer; double buffer for mmap() */
|
/* Allocate image buffer; double buffer for mmap() */
|
||||||
kbuf = rvmalloc(default_mbufs * pdev->len_per_image);
|
kbuf = rvmalloc(default_mbufs * pdev->len_per_image);
|
||||||
if (kbuf == NULL) {
|
if (kbuf == NULL) {
|
||||||
@ -348,7 +348,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev)
|
|||||||
pdev->image_ptr[i] = NULL;
|
pdev->image_ptr[i] = NULL;
|
||||||
|
|
||||||
kbuf = NULL;
|
kbuf = NULL;
|
||||||
|
|
||||||
Trace(TRACE_MEMORY, "<< pwc_allocate_buffers()\n");
|
Trace(TRACE_MEMORY, "<< pwc_allocate_buffers()\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -366,7 +366,7 @@ static void pwc_free_buffers(struct pwc_device *pdev)
|
|||||||
Err("free_buffers(): magic failed.\n");
|
Err("free_buffers(): magic failed.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Release Iso-pipe buffers */
|
/* Release Iso-pipe buffers */
|
||||||
for (i = 0; i < MAX_ISO_BUFS; i++)
|
for (i = 0; i < MAX_ISO_BUFS; i++)
|
||||||
@ -403,17 +403,17 @@ static void pwc_free_buffers(struct pwc_device *pdev)
|
|||||||
rvfree(pdev->image_data, default_mbufs * pdev->len_per_image);
|
rvfree(pdev->image_data, default_mbufs * pdev->len_per_image);
|
||||||
}
|
}
|
||||||
pdev->image_data = NULL;
|
pdev->image_data = NULL;
|
||||||
|
|
||||||
Trace(TRACE_MEMORY, "Leaving free_buffers().\n");
|
Trace(TRACE_MEMORY, "Leaving free_buffers().\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The frame & image buffer mess.
|
/* The frame & image buffer mess.
|
||||||
|
|
||||||
Yes, this is a mess. Well, it used to be simple, but alas... In this
|
Yes, this is a mess. Well, it used to be simple, but alas... In this
|
||||||
module, 3 buffers schemes are used to get the data from the USB bus to
|
module, 3 buffers schemes are used to get the data from the USB bus to
|
||||||
the user program. The first scheme involves the ISO buffers (called thus
|
the user program. The first scheme involves the ISO buffers (called thus
|
||||||
since they transport ISO data from the USB controller), and not really
|
since they transport ISO data from the USB controller), and not really
|
||||||
interesting. Suffices to say the data from this buffer is quickly
|
interesting. Suffices to say the data from this buffer is quickly
|
||||||
gathered in an interrupt handler (pwc_isoc_handler) and placed into the
|
gathered in an interrupt handler (pwc_isoc_handler) and placed into the
|
||||||
frame buffer.
|
frame buffer.
|
||||||
|
|
||||||
@ -443,8 +443,8 @@ static void pwc_free_buffers(struct pwc_device *pdev)
|
|||||||
and a 'full' frame list:
|
and a 'full' frame list:
|
||||||
* Initially, all frame buffers but one are on the 'empty' list; the one
|
* Initially, all frame buffers but one are on the 'empty' list; the one
|
||||||
remaining buffer is our initial fill frame.
|
remaining buffer is our initial fill frame.
|
||||||
* If a frame is needed for filling, we try to take it from the 'empty'
|
* If a frame is needed for filling, we try to take it from the 'empty'
|
||||||
list, unless that list is empty, in which case we take the buffer at
|
list, unless that list is empty, in which case we take the buffer at
|
||||||
the head of the 'full' list.
|
the head of the 'full' list.
|
||||||
* When our fill buffer has been filled, it is appended to the 'full'
|
* When our fill buffer has been filled, it is appended to the 'full'
|
||||||
list.
|
list.
|
||||||
@ -646,7 +646,7 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs)
|
|||||||
case -ETIMEDOUT: errmsg = "NAK (device does not respond)"; break;
|
case -ETIMEDOUT: errmsg = "NAK (device does not respond)"; break;
|
||||||
}
|
}
|
||||||
Trace(TRACE_FLOW, "pwc_isoc_handler() called with status %d [%s].\n", urb->status, errmsg);
|
Trace(TRACE_FLOW, "pwc_isoc_handler() called with status %d [%s].\n", urb->status, errmsg);
|
||||||
/* Give up after a number of contiguous errors on the USB bus.
|
/* Give up after a number of contiguous errors on the USB bus.
|
||||||
Appearantly something is wrong so we simulate an unplug event.
|
Appearantly something is wrong so we simulate an unplug event.
|
||||||
*/
|
*/
|
||||||
if (++pdev->visoc_errors > MAX_ISOC_ERRORS)
|
if (++pdev->visoc_errors > MAX_ISOC_ERRORS)
|
||||||
@ -673,8 +673,8 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs)
|
|||||||
pdev->visoc_errors = 0;
|
pdev->visoc_errors = 0;
|
||||||
|
|
||||||
/* vsync: 0 = don't copy data
|
/* vsync: 0 = don't copy data
|
||||||
1 = sync-hunt
|
1 = sync-hunt
|
||||||
2 = synched
|
2 = synched
|
||||||
*/
|
*/
|
||||||
/* Compact data */
|
/* Compact data */
|
||||||
for (i = 0; i < urb->number_of_packets; i++) {
|
for (i = 0; i < urb->number_of_packets; i++) {
|
||||||
@ -701,18 +701,18 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs)
|
|||||||
} /* ..flen > 0 */
|
} /* ..flen > 0 */
|
||||||
|
|
||||||
if (flen < pdev->vlast_packet_size) {
|
if (flen < pdev->vlast_packet_size) {
|
||||||
/* Shorter packet... We probably have the end of an image-frame;
|
/* Shorter packet... We probably have the end of an image-frame;
|
||||||
wake up read() process and let select()/poll() do something.
|
wake up read() process and let select()/poll() do something.
|
||||||
Decompression is done in user time over there.
|
Decompression is done in user time over there.
|
||||||
*/
|
*/
|
||||||
if (pdev->vsync == 2) {
|
if (pdev->vsync == 2) {
|
||||||
/* The ToUCam Fun CMOS sensor causes the firmware to send 2 or 3 bogus
|
/* The ToUCam Fun CMOS sensor causes the firmware to send 2 or 3 bogus
|
||||||
frames on the USB wire after an exposure change. This conditition is
|
frames on the USB wire after an exposure change. This conditition is
|
||||||
however detected in the cam and a bit is set in the header.
|
however detected in the cam and a bit is set in the header.
|
||||||
*/
|
*/
|
||||||
if (pdev->type == 730) {
|
if (pdev->type == 730) {
|
||||||
unsigned char *ptr = (unsigned char *)fbuf->data;
|
unsigned char *ptr = (unsigned char *)fbuf->data;
|
||||||
|
|
||||||
if (ptr[1] == 1 && ptr[0] & 0x10) {
|
if (ptr[1] == 1 && ptr[0] & 0x10) {
|
||||||
#if PWC_DEBUG
|
#if PWC_DEBUG
|
||||||
Debug("Hyundai CMOS sensor bug. Dropping frame %d.\n", fbuf->sequence);
|
Debug("Hyundai CMOS sensor bug. Dropping frame %d.\n", fbuf->sequence);
|
||||||
@ -733,13 +733,13 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs)
|
|||||||
Info("Image is normal.\n");
|
Info("Image is normal.\n");
|
||||||
}
|
}
|
||||||
pdev->vmirror = ptr[0] & 0x03;
|
pdev->vmirror = ptr[0] & 0x03;
|
||||||
/* Sometimes the trailer of the 730 is still sent as a 4 byte packet
|
/* Sometimes the trailer of the 730 is still sent as a 4 byte packet
|
||||||
after a short frame; this condition is filtered out specifically. A 4 byte
|
after a short frame; this condition is filtered out specifically. A 4 byte
|
||||||
frame doesn't make sense anyway.
|
frame doesn't make sense anyway.
|
||||||
So we get either this sequence:
|
So we get either this sequence:
|
||||||
drop_bit set -> 4 byte frame -> short frame -> good frame
|
drop_bit set -> 4 byte frame -> short frame -> good frame
|
||||||
Or this one:
|
Or this one:
|
||||||
drop_bit set -> short frame -> good frame
|
drop_bit set -> short frame -> good frame
|
||||||
So we drop either 3 or 2 frames in all!
|
So we drop either 3 or 2 frames in all!
|
||||||
*/
|
*/
|
||||||
if (fbuf->filled == 4)
|
if (fbuf->filled == 4)
|
||||||
@ -830,7 +830,7 @@ static int pwc_isoc_init(struct pwc_device *pdev)
|
|||||||
intf = usb_ifnum_to_if(udev, 0);
|
intf = usb_ifnum_to_if(udev, 0);
|
||||||
if (intf)
|
if (intf)
|
||||||
idesc = usb_altnum_to_altsetting(intf, pdev->valternate);
|
idesc = usb_altnum_to_altsetting(intf, pdev->valternate);
|
||||||
|
|
||||||
if (!idesc)
|
if (!idesc)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
@ -841,7 +841,7 @@ static int pwc_isoc_init(struct pwc_device *pdev)
|
|||||||
pdev->vmax_packet_size = le16_to_cpu(idesc->endpoint[i].desc.wMaxPacketSize);
|
pdev->vmax_packet_size = le16_to_cpu(idesc->endpoint[i].desc.wMaxPacketSize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) {
|
if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) {
|
||||||
Err("Failed to find packet size for video endpoint in current alternate setting.\n");
|
Err("Failed to find packet size for video endpoint in current alternate setting.\n");
|
||||||
return -ENFILE; /* Odd error, that should be noticeable */
|
return -ENFILE; /* Odd error, that should be noticeable */
|
||||||
@ -875,18 +875,18 @@ static int pwc_isoc_init(struct pwc_device *pdev)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* init URB structure */
|
/* init URB structure */
|
||||||
for (i = 0; i < MAX_ISO_BUFS; i++) {
|
for (i = 0; i < MAX_ISO_BUFS; i++) {
|
||||||
urb = pdev->sbuf[i].urb;
|
urb = pdev->sbuf[i].urb;
|
||||||
|
|
||||||
urb->interval = 1; // devik
|
urb->interval = 1; // devik
|
||||||
urb->dev = udev;
|
urb->dev = udev;
|
||||||
urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint);
|
urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint);
|
||||||
urb->transfer_flags = URB_ISO_ASAP;
|
urb->transfer_flags = URB_ISO_ASAP;
|
||||||
urb->transfer_buffer = pdev->sbuf[i].data;
|
urb->transfer_buffer = pdev->sbuf[i].data;
|
||||||
urb->transfer_buffer_length = ISO_BUFFER_SIZE;
|
urb->transfer_buffer_length = ISO_BUFFER_SIZE;
|
||||||
urb->complete = pwc_isoc_handler;
|
urb->complete = pwc_isoc_handler;
|
||||||
urb->context = pdev;
|
urb->context = pdev;
|
||||||
urb->start_frame = 0;
|
urb->start_frame = 0;
|
||||||
urb->number_of_packets = ISO_FRAMES_PER_DESC;
|
urb->number_of_packets = ISO_FRAMES_PER_DESC;
|
||||||
for (j = 0; j < ISO_FRAMES_PER_DESC; j++) {
|
for (j = 0; j < ISO_FRAMES_PER_DESC; j++) {
|
||||||
@ -935,7 +935,7 @@ static void pwc_isoc_cleanup(struct pwc_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Stop camera, but only if we are sure the camera is still there (unplug
|
/* Stop camera, but only if we are sure the camera is still there (unplug
|
||||||
is signalled by EPIPE)
|
is signalled by EPIPE)
|
||||||
*/
|
*/
|
||||||
if (pdev->error_status && pdev->error_status != EPIPE) {
|
if (pdev->error_status && pdev->error_status != EPIPE) {
|
||||||
Trace(TRACE_OPEN, "Setting alternate interface 0.\n");
|
Trace(TRACE_OPEN, "Setting alternate interface 0.\n");
|
||||||
@ -956,12 +956,12 @@ int pwc_try_video_mode(struct pwc_device *pdev, int width, int height, int new_f
|
|||||||
pwc_reset_buffers(pdev);
|
pwc_reset_buffers(pdev);
|
||||||
/* Try to set video mode... */
|
/* Try to set video mode... */
|
||||||
start = ret = pwc_set_video_mode(pdev, width, height, new_fps, new_compression, new_snapshot);
|
start = ret = pwc_set_video_mode(pdev, width, height, new_fps, new_compression, new_snapshot);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
Trace(TRACE_FLOW, "pwc_set_video_mode attempt 1 failed.\n");
|
Trace(TRACE_FLOW, "pwc_set_video_mode attempt 1 failed.\n");
|
||||||
/* That failed... restore old mode (we know that worked) */
|
/* That failed... restore old mode (we know that worked) */
|
||||||
start = pwc_set_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, pdev->vcompression, pdev->vsnapshot);
|
start = pwc_set_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, pdev->vcompression, pdev->vsnapshot);
|
||||||
if (start) {
|
if (start) {
|
||||||
Trace(TRACE_FLOW, "pwc_set_video_mode attempt 2 failed.\n");
|
Trace(TRACE_FLOW, "pwc_set_video_mode attempt 2 failed.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (start == 0)
|
if (start == 0)
|
||||||
@ -987,18 +987,18 @@ static int pwc_video_open(struct inode *inode, struct file *file)
|
|||||||
struct pwc_device *pdev;
|
struct pwc_device *pdev;
|
||||||
|
|
||||||
Trace(TRACE_OPEN, ">> video_open called(vdev = 0x%p).\n", vdev);
|
Trace(TRACE_OPEN, ">> video_open called(vdev = 0x%p).\n", vdev);
|
||||||
|
|
||||||
pdev = (struct pwc_device *)vdev->priv;
|
pdev = (struct pwc_device *)vdev->priv;
|
||||||
if (pdev == NULL)
|
if (pdev == NULL)
|
||||||
BUG();
|
BUG();
|
||||||
if (pdev->vopen)
|
if (pdev->vopen)
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
down(&pdev->modlock);
|
down(&pdev->modlock);
|
||||||
if (!pdev->usb_init) {
|
if (!pdev->usb_init) {
|
||||||
Trace(TRACE_OPEN, "Doing first time initialization.\n");
|
Trace(TRACE_OPEN, "Doing first time initialization.\n");
|
||||||
pdev->usb_init = 1;
|
pdev->usb_init = 1;
|
||||||
|
|
||||||
if (pwc_trace & TRACE_OPEN)
|
if (pwc_trace & TRACE_OPEN)
|
||||||
{
|
{
|
||||||
/* Query sensor type */
|
/* Query sensor type */
|
||||||
@ -1036,7 +1036,7 @@ static int pwc_video_open(struct inode *inode, struct file *file)
|
|||||||
/* Set LED on/off time */
|
/* Set LED on/off time */
|
||||||
if (pwc_set_leds(pdev, led_on, led_off) < 0)
|
if (pwc_set_leds(pdev, led_on, led_off) < 0)
|
||||||
Info("Failed to set LED on/off time.\n");
|
Info("Failed to set LED on/off time.\n");
|
||||||
|
|
||||||
pwc_construct(pdev); /* set min/max sizes correct */
|
pwc_construct(pdev); /* set min/max sizes correct */
|
||||||
|
|
||||||
/* So far, so good. Allocate memory. */
|
/* So far, so good. Allocate memory. */
|
||||||
@ -1046,7 +1046,7 @@ static int pwc_video_open(struct inode *inode, struct file *file)
|
|||||||
up(&pdev->modlock);
|
up(&pdev->modlock);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset buffers & parameters */
|
/* Reset buffers & parameters */
|
||||||
pwc_reset_buffers(pdev);
|
pwc_reset_buffers(pdev);
|
||||||
for (i = 0; i < default_mbufs; i++)
|
for (i = 0; i < default_mbufs; i++)
|
||||||
@ -1081,7 +1081,7 @@ static int pwc_video_open(struct inode *inode, struct file *file)
|
|||||||
up(&pdev->modlock);
|
up(&pdev->modlock);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = pwc_isoc_init(pdev);
|
i = pwc_isoc_init(pdev);
|
||||||
if (i) {
|
if (i) {
|
||||||
Trace(TRACE_OPEN, "Failed to init ISOC stuff = %d.\n", i);
|
Trace(TRACE_OPEN, "Failed to init ISOC stuff = %d.\n", i);
|
||||||
@ -1155,13 +1155,13 @@ static int pwc_video_close(struct inode *inode, struct file *file)
|
|||||||
/*
|
/*
|
||||||
* FIXME: what about two parallel reads ????
|
* FIXME: what about two parallel reads ????
|
||||||
* ANSWER: Not supported. You can't open the device more than once,
|
* ANSWER: Not supported. You can't open the device more than once,
|
||||||
despite what the V4L1 interface says. First, I don't see
|
despite what the V4L1 interface says. First, I don't see
|
||||||
the need, second there's no mechanism of alerting the
|
the need, second there's no mechanism of alerting the
|
||||||
2nd/3rd/... process of events like changing image size.
|
2nd/3rd/... process of events like changing image size.
|
||||||
And I don't see the point of blocking that for the
|
And I don't see the point of blocking that for the
|
||||||
2nd/3rd/... process.
|
2nd/3rd/... process.
|
||||||
In multi-threaded environments reading parallel from any
|
In multi-threaded environments reading parallel from any
|
||||||
device is tricky anyhow.
|
device is tricky anyhow.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static ssize_t pwc_video_read(struct file *file, char __user * buf,
|
static ssize_t pwc_video_read(struct file *file, char __user * buf,
|
||||||
@ -1171,7 +1171,7 @@ static ssize_t pwc_video_read(struct file *file, char __user * buf,
|
|||||||
struct pwc_device *pdev;
|
struct pwc_device *pdev;
|
||||||
int noblock = file->f_flags & O_NONBLOCK;
|
int noblock = file->f_flags & O_NONBLOCK;
|
||||||
DECLARE_WAITQUEUE(wait, current);
|
DECLARE_WAITQUEUE(wait, current);
|
||||||
int bytes_to_read;
|
int bytes_to_read;
|
||||||
|
|
||||||
Trace(TRACE_READ, "video_read(0x%p, %p, %zu) called.\n", vdev, buf, count);
|
Trace(TRACE_READ, "video_read(0x%p, %p, %zu) called.\n", vdev, buf, count);
|
||||||
if (vdev == NULL)
|
if (vdev == NULL)
|
||||||
@ -1193,22 +1193,22 @@ static ssize_t pwc_video_read(struct file *file, char __user * buf,
|
|||||||
set_current_state(TASK_RUNNING);
|
set_current_state(TASK_RUNNING);
|
||||||
return -pdev->error_status ;
|
return -pdev->error_status ;
|
||||||
}
|
}
|
||||||
if (noblock) {
|
if (noblock) {
|
||||||
remove_wait_queue(&pdev->frameq, &wait);
|
remove_wait_queue(&pdev->frameq, &wait);
|
||||||
set_current_state(TASK_RUNNING);
|
set_current_state(TASK_RUNNING);
|
||||||
return -EWOULDBLOCK;
|
return -EWOULDBLOCK;
|
||||||
}
|
}
|
||||||
if (signal_pending(current)) {
|
if (signal_pending(current)) {
|
||||||
remove_wait_queue(&pdev->frameq, &wait);
|
remove_wait_queue(&pdev->frameq, &wait);
|
||||||
set_current_state(TASK_RUNNING);
|
set_current_state(TASK_RUNNING);
|
||||||
return -ERESTARTSYS;
|
return -ERESTARTSYS;
|
||||||
}
|
}
|
||||||
schedule();
|
schedule();
|
||||||
set_current_state(TASK_INTERRUPTIBLE);
|
set_current_state(TASK_INTERRUPTIBLE);
|
||||||
}
|
}
|
||||||
remove_wait_queue(&pdev->frameq, &wait);
|
remove_wait_queue(&pdev->frameq, &wait);
|
||||||
set_current_state(TASK_RUNNING);
|
set_current_state(TASK_RUNNING);
|
||||||
|
|
||||||
/* Decompress and release frame */
|
/* Decompress and release frame */
|
||||||
if (pwc_handle_frame(pdev))
|
if (pwc_handle_frame(pdev))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
@ -1218,7 +1218,7 @@ static ssize_t pwc_video_read(struct file *file, char __user * buf,
|
|||||||
if (pdev->vpalette == VIDEO_PALETTE_RAW)
|
if (pdev->vpalette == VIDEO_PALETTE_RAW)
|
||||||
bytes_to_read = pdev->frame_size;
|
bytes_to_read = pdev->frame_size;
|
||||||
else
|
else
|
||||||
bytes_to_read = pdev->view.size;
|
bytes_to_read = pdev->view.size;
|
||||||
|
|
||||||
/* copy bytes to user space; we allow for partial reads */
|
/* copy bytes to user space; we allow for partial reads */
|
||||||
if (count + pdev->image_read_pos > bytes_to_read)
|
if (count + pdev->image_read_pos > bytes_to_read)
|
||||||
@ -1348,11 +1348,11 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
struct video_picture *p = arg;
|
struct video_picture *p = arg;
|
||||||
/*
|
/*
|
||||||
* FIXME: Suppose we are mid read
|
* FIXME: Suppose we are mid read
|
||||||
ANSWER: No problem: the firmware of the camera
|
ANSWER: No problem: the firmware of the camera
|
||||||
can handle brightness/contrast/etc
|
can handle brightness/contrast/etc
|
||||||
changes at _any_ time, and the palette
|
changes at _any_ time, and the palette
|
||||||
is used exactly once in the uncompress
|
is used exactly once in the uncompress
|
||||||
routine.
|
routine.
|
||||||
*/
|
*/
|
||||||
pwc_set_brightness(pdev, p->brightness);
|
pwc_set_brightness(pdev, p->brightness);
|
||||||
pwc_set_contrast(pdev, p->contrast);
|
pwc_set_contrast(pdev, p->contrast);
|
||||||
@ -1373,21 +1373,21 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Window/size parameters */
|
/* Window/size parameters */
|
||||||
case VIDIOCGWIN:
|
case VIDIOCGWIN:
|
||||||
{
|
{
|
||||||
struct video_window *vw = arg;
|
struct video_window *vw = arg;
|
||||||
|
|
||||||
vw->x = 0;
|
vw->x = 0;
|
||||||
vw->y = 0;
|
vw->y = 0;
|
||||||
vw->width = pdev->view.x;
|
vw->width = pdev->view.x;
|
||||||
vw->height = pdev->view.y;
|
vw->height = pdev->view.y;
|
||||||
vw->chromakey = 0;
|
vw->chromakey = 0;
|
||||||
vw->flags = (pdev->vframes << PWC_FPS_SHIFT) |
|
vw->flags = (pdev->vframes << PWC_FPS_SHIFT) |
|
||||||
(pdev->vsnapshot ? PWC_FPS_SNAPSHOT : 0);
|
(pdev->vsnapshot ? PWC_FPS_SNAPSHOT : 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCSWIN:
|
case VIDIOCSWIN:
|
||||||
{
|
{
|
||||||
struct video_window *vw = arg;
|
struct video_window *vw = arg;
|
||||||
@ -1402,9 +1402,9 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
ret = pwc_try_video_mode(pdev, vw->width, vw->height, fps, pdev->vcompression, snapshot);
|
ret = pwc_try_video_mode(pdev, vw->width, vw->height, fps, pdev->vcompression, snapshot);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We don't have overlay support (yet) */
|
/* We don't have overlay support (yet) */
|
||||||
case VIDIOCGFBUF:
|
case VIDIOCGFBUF:
|
||||||
{
|
{
|
||||||
@ -1471,8 +1471,8 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return -EBUSY; /* buffer wasn't available. Bummer */
|
return -EBUSY; /* buffer wasn't available. Bummer */
|
||||||
pdev->image_used[vm->frame] = 1;
|
pdev->image_used[vm->frame] = 1;
|
||||||
|
|
||||||
/* Okay, we're done here. In the SYNC call we wait until a
|
/* Okay, we're done here. In the SYNC call we wait until a
|
||||||
frame comes available, then expand image into the given
|
frame comes available, then expand image into the given
|
||||||
buffer.
|
buffer.
|
||||||
In contrast to the CPiA cam the Philips cams deliver a
|
In contrast to the CPiA cam the Philips cams deliver a
|
||||||
constant stream, almost like a grabber card. Also,
|
constant stream, almost like a grabber card. Also,
|
||||||
@ -1487,16 +1487,16 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
{
|
{
|
||||||
/* The doc says: "Whenever a buffer is used it should
|
/* The doc says: "Whenever a buffer is used it should
|
||||||
call VIDIOCSYNC to free this frame up and continue."
|
call VIDIOCSYNC to free this frame up and continue."
|
||||||
|
|
||||||
The only odd thing about this whole procedure is
|
The only odd thing about this whole procedure is
|
||||||
that MCAPTURE flags the buffer as "in use", and
|
that MCAPTURE flags the buffer as "in use", and
|
||||||
SYNC immediately unmarks it, while it isn't
|
SYNC immediately unmarks it, while it isn't
|
||||||
after SYNC that you know that the buffer actually
|
after SYNC that you know that the buffer actually
|
||||||
got filled! So you better not start a CAPTURE in
|
got filled! So you better not start a CAPTURE in
|
||||||
the same frame immediately (use double buffering).
|
the same frame immediately (use double buffering).
|
||||||
This is not a problem for this cam, since it has
|
This is not a problem for this cam, since it has
|
||||||
extra intermediate buffers, but a hardware
|
extra intermediate buffers, but a hardware
|
||||||
grabber card will then overwrite the buffer
|
grabber card will then overwrite the buffer
|
||||||
you're working on.
|
you're working on.
|
||||||
*/
|
*/
|
||||||
int *mbuf = arg;
|
int *mbuf = arg;
|
||||||
@ -1512,10 +1512,10 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* Add ourselves to the frame wait-queue.
|
/* Add ourselves to the frame wait-queue.
|
||||||
|
|
||||||
FIXME: needs auditing for safety.
|
FIXME: needs auditing for safety.
|
||||||
QUESTION: In what respect? I think that using the
|
QUESTION: In what respect? I think that using the
|
||||||
frameq is safe now.
|
frameq is safe now.
|
||||||
*/
|
*/
|
||||||
add_wait_queue(&pdev->frameq, &wait);
|
add_wait_queue(&pdev->frameq, &wait);
|
||||||
while (pdev->full_frames == NULL) {
|
while (pdev->full_frames == NULL) {
|
||||||
@ -1524,21 +1524,21 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
set_current_state(TASK_RUNNING);
|
set_current_state(TASK_RUNNING);
|
||||||
return -pdev->error_status;
|
return -pdev->error_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (signal_pending(current)) {
|
if (signal_pending(current)) {
|
||||||
remove_wait_queue(&pdev->frameq, &wait);
|
remove_wait_queue(&pdev->frameq, &wait);
|
||||||
set_current_state(TASK_RUNNING);
|
set_current_state(TASK_RUNNING);
|
||||||
return -ERESTARTSYS;
|
return -ERESTARTSYS;
|
||||||
}
|
}
|
||||||
schedule();
|
schedule();
|
||||||
set_current_state(TASK_INTERRUPTIBLE);
|
set_current_state(TASK_INTERRUPTIBLE);
|
||||||
}
|
}
|
||||||
remove_wait_queue(&pdev->frameq, &wait);
|
remove_wait_queue(&pdev->frameq, &wait);
|
||||||
set_current_state(TASK_RUNNING);
|
set_current_state(TASK_RUNNING);
|
||||||
|
|
||||||
/* The frame is ready. Expand in the image buffer
|
/* The frame is ready. Expand in the image buffer
|
||||||
requested by the user. I don't care if you
|
requested by the user. I don't care if you
|
||||||
mmap() 5 buffers and request data in this order:
|
mmap() 5 buffers and request data in this order:
|
||||||
buffer 4 2 3 0 1 2 3 0 4 3 1 . . .
|
buffer 4 2 3 0 1 2 3 0 4 3 1 . . .
|
||||||
Grabber hardware may not be so forgiving.
|
Grabber hardware may not be so forgiving.
|
||||||
*/
|
*/
|
||||||
@ -1551,11 +1551,11 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCGAUDIO:
|
case VIDIOCGAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
|
|
||||||
strcpy(v->name, "Microphone");
|
strcpy(v->name, "Microphone");
|
||||||
v->audio = -1; /* unknown audio minor */
|
v->audio = -1; /* unknown audio minor */
|
||||||
v->flags = 0;
|
v->flags = 0;
|
||||||
@ -1565,19 +1565,19 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
v->treble = 0;
|
v->treble = 0;
|
||||||
v->balance = 0x8000;
|
v->balance = 0x8000;
|
||||||
v->step = 1;
|
v->step = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCSAUDIO:
|
case VIDIOCSAUDIO:
|
||||||
{
|
{
|
||||||
/* Dummy: nothing can be set */
|
/* Dummy: nothing can be set */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCGUNIT:
|
case VIDIOCGUNIT:
|
||||||
{
|
{
|
||||||
struct video_unit *vu = arg;
|
struct video_unit *vu = arg;
|
||||||
|
|
||||||
vu->video = pdev->vdev->minor & 0x3F;
|
vu->video = pdev->vdev->minor & 0x3F;
|
||||||
vu->audio = -1; /* not known yet */
|
vu->audio = -1; /* not known yet */
|
||||||
vu->vbi = -1;
|
vu->vbi = -1;
|
||||||
@ -1589,7 +1589,7 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return pwc_ioctl(pdev, cmd, arg);
|
return pwc_ioctl(pdev, cmd, arg);
|
||||||
} /* ..switch */
|
} /* ..switch */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pwc_video_ioctl(struct inode *inode, struct file *file,
|
static int pwc_video_ioctl(struct inode *inode, struct file *file,
|
||||||
unsigned int cmd, unsigned long arg)
|
unsigned int cmd, unsigned long arg)
|
||||||
@ -1605,10 +1605,10 @@ static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma)
|
|||||||
unsigned long start = vma->vm_start;
|
unsigned long start = vma->vm_start;
|
||||||
unsigned long size = vma->vm_end-vma->vm_start;
|
unsigned long size = vma->vm_end-vma->vm_start;
|
||||||
unsigned long page, pos;
|
unsigned long page, pos;
|
||||||
|
|
||||||
Trace(TRACE_MEMORY, "mmap(0x%p, 0x%lx, %lu) called.\n", vdev, start, size);
|
Trace(TRACE_MEMORY, "mmap(0x%p, 0x%lx, %lu) called.\n", vdev, start, size);
|
||||||
pdev = vdev->priv;
|
pdev = vdev->priv;
|
||||||
|
|
||||||
vma->vm_flags |= VM_IO;
|
vma->vm_flags |= VM_IO;
|
||||||
|
|
||||||
pos = (unsigned long)pdev->image_data;
|
pos = (unsigned long)pdev->image_data;
|
||||||
@ -1646,7 +1646,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
|
|||||||
char serial_number[30], *name;
|
char serial_number[30], *name;
|
||||||
|
|
||||||
/* Check if we can handle this device */
|
/* Check if we can handle this device */
|
||||||
Trace(TRACE_PROBE, "probe() called [%04X %04X], if %d\n",
|
Trace(TRACE_PROBE, "probe() called [%04X %04X], if %d\n",
|
||||||
le16_to_cpu(udev->descriptor.idVendor),
|
le16_to_cpu(udev->descriptor.idVendor),
|
||||||
le16_to_cpu(udev->descriptor.idProduct),
|
le16_to_cpu(udev->descriptor.idProduct),
|
||||||
intf->altsetting->desc.bInterfaceNumber);
|
intf->altsetting->desc.bInterfaceNumber);
|
||||||
@ -1770,11 +1770,11 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
|
|||||||
name = "Logitech QuickCam (res.)";
|
name = "Logitech QuickCam (res.)";
|
||||||
type_id = 730; /* Assuming CMOS */
|
type_id = 730; /* Assuming CMOS */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (vendor_id == 0x055d) {
|
else if (vendor_id == 0x055d) {
|
||||||
/* I don't know the difference between the C10 and the C30;
|
/* I don't know the difference between the C10 and the C30;
|
||||||
I suppose the difference is the sensor, but both cameras
|
I suppose the difference is the sensor, but both cameras
|
||||||
@ -1837,7 +1837,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (vendor_id == 0x0d81) {
|
else if (vendor_id == 0x0d81) {
|
||||||
switch(product_id) {
|
switch(product_id) {
|
||||||
@ -1856,7 +1856,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return -ENODEV; /* Not any of the know types; but the list keeps growing. */
|
return -ENODEV; /* Not any of the know types; but the list keeps growing. */
|
||||||
|
|
||||||
memset(serial_number, 0, 30);
|
memset(serial_number, 0, 30);
|
||||||
@ -1880,9 +1880,9 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
|
|||||||
if (vendor_id == 0x046D && product_id == 0x08B5)
|
if (vendor_id == 0x046D && product_id == 0x08B5)
|
||||||
{
|
{
|
||||||
/* Logitech QuickCam Orbit
|
/* Logitech QuickCam Orbit
|
||||||
The ranges have been determined experimentally; they may differ from cam to cam.
|
The ranges have been determined experimentally; they may differ from cam to cam.
|
||||||
Also, the exact ranges left-right and up-down are different for my cam
|
Also, the exact ranges left-right and up-down are different for my cam
|
||||||
*/
|
*/
|
||||||
pdev->angle_range.pan_min = -7000;
|
pdev->angle_range.pan_min = -7000;
|
||||||
pdev->angle_range.pan_max = 7000;
|
pdev->angle_range.pan_max = 7000;
|
||||||
pdev->angle_range.tilt_min = -3000;
|
pdev->angle_range.tilt_min = -3000;
|
||||||
@ -1939,7 +1939,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* occupy slot */
|
/* occupy slot */
|
||||||
if (hint < MAX_DEV_HINTS)
|
if (hint < MAX_DEV_HINTS)
|
||||||
device_hint[hint].pdev = pdev;
|
device_hint[hint].pdev = pdev;
|
||||||
|
|
||||||
Trace(TRACE_PROBE, "probe() function returning struct at 0x%p.\n", pdev);
|
Trace(TRACE_PROBE, "probe() function returning struct at 0x%p.\n", pdev);
|
||||||
@ -1968,13 +1968,13 @@ static void usb_pwc_disconnect(struct usb_interface *intf)
|
|||||||
Err("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n");
|
Err("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n");
|
||||||
goto disconnect_out;
|
goto disconnect_out;
|
||||||
}
|
}
|
||||||
#ifdef PWC_MAGIC
|
#ifdef PWC_MAGIC
|
||||||
if (pdev->magic != PWC_MAGIC) {
|
if (pdev->magic != PWC_MAGIC) {
|
||||||
Err("pwc_disconnect() Magic number failed. Consult your scrolls and try again.\n");
|
Err("pwc_disconnect() Magic number failed. Consult your scrolls and try again.\n");
|
||||||
goto disconnect_out;
|
goto disconnect_out;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* We got unplugged; this is signalled by an EPIPE error code */
|
/* We got unplugged; this is signalled by an EPIPE error code */
|
||||||
if (pdev->vopen) {
|
if (pdev->vopen) {
|
||||||
Info("Disconnected while webcam is in use!\n");
|
Info("Disconnected while webcam is in use!\n");
|
||||||
@ -2017,8 +2017,8 @@ static int pwc_atoi(const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialization code & module stuff
|
* Initialization code & module stuff
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char size[10];
|
static char size[10];
|
||||||
@ -2168,7 +2168,7 @@ static int __init usb_pwc_init(void)
|
|||||||
if (*dot != '\0') {
|
if (*dot != '\0') {
|
||||||
/* There's a serial number as well */
|
/* There's a serial number as well */
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
dot++;
|
dot++;
|
||||||
k = 0;
|
k = 0;
|
||||||
while (*dot != ':' && k < 29) {
|
while (*dot != ':' && k < 29) {
|
||||||
@ -2178,18 +2178,18 @@ static int __init usb_pwc_init(void)
|
|||||||
device_hint[i].serial_number[k] = '\0';
|
device_hint[i].serial_number[k] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if PWC_DEBUG
|
#if PWC_DEBUG
|
||||||
Debug("device_hint[%d]:\n", i);
|
Debug("device_hint[%d]:\n", i);
|
||||||
Debug(" type : %d\n", device_hint[i].type);
|
Debug(" type : %d\n", device_hint[i].type);
|
||||||
Debug(" serial# : %s\n", device_hint[i].serial_number);
|
Debug(" serial# : %s\n", device_hint[i].serial_number);
|
||||||
Debug(" node : %d\n", device_hint[i].device_node);
|
Debug(" node : %d\n", device_hint[i].device_node);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
device_hint[i].type = 0; /* not filled */
|
device_hint[i].type = 0; /* not filled */
|
||||||
} /* ..for MAX_DEV_HINTS */
|
} /* ..for MAX_DEV_HINTS */
|
||||||
|
|
||||||
Trace(TRACE_PROBE, "Registering driver at address 0x%p.\n", &pwc_driver);
|
Trace(TRACE_PROBE, "Registering driver at address 0x%p.\n", &pwc_driver);
|
||||||
return usb_register(&pwc_driver);
|
return usb_register(&pwc_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,10 +33,10 @@
|
|||||||
/*
|
/*
|
||||||
Changes
|
Changes
|
||||||
2001/08/03 Alvarado Added ioctl constants to access methods for
|
2001/08/03 Alvarado Added ioctl constants to access methods for
|
||||||
changing white balance and red/blue gains
|
changing white balance and red/blue gains
|
||||||
2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE
|
2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE
|
||||||
2003/12/13 Nemosft Unv. Some modifications to make interfacing to
|
2003/12/13 Nemosft Unv. Some modifications to make interfacing to
|
||||||
PWCX easier
|
PWCX easier
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* These are private ioctl() commands, specific for the Philips webcams.
|
/* These are private ioctl() commands, specific for the Philips webcams.
|
||||||
@ -45,10 +45,10 @@
|
|||||||
|
|
||||||
The #define names are built up like follows:
|
The #define names are built up like follows:
|
||||||
VIDIOC VIDeo IOCtl prefix
|
VIDIOC VIDeo IOCtl prefix
|
||||||
PWC Philps WebCam
|
PWC Philps WebCam
|
||||||
G optional: Get
|
G optional: Get
|
||||||
S optional: Set
|
S optional: Set
|
||||||
... the function
|
... the function
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ struct pwc_serial
|
|||||||
{
|
{
|
||||||
char serial[30]; /* String with serial number. Contains terminating 0 */
|
char serial[30]; /* String with serial number. Contains terminating 0 */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* pwc_whitebalance.mode values */
|
/* pwc_whitebalance.mode values */
|
||||||
#define PWC_WB_INDOOR 0
|
#define PWC_WB_INDOOR 0
|
||||||
#define PWC_WB_OUTDOOR 1
|
#define PWC_WB_OUTDOOR 1
|
||||||
@ -102,14 +102,14 @@ struct pwc_serial
|
|||||||
#define PWC_WB_MANUAL 3
|
#define PWC_WB_MANUAL 3
|
||||||
#define PWC_WB_AUTO 4
|
#define PWC_WB_AUTO 4
|
||||||
|
|
||||||
/* Used with VIDIOCPWC[SG]AWB (Auto White Balance).
|
/* Used with VIDIOCPWC[SG]AWB (Auto White Balance).
|
||||||
Set mode to one of the PWC_WB_* values above.
|
Set mode to one of the PWC_WB_* values above.
|
||||||
*red and *blue are the respective gains of these colour components inside
|
*red and *blue are the respective gains of these colour components inside
|
||||||
the camera; range 0..65535
|
the camera; range 0..65535
|
||||||
When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read;
|
When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read;
|
||||||
otherwise undefined.
|
otherwise undefined.
|
||||||
'read_red' and 'read_blue' are read-only.
|
'read_red' and 'read_blue' are read-only.
|
||||||
*/
|
*/
|
||||||
struct pwc_whitebalance
|
struct pwc_whitebalance
|
||||||
{
|
{
|
||||||
int mode;
|
int mode;
|
||||||
@ -117,9 +117,9 @@ struct pwc_whitebalance
|
|||||||
int read_red, read_blue; /* R/O */
|
int read_red, read_blue; /* R/O */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
'control_speed' and 'control_delay' are used in automatic whitebalance mode,
|
'control_speed' and 'control_delay' are used in automatic whitebalance mode,
|
||||||
and tell the camera how fast it should react to changes in lighting, and
|
and tell the camera how fast it should react to changes in lighting, and
|
||||||
with how much delay. Valid values are 0..65535.
|
with how much delay. Valid values are 0..65535.
|
||||||
*/
|
*/
|
||||||
struct pwc_wb_speed
|
struct pwc_wb_speed
|
||||||
@ -148,11 +148,11 @@ struct pwc_imagesize
|
|||||||
#define PWC_MPT_TILT 0x02
|
#define PWC_MPT_TILT 0x02
|
||||||
#define PWC_MPT_TIMEOUT 0x04 /* for status */
|
#define PWC_MPT_TIMEOUT 0x04 /* for status */
|
||||||
|
|
||||||
/* Set angles; when absolute != 0, the angle is absolute and the
|
/* Set angles; when absolute != 0, the angle is absolute and the
|
||||||
driver calculates the relative offset for you. This can only
|
driver calculates the relative offset for you. This can only
|
||||||
be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns
|
be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns
|
||||||
absolute angles.
|
absolute angles.
|
||||||
*/
|
*/
|
||||||
struct pwc_mpt_angles
|
struct pwc_mpt_angles
|
||||||
{
|
{
|
||||||
int absolute; /* write-only */
|
int absolute; /* write-only */
|
||||||
@ -179,14 +179,14 @@ struct pwc_mpt_status
|
|||||||
/* This is used for out-of-kernel decompression. With it, you can get
|
/* This is used for out-of-kernel decompression. With it, you can get
|
||||||
all the necessary information to initialize and use the decompressor
|
all the necessary information to initialize and use the decompressor
|
||||||
routines in standalone applications.
|
routines in standalone applications.
|
||||||
*/
|
*/
|
||||||
struct pwc_video_command
|
struct pwc_video_command
|
||||||
{
|
{
|
||||||
int type; /* camera type (645, 675, 730, etc.) */
|
int type; /* camera type (645, 675, 730, etc.) */
|
||||||
int release; /* release number */
|
int release; /* release number */
|
||||||
|
|
||||||
int size; /* one of PSZ_* */
|
int size; /* one of PSZ_* */
|
||||||
int alternate;
|
int alternate;
|
||||||
int command_len; /* length of USB video command */
|
int command_len; /* length of USB video command */
|
||||||
unsigned char command_buf[13]; /* Actual USB video command */
|
unsigned char command_buf[13]; /* Actual USB video command */
|
||||||
int bandlength; /* >0 = compressed */
|
int bandlength; /* >0 = compressed */
|
||||||
@ -264,7 +264,7 @@ struct pwc_video_command
|
|||||||
|
|
||||||
/* Flickerless mode; = 0 off, otherwise on */
|
/* Flickerless mode; = 0 off, otherwise on */
|
||||||
#define VIDIOCPWCSFLICKER _IOW('v', 208, int)
|
#define VIDIOCPWCSFLICKER _IOW('v', 208, int)
|
||||||
#define VIDIOCPWCGFLICKER _IOR('v', 208, int)
|
#define VIDIOCPWCGFLICKER _IOR('v', 208, int)
|
||||||
|
|
||||||
/* Dynamic noise reduction; 0 off, 3 = high noise reduction */
|
/* Dynamic noise reduction; 0 off, 3 = high noise reduction */
|
||||||
#define VIDIOCPWCSDYNNOISE _IOW('v', 209, int)
|
#define VIDIOCPWCSDYNNOISE _IOW('v', 209, int)
|
||||||
@ -273,7 +273,7 @@ struct pwc_video_command
|
|||||||
/* Real image size as used by the camera; tells you whether or not there's a gray border around the image */
|
/* Real image size as used by the camera; tells you whether or not there's a gray border around the image */
|
||||||
#define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize)
|
#define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize)
|
||||||
|
|
||||||
/* Motorized pan & tilt functions */
|
/* Motorized pan & tilt functions */
|
||||||
#define VIDIOCPWCMPTRESET _IOW('v', 211, int)
|
#define VIDIOCPWCMPTRESET _IOW('v', 211, int)
|
||||||
#define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range)
|
#define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range)
|
||||||
#define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles)
|
#define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles)
|
||||||
|
@ -48,270 +48,270 @@ const struct Kiara_table_entry Kiara_table[PSZ_MAX][6][4] =
|
|||||||
{
|
{
|
||||||
/* 5 fps */
|
/* 5 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 10 fps */
|
/* 10 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 15 fps */
|
/* 15 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 20 fps */
|
/* 20 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 25 fps */
|
/* 25 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 30 fps */
|
/* 30 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/* QSIF */
|
/* QSIF */
|
||||||
{
|
{
|
||||||
/* 5 fps */
|
/* 5 fps */
|
||||||
{
|
{
|
||||||
{1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
|
{1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
|
||||||
{1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
|
{1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
|
||||||
{1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
|
{1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
|
||||||
{1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
|
{1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
|
||||||
},
|
},
|
||||||
/* 10 fps */
|
/* 10 fps */
|
||||||
{
|
{
|
||||||
{2, 291, 0, {0x1C, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0x01, 0x80}},
|
{2, 291, 0, {0x1C, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0x01, 0x80}},
|
||||||
{1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},
|
{1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},
|
||||||
{1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},
|
{1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},
|
||||||
{1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},
|
{1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},
|
||||||
},
|
},
|
||||||
/* 15 fps */
|
/* 15 fps */
|
||||||
{
|
{
|
||||||
{3, 437, 0, {0x1B, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x01, 0x80}},
|
{3, 437, 0, {0x1B, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x01, 0x80}},
|
||||||
{2, 292, 640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}},
|
{2, 292, 640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}},
|
||||||
{2, 292, 640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}},
|
{2, 292, 640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}},
|
||||||
{1, 192, 420, {0x13, 0xF4, 0x30, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x18, 0xC0, 0x00, 0x80}},
|
{1, 192, 420, {0x13, 0xF4, 0x30, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x18, 0xC0, 0x00, 0x80}},
|
||||||
},
|
},
|
||||||
/* 20 fps */
|
/* 20 fps */
|
||||||
{
|
{
|
||||||
{4, 589, 0, {0x1A, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4D, 0x02, 0x80}},
|
{4, 589, 0, {0x1A, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4D, 0x02, 0x80}},
|
||||||
{3, 448, 730, {0x12, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xC0, 0x01, 0x80}},
|
{3, 448, 730, {0x12, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xC0, 0x01, 0x80}},
|
||||||
{2, 292, 476, {0x12, 0xF4, 0x30, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0x01, 0x80}},
|
{2, 292, 476, {0x12, 0xF4, 0x30, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0x01, 0x80}},
|
||||||
{1, 192, 312, {0x12, 0xF4, 0x50, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0x00, 0x80}},
|
{1, 192, 312, {0x12, 0xF4, 0x50, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0x00, 0x80}},
|
||||||
},
|
},
|
||||||
/* 25 fps */
|
/* 25 fps */
|
||||||
{
|
{
|
||||||
{5, 703, 0, {0x19, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x02, 0x80}},
|
{5, 703, 0, {0x19, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x02, 0x80}},
|
||||||
{3, 447, 610, {0x11, 0xF4, 0x30, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x28, 0xBF, 0x01, 0x80}},
|
{3, 447, 610, {0x11, 0xF4, 0x30, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x28, 0xBF, 0x01, 0x80}},
|
||||||
{2, 292, 398, {0x11, 0xF4, 0x50, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x28, 0x24, 0x01, 0x80}},
|
{2, 292, 398, {0x11, 0xF4, 0x50, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x28, 0x24, 0x01, 0x80}},
|
||||||
{1, 193, 262, {0x11, 0xF4, 0x50, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x28, 0xC1, 0x00, 0x80}},
|
{1, 193, 262, {0x11, 0xF4, 0x50, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x28, 0xC1, 0x00, 0x80}},
|
||||||
},
|
},
|
||||||
/* 30 fps */
|
/* 30 fps */
|
||||||
{
|
{
|
||||||
{8, 874, 0, {0x18, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6A, 0x03, 0x80}},
|
{8, 874, 0, {0x18, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6A, 0x03, 0x80}},
|
||||||
{5, 704, 730, {0x10, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x28, 0xC0, 0x02, 0x80}},
|
{5, 704, 730, {0x10, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x28, 0xC0, 0x02, 0x80}},
|
||||||
{3, 448, 492, {0x10, 0xF4, 0x30, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x28, 0xC0, 0x01, 0x80}},
|
{3, 448, 492, {0x10, 0xF4, 0x30, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x28, 0xC0, 0x01, 0x80}},
|
||||||
{2, 292, 320, {0x10, 0xF4, 0x50, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x28, 0x24, 0x01, 0x80}},
|
{2, 292, 320, {0x10, 0xF4, 0x50, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x28, 0x24, 0x01, 0x80}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/* QCIF */
|
/* QCIF */
|
||||||
{
|
{
|
||||||
/* 5 fps */
|
/* 5 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 10 fps */
|
/* 10 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 15 fps */
|
/* 15 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 20 fps */
|
/* 20 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 25 fps */
|
/* 25 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 30 fps */
|
/* 30 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/* SIF */
|
/* SIF */
|
||||||
{
|
{
|
||||||
/* 5 fps */
|
/* 5 fps */
|
||||||
{
|
{
|
||||||
{4, 582, 0, {0x0D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x02, 0x80}},
|
{4, 582, 0, {0x0D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x02, 0x80}},
|
||||||
{3, 387, 1276, {0x05, 0xF4, 0x30, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x01, 0x80}},
|
{3, 387, 1276, {0x05, 0xF4, 0x30, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x01, 0x80}},
|
||||||
{2, 291, 960, {0x05, 0xF4, 0x30, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0x01, 0x80}},
|
{2, 291, 960, {0x05, 0xF4, 0x30, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0x01, 0x80}},
|
||||||
{1, 191, 630, {0x05, 0xF4, 0x50, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x18, 0xBF, 0x00, 0x80}},
|
{1, 191, 630, {0x05, 0xF4, 0x50, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x18, 0xBF, 0x00, 0x80}},
|
||||||
},
|
},
|
||||||
/* 10 fps */
|
/* 10 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{6, 775, 1278, {0x04, 0xF4, 0x30, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x03, 0x80}},
|
{6, 775, 1278, {0x04, 0xF4, 0x30, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x03, 0x80}},
|
||||||
{3, 447, 736, {0x04, 0xF4, 0x30, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x28, 0xBF, 0x01, 0x80}},
|
{3, 447, 736, {0x04, 0xF4, 0x30, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x28, 0xBF, 0x01, 0x80}},
|
||||||
{2, 292, 480, {0x04, 0xF4, 0x70, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x28, 0x24, 0x01, 0x80}},
|
{2, 292, 480, {0x04, 0xF4, 0x70, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x28, 0x24, 0x01, 0x80}},
|
||||||
},
|
},
|
||||||
/* 15 fps */
|
/* 15 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 955, 1050, {0x03, 0xF4, 0x30, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x03, 0x80}},
|
{9, 955, 1050, {0x03, 0xF4, 0x30, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x03, 0x80}},
|
||||||
{4, 592, 650, {0x03, 0xF4, 0x30, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x50, 0x02, 0x80}},
|
{4, 592, 650, {0x03, 0xF4, 0x30, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x50, 0x02, 0x80}},
|
||||||
{3, 448, 492, {0x03, 0xF4, 0x50, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x38, 0xC0, 0x01, 0x80}},
|
{3, 448, 492, {0x03, 0xF4, 0x50, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x38, 0xC0, 0x01, 0x80}},
|
||||||
},
|
},
|
||||||
/* 20 fps */
|
/* 20 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 958, 782, {0x02, 0xF4, 0x30, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x03, 0x80}},
|
{9, 958, 782, {0x02, 0xF4, 0x30, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x03, 0x80}},
|
||||||
{5, 703, 574, {0x02, 0xF4, 0x50, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x02, 0x80}},
|
{5, 703, 574, {0x02, 0xF4, 0x50, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x02, 0x80}},
|
||||||
{3, 446, 364, {0x02, 0xF4, 0x90, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x38, 0xBE, 0x01, 0x80}},
|
{3, 446, 364, {0x02, 0xF4, 0x90, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x38, 0xBE, 0x01, 0x80}},
|
||||||
},
|
},
|
||||||
/* 25 fps */
|
/* 25 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 958, 654, {0x01, 0xF4, 0x30, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x03, 0x80}},
|
{9, 958, 654, {0x01, 0xF4, 0x30, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x03, 0x80}},
|
||||||
{6, 776, 530, {0x01, 0xF4, 0x50, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x03, 0x80}},
|
{6, 776, 530, {0x01, 0xF4, 0x50, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x03, 0x80}},
|
||||||
{4, 592, 404, {0x01, 0xF4, 0x70, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x48, 0x50, 0x02, 0x80}},
|
{4, 592, 404, {0x01, 0xF4, 0x70, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x48, 0x50, 0x02, 0x80}},
|
||||||
},
|
},
|
||||||
/* 30 fps */
|
/* 30 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 957, 526, {0x00, 0xF4, 0x50, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x03, 0x80}},
|
{9, 957, 526, {0x00, 0xF4, 0x50, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x03, 0x80}},
|
||||||
{6, 775, 426, {0x00, 0xF4, 0x70, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x03, 0x80}},
|
{6, 775, 426, {0x00, 0xF4, 0x70, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x03, 0x80}},
|
||||||
{4, 590, 324, {0x00, 0x7A, 0x88, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x50, 0x4E, 0x02, 0x80}},
|
{4, 590, 324, {0x00, 0x7A, 0x88, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x50, 0x4E, 0x02, 0x80}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/* CIF */
|
/* CIF */
|
||||||
{
|
{
|
||||||
/* 5 fps */
|
/* 5 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 10 fps */
|
/* 10 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 15 fps */
|
/* 15 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 20 fps */
|
/* 20 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 25 fps */
|
/* 25 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 30 fps */
|
/* 30 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/* VGA */
|
/* VGA */
|
||||||
{
|
{
|
||||||
/* 5 fps */
|
/* 5 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{6, 773, 1272, {0x25, 0xF4, 0x30, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}},
|
{6, 773, 1272, {0x25, 0xF4, 0x30, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}},
|
||||||
{4, 592, 976, {0x25, 0xF4, 0x50, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x02, 0x80}},
|
{4, 592, 976, {0x25, 0xF4, 0x50, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x02, 0x80}},
|
||||||
{3, 448, 738, {0x25, 0xF4, 0x90, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x01, 0x80}},
|
{3, 448, 738, {0x25, 0xF4, 0x90, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x01, 0x80}},
|
||||||
},
|
},
|
||||||
/* 10 fps */
|
/* 10 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 956, 788, {0x24, 0xF4, 0x70, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x03, 0x80}},
|
{9, 956, 788, {0x24, 0xF4, 0x70, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x03, 0x80}},
|
||||||
{6, 776, 640, {0x24, 0xF4, 0xB0, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x03, 0x80}},
|
{6, 776, 640, {0x24, 0xF4, 0xB0, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x03, 0x80}},
|
||||||
{4, 592, 488, {0x24, 0x7A, 0xE8, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x02, 0x80}},
|
{4, 592, 488, {0x24, 0x7A, 0xE8, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x02, 0x80}},
|
||||||
},
|
},
|
||||||
/* 15 fps */
|
/* 15 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 957, 526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}},
|
{9, 957, 526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}},
|
||||||
{9, 957, 526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}},
|
{9, 957, 526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}},
|
||||||
{8, 895, 492, {0x23, 0x7A, 0xE8, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x03, 0x80}},
|
{8, 895, 492, {0x23, 0x7A, 0xE8, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x03, 0x80}},
|
||||||
},
|
},
|
||||||
/* 20 fps */
|
/* 20 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 25 fps */
|
/* 25 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 30 fps */
|
/* 30 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Linux driver for Philips webcam
|
/* Linux driver for Philips webcam
|
||||||
Various miscellaneous functions and tables.
|
Various miscellaneous functions and tables.
|
||||||
(C) 1999-2003 Nemosoft Unv.
|
(C) 1999-2003 Nemosoft Unv.
|
||||||
(C) 2004 Luc Saillard (luc@saillard.org)
|
(C) 2004 Luc Saillard (luc@saillard.org)
|
||||||
@ -44,17 +44,17 @@ int pwc_decode_size(struct pwc_device *pdev, int width, int height)
|
|||||||
int i, find;
|
int i, find;
|
||||||
|
|
||||||
/* Make sure we don't go beyond our max size.
|
/* Make sure we don't go beyond our max size.
|
||||||
NB: we have different limits for RAW and normal modes. In case
|
NB: we have different limits for RAW and normal modes. In case
|
||||||
you don't have the decompressor loaded or use RAW mode,
|
you don't have the decompressor loaded or use RAW mode,
|
||||||
the maximum viewable size is smaller.
|
the maximum viewable size is smaller.
|
||||||
*/
|
*/
|
||||||
if (pdev->vpalette == VIDEO_PALETTE_RAW)
|
if (pdev->vpalette == VIDEO_PALETTE_RAW)
|
||||||
{
|
{
|
||||||
if (width > pdev->abs_max.x || height > pdev->abs_max.y)
|
if (width > pdev->abs_max.x || height > pdev->abs_max.y)
|
||||||
{
|
{
|
||||||
Debug("VIDEO_PALETTE_RAW: going beyond abs_max.\n");
|
Debug("VIDEO_PALETTE_RAW: going beyond abs_max.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -88,8 +88,8 @@ void pwc_construct(struct pwc_device *pdev)
|
|||||||
pdev->view_min.y = 96;
|
pdev->view_min.y = 96;
|
||||||
pdev->view_max.x = 352;
|
pdev->view_max.x = 352;
|
||||||
pdev->view_max.y = 288;
|
pdev->view_max.y = 288;
|
||||||
pdev->abs_max.x = 352;
|
pdev->abs_max.x = 352;
|
||||||
pdev->abs_max.y = 288;
|
pdev->abs_max.y = 288;
|
||||||
pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QCIF | 1 << PSZ_CIF;
|
pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QCIF | 1 << PSZ_CIF;
|
||||||
pdev->vcinterface = 2;
|
pdev->vcinterface = 2;
|
||||||
pdev->vendpoint = 4;
|
pdev->vendpoint = 4;
|
||||||
@ -105,8 +105,8 @@ void pwc_construct(struct pwc_device *pdev)
|
|||||||
pdev->view_max.x = 640;
|
pdev->view_max.x = 640;
|
||||||
pdev->view_max.y = 480;
|
pdev->view_max.y = 480;
|
||||||
pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QSIF | 1 << PSZ_QCIF | 1 << PSZ_SIF | 1 << PSZ_CIF | 1 << PSZ_VGA;
|
pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QSIF | 1 << PSZ_QCIF | 1 << PSZ_SIF | 1 << PSZ_CIF | 1 << PSZ_VGA;
|
||||||
pdev->abs_max.x = 640;
|
pdev->abs_max.x = 640;
|
||||||
pdev->abs_max.y = 480;
|
pdev->abs_max.y = 480;
|
||||||
pdev->vcinterface = 3;
|
pdev->vcinterface = 3;
|
||||||
pdev->vendpoint = 4;
|
pdev->vendpoint = 4;
|
||||||
pdev->frame_header_size = 0;
|
pdev->frame_header_size = 0;
|
||||||
@ -121,8 +121,8 @@ void pwc_construct(struct pwc_device *pdev)
|
|||||||
pdev->view_max.x = 640;
|
pdev->view_max.x = 640;
|
||||||
pdev->view_max.y = 480;
|
pdev->view_max.y = 480;
|
||||||
pdev->image_mask = 1 << PSZ_QSIF | 1 << PSZ_SIF | 1 << PSZ_VGA;
|
pdev->image_mask = 1 << PSZ_QSIF | 1 << PSZ_SIF | 1 << PSZ_VGA;
|
||||||
pdev->abs_max.x = 640;
|
pdev->abs_max.x = 640;
|
||||||
pdev->abs_max.y = 480;
|
pdev->abs_max.y = 480;
|
||||||
pdev->vcinterface = 3;
|
pdev->vcinterface = 3;
|
||||||
pdev->vendpoint = 5;
|
pdev->vendpoint = 5;
|
||||||
pdev->frame_header_size = TOUCAM_HEADER_SIZE;
|
pdev->frame_header_size = TOUCAM_HEADER_SIZE;
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
{0},
|
{0},
|
||||||
},
|
},
|
||||||
/* VGA */
|
/* VGA */
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0},
|
{0},
|
||||||
{0},
|
{0},
|
||||||
|
@ -46,270 +46,270 @@ const struct Timon_table_entry Timon_table[PSZ_MAX][6][4] =
|
|||||||
{
|
{
|
||||||
/* 5 fps */
|
/* 5 fps */
|
||||||
{
|
{
|
||||||
{1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},
|
{1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},
|
||||||
{1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},
|
{1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},
|
||||||
{1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},
|
{1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},
|
||||||
{1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},
|
{1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},
|
||||||
},
|
},
|
||||||
/* 10 fps */
|
/* 10 fps */
|
||||||
{
|
{
|
||||||
{2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},
|
{2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},
|
||||||
{2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},
|
{2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},
|
||||||
{2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},
|
{2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},
|
||||||
{2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},
|
{2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},
|
||||||
},
|
},
|
||||||
/* 15 fps */
|
/* 15 fps */
|
||||||
{
|
{
|
||||||
{3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},
|
{3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},
|
||||||
{3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},
|
{3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},
|
||||||
{3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},
|
{3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},
|
||||||
{3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},
|
{3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},
|
||||||
},
|
},
|
||||||
/* 20 fps */
|
/* 20 fps */
|
||||||
{
|
{
|
||||||
{4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},
|
{4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},
|
||||||
{4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},
|
{4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},
|
||||||
{4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},
|
{4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},
|
||||||
{4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},
|
{4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},
|
||||||
},
|
},
|
||||||
/* 25 fps */
|
/* 25 fps */
|
||||||
{
|
{
|
||||||
{5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},
|
{5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},
|
||||||
{5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},
|
{5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},
|
||||||
{5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},
|
{5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},
|
||||||
{5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},
|
{5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},
|
||||||
},
|
},
|
||||||
/* 30 fps */
|
/* 30 fps */
|
||||||
{
|
{
|
||||||
{7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},
|
{7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},
|
||||||
{7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},
|
{7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},
|
||||||
{7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},
|
{7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},
|
||||||
{7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},
|
{7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/* QSIF */
|
/* QSIF */
|
||||||
{
|
{
|
||||||
/* 5 fps */
|
/* 5 fps */
|
||||||
{
|
{
|
||||||
{1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},
|
{1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},
|
||||||
{1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},
|
{1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},
|
||||||
{1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},
|
{1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},
|
||||||
{1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},
|
{1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},
|
||||||
},
|
},
|
||||||
/* 10 fps */
|
/* 10 fps */
|
||||||
{
|
{
|
||||||
{2, 291, 0, {0x2C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0xA1, 0xC0, 0x02}},
|
{2, 291, 0, {0x2C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0xA1, 0xC0, 0x02}},
|
||||||
{1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},
|
{1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},
|
||||||
{1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},
|
{1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},
|
||||||
{1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},
|
{1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},
|
||||||
},
|
},
|
||||||
/* 15 fps */
|
/* 15 fps */
|
||||||
{
|
{
|
||||||
{3, 437, 0, {0x2B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x6D, 0xC0, 0x02}},
|
{3, 437, 0, {0x2B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x6D, 0xC0, 0x02}},
|
||||||
{2, 291, 640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}},
|
{2, 291, 640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}},
|
||||||
{2, 291, 640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}},
|
{2, 291, 640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}},
|
||||||
{1, 191, 420, {0x2B, 0xF4, 0x0D, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},
|
{1, 191, 420, {0x2B, 0xF4, 0x0D, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},
|
||||||
},
|
},
|
||||||
/* 20 fps */
|
/* 20 fps */
|
||||||
{
|
{
|
||||||
{4, 588, 0, {0x2A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4C, 0x52, 0xC0, 0x02}},
|
{4, 588, 0, {0x2A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4C, 0x52, 0xC0, 0x02}},
|
||||||
{3, 447, 730, {0x2A, 0xF4, 0x05, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xBF, 0x69, 0xC0, 0x02}},
|
{3, 447, 730, {0x2A, 0xF4, 0x05, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xBF, 0x69, 0xC0, 0x02}},
|
||||||
{2, 292, 476, {0x2A, 0xF4, 0x0D, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0xA1, 0xC0, 0x02}},
|
{2, 292, 476, {0x2A, 0xF4, 0x0D, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0xA1, 0xC0, 0x02}},
|
||||||
{1, 192, 312, {0x2A, 0xF4, 0x1D, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}},
|
{1, 192, 312, {0x2A, 0xF4, 0x1D, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}},
|
||||||
},
|
},
|
||||||
/* 25 fps */
|
/* 25 fps */
|
||||||
{
|
{
|
||||||
{5, 703, 0, {0x29, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x42, 0xC0, 0x02}},
|
{5, 703, 0, {0x29, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x42, 0xC0, 0x02}},
|
||||||
{3, 447, 610, {0x29, 0xF4, 0x05, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x18, 0xBF, 0x69, 0xC0, 0x02}},
|
{3, 447, 610, {0x29, 0xF4, 0x05, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x18, 0xBF, 0x69, 0xC0, 0x02}},
|
||||||
{2, 292, 398, {0x29, 0xF4, 0x0D, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}},
|
{2, 292, 398, {0x29, 0xF4, 0x0D, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}},
|
||||||
{1, 192, 262, {0x29, 0xF4, 0x25, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}},
|
{1, 192, 262, {0x29, 0xF4, 0x25, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}},
|
||||||
},
|
},
|
||||||
/* 30 fps */
|
/* 30 fps */
|
||||||
{
|
{
|
||||||
{8, 873, 0, {0x28, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x69, 0x37, 0xC0, 0x02}},
|
{8, 873, 0, {0x28, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x69, 0x37, 0xC0, 0x02}},
|
||||||
{5, 704, 774, {0x28, 0xF4, 0x05, 0x18, 0x21, 0x17, 0x59, 0x0F, 0x18, 0xC0, 0x42, 0xC0, 0x02}},
|
{5, 704, 774, {0x28, 0xF4, 0x05, 0x18, 0x21, 0x17, 0x59, 0x0F, 0x18, 0xC0, 0x42, 0xC0, 0x02}},
|
||||||
{3, 448, 492, {0x28, 0xF4, 0x05, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x18, 0xC0, 0x69, 0xC0, 0x02}},
|
{3, 448, 492, {0x28, 0xF4, 0x05, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x18, 0xC0, 0x69, 0xC0, 0x02}},
|
||||||
{2, 291, 320, {0x28, 0xF4, 0x1D, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}},
|
{2, 291, 320, {0x28, 0xF4, 0x1D, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/* QCIF */
|
/* QCIF */
|
||||||
{
|
{
|
||||||
/* 5 fps */
|
/* 5 fps */
|
||||||
{
|
{
|
||||||
{1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},
|
{1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},
|
||||||
{1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},
|
{1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},
|
||||||
{1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},
|
{1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},
|
||||||
{1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},
|
{1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},
|
||||||
},
|
},
|
||||||
/* 10 fps */
|
/* 10 fps */
|
||||||
{
|
{
|
||||||
{3, 385, 0, {0x0C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x81, 0x79, 0xC0, 0x02}},
|
{3, 385, 0, {0x0C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x81, 0x79, 0xC0, 0x02}},
|
||||||
{2, 291, 800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}},
|
{2, 291, 800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}},
|
||||||
{2, 291, 800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}},
|
{2, 291, 800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}},
|
||||||
{1, 194, 532, {0x0C, 0xF4, 0x05, 0x10, 0x9A, 0x0F, 0xBE, 0x1B, 0x08, 0xC2, 0xF0, 0xC0, 0x02}},
|
{1, 194, 532, {0x0C, 0xF4, 0x05, 0x10, 0x9A, 0x0F, 0xBE, 0x1B, 0x08, 0xC2, 0xF0, 0xC0, 0x02}},
|
||||||
},
|
},
|
||||||
/* 15 fps */
|
/* 15 fps */
|
||||||
{
|
{
|
||||||
{4, 577, 0, {0x0B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x41, 0x52, 0xC0, 0x02}},
|
{4, 577, 0, {0x0B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x41, 0x52, 0xC0, 0x02}},
|
||||||
{3, 447, 818, {0x0B, 0xF4, 0x05, 0x19, 0x89, 0x18, 0xAD, 0x0F, 0x10, 0xBF, 0x69, 0xC0, 0x02}},
|
{3, 447, 818, {0x0B, 0xF4, 0x05, 0x19, 0x89, 0x18, 0xAD, 0x0F, 0x10, 0xBF, 0x69, 0xC0, 0x02}},
|
||||||
{2, 292, 534, {0x0B, 0xF4, 0x05, 0x10, 0xA3, 0x0F, 0xC7, 0x19, 0x10, 0x24, 0xA1, 0xC0, 0x02}},
|
{2, 292, 534, {0x0B, 0xF4, 0x05, 0x10, 0xA3, 0x0F, 0xC7, 0x19, 0x10, 0x24, 0xA1, 0xC0, 0x02}},
|
||||||
{1, 195, 356, {0x0B, 0xF4, 0x15, 0x0B, 0x11, 0x0A, 0x35, 0x1E, 0x10, 0xC3, 0xF0, 0xC0, 0x02}},
|
{1, 195, 356, {0x0B, 0xF4, 0x15, 0x0B, 0x11, 0x0A, 0x35, 0x1E, 0x10, 0xC3, 0xF0, 0xC0, 0x02}},
|
||||||
},
|
},
|
||||||
/* 20 fps */
|
/* 20 fps */
|
||||||
{
|
{
|
||||||
{6, 776, 0, {0x0A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x08, 0x3F, 0xC0, 0x02}},
|
{6, 776, 0, {0x0A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x08, 0x3F, 0xC0, 0x02}},
|
||||||
{4, 591, 804, {0x0A, 0xF4, 0x05, 0x19, 0x1E, 0x18, 0x42, 0x0F, 0x18, 0x4F, 0x4E, 0xC0, 0x02}},
|
{4, 591, 804, {0x0A, 0xF4, 0x05, 0x19, 0x1E, 0x18, 0x42, 0x0F, 0x18, 0x4F, 0x4E, 0xC0, 0x02}},
|
||||||
{3, 447, 608, {0x0A, 0xF4, 0x05, 0x12, 0xFD, 0x12, 0x21, 0x15, 0x18, 0xBF, 0x69, 0xC0, 0x02}},
|
{3, 447, 608, {0x0A, 0xF4, 0x05, 0x12, 0xFD, 0x12, 0x21, 0x15, 0x18, 0xBF, 0x69, 0xC0, 0x02}},
|
||||||
{2, 291, 396, {0x0A, 0xF4, 0x15, 0x0C, 0x5E, 0x0B, 0x82, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}},
|
{2, 291, 396, {0x0A, 0xF4, 0x15, 0x0C, 0x5E, 0x0B, 0x82, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}},
|
||||||
},
|
},
|
||||||
/* 25 fps */
|
/* 25 fps */
|
||||||
{
|
{
|
||||||
{9, 928, 0, {0x09, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xA0, 0x33, 0xC0, 0x02}},
|
{9, 928, 0, {0x09, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xA0, 0x33, 0xC0, 0x02}},
|
||||||
{5, 703, 800, {0x09, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x10, 0x18, 0xBF, 0x42, 0xC0, 0x02}},
|
{5, 703, 800, {0x09, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x10, 0x18, 0xBF, 0x42, 0xC0, 0x02}},
|
||||||
{3, 447, 508, {0x09, 0xF4, 0x0D, 0x0F, 0xD2, 0x0E, 0xF6, 0x1B, 0x18, 0xBF, 0x69, 0xC0, 0x02}},
|
{3, 447, 508, {0x09, 0xF4, 0x0D, 0x0F, 0xD2, 0x0E, 0xF6, 0x1B, 0x18, 0xBF, 0x69, 0xC0, 0x02}},
|
||||||
{2, 292, 332, {0x09, 0xF4, 0x1D, 0x0A, 0x5A, 0x09, 0x7E, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}},
|
{2, 292, 332, {0x09, 0xF4, 0x1D, 0x0A, 0x5A, 0x09, 0x7E, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}},
|
||||||
},
|
},
|
||||||
/* 30 fps */
|
/* 30 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 956, 876, {0x08, 0xF4, 0x05, 0x1B, 0x58, 0x1A, 0x7C, 0x0E, 0x20, 0xBC, 0x33, 0x10, 0x02}},
|
{9, 956, 876, {0x08, 0xF4, 0x05, 0x1B, 0x58, 0x1A, 0x7C, 0x0E, 0x20, 0xBC, 0x33, 0x10, 0x02}},
|
||||||
{4, 592, 542, {0x08, 0xF4, 0x05, 0x10, 0xE4, 0x10, 0x08, 0x17, 0x20, 0x50, 0x4E, 0x10, 0x02}},
|
{4, 592, 542, {0x08, 0xF4, 0x05, 0x10, 0xE4, 0x10, 0x08, 0x17, 0x20, 0x50, 0x4E, 0x10, 0x02}},
|
||||||
{2, 291, 266, {0x08, 0xF4, 0x25, 0x08, 0x48, 0x07, 0x6C, 0x1E, 0x20, 0x23, 0xA1, 0x10, 0x02}},
|
{2, 291, 266, {0x08, 0xF4, 0x25, 0x08, 0x48, 0x07, 0x6C, 0x1E, 0x20, 0x23, 0xA1, 0x10, 0x02}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/* SIF */
|
/* SIF */
|
||||||
{
|
{
|
||||||
/* 5 fps */
|
/* 5 fps */
|
||||||
{
|
{
|
||||||
{4, 582, 0, {0x35, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x52, 0x60, 0x02}},
|
{4, 582, 0, {0x35, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x52, 0x60, 0x02}},
|
||||||
{3, 387, 1276, {0x35, 0xF4, 0x05, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x79, 0x60, 0x02}},
|
{3, 387, 1276, {0x35, 0xF4, 0x05, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x79, 0x60, 0x02}},
|
||||||
{2, 291, 960, {0x35, 0xF4, 0x0D, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0xA1, 0x60, 0x02}},
|
{2, 291, 960, {0x35, 0xF4, 0x0D, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0xA1, 0x60, 0x02}},
|
||||||
{1, 191, 630, {0x35, 0xF4, 0x1D, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x08, 0xBF, 0xF4, 0x60, 0x02}},
|
{1, 191, 630, {0x35, 0xF4, 0x1D, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x08, 0xBF, 0xF4, 0x60, 0x02}},
|
||||||
},
|
},
|
||||||
/* 10 fps */
|
/* 10 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{6, 775, 1278, {0x34, 0xF4, 0x05, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x3F, 0x10, 0x02}},
|
{6, 775, 1278, {0x34, 0xF4, 0x05, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x3F, 0x10, 0x02}},
|
||||||
{3, 447, 736, {0x34, 0xF4, 0x15, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x18, 0xBF, 0x69, 0x10, 0x02}},
|
{3, 447, 736, {0x34, 0xF4, 0x15, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x18, 0xBF, 0x69, 0x10, 0x02}},
|
||||||
{2, 291, 480, {0x34, 0xF4, 0x2D, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x18, 0x23, 0xA1, 0x10, 0x02}},
|
{2, 291, 480, {0x34, 0xF4, 0x2D, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x18, 0x23, 0xA1, 0x10, 0x02}},
|
||||||
},
|
},
|
||||||
/* 15 fps */
|
/* 15 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 955, 1050, {0x33, 0xF4, 0x05, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x33, 0x10, 0x02}},
|
{9, 955, 1050, {0x33, 0xF4, 0x05, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x33, 0x10, 0x02}},
|
||||||
{4, 591, 650, {0x33, 0xF4, 0x15, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x4F, 0x4E, 0x10, 0x02}},
|
{4, 591, 650, {0x33, 0xF4, 0x15, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x4F, 0x4E, 0x10, 0x02}},
|
||||||
{3, 448, 492, {0x33, 0xF4, 0x25, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x28, 0xC0, 0x69, 0x10, 0x02}},
|
{3, 448, 492, {0x33, 0xF4, 0x25, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x28, 0xC0, 0x69, 0x10, 0x02}},
|
||||||
},
|
},
|
||||||
/* 20 fps */
|
/* 20 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 958, 782, {0x32, 0xF4, 0x0D, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x33, 0xD0, 0x02}},
|
{9, 958, 782, {0x32, 0xF4, 0x0D, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x33, 0xD0, 0x02}},
|
||||||
{5, 703, 574, {0x32, 0xF4, 0x1D, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x42, 0xD0, 0x02}},
|
{5, 703, 574, {0x32, 0xF4, 0x1D, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x42, 0xD0, 0x02}},
|
||||||
{3, 446, 364, {0x32, 0xF4, 0x3D, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x30, 0xBE, 0x69, 0xD0, 0x02}},
|
{3, 446, 364, {0x32, 0xF4, 0x3D, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x30, 0xBE, 0x69, 0xD0, 0x02}},
|
||||||
},
|
},
|
||||||
/* 25 fps */
|
/* 25 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 958, 654, {0x31, 0xF4, 0x15, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x33, 0x90, 0x02}},
|
{9, 958, 654, {0x31, 0xF4, 0x15, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x33, 0x90, 0x02}},
|
||||||
{6, 776, 530, {0x31, 0xF4, 0x25, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x3F, 0x90, 0x02}},
|
{6, 776, 530, {0x31, 0xF4, 0x25, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x3F, 0x90, 0x02}},
|
||||||
{4, 592, 404, {0x31, 0xF4, 0x35, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x38, 0x50, 0x4E, 0x90, 0x02}},
|
{4, 592, 404, {0x31, 0xF4, 0x35, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x38, 0x50, 0x4E, 0x90, 0x02}},
|
||||||
},
|
},
|
||||||
/* 30 fps */
|
/* 30 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 957, 526, {0x30, 0xF4, 0x25, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x33, 0x60, 0x02}},
|
{9, 957, 526, {0x30, 0xF4, 0x25, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x33, 0x60, 0x02}},
|
||||||
{6, 775, 426, {0x30, 0xF4, 0x35, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x3F, 0x60, 0x02}},
|
{6, 775, 426, {0x30, 0xF4, 0x35, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x3F, 0x60, 0x02}},
|
||||||
{4, 590, 324, {0x30, 0x7A, 0x4B, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x40, 0x4E, 0x52, 0x60, 0x02}},
|
{4, 590, 324, {0x30, 0x7A, 0x4B, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x40, 0x4E, 0x52, 0x60, 0x02}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/* CIF */
|
/* CIF */
|
||||||
{
|
{
|
||||||
/* 5 fps */
|
/* 5 fps */
|
||||||
{
|
{
|
||||||
{6, 771, 0, {0x15, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x3F, 0x80, 0x02}},
|
{6, 771, 0, {0x15, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x3F, 0x80, 0x02}},
|
||||||
{4, 465, 1278, {0x15, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x03, 0x18, 0xD1, 0x65, 0x80, 0x02}},
|
{4, 465, 1278, {0x15, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x03, 0x18, 0xD1, 0x65, 0x80, 0x02}},
|
||||||
{2, 291, 800, {0x15, 0xF4, 0x15, 0x18, 0xF4, 0x17, 0x3C, 0x05, 0x18, 0x23, 0xA1, 0x80, 0x02}},
|
{2, 291, 800, {0x15, 0xF4, 0x15, 0x18, 0xF4, 0x17, 0x3C, 0x05, 0x18, 0x23, 0xA1, 0x80, 0x02}},
|
||||||
{1, 193, 528, {0x15, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x18, 0xC1, 0xF4, 0x80, 0x02}},
|
{1, 193, 528, {0x15, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x18, 0xC1, 0xF4, 0x80, 0x02}},
|
||||||
},
|
},
|
||||||
/* 10 fps */
|
/* 10 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 932, 1278, {0x14, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x04, 0x30, 0xA4, 0x33, 0x10, 0x02}},
|
{9, 932, 1278, {0x14, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x04, 0x30, 0xA4, 0x33, 0x10, 0x02}},
|
||||||
{4, 591, 812, {0x14, 0xF4, 0x15, 0x19, 0x56, 0x17, 0x9E, 0x06, 0x28, 0x4F, 0x4E, 0x10, 0x02}},
|
{4, 591, 812, {0x14, 0xF4, 0x15, 0x19, 0x56, 0x17, 0x9E, 0x06, 0x28, 0x4F, 0x4E, 0x10, 0x02}},
|
||||||
{2, 291, 400, {0x14, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x28, 0x23, 0xA1, 0x10, 0x02}},
|
{2, 291, 400, {0x14, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x28, 0x23, 0xA1, 0x10, 0x02}},
|
||||||
},
|
},
|
||||||
/* 15 fps */
|
/* 15 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 956, 876, {0x13, 0xF4, 0x0D, 0x1B, 0x58, 0x19, 0xA0, 0x05, 0x38, 0xBC, 0x33, 0x60, 0x02}},
|
{9, 956, 876, {0x13, 0xF4, 0x0D, 0x1B, 0x58, 0x19, 0xA0, 0x05, 0x38, 0xBC, 0x33, 0x60, 0x02}},
|
||||||
{5, 703, 644, {0x13, 0xF4, 0x1D, 0x14, 0x1C, 0x12, 0x64, 0x08, 0x38, 0xBF, 0x42, 0x60, 0x02}},
|
{5, 703, 644, {0x13, 0xF4, 0x1D, 0x14, 0x1C, 0x12, 0x64, 0x08, 0x38, 0xBF, 0x42, 0x60, 0x02}},
|
||||||
{3, 448, 410, {0x13, 0xF4, 0x3D, 0x0C, 0xC4, 0x0B, 0x0C, 0x0E, 0x38, 0xC0, 0x69, 0x60, 0x02}},
|
{3, 448, 410, {0x13, 0xF4, 0x3D, 0x0C, 0xC4, 0x0B, 0x0C, 0x0E, 0x38, 0xC0, 0x69, 0x60, 0x02}},
|
||||||
},
|
},
|
||||||
/* 20 fps */
|
/* 20 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 956, 650, {0x12, 0xF4, 0x1D, 0x14, 0x4A, 0x12, 0x92, 0x09, 0x48, 0xBC, 0x33, 0x10, 0x03}},
|
{9, 956, 650, {0x12, 0xF4, 0x1D, 0x14, 0x4A, 0x12, 0x92, 0x09, 0x48, 0xBC, 0x33, 0x10, 0x03}},
|
||||||
{6, 776, 528, {0x12, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x40, 0x08, 0x3F, 0x10, 0x03}},
|
{6, 776, 528, {0x12, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x40, 0x08, 0x3F, 0x10, 0x03}},
|
||||||
{4, 591, 402, {0x12, 0xF4, 0x3D, 0x0C, 0x8F, 0x0A, 0xD7, 0x0E, 0x40, 0x4F, 0x4E, 0x10, 0x03}},
|
{4, 591, 402, {0x12, 0xF4, 0x3D, 0x0C, 0x8F, 0x0A, 0xD7, 0x0E, 0x40, 0x4F, 0x4E, 0x10, 0x03}},
|
||||||
},
|
},
|
||||||
/* 25 fps */
|
/* 25 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 956, 544, {0x11, 0xF4, 0x25, 0x10, 0xF4, 0x0F, 0x3C, 0x0A, 0x48, 0xBC, 0x33, 0xC0, 0x02}},
|
{9, 956, 544, {0x11, 0xF4, 0x25, 0x10, 0xF4, 0x0F, 0x3C, 0x0A, 0x48, 0xBC, 0x33, 0xC0, 0x02}},
|
||||||
{7, 840, 478, {0x11, 0xF4, 0x2D, 0x0E, 0xEB, 0x0D, 0x33, 0x0B, 0x48, 0x48, 0x3B, 0xC0, 0x02}},
|
{7, 840, 478, {0x11, 0xF4, 0x2D, 0x0E, 0xEB, 0x0D, 0x33, 0x0B, 0x48, 0x48, 0x3B, 0xC0, 0x02}},
|
||||||
{5, 703, 400, {0x11, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x48, 0xBF, 0x42, 0xC0, 0x02}},
|
{5, 703, 400, {0x11, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x48, 0xBF, 0x42, 0xC0, 0x02}},
|
||||||
},
|
},
|
||||||
/* 30 fps */
|
/* 30 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 956, 438, {0x10, 0xF4, 0x35, 0x0D, 0xAC, 0x0B, 0xF4, 0x0D, 0x50, 0xBC, 0x33, 0x10, 0x02}},
|
{9, 956, 438, {0x10, 0xF4, 0x35, 0x0D, 0xAC, 0x0B, 0xF4, 0x0D, 0x50, 0xBC, 0x33, 0x10, 0x02}},
|
||||||
{7, 838, 384, {0x10, 0xF4, 0x45, 0x0B, 0xFD, 0x0A, 0x45, 0x0F, 0x50, 0x46, 0x3B, 0x10, 0x02}},
|
{7, 838, 384, {0x10, 0xF4, 0x45, 0x0B, 0xFD, 0x0A, 0x45, 0x0F, 0x50, 0x46, 0x3B, 0x10, 0x02}},
|
||||||
{6, 773, 354, {0x10, 0x7A, 0x4B, 0x0B, 0x0C, 0x09, 0x80, 0x10, 0x50, 0x05, 0x3F, 0x10, 0x02}},
|
{6, 773, 354, {0x10, 0x7A, 0x4B, 0x0B, 0x0C, 0x09, 0x80, 0x10, 0x50, 0x05, 0x3F, 0x10, 0x02}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/* VGA */
|
/* VGA */
|
||||||
{
|
{
|
||||||
/* 5 fps */
|
/* 5 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{6, 773, 1272, {0x1D, 0xF4, 0x15, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x3F, 0x10, 0x02}},
|
{6, 773, 1272, {0x1D, 0xF4, 0x15, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x3F, 0x10, 0x02}},
|
||||||
{4, 592, 976, {0x1D, 0xF4, 0x25, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x4E, 0x10, 0x02}},
|
{4, 592, 976, {0x1D, 0xF4, 0x25, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x4E, 0x10, 0x02}},
|
||||||
{3, 448, 738, {0x1D, 0xF4, 0x3D, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x69, 0x10, 0x02}},
|
{3, 448, 738, {0x1D, 0xF4, 0x3D, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x69, 0x10, 0x02}},
|
||||||
},
|
},
|
||||||
/* 10 fps */
|
/* 10 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 956, 788, {0x1C, 0xF4, 0x35, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x33, 0x10, 0x02}},
|
{9, 956, 788, {0x1C, 0xF4, 0x35, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x33, 0x10, 0x02}},
|
||||||
{6, 776, 640, {0x1C, 0x7A, 0x53, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x3F, 0x10, 0x02}},
|
{6, 776, 640, {0x1C, 0x7A, 0x53, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x3F, 0x10, 0x02}},
|
||||||
{4, 592, 488, {0x1C, 0x7A, 0x6B, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x4E, 0x10, 0x02}},
|
{4, 592, 488, {0x1C, 0x7A, 0x6B, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x4E, 0x10, 0x02}},
|
||||||
},
|
},
|
||||||
/* 15 fps */
|
/* 15 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{9, 957, 526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}},
|
{9, 957, 526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}},
|
||||||
{9, 957, 526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}},
|
{9, 957, 526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}},
|
||||||
{8, 895, 492, {0x1B, 0x7A, 0x6B, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x37, 0x80, 0x02}},
|
{8, 895, 492, {0x1B, 0x7A, 0x6B, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x37, 0x80, 0x02}},
|
||||||
},
|
},
|
||||||
/* 20 fps */
|
/* 20 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 25 fps */
|
/* 25 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
/* 30 fps */
|
/* 30 fps */
|
||||||
{
|
{
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
{0, },
|
{0, },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -109,9 +109,9 @@ int pwc_decompress(struct pwc_device *pdev)
|
|||||||
in planar format immediately.
|
in planar format immediately.
|
||||||
*/
|
*/
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
flags = PWCX_FLAG_PLANAR;
|
flags = PWCX_FLAG_PLANAR;
|
||||||
if (pdev->vsize == PSZ_VGA && pdev->vframes == 5 && pdev->vsnapshot)
|
if (pdev->vsize == PSZ_VGA && pdev->vframes == 5 && pdev->vsnapshot)
|
||||||
{
|
{
|
||||||
printk(KERN_ERR "pwc: Mode Bayer is not supported for now\n");
|
printk(KERN_ERR "pwc: Mode Bayer is not supported for now\n");
|
||||||
flags |= PWCX_FLAG_BAYER;
|
flags |= PWCX_FLAG_BAYER;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
/* This file is the bridge between the kernel module and the plugin; it
|
/* This file is the bridge between the kernel module and the plugin; it
|
||||||
describes the structures and datatypes used in both modules. Any
|
describes the structures and datatypes used in both modules. Any
|
||||||
significant change should be reflected by increasing the
|
significant change should be reflected by increasing the
|
||||||
pwc_decompressor_version major number.
|
pwc_decompressor_version major number.
|
||||||
*/
|
*/
|
||||||
#ifndef PWC_UNCOMPRESS_H
|
#ifndef PWC_UNCOMPRESS_H
|
||||||
|
@ -123,7 +123,7 @@ struct pwc_device
|
|||||||
#endif
|
#endif
|
||||||
/* Pointer to our usb_device */
|
/* Pointer to our usb_device */
|
||||||
struct usb_device *udev;
|
struct usb_device *udev;
|
||||||
|
|
||||||
int type; /* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */
|
int type; /* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */
|
||||||
int release; /* release number */
|
int release; /* release number */
|
||||||
int features; /* feature bits */
|
int features; /* feature bits */
|
||||||
@ -149,7 +149,7 @@ struct pwc_device
|
|||||||
char vsnapshot; /* snapshot mode */
|
char vsnapshot; /* snapshot mode */
|
||||||
char vsync; /* used by isoc handler */
|
char vsync; /* used by isoc handler */
|
||||||
char vmirror; /* for ToUCaM series */
|
char vmirror; /* for ToUCaM series */
|
||||||
|
|
||||||
int cmd_len;
|
int cmd_len;
|
||||||
unsigned char cmd_buf[13];
|
unsigned char cmd_buf[13];
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
#define NUM_BUFS 8
|
#define NUM_BUFS 8
|
||||||
#define IF_NAME "SAA5249"
|
#define IF_NAME "SAA5249"
|
||||||
|
|
||||||
static const int disp_modes[8][3] =
|
static const int disp_modes[8][3] =
|
||||||
{
|
{
|
||||||
{ 0x46, 0x03, 0x03 }, /* DISPOFF */
|
{ 0x46, 0x03, 0x03 }, /* DISPOFF */
|
||||||
{ 0x46, 0xcc, 0xcc }, /* DISPNORM */
|
{ 0x46, 0xcc, 0xcc }, /* DISPNORM */
|
||||||
@ -150,8 +150,8 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind)
|
|||||||
client=kmalloc(sizeof(*client), GFP_KERNEL);
|
client=kmalloc(sizeof(*client), GFP_KERNEL);
|
||||||
if(client==NULL)
|
if(client==NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
client_template.adapter = adap;
|
client_template.adapter = adap;
|
||||||
client_template.addr = addr;
|
client_template.addr = addr;
|
||||||
memcpy(client, &client_template, sizeof(*client));
|
memcpy(client, &client_template, sizeof(*client));
|
||||||
t = kzalloc(sizeof(*t), GFP_KERNEL);
|
t = kzalloc(sizeof(*t), GFP_KERNEL);
|
||||||
if(t==NULL)
|
if(t==NULL)
|
||||||
@ -161,11 +161,11 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind)
|
|||||||
}
|
}
|
||||||
strlcpy(client->name, IF_NAME, I2C_NAME_SIZE);
|
strlcpy(client->name, IF_NAME, I2C_NAME_SIZE);
|
||||||
mutex_init(&t->lock);
|
mutex_init(&t->lock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now create a video4linux device
|
* Now create a video4linux device
|
||||||
*/
|
*/
|
||||||
|
|
||||||
vd = kmalloc(sizeof(struct video_device), GFP_KERNEL);
|
vd = kmalloc(sizeof(struct video_device), GFP_KERNEL);
|
||||||
if(vd==NULL)
|
if(vd==NULL)
|
||||||
{
|
{
|
||||||
@ -175,8 +175,8 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind)
|
|||||||
}
|
}
|
||||||
i2c_set_clientdata(client, vd);
|
i2c_set_clientdata(client, vd);
|
||||||
memcpy(vd, &saa_template, sizeof(*vd));
|
memcpy(vd, &saa_template, sizeof(*vd));
|
||||||
|
|
||||||
for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++)
|
for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++)
|
||||||
{
|
{
|
||||||
memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf));
|
memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf));
|
||||||
memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs));
|
memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs));
|
||||||
@ -186,9 +186,9 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind)
|
|||||||
t->vdau[pgbuf].stopped = TRUE;
|
t->vdau[pgbuf].stopped = TRUE;
|
||||||
t->is_searching[pgbuf] = FALSE;
|
t->is_searching[pgbuf] = FALSE;
|
||||||
}
|
}
|
||||||
vd->priv=t;
|
vd->priv=t;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Register it
|
* Register it
|
||||||
*/
|
*/
|
||||||
@ -208,7 +208,7 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind)
|
|||||||
/*
|
/*
|
||||||
* We do most of the hard work when we become a device on the i2c.
|
* We do most of the hard work when we become a device on the i2c.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int saa5249_probe(struct i2c_adapter *adap)
|
static int saa5249_probe(struct i2c_adapter *adap)
|
||||||
{
|
{
|
||||||
if (adap->class & I2C_CLASS_TV_ANALOG)
|
if (adap->class & I2C_CLASS_TV_ANALOG)
|
||||||
@ -229,7 +229,7 @@ static int saa5249_detach(struct i2c_client *client)
|
|||||||
|
|
||||||
/* new I2C driver support */
|
/* new I2C driver support */
|
||||||
|
|
||||||
static struct i2c_driver i2c_driver_videotext =
|
static struct i2c_driver i2c_driver_videotext =
|
||||||
{
|
{
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = IF_NAME, /* name */
|
.name = IF_NAME, /* name */
|
||||||
@ -249,7 +249,7 @@ static struct i2c_client client_template = {
|
|||||||
* delay may be longer.
|
* delay may be longer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void jdelay(unsigned long delay)
|
static void jdelay(unsigned long delay)
|
||||||
{
|
{
|
||||||
sigset_t oldblocked = current->blocked;
|
sigset_t oldblocked = current->blocked;
|
||||||
|
|
||||||
@ -269,14 +269,14 @@ static void jdelay(unsigned long delay)
|
|||||||
/*
|
/*
|
||||||
* I2C interfaces
|
* I2C interfaces
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int i2c_sendbuf(struct saa5249_device *t, int reg, int count, u8 *data)
|
static int i2c_sendbuf(struct saa5249_device *t, int reg, int count, u8 *data)
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
|
||||||
buf[0] = reg;
|
buf[0] = reg;
|
||||||
memcpy(buf+1, data, count);
|
memcpy(buf+1, data, count);
|
||||||
|
|
||||||
if(i2c_master_send(t->client, buf, count+1)==count+1)
|
if(i2c_master_send(t->client, buf, count+1)==count+1)
|
||||||
return 0;
|
return 0;
|
||||||
return -1;
|
return -1;
|
||||||
@ -289,7 +289,7 @@ static int i2c_senddata(struct saa5249_device *t, ...)
|
|||||||
int ct=0;
|
int ct=0;
|
||||||
va_list argp;
|
va_list argp;
|
||||||
va_start(argp,t);
|
va_start(argp,t);
|
||||||
|
|
||||||
while((v=va_arg(argp,int))!=-1)
|
while((v=va_arg(argp,int))!=-1)
|
||||||
buf[ct++]=v;
|
buf[ct++]=v;
|
||||||
return i2c_sendbuf(t, buf[0], ct-1, buf+1);
|
return i2c_sendbuf(t, buf[0], ct-1, buf+1);
|
||||||
@ -301,7 +301,7 @@ static int i2c_senddata(struct saa5249_device *t, ...)
|
|||||||
* Returns -1 if I²C-device didn't send acknowledge, 0 otherwise
|
* Returns -1 if I²C-device didn't send acknowledge, 0 otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int i2c_getdata(struct saa5249_device *t, int count, u8 *buf)
|
static int i2c_getdata(struct saa5249_device *t, int count, u8 *buf)
|
||||||
{
|
{
|
||||||
if(i2c_master_recv(t->client, buf, count)!=count)
|
if(i2c_master_recv(t->client, buf, count)!=count)
|
||||||
return -1;
|
return -1;
|
||||||
@ -320,9 +320,9 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
|
|||||||
struct video_device *vd = video_devdata(file);
|
struct video_device *vd = video_devdata(file);
|
||||||
struct saa5249_device *t=vd->priv;
|
struct saa5249_device *t=vd->priv;
|
||||||
|
|
||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
case VTXIOCGETINFO:
|
case VTXIOCGETINFO:
|
||||||
{
|
{
|
||||||
vtx_info_t *info = arg;
|
vtx_info_t *info = arg;
|
||||||
info->version_major = VTX_VER_MAJ;
|
info->version_major = VTX_VER_MAJ;
|
||||||
@ -332,10 +332,10 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VTXIOCCLRPAGE:
|
case VTXIOCCLRPAGE:
|
||||||
{
|
{
|
||||||
vtx_pagereq_t *req = arg;
|
vtx_pagereq_t *req = arg;
|
||||||
|
|
||||||
if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS)
|
if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
memset(t->vdau[req->pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf));
|
memset(t->vdau[req->pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf));
|
||||||
@ -343,17 +343,17 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VTXIOCCLRFOUND:
|
case VTXIOCCLRFOUND:
|
||||||
{
|
{
|
||||||
vtx_pagereq_t *req = arg;
|
vtx_pagereq_t *req = arg;
|
||||||
|
|
||||||
if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS)
|
if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
t->vdau[req->pgbuf].clrfound = TRUE;
|
t->vdau[req->pgbuf].clrfound = TRUE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VTXIOCPAGEREQ:
|
case VTXIOCPAGEREQ:
|
||||||
{
|
{
|
||||||
vtx_pagereq_t *req = arg;
|
vtx_pagereq_t *req = arg;
|
||||||
if (!(req->pagemask & PGMASK_PAGE))
|
if (!(req->pagemask & PGMASK_PAGE))
|
||||||
@ -381,7 +381,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VTXIOCGETSTAT:
|
case VTXIOCGETSTAT:
|
||||||
{
|
{
|
||||||
vtx_pagereq_t *req = arg;
|
vtx_pagereq_t *req = arg;
|
||||||
u8 infobits[10];
|
u8 infobits[10];
|
||||||
@ -390,7 +390,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
|
|||||||
|
|
||||||
if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS)
|
if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (!t->vdau[req->pgbuf].stopped)
|
if (!t->vdau[req->pgbuf].stopped)
|
||||||
{
|
{
|
||||||
if (i2c_senddata(t, 2, 0, -1) ||
|
if (i2c_senddata(t, 2, 0, -1) ||
|
||||||
i2c_sendbuf(t, 3, sizeof(t->vdau[0].sregs), t->vdau[req->pgbuf].sregs) ||
|
i2c_sendbuf(t, 3, sizeof(t->vdau[0].sregs), t->vdau[req->pgbuf].sregs) ||
|
||||||
@ -403,7 +403,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
|
|||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
if (!(infobits[8] & 0x10) && !(infobits[7] & 0xf0) && /* check FOUND-bit */
|
if (!(infobits[8] & 0x10) && !(infobits[7] & 0xf0) && /* check FOUND-bit */
|
||||||
(memcmp(infobits, t->vdau[req->pgbuf].laststat, sizeof(infobits)) ||
|
(memcmp(infobits, t->vdau[req->pgbuf].laststat, sizeof(infobits)) ||
|
||||||
time_after_eq(jiffies, t->vdau[req->pgbuf].expire)))
|
time_after_eq(jiffies, t->vdau[req->pgbuf].expire)))
|
||||||
{ /* check if new page arrived */
|
{ /* check if new page arrived */
|
||||||
if (i2c_senddata(t, 8, 0, 0, 0, -1) ||
|
if (i2c_senddata(t, 8, 0, 0, 0, -1) ||
|
||||||
@ -411,7 +411,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
|
|||||||
return -EIO;
|
return -EIO;
|
||||||
t->vdau[req->pgbuf].expire = jiffies + PGBUF_EXPIRE;
|
t->vdau[req->pgbuf].expire = jiffies + PGBUF_EXPIRE;
|
||||||
memset(t->vdau[req->pgbuf].pgbuf + VTX_PAGESIZE, ' ', VTX_VIRTUALSIZE - VTX_PAGESIZE);
|
memset(t->vdau[req->pgbuf].pgbuf + VTX_PAGESIZE, ' ', VTX_VIRTUALSIZE - VTX_PAGESIZE);
|
||||||
if (t->virtual_mode)
|
if (t->virtual_mode)
|
||||||
{
|
{
|
||||||
/* Packet X/24 */
|
/* Packet X/24 */
|
||||||
if (i2c_senddata(t, 8, 0, 0x20, 0, -1) ||
|
if (i2c_senddata(t, 8, 0, 0x20, 0, -1) ||
|
||||||
@ -459,9 +459,9 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
|
|||||||
info.notfound = !!(infobits[8] & 0x10);
|
info.notfound = !!(infobits[8] & 0x10);
|
||||||
info.pblf = !!(infobits[9] & 0x20);
|
info.pblf = !!(infobits[9] & 0x20);
|
||||||
info.hamming = 0;
|
info.hamming = 0;
|
||||||
for (a = 0; a <= 7; a++)
|
for (a = 0; a <= 7; a++)
|
||||||
{
|
{
|
||||||
if (infobits[a] & 0xf0)
|
if (infobits[a] & 0xf0)
|
||||||
{
|
{
|
||||||
info.hamming = 1;
|
info.hamming = 1;
|
||||||
break;
|
break;
|
||||||
@ -471,14 +471,14 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
|
|||||||
info.notfound = 1;
|
info.notfound = 1;
|
||||||
if(copy_to_user(req->buffer, &info, sizeof(vtx_pageinfo_t)))
|
if(copy_to_user(req->buffer, &info, sizeof(vtx_pageinfo_t)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
if (!info.hamming && !info.notfound)
|
if (!info.hamming && !info.notfound)
|
||||||
{
|
{
|
||||||
t->is_searching[req->pgbuf] = FALSE;
|
t->is_searching[req->pgbuf] = FALSE;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VTXIOCGETPAGE:
|
case VTXIOCGETPAGE:
|
||||||
{
|
{
|
||||||
vtx_pagereq_t *req = arg;
|
vtx_pagereq_t *req = arg;
|
||||||
int start, end;
|
int start, end;
|
||||||
@ -488,15 +488,15 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if(copy_to_user(req->buffer, &t->vdau[req->pgbuf].pgbuf[req->start], req->end - req->start + 1))
|
if(copy_to_user(req->buffer, &t->vdau[req->pgbuf].pgbuf[req->start], req->end - req->start + 1))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Always read the time directly from SAA5249
|
* Always read the time directly from SAA5249
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (req->start <= 39 && req->end >= 32)
|
if (req->start <= 39 && req->end >= 32)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
char buf[16];
|
char buf[16];
|
||||||
start = max(req->start, 32);
|
start = max(req->start, 32);
|
||||||
end = min(req->end, 39);
|
end = min(req->end, 39);
|
||||||
len=end-start+1;
|
len=end-start+1;
|
||||||
@ -507,7 +507,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
|
|||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
/* Insert the current header if DAU is still searching for a page */
|
/* Insert the current header if DAU is still searching for a page */
|
||||||
if (req->start <= 31 && req->end >= 7 && t->is_searching[req->pgbuf])
|
if (req->start <= 31 && req->end >= 7 && t->is_searching[req->pgbuf])
|
||||||
{
|
{
|
||||||
char buf[32];
|
char buf[32];
|
||||||
int len;
|
int len;
|
||||||
@ -523,7 +523,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VTXIOCSTOPDAU:
|
case VTXIOCSTOPDAU:
|
||||||
{
|
{
|
||||||
vtx_pagereq_t *req = arg;
|
vtx_pagereq_t *req = arg;
|
||||||
|
|
||||||
@ -534,12 +534,12 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VTXIOCPUTPAGE:
|
case VTXIOCPUTPAGE:
|
||||||
case VTXIOCSETDISP:
|
case VTXIOCSETDISP:
|
||||||
case VTXIOCPUTSTAT:
|
case VTXIOCPUTSTAT:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case VTXIOCCLRCACHE:
|
case VTXIOCCLRCACHE:
|
||||||
{
|
{
|
||||||
if (i2c_senddata(t, 0, NUM_DAUS, 0, 8, -1) || i2c_senddata(t, 11,
|
if (i2c_senddata(t, 0, NUM_DAUS, 0, 8, -1) || i2c_senddata(t, 11,
|
||||||
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
|
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
|
||||||
@ -551,7 +551,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VTXIOCSETVIRT:
|
case VTXIOCSETVIRT:
|
||||||
{
|
{
|
||||||
/* The SAA5249 has virtual-row reception turned on always */
|
/* The SAA5249 has virtual-row reception turned on always */
|
||||||
t->virtual_mode = (int)(long)arg;
|
t->virtual_mode = (int)(long)arg;
|
||||||
@ -612,14 +612,14 @@ static inline unsigned int vtx_fix_command(unsigned int cmd)
|
|||||||
/*
|
/*
|
||||||
* Handle the locking
|
* Handle the locking
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int saa5249_ioctl(struct inode *inode, struct file *file,
|
static int saa5249_ioctl(struct inode *inode, struct file *file,
|
||||||
unsigned int cmd, unsigned long arg)
|
unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
struct video_device *vd = video_devdata(file);
|
struct video_device *vd = video_devdata(file);
|
||||||
struct saa5249_device *t=vd->priv;
|
struct saa5249_device *t=vd->priv;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
cmd = vtx_fix_command(cmd);
|
cmd = vtx_fix_command(cmd);
|
||||||
mutex_lock(&t->lock);
|
mutex_lock(&t->lock);
|
||||||
err = video_usercopy(inode,file,cmd,arg,do_saa5249_ioctl);
|
err = video_usercopy(inode,file,cmd,arg,do_saa5249_ioctl);
|
||||||
@ -627,7 +627,7 @@ static int saa5249_ioctl(struct inode *inode, struct file *file,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int saa5249_open(struct inode *inode, struct file *file)
|
static int saa5249_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
struct video_device *vd = video_devdata(file);
|
struct video_device *vd = video_devdata(file);
|
||||||
struct saa5249_device *t=vd->priv;
|
struct saa5249_device *t=vd->priv;
|
||||||
@ -636,7 +636,7 @@ static int saa5249_open(struct inode *inode, struct file *file)
|
|||||||
err = video_exclusive_open(inode,file);
|
err = video_exclusive_open(inode,file);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (t->client==NULL) {
|
if (t->client==NULL) {
|
||||||
err = -ENODEV;
|
err = -ENODEV;
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -647,13 +647,13 @@ static int saa5249_open(struct inode *inode, struct file *file)
|
|||||||
i2c_senddata(t, 1, disp_modes[t->disp_mode][0], 0, -1) ||
|
i2c_senddata(t, 1, disp_modes[t->disp_mode][0], 0, -1) ||
|
||||||
/* Display TV-picture, no virtual rows */
|
/* Display TV-picture, no virtual rows */
|
||||||
i2c_senddata(t, 4, NUM_DAUS, disp_modes[t->disp_mode][1], disp_modes[t->disp_mode][2], 7, -1)) /* Set display to page 4 */
|
i2c_senddata(t, 4, NUM_DAUS, disp_modes[t->disp_mode][1], disp_modes[t->disp_mode][2], 7, -1)) /* Set display to page 4 */
|
||||||
|
|
||||||
{
|
{
|
||||||
err = -EIO;
|
err = -EIO;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++)
|
for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++)
|
||||||
{
|
{
|
||||||
memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf));
|
memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf));
|
||||||
memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs));
|
memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs));
|
||||||
@ -673,7 +673,7 @@ static int saa5249_open(struct inode *inode, struct file *file)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int saa5249_release(struct inode *inode, struct file *file)
|
static int saa5249_release(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
struct video_device *vd = video_devdata(file);
|
struct video_device *vd = video_devdata(file);
|
||||||
struct saa5249_device *t=vd->priv;
|
struct saa5249_device *t=vd->priv;
|
||||||
@ -690,7 +690,7 @@ static int __init init_saa_5249 (void)
|
|||||||
return i2c_add_driver(&i2c_driver_videotext);
|
return i2c_add_driver(&i2c_driver_videotext);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit cleanup_saa_5249 (void)
|
static void __exit cleanup_saa_5249 (void)
|
||||||
{
|
{
|
||||||
i2c_del_driver(&i2c_driver_videotext);
|
i2c_del_driver(&i2c_driver_videotext);
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ saa7110_read (struct i2c_client *client)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
saa7110_selmux (struct i2c_client *client,
|
saa7110_selmux (struct i2c_client *client,
|
||||||
int chan)
|
int chan)
|
||||||
{
|
{
|
||||||
static const unsigned char modes[9][8] = {
|
static const unsigned char modes[9][8] = {
|
||||||
/* mode 0 */
|
/* mode 0 */
|
||||||
@ -457,7 +457,7 @@ static unsigned short normal_i2c[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static unsigned short ignore = I2C_CLIENT_END;
|
static unsigned short ignore = I2C_CLIENT_END;
|
||||||
|
|
||||||
static struct i2c_client_address_data addr_data = {
|
static struct i2c_client_address_data addr_data = {
|
||||||
.normal_i2c = normal_i2c,
|
.normal_i2c = normal_i2c,
|
||||||
.probe = &ignore,
|
.probe = &ignore,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* saa7111 - Philips SAA7111A video decoder driver version 0.0.3
|
* saa7111 - Philips SAA7111A video decoder driver version 0.0.3
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 Dave Perks <dperks@ibm.net>
|
* Copyright (C) 1998 Dave Perks <dperks@ibm.net>
|
||||||
@ -482,7 +482,7 @@ saa7111_command (struct i2c_client *client,
|
|||||||
static unsigned short normal_i2c[] = { I2C_SAA7111 >> 1, I2C_CLIENT_END };
|
static unsigned short normal_i2c[] = { I2C_SAA7111 >> 1, I2C_CLIENT_END };
|
||||||
|
|
||||||
static unsigned short ignore = I2C_CLIENT_END;
|
static unsigned short ignore = I2C_CLIENT_END;
|
||||||
|
|
||||||
static struct i2c_client_address_data addr_data = {
|
static struct i2c_client_address_data addr_data = {
|
||||||
.normal_i2c = normal_i2c,
|
.normal_i2c = normal_i2c,
|
||||||
.probe = &ignore,
|
.probe = &ignore,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* saa7114 - Philips SAA7114H video decoder driver version 0.0.1
|
* saa7114 - Philips SAA7114H video decoder driver version 0.0.1
|
||||||
*
|
*
|
||||||
* Copyright (C) 2002 Maxim Yevtyushkin <max@linuxmedialabs.com>
|
* Copyright (C) 2002 Maxim Yevtyushkin <max@linuxmedialabs.com>
|
||||||
@ -300,7 +300,7 @@ static const unsigned char init[] = {
|
|||||||
0x55, 0xff,
|
0x55, 0xff,
|
||||||
0x56, 0xff,
|
0x56, 0xff,
|
||||||
0x57, 0xff,
|
0x57, 0xff,
|
||||||
0x58, 0x40, // framing code
|
0x58, 0x40, // framing code
|
||||||
0x59, 0x47, // horizontal offset
|
0x59, 0x47, // horizontal offset
|
||||||
0x5a, 0x06, // vertical offset
|
0x5a, 0x06, // vertical offset
|
||||||
0x5b, 0x83, // field offset
|
0x5b, 0x83, // field offset
|
||||||
@ -345,7 +345,7 @@ static const unsigned char init[] = {
|
|||||||
0x82, 0x00,
|
0x82, 0x00,
|
||||||
0x83, 0x00,
|
0x83, 0x00,
|
||||||
0x84, 0xc5,
|
0x84, 0xc5,
|
||||||
0x85, 0x0d, // hsync and vsync ?
|
0x85, 0x0d, // hsync and vsync ?
|
||||||
0x86, 0x40,
|
0x86, 0x40,
|
||||||
0x87, 0x01,
|
0x87, 0x01,
|
||||||
0x88, 0x00,
|
0x88, 0x00,
|
||||||
@ -434,7 +434,7 @@ static const unsigned char init[] = {
|
|||||||
0xd9, 0x04,
|
0xd9, 0x04,
|
||||||
0xda, 0x00, // horizontal luminance phase offset
|
0xda, 0x00, // horizontal luminance phase offset
|
||||||
0xdb, 0x00,
|
0xdb, 0x00,
|
||||||
0xdc, 0x00, // horizontal chrominance scaling increment
|
0xdc, 0x00, // horizontal chrominance scaling increment
|
||||||
0xdd, 0x02,
|
0xdd, 0x02,
|
||||||
0xde, 0x00, // horizontal chrominance phase offset
|
0xde, 0x00, // horizontal chrominance phase offset
|
||||||
0xdf, 0x00,
|
0xdf, 0x00,
|
||||||
@ -754,7 +754,7 @@ saa7114_command (struct i2c_client *client,
|
|||||||
saa7114_write(client, 0x87,
|
saa7114_write(client, 0x87,
|
||||||
decoder->reg[REG_ADDR(0x87)]);
|
decoder->reg[REG_ADDR(0x87)]);
|
||||||
saa7114_write(client, 0x88, 0xd8); // sw reset scaler
|
saa7114_write(client, 0x88, 0xd8); // sw reset scaler
|
||||||
saa7114_write(client, 0x88, 0xf8); // sw reset scaler release
|
saa7114_write(client, 0x88, 0xf8); // sw reset scaler release
|
||||||
saa7114_write(client, 0x80, 0x36);
|
saa7114_write(client, 0x80, 0x36);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -813,7 +813,7 @@ static unsigned short normal_i2c[] =
|
|||||||
{ I2C_SAA7114 >> 1, I2C_SAA7114A >> 1, I2C_CLIENT_END };
|
{ I2C_SAA7114 >> 1, I2C_SAA7114A >> 1, I2C_CLIENT_END };
|
||||||
|
|
||||||
static unsigned short ignore = I2C_CLIENT_END;
|
static unsigned short ignore = I2C_CLIENT_END;
|
||||||
|
|
||||||
static struct i2c_client_address_data addr_data = {
|
static struct i2c_client_address_data addr_data = {
|
||||||
.normal_i2c = normal_i2c,
|
.normal_i2c = normal_i2c,
|
||||||
.probe = &ignore,
|
.probe = &ignore,
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
#define PAL_MSB_VERTICAL 0x40 /* 7c */
|
#define PAL_MSB_VERTICAL 0x40 /* 7c */
|
||||||
|
|
||||||
/* Initialization Sequence */
|
/* Initialization Sequence */
|
||||||
|
|
||||||
static __u8 init7121ntsc[] = {
|
static __u8 init7121ntsc[] = {
|
||||||
0x26, 0x0, 0x27, 0x0,
|
0x26, 0x0, 0x27, 0x0,
|
||||||
0x28, NTSC_BURST_START, 0x29, NTSC_BURST_END,
|
0x28, NTSC_BURST_START, 0x29, NTSC_BURST_END,
|
||||||
@ -95,7 +95,7 @@ static __u8 init7121ntsc[] = {
|
|||||||
0x78, 0x0, 0x79, 0x0, 0x7a, NTSC_FIRST_ACTIVE,
|
0x78, 0x0, 0x79, 0x0, 0x7a, NTSC_FIRST_ACTIVE,
|
||||||
0x7b, NTSC_LAST_ACTIVE, 0x7c, NTSC_MSB_VERTICAL,
|
0x7b, NTSC_LAST_ACTIVE, 0x7c, NTSC_MSB_VERTICAL,
|
||||||
0x7d, 0x0, 0x7e, 0x0, 0x7f, 0x0
|
0x7d, 0x0, 0x7e, 0x0, 0x7f, 0x0
|
||||||
};
|
};
|
||||||
#define INIT7121LEN (sizeof(init7121ntsc)/2)
|
#define INIT7121LEN (sizeof(init7121ntsc)/2)
|
||||||
|
|
||||||
static __u8 init7121pal[] = {
|
static __u8 init7121pal[] = {
|
||||||
@ -128,5 +128,5 @@ static __u8 init7121pal[] = {
|
|||||||
0x78, 0x0, 0x79, 0x0, 0x7a, PAL_FIRST_ACTIVE,
|
0x78, 0x0, 0x79, 0x0, 0x7a, PAL_FIRST_ACTIVE,
|
||||||
0x7b, PAL_LAST_ACTIVE, 0x7c, PAL_MSB_VERTICAL,
|
0x7b, PAL_LAST_ACTIVE, 0x7c, PAL_MSB_VERTICAL,
|
||||||
0x7d, 0x0, 0x7e, 0x0, 0x7f, 0x0
|
0x7d, 0x0, 0x7e, 0x0, 0x7f, 0x0
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
saa7146.h - definitions philips saa7146 based cards
|
saa7146.h - definitions philips saa7146 based cards
|
||||||
Copyright (C) 1999 Nathan Laredo (laredo@gnu.org)
|
Copyright (C) 1999 Nathan Laredo (laredo@gnu.org)
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include <linux/videodev.h>
|
#include <linux/videodev.h>
|
||||||
|
|
||||||
#ifndef O_NONCAP
|
#ifndef O_NONCAP
|
||||||
#define O_NONCAP O_TRUNC
|
#define O_NONCAP O_TRUNC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
|
|
||||||
struct saa7146_window
|
struct saa7146_window
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
ushort width, height;
|
ushort width, height;
|
||||||
@ -70,7 +70,7 @@ struct saa7146
|
|||||||
int irqstate; /* irq routine is state driven */
|
int irqstate; /* irq routine is state driven */
|
||||||
int writemode;
|
int writemode;
|
||||||
int playmode;
|
int playmode;
|
||||||
unsigned int nr;
|
unsigned int nr;
|
||||||
unsigned long irq; /* IRQ used by SAA7146 card */
|
unsigned long irq; /* IRQ used by SAA7146 card */
|
||||||
unsigned short id;
|
unsigned short id;
|
||||||
unsigned char revision;
|
unsigned char revision;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
saa7146.h - definitions philips saa7146 based cards
|
saa7146.h - definitions philips saa7146 based cards
|
||||||
Copyright (C) 1999 Nathan Laredo (laredo@gnu.org)
|
Copyright (C) 1999 Nathan Laredo (laredo@gnu.org)
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* saa7185 - Philips SAA7185B video encoder driver version 0.0.3
|
* saa7185 - Philips SAA7185B video encoder driver version 0.0.3
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 Dave Perks <dperks@ibm.net>
|
* Copyright (C) 1998 Dave Perks <dperks@ibm.net>
|
||||||
@ -377,7 +377,7 @@ saa7185_command (struct i2c_client *client,
|
|||||||
static unsigned short normal_i2c[] = { I2C_SAA7185 >> 1, I2C_CLIENT_END };
|
static unsigned short normal_i2c[] = { I2C_SAA7185 >> 1, I2C_CLIENT_END };
|
||||||
|
|
||||||
static unsigned short ignore = I2C_CLIENT_END;
|
static unsigned short ignore = I2C_CLIENT_END;
|
||||||
|
|
||||||
static struct i2c_client_address_data addr_data = {
|
static struct i2c_client_address_data addr_data = {
|
||||||
.normal_i2c = normal_i2c,
|
.normal_i2c = normal_i2c,
|
||||||
.probe = &ignore,
|
.probe = &ignore,
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
Definitions for the Philips SAA7196 digital video decoder,
|
Definitions for the Philips SAA7196 digital video decoder,
|
||||||
scaler, and clock generator circuit (DESCpro), as used in
|
scaler, and clock generator circuit (DESCpro), as used in
|
||||||
the PlanB video input of the Powermac 7x00/8x00 series.
|
the PlanB video input of the Powermac 7x00/8x00 series.
|
||||||
|
|
||||||
Copyright (C) 1998 Michel Lanners (mlan@cpu.lu)
|
Copyright (C) 1998 Michel Lanners (mlan@cpu.lu)
|
||||||
|
|
||||||
The register defines are shamelessly copied from the meteor
|
The register defines are shamelessly copied from the meteor
|
||||||
driver out of NetBSD (with permission),
|
driver out of NetBSD (with permission),
|
||||||
and are copyrighted (c) 1995 Mark Tinguely and Jim Lowe
|
and are copyrighted (c) 1995 Mark Tinguely and Jim Lowe
|
||||||
(Thanks !)
|
(Thanks !)
|
||||||
|
|
||||||
Additional debugging and coding by Takashi Oe (toe@unlinfo.unl.edu)
|
Additional debugging and coding by Takashi Oe (toe@unlinfo.unl.edu)
|
||||||
|
|
||||||
The default values used for PlanB are my mistakes.
|
The default values used for PlanB are my mistakes.
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org)
|
* Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org)
|
||||||
*
|
*
|
||||||
* Still somewhat based on the Linux ov511 driver.
|
* Still somewhat based on the Linux ov511 driver.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* 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
|
* 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
|
* Free Software Foundation; either version 2 of the License, or (at your
|
||||||
@ -114,16 +114,16 @@ static int se401_sndctrl(int set, struct usb_se401 *se401, unsigned short req,
|
|||||||
unsigned short value, unsigned char *cp, int size)
|
unsigned short value, unsigned char *cp, int size)
|
||||||
{
|
{
|
||||||
return usb_control_msg (
|
return usb_control_msg (
|
||||||
se401->dev,
|
se401->dev,
|
||||||
set ? usb_sndctrlpipe(se401->dev, 0) : usb_rcvctrlpipe(se401->dev, 0),
|
set ? usb_sndctrlpipe(se401->dev, 0) : usb_rcvctrlpipe(se401->dev, 0),
|
||||||
req,
|
req,
|
||||||
(set ? USB_DIR_OUT : USB_DIR_IN) | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
(set ? USB_DIR_OUT : USB_DIR_IN) | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||||
value,
|
value,
|
||||||
0,
|
0,
|
||||||
cp,
|
cp,
|
||||||
size,
|
size,
|
||||||
1000
|
1000
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int se401_set_feature(struct usb_se401 *se401, unsigned short selector,
|
static int se401_set_feature(struct usb_se401 *se401, unsigned short selector,
|
||||||
@ -140,30 +140,30 @@ static int se401_set_feature(struct usb_se401 *se401, unsigned short selector,
|
|||||||
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||||
param,
|
param,
|
||||||
selector,
|
selector,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
1000
|
1000
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned short se401_get_feature(struct usb_se401 *se401,
|
static unsigned short se401_get_feature(struct usb_se401 *se401,
|
||||||
unsigned short selector)
|
unsigned short selector)
|
||||||
{
|
{
|
||||||
/* For 'set' the selecetor should be in index, not sure if the spec is
|
/* For 'set' the selecetor should be in index, not sure if the spec is
|
||||||
wrong here to....
|
wrong here to....
|
||||||
*/
|
*/
|
||||||
unsigned char cp[2];
|
unsigned char cp[2];
|
||||||
usb_control_msg (
|
usb_control_msg (
|
||||||
se401->dev,
|
se401->dev,
|
||||||
usb_rcvctrlpipe(se401->dev, 0),
|
usb_rcvctrlpipe(se401->dev, 0),
|
||||||
SE401_REQ_GET_EXT_FEATURE,
|
SE401_REQ_GET_EXT_FEATURE,
|
||||||
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||||
0,
|
0,
|
||||||
selector,
|
selector,
|
||||||
cp,
|
cp,
|
||||||
2,
|
2,
|
||||||
1000
|
1000
|
||||||
);
|
);
|
||||||
return cp[0]+cp[1]*256;
|
return cp[0]+cp[1]*256;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,14 +183,14 @@ static int se401_send_pict(struct usb_se401 *se401)
|
|||||||
se401_set_feature(se401, HV7131_REG_ARCG, se401->rgain);/* red color gain */
|
se401_set_feature(se401, HV7131_REG_ARCG, se401->rgain);/* red color gain */
|
||||||
se401_set_feature(se401, HV7131_REG_AGCG, se401->ggain);/* green color gain */
|
se401_set_feature(se401, HV7131_REG_AGCG, se401->ggain);/* green color gain */
|
||||||
se401_set_feature(se401, HV7131_REG_ABCG, se401->bgain);/* blue color gain */
|
se401_set_feature(se401, HV7131_REG_ABCG, se401->bgain);/* blue color gain */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void se401_set_exposure(struct usb_se401 *se401, int brightness)
|
static void se401_set_exposure(struct usb_se401 *se401, int brightness)
|
||||||
{
|
{
|
||||||
int integration=brightness<<5;
|
int integration=brightness<<5;
|
||||||
|
|
||||||
if (flickerless==50) {
|
if (flickerless==50) {
|
||||||
integration=integration-integration%106667;
|
integration=integration-integration%106667;
|
||||||
}
|
}
|
||||||
@ -255,11 +255,11 @@ static void se401_auto_resetlevel(struct usb_se401 *se401)
|
|||||||
/* For some reason this normally read-only register doesn't get reset
|
/* For some reason this normally read-only register doesn't get reset
|
||||||
to zero after reading them just once...
|
to zero after reading them just once...
|
||||||
*/
|
*/
|
||||||
se401_get_feature(se401, HV7131_REG_HIREFNOH);
|
se401_get_feature(se401, HV7131_REG_HIREFNOH);
|
||||||
se401_get_feature(se401, HV7131_REG_HIREFNOL);
|
se401_get_feature(se401, HV7131_REG_HIREFNOL);
|
||||||
se401_get_feature(se401, HV7131_REG_LOREFNOH);
|
se401_get_feature(se401, HV7131_REG_LOREFNOH);
|
||||||
se401_get_feature(se401, HV7131_REG_LOREFNOL);
|
se401_get_feature(se401, HV7131_REG_LOREFNOL);
|
||||||
ahrc=256*se401_get_feature(se401, HV7131_REG_HIREFNOH) +
|
ahrc=256*se401_get_feature(se401, HV7131_REG_HIREFNOH) +
|
||||||
se401_get_feature(se401, HV7131_REG_HIREFNOL);
|
se401_get_feature(se401, HV7131_REG_HIREFNOL);
|
||||||
alrc=256*se401_get_feature(se401, HV7131_REG_LOREFNOH) +
|
alrc=256*se401_get_feature(se401, HV7131_REG_LOREFNOH) +
|
||||||
se401_get_feature(se401, HV7131_REG_LOREFNOL);
|
se401_get_feature(se401, HV7131_REG_LOREFNOL);
|
||||||
@ -287,12 +287,12 @@ static void se401_button_irq(struct urb *urb, struct pt_regs *regs)
|
|||||||
{
|
{
|
||||||
struct usb_se401 *se401 = urb->context;
|
struct usb_se401 *se401 = urb->context;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (!se401->dev) {
|
if (!se401->dev) {
|
||||||
info("ohoh: device vapourished");
|
info("ohoh: device vapourished");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (urb->status) {
|
switch (urb->status) {
|
||||||
case 0:
|
case 0:
|
||||||
/* success */
|
/* success */
|
||||||
@ -368,7 +368,7 @@ static void se401_video_irq(struct urb *urb, struct pt_regs *regs)
|
|||||||
if (se401->nullpackets > SE401_MAX_NULLPACKETS) {
|
if (se401->nullpackets > SE401_MAX_NULLPACKETS) {
|
||||||
if (waitqueue_active(&se401->wq)) {
|
if (waitqueue_active(&se401->wq)) {
|
||||||
wake_up_interruptible(&se401->wq);
|
wake_up_interruptible(&se401->wq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,8 +433,8 @@ static int se401_start_stream(struct usb_se401 *se401)
|
|||||||
int err=0, i;
|
int err=0, i;
|
||||||
se401->streaming=1;
|
se401->streaming=1;
|
||||||
|
|
||||||
se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0);
|
se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0);
|
||||||
se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0);
|
se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0);
|
||||||
|
|
||||||
/* Set picture settings */
|
/* Set picture settings */
|
||||||
se401_set_feature(se401, HV7131_REG_MODE_B, 0x05);/*windowed + pix intg */
|
se401_set_feature(se401, HV7131_REG_MODE_B, 0x05);/*windowed + pix intg */
|
||||||
@ -571,7 +571,7 @@ static inline void decode_JangGu_integrate(struct usb_se401 *se401, int data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* First three are absolute, all others relative.
|
/* First three are absolute, all others relative.
|
||||||
* Format is rgb from right to left (mirrorred image),
|
* Format is rgb from right to left (mirrorred image),
|
||||||
* we flip it to get bgr from left to right. */
|
* we flip it to get bgr from left to right. */
|
||||||
if (frame->curlinepix < 3) {
|
if (frame->curlinepix < 3) {
|
||||||
*(frame->curline-frame->curlinepix)=1+data*4;
|
*(frame->curline-frame->curlinepix)=1+data*4;
|
||||||
@ -703,7 +703,7 @@ static inline void decode_bayer (struct usb_se401 *se401, struct se401_scratch *
|
|||||||
int width=se401->cwidth;
|
int width=se401->cwidth;
|
||||||
int blineoffset=0, bline;
|
int blineoffset=0, bline;
|
||||||
int linelength=width*3, i;
|
int linelength=width*3, i;
|
||||||
|
|
||||||
|
|
||||||
if (frame->curpix==0) {
|
if (frame->curpix==0) {
|
||||||
if (frame->grabstate==FRAME_READY) {
|
if (frame->grabstate==FRAME_READY) {
|
||||||
@ -831,7 +831,7 @@ static int se401_newframe(struct usb_se401 *se401, int framenr)
|
|||||||
se401->nullpackets=0;
|
se401->nullpackets=0;
|
||||||
info("to many null length packets, restarting capture");
|
info("to many null length packets, restarting capture");
|
||||||
se401_stop_stream(se401);
|
se401_stop_stream(se401);
|
||||||
se401_start_stream(se401);
|
se401_start_stream(se401);
|
||||||
} else {
|
} else {
|
||||||
if (se401->scratch[se401->scratch_use].state!=BUFFER_READY) {
|
if (se401->scratch[se401->scratch_use].state!=BUFFER_READY) {
|
||||||
se401->frame[framenr].grabstate=FRAME_ERROR;
|
se401->frame[framenr].grabstate=FRAME_ERROR;
|
||||||
@ -866,7 +866,7 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
se401->dev = NULL;
|
se401->dev = NULL;
|
||||||
|
|
||||||
for (i=0; i<SE401_NUMSBUF; i++)
|
for (i=0; i<SE401_NUMSBUF; i++)
|
||||||
if (se401->urb[i]) {
|
if (se401->urb[i]) {
|
||||||
@ -882,9 +882,9 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401)
|
|||||||
usb_kill_urb(se401->inturb);
|
usb_kill_urb(se401->inturb);
|
||||||
usb_free_urb(se401->inturb);
|
usb_free_urb(se401->inturb);
|
||||||
}
|
}
|
||||||
info("%s disconnected", se401->camera_name);
|
info("%s disconnected", se401->camera_name);
|
||||||
|
|
||||||
/* Free the memory */
|
/* Free the memory */
|
||||||
kfree(se401->width);
|
kfree(se401->width);
|
||||||
kfree(se401->height);
|
kfree(se401->height);
|
||||||
kfree(se401);
|
kfree(se401);
|
||||||
@ -910,7 +910,7 @@ static int se401_open(struct inode *inode, struct file *file)
|
|||||||
se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES);
|
se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES);
|
||||||
if (se401->fbuf)
|
if (se401->fbuf)
|
||||||
file->private_data = dev;
|
file->private_data = dev;
|
||||||
else
|
else
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
se401->user = !err;
|
se401->user = !err;
|
||||||
|
|
||||||
@ -920,11 +920,11 @@ static int se401_open(struct inode *inode, struct file *file)
|
|||||||
static int se401_close(struct inode *inode, struct file *file)
|
static int se401_close(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
struct video_device *dev = file->private_data;
|
struct video_device *dev = file->private_data;
|
||||||
struct usb_se401 *se401 = (struct usb_se401 *)dev;
|
struct usb_se401 *se401 = (struct usb_se401 *)dev;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
rvfree(se401->fbuf, se401->maxframesize * SE401_NUMFRAMES);
|
rvfree(se401->fbuf, se401->maxframesize * SE401_NUMFRAMES);
|
||||||
if (se401->removed) {
|
if (se401->removed) {
|
||||||
usb_se401_remove_disconnected(se401);
|
usb_se401_remove_disconnected(se401);
|
||||||
info("device unregistered");
|
info("device unregistered");
|
||||||
} else {
|
} else {
|
||||||
@ -942,12 +942,12 @@ static int se401_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
unsigned int cmd, void *arg)
|
unsigned int cmd, void *arg)
|
||||||
{
|
{
|
||||||
struct video_device *vdev = file->private_data;
|
struct video_device *vdev = file->private_data;
|
||||||
struct usb_se401 *se401 = (struct usb_se401 *)vdev;
|
struct usb_se401 *se401 = (struct usb_se401 *)vdev;
|
||||||
|
|
||||||
if (!se401->dev)
|
if (!se401->dev)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case VIDIOCGCAP:
|
case VIDIOCGCAP:
|
||||||
{
|
{
|
||||||
struct video_capability *b = arg;
|
struct video_capability *b = arg;
|
||||||
@ -981,8 +981,8 @@ static int se401_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCGPICT:
|
case VIDIOCGPICT:
|
||||||
{
|
{
|
||||||
struct video_picture *p = arg;
|
struct video_picture *p = arg;
|
||||||
|
|
||||||
se401_get_pict(se401, p);
|
se401_get_pict(se401, p);
|
||||||
@ -1007,7 +1007,7 @@ static int se401_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
if (se401_set_size(se401, vw->width, vw->height))
|
if (se401_set_size(se401, vw->width, vw->height))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCGWIN:
|
case VIDIOCGWIN:
|
||||||
{
|
{
|
||||||
struct video_window *vw = arg;
|
struct video_window *vw = arg;
|
||||||
@ -1095,11 +1095,11 @@ static int se401_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
case VIDIOCGAUDIO:
|
case VIDIOCGAUDIO:
|
||||||
case VIDIOCSAUDIO:
|
case VIDIOCSAUDIO:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOIOCTLCMD;
|
||||||
} /* end switch */
|
} /* end switch */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int se401_ioctl(struct inode *inode, struct file *file,
|
static int se401_ioctl(struct inode *inode, struct file *file,
|
||||||
@ -1142,7 +1142,7 @@ static ssize_t se401_read(struct file *file, char __user *buf,
|
|||||||
|
|
||||||
se401->frame[0].grabstate=FRAME_UNUSED;
|
se401->frame[0].grabstate=FRAME_UNUSED;
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
if (copy_to_user(buf, se401->frame[0].data, realcount))
|
if (copy_to_user(buf, se401->frame[0].data, realcount))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
@ -1183,24 +1183,24 @@ static int se401_mmap(struct file *file, struct vm_area_struct *vma)
|
|||||||
}
|
}
|
||||||
mutex_unlock(&se401->lock);
|
mutex_unlock(&se401->lock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct file_operations se401_fops = {
|
static struct file_operations se401_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.open = se401_open,
|
.open = se401_open,
|
||||||
.release = se401_close,
|
.release = se401_close,
|
||||||
.read = se401_read,
|
.read = se401_read,
|
||||||
.mmap = se401_mmap,
|
.mmap = se401_mmap,
|
||||||
.ioctl = se401_ioctl,
|
.ioctl = se401_ioctl,
|
||||||
.compat_ioctl = v4l_compat_ioctl32,
|
.compat_ioctl = v4l_compat_ioctl32,
|
||||||
.llseek = no_llseek,
|
.llseek = no_llseek,
|
||||||
};
|
};
|
||||||
static struct video_device se401_template = {
|
static struct video_device se401_template = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.name = "se401 USB camera",
|
.name = "se401 USB camera",
|
||||||
.type = VID_TYPE_CAPTURE,
|
.type = VID_TYPE_CAPTURE,
|
||||||
.hardware = VID_HARDWARE_SE401,
|
.hardware = VID_HARDWARE_SE401,
|
||||||
.fops = &se401_fops,
|
.fops = &se401_fops,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1209,12 +1209,12 @@ static struct video_device se401_template = {
|
|||||||
/***************************/
|
/***************************/
|
||||||
static int se401_init(struct usb_se401 *se401, int button)
|
static int se401_init(struct usb_se401 *se401, int button)
|
||||||
{
|
{
|
||||||
int i=0, rc;
|
int i=0, rc;
|
||||||
unsigned char cp[0x40];
|
unsigned char cp[0x40];
|
||||||
char temp[200];
|
char temp[200];
|
||||||
|
|
||||||
/* led on */
|
/* led on */
|
||||||
se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0);
|
se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0);
|
||||||
|
|
||||||
/* get camera descriptor */
|
/* get camera descriptor */
|
||||||
rc=se401_sndctrl(0, se401, SE401_REQ_GET_CAMERA_DESCRIPTOR, 0, cp, sizeof(cp));
|
rc=se401_sndctrl(0, se401, SE401_REQ_GET_CAMERA_DESCRIPTOR, 0, cp, sizeof(cp));
|
||||||
@ -1254,7 +1254,7 @@ static int se401_init(struct usb_se401 *se401, int button)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* set output mode (BAYER) */
|
/* set output mode (BAYER) */
|
||||||
se401_sndctrl(1, se401, SE401_REQ_SET_OUTPUT_MODE, SE401_FORMAT_BAYER, NULL, 0);
|
se401_sndctrl(1, se401, SE401_REQ_SET_OUTPUT_MODE, SE401_FORMAT_BAYER, NULL, 0);
|
||||||
|
|
||||||
rc=se401_sndctrl(0, se401, SE401_REQ_GET_BRT, 0, cp, sizeof(cp));
|
rc=se401_sndctrl(0, se401, SE401_REQ_GET_BRT, 0, cp, sizeof(cp));
|
||||||
se401->brightness=cp[0]+cp[1]*256;
|
se401->brightness=cp[0]+cp[1]*256;
|
||||||
@ -1292,71 +1292,71 @@ static int se401_init(struct usb_se401 *se401, int button)
|
|||||||
} else
|
} else
|
||||||
se401->inturb=NULL;
|
se401->inturb=NULL;
|
||||||
|
|
||||||
/* Flash the led */
|
/* Flash the led */
|
||||||
se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0);
|
se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0);
|
||||||
se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0);
|
se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0);
|
||||||
se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 0, NULL, 0);
|
se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 0, NULL, 0);
|
||||||
se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 0, NULL, 0);
|
se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 0, NULL, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int se401_probe(struct usb_interface *intf,
|
static int se401_probe(struct usb_interface *intf,
|
||||||
const struct usb_device_id *id)
|
const struct usb_device_id *id)
|
||||||
{
|
{
|
||||||
struct usb_device *dev = interface_to_usbdev(intf);
|
struct usb_device *dev = interface_to_usbdev(intf);
|
||||||
struct usb_interface_descriptor *interface;
|
struct usb_interface_descriptor *interface;
|
||||||
struct usb_se401 *se401;
|
struct usb_se401 *se401;
|
||||||
char *camera_name=NULL;
|
char *camera_name=NULL;
|
||||||
int button=1;
|
int button=1;
|
||||||
|
|
||||||
/* We don't handle multi-config cameras */
|
/* We don't handle multi-config cameras */
|
||||||
if (dev->descriptor.bNumConfigurations != 1)
|
if (dev->descriptor.bNumConfigurations != 1)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
interface = &intf->cur_altsetting->desc;
|
interface = &intf->cur_altsetting->desc;
|
||||||
|
|
||||||
/* Is it an se401? */
|
/* Is it an se401? */
|
||||||
if (le16_to_cpu(dev->descriptor.idVendor) == 0x03e8 &&
|
if (le16_to_cpu(dev->descriptor.idVendor) == 0x03e8 &&
|
||||||
le16_to_cpu(dev->descriptor.idProduct) == 0x0004) {
|
le16_to_cpu(dev->descriptor.idProduct) == 0x0004) {
|
||||||
camera_name="Endpoints/Aox SE401";
|
camera_name="Endpoints/Aox SE401";
|
||||||
} else if (le16_to_cpu(dev->descriptor.idVendor) == 0x0471 &&
|
} else if (le16_to_cpu(dev->descriptor.idVendor) == 0x0471 &&
|
||||||
le16_to_cpu(dev->descriptor.idProduct) == 0x030b) {
|
le16_to_cpu(dev->descriptor.idProduct) == 0x030b) {
|
||||||
camera_name="Philips PCVC665K";
|
camera_name="Philips PCVC665K";
|
||||||
} else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d &&
|
} else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d &&
|
||||||
le16_to_cpu(dev->descriptor.idProduct) == 0x5001) {
|
le16_to_cpu(dev->descriptor.idProduct) == 0x5001) {
|
||||||
camera_name="Kensington VideoCAM 67014";
|
camera_name="Kensington VideoCAM 67014";
|
||||||
} else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d &&
|
} else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d &&
|
||||||
le16_to_cpu(dev->descriptor.idProduct) == 0x5002) {
|
le16_to_cpu(dev->descriptor.idProduct) == 0x5002) {
|
||||||
camera_name="Kensington VideoCAM 6701(5/7)";
|
camera_name="Kensington VideoCAM 6701(5/7)";
|
||||||
} else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d &&
|
} else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d &&
|
||||||
le16_to_cpu(dev->descriptor.idProduct) == 0x5003) {
|
le16_to_cpu(dev->descriptor.idProduct) == 0x5003) {
|
||||||
camera_name="Kensington VideoCAM 67016";
|
camera_name="Kensington VideoCAM 67016";
|
||||||
button=0;
|
button=0;
|
||||||
} else
|
} else
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
/* Checking vendor/product should be enough, but what the hell */
|
/* Checking vendor/product should be enough, but what the hell */
|
||||||
if (interface->bInterfaceClass != 0x00)
|
if (interface->bInterfaceClass != 0x00)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
if (interface->bInterfaceSubClass != 0x00)
|
if (interface->bInterfaceSubClass != 0x00)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
/* We found one */
|
/* We found one */
|
||||||
info("SE401 camera found: %s", camera_name);
|
info("SE401 camera found: %s", camera_name);
|
||||||
|
|
||||||
if ((se401 = kzalloc(sizeof(*se401), GFP_KERNEL)) == NULL) {
|
if ((se401 = kzalloc(sizeof(*se401), GFP_KERNEL)) == NULL) {
|
||||||
err("couldn't kmalloc se401 struct");
|
err("couldn't kmalloc se401 struct");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
se401->dev = dev;
|
se401->dev = dev;
|
||||||
se401->iface = interface->bInterfaceNumber;
|
se401->iface = interface->bInterfaceNumber;
|
||||||
se401->camera_name = camera_name;
|
se401->camera_name = camera_name;
|
||||||
|
|
||||||
info("firmware version: %02x", le16_to_cpu(dev->descriptor.bcdDevice) & 255);
|
info("firmware version: %02x", le16_to_cpu(dev->descriptor.bcdDevice) & 255);
|
||||||
|
|
||||||
if (se401_init(se401, button)) {
|
if (se401_init(se401, button)) {
|
||||||
kfree(se401);
|
kfree(se401);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
@ -1375,7 +1375,7 @@ static int se401_probe(struct usb_interface *intf,
|
|||||||
info("registered new video device: video%d", se401->vdev.minor);
|
info("registered new video device: video%d", se401->vdev.minor);
|
||||||
|
|
||||||
usb_set_intfdata (intf, se401);
|
usb_set_intfdata (intf, se401);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void se401_disconnect(struct usb_interface *intf)
|
static void se401_disconnect(struct usb_interface *intf)
|
||||||
@ -1400,10 +1400,10 @@ static void se401_disconnect(struct usb_interface *intf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct usb_driver se401_driver = {
|
static struct usb_driver se401_driver = {
|
||||||
.name = "se401",
|
.name = "se401",
|
||||||
.id_table = device_table,
|
.id_table = device_table,
|
||||||
.probe = se401_probe,
|
.probe = se401_probe,
|
||||||
.disconnect = se401_disconnect,
|
.disconnect = se401_disconnect,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ struct usb_se401 {
|
|||||||
int expose_m;
|
int expose_m;
|
||||||
int expose_l;
|
int expose_l;
|
||||||
int resetlevel;
|
int resetlevel;
|
||||||
|
|
||||||
int enhance;
|
int enhance;
|
||||||
|
|
||||||
int format;
|
int format;
|
||||||
@ -200,12 +200,12 @@ struct usb_se401 {
|
|||||||
|
|
||||||
struct urb *urb[SE401_NUMSBUF];
|
struct urb *urb[SE401_NUMSBUF];
|
||||||
struct urb *inturb;
|
struct urb *inturb;
|
||||||
|
|
||||||
int button;
|
int button;
|
||||||
int buttonpressed;
|
int buttonpressed;
|
||||||
|
|
||||||
int curframe; /* Current receiving frame */
|
int curframe; /* Current receiving frame */
|
||||||
struct se401_frame frame[SE401_NUMFRAMES];
|
struct se401_frame frame[SE401_NUMFRAMES];
|
||||||
int readcount;
|
int readcount;
|
||||||
int framecount;
|
int framecount;
|
||||||
int error;
|
int error;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o \
|
sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o \
|
||||||
sn9c102_ov7630.o sn9c102_pas106b.o sn9c102_pas202bca.o \
|
sn9c102_ov7630.o sn9c102_pas106b.o sn9c102_pas202bca.o \
|
||||||
sn9c102_pas202bcb.o sn9c102_tas5110c1b.o \
|
sn9c102_pas202bcb.o sn9c102_tas5110c1b.o \
|
||||||
sn9c102_tas5130d1b.o
|
sn9c102_tas5130d1b.o
|
||||||
|
|
||||||
obj-$(CONFIG_USB_SN9C102) += sn9c102.o
|
obj-$(CONFIG_USB_SN9C102) += sn9c102.o
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id)
|
|||||||
|
|
||||||
void
|
void
|
||||||
sn9c102_attach_sensor(struct sn9c102_device* cam,
|
sn9c102_attach_sensor(struct sn9c102_device* cam,
|
||||||
struct sn9c102_sensor* sensor)
|
struct sn9c102_sensor* sensor)
|
||||||
{
|
{
|
||||||
memcpy(&cam->sensor, sensor, sizeof(struct sn9c102_sensor));
|
memcpy(&cam->sensor, sensor, sizeof(struct sn9c102_sensor));
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ do { \
|
|||||||
dev_info(&cam->usbdev->dev, fmt "\n", ## args); \
|
dev_info(&cam->usbdev->dev, fmt "\n", ## args); \
|
||||||
else if ((level) >= 3) \
|
else if ((level) >= 3) \
|
||||||
dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
|
dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
|
||||||
__FUNCTION__, __LINE__ , ## args); \
|
__FUNCTION__, __LINE__ , ## args); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
# define V4LDBG(level, name, cmd) \
|
# define V4LDBG(level, name, cmd) \
|
||||||
@ -198,7 +198,7 @@ do { \
|
|||||||
pr_info("sn9c102: " fmt "\n", ## args); \
|
pr_info("sn9c102: " fmt "\n", ## args); \
|
||||||
else if ((level) == 3) \
|
else if ((level) == 3) \
|
||||||
pr_debug("sn9c102: [%s:%d] " fmt "\n", __FUNCTION__, \
|
pr_debug("sn9c102: [%s:%d] " fmt "\n", __FUNCTION__, \
|
||||||
__LINE__ , ## args); \
|
__LINE__ , ## args); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
@ -210,7 +210,7 @@ do { \
|
|||||||
#undef PDBG
|
#undef PDBG
|
||||||
#define PDBG(fmt, args...) \
|
#define PDBG(fmt, args...) \
|
||||||
dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
|
dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
|
||||||
__FUNCTION__, __LINE__ , ## args)
|
__FUNCTION__, __LINE__ , ## args)
|
||||||
|
|
||||||
#undef PDBGG
|
#undef PDBGG
|
||||||
#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */
|
#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */
|
||||||
|
@ -62,53 +62,53 @@ MODULE_LICENSE(SN9C102_MODULE_LICENSE);
|
|||||||
static short video_nr[] = {[0 ... SN9C102_MAX_DEVICES-1] = -1};
|
static short video_nr[] = {[0 ... SN9C102_MAX_DEVICES-1] = -1};
|
||||||
module_param_array(video_nr, short, NULL, 0444);
|
module_param_array(video_nr, short, NULL, 0444);
|
||||||
MODULE_PARM_DESC(video_nr,
|
MODULE_PARM_DESC(video_nr,
|
||||||
"\n<-1|n[,...]> Specify V4L2 minor mode number."
|
"\n<-1|n[,...]> Specify V4L2 minor mode number."
|
||||||
"\n -1 = use next available (default)"
|
"\n -1 = use next available (default)"
|
||||||
"\n n = use minor number n (integer >= 0)"
|
"\n n = use minor number n (integer >= 0)"
|
||||||
"\nYou can specify up to "__MODULE_STRING(SN9C102_MAX_DEVICES)
|
"\nYou can specify up to "__MODULE_STRING(SN9C102_MAX_DEVICES)
|
||||||
" cameras this way."
|
" cameras this way."
|
||||||
"\nFor example:"
|
"\nFor example:"
|
||||||
"\nvideo_nr=-1,2,-1 would assign minor number 2 to"
|
"\nvideo_nr=-1,2,-1 would assign minor number 2 to"
|
||||||
"\nthe second camera and use auto for the first"
|
"\nthe second camera and use auto for the first"
|
||||||
"\none and for every other camera."
|
"\none and for every other camera."
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
static short force_munmap[] = {[0 ... SN9C102_MAX_DEVICES-1] =
|
static short force_munmap[] = {[0 ... SN9C102_MAX_DEVICES-1] =
|
||||||
SN9C102_FORCE_MUNMAP};
|
SN9C102_FORCE_MUNMAP};
|
||||||
module_param_array(force_munmap, bool, NULL, 0444);
|
module_param_array(force_munmap, bool, NULL, 0444);
|
||||||
MODULE_PARM_DESC(force_munmap,
|
MODULE_PARM_DESC(force_munmap,
|
||||||
"\n<0|1[,...]> Force the application to unmap previously"
|
"\n<0|1[,...]> Force the application to unmap previously"
|
||||||
"\nmapped buffer memory before calling any VIDIOC_S_CROP or"
|
"\nmapped buffer memory before calling any VIDIOC_S_CROP or"
|
||||||
"\nVIDIOC_S_FMT ioctl's. Not all the applications support"
|
"\nVIDIOC_S_FMT ioctl's. Not all the applications support"
|
||||||
"\nthis feature. This parameter is specific for each"
|
"\nthis feature. This parameter is specific for each"
|
||||||
"\ndetected camera."
|
"\ndetected camera."
|
||||||
"\n 0 = do not force memory unmapping"
|
"\n 0 = do not force memory unmapping"
|
||||||
"\n 1 = force memory unmapping (save memory)"
|
"\n 1 = force memory unmapping (save memory)"
|
||||||
"\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"."
|
"\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"."
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
static unsigned int frame_timeout[] = {[0 ... SN9C102_MAX_DEVICES-1] =
|
static unsigned int frame_timeout[] = {[0 ... SN9C102_MAX_DEVICES-1] =
|
||||||
SN9C102_FRAME_TIMEOUT};
|
SN9C102_FRAME_TIMEOUT};
|
||||||
module_param_array(frame_timeout, uint, NULL, 0644);
|
module_param_array(frame_timeout, uint, NULL, 0644);
|
||||||
MODULE_PARM_DESC(frame_timeout,
|
MODULE_PARM_DESC(frame_timeout,
|
||||||
"\n<n[,...]> Timeout for a video frame in seconds."
|
"\n<n[,...]> Timeout for a video frame in seconds."
|
||||||
"\nThis parameter is specific for each detected camera."
|
"\nThis parameter is specific for each detected camera."
|
||||||
"\nDefault value is "__MODULE_STRING(SN9C102_FRAME_TIMEOUT)"."
|
"\nDefault value is "__MODULE_STRING(SN9C102_FRAME_TIMEOUT)"."
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#ifdef SN9C102_DEBUG
|
#ifdef SN9C102_DEBUG
|
||||||
static unsigned short debug = SN9C102_DEBUG_LEVEL;
|
static unsigned short debug = SN9C102_DEBUG_LEVEL;
|
||||||
module_param(debug, ushort, 0644);
|
module_param(debug, ushort, 0644);
|
||||||
MODULE_PARM_DESC(debug,
|
MODULE_PARM_DESC(debug,
|
||||||
"\n<n> Debugging information level, from 0 to 3:"
|
"\n<n> Debugging information level, from 0 to 3:"
|
||||||
"\n0 = none (use carefully)"
|
"\n0 = none (use carefully)"
|
||||||
"\n1 = critical errors"
|
"\n1 = critical errors"
|
||||||
"\n2 = significant informations"
|
"\n2 = significant informations"
|
||||||
"\n3 = more verbose messages"
|
"\n3 = more verbose messages"
|
||||||
"\nLevel 3 is useful for testing only, when only "
|
"\nLevel 3 is useful for testing only, when only "
|
||||||
"one device is used."
|
"one device is used."
|
||||||
"\nDefault value is "__MODULE_STRING(SN9C102_DEBUG_LEVEL)"."
|
"\nDefault value is "__MODULE_STRING(SN9C102_DEBUG_LEVEL)"."
|
||||||
"\n");
|
"\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -131,16 +131,16 @@ static sn9c102_eof_header_t sn9c102_eof_header[] = {
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static u32
|
static u32
|
||||||
sn9c102_request_buffers(struct sn9c102_device* cam, u32 count,
|
sn9c102_request_buffers(struct sn9c102_device* cam, u32 count,
|
||||||
enum sn9c102_io_method io)
|
enum sn9c102_io_method io)
|
||||||
{
|
{
|
||||||
struct v4l2_pix_format* p = &(cam->sensor.pix_format);
|
struct v4l2_pix_format* p = &(cam->sensor.pix_format);
|
||||||
struct v4l2_rect* r = &(cam->sensor.cropcap.bounds);
|
struct v4l2_rect* r = &(cam->sensor.cropcap.bounds);
|
||||||
const size_t imagesize = cam->module_param.force_munmap ||
|
const size_t imagesize = cam->module_param.force_munmap ||
|
||||||
io == IO_READ ?
|
io == IO_READ ?
|
||||||
(p->width * p->height * p->priv) / 8 :
|
(p->width * p->height * p->priv) / 8 :
|
||||||
(r->width * r->height * p->priv) / 8;
|
(r->width * r->height * p->priv) / 8;
|
||||||
void* buff = NULL;
|
void* buff = NULL;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
@ -232,8 +232,8 @@ int sn9c102_write_regs(struct sn9c102_device* cam, u8* buff, u16 index)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41,
|
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41,
|
||||||
index, 0, buff, sizeof(buff),
|
index, 0, buff, sizeof(buff),
|
||||||
SN9C102_CTRL_TIMEOUT*sizeof(buff));
|
SN9C102_CTRL_TIMEOUT*sizeof(buff));
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
DBG(3, "Failed to write registers (index 0x%02X, error %d)",
|
DBG(3, "Failed to write registers (index 0x%02X, error %d)",
|
||||||
index, res);
|
index, res);
|
||||||
@ -259,7 +259,7 @@ int sn9c102_write_reg(struct sn9c102_device* cam, u8 value, u16 index)
|
|||||||
*buff = value;
|
*buff = value;
|
||||||
|
|
||||||
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41,
|
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41,
|
||||||
index, 0, buff, 1, SN9C102_CTRL_TIMEOUT);
|
index, 0, buff, 1, SN9C102_CTRL_TIMEOUT);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
DBG(3, "Failed to write a register (value 0x%02X, index "
|
DBG(3, "Failed to write a register (value 0x%02X, index "
|
||||||
"0x%02X, error %d)", value, index, res);
|
"0x%02X, error %d)", value, index, res);
|
||||||
@ -280,7 +280,7 @@ static int sn9c102_read_reg(struct sn9c102_device* cam, u16 index)
|
|||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1,
|
res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1,
|
||||||
index, 0, buff, 1, SN9C102_CTRL_TIMEOUT);
|
index, 0, buff, 1, SN9C102_CTRL_TIMEOUT);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
DBG(3, "Failed to read a register (index 0x%02X, error %d)",
|
DBG(3, "Failed to read a register (index 0x%02X, error %d)",
|
||||||
index, res);
|
index, res);
|
||||||
@ -319,8 +319,8 @@ sn9c102_i2c_wait(struct sn9c102_device* cam, struct sn9c102_sensor* sensor)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
sn9c102_i2c_detect_read_error(struct sn9c102_device* cam,
|
sn9c102_i2c_detect_read_error(struct sn9c102_device* cam,
|
||||||
struct sn9c102_sensor* sensor)
|
struct sn9c102_sensor* sensor)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
r = sn9c102_read_reg(cam, 0x08);
|
r = sn9c102_read_reg(cam, 0x08);
|
||||||
@ -329,8 +329,8 @@ sn9c102_i2c_detect_read_error(struct sn9c102_device* cam,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
sn9c102_i2c_detect_write_error(struct sn9c102_device* cam,
|
sn9c102_i2c_detect_write_error(struct sn9c102_device* cam,
|
||||||
struct sn9c102_sensor* sensor)
|
struct sn9c102_sensor* sensor)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
r = sn9c102_read_reg(cam, 0x08);
|
r = sn9c102_read_reg(cam, 0x08);
|
||||||
@ -338,10 +338,10 @@ sn9c102_i2c_detect_write_error(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sn9c102_i2c_try_raw_read(struct sn9c102_device* cam,
|
sn9c102_i2c_try_raw_read(struct sn9c102_device* cam,
|
||||||
struct sn9c102_sensor* sensor, u8 data0, u8 data1,
|
struct sn9c102_sensor* sensor, u8 data0, u8 data1,
|
||||||
u8 n, u8 buffer[])
|
u8 n, u8 buffer[])
|
||||||
{
|
{
|
||||||
struct usb_device* udev = cam->usbdev;
|
struct usb_device* udev = cam->usbdev;
|
||||||
u8* data = cam->control_buffer;
|
u8* data = cam->control_buffer;
|
||||||
@ -349,12 +349,12 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam,
|
|||||||
|
|
||||||
/* Write cycle */
|
/* Write cycle */
|
||||||
data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) |
|
data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) |
|
||||||
((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) | 0x10;
|
((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) | 0x10;
|
||||||
data[1] = data0; /* I2C slave id */
|
data[1] = data0; /* I2C slave id */
|
||||||
data[2] = data1; /* address */
|
data[2] = data1; /* address */
|
||||||
data[7] = 0x10;
|
data[7] = 0x10;
|
||||||
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41,
|
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41,
|
||||||
0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT);
|
0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
err += res;
|
err += res;
|
||||||
|
|
||||||
@ -362,12 +362,12 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam,
|
|||||||
|
|
||||||
/* Read cycle - n bytes */
|
/* Read cycle - n bytes */
|
||||||
data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) |
|
data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) |
|
||||||
((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) |
|
((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) |
|
||||||
(n << 4) | 0x02;
|
(n << 4) | 0x02;
|
||||||
data[1] = data0;
|
data[1] = data0;
|
||||||
data[7] = 0x10;
|
data[7] = 0x10;
|
||||||
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41,
|
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41,
|
||||||
0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT);
|
0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
err += res;
|
err += res;
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam,
|
|||||||
|
|
||||||
/* The first read byte will be placed in data[4] */
|
/* The first read byte will be placed in data[4] */
|
||||||
res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1,
|
res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1,
|
||||||
0x0a, 0, data, 5, SN9C102_CTRL_TIMEOUT);
|
0x0a, 0, data, 5, SN9C102_CTRL_TIMEOUT);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
err += res;
|
err += res;
|
||||||
|
|
||||||
@ -396,10 +396,10 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sn9c102_i2c_try_raw_write(struct sn9c102_device* cam,
|
sn9c102_i2c_try_raw_write(struct sn9c102_device* cam,
|
||||||
struct sn9c102_sensor* sensor, u8 n, u8 data0,
|
struct sn9c102_sensor* sensor, u8 n, u8 data0,
|
||||||
u8 data1, u8 data2, u8 data3, u8 data4, u8 data5)
|
u8 data1, u8 data2, u8 data3, u8 data4, u8 data5)
|
||||||
{
|
{
|
||||||
struct usb_device* udev = cam->usbdev;
|
struct usb_device* udev = cam->usbdev;
|
||||||
u8* data = cam->control_buffer;
|
u8* data = cam->control_buffer;
|
||||||
@ -407,8 +407,8 @@ sn9c102_i2c_try_raw_write(struct sn9c102_device* cam,
|
|||||||
|
|
||||||
/* Write cycle. It usually is address + value */
|
/* Write cycle. It usually is address + value */
|
||||||
data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) |
|
data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) |
|
||||||
((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0)
|
((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0)
|
||||||
| ((n - 1) << 4);
|
| ((n - 1) << 4);
|
||||||
data[1] = data0;
|
data[1] = data0;
|
||||||
data[2] = data1;
|
data[2] = data1;
|
||||||
data[3] = data2;
|
data[3] = data2;
|
||||||
@ -417,7 +417,7 @@ sn9c102_i2c_try_raw_write(struct sn9c102_device* cam,
|
|||||||
data[6] = data5;
|
data[6] = data5;
|
||||||
data[7] = 0x14;
|
data[7] = 0x14;
|
||||||
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41,
|
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41,
|
||||||
0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT);
|
0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
err += res;
|
err += res;
|
||||||
|
|
||||||
@ -437,20 +437,20 @@ sn9c102_i2c_try_raw_write(struct sn9c102_device* cam,
|
|||||||
|
|
||||||
int
|
int
|
||||||
sn9c102_i2c_try_read(struct sn9c102_device* cam,
|
sn9c102_i2c_try_read(struct sn9c102_device* cam,
|
||||||
struct sn9c102_sensor* sensor, u8 address)
|
struct sn9c102_sensor* sensor, u8 address)
|
||||||
{
|
{
|
||||||
return sn9c102_i2c_try_raw_read(cam, sensor, sensor->i2c_slave_id,
|
return sn9c102_i2c_try_raw_read(cam, sensor, sensor->i2c_slave_id,
|
||||||
address, 1, NULL);
|
address, 1, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sn9c102_i2c_try_write(struct sn9c102_device* cam,
|
sn9c102_i2c_try_write(struct sn9c102_device* cam,
|
||||||
struct sn9c102_sensor* sensor, u8 address, u8 value)
|
struct sn9c102_sensor* sensor, u8 address, u8 value)
|
||||||
{
|
{
|
||||||
return sn9c102_i2c_try_raw_write(cam, sensor, 3,
|
return sn9c102_i2c_try_raw_write(cam, sensor, 3,
|
||||||
sensor->i2c_slave_id, address,
|
sensor->i2c_slave_id, address,
|
||||||
value, 0, 0, 0);
|
value, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -484,7 +484,7 @@ sn9c102_find_sof_header(struct sn9c102_device* cam, void* mem, size_t len)
|
|||||||
n = sizeof(sn9c103_sof_header) / soflen;
|
n = sizeof(sn9c103_sof_header) / soflen;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; (len >= soflen) && (i <= len - soflen); i++)
|
for (i = 0; (len >= soflen) && (i <= len - soflen); i++)
|
||||||
for (j = 0; j < n; j++)
|
for (j = 0; j < n; j++)
|
||||||
/* The invariable part of the header is 6 bytes long */
|
/* The invariable part of the header is 6 bytes long */
|
||||||
if ((cam->bridge != BRIDGE_SN9C103 &&
|
if ((cam->bridge != BRIDGE_SN9C103 &&
|
||||||
@ -552,15 +552,15 @@ static void sn9c102_urb_complete(struct urb *urb, struct pt_regs* regs)
|
|||||||
|
|
||||||
if (!(*f))
|
if (!(*f))
|
||||||
(*f) = list_entry(cam->inqueue.next, struct sn9c102_frame_t,
|
(*f) = list_entry(cam->inqueue.next, struct sn9c102_frame_t,
|
||||||
frame);
|
frame);
|
||||||
|
|
||||||
imagesize = (cam->sensor.pix_format.width *
|
imagesize = (cam->sensor.pix_format.width *
|
||||||
cam->sensor.pix_format.height *
|
cam->sensor.pix_format.height *
|
||||||
cam->sensor.pix_format.priv) / 8;
|
cam->sensor.pix_format.priv) / 8;
|
||||||
|
|
||||||
soflen = (cam->bridge) == BRIDGE_SN9C103 ?
|
soflen = (cam->bridge) == BRIDGE_SN9C103 ?
|
||||||
sizeof(sn9c103_sof_header_t) :
|
sizeof(sn9c103_sof_header_t) :
|
||||||
sizeof(sn9c102_sof_header_t);
|
sizeof(sn9c102_sof_header_t);
|
||||||
|
|
||||||
for (i = 0; i < urb->number_of_packets; i++) {
|
for (i = 0; i < urb->number_of_packets; i++) {
|
||||||
unsigned int img, len, status;
|
unsigned int img, len, status;
|
||||||
@ -611,19 +611,19 @@ end_of_frame:
|
|||||||
|
|
||||||
if ((*f)->buf.bytesused == imagesize ||
|
if ((*f)->buf.bytesused == imagesize ||
|
||||||
(cam->sensor.pix_format.pixelformat ==
|
(cam->sensor.pix_format.pixelformat ==
|
||||||
V4L2_PIX_FMT_SN9C10X && eof)) {
|
V4L2_PIX_FMT_SN9C10X && eof)) {
|
||||||
u32 b;
|
u32 b;
|
||||||
b = (*f)->buf.bytesused;
|
b = (*f)->buf.bytesused;
|
||||||
(*f)->state = F_DONE;
|
(*f)->state = F_DONE;
|
||||||
(*f)->buf.sequence= ++cam->frame_count;
|
(*f)->buf.sequence= ++cam->frame_count;
|
||||||
spin_lock(&cam->queue_lock);
|
spin_lock(&cam->queue_lock);
|
||||||
list_move_tail(&(*f)->frame,
|
list_move_tail(&(*f)->frame,
|
||||||
&cam->outqueue);
|
&cam->outqueue);
|
||||||
if (!list_empty(&cam->inqueue))
|
if (!list_empty(&cam->inqueue))
|
||||||
(*f) = list_entry(
|
(*f) = list_entry(
|
||||||
cam->inqueue.next,
|
cam->inqueue.next,
|
||||||
struct sn9c102_frame_t,
|
struct sn9c102_frame_t,
|
||||||
frame );
|
frame );
|
||||||
else
|
else
|
||||||
(*f) = NULL;
|
(*f) = NULL;
|
||||||
spin_unlock(&cam->queue_lock);
|
spin_unlock(&cam->queue_lock);
|
||||||
@ -638,7 +638,7 @@ end_of_frame:
|
|||||||
} else if (eof) {
|
} else if (eof) {
|
||||||
(*f)->state = F_ERROR;
|
(*f)->state = F_ERROR;
|
||||||
DBG(3, "Not expected EOF after %lu "
|
DBG(3, "Not expected EOF after %lu "
|
||||||
"bytes of image data",
|
"bytes of image data",
|
||||||
(unsigned long)
|
(unsigned long)
|
||||||
((*f)->buf.bytesused));
|
((*f)->buf.bytesused));
|
||||||
}
|
}
|
||||||
@ -676,7 +676,7 @@ start_of_frame:
|
|||||||
goto end_of_frame;
|
goto end_of_frame;
|
||||||
} else {
|
} else {
|
||||||
DBG(3, "SOF before expected EOF after "
|
DBG(3, "SOF before expected EOF after "
|
||||||
"%lu bytes of image data",
|
"%lu bytes of image data",
|
||||||
(unsigned long)
|
(unsigned long)
|
||||||
((*f)->buf.bytesused));
|
((*f)->buf.bytesused));
|
||||||
goto start_of_frame;
|
goto start_of_frame;
|
||||||
@ -702,18 +702,18 @@ static int sn9c102_start_transfer(struct sn9c102_device* cam)
|
|||||||
struct usb_device *udev = cam->usbdev;
|
struct usb_device *udev = cam->usbdev;
|
||||||
struct urb* urb;
|
struct urb* urb;
|
||||||
const unsigned int sn9c102_wMaxPacketSize[] = {0, 128, 256, 384, 512,
|
const unsigned int sn9c102_wMaxPacketSize[] = {0, 128, 256, 384, 512,
|
||||||
680, 800, 900, 1023};
|
680, 800, 900, 1023};
|
||||||
const unsigned int sn9c103_wMaxPacketSize[] = {0, 128, 256, 384, 512,
|
const unsigned int sn9c103_wMaxPacketSize[] = {0, 128, 256, 384, 512,
|
||||||
680, 800, 900, 1003};
|
680, 800, 900, 1003};
|
||||||
const unsigned int psz = (cam->bridge == BRIDGE_SN9C103) ?
|
const unsigned int psz = (cam->bridge == BRIDGE_SN9C103) ?
|
||||||
sn9c103_wMaxPacketSize[SN9C102_ALTERNATE_SETTING] :
|
sn9c103_wMaxPacketSize[SN9C102_ALTERNATE_SETTING] :
|
||||||
sn9c102_wMaxPacketSize[SN9C102_ALTERNATE_SETTING];
|
sn9c102_wMaxPacketSize[SN9C102_ALTERNATE_SETTING];
|
||||||
s8 i, j;
|
s8 i, j;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
for (i = 0; i < SN9C102_URBS; i++) {
|
for (i = 0; i < SN9C102_URBS; i++) {
|
||||||
cam->transfer_buffer[i] = kzalloc(SN9C102_ISO_PACKETS * psz,
|
cam->transfer_buffer[i] = kzalloc(SN9C102_ISO_PACKETS * psz,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!cam->transfer_buffer[i]) {
|
if (!cam->transfer_buffer[i]) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
DBG(1, "Not enough memory");
|
DBG(1, "Not enough memory");
|
||||||
@ -815,9 +815,9 @@ static int sn9c102_stream_interrupt(struct sn9c102_device* cam)
|
|||||||
|
|
||||||
cam->stream = STREAM_INTERRUPT;
|
cam->stream = STREAM_INTERRUPT;
|
||||||
timeout = wait_event_timeout(cam->wait_stream,
|
timeout = wait_event_timeout(cam->wait_stream,
|
||||||
(cam->stream == STREAM_OFF) ||
|
(cam->stream == STREAM_OFF) ||
|
||||||
(cam->state & DEV_DISCONNECTED),
|
(cam->state & DEV_DISCONNECTED),
|
||||||
SN9C102_URB_TIMEOUT);
|
SN9C102_URB_TIMEOUT);
|
||||||
if (cam->state & DEV_DISCONNECTED)
|
if (cam->state & DEV_DISCONNECTED)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
else if (cam->stream != STREAM_OFF) {
|
else if (cam->stream != STREAM_OFF) {
|
||||||
@ -861,7 +861,7 @@ static u8 sn9c102_strtou8(const char* buff, size_t len, ssize_t* count)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
NOTE 1: being inside one of the following methods implies that the v4l
|
NOTE 1: being inside one of the following methods implies that the v4l
|
||||||
device exists for sure (see kobjects and reference counters)
|
device exists for sure (see kobjects and reference counters)
|
||||||
NOTE 2: buffers are PAGE_SIZE long
|
NOTE 2: buffers are PAGE_SIZE long
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -884,10 +884,10 @@ static ssize_t sn9c102_show_reg(struct class_device* cd, char* buf)
|
|||||||
mutex_unlock(&sn9c102_sysfs_lock);
|
mutex_unlock(&sn9c102_sysfs_lock);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
sn9c102_store_reg(struct class_device* cd, const char* buf, size_t len)
|
sn9c102_store_reg(struct class_device* cd, const char* buf, size_t len)
|
||||||
{
|
{
|
||||||
struct sn9c102_device* cam;
|
struct sn9c102_device* cam;
|
||||||
@ -947,7 +947,7 @@ static ssize_t sn9c102_show_val(struct class_device* cd, char* buf)
|
|||||||
mutex_unlock(&sn9c102_sysfs_lock);
|
mutex_unlock(&sn9c102_sysfs_lock);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
@ -1013,7 +1013,7 @@ static ssize_t sn9c102_show_i2c_reg(struct class_device* cd, char* buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
sn9c102_store_i2c_reg(struct class_device* cd, const char* buf, size_t len)
|
sn9c102_store_i2c_reg(struct class_device* cd, const char* buf, size_t len)
|
||||||
{
|
{
|
||||||
struct sn9c102_device* cam;
|
struct sn9c102_device* cam;
|
||||||
@ -1078,7 +1078,7 @@ static ssize_t sn9c102_show_i2c_val(struct class_device* cd, char* buf)
|
|||||||
mutex_unlock(&sn9c102_sysfs_lock);
|
mutex_unlock(&sn9c102_sysfs_lock);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
@ -1222,22 +1222,22 @@ static ssize_t sn9c102_show_frame_header(struct class_device* cd, char* buf)
|
|||||||
DBG(3, "Frame header, read bytes: %zd", count);
|
DBG(3, "Frame header, read bytes: %zd", count);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR,
|
static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR,
|
||||||
sn9c102_show_reg, sn9c102_store_reg);
|
sn9c102_show_reg, sn9c102_store_reg);
|
||||||
static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR,
|
static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR,
|
||||||
sn9c102_show_val, sn9c102_store_val);
|
sn9c102_show_val, sn9c102_store_val);
|
||||||
static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR,
|
static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR,
|
||||||
sn9c102_show_i2c_reg, sn9c102_store_i2c_reg);
|
sn9c102_show_i2c_reg, sn9c102_store_i2c_reg);
|
||||||
static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR,
|
static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR,
|
||||||
sn9c102_show_i2c_val, sn9c102_store_i2c_val);
|
sn9c102_show_i2c_val, sn9c102_store_i2c_val);
|
||||||
static CLASS_DEVICE_ATTR(green, S_IWUGO, NULL, sn9c102_store_green);
|
static CLASS_DEVICE_ATTR(green, S_IWUGO, NULL, sn9c102_store_green);
|
||||||
static CLASS_DEVICE_ATTR(blue, S_IWUGO, NULL, sn9c102_store_blue);
|
static CLASS_DEVICE_ATTR(blue, S_IWUGO, NULL, sn9c102_store_blue);
|
||||||
static CLASS_DEVICE_ATTR(red, S_IWUGO, NULL, sn9c102_store_red);
|
static CLASS_DEVICE_ATTR(red, S_IWUGO, NULL, sn9c102_store_red);
|
||||||
static CLASS_DEVICE_ATTR(frame_header, S_IRUGO,
|
static CLASS_DEVICE_ATTR(frame_header, S_IRUGO,
|
||||||
sn9c102_show_frame_header, NULL);
|
sn9c102_show_frame_header, NULL);
|
||||||
|
|
||||||
|
|
||||||
static void sn9c102_create_sysfs(struct sn9c102_device* cam)
|
static void sn9c102_create_sysfs(struct sn9c102_device* cam)
|
||||||
@ -1278,7 +1278,7 @@ sn9c102_set_pix_format(struct sn9c102_device* cam, struct v4l2_pix_format* pix)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
sn9c102_set_compression(struct sn9c102_device* cam,
|
sn9c102_set_compression(struct sn9c102_device* cam,
|
||||||
struct v4l2_jpegcompression* compression)
|
struct v4l2_jpegcompression* compression)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
@ -1469,8 +1469,8 @@ static int sn9c102_open(struct inode* inode, struct file* filp)
|
|||||||
}
|
}
|
||||||
mutex_unlock(&cam->dev_mutex);
|
mutex_unlock(&cam->dev_mutex);
|
||||||
err = wait_event_interruptible_exclusive(cam->open,
|
err = wait_event_interruptible_exclusive(cam->open,
|
||||||
cam->state & DEV_DISCONNECTED
|
cam->state & DEV_DISCONNECTED
|
||||||
|| !cam->users);
|
|| !cam->users);
|
||||||
if (err) {
|
if (err) {
|
||||||
up_read(&sn9c102_disconnect);
|
up_read(&sn9c102_disconnect);
|
||||||
return err;
|
return err;
|
||||||
@ -1600,12 +1600,12 @@ sn9c102_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos)
|
|||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
timeout = wait_event_interruptible_timeout
|
timeout = wait_event_interruptible_timeout
|
||||||
( cam->wait_frame,
|
( cam->wait_frame,
|
||||||
(!list_empty(&cam->outqueue)) ||
|
(!list_empty(&cam->outqueue)) ||
|
||||||
(cam->state & DEV_DISCONNECTED) ||
|
(cam->state & DEV_DISCONNECTED) ||
|
||||||
(cam->state & DEV_MISCONFIGURED),
|
(cam->state & DEV_MISCONFIGURED),
|
||||||
cam->module_param.frame_timeout *
|
cam->module_param.frame_timeout *
|
||||||
1000 * msecs_to_jiffies(1) );
|
1000 * msecs_to_jiffies(1) );
|
||||||
if (timeout < 0) {
|
if (timeout < 0) {
|
||||||
mutex_unlock(&cam->fileop_mutex);
|
mutex_unlock(&cam->fileop_mutex);
|
||||||
return timeout;
|
return timeout;
|
||||||
@ -1672,7 +1672,7 @@ static unsigned int sn9c102_poll(struct file *filp, poll_table *wait)
|
|||||||
|
|
||||||
if (cam->io == IO_NONE) {
|
if (cam->io == IO_NONE) {
|
||||||
if (!sn9c102_request_buffers(cam, cam->nreadbuffers,
|
if (!sn9c102_request_buffers(cam, cam->nreadbuffers,
|
||||||
IO_READ)) {
|
IO_READ)) {
|
||||||
DBG(1, "poll() failed, not enough memory");
|
DBG(1, "poll() failed, not enough memory");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -1729,7 +1729,7 @@ static int sn9c102_mmap(struct file* filp, struct vm_area_struct *vma)
|
|||||||
{
|
{
|
||||||
struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp));
|
struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp));
|
||||||
unsigned long size = vma->vm_end - vma->vm_start,
|
unsigned long size = vma->vm_end - vma->vm_start,
|
||||||
start = vma->vm_start;
|
start = vma->vm_start;
|
||||||
void *pos;
|
void *pos;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
@ -1797,13 +1797,13 @@ sn9c102_vidioc_querycap(struct sn9c102_device* cam, void __user * arg)
|
|||||||
.driver = "sn9c102",
|
.driver = "sn9c102",
|
||||||
.version = SN9C102_MODULE_VERSION_CODE,
|
.version = SN9C102_MODULE_VERSION_CODE,
|
||||||
.capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
|
.capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
|
||||||
V4L2_CAP_STREAMING,
|
V4L2_CAP_STREAMING,
|
||||||
};
|
};
|
||||||
|
|
||||||
strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card));
|
strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card));
|
||||||
if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0)
|
if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0)
|
||||||
strlcpy(cap.bus_info, cam->usbdev->dev.bus_id,
|
strlcpy(cap.bus_info, cam->usbdev->dev.bus_id,
|
||||||
sizeof(cap.bus_info));
|
sizeof(cap.bus_info));
|
||||||
|
|
||||||
if (copy_to_user(arg, &cap, sizeof(cap)))
|
if (copy_to_user(arg, &cap, sizeof(cap)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
@ -2138,7 +2138,7 @@ sn9c102_vidioc_g_fmt(struct sn9c102_device* cam, void __user * arg)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_SN9C10X)
|
pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_SN9C10X)
|
||||||
? 0 : (pfmt->width * pfmt->priv) / 8;
|
? 0 : (pfmt->width * pfmt->priv) / 8;
|
||||||
pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8);
|
pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8);
|
||||||
pfmt->field = V4L2_FIELD_NONE;
|
pfmt->field = V4L2_FIELD_NONE;
|
||||||
memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt));
|
memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt));
|
||||||
@ -2152,7 +2152,7 @@ sn9c102_vidioc_g_fmt(struct sn9c102_device* cam, void __user * arg)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd,
|
sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd,
|
||||||
void __user * arg)
|
void __user * arg)
|
||||||
{
|
{
|
||||||
struct sn9c102_sensor* s = &cam->sensor;
|
struct sn9c102_sensor* s = &cam->sensor;
|
||||||
struct v4l2_format format;
|
struct v4l2_format format;
|
||||||
@ -2214,7 +2214,7 @@ sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd,
|
|||||||
pix->priv = pfmt->priv; /* bpp */
|
pix->priv = pfmt->priv; /* bpp */
|
||||||
pix->colorspace = pfmt->colorspace;
|
pix->colorspace = pfmt->colorspace;
|
||||||
pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_SN9C10X)
|
pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_SN9C10X)
|
||||||
? 0 : (pix->width * pix->priv) / 8;
|
? 0 : (pix->width * pix->priv) / 8;
|
||||||
pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8);
|
pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8);
|
||||||
pix->field = V4L2_FIELD_NONE;
|
pix->field = V4L2_FIELD_NONE;
|
||||||
|
|
||||||
@ -2287,7 +2287,7 @@ static int
|
|||||||
sn9c102_vidioc_g_jpegcomp(struct sn9c102_device* cam, void __user * arg)
|
sn9c102_vidioc_g_jpegcomp(struct sn9c102_device* cam, void __user * arg)
|
||||||
{
|
{
|
||||||
if (copy_to_user(arg, &cam->compression,
|
if (copy_to_user(arg, &cam->compression,
|
||||||
sizeof(cam->compression)))
|
sizeof(cam->compression)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -2436,7 +2436,7 @@ sn9c102_vidioc_qbuf(struct sn9c102_device* cam, void __user * arg)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp,
|
sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp,
|
||||||
void __user * arg)
|
void __user * arg)
|
||||||
{
|
{
|
||||||
struct v4l2_buffer b;
|
struct v4l2_buffer b;
|
||||||
struct sn9c102_frame_t *f;
|
struct sn9c102_frame_t *f;
|
||||||
@ -2455,12 +2455,12 @@ sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp,
|
|||||||
if (filp->f_flags & O_NONBLOCK)
|
if (filp->f_flags & O_NONBLOCK)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
timeout = wait_event_interruptible_timeout
|
timeout = wait_event_interruptible_timeout
|
||||||
( cam->wait_frame,
|
( cam->wait_frame,
|
||||||
(!list_empty(&cam->outqueue)) ||
|
(!list_empty(&cam->outqueue)) ||
|
||||||
(cam->state & DEV_DISCONNECTED) ||
|
(cam->state & DEV_DISCONNECTED) ||
|
||||||
(cam->state & DEV_MISCONFIGURED),
|
(cam->state & DEV_MISCONFIGURED),
|
||||||
cam->module_param.frame_timeout *
|
cam->module_param.frame_timeout *
|
||||||
1000 * msecs_to_jiffies(1) );
|
1000 * msecs_to_jiffies(1) );
|
||||||
if (timeout < 0)
|
if (timeout < 0)
|
||||||
return timeout;
|
return timeout;
|
||||||
if (cam->state & DEV_DISCONNECTED)
|
if (cam->state & DEV_DISCONNECTED)
|
||||||
@ -2584,7 +2584,7 @@ sn9c102_vidioc_s_parm(struct sn9c102_device* cam, void __user * arg)
|
|||||||
|
|
||||||
|
|
||||||
static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp,
|
static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp,
|
||||||
unsigned int cmd, void __user * arg)
|
unsigned int cmd, void __user * arg)
|
||||||
{
|
{
|
||||||
struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp));
|
struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp));
|
||||||
|
|
||||||
@ -2678,7 +2678,7 @@ static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp,
|
|||||||
|
|
||||||
|
|
||||||
static int sn9c102_ioctl(struct inode* inode, struct file* filp,
|
static int sn9c102_ioctl(struct inode* inode, struct file* filp,
|
||||||
unsigned int cmd, unsigned long arg)
|
unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp));
|
struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp));
|
||||||
int err = 0;
|
int err = 0;
|
||||||
@ -2761,7 +2761,7 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cam->bridge = (id->idProduct & 0xffc0) == 0x6080 ?
|
cam->bridge = (id->idProduct & 0xffc0) == 0x6080 ?
|
||||||
BRIDGE_SN9C103 : BRIDGE_SN9C102;
|
BRIDGE_SN9C103 : BRIDGE_SN9C102;
|
||||||
switch (cam->bridge) {
|
switch (cam->bridge) {
|
||||||
case BRIDGE_SN9C101:
|
case BRIDGE_SN9C101:
|
||||||
case BRIDGE_SN9C102:
|
case BRIDGE_SN9C102:
|
||||||
@ -2807,7 +2807,7 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
|
|||||||
mutex_lock(&cam->dev_mutex);
|
mutex_lock(&cam->dev_mutex);
|
||||||
|
|
||||||
err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER,
|
err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER,
|
||||||
video_nr[dev_nr]);
|
video_nr[dev_nr]);
|
||||||
if (err) {
|
if (err) {
|
||||||
DBG(1, "V4L2 device registration failed");
|
DBG(1, "V4L2 device registration failed");
|
||||||
if (err == -ENFILE && video_nr[dev_nr] == -1)
|
if (err == -ENFILE && video_nr[dev_nr] == -1)
|
||||||
|
@ -44,8 +44,8 @@ static int hv7131d_init(struct sn9c102_device* cam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int hv7131d_get_ctrl(struct sn9c102_device* cam,
|
static int hv7131d_get_ctrl(struct sn9c102_device* cam,
|
||||||
struct v4l2_control* ctrl)
|
struct v4l2_control* ctrl)
|
||||||
{
|
{
|
||||||
switch (ctrl->id) {
|
switch (ctrl->id) {
|
||||||
case V4L2_CID_EXPOSURE:
|
case V4L2_CID_EXPOSURE:
|
||||||
@ -88,8 +88,8 @@ static int hv7131d_get_ctrl(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int hv7131d_set_ctrl(struct sn9c102_device* cam,
|
static int hv7131d_set_ctrl(struct sn9c102_device* cam,
|
||||||
const struct v4l2_control* ctrl)
|
const struct v4l2_control* ctrl)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
@ -121,8 +121,8 @@ static int hv7131d_set_ctrl(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int hv7131d_set_crop(struct sn9c102_device* cam,
|
static int hv7131d_set_crop(struct sn9c102_device* cam,
|
||||||
const struct v4l2_rect* rect)
|
const struct v4l2_rect* rect)
|
||||||
{
|
{
|
||||||
struct sn9c102_sensor* s = &hv7131d;
|
struct sn9c102_sensor* s = &hv7131d;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
@ -136,8 +136,8 @@ static int hv7131d_set_crop(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int hv7131d_set_pix_format(struct sn9c102_device* cam,
|
static int hv7131d_set_pix_format(struct sn9c102_device* cam,
|
||||||
const struct v4l2_pix_format* pix)
|
const struct v4l2_pix_format* pix)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
@ -39,64 +39,64 @@ static int mi0343_init(struct sn9c102_device* cam)
|
|||||||
err += sn9c102_write_reg(cam, 0xa0, 0x19);
|
err += sn9c102_write_reg(cam, 0xa0, 0x19);
|
||||||
|
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id,
|
||||||
0x0d, 0x00, 0x01, 0, 0);
|
0x0d, 0x00, 0x01, 0, 0);
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id,
|
||||||
0x0d, 0x00, 0x00, 0, 0);
|
0x0d, 0x00, 0x00, 0, 0);
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id,
|
||||||
0x03, 0x01, 0xe1, 0, 0);
|
0x03, 0x01, 0xe1, 0, 0);
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id,
|
||||||
0x04, 0x02, 0x81, 0, 0);
|
0x04, 0x02, 0x81, 0, 0);
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id,
|
||||||
0x05, 0x00, 0x17, 0, 0);
|
0x05, 0x00, 0x17, 0, 0);
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id,
|
||||||
0x06, 0x00, 0x11, 0, 0);
|
0x06, 0x00, 0x11, 0, 0);
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id,
|
||||||
0x62, 0x04, 0x9a, 0, 0);
|
0x62, 0x04, 0x9a, 0, 0);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int mi0343_get_ctrl(struct sn9c102_device* cam,
|
static int mi0343_get_ctrl(struct sn9c102_device* cam,
|
||||||
struct v4l2_control* ctrl)
|
struct v4l2_control* ctrl)
|
||||||
{
|
{
|
||||||
switch (ctrl->id) {
|
switch (ctrl->id) {
|
||||||
case V4L2_CID_EXPOSURE:
|
case V4L2_CID_EXPOSURE:
|
||||||
if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id,
|
if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id,
|
||||||
0x09, 2+1, mi0343_i2c_data) < 0)
|
0x09, 2+1, mi0343_i2c_data) < 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
ctrl->value = mi0343_i2c_data[2];
|
ctrl->value = mi0343_i2c_data[2];
|
||||||
return 0;
|
return 0;
|
||||||
case V4L2_CID_GAIN:
|
case V4L2_CID_GAIN:
|
||||||
if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id,
|
if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id,
|
||||||
0x35, 2+1, mi0343_i2c_data) < 0)
|
0x35, 2+1, mi0343_i2c_data) < 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
break;
|
break;
|
||||||
case V4L2_CID_HFLIP:
|
case V4L2_CID_HFLIP:
|
||||||
if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id,
|
if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id,
|
||||||
0x20, 2+1, mi0343_i2c_data) < 0)
|
0x20, 2+1, mi0343_i2c_data) < 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
ctrl->value = mi0343_i2c_data[3] & 0x20 ? 1 : 0;
|
ctrl->value = mi0343_i2c_data[3] & 0x20 ? 1 : 0;
|
||||||
return 0;
|
return 0;
|
||||||
case V4L2_CID_VFLIP:
|
case V4L2_CID_VFLIP:
|
||||||
if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id,
|
if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id,
|
||||||
0x20, 2+1, mi0343_i2c_data) < 0)
|
0x20, 2+1, mi0343_i2c_data) < 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
ctrl->value = mi0343_i2c_data[3] & 0x80 ? 1 : 0;
|
ctrl->value = mi0343_i2c_data[3] & 0x80 ? 1 : 0;
|
||||||
return 0;
|
return 0;
|
||||||
case V4L2_CID_RED_BALANCE:
|
case V4L2_CID_RED_BALANCE:
|
||||||
if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id,
|
if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id,
|
||||||
0x2d, 2+1, mi0343_i2c_data) < 0)
|
0x2d, 2+1, mi0343_i2c_data) < 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
break;
|
break;
|
||||||
case V4L2_CID_BLUE_BALANCE:
|
case V4L2_CID_BLUE_BALANCE:
|
||||||
if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id,
|
if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id,
|
||||||
0x2c, 2+1, mi0343_i2c_data) < 0)
|
0x2c, 2+1, mi0343_i2c_data) < 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
break;
|
break;
|
||||||
case SN9C102_V4L2_CID_GREEN_BALANCE:
|
case SN9C102_V4L2_CID_GREEN_BALANCE:
|
||||||
if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id,
|
if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id,
|
||||||
0x2e, 2+1, mi0343_i2c_data) < 0)
|
0x2e, 2+1, mi0343_i2c_data) < 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -121,8 +121,8 @@ static int mi0343_get_ctrl(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int mi0343_set_ctrl(struct sn9c102_device* cam,
|
static int mi0343_set_ctrl(struct sn9c102_device* cam,
|
||||||
const struct v4l2_control* ctrl)
|
const struct v4l2_control* ctrl)
|
||||||
{
|
{
|
||||||
u16 reg = 0;
|
u16 reg = 0;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
@ -144,51 +144,51 @@ static int mi0343_set_ctrl(struct sn9c102_device* cam,
|
|||||||
switch (ctrl->id) {
|
switch (ctrl->id) {
|
||||||
case V4L2_CID_EXPOSURE:
|
case V4L2_CID_EXPOSURE:
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
||||||
mi0343.i2c_slave_id,
|
mi0343.i2c_slave_id,
|
||||||
0x09, ctrl->value, 0x00,
|
0x09, ctrl->value, 0x00,
|
||||||
0, 0);
|
0, 0);
|
||||||
break;
|
break;
|
||||||
case V4L2_CID_GAIN:
|
case V4L2_CID_GAIN:
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
||||||
mi0343.i2c_slave_id,
|
mi0343.i2c_slave_id,
|
||||||
0x35, reg >> 8, reg & 0xff,
|
0x35, reg >> 8, reg & 0xff,
|
||||||
0, 0);
|
0, 0);
|
||||||
break;
|
break;
|
||||||
case V4L2_CID_HFLIP:
|
case V4L2_CID_HFLIP:
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
||||||
mi0343.i2c_slave_id,
|
mi0343.i2c_slave_id,
|
||||||
0x20, ctrl->value ? 0x40:0x00,
|
0x20, ctrl->value ? 0x40:0x00,
|
||||||
ctrl->value ? 0x20:0x00,
|
ctrl->value ? 0x20:0x00,
|
||||||
0, 0);
|
0, 0);
|
||||||
break;
|
break;
|
||||||
case V4L2_CID_VFLIP:
|
case V4L2_CID_VFLIP:
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
||||||
mi0343.i2c_slave_id,
|
mi0343.i2c_slave_id,
|
||||||
0x20, ctrl->value ? 0x80:0x00,
|
0x20, ctrl->value ? 0x80:0x00,
|
||||||
ctrl->value ? 0x80:0x00,
|
ctrl->value ? 0x80:0x00,
|
||||||
0, 0);
|
0, 0);
|
||||||
break;
|
break;
|
||||||
case V4L2_CID_RED_BALANCE:
|
case V4L2_CID_RED_BALANCE:
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
||||||
mi0343.i2c_slave_id,
|
mi0343.i2c_slave_id,
|
||||||
0x2d, reg >> 8, reg & 0xff,
|
0x2d, reg >> 8, reg & 0xff,
|
||||||
0, 0);
|
0, 0);
|
||||||
break;
|
break;
|
||||||
case V4L2_CID_BLUE_BALANCE:
|
case V4L2_CID_BLUE_BALANCE:
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
||||||
mi0343.i2c_slave_id,
|
mi0343.i2c_slave_id,
|
||||||
0x2c, reg >> 8, reg & 0xff,
|
0x2c, reg >> 8, reg & 0xff,
|
||||||
0, 0);
|
0, 0);
|
||||||
break;
|
break;
|
||||||
case SN9C102_V4L2_CID_GREEN_BALANCE:
|
case SN9C102_V4L2_CID_GREEN_BALANCE:
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
||||||
mi0343.i2c_slave_id,
|
mi0343.i2c_slave_id,
|
||||||
0x2b, reg >> 8, reg & 0xff,
|
0x2b, reg >> 8, reg & 0xff,
|
||||||
0, 0);
|
0, 0);
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
||||||
mi0343.i2c_slave_id,
|
mi0343.i2c_slave_id,
|
||||||
0x2e, reg >> 8, reg & 0xff,
|
0x2e, reg >> 8, reg & 0xff,
|
||||||
0, 0);
|
0, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -198,8 +198,8 @@ static int mi0343_set_ctrl(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int mi0343_set_crop(struct sn9c102_device* cam,
|
static int mi0343_set_crop(struct sn9c102_device* cam,
|
||||||
const struct v4l2_rect* rect)
|
const struct v4l2_rect* rect)
|
||||||
{
|
{
|
||||||
struct sn9c102_sensor* s = &mi0343;
|
struct sn9c102_sensor* s = &mi0343;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
@ -213,20 +213,20 @@ static int mi0343_set_crop(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int mi0343_set_pix_format(struct sn9c102_device* cam,
|
static int mi0343_set_pix_format(struct sn9c102_device* cam,
|
||||||
const struct v4l2_pix_format* pix)
|
const struct v4l2_pix_format* pix)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) {
|
if (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) {
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
||||||
mi0343.i2c_slave_id,
|
mi0343.i2c_slave_id,
|
||||||
0x0a, 0x00, 0x03, 0, 0);
|
0x0a, 0x00, 0x03, 0, 0);
|
||||||
err += sn9c102_write_reg(cam, 0x20, 0x19);
|
err += sn9c102_write_reg(cam, 0x20, 0x19);
|
||||||
} else {
|
} else {
|
||||||
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4,
|
||||||
mi0343.i2c_slave_id,
|
mi0343.i2c_slave_id,
|
||||||
0x0a, 0x00, 0x05, 0, 0);
|
0x0a, 0x00, 0x05, 0, 0);
|
||||||
err += sn9c102_write_reg(cam, 0xa0, 0x19);
|
err += sn9c102_write_reg(cam, 0xa0, 0x19);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ int sn9c102_probe_mi0343(struct sn9c102_device* cam)
|
|||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, 0x00,
|
if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, 0x00,
|
||||||
2, mi0343_i2c_data) < 0)
|
2, mi0343_i2c_data) < 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
if (mi0343_i2c_data[4] != 0x32 && mi0343_i2c_data[3] != 0xe3)
|
if (mi0343_i2c_data[4] != 0x32 && mi0343_i2c_data[3] != 0xe3)
|
||||||
|
@ -69,7 +69,7 @@ static int ov7630_init(struct sn9c102_device* cam)
|
|||||||
|
|
||||||
|
|
||||||
static int ov7630_set_ctrl(struct sn9c102_device* cam,
|
static int ov7630_set_ctrl(struct sn9c102_device* cam,
|
||||||
const struct v4l2_control* ctrl)
|
const struct v4l2_control* ctrl)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
@ -89,8 +89,8 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam,
|
|||||||
break;
|
break;
|
||||||
case V4L2_CID_CONTRAST:
|
case V4L2_CID_CONTRAST:
|
||||||
err += ctrl->value ? sn9c102_i2c_write(cam, 0x05,
|
err += ctrl->value ? sn9c102_i2c_write(cam, 0x05,
|
||||||
(ctrl->value-1) | 0x20)
|
(ctrl->value-1) | 0x20)
|
||||||
: sn9c102_i2c_write(cam, 0x05, 0x00);
|
: sn9c102_i2c_write(cam, 0x05, 0x00);
|
||||||
break;
|
break;
|
||||||
case V4L2_CID_BRIGHTNESS:
|
case V4L2_CID_BRIGHTNESS:
|
||||||
err += sn9c102_i2c_write(cam, 0x06, ctrl->value);
|
err += sn9c102_i2c_write(cam, 0x06, ctrl->value);
|
||||||
@ -100,8 +100,8 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam,
|
|||||||
break;
|
break;
|
||||||
case V4L2_CID_HUE:
|
case V4L2_CID_HUE:
|
||||||
err += ctrl->value ? sn9c102_i2c_write(cam, 0x04,
|
err += ctrl->value ? sn9c102_i2c_write(cam, 0x04,
|
||||||
(ctrl->value-1) | 0x20)
|
(ctrl->value-1) | 0x20)
|
||||||
: sn9c102_i2c_write(cam, 0x04, 0x00);
|
: sn9c102_i2c_write(cam, 0x04, 0x00);
|
||||||
break;
|
break;
|
||||||
case V4L2_CID_DO_WHITE_BALANCE:
|
case V4L2_CID_DO_WHITE_BALANCE:
|
||||||
err += sn9c102_i2c_write(cam, 0x0c, ctrl->value);
|
err += sn9c102_i2c_write(cam, 0x0c, ctrl->value);
|
||||||
@ -139,7 +139,7 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam,
|
|||||||
|
|
||||||
|
|
||||||
static int ov7630_set_crop(struct sn9c102_device* cam,
|
static int ov7630_set_crop(struct sn9c102_device* cam,
|
||||||
const struct v4l2_rect* rect)
|
const struct v4l2_rect* rect)
|
||||||
{
|
{
|
||||||
struct sn9c102_sensor* s = &ov7630;
|
struct sn9c102_sensor* s = &ov7630;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
@ -152,7 +152,7 @@ static int ov7630_set_crop(struct sn9c102_device* cam,
|
|||||||
|
|
||||||
|
|
||||||
static int ov7630_set_pix_format(struct sn9c102_device* cam,
|
static int ov7630_set_pix_format(struct sn9c102_device* cam,
|
||||||
const struct v4l2_pix_format* pix)
|
const struct v4l2_pix_format* pix)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
@ -53,8 +53,8 @@ static int pas106b_init(struct sn9c102_device* cam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int pas106b_get_ctrl(struct sn9c102_device* cam,
|
static int pas106b_get_ctrl(struct sn9c102_device* cam,
|
||||||
struct v4l2_control* ctrl)
|
struct v4l2_control* ctrl)
|
||||||
{
|
{
|
||||||
switch (ctrl->id) {
|
switch (ctrl->id) {
|
||||||
case V4L2_CID_EXPOSURE:
|
case V4L2_CID_EXPOSURE:
|
||||||
@ -102,8 +102,8 @@ static int pas106b_get_ctrl(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int pas106b_set_ctrl(struct sn9c102_device* cam,
|
static int pas106b_set_ctrl(struct sn9c102_device* cam,
|
||||||
const struct v4l2_control* ctrl)
|
const struct v4l2_control* ctrl)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
@ -140,8 +140,8 @@ static int pas106b_set_ctrl(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int pas106b_set_crop(struct sn9c102_device* cam,
|
static int pas106b_set_crop(struct sn9c102_device* cam,
|
||||||
const struct v4l2_rect* rect)
|
const struct v4l2_rect* rect)
|
||||||
{
|
{
|
||||||
struct sn9c102_sensor* s = &pas106b;
|
struct sn9c102_sensor* s = &pas106b;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
@ -155,8 +155,8 @@ static int pas106b_set_crop(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int pas106b_set_pix_format(struct sn9c102_device* cam,
|
static int pas106b_set_pix_format(struct sn9c102_device* cam,
|
||||||
const struct v4l2_pix_format* pix)
|
const struct v4l2_pix_format* pix)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ static int pas202bca_init(struct sn9c102_device* cam)
|
|||||||
|
|
||||||
|
|
||||||
static int pas202bca_set_pix_format(struct sn9c102_device* cam,
|
static int pas202bca_set_pix_format(struct sn9c102_device* cam,
|
||||||
const struct v4l2_pix_format* pix)
|
const struct v4l2_pix_format* pix)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ static int pas202bca_set_pix_format(struct sn9c102_device* cam,
|
|||||||
|
|
||||||
|
|
||||||
static int pas202bca_set_ctrl(struct sn9c102_device* cam,
|
static int pas202bca_set_ctrl(struct sn9c102_device* cam,
|
||||||
const struct v4l2_control* ctrl)
|
const struct v4l2_control* ctrl)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ static int pas202bca_set_ctrl(struct sn9c102_device* cam,
|
|||||||
|
|
||||||
|
|
||||||
static int pas202bca_set_crop(struct sn9c102_device* cam,
|
static int pas202bca_set_crop(struct sn9c102_device* cam,
|
||||||
const struct v4l2_rect* rect)
|
const struct v4l2_rect* rect)
|
||||||
{
|
{
|
||||||
struct sn9c102_sensor* s = &pas202bca;
|
struct sn9c102_sensor* s = &pas202bca;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
@ -58,8 +58,8 @@ static int pas202bcb_init(struct sn9c102_device* cam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int pas202bcb_get_ctrl(struct sn9c102_device* cam,
|
static int pas202bcb_get_ctrl(struct sn9c102_device* cam,
|
||||||
struct v4l2_control* ctrl)
|
struct v4l2_control* ctrl)
|
||||||
{
|
{
|
||||||
switch (ctrl->id) {
|
switch (ctrl->id) {
|
||||||
case V4L2_CID_EXPOSURE:
|
case V4L2_CID_EXPOSURE:
|
||||||
@ -101,8 +101,8 @@ static int pas202bcb_get_ctrl(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int pas202bcb_set_pix_format(struct sn9c102_device* cam,
|
static int pas202bcb_set_pix_format(struct sn9c102_device* cam,
|
||||||
const struct v4l2_pix_format* pix)
|
const struct v4l2_pix_format* pix)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
@ -115,8 +115,8 @@ static int pas202bcb_set_pix_format(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int pas202bcb_set_ctrl(struct sn9c102_device* cam,
|
static int pas202bcb_set_ctrl(struct sn9c102_device* cam,
|
||||||
const struct v4l2_control* ctrl)
|
const struct v4l2_control* ctrl)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
@ -149,8 +149,8 @@ static int pas202bcb_set_ctrl(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int pas202bcb_set_crop(struct sn9c102_device* cam,
|
static int pas202bcb_set_crop(struct sn9c102_device* cam,
|
||||||
const struct v4l2_rect* rect)
|
const struct v4l2_rect* rect)
|
||||||
{
|
{
|
||||||
struct sn9c102_sensor* s = &pas202bcb;
|
struct sn9c102_sensor* s = &pas202bcb;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
@ -167,7 +167,7 @@ static int pas202bcb_set_crop(struct sn9c102_device* cam,
|
|||||||
static struct sn9c102_sensor pas202bcb = {
|
static struct sn9c102_sensor pas202bcb = {
|
||||||
.name = "PAS202BCB",
|
.name = "PAS202BCB",
|
||||||
.maintainer = "Carlos Eduardo Medaglia Dyonisio "
|
.maintainer = "Carlos Eduardo Medaglia Dyonisio "
|
||||||
"<medaglia@undl.org.br>",
|
"<medaglia@undl.org.br>",
|
||||||
.sysfs_ops = SN9C102_I2C_READ | SN9C102_I2C_WRITE,
|
.sysfs_ops = SN9C102_I2C_READ | SN9C102_I2C_WRITE,
|
||||||
.frequency = SN9C102_I2C_400KHZ | SN9C102_I2C_100KHZ,
|
.frequency = SN9C102_I2C_400KHZ | SN9C102_I2C_100KHZ,
|
||||||
.interface = SN9C102_I2C_2WIRES,
|
.interface = SN9C102_I2C_2WIRES,
|
||||||
|
@ -58,7 +58,7 @@ struct sn9c102_sensor;
|
|||||||
Probing functions: on success, you must attach the sensor to the camera
|
Probing functions: on success, you must attach the sensor to the camera
|
||||||
by calling sn9c102_attach_sensor() provided below.
|
by calling sn9c102_attach_sensor() provided below.
|
||||||
To enable the I2C communication, you might need to perform a really basic
|
To enable the I2C communication, you might need to perform a really basic
|
||||||
initialization of the SN9C10X chip by using the write function declared
|
initialization of the SN9C10X chip by using the write function declared
|
||||||
ahead.
|
ahead.
|
||||||
Functions must return 0 on success, the appropriate error otherwise.
|
Functions must return 0 on success, the appropriate error otherwise.
|
||||||
*/
|
*/
|
||||||
@ -73,7 +73,7 @@ extern int sn9c102_probe_tas5130d1b(struct sn9c102_device* cam);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Add the above entries to this table. Be sure to add the entry in the right
|
Add the above entries to this table. Be sure to add the entry in the right
|
||||||
place, since, on failure, the next probing routine is called according to
|
place, since, on failure, the next probing routine is called according to
|
||||||
the order of the list below, from top to bottom.
|
the order of the list below, from top to bottom.
|
||||||
*/
|
*/
|
||||||
#define SN9C102_SENSOR_TABLE \
|
#define SN9C102_SENSOR_TABLE \
|
||||||
@ -94,9 +94,9 @@ extern struct sn9c102_device*
|
|||||||
sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id);
|
sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id);
|
||||||
|
|
||||||
/* Attach a probed sensor to the camera. */
|
/* Attach a probed sensor to the camera. */
|
||||||
extern void
|
extern void
|
||||||
sn9c102_attach_sensor(struct sn9c102_device* cam,
|
sn9c102_attach_sensor(struct sn9c102_device* cam,
|
||||||
struct sn9c102_sensor* sensor);
|
struct sn9c102_sensor* sensor);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Each SN9C10x camera has proper PID/VID identifiers.
|
Each SN9C10x camera has proper PID/VID identifiers.
|
||||||
@ -105,7 +105,7 @@ sn9c102_attach_sensor(struct sn9c102_device* cam,
|
|||||||
*/
|
*/
|
||||||
#define SN9C102_USB_DEVICE(vend, prod, intclass) \
|
#define SN9C102_USB_DEVICE(vend, prod, intclass) \
|
||||||
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
|
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
|
||||||
USB_DEVICE_ID_MATCH_INT_CLASS, \
|
USB_DEVICE_ID_MATCH_INT_CLASS, \
|
||||||
.idVendor = (vend), \
|
.idVendor = (vend), \
|
||||||
.idProduct = (prod), \
|
.idProduct = (prod), \
|
||||||
.bInterfaceClass = (intclass)
|
.bInterfaceClass = (intclass)
|
||||||
@ -162,19 +162,19 @@ static const struct usb_device_id sn9c102_id_table[] = { \
|
|||||||
Read/write routines: they always return -1 on error, 0 or the read value
|
Read/write routines: they always return -1 on error, 0 or the read value
|
||||||
otherwise. NOTE that a real read operation is not supported by the SN9C10X
|
otherwise. NOTE that a real read operation is not supported by the SN9C10X
|
||||||
chip for some of its registers. To work around this problem, a pseudo-read
|
chip for some of its registers. To work around this problem, a pseudo-read
|
||||||
call is provided instead: it returns the last successfully written value
|
call is provided instead: it returns the last successfully written value
|
||||||
on the register (0 if it has never been written), the usual -1 on error.
|
on the register (0 if it has never been written), the usual -1 on error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* The "try" I2C I/O versions are used when probing the sensor */
|
/* The "try" I2C I/O versions are used when probing the sensor */
|
||||||
extern int sn9c102_i2c_try_write(struct sn9c102_device*,struct sn9c102_sensor*,
|
extern int sn9c102_i2c_try_write(struct sn9c102_device*,struct sn9c102_sensor*,
|
||||||
u8 address, u8 value);
|
u8 address, u8 value);
|
||||||
extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*,
|
extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*,
|
||||||
u8 address);
|
u8 address);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
These must be used if and only if the sensor doesn't implement the standard
|
These must be used if and only if the sensor doesn't implement the standard
|
||||||
I2C protocol. There are a number of good reasons why you must use the
|
I2C protocol. There are a number of good reasons why you must use the
|
||||||
single-byte versions of these functions: do not abuse. The first function
|
single-byte versions of these functions: do not abuse. The first function
|
||||||
writes n bytes, from data0 to datan, to registers 0x09 - 0x09+n of SN9C10X
|
writes n bytes, from data0 to datan, to registers 0x09 - 0x09+n of SN9C10X
|
||||||
chip. The second one programs the registers 0x09 and 0x10 with data0 and
|
chip. The second one programs the registers 0x09 and 0x10 with data0 and
|
||||||
@ -184,12 +184,12 @@ extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*,
|
|||||||
byte.
|
byte.
|
||||||
*/
|
*/
|
||||||
extern int sn9c102_i2c_try_raw_write(struct sn9c102_device* cam,
|
extern int sn9c102_i2c_try_raw_write(struct sn9c102_device* cam,
|
||||||
struct sn9c102_sensor* sensor, u8 n,
|
struct sn9c102_sensor* sensor, u8 n,
|
||||||
u8 data0, u8 data1, u8 data2, u8 data3,
|
u8 data0, u8 data1, u8 data2, u8 data3,
|
||||||
u8 data4, u8 data5);
|
u8 data4, u8 data5);
|
||||||
extern int sn9c102_i2c_try_raw_read(struct sn9c102_device* cam,
|
extern int sn9c102_i2c_try_raw_read(struct sn9c102_device* cam,
|
||||||
struct sn9c102_sensor* sensor, u8 data0,
|
struct sn9c102_sensor* sensor, u8 data0,
|
||||||
u8 data1, u8 n, u8 buffer[]);
|
u8 data1, u8 n, u8 buffer[]);
|
||||||
|
|
||||||
/* To be used after the sensor struct has been attached to the camera struct */
|
/* To be used after the sensor struct has been attached to the camera struct */
|
||||||
extern int sn9c102_i2c_write(struct sn9c102_device*, u8 address, u8 value);
|
extern int sn9c102_i2c_write(struct sn9c102_device*, u8 address, u8 value);
|
||||||
@ -252,17 +252,17 @@ struct sn9c102_sensor {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
NOTE: Where not noted,most of the functions below are not mandatory.
|
NOTE: Where not noted,most of the functions below are not mandatory.
|
||||||
Set to null if you do not implement them. If implemented,
|
Set to null if you do not implement them. If implemented,
|
||||||
they must return 0 on success, the proper error otherwise.
|
they must return 0 on success, the proper error otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*init)(struct sn9c102_device* cam);
|
int (*init)(struct sn9c102_device* cam);
|
||||||
/*
|
/*
|
||||||
This function will be called after the sensor has been attached.
|
This function will be called after the sensor has been attached.
|
||||||
It should be used to initialize the sensor only, but may also
|
It should be used to initialize the sensor only, but may also
|
||||||
configure part of the SN9C10X chip if necessary. You don't need to
|
configure part of the SN9C10X chip if necessary. You don't need to
|
||||||
setup picture settings like brightness, contrast, etc.. here, if
|
setup picture settings like brightness, contrast, etc.. here, if
|
||||||
the corrisponding controls are implemented (see below), since
|
the corrisponding controls are implemented (see below), since
|
||||||
they are adjusted in the core driver by calling the set_ctrl()
|
they are adjusted in the core driver by calling the set_ctrl()
|
||||||
method after init(), where the arguments are the default values
|
method after init(), where the arguments are the default values
|
||||||
specified in the v4l2_queryctrl list of supported controls;
|
specified in the v4l2_queryctrl list of supported controls;
|
||||||
@ -273,13 +273,13 @@ struct sn9c102_sensor {
|
|||||||
|
|
||||||
struct v4l2_queryctrl qctrl[SN9C102_MAX_CTRLS];
|
struct v4l2_queryctrl qctrl[SN9C102_MAX_CTRLS];
|
||||||
/*
|
/*
|
||||||
Optional list of default controls, defined as indicated in the
|
Optional list of default controls, defined as indicated in the
|
||||||
V4L2 API. Menu type controls are not handled by this interface.
|
V4L2 API. Menu type controls are not handled by this interface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*get_ctrl)(struct sn9c102_device* cam, struct v4l2_control* ctrl);
|
int (*get_ctrl)(struct sn9c102_device* cam, struct v4l2_control* ctrl);
|
||||||
int (*set_ctrl)(struct sn9c102_device* cam,
|
int (*set_ctrl)(struct sn9c102_device* cam,
|
||||||
const struct v4l2_control* ctrl);
|
const struct v4l2_control* ctrl);
|
||||||
/*
|
/*
|
||||||
You must implement at least the set_ctrl method if you have defined
|
You must implement at least the set_ctrl method if you have defined
|
||||||
the list above. The returned value must follow the V4L2
|
the list above. The returned value must follow the V4L2
|
||||||
@ -306,7 +306,7 @@ struct sn9c102_sensor {
|
|||||||
specified in the cropcap substructures 'bounds' and 'defrect'.
|
specified in the cropcap substructures 'bounds' and 'defrect'.
|
||||||
By default, the source rectangle should cover the largest possible
|
By default, the source rectangle should cover the largest possible
|
||||||
area. Again, it is not always true that the largest source rectangle
|
area. Again, it is not always true that the largest source rectangle
|
||||||
can cover the entire active window, although it is a rare case for
|
can cover the entire active window, although it is a rare case for
|
||||||
the hardware we have. The bounds of the source rectangle _must_ be
|
the hardware we have. The bounds of the source rectangle _must_ be
|
||||||
multiple of 16 and must use the same coordinate system as indicated
|
multiple of 16 and must use the same coordinate system as indicated
|
||||||
before; their centers shall align initially.
|
before; their centers shall align initially.
|
||||||
@ -317,13 +317,13 @@ struct sn9c102_sensor {
|
|||||||
defined the correct default bounds in the structures.
|
defined the correct default bounds in the structures.
|
||||||
See the V4L2 API for further details.
|
See the V4L2 API for further details.
|
||||||
NOTE: once you have defined the bounds of the active window
|
NOTE: once you have defined the bounds of the active window
|
||||||
(struct cropcap.bounds) you must not change them.anymore.
|
(struct cropcap.bounds) you must not change them.anymore.
|
||||||
Only 'bounds' and 'defrect' fields are mandatory, other fields
|
Only 'bounds' and 'defrect' fields are mandatory, other fields
|
||||||
will be ignored.
|
will be ignored.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*set_crop)(struct sn9c102_device* cam,
|
int (*set_crop)(struct sn9c102_device* cam,
|
||||||
const struct v4l2_rect* rect);
|
const struct v4l2_rect* rect);
|
||||||
/*
|
/*
|
||||||
To be called on VIDIOC_C_SETCROP. The core module always calls a
|
To be called on VIDIOC_C_SETCROP. The core module always calls a
|
||||||
default routine which configures the appropriate SN9C10X regs (also
|
default routine which configures the appropriate SN9C10X regs (also
|
||||||
@ -332,12 +332,12 @@ struct sn9c102_sensor {
|
|||||||
case you override the default function, you always have to program
|
case you override the default function, you always have to program
|
||||||
the chip to match those values; on error return the corresponding
|
the chip to match those values; on error return the corresponding
|
||||||
error code without rolling back.
|
error code without rolling back.
|
||||||
NOTE: in case, you must program the SN9C10X chip to get rid of
|
NOTE: in case, you must program the SN9C10X chip to get rid of
|
||||||
blank pixels or blank lines at the _start_ of each line or
|
blank pixels or blank lines at the _start_ of each line or
|
||||||
frame after each HSYNC or VSYNC, so that the image starts with
|
frame after each HSYNC or VSYNC, so that the image starts with
|
||||||
real RGB data (see regs 0x12, 0x13) (having set H_SIZE and,
|
real RGB data (see regs 0x12, 0x13) (having set H_SIZE and,
|
||||||
V_SIZE you don't have to care about blank pixels or blank
|
V_SIZE you don't have to care about blank pixels or blank
|
||||||
lines at the end of each line or frame).
|
lines at the end of each line or frame).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct v4l2_pix_format pix_format;
|
struct v4l2_pix_format pix_format;
|
||||||
@ -349,17 +349,17 @@ struct sn9c102_sensor {
|
|||||||
number of bits per pixel for uncompressed video, 8 or 9 (despite the
|
number of bits per pixel for uncompressed video, 8 or 9 (despite the
|
||||||
current value of 'pixelformat').
|
current value of 'pixelformat').
|
||||||
NOTE 1: both 'width' and 'height' _must_ be either 1/1 or 1/2 or 1/4
|
NOTE 1: both 'width' and 'height' _must_ be either 1/1 or 1/2 or 1/4
|
||||||
of cropcap.defrect.width and cropcap.defrect.height. I
|
of cropcap.defrect.width and cropcap.defrect.height. I
|
||||||
suggest 1/1.
|
suggest 1/1.
|
||||||
NOTE 2: The initial compression quality is defined by the first bit
|
NOTE 2: The initial compression quality is defined by the first bit
|
||||||
of reg 0x17 during the initialization of the image sensor.
|
of reg 0x17 during the initialization of the image sensor.
|
||||||
NOTE 3: as said above, you have to program the SN9C10X chip to get
|
NOTE 3: as said above, you have to program the SN9C10X chip to get
|
||||||
rid of any blank pixels, so that the output of the sensor
|
rid of any blank pixels, so that the output of the sensor
|
||||||
matches the RGB bayer sequence (i.e. BGBGBG...GRGRGR).
|
matches the RGB bayer sequence (i.e. BGBGBG...GRGRGR).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*set_pix_format)(struct sn9c102_device* cam,
|
int (*set_pix_format)(struct sn9c102_device* cam,
|
||||||
const struct v4l2_pix_format* pix);
|
const struct v4l2_pix_format* pix);
|
||||||
/*
|
/*
|
||||||
To be called on VIDIOC_S_FMT, when switching from the SBGGR8 to
|
To be called on VIDIOC_S_FMT, when switching from the SBGGR8 to
|
||||||
SN9C10X pixel format or viceversa. On error return the corresponding
|
SN9C10X pixel format or viceversa. On error return the corresponding
|
||||||
|
@ -44,8 +44,8 @@ static int tas5110c1b_init(struct sn9c102_device* cam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int tas5110c1b_set_ctrl(struct sn9c102_device* cam,
|
static int tas5110c1b_set_ctrl(struct sn9c102_device* cam,
|
||||||
const struct v4l2_control* ctrl)
|
const struct v4l2_control* ctrl)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
@ -61,8 +61,8 @@ static int tas5110c1b_set_ctrl(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int tas5110c1b_set_crop(struct sn9c102_device* cam,
|
static int tas5110c1b_set_crop(struct sn9c102_device* cam,
|
||||||
const struct v4l2_rect* rect)
|
const struct v4l2_rect* rect)
|
||||||
{
|
{
|
||||||
struct sn9c102_sensor* s = &tas5110c1b;
|
struct sn9c102_sensor* s = &tas5110c1b;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
@ -81,8 +81,8 @@ static int tas5110c1b_set_crop(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int tas5110c1b_set_pix_format(struct sn9c102_device* cam,
|
static int tas5110c1b_set_pix_format(struct sn9c102_device* cam,
|
||||||
const struct v4l2_pix_format* pix)
|
const struct v4l2_pix_format* pix)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@ static int tas5130d1b_init(struct sn9c102_device* cam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int tas5130d1b_set_ctrl(struct sn9c102_device* cam,
|
static int tas5130d1b_set_ctrl(struct sn9c102_device* cam,
|
||||||
const struct v4l2_control* ctrl)
|
const struct v4l2_control* ctrl)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
@ -62,8 +62,8 @@ static int tas5130d1b_set_ctrl(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int tas5130d1b_set_crop(struct sn9c102_device* cam,
|
static int tas5130d1b_set_crop(struct sn9c102_device* cam,
|
||||||
const struct v4l2_rect* rect)
|
const struct v4l2_rect* rect)
|
||||||
{
|
{
|
||||||
struct sn9c102_sensor* s = &tas5130d1b;
|
struct sn9c102_sensor* s = &tas5130d1b;
|
||||||
u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 104,
|
u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 104,
|
||||||
@ -82,8 +82,8 @@ static int tas5130d1b_set_crop(struct sn9c102_device* cam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int tas5130d1b_set_pix_format(struct sn9c102_device* cam,
|
static int tas5130d1b_set_pix_format(struct sn9c102_device* cam,
|
||||||
const struct v4l2_pix_format* pix)
|
const struct v4l2_pix_format* pix)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* stradis.c - stradis 4:2:2 mpeg decoder driver
|
* stradis.c - stradis 4:2:2 mpeg decoder driver
|
||||||
*
|
*
|
||||||
* Stradis 4:2:2 MPEG-2 Decoder Driver
|
* Stradis 4:2:2 MPEG-2 Decoder Driver
|
||||||
@ -1191,9 +1191,9 @@ static void saa7146_set_winsize(struct saa7146 *saa)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* clip_draw_rectangle(cm,x,y,w,h) -- handle clipping an area
|
/* clip_draw_rectangle(cm,x,y,w,h) -- handle clipping an area
|
||||||
* bitmap is fixed width, 128 bytes (1024 pixels represented)
|
* bitmap is fixed width, 128 bytes (1024 pixels represented)
|
||||||
* arranged most-sigificant-bit-left in 32-bit words
|
* arranged most-sigificant-bit-left in 32-bit words
|
||||||
* based on saa7146 clipping hardware, it swaps bytes if LE
|
* based on saa7146 clipping hardware, it swaps bytes if LE
|
||||||
* much of this makes up for egcs brain damage -- so if you
|
* much of this makes up for egcs brain damage -- so if you
|
||||||
* are wondering "why did he do this?" it is because the C
|
* are wondering "why did he do this?" it is because the C
|
||||||
* was adjusted to generate the optimal asm output without
|
* was adjusted to generate the optimal asm output without
|
||||||
@ -1259,7 +1259,7 @@ static void make_clip_tab(struct saa7146 *saa, struct video_clip *cr, int ncr)
|
|||||||
clip_draw_rectangle(clipmap, cr[i].x, cr[i].y,
|
clip_draw_rectangle(clipmap, cr[i].x, cr[i].y,
|
||||||
cr[i].width, cr[i].height);
|
cr[i].width, cr[i].height);
|
||||||
}
|
}
|
||||||
/* clip against viewing window AND screen
|
/* clip against viewing window AND screen
|
||||||
so we do not have to rely on the user program
|
so we do not have to rely on the user program
|
||||||
*/
|
*/
|
||||||
clip_draw_rectangle(clipmap, (saa->win.x + width > saa->win.swidth) ?
|
clip_draw_rectangle(clipmap, (saa->win.x + width > saa->win.swidth) ?
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
/*
|
/*
|
||||||
* STV0680 USB Camera Driver, by Kevin Sisson (kjsisson@bellsouth.net)
|
* STV0680 USB Camera Driver, by Kevin Sisson (kjsisson@bellsouth.net)
|
||||||
*
|
*
|
||||||
* Thanks to STMicroelectronics for information on the usb commands, and
|
* Thanks to STMicroelectronics for information on the usb commands, and
|
||||||
* to Steve Miller at STM for his help and encouragement while I was
|
* to Steve Miller at STM for his help and encouragement while I was
|
||||||
* writing this driver.
|
* writing this driver.
|
||||||
*
|
*
|
||||||
* This driver is based heavily on the
|
* This driver is based heavily on the
|
||||||
* Endpoints (formerly known as AOX) se401 USB Camera Driver
|
* Endpoints (formerly known as AOX) se401 USB Camera Driver
|
||||||
* Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org)
|
* Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org)
|
||||||
*
|
*
|
||||||
* Still somewhat based on the Linux ov511 driver.
|
* Still somewhat based on the Linux ov511 driver.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* 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
|
* 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
|
* Free Software Foundation; either version 2 of the License, or (at your
|
||||||
@ -25,18 +25,18 @@
|
|||||||
* along with this program; if not, write to the Free Software Foundation,
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
* Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*
|
*
|
||||||
* History:
|
* History:
|
||||||
* ver 0.1 October, 2001. Initial attempt.
|
* ver 0.1 October, 2001. Initial attempt.
|
||||||
*
|
*
|
||||||
* ver 0.2 November, 2001. Fixed asbility to resize, added brightness
|
* ver 0.2 November, 2001. Fixed asbility to resize, added brightness
|
||||||
* function, made more stable (?)
|
* function, made more stable (?)
|
||||||
*
|
*
|
||||||
* ver 0.21 Nov, 2001. Added gamma correction and white balance,
|
* ver 0.21 Nov, 2001. Added gamma correction and white balance,
|
||||||
* due to Alexander Schwartz. Still trying to
|
* due to Alexander Schwartz. Still trying to
|
||||||
* improve stablility. Moved stuff into stv680.h
|
* improve stablility. Moved stuff into stv680.h
|
||||||
*
|
*
|
||||||
* ver 0.22 Nov, 2001. Added sharpen function (by Michael Sweet,
|
* ver 0.22 Nov, 2001. Added sharpen function (by Michael Sweet,
|
||||||
* mike@easysw.com) from GIMP, also used in pencam.
|
* mike@easysw.com) from GIMP, also used in pencam.
|
||||||
* Simple, fast, good integer math routine.
|
* Simple, fast, good integer math routine.
|
||||||
*
|
*
|
||||||
* ver 0.23 Dec, 2001 (gkh)
|
* ver 0.23 Dec, 2001 (gkh)
|
||||||
@ -44,11 +44,11 @@
|
|||||||
* Lindent, and did other minor tweaks to get
|
* Lindent, and did other minor tweaks to get
|
||||||
* things to work properly with 2.5.1
|
* things to work properly with 2.5.1
|
||||||
*
|
*
|
||||||
* ver 0.24 Jan, 2002 (kjs)
|
* ver 0.24 Jan, 2002 (kjs)
|
||||||
* Fixed the problem with webcam crashing after
|
* Fixed the problem with webcam crashing after
|
||||||
* two pictures. Changed the way pic is halved to
|
* two pictures. Changed the way pic is halved to
|
||||||
* improve quality. Got rid of green line around
|
* improve quality. Got rid of green line around
|
||||||
* frame. Fix brightness reset when changing size
|
* frame. Fix brightness reset when changing size
|
||||||
* bug. Adjusted gamma filters slightly.
|
* bug. Adjusted gamma filters slightly.
|
||||||
*
|
*
|
||||||
* ver 0.25 Jan, 2002 (kjs)
|
* ver 0.25 Jan, 2002 (kjs)
|
||||||
@ -484,7 +484,7 @@ exit:
|
|||||||
PDEBUG (1, "STV(i): swapRGB is (forced) ON");
|
PDEBUG (1, "STV(i): swapRGB is (forced) ON");
|
||||||
else if (swapRGB_on == -1)
|
else if (swapRGB_on == -1)
|
||||||
PDEBUG (1, "STV(i): swapRGB is (forced) OFF");
|
PDEBUG (1, "STV(i): swapRGB is (forced) OFF");
|
||||||
|
|
||||||
if (stv_set_video_mode (stv680) < 0) {
|
if (stv_set_video_mode (stv680) < 0) {
|
||||||
PDEBUG (0, "STV(e): Could not set video mode in stv_init");
|
PDEBUG (0, "STV(e): Could not set video mode in stv_init");
|
||||||
return -1;
|
return -1;
|
||||||
@ -570,7 +570,7 @@ static int stv680_set_pict (struct usb_stv *stv680, struct video_picture *p)
|
|||||||
if (stv680->brightness != p->brightness) {
|
if (stv680->brightness != p->brightness) {
|
||||||
stv680->chgbright = 1;
|
stv680->chgbright = 1;
|
||||||
stv680->brightness = p->brightness;
|
stv680->brightness = p->brightness;
|
||||||
}
|
}
|
||||||
|
|
||||||
stv680->whiteness = p->whiteness; /* greyscale */
|
stv680->whiteness = p->whiteness; /* greyscale */
|
||||||
stv680->colour = p->colour;
|
stv680->colour = p->colour;
|
||||||
@ -612,7 +612,7 @@ static void stv680_video_irq (struct urb *urb, struct pt_regs *regs)
|
|||||||
|
|
||||||
case BUFFER_UNUSED:
|
case BUFFER_UNUSED:
|
||||||
memcpy (stv680->scratch[stv680->scratch_next].data,
|
memcpy (stv680->scratch[stv680->scratch_next].data,
|
||||||
(unsigned char *) urb->transfer_buffer, length);
|
(unsigned char *) urb->transfer_buffer, length);
|
||||||
stv680->scratch[stv680->scratch_next].state = BUFFER_READY;
|
stv680->scratch[stv680->scratch_next].state = BUFFER_READY;
|
||||||
stv680->scratch[stv680->scratch_next].length = length;
|
stv680->scratch[stv680->scratch_next].length = length;
|
||||||
if (waitqueue_active (&stv680->wq)) {
|
if (waitqueue_active (&stv680->wq)) {
|
||||||
@ -752,7 +752,7 @@ static int stv680_set_size (struct usb_stv *stv680, int width, int height)
|
|||||||
PDEBUG (1, "STV(e): request for non-supported size: request: v.width = %i, v.height = %i actual: stv.width = %i, stv.height = %i", width, height, stv680->vwidth, stv680->vheight);
|
PDEBUG (1, "STV(e): request for non-supported size: request: v.width = %i, v.height = %i actual: stv.width = %i, stv.height = %i", width, height, stv680->vwidth, stv680->vheight);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stop a current stream and start it again at the new size */
|
/* Stop a current stream and start it again at the new size */
|
||||||
if (wasstreaming)
|
if (wasstreaming)
|
||||||
stv680_stop_stream (stv680);
|
stv680_stop_stream (stv680);
|
||||||
@ -773,7 +773,7 @@ static int stv680_set_size (struct usb_stv *stv680, int width, int height)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* STV0680 Vision Camera Chipset Driver
|
* STV0680 Vision Camera Chipset Driver
|
||||||
* Copyright (C) 2000 Adam Harrison <adam@antispin.org>
|
* Copyright (C) 2000 Adam Harrison <adam@antispin.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define RED 0
|
#define RED 0
|
||||||
@ -842,7 +842,7 @@ static void bayer_unshuffle (struct usb_stv *stv680, struct stv680_scratch *buff
|
|||||||
colour = 2;
|
colour = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i = (y * vw + x) * 3;
|
i = (y * vw + x) * 3;
|
||||||
*(output + i + colour) = (unsigned char) p;
|
*(output + i + colour) = (unsigned char) p;
|
||||||
} /* for x */
|
} /* for x */
|
||||||
|
|
||||||
@ -850,9 +850,9 @@ static void bayer_unshuffle (struct usb_stv *stv680, struct stv680_scratch *buff
|
|||||||
|
|
||||||
/****** gamma correction plus hardcoded white balance */
|
/****** gamma correction plus hardcoded white balance */
|
||||||
/* Thanks to Alexander Schwartx <alexander.schwartx@gmx.net> for this code.
|
/* Thanks to Alexander Schwartx <alexander.schwartx@gmx.net> for this code.
|
||||||
Correction values red[], green[], blue[], are generated by
|
Correction values red[], green[], blue[], are generated by
|
||||||
(pow(i/256.0, GAMMA)*255.0)*white balanceRGB where GAMMA=0.55, 1<i<255.
|
(pow(i/256.0, GAMMA)*255.0)*white balanceRGB where GAMMA=0.55, 1<i<255.
|
||||||
White balance (RGB)= 1.0, 1.17, 1.48. Values are calculated as double float and
|
White balance (RGB)= 1.0, 1.17, 1.48. Values are calculated as double float and
|
||||||
converted to unsigned char. Values are in stv680.h */
|
converted to unsigned char. Values are in stv680.h */
|
||||||
|
|
||||||
for (y = 0; y < vh; y++) {
|
for (y = 0; y < vh; y++) {
|
||||||
|
@ -9,12 +9,12 @@
|
|||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
@ -152,76 +152,76 @@ struct usb_stv {
|
|||||||
|
|
||||||
|
|
||||||
static const unsigned char red[256] = {
|
static const unsigned char red[256] = {
|
||||||
0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
|
0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
|
||||||
18, 18, 18, 18, 18, 18, 18, 25, 30, 35, 38, 42,
|
18, 18, 18, 18, 18, 18, 18, 25, 30, 35, 38, 42,
|
||||||
44, 47, 50, 53, 54, 57, 59, 61, 63, 65, 67, 69,
|
44, 47, 50, 53, 54, 57, 59, 61, 63, 65, 67, 69,
|
||||||
71, 71, 73, 75, 77, 78, 80, 81, 82, 84, 85, 87,
|
71, 71, 73, 75, 77, 78, 80, 81, 82, 84, 85, 87,
|
||||||
88, 89, 90, 91, 93, 94, 95, 97, 98, 98, 99, 101,
|
88, 89, 90, 91, 93, 94, 95, 97, 98, 98, 99, 101,
|
||||||
102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
|
102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
|
||||||
114, 115, 116, 116, 117, 118, 119, 120, 121, 122, 123, 124,
|
114, 115, 116, 116, 117, 118, 119, 120, 121, 122, 123, 124,
|
||||||
125, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 134,
|
125, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 134,
|
||||||
134, 135, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143,
|
134, 135, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143,
|
||||||
143, 143, 144, 145, 146, 147, 147, 148, 149, 150, 150, 151,
|
143, 143, 144, 145, 146, 147, 147, 148, 149, 150, 150, 151,
|
||||||
152, 152, 152, 153, 154, 154, 155, 156, 157, 157, 158, 159,
|
152, 152, 152, 153, 154, 154, 155, 156, 157, 157, 158, 159,
|
||||||
159, 160, 161, 161, 161, 162, 163, 163, 164, 165, 165, 166,
|
159, 160, 161, 161, 161, 162, 163, 163, 164, 165, 165, 166,
|
||||||
167, 167, 168, 168, 169, 170, 170, 170, 171, 171, 172, 173,
|
167, 167, 168, 168, 169, 170, 170, 170, 171, 171, 172, 173,
|
||||||
173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 179, 179,
|
173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 179, 179,
|
||||||
180, 180, 181, 181, 182, 183, 183, 184, 184, 185, 185, 186,
|
180, 180, 181, 181, 182, 183, 183, 184, 184, 185, 185, 186,
|
||||||
187, 187, 188, 188, 188, 188, 189, 190, 190, 191, 191, 192,
|
187, 187, 188, 188, 188, 188, 189, 190, 190, 191, 191, 192,
|
||||||
192, 193, 193, 194, 195, 195, 196, 196, 197, 197, 197, 197,
|
192, 193, 193, 194, 195, 195, 196, 196, 197, 197, 197, 197,
|
||||||
198, 198, 199, 199, 200, 201, 201, 202, 202, 203, 203, 204,
|
198, 198, 199, 199, 200, 201, 201, 202, 202, 203, 203, 204,
|
||||||
204, 205, 205, 206, 206, 206, 206, 207, 207, 208, 208, 209,
|
204, 205, 205, 206, 206, 206, 206, 207, 207, 208, 208, 209,
|
||||||
209, 210, 210, 211, 211, 212, 212, 213, 213, 214, 214, 215,
|
209, 210, 210, 211, 211, 212, 212, 213, 213, 214, 214, 215,
|
||||||
215, 215, 215, 216, 216, 217, 217, 218, 218, 218, 219, 219,
|
215, 215, 215, 216, 216, 217, 217, 218, 218, 218, 219, 219,
|
||||||
220, 220, 221, 221
|
220, 220, 221, 221
|
||||||
};
|
};
|
||||||
|
|
||||||
static const unsigned char green[256] = {
|
static const unsigned char green[256] = {
|
||||||
0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
|
0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
|
||||||
21, 21, 21, 21, 21, 21, 21, 28, 34, 39, 43, 47,
|
21, 21, 21, 21, 21, 21, 21, 28, 34, 39, 43, 47,
|
||||||
50, 53, 56, 59, 61, 64, 66, 68, 71, 73, 75, 77,
|
50, 53, 56, 59, 61, 64, 66, 68, 71, 73, 75, 77,
|
||||||
79, 80, 82, 84, 86, 87, 89, 91, 92, 94, 95, 97,
|
79, 80, 82, 84, 86, 87, 89, 91, 92, 94, 95, 97,
|
||||||
98, 100, 101, 102, 104, 105, 106, 108, 109, 110, 111, 113,
|
98, 100, 101, 102, 104, 105, 106, 108, 109, 110, 111, 113,
|
||||||
114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126,
|
114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126,
|
||||||
127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
|
127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
|
||||||
139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149,
|
139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149,
|
||||||
150, 151, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159,
|
150, 151, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159,
|
||||||
160, 160, 161, 162, 163, 164, 164, 165, 166, 167, 167, 168,
|
160, 160, 161, 162, 163, 164, 164, 165, 166, 167, 167, 168,
|
||||||
169, 170, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177,
|
169, 170, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177,
|
||||||
177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 184, 185,
|
177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 184, 185,
|
||||||
186, 186, 187, 187, 188, 189, 189, 190, 191, 191, 192, 193,
|
186, 186, 187, 187, 188, 189, 189, 190, 191, 191, 192, 193,
|
||||||
193, 194, 194, 195, 196, 196, 197, 198, 198, 199, 199, 200,
|
193, 194, 194, 195, 196, 196, 197, 198, 198, 199, 199, 200,
|
||||||
201, 201, 202, 202, 203, 204, 204, 205, 205, 206, 206, 207,
|
201, 201, 202, 202, 203, 204, 204, 205, 205, 206, 206, 207,
|
||||||
208, 208, 209, 209, 210, 210, 211, 212, 212, 213, 213, 214,
|
208, 208, 209, 209, 210, 210, 211, 212, 212, 213, 213, 214,
|
||||||
214, 215, 215, 216, 217, 217, 218, 218, 219, 219, 220, 220,
|
214, 215, 215, 216, 217, 217, 218, 218, 219, 219, 220, 220,
|
||||||
221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227,
|
221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227,
|
||||||
227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 233,
|
227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 233,
|
||||||
233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239,
|
233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239,
|
||||||
239, 240, 240, 241, 241, 242, 242, 243, 243, 243, 244, 244,
|
239, 240, 240, 241, 241, 242, 242, 243, 243, 243, 244, 244,
|
||||||
245, 245, 246, 246
|
245, 245, 246, 246
|
||||||
};
|
};
|
||||||
|
|
||||||
static const unsigned char blue[256] = {
|
static const unsigned char blue[256] = {
|
||||||
0, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
|
0, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
|
||||||
23, 23, 23, 23, 23, 23, 23, 30, 37, 42, 47, 51,
|
23, 23, 23, 23, 23, 23, 23, 30, 37, 42, 47, 51,
|
||||||
55, 58, 61, 64, 67, 70, 72, 74, 78, 80, 82, 84,
|
55, 58, 61, 64, 67, 70, 72, 74, 78, 80, 82, 84,
|
||||||
86, 88, 90, 92, 94, 95, 97, 100, 101, 103, 104, 106,
|
86, 88, 90, 92, 94, 95, 97, 100, 101, 103, 104, 106,
|
||||||
107, 110, 111, 112, 114, 115, 116, 118, 119, 121, 122, 124,
|
107, 110, 111, 112, 114, 115, 116, 118, 119, 121, 122, 124,
|
||||||
125, 126, 127, 128, 129, 132, 133, 134, 135, 136, 137, 138,
|
125, 126, 127, 128, 129, 132, 133, 134, 135, 136, 137, 138,
|
||||||
139, 140, 141, 143, 144, 145, 146, 147, 148, 149, 150, 151,
|
139, 140, 141, 143, 144, 145, 146, 147, 148, 149, 150, 151,
|
||||||
152, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163,
|
152, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163,
|
||||||
165, 166, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174,
|
165, 166, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174,
|
||||||
176, 176, 177, 178, 179, 180, 180, 181, 182, 183, 183, 184,
|
176, 176, 177, 178, 179, 180, 180, 181, 182, 183, 183, 184,
|
||||||
185, 187, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194,
|
185, 187, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194,
|
||||||
194, 195, 196, 196, 198, 199, 200, 200, 201, 202, 202, 203,
|
194, 195, 196, 196, 198, 199, 200, 200, 201, 202, 202, 203,
|
||||||
204, 204, 205, 205, 206, 207, 207, 209, 210, 210, 211, 212,
|
204, 204, 205, 205, 206, 207, 207, 209, 210, 210, 211, 212,
|
||||||
212, 213, 213, 214, 215, 215, 216, 217, 217, 218, 218, 220,
|
212, 213, 213, 214, 215, 215, 216, 217, 217, 218, 218, 220,
|
||||||
221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227,
|
221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227,
|
||||||
228, 228, 229, 229, 231, 231, 232, 233, 233, 234, 234, 235,
|
228, 228, 229, 229, 231, 231, 232, 233, 233, 234, 234, 235,
|
||||||
235, 236, 236, 237, 238, 238, 239, 239, 240, 240, 242, 242,
|
235, 236, 236, 237, 238, 238, 239, 239, 240, 240, 242, 242,
|
||||||
243, 243, 244, 244, 245, 246, 246, 247, 247, 248, 248, 249,
|
243, 243, 244, 244, 245, 246, 246, 247, 247, 248, 248, 249,
|
||||||
249, 250, 250, 251, 251, 253, 253, 254, 254, 255, 255, 255,
|
249, 250, 250, 251, 251, 253, 253, 254, 254, 255, 255, 255,
|
||||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||||
255, 255, 255, 255
|
255, 255, 255, 255
|
||||||
};
|
};
|
||||||
|
@ -35,7 +35,7 @@ static int debug = 0; /* insmod parameter */
|
|||||||
module_param(debug, int, 0644);
|
module_param(debug, int, 0644);
|
||||||
MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off).");
|
MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off).");
|
||||||
#define dprintk(args...) \
|
#define dprintk(args...) \
|
||||||
do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0)
|
do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0)
|
||||||
|
|
||||||
#define SWITCH 0x00
|
#define SWITCH 0x00
|
||||||
#define LEVEL_ADJUST 0x02
|
#define LEVEL_ADJUST 0x02
|
||||||
|
@ -37,7 +37,7 @@ static int debug = 0; /* insmod parameter */
|
|||||||
module_param(debug, int, 0644);
|
module_param(debug, int, 0644);
|
||||||
MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off).");
|
MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off).");
|
||||||
#define dprintk(args...) \
|
#define dprintk(args...) \
|
||||||
do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0)
|
do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0)
|
||||||
|
|
||||||
#define TEA6415C_NUM_INPUTS 8
|
#define TEA6415C_NUM_INPUTS 8
|
||||||
#define TEA6415C_NUM_OUTPUTS 6
|
#define TEA6415C_NUM_OUTPUTS 6
|
||||||
|
@ -37,7 +37,7 @@ static int debug = 0; /* insmod parameter */
|
|||||||
module_param(debug, int, 0644);
|
module_param(debug, int, 0644);
|
||||||
MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off).");
|
MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off).");
|
||||||
#define dprintk(args...) \
|
#define dprintk(args...) \
|
||||||
do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0)
|
do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0)
|
||||||
|
|
||||||
/* addresses to scan, found only at 0x4c and/or 0x4d (7-Bit) */
|
/* addresses to scan, found only at 0x4c and/or 0x4d (7-Bit) */
|
||||||
static unsigned short normal_i2c[] = { I2C_ADDR_TEA6420_1, I2C_ADDR_TEA6420_2, I2C_CLIENT_END };
|
static unsigned short normal_i2c[] = { I2C_ADDR_TEA6420_1, I2C_ADDR_TEA6420_2, I2C_CLIENT_END };
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* The SAB3036 is just about different enough from the chips that
|
* The SAB3036 is just about different enough from the chips that
|
||||||
* tuner.c copes with to make it not worth the effort to crowbar
|
* tuner.c copes with to make it not worth the effort to crowbar
|
||||||
* the support into that file. So instead we have a separate driver.
|
* the support into that file. So instead we have a separate driver.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -56,15 +56,15 @@ tuner_getstatus (struct i2c_client *c)
|
|||||||
|
|
||||||
#define TUNER_FL 0x80
|
#define TUNER_FL 0x80
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tuner_islocked (struct i2c_client *c)
|
tuner_islocked (struct i2c_client *c)
|
||||||
{
|
{
|
||||||
return (tuner_getstatus(c) & TUNER_FL);
|
return (tuner_getstatus(c) & TUNER_FL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_tv_freq(struct i2c_client *c, int freq)
|
set_tv_freq(struct i2c_client *c, int freq)
|
||||||
{
|
{
|
||||||
u16 div = ((freq * 20) / 16);
|
u16 div = ((freq * 20) / 16);
|
||||||
@ -73,26 +73,26 @@ set_tv_freq(struct i2c_client *c, int freq)
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
printk(KERN_DEBUG "tuner: setting frequency %dMHz, divisor %x\n", freq / 16, div);
|
printk(KERN_DEBUG "tuner: setting frequency %dMHz, divisor %x\n", freq / 16, div);
|
||||||
|
|
||||||
/* Select high tuning current */
|
/* Select high tuning current */
|
||||||
buffer[0] = 0x29;
|
buffer[0] = 0x29;
|
||||||
buffer[1] = 0x3e;
|
buffer[1] = 0x3e;
|
||||||
|
|
||||||
if (i2c_master_send(c, buffer, 2) != 2)
|
if (i2c_master_send(c, buffer, 2) != 2)
|
||||||
printk("tuner: i2c i/o error 1\n");
|
printk("tuner: i2c i/o error 1\n");
|
||||||
|
|
||||||
buffer[0] = 0x80 | ((div>>8) & 0x7f);
|
buffer[0] = 0x80 | ((div>>8) & 0x7f);
|
||||||
buffer[1] = div & 0xff;
|
buffer[1] = div & 0xff;
|
||||||
|
|
||||||
if (i2c_master_send(c, buffer, 2) != 2)
|
if (i2c_master_send(c, buffer, 2) != 2)
|
||||||
printk("tuner: i2c i/o error 2\n");
|
printk("tuner: i2c i/o error 2\n");
|
||||||
|
|
||||||
while (!tuner_islocked(c) && time_before(jiffies, give_up))
|
while (!tuner_islocked(c) && time_before(jiffies, give_up))
|
||||||
schedule();
|
schedule();
|
||||||
|
|
||||||
if (!tuner_islocked(c))
|
if (!tuner_islocked(c))
|
||||||
printk(KERN_WARNING "tuner: failed to achieve PLL lock\n");
|
printk(KERN_WARNING "tuner: failed to achieve PLL lock\n");
|
||||||
|
|
||||||
/* Select low tuning current and engage AFC */
|
/* Select low tuning current and engage AFC */
|
||||||
buffer[0] = 0x29;
|
buffer[0] = 0x29;
|
||||||
buffer[1] = 0xb2;
|
buffer[1] = 0xb2;
|
||||||
@ -106,7 +106,7 @@ set_tv_freq(struct i2c_client *c, int freq)
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tuner_attach(struct i2c_adapter *adap, int addr, int kind)
|
tuner_attach(struct i2c_adapter *adap, int addr, int kind)
|
||||||
{
|
{
|
||||||
static unsigned char buffer[] = { 0x29, 0x32, 0x2a, 0, 0x2b, 0 };
|
static unsigned char buffer[] = { 0x29, 0x32, 0x2a, 0, 0x2b, 0 };
|
||||||
@ -116,18 +116,18 @@ tuner_attach(struct i2c_adapter *adap, int addr, int kind)
|
|||||||
if (this_adap > 0)
|
if (this_adap > 0)
|
||||||
return -1;
|
return -1;
|
||||||
this_adap++;
|
this_adap++;
|
||||||
|
|
||||||
client_template.adapter = adap;
|
client_template.adapter = adap;
|
||||||
client_template.addr = addr;
|
client_template.addr = addr;
|
||||||
|
|
||||||
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
|
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
|
||||||
if (client == NULL)
|
if (client == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memcpy(client, &client_template, sizeof(struct i2c_client));
|
memcpy(client, &client_template, sizeof(struct i2c_client));
|
||||||
|
|
||||||
printk("tuner: SAB3036 found, status %02x\n", tuner_getstatus(client));
|
printk("tuner: SAB3036 found, status %02x\n", tuner_getstatus(client));
|
||||||
|
|
||||||
i2c_attach_client(client);
|
i2c_attach_client(client);
|
||||||
|
|
||||||
if (i2c_master_send(client, buffer, 2) != 2)
|
if (i2c_master_send(client, buffer, 2) != 2)
|
||||||
printk("tuner: i2c i/o error 1\n");
|
printk("tuner: i2c i/o error 1\n");
|
||||||
@ -138,30 +138,30 @@ tuner_attach(struct i2c_adapter *adap, int addr, int kind)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tuner_detach(struct i2c_client *c)
|
tuner_detach(struct i2c_client *c)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||||
{
|
{
|
||||||
int *iarg = (int*)arg;
|
int *iarg = (int*)arg;
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case VIDIOCSFREQ:
|
case VIDIOCSFREQ:
|
||||||
set_tv_freq(client, *iarg);
|
set_tv_freq(client, *iarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tuner_probe(struct i2c_adapter *adap)
|
tuner_probe(struct i2c_adapter *adap)
|
||||||
{
|
{
|
||||||
this_adap = 0;
|
this_adap = 0;
|
||||||
@ -172,8 +172,8 @@ tuner_probe(struct i2c_adapter *adap)
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
|
||||||
static struct i2c_driver
|
static struct i2c_driver
|
||||||
i2c_driver_tuner =
|
i2c_driver_tuner =
|
||||||
{
|
{
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "sab3036",
|
.name = "sab3036",
|
||||||
@ -186,7 +186,7 @@ i2c_driver_tuner =
|
|||||||
|
|
||||||
static struct i2c_client client_template =
|
static struct i2c_client client_template =
|
||||||
{
|
{
|
||||||
.driver = &i2c_driver_tuner,
|
.driver = &i2c_driver_tuner,
|
||||||
.name = "SAB3036",
|
.name = "SAB3036",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1300,11 +1300,11 @@ static void ibmcam_model2_Packet1(struct uvd *uvd, unsigned short v1, unsigned s
|
|||||||
/*
|
/*
|
||||||
* ibmcam_model3_Packet1()
|
* ibmcam_model3_Packet1()
|
||||||
*
|
*
|
||||||
* 00_0078_012d
|
* 00_0078_012d
|
||||||
* 00_0097_012f
|
* 00_0097_012f
|
||||||
* 00_d141_0124
|
* 00_d141_0124
|
||||||
* 00_0096_0127
|
* 00_0096_0127
|
||||||
* 00_fea8_0124
|
* 00_fea8_0124
|
||||||
*/
|
*/
|
||||||
static void ibmcam_model3_Packet1(struct uvd *uvd, unsigned short v1, unsigned short v2)
|
static void ibmcam_model3_Packet1(struct uvd *uvd, unsigned short v1, unsigned short v2)
|
||||||
{
|
{
|
||||||
@ -2687,7 +2687,7 @@ static void ibmcam_model4_setup_after_video_if(struct uvd *uvd)
|
|||||||
ibmcam_veio(uvd, 0, 0x0004, 0x0127);
|
ibmcam_veio(uvd, 0, 0x0004, 0x0127);
|
||||||
ibmcam_veio(uvd, 0, 0xfea8, 0x0124);
|
ibmcam_veio(uvd, 0, 0xfea8, 0x0124);
|
||||||
ibmcam_veio(uvd, 0, 0x00c0, 0x010c);
|
ibmcam_veio(uvd, 0, 0x00c0, 0x010c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
usb_clear_halt(uvd->dev, usb_rcvisocpipe(uvd->dev, uvd->video_endp));
|
usb_clear_halt(uvd->dev, usb_rcvisocpipe(uvd->dev, uvd->video_endp));
|
||||||
}
|
}
|
||||||
@ -3238,7 +3238,7 @@ static void ibmcam_model3_setup_after_video_if(struct uvd *uvd)
|
|||||||
{0, 0x0062, 0x0107},
|
{0, 0x0062, 0x0107},
|
||||||
{0, 0x0003, 0x0111},
|
{0, 0x0003, 0x0111},
|
||||||
};
|
};
|
||||||
#define NUM_INIT_DATA
|
#define NUM_INIT_DATA
|
||||||
|
|
||||||
unsigned short compression = 0; /* 0=none, 7=best frame rate */
|
unsigned short compression = 0; /* 0=none, 7=best frame rate */
|
||||||
int f_rate; /* 0=Fastest 7=slowest */
|
int f_rate; /* 0=Fastest 7=slowest */
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
enum ctrl_req {
|
enum ctrl_req {
|
||||||
SetWhitebal = 0x01,
|
SetWhitebal = 0x01,
|
||||||
SetBrightness = 0x02,
|
SetBrightness = 0x02,
|
||||||
SetSharpness = 0x03,
|
SetSharpness = 0x03,
|
||||||
SetContrast = 0x04,
|
SetContrast = 0x04,
|
||||||
SetSaturation = 0x05,
|
SetSaturation = 0x05,
|
||||||
};
|
};
|
||||||
@ -47,7 +47,7 @@ enum frame_sizes {
|
|||||||
SIZE_160X136 = 1,
|
SIZE_160X136 = 1,
|
||||||
SIZE_176X144 = 2,
|
SIZE_176X144 = 2,
|
||||||
SIZE_320X240 = 3,
|
SIZE_320X240 = 3,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_FRAME_SIZE SIZE_320X240
|
#define MAX_FRAME_SIZE SIZE_320X240
|
||||||
@ -69,7 +69,7 @@ static const int debug = 0;
|
|||||||
/* Some default values for initial camera settings,
|
/* Some default values for initial camera settings,
|
||||||
can be set by modprobe */
|
can be set by modprobe */
|
||||||
|
|
||||||
static int size;
|
static int size;
|
||||||
static int speed = 6; /* Speed (fps) 0 (slowest) to 6 (fastest) */
|
static int speed = 6; /* Speed (fps) 0 (slowest) to 6 (fastest) */
|
||||||
static int brightness = MAX_BRIGHTNESS/2;
|
static int brightness = MAX_BRIGHTNESS/2;
|
||||||
static int contrast = MAX_CONTRAST/2;
|
static int contrast = MAX_CONTRAST/2;
|
||||||
@ -132,24 +132,24 @@ struct konicawc {
|
|||||||
|
|
||||||
static int konicawc_ctrl_msg(struct uvd *uvd, u8 dir, u8 request, u16 value, u16 index, void *buf, int len)
|
static int konicawc_ctrl_msg(struct uvd *uvd, u8 dir, u8 request, u16 value, u16 index, void *buf, int len)
|
||||||
{
|
{
|
||||||
int retval = usb_control_msg(uvd->dev,
|
int retval = usb_control_msg(uvd->dev,
|
||||||
dir ? usb_rcvctrlpipe(uvd->dev, 0) : usb_sndctrlpipe(uvd->dev, 0),
|
dir ? usb_rcvctrlpipe(uvd->dev, 0) : usb_sndctrlpipe(uvd->dev, 0),
|
||||||
request, 0x40 | dir, value, index, buf, len, 1000);
|
request, 0x40 | dir, value, index, buf, len, 1000);
|
||||||
return retval < 0 ? retval : 0;
|
return retval < 0 ? retval : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void konicawc_camera_on(struct uvd *uvd)
|
static inline void konicawc_camera_on(struct uvd *uvd)
|
||||||
{
|
{
|
||||||
DEBUG(0, "camera on");
|
DEBUG(0, "camera on");
|
||||||
konicawc_set_misc(uvd, 0x2, 1, 0x0b);
|
konicawc_set_misc(uvd, 0x2, 1, 0x0b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void konicawc_camera_off(struct uvd *uvd)
|
static inline void konicawc_camera_off(struct uvd *uvd)
|
||||||
{
|
{
|
||||||
DEBUG(0, "camera off");
|
DEBUG(0, "camera off");
|
||||||
konicawc_set_misc(uvd, 0x2, 0, 0x0b);
|
konicawc_set_misc(uvd, 0x2, 0, 0x0b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -317,7 +317,7 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur
|
|||||||
button = !!(sts & 0x40);
|
button = !!(sts & 0x40);
|
||||||
sts &= ~0x40;
|
sts &= ~0x40;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* work out the button status, but don't do
|
/* work out the button status, but don't do
|
||||||
anything with it for now */
|
anything with it for now */
|
||||||
|
|
||||||
@ -331,7 +331,7 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur
|
|||||||
discard++;
|
discard++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((sts > 0x01) && (sts < 0x80)) {
|
if((sts > 0x01) && (sts < 0x80)) {
|
||||||
info("unknown status %2.2x", sts);
|
info("unknown status %2.2x", sts);
|
||||||
bad++;
|
bad++;
|
||||||
@ -350,7 +350,7 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur
|
|||||||
DEBUG(2, "found initial image");
|
DEBUG(2, "found initial image");
|
||||||
cam->lastframe = -1;
|
cam->lastframe = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
marker[3] = sts & 0x7F;
|
marker[3] = sts & 0x7F;
|
||||||
RingQueue_Enqueue(&uvd->dp, marker, 4);
|
RingQueue_Enqueue(&uvd->dp, marker, 4);
|
||||||
totlen += 4;
|
totlen += 4;
|
||||||
@ -367,16 +367,16 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur
|
|||||||
|
|
||||||
static void resubmit_urb(struct uvd *uvd, struct urb *urb)
|
static void resubmit_urb(struct uvd *uvd, struct urb *urb)
|
||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
for (i = 0; i < FRAMES_PER_DESC; i++) {
|
for (i = 0; i < FRAMES_PER_DESC; i++) {
|
||||||
urb->iso_frame_desc[i].status = 0;
|
urb->iso_frame_desc[i].status = 0;
|
||||||
}
|
}
|
||||||
urb->dev = uvd->dev;
|
urb->dev = uvd->dev;
|
||||||
urb->status = 0;
|
urb->status = 0;
|
||||||
ret = usb_submit_urb(urb, GFP_ATOMIC);
|
ret = usb_submit_urb(urb, GFP_ATOMIC);
|
||||||
DEBUG(3, "submitting urb of length %d", urb->transfer_buffer_length);
|
DEBUG(3, "submitting urb of length %d", urb->transfer_buffer_length);
|
||||||
if(ret)
|
if(ret)
|
||||||
err("usb_submit_urb error (%d)", ret);
|
err("usb_submit_urb error (%d)", ret);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,7 +490,7 @@ static int konicawc_start_data(struct uvd *uvd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cam->last_data_urb = NULL;
|
cam->last_data_urb = NULL;
|
||||||
|
|
||||||
/* Submit all URBs */
|
/* Submit all URBs */
|
||||||
for (i=0; i < USBVIDEO_NUMSBUF; i++) {
|
for (i=0; i < USBVIDEO_NUMSBUF; i++) {
|
||||||
errFlag = usb_submit_urb(cam->sts_urb[i], GFP_KERNEL);
|
errFlag = usb_submit_urb(cam->sts_urb[i], GFP_KERNEL);
|
||||||
@ -539,7 +539,7 @@ static void konicawc_stop_data(struct uvd *uvd)
|
|||||||
|
|
||||||
|
|
||||||
static void konicawc_process_isoc(struct uvd *uvd, struct usbvideo_frame *frame)
|
static void konicawc_process_isoc(struct uvd *uvd, struct usbvideo_frame *frame)
|
||||||
{
|
{
|
||||||
struct konicawc *cam = (struct konicawc *)uvd->user_data;
|
struct konicawc *cam = (struct konicawc *)uvd->user_data;
|
||||||
int maxline = cam->maxline;
|
int maxline = cam->maxline;
|
||||||
int yplanesz = cam->yplanesz;
|
int yplanesz = cam->yplanesz;
|
||||||
@ -583,13 +583,13 @@ static void konicawc_process_isoc(struct uvd *uvd, struct usbvideo_frame *frame)
|
|||||||
|
|
||||||
if(frame->scanstate == ScanState_Scanning)
|
if(frame->scanstate == ScanState_Scanning)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Try to move data from queue into frame buffer
|
/* Try to move data from queue into frame buffer
|
||||||
* We get data in blocks of 384 bytes made up of:
|
* We get data in blocks of 384 bytes made up of:
|
||||||
* 256 Y, 64 U, 64 V.
|
* 256 Y, 64 U, 64 V.
|
||||||
* This needs to be written out as a Y plane, a U plane and a V plane.
|
* This needs to be written out as a Y plane, a U plane and a V plane.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while ( frame->curline < maxline && (RingQueue_GetLength(&uvd->dp) >= 384)) {
|
while ( frame->curline < maxline && (RingQueue_GetLength(&uvd->dp) >= 384)) {
|
||||||
/* Y */
|
/* Y */
|
||||||
RingQueue_Dequeue(&uvd->dp, frame->data + (frame->curline * 256), 256);
|
RingQueue_Dequeue(&uvd->dp, frame->data + (frame->curline * 256), 256);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
int initialized; /* Had we already sent init sequence? */
|
int initialized; /* Had we already sent init sequence? */
|
||||||
int camera_model; /* What type of IBM camera we got? */
|
int camera_model; /* What type of IBM camera we got? */
|
||||||
int has_hdr;
|
int has_hdr;
|
||||||
} ultracam_t;
|
} ultracam_t;
|
||||||
#define ULTRACAM_T(uvd) ((ultracam_t *)((uvd)->user_data))
|
#define ULTRACAM_T(uvd) ((ultracam_t *)((uvd)->user_data))
|
||||||
|
|
||||||
|
@ -574,7 +574,7 @@ void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode)
|
|||||||
} else {
|
} else {
|
||||||
/* Just the blue screen */
|
/* Just the blue screen */
|
||||||
}
|
}
|
||||||
|
|
||||||
*f++ = cb;
|
*f++ = cb;
|
||||||
*f++ = cg;
|
*f++ = cg;
|
||||||
*f++ = cr;
|
*f++ = cr;
|
||||||
@ -1243,7 +1243,7 @@ static int usbvideo_v4l_close(struct inode *inode, struct file *file)
|
|||||||
|
|
||||||
#if USBVIDEO_REPORT_STATS
|
#if USBVIDEO_REPORT_STATS
|
||||||
usbvideo_ReportStatistics(uvd);
|
usbvideo_ReportStatistics(uvd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uvd->user--;
|
uvd->user--;
|
||||||
if (uvd->remove_pending) {
|
if (uvd->remove_pending) {
|
||||||
@ -1290,7 +1290,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCSCHAN:
|
case VIDIOCSCHAN:
|
||||||
{
|
{
|
||||||
struct video_channel *v = arg;
|
struct video_channel *v = arg;
|
||||||
if (v->channel != 0)
|
if (v->channel != 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1347,7 +1347,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
vw->chromakey = 0;
|
vw->chromakey = 0;
|
||||||
if (VALID_CALLBACK(uvd, getFPS))
|
if (VALID_CALLBACK(uvd, getFPS))
|
||||||
vw->flags = GET_CALLBACK(uvd, getFPS)(uvd);
|
vw->flags = GET_CALLBACK(uvd, getFPS)(uvd);
|
||||||
else
|
else
|
||||||
vw->flags = 10; /* FIXME: do better! */
|
vw->flags = 10; /* FIXME: do better! */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1359,7 +1359,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
memset(vm, 0, sizeof(*vm));
|
memset(vm, 0, sizeof(*vm));
|
||||||
vm->size = uvd->max_frame_size * USBVIDEO_NUMFRAMES;
|
vm->size = uvd->max_frame_size * USBVIDEO_NUMFRAMES;
|
||||||
vm->frames = USBVIDEO_NUMFRAMES;
|
vm->frames = USBVIDEO_NUMFRAMES;
|
||||||
for(i = 0; i < USBVIDEO_NUMFRAMES; i++)
|
for(i = 0; i < USBVIDEO_NUMFRAMES; i++)
|
||||||
vm->offsets[i] = i * uvd->max_frame_size;
|
vm->offsets[i] = i * uvd->max_frame_size;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1425,7 +1425,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
|
|
||||||
if (*frameNum < 0 || *frameNum >= USBVIDEO_NUMFRAMES)
|
if (*frameNum < 0 || *frameNum >= USBVIDEO_NUMFRAMES)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (uvd->debug >= 1)
|
if (uvd->debug >= 1)
|
||||||
info("VIDIOCSYNC: syncing to frame %d.", *frameNum);
|
info("VIDIOCSYNC: syncing to frame %d.", *frameNum);
|
||||||
if (uvd->flags & FLAGS_NO_DECODING)
|
if (uvd->flags & FLAGS_NO_DECODING)
|
||||||
@ -1454,8 +1454,8 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
struct video_buffer *vb = arg;
|
struct video_buffer *vb = arg;
|
||||||
|
|
||||||
memset(vb, 0, sizeof(*vb));
|
memset(vb, 0, sizeof(*vb));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCKEY:
|
case VIDIOCKEY:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1704,7 +1704,7 @@ static void usbvideo_IsocIrq(struct urb *urb, struct pt_regs *regs)
|
|||||||
info("Not streaming, but interrupt!");
|
info("Not streaming, but interrupt!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uvd->stats.urb_count++;
|
uvd->stats.urb_count++;
|
||||||
if (urb->actual_length <= 0)
|
if (urb->actual_length <= 0)
|
||||||
goto urb_done_with;
|
goto urb_done_with;
|
||||||
@ -1763,7 +1763,7 @@ static int usbvideo_StartDataPump(struct uvd *uvd)
|
|||||||
}
|
}
|
||||||
if (VALID_CALLBACK(uvd, videoStart))
|
if (VALID_CALLBACK(uvd, videoStart))
|
||||||
GET_CALLBACK(uvd, videoStart)(uvd);
|
GET_CALLBACK(uvd, videoStart)(uvd);
|
||||||
else
|
else
|
||||||
err("%s: videoStart not set", __FUNCTION__);
|
err("%s: videoStart not set", __FUNCTION__);
|
||||||
|
|
||||||
/* We double buffer the Iso lists */
|
/* We double buffer the Iso lists */
|
||||||
@ -1830,7 +1830,7 @@ static void usbvideo_StopDataPump(struct uvd *uvd)
|
|||||||
/* Invoke minidriver's magic to stop the camera */
|
/* Invoke minidriver's magic to stop the camera */
|
||||||
if (VALID_CALLBACK(uvd, videoStop))
|
if (VALID_CALLBACK(uvd, videoStop))
|
||||||
GET_CALLBACK(uvd, videoStop)(uvd);
|
GET_CALLBACK(uvd, videoStop)(uvd);
|
||||||
else
|
else
|
||||||
err("%s: videoStop not set", __FUNCTION__);
|
err("%s: videoStop not set", __FUNCTION__);
|
||||||
|
|
||||||
/* Set packet size to 0 */
|
/* Set packet size to 0 */
|
||||||
@ -1963,14 +1963,14 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum)
|
|||||||
info("%s($%p,%d.)", __FUNCTION__, uvd, frameNum);
|
info("%s($%p,%d.)", __FUNCTION__, uvd, frameNum);
|
||||||
|
|
||||||
switch (frame->frameState) {
|
switch (frame->frameState) {
|
||||||
case FrameState_Unused:
|
case FrameState_Unused:
|
||||||
if (uvd->debug >= 2)
|
if (uvd->debug >= 2)
|
||||||
info("%s: FrameState_Unused", __FUNCTION__);
|
info("%s: FrameState_Unused", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
case FrameState_Ready:
|
case FrameState_Ready:
|
||||||
case FrameState_Grabbing:
|
case FrameState_Grabbing:
|
||||||
case FrameState_Error:
|
case FrameState_Error:
|
||||||
{
|
{
|
||||||
int ntries, signalPending;
|
int ntries, signalPending;
|
||||||
redo:
|
redo:
|
||||||
if (!CAMERA_IS_OPERATIONAL(uvd)) {
|
if (!CAMERA_IS_OPERATIONAL(uvd)) {
|
||||||
@ -1978,7 +1978,7 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum)
|
|||||||
info("%s: Camera is not operational (1)", __FUNCTION__);
|
info("%s: Camera is not operational (1)", __FUNCTION__);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
ntries = 0;
|
ntries = 0;
|
||||||
do {
|
do {
|
||||||
RingQueue_InterruptibleSleepOn(&uvd->dp);
|
RingQueue_InterruptibleSleepOn(&uvd->dp);
|
||||||
signalPending = signal_pending(current);
|
signalPending = signal_pending(current);
|
||||||
@ -2010,7 +2010,7 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum)
|
|||||||
usbvideo_CollectRawData(uvd, frame);
|
usbvideo_CollectRawData(uvd, frame);
|
||||||
else if (VALID_CALLBACK(uvd, processData))
|
else if (VALID_CALLBACK(uvd, processData))
|
||||||
GET_CALLBACK(uvd, processData)(uvd, frame);
|
GET_CALLBACK(uvd, processData)(uvd, frame);
|
||||||
else
|
else
|
||||||
err("%s: processData not set", __FUNCTION__);
|
err("%s: processData not set", __FUNCTION__);
|
||||||
}
|
}
|
||||||
} while (frame->frameState == FrameState_Grabbing);
|
} while (frame->frameState == FrameState_Grabbing);
|
||||||
@ -2027,8 +2027,8 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum)
|
|||||||
goto redo;
|
goto redo;
|
||||||
}
|
}
|
||||||
/* Note that we fall through to meet our destiny below */
|
/* Note that we fall through to meet our destiny below */
|
||||||
}
|
}
|
||||||
case FrameState_Done:
|
case FrameState_Done:
|
||||||
/*
|
/*
|
||||||
* Do all necessary postprocessing of data prepared in
|
* Do all necessary postprocessing of data prepared in
|
||||||
* "interrupt" code and the collecting code above. The
|
* "interrupt" code and the collecting code above. The
|
||||||
@ -2157,7 +2157,7 @@ EXPORT_SYMBOL(usbvideo_DeinterlaceFrame);
|
|||||||
* History:
|
* History:
|
||||||
* 09-Feb-2001 Created.
|
* 09-Feb-2001 Created.
|
||||||
*/
|
*/
|
||||||
static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd,
|
static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd,
|
||||||
struct usbvideo_frame *frame)
|
struct usbvideo_frame *frame)
|
||||||
{
|
{
|
||||||
int i, j, v4l_linesize;
|
int i, j, v4l_linesize;
|
||||||
|
@ -189,11 +189,11 @@ struct usbvideo_frame {
|
|||||||
|
|
||||||
/* Statistics that can be overlaid on screen */
|
/* Statistics that can be overlaid on screen */
|
||||||
struct usbvideo_statistics {
|
struct usbvideo_statistics {
|
||||||
unsigned long frame_num; /* Sequential number of the frame */
|
unsigned long frame_num; /* Sequential number of the frame */
|
||||||
unsigned long urb_count; /* How many URBs we received so far */
|
unsigned long urb_count; /* How many URBs we received so far */
|
||||||
unsigned long urb_length; /* Length of last URB */
|
unsigned long urb_length; /* Length of last URB */
|
||||||
unsigned long data_count; /* How many bytes we received */
|
unsigned long data_count; /* How many bytes we received */
|
||||||
unsigned long header_count; /* How many frame headers we found */
|
unsigned long header_count; /* How many frame headers we found */
|
||||||
unsigned long iso_skip_count; /* How many empty ISO packets received */
|
unsigned long iso_skip_count; /* How many empty ISO packets received */
|
||||||
unsigned long iso_err_count; /* How many bad ISO packets received */
|
unsigned long iso_err_count; /* How many bad ISO packets received */
|
||||||
};
|
};
|
||||||
|
@ -69,10 +69,10 @@
|
|||||||
#define VICAM_HEADER_SIZE 64
|
#define VICAM_HEADER_SIZE 64
|
||||||
|
|
||||||
#define clamp( x, l, h ) max_t( __typeof__( x ), \
|
#define clamp( x, l, h ) max_t( __typeof__( x ), \
|
||||||
( l ), \
|
( l ), \
|
||||||
min_t( __typeof__( x ), \
|
min_t( __typeof__( x ), \
|
||||||
( h ), \
|
( h ), \
|
||||||
( x ) ) )
|
( x ) ) )
|
||||||
|
|
||||||
/* Not sure what all the bytes in these char
|
/* Not sure what all the bytes in these char
|
||||||
* arrays do, but they're necessary to make
|
* arrays do, but they're necessary to make
|
||||||
@ -357,7 +357,7 @@ static unsigned char setup5[] = {
|
|||||||
* Not sure why these are not yet non-statics which I can reference through
|
* Not sure why these are not yet non-statics which I can reference through
|
||||||
* usbvideo.h the same as it is in 2.4.20. I bet this will get fixed sometime
|
* usbvideo.h the same as it is in 2.4.20. I bet this will get fixed sometime
|
||||||
* in the future.
|
* in the future.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void *rvmalloc(unsigned long size)
|
static void *rvmalloc(unsigned long size)
|
||||||
{
|
{
|
||||||
@ -603,12 +603,12 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign
|
|||||||
case VIDIOCSPICT:
|
case VIDIOCSPICT:
|
||||||
{
|
{
|
||||||
struct video_picture vp;
|
struct video_picture vp;
|
||||||
|
|
||||||
if (copy_from_user(&vp, user_arg, sizeof(vp))) {
|
if (copy_from_user(&vp, user_arg, sizeof(vp))) {
|
||||||
retval = -EFAULT;
|
retval = -EFAULT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBG("VIDIOCSPICT depth = %d, pal = %d\n", vp.depth,
|
DBG("VIDIOCSPICT depth = %d, pal = %d\n", vp.depth,
|
||||||
vp.palette);
|
vp.palette);
|
||||||
|
|
||||||
@ -655,7 +655,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign
|
|||||||
}
|
}
|
||||||
|
|
||||||
DBG("VIDIOCSWIN %d x %d\n", vw.width, vw.height);
|
DBG("VIDIOCSWIN %d x %d\n", vw.width, vw.height);
|
||||||
|
|
||||||
if ( vw.width != 320 || vw.height != 240 )
|
if ( vw.width != 320 || vw.height != 240 )
|
||||||
retval = -EFAULT;
|
retval = -EFAULT;
|
||||||
|
|
||||||
@ -809,12 +809,12 @@ vicam_open(struct inode *inode, struct file *file)
|
|||||||
cam->needsDummyRead = 1;
|
cam->needsDummyRead = 1;
|
||||||
cam->open_count++;
|
cam->open_count++;
|
||||||
|
|
||||||
file->private_data = cam;
|
file->private_data = cam;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vicam_close(struct inode *inode, struct file *file)
|
vicam_close(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
struct vicam_camera *cam = file->private_data;
|
struct vicam_camera *cam = file->private_data;
|
||||||
@ -1187,7 +1187,7 @@ vicam_create_proc_entry(struct vicam_camera *cam)
|
|||||||
|
|
||||||
if ( !cam->proc_dir )
|
if ( !cam->proc_dir )
|
||||||
return; // FIXME: We should probably return an error here
|
return; // FIXME: We should probably return an error here
|
||||||
|
|
||||||
ent = create_proc_entry("shutter", S_IFREG | S_IRUGO | S_IWUSR,
|
ent = create_proc_entry("shutter", S_IFREG | S_IRUGO | S_IWUSR,
|
||||||
cam->proc_dir);
|
cam->proc_dir);
|
||||||
if (ent) {
|
if (ent) {
|
||||||
@ -1282,7 +1282,7 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id)
|
|||||||
const struct usb_host_interface *interface;
|
const struct usb_host_interface *interface;
|
||||||
const struct usb_endpoint_descriptor *endpoint;
|
const struct usb_endpoint_descriptor *endpoint;
|
||||||
struct vicam_camera *cam;
|
struct vicam_camera *cam;
|
||||||
|
|
||||||
printk(KERN_INFO "ViCam based webcam connected\n");
|
printk(KERN_INFO "ViCam based webcam connected\n");
|
||||||
|
|
||||||
interface = intf->cur_altsetting;
|
interface = intf->cur_altsetting;
|
||||||
@ -1331,7 +1331,7 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id)
|
|||||||
printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor);
|
printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor);
|
||||||
|
|
||||||
usb_set_intfdata (intf, cam);
|
usb_set_intfdata (intf, cam);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
therfor they may not be initialized.
|
therfor they may not be initialized.
|
||||||
|
|
||||||
The other fuctions are just for convenience, as they are for sure used by
|
The other fuctions are just for convenience, as they are for sure used by
|
||||||
most/all of the codecs. The last ones may be ommited, too.
|
most/all of the codecs. The last ones may be ommited, too.
|
||||||
|
|
||||||
See the structure declaration below for more information and which data has
|
See the structure declaration below for more information and which data has
|
||||||
to be set up for the master and the slave.
|
to be set up for the master and the slave.
|
||||||
@ -75,52 +75,52 @@
|
|||||||
/* ========================================== */
|
/* ========================================== */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==== master setup ====
|
==== master setup ====
|
||||||
name -> name of the device structure for reference and debugging
|
name -> name of the device structure for reference and debugging
|
||||||
master_data -> data ref. for the master (e.g. the zr36055,57,67)
|
master_data -> data ref. for the master (e.g. the zr36055,57,67)
|
||||||
readreg -> ref. to read-fn from register (setup by master, used by slave)
|
readreg -> ref. to read-fn from register (setup by master, used by slave)
|
||||||
writereg -> ref. to write-fn to register (setup by master, used by slave)
|
writereg -> ref. to write-fn to register (setup by master, used by slave)
|
||||||
this two functions do the lowlevel I/O job
|
this two functions do the lowlevel I/O job
|
||||||
|
|
||||||
==== slave functionality setup ====
|
==== slave functionality setup ====
|
||||||
slave_data -> data ref. for the slave (e.g. the zr36050,60)
|
slave_data -> data ref. for the slave (e.g. the zr36050,60)
|
||||||
check -> fn-ref. checks availability of an device, returns -EIO on failure or
|
check -> fn-ref. checks availability of an device, returns -EIO on failure or
|
||||||
the type on success
|
the type on success
|
||||||
this makes espcecially sense if a driver module supports more than
|
this makes espcecially sense if a driver module supports more than
|
||||||
one codec which may be quite similar to access, nevertheless it
|
one codec which may be quite similar to access, nevertheless it
|
||||||
is good for a first functionality check
|
is good for a first functionality check
|
||||||
|
|
||||||
-- main functions you always need for compression/decompression --
|
-- main functions you always need for compression/decompression --
|
||||||
|
|
||||||
set_mode -> this fn-ref. resets the entire codec, and sets up the mode
|
set_mode -> this fn-ref. resets the entire codec, and sets up the mode
|
||||||
with the last defined norm/size (or device default if not
|
with the last defined norm/size (or device default if not
|
||||||
available) - it returns 0 if the mode is possible
|
available) - it returns 0 if the mode is possible
|
||||||
set_size -> this fn-ref. sets the norm and image size for
|
set_size -> this fn-ref. sets the norm and image size for
|
||||||
compression/decompression (returns 0 on success)
|
compression/decompression (returns 0 on success)
|
||||||
the norm param is defined in videodev.h (VIDEO_MODE_*)
|
the norm param is defined in videodev.h (VIDEO_MODE_*)
|
||||||
|
|
||||||
additional setup may be available, too - but the codec should work with
|
additional setup may be available, too - but the codec should work with
|
||||||
some default values even without this
|
some default values even without this
|
||||||
|
|
||||||
set_data -> sets device-specific data (tables, quality etc.)
|
set_data -> sets device-specific data (tables, quality etc.)
|
||||||
get_data -> query device-specific data (tables, quality etc.)
|
get_data -> query device-specific data (tables, quality etc.)
|
||||||
|
|
||||||
if the device delivers interrupts, they may be setup/handled here
|
if the device delivers interrupts, they may be setup/handled here
|
||||||
setup_interrupt -> codec irq setup (not needed for 36050/60)
|
setup_interrupt -> codec irq setup (not needed for 36050/60)
|
||||||
handle_interrupt -> codec irq handling (not needed for 36050/60)
|
handle_interrupt -> codec irq handling (not needed for 36050/60)
|
||||||
|
|
||||||
if the device delivers pictures, they may be handled here
|
if the device delivers pictures, they may be handled here
|
||||||
put_image -> puts image data to the codec (not needed for 36050/60)
|
put_image -> puts image data to the codec (not needed for 36050/60)
|
||||||
get_image -> gets image data from the codec (not needed for 36050/60)
|
get_image -> gets image data from the codec (not needed for 36050/60)
|
||||||
the calls include frame numbers and flags (even/odd/...)
|
the calls include frame numbers and flags (even/odd/...)
|
||||||
if needed and a flag which allows blocking until its ready
|
if needed and a flag which allows blocking until its ready
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ============== */
|
/* ============== */
|
||||||
/* user interface */
|
/* user interface */
|
||||||
/* ============== */
|
/* ============== */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Currently there is only a information display planned, as the layer
|
Currently there is only a information display planned, as the layer
|
||||||
is not visible for the user space at all.
|
is not visible for the user space at all.
|
||||||
|
|
||||||
|
@ -1555,12 +1555,12 @@ static void vino_update_line_size(struct vino_channel_settings *vcs)
|
|||||||
unsigned int w = vcs->clipping.right - vcs->clipping.left;
|
unsigned int w = vcs->clipping.right - vcs->clipping.left;
|
||||||
unsigned int d = vcs->decimation;
|
unsigned int d = vcs->decimation;
|
||||||
unsigned int bpp = vino_data_formats[vcs->data_format].bpp;
|
unsigned int bpp = vino_data_formats[vcs->data_format].bpp;
|
||||||
unsigned int lsize;
|
unsigned int lsize;
|
||||||
|
|
||||||
dprintk("update_line_size(): before: w = %d, d = %d, "
|
dprintk("update_line_size(): before: w = %d, d = %d, "
|
||||||
"line_size = %d\n", w, d, vcs->line_size);
|
"line_size = %d\n", w, d, vcs->line_size);
|
||||||
|
|
||||||
/* line size must be multiple of 8 bytes */
|
/* line size must be multiple of 8 bytes */
|
||||||
lsize = (bpp * (w / d)) & ~7;
|
lsize = (bpp * (w / d)) & ~7;
|
||||||
w = (lsize / bpp) * d;
|
w = (lsize / bpp) * d;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* vpx3220a, vpx3216b & vpx3214c video decoder driver version 0.0.1
|
* vpx3220a, vpx3216b & vpx3214c video decoder driver version 0.0.1
|
||||||
*
|
*
|
||||||
* Copyright (C) 2001 Laurent Pinchart <lpinchart@freegates.be>
|
* Copyright (C) 2001 Laurent Pinchart <lpinchart@freegates.be>
|
||||||
@ -176,8 +176,8 @@ vpx3220_write_block (struct i2c_client *client,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
vpx3220_write_fp_block (struct i2c_client *client,
|
vpx3220_write_fp_block (struct i2c_client *client,
|
||||||
const u16 *data,
|
const u16 *data,
|
||||||
unsigned int len)
|
unsigned int len)
|
||||||
{
|
{
|
||||||
u8 reg;
|
u8 reg;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -316,7 +316,7 @@ vpx3220_command (struct i2c_client *client,
|
|||||||
vpx3220_write_fp_block(client, init_fp,
|
vpx3220_write_fp_block(client, init_fp,
|
||||||
sizeof(init_fp) >> 1);
|
sizeof(init_fp) >> 1);
|
||||||
switch (decoder->norm) {
|
switch (decoder->norm) {
|
||||||
|
|
||||||
case VIDEO_MODE_NTSC:
|
case VIDEO_MODE_NTSC:
|
||||||
vpx3220_write_fp_block(client, init_ntsc,
|
vpx3220_write_fp_block(client, init_ntsc,
|
||||||
sizeof(init_ntsc) >> 1);
|
sizeof(init_ntsc) >> 1);
|
||||||
@ -324,7 +324,7 @@ vpx3220_command (struct i2c_client *client,
|
|||||||
|
|
||||||
case VIDEO_MODE_PAL:
|
case VIDEO_MODE_PAL:
|
||||||
vpx3220_write_fp_block(client, init_pal,
|
vpx3220_write_fp_block(client, init_pal,
|
||||||
sizeof(init_pal) >> 1);
|
sizeof(init_pal) >> 1);
|
||||||
break;
|
break;
|
||||||
case VIDEO_MODE_SECAM:
|
case VIDEO_MODE_SECAM:
|
||||||
vpx3220_write_fp_block(client, init_secam,
|
vpx3220_write_fp_block(client, init_secam,
|
||||||
@ -332,10 +332,10 @@ vpx3220_command (struct i2c_client *client,
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
vpx3220_write_fp_block(client, init_pal,
|
vpx3220_write_fp_block(client, init_pal,
|
||||||
sizeof(init_pal) >> 1);
|
sizeof(init_pal) >> 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DECODER_DUMP:
|
case DECODER_DUMP:
|
||||||
@ -411,7 +411,7 @@ vpx3220_command (struct i2c_client *client,
|
|||||||
|
|
||||||
/* Here we back up the input selection because it gets
|
/* Here we back up the input selection because it gets
|
||||||
overwritten when we fill the registers with the
|
overwritten when we fill the registers with the
|
||||||
choosen video norm */
|
choosen video norm */
|
||||||
temp_input = vpx3220_fp_read(client, 0xf2);
|
temp_input = vpx3220_fp_read(client, 0xf2);
|
||||||
|
|
||||||
dprintk(1, KERN_DEBUG "%s: DECODER_SET_NORM %d\n",
|
dprintk(1, KERN_DEBUG "%s: DECODER_SET_NORM %d\n",
|
||||||
@ -578,7 +578,7 @@ static unsigned short normal_i2c[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
static unsigned short ignore = I2C_CLIENT_END;
|
static unsigned short ignore = I2C_CLIENT_END;
|
||||||
|
|
||||||
static struct i2c_client_address_data addr_data = {
|
static struct i2c_client_address_data addr_data = {
|
||||||
.normal_i2c = normal_i2c,
|
.normal_i2c = normal_i2c,
|
||||||
.probe = &ignore,
|
.probe = &ignore,
|
||||||
@ -661,7 +661,7 @@ vpx3220_detect_client (struct i2c_adapter *adapter,
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dprintk(1,
|
dprintk(1,
|
||||||
KERN_INFO
|
KERN_INFO
|
||||||
"%s: Wrong part number (0x%04x)\n",
|
"%s: Wrong part number (0x%04x)\n",
|
||||||
__func__, pn);
|
__func__, pn);
|
||||||
kfree(client);
|
kfree(client);
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
Does any other model using the w9966 interface chip exist ?
|
Does any other model using the w9966 interface chip exist ?
|
||||||
|
|
||||||
Todo:
|
Todo:
|
||||||
|
|
||||||
*Add a working EPP mode, since DMA ECP read isn't implemented
|
*Add a working EPP mode, since DMA ECP read isn't implemented
|
||||||
in the parport drivers. (That's why it's so sloow)
|
in the parport drivers. (That's why it's so sloow)
|
||||||
|
|
||||||
@ -47,9 +47,9 @@
|
|||||||
*Probably some bugs that I don't know of
|
*Probably some bugs that I don't know of
|
||||||
|
|
||||||
Please support me by sending feedback!
|
Please support me by sending feedback!
|
||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
|
|
||||||
Alan Cox: Removed RGB mode for kernel merge, added THIS_MODULE
|
Alan Cox: Removed RGB mode for kernel merge, added THIS_MODULE
|
||||||
and owner support for newer module locks
|
and owner support for newer module locks
|
||||||
*/
|
*/
|
||||||
@ -204,7 +204,7 @@ static struct video_device w9966_template = {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// Set camera phase flags, so we know what to uninit when terminating
|
// Set camera phase flags, so we know what to uninit when terminating
|
||||||
static inline void w9966_setState(struct w9966_dev* cam, int mask, int val)
|
static inline void w9966_setState(struct w9966_dev* cam, int mask, int val)
|
||||||
{
|
{
|
||||||
cam->dev_state = (cam->dev_state & ~mask) ^ val;
|
cam->dev_state = (cam->dev_state & ~mask) ^ val;
|
||||||
@ -233,7 +233,7 @@ static inline void w9966_pdev_release(struct w9966_dev* cam)
|
|||||||
parport_release(cam->pdev);
|
parport_release(cam->pdev);
|
||||||
w9966_setState(cam, W9966_STATE_CLAIMED, 0);
|
w9966_setState(cam, W9966_STATE_CLAIMED, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read register from W9966 interface-chip
|
// Read register from W9966 interface-chip
|
||||||
// Expects a claimed pdev
|
// Expects a claimed pdev
|
||||||
// -1 on error, else register data (byte)
|
// -1 on error, else register data (byte)
|
||||||
@ -242,7 +242,7 @@ static int w9966_rReg(struct w9966_dev* cam, int reg)
|
|||||||
// ECP, read, regtransfer, REG, REG, REG, REG, REG
|
// ECP, read, regtransfer, REG, REG, REG, REG, REG
|
||||||
const unsigned char addr = 0x80 | (reg & 0x1f);
|
const unsigned char addr = 0x80 | (reg & 0x1f);
|
||||||
unsigned char val;
|
unsigned char val;
|
||||||
|
|
||||||
if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0)
|
if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (parport_write(cam->pport, &addr, 1) != 1)
|
if (parport_write(cam->pport, &addr, 1) != 1)
|
||||||
@ -263,7 +263,7 @@ static int w9966_wReg(struct w9966_dev* cam, int reg, int data)
|
|||||||
// ECP, write, regtransfer, REG, REG, REG, REG, REG
|
// ECP, write, regtransfer, REG, REG, REG, REG, REG
|
||||||
const unsigned char addr = 0xc0 | (reg & 0x1f);
|
const unsigned char addr = 0xc0 | (reg & 0x1f);
|
||||||
const unsigned char val = data;
|
const unsigned char val = data;
|
||||||
|
|
||||||
if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0)
|
if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (parport_write(cam->pport, &addr, 1) != 1)
|
if (parport_write(cam->pport, &addr, 1) != 1)
|
||||||
@ -284,7 +284,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port)
|
|||||||
{
|
{
|
||||||
if (cam->dev_state != 0)
|
if (cam->dev_state != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
cam->pport = port;
|
cam->pport = port;
|
||||||
cam->brightness = 128;
|
cam->brightness = 128;
|
||||||
cam->contrast = 64;
|
cam->contrast = 64;
|
||||||
@ -302,7 +302,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port)
|
|||||||
cam->ppmode = IEEE1284_MODE_EPP;
|
cam->ppmode = IEEE1284_MODE_EPP;
|
||||||
else
|
else
|
||||||
cam->ppmode = IEEE1284_MODE_ECP;
|
cam->ppmode = IEEE1284_MODE_ECP;
|
||||||
break;
|
break;
|
||||||
case 1: // hw- or sw-ecp
|
case 1: // hw- or sw-ecp
|
||||||
cam->ppmode = IEEE1284_MODE_ECP;
|
cam->ppmode = IEEE1284_MODE_ECP;
|
||||||
break;
|
break;
|
||||||
@ -310,7 +310,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port)
|
|||||||
cam->ppmode = IEEE1284_MODE_EPP;
|
cam->ppmode = IEEE1284_MODE_EPP;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell the parport driver that we exists
|
// Tell the parport driver that we exists
|
||||||
cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL);
|
cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL);
|
||||||
if (cam->pdev == NULL) {
|
if (cam->pdev == NULL) {
|
||||||
@ -320,7 +320,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port)
|
|||||||
w9966_setState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV);
|
w9966_setState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV);
|
||||||
|
|
||||||
w9966_pdev_claim(cam);
|
w9966_pdev_claim(cam);
|
||||||
|
|
||||||
// Setup a default capture mode
|
// Setup a default capture mode
|
||||||
if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) {
|
if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) {
|
||||||
DPRINTF("w9966_setup() failed.\n");
|
DPRINTF("w9966_setup() failed.\n");
|
||||||
@ -333,11 +333,11 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port)
|
|||||||
memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device));
|
memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device));
|
||||||
cam->vdev.priv = cam;
|
cam->vdev.priv = cam;
|
||||||
|
|
||||||
if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) == -1)
|
if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV);
|
w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV);
|
||||||
|
|
||||||
// All ok
|
// All ok
|
||||||
printk(
|
printk(
|
||||||
"w9966cf: Found and initialized a webcam on %s.\n",
|
"w9966cf: Found and initialized a webcam on %s.\n",
|
||||||
@ -391,7 +391,7 @@ static int w9966_findlen(int near, int size, int maxlen)
|
|||||||
// Only continue as long as we keep getting better values
|
// Only continue as long as we keep getting better values
|
||||||
if (err > besterr)
|
if (err > besterr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
besterr = err;
|
besterr = err;
|
||||||
bestlen = len;
|
bestlen = len;
|
||||||
}
|
}
|
||||||
@ -399,7 +399,7 @@ static int w9966_findlen(int near, int size, int maxlen)
|
|||||||
return bestlen;
|
return bestlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modify capture window (if necessary)
|
// Modify capture window (if necessary)
|
||||||
// and calculate downscaling
|
// and calculate downscaling
|
||||||
// Return -1 on error
|
// Return -1 on error
|
||||||
static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsigned char* factor)
|
static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsigned char* factor)
|
||||||
@ -407,7 +407,7 @@ static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsig
|
|||||||
int maxlen = max - min;
|
int maxlen = max - min;
|
||||||
int len = *end - *beg + 1;
|
int len = *end - *beg + 1;
|
||||||
int newlen = w9966_findlen(len, size, maxlen);
|
int newlen = w9966_findlen(len, size, maxlen);
|
||||||
int err = newlen - len;
|
int err = newlen - len;
|
||||||
|
|
||||||
// Check for bad format
|
// Check for bad format
|
||||||
if (newlen > maxlen || newlen < size)
|
if (newlen > maxlen || newlen < size)
|
||||||
@ -452,8 +452,8 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in
|
|||||||
0x48, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x48, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x71, 0xe7, 0x00, 0x00, 0xc0
|
0x00, 0x00, 0x00, 0x71, 0xe7, 0x00, 0x00, 0xc0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
if (w*h*2 > W9966_SRAMSIZE)
|
if (w*h*2 > W9966_SRAMSIZE)
|
||||||
{
|
{
|
||||||
DPRINTF("capture window exceeds SRAM size!.\n");
|
DPRINTF("capture window exceeds SRAM size!.\n");
|
||||||
@ -469,9 +469,9 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in
|
|||||||
cam->width = w;
|
cam->width = w;
|
||||||
cam->height = h;
|
cam->height = h;
|
||||||
|
|
||||||
enh_s = 0;
|
enh_s = 0;
|
||||||
enh_e = w*h*2;
|
enh_e = w*h*2;
|
||||||
|
|
||||||
// Modify capture window if necessary and calculate downscaling
|
// Modify capture window if necessary and calculate downscaling
|
||||||
if (
|
if (
|
||||||
w9966_calcscale(w, W9966_WND_MIN_X, W9966_WND_MAX_X, &x1, &x2, &scale_x) != 0 ||
|
w9966_calcscale(w, W9966_WND_MIN_X, W9966_WND_MAX_X, &x1, &x2, &scale_x) != 0 ||
|
||||||
@ -482,14 +482,14 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in
|
|||||||
"%dx%d, x: %d<->%d, y: %d<->%d, sx: %d/64, sy: %d/64.\n",
|
"%dx%d, x: %d<->%d, y: %d<->%d, sx: %d/64, sy: %d/64.\n",
|
||||||
w, h, x1, x2, y1, y2, scale_x&~0x80, scale_y&~0x80
|
w, h, x1, x2, y1, y2, scale_x&~0x80, scale_y&~0x80
|
||||||
);
|
);
|
||||||
|
|
||||||
// Setup registers
|
// Setup registers
|
||||||
regs[0x00] = 0x00; // Set normal operation
|
regs[0x00] = 0x00; // Set normal operation
|
||||||
regs[0x01] = 0x18; // Capture mode
|
regs[0x01] = 0x18; // Capture mode
|
||||||
regs[0x02] = scale_y; // V-scaling
|
regs[0x02] = scale_y; // V-scaling
|
||||||
regs[0x03] = scale_x; // H-scaling
|
regs[0x03] = scale_x; // H-scaling
|
||||||
|
|
||||||
// Capture window
|
// Capture window
|
||||||
regs[0x04] = (x1 & 0x0ff); // X-start (8 low bits)
|
regs[0x04] = (x1 & 0x0ff); // X-start (8 low bits)
|
||||||
regs[0x05] = (x1 & 0x300)>>8; // X-start (2 high bits)
|
regs[0x05] = (x1 & 0x300)>>8; // X-start (2 high bits)
|
||||||
regs[0x06] = (y1 & 0x0ff); // Y-start (8 low bits)
|
regs[0x06] = (y1 & 0x0ff); // Y-start (8 low bits)
|
||||||
@ -499,7 +499,7 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in
|
|||||||
regs[0x0a] = (y2 & 0x0ff); // Y-end (8 low bits)
|
regs[0x0a] = (y2 & 0x0ff); // Y-end (8 low bits)
|
||||||
|
|
||||||
regs[0x0c] = W9966_SRAMID; // SRAM-banks (1x 128kb)
|
regs[0x0c] = W9966_SRAMID; // SRAM-banks (1x 128kb)
|
||||||
|
|
||||||
// Enhancement layer
|
// Enhancement layer
|
||||||
regs[0x0d] = (enh_s& 0x000ff); // Enh. start (0-7)
|
regs[0x0d] = (enh_s& 0x000ff); // Enh. start (0-7)
|
||||||
regs[0x0e] = (enh_s& 0x0ff00)>>8; // Enh. start (8-15)
|
regs[0x0e] = (enh_s& 0x0ff00)>>8; // Enh. start (8-15)
|
||||||
@ -515,7 +515,7 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in
|
|||||||
regs[0x19] = 0xff; // I/O port direction control
|
regs[0x19] = 0xff; // I/O port direction control
|
||||||
regs[0x1a] = 0xff; // I/O port data register
|
regs[0x1a] = 0xff; // I/O port data register
|
||||||
regs[0x1b] = 0x10; // ???
|
regs[0x1b] = 0x10; // ???
|
||||||
|
|
||||||
// SAA7111 chip settings
|
// SAA7111 chip settings
|
||||||
saa7111_regs[0x0a] = cam->brightness;
|
saa7111_regs[0x0a] = cam->brightness;
|
||||||
saa7111_regs[0x0b] = cam->contrast;
|
saa7111_regs[0x0b] = cam->contrast;
|
||||||
@ -551,7 +551,7 @@ static inline void w9966_i2c_setsda(struct w9966_dev* cam, int state)
|
|||||||
cam->i2c_state |= W9966_I2C_W_DATA;
|
cam->i2c_state |= W9966_I2C_W_DATA;
|
||||||
else
|
else
|
||||||
cam->i2c_state &= ~W9966_I2C_W_DATA;
|
cam->i2c_state &= ~W9966_I2C_W_DATA;
|
||||||
|
|
||||||
w9966_wReg(cam, 0x18, cam->i2c_state);
|
w9966_wReg(cam, 0x18, cam->i2c_state);
|
||||||
udelay(5);
|
udelay(5);
|
||||||
}
|
}
|
||||||
@ -577,7 +577,7 @@ static inline int w9966_i2c_setscl(struct w9966_dev* cam, int state)
|
|||||||
|
|
||||||
w9966_wReg(cam, 0x18, cam->i2c_state);
|
w9966_wReg(cam, 0x18, cam->i2c_state);
|
||||||
udelay(5);
|
udelay(5);
|
||||||
|
|
||||||
// we go to high, we also expect the peripheral to ack.
|
// we go to high, we also expect the peripheral to ack.
|
||||||
if (state) {
|
if (state) {
|
||||||
timeout = jiffies + 100;
|
timeout = jiffies + 100;
|
||||||
@ -607,16 +607,16 @@ static int w9966_i2c_wbyte(struct w9966_dev* cam, int data)
|
|||||||
w9966_i2c_setsda(cam, (data >> i) & 0x01);
|
w9966_i2c_setsda(cam, (data >> i) & 0x01);
|
||||||
|
|
||||||
if (w9966_i2c_setscl(cam, 1) == -1)
|
if (w9966_i2c_setscl(cam, 1) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
w9966_i2c_setscl(cam, 0);
|
w9966_i2c_setscl(cam, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
w9966_i2c_setsda(cam, 1);
|
w9966_i2c_setsda(cam, 1);
|
||||||
|
|
||||||
if (w9966_i2c_setscl(cam, 1) == -1)
|
if (w9966_i2c_setscl(cam, 1) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
w9966_i2c_setscl(cam, 0);
|
w9966_i2c_setscl(cam, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,8 +626,8 @@ static int w9966_i2c_wbyte(struct w9966_dev* cam, int data)
|
|||||||
static int w9966_i2c_rbyte(struct w9966_dev* cam)
|
static int w9966_i2c_rbyte(struct w9966_dev* cam)
|
||||||
{
|
{
|
||||||
unsigned char data = 0x00;
|
unsigned char data = 0x00;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
w9966_i2c_setsda(cam, 1);
|
w9966_i2c_setsda(cam, 1);
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
@ -637,7 +637,7 @@ static int w9966_i2c_rbyte(struct w9966_dev* cam)
|
|||||||
data = data << 1;
|
data = data << 1;
|
||||||
if (w9966_i2c_getsda(cam))
|
if (w9966_i2c_getsda(cam))
|
||||||
data |= 0x01;
|
data |= 0x01;
|
||||||
|
|
||||||
w9966_i2c_setscl(cam, 0);
|
w9966_i2c_setscl(cam, 0);
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
@ -673,11 +673,11 @@ static int w9966_rReg_i2c(struct w9966_dev* cam, int reg)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
w9966_i2c_setsda(cam, 0);
|
w9966_i2c_setsda(cam, 0);
|
||||||
|
|
||||||
if (w9966_i2c_setscl(cam, 1) == -1)
|
if (w9966_i2c_setscl(cam, 1) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
w9966_i2c_setsda(cam, 1);
|
w9966_i2c_setsda(cam, 1);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -699,7 +699,7 @@ static int w9966_wReg_i2c(struct w9966_dev* cam, int reg, int data)
|
|||||||
w9966_i2c_setsda(cam, 0);
|
w9966_i2c_setsda(cam, 0);
|
||||||
if (w9966_i2c_setscl(cam, 1) == -1)
|
if (w9966_i2c_setscl(cam, 1) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
w9966_i2c_setsda(cam, 1);
|
w9966_i2c_setsda(cam, 1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -714,7 +714,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
{
|
{
|
||||||
struct video_device *vdev = video_devdata(file);
|
struct video_device *vdev = video_devdata(file);
|
||||||
struct w9966_dev *cam = vdev->priv;
|
struct w9966_dev *cam = vdev->priv;
|
||||||
|
|
||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
case VIDIOCGCAP:
|
case VIDIOCGCAP:
|
||||||
@ -790,14 +790,14 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
struct video_picture *vpic = arg;
|
struct video_picture *vpic = arg;
|
||||||
if (vpic->depth != 16 || vpic->palette != VIDEO_PALETTE_YUV422)
|
if (vpic->depth != 16 || vpic->palette != VIDEO_PALETTE_YUV422)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
cam->brightness = vpic->brightness >> 8;
|
cam->brightness = vpic->brightness >> 8;
|
||||||
cam->hue = (vpic->hue >> 8) - 128;
|
cam->hue = (vpic->hue >> 8) - 128;
|
||||||
cam->color = vpic->colour >> 9;
|
cam->color = vpic->colour >> 9;
|
||||||
cam->contrast = vpic->contrast >> 9;
|
cam->contrast = vpic->contrast >> 9;
|
||||||
|
|
||||||
w9966_pdev_claim(cam);
|
w9966_pdev_claim(cam);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
w9966_wReg_i2c(cam, 0x0a, cam->brightness) == -1 ||
|
w9966_wReg_i2c(cam, 0x0a, cam->brightness) == -1 ||
|
||||||
w9966_wReg_i2c(cam, 0x0b, cam->contrast) == -1 ||
|
w9966_wReg_i2c(cam, 0x0b, cam->contrast) == -1 ||
|
||||||
@ -807,7 +807,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
w9966_pdev_release(cam);
|
w9966_pdev_release(cam);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
w9966_pdev_release(cam);
|
w9966_pdev_release(cam);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -815,13 +815,13 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct video_window *vwin = arg;
|
struct video_window *vwin = arg;
|
||||||
|
|
||||||
if (vwin->flags != 0)
|
if (vwin->flags != 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (vwin->clipcount != 0)
|
if (vwin->clipcount != 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (vwin->width < 2 || vwin->width > W9966_WND_MAX_W)
|
if (vwin->width < 2 || vwin->width > W9966_WND_MAX_W)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (vwin->height < 1 || vwin->height > W9966_WND_MAX_H)
|
if (vwin->height < 1 || vwin->height > W9966_WND_MAX_H)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@ -829,12 +829,12 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
w9966_pdev_claim(cam);
|
w9966_pdev_claim(cam);
|
||||||
ret = w9966_setup(cam, 0, 0, 1023, 1023, vwin->width, vwin->height);
|
ret = w9966_setup(cam, 0, 0, 1023, 1023, vwin->width, vwin->height);
|
||||||
w9966_pdev_release(cam);
|
w9966_pdev_release(cam);
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DPRINTF("VIDIOCSWIN: w9966_setup() failed.\n");
|
DPRINTF("VIDIOCSWIN: w9966_setup() failed.\n");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCGWIN:
|
case VIDIOCGWIN:
|
||||||
@ -846,7 +846,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// Unimplemented
|
// Unimplemented
|
||||||
case VIDIOCCAPTURE:
|
case VIDIOCCAPTURE:
|
||||||
case VIDIOCGFBUF:
|
case VIDIOCGFBUF:
|
||||||
case VIDIOCSFBUF:
|
case VIDIOCSFBUF:
|
||||||
case VIDIOCKEY:
|
case VIDIOCKEY:
|
||||||
@ -877,17 +877,17 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
|
|||||||
unsigned char __user *dest = (unsigned char __user *)buf;
|
unsigned char __user *dest = (unsigned char __user *)buf;
|
||||||
unsigned long dleft = count;
|
unsigned long dleft = count;
|
||||||
unsigned char *tbuf;
|
unsigned char *tbuf;
|
||||||
|
|
||||||
// Why would anyone want more than this??
|
// Why would anyone want more than this??
|
||||||
if (count > cam->width * cam->height * 2)
|
if (count > cam->width * cam->height * 2)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
w9966_pdev_claim(cam);
|
w9966_pdev_claim(cam);
|
||||||
w9966_wReg(cam, 0x00, 0x02); // Reset ECP-FIFO buffer
|
w9966_wReg(cam, 0x00, 0x02); // Reset ECP-FIFO buffer
|
||||||
w9966_wReg(cam, 0x00, 0x00); // Return to normal operation
|
w9966_wReg(cam, 0x00, 0x00); // Return to normal operation
|
||||||
w9966_wReg(cam, 0x01, 0x98); // Enable capture
|
w9966_wReg(cam, 0x01, 0x98); // Enable capture
|
||||||
|
|
||||||
// write special capture-addr and negotiate into data transfer
|
// write special capture-addr and negotiate into data transfer
|
||||||
if (
|
if (
|
||||||
(parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0 )||
|
(parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0 )||
|
||||||
(parport_write(cam->pport, &addr, 1) != 1 )||
|
(parport_write(cam->pport, &addr, 1) != 1 )||
|
||||||
@ -906,7 +906,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
|
|||||||
while(dleft > 0)
|
while(dleft > 0)
|
||||||
{
|
{
|
||||||
unsigned long tsize = (dleft > W9966_RBUFFER) ? W9966_RBUFFER : dleft;
|
unsigned long tsize = (dleft > W9966_RBUFFER) ? W9966_RBUFFER : dleft;
|
||||||
|
|
||||||
if (parport_read(cam->pport, tbuf, tsize) < tsize) {
|
if (parport_read(cam->pport, tbuf, tsize) < tsize) {
|
||||||
count = -EFAULT;
|
count = -EFAULT;
|
||||||
goto out;
|
goto out;
|
||||||
@ -933,7 +933,7 @@ out:
|
|||||||
static void w9966_attach(struct parport *port)
|
static void w9966_attach(struct parport *port)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < W9966_MAXCAMS; i++)
|
for (i = 0; i < W9966_MAXCAMS; i++)
|
||||||
{
|
{
|
||||||
if (w9966_cams[i].dev_state != 0) // Cam is already assigned
|
if (w9966_cams[i].dev_state != 0) // Cam is already assigned
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -61,7 +61,7 @@
|
|||||||
|
|
||||||
/* Maximum data payload sizes in bytes for alternate settings */
|
/* Maximum data payload sizes in bytes for alternate settings */
|
||||||
static const u16 wMaxPacketSize[] = {1023, 959, 895, 831, 767, 703, 639, 575,
|
static const u16 wMaxPacketSize[] = {1023, 959, 895, 831, 767, 703, 639, 575,
|
||||||
511, 447, 383, 319, 255, 191, 127, 63};
|
511, 447, 383, 319, 255, 191, 127, 63};
|
||||||
#define W9968CF_PACKET_SIZE 1023 /* according to wMaxPacketSizes[] */
|
#define W9968CF_PACKET_SIZE 1023 /* according to wMaxPacketSizes[] */
|
||||||
#define W9968CF_MIN_PACKET_SIZE 63 /* minimum value */
|
#define W9968CF_MIN_PACKET_SIZE 63 /* minimum value */
|
||||||
#define W9968CF_ISO_PACKETS 5 /* n.of packets for isochronous transfers */
|
#define W9968CF_ISO_PACKETS 5 /* n.of packets for isochronous transfers */
|
||||||
@ -134,7 +134,7 @@ static const struct w9968cf_format w9968cf_formatlist[] = {
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define W9968CF_MODULE_NAME "V4L driver for W996[87]CF JPEG USB " \
|
#define W9968CF_MODULE_NAME "V4L driver for W996[87]CF JPEG USB " \
|
||||||
"Dual Mode Camera Chip"
|
"Dual Mode Camera Chip"
|
||||||
#define W9968CF_MODULE_VERSION "1:1.33-basic"
|
#define W9968CF_MODULE_VERSION "1:1.33-basic"
|
||||||
#define W9968CF_MODULE_AUTHOR "(C) 2002-2004 Luca Risolia"
|
#define W9968CF_MODULE_AUTHOR "(C) 2002-2004 Luca Risolia"
|
||||||
#define W9968CF_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"
|
#define W9968CF_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"
|
||||||
@ -270,9 +270,9 @@ struct w9968cf_device {
|
|||||||
|
|
||||||
/* Locks */
|
/* Locks */
|
||||||
struct mutex dev_mutex, /* for probe, disconnect,open and close */
|
struct mutex dev_mutex, /* for probe, disconnect,open and close */
|
||||||
fileop_mutex; /* for read and ioctl */
|
fileop_mutex; /* for read and ioctl */
|
||||||
spinlock_t urb_lock, /* for submit_urb() and unlink_urb() */
|
spinlock_t urb_lock, /* for submit_urb() and unlink_urb() */
|
||||||
flist_lock; /* for requested frame list accesses */
|
flist_lock; /* for requested frame list accesses */
|
||||||
wait_queue_head_t open, wait_queue;
|
wait_queue_head_t open, wait_queue;
|
||||||
|
|
||||||
char command[16]; /* name of the program holding the device */
|
char command[16]; /* name of the program holding the device */
|
||||||
@ -299,7 +299,7 @@ struct w9968cf_device {
|
|||||||
dev_warn(&cam->dev, fmt "\n", ## args); \
|
dev_warn(&cam->dev, fmt "\n", ## args); \
|
||||||
else if ((level) >= 5) \
|
else if ((level) >= 5) \
|
||||||
dev_info(&cam->dev, "[%s:%d] " fmt "\n", \
|
dev_info(&cam->dev, "[%s:%d] " fmt "\n", \
|
||||||
__FUNCTION__, __LINE__ , ## args); \
|
__FUNCTION__, __LINE__ , ## args); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
/* For generic kernel (not device specific) messages */
|
/* For generic kernel (not device specific) messages */
|
||||||
@ -311,7 +311,7 @@ struct w9968cf_device {
|
|||||||
pr_info("w9968cf: " fmt "\n", ## args); \
|
pr_info("w9968cf: " fmt "\n", ## args); \
|
||||||
else if ((level) >= 5) \
|
else if ((level) >= 5) \
|
||||||
pr_debug("w9968cf: [%s:%d] " fmt "\n", __FUNCTION__, \
|
pr_debug("w9968cf: [%s:%d] " fmt "\n", __FUNCTION__, \
|
||||||
__LINE__ , ## args); \
|
__LINE__ , ## args); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -78,9 +78,9 @@ static const unsigned char UV_QUANTABLE[64] = {
|
|||||||
#define W9968CF_DEC_ERR_NO_EOI -6
|
#define W9968CF_DEC_ERR_NO_EOI -6
|
||||||
|
|
||||||
extern void w9968cf_init_decoder(void);
|
extern void w9968cf_init_decoder(void);
|
||||||
extern int w9968cf_check_headers(const unsigned char* Pin,
|
extern int w9968cf_check_headers(const unsigned char* Pin,
|
||||||
const unsigned long BUF_SIZE);
|
const unsigned long BUF_SIZE);
|
||||||
extern int w9968cf_decode(const char* Pin, const unsigned long BUF_SIZE,
|
extern int w9968cf_decode(const char* Pin, const unsigned long BUF_SIZE,
|
||||||
const unsigned W, const unsigned H, char* Pout);
|
const unsigned W, const unsigned H, char* Pout);
|
||||||
|
|
||||||
#endif /* _W9968CF_DECODER_H_ */
|
#endif /* _W9968CF_DECODER_H_ */
|
||||||
|
@ -29,7 +29,7 @@ struct w9968cf_vpp_t {
|
|||||||
struct module* owner;
|
struct module* owner;
|
||||||
int (*check_headers)(const unsigned char*, const unsigned long);
|
int (*check_headers)(const unsigned char*, const unsigned long);
|
||||||
int (*decode)(const char*, const unsigned long, const unsigned,
|
int (*decode)(const char*, const unsigned long, const unsigned,
|
||||||
const unsigned, char*);
|
const unsigned, char*);
|
||||||
void (*swap_yuvbytes)(void*, unsigned long);
|
void (*swap_yuvbytes)(void*, unsigned long);
|
||||||
void (*uyvy_to_rgbx)(u8*, unsigned long, u8*, u16, u8);
|
void (*uyvy_to_rgbx)(u8*, unsigned long, u8*, u16, u8);
|
||||||
void (*scale_up)(u8*, u8*, u16, u16, u16, u16, u16);
|
void (*scale_up)(u8*, u8*, u16, u16, u16, u16, u16);
|
||||||
|
@ -157,7 +157,7 @@ do { \
|
|||||||
dev_info(&cam->usbdev->dev, fmt "\n", ## args); \
|
dev_info(&cam->usbdev->dev, fmt "\n", ## args); \
|
||||||
else if ((level) >= 3) \
|
else if ((level) >= 3) \
|
||||||
dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
|
dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
|
||||||
__FUNCTION__, __LINE__ , ## args); \
|
__FUNCTION__, __LINE__ , ## args); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
# define KDBG(level, fmt, args...) \
|
# define KDBG(level, fmt, args...) \
|
||||||
@ -167,7 +167,7 @@ do { \
|
|||||||
pr_info("zc0301: " fmt "\n", ## args); \
|
pr_info("zc0301: " fmt "\n", ## args); \
|
||||||
else if ((level) == 3) \
|
else if ((level) == 3) \
|
||||||
pr_debug("zc0301: [%s:%d] " fmt "\n", __FUNCTION__, \
|
pr_debug("zc0301: [%s:%d] " fmt "\n", __FUNCTION__, \
|
||||||
__LINE__ , ## args); \
|
__LINE__ , ## args); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
# define V4LDBG(level, name, cmd) \
|
# define V4LDBG(level, name, cmd) \
|
||||||
@ -184,7 +184,7 @@ do { \
|
|||||||
#undef PDBG
|
#undef PDBG
|
||||||
#define PDBG(fmt, args...) \
|
#define PDBG(fmt, args...) \
|
||||||
dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
|
dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
|
||||||
__FUNCTION__, __LINE__ , ## args)
|
__FUNCTION__, __LINE__ , ## args)
|
||||||
|
|
||||||
#undef PDBGG
|
#undef PDBGG
|
||||||
#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */
|
#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define ZC0301_MODULE_NAME "V4L2 driver for ZC0301 " \
|
#define ZC0301_MODULE_NAME "V4L2 driver for ZC0301 " \
|
||||||
"Image Processor and Control Chip"
|
"Image Processor and Control Chip"
|
||||||
#define ZC0301_MODULE_AUTHOR "(C) 2006 Luca Risolia"
|
#define ZC0301_MODULE_AUTHOR "(C) 2006 Luca Risolia"
|
||||||
#define ZC0301_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"
|
#define ZC0301_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"
|
||||||
#define ZC0301_MODULE_LICENSE "GPL"
|
#define ZC0301_MODULE_LICENSE "GPL"
|
||||||
@ -67,67 +67,67 @@ MODULE_LICENSE(ZC0301_MODULE_LICENSE);
|
|||||||
static short video_nr[] = {[0 ... ZC0301_MAX_DEVICES-1] = -1};
|
static short video_nr[] = {[0 ... ZC0301_MAX_DEVICES-1] = -1};
|
||||||
module_param_array(video_nr, short, NULL, 0444);
|
module_param_array(video_nr, short, NULL, 0444);
|
||||||
MODULE_PARM_DESC(video_nr,
|
MODULE_PARM_DESC(video_nr,
|
||||||
"\n<-1|n[,...]> Specify V4L2 minor mode number."
|
"\n<-1|n[,...]> Specify V4L2 minor mode number."
|
||||||
"\n -1 = use next available (default)"
|
"\n -1 = use next available (default)"
|
||||||
"\n n = use minor number n (integer >= 0)"
|
"\n n = use minor number n (integer >= 0)"
|
||||||
"\nYou can specify up to "
|
"\nYou can specify up to "
|
||||||
__MODULE_STRING(ZC0301_MAX_DEVICES) " cameras this way."
|
__MODULE_STRING(ZC0301_MAX_DEVICES) " cameras this way."
|
||||||
"\nFor example:"
|
"\nFor example:"
|
||||||
"\nvideo_nr=-1,2,-1 would assign minor number 2 to"
|
"\nvideo_nr=-1,2,-1 would assign minor number 2 to"
|
||||||
"\nthe second registered camera and use auto for the first"
|
"\nthe second registered camera and use auto for the first"
|
||||||
"\none and for every other camera."
|
"\none and for every other camera."
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
static short force_munmap[] = {[0 ... ZC0301_MAX_DEVICES-1] =
|
static short force_munmap[] = {[0 ... ZC0301_MAX_DEVICES-1] =
|
||||||
ZC0301_FORCE_MUNMAP};
|
ZC0301_FORCE_MUNMAP};
|
||||||
module_param_array(force_munmap, bool, NULL, 0444);
|
module_param_array(force_munmap, bool, NULL, 0444);
|
||||||
MODULE_PARM_DESC(force_munmap,
|
MODULE_PARM_DESC(force_munmap,
|
||||||
"\n<0|1[,...]> Force the application to unmap previously"
|
"\n<0|1[,...]> Force the application to unmap previously"
|
||||||
"\nmapped buffer memory before calling any VIDIOC_S_CROP or"
|
"\nmapped buffer memory before calling any VIDIOC_S_CROP or"
|
||||||
"\nVIDIOC_S_FMT ioctl's. Not all the applications support"
|
"\nVIDIOC_S_FMT ioctl's. Not all the applications support"
|
||||||
"\nthis feature. This parameter is specific for each"
|
"\nthis feature. This parameter is specific for each"
|
||||||
"\ndetected camera."
|
"\ndetected camera."
|
||||||
"\n 0 = do not force memory unmapping"
|
"\n 0 = do not force memory unmapping"
|
||||||
"\n 1 = force memory unmapping (save memory)"
|
"\n 1 = force memory unmapping (save memory)"
|
||||||
"\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"."
|
"\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"."
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
static unsigned int frame_timeout[] = {[0 ... ZC0301_MAX_DEVICES-1] =
|
static unsigned int frame_timeout[] = {[0 ... ZC0301_MAX_DEVICES-1] =
|
||||||
ZC0301_FRAME_TIMEOUT};
|
ZC0301_FRAME_TIMEOUT};
|
||||||
module_param_array(frame_timeout, uint, NULL, 0644);
|
module_param_array(frame_timeout, uint, NULL, 0644);
|
||||||
MODULE_PARM_DESC(frame_timeout,
|
MODULE_PARM_DESC(frame_timeout,
|
||||||
"\n<n[,...]> Timeout for a video frame in seconds."
|
"\n<n[,...]> Timeout for a video frame in seconds."
|
||||||
"\nThis parameter is specific for each detected camera."
|
"\nThis parameter is specific for each detected camera."
|
||||||
"\nDefault value is "__MODULE_STRING(ZC0301_FRAME_TIMEOUT)"."
|
"\nDefault value is "__MODULE_STRING(ZC0301_FRAME_TIMEOUT)"."
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#ifdef ZC0301_DEBUG
|
#ifdef ZC0301_DEBUG
|
||||||
static unsigned short debug = ZC0301_DEBUG_LEVEL;
|
static unsigned short debug = ZC0301_DEBUG_LEVEL;
|
||||||
module_param(debug, ushort, 0644);
|
module_param(debug, ushort, 0644);
|
||||||
MODULE_PARM_DESC(debug,
|
MODULE_PARM_DESC(debug,
|
||||||
"\n<n> Debugging information level, from 0 to 3:"
|
"\n<n> Debugging information level, from 0 to 3:"
|
||||||
"\n0 = none (use carefully)"
|
"\n0 = none (use carefully)"
|
||||||
"\n1 = critical errors"
|
"\n1 = critical errors"
|
||||||
"\n2 = significant informations"
|
"\n2 = significant informations"
|
||||||
"\n3 = more verbose messages"
|
"\n3 = more verbose messages"
|
||||||
"\nLevel 3 is useful for testing only, when only "
|
"\nLevel 3 is useful for testing only, when only "
|
||||||
"one device is used."
|
"one device is used."
|
||||||
"\nDefault value is "__MODULE_STRING(ZC0301_DEBUG_LEVEL)"."
|
"\nDefault value is "__MODULE_STRING(ZC0301_DEBUG_LEVEL)"."
|
||||||
"\n");
|
"\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static u32
|
static u32
|
||||||
zc0301_request_buffers(struct zc0301_device* cam, u32 count,
|
zc0301_request_buffers(struct zc0301_device* cam, u32 count,
|
||||||
enum zc0301_io_method io)
|
enum zc0301_io_method io)
|
||||||
{
|
{
|
||||||
struct v4l2_pix_format* p = &(cam->sensor.pix_format);
|
struct v4l2_pix_format* p = &(cam->sensor.pix_format);
|
||||||
struct v4l2_rect* r = &(cam->sensor.cropcap.bounds);
|
struct v4l2_rect* r = &(cam->sensor.cropcap.bounds);
|
||||||
const size_t imagesize = cam->module_param.force_munmap ||
|
const size_t imagesize = cam->module_param.force_munmap ||
|
||||||
io == IO_READ ?
|
io == IO_READ ?
|
||||||
(p->width * p->height * p->priv) / 8 :
|
(p->width * p->height * p->priv) / 8 :
|
||||||
(r->width * r->height * p->priv) / 8;
|
(r->width * r->height * p->priv) / 8;
|
||||||
void* buff = NULL;
|
void* buff = NULL;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ int zc0301_write_reg(struct zc0301_device* cam, u16 index, u16 value)
|
|||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0xa0, 0x40,
|
res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0xa0, 0x40,
|
||||||
value, index, NULL, 0, ZC0301_CTRL_TIMEOUT);
|
value, index, NULL, 0, ZC0301_CTRL_TIMEOUT);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
DBG(3, "Failed to write a register (index 0x%04X, "
|
DBG(3, "Failed to write a register (index 0x%04X, "
|
||||||
"value 0x%02X, error %d)",index, value, res);
|
"value 0x%02X, error %d)",index, value, res);
|
||||||
@ -234,7 +234,7 @@ int zc0301_read_reg(struct zc0301_device* cam, u16 index)
|
|||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0xa1, 0xc0,
|
res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0xa1, 0xc0,
|
||||||
0x0001, index, buff, 1, ZC0301_CTRL_TIMEOUT);
|
0x0001, index, buff, 1, ZC0301_CTRL_TIMEOUT);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
DBG(3, "Failed to read a register (index 0x%04X, error %d)",
|
DBG(3, "Failed to read a register (index 0x%04X, error %d)",
|
||||||
index, res);
|
index, res);
|
||||||
@ -337,11 +337,11 @@ static void zc0301_urb_complete(struct urb *urb, struct pt_regs* regs)
|
|||||||
|
|
||||||
if (!(*f))
|
if (!(*f))
|
||||||
(*f) = list_entry(cam->inqueue.next, struct zc0301_frame_t,
|
(*f) = list_entry(cam->inqueue.next, struct zc0301_frame_t,
|
||||||
frame);
|
frame);
|
||||||
|
|
||||||
imagesize = (cam->sensor.pix_format.width *
|
imagesize = (cam->sensor.pix_format.width *
|
||||||
cam->sensor.pix_format.height *
|
cam->sensor.pix_format.height *
|
||||||
cam->sensor.pix_format.priv) / 8;
|
cam->sensor.pix_format.priv) / 8;
|
||||||
|
|
||||||
for (i = 0; i < urb->number_of_packets; i++) {
|
for (i = 0; i < urb->number_of_packets; i++) {
|
||||||
unsigned int len, status;
|
unsigned int len, status;
|
||||||
@ -395,8 +395,8 @@ end_of_frame:
|
|||||||
list_move_tail(&(*f)->frame, &cam->outqueue);
|
list_move_tail(&(*f)->frame, &cam->outqueue);
|
||||||
if (!list_empty(&cam->inqueue))
|
if (!list_empty(&cam->inqueue))
|
||||||
(*f) = list_entry(cam->inqueue.next,
|
(*f) = list_entry(cam->inqueue.next,
|
||||||
struct zc0301_frame_t,
|
struct zc0301_frame_t,
|
||||||
frame);
|
frame);
|
||||||
else
|
else
|
||||||
(*f) = NULL;
|
(*f) = NULL;
|
||||||
spin_unlock(&cam->queue_lock);
|
spin_unlock(&cam->queue_lock);
|
||||||
@ -429,14 +429,14 @@ static int zc0301_start_transfer(struct zc0301_device* cam)
|
|||||||
struct usb_device *udev = cam->usbdev;
|
struct usb_device *udev = cam->usbdev;
|
||||||
struct urb* urb;
|
struct urb* urb;
|
||||||
const unsigned int wMaxPacketSize[] = {0, 128, 192, 256, 384,
|
const unsigned int wMaxPacketSize[] = {0, 128, 192, 256, 384,
|
||||||
512, 768, 1023};
|
512, 768, 1023};
|
||||||
const unsigned int psz = wMaxPacketSize[ZC0301_ALTERNATE_SETTING];
|
const unsigned int psz = wMaxPacketSize[ZC0301_ALTERNATE_SETTING];
|
||||||
s8 i, j;
|
s8 i, j;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
for (i = 0; i < ZC0301_URBS; i++) {
|
for (i = 0; i < ZC0301_URBS; i++) {
|
||||||
cam->transfer_buffer[i] = kzalloc(ZC0301_ISO_PACKETS * psz,
|
cam->transfer_buffer[i] = kzalloc(ZC0301_ISO_PACKETS * psz,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!cam->transfer_buffer[i]) {
|
if (!cam->transfer_buffer[i]) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
DBG(1, "Not enough memory");
|
DBG(1, "Not enough memory");
|
||||||
@ -528,9 +528,9 @@ static int zc0301_stream_interrupt(struct zc0301_device* cam)
|
|||||||
|
|
||||||
cam->stream = STREAM_INTERRUPT;
|
cam->stream = STREAM_INTERRUPT;
|
||||||
timeout = wait_event_timeout(cam->wait_stream,
|
timeout = wait_event_timeout(cam->wait_stream,
|
||||||
(cam->stream == STREAM_OFF) ||
|
(cam->stream == STREAM_OFF) ||
|
||||||
(cam->state & DEV_DISCONNECTED),
|
(cam->state & DEV_DISCONNECTED),
|
||||||
ZC0301_URB_TIMEOUT);
|
ZC0301_URB_TIMEOUT);
|
||||||
if (cam->state & DEV_DISCONNECTED)
|
if (cam->state & DEV_DISCONNECTED)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
else if (cam->stream != STREAM_OFF) {
|
else if (cam->stream != STREAM_OFF) {
|
||||||
@ -548,7 +548,7 @@ static int zc0301_stream_interrupt(struct zc0301_device* cam)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
zc0301_set_compression(struct zc0301_device* cam,
|
zc0301_set_compression(struct zc0301_device* cam,
|
||||||
struct v4l2_jpegcompression* compression)
|
struct v4l2_jpegcompression* compression)
|
||||||
{
|
{
|
||||||
int r, err = 0;
|
int r, err = 0;
|
||||||
|
|
||||||
@ -670,8 +670,8 @@ static int zc0301_open(struct inode* inode, struct file* filp)
|
|||||||
}
|
}
|
||||||
mutex_unlock(&cam->dev_mutex);
|
mutex_unlock(&cam->dev_mutex);
|
||||||
err = wait_event_interruptible_exclusive(cam->open,
|
err = wait_event_interruptible_exclusive(cam->open,
|
||||||
cam->state & DEV_DISCONNECTED
|
cam->state & DEV_DISCONNECTED
|
||||||
|| !cam->users);
|
|| !cam->users);
|
||||||
if (err) {
|
if (err) {
|
||||||
up_read(&zc0301_disconnect);
|
up_read(&zc0301_disconnect);
|
||||||
return err;
|
return err;
|
||||||
@ -802,12 +802,12 @@ zc0301_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos)
|
|||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
timeout = wait_event_interruptible_timeout
|
timeout = wait_event_interruptible_timeout
|
||||||
( cam->wait_frame,
|
( cam->wait_frame,
|
||||||
(!list_empty(&cam->outqueue)) ||
|
(!list_empty(&cam->outqueue)) ||
|
||||||
(cam->state & DEV_DISCONNECTED) ||
|
(cam->state & DEV_DISCONNECTED) ||
|
||||||
(cam->state & DEV_MISCONFIGURED),
|
(cam->state & DEV_MISCONFIGURED),
|
||||||
cam->module_param.frame_timeout *
|
cam->module_param.frame_timeout *
|
||||||
1000 * msecs_to_jiffies(1) );
|
1000 * msecs_to_jiffies(1) );
|
||||||
if (timeout < 0) {
|
if (timeout < 0) {
|
||||||
mutex_unlock(&cam->fileop_mutex);
|
mutex_unlock(&cam->fileop_mutex);
|
||||||
return timeout;
|
return timeout;
|
||||||
@ -930,7 +930,7 @@ static int zc0301_mmap(struct file* filp, struct vm_area_struct *vma)
|
|||||||
{
|
{
|
||||||
struct zc0301_device* cam = video_get_drvdata(video_devdata(filp));
|
struct zc0301_device* cam = video_get_drvdata(video_devdata(filp));
|
||||||
unsigned long size = vma->vm_end - vma->vm_start,
|
unsigned long size = vma->vm_end - vma->vm_start,
|
||||||
start = vma->vm_start;
|
start = vma->vm_start;
|
||||||
void *pos;
|
void *pos;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
@ -998,13 +998,13 @@ zc0301_vidioc_querycap(struct zc0301_device* cam, void __user * arg)
|
|||||||
.driver = "zc0301",
|
.driver = "zc0301",
|
||||||
.version = ZC0301_MODULE_VERSION_CODE,
|
.version = ZC0301_MODULE_VERSION_CODE,
|
||||||
.capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
|
.capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
|
||||||
V4L2_CAP_STREAMING,
|
V4L2_CAP_STREAMING,
|
||||||
};
|
};
|
||||||
|
|
||||||
strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card));
|
strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card));
|
||||||
if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0)
|
if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0)
|
||||||
strlcpy(cap.bus_info, cam->usbdev->dev.bus_id,
|
strlcpy(cap.bus_info, cam->usbdev->dev.bus_id,
|
||||||
sizeof(cap.bus_info));
|
sizeof(cap.bus_info));
|
||||||
|
|
||||||
if (copy_to_user(arg, &cap, sizeof(cap)))
|
if (copy_to_user(arg, &cap, sizeof(cap)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
@ -1337,7 +1337,7 @@ zc0301_vidioc_g_fmt(struct zc0301_device* cam, void __user * arg)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
zc0301_vidioc_try_s_fmt(struct zc0301_device* cam, unsigned int cmd,
|
zc0301_vidioc_try_s_fmt(struct zc0301_device* cam, unsigned int cmd,
|
||||||
void __user * arg)
|
void __user * arg)
|
||||||
{
|
{
|
||||||
struct zc0301_sensor* s = &cam->sensor;
|
struct zc0301_sensor* s = &cam->sensor;
|
||||||
struct v4l2_format format;
|
struct v4l2_format format;
|
||||||
@ -1600,7 +1600,7 @@ zc0301_vidioc_qbuf(struct zc0301_device* cam, void __user * arg)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
zc0301_vidioc_dqbuf(struct zc0301_device* cam, struct file* filp,
|
zc0301_vidioc_dqbuf(struct zc0301_device* cam, struct file* filp,
|
||||||
void __user * arg)
|
void __user * arg)
|
||||||
{
|
{
|
||||||
struct v4l2_buffer b;
|
struct v4l2_buffer b;
|
||||||
struct zc0301_frame_t *f;
|
struct zc0301_frame_t *f;
|
||||||
@ -1619,12 +1619,12 @@ zc0301_vidioc_dqbuf(struct zc0301_device* cam, struct file* filp,
|
|||||||
if (filp->f_flags & O_NONBLOCK)
|
if (filp->f_flags & O_NONBLOCK)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
timeout = wait_event_interruptible_timeout
|
timeout = wait_event_interruptible_timeout
|
||||||
( cam->wait_frame,
|
( cam->wait_frame,
|
||||||
(!list_empty(&cam->outqueue)) ||
|
(!list_empty(&cam->outqueue)) ||
|
||||||
(cam->state & DEV_DISCONNECTED) ||
|
(cam->state & DEV_DISCONNECTED) ||
|
||||||
(cam->state & DEV_MISCONFIGURED),
|
(cam->state & DEV_MISCONFIGURED),
|
||||||
cam->module_param.frame_timeout *
|
cam->module_param.frame_timeout *
|
||||||
1000 * msecs_to_jiffies(1) );
|
1000 * msecs_to_jiffies(1) );
|
||||||
if (timeout < 0)
|
if (timeout < 0)
|
||||||
return timeout;
|
return timeout;
|
||||||
if (cam->state & DEV_DISCONNECTED)
|
if (cam->state & DEV_DISCONNECTED)
|
||||||
@ -1748,7 +1748,7 @@ zc0301_vidioc_s_parm(struct zc0301_device* cam, void __user * arg)
|
|||||||
|
|
||||||
|
|
||||||
static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp,
|
static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp,
|
||||||
unsigned int cmd, void __user * arg)
|
unsigned int cmd, void __user * arg)
|
||||||
{
|
{
|
||||||
struct zc0301_device* cam = video_get_drvdata(video_devdata(filp));
|
struct zc0301_device* cam = video_get_drvdata(video_devdata(filp));
|
||||||
|
|
||||||
@ -1842,7 +1842,7 @@ static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp,
|
|||||||
|
|
||||||
|
|
||||||
static int zc0301_ioctl(struct inode* inode, struct file* filp,
|
static int zc0301_ioctl(struct inode* inode, struct file* filp,
|
||||||
unsigned int cmd, unsigned long arg)
|
unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
struct zc0301_device* cam = video_get_drvdata(video_devdata(filp));
|
struct zc0301_device* cam = video_get_drvdata(video_devdata(filp));
|
||||||
int err = 0;
|
int err = 0;
|
||||||
@ -1948,7 +1948,7 @@ zc0301_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
|
|||||||
mutex_lock(&cam->dev_mutex);
|
mutex_lock(&cam->dev_mutex);
|
||||||
|
|
||||||
err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER,
|
err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER,
|
||||||
video_nr[dev_nr]);
|
video_nr[dev_nr]);
|
||||||
if (err) {
|
if (err) {
|
||||||
DBG(1, "V4L2 device registration failed");
|
DBG(1, "V4L2 device registration failed");
|
||||||
if (err == -ENFILE && video_nr[dev_nr] == -1)
|
if (err == -ENFILE && video_nr[dev_nr] == -1)
|
||||||
|
@ -24,10 +24,10 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
NOTE: Sensor controls are disabled for now, becouse changing them while
|
NOTE: Sensor controls are disabled for now, becouse changing them while
|
||||||
streaming sometimes results in out-of-sync video frames. We'll use
|
streaming sometimes results in out-of-sync video frames. We'll use
|
||||||
the default initialization, until we know how to stop and start video
|
the default initialization, until we know how to stop and start video
|
||||||
in the chip. However, the image quality still looks good under various
|
in the chip. However, the image quality still looks good under various
|
||||||
light conditions.
|
light conditions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
@ -165,7 +165,7 @@ static int pas202bcb_init(struct zc0301_device* cam)
|
|||||||
|
|
||||||
|
|
||||||
static int pas202bcb_get_ctrl(struct zc0301_device* cam,
|
static int pas202bcb_get_ctrl(struct zc0301_device* cam,
|
||||||
struct v4l2_control* ctrl)
|
struct v4l2_control* ctrl)
|
||||||
{
|
{
|
||||||
switch (ctrl->id) {
|
switch (ctrl->id) {
|
||||||
case V4L2_CID_EXPOSURE:
|
case V4L2_CID_EXPOSURE:
|
||||||
@ -208,7 +208,7 @@ static int pas202bcb_get_ctrl(struct zc0301_device* cam,
|
|||||||
|
|
||||||
|
|
||||||
static int pas202bcb_set_ctrl(struct zc0301_device* cam,
|
static int pas202bcb_set_ctrl(struct zc0301_device* cam,
|
||||||
const struct v4l2_control* ctrl)
|
const struct v4l2_control* ctrl)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ zc0301_attach_sensor(struct zc0301_device* cam, struct zc0301_sensor* sensor);
|
|||||||
|
|
||||||
#define ZC0301_USB_DEVICE(vend, prod, intclass) \
|
#define ZC0301_USB_DEVICE(vend, prod, intclass) \
|
||||||
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
|
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
|
||||||
USB_DEVICE_ID_MATCH_INT_CLASS, \
|
USB_DEVICE_ID_MATCH_INT_CLASS, \
|
||||||
.idVendor = (vend), \
|
.idVendor = (vend), \
|
||||||
.idProduct = (prod), \
|
.idProduct = (prod), \
|
||||||
.bInterfaceClass = (intclass)
|
.bInterfaceClass = (intclass)
|
||||||
@ -92,7 +92,7 @@ struct zc0301_sensor {
|
|||||||
int (*init)(struct zc0301_device*);
|
int (*init)(struct zc0301_device*);
|
||||||
int (*get_ctrl)(struct zc0301_device*, struct v4l2_control* ctrl);
|
int (*get_ctrl)(struct zc0301_device*, struct v4l2_control* ctrl);
|
||||||
int (*set_ctrl)(struct zc0301_device*,
|
int (*set_ctrl)(struct zc0301_device*,
|
||||||
const struct v4l2_control* ctrl);
|
const struct v4l2_control* ctrl);
|
||||||
int (*set_crop)(struct zc0301_device*, const struct v4l2_rect* rect);
|
int (*set_crop)(struct zc0301_device*, const struct v4l2_rect* rect);
|
||||||
|
|
||||||
/* Private */
|
/* Private */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* zoran - Iomega Buz driver
|
* zoran - Iomega Buz driver
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Rainer Johanni <Rainer@Johanni.de>
|
* Copyright (C) 1999 Rainer Johanni <Rainer@Johanni.de>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Media Labs LML33/LML33R10.
|
* Media Labs LML33/LML33R10.
|
||||||
*
|
*
|
||||||
* This part handles card-specific data and detection
|
* This part handles card-specific data and detection
|
||||||
*
|
*
|
||||||
* Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
|
* Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
|
||||||
*
|
*
|
||||||
* Currently maintained by:
|
* Currently maintained by:
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Media Labs LML33/LML33R10.
|
* Media Labs LML33/LML33R10.
|
||||||
*
|
*
|
||||||
* This part handles card-specific data and detection
|
* This part handles card-specific data and detection
|
||||||
*
|
*
|
||||||
* Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
|
* Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
|
||||||
*
|
*
|
||||||
* Currently maintained by:
|
* Currently maintained by:
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Media Labs LML33/LML33R10.
|
* Media Labs LML33/LML33R10.
|
||||||
*
|
*
|
||||||
* This part handles device access (PCI/I2C/codec/...)
|
* This part handles device access (PCI/I2C/codec/...)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
|
* Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
|
||||||
*
|
*
|
||||||
* Currently maintained by:
|
* Currently maintained by:
|
||||||
@ -492,7 +492,7 @@ zr36057_set_vfe (struct zoran *zr,
|
|||||||
/* (Ronald) don't write this if overlay_mask = NULL */
|
/* (Ronald) don't write this if overlay_mask = NULL */
|
||||||
if (zr->overlay_mask) {
|
if (zr->overlay_mask) {
|
||||||
/* Write overlay clipping mask data, but don't enable overlay clipping */
|
/* Write overlay clipping mask data, but don't enable overlay clipping */
|
||||||
/* RJ: since this makes only sense on the screen, we use
|
/* RJ: since this makes only sense on the screen, we use
|
||||||
* zr->overlay_settings.width instead of video_width */
|
* zr->overlay_settings.width instead of video_width */
|
||||||
|
|
||||||
mask_line_size = (BUZ_MAX_WIDTH + 31) / 32;
|
mask_line_size = (BUZ_MAX_WIDTH + 31) / 32;
|
||||||
@ -819,12 +819,12 @@ zr36057_set_jpg (struct zoran *zr,
|
|||||||
if (zr->card.vfe_pol.hsync_pol)
|
if (zr->card.vfe_pol.hsync_pol)
|
||||||
btor(ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR);
|
btor(ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR);
|
||||||
else
|
else
|
||||||
btand(~ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR);
|
btand(~ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR);
|
||||||
reg = ((tvn->HSyncStart) << ZR36057_HSP_HsyncStart) |
|
reg = ((tvn->HSyncStart) << ZR36057_HSP_HsyncStart) |
|
||||||
(tvn->Wt << ZR36057_HSP_LineTot);
|
(tvn->Wt << ZR36057_HSP_LineTot);
|
||||||
btwrite(reg, ZR36057_HSP);
|
btwrite(reg, ZR36057_HSP);
|
||||||
reg = ((zr->jpg_settings.img_x +
|
reg = ((zr->jpg_settings.img_x +
|
||||||
tvn->HStart + 4) << ZR36057_FHAP_NAX) |
|
tvn->HStart + 4) << ZR36057_FHAP_NAX) |
|
||||||
(zr->jpg_settings.img_width << ZR36057_FHAP_PAX);
|
(zr->jpg_settings.img_width << ZR36057_FHAP_PAX);
|
||||||
btwrite(reg, ZR36057_FHAP);
|
btwrite(reg, ZR36057_FHAP);
|
||||||
|
|
||||||
@ -1272,15 +1272,15 @@ error_handler (struct zoran *zr,
|
|||||||
if (zr->JPEG_error != 1) {
|
if (zr->JPEG_error != 1) {
|
||||||
/*
|
/*
|
||||||
* First entry: error just happened during normal operation
|
* First entry: error just happened during normal operation
|
||||||
*
|
*
|
||||||
* In BUZ_MODE_MOTION_COMPRESS:
|
* In BUZ_MODE_MOTION_COMPRESS:
|
||||||
*
|
*
|
||||||
* Possible glitch in TV signal. In this case we should
|
* Possible glitch in TV signal. In this case we should
|
||||||
* stop the codec and wait for good quality signal before
|
* stop the codec and wait for good quality signal before
|
||||||
* restarting it to avoid further problems
|
* restarting it to avoid further problems
|
||||||
*
|
*
|
||||||
* In BUZ_MODE_MOTION_DECOMPRESS:
|
* In BUZ_MODE_MOTION_DECOMPRESS:
|
||||||
*
|
*
|
||||||
* Bad JPEG frame: we have to mark it as processed (codec crashed
|
* Bad JPEG frame: we have to mark it as processed (codec crashed
|
||||||
* and was not able to do it itself), and to remove it from queue.
|
* and was not able to do it itself), and to remove it from queue.
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Media Labs LML33/LML33R10.
|
* Media Labs LML33/LML33R10.
|
||||||
*
|
*
|
||||||
* This part handles card-specific data and detection
|
* This part handles card-specific data and detection
|
||||||
*
|
*
|
||||||
* Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
|
* Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
|
||||||
*
|
*
|
||||||
* Currently maintained by:
|
* Currently maintained by:
|
||||||
|
@ -94,7 +94,7 @@
|
|||||||
V4L2_CAP_VIDEO_CAPTURE |\
|
V4L2_CAP_VIDEO_CAPTURE |\
|
||||||
V4L2_CAP_VIDEO_OUTPUT |\
|
V4L2_CAP_VIDEO_OUTPUT |\
|
||||||
V4L2_CAP_VIDEO_OVERLAY \
|
V4L2_CAP_VIDEO_OVERLAY \
|
||||||
)
|
)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <asm/byteorder.h>
|
#include <asm/byteorder.h>
|
||||||
@ -165,7 +165,7 @@ const struct zoran_format zoran_formats[] = {
|
|||||||
#endif
|
#endif
|
||||||
.depth = 16,
|
.depth = 16,
|
||||||
.flags = ZORAN_FORMAT_CAPTURE |
|
.flags = ZORAN_FORMAT_CAPTURE |
|
||||||
ZORAN_FORMAT_OVERLAY,
|
ZORAN_FORMAT_OVERLAY,
|
||||||
}, {
|
}, {
|
||||||
.name = "Hardware-encoded Motion-JPEG",
|
.name = "Hardware-encoded Motion-JPEG",
|
||||||
.palette = -1,
|
.palette = -1,
|
||||||
@ -670,7 +670,7 @@ jpg_fbuffer_free (struct file *file)
|
|||||||
j]))));
|
j]))));
|
||||||
free_page((unsigned long)
|
free_page((unsigned long)
|
||||||
bus_to_virt
|
bus_to_virt
|
||||||
(le32_to_cpu
|
(le32_to_cpu
|
||||||
(fh->jpg_buffers.
|
(fh->jpg_buffers.
|
||||||
buffer[i].
|
buffer[i].
|
||||||
frag_tab[2 * j])));
|
frag_tab[2 * j])));
|
||||||
@ -1871,7 +1871,7 @@ zoran_v4l2_buffer_status (struct file *file,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
zoran_set_norm (struct zoran *zr,
|
zoran_set_norm (struct zoran *zr,
|
||||||
int norm) /* VIDEO_MODE_* */
|
int norm) /* VIDEO_MODE_* */
|
||||||
{
|
{
|
||||||
int norm_encoder, on;
|
int norm_encoder, on;
|
||||||
|
|
||||||
@ -2006,9 +2006,9 @@ zoran_set_input (struct zoran *zr,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
zoran_do_ioctl (struct inode *inode,
|
zoran_do_ioctl (struct inode *inode,
|
||||||
struct file *file,
|
struct file *file,
|
||||||
unsigned int cmd,
|
unsigned int cmd,
|
||||||
void *arg)
|
void *arg)
|
||||||
{
|
{
|
||||||
struct zoran_fh *fh = file->private_data;
|
struct zoran_fh *fh = file->private_data;
|
||||||
struct zoran *zr = fh->zr;
|
struct zoran *zr = fh->zr;
|
||||||
@ -2095,7 +2095,7 @@ zoran_do_ioctl (struct inode *inode,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
/* RJ: the documentation at http://roadrunner.swansea.linux.org.uk/v4lapi.shtml says:
|
/* RJ: the documentation at http://roadrunner.swansea.linux.org.uk/v4lapi.shtml says:
|
||||||
*
|
*
|
||||||
* * "The VIDIOCSCHAN ioctl takes an integer argument and switches the capture to this input."
|
* * "The VIDIOCSCHAN ioctl takes an integer argument and switches the capture to this input."
|
||||||
* * ^^^^^^^
|
* * ^^^^^^^
|
||||||
* * The famos BTTV driver has it implemented with a struct video_channel argument
|
* * The famos BTTV driver has it implemented with a struct video_channel argument
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Media Labs LML33/LML33R10.
|
* Media Labs LML33/LML33R10.
|
||||||
*
|
*
|
||||||
* This part handles the procFS entries (/proc/ZORAN[%d])
|
* This part handles the procFS entries (/proc/ZORAN[%d])
|
||||||
*
|
*
|
||||||
* Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
|
* Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
|
||||||
*
|
*
|
||||||
* Currently maintained by:
|
* Currently maintained by:
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Media Labs LML33/LML33R10.
|
* Media Labs LML33/LML33R10.
|
||||||
*
|
*
|
||||||
* This part handles card-specific data and detection
|
* This part handles card-specific data and detection
|
||||||
*
|
*
|
||||||
* Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
|
* Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
|
||||||
*
|
*
|
||||||
* Currently maintained by:
|
* Currently maintained by:
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/wait.h>
|
#include <linux/wait.h>
|
||||||
|
|
||||||
/* includes for structures and defines regarding video
|
/* includes for structures and defines regarding video
|
||||||
#include<linux/videodev.h> */
|
#include<linux/videodev.h> */
|
||||||
|
|
||||||
/* I/O commands, error codes */
|
/* I/O commands, error codes */
|
||||||
@ -143,8 +143,8 @@ zr36016_readi (struct zr36016 *ptr,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
zr36016_writei (struct zr36016 *ptr,
|
zr36016_writei (struct zr36016 *ptr,
|
||||||
u16 reg,
|
u16 reg,
|
||||||
u8 value)
|
u8 value)
|
||||||
{
|
{
|
||||||
dprintk(4, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name,
|
dprintk(4, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name,
|
||||||
value, reg);
|
value, reg);
|
||||||
@ -192,7 +192,7 @@ zr36016_basic_test (struct zr36016 *ptr)
|
|||||||
dprintk(1, "\n");
|
dprintk(1, "\n");
|
||||||
}
|
}
|
||||||
// for testing just write 0, then the default value to a register and read
|
// for testing just write 0, then the default value to a register and read
|
||||||
// it back in both cases
|
// it back in both cases
|
||||||
zr36016_writei(ptr, ZR016I_PAX_LO, 0x00);
|
zr36016_writei(ptr, ZR016I_PAX_LO, 0x00);
|
||||||
if (zr36016_readi(ptr, ZR016I_PAX_LO) != 0x0) {
|
if (zr36016_readi(ptr, ZR016I_PAX_LO) != 0x0) {
|
||||||
dprintk(1,
|
dprintk(1,
|
||||||
@ -232,17 +232,17 @@ zr36016_basic_test (struct zr36016 *ptr)
|
|||||||
static int zr36016_pushit (struct zr36016 *ptr,
|
static int zr36016_pushit (struct zr36016 *ptr,
|
||||||
u16 startreg,
|
u16 startreg,
|
||||||
u16 len,
|
u16 len,
|
||||||
const char *data)
|
const char *data)
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
dprintk(4, "%s: write data block to 0x%04x (len=%d)\n",
|
dprintk(4, "%s: write data block to 0x%04x (len=%d)\n",
|
||||||
ptr->name, startreg,len);
|
ptr->name, startreg,len);
|
||||||
while (i<len) {
|
while (i<len) {
|
||||||
zr36016_writei(ptr, startreg++, data[i++]);
|
zr36016_writei(ptr, startreg++, data[i++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/wait.h>
|
#include <linux/wait.h>
|
||||||
|
|
||||||
/* includes for structures and defines regarding video
|
/* includes for structures and defines regarding video
|
||||||
#include<linux/videodev.h> */
|
#include<linux/videodev.h> */
|
||||||
|
|
||||||
/* I/O commands, error codes */
|
/* I/O commands, error codes */
|
||||||
@ -171,7 +171,7 @@ zr36050_wait_end (struct zr36050 *ptr)
|
|||||||
/* =========================================================================
|
/* =========================================================================
|
||||||
Local helper function:
|
Local helper function:
|
||||||
|
|
||||||
basic test of "connectivity", writes/reads to/from memory the SOF marker
|
basic test of "connectivity", writes/reads to/from memory the SOF marker
|
||||||
========================================================================= */
|
========================================================================= */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -218,9 +218,9 @@ zr36050_basic_test (struct zr36050 *ptr)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
zr36050_pushit (struct zr36050 *ptr,
|
zr36050_pushit (struct zr36050 *ptr,
|
||||||
u16 startreg,
|
u16 startreg,
|
||||||
u16 len,
|
u16 len,
|
||||||
const char *data)
|
const char *data)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ static const char zr36050_decimation_v[8] = { 1, 1, 1, 0, 0, 0, 0, 0 };
|
|||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* SOF (start of frame) segment depends on width, height and sampling ratio
|
/* SOF (start of frame) segment depends on width, height and sampling ratio
|
||||||
of each color component */
|
of each color component */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
zr36050_set_sof (struct zr36050 *ptr)
|
zr36050_set_sof (struct zr36050 *ptr)
|
||||||
@ -376,8 +376,8 @@ zr36050_set_sof (struct zr36050 *ptr)
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* SOS (start of scan) segment depends on the used scan components
|
/* SOS (start of scan) segment depends on the used scan components
|
||||||
of each color component */
|
of each color component */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
zr36050_set_sos (struct zr36050 *ptr)
|
zr36050_set_sos (struct zr36050 *ptr)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* zr36057.h - zr36057 register offsets
|
* zr36057.h - zr36057 register offsets
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 Dave Perks <dperks@ibm.net>
|
* Copyright (C) 1998 Dave Perks <dperks@ibm.net>
|
||||||
@ -27,14 +27,14 @@
|
|||||||
#define ZR36057_VFEHCR 0x000 /* Video Front End, Horizontal Configuration Register */
|
#define ZR36057_VFEHCR 0x000 /* Video Front End, Horizontal Configuration Register */
|
||||||
#define ZR36057_VFEHCR_HSPol (1<<30)
|
#define ZR36057_VFEHCR_HSPol (1<<30)
|
||||||
#define ZR36057_VFEHCR_HStart 10
|
#define ZR36057_VFEHCR_HStart 10
|
||||||
#define ZR36057_VFEHCR_HEnd 0
|
#define ZR36057_VFEHCR_HEnd 0
|
||||||
#define ZR36057_VFEHCR_Hmask 0x3ff
|
#define ZR36057_VFEHCR_Hmask 0x3ff
|
||||||
|
|
||||||
#define ZR36057_VFEVCR 0x004 /* Video Front End, Vertical Configuration Register */
|
#define ZR36057_VFEVCR 0x004 /* Video Front End, Vertical Configuration Register */
|
||||||
#define ZR36057_VFEVCR_VSPol (1<<30)
|
#define ZR36057_VFEVCR_VSPol (1<<30)
|
||||||
#define ZR36057_VFEVCR_VStart 10
|
#define ZR36057_VFEVCR_VStart 10
|
||||||
#define ZR36057_VFEVCR_VEnd 0
|
#define ZR36057_VFEVCR_VEnd 0
|
||||||
#define ZR36057_VFEVCR_Vmask 0x3ff
|
#define ZR36057_VFEVCR_Vmask 0x3ff
|
||||||
|
|
||||||
#define ZR36057_VFESPFR 0x008 /* Video Front End, Scaler and Pixel Format Register */
|
#define ZR36057_VFESPFR 0x008 /* Video Front End, Scaler and Pixel Format Register */
|
||||||
#define ZR36057_VFESPFR_ExtFl (1<<26)
|
#define ZR36057_VFESPFR_ExtFl (1<<26)
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/wait.h>
|
#include <linux/wait.h>
|
||||||
|
|
||||||
/* includes for structures and defines regarding video
|
/* includes for structures and defines regarding video
|
||||||
#include<linux/videodev.h> */
|
#include<linux/videodev.h> */
|
||||||
|
|
||||||
/* I/O commands, error codes */
|
/* I/O commands, error codes */
|
||||||
@ -173,7 +173,7 @@ zr36060_wait_end (struct zr36060 *ptr)
|
|||||||
/* =========================================================================
|
/* =========================================================================
|
||||||
Local helper function:
|
Local helper function:
|
||||||
|
|
||||||
basic test of "connectivity", writes/reads to/from memory the SOF marker
|
basic test of "connectivity", writes/reads to/from memory the SOF marker
|
||||||
========================================================================= */
|
========================================================================= */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -208,9 +208,9 @@ zr36060_basic_test (struct zr36060 *ptr)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
zr36060_pushit (struct zr36060 *ptr,
|
zr36060_pushit (struct zr36060 *ptr,
|
||||||
u16 startreg,
|
u16 startreg,
|
||||||
u16 len,
|
u16 len,
|
||||||
const char *data)
|
const char *data)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@ -335,7 +335,7 @@ static const char zr36060_decimation_v[8] = { 1, 1, 1, 0, 0, 0, 0, 0 };
|
|||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* SOF (start of frame) segment depends on width, height and sampling ratio
|
/* SOF (start of frame) segment depends on width, height and sampling ratio
|
||||||
of each color component */
|
of each color component */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
zr36060_set_sof (struct zr36060 *ptr)
|
zr36060_set_sof (struct zr36060 *ptr)
|
||||||
@ -367,8 +367,8 @@ zr36060_set_sof (struct zr36060 *ptr)
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* SOS (start of scan) segment depends on the used scan components
|
/* SOS (start of scan) segment depends on the used scan components
|
||||||
of each color component */
|
of each color component */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
zr36060_set_sos (struct zr36060 *ptr)
|
zr36060_set_sos (struct zr36060 *ptr)
|
||||||
@ -385,7 +385,7 @@ zr36060_set_sos (struct zr36060 *ptr)
|
|||||||
for (i = 0; i < NO_OF_COMPONENTS; i++) {
|
for (i = 0; i < NO_OF_COMPONENTS; i++) {
|
||||||
sos_data[5 + (i * 2)] = i; // index
|
sos_data[5 + (i * 2)] = i; // index
|
||||||
sos_data[6 + (i * 2)] = (zr36060_td[i] << 4) |
|
sos_data[6 + (i * 2)] = (zr36060_td[i] << 4) |
|
||||||
zr36060_ta[i]; // AC/DC tbl.sel.
|
zr36060_ta[i]; // AC/DC tbl.sel.
|
||||||
}
|
}
|
||||||
sos_data[2 + 1 + (2 * NO_OF_COMPONENTS) + 2] = 00; // scan start
|
sos_data[2 + 1 + (2 * NO_OF_COMPONENTS) + 2] = 00; // scan start
|
||||||
sos_data[2 + 1 + (2 * NO_OF_COMPONENTS) + 3] = 0x3f;
|
sos_data[2 + 1 + (2 * NO_OF_COMPONENTS) + 3] = 0x3f;
|
||||||
@ -999,7 +999,7 @@ zr36060_cleanup_module (void)
|
|||||||
dprintk(1,
|
dprintk(1,
|
||||||
"zr36060: something's wrong - %d codecs left somehow.\n",
|
"zr36060: something's wrong - %d codecs left somehow.\n",
|
||||||
zr36060_codecs);
|
zr36060_codecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* however, we can't just stay alive */
|
/* however, we can't just stay alive */
|
||||||
videocodec_unregister(&zr36060_codec);
|
videocodec_unregister(&zr36060_codec);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user