gspca sn9c20x subdriver rev2
cover gspca sn9c20x subdriver rev2
Mauro,
Here is the updated version of the gspca sn9c20x subdriver.
I've removed the custom debugging support and replaced it with support for the v4l2 debugging ioctls. The first patch in this set adds support to the gspca core for those ioctls. Also included are the fixes Hans sent in his last email.
Regards,
Brian Johnson
PATCH 1/2 gspca: add support for v4l2 debugging ioctls
This patch adds support for dbg_g_chip_ident, dbg_g_register, and dbg_s_register to the gspca core module.
--- drivers/media/video/gspca/gspca.c | 73 +++++++++++++++++++++++++++++++++++++ drivers/media/video/gspca/gspca.h | 7 ++++ 2 files changed, 80 insertions(+), 0 deletions(-)
drivers/media/video/gspca/gspca.c +73 -0
@@ -727,6 +727,74 @@ static int gspca_get_mode(struct gspca_dev *gspca_dev,return -EINVAL ; } +#ifdef CONFIG_VIDEO_ADV_DEBUG +static int vidioc_g_register (struct file *file,void *priv, +struct v4l2_dbg_register *reg) +{ +int ret; +struct gspca_dev *gspca_dev = priv; + +if (!gspca_dev->sd_desc->get_chip_ident) +return -EINVAL ; + +if (!gspca_dev->sd_desc->get_register) +return -EINVAL ; + +if (mutex_lock_interruptible (&gspca_dev->usb_lock)) +return -ERESTARTSYS ; +if (gspca_dev->present) + ret = gspca_dev->sd_desc->get_register (gspca_dev, reg); +else + ret = -ENODEV ; +mutex_unlock (&gspca_dev->usb_lock); + +return ret; +} + +static int vidioc_s_register (struct file *file,void *priv, +struct v4l2_dbg_register *reg) +{ +int ret; +struct gspca_dev *gspca_dev = priv; + +if (!gspca_dev->sd_desc->get_chip_ident) +return -EINVAL ; + +if (!gspca_dev->sd_desc->set_register) +return -EINVAL ; + +if (mutex_lock_interruptible (&gspca_dev->usb_lock)) +return -ERESTARTSYS ; +if (gspca_dev->present) + ret = gspca_dev->sd_desc->set_register (gspca_dev, reg); +else + ret = -ENODEV ; +mutex_unlock (&gspca_dev->usb_lock); + +return ret; +} +#endif + +static int vidioc_g_chip_ident (struct file *file,void *priv, +struct v4l2_dbg_chip_ident *chip) +{ +int ret; +struct gspca_dev *gspca_dev = priv; + +if (!gspca_dev->sd_desc->get_chip_ident) +return -EINVAL ; + +if (mutex_lock_interruptible (&gspca_dev->usb_lock)) +return -ERESTARTSYS ; +if (gspca_dev->present) + ret = gspca_dev->sd_desc->get_chip_ident (gspca_dev, chip); +else + ret = -ENODEV ; +mutex_unlock (&gspca_dev->usb_lock); + +return ret; +} +static int vidioc_enum_fmt_vid_cap (struct file *file,void *priv,struct v4l2_fmtdesc *fmtdesc) {
@@ -1883,6 +1951,11 @@ static const struct v4l2_ioctl_ops dev_ioctl_ops = { .vidioc_s_parm = vidioc_s_parm, .vidioc_s_std = vidioc_s_std, .vidioc_enum_framesizes = vidioc_enum_framesizes, +#ifdef CONFIG_VIDEO_ADV_DEBUG + .vidioc_g_register = vidioc_g_register, + .vidioc_s_register = vidioc_s_register, +#endif + .vidioc_g_chip_ident = vidioc_g_chip_ident, #ifdef CONFIG_VIDEO_V4L1_COMPAT .vidiocgmbuf = vidiocgmbuf, #endif
drivers/media/video/gspca/gspca.h +7 -0
@@ -69,6 +69,10 @@ typedef void (*cam_v_op) (struct gspca_dev *);typedef int (*cam_cf_op ) (struct gspca_dev *,const struct usb_device_id *);typedef int (*cam_jpg_op ) (struct gspca_dev *,struct v4l2_jpegcompression *); +typedef int (*cam_reg_op ) (struct gspca_dev *, +struct v4l2_dbg_register *); +typedef int (*cam_ident_op ) (struct gspca_dev *, +struct v4l2_dbg_chip_ident *);typedef int (*cam_streamparm_op ) (struct gspca_dev *,struct v4l2_streamparm *); typedef int (*cam_qmnu_op) (struct gspca_dev *,
@@ -105,6 +109,9 @@ struct sd_desc {cam_qmnu_op querymenu;cam_streamparm_op get_streamparm;cam_streamparm_op set_streamparm; +cam_reg_op set_register; +cam_reg_op get_register; +cam_ident_op get_chip_ident; };/* packet types when moving from iso buf to frame buf */
Signature · 1 line
1.5.6.3
PATCH 2/2 gspca: Add sn9c20x subdriver
This adds support for webcams using the sn9c201 and sn9c202 bridges.
--- MAINTAINERS | 8 + drivers/media/video/gspca/Kconfig | 16 + drivers/media/video/gspca/Makefile | 2 + drivers/media/video/gspca/sn9c20x.c | 2430 +++++++++++++++++++++++++++++++++++ include/linux/videodev2.h | 1 + include/media/v4l2-chip-ident.h | 12 + 6 files changed, 2469 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/gspca/sn9c20x.c
MAINTAINERS +8 -0
@@ -2599,6 +2599,14 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git S: Maintained F: drivers/media/video/gspca/pac207.c +GSPCA SN9C20X SUBDRIVER +P: Brian Johnson +M: [email protected] +L: [email protected] +T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git +S: Maintained +F: drivers/media/video/gspca/sn9c20x/ + GSPCA T613 SUBDRIVER P: Leandro Costantino M: [email protected]
drivers/media/video/gspca/Kconfig +16 -0
@@ -102,6 +102,22 @@ config USB_GSPCA_PAC7311 To compile this driver as a module, choose M here: the module will be called gspca_pac7311. +config USB_GSPCA_SN9C20X + tristate "SN9C20X USB Camera Driver" + depends on VIDEO_V4L2 && USB_GSPCA + help + Say Y here if you want support for cameras based on the + sn9c20x chips (SN9C201 and SN9C202). + + To compile this driver as a module, choose M here: the + module will be called gspca_sn9c20x. + +config USB_GSPCA_SN9C20X_EVDEV + bool "Enable evdev support" + depends on USB_GSPCA_SN9C20X + ---help--- + Say Y here in order to enable evdev support for sn9c20x webcam button. + config USB_GSPCA_SONIXB tristate "SONIX Bayer USB Camera Driver" depends on VIDEO_V4L2 && USB_GSPCA
drivers/media/video/gspca/Makefile +2 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_USB_GSPCA_OV519) += gspca_ov519.o obj-$(CONFIG_USB_GSPCA_OV534) += gspca_ov534.o obj-$(CONFIG_USB_GSPCA_PAC207) += gspca_pac207.o obj-$(CONFIG_USB_GSPCA_PAC7311) += gspca_pac7311.o +obj-$(CONFIG_USB_GSPCA_SN9C20X) += gspca_sn9c20x.o obj-$(CONFIG_USB_GSPCA_SONIXB) += gspca_sonixb.o obj-$(CONFIG_USB_GSPCA_SONIXJ) += gspca_sonixj.o obj-$(CONFIG_USB_GSPCA_SPCA500) += gspca_spca500.o
@@ -35,6 +36,7 @@ gspca_ov519-objs := ov519.o gspca_ov534-objs := ov534.o gspca_pac207-objs := pac207.o gspca_pac7311-objs := pac7311.o +gspca_sn9c20x-objs := sn9c20x.o gspca_sonixb-objs := sonixb.o gspca_sonixj-objs := sonixj.o gspca_spca500-objs := spca500.o
drivers/media/video/gspca/sn9c20x.c new file +2430 -0
2,430 lines not on this page · raw message
include/linux/videodev2.h +1 -0
@@ -338,6 +338,7 @@ struct v4l2_pix_format {/* Vendor-specific formats */ #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A')/* Winnov hw compress */ #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0')/* SN9C10x compression */ +#define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0')/* SN9C20x YUV 4:2:0 */ #define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1')/* pwc older webcam */ #define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2')/* pwc newer webcam */ #define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5')/* ET61X251 compression */
include/media/v4l2-chip-ident.h +12 -0
@@ -60,6 +60,10 @@ enum {V4L2_IDENT_OV7670 =250 ,V4L2_IDENT_OV7720 =251 ,V4L2_IDENT_OV7725 =252 , +V4L2_IDENT_OV7660 =253 , +V4L2_IDENT_OV9650 =254 , +V4L2_IDENT_OV9655 =255 , +V4L2_IDENT_SOI968 =256 ,/* module saa7146: reserved range 300-309 */ V4L2_IDENT_SAA7146 = 300,
@@ -161,6 +165,9 @@ enum {/* module tw9910: just ident 9910 */ V4L2_IDENT_TW9910 =9910 , +/* module sn9c20x: just ident 10000 */ +V4L2_IDENT_SN9C20X =10000 , +/* module msp3400: reserved range 34000-34999 and 44000-44999 */ V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, onlyuse internally (tveeprom.c). */
@@ -237,6 +244,11 @@ enum {V4L2_IDENT_MT9V022IX7ATC =45010 ,/* No way to detect "normal" I77ATx */ V4L2_IDENT_MT9V022IX7ATM =45015 ,/* and "lead free" IA7ATx chips */ V4L2_IDENT_MT9T031 =45020 , +V4L2_IDENT_MT9V111 =45031 , +V4L2_IDENT_MT9V112 =45032 , + +/* HV7131R CMOS sensor: just ident 46000 */ +V4L2_IDENT_HV7131R =46000 ,/* module cs53132a: just ident 53132 */ V4L2_IDENT_CS53l32A = 53132,
Signature · 1 line
1.5.6.3
Quoted 10 lines · On Fri, 17 Jul 2009 16:51:41 -0400 Brian Johnson <[email protected]> wrote:
Mauro,
Here is the updated version of the gspca sn9c20x subdriver.I've removed the custom debugging support and replaced it with support for the v4l2 debugging ioctls. The first patch in this set adds support to the gspca core for those ioctls. Also included are the fixes Hans sent in his last email.
Regards,
Brian Johnson
Hello Brian and Mauro,
Thanks, Brian. I have just a few remarks:
- in the 1st patch, in gspca.c, why is the get_chip_ident check needed in vidioc_g_register / vidioc_s_register)?
- in the 1st patch, in gspca.h, the operations set/get_register in the sd descriptor should not exist if not CONFIG_VIDEO_ADV_DEBUG.
- in the 2nd patch, I would have preferred hexadecimal letters in lower case.
- in the 2nd patch, the list of the new handled webcams (linux/Documentation/video4linux/gspca.txt) is lacking.
Anyway, this is not important and may be done later.
So, Mauro, if it is OK for you (don't confirm), I will handle these patch series.
Cheers.
Signature · 2 lines
Ken ar c'hentañ | ** Breizh ha Linux atav! ** Jef | http://moinejf.free.fr/
Quoted 3 lines
- in the 1st patch, in
gspca.c, why is theget_chip_identcheck needed invidioc_g_register/vidioc_s_register)?
According the the current v4l2 spec regarding the set and get register ioctls drivers that support them must also support the get chip ident ioctl. As such in the vidioc_s/g_register ioctls I do the check to ensure that the driver also defines the get_chip_ident ioctl.
Brian Johnson
Hi,
shouldn't there be a check when allocating jpg_hdr? or i am missing something?
sd->jpeg_hdr = kmalloc(JPEG_HDR_SZ, GFP_KERNEL);
jpeg_define(sd->jpeg_hdr, height, width, 0x21);
jpeg_set_qual(sd->jpeg_hdr, sd->quality);
Best Regards.
Nice to see microdia project here :)
Quoted 15 lines · Brian Johnson
Quoted 3 lines
- in the 1st patch, in
gspca.c, why is theget_chip_identcheck needed invidioc_g_register/vidioc_s_register)?According the the current v4l2 spec regarding the set and get register ioctls drivers that support them must also support the get chip ident ioctl. As such in the vidioc_s/g_register ioctls I do the check to ensure that the driver also defines the
get_chip_identioctl.Brian Johnson
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines
shouldn't there be a check when allocating
jpg_hdr? or i am missing something?
sd->jpeg_hdr=kmalloc(JPEG_HDR_SZ, GFP_KERNEL);
jpeg_define(sd->jpeg_hdr, height, width, 0x21);
jpeg_set_qual(sd->jpeg_hdr, sd->quality);
Yes probably there should be a check there. I'll one more minor revision with this plus the changes Jean-Francois mentioned previously in a bit.
Brian Johnson