提交 2bf2154c 编写于 作者: L Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (81 commits)
  [PATCH] USB: omninet: fix up debugging comments
  [PATCH] USB serial: add navman driver
  [PATCH] USB: Fix irda-usb use after use
  [PATCH] USB: rtl8150 small fix
  [PATCH] USB: ftdi_sio: add Icom ID1 USB product and vendor ids
  [PATCH] USB: cp2101: add new device IDs
  [PATCH] USB: fix check_ctrlrecip to allow control transfers in state ADDRESS
  [PATCH] USB: vicam.c: fix a NULL pointer dereference
  [PATCH] USB: ZC0301 driver bugfix
  [PATCH] USB: add support for Creativelabs Silvercrest USB keyboard
  [PATCH] USB: storage: new unusual_devs.h entry: Mitsumi 7in1 Card Reader
  [PATCH] USB: storage: unusual_devs.h entry 0420:0001
  [PATCH] USB: storage: another unusual_devs.h entry
  [PATCH] USB: storage: sandisk unusual_devices entry
  [PATCH] USB: fix initdata issue in isp116x-hcd
  [PATCH] USB: usbcore: usb_set_configuration oops (NULL ptr dereference)
  [PATCH] USB: usbcore: Don't assume a USB configuration includes any interfaces
  [PATCH] USB: ub 03 drop stall clearing
  [PATCH] USB: ub 02 remove diag
  [PATCH] USB: ub 01 remove first_open
  ...
......@@ -2813,6 +2813,8 @@ E: luca.risolia@studio.unibo.it
P: 1024D/FCE635A4 88E8 F32F 7244 68BA 3958 5D40 99DA 5D2A FCE6 35A4
D: V4L driver for W996[87]CF JPEG USB Dual Mode Camera Chips
D: V4L2 driver for SN9C10x PC Camera Controllers
D: V4L2 driver for ET61X151 and ET61X251 PC Camera Controllers
D: V4L2 driver for ZC0301 Image Processor and Control Chip
S: Via Liberta' 41/A
S: Osio Sotto, 24046, Bergamo
S: Italy
......
......@@ -176,6 +176,14 @@ Description: Force the application to unmap previously mapped buffer memory
1 = force memory unmapping (save memory)
Default: 0
-------------------------------------------------------------------------------
Name: frame_timeout
Type: uint array (min = 0, max = 64)
Syntax: <n[,...]>
Description: Timeout for a video frame in seconds. This parameter is
specific for each detected camera. This parameter can be
changed at runtime thanks to the /sys filesystem interface.
Default: 2
-------------------------------------------------------------------------------
Name: debug
Type: ushort
Syntax: <n>
......@@ -266,7 +274,7 @@ the V4L2 interface.
10. Notes for V4L2 application developers
========================================
=========================================
This driver follows the V4L2 API specifications. In particular, it enforces two
rules:
......
......@@ -196,6 +196,14 @@ Description: Force the application to unmap previously mapped buffer memory
1 = force memory unmapping (save memory)
Default: 0
-------------------------------------------------------------------------------
Name: frame_timeout
Type: uint array (min = 0, max = 64)
Syntax: <n[,...]>
Description: Timeout for a video frame in seconds. This parameter is
specific for each detected camera. This parameter can be
changed at runtime thanks to the /sys filesystem interface.
Default: 2
-------------------------------------------------------------------------------
Name: debug
Type: ushort
Syntax: <n>
......@@ -321,6 +329,7 @@ Vendor ID Product ID
--------- ----------
0x0c45 0x6001
0x0c45 0x6005
0x0c45 0x6007
0x0c45 0x6009
0x0c45 0x600d
0x0c45 0x6024
......@@ -370,6 +379,7 @@ HV7131D Hynix Semiconductor, Inc.
MI-0343 Micron Technology, Inc.
OV7630 OmniVision Technologies, Inc.
PAS106B PixArt Imaging, Inc.
PAS202BCA PixArt Imaging, Inc.
PAS202BCB PixArt Imaging, Inc.
TAS5110C1B Taiwan Advanced Sensor Corporation
TAS5130D1B Taiwan Advanced Sensor Corporation
......@@ -493,6 +503,7 @@ Many thanks to following persons for their contribute (listed in alphabetical
order):
- Luca Capello for the donation of a webcam;
- Philippe Coval for having helped testing the PAS202BCA image sensor;
- Joao Rodrigo Fuzaro, Joao Limirio, Claudio Filho and Caio Begotti for the
donation of a webcam;
- Jon Hollstrom for the donation of a webcam;
......
ZC0301 Image Processor and Control Chip
Driver for Linux
=======================================
- Documentation -
Index
=====
1. Copyright
2. Disclaimer
3. License
4. Overview and features
5. Module dependencies
6. Module loading
7. Module parameters
8. Supported devices
9. Notes for V4L2 application developers
10. Contact information
11. Credits
1. Copyright
============
Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it>
2. Disclaimer
=============
This software is not developed or sponsored by Z-Star Microelectronics Corp.
Trademarks are property of their respective owner.
3. License
==========
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 Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
4. Overview and features
========================
This driver supports the video interface of the devices mounting the ZC0301
Image Processor and Control Chip.
The driver relies on the Video4Linux2 and USB core modules. It has been
designed to run properly on SMP systems as well.
The latest version of the ZC0301 driver can be found at the following URL:
http://www.linux-projects.org/
Some of the features of the driver are:
- full compliance with the Video4Linux2 API (see also "Notes for V4L2
application developers" paragraph);
- available mmap or read/poll methods for video streaming through isochronous
data transfers;
- automatic detection of image sensor;
- video format is standard JPEG;
- dynamic driver control thanks to various module parameters (see "Module
parameters" paragraph);
- up to 64 cameras can be handled at the same time; they can be connected and
disconnected from the host many times without turning off the computer, if
the system supports hotplugging;
5. Module dependencies
======================
For it to work properly, the driver needs kernel support for Video4Linux and
USB.
The following options of the kernel configuration file must be enabled and
corresponding modules must be compiled:
# Multimedia devices
#
CONFIG_VIDEO_DEV=m
# USB support
#
CONFIG_USB=m
In addition, depending on the hardware being used, the modules below are
necessary:
# USB Host Controller Drivers
#
CONFIG_USB_EHCI_HCD=m
CONFIG_USB_UHCI_HCD=m
CONFIG_USB_OHCI_HCD=m
The ZC0301 controller also provides a built-in microphone interface. It is
supported by the USB Audio driver thanks to the ALSA API:
# Sound
#
CONFIG_SOUND=y
# Advanced Linux Sound Architecture
#
CONFIG_SND=m
# USB devices
#
CONFIG_SND_USB_AUDIO=m
And finally:
# USB Multimedia devices
#
CONFIG_USB_ZC0301=m
6. Module loading
=================
To use the driver, it is necessary to load the "zc0301" module into memory
after every other module required: "videodev", "usbcore" and, depending on
the USB host controller you have, "ehci-hcd", "uhci-hcd" or "ohci-hcd".
Loading can be done as shown below:
[root@localhost home]# modprobe zc0301
At this point the devices should be recognized. You can invoke "dmesg" to
analyze kernel messages and verify that the loading process has gone well:
[user@localhost home]$ dmesg
7. Module parameters
====================
Module parameters are listed below:
-------------------------------------------------------------------------------
Name: video_nr
Type: short array (min = 0, max = 64)
Syntax: <-1|n[,...]>
Description: Specify V4L2 minor mode number:
-1 = use next available
n = use minor number n
You can specify up to 64 cameras this way.
For example:
video_nr=-1,2,-1 would assign minor number 2 to the second
registered camera and use auto for the first one and for every
other camera.
Default: -1
-------------------------------------------------------------------------------
Name: force_munmap
Type: bool array (min = 0, max = 64)
Syntax: <0|1[,...]>
Description: Force the application to unmap previously mapped buffer memory
before calling any VIDIOC_S_CROP or VIDIOC_S_FMT ioctl's. Not
all the applications support this feature. This parameter is
specific for each detected camera.
0 = do not force memory unmapping
1 = force memory unmapping (save memory)
Default: 0
-------------------------------------------------------------------------------
Name: frame_timeout
Type: uint array (min = 0, max = 64)
Syntax: <n[,...]>
Description: Timeout for a video frame in seconds. This parameter is
specific for each detected camera. This parameter can be
changed at runtime thanks to the /sys filesystem interface.
Default: 2
-------------------------------------------------------------------------------
Name: debug
Type: ushort
Syntax: <n>
Description: Debugging information level, from 0 to 3:
0 = none (use carefully)
1 = critical errors
2 = significant informations
3 = more verbose messages
Level 3 is useful for testing only, when only one device
is used at the same time. It also shows some more informations
about the hardware being detected. This module parameter can be
changed at runtime thanks to the /sys filesystem interface.
Default: 2
-------------------------------------------------------------------------------
8. Supported devices
====================
None of the names of the companies as well as their products will be mentioned
here. They have never collaborated with the author, so no advertising.
From the point of view of a driver, what unambiguously identify a device are
its vendor and product USB identifiers. Below is a list of known identifiers of
devices mounting the ZC0301 Image Processor and Control Chips:
Vendor ID Product ID
--------- ----------
0x041e 0x4017
0x041e 0x401c
0x041e 0x401e
0x041e 0x4034
0x041e 0x4035
0x046d 0x08ae
0x0ac8 0x0301
0x10fd 0x8050
The list above does not imply that all those devices work with this driver: up
until now only the ones that mount the following image sensors are supported;
kernel messages will always tell you whether this is the case:
Model Manufacturer
----- ------------
PAS202BCB PixArt Imaging, Inc.
9. Notes for V4L2 application developers
========================================
This driver follows the V4L2 API specifications. In particular, it enforces two
rules:
- exactly one I/O method, either "mmap" or "read", is associated with each
file descriptor. Once it is selected, the application must close and reopen the
device to switch to the other I/O method;
- although it is not mandatory, previously mapped buffer memory should always
be unmapped before calling any "VIDIOC_S_CROP" or "VIDIOC_S_FMT" ioctl's.
The same number of buffers as before will be allocated again to match the size
of the new video frames, so you have to map the buffers again before any I/O
attempts on them.
10. Contact information
=======================
The author may be contacted by e-mail at <luca.risolia@studio.unibo.it>.
GPG/PGP encrypted e-mail's are accepted. The GPG key ID of the author is
'FCE635A4'; the public 1024-bit key should be available at any keyserver;
the fingerprint is: '88E8 F32F 7244 68BA 3958 5D40 99DA 5D2A FCE6 35A4'.
11. Credits
===========
- Informations about the chip internals needed to enable the I2C protocol have
been taken from the documentation of the ZC030x Video4Linux1 driver written
by Andrew Birkett <andy@nobugs.org>;
- The initialization values of the ZC0301 controller connected to the PAS202BCB
image sensor have been taken from the SPCA5XX driver maintained by
Michel Xhaard <mxhaard@magic.fr>.
......@@ -2896,6 +2896,14 @@ L: video4linux-list@redhat.com
W: http://www.linux-projects.org
S: Maintained
USB ZC0301 DRIVER
P: Luca Risolia
M: luca.risolia@studio.unibo.it
L: linux-usb-devel@lists.sourceforge.net
L: video4linux-list@redhat.com
W: http://www.linux-projects.org
S: Maintained
USB ZD1201 DRIVER
P: Jeroen Vreeken
M: pe1rxq@amsat.org
......
......@@ -38,7 +38,7 @@ struct cpu_spec cpu_specs[] = {
{ 0xffffffff, 0x02030204, "Au1100 BE", 0, 1 },
{ 0xffffffff, 0x03030200, "Au1550 AA", 0, 1 },
{ 0xffffffff, 0x04030200, "Au1200 AB", 0, 0 },
{ 0xffffffff, 0x04030201, "Au1200 AC", 0, 1 },
{ 0xffffffff, 0x04030201, "Au1200 AC", 1, 0 },
{ 0x00000000, 0x00000000, "Unknown Au1xxx", 1, 0 },
};
......
......@@ -20,7 +20,7 @@
static struct resource au1xxx_usb_ohci_resources[] = {
[0] = {
.start = USB_OHCI_BASE,
.end = USB_OHCI_BASE + USB_OHCI_LEN,
.end = USB_OHCI_BASE + USB_OHCI_LEN - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
......@@ -278,9 +278,7 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {
&au1100_lcd_device,
#endif
#ifdef CONFIG_SOC_AU1200
#if 0 /* fixme */
&au1xxx_usb_ehci_device,
#endif
&au1xxx_usb_gdt_device,
&au1xxx_usb_otg_device,
&au1200_lcd_device,
......
......@@ -8,7 +8,6 @@
* and is not licensed separately. See file COPYING for details.
*
* TODO (sorted by decreasing priority)
* -- Kill first_open (Al Viro fixed the block layer now)
* -- set readonly flag for CDs, set removable flag for CF readers
* -- do inquiry and verify we got a disk and not a tape (for LUN mismatch)
* -- special case some senses, e.g. 3a/0 -> no media present, reduce retries
......@@ -181,6 +180,7 @@ struct ub_dev;
#define UB_DIR_ILLEGAL2 2
#define UB_DIR_WRITE 3
/* P3 */
#define UB_DIR_CHAR(c) (((c)==UB_DIR_WRITE)? 'w': \
(((c)==UB_DIR_READ)? 'r': 'n'))
......@@ -196,24 +196,11 @@ enum ub_scsi_cmd_state {
UB_CMDST_DONE /* Final state */
};
static char *ub_scsi_cmd_stname[] = {
". ",
"Cmd",
"dat",
"c2s",
"sts",
"clr",
"crs",
"Sen",
"fin"
};
struct ub_scsi_cmd {
unsigned char cdb[UB_MAX_CDB_SIZE];
unsigned char cdb_len;
unsigned char dir; /* 0 - none, 1 - read, 3 - write. */
unsigned char trace_index;
enum ub_scsi_cmd_state state;
unsigned int tag;
struct ub_scsi_cmd *next;
......@@ -249,28 +236,6 @@ struct ub_capacity {
unsigned int bshift; /* Shift between 512 and hard sects */
};
/*
* The SCSI command tracing structure.
*/
#define SCMD_ST_HIST_SZ 8
#define SCMD_TRACE_SZ 63 /* Less than 4KB of 61-byte lines */
struct ub_scsi_cmd_trace {
int hcur;
unsigned int tag;
unsigned int req_size, act_size;
unsigned char op;
unsigned char dir;
unsigned char key, asc, ascq;
char st_hst[SCMD_ST_HIST_SZ];
};
struct ub_scsi_trace {
int cur;
struct ub_scsi_cmd_trace vec[SCMD_TRACE_SZ];
};
/*
* This is a direct take-off from linux/include/completion.h
* The difference is that I do not wait on this thing, just poll.
......@@ -334,7 +299,6 @@ struct ub_lun {
int changed; /* Media was changed */
int removable;
int readonly;
int first_open; /* Kludge. See ub_bd_open. */
struct ub_request urq;
......@@ -390,7 +354,6 @@ struct ub_dev {
wait_queue_head_t reset_wait;
int sg_stat[6];
struct ub_scsi_trace tr;
};
/*
......@@ -459,137 +422,6 @@ static int ub_qlock_next = 0;
static DEFINE_SPINLOCK(ub_lock); /* Locks globals and ->openc */
/*
* The SCSI command tracing procedures.
*/
static void ub_cmdtr_new(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
{
int n;
struct ub_scsi_cmd_trace *t;
if ((n = sc->tr.cur + 1) == SCMD_TRACE_SZ) n = 0;
t = &sc->tr.vec[n];
memset(t, 0, sizeof(struct ub_scsi_cmd_trace));
t->tag = cmd->tag;
t->op = cmd->cdb[0];
t->dir = cmd->dir;
t->req_size = cmd->len;
t->st_hst[0] = cmd->state;
sc->tr.cur = n;
cmd->trace_index = n;
}
static void ub_cmdtr_state(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
{
int n;
struct ub_scsi_cmd_trace *t;
t = &sc->tr.vec[cmd->trace_index];
if (t->tag == cmd->tag) {
if ((n = t->hcur + 1) == SCMD_ST_HIST_SZ) n = 0;
t->st_hst[n] = cmd->state;
t->hcur = n;
}
}
static void ub_cmdtr_act_len(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
{
struct ub_scsi_cmd_trace *t;
t = &sc->tr.vec[cmd->trace_index];
if (t->tag == cmd->tag)
t->act_size = cmd->act_len;
}
static void ub_cmdtr_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd,
unsigned char *sense)
{
struct ub_scsi_cmd_trace *t;
t = &sc->tr.vec[cmd->trace_index];
if (t->tag == cmd->tag) {
t->key = sense[2] & 0x0F;
t->asc = sense[12];
t->ascq = sense[13];
}
}
static ssize_t ub_diag_show(struct device *dev, struct device_attribute *attr,
char *page)
{
struct usb_interface *intf;
struct ub_dev *sc;
struct list_head *p;
struct ub_lun *lun;
int cnt;
unsigned long flags;
int nc, nh;
int i, j;
struct ub_scsi_cmd_trace *t;
intf = to_usb_interface(dev);
sc = usb_get_intfdata(intf);
if (sc == NULL)
return 0;
cnt = 0;
spin_lock_irqsave(sc->lock, flags);
cnt += sprintf(page + cnt,
"poison %d reset %d\n",
atomic_read(&sc->poison), sc->reset);
cnt += sprintf(page + cnt,
"qlen %d qmax %d\n",
sc->cmd_queue.qlen, sc->cmd_queue.qmax);
cnt += sprintf(page + cnt,
"sg %d %d %d %d %d .. %d\n",
sc->sg_stat[0],
sc->sg_stat[1],
sc->sg_stat[2],
sc->sg_stat[3],
sc->sg_stat[4],
sc->sg_stat[5]);
list_for_each (p, &sc->luns) {
lun = list_entry(p, struct ub_lun, link);
cnt += sprintf(page + cnt,
"lun %u changed %d removable %d readonly %d\n",
lun->num, lun->changed, lun->removable, lun->readonly);
}
if ((nc = sc->tr.cur + 1) == SCMD_TRACE_SZ) nc = 0;
for (j = 0; j < SCMD_TRACE_SZ; j++) {
t = &sc->tr.vec[nc];
cnt += sprintf(page + cnt, "%08x %02x", t->tag, t->op);
if (t->op == REQUEST_SENSE) {
cnt += sprintf(page + cnt, " [sense %x %02x %02x]",
t->key, t->asc, t->ascq);
} else {
cnt += sprintf(page + cnt, " %c", UB_DIR_CHAR(t->dir));
cnt += sprintf(page + cnt, " [%5d %5d]",
t->req_size, t->act_size);
}
if ((nh = t->hcur + 1) == SCMD_ST_HIST_SZ) nh = 0;
for (i = 0; i < SCMD_ST_HIST_SZ; i++) {
cnt += sprintf(page + cnt, " %s",
ub_scsi_cmd_stname[(int)t->st_hst[nh]]);
if (++nh == SCMD_ST_HIST_SZ) nh = 0;
}
cnt += sprintf(page + cnt, "\n");
if (++nc == SCMD_TRACE_SZ) nc = 0;
}
spin_unlock_irqrestore(sc->lock, flags);
return cnt;
}
static DEVICE_ATTR(diag, S_IRUGO, ub_diag_show, NULL); /* N.B. World readable */
/*
* The id allocator.
*
......@@ -1092,7 +924,6 @@ static int ub_scsi_cmd_start(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
add_timer(&sc->work_timer);
cmd->state = UB_CMDST_CMD;
ub_cmdtr_state(sc, cmd);
return 0;
}
......@@ -1145,12 +976,10 @@ static void ub_scsi_dispatch(struct ub_dev *sc)
ub_cmdq_pop(sc);
(*cmd->done)(sc, cmd);
} else if (cmd->state == UB_CMDST_INIT) {
ub_cmdtr_new(sc, cmd);
if ((rc = ub_scsi_cmd_start(sc, cmd)) == 0)
break;
cmd->error = rc;
cmd->state = UB_CMDST_DONE;
ub_cmdtr_state(sc, cmd);
} else {
if (!ub_is_completed(&sc->work_done))
break;
......@@ -1247,7 +1076,6 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
return;
}
cmd->state = UB_CMDST_CLEAR;
ub_cmdtr_state(sc, cmd);
return;
case -ESHUTDOWN: /* unplug */
case -EILSEQ: /* unplug timeout on uhci */
......@@ -1279,7 +1107,6 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
return;
}
cmd->state = UB_CMDST_CLR2STS;
ub_cmdtr_state(sc, cmd);
return;
}
if (urb->status == -EOVERFLOW) {
......@@ -1304,7 +1131,6 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
if (urb->status != 0 ||
len != cmd->sgv[cmd->current_sg].length) {
cmd->act_len += len;
ub_cmdtr_act_len(sc, cmd);
cmd->error = -EIO;
ub_state_stat(sc, cmd);
......@@ -1331,7 +1157,6 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
}
cmd->act_len += urb->actual_length;
ub_cmdtr_act_len(sc, cmd);
if (++cmd->current_sg < cmd->nsg) {
ub_data_start(sc, cmd);
......@@ -1357,7 +1182,6 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
cmd->error = -EIO; /* A cheap trick... */
cmd->state = UB_CMDST_CLRRS;
ub_cmdtr_state(sc, cmd);
return;
}
......@@ -1441,7 +1265,6 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
return;
}
cmd->state = UB_CMDST_DONE;
ub_cmdtr_state(sc, cmd);
ub_cmdq_pop(sc);
(*cmd->done)(sc, cmd);
......@@ -1496,7 +1319,6 @@ static void ub_data_start(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
add_timer(&sc->work_timer);
cmd->state = UB_CMDST_DATA;
ub_cmdtr_state(sc, cmd);
}
/*
......@@ -1508,7 +1330,6 @@ static void ub_state_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd, int rc)
cmd->error = rc;
cmd->state = UB_CMDST_DONE;
ub_cmdtr_state(sc, cmd);
ub_cmdq_pop(sc);
(*cmd->done)(sc, cmd);
}
......@@ -1554,7 +1375,6 @@ static void ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
cmd->stat_count = 0;
cmd->state = UB_CMDST_STAT;
ub_cmdtr_state(sc, cmd);
}
/*
......@@ -1573,7 +1393,6 @@ static void ub_state_stat_counted(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
return;
cmd->state = UB_CMDST_STAT;
ub_cmdtr_state(sc, cmd);
}
/*
......@@ -1611,7 +1430,6 @@ static void ub_state_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
scmd->tag = sc->tagcnt++;
cmd->state = UB_CMDST_SENSE;
ub_cmdtr_state(sc, cmd);
ub_cmdq_insert(sc, scmd);
return;
......@@ -1667,11 +1485,6 @@ static void ub_top_sense_done(struct ub_dev *sc, struct ub_scsi_cmd *scmd)
unsigned char *sense = sc->top_sense;
struct ub_scsi_cmd *cmd;
/*
* Ignoring scmd->act_len, because the buffer was pre-zeroed.
*/
ub_cmdtr_sense(sc, scmd, sense);
/*
* Find the command which triggered the unit attention or a check,
* save the sense into it, and advance its state machine.
......@@ -1693,6 +1506,9 @@ static void ub_top_sense_done(struct ub_dev *sc, struct ub_scsi_cmd *scmd)
return;
}
/*
* Ignoring scmd->act_len, because the buffer was pre-zeroed.
*/
cmd->key = sense[2] & 0x0F;
cmd->asc = sense[12];
cmd->ascq = sense[13];
......@@ -1849,26 +1665,6 @@ static int ub_bd_open(struct inode *inode, struct file *filp)
sc->openc++;
spin_unlock_irqrestore(&ub_lock, flags);
/*
* This is a workaround for a specific problem in our block layer.
* In 2.6.9, register_disk duplicates the code from rescan_partitions.
* However, if we do add_disk with a device which persistently reports
* a changed media, add_disk calls register_disk, which does do_open,
* which will call rescan_paritions for changed media. After that,
* register_disk attempts to do it all again and causes double kobject
* registration and a eventually an oops on module removal.
*
* The bottom line is, Al Viro says that we should not allow
* bdev->bd_invalidated to be set when doing add_disk no matter what.
*/
if (lun->first_open) {
lun->first_open = 0;
if (lun->changed) {
rc = -ENOMEDIUM;
goto err_open;
}
}
if (lun->removable || lun->readonly)
check_disk_change(inode->i_bdev);
......@@ -2007,9 +1803,8 @@ static int ub_sync_tur(struct ub_dev *sc, struct ub_lun *lun)
init_completion(&compl);
rc = -ENOMEM;
if ((cmd = kmalloc(ALLOC_SIZE, GFP_KERNEL)) == NULL)
if ((cmd = kzalloc(ALLOC_SIZE, GFP_KERNEL)) == NULL)
goto err_alloc;
memset(cmd, 0, ALLOC_SIZE);
cmd->cdb[0] = TEST_UNIT_READY;
cmd->cdb_len = 6;
......@@ -2062,9 +1857,8 @@ static int ub_sync_read_cap(struct ub_dev *sc, struct ub_lun *lun,
init_completion(&compl);
rc = -ENOMEM;
if ((cmd = kmalloc(ALLOC_SIZE, GFP_KERNEL)) == NULL)
if ((cmd = kzalloc(ALLOC_SIZE, GFP_KERNEL)) == NULL)
goto err_alloc;
memset(cmd, 0, ALLOC_SIZE);
p = (char *)cmd + sizeof(struct ub_scsi_cmd);
cmd->cdb[0] = 0x25;
......@@ -2405,9 +2199,8 @@ static int ub_probe(struct usb_interface *intf,
return -ENXIO;
rc = -ENOMEM;
if ((sc = kmalloc(sizeof(struct ub_dev), GFP_KERNEL)) == NULL)
if ((sc = kzalloc(sizeof(struct ub_dev), GFP_KERNEL)) == NULL)
goto err_core;
memset(sc, 0, sizeof(struct ub_dev));
sc->lock = ub_next_lock();
INIT_LIST_HEAD(&sc->luns);
usb_init_urb(&sc->work_urb);
......@@ -2438,9 +2231,6 @@ static int ub_probe(struct usb_interface *intf,
if (ub_get_pipes(sc, sc->dev, intf) != 0)
goto err_dev_desc;
if (device_create_file(&sc->intf->dev, &dev_attr_diag) != 0)
goto err_diag;
/*
* At this point, all USB initialization is done, do upper layer.
* We really hate halfway initialized structures, so from the
......@@ -2480,19 +2270,8 @@ static int ub_probe(struct usb_interface *intf,
nluns = 1;
for (i = 0; i < 3; i++) {
if ((rc = ub_sync_getmaxlun(sc)) < 0) {
/*
* This segment is taken from usb-storage. They say
* that ZIP-100 needs this, but my own ZIP-100 works
* fine without this.
* Still, it does not seem to hurt anything.
*/
if (rc == -EPIPE) {
ub_probe_clear_stall(sc, sc->recv_bulk_pipe);
ub_probe_clear_stall(sc, sc->send_bulk_pipe);
}
if ((rc = ub_sync_getmaxlun(sc)) < 0)
break;
}
if (rc != 0) {
nluns = rc;
break;
......@@ -2505,8 +2284,6 @@ static int ub_probe(struct usb_interface *intf,
}
return 0;
/* device_remove_file(&sc->intf->dev, &dev_attr_diag); */
err_diag:
err_dev_desc:
usb_set_intfdata(intf, NULL);
// usb_put_intf(sc->intf);
......@@ -2524,9 +2301,8 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum)
int rc;
rc = -ENOMEM;
if ((lun = kmalloc(sizeof(struct ub_lun), GFP_KERNEL)) == NULL)
if ((lun = kzalloc(sizeof(struct ub_lun), GFP_KERNEL)) == NULL)
goto err_alloc;
memset(lun, 0, sizeof(struct ub_lun));
lun->num = lnum;
rc = -ENOSR;
......@@ -2541,7 +2317,6 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum)
lun->removable = 1; /* XXX Query this from the device */
lun->changed = 1; /* ub_revalidate clears only */
lun->first_open = 1;
ub_revalidate(sc, lun);
rc = -ENOMEM;
......@@ -2636,7 +2411,6 @@ static void ub_disconnect(struct usb_interface *intf)
while ((cmd = ub_cmdq_peek(sc)) != NULL) {
cmd->error = -ENOTCONN;
cmd->state = UB_CMDST_DONE;
ub_cmdtr_state(sc, cmd);
ub_cmdq_pop(sc);
(*cmd->done)(sc, cmd);
cnt++;
......@@ -2687,7 +2461,6 @@ static void ub_disconnect(struct usb_interface *intf)
* and no URBs left in transit.
*/
device_remove_file(&sc->intf->dev, &dev_attr_diag);
usb_set_intfdata(intf, NULL);
// usb_put_intf(sc->intf);
sc->intf = NULL;
......
......@@ -740,7 +740,7 @@ static void irda_usb_receive(struct urb *urb, struct pt_regs *regs)
struct sk_buff *newskb;
struct sk_buff *dataskb;
struct urb *next_urb;
int docopy;
unsigned int len, docopy;
IRDA_DEBUG(2, "%s(), len=%d\n", __FUNCTION__, urb->actual_length);
......@@ -851,10 +851,11 @@ static void irda_usb_receive(struct urb *urb, struct pt_regs *regs)
dataskb->dev = self->netdev;
dataskb->mac.raw = dataskb->data;
dataskb->protocol = htons(ETH_P_IRDA);
len = dataskb->len;
netif_rx(dataskb);
/* Keep stats up to date */
self->stats.rx_bytes += dataskb->len;
self->stats.rx_bytes += len;
self->stats.rx_packets++;
self->netdev->last_rx = jiffies;
......
......@@ -10,6 +10,7 @@ menu "USB support"
config USB_ARCH_HAS_HCD
boolean
default y if USB_ARCH_HAS_OHCI
default y if USB_ARCH_HAS_EHCI
default y if ARM # SL-811
default PCI
......@@ -22,6 +23,7 @@ config USB_ARCH_HAS_OHCI
default y if ARCH_LH7A404
default y if ARCH_S3C2410
default y if PXA27x
default y if ARCH_AT91RM9200
# PPC:
default y if STB03xxx
default y if PPC_MPC52xx
......@@ -30,6 +32,13 @@ config USB_ARCH_HAS_OHCI
# more:
default PCI
# some non-PCI hcds implement EHCI
config USB_ARCH_HAS_EHCI
boolean
default y if PPC_83xx
default y if SOC_AU1200
default PCI
# ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.
config USB
tristate "Support for Host-side USB"
......
......@@ -15,10 +15,9 @@ obj-$(CONFIG_USB_OHCI_HCD) += host/
obj-$(CONFIG_USB_UHCI_HCD) += host/
obj-$(CONFIG_USB_SL811_HCD) += host/
obj-$(CONFIG_ETRAX_USB_HOST) += host/
obj-$(CONFIG_USB_OHCI_AT91) += host/
obj-$(CONFIG_USB_ACM) += class/
obj-$(CONFIG_USB_AUDIO) += class/
obj-$(CONFIG_USB_MIDI) += class/
obj-$(CONFIG_USB_PRINTER) += class/
obj-$(CONFIG_USB_STORAGE) += storage/
......@@ -48,6 +47,7 @@ obj-$(CONFIG_USB_SN9C102) += media/
obj-$(CONFIG_USB_STV680) += media/
obj-$(CONFIG_USB_VICAM) += media/
obj-$(CONFIG_USB_W9968CF) += media/
obj-$(CONFIG_USB_ZC0301) += media/
obj-$(CONFIG_USB_CATC) += net/
obj-$(CONFIG_USB_KAWETH) += net/
......
......@@ -4,53 +4,6 @@
comment "USB Device Class drivers"
depends on USB
config OBSOLETE_OSS_USB_DRIVER
bool "Obsolete OSS USB drivers"
depends on USB && SOUND
help
This option enables support for the obsolete USB Audio and Midi
drivers that are scheduled for removal in the near future since
there are ALSA drivers for the same hardware.
Please contact Adrian Bunk <bunk@stusta.de> if you had to
say Y here because of missing support in the ALSA drivers.
If unsure, say N.
config USB_AUDIO
tristate "USB Audio support"
depends on USB && SOUND && OBSOLETE_OSS_USB_DRIVER
help
Say Y here if you want to connect USB audio equipment such as
speakers to your computer's USB port. You only need this if you use
the OSS sound driver; ALSA has its own option for usb audio support.
To compile this driver as a module, choose M here: the
module will be called audio.
config USB_MIDI
tristate "USB MIDI support"
depends on USB && SOUND && OBSOLETE_OSS_USB_DRIVER
---help---
Say Y here if you want to connect a USB MIDI device to your
computer's USB port. You only need this if you use the OSS
sound system; USB MIDI devices are supported by ALSA's USB
audio driver. This driver is for devices that comply with
'Universal Serial Bus Device Class Definition for MIDI Device'.
The following devices are known to work:
* Steinberg USB2MIDI
* Roland MPU64
* Roland PC-300
* Roland SC8850
* Roland UM-1
* Roland UM-2
* Roland UA-100
* Yamaha MU1000
To compile this driver as a module, choose M here: the
module will be called usb-midi.
config USB_ACM
tristate "USB Modem (CDC ACM) support"
depends on USB
......
......@@ -4,6 +4,4 @@
#
obj-$(CONFIG_USB_ACM) += cdc-acm.o
obj-$(CONFIG_USB_AUDIO) += audio.o
obj-$(CONFIG_USB_MIDI) += usb-midi.o
obj-$(CONFIG_USB_PRINTER) += usblp.o
此差异已折叠。
#define CS_AUDIO_UNDEFINED 0x20
#define CS_AUDIO_DEVICE 0x21
#define CS_AUDIO_CONFIGURATION 0x22
#define CS_AUDIO_STRING 0x23
#define CS_AUDIO_INTERFACE 0x24
#define CS_AUDIO_ENDPOINT 0x25
#define HEADER 0x01
#define INPUT_TERMINAL 0x02
#define OUTPUT_TERMINAL 0x03
#define MIXER_UNIT 0x04
#define SELECTOR_UNIT 0x05
#define FEATURE_UNIT 0x06
#define PROCESSING_UNIT 0x07
#define EXTENSION_UNIT 0x08
#define AS_GENERAL 0x01
#define FORMAT_TYPE 0x02
#define FORMAT_SPECIFIC 0x03
#define EP_GENERAL 0x01
#define MAX_CHAN 9
#define MAX_FREQ 16
#define MAX_IFACE 8
#define MAX_FORMAT 8
#define MAX_ALT 32 /* Sorry, we need quite a few for the Philips webcams */
struct usb_audio_terminal
{
u8 flags;
u8 assoc;
u16 type; /* Mic etc */
u8 channels;
u8 source;
u16 chancfg;
};
struct usb_audio_format
{
u8 type;
u8 channels;
u8 num_freq;
u8 sfz;
u8 bits;
u16 freq[MAX_FREQ];
};
struct usb_audio_interface
{
u8 terminal;
u8 delay;
u16 num_formats;
u16 format_type;
u8 flags;
u8 idleconf; /* Idle config */
#define AU_IFACE_FOUND 1
struct usb_audio_format format[MAX_FORMAT];
};
struct usb_audio_device
{
struct list_head list;
u8 mixer;
u8 selector;
void *irq_handle;
u8 num_channels;
u8 num_dsp_iface;
u8 channel_map[MAX_CHAN];
struct usb_audio_terminal terminal[MAX_CHAN];
struct usb_audio_interface interface[MAX_IFACE][MAX_ALT];
};
/* Audio Class specific Request Codes */
#define SET_CUR 0x01
#define GET_CUR 0x81
#define SET_MIN 0x02
#define GET_MIN 0x82
#define SET_MAX 0x03
#define GET_MAX 0x83
#define SET_RES 0x04
#define GET_RES 0x84
#define SET_MEM 0x05
#define GET_MEM 0x85
#define GET_STAT 0xff
/* Terminal Control Selectors */
#define COPY_PROTECT_CONTROL 0x01
/* Feature Unit Control Selectors */
#define MUTE_CONTROL 0x01
#define VOLUME_CONTROL 0x02
#define BASS_CONTROL 0x03
#define MID_CONTROL 0x04
#define TREBLE_CONTROL 0x05
#define GRAPHIC_EQUALIZER_CONTROL 0x06
#define AUTOMATIC_GAIN_CONTROL 0x07
#define DELAY_CONTROL 0x08
#define BASS_BOOST_CONTROL 0x09
#define LOUDNESS_CONTROL 0x0a
/* Endpoint Control Selectors */
#define SAMPLING_FREQ_CONTROL 0x01
#define PITCH_CONTROL 0x02
......@@ -60,6 +60,7 @@
#include <linux/tty_flip.h>
#include <linux/module.h>
#include <linux/smp_lock.h>
#include <linux/mutex.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
#include <linux/usb_cdc.h>
......@@ -80,7 +81,7 @@ static struct usb_driver acm_driver;
static struct tty_driver *acm_tty_driver;
static struct acm *acm_table[ACM_TTY_MINORS];
static DECLARE_MUTEX(open_sem);
static DEFINE_MUTEX(open_mutex);
#define ACM_READY(acm) (acm && acm->dev && acm->used)
......@@ -431,8 +432,8 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
int rv = -EINVAL;
int i;
dbg("Entering acm_tty_open.\n");
down(&open_sem);
mutex_lock(&open_mutex);
acm = acm_table[tty->index];
if (!acm || !acm->dev)
......@@ -474,14 +475,14 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
done:
err_out:
up(&open_sem);
mutex_unlock(&open_mutex);
return rv;
full_bailout:
usb_kill_urb(acm->ctrlurb);
bail_out:
acm->used--;
up(&open_sem);
mutex_unlock(&open_mutex);
return -EIO;
}
......@@ -507,7 +508,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
if (!acm || !acm->used)
return;
down(&open_sem);
mutex_lock(&open_mutex);
if (!--acm->used) {
if (acm->dev) {
acm_set_control(acm, acm->ctrlout = 0);
......@@ -518,7 +519,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
} else
acm_tty_unregister(acm);
}
up(&open_sem);
mutex_unlock(&open_mutex);
}
static int acm_tty_write(struct tty_struct *tty, const unsigned char *buf, int count)
......@@ -1013,9 +1014,9 @@ static void acm_disconnect(struct usb_interface *intf)
return;
}
down(&open_sem);
mutex_lock(&open_mutex);
if (!usb_get_intfdata(intf)) {
up(&open_sem);
mutex_unlock(&open_mutex);
return;
}
acm->dev = NULL;
......@@ -1045,11 +1046,11 @@ static void acm_disconnect(struct usb_interface *intf)
if (!acm->used) {
acm_tty_unregister(acm);
up(&open_sem);
mutex_unlock(&open_mutex);
return;
}
up(&open_sem);
mutex_unlock(&open_mutex);
if (acm->tty)
tty_hangup(acm->tty);
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册