From 32064c153f5cdbaeac2a930a344feb6a187cc7fa Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 11 Jul 2005 14:29:11 -0700 Subject: [PATCH] --- yaml --- r: 4629 b: refs/heads/master c: 63522f7fdb624adef20cb9d90c7effcd5b6301b2 h: refs/heads/master i: 4627: 8fb009a45cf3c7aaffeaaa773aa40c68eff8fdb4 v: v3 --- [refs] | 2 +- trunk/Documentation/kernel-parameters.txt | 3 - trunk/Documentation/usb/sn9c102.txt | 4 - trunk/Documentation/usb/usbmon.txt | 29 +- trunk/arch/ia64/hp/sim/simeth.c | 6 +- trunk/arch/ia64/hp/sim/simserial.c | 7 +- trunk/arch/ia64/kernel/entry.S | 2 +- trunk/arch/ia64/kernel/iosapic.c | 13 +- trunk/arch/ia64/kernel/irq_ia64.c | 15 +- trunk/arch/ia64/kernel/perfmon.c | 1 + trunk/arch/ia64/sn/kernel/tiocx.c | 1 + trunk/arch/ia64/sn/kernel/xpc_main.c | 16 +- trunk/arch/v850/lib/checksum.c | 3 +- trunk/drivers/usb/Makefile | 2 - trunk/drivers/usb/atm/cxacru.c | 2 +- trunk/drivers/usb/atm/speedtch.c | 63 +- trunk/drivers/usb/class/cdc-acm.c | 31 +- trunk/drivers/usb/core/buffer.c | 2 +- trunk/drivers/usb/core/hcd.c | 2 +- trunk/drivers/usb/core/hcd.h | 8 +- trunk/drivers/usb/core/hub.c | 40 +- trunk/drivers/usb/core/message.c | 2 +- trunk/drivers/usb/core/sysfs.c | 2 - trunk/drivers/usb/core/urb.c | 4 +- trunk/drivers/usb/core/usb.c | 5 +- trunk/drivers/usb/gadget/dummy_hcd.c | 9 +- trunk/drivers/usb/gadget/ether.c | 22 +- trunk/drivers/usb/gadget/goku_udc.c | 6 +- trunk/drivers/usb/gadget/lh7a40x_udc.c | 6 +- trunk/drivers/usb/gadget/net2280.c | 8 +- trunk/drivers/usb/gadget/omap_udc.c | 9 +- trunk/drivers/usb/gadget/pxa2xx_udc.c | 6 +- trunk/drivers/usb/gadget/zero.c | 8 +- trunk/drivers/usb/host/ehci-hcd.c | 2 +- trunk/drivers/usb/host/ehci-q.c | 2 +- trunk/drivers/usb/host/ehci-sched.c | 19 +- trunk/drivers/usb/host/hc_crisv10.c | 10 +- trunk/drivers/usb/host/isp116x-hcd.c | 20 +- trunk/drivers/usb/host/ohci-hcd.c | 6 +- trunk/drivers/usb/host/ohci-hub.c | 3 +- trunk/drivers/usb/host/ohci-mem.c | 4 +- trunk/drivers/usb/host/ohci-omap.c | 53 +- trunk/drivers/usb/host/sl811-hcd.c | 2 +- trunk/drivers/usb/host/uhci-q.c | 2 +- trunk/drivers/usb/input/Kconfig | 13 - trunk/drivers/usb/input/Makefile | 1 - trunk/drivers/usb/input/hid-core.c | 24 - trunk/drivers/usb/input/keyspan_remote.c | 633 --------------- trunk/drivers/usb/media/Makefile | 2 +- trunk/drivers/usb/media/sn9c102.h | 2 +- trunk/drivers/usb/media/sn9c102_core.c | 2 +- trunk/drivers/usb/media/sn9c102_ov7630.c | 394 --------- trunk/drivers/usb/media/sn9c102_sensor.h | 16 +- trunk/drivers/usb/media/sn9c102_tas5110c1b.c | 21 +- trunk/drivers/usb/media/sn9c102_tas5130d1b.c | 27 +- trunk/drivers/usb/misc/Kconfig | 10 - trunk/drivers/usb/misc/Makefile | 1 - trunk/drivers/usb/misc/ldusb.c | 794 ------------------- trunk/drivers/usb/mon/mon_text.c | 48 +- trunk/drivers/usb/net/kaweth.c | 4 +- trunk/drivers/usb/serial/ftdi_sio.c | 756 ++++++++++++++---- trunk/drivers/usb/storage/unusual_devs.h | 2 +- trunk/include/asm-ia64/hw_irq.h | 1 + trunk/include/asm-ia64/sn/xp.h | 1 + trunk/include/asm-sparc64/seccomp.h | 21 - trunk/include/asm-v850/checksum.h | 11 +- trunk/include/asm-v850/mmu.h | 17 +- trunk/include/linux/netlink.h | 1 + trunk/include/linux/usb.h | 8 +- trunk/include/linux/usb_cdc.h | 13 - trunk/include/linux/usb_gadget.h | 12 +- 71 files changed, 941 insertions(+), 2356 deletions(-) delete mode 100644 trunk/drivers/usb/input/keyspan_remote.c delete mode 100644 trunk/drivers/usb/media/sn9c102_ov7630.c delete mode 100644 trunk/drivers/usb/misc/ldusb.c delete mode 100644 trunk/include/asm-sparc64/seccomp.h diff --git a/[refs] b/[refs] index 0398787fcf27..8641fd39ee42 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2824bd250f0be1551747cc3ed5ae07facc285b57 +refs/heads/master: 63522f7fdb624adef20cb9d90c7effcd5b6301b2 diff --git a/trunk/Documentation/kernel-parameters.txt b/trunk/Documentation/kernel-parameters.txt index 753db6d8b745..4ec75c06bca4 100644 --- a/trunk/Documentation/kernel-parameters.txt +++ b/trunk/Documentation/kernel-parameters.txt @@ -758,9 +758,6 @@ running once the system is up. maxcpus= [SMP] Maximum number of processors that an SMP kernel should make use of - max_addr=[KMG] [KNL,BOOT,ia64] All physical memory greater than or - equal to this physical address is ignored. - max_luns= [SCSI] Maximum number of LUNs to probe Should be between 1 and 2^32-1. diff --git a/trunk/Documentation/usb/sn9c102.txt b/trunk/Documentation/usb/sn9c102.txt index 3f8a119db31b..cf9a1187edce 100644 --- a/trunk/Documentation/usb/sn9c102.txt +++ b/trunk/Documentation/usb/sn9c102.txt @@ -297,7 +297,6 @@ Vendor ID Product ID 0x0c45 0x602a 0x0c45 0x602b 0x0c45 0x602c -0x0c45 0x602d 0x0c45 0x6030 0x0c45 0x6080 0x0c45 0x6082 @@ -334,7 +333,6 @@ Model Manufacturer ----- ------------ HV7131D Hynix Semiconductor, Inc. MI-0343 Micron Technology, Inc. -OV7630 OmniVision Technologies, Inc. PAS106B PixArt Imaging, Inc. PAS202BCB PixArt Imaging, Inc. TAS5110C1B Taiwan Advanced Sensor Corporation @@ -472,11 +470,9 @@ order): - Luca Capello for the donation of a webcam; - Joao Rodrigo Fuzaro, Joao Limirio, Claudio Filho and Caio Begotti for the donation of a webcam; -- Jon Hollstrom for the donation of a webcam; - Carlos Eduardo Medaglia Dyonisio, who added the support for the PAS202BCB image sensor; - Stefano Mozzi, who donated 45 EU; -- Andrew Pearce for the donation of a webcam; - Bertrik Sikken, who reverse-engineered and documented the Huffman compression algorithm used in the SN9C10x controllers and implemented the first decoder; - Mizuno Takafumi for the donation of a webcam; diff --git a/trunk/Documentation/usb/usbmon.txt b/trunk/Documentation/usb/usbmon.txt index f1896ee3bb2a..2f8431f92b77 100644 --- a/trunk/Documentation/usb/usbmon.txt +++ b/trunk/Documentation/usb/usbmon.txt @@ -101,13 +101,6 @@ Here is the list of words, from left to right: or 3 and 2 positions, correspondingly. - URB Status. This field makes no sense for submissions, but is present to help scripts with parsing. In error case, it contains the error code. - In case of a setup packet, it contains a Setup Tag. If scripts read a number - in this field, the proceed to read Data Length. Otherwise, they read - the setup packet before reading the Data Length. -- Setup packet, if present, consists of 5 words: one of each for bmRequestType, - bRequest, wValue, wIndex, wLength, as specified by the USB Specification 2.0. - These words are safe to decode if Setup Tag was 's'. Otherwise, the setup - packet was present, but not captured, and the fields contain filler. - Data Length. This is the actual length in the URB. - Data tag. The usbmon may not always capture data, even if length is nonzero. Only if tag is '=', the data words are present. @@ -132,31 +125,25 @@ class ParsedLine { String data_str = st.nextToken(); int len = data_str.length() / 2; int i; - int b; // byte is signed, apparently?! XXX for (i = 0; i < len; i++) { - // data[data_len] = Byte.parseByte( - // data_str.substring(i*2, i*2 + 2), - // 16); - b = Integer.parseInt( - data_str.substring(i*2, i*2 + 2), - 16); - if (b >= 128) - b *= -1; - data[data_len] = (byte) b; + data[data_len] = Byte.parseByte( + data_str.substring(i*2, i*2 + 2), + 16); data_len++; } } } } -This format may be changed in the future. +This format is obviously deficient. For example, the setup packet for control +transfers is not delivered. This will change in the future. Examples: -An input control transfer to get a port status. +An input control transfer to get a port status: -d5ea89a0 3575914555 S Ci:001:00 s a3 00 0000 0003 0004 4 < -d5ea89a0 3575914560 C Ci:001:00 0 4 = 01050000 +d74ff9a0 2640288196 S Ci:001:00 -115 4 < +d74ff9a0 2640288202 C Ci:001:00 0 4 = 01010100 An output bulk transfer to send a SCSI command 0x5E in a 31-byte Bulk wrapper to a storage device at address 5: diff --git a/trunk/arch/ia64/hp/sim/simeth.c b/trunk/arch/ia64/hp/sim/simeth.c index 0639ec0ed015..ae84a1018a89 100644 --- a/trunk/arch/ia64/hp/sim/simeth.c +++ b/trunk/arch/ia64/hp/sim/simeth.c @@ -191,7 +191,7 @@ simeth_probe1(void) unsigned char mac_addr[ETH_ALEN]; struct simeth_local *local; struct net_device *dev; - int fd, i, err, rc; + int fd, i, err; /* * XXX Fix me @@ -228,9 +228,7 @@ simeth_probe1(void) return err; } - if ((rc = assign_irq_vector(AUTO_ASSIGN)) < 0) - panic("%s: out of interrupt vectors!\n", __FUNCTION__); - dev->irq = rc; + dev->irq = assign_irq_vector(AUTO_ASSIGN); /* * attach the interrupt in the simulator, this does enable interrupts diff --git a/trunk/arch/ia64/hp/sim/simserial.c b/trunk/arch/ia64/hp/sim/simserial.c index 7dcb8582ae0d..7a8ae0f4b387 100644 --- a/trunk/arch/ia64/hp/sim/simserial.c +++ b/trunk/arch/ia64/hp/sim/simserial.c @@ -982,7 +982,7 @@ static struct tty_operations hp_ops = { static int __init simrs_init (void) { - int i, rc; + int i; struct serial_state *state; if (!ia64_platform_is("hpsim")) @@ -1017,10 +1017,7 @@ simrs_init (void) if (state->type == PORT_UNKNOWN) continue; if (!state->irq) { - if ((rc = assign_irq_vector(AUTO_ASSIGN)) < 0) - panic("%s: out of interrupt vectors!\n", - __FUNCTION__); - state->irq = rc; + state->irq = assign_irq_vector(AUTO_ASSIGN); ia64_ssc_connect_irq(KEYBOARD_INTR, state->irq); } diff --git a/trunk/arch/ia64/kernel/entry.S b/trunk/arch/ia64/kernel/entry.S index bb9a506deb78..69f88d561d62 100644 --- a/trunk/arch/ia64/kernel/entry.S +++ b/trunk/arch/ia64/kernel/entry.S @@ -1249,7 +1249,7 @@ ENTRY(sys_rt_sigreturn) stf.spill [r17]=f11 adds out0=16,sp // out0 = &sigscratch br.call.sptk.many rp=ia64_rt_sigreturn -.ret19: .restore sp,0 +.ret19: .restore sp 0 adds sp=16,sp ;; ld8 r9=[sp] // load new ar.unat diff --git a/trunk/arch/ia64/kernel/iosapic.c b/trunk/arch/ia64/kernel/iosapic.c index 7936b62f7a2e..c170be095ccd 100644 --- a/trunk/arch/ia64/kernel/iosapic.c +++ b/trunk/arch/ia64/kernel/iosapic.c @@ -489,6 +489,8 @@ static int iosapic_find_sharable_vector (unsigned long trigger, unsigned long po } } } + if (vector < 0) + panic("%s: out of interrupt vectors!\n", __FUNCTION__); return vector; } @@ -504,8 +506,6 @@ iosapic_reassign_vector (int vector) if (!list_empty(&iosapic_intr_info[vector].rtes)) { new_vector = assign_irq_vector(AUTO_ASSIGN); - if (new_vector < 0) - panic("%s: out of interrupt vectors!\n", __FUNCTION__); printk(KERN_INFO "Reassigning vector %d to %d\n", vector, new_vector); memcpy(&iosapic_intr_info[new_vector], &iosapic_intr_info[vector], sizeof(struct iosapic_intr_info)); @@ -734,12 +734,9 @@ iosapic_register_intr (unsigned int gsi, spin_unlock_irqrestore(&iosapic_lock, flags); /* If vector is running out, we try to find a sharable vector */ - vector = assign_irq_vector(AUTO_ASSIGN); - if (vector < 0) { + vector = assign_irq_vector_nopanic(AUTO_ASSIGN); + if (vector < 0) vector = iosapic_find_sharable_vector(trigger, polarity); - if (vector < 0) - panic("%s: out of interrupt vectors!\n", __FUNCTION__); - } spin_lock_irqsave(&irq_descp(vector)->lock, flags); spin_lock(&iosapic_lock); @@ -887,8 +884,6 @@ iosapic_register_platform_intr (u32 int_type, unsigned int gsi, break; case ACPI_INTERRUPT_INIT: vector = assign_irq_vector(AUTO_ASSIGN); - if (vector < 0) - panic("%s: out of interrupt vectors!\n", __FUNCTION__); delivery = IOSAPIC_INIT; break; case ACPI_INTERRUPT_CPEI: diff --git a/trunk/arch/ia64/kernel/irq_ia64.c b/trunk/arch/ia64/kernel/irq_ia64.c index 6c4d59fd0364..4fe60c7a2e90 100644 --- a/trunk/arch/ia64/kernel/irq_ia64.c +++ b/trunk/arch/ia64/kernel/irq_ia64.c @@ -63,19 +63,30 @@ EXPORT_SYMBOL(isa_irq_to_vector_map); static unsigned long ia64_vector_mask[BITS_TO_LONGS(IA64_NUM_DEVICE_VECTORS)]; int -assign_irq_vector (int irq) +assign_irq_vector_nopanic (int irq) { int pos, vector; again: pos = find_first_zero_bit(ia64_vector_mask, IA64_NUM_DEVICE_VECTORS); vector = IA64_FIRST_DEVICE_VECTOR + pos; if (vector > IA64_LAST_DEVICE_VECTOR) - return -ENOSPC; + return -1; if (test_and_set_bit(pos, ia64_vector_mask)) goto again; return vector; } +int +assign_irq_vector (int irq) +{ + int vector = assign_irq_vector_nopanic(irq); + + if (vector < 0) + panic("assign_irq_vector: out of interrupt vectors!"); + + return vector; +} + void free_irq_vector (int vector) { diff --git a/trunk/arch/ia64/kernel/perfmon.c b/trunk/arch/ia64/kernel/perfmon.c index b8ebb8e427ef..6407bff6bfd7 100644 --- a/trunk/arch/ia64/kernel/perfmon.c +++ b/trunk/arch/ia64/kernel/perfmon.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include diff --git a/trunk/arch/ia64/sn/kernel/tiocx.c b/trunk/arch/ia64/sn/kernel/tiocx.c index 254fe15c064b..c1cbcd1a1398 100644 --- a/trunk/arch/ia64/sn/kernel/tiocx.c +++ b/trunk/arch/ia64/sn/kernel/tiocx.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include diff --git a/trunk/arch/ia64/sn/kernel/xpc_main.c b/trunk/arch/ia64/sn/kernel/xpc_main.c index d580adcad927..177ddb748ebe 100644 --- a/trunk/arch/ia64/sn/kernel/xpc_main.c +++ b/trunk/arch/ia64/sn/kernel/xpc_main.c @@ -53,7 +53,6 @@ #include #include #include -#include #include #include #include @@ -309,7 +308,8 @@ xpc_make_first_contact(struct xpc_partition *part) "partition %d\n", XPC_PARTID(part)); /* wait a 1/4 of a second or so */ - msleep_interruptible(250); + set_current_state(TASK_INTERRUPTIBLE); + (void) schedule_timeout(0.25 * HZ); if (part->act_state == XPC_P_DEACTIVATING) { return part->reason; @@ -841,7 +841,9 @@ xpc_do_exit(void) down(&xpc_discovery_exited); - msleep_interruptible(300); + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(0.3 * HZ); + set_current_state(TASK_RUNNING); /* wait for all partitions to become inactive */ @@ -858,8 +860,12 @@ xpc_do_exit(void) } } - if (active_part_count) - msleep_interruptible(300); + if (active_part_count) { + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(0.3 * HZ); + set_current_state(TASK_RUNNING); + } + } while (active_part_count > 0); diff --git a/trunk/arch/v850/lib/checksum.c b/trunk/arch/v850/lib/checksum.c index fa5872633075..d308b724c023 100644 --- a/trunk/arch/v850/lib/checksum.c +++ b/trunk/arch/v850/lib/checksum.c @@ -138,8 +138,7 @@ unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst, * Copy from userspace and compute checksum. If we catch an exception * then zero the rest of the buffer. */ -unsigned int csum_partial_copy_from_user (const unsigned char *src, - unsigned char *dst, +unsigned int csum_partial_copy_from_user (const unsigned char *src, unsigned char *dst, int len, unsigned int sum, int *err_ptr) { diff --git a/trunk/drivers/usb/Makefile b/trunk/drivers/usb/Makefile index df014c2a7c54..d79cd218a551 100644 --- a/trunk/drivers/usb/Makefile +++ b/trunk/drivers/usb/Makefile @@ -65,14 +65,12 @@ obj-$(CONFIG_USB_EMI26) += misc/ obj-$(CONFIG_USB_EMI62) += misc/ obj-$(CONFIG_USB_IDMOUSE) += misc/ obj-$(CONFIG_USB_LCD) += misc/ -obj-$(CONFIG_USB_LD) += misc/ obj-$(CONFIG_USB_LED) += misc/ obj-$(CONFIG_USB_LEGOTOWER) += misc/ obj-$(CONFIG_USB_RIO500) += misc/ obj-$(CONFIG_USB_TEST) += misc/ obj-$(CONFIG_USB_USS720) += misc/ obj-$(CONFIG_USB_PHIDGETSERVO) += misc/ -obj-$(CONFIG_USB_SISUSBVGA) += misc/ obj-$(CONFIG_USB_ATM) += atm/ obj-$(CONFIG_USB_SPEEDTOUCH) += atm/ diff --git a/trunk/drivers/usb/atm/cxacru.c b/trunk/drivers/usb/atm/cxacru.c index 8e184e2641cb..cbd4a7d25d0b 100644 --- a/trunk/drivers/usb/atm/cxacru.c +++ b/trunk/drivers/usb/atm/cxacru.c @@ -427,7 +427,7 @@ static void cxacru_poll_status(struct cxacru_data *instance) atm_dev->link_rate = buf[CXINF_DOWNSTREAM_RATE] * 1000 / 424; atm_dev->signal = ATM_PHY_SIG_FOUND; - dev_info(dev, "ADSL line: up (%d kb/s down | %d kb/s up)\n", + dev_info(dev, "ADSL line: up (%d Kib/s down | %d Kib/s up)\n", buf[CXINF_DOWNSTREAM_RATE], buf[CXINF_UPSTREAM_RATE]); break; diff --git a/trunk/drivers/usb/atm/speedtch.c b/trunk/drivers/usb/atm/speedtch.c index d0cbbb7f0385..6a6eaa2a3b1c 100644 --- a/trunk/drivers/usb/atm/speedtch.c +++ b/trunk/drivers/usb/atm/speedtch.c @@ -100,8 +100,6 @@ struct speedtch_instance_data { struct work_struct status_checker; - unsigned char last_status; - int poll_delay; /* milliseconds */ struct timer_list resubmit_timer; @@ -425,48 +423,52 @@ static void speedtch_check_status(struct speedtch_instance_data *instance) struct usbatm_data *usbatm = instance->usbatm; struct atm_dev *atm_dev = usbatm->atm_dev; unsigned char *buf = instance->scratch_buffer; - int down_speed, up_speed, ret; - unsigned char status; + int ret; atm_dbg(usbatm, "%s entered\n", __func__); ret = speedtch_read_status(instance); if (ret < 0) { atm_warn(usbatm, "error %d fetching device status\n", ret); - instance->poll_delay = min(2 * instance->poll_delay, MAX_POLL_DELAY); + if (instance->poll_delay < MAX_POLL_DELAY) + instance->poll_delay *= 2; return; } - instance->poll_delay = max(instance->poll_delay / 2, MIN_POLL_DELAY); + if (instance->poll_delay > MIN_POLL_DELAY) + instance->poll_delay /= 2; - status = buf[OFFSET_7]; + atm_dbg(usbatm, "%s: line state %02x\n", __func__, buf[OFFSET_7]); - atm_dbg(usbatm, "%s: line state %02x\n", __func__, status); - - if ((status != instance->last_status) || !status) { - switch (status) { - case 0: + switch (buf[OFFSET_7]) { + case 0: + if (atm_dev->signal != ATM_PHY_SIG_LOST) { atm_dev->signal = ATM_PHY_SIG_LOST; - if (instance->last_status) - atm_info(usbatm, "ADSL line is down\n"); - /* It may never resync again unless we ask it to... */ + atm_info(usbatm, "ADSL line is down\n"); + /* It'll never resync again unless we ask it to... */ ret = speedtch_start_synchro(instance); - break; + } + break; - case 0x08: + case 0x08: + if (atm_dev->signal != ATM_PHY_SIG_UNKNOWN) { atm_dev->signal = ATM_PHY_SIG_UNKNOWN; atm_info(usbatm, "ADSL line is blocked?\n"); - break; + } + break; - case 0x10: + case 0x10: + if (atm_dev->signal != ATM_PHY_SIG_LOST) { atm_dev->signal = ATM_PHY_SIG_LOST; atm_info(usbatm, "ADSL line is synchronising\n"); - break; + } + break; - case 0x20: - down_speed = buf[OFFSET_b] | (buf[OFFSET_b + 1] << 8) + case 0x20: + if (atm_dev->signal != ATM_PHY_SIG_FOUND) { + int down_speed = buf[OFFSET_b] | (buf[OFFSET_b + 1] << 8) | (buf[OFFSET_b + 2] << 16) | (buf[OFFSET_b + 3] << 24); - up_speed = buf[OFFSET_b + 4] | (buf[OFFSET_b + 5] << 8) + int up_speed = buf[OFFSET_b + 4] | (buf[OFFSET_b + 5] << 8) | (buf[OFFSET_b + 6] << 16) | (buf[OFFSET_b + 7] << 24); if (!(down_speed & 0x0000ffff) && !(up_speed & 0x0000ffff)) { @@ -478,17 +480,17 @@ static void speedtch_check_status(struct speedtch_instance_data *instance) atm_dev->signal = ATM_PHY_SIG_FOUND; atm_info(usbatm, - "ADSL line is up (%d kb/s down | %d kb/s up)\n", + "ADSL line is up (%d Kib/s down | %d Kib/s up)\n", down_speed, up_speed); - break; + } + break; - default: + default: + if (atm_dev->signal != ATM_PHY_SIG_UNKNOWN) { atm_dev->signal = ATM_PHY_SIG_UNKNOWN; - atm_info(usbatm, "Unknown line state %02x\n", status); - break; + atm_info(usbatm, "Unknown line state %02x\n", buf[OFFSET_7]); } - - instance->last_status = status; + break; } } @@ -728,7 +730,6 @@ static int speedtch_bind(struct usbatm_data *usbatm, instance->status_checker.timer.function = speedtch_status_poll; instance->status_checker.timer.data = (unsigned long)instance; - instance->last_status = 0xff; instance->poll_delay = MIN_POLL_DELAY; init_timer(&instance->resubmit_timer); diff --git a/trunk/drivers/usb/class/cdc-acm.c b/trunk/drivers/usb/class/cdc-acm.c index adff5a77e31f..69e859e0f51d 100644 --- a/trunk/drivers/usb/class/cdc-acm.c +++ b/trunk/drivers/usb/class/cdc-acm.c @@ -422,17 +422,6 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp) return -EIO; } -static void acm_tty_unregister(struct acm *acm) -{ - tty_unregister_device(acm_tty_driver, acm->minor); - usb_put_intf(acm->control); - acm_table[acm->minor] = NULL; - usb_free_urb(acm->ctrlurb); - usb_free_urb(acm->readurb); - usb_free_urb(acm->writeurb); - kfree(acm); -} - static void acm_tty_close(struct tty_struct *tty, struct file *filp) { struct acm *acm = tty->driver_data; @@ -447,8 +436,14 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp) usb_kill_urb(acm->ctrlurb); usb_kill_urb(acm->writeurb); usb_kill_urb(acm->readurb); - } else - acm_tty_unregister(acm); + } else { + tty_unregister_device(acm_tty_driver, acm->minor); + acm_table[acm->minor] = NULL; + usb_free_urb(acm->ctrlurb); + usb_free_urb(acm->readurb); + usb_free_urb(acm->writeurb); + kfree(acm); + } } up(&open_sem); } @@ -910,8 +905,7 @@ static int acm_probe (struct usb_interface *intf, usb_driver_claim_interface(&acm_driver, data_interface, acm); - usb_get_intf(control_interface); - tty_register_device(acm_tty_driver, minor, &control_interface->dev); + tty_register_device(acm_tty_driver, minor, &intf->dev); acm_table[minor] = acm; usb_set_intfdata (intf, acm); @@ -960,7 +954,12 @@ static void acm_disconnect(struct usb_interface *intf) usb_driver_release_interface(&acm_driver, acm->data); if (!acm->used) { - acm_tty_unregister(acm); + tty_unregister_device(acm_tty_driver, acm->minor); + acm_table[acm->minor] = NULL; + usb_free_urb(acm->ctrlurb); + usb_free_urb(acm->readurb); + usb_free_urb(acm->writeurb); + kfree(acm); up(&open_sem); return; } diff --git a/trunk/drivers/usb/core/buffer.c b/trunk/drivers/usb/core/buffer.c index fc15b4acc8af..b7827df21f48 100644 --- a/trunk/drivers/usb/core/buffer.c +++ b/trunk/drivers/usb/core/buffer.c @@ -106,7 +106,7 @@ void hcd_buffer_destroy (struct usb_hcd *hcd) void *hcd_buffer_alloc ( struct usb_bus *bus, size_t size, - unsigned mem_flags, + int mem_flags, dma_addr_t *dma ) { diff --git a/trunk/drivers/usb/core/hcd.c b/trunk/drivers/usb/core/hcd.c index 8616356f55e8..83e732a0d64a 100644 --- a/trunk/drivers/usb/core/hcd.c +++ b/trunk/drivers/usb/core/hcd.c @@ -1112,7 +1112,7 @@ static void urb_unlink (struct urb *urb) * expects usb_submit_urb() to have sanity checked and conditioned all * inputs in the urb */ -static int hcd_submit_urb (struct urb *urb, unsigned mem_flags) +static int hcd_submit_urb (struct urb *urb, int mem_flags) { int status; struct usb_hcd *hcd = urb->dev->bus->hcpriv; diff --git a/trunk/drivers/usb/core/hcd.h b/trunk/drivers/usb/core/hcd.h index 67db4a999b93..8dc13cde2f73 100644 --- a/trunk/drivers/usb/core/hcd.h +++ b/trunk/drivers/usb/core/hcd.h @@ -142,12 +142,12 @@ struct hcd_timeout { /* timeouts we allocate */ struct usb_operations { int (*get_frame_number) (struct usb_device *usb_dev); - int (*submit_urb) (struct urb *urb, unsigned mem_flags); + int (*submit_urb) (struct urb *urb, int mem_flags); int (*unlink_urb) (struct urb *urb, int status); /* allocate dma-consistent buffer for URB_DMA_NOMAPPING */ void *(*buffer_alloc)(struct usb_bus *bus, size_t size, - unsigned mem_flags, + int mem_flags, dma_addr_t *dma); void (*buffer_free)(struct usb_bus *bus, size_t size, void *addr, dma_addr_t dma); @@ -200,7 +200,7 @@ struct hc_driver { int (*urb_enqueue) (struct usb_hcd *hcd, struct usb_host_endpoint *ep, struct urb *urb, - unsigned mem_flags); + int mem_flags); int (*urb_dequeue) (struct usb_hcd *hcd, struct urb *urb); /* hw synch, freeing endpoint resources that urb_dequeue can't */ @@ -247,7 +247,7 @@ int hcd_buffer_create (struct usb_hcd *hcd); void hcd_buffer_destroy (struct usb_hcd *hcd); void *hcd_buffer_alloc (struct usb_bus *bus, size_t size, - unsigned mem_flags, dma_addr_t *dma); + int mem_flags, dma_addr_t *dma); void hcd_buffer_free (struct usb_bus *bus, size_t size, void *addr, dma_addr_t dma); diff --git a/trunk/drivers/usb/core/hub.c b/trunk/drivers/usb/core/hub.c index c3e46d24a37e..32ff32181852 100644 --- a/trunk/drivers/usb/core/hub.c +++ b/trunk/drivers/usb/core/hub.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -48,7 +47,8 @@ static LIST_HEAD(hub_event_list); /* List of hubs needing servicing */ /* Wakes up khubd */ static DECLARE_WAIT_QUEUE_HEAD(khubd_wait); -static struct task_struct *khubd_task; +static pid_t khubd_pid = 0; /* PID of khubd */ +static DECLARE_COMPLETION(khubd_exited); /* cycle leds on hubs that aren't blinking for attention */ static int blinkenlights = 0; @@ -2807,16 +2807,23 @@ static void hub_events(void) static int hub_thread(void *__unused) { + /* + * This thread doesn't need any user-level access, + * so get rid of all our resources + */ + + daemonize("khubd"); + allow_signal(SIGKILL); + + /* Send me a signal to get me die (for debugging) */ do { hub_events(); - wait_event_interruptible(khubd_wait, - !list_empty(&hub_event_list) || - kthread_should_stop()); + wait_event_interruptible(khubd_wait, !list_empty(&hub_event_list)); try_to_freeze(); - } while (!kthread_should_stop() || !list_empty(&hub_event_list)); + } while (!signal_pending(current)); - pr_debug("%s: khubd exiting\n", usbcore_name); - return 0; + pr_debug ("%s: khubd exiting\n", usbcore_name); + complete_and_exit(&khubd_exited, 0); } static struct usb_device_id hub_id_table [] = { @@ -2842,15 +2849,20 @@ static struct usb_driver hub_driver = { int usb_hub_init(void) { + pid_t pid; + if (usb_register(&hub_driver) < 0) { printk(KERN_ERR "%s: can't register hub driver\n", usbcore_name); return -1; } - khubd_task = kthread_run(hub_thread, NULL, "khubd"); - if (!IS_ERR(khubd_task)) + pid = kernel_thread(hub_thread, NULL, CLONE_KERNEL); + if (pid >= 0) { + khubd_pid = pid; + return 0; + } /* Fall through if kernel_thread failed */ usb_deregister(&hub_driver); @@ -2861,7 +2873,12 @@ int usb_hub_init(void) void usb_hub_cleanup(void) { - kthread_stop(khubd_task); + int ret; + + /* Kill the thread */ + ret = kill_proc(khubd_pid, SIGKILL, 1); + + wait_for_completion(&khubd_exited); /* * Hub resources are freed for us by usb_deregister. It calls @@ -2873,6 +2890,7 @@ void usb_hub_cleanup(void) usb_deregister(&hub_driver); } /* usb_hub_cleanup() */ + static int config_descriptors_changed(struct usb_device *udev) { unsigned index; diff --git a/trunk/drivers/usb/core/message.c b/trunk/drivers/usb/core/message.c index a428ef479bd7..f50aaf25c98e 100644 --- a/trunk/drivers/usb/core/message.c +++ b/trunk/drivers/usb/core/message.c @@ -320,7 +320,7 @@ int usb_sg_init ( struct scatterlist *sg, int nents, size_t length, - unsigned mem_flags + int mem_flags ) { int i; diff --git a/trunk/drivers/usb/core/sysfs.c b/trunk/drivers/usb/core/sysfs.c index 00297f113849..740cb4c668df 100644 --- a/trunk/drivers/usb/core/sysfs.c +++ b/trunk/drivers/usb/core/sysfs.c @@ -196,7 +196,6 @@ usb_descriptor_attr (bDeviceClass, "%02x\n") usb_descriptor_attr (bDeviceSubClass, "%02x\n") usb_descriptor_attr (bDeviceProtocol, "%02x\n") usb_descriptor_attr (bNumConfigurations, "%d\n") -usb_descriptor_attr (bMaxPacketSize0, "%d\n") static struct attribute *dev_attrs[] = { /* current configuration's attributes */ @@ -212,7 +211,6 @@ static struct attribute *dev_attrs[] = { &dev_attr_bDeviceSubClass.attr, &dev_attr_bDeviceProtocol.attr, &dev_attr_bNumConfigurations.attr, - &dev_attr_bMaxPacketSize0.attr, &dev_attr_speed.attr, &dev_attr_devnum.attr, &dev_attr_version.attr, diff --git a/trunk/drivers/usb/core/urb.c b/trunk/drivers/usb/core/urb.c index c0feee25ff0a..0faf18d511de 100644 --- a/trunk/drivers/usb/core/urb.c +++ b/trunk/drivers/usb/core/urb.c @@ -60,7 +60,7 @@ void usb_init_urb(struct urb *urb) * * The driver must call usb_free_urb() when it is finished with the urb. */ -struct urb *usb_alloc_urb(int iso_packets, unsigned mem_flags) +struct urb *usb_alloc_urb(int iso_packets, int mem_flags) { struct urb *urb; @@ -224,7 +224,7 @@ struct urb * usb_get_urb(struct urb *urb) * GFP_NOIO, unless b) or c) apply * */ -int usb_submit_urb(struct urb *urb, unsigned mem_flags) +int usb_submit_urb(struct urb *urb, int mem_flags) { int pipe, temp, max; struct usb_device *dev; diff --git a/trunk/drivers/usb/core/usb.c b/trunk/drivers/usb/core/usb.c index 99c85d2f92da..a3c42203213a 100644 --- a/trunk/drivers/usb/core/usb.c +++ b/trunk/drivers/usb/core/usb.c @@ -1129,7 +1129,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size, void *usb_buffer_alloc ( struct usb_device *dev, size_t size, - unsigned mem_flags, + int mem_flags, dma_addr_t *dma ) { @@ -1532,9 +1532,6 @@ EXPORT_SYMBOL(usb_register); EXPORT_SYMBOL(usb_deregister); EXPORT_SYMBOL(usb_disabled); -EXPORT_SYMBOL_GPL(usb_get_intf); -EXPORT_SYMBOL_GPL(usb_put_intf); - EXPORT_SYMBOL(usb_alloc_dev); EXPORT_SYMBOL(usb_put_dev); EXPORT_SYMBOL(usb_get_dev); diff --git a/trunk/drivers/usb/gadget/dummy_hcd.c b/trunk/drivers/usb/gadget/dummy_hcd.c index 583db7c38cf1..4d692670f288 100644 --- a/trunk/drivers/usb/gadget/dummy_hcd.c +++ b/trunk/drivers/usb/gadget/dummy_hcd.c @@ -470,7 +470,7 @@ static int dummy_disable (struct usb_ep *_ep) } static struct usb_request * -dummy_alloc_request (struct usb_ep *_ep, unsigned mem_flags) +dummy_alloc_request (struct usb_ep *_ep, int mem_flags) { struct dummy_ep *ep; struct dummy_request *req; @@ -507,7 +507,7 @@ dummy_alloc_buffer ( struct usb_ep *_ep, unsigned bytes, dma_addr_t *dma, - unsigned mem_flags + int mem_flags ) { char *retval; struct dummy_ep *ep; @@ -540,8 +540,7 @@ fifo_complete (struct usb_ep *ep, struct usb_request *req) } static int -dummy_queue (struct usb_ep *_ep, struct usb_request *_req, - unsigned mem_flags) +dummy_queue (struct usb_ep *_ep, struct usb_request *_req, int mem_flags) { struct dummy_ep *ep; struct dummy_request *req; @@ -999,7 +998,7 @@ static int dummy_urb_enqueue ( struct usb_hcd *hcd, struct usb_host_endpoint *ep, struct urb *urb, - unsigned mem_flags + int mem_flags ) { struct dummy *dum; struct urbp *urbp; diff --git a/trunk/drivers/usb/gadget/ether.c b/trunk/drivers/usb/gadget/ether.c index 8509e955007d..5bb53ae88969 100644 --- a/trunk/drivers/usb/gadget/ether.c +++ b/trunk/drivers/usb/gadget/ether.c @@ -945,16 +945,15 @@ config_buf (enum usb_device_speed speed, /*-------------------------------------------------------------------------*/ -static void eth_start (struct eth_dev *dev, unsigned gfp_flags); -static int alloc_requests (struct eth_dev *dev, unsigned n, unsigned gfp_flags); +static void eth_start (struct eth_dev *dev, int gfp_flags); +static int alloc_requests (struct eth_dev *dev, unsigned n, int gfp_flags); static int -set_ether_config (struct eth_dev *dev, unsigned gfp_flags) +set_ether_config (struct eth_dev *dev, int gfp_flags) { int result = 0; struct usb_gadget *gadget = dev->gadget; -#if defined(DEV_CONFIG_CDC) || defined(CONFIG_USB_ETH_RNDIS) /* status endpoint used for RNDIS and (optionally) CDC */ if (!subset_active(dev) && dev->status_ep) { dev->status = ep_desc (gadget, &hs_status_desc, @@ -968,7 +967,6 @@ set_ether_config (struct eth_dev *dev, unsigned gfp_flags) goto done; } } -#endif dev->in = ep_desc (dev->gadget, &hs_source_desc, &fs_source_desc); dev->in_ep->driver_data = dev; @@ -1081,7 +1079,7 @@ static void eth_reset_config (struct eth_dev *dev) * that returns config descriptors, and altsetting code. */ static int -eth_set_config (struct eth_dev *dev, unsigned number, unsigned gfp_flags) +eth_set_config (struct eth_dev *dev, unsigned number, int gfp_flags) { int result = 0; struct usb_gadget *gadget = dev->gadget; @@ -1598,7 +1596,7 @@ static void defer_kevent (struct eth_dev *dev, int flag) static void rx_complete (struct usb_ep *ep, struct usb_request *req); static int -rx_submit (struct eth_dev *dev, struct usb_request *req, unsigned gfp_flags) +rx_submit (struct eth_dev *dev, struct usb_request *req, int gfp_flags) { struct sk_buff *skb; int retval = -ENOMEM; @@ -1724,7 +1722,7 @@ static void rx_complete (struct usb_ep *ep, struct usb_request *req) } static int prealloc (struct list_head *list, struct usb_ep *ep, - unsigned n, unsigned gfp_flags) + unsigned n, int gfp_flags) { unsigned i; struct usb_request *req; @@ -1763,7 +1761,7 @@ static int prealloc (struct list_head *list, struct usb_ep *ep, return 0; } -static int alloc_requests (struct eth_dev *dev, unsigned n, unsigned gfp_flags) +static int alloc_requests (struct eth_dev *dev, unsigned n, int gfp_flags) { int status; @@ -1779,7 +1777,7 @@ static int alloc_requests (struct eth_dev *dev, unsigned n, unsigned gfp_flags) return status; } -static void rx_fill (struct eth_dev *dev, unsigned gfp_flags) +static void rx_fill (struct eth_dev *dev, int gfp_flags) { struct usb_request *req; unsigned long flags; @@ -2024,7 +2022,7 @@ static int rndis_control_ack (struct net_device *net) #endif /* RNDIS */ -static void eth_start (struct eth_dev *dev, unsigned gfp_flags) +static void eth_start (struct eth_dev *dev, int gfp_flags) { DEBUG (dev, "%s\n", __FUNCTION__); @@ -2430,7 +2428,7 @@ eth_bind (struct usb_gadget *gadget) dev->req->complete = eth_setup_complete; /* ... and maybe likewise for status transfer */ -#if defined(DEV_CONFIG_CDC) || defined(CONFIG_USB_ETH_RNDIS) +#ifdef DEV_CONFIG_CDC if (dev->status_ep) { dev->stat_req = eth_req_alloc (dev->status_ep, STATUS_BYTECOUNT, GFP_KERNEL); diff --git a/trunk/drivers/usb/gadget/goku_udc.c b/trunk/drivers/usb/gadget/goku_udc.c index eaab26f4ed37..ed773a9111de 100644 --- a/trunk/drivers/usb/gadget/goku_udc.c +++ b/trunk/drivers/usb/gadget/goku_udc.c @@ -269,7 +269,7 @@ static int goku_ep_disable(struct usb_ep *_ep) /*-------------------------------------------------------------------------*/ static struct usb_request * -goku_alloc_request(struct usb_ep *_ep, unsigned gfp_flags) +goku_alloc_request(struct usb_ep *_ep, int gfp_flags) { struct goku_request *req; @@ -327,7 +327,7 @@ goku_free_request(struct usb_ep *_ep, struct usb_request *_req) */ static void * goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes, - dma_addr_t *dma, unsigned gfp_flags) + dma_addr_t *dma, int gfp_flags) { void *retval; struct goku_ep *ep; @@ -789,7 +789,7 @@ static void abort_dma(struct goku_ep *ep, int status) /*-------------------------------------------------------------------------*/ static int -goku_queue(struct usb_ep *_ep, struct usb_request *_req, unsigned gfp_flags) +goku_queue(struct usb_ep *_ep, struct usb_request *_req, int gfp_flags) { struct goku_request *req; struct goku_ep *ep; diff --git a/trunk/drivers/usb/gadget/lh7a40x_udc.c b/trunk/drivers/usb/gadget/lh7a40x_udc.c index 4842577789c9..df75ab65a5ec 100644 --- a/trunk/drivers/usb/gadget/lh7a40x_udc.c +++ b/trunk/drivers/usb/gadget/lh7a40x_udc.c @@ -1106,7 +1106,7 @@ static int lh7a40x_ep_disable(struct usb_ep *_ep) } static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep, - unsigned gfp_flags) + int gfp_flags) { struct lh7a40x_request *req; @@ -1134,7 +1134,7 @@ static void lh7a40x_free_request(struct usb_ep *ep, struct usb_request *_req) } static void *lh7a40x_alloc_buffer(struct usb_ep *ep, unsigned bytes, - dma_addr_t * dma, unsigned gfp_flags) + dma_addr_t * dma, int gfp_flags) { char *retval; @@ -1158,7 +1158,7 @@ static void lh7a40x_free_buffer(struct usb_ep *ep, void *buf, dma_addr_t dma, * NOTE: Sets INDEX register */ static int lh7a40x_queue(struct usb_ep *_ep, struct usb_request *_req, - unsigned gfp_flags) + int gfp_flags) { struct lh7a40x_request *req; struct lh7a40x_ep *ep; diff --git a/trunk/drivers/usb/gadget/net2280.c b/trunk/drivers/usb/gadget/net2280.c index 477fab2e74d1..13a3dbc9949b 100644 --- a/trunk/drivers/usb/gadget/net2280.c +++ b/trunk/drivers/usb/gadget/net2280.c @@ -376,7 +376,7 @@ static int net2280_disable (struct usb_ep *_ep) /*-------------------------------------------------------------------------*/ static struct usb_request * -net2280_alloc_request (struct usb_ep *_ep, unsigned gfp_flags) +net2280_alloc_request (struct usb_ep *_ep, int gfp_flags) { struct net2280_ep *ep; struct net2280_request *req; @@ -463,7 +463,7 @@ net2280_alloc_buffer ( struct usb_ep *_ep, unsigned bytes, dma_addr_t *dma, - unsigned gfp_flags + int gfp_flags ) { void *retval; @@ -897,7 +897,7 @@ done (struct net2280_ep *ep, struct net2280_request *req, int status) /*-------------------------------------------------------------------------*/ static int -net2280_queue (struct usb_ep *_ep, struct usb_request *_req, unsigned gfp_flags) +net2280_queue (struct usb_ep *_ep, struct usb_request *_req, int gfp_flags) { struct net2280_request *req; struct net2280_ep *ep; @@ -1490,7 +1490,7 @@ show_registers (struct device *_dev, struct device_attribute *attr, char *buf) unsigned long flags; int i; u32 t1, t2; - const char *s; + char *s; dev = dev_get_drvdata (_dev); next = buf; diff --git a/trunk/drivers/usb/gadget/omap_udc.c b/trunk/drivers/usb/gadget/omap_udc.c index ff5533e69560..a2b812af6e66 100644 --- a/trunk/drivers/usb/gadget/omap_udc.c +++ b/trunk/drivers/usb/gadget/omap_udc.c @@ -269,7 +269,7 @@ static int omap_ep_disable(struct usb_ep *_ep) /*-------------------------------------------------------------------------*/ static struct usb_request * -omap_alloc_request(struct usb_ep *ep, unsigned gfp_flags) +omap_alloc_request(struct usb_ep *ep, int gfp_flags) { struct omap_req *req; @@ -298,7 +298,7 @@ omap_alloc_buffer( struct usb_ep *_ep, unsigned bytes, dma_addr_t *dma, - unsigned gfp_flags + int gfp_flags ) { void *retval; @@ -937,7 +937,7 @@ static void dma_channel_release(struct omap_ep *ep) /*-------------------------------------------------------------------------*/ static int -omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, unsigned gfp_flags) +omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, int gfp_flags) { struct omap_ep *ep = container_of(_ep, struct omap_ep, ep); struct omap_req *req = container_of(_req, struct omap_req, req); @@ -2908,7 +2908,6 @@ static int __exit omap_udc_remove(struct device *dev) * make host resumes and VBUS detection trigger OMAP wakeup events; that * may involve talking to an external transceiver (e.g. isp1301). */ - static int omap_udc_suspend(struct device *dev, pm_message_t message, u32 level) { u32 devstat; @@ -2937,6 +2936,8 @@ static int omap_udc_resume(struct device *dev, u32 level) return 0; DBG("resume + wakeup/SRP\n"); + udc->gadget.dev.parent->power.power_state = PMSG_ON; + udc->gadget.dev.power.power_state = PMSG_ON; omap_pullup(&udc->gadget, 1); /* maybe the host would enumerate us if we nudged it */ diff --git a/trunk/drivers/usb/gadget/pxa2xx_udc.c b/trunk/drivers/usb/gadget/pxa2xx_udc.c index 1507738337c4..6a0b957af335 100644 --- a/trunk/drivers/usb/gadget/pxa2xx_udc.c +++ b/trunk/drivers/usb/gadget/pxa2xx_udc.c @@ -332,7 +332,7 @@ static int pxa2xx_ep_disable (struct usb_ep *_ep) * pxa2xx_ep_alloc_request - allocate a request data structure */ static struct usb_request * -pxa2xx_ep_alloc_request (struct usb_ep *_ep, unsigned gfp_flags) +pxa2xx_ep_alloc_request (struct usb_ep *_ep, int gfp_flags) { struct pxa2xx_request *req; @@ -367,7 +367,7 @@ pxa2xx_ep_free_request (struct usb_ep *_ep, struct usb_request *_req) */ static void * pxa2xx_ep_alloc_buffer(struct usb_ep *_ep, unsigned bytes, - dma_addr_t *dma, unsigned gfp_flags) + dma_addr_t *dma, int gfp_flags) { char *retval; @@ -874,7 +874,7 @@ static void dma_nodesc_handler(int dmach, void *_ep, struct pt_regs *r) /*-------------------------------------------------------------------------*/ static int -pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, unsigned gfp_flags) +pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, int gfp_flags) { struct pxa2xx_request *req; struct pxa2xx_ep *ep; diff --git a/trunk/drivers/usb/gadget/zero.c b/trunk/drivers/usb/gadget/zero.c index bb9b2d94eed5..a6e035e24479 100644 --- a/trunk/drivers/usb/gadget/zero.c +++ b/trunk/drivers/usb/gadget/zero.c @@ -612,7 +612,7 @@ static void source_sink_complete (struct usb_ep *ep, struct usb_request *req) } static struct usb_request * -source_sink_start_ep (struct usb_ep *ep, unsigned gfp_flags) +source_sink_start_ep (struct usb_ep *ep, int gfp_flags) { struct usb_request *req; int status; @@ -640,7 +640,7 @@ source_sink_start_ep (struct usb_ep *ep, unsigned gfp_flags) } static int -set_source_sink_config (struct zero_dev *dev, unsigned gfp_flags) +set_source_sink_config (struct zero_dev *dev, int gfp_flags) { int result = 0; struct usb_ep *ep; @@ -744,7 +744,7 @@ static void loopback_complete (struct usb_ep *ep, struct usb_request *req) } static int -set_loopback_config (struct zero_dev *dev, unsigned gfp_flags) +set_loopback_config (struct zero_dev *dev, int gfp_flags) { int result = 0; struct usb_ep *ep; @@ -845,7 +845,7 @@ static void zero_reset_config (struct zero_dev *dev) * by limiting configuration choices (like the pxa2xx). */ static int -zero_set_config (struct zero_dev *dev, unsigned number, unsigned gfp_flags) +zero_set_config (struct zero_dev *dev, unsigned number, int gfp_flags) { int result = 0; struct usb_gadget *gadget = dev->gadget; diff --git a/trunk/drivers/usb/host/ehci-hcd.c b/trunk/drivers/usb/host/ehci-hcd.c index 149b13fc0a71..35248a37b717 100644 --- a/trunk/drivers/usb/host/ehci-hcd.c +++ b/trunk/drivers/usb/host/ehci-hcd.c @@ -960,7 +960,7 @@ static int ehci_urb_enqueue ( struct usb_hcd *hcd, struct usb_host_endpoint *ep, struct urb *urb, - unsigned mem_flags + int mem_flags ) { struct ehci_hcd *ehci = hcd_to_ehci (hcd); struct list_head qtd_list; diff --git a/trunk/drivers/usb/host/ehci-q.c b/trunk/drivers/usb/host/ehci-q.c index d74b2d68a50e..45d89a7083b1 100644 --- a/trunk/drivers/usb/host/ehci-q.c +++ b/trunk/drivers/usb/host/ehci-q.c @@ -898,7 +898,7 @@ submit_async ( struct usb_host_endpoint *ep, struct urb *urb, struct list_head *qtd_list, - unsigned mem_flags + int mem_flags ) { struct ehci_qtd *qtd; int epnum; diff --git a/trunk/drivers/usb/host/ehci-sched.c b/trunk/drivers/usb/host/ehci-sched.c index 9af4f64532a9..c2104cad4033 100644 --- a/trunk/drivers/usb/host/ehci-sched.c +++ b/trunk/drivers/usb/host/ehci-sched.c @@ -588,7 +588,7 @@ static int intr_submit ( struct usb_host_endpoint *ep, struct urb *urb, struct list_head *qtd_list, - unsigned mem_flags + int mem_flags ) { unsigned epnum; unsigned long flags; @@ -633,7 +633,7 @@ static int intr_submit ( /* ehci_iso_stream ops work with both ITD and SITD */ static struct ehci_iso_stream * -iso_stream_alloc (unsigned mem_flags) +iso_stream_alloc (int mem_flags) { struct ehci_iso_stream *stream; @@ -846,7 +846,7 @@ iso_stream_find (struct ehci_hcd *ehci, struct urb *urb) /* ehci_iso_sched ops can be ITD-only or SITD-only */ static struct ehci_iso_sched * -iso_sched_alloc (unsigned packets, unsigned mem_flags) +iso_sched_alloc (unsigned packets, int mem_flags) { struct ehci_iso_sched *iso_sched; int size = sizeof *iso_sched; @@ -919,7 +919,7 @@ itd_urb_transaction ( struct ehci_iso_stream *stream, struct ehci_hcd *ehci, struct urb *urb, - unsigned mem_flags + int mem_flags ) { struct ehci_itd *itd; @@ -1412,8 +1412,7 @@ itd_complete ( /*-------------------------------------------------------------------------*/ -static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, - unsigned mem_flags) +static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags) { int status = -EINVAL; unsigned long flags; @@ -1524,7 +1523,7 @@ sitd_urb_transaction ( struct ehci_iso_stream *stream, struct ehci_hcd *ehci, struct urb *urb, - unsigned mem_flags + int mem_flags ) { struct ehci_sitd *sitd; @@ -1773,8 +1772,7 @@ sitd_complete ( } -static int sitd_submit (struct ehci_hcd *ehci, struct urb *urb, - unsigned mem_flags) +static int sitd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags) { int status = -EINVAL; unsigned long flags; @@ -1824,8 +1822,7 @@ static int sitd_submit (struct ehci_hcd *ehci, struct urb *urb, #else static inline int -sitd_submit (struct ehci_hcd *ehci, struct urb *urb, - unsigned mem_flags) +sitd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags) { ehci_dbg (ehci, "split iso support is disabled\n"); return -ENOSYS; diff --git a/trunk/drivers/usb/host/hc_crisv10.c b/trunk/drivers/usb/host/hc_crisv10.c index 81f8f6b7fdce..d9883d774d3a 100644 --- a/trunk/drivers/usb/host/hc_crisv10.c +++ b/trunk/drivers/usb/host/hc_crisv10.c @@ -463,8 +463,7 @@ static void etrax_usb_free_epid(int epid); static int etrax_remove_from_sb_list(struct urb *urb); -static void* etrax_usb_buffer_alloc(struct usb_bus* bus, size_t size, - unsigned mem_flags, dma_addr_t *dma); +static void* etrax_usb_buffer_alloc(struct usb_bus* bus, size_t size, int mem_flags, dma_addr_t *dma); static void etrax_usb_buffer_free(struct usb_bus *bus, size_t size, void *addr, dma_addr_t dma); static void etrax_usb_add_to_bulk_sb_list(struct urb *urb, int epid); @@ -477,7 +476,7 @@ static int etrax_usb_submit_ctrl_urb(struct urb *urb); static int etrax_usb_submit_intr_urb(struct urb *urb); static int etrax_usb_submit_isoc_urb(struct urb *urb); -static int etrax_usb_submit_urb(struct urb *urb, unsigned mem_flags); +static int etrax_usb_submit_urb(struct urb *urb, int mem_flags); static int etrax_usb_unlink_urb(struct urb *urb, int status); static int etrax_usb_get_frame_number(struct usb_device *usb_dev); @@ -1263,7 +1262,7 @@ static int etrax_usb_allocate_epid(void) return -1; } -static int etrax_usb_submit_urb(struct urb *urb, unsigned mem_flags) +static int etrax_usb_submit_urb(struct urb *urb, int mem_flags) { etrax_hc_t *hc; int ret = -EINVAL; @@ -4278,8 +4277,7 @@ etrax_usb_bulk_eot_timer_func(unsigned long dummy) } static void* -etrax_usb_buffer_alloc(struct usb_bus* bus, size_t size, - unsigned mem_flags, dma_addr_t *dma) +etrax_usb_buffer_alloc(struct usb_bus* bus, size_t size, int mem_flags, dma_addr_t *dma) { return kmalloc(size, mem_flags); } diff --git a/trunk/drivers/usb/host/isp116x-hcd.c b/trunk/drivers/usb/host/isp116x-hcd.c index 50b1970fe6b6..ff0a168e8eed 100644 --- a/trunk/drivers/usb/host/isp116x-hcd.c +++ b/trunk/drivers/usb/host/isp116x-hcd.c @@ -17,7 +17,7 @@ * The driver basically works. A number of people have used it with a range * of devices. * - * The driver passes all usbtests 1-14. + *The driver passes all usbtests 1-14. * * Suspending/resuming of root hub via sysfs works. Remote wakeup works too. * And suspending/resuming of platform device works too. Suspend/resume @@ -229,7 +229,7 @@ static void preproc_atl_queue(struct isp116x *isp116x) struct isp116x_ep *ep; struct urb *urb; struct ptd *ptd; - u16 toggle = 0, dir = PTD_DIR_SETUP, len; + u16 toggle, dir, len; for (ep = isp116x->atl_active; ep; ep = ep->active) { BUG_ON(list_empty(&ep->hep->urb_list)); @@ -251,6 +251,8 @@ static void preproc_atl_queue(struct isp116x *isp116x) dir = PTD_DIR_OUT; break; case USB_PID_SETUP: + toggle = 0; + dir = PTD_DIR_SETUP; len = sizeof(struct usb_ctrlrequest); ep->data = urb->setup_packet; break; @@ -262,9 +264,11 @@ static void preproc_atl_queue(struct isp116x *isp116x) ? PTD_DIR_OUT : PTD_DIR_IN; break; default: + /* To please gcc */ + toggle = dir = 0; ERR("%s %d: ep->nextpid %d\n", __func__, __LINE__, ep->nextpid); - BUG(); + BUG_ON(1); } ptd->count = PTD_CC_MSK | PTD_ACTIVE_MSK | PTD_TOGGLE(toggle); @@ -693,7 +697,7 @@ static int balance(struct isp116x *isp116x, u16 period, u16 load) static int isp116x_urb_enqueue(struct usb_hcd *hcd, struct usb_host_endpoint *hep, struct urb *urb, - unsigned mem_flags) + int mem_flags) { struct isp116x *isp116x = hcd_to_isp116x(hcd); struct usb_device *udev = urb->dev; @@ -715,7 +719,7 @@ static int isp116x_urb_enqueue(struct usb_hcd *hcd, } /* avoid all allocations within spinlocks: request or endpoint */ if (!hep->hcpriv) { - ep = kcalloc(1, sizeof *ep, mem_flags); + ep = kcalloc(1, sizeof *ep, (__force unsigned)mem_flags); if (!ep) return -ENOMEM; } @@ -1050,7 +1054,7 @@ static int isp116x_hub_control(struct usb_hcd *hcd, break; case GetHubStatus: DBG("GetHubStatus\n"); - *(__le32 *) buf = 0; + *(__le32 *) buf = cpu_to_le32(0); break; case GetPortStatus: DBG("GetPortStatus\n"); @@ -1806,9 +1810,9 @@ static int isp116x_suspend(struct device *dev, pm_message_t state, u32 phase) ret = usb_suspend_device(hcd->self.root_hub, state); if (!ret) { dev->power.power_state = state; - INFO("%s suspended\n", hcd_name); + INFO("%s suspended\n", (char *)hcd_name); } else - ERR("%s suspend failed\n", hcd_name); + ERR("%s suspend failed\n", (char *)hcd_name); return ret; } diff --git a/trunk/drivers/usb/host/ohci-hcd.c b/trunk/drivers/usb/host/ohci-hcd.c index 68decab280dd..13cd2177b557 100644 --- a/trunk/drivers/usb/host/ohci-hcd.c +++ b/trunk/drivers/usb/host/ohci-hcd.c @@ -180,7 +180,7 @@ static int ohci_urb_enqueue ( struct usb_hcd *hcd, struct usb_host_endpoint *ep, struct urb *urb, - unsigned mem_flags + int mem_flags ) { struct ohci_hcd *ohci = hcd_to_ohci (hcd); struct ed *ed; @@ -673,10 +673,8 @@ static int ohci_run (struct ohci_hcd *ohci) ohci_dump (ohci, 1); - if (ohci_to_hcd(ohci)->self.root_hub == NULL) { - register_reboot_notifier (&ohci->reboot_notifier); + if (ohci_to_hcd(ohci)->self.root_hub == NULL) create_debug_files (ohci); - } return 0; } diff --git a/trunk/drivers/usb/host/ohci-hub.c b/trunk/drivers/usb/host/ohci-hub.c index 83ca4549a50e..e2fc4129dfc6 100644 --- a/trunk/drivers/usb/host/ohci-hub.c +++ b/trunk/drivers/usb/host/ohci-hub.c @@ -419,11 +419,10 @@ ohci_hub_descriptor ( /* two bitmaps: ports removable, and usb 1.0 legacy PortPwrCtrlMask */ rh = roothub_b (ohci); - memset(desc->bitmap, 0xff, sizeof(desc->bitmap)); desc->bitmap [0] = rh & RH_B_DR; if (ports > 7) { desc->bitmap [1] = (rh & RH_B_DR) >> 8; - desc->bitmap [2] = 0xff; + desc->bitmap [2] = desc->bitmap [3] = 0xff; } else desc->bitmap [1] = 0xff; } diff --git a/trunk/drivers/usb/host/ohci-mem.c b/trunk/drivers/usb/host/ohci-mem.c index fd3c4d3714bd..23735a36af00 100644 --- a/trunk/drivers/usb/host/ohci-mem.c +++ b/trunk/drivers/usb/host/ohci-mem.c @@ -84,7 +84,7 @@ dma_to_td (struct ohci_hcd *hc, dma_addr_t td_dma) /* TDs ... */ static struct td * -td_alloc (struct ohci_hcd *hc, unsigned mem_flags) +td_alloc (struct ohci_hcd *hc, int mem_flags) { dma_addr_t dma; struct td *td; @@ -118,7 +118,7 @@ td_free (struct ohci_hcd *hc, struct td *td) /* EDs ... */ static struct ed * -ed_alloc (struct ohci_hcd *hc, unsigned mem_flags) +ed_alloc (struct ohci_hcd *hc, int mem_flags) { dma_addr_t dma; struct ed *ed; diff --git a/trunk/drivers/usb/host/ohci-omap.c b/trunk/drivers/usb/host/ohci-omap.c index 5cde76faab93..b62d69937694 100644 --- a/trunk/drivers/usb/host/ohci-omap.c +++ b/trunk/drivers/usb/host/ohci-omap.c @@ -456,22 +456,34 @@ static int ohci_hcd_omap_drv_remove(struct device *dev) #ifdef CONFIG_PM -static int ohci_omap_suspend(struct device *dev, pm_message_t message, u32 level) +/* states match PCI usage, always suspending the root hub except that + * 4 ~= D3cold (ACPI D3) with clock off (resume sees reset). + * + * FIXME: above comment is not right, and code is wrong, too :-(. + */ + +static int ohci_omap_suspend(struct device *dev, pm_message_t state, u32 level) { struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); int status = -EINVAL; if (level != SUSPEND_POWER_DOWN) return 0; + if (state <= dev->power.power_state) + return 0; + dev_dbg(dev, "suspend to %d\n", state); down(&ohci_to_hcd(ohci)->self.root_hub->serialize); status = ohci_hub_suspend(ohci_to_hcd(ohci)); if (status == 0) { - omap_ohci_clock_power(0); - ohci_to_hcd(ohci)->self.root_hub->state = - USB_STATE_SUSPENDED; + if (state >= 4) { + omap_ohci_clock_power(0); + ohci_to_hcd(ohci)->self.root_hub->state = + USB_STATE_SUSPENDED; + state = 4; + } ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; - dev->power.power_state = PMSG_SUSPEND; + dev->power.power_state = state; } up(&ohci_to_hcd(ohci)->self.root_hub->serialize); return status; @@ -485,20 +497,29 @@ static int ohci_omap_resume(struct device *dev, u32 level) if (level != RESUME_POWER_ON) return 0; - if (time_before(jiffies, ohci->next_statechange)) - msleep(5); - ohci->next_statechange = jiffies; - omap_ohci_clock_power(1); + switch (dev->power.power_state) { + case 0: + break; + case 4: + if (time_before(jiffies, ohci->next_statechange)) + msleep(5); + ohci->next_statechange = jiffies; + omap_ohci_clock_power(1); + /* FALLTHROUGH */ + default: + dev_dbg(dev, "resume from %d\n", dev->power.power_state); #ifdef CONFIG_USB_SUSPEND - /* get extra cleanup even if remote wakeup isn't in use */ - status = usb_resume_device(ohci_to_hcd(ohci)->self.root_hub); + /* get extra cleanup even if remote wakeup isn't in use */ + status = usb_resume_device(ohci_to_hcd(ohci)->self.root_hub); #else - down(&ohci_to_hcd(ohci)->self.root_hub->serialize); - status = ohci_hub_resume(ohci_to_hcd(ohci)); - up(&ohci_to_hcd(ohci)->self.root_hub->serialize); + down(&ohci_to_hcd(ohci)->self.root_hub->serialize); + status = ohci_hub_resume(ohci_to_hcd(ohci)); + up(&ohci_to_hcd(ohci)->self.root_hub->serialize); #endif - if (status == 0) - dev->power.power_state = PMSG_ON; + if (status == 0) + dev->power.power_state = 0; + break; + } return status; } diff --git a/trunk/drivers/usb/host/sl811-hcd.c b/trunk/drivers/usb/host/sl811-hcd.c index 7a890a65f55d..6c3f910bc307 100644 --- a/trunk/drivers/usb/host/sl811-hcd.c +++ b/trunk/drivers/usb/host/sl811-hcd.c @@ -815,7 +815,7 @@ static int sl811h_urb_enqueue( struct usb_hcd *hcd, struct usb_host_endpoint *hep, struct urb *urb, - unsigned mem_flags + int mem_flags ) { struct sl811 *sl811 = hcd_to_sl811(hcd); struct usb_device *udev = urb->dev; diff --git a/trunk/drivers/usb/host/uhci-q.c b/trunk/drivers/usb/host/uhci-q.c index bbb36cd6ed61..5f18084a116d 100644 --- a/trunk/drivers/usb/host/uhci-q.c +++ b/trunk/drivers/usb/host/uhci-q.c @@ -1164,7 +1164,7 @@ static struct urb *uhci_find_urb_ep(struct uhci_hcd *uhci, struct urb *urb) static int uhci_urb_enqueue(struct usb_hcd *hcd, struct usb_host_endpoint *ep, - struct urb *urb, unsigned mem_flags) + struct urb *urb, int mem_flags) { int ret; struct uhci_hcd *uhci = hcd_to_uhci(hcd); diff --git a/trunk/drivers/usb/input/Kconfig b/trunk/drivers/usb/input/Kconfig index 298e4a25e3d3..fd59f6bdd67f 100644 --- a/trunk/drivers/usb/input/Kconfig +++ b/trunk/drivers/usb/input/Kconfig @@ -259,16 +259,3 @@ config USB_ATI_REMOTE To compile this driver as a module, choose M here: the module will be called ati_remote. -config USB_KEYSPAN_REMOTE - tristate "Keyspan DMR USB remote control (EXPERIMENTAL)" - depends on USB && INPUT && EXPERIMENTAL - ---help--- - Say Y here if you want to use a Keyspan DMR USB remote control. - Currently only the UIA-11 type of receiver has been tested. The tag - on the receiver that connects to the USB port should have a P/N that - will tell you what type of DMR you have. The UIA-10 type is not - supported at this time. This driver maps all buttons to keypress - events. - - To compile this driver as a module, choose M here: the module will - be called keyspan_remote. diff --git a/trunk/drivers/usb/input/Makefile b/trunk/drivers/usb/input/Makefile index f1547be632d4..831b2b0f1f05 100644 --- a/trunk/drivers/usb/input/Makefile +++ b/trunk/drivers/usb/input/Makefile @@ -31,7 +31,6 @@ obj-$(CONFIG_USB_ATI_REMOTE) += ati_remote.o obj-$(CONFIG_USB_HID) += usbhid.o obj-$(CONFIG_USB_KBD) += usbkbd.o obj-$(CONFIG_USB_KBTAB) += kbtab.o -obj-$(CONFIG_USB_KEYSPAN_REMOTE) += keyspan_remote.o obj-$(CONFIG_USB_MOUSE) += usbmouse.o obj-$(CONFIG_USB_MTOUCH) += mtouchusb.o obj-$(CONFIG_USB_ITMTOUCH) += itmtouch.o diff --git a/trunk/drivers/usb/input/hid-core.c b/trunk/drivers/usb/input/hid-core.c index 2350e7a5ad70..100b49bd1d3e 100644 --- a/trunk/drivers/usb/input/hid-core.c +++ b/trunk/drivers/usb/input/hid-core.c @@ -1428,19 +1428,6 @@ void hid_init_reports(struct hid_device *hid) #define USB_DEVICE_ID_VERNIER_SKIP 0x0003 #define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 -#define USB_VENDOR_ID_LD 0x0f11 -#define USB_DEVICE_ID_CASSY 0x1000 -#define USB_DEVICE_ID_POCKETCASSY 0x1010 -#define USB_DEVICE_ID_MOBILECASSY 0x1020 -#define USB_DEVICE_ID_JWM 0x1080 -#define USB_DEVICE_ID_DMMP 0x1081 -#define USB_DEVICE_ID_UMIP 0x1090 -#define USB_DEVICE_ID_VIDEOCOM 0x1200 -#define USB_DEVICE_ID_COM3LAB 0x2000 -#define USB_DEVICE_ID_TELEPORT 0x2010 -#define USB_DEVICE_ID_NETWORKANALYSER 0x2020 -#define USB_DEVICE_ID_POWERCONTROL 0x2030 - /* * Alphabetically sorted blacklist by quirk type. @@ -1476,17 +1463,6 @@ static struct hid_blacklist { { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE }, - { USB_VENDOR_ID_LD, USB_DEVICE_ID_CASSY, HID_QUIRK_IGNORE }, - { USB_VENDOR_ID_LD, USB_DEVICE_ID_POCKETCASSY, HID_QUIRK_IGNORE }, - { USB_VENDOR_ID_LD, USB_DEVICE_ID_MOBILECASSY, HID_QUIRK_IGNORE }, - { USB_VENDOR_ID_LD, USB_DEVICE_ID_JWM, HID_QUIRK_IGNORE }, - { USB_VENDOR_ID_LD, USB_DEVICE_ID_DMMP, HID_QUIRK_IGNORE }, - { USB_VENDOR_ID_LD, USB_DEVICE_ID_UMIP, HID_QUIRK_IGNORE }, - { USB_VENDOR_ID_LD, USB_DEVICE_ID_VIDEOCOM, HID_QUIRK_IGNORE }, - { USB_VENDOR_ID_LD, USB_DEVICE_ID_COM3LAB, HID_QUIRK_IGNORE }, - { USB_VENDOR_ID_LD, USB_DEVICE_ID_TELEPORT, HID_QUIRK_IGNORE }, - { USB_VENDOR_ID_LD, USB_DEVICE_ID_NETWORKANALYSER, HID_QUIRK_IGNORE }, - { USB_VENDOR_ID_LD, USB_DEVICE_ID_POWERCONTROL, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_IGNORE }, diff --git a/trunk/drivers/usb/input/keyspan_remote.c b/trunk/drivers/usb/input/keyspan_remote.c deleted file mode 100644 index 67dc93685203..000000000000 --- a/trunk/drivers/usb/input/keyspan_remote.c +++ /dev/null @@ -1,633 +0,0 @@ -/* - * keyspan_remote: USB driver for the Keyspan DMR - * - * Copyright (C) 2005 Zymeta Corporation - Michael Downey (downey@zymeta.com) - * - * 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, version 2. - * - * This driver has been put together with the support of Innosys, Inc. - * and Keyspan, Inc the manufacturers of the Keyspan USB DMR product. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DRIVER_VERSION "v0.1" -#define DRIVER_AUTHOR "Michael Downey " -#define DRIVER_DESC "Driver for the USB Keyspan remote control." -#define DRIVER_LICENSE "GPL" - -/* Parameters that can be passed to the driver. */ -static int debug; -module_param(debug, int, 0444); -MODULE_PARM_DESC(debug, "Enable extra debug messages and information"); - -/* Vendor and product ids */ -#define USB_KEYSPAN_VENDOR_ID 0x06CD -#define USB_KEYSPAN_PRODUCT_UIA11 0x0202 - -/* Defines for converting the data from the remote. */ -#define ZERO 0x18 -#define ZERO_MASK 0x1F /* 5 bits for a 0 */ -#define ONE 0x3C -#define ONE_MASK 0x3F /* 6 bits for a 1 */ -#define SYNC 0x3F80 -#define SYNC_MASK 0x3FFF /* 14 bits for a SYNC sequence */ -#define STOP 0x00 -#define STOP_MASK 0x1F /* 5 bits for the STOP sequence */ -#define GAP 0xFF - -#define RECV_SIZE 8 /* The UIA-11 type have a 8 byte limit. */ - -/* table of devices that work with this driver */ -static struct usb_device_id keyspan_table[] = { - { USB_DEVICE(USB_KEYSPAN_VENDOR_ID, USB_KEYSPAN_PRODUCT_UIA11) }, - { } /* Terminating entry */ -}; - -/* Structure to store all the real stuff that a remote sends to us. */ -struct keyspan_message { - u16 system; - u8 button; - u8 toggle; -}; - -/* Structure used for all the bit testing magic needed to be done. */ -struct bit_tester { - u32 tester; - int len; - int pos; - int bits_left; - u8 buffer[32]; -}; - -/* Structure to hold all of our driver specific stuff */ -struct usb_keyspan { - char name[128]; - char phys[64]; - struct usb_device* udev; - struct input_dev input; - struct usb_interface* interface; - struct usb_endpoint_descriptor* in_endpoint; - struct urb* irq_urb; - int open; - dma_addr_t in_dma; - unsigned char* in_buffer; - - /* variables used to parse messages from remote. */ - struct bit_tester data; - int stage; - int toggle; -}; - -/* - * Table that maps the 31 possible keycodes to input keys. - * Currently there are 15 and 17 button models so RESERVED codes - * are blank areas in the mapping. - */ -static int keyspan_key_table[] = { - KEY_RESERVED, /* 0 is just a place holder. */ - KEY_RESERVED, - KEY_STOP, - KEY_PLAYCD, - KEY_RESERVED, - KEY_PREVIOUSSONG, - KEY_REWIND, - KEY_FORWARD, - KEY_NEXTSONG, - KEY_RESERVED, - KEY_RESERVED, - KEY_RESERVED, - KEY_PAUSE, - KEY_VOLUMEUP, - KEY_RESERVED, - KEY_RESERVED, - KEY_RESERVED, - KEY_VOLUMEDOWN, - KEY_RESERVED, - KEY_UP, - KEY_RESERVED, - KEY_MUTE, - KEY_LEFT, - KEY_ENTER, - KEY_RIGHT, - KEY_RESERVED, - KEY_RESERVED, - KEY_DOWN, - KEY_RESERVED, - KEY_KPASTERISK, - KEY_RESERVED, - KEY_MENU -}; - -static struct usb_driver keyspan_driver; - -/* - * Debug routine that prints out what we've received from the remote. - */ -static void keyspan_print(struct usb_keyspan* dev) /*unsigned char* data)*/ -{ - char codes[4*RECV_SIZE]; - int i; - - for (i = 0; i < RECV_SIZE; i++) { - snprintf(codes+i*3, 4, "%02x ", dev->in_buffer[i]); - } - - dev_info(&dev->udev->dev, "%s\n", codes); -} - -/* - * Routine that manages the bit_tester structure. It makes sure that there are - * at least bits_needed bits loaded into the tester. - */ -static int keyspan_load_tester(struct usb_keyspan* dev, int bits_needed) -{ - if (dev->data.bits_left >= bits_needed) - return(0); - - /* - * Somehow we've missed the last message. The message will be repeated - * though so it's not too big a deal - */ - if (dev->data.pos >= dev->data.len) { - dev_dbg(&dev->udev, "%s - Error ran out of data. pos: %d, len: %d\n", - __FUNCTION__, dev->data.pos, dev->data.len); - return(-1); - } - - /* Load as much as we can into the tester. */ - while ((dev->data.bits_left + 7 < (sizeof(dev->data.tester) * 8)) && - (dev->data.pos < dev->data.len)) { - dev->data.tester += (dev->data.buffer[dev->data.pos++] << dev->data.bits_left); - dev->data.bits_left += 8; - } - - return(0); -} - -/* - * Routine that handles all the logic needed to parse out the message from the remote. - */ -static void keyspan_check_data(struct usb_keyspan *remote, struct pt_regs *regs) -{ - int i; - int found = 0; - struct keyspan_message message; - - switch(remote->stage) { - case 0: - /* - * In stage 0 we want to find the start of a message. The remote sends a 0xFF as filler. - * So the first byte that isn't a FF should be the start of a new message. - */ - for (i = 0; i < RECV_SIZE && remote->in_buffer[i] == GAP; ++i); - - if (i < RECV_SIZE) { - memcpy(remote->data.buffer, remote->in_buffer, RECV_SIZE); - remote->data.len = RECV_SIZE; - remote->data.pos = 0; - remote->data.tester = 0; - remote->data.bits_left = 0; - remote->stage = 1; - } - break; - - case 1: - /* - * Stage 1 we should have 16 bytes and should be able to detect a - * SYNC. The SYNC is 14 bits, 7 0's and then 7 1's. - */ - memcpy(remote->data.buffer + remote->data.len, remote->in_buffer, RECV_SIZE); - remote->data.len += RECV_SIZE; - - found = 0; - while ((remote->data.bits_left >= 14 || remote->data.pos < remote->data.len) && !found) { - for (i = 0; i < 8; ++i) { - if (keyspan_load_tester(remote, 14) != 0) { - remote->stage = 0; - return; - } - - if ((remote->data.tester & SYNC_MASK) == SYNC) { - remote->data.tester = remote->data.tester >> 14; - remote->data.bits_left -= 14; - found = 1; - break; - } else { - remote->data.tester = remote->data.tester >> 1; - --remote->data.bits_left; - } - } - } - - if (!found) { - remote->stage = 0; - remote->data.len = 0; - } else { - remote->stage = 2; - } - break; - - case 2: - /* - * Stage 2 we should have 24 bytes which will be enough for a full - * message. We need to parse out the system code, button code, - * toggle code, and stop. - */ - memcpy(remote->data.buffer + remote->data.len, remote->in_buffer, RECV_SIZE); - remote->data.len += RECV_SIZE; - - message.system = 0; - for (i = 0; i < 9; i++) { - keyspan_load_tester(remote, 6); - - if ((remote->data.tester & ZERO_MASK) == ZERO) { - message.system = message.system << 1; - remote->data.tester = remote->data.tester >> 5; - remote->data.bits_left -= 5; - } else if ((remote->data.tester & ONE_MASK) == ONE) { - message.system = (message.system << 1) + 1; - remote->data.tester = remote->data.tester >> 6; - remote->data.bits_left -= 6; - } else { - err("%s - Unknown sequence found in system data.\n", __FUNCTION__); - remote->stage = 0; - return; - } - } - - message.button = 0; - for (i = 0; i < 5; i++) { - keyspan_load_tester(remote, 6); - - if ((remote->data.tester & ZERO_MASK) == ZERO) { - message.button = message.button << 1; - remote->data.tester = remote->data.tester >> 5; - remote->data.bits_left -= 5; - } else if ((remote->data.tester & ONE_MASK) == ONE) { - message.button = (message.button << 1) + 1; - remote->data.tester = remote->data.tester >> 6; - remote->data.bits_left -= 6; - } else { - err("%s - Unknown sequence found in button data.\n", __FUNCTION__); - remote->stage = 0; - return; - } - } - - keyspan_load_tester(remote, 6); - if ((remote->data.tester & ZERO_MASK) == ZERO) { - message.toggle = 0; - remote->data.tester = remote->data.tester >> 5; - remote->data.bits_left -= 5; - } else if ((remote->data.tester & ONE_MASK) == ONE) { - message.toggle = 1; - remote->data.tester = remote->data.tester >> 6; - remote->data.bits_left -= 6; - } else { - err("%s - Error in message, invalid toggle.\n", __FUNCTION__); - } - - keyspan_load_tester(remote, 5); - if ((remote->data.tester & STOP_MASK) == STOP) { - remote->data.tester = remote->data.tester >> 5; - remote->data.bits_left -= 5; - } else { - err("Bad message recieved, no stop bit found.\n"); - } - - dev_dbg(&remote->udev, - "%s found valid message: system: %d, button: %d, toggle: %d\n", - __FUNCTION__, message.system, message.button, message.toggle); - - if (message.toggle != remote->toggle) { - input_regs(&remote->input, regs); - input_report_key(&remote->input, keyspan_key_table[message.button], 1); - input_report_key(&remote->input, keyspan_key_table[message.button], 0); - input_sync(&remote->input); - remote->toggle = message.toggle; - } - - remote->stage = 0; - break; - } -} - -/* - * Routine for sending all the initialization messages to the remote. - */ -static int keyspan_setup(struct usb_device* dev) -{ - int retval = 0; - - retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), - 0x11, 0x40, 0x5601, 0x0, NULL, 0, 0); - if (retval) { - dev_dbg(&dev->dev, "%s - failed to set bit rate due to error: %d\n", - __FUNCTION__, retval); - return(retval); - } - - retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), - 0x44, 0x40, 0x0, 0x0, NULL, 0, 0); - if (retval) { - dev_dbg(&dev->dev, "%s - failed to set resume sensitivity due to error: %d\n", - __FUNCTION__, retval); - return(retval); - } - - retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), - 0x22, 0x40, 0x0, 0x0, NULL, 0, 0); - if (retval) { - dev_dbg(&dev->dev, "%s - failed to turn receive on due to error: %d\n", - __FUNCTION__, retval); - return(retval); - } - - dev_dbg(&dev->dev, "%s - Setup complete.\n", __FUNCTION__); - return(retval); -} - -/* - * Routine used to handle a new message that has come in. - */ -static void keyspan_irq_recv(struct urb *urb, struct pt_regs *regs) -{ - struct usb_keyspan *dev = urb->context; - int retval; - - /* Check our status in case we need to bail out early. */ - switch (urb->status) { - case 0: - break; - - /* Device went away so don't keep trying to read from it. */ - case -ECONNRESET: - case -ENOENT: - case -ESHUTDOWN: - return; - - default: - goto resubmit; - break; - } - - if (debug) - keyspan_print(dev); - - keyspan_check_data(dev, regs); - -resubmit: - retval = usb_submit_urb(urb, GFP_ATOMIC); - if (retval) - err ("%s - usb_submit_urb failed with result: %d", __FUNCTION__, retval); -} - -static int keyspan_open(struct input_dev *dev) -{ - struct usb_keyspan *remote = dev->private; - - if (remote->open++) - return 0; - - remote->irq_urb->dev = remote->udev; - if (usb_submit_urb(remote->irq_urb, GFP_KERNEL)) { - remote->open--; - return -EIO; - } - - return 0; -} - -static void keyspan_close(struct input_dev *dev) -{ - struct usb_keyspan *remote = dev->private; - - if (!--remote->open) - usb_kill_urb(remote->irq_urb); -} - -/* - * Routine that sets up the driver to handle a specific USB device detected on the bus. - */ -static int keyspan_probe(struct usb_interface *interface, const struct usb_device_id *id) -{ - int i; - int retval = -ENOMEM; - char path[64]; - char *buf; - struct usb_keyspan *remote = NULL; - struct usb_host_interface *iface_desc; - struct usb_endpoint_descriptor *endpoint; - struct usb_device *udev = usb_get_dev(interface_to_usbdev(interface)); - - /* See if the offered device matches what we can accept */ - if ((udev->descriptor.idVendor != USB_KEYSPAN_VENDOR_ID) || - (udev->descriptor.idProduct != USB_KEYSPAN_PRODUCT_UIA11) ) - return -ENODEV; - - /* allocate memory for our device state and initialize it */ - remote = kmalloc(sizeof(*remote), GFP_KERNEL); - if (remote == NULL) { - err("Out of memory\n"); - goto error; - } - memset(remote, 0x00, sizeof(*remote)); - - remote->udev = udev; - remote->interface = interface; - remote->toggle = -1; /* Set to -1 so we will always not match the toggle from the first remote message. */ - - /* set up the endpoint information */ - /* use only the first in interrupt endpoint */ - iface_desc = interface->cur_altsetting; - for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { - endpoint = &iface_desc->endpoint[i].desc; - - if (!remote->in_endpoint && - (endpoint->bEndpointAddress & USB_DIR_IN) && - ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT)) { - /* we found our interrupt in endpoint */ - remote->in_endpoint = endpoint; - - remote->in_buffer = usb_buffer_alloc(remote->udev, RECV_SIZE, SLAB_ATOMIC, &remote->in_dma); - if (!remote->in_buffer) { - retval = -ENOMEM; - goto error; - } - } - } - - if (!remote->in_endpoint) { - err("Could not find interrupt input endpoint.\n"); - retval = -ENODEV; - goto error; - } - - remote->irq_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!remote->irq_urb) { - err("Failed to allocate urb.\n"); - retval = -ENOMEM; - goto error; - } - - retval = keyspan_setup(remote->udev); - if (retval) { - err("Failed to setup device.\n"); - retval = -ENODEV; - goto error; - } - - /* - * Setup the input system with the bits we are going to be reporting - */ - remote->input.evbit[0] = BIT(EV_KEY); /* We will only report KEY events. */ - for (i = 0; i < 32; ++i) { - if (keyspan_key_table[i] != KEY_RESERVED) { - set_bit(keyspan_key_table[i], remote->input.keybit); - } - } - - remote->input.private = remote; - remote->input.open = keyspan_open; - remote->input.close = keyspan_close; - - usb_make_path(remote->udev, path, 64); - sprintf(remote->phys, "%s/input0", path); - - remote->input.name = remote->name; - remote->input.phys = remote->phys; - remote->input.id.bustype = BUS_USB; - remote->input.id.vendor = le16_to_cpu(remote->udev->descriptor.idVendor); - remote->input.id.product = le16_to_cpu(remote->udev->descriptor.idProduct); - remote->input.id.version = le16_to_cpu(remote->udev->descriptor.bcdDevice); - - if (!(buf = kmalloc(63, GFP_KERNEL))) { - usb_buffer_free(remote->udev, RECV_SIZE, remote->in_buffer, remote->in_dma); - kfree(remote); - return -ENOMEM; - } - - if (remote->udev->descriptor.iManufacturer && - usb_string(remote->udev, remote->udev->descriptor.iManufacturer, buf, 63) > 0) - strcat(remote->name, buf); - - if (remote->udev->descriptor.iProduct && - usb_string(remote->udev, remote->udev->descriptor.iProduct, buf, 63) > 0) - sprintf(remote->name, "%s %s", remote->name, buf); - - if (!strlen(remote->name)) - sprintf(remote->name, "USB Keyspan Remote %04x:%04x", - remote->input.id.vendor, remote->input.id.product); - - kfree(buf); - - /* - * Initialize the URB to access the device. The urb gets sent to the device in keyspan_open() - */ - usb_fill_int_urb(remote->irq_urb, - remote->udev, usb_rcvintpipe(remote->udev, remote->in_endpoint->bEndpointAddress), - remote->in_buffer, RECV_SIZE, keyspan_irq_recv, remote, - remote->in_endpoint->bInterval); - remote->irq_urb->transfer_dma = remote->in_dma; - remote->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - - /* we can register the device now, as it is ready */ - input_register_device(&remote->input); - - /* save our data pointer in this interface device */ - usb_set_intfdata(interface, remote); - - /* let the user know what node this device is now attached to */ - info("connected: %s on %s", remote->name, path); - return 0; - -error: - /* - * In case of error we need to clean up any allocated buffers - */ - if (remote->irq_urb) - usb_free_urb(remote->irq_urb); - - if (remote->in_buffer) - usb_buffer_free(remote->udev, RECV_SIZE, remote->in_buffer, remote->in_dma); - - if (remote) - kfree(remote); - - return retval; -} - -/* - * Routine called when a device is disconnected from the USB. - */ -static void keyspan_disconnect(struct usb_interface *interface) -{ - struct usb_keyspan *remote; - - /* prevent keyspan_open() from racing keyspan_disconnect() */ - lock_kernel(); - - remote = usb_get_intfdata(interface); - usb_set_intfdata(interface, NULL); - - if (remote) { /* We have a valid driver structure so clean up everything we allocated. */ - input_unregister_device(&remote->input); - usb_kill_urb(remote->irq_urb); - usb_free_urb(remote->irq_urb); - usb_buffer_free(interface_to_usbdev(interface), RECV_SIZE, remote->in_buffer, remote->in_dma); - kfree(remote); - } - - unlock_kernel(); - - info("USB Keyspan now disconnected"); -} - -/* - * Standard driver set up sections - */ -static struct usb_driver keyspan_driver = -{ - .owner = THIS_MODULE, - .name = "keyspan_remote", - .probe = keyspan_probe, - .disconnect = keyspan_disconnect, - .id_table = keyspan_table -}; - -static int __init usb_keyspan_init(void) -{ - int result; - - /* register this driver with the USB subsystem */ - result = usb_register(&keyspan_driver); - if (result) - err("usb_register failed. Error number %d\n", result); - - return result; -} - -static void __exit usb_keyspan_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&keyspan_driver); -} - -module_init(usb_keyspan_init); -module_exit(usb_keyspan_exit); - -MODULE_DEVICE_TABLE(usb, keyspan_table); -MODULE_AUTHOR(DRIVER_AUTHOR); -MODULE_DESCRIPTION(DRIVER_DESC); -MODULE_LICENSE(DRIVER_LICENSE); diff --git a/trunk/drivers/usb/media/Makefile b/trunk/drivers/usb/media/Makefile index d83adffa925f..2b76df7005fe 100644 --- a/trunk/drivers/usb/media/Makefile +++ b/trunk/drivers/usb/media/Makefile @@ -2,7 +2,7 @@ # Makefile for USB Media drivers # -sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o sn9c102_ov7630.o sn9c102_pas106b.o sn9c102_pas202bcb.o sn9c102_tas5110c1b.o sn9c102_tas5130d1b.o +sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o sn9c102_pas106b.o sn9c102_pas202bcb.o sn9c102_tas5110c1b.o sn9c102_tas5130d1b.o obj-$(CONFIG_USB_DABUSB) += dabusb.o obj-$(CONFIG_USB_DSBR) += dsbr100.o diff --git a/trunk/drivers/usb/media/sn9c102.h b/trunk/drivers/usb/media/sn9c102.h index e5cea0e2eb57..8b8a4c8743f8 100644 --- a/trunk/drivers/usb/media/sn9c102.h +++ b/trunk/drivers/usb/media/sn9c102.h @@ -56,7 +56,7 @@ #define SN9C102_MODULE_AUTHOR "(C) 2004-2005 Luca Risolia" #define SN9C102_AUTHOR_EMAIL "" #define SN9C102_MODULE_LICENSE "GPL" -#define SN9C102_MODULE_VERSION "1:1.24a" +#define SN9C102_MODULE_VERSION "1:1.24" #define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 24) enum sn9c102_bridge { diff --git a/trunk/drivers/usb/media/sn9c102_core.c b/trunk/drivers/usb/media/sn9c102_core.c index cf8cfbabefde..31d57400d5be 100644 --- a/trunk/drivers/usb/media/sn9c102_core.c +++ b/trunk/drivers/usb/media/sn9c102_core.c @@ -429,7 +429,7 @@ sn9c102_i2c_try_read(struct sn9c102_device* cam, } -int +static int sn9c102_i2c_try_write(struct sn9c102_device* cam, struct sn9c102_sensor* sensor, u8 address, u8 value) { diff --git a/trunk/drivers/usb/media/sn9c102_ov7630.c b/trunk/drivers/usb/media/sn9c102_ov7630.c deleted file mode 100644 index d27c5aedeaf8..000000000000 --- a/trunk/drivers/usb/media/sn9c102_ov7630.c +++ /dev/null @@ -1,394 +0,0 @@ -/*************************************************************************** - * Plug-in for OV7630 image sensor connected to the SN9C10x PC Camera * - * Controllers * - * * - * Copyright (C) 2005 by Luca Risolia * - * * - * 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. * - ***************************************************************************/ - -#include "sn9c102_sensor.h" - - -static struct sn9c102_sensor ov7630; - - -static int ov7630_init(struct sn9c102_device* cam) -{ - int err = 0; - - err += sn9c102_write_reg(cam, 0x00, 0x14); - err += sn9c102_write_reg(cam, 0x60, 0x17); - err += sn9c102_write_reg(cam, 0x0f, 0x18); - err += sn9c102_write_reg(cam, 0x50, 0x19); - - err += sn9c102_i2c_write(cam, 0x12, 0x8d); - err += sn9c102_i2c_write(cam, 0x11, 0x00); - err += sn9c102_i2c_write(cam, 0x15, 0x34); - err += sn9c102_i2c_write(cam, 0x16, 0x03); - err += sn9c102_i2c_write(cam, 0x17, 0x1c); - err += sn9c102_i2c_write(cam, 0x18, 0xbd); - err += sn9c102_i2c_write(cam, 0x19, 0x06); - err += sn9c102_i2c_write(cam, 0x1a, 0xf6); - err += sn9c102_i2c_write(cam, 0x1b, 0x04); - err += sn9c102_i2c_write(cam, 0x20, 0x44); - err += sn9c102_i2c_write(cam, 0x23, 0xee); - err += sn9c102_i2c_write(cam, 0x26, 0xa0); - err += sn9c102_i2c_write(cam, 0x27, 0x9a); - err += sn9c102_i2c_write(cam, 0x28, 0x20); - err += sn9c102_i2c_write(cam, 0x29, 0x30); - err += sn9c102_i2c_write(cam, 0x2f, 0x3d); - err += sn9c102_i2c_write(cam, 0x30, 0x24); - err += sn9c102_i2c_write(cam, 0x32, 0x86); - err += sn9c102_i2c_write(cam, 0x60, 0xa9); - err += sn9c102_i2c_write(cam, 0x61, 0x42); - err += sn9c102_i2c_write(cam, 0x65, 0x00); - err += sn9c102_i2c_write(cam, 0x69, 0x38); - err += sn9c102_i2c_write(cam, 0x6f, 0x88); - err += sn9c102_i2c_write(cam, 0x70, 0x0b); - err += sn9c102_i2c_write(cam, 0x71, 0x00); - err += sn9c102_i2c_write(cam, 0x74, 0x21); - err += sn9c102_i2c_write(cam, 0x7d, 0xf7); - - return err; -} - - -static int ov7630_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) -{ - int err = 0; - - switch (ctrl->id) { - case V4L2_CID_EXPOSURE: - err += sn9c102_i2c_write(cam, 0x10, ctrl->value >> 2); - err += sn9c102_i2c_write(cam, 0x76, ctrl->value & 0x03); - break; - case V4L2_CID_RED_BALANCE: - err += sn9c102_i2c_write(cam, 0x02, ctrl->value); - break; - case V4L2_CID_BLUE_BALANCE: - err += sn9c102_i2c_write(cam, 0x03, ctrl->value); - break; - case V4L2_CID_GAIN: - err += sn9c102_i2c_write(cam, 0x00, ctrl->value); - break; - case V4L2_CID_CONTRAST: - err += ctrl->value ? sn9c102_i2c_write(cam, 0x05, - (ctrl->value-1) | 0x20) - : sn9c102_i2c_write(cam, 0x05, 0x00); - break; - case V4L2_CID_BRIGHTNESS: - err += sn9c102_i2c_write(cam, 0x06, ctrl->value); - break; - case V4L2_CID_SATURATION: - err += sn9c102_i2c_write(cam, 0x03, ctrl->value << 4); - break; - case V4L2_CID_HUE: - err += ctrl->value ? sn9c102_i2c_write(cam, 0x04, - (ctrl->value-1) | 0x20) - : sn9c102_i2c_write(cam, 0x04, 0x00); - break; - case V4L2_CID_DO_WHITE_BALANCE: - err += sn9c102_i2c_write(cam, 0x0c, ctrl->value); - break; - case V4L2_CID_WHITENESS: - err += sn9c102_i2c_write(cam, 0x0d, ctrl->value); - break; - case V4L2_CID_AUTO_WHITE_BALANCE: - err += sn9c102_i2c_write(cam, 0x12, (ctrl->value << 2) | 0x09); - break; - case V4L2_CID_AUTOGAIN: - err += sn9c102_i2c_write(cam, 0x13, ctrl->value); - break; - case V4L2_CID_VFLIP: - err += sn9c102_i2c_write(cam, 0x75, 0x0e | (ctrl->value << 7)); - break; - case V4L2_CID_BLACK_LEVEL: - err += sn9c102_i2c_write(cam, 0x25, ctrl->value); - break; - case SN9C102_V4L2_CID_BRIGHT_LEVEL: - err += sn9c102_i2c_write(cam, 0x24, ctrl->value); - break; - case SN9C102_V4L2_CID_GAMMA: - err += sn9c102_i2c_write(cam, 0x14, (ctrl->value << 2) | 0x80); - break; - case SN9C102_V4L2_CID_BAND_FILTER: - err += sn9c102_i2c_write(cam, 0x2d, ctrl->value << 2); - break; - default: - return -EINVAL; - } - - return err ? -EIO : 0; -} - - -static int ov7630_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) -{ - struct sn9c102_sensor* s = &ov7630; - int err = 0; - u8 v_start = (u8)(rect->top - s->cropcap.bounds.top) + 1; - - err += sn9c102_write_reg(cam, v_start, 0x13); - - return err; -} - - -static int ov7630_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) -{ - int err = 0; - - if (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) - err += sn9c102_write_reg(cam, 0x20, 0x19); - else - err += sn9c102_write_reg(cam, 0x50, 0x19); - - return err; -} - - -static struct sn9c102_sensor ov7630 = { - .name = "OV7630", - .maintainer = "Luca Risolia ", - .sysfs_ops = SN9C102_I2C_WRITE, - .frequency = SN9C102_I2C_100KHZ, - .interface = SN9C102_I2C_2WIRES, - .i2c_slave_id = 0x21, - .init = &ov7630_init, - .qctrl = { - { - .id = V4L2_CID_GAIN, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "global gain", - .minimum = 0x00, - .maximum = 0x3f, - .step = 0x01, - .default_value = 0x14, - .flags = 0, - }, - { - .id = V4L2_CID_HUE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "hue", - .minimum = 0x00, - .maximum = 0x1f+1, - .step = 0x01, - .default_value = 0x00, - .flags = 0, - }, - { - .id = V4L2_CID_SATURATION, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "saturation", - .minimum = 0x00, - .maximum = 0x0f, - .step = 0x01, - .default_value = 0x08, - .flags = 0, - }, - { - .id = V4L2_CID_CONTRAST, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "contrast", - .minimum = 0x00, - .maximum = 0x1f+1, - .step = 0x01, - .default_value = 0x00, - .flags = 0, - }, - { - .id = V4L2_CID_EXPOSURE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "exposure", - .minimum = 0x000, - .maximum = 0x3ff, - .step = 0x001, - .default_value = 0x83<<2, - .flags = 0, - }, - { - .id = V4L2_CID_RED_BALANCE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "red balance", - .minimum = 0x00, - .maximum = 0xff, - .step = 0x01, - .default_value = 0x3a, - .flags = 0, - }, - { - .id = V4L2_CID_BLUE_BALANCE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "blue balance", - .minimum = 0x00, - .maximum = 0xff, - .step = 0x01, - .default_value = 0x77, - .flags = 0, - }, - { - .id = V4L2_CID_BRIGHTNESS, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "brightness", - .minimum = 0x00, - .maximum = 0xff, - .step = 0x01, - .default_value = 0xa0, - .flags = 0, - }, - { - .id = V4L2_CID_DO_WHITE_BALANCE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "white balance background: blue", - .minimum = 0x00, - .maximum = 0x3f, - .step = 0x01, - .default_value = 0x20, - .flags = 0, - }, - { - .id = V4L2_CID_WHITENESS, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "white balance background: red", - .minimum = 0x00, - .maximum = 0x3f, - .step = 0x01, - .default_value = 0x20, - .flags = 0, - }, - { - .id = V4L2_CID_AUTO_WHITE_BALANCE, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "auto white balance", - .minimum = 0x00, - .maximum = 0x01, - .step = 0x01, - .default_value = 0x01, - .flags = 0, - }, - { - .id = V4L2_CID_AUTOGAIN, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "gain & exposure mode", - .minimum = 0x00, - .maximum = 0x03, - .step = 0x01, - .default_value = 0x00, - .flags = 0, - }, - { - .id = V4L2_CID_VFLIP, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "vertical flip", - .minimum = 0x00, - .maximum = 0x01, - .step = 0x01, - .default_value = 0x01, - .flags = 0, - }, - { - .id = V4L2_CID_BLACK_LEVEL, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "black pixel ratio", - .minimum = 0x01, - .maximum = 0x9a, - .step = 0x01, - .default_value = 0x8a, - .flags = 0, - }, - { - .id = SN9C102_V4L2_CID_BRIGHT_LEVEL, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "bright pixel ratio", - .minimum = 0x01, - .maximum = 0x9a, - .step = 0x01, - .default_value = 0x10, - .flags = 0, - }, - { - .id = SN9C102_V4L2_CID_BAND_FILTER, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "band filter", - .minimum = 0x00, - .maximum = 0x01, - .step = 0x01, - .default_value = 0x00, - .flags = 0, - }, - { - .id = SN9C102_V4L2_CID_GAMMA, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "rgb gamma", - .minimum = 0x00, - .maximum = 0x01, - .step = 0x01, - .default_value = 0x00, - .flags = 0, - }, - }, - .set_ctrl = &ov7630_set_ctrl, - .cropcap = { - .bounds = { - .left = 0, - .top = 0, - .width = 640, - .height = 480, - }, - .defrect = { - .left = 0, - .top = 0, - .width = 640, - .height = 480, - }, - }, - .set_crop = &ov7630_set_crop, - .pix_format = { - .width = 640, - .height = 480, - .pixelformat = V4L2_PIX_FMT_SBGGR8, - .priv = 8, - }, - .set_pix_format = &ov7630_set_pix_format -}; - - -int sn9c102_probe_ov7630(struct sn9c102_device* cam) -{ - int err = 0; - - sn9c102_attach_sensor(cam, &ov7630); - - if (le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x608f && - le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x602c) - return -ENODEV; - - err += sn9c102_write_reg(cam, 0x01, 0x01); - err += sn9c102_write_reg(cam, 0x00, 0x01); - err += sn9c102_write_reg(cam, 0x28, 0x17); - - if (err) - return -EIO; - - err += sn9c102_i2c_write(cam, 0x0b, 0); - if (err) - return -ENODEV; - - return 0; -} diff --git a/trunk/drivers/usb/media/sn9c102_sensor.h b/trunk/drivers/usb/media/sn9c102_sensor.h index a45166c3488c..6a7adebcb4bf 100644 --- a/trunk/drivers/usb/media/sn9c102_sensor.h +++ b/trunk/drivers/usb/media/sn9c102_sensor.h @@ -64,7 +64,6 @@ struct sn9c102_sensor; */ extern int sn9c102_probe_hv7131d(struct sn9c102_device* cam); extern int sn9c102_probe_mi0343(struct sn9c102_device* cam); -extern int sn9c102_probe_ov7630(struct sn9c102_device* cam); extern int sn9c102_probe_pas106b(struct sn9c102_device* cam); extern int sn9c102_probe_pas202bcb(struct sn9c102_device* cam); extern int sn9c102_probe_tas5110c1b(struct sn9c102_device* cam); @@ -81,7 +80,6 @@ static int (*sn9c102_sensor_table[])(struct sn9c102_device*) = { \ &sn9c102_probe_pas106b, /* strong detection based on SENSOR ids */ \ &sn9c102_probe_pas202bcb, /* strong detection based on SENSOR ids */ \ &sn9c102_probe_hv7131d, /* strong detection based on SENSOR ids */ \ - &sn9c102_probe_ov7630, /* detection mostly based on USB pid/vid */ \ &sn9c102_probe_tas5110c1b, /* detection based on USB pid/vid */ \ &sn9c102_probe_tas5130d1b, /* detection based on USB pid/vid */ \ NULL, \ @@ -105,8 +103,7 @@ static const struct usb_device_id sn9c102_id_table[] = { \ { USB_DEVICE(0x0c45, 0x6029), }, /* PAS106B */ \ { USB_DEVICE(0x0c45, 0x602a), }, /* HV7131D */ \ { USB_DEVICE(0x0c45, 0x602b), }, /* MI-0343 */ \ - { USB_DEVICE(0x0c45, 0x602c), }, /* OV7630 */ \ - { USB_DEVICE(0x0c45, 0x602d), }, \ + { USB_DEVICE(0x0c45, 0x602c), }, /* OV7620 */ \ { USB_DEVICE(0x0c45, 0x6030), }, /* MI03x */ \ { USB_DEVICE(0x0c45, 0x6080), }, \ { USB_DEVICE(0x0c45, 0x6082), }, /* MI0343 and MI0360 */ \ @@ -148,8 +145,6 @@ static const struct usb_device_id sn9c102_id_table[] = { \ */ /* The "try" I2C I/O versions are used when probing the sensor */ -extern int sn9c102_i2c_try_write(struct sn9c102_device*,struct sn9c102_sensor*, - u8 address, u8 value); extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*, u8 address); @@ -206,8 +201,6 @@ enum sn9c102_i2c_interface { SN9C102_I2C_3WIRES, }; -#define SN9C102_MAX_CTRLS V4L2_CID_LASTP1-V4L2_CID_BASE+10 - struct sn9c102_sensor { char name[32], /* sensor name */ maintainer[64]; /* name of the mantainer */ @@ -250,7 +243,7 @@ struct sn9c102_sensor { sensor according to the default configuration structures below. */ - struct v4l2_queryctrl qctrl[SN9C102_MAX_CTRLS]; + struct v4l2_queryctrl qctrl[V4L2_CID_LASTP1-V4L2_CID_BASE]; /* Optional list of default controls, defined as indicated in the V4L2 API. Menu type controls are not handled by this interface. @@ -363,7 +356,7 @@ struct sn9c102_sensor { core module to store successfully updated values of the above settings, for rollbacks..etc..in case of errors during atomic I/O */ - struct v4l2_queryctrl _qctrl[SN9C102_MAX_CTRLS]; + struct v4l2_queryctrl _qctrl[V4L2_CID_LASTP1-V4L2_CID_BASE]; struct v4l2_rect _rect; }; @@ -374,8 +367,5 @@ struct sn9c102_sensor { #define SN9C102_V4L2_CID_GREEN_BALANCE V4L2_CID_PRIVATE_BASE + 1 #define SN9C102_V4L2_CID_RESET_LEVEL V4L2_CID_PRIVATE_BASE + 2 #define SN9C102_V4L2_CID_PIXEL_BIAS_VOLTAGE V4L2_CID_PRIVATE_BASE + 3 -#define SN9C102_V4L2_CID_GAMMA V4L2_CID_PRIVATE_BASE + 4 -#define SN9C102_V4L2_CID_BAND_FILTER V4L2_CID_PRIVATE_BASE + 5 -#define SN9C102_V4L2_CID_BRIGHT_LEVEL V4L2_CID_PRIVATE_BASE + 6 #endif /* _SN9C102_SENSOR_H_ */ diff --git a/trunk/drivers/usb/media/sn9c102_tas5110c1b.c b/trunk/drivers/usb/media/sn9c102_tas5110c1b.c index 8775999b5aff..690d62192273 100644 --- a/trunk/drivers/usb/media/sn9c102_tas5110c1b.c +++ b/trunk/drivers/usb/media/sn9c102_tas5110c1b.c @@ -24,6 +24,8 @@ static struct sn9c102_sensor tas5110c1b; +static struct v4l2_control tas5110c1b_gain; + static int tas5110c1b_init(struct sn9c102_device* cam) { @@ -44,6 +46,21 @@ static int tas5110c1b_init(struct sn9c102_device* cam) } +static int tas5110c1b_get_ctrl(struct sn9c102_device* cam, + struct v4l2_control* ctrl) +{ + switch (ctrl->id) { + case V4L2_CID_GAIN: + ctrl->value = tas5110c1b_gain.value; + break; + default: + return -EINVAL; + } + + return 0; +} + + static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, const struct v4l2_control* ctrl) { @@ -51,7 +68,8 @@ static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, switch (ctrl->id) { case V4L2_CID_GAIN: - err += sn9c102_i2c_write(cam, 0x20, 0xf6 - ctrl->value); + if (!(err += sn9c102_i2c_write(cam, 0x20, 0xf6 - ctrl->value))) + tas5110c1b_gain.value = ctrl->value; break; default: return -EINVAL; @@ -129,6 +147,7 @@ static struct sn9c102_sensor tas5110c1b = { .height = 288, }, }, + .get_ctrl = &tas5110c1b_get_ctrl, .set_crop = &tas5110c1b_set_crop, .pix_format = { .width = 352, diff --git a/trunk/drivers/usb/media/sn9c102_tas5130d1b.c b/trunk/drivers/usb/media/sn9c102_tas5130d1b.c index 927eafdd8c73..b378e941bbe8 100644 --- a/trunk/drivers/usb/media/sn9c102_tas5130d1b.c +++ b/trunk/drivers/usb/media/sn9c102_tas5130d1b.c @@ -24,6 +24,8 @@ static struct sn9c102_sensor tas5130d1b; +static struct v4l2_control tas5130d1b_gain, tas5130d1b_exposure; + static int tas5130d1b_init(struct sn9c102_device* cam) { @@ -42,6 +44,24 @@ static int tas5130d1b_init(struct sn9c102_device* cam) } +static int tas5130d1b_get_ctrl(struct sn9c102_device* cam, + struct v4l2_control* ctrl) +{ + switch (ctrl->id) { + case V4L2_CID_GAIN: + ctrl->value = tas5130d1b_gain.value; + break; + case V4L2_CID_EXPOSURE: + ctrl->value = tas5130d1b_exposure.value; + break; + default: + return -EINVAL; + } + + return 0; +} + + static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, const struct v4l2_control* ctrl) { @@ -49,10 +69,12 @@ static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, switch (ctrl->id) { case V4L2_CID_GAIN: - err += sn9c102_i2c_write(cam, 0x20, 0xf6 - ctrl->value); + if (!(err += sn9c102_i2c_write(cam, 0x20, 0xf6 - ctrl->value))) + tas5130d1b_gain.value = ctrl->value; break; case V4L2_CID_EXPOSURE: - err += sn9c102_i2c_write(cam, 0x40, 0x47 - ctrl->value); + if (!(err += sn9c102_i2c_write(cam, 0x40, 0x47 - ctrl->value))) + tas5130d1b_exposure.value = ctrl->value; break; default: return -EINVAL; @@ -125,6 +147,7 @@ static struct sn9c102_sensor tas5130d1b = { .flags = 0, }, }, + .get_ctrl = &tas5130d1b_get_ctrl, .set_ctrl = &tas5130d1b_set_ctrl, .cropcap = { .bounds = { diff --git a/trunk/drivers/usb/misc/Kconfig b/trunk/drivers/usb/misc/Kconfig index 6649531fa824..3a896954b3a9 100644 --- a/trunk/drivers/usb/misc/Kconfig +++ b/trunk/drivers/usb/misc/Kconfig @@ -139,16 +139,6 @@ config USB_IDMOUSE source "drivers/usb/misc/sisusbvga/Kconfig" -config USB_LD - tristate "USB LD driver" - depends on USB && EXPERIMENTAL - help - This driver is for generic USB devices that use interrupt transfers, - like LD Didactic's USB devices. - - To compile this driver as a module, choose M here: the - module will be called ldusb. - config USB_TEST tristate "USB testing driver (DEVELOPMENT)" depends on USB && USB_DEVICEFS && EXPERIMENTAL diff --git a/trunk/drivers/usb/misc/Makefile b/trunk/drivers/usb/misc/Makefile index 862e40a83689..4a3814cbd48d 100644 --- a/trunk/drivers/usb/misc/Makefile +++ b/trunk/drivers/usb/misc/Makefile @@ -9,7 +9,6 @@ obj-$(CONFIG_USB_EMI26) += emi26.o obj-$(CONFIG_USB_EMI62) += emi62.o obj-$(CONFIG_USB_IDMOUSE) += idmouse.o obj-$(CONFIG_USB_LCD) += usblcd.o -obj-$(CONFIG_USB_LD) += ldusb.o obj-$(CONFIG_USB_LED) += usbled.o obj-$(CONFIG_USB_LEGOTOWER) += legousbtower.o obj-$(CONFIG_USB_PHIDGETKIT) += phidgetkit.o diff --git a/trunk/drivers/usb/misc/ldusb.c b/trunk/drivers/usb/misc/ldusb.c deleted file mode 100644 index 66ec88354b93..000000000000 --- a/trunk/drivers/usb/misc/ldusb.c +++ /dev/null @@ -1,794 +0,0 @@ -/** - * Generic USB driver for report based interrupt in/out devices - * like LD Didactic's USB devices. LD Didactic's USB devices are - * HID devices which do not use HID report definitons (they use - * raw interrupt in and our reports only for communication). - * - * This driver uses a ring buffer for time critical reading of - * interrupt in reports and provides read and write methods for - * raw interrupt reports (similar to the Windows HID driver). - * Devices based on the book USB COMPLETE by Jan Axelson may need - * such a compatibility to the Windows HID driver. - * - * Copyright (C) 2005 Michael Hund - * - * 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. - * - * Derived from Lego USB Tower driver - * Copyright (C) 2003 David Glance - * 2001-2004 Juergen Stuber - * - * V0.1 (mh) Initial version - * V0.11 (mh) Added raw support for HID 1.0 devices (no interrupt out endpoint) - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -/* Define these values to match your devices */ -#define USB_VENDOR_ID_LD 0x0f11 /* USB Vendor ID of LD Didactic GmbH */ -#define USB_DEVICE_ID_CASSY 0x1000 /* USB Product ID for all CASSY-S modules */ -#define USB_DEVICE_ID_POCKETCASSY 0x1010 /* USB Product ID for Pocket-CASSY */ -#define USB_DEVICE_ID_MOBILECASSY 0x1020 /* USB Product ID for Mobile-CASSY */ -#define USB_DEVICE_ID_JWM 0x1080 /* USB Product ID for Joule and Wattmeter */ -#define USB_DEVICE_ID_DMMP 0x1081 /* USB Product ID for Digital Multimeter P (reserved) */ -#define USB_DEVICE_ID_UMIP 0x1090 /* USB Product ID for UMI P */ -#define USB_DEVICE_ID_VIDEOCOM 0x1200 /* USB Product ID for VideoCom */ -#define USB_DEVICE_ID_COM3LAB 0x2000 /* USB Product ID for COM3LAB */ -#define USB_DEVICE_ID_TELEPORT 0x2010 /* USB Product ID for Terminal Adapter */ -#define USB_DEVICE_ID_NETWORKANALYSER 0x2020 /* USB Product ID for Network Analyser */ -#define USB_DEVICE_ID_POWERCONTROL 0x2030 /* USB Product ID for Controlling device for Power Electronics */ - -#define USB_VENDOR_ID_VERNIER 0x08f7 -#define USB_DEVICE_ID_VERNIER_LABPRO 0x0001 -#define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002 -#define USB_DEVICE_ID_VERNIER_SKIP 0x0003 -#define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 - - -#ifdef CONFIG_USB_DYNAMIC_MINORS -#define USB_LD_MINOR_BASE 0 -#else -#define USB_LD_MINOR_BASE 176 -#endif - -/* table of devices that work with this driver */ -static struct usb_device_id ld_usb_table [] = { - { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_CASSY) }, - { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_POCKETCASSY) }, - { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_MOBILECASSY) }, - { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_JWM) }, - { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_DMMP) }, - { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_UMIP) }, - { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_VIDEOCOM) }, - { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_COM3LAB) }, - { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_TELEPORT) }, - { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_NETWORKANALYSER) }, - { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_POWERCONTROL) }, - { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, - { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, - { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, - { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) }, - { } /* Terminating entry */ -}; -MODULE_DEVICE_TABLE(usb, ld_usb_table); -MODULE_VERSION("V0.11"); -MODULE_AUTHOR("Michael Hund "); -MODULE_DESCRIPTION("LD USB Driver"); -MODULE_LICENSE("GPL"); -MODULE_SUPPORTED_DEVICE("LD USB Devices"); - -#ifdef CONFIG_USB_DEBUG - static int debug = 1; -#else - static int debug = 0; -#endif - -/* Use our own dbg macro */ -#define dbg_info(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0) - -/* Module parameters */ -module_param(debug, int, S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(debug, "Debug enabled or not"); - -/* All interrupt in transfers are collected in a ring buffer to - * avoid racing conditions and get better performance of the driver. - */ -static int ring_buffer_size = 128; -module_param(ring_buffer_size, int, 0); -MODULE_PARM_DESC(ring_buffer_size, "Read ring buffer size in reports"); - -/* The write_buffer can contain more than one interrupt out transfer. - */ -static int write_buffer_size = 10; -module_param(write_buffer_size, int, 0); -MODULE_PARM_DESC(write_buffer_size, "Write buffer size in reports"); - -/* As of kernel version 2.6.4 ehci-hcd uses an - * "only one interrupt transfer per frame" shortcut - * to simplify the scheduling of periodic transfers. - * This conflicts with our standard 1ms intervals for in and out URBs. - * We use default intervals of 2ms for in and 2ms for out transfers, - * which should be fast enough. - * Increase the interval to allow more devices that do interrupt transfers, - * or set to 1 to use the standard interval from the endpoint descriptors. - */ -static int min_interrupt_in_interval = 2; -module_param(min_interrupt_in_interval, int, 0); -MODULE_PARM_DESC(min_interrupt_in_interval, "Minimum interrupt in interval in ms"); - -static int min_interrupt_out_interval = 2; -module_param(min_interrupt_out_interval, int, 0); -MODULE_PARM_DESC(min_interrupt_out_interval, "Minimum interrupt out interval in ms"); - -/* Structure to hold all of our device specific stuff */ -struct ld_usb { - struct semaphore sem; /* locks this structure */ - struct usb_interface* intf; /* save off the usb interface pointer */ - - int open_count; /* number of times this port has been opened */ - - char* ring_buffer; - unsigned int ring_head; - unsigned int ring_tail; - - wait_queue_head_t read_wait; - wait_queue_head_t write_wait; - - char* interrupt_in_buffer; - struct usb_endpoint_descriptor* interrupt_in_endpoint; - struct urb* interrupt_in_urb; - int interrupt_in_interval; - size_t interrupt_in_endpoint_size; - int interrupt_in_running; - int interrupt_in_done; - - char* interrupt_out_buffer; - struct usb_endpoint_descriptor* interrupt_out_endpoint; - struct urb* interrupt_out_urb; - int interrupt_out_interval; - size_t interrupt_out_endpoint_size; - int interrupt_out_busy; -}; - -/* prevent races between open() and disconnect() */ -static DECLARE_MUTEX(disconnect_sem); - -static struct usb_driver ld_usb_driver; - -/** - * ld_usb_abort_transfers - * aborts transfers and frees associated data structures - */ -static void ld_usb_abort_transfers(struct ld_usb *dev) -{ - /* shutdown transfer */ - if (dev->interrupt_in_running) { - dev->interrupt_in_running = 0; - if (dev->intf) - usb_kill_urb(dev->interrupt_in_urb); - } - if (dev->interrupt_out_busy) - if (dev->intf) - usb_kill_urb(dev->interrupt_out_urb); -} - -/** - * ld_usb_delete - */ -static void ld_usb_delete(struct ld_usb *dev) -{ - ld_usb_abort_transfers(dev); - - /* free data structures */ - usb_free_urb(dev->interrupt_in_urb); - usb_free_urb(dev->interrupt_out_urb); - kfree(dev->ring_buffer); - kfree(dev->interrupt_in_buffer); - kfree(dev->interrupt_out_buffer); - kfree(dev); -} - -/** - * ld_usb_interrupt_in_callback - */ -static void ld_usb_interrupt_in_callback(struct urb *urb, struct pt_regs *regs) -{ - struct ld_usb *dev = urb->context; - size_t *actual_buffer; - unsigned int next_ring_head; - int retval; - - if (urb->status) { - if (urb->status == -ENOENT || - urb->status == -ECONNRESET || - urb->status == -ESHUTDOWN) { - goto exit; - } else { - dbg_info(&dev->intf->dev, "%s: nonzero status received: %d\n", - __FUNCTION__, urb->status); - goto resubmit; /* maybe we can recover */ - } - } - - if (urb->actual_length > 0) { - next_ring_head = (dev->ring_head+1) % ring_buffer_size; - if (next_ring_head != dev->ring_tail) { - actual_buffer = (size_t*)(dev->ring_buffer + dev->ring_head*(sizeof(size_t)+dev->interrupt_in_endpoint_size)); - /* actual_buffer gets urb->actual_length + interrupt_in_buffer */ - *actual_buffer = urb->actual_length; - memcpy(actual_buffer+1, dev->interrupt_in_buffer, urb->actual_length); - dev->ring_head = next_ring_head; - dbg_info(&dev->intf->dev, "%s: received %d bytes\n", - __FUNCTION__, urb->actual_length); - } else - dev_warn(&dev->intf->dev, - "Ring buffer overflow, %d bytes dropped\n", - urb->actual_length); - } - -resubmit: - /* resubmit if we're still running */ - if (dev->interrupt_in_running && dev->intf) { - retval = usb_submit_urb(dev->interrupt_in_urb, GFP_ATOMIC); - if (retval) - dev_err(&dev->intf->dev, - "usb_submit_urb failed (%d)\n", retval); - } - -exit: - dev->interrupt_in_done = 1; - wake_up_interruptible(&dev->read_wait); -} - -/** - * ld_usb_interrupt_out_callback - */ -static void ld_usb_interrupt_out_callback(struct urb *urb, struct pt_regs *regs) -{ - struct ld_usb *dev = urb->context; - - /* sync/async unlink faults aren't errors */ - if (urb->status && !(urb->status == -ENOENT || - urb->status == -ECONNRESET || - urb->status == -ESHUTDOWN)) - dbg_info(&dev->intf->dev, - "%s - nonzero write interrupt status received: %d\n", - __FUNCTION__, urb->status); - - dev->interrupt_out_busy = 0; - wake_up_interruptible(&dev->write_wait); -} - -/** - * ld_usb_open - */ -static int ld_usb_open(struct inode *inode, struct file *file) -{ - struct ld_usb *dev; - int subminor; - int retval = 0; - struct usb_interface *interface; - - nonseekable_open(inode, file); - subminor = iminor(inode); - - down(&disconnect_sem); - - interface = usb_find_interface(&ld_usb_driver, subminor); - - if (!interface) { - err("%s - error, can't find device for minor %d\n", - __FUNCTION__, subminor); - retval = -ENODEV; - goto unlock_disconnect_exit; - } - - dev = usb_get_intfdata(interface); - - if (!dev) { - retval = -ENODEV; - goto unlock_disconnect_exit; - } - - /* lock this device */ - if (down_interruptible(&dev->sem)) { - retval = -ERESTARTSYS; - goto unlock_disconnect_exit; - } - - /* allow opening only once */ - if (dev->open_count) { - retval = -EBUSY; - goto unlock_exit; - } - dev->open_count = 1; - - /* initialize in direction */ - dev->ring_head = 0; - dev->ring_tail = 0; - usb_fill_int_urb(dev->interrupt_in_urb, - interface_to_usbdev(interface), - usb_rcvintpipe(interface_to_usbdev(interface), - dev->interrupt_in_endpoint->bEndpointAddress), - dev->interrupt_in_buffer, - dev->interrupt_in_endpoint_size, - ld_usb_interrupt_in_callback, - dev, - dev->interrupt_in_interval); - - dev->interrupt_in_running = 1; - dev->interrupt_in_done = 0; - - retval = usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL); - if (retval) { - dev_err(&interface->dev, "Couldn't submit interrupt_in_urb %d\n", retval); - dev->interrupt_in_running = 0; - dev->open_count = 0; - goto unlock_exit; - } - - /* save device in the file's private structure */ - file->private_data = dev; - -unlock_exit: - up(&dev->sem); - -unlock_disconnect_exit: - up(&disconnect_sem); - - return retval; -} - -/** - * ld_usb_release - */ -static int ld_usb_release(struct inode *inode, struct file *file) -{ - struct ld_usb *dev; - int retval = 0; - - dev = file->private_data; - - if (dev == NULL) { - retval = -ENODEV; - goto exit; - } - - if (down_interruptible(&dev->sem)) { - retval = -ERESTARTSYS; - goto exit; - } - - if (dev->open_count != 1) { - retval = -ENODEV; - goto unlock_exit; - } - if (dev->intf == NULL) { - /* the device was unplugged before the file was released */ - up(&dev->sem); - /* unlock here as ld_usb_delete frees dev */ - ld_usb_delete(dev); - goto exit; - } - - /* wait until write transfer is finished */ - if (dev->interrupt_out_busy) - wait_event_interruptible_timeout(dev->write_wait, !dev->interrupt_out_busy, 2 * HZ); - ld_usb_abort_transfers(dev); - dev->open_count = 0; - -unlock_exit: - up(&dev->sem); - -exit: - return retval; -} - -/** - * ld_usb_poll - */ -static unsigned int ld_usb_poll(struct file *file, poll_table *wait) -{ - struct ld_usb *dev; - unsigned int mask = 0; - - dev = file->private_data; - - poll_wait(file, &dev->read_wait, wait); - poll_wait(file, &dev->write_wait, wait); - - if (dev->ring_head != dev->ring_tail) - mask |= POLLIN | POLLRDNORM; - if (!dev->interrupt_out_busy) - mask |= POLLOUT | POLLWRNORM; - - return mask; -} - -/** - * ld_usb_read - */ -static ssize_t ld_usb_read(struct file *file, char __user *buffer, size_t count, - loff_t *ppos) -{ - struct ld_usb *dev; - size_t *actual_buffer; - size_t bytes_to_read; - int retval = 0; - - dev = file->private_data; - - /* verify that we actually have some data to read */ - if (count == 0) - goto exit; - - /* lock this object */ - if (down_interruptible(&dev->sem)) { - retval = -ERESTARTSYS; - goto exit; - } - - /* verify that the device wasn't unplugged */ - if (dev->intf == NULL) { - retval = -ENODEV; - err("No device or device unplugged %d\n", retval); - goto unlock_exit; - } - - /* wait for data */ - if (dev->ring_head == dev->ring_tail) { - if (file->f_flags & O_NONBLOCK) { - retval = -EAGAIN; - goto unlock_exit; - } - retval = wait_event_interruptible(dev->read_wait, dev->interrupt_in_done); - if (retval < 0) - goto unlock_exit; - } - - /* actual_buffer contains actual_length + interrupt_in_buffer */ - actual_buffer = (size_t*)(dev->ring_buffer + dev->ring_tail*(sizeof(size_t)+dev->interrupt_in_endpoint_size)); - bytes_to_read = min(count, *actual_buffer); - if (bytes_to_read < *actual_buffer) - dev_warn(&dev->intf->dev, "Read buffer overflow, %d bytes dropped\n", - *actual_buffer-bytes_to_read); - - /* copy one interrupt_in_buffer from ring_buffer into userspace */ - if (copy_to_user(buffer, actual_buffer+1, bytes_to_read)) { - retval = -EFAULT; - goto unlock_exit; - } - dev->ring_tail = (dev->ring_tail+1) % ring_buffer_size; - - retval = bytes_to_read; - -unlock_exit: - /* unlock the device */ - up(&dev->sem); - -exit: - return retval; -} - -/** - * ld_usb_write - */ -static ssize_t ld_usb_write(struct file *file, const char __user *buffer, - size_t count, loff_t *ppos) -{ - struct ld_usb *dev; - size_t bytes_to_write; - int retval = 0; - - dev = file->private_data; - - /* verify that we actually have some data to write */ - if (count == 0) - goto exit; - - /* lock this object */ - if (down_interruptible(&dev->sem)) { - retval = -ERESTARTSYS; - goto exit; - } - - /* verify that the device wasn't unplugged */ - if (dev->intf == NULL) { - retval = -ENODEV; - err("No device or device unplugged %d\n", retval); - goto unlock_exit; - } - - /* wait until previous transfer is finished */ - if (dev->interrupt_out_busy) { - if (file->f_flags & O_NONBLOCK) { - retval = -EAGAIN; - goto unlock_exit; - } - retval = wait_event_interruptible(dev->write_wait, !dev->interrupt_out_busy); - if (retval < 0) { - goto unlock_exit; - } - } - - /* write the data into interrupt_out_buffer from userspace */ - bytes_to_write = min(count, write_buffer_size*dev->interrupt_out_endpoint_size); - if (bytes_to_write < count) - dev_warn(&dev->intf->dev, "Write buffer overflow, %d bytes dropped\n",count-bytes_to_write); - dbg_info(&dev->intf->dev, "%s: count = %d, bytes_to_write = %d\n", __FUNCTION__, count, bytes_to_write); - - if (copy_from_user(dev->interrupt_out_buffer, buffer, bytes_to_write)) { - retval = -EFAULT; - goto unlock_exit; - } - - if (dev->interrupt_out_endpoint == NULL) { - /* try HID_REQ_SET_REPORT=9 on control_endpoint instead of interrupt_out_endpoint */ - retval = usb_control_msg(interface_to_usbdev(dev->intf), - usb_sndctrlpipe(interface_to_usbdev(dev->intf), 0), - 9, - USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, - 1 << 8, 0, - dev->interrupt_out_buffer, - bytes_to_write, - USB_CTRL_SET_TIMEOUT * HZ); - if (retval < 0) - err("Couldn't submit HID_REQ_SET_REPORT %d\n", retval); - goto unlock_exit; - } - - /* send off the urb */ - usb_fill_int_urb(dev->interrupt_out_urb, - interface_to_usbdev(dev->intf), - usb_sndintpipe(interface_to_usbdev(dev->intf), - dev->interrupt_out_endpoint->bEndpointAddress), - dev->interrupt_out_buffer, - bytes_to_write, - ld_usb_interrupt_out_callback, - dev, - dev->interrupt_out_interval); - - dev->interrupt_out_busy = 1; - wmb(); - - retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); - if (retval) { - dev->interrupt_out_busy = 0; - err("Couldn't submit interrupt_out_urb %d\n", retval); - goto unlock_exit; - } - retval = bytes_to_write; - -unlock_exit: - /* unlock the device */ - up(&dev->sem); - -exit: - return retval; -} - -/* file operations needed when we register this driver */ -static struct file_operations ld_usb_fops = { - .owner = THIS_MODULE, - .read = ld_usb_read, - .write = ld_usb_write, - .open = ld_usb_open, - .release = ld_usb_release, - .poll = ld_usb_poll, -}; - -/* - * usb class driver info in order to get a minor number from the usb core, - * and to have the device registered with devfs and the driver core - */ -static struct usb_class_driver ld_usb_class = { - .name = "ldusb%d", - .fops = &ld_usb_fops, - .minor_base = USB_LD_MINOR_BASE, -}; - -/** - * ld_usb_probe - * - * Called by the usb core when a new device is connected that it thinks - * this driver might be interested in. - */ -static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) -{ - struct usb_device *udev = interface_to_usbdev(intf); - struct ld_usb *dev = NULL; - struct usb_host_interface *iface_desc; - struct usb_endpoint_descriptor *endpoint; - char *buffer; - int i; - int retval = -ENOMEM; - - /* allocate memory for our device state and intialize it */ - - dev = kmalloc(sizeof(*dev), GFP_KERNEL); - if (dev == NULL) { - dev_err(&intf->dev, "Out of memory\n"); - goto exit; - } - memset(dev, 0x00, sizeof(*dev)); - init_MUTEX(&dev->sem); - dev->intf = intf; - init_waitqueue_head(&dev->read_wait); - init_waitqueue_head(&dev->write_wait); - - /* workaround for early firmware versions on fast computers */ - if ((le16_to_cpu(udev->descriptor.idVendor) == USB_VENDOR_ID_LD) && - ((le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_CASSY) || - (le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_COM3LAB)) && - (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) { - buffer = kmalloc(256, GFP_KERNEL); - /* usb_string makes SETUP+STALL to leave always ControlReadLoop */ - usb_string(udev, 255, buffer, 256); - kfree(buffer); - } - - iface_desc = intf->cur_altsetting; - - /* set up the endpoint information */ - for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { - endpoint = &iface_desc->endpoint[i].desc; - - if (((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) && - ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT)) { - dev->interrupt_in_endpoint = endpoint; - } - - if (((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) && - ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT)) { - dev->interrupt_out_endpoint = endpoint; - } - } - if (dev->interrupt_in_endpoint == NULL) { - dev_err(&intf->dev, "Interrupt in endpoint not found\n"); - goto error; - } - if (dev->interrupt_out_endpoint == NULL) - dev_warn(&intf->dev, "Interrupt out endpoint not found (using control endpoint instead)\n"); - - dev->interrupt_in_endpoint_size = le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize); - dev->ring_buffer = kmalloc(ring_buffer_size*(sizeof(size_t)+dev->interrupt_in_endpoint_size), GFP_KERNEL); - if (!dev->ring_buffer) { - dev_err(&intf->dev, "Couldn't allocate ring_buffer\n"); - goto error; - } - dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL); - if (!dev->interrupt_in_buffer) { - dev_err(&intf->dev, "Couldn't allocate interrupt_in_buffer\n"); - goto error; - } - dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!dev->interrupt_in_urb) { - dev_err(&intf->dev, "Couldn't allocate interrupt_in_urb\n"); - goto error; - } - dev->interrupt_out_endpoint_size = dev->interrupt_out_endpoint ? le16_to_cpu(dev->interrupt_out_endpoint->wMaxPacketSize) : - udev->descriptor.bMaxPacketSize0; - dev->interrupt_out_buffer = kmalloc(write_buffer_size*dev->interrupt_out_endpoint_size, GFP_KERNEL); - if (!dev->interrupt_out_buffer) { - dev_err(&intf->dev, "Couldn't allocate interrupt_out_buffer\n"); - goto error; - } - dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!dev->interrupt_out_urb) { - dev_err(&intf->dev, "Couldn't allocate interrupt_out_urb\n"); - goto error; - } - dev->interrupt_in_interval = min_interrupt_in_interval > dev->interrupt_in_endpoint->bInterval ? min_interrupt_in_interval : dev->interrupt_in_endpoint->bInterval; - if (dev->interrupt_out_endpoint) - dev->interrupt_out_interval = min_interrupt_out_interval > dev->interrupt_out_endpoint->bInterval ? min_interrupt_out_interval : dev->interrupt_out_endpoint->bInterval; - - /* we can register the device now, as it is ready */ - usb_set_intfdata(intf, dev); - - retval = usb_register_dev(intf, &ld_usb_class); - if (retval) { - /* something prevented us from registering this driver */ - dev_err(&intf->dev, "Not able to get a minor for this device.\n"); - usb_set_intfdata(intf, NULL); - goto error; - } - - /* let the user know what node this device is now attached to */ - dev_info(&intf->dev, "LD USB Device #%d now attached to major %d minor %d\n", - (intf->minor - USB_LD_MINOR_BASE), USB_MAJOR, intf->minor); - -exit: - return retval; - -error: - ld_usb_delete(dev); - - return retval; -} - -/** - * ld_usb_disconnect - * - * Called by the usb core when the device is removed from the system. - */ -static void ld_usb_disconnect(struct usb_interface *intf) -{ - struct ld_usb *dev; - int minor; - - down(&disconnect_sem); - - dev = usb_get_intfdata(intf); - usb_set_intfdata(intf, NULL); - - down(&dev->sem); - - minor = intf->minor; - - /* give back our minor */ - usb_deregister_dev(intf, &ld_usb_class); - - /* if the device is not opened, then we clean up right now */ - if (!dev->open_count) { - up(&dev->sem); - ld_usb_delete(dev); - } else { - dev->intf = NULL; - up(&dev->sem); - } - - up(&disconnect_sem); - - dev_info(&intf->dev, "LD USB Device #%d now disconnected\n", - (minor - USB_LD_MINOR_BASE)); -} - -/* usb specific object needed to register this driver with the usb subsystem */ -static struct usb_driver ld_usb_driver = { - .owner = THIS_MODULE, - .name = "ldusb", - .probe = ld_usb_probe, - .disconnect = ld_usb_disconnect, - .id_table = ld_usb_table, -}; - -/** - * ld_usb_init - */ -static int __init ld_usb_init(void) -{ - int retval; - - /* register this driver with the USB subsystem */ - retval = usb_register(&ld_usb_driver); - if (retval) - err("usb_register failed for the "__FILE__" driver. Error number %d\n", retval); - - return retval; -} - -/** - * ld_usb_exit - */ -static void __exit ld_usb_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&ld_usb_driver); -} - -module_init(ld_usb_init); -module_exit(ld_usb_exit); - diff --git a/trunk/drivers/usb/mon/mon_text.c b/trunk/drivers/usb/mon/mon_text.c index 26266b30028e..755a4570477f 100644 --- a/trunk/drivers/usb/mon/mon_text.c +++ b/trunk/drivers/usb/mon/mon_text.c @@ -18,17 +18,12 @@ */ #define DATA_MAX 32 -/* - * Defined by USB 2.0 clause 9.3, table 9.2. - */ -#define SETUP_MAX 8 - /* * This limit exists to prevent OOMs when the user process stops reading. */ #define EVENT_MAX 25 -#define PRINTF_DFL 130 +#define PRINTF_DFL 120 struct mon_event_text { struct list_head e_link; @@ -38,9 +33,7 @@ struct mon_event_text { unsigned int tstamp; int length; /* Depends on type: xfer length or act length */ int status; - char setup_flag; char data_flag; - unsigned char setup[SETUP_MAX]; unsigned char data[DATA_MAX]; }; @@ -71,22 +64,6 @@ static void mon_text_dtor(void *, kmem_cache_t *, unsigned long); * This is called with the whole mon_bus locked, so no additional lock. */ -static inline char mon_text_get_setup(struct mon_event_text *ep, - struct urb *urb, char ev_type) -{ - - if (!usb_pipecontrol(urb->pipe) || ev_type != 'S') - return '-'; - - if (urb->transfer_flags & URB_NO_SETUP_DMA_MAP) - return 'D'; - if (urb->setup_packet == NULL) - return 'Z'; /* '0' would be not as pretty. */ - - memcpy(ep->setup, urb->setup_packet, SETUP_MAX); - return 0; -} - static inline char mon_text_get_data(struct mon_event_text *ep, struct urb *urb, int len, char ev_type) { @@ -113,6 +90,7 @@ static inline char mon_text_get_data(struct mon_event_text *ep, struct urb *urb, /* * Bulk is easy to shortcut reliably. + * XXX Control needs setup packet taken. * XXX Other pipe types need consideration. Currently, we overdo it * and collect garbage for them: better more than less. */ @@ -166,7 +144,6 @@ static void mon_text_event(struct mon_reader_text *rp, struct urb *urb, /* Collecting status makes debugging sense for submits, too */ ep->status = urb->status; - ep->setup_flag = mon_text_get_setup(ep, urb, ev_type); ep->data_flag = mon_text_get_data(ep, urb, ep->length, ev_type); rp->nevents++; @@ -322,25 +299,10 @@ static ssize_t mon_text_read(struct file *file, char __user *buf, default: /* PIPE_BULK */ utype = 'B'; } cnt += snprintf(pbuf + cnt, limit - cnt, - "%lx %u %c %c%c:%03u:%02u", + "%lx %u %c %c%c:%03u:%02u %d %d", ep->id, ep->tstamp, ep->type, - utype, udir, usb_pipedevice(ep->pipe), usb_pipeendpoint(ep->pipe)); - - if (ep->setup_flag == 0) { /* Setup packet is present and captured */ - cnt += snprintf(pbuf + cnt, limit - cnt, - " s %02x %02x %04x %04x %04x", - ep->setup[0], - ep->setup[1], - (ep->setup[3] << 8) | ep->setup[2], - (ep->setup[5] << 8) | ep->setup[4], - (ep->setup[7] << 8) | ep->setup[6]); - } else if (ep->setup_flag != '-') { /* Unable to capture setup packet */ - cnt += snprintf(pbuf + cnt, limit - cnt, - " %c __ __ ____ ____ ____", ep->setup_flag); - } else { /* No setup for this kind of URB */ - cnt += snprintf(pbuf + cnt, limit - cnt, " %d", ep->status); - } - cnt += snprintf(pbuf + cnt, limit - cnt, " %d", ep->length); + utype, udir, usb_pipedevice(ep->pipe), usb_pipeendpoint(ep->pipe), + ep->status, ep->length); if ((data_len = ep->length) > 0) { if (ep->data_flag == 0) { diff --git a/trunk/drivers/usb/net/kaweth.c b/trunk/drivers/usb/net/kaweth.c index 7ffa99b9760f..fd6ff4cb2c62 100644 --- a/trunk/drivers/usb/net/kaweth.c +++ b/trunk/drivers/usb/net/kaweth.c @@ -477,7 +477,7 @@ static int kaweth_reset(struct kaweth_device *kaweth) } static void kaweth_usb_receive(struct urb *, struct pt_regs *regs); -static int kaweth_resubmit_rx_urb(struct kaweth_device *, unsigned); +static int kaweth_resubmit_rx_urb(struct kaweth_device *, int); /**************************************************************** int_callback @@ -550,7 +550,7 @@ static void kaweth_resubmit_tl(void *d) * kaweth_resubmit_rx_urb ****************************************************************/ static int kaweth_resubmit_rx_urb(struct kaweth_device *kaweth, - unsigned mem_flags) + int mem_flags) { int result; diff --git a/trunk/drivers/usb/serial/ftdi_sio.c b/trunk/drivers/usb/serial/ftdi_sio.c index 0b03ddab53d9..d882fa3ad19a 100644 --- a/trunk/drivers/usb/serial/ftdi_sio.c +++ b/trunk/drivers/usb/serial/ftdi_sio.c @@ -264,26 +264,16 @@ /* * Version Information */ -#define DRIVER_VERSION "v1.4.3" +#define DRIVER_VERSION "v1.4.2" #define DRIVER_AUTHOR "Greg Kroah-Hartman , Bill Ryder , Kuba Ober " #define DRIVER_DESC "USB FTDI Serial Converters Driver" static int debug; -/* struct ftdi_sio_quirk is used by devices requiring special attention. */ -struct ftdi_sio_quirk { - void (*setup)(struct usb_serial *); /* Special settings during startup. */ -}; - -static void ftdi_USB_UIRT_setup (struct usb_serial *serial); -static void ftdi_HE_TIRA1_setup (struct usb_serial *serial); - -static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = { - .setup = ftdi_USB_UIRT_setup, -}; - -static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = { - .setup = ftdi_HE_TIRA1_setup, +static struct usb_device_id id_table_sio [] = { + { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, + { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, + { } /* Terminating entry */ }; /* @@ -298,11 +288,237 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = { * the bcdDevice value is used to differentiate FT232BM and FT245BM from * the earlier FT8U232AM and FT8U232BM. For now, include all known VID/PID * combinations in both tables. - * FIXME: perhaps bcdDevice can also identify 12MHz FT8U232AM devices, - * but I don't know if those ever went into mass production. [Ian Abbott] + * FIXME: perhaps bcdDevice can also identify 12MHz devices, but I don't know + * if those ever went into mass production. [Ian Abbott] */ +static struct usb_device_id id_table_8U232AM [] = { + { USB_DEVICE_VER(FTDI_VID, FTDI_IRTRANS_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_RELAIS_PID, 0, 0x3ff) }, + { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, + { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, + { USB_DEVICE_VER(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_XF_632_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_XF_634_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_XF_547_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_XF_633_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_XF_631_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_XF_635_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_XF_640_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_XF_642_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_VNHCPCUSB_D_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_DSS20_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2101_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2102_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2103_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2104_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2201_1_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2201_2_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2202_1_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2202_2_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2203_1_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2203_2_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2401_1_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2401_2_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2401_3_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2401_4_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2402_1_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2402_2_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2402_3_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2402_4_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2403_1_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2403_2_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2403_3_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2403_4_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_1_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_2_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_3_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_4_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_5_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_6_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_7_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_8_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_1_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_2_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_3_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_4_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_5_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_6_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_7_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_8_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_1_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_2_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_3_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_4_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_5_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_6_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_7_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_8_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(IDTECH_VID, IDTECH_IDT1221U_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(OCT_VID, OCT_US101_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, PROTEGO_SPECIAL_1, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, PROTEGO_R2X0, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, PROTEGO_SPECIAL_3, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, PROTEGO_SPECIAL_4, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_ELV_UO100_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_ELV_UM100_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, INSIDE_ACCESSO, 0, 0x3ff) }, + { USB_DEVICE_VER(INTREPID_VID, INTREPID_VALUECAN_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(INTREPID_VID, INTREPID_NEOVI_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FALCOM_VID, FALCOM_TWIST_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_SUUNTO_SPORTS_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_RM_CANVIEW_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(BANDB_VID, BANDB_USOTL4_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(BANDB_VID, BANDB_USTL4_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(BANDB_VID, BANDB_USO9ML2_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, EVER_ECO_PRO_CDS, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_0_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID, 0, 0x3ff) }, + { } /* Terminating entry */ +}; + + +static struct usb_device_id id_table_FT232BM [] = { + { USB_DEVICE_VER(FTDI_VID, FTDI_IRTRANS_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_RELAIS_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_XF_632_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_XF_634_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_XF_547_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_XF_633_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_XF_631_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_XF_635_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_XF_640_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_XF_642_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_VNHCPCUSB_D_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_DSS20_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_0_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_1_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_2_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_3_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_4_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_5_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_6_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_PIEGROUP_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2101_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2102_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2103_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2104_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2201_1_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2201_2_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2202_1_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2202_2_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2203_1_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2203_2_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2401_1_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2401_2_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2401_3_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2401_4_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2402_1_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2402_2_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2402_3_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2402_4_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2403_1_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2403_2_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2403_3_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2403_4_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_1_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_2_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_3_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_4_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_5_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_6_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_7_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_8_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_1_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_2_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_3_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_4_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_5_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_6_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_7_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_8_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_1_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_2_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_3_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_4_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_5_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_6_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_7_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_8_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(IDTECH_VID, IDTECH_IDT1221U_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(OCT_VID, OCT_US101_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, PROTEGO_SPECIAL_1, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, PROTEGO_R2X0, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, PROTEGO_SPECIAL_3, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, PROTEGO_SPECIAL_4, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E808_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E809_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80A_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80B_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80C_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80D_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80E_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80F_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E888_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E889_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88A_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88B_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88C_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88D_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88E_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88F_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_ELV_UO100_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_ELV_UM100_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, LINX_SDMUSBQSS_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, LINX_MASTERDEVEL2_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, LINX_FUTURE_0_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, LINX_FUTURE_1_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, LINX_FUTURE_2_PID, 0x400, 0xffff) }, + { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) }, + { USB_DEVICE_VER(FTDI_VID, INSIDE_ACCESSO, 0x400, 0xffff) }, + { USB_DEVICE_VER(INTREPID_VID, INTREPID_VALUECAN_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(INTREPID_VID, INTREPID_NEOVI_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FALCOM_VID, FALCOM_TWIST_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_SUUNTO_SPORTS_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_RM_CANVIEW_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(BANDB_VID, BANDB_USOTL4_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(BANDB_VID, BANDB_USTL4_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(BANDB_VID, BANDB_USO9ML2_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, EVER_ECO_PRO_CDS, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_0_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID, 0x400, 0xffff) }, + { } /* Terminating entry */ +}; + + +static struct usb_device_id id_table_USB_UIRT [] = { + { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID) }, + { } /* Terminating entry */ +}; + + +static struct usb_device_id id_table_HE_TIRA1 [] = { + { USB_DEVICE_VER(FTDI_VID, FTDI_HE_TIRA1_PID, 0x400, 0xffff) }, + { } /* Terminating entry */ +}; + + +static struct usb_device_id id_table_FT2232C[] = { + { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, + { } /* Terminating entry */ +}; + static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, @@ -324,14 +540,14 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_DSS20_PID) }, { USB_DEVICE(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID) }, { USB_DEVICE(FTDI_VID, FTDI_VNHCPCUSB_D_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_MTXORB_0_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_MTXORB_1_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_MTXORB_2_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_MTXORB_3_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_0_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_1_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_2_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_3_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_4_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_5_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_6_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID, 0x400, 0xffff) }, { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) }, { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) }, @@ -381,37 +597,35 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) }, { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) }, { USB_DEVICE(OCT_VID, OCT_US101_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_HE_TIRA1_PID), - .driver_info = (kernel_ulong_t)&ftdi_HE_TIRA1_quirk }, - { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID), - .driver_info = (kernel_ulong_t)&ftdi_USB_UIRT_quirk }, + { USB_DEVICE_VER(FTDI_VID, FTDI_HE_TIRA1_PID, 0x400, 0xffff) }, + { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID) }, { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_1) }, { USB_DEVICE(FTDI_VID, PROTEGO_R2X0) }, { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_3) }, { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_4) }, - { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E808_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E809_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80A_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80B_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80C_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80D_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80E_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80F_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E888_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E889_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88A_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88B_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88C_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88D_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88E_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88F_PID) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E808_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E809_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80A_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80B_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80C_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80D_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80E_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80F_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E888_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E889_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88A_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88B_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88C_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88D_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88E_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88F_PID, 0x400, 0xffff) }, { USB_DEVICE(FTDI_VID, FTDI_ELV_UO100_PID) }, { USB_DEVICE(FTDI_VID, FTDI_ELV_UM100_PID) }, - { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) }, - { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) }, - { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) }, - { USB_DEVICE(FTDI_VID, LINX_FUTURE_1_PID) }, - { USB_DEVICE(FTDI_VID, LINX_FUTURE_2_PID) }, + { USB_DEVICE_VER(FTDI_VID, LINX_SDMUSBQSS_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, LINX_MASTERDEVEL2_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, LINX_FUTURE_0_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, LINX_FUTURE_1_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, LINX_FUTURE_2_PID, 0x400, 0xffff) }, { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) }, { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) }, { USB_DEVICE(FTDI_VID, INSIDE_ACCESSO) }, @@ -428,7 +642,7 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) }, { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID, 0x400, 0xffff) }, { } /* Terminating entry */ }; @@ -491,8 +705,12 @@ struct ftdi_private { ASYNC_SPD_CUST | ASYNC_SPD_SHI | ASYNC_SPD_WARP ) /* function prototypes for a FTDI serial converter */ -static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id); -static int ftdi_sio_attach (struct usb_serial *serial); +static int ftdi_SIO_startup (struct usb_serial *serial); +static int ftdi_8U232AM_startup (struct usb_serial *serial); +static int ftdi_FT232BM_startup (struct usb_serial *serial); +static int ftdi_FT2232C_startup (struct usb_serial *serial); +static int ftdi_USB_UIRT_startup (struct usb_serial *serial); +static int ftdi_HE_TIRA1_startup (struct usb_serial *serial); static void ftdi_shutdown (struct usb_serial *serial); static int ftdi_open (struct usb_serial_port *port, struct file *filp); static void ftdi_close (struct usb_serial_port *port, struct file *filp); @@ -515,16 +733,14 @@ static unsigned short int ftdi_232am_baud_to_divisor (int baud); static __u32 ftdi_232bm_baud_base_to_divisor (int baud, int base); static __u32 ftdi_232bm_baud_to_divisor (int baud); -static struct usb_serial_device_type ftdi_sio_device = { +static struct usb_serial_device_type ftdi_SIO_device = { .owner = THIS_MODULE, - .name = "FTDI USB Serial Device", - .short_name = "ftdi_sio", - .id_table = id_table_combined, + .name = "FTDI SIO", + .id_table = id_table_sio, .num_interrupt_in = 0, .num_bulk_in = 1, .num_bulk_out = 1, .num_ports = 1, - .probe = ftdi_sio_probe, .open = ftdi_open, .close = ftdi_close, .throttle = ftdi_throttle, @@ -539,10 +755,143 @@ static struct usb_serial_device_type ftdi_sio_device = { .ioctl = ftdi_ioctl, .set_termios = ftdi_set_termios, .break_ctl = ftdi_break_ctl, - .attach = ftdi_sio_attach, + .attach = ftdi_SIO_startup, .shutdown = ftdi_shutdown, }; +static struct usb_serial_device_type ftdi_8U232AM_device = { + .owner = THIS_MODULE, + .name = "FTDI 8U232AM Compatible", + .id_table = id_table_8U232AM, + .num_interrupt_in = 0, + .num_bulk_in = 1, + .num_bulk_out = 1, + .num_ports = 1, + .open = ftdi_open, + .close = ftdi_close, + .throttle = ftdi_throttle, + .unthrottle = ftdi_unthrottle, + .write = ftdi_write, + .write_room = ftdi_write_room, + .chars_in_buffer = ftdi_chars_in_buffer, + .read_bulk_callback = ftdi_read_bulk_callback, + .write_bulk_callback = ftdi_write_bulk_callback, + .tiocmget = ftdi_tiocmget, + .tiocmset = ftdi_tiocmset, + .ioctl = ftdi_ioctl, + .set_termios = ftdi_set_termios, + .break_ctl = ftdi_break_ctl, + .attach = ftdi_8U232AM_startup, + .shutdown = ftdi_shutdown, +}; + +static struct usb_serial_device_type ftdi_FT232BM_device = { + .owner = THIS_MODULE, + .name = "FTDI FT232BM Compatible", + .id_table = id_table_FT232BM, + .num_interrupt_in = 0, + .num_bulk_in = 1, + .num_bulk_out = 1, + .num_ports = 1, + .open = ftdi_open, + .close = ftdi_close, + .throttle = ftdi_throttle, + .unthrottle = ftdi_unthrottle, + .write = ftdi_write, + .write_room = ftdi_write_room, + .chars_in_buffer = ftdi_chars_in_buffer, + .read_bulk_callback = ftdi_read_bulk_callback, + .write_bulk_callback = ftdi_write_bulk_callback, + .tiocmget = ftdi_tiocmget, + .tiocmset = ftdi_tiocmset, + .ioctl = ftdi_ioctl, + .set_termios = ftdi_set_termios, + .break_ctl = ftdi_break_ctl, + .attach = ftdi_FT232BM_startup, + .shutdown = ftdi_shutdown, +}; + +static struct usb_serial_device_type ftdi_FT2232C_device = { + .owner = THIS_MODULE, + .name = "FTDI FT2232C Compatible", + .id_table = id_table_FT2232C, + .num_interrupt_in = 0, + .num_bulk_in = 1, + .num_bulk_out = 1, + .num_ports = 1, + .open = ftdi_open, + .close = ftdi_close, + .throttle = ftdi_throttle, + .unthrottle = ftdi_unthrottle, + .write = ftdi_write, + .write_room = ftdi_write_room, + .chars_in_buffer = ftdi_chars_in_buffer, + .read_bulk_callback = ftdi_read_bulk_callback, + .write_bulk_callback = ftdi_write_bulk_callback, + .tiocmget = ftdi_tiocmget, + .tiocmset = ftdi_tiocmset, + .ioctl = ftdi_ioctl, + .set_termios = ftdi_set_termios, + .break_ctl = ftdi_break_ctl, + .attach = ftdi_FT2232C_startup, + .shutdown = ftdi_shutdown, +}; + +static struct usb_serial_device_type ftdi_USB_UIRT_device = { + .owner = THIS_MODULE, + .name = "USB-UIRT Infrared Tranceiver", + .id_table = id_table_USB_UIRT, + .num_interrupt_in = 0, + .num_bulk_in = 1, + .num_bulk_out = 1, + .num_ports = 1, + .open = ftdi_open, + .close = ftdi_close, + .throttle = ftdi_throttle, + .unthrottle = ftdi_unthrottle, + .write = ftdi_write, + .write_room = ftdi_write_room, + .chars_in_buffer = ftdi_chars_in_buffer, + .read_bulk_callback = ftdi_read_bulk_callback, + .write_bulk_callback = ftdi_write_bulk_callback, + .tiocmget = ftdi_tiocmget, + .tiocmset = ftdi_tiocmset, + .ioctl = ftdi_ioctl, + .set_termios = ftdi_set_termios, + .break_ctl = ftdi_break_ctl, + .attach = ftdi_USB_UIRT_startup, + .shutdown = ftdi_shutdown, +}; + +/* The TIRA1 is based on a FT232BM which requires a fixed baud rate of 100000 + * and which requires RTS-CTS to be enabled. */ +static struct usb_serial_device_type ftdi_HE_TIRA1_device = { + .owner = THIS_MODULE, + .name = "Home-Electronics TIRA-1 IR Transceiver", + .id_table = id_table_HE_TIRA1, + .num_interrupt_in = 0, + .num_bulk_in = 1, + .num_bulk_out = 1, + .num_ports = 1, + .open = ftdi_open, + .close = ftdi_close, + .throttle = ftdi_throttle, + .unthrottle = ftdi_unthrottle, + .write = ftdi_write, + .write_room = ftdi_write_room, + .chars_in_buffer = ftdi_chars_in_buffer, + .read_bulk_callback = ftdi_read_bulk_callback, + .write_bulk_callback = ftdi_write_bulk_callback, + .tiocmget = ftdi_tiocmget, + .tiocmset = ftdi_tiocmset, + .ioctl = ftdi_ioctl, + .set_termios = ftdi_set_termios, + .break_ctl = ftdi_break_ctl, + .attach = ftdi_HE_TIRA1_startup, + .shutdown = ftdi_shutdown, +}; + + #define WDR_TIMEOUT 5000 /* default urb timeout */ @@ -863,59 +1212,6 @@ static int set_serial_info(struct usb_serial_port * port, struct serial_struct _ } /* set_serial_info */ -/* Determine type of FTDI chip based on USB config and descriptor. */ -static void ftdi_determine_type(struct usb_serial_port *port) -{ - struct ftdi_private *priv = usb_get_serial_port_data(port); - struct usb_serial *serial = port->serial; - struct usb_device *udev = serial->dev; - unsigned version; - unsigned interfaces; - - /* Assume it is not the original SIO device for now. */ - priv->baud_base = 48000000 / 16; - priv->write_offset = 0; - - version = le16_to_cpu(udev->descriptor.bcdDevice); - interfaces = udev->actconfig->desc.bNumInterfaces; - dbg("%s: bcdDevice = 0x%x, bNumInterfaces = %u", __FUNCTION__, - version, interfaces); - if (interfaces > 1) { - int inter; - - /* Multiple interfaces. Assume FT2232C. */ - priv->chip_type = FT2232C; - /* Determine interface code. */ - inter = serial->interface->altsetting->desc.bInterfaceNumber; - if (inter == 0) { - priv->interface = PIT_SIOA; - } else { - priv->interface = PIT_SIOB; - } - /* BM-type devices have a bug where bcdDevice gets set - * to 0x200 when iSerialNumber is 0. */ - if (version < 0x500) { - dbg("%s: something fishy - bcdDevice too low for multi-interface device", - __FUNCTION__); - } - } else if (version < 0x200) { - /* Old device. Assume its the original SIO. */ - priv->chip_type = SIO; - priv->baud_base = 12000000 / 16; - priv->write_offset = 1; - } else if (version < 0x400) { - /* Assume its an FT8U232AM (or FT8U245AM) */ - /* (It might be a BM because of the iSerialNumber bug, - * but it will still work as an AM device.) */ - priv->chip_type = FT8U232AM; - } else { - /* Assume its an FT232BM (or FT245BM) */ - priv->chip_type = FT232BM; - } - info("Detected %s", ftdi_chip_name[priv->chip_type]); -} - - /* * *************************************************************************** * Sysfs Attribute @@ -1059,20 +1355,12 @@ static void remove_sysfs_attrs(struct usb_serial *serial) * *************************************************************************** */ -/* Probe function to check for special devices */ -static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id) -{ - usb_set_serial_data(serial, (void *)id->driver_info); - - return (0); -} - -/* attach subroutine */ -static int ftdi_sio_attach (struct usb_serial *serial) +/* Common startup subroutine */ +/* Called from ftdi_SIO_startup, etc. */ +static int ftdi_common_startup (struct usb_serial *serial) { struct usb_serial_port *port = serial->port[0]; struct ftdi_private *priv; - struct ftdi_sio_quirk *quirk; dbg("%s",__FUNCTION__); @@ -1112,49 +1400,150 @@ static int ftdi_sio_attach (struct usb_serial *serial) port->bulk_out_buffer = NULL; usb_set_serial_port_data(serial->port[0], priv); + + return (0); +} + + +/* Startup for the SIO chip */ +/* Called from usbserial:serial_probe */ +static int ftdi_SIO_startup (struct usb_serial *serial) +{ + struct ftdi_private *priv; + int err; + + dbg("%s",__FUNCTION__); + + err = ftdi_common_startup(serial); + if (err){ + return (err); + } + + priv = usb_get_serial_port_data(serial->port[0]); + priv->chip_type = SIO; + priv->baud_base = 12000000 / 16; + priv->write_offset = 1; + + return (0); +} + +/* Startup for the 8U232AM chip */ +/* Called from usbserial:serial_probe */ +static int ftdi_8U232AM_startup (struct usb_serial *serial) +{ /* ftdi_8U232AM_startup */ + struct ftdi_private *priv; + int err; + + dbg("%s",__FUNCTION__); + err = ftdi_common_startup(serial); + if (err){ + return (err); + } - ftdi_determine_type (serial->port[0]); + priv = usb_get_serial_port_data(serial->port[0]); + priv->chip_type = FT8U232AM; + priv->baud_base = 48000000 / 2; /* Would be / 16, but FTDI supports 0.125, 0.25 and 0.5 divisor fractions! */ + create_sysfs_attrs(serial); + + return (0); +} /* ftdi_8U232AM_startup */ - /* Check for device requiring special set up. */ - quirk = (struct ftdi_sio_quirk *)usb_get_serial_data(serial); - if (quirk && quirk->setup) { - quirk->setup(serial); +/* Startup for the FT232BM chip */ +/* Called from usbserial:serial_probe */ +static int ftdi_FT232BM_startup (struct usb_serial *serial) +{ /* ftdi_FT232BM_startup */ + struct ftdi_private *priv; + int err; + + dbg("%s",__FUNCTION__); + err = ftdi_common_startup(serial); + if (err){ + return (err); } + + priv = usb_get_serial_port_data(serial->port[0]); + priv->chip_type = FT232BM; + priv->baud_base = 48000000 / 2; /* Would be / 16, but FT232BM supports multiple of 0.125 divisor fractions! */ + create_sysfs_attrs(serial); + return (0); -} /* ftdi_sio_attach */ +} /* ftdi_FT232BM_startup */ + +/* Startup for the FT2232C chip */ +/* Called from usbserial:serial_probe */ +static int ftdi_FT2232C_startup (struct usb_serial *serial) +{ /* ftdi_FT2232C_startup */ + struct ftdi_private *priv; + int err; + int inter; + + dbg("%s",__FUNCTION__); + err = ftdi_common_startup(serial); + if (err){ + return (err); + } + priv = usb_get_serial_port_data(serial->port[0]); + priv->chip_type = FT2232C; + inter = serial->interface->altsetting->desc.bInterfaceNumber; -/* Setup for the USB-UIRT device, which requires hardwired - * baudrate (38400 gets mapped to 312500) */ + if (inter) { + priv->interface = PIT_SIOB; + } + else { + priv->interface = PIT_SIOA; + } + priv->baud_base = 48000000 / 2; /* Would be / 16, but FT2232C supports multiple of 0.125 divisor fractions! */ + + create_sysfs_attrs(serial); + + return (0); +} /* ftdi_FT2232C_startup */ + +/* Startup for the USB-UIRT device, which requires hardwired baudrate (38400 gets mapped to 312500) */ /* Called from usbserial:serial_probe */ -static void ftdi_USB_UIRT_setup (struct usb_serial *serial) -{ +static int ftdi_USB_UIRT_startup (struct usb_serial *serial) +{ /* ftdi_USB_UIRT_startup */ struct ftdi_private *priv; + int err; dbg("%s",__FUNCTION__); + err = ftdi_8U232AM_startup(serial); + if (err){ + return (err); + } priv = usb_get_serial_port_data(serial->port[0]); priv->flags |= ASYNC_SPD_CUST; priv->custom_divisor = 77; priv->force_baud = B38400; -} /* ftdi_USB_UIRT_setup */ + + return (0); +} /* ftdi_USB_UIRT_startup */ -/* Setup for the HE-TIRA1 device, which requires hardwired - * baudrate (38400 gets mapped to 100000) and RTS-CTS enabled. */ -static void ftdi_HE_TIRA1_setup (struct usb_serial *serial) -{ +/* Startup for the HE-TIRA1 device, which requires hardwired + * baudrate (38400 gets mapped to 100000) */ +static int ftdi_HE_TIRA1_startup (struct usb_serial *serial) +{ /* ftdi_HE_TIRA1_startup */ struct ftdi_private *priv; + int err; dbg("%s",__FUNCTION__); + err = ftdi_FT232BM_startup(serial); + if (err){ + return (err); + } priv = usb_get_serial_port_data(serial->port[0]); priv->flags |= ASYNC_SPD_CUST; priv->custom_divisor = 240; priv->force_baud = B38400; priv->force_rtscts = 1; -} /* ftdi_HE_TIRA1_setup */ + + return (0); +} /* ftdi_HE_TIRA1_startup */ /* ftdi_shutdown is called from usbserial:usb_serial_disconnect @@ -1978,11 +2367,60 @@ static int ftdi_ioctl (struct usb_serial_port *port, struct file * file, unsigne { struct ftdi_private *priv = usb_get_serial_port_data(port); + int ret, mask; + dbg("%s cmd 0x%04x", __FUNCTION__, cmd); /* Based on code from acm.c and others */ switch (cmd) { + case TIOCMBIS: /* turns on (Sets) the lines as specified by the mask */ + dbg("%s TIOCMBIS", __FUNCTION__); + if (get_user(mask, (unsigned long __user *) arg)) + return -EFAULT; + if (mask & TIOCM_DTR){ + if ((ret = set_dtr(port, HIGH)) < 0) { + err("Urb to set DTR failed"); + return(ret); + } + } + if (mask & TIOCM_RTS) { + if ((ret = set_rts(port, HIGH)) < 0){ + err("Urb to set RTS failed"); + return(ret); + } + } + return(0); + break; + + case TIOCMBIC: /* turns off (Clears) the lines as specified by the mask */ + dbg("%s TIOCMBIC", __FUNCTION__); + if (get_user(mask, (unsigned long __user *) arg)) + return -EFAULT; + if (mask & TIOCM_DTR){ + if ((ret = set_dtr(port, LOW)) < 0){ + err("Urb to unset DTR failed"); + return(ret); + } + } + if (mask & TIOCM_RTS) { + if ((ret = set_rts(port, LOW)) < 0){ + err("Urb to unset RTS failed"); + return(ret); + } + } + return(0); + break; + + /* + * I had originally implemented TCSET{A,S}{,F,W} and + * TCGET{A,S} here separately, however when testing I + * found that the higher layers actually do the termios + * conversions themselves and pass the call onto + * ftdi_sio_set_termios. + * + */ + case TIOCGSERIAL: /* gets serial port data */ return get_serial_info(port, (struct serial_struct __user *) arg); @@ -2078,9 +2516,24 @@ static int __init ftdi_init (void) int retval; dbg("%s", __FUNCTION__); - retval = usb_serial_register(&ftdi_sio_device); + retval = usb_serial_register(&ftdi_SIO_device); + if (retval) + goto failed_SIO_register; + retval = usb_serial_register(&ftdi_8U232AM_device); + if (retval) + goto failed_8U232AM_register; + retval = usb_serial_register(&ftdi_FT232BM_device); + if (retval) + goto failed_FT232BM_register; + retval = usb_serial_register(&ftdi_FT2232C_device); + if (retval) + goto failed_FT2232C_register; + retval = usb_serial_register(&ftdi_USB_UIRT_device); + if (retval) + goto failed_USB_UIRT_register; + retval = usb_serial_register(&ftdi_HE_TIRA1_device); if (retval) - goto failed_sio_register; + goto failed_HE_TIRA1_register; retval = usb_register(&ftdi_driver); if (retval) goto failed_usb_register; @@ -2088,8 +2541,18 @@ static int __init ftdi_init (void) info(DRIVER_VERSION ":" DRIVER_DESC); return 0; failed_usb_register: - usb_serial_deregister(&ftdi_sio_device); -failed_sio_register: + usb_serial_deregister(&ftdi_HE_TIRA1_device); +failed_HE_TIRA1_register: + usb_serial_deregister(&ftdi_USB_UIRT_device); +failed_USB_UIRT_register: + usb_serial_deregister(&ftdi_FT2232C_device); +failed_FT2232C_register: + usb_serial_deregister(&ftdi_FT232BM_device); +failed_FT232BM_register: + usb_serial_deregister(&ftdi_8U232AM_device); +failed_8U232AM_register: + usb_serial_deregister(&ftdi_SIO_device); +failed_SIO_register: return retval; } @@ -2100,7 +2563,12 @@ static void __exit ftdi_exit (void) dbg("%s", __FUNCTION__); usb_deregister (&ftdi_driver); - usb_serial_deregister (&ftdi_sio_device); + usb_serial_deregister (&ftdi_HE_TIRA1_device); + usb_serial_deregister (&ftdi_USB_UIRT_device); + usb_serial_deregister (&ftdi_FT2232C_device); + usb_serial_deregister (&ftdi_FT232BM_device); + usb_serial_deregister (&ftdi_8U232AM_device); + usb_serial_deregister (&ftdi_SIO_device); } diff --git a/trunk/drivers/usb/storage/unusual_devs.h b/trunk/drivers/usb/storage/unusual_devs.h index bd0ab3039bdd..9fcc7bd1fbe4 100644 --- a/trunk/drivers/usb/storage/unusual_devs.h +++ b/trunk/drivers/usb/storage/unusual_devs.h @@ -697,7 +697,7 @@ UNUSUAL_DEV( 0x07af, 0x0004, 0x0100, 0x0133, UNUSUAL_DEV( 0x07af, 0x0005, 0x0100, 0x0100, "Microtech", "USB-SCSI-HD50", - US_SC_DEVICE, US_PR_DEVICE, usb_stor_euscsi_init, + US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, US_FL_SCM_MULT_TARG ), #ifdef CONFIG_USB_STORAGE_DPCM diff --git a/trunk/include/asm-ia64/hw_irq.h b/trunk/include/asm-ia64/hw_irq.h index 041ab8c51a64..cd4e06b74ab6 100644 --- a/trunk/include/asm-ia64/hw_irq.h +++ b/trunk/include/asm-ia64/hw_irq.h @@ -81,6 +81,7 @@ extern __u8 isa_irq_to_vector_map[16]; extern struct hw_interrupt_type irq_type_ia64_lsapic; /* CPU-internal interrupt controller */ +extern int assign_irq_vector_nopanic (int irq); /* allocate a free vector without panic */ extern int assign_irq_vector (int irq); /* allocate a free vector */ extern void free_irq_vector (int vector); extern void ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect); diff --git a/trunk/include/asm-ia64/sn/xp.h b/trunk/include/asm-ia64/sn/xp.h index 1df1c9f61a65..9902185c0288 100644 --- a/trunk/include/asm-ia64/sn/xp.h +++ b/trunk/include/asm-ia64/sn/xp.h @@ -16,6 +16,7 @@ #define _ASM_IA64_SN_XP_H +#include #include #include #include diff --git a/trunk/include/asm-sparc64/seccomp.h b/trunk/include/asm-sparc64/seccomp.h deleted file mode 100644 index 7fcd9968192b..000000000000 --- a/trunk/include/asm-sparc64/seccomp.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _ASM_SECCOMP_H - -#include /* already defines TIF_32BIT */ - -#ifndef TIF_32BIT -#error "unexpected TIF_32BIT on sparc64" -#endif - -#include - -#define __NR_seccomp_read __NR_read -#define __NR_seccomp_write __NR_write -#define __NR_seccomp_exit __NR_exit -#define __NR_seccomp_sigreturn __NR_rt_sigreturn - -#define __NR_seccomp_read_32 __NR_read -#define __NR_seccomp_write_32 __NR_write -#define __NR_seccomp_exit_32 __NR_exit -#define __NR_seccomp_sigreturn_32 __NR_sigreturn - -#endif /* _ASM_SECCOMP_H */ diff --git a/trunk/include/asm-v850/checksum.h b/trunk/include/asm-v850/checksum.h index 4df5e71098f9..d3aedb7bfc5c 100644 --- a/trunk/include/asm-v850/checksum.h +++ b/trunk/include/asm-v850/checksum.h @@ -1,8 +1,8 @@ /* * include/asm-v850/checksum.h -- Checksum ops * - * Copyright (C) 2001,2005 NEC Corporation - * Copyright (C) 2001,2005 Miles Bader + * Copyright (C) 2001 NEC Corporation + * Copyright (C) 2001 Miles Bader * * This file is subject to the terms and conditions of the GNU General * Public License. See the file COPYING in the main directory of this @@ -36,8 +36,8 @@ extern unsigned int csum_partial (const unsigned char * buff, int len, * here even more important to align src and dst on a 32-bit (or even * better 64-bit) boundary */ -extern unsigned csum_partial_copy (const unsigned char *src, - unsigned char *dst, int len, unsigned sum); +extern unsigned csum_partial_copy (const char *src, char *dst, int len, + unsigned sum); /* @@ -46,8 +46,7 @@ extern unsigned csum_partial_copy (const unsigned char *src, * here even more important to align src and dst on a 32-bit (or even * better 64-bit) boundary */ -extern unsigned csum_partial_copy_from_user (const unsigned char *src, - unsigned char *dst, +extern unsigned csum_partial_copy_from_user (const char *src, char *dst, int len, unsigned sum, int *csum_err); diff --git a/trunk/include/asm-v850/mmu.h b/trunk/include/asm-v850/mmu.h index 267768c66ef6..e30a52becfd6 100644 --- a/trunk/include/asm-v850/mmu.h +++ b/trunk/include/asm-v850/mmu.h @@ -1,11 +1,22 @@ -/* Copyright (C) 2002, 2005, David McCullough */ +/* Copyright (C) 2002, David McCullough */ #ifndef __V850_MMU_H__ #define __V850_MMU_H__ +struct mm_rblock_struct { + int size; + int refcount; + void *kblock; +}; + +struct mm_tblock_struct { + struct mm_rblock_struct *rblock; + struct mm_tblock_struct *next; +}; + typedef struct { - struct vm_list_struct *vmlist; - unsigned long end_brk; + struct mm_tblock_struct tblock; + unsigned long end_brk; } mm_context_t; #endif /* __V850_MMU_H__ */ diff --git a/trunk/include/linux/netlink.h b/trunk/include/linux/netlink.h index 27e4d164a108..2f0c085f2c7d 100644 --- a/trunk/include/linux/netlink.h +++ b/trunk/include/linux/netlink.h @@ -16,6 +16,7 @@ #define NETLINK_AUDIT 9 /* auditing */ #define NETLINK_FIB_LOOKUP 10 #define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */ +#define NETLINK_NETFILTER 12 /* netfilter subsystem */ #define NETLINK_IP6_FW 13 #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ #define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ diff --git a/trunk/include/linux/usb.h b/trunk/include/linux/usb.h index 724637792996..eb282b581546 100644 --- a/trunk/include/linux/usb.h +++ b/trunk/include/linux/usb.h @@ -938,17 +938,17 @@ static inline void usb_fill_int_urb (struct urb *urb, } extern void usb_init_urb(struct urb *urb); -extern struct urb *usb_alloc_urb(int iso_packets, unsigned mem_flags); +extern struct urb *usb_alloc_urb(int iso_packets, int mem_flags); extern void usb_free_urb(struct urb *urb); #define usb_put_urb usb_free_urb extern struct urb *usb_get_urb(struct urb *urb); -extern int usb_submit_urb(struct urb *urb, unsigned mem_flags); +extern int usb_submit_urb(struct urb *urb, int mem_flags); extern int usb_unlink_urb(struct urb *urb); extern void usb_kill_urb(struct urb *urb); #define HAVE_USB_BUFFERS void *usb_buffer_alloc (struct usb_device *dev, size_t size, - unsigned mem_flags, dma_addr_t *dma); + int mem_flags, dma_addr_t *dma); void usb_buffer_free (struct usb_device *dev, size_t size, void *addr, dma_addr_t dma); @@ -1055,7 +1055,7 @@ int usb_sg_init ( struct scatterlist *sg, int nents, size_t length, - unsigned mem_flags + int mem_flags ); void usb_sg_cancel (struct usb_sg_request *io); void usb_sg_wait (struct usb_sg_request *io); diff --git a/trunk/include/linux/usb_cdc.h b/trunk/include/linux/usb_cdc.h index ba617c372455..f22d6beecc73 100644 --- a/trunk/include/linux/usb_cdc.h +++ b/trunk/include/linux/usb_cdc.h @@ -34,7 +34,6 @@ #define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ #define USB_CDC_UNION_TYPE 0x06 /* union_desc */ #define USB_CDC_COUNTRY_TYPE 0x07 -#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */ #define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ #define USB_CDC_WHCM_TYPE 0x11 #define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ @@ -84,18 +83,6 @@ struct usb_cdc_union_desc { /* ... and there could be other slave interfaces */ } __attribute__ ((packed)); -/* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */ -struct usb_cdc_network_terminal_desc { - __u8 bLength; - __u8 bDescriptorType; - __u8 bDescriptorSubType; - - __u8 bEntityId; - __u8 iName; - __u8 bChannelIndex; - __u8 bPhysicalInterface; -} __attribute__ ((packed)); - /* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */ struct usb_cdc_ether_desc { __u8 bLength; diff --git a/trunk/include/linux/usb_gadget.h b/trunk/include/linux/usb_gadget.h index 71e608607324..b00f127cb447 100644 --- a/trunk/include/linux/usb_gadget.h +++ b/trunk/include/linux/usb_gadget.h @@ -107,18 +107,18 @@ struct usb_ep_ops { int (*disable) (struct usb_ep *ep); struct usb_request *(*alloc_request) (struct usb_ep *ep, - unsigned gfp_flags); + int gfp_flags); void (*free_request) (struct usb_ep *ep, struct usb_request *req); void *(*alloc_buffer) (struct usb_ep *ep, unsigned bytes, - dma_addr_t *dma, unsigned gfp_flags); + dma_addr_t *dma, int gfp_flags); void (*free_buffer) (struct usb_ep *ep, void *buf, dma_addr_t dma, unsigned bytes); // NOTE: on 2.6, drivers may also use dma_map() and // dma_sync_single_*() to directly manage dma overhead. int (*queue) (struct usb_ep *ep, struct usb_request *req, - unsigned gfp_flags); + int gfp_flags); int (*dequeue) (struct usb_ep *ep, struct usb_request *req); int (*set_halt) (struct usb_ep *ep, int value); @@ -214,7 +214,7 @@ usb_ep_disable (struct usb_ep *ep) * Returns the request, or null if one could not be allocated. */ static inline struct usb_request * -usb_ep_alloc_request (struct usb_ep *ep, unsigned gfp_flags) +usb_ep_alloc_request (struct usb_ep *ep, int gfp_flags) { return ep->ops->alloc_request (ep, gfp_flags); } @@ -254,7 +254,7 @@ usb_ep_free_request (struct usb_ep *ep, struct usb_request *req) */ static inline void * usb_ep_alloc_buffer (struct usb_ep *ep, unsigned len, dma_addr_t *dma, - unsigned gfp_flags) + int gfp_flags) { return ep->ops->alloc_buffer (ep, len, dma, gfp_flags); } @@ -330,7 +330,7 @@ usb_ep_free_buffer (struct usb_ep *ep, void *buf, dma_addr_t dma, unsigned len) * reported when the usb peripheral is disconnected. */ static inline int -usb_ep_queue (struct usb_ep *ep, struct usb_request *req, unsigned gfp_flags) +usb_ep_queue (struct usb_ep *ep, struct usb_request *req, int gfp_flags) { return ep->ops->queue (ep, req, gfp_flags); }