gspca: Add MR97310A driver
PATCH 2/2 gspca: Add MR97310A driver
# HG changeset patch
# User Kyle Guinn <[email protected]>
# Date 1231906280 21600
# Node ID 09bce1e0dcac5bc99a2762288d879db9361377bc # Parent 1bf7a4403e5f1cd10f12a69a9d9239f1bf4a58b6
gspca: Add MR97310A driver
From: Kyle Guinn <[email protected]>
This patch adds support for USB webcams based on the MR97310A chip. It was tested with an Aiptek PenCam VGA+ webcam.
Priority: normal
linux/Documentation/video4linux/gspca.txt +1 -0
@@ -193,6 +193,7 @@ spca500 08ca:0103 Aiptek PocketDV sunplus 08ca:0104 Aiptek PocketDVII 1.3 sunplus 08ca:0106 Aiptek Pocket DV3100+ +mr97310a 08ca:0111 Aiptek PenCam VGA+ sunplus 08ca:2008 Aiptek Mini PenCam 2 M sunplus 08ca:2010 Aiptek PocketCam 3M sunplus 08ca:2016 Aiptek PocketCam 2 Mega
linux/drivers/media/video/gspca/Kconfig +9 -0
@@ -55,6 +55,15 @@ To compile this driver as a module, choose M here: the module will be called gspca_mars. + +config USB_GSPCA_MR97310A + tristate "Mars-Semi MR97310A USB Camera Driver" + depends on VIDEO_V4L2 && USB_GSPCA + help + Say Y here if you want support for cameras based on the MR97310A chip. + + To compile this driver as a module, choose M here: the + module will be called gspca_mr97310a. config USB_GSPCA_OV519 tristate "OV519 USB Camera Driver"
linux/drivers/media/video/gspca/Makefile +50 -48
100 lines not on this page · raw message
linux/drivers/media/video/gspca/gspca.c +1 -0
@@ -332,6 +332,7 @@case V4L2_PIX_FMT_JPEG :case V4L2_PIX_FMT_SPCA561 :case V4L2_PIX_FMT_PAC207 : +case V4L2_PIX_FMT_MR97310A :return 1 ; }return 0 ;
linux/drivers/media/video/gspca/mr97310a.c new file +390 -0
390 lines not on this page · raw message
Quoted 6 lines · On Wed, 14 Jan 2009 20:59:41 -0600 Kyle Guinn <[email protected]> wrote:
gspca: Add MR97310A driver
From: Kyle Guinn <[email protected]>
This patch adds support for USB webcams based on the MR97310A chip. It was tested with an Aiptek PenCam VGA+ webcam.
Hi again,
Here are some remarks about your patch.
[snip]
Quoted 12 lines
linux/drivers/media/video/gspca/mr97310a.c new file +11
-0+/* the bytes to write are in gspca_dev->usb_buf */ +static int reg_w (struct gspca_dev *gspca_dev, +__u16 index,int len) +{ +int rc; + + rc =usb_bulk_msg (gspca_dev->dev, +usb_sndbulkpipe (gspca_dev->dev,4 ), + gspca_dev->usb_buf, len,0 ,500 ); +if (rc <0 ) + PDEBUG(D_ERR, "reg write [%02x] error %d", index,rc);
Review
Quoted 2 lines
(quoted diff) +2
-0+ return rc; +}
The 'index' parameter is not useful: the register is always in the first byte of the buffer.
[snip]
linux/drivers/media/video/gspca/mr97310a.c line 90
Quoted 8 lines
linux/drivers/media/video/gspca/mr97310a.c new file +8
-0+/* this function is called at probe time */ +static int sd_config (struct gspca_dev *gspca_dev, +const struct usb_device_id *id) +{ +struct cam *cam; + + cam = &gspca_dev->cam; + cam->epaddr =0x01 ;
This variable has been removed in the last versions of gspca.
linux/drivers/media/video/gspca/mr97310a.c line 94
Quoted 4 lines
linux/drivers/media/video/gspca/mr97310a.c new file +4
-0+ cam->cam_mode = vga_mode; + cam->nmodes =ARRAY_SIZE (vga_mode); +return 0 ; +}
[snip]
Quoted 14 lines
linux/drivers/media/video/gspca/mr97310a.c new file +8
-0+static int sd_start (struct gspca_dev *gspca_dev) +{ +struct sd *sd = (struct sd *) gspca_dev; +__u8 *data = gspca_dev->usb_buf; +int err_code; +int intpipe; + + PDEBUG(D_STREAM, "camera start, iface %d, alt 8",
gspca_dev->iface);(quoted diff) +1
-0+ err_code = usb_set_interface(gspca_dev->dev,
gspca_dev->iface, 8);(quoted diff) +2
-0+ if (err_code < 0) { + PDEBUG(D_ERR|D_STREAM, "Set packet size: setinterface error");
Review
Quoted 2 lines
(quoted diff) +2
-0+ return err_code; + }
The usb_set_interface() is already done in the gspca main.
[snip]
linux/drivers/media/video/gspca/mr97310a.c line 273
Quoted 4 lines
linux/drivers/media/video/gspca/mr97310a.c new file +4
-0+ sd->sof_read =0 ; + + intpipe =usb_sndintpipe (gspca_dev->dev,0 ); + err_code =usb_clear_halt (gspca_dev->dev, intpipe);
Is this really needed?
linux/drivers/media/video/gspca/mr97310a.c line 279
Quoted 5 lines
linux/drivers/media/video/gspca/mr97310a.c new file +5
-0+ data[0 ] =0x00 ; + data[1 ] =0x4d ;/* ISOC transfering enable... */ +reg_w (gspca_dev, data[0 ],2 ); +return err_code; +}
[snip]
Signature · 2 lines
Ken ar c'hentan | ** Breizh ha Linux atav! ** Jef | http://moinejf.free.fr/
Quoted 13 lines · On Thursday 15 January 2009 06:13:29 Jean-Francois Moine wrote:
Hi again,
Here are some remarks about your patch.
Quoted 9 lines
linux/drivers/media/video/gspca/mr97310a.c new file +9
-0+/* the bytes to write are in gspca_dev->usb_buf */ +static int reg_w (struct gspca_dev *gspca_dev, +__u16 index,int len) +{ +int rc; + + rc =usb_bulk_msg (gspca_dev->dev, +usb_sndbulkpipe (gspca_dev->dev,4 ), + gspca_dev->usb_buf, len,0 ,500 );
Quoted 9 lines
Review
Quoted 5 lines
(quoted diff) +2
-0+ if (rc < 0) + PDEBUG(D_ERR, "reg write [%02x] error %d", index,rc);
(quoted diff) +2
-0+ return rc; +}The 'index' parameter is not useful: the register is always in the first byte of the buffer.
Noted. I used the mars subdriver as a basis for this driver, and apparently an old version of it at that. Will be fixed in v2.
Quoted 11 lines
linux/drivers/media/video/gspca/mr97310a.c line 90
Quoted 8 lines
linux/drivers/media/video/gspca/mr97310a.c new file +8
-0+/* this function is called at probe time */ +static int sd_config (struct gspca_dev *gspca_dev, +const struct usb_device_id *id) +{ +struct cam *cam; + + cam = &gspca_dev->cam; + cam->epaddr =0x01 ;This variable has been removed in the last versions of gspca.
Will be removed in v2.
Quoted 10 lines
Quoted 10 lines
linux/drivers/media/video/gspca/mr97310a.c new file +8
-0+static int sd_start (struct gspca_dev *gspca_dev) +{ +struct sd *sd = (struct sd *) gspca_dev; +__u8 *data = gspca_dev->usb_buf; +int err_code; +int intpipe; + + PDEBUG(D_STREAM, "camera start, iface %d, alt 8",
gspca_dev->iface);(quoted diff) +1
-0+ err_code = usb_set_interface(gspca_dev->dev,
Quoted 9 lines
Review
Quoted 6 lines
gspca_dev->iface, 8);(quoted diff) +2
-0+ if (err_code < 0) { + PDEBUG(D_ERR|D_STREAM, "Set packet size: setinterface error");
(quoted diff) +2
-0+ return err_code; + }The
usb_set_interface()is already done in the gspca main.
Also borrowed from the mars subdriver. Will be removed in v2.
Quoted 7 lines
linux/drivers/media/video/gspca/mr97310a.c line 273
Quoted 4 lines
linux/drivers/media/video/gspca/mr97310a.c new file +4
-0+ sd->sof_read =0 ; + + intpipe =usb_sndintpipe (gspca_dev->dev,0 ); + err_code =usb_clear_halt (gspca_dev->dev, intpipe);Is this really needed?
Also borrowed from the mars subdriver, and doesn't appear to be necessary for the camera to work. Will be removed in v2.
Regards,
-Kyle