diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-23 14:39:09 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-23 14:39:09 -0700 |
commit | e317234975cb7463b8ca21a93bb6862d9dcf113f (patch) | |
tree | 4446fa3a21364f3cba23a22aa2a94027f169d8df /drivers/staging | |
parent | f37ab0fba271e43edab0e3ae9fe644fcda455402 (diff) | |
parent | 7483d45f0aee3afc0646d185cabd4af9f6cab58c (diff) |
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab:
- V4L2 API additions to better support JPEG compression control
- media API additions to properly support MPEG decoders
- V4L2 API additions for image crop/scaling
- a few other V4L2 API DocBook fixes/improvements
- two new DVB frontend drivers: m88rs2000 and rtl2830
- two new DVB drivers: az6007 and rtl28xxu
- a framework for ISA drivers, that removed lots of common code found
at the ISA radio drivers
- a new FM transmitter driver (radio-keene)
- a GPIO-based IR receiver driver
- a new sensor driver: mt9m032
- some new video drivers: adv7183, blackfin, mx2_emmaprp, sii9234_drv,
vs6624
- several new board additions, driver fixes, improvements and cleanups.
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (295 commits)
[media] update CARDLIST.em28xx
[media] partially reverts changeset fa5527c
[media] stb0899: fix the limits for signal strength values
[media] em28xx: support for 2304:0242 PCTV QuatroStick (510e)
[media] em28xx: support for 2013:0251 PCTV QuatroStick nano (520e)
[media] -EINVAL -> -ENOTTY
[media] gspca - sn9c20x: Cleanup source
[media] gspca - sn9c20x: Simplify register write for capture start/stop
[media] gspca - sn9c20x: Add automatic JPEG compression mechanism
[media] gspca - sn9c20x: Greater delay in case of sensor no response
[media] gspca - sn9c20x: Optimize the code of write sequences
[media] gspca - sn9c20x: Add the JPEG compression quality control
[media] gspca - sn9c20x: Add a delay after Omnivision sensor reset
[media] gspca - sn9c20x: Propagate USB errors to higher level
[media] gspca - sn9c20x: Use the new video control mechanism
[media] gspca - sn9c20x: Fix loss of frame start
[media] gspca - zc3xx: Lack of register 08 value for sensor cs2102k
[media] gspca - ov534_9: Add brightness to OmniVision 5621 sensor
[media] gspca - zc3xx: Add V4L2_CID_JPEG_COMPRESSION_QUALITY control support
[media] pvrusb2: fix 7MHz & 8MHz DVB-T tuner support for HVR1900 rev D1F5
...
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/media/Kconfig | 2 | ||||
-rw-r--r-- | drivers/staging/media/as102/as102_drv.c | 2 | ||||
-rw-r--r-- | drivers/staging/media/as102/as102_drv.h | 2 | ||||
-rw-r--r-- | drivers/staging/media/as102/as102_fe.c | 6 | ||||
-rw-r--r-- | drivers/staging/media/as102/as102_fw.h | 2 | ||||
-rw-r--r-- | drivers/staging/media/as102/as102_usb_drv.c | 17 | ||||
-rw-r--r-- | drivers/staging/media/as102/as10x_cmd.h | 80 | ||||
-rw-r--r-- | drivers/staging/media/as102/as10x_types.h | 2 | ||||
-rw-r--r-- | drivers/staging/media/easycap/easycap_main.c | 242 | ||||
-rw-r--r-- | drivers/staging/media/go7007/go7007-v4l2.c | 8 | ||||
-rw-r--r-- | drivers/staging/media/go7007/s2250-board.c | 16 | ||||
-rw-r--r-- | drivers/staging/media/lirc/lirc_serial.c | 2 | ||||
-rw-r--r-- | drivers/staging/media/solo6x10/Kconfig | 2 | ||||
-rw-r--r-- | drivers/staging/media/solo6x10/core.c | 32 |
14 files changed, 174 insertions, 241 deletions
diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig index 7e5caa39ed3f..4f4b7d6281a7 100644 --- a/drivers/staging/media/Kconfig +++ b/drivers/staging/media/Kconfig @@ -6,7 +6,7 @@ menuconfig STAGING_MEDIA don't have the "normal" Linux kernel quality level. Most of them don't follow properly the V4L, DVB and/or RC API's, so, they won't likely work fine with the existing applications. - That also means that, one fixed, their API's will change to match + That also means that, once fixed, their API's will change to match the existing ones. If you wish to work on these drivers, to help improve them, or diff --git a/drivers/staging/media/as102/as102_drv.c b/drivers/staging/media/as102/as102_drv.c index aae0505a36c4..ea4f992de235 100644 --- a/drivers/staging/media/as102/as102_drv.c +++ b/drivers/staging/media/as102/as102_drv.c @@ -27,7 +27,7 @@ #include <linux/uaccess.h> #include <linux/usb.h> -/* header file for Usb device driver*/ +/* header file for usb device driver*/ #include "as102_drv.h" #include "as102_fw.h" #include "dvbdev.h" diff --git a/drivers/staging/media/as102/as102_drv.h b/drivers/staging/media/as102/as102_drv.h index 957f0ed0d81a..b0e5a23bd532 100644 --- a/drivers/staging/media/as102/as102_drv.h +++ b/drivers/staging/media/as102/as102_drv.h @@ -76,7 +76,7 @@ struct as102_dev_t { struct as10x_bus_adapter_t bus_adap; struct list_head device_entry; struct kref kref; - unsigned long minor; + uint8_t elna_cfg; struct dvb_adapter dvb_adap; struct dvb_frontend dvb_fe; diff --git a/drivers/staging/media/as102/as102_fe.c b/drivers/staging/media/as102/as102_fe.c index bdc5a38cddf7..5917657b9d0f 100644 --- a/drivers/staging/media/as102/as102_fe.c +++ b/drivers/staging/media/as102/as102_fe.c @@ -265,7 +265,7 @@ static int as102_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire) if (acquire) { if (elna_enable) - as10x_cmd_set_context(&dev->bus_adap, 1010, 0xC0); + as10x_cmd_set_context(&dev->bus_adap, CONTEXT_LNA, dev->elna_cfg); ret = as10x_cmd_turn_on(&dev->bus_adap); } else { @@ -337,7 +337,7 @@ int as102_dvb_register_fe(struct as102_dev_t *as102_dev, strncpy(dvb_fe->ops.info.name, as102_dev->name, sizeof(dvb_fe->ops.info.name)); - /* register dbvb frontend */ + /* register dvb frontend */ errno = dvb_register_frontend(dvb_adap, dvb_fe); if (errno == 0) dvb_fe->tuner_priv = as102_dev; @@ -349,7 +349,7 @@ static void as10x_fe_copy_tps_parameters(struct dtv_frontend_properties *fe_tps, struct as10x_tps *as10x_tps) { - /* extract consteallation */ + /* extract constellation */ switch (as10x_tps->modulation) { case CONST_QPSK: fe_tps->modulation = QPSK; diff --git a/drivers/staging/media/as102/as102_fw.h b/drivers/staging/media/as102/as102_fw.h index bd21f0554392..4bfc6849d95a 100644 --- a/drivers/staging/media/as102/as102_fw.h +++ b/drivers/staging/media/as102/as102_fw.h @@ -29,7 +29,7 @@ struct as10x_fw_pkt_t { union { unsigned char request[2]; unsigned char length[2]; - } u; + } __packed u; struct as10x_raw_fw_pkt raw; } __packed; diff --git a/drivers/staging/media/as102/as102_usb_drv.c b/drivers/staging/media/as102/as102_usb_drv.c index d775be0173ea..0f6bfe7eccba 100644 --- a/drivers/staging/media/as102/as102_usb_drv.c +++ b/drivers/staging/media/as102/as102_usb_drv.c @@ -57,6 +57,17 @@ static const char * const as102_device_names[] = { NULL /* Terminating entry */ }; +/* eLNA configuration: devices built on the reference design work best + with 0xA0, while custom designs seem to require 0xC0 */ +static uint8_t const as102_elna_cfg[] = { + 0xA0, + 0xC0, + 0xC0, + 0xA0, + 0xA0, + 0x00 /* Terminating entry */ +}; + struct usb_driver as102_usb_driver = { .name = DRIVER_FULL_NAME, .probe = as102_usb_probe, @@ -270,6 +281,8 @@ static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) } urb->transfer_buffer = dev->stream + (i * AS102_USB_BUF_SIZE); + urb->transfer_dma = dev->dma_addr + (i * AS102_USB_BUF_SIZE); + urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; urb->transfer_buffer_length = AS102_USB_BUF_SIZE; dev->stream_urb[i] = urb; @@ -369,8 +382,10 @@ static int as102_usb_probe(struct usb_interface *intf, /* Assign the user-friendly device name */ for (i = 0; i < (sizeof(as102_usb_id_table) / sizeof(struct usb_device_id)); i++) { - if (id == &as102_usb_id_table[i]) + if (id == &as102_usb_id_table[i]) { as102_dev->name = as102_device_names[i]; + as102_dev->elna_cfg = as102_elna_cfg[i]; + } } if (as102_dev->name == NULL) diff --git a/drivers/staging/media/as102/as10x_cmd.h b/drivers/staging/media/as102/as10x_cmd.h index 4ea249e7adab..e21ec6c702a9 100644 --- a/drivers/staging/media/as102/as10x_cmd.h +++ b/drivers/staging/media/as102/as10x_cmd.h @@ -99,14 +99,14 @@ union as10x_turn_on { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_turn_off { @@ -114,14 +114,14 @@ union as10x_turn_off { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* error */ uint8_t err; - } rsp; + } __packed rsp; } __packed; union as10x_set_tune { @@ -131,14 +131,14 @@ union as10x_set_tune { uint16_t proc_id; /* tune params */ struct as10x_tune_args args; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* response error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_get_tune_status { @@ -146,7 +146,7 @@ union as10x_get_tune_status { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -155,7 +155,7 @@ union as10x_get_tune_status { uint8_t error; /* tune status */ struct as10x_tune_status sts; - } rsp; + } __packed rsp; } __packed; union as10x_get_tps { @@ -163,7 +163,7 @@ union as10x_get_tps { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -172,7 +172,7 @@ union as10x_get_tps { uint8_t error; /* tps details */ struct as10x_tps tps; - } rsp; + } __packed rsp; } __packed; union as10x_common { @@ -180,14 +180,14 @@ union as10x_common { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* response error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_add_pid_filter { @@ -201,7 +201,7 @@ union as10x_add_pid_filter { uint8_t stream_type; /* PID index in filter table */ uint8_t idx; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -210,7 +210,7 @@ union as10x_add_pid_filter { uint8_t error; /* Filter id */ uint8_t filter_id; - } rsp; + } __packed rsp; } __packed; union as10x_del_pid_filter { @@ -220,14 +220,14 @@ union as10x_del_pid_filter { uint16_t proc_id; /* PID to remove */ uint16_t pid; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* response error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_start_streaming { @@ -235,14 +235,14 @@ union as10x_start_streaming { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_stop_streaming { @@ -250,14 +250,14 @@ union as10x_stop_streaming { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_get_demod_stats { @@ -265,7 +265,7 @@ union as10x_get_demod_stats { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -274,7 +274,7 @@ union as10x_get_demod_stats { uint8_t error; /* demod stats */ struct as10x_demod_stats stats; - } rsp; + } __packed rsp; } __packed; union as10x_get_impulse_resp { @@ -282,7 +282,7 @@ union as10x_get_impulse_resp { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -291,7 +291,7 @@ union as10x_get_impulse_resp { uint8_t error; /* impulse response ready */ uint8_t is_ready; - } rsp; + } __packed rsp; } __packed; union as10x_fw_context { @@ -305,7 +305,7 @@ union as10x_fw_context { uint16_t tag; /* context request type */ uint16_t type; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -316,7 +316,7 @@ union as10x_fw_context { uint16_t type; /* error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_set_register { @@ -328,14 +328,14 @@ union as10x_set_register { struct as10x_register_addr reg_addr; /* register content */ struct as10x_register_value reg_val; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_get_register { @@ -345,7 +345,7 @@ union as10x_get_register { uint16_t proc_id; /* register description */ struct as10x_register_addr reg_addr; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -354,7 +354,7 @@ union as10x_get_register { uint8_t error; /* register content */ struct as10x_register_value reg_val; - } rsp; + } __packed rsp; } __packed; union as10x_cfg_change_mode { @@ -364,14 +364,14 @@ union as10x_cfg_change_mode { uint16_t proc_id; /* mode */ uint8_t mode; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; struct as10x_cmd_header_t { @@ -394,7 +394,7 @@ union as10x_dump_memory { struct as10x_register_addr reg_addr; /* nb blocks to read */ uint16_t num_blocks; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -408,8 +408,8 @@ union as10x_dump_memory { uint8_t data8[DUMP_BLOCK_SIZE]; uint16_t data16[DUMP_BLOCK_SIZE / sizeof(uint16_t)]; uint32_t data32[DUMP_BLOCK_SIZE / sizeof(uint32_t)]; - } u; - } rsp; + } __packed u; + } __packed rsp; } __packed; union as10x_dumplog_memory { @@ -418,7 +418,7 @@ union as10x_dumplog_memory { uint16_t proc_id; /* dump memory type request */ uint8_t dump_req; - } req; + } __packed req; struct { /* request identifier */ uint16_t proc_id; @@ -428,7 +428,7 @@ union as10x_dumplog_memory { uint8_t dump_rsp; /* dump data */ uint8_t data[DUMP_BLOCK_SIZE]; - } rsp; + } __packed rsp; } __packed; union as10x_raw_data { @@ -437,14 +437,14 @@ union as10x_raw_data { uint16_t proc_id; uint8_t data[64 - sizeof(struct as10x_cmd_header_t) - 2 /* proc_id */]; - } req; + } __packed req; /* response */ struct { uint16_t proc_id; uint8_t error; uint8_t data[64 - sizeof(struct as10x_cmd_header_t) - 2 /* proc_id */ - 1 /* rc */]; - } rsp; + } __packed rsp; } __packed; struct as10x_cmd_t { @@ -469,7 +469,7 @@ struct as10x_cmd_t { union as10x_dump_memory dump_memory; union as10x_dumplog_memory dumplog_memory; union as10x_raw_data raw_data; - } body; + } __packed body; } __packed; struct as10x_token_cmd_t { diff --git a/drivers/staging/media/as102/as10x_types.h b/drivers/staging/media/as102/as10x_types.h index fde8140ae88b..af26e057d9a2 100644 --- a/drivers/staging/media/as102/as10x_types.h +++ b/drivers/staging/media/as102/as10x_types.h @@ -181,7 +181,7 @@ struct as10x_register_value { uint8_t value8; /* 8 bit value */ uint16_t value16; /* 16 bit value */ uint32_t value32; /* 32 bit value */ - } u; + } __packed u; } __packed; struct as10x_register_addr { diff --git a/drivers/staging/media/easycap/easycap_main.c b/drivers/staging/media/easycap/easycap_main.c index 3d439b790cc6..d0fe34afc2e5 100644 --- a/drivers/staging/media/easycap/easycap_main.c +++ b/drivers/staging/media/easycap/easycap_main.c @@ -2849,13 +2849,11 @@ static const struct v4l2_file_operations v4l2_fops = { .poll = easycap_poll, .mmap = easycap_mmap, }; -/*****************************************************************************/ -/*---------------------------------------------------------------------------*/ + /* - * WHEN THE EasyCAP IS PHYSICALLY PLUGGED IN, THIS FUNCTION IS CALLED THREE - * TIMES, ONCE FOR EACH OF THE THREE INTERFACES. BEWARE. + * When the device is plugged, this function is called three times, + * one for each interface. */ -/*---------------------------------------------------------------------------*/ static int easycap_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -2884,7 +2882,6 @@ static int easycap_usb_probe(struct usb_interface *intf, usbdev = interface_to_usbdev(intf); -/*---------------------------------------------------------------------------*/ alt = usb_altnum_to_altsetting(intf, 0); if (!alt) { SAY("ERROR: usb_host_interface not found\n"); @@ -2896,11 +2893,8 @@ static int easycap_usb_probe(struct usb_interface *intf, SAY("ERROR: intf_descriptor is NULL\n"); return -EFAULT; } -/*---------------------------------------------------------------------------*/ -/* - * GET PROPERTIES OF PROBED INTERFACE - */ -/*---------------------------------------------------------------------------*/ + + /* Get properties of probed interface */ bInterfaceNumber = interface->bInterfaceNumber; bInterfaceClass = interface->bInterfaceClass; bInterfaceSubClass = interface->bInterfaceSubClass; @@ -2912,28 +2906,23 @@ static int easycap_usb_probe(struct usb_interface *intf, (long int)(intf->cur_altsetting - intf->altsetting)); JOT(4, "intf[%i]: bInterfaceClass=0x%02X bInterfaceSubClass=0x%02X\n", bInterfaceNumber, bInterfaceClass, bInterfaceSubClass); -/*---------------------------------------------------------------------------*/ -/* - * A NEW struct easycap IS ALWAYS ALLOCATED WHEN INTERFACE 0 IS PROBED. - * IT IS NOT POSSIBLE HERE TO FREE ANY EXISTING struct easycap. THIS - * SHOULD HAVE BEEN DONE BY easycap_delete() WHEN THE EasyCAP WAS - * PHYSICALLY UNPLUGGED. - * - * THE POINTER peasycap TO THE struct easycap IS REMEMBERED WHEN - * INTERFACES 1 AND 2 ARE PROBED. -*/ -/*---------------------------------------------------------------------------*/ + + /* + * A new struct easycap is always allocated when interface 0 is probed. + * It is not possible here to free any existing struct easycap. + * This should have been done by easycap_delete() when the device was + * physically unplugged. + * The allocated struct easycap is saved for later usage when + * interfaces 1 and 2 are probed. + */ if (0 == bInterfaceNumber) { peasycap = kzalloc(sizeof(struct easycap), GFP_KERNEL); if (!peasycap) { SAY("ERROR: Could not allocate peasycap\n"); return -ENOMEM; } -/*---------------------------------------------------------------------------*/ -/* - * PERFORM URGENT INTIALIZATIONS ... -*/ -/*---------------------------------------------------------------------------*/ + + /* Perform urgent initializations */ peasycap->minor = -1; kref_init(&peasycap->kref); JOM(8, "intf[%i]: after kref_init(..._video) " @@ -2976,11 +2965,7 @@ static int easycap_usb_probe(struct usb_interface *intf, peasycap->allocation_video_struct = sizeof(struct easycap); -/*---------------------------------------------------------------------------*/ -/* - * ... AND FURTHER INITIALIZE THE STRUCTURE -*/ -/*---------------------------------------------------------------------------*/ + /* and further initialize the structure */ peasycap->pusb_device = usbdev; peasycap->pusb_interface = intf; @@ -3002,11 +2987,7 @@ static int easycap_usb_probe(struct usb_interface *intf, peasycap->frame_buffer_many = FRAME_BUFFER_MANY; -/*---------------------------------------------------------------------------*/ -/* - * DYNAMICALLY FILL IN THE AVAILABLE FORMATS ... - */ -/*---------------------------------------------------------------------------*/ + /* Dynamically fill in the available formats */ rc = easycap_video_fillin_formats(); if (0 > rc) { SAM("ERROR: fillin_formats() rc = %i\n", rc); @@ -3014,10 +2995,8 @@ static int easycap_usb_probe(struct usb_interface *intf, } JOM(4, "%i formats available\n", rc); - /* ... AND POPULATE easycap.inputset[] */ - + /* Populate easycap.inputset[] */ inputset = peasycap->inputset; - fmtidx = peasycap->ntsc ? NTSC_M : PAL_BGHIN; m = 0; mask = 0; @@ -3030,7 +3009,6 @@ static int easycap_usb_probe(struct usb_interface *intf, mask = easycap_standard[i].mask; } } - if (1 != m) { SAM("ERROR: " "inputset->standard_offset unpopulated, %i=m\n", m); @@ -3089,14 +3067,13 @@ static int easycap_usb_probe(struct usb_interface *intf, JOM(4, "populated inputset[]\n"); JOM(4, "finished initialization\n"); } else { -/*---------------------------------------------------------------------------*/ -/* - * FIXME - * - * IDENTIFY THE APPROPRIATE POINTER peasycap FOR INTERFACES 1 AND 2. - * THE ADDRESS OF peasycap->pusb_device IS RELUCTANTLY USED FOR THIS PURPOSE. - */ -/*---------------------------------------------------------------------------*/ + + /* + * FIXME: Identify the appropriate pointer + * peasycap for interfaces 1 and 2. + * The address of peasycap->pusb_device + * is reluctantly used for this purpose. + */ for (ndong = 0; ndong < DONGLE_MANY; ndong++) { if (usbdev == easycapdc60_dongle[ndong].peasycap-> pusb_device) { @@ -3117,7 +3094,7 @@ static int easycap_usb_probe(struct usb_interface *intf, return -ENODEV; } } -/*---------------------------------------------------------------------------*/ + if ((USB_CLASS_VIDEO == bInterfaceClass) || (USB_CLASS_VENDOR_SPEC == bInterfaceClass)) { if (-1 == peasycap->video_interface) { @@ -3149,14 +3126,12 @@ static int easycap_usb_probe(struct usb_interface *intf, } } } -/*---------------------------------------------------------------------------*/ -/* - * INVESTIGATE ALL ALTSETTINGS. - * DONE IN DETAIL BECAUSE USB DEVICE 05e1:0408 HAS DISPARATE INCARNATIONS. - */ -/*---------------------------------------------------------------------------*/ - isokalt = 0; + /* + * Investigate all altsettings. This is done in detail + * because USB device 05e1:0408 has disparate incarnations. + */ + isokalt = 0; for (i = 0; i < intf->num_altsetting; i++) { alt = usb_altnum_to_altsetting(intf, i); if (!alt) { @@ -3172,7 +3147,6 @@ static int easycap_usb_probe(struct usb_interface *intf, if (0 == interface->bNumEndpoints) JOM(4, "intf[%i]alt[%i] has no endpoints\n", bInterfaceNumber, i); -/*---------------------------------------------------------------------------*/ for (j = 0; j < interface->bNumEndpoints; j++) { ep = &alt->endpoint[j].desc; if (!ep) { @@ -3312,19 +3286,12 @@ static int easycap_usb_probe(struct usb_interface *intf, } } } -/*---------------------------------------------------------------------------*/ -/* - * PERFORM INITIALIZATION OF THE PROBED INTERFACE - */ -/*---------------------------------------------------------------------------*/ + + /* Perform initialization of the probed interface */ JOM(4, "initialization begins for interface %i\n", interface->bInterfaceNumber); switch (bInterfaceNumber) { -/*---------------------------------------------------------------------------*/ -/* - * INTERFACE 0 IS THE VIDEO INTERFACE - */ -/*---------------------------------------------------------------------------*/ + /* 0: Video interface */ case 0: { if (!peasycap) { SAM("MISTAKE: peasycap is NULL\n"); @@ -3337,11 +3304,8 @@ static int easycap_usb_probe(struct usb_interface *intf, peasycap->video_altsetting_on = okalt[isokalt - 1]; JOM(4, "%i=video_altsetting_on <====\n", peasycap->video_altsetting_on); -/*---------------------------------------------------------------------------*/ -/* - * DECIDE THE VIDEO STREAMING PARAMETERS - */ -/*---------------------------------------------------------------------------*/ + + /* Decide video streaming parameters */ peasycap->video_endpointnumber = okepn[isokalt - 1]; JOM(4, "%i=video_endpointnumber\n", peasycap->video_endpointnumber); maxpacketsize = okmps[isokalt - 1]; @@ -3373,7 +3337,6 @@ static int easycap_usb_probe(struct usb_interface *intf, SAM("MISTAKE: peasycap->video_isoc_buffer_size too big\n"); return -EFAULT; } -/*---------------------------------------------------------------------------*/ if (-1 == peasycap->video_interface) { SAM("MISTAKE: video_interface is unset\n"); return -EFAULT; @@ -3398,14 +3361,13 @@ static int easycap_usb_probe(struct usb_interface *intf, SAM("MISTAKE: video_isoc_buffer_size is unset\n"); return -EFAULT; } -/*---------------------------------------------------------------------------*/ -/* - * ALLOCATE MEMORY FOR VIDEO BUFFERS. LISTS MUST BE INITIALIZED FIRST. - */ -/*---------------------------------------------------------------------------*/ + + /* + * Allocate memory for video buffers. + * Lists must be initialized first. + */ INIT_LIST_HEAD(&(peasycap->urb_video_head)); peasycap->purb_video_head = &(peasycap->urb_video_head); -/*---------------------------------------------------------------------------*/ JOM(4, "allocating %i frame buffers of size %li\n", FRAME_BUFFER_MANY, (long int)FRAME_BUFFER_SIZE); JOM(4, ".... each scattered over %li pages\n", @@ -3436,7 +3398,6 @@ static int easycap_usb_probe(struct usb_interface *intf, peasycap->frame_read = 0; JOM(4, "allocation of frame buffers done: %i pages\n", k * m); -/*---------------------------------------------------------------------------*/ JOM(4, "allocating %i field buffers of size %li\n", FIELD_BUFFER_MANY, (long int)FIELD_BUFFER_SIZE); JOM(4, ".... each scattered over %li pages\n", @@ -3468,7 +3429,6 @@ static int easycap_usb_probe(struct usb_interface *intf, peasycap->field_read = 0; JOM(4, "allocation of field buffers done: %i pages\n", k * m); -/*---------------------------------------------------------------------------*/ JOM(4, "allocating %i isoc video buffers of size %i\n", VIDEO_ISOC_BUFFER_MANY, peasycap->video_isoc_buffer_size); @@ -3492,11 +3452,8 @@ static int easycap_usb_probe(struct usb_interface *intf, } JOM(4, "allocation of isoc video buffers done: %i pages\n", k * (0x01 << VIDEO_ISOC_ORDER)); -/*---------------------------------------------------------------------------*/ -/* - * ALLOCATE AND INITIALIZE MULTIPLE struct urb ... - */ -/*---------------------------------------------------------------------------*/ + + /* Allocate and initialize multiple struct usb */ JOM(4, "allocating %i struct urb.\n", VIDEO_ISOC_BUFFER_MANY); JOM(4, "using %i=peasycap->video_isoc_framesperdesc\n", peasycap->video_isoc_framesperdesc); @@ -3515,7 +3472,6 @@ static int easycap_usb_probe(struct usb_interface *intf, } peasycap->allocation_video_urb += 1; -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ pdata_urb = kzalloc(sizeof(struct data_urb), GFP_KERNEL); if (!pdata_urb) { SAM("ERROR: Could not allocate struct data_urb.\n"); @@ -3530,11 +3486,8 @@ static int easycap_usb_probe(struct usb_interface *intf, pdata_urb->length = 0; list_add_tail(&(pdata_urb->list_head), peasycap->purb_video_head); -/*---------------------------------------------------------------------------*/ -/* - * ... AND INITIALIZE THEM - */ -/*---------------------------------------------------------------------------*/ + + /* Initialize allocated urbs */ if (!k) { JOM(4, "initializing video urbs thus:\n"); JOM(4, " purb->interval = 1;\n"); @@ -3582,20 +3535,16 @@ static int easycap_usb_probe(struct usb_interface *intf, } } JOM(4, "allocation of %i struct urb done.\n", k); -/*--------------------------------------------------------------------------*/ -/* - * SAVE POINTER peasycap IN THIS INTERFACE. - */ -/*--------------------------------------------------------------------------*/ + + /* Save pointer peasycap in this interface */ usb_set_intfdata(intf, peasycap); -/*---------------------------------------------------------------------------*/ -/* - * IT IS ESSENTIAL TO INITIALIZE THE HARDWARE BEFORE, RATHER THAN AFTER, - * THE DEVICE IS REGISTERED, BECAUSE SOME VERSIONS OF THE videodev MODULE - * CALL easycap_open() IMMEDIATELY AFTER REGISTRATION, CAUSING A CLASH. - * BEWARE. -*/ -/*---------------------------------------------------------------------------*/ + + /* + * It is essential to initialize the hardware before, + * rather than after, the device is registered, + * because some udev rules triggers easycap_open() + * immediately after registration, causing a clash. + */ peasycap->ntsc = easycap_ntsc; JOM(8, "defaulting initially to %s\n", easycap_ntsc ? "NTSC" : "PAL"); @@ -3604,27 +3553,20 @@ static int easycap_usb_probe(struct usb_interface *intf, SAM("ERROR: reset() rc = %i\n", rc); return -EFAULT; } -/*--------------------------------------------------------------------------*/ -/* - * THE VIDEO DEVICE CAN BE REGISTERED NOW, AS IT IS READY. - */ -/*--------------------------------------------------------------------------*/ + + /* The video device can now be registered */ if (v4l2_device_register(&intf->dev, &peasycap->v4l2_device)) { SAM("v4l2_device_register() failed\n"); return -ENODEV; } JOM(4, "registered device instance: %s\n", peasycap->v4l2_device.name); -/*---------------------------------------------------------------------------*/ -/* - * FIXME - * - * - * THIS IS BELIEVED TO BE HARMLESS, BUT MAY WELL BE UNNECESSARY OR WRONG: -*/ -/*---------------------------------------------------------------------------*/ + + /* + * FIXME: This is believed to be harmless, + * but may well be unnecessary or wrong. + */ peasycap->video_device.v4l2_dev = NULL; -/*---------------------------------------------------------------------------*/ strcpy(&peasycap->video_device.name[0], "easycapdc60"); @@ -3648,28 +3590,19 @@ static int easycap_usb_probe(struct usb_interface *intf, break; } -/*--------------------------------------------------------------------------*/ -/* - * INTERFACE 1 IS THE AUDIO CONTROL INTERFACE - * INTERFACE 2 IS THE AUDIO STREAMING INTERFACE - */ -/*--------------------------------------------------------------------------*/ + /* 1: Audio control */ case 1: { if (!peasycap) { SAM("MISTAKE: peasycap is NULL\n"); return -EFAULT; } -/*--------------------------------------------------------------------------*/ -/* - * SAVE POINTER peasycap IN INTERFACE 1 - */ -/*--------------------------------------------------------------------------*/ + /* Save pointer peasycap in this interface */ usb_set_intfdata(intf, peasycap); JOM(4, "no initialization required for interface %i\n", interface->bInterfaceNumber); break; } -/*--------------------------------------------------------------------------*/ + /* 2: Audio streaming */ case 2: { if (!peasycap) { SAM("MISTAKE: peasycap is NULL\n"); @@ -3769,15 +3702,14 @@ static int easycap_usb_probe(struct usb_interface *intf, SAM("MISTAKE: audio_isoc_buffer_size is unset\n"); return -EFAULT; } -/*---------------------------------------------------------------------------*/ -/* - * ALLOCATE MEMORY FOR AUDIO BUFFERS. LISTS MUST BE INITIALIZED FIRST. - */ -/*---------------------------------------------------------------------------*/ + + /* + * Allocate memory for audio buffers. + * Lists must be initialized first. + */ INIT_LIST_HEAD(&(peasycap->urb_audio_head)); peasycap->purb_audio_head = &(peasycap->urb_audio_head); -/*---------------------------------------------------------------------------*/ JOM(4, "allocating %i isoc audio buffers of size %i\n", AUDIO_ISOC_BUFFER_MANY, peasycap->audio_isoc_buffer_size); @@ -3800,11 +3732,8 @@ |