Commit a5c44e29e5637b5e6fe59d225eb4f438688b3849
Committed by
Greg Kroah-Hartman
1 parent
a847423905
Exists in
master
and in
7 other branches
[PATCH] USB: cypress_m8: add support for the Nokia ca42-version 2 cable
This patch adds support for the Nokia ca42 version 2 cable to the cypress_m8 driver. The device was tested by others with this patch and found to be compatible with the cypress_m8 driver. A special note should be taken that this cable seems to vary in the type of chipset used. This patch supports the cable with product id 0x4101. Signed-off-by: Lonnie Mendez <lmendez19@austin.rr.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Showing 2 changed files with 75 additions and 0 deletions Side-by-side Diff
drivers/usb/serial/cypress_m8.c
... | ... | @@ -98,10 +98,16 @@ |
98 | 98 | { } /* Terminating entry */ |
99 | 99 | }; |
100 | 100 | |
101 | +static struct usb_device_id id_table_nokiaca42v2 [] = { | |
102 | + { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) }, | |
103 | + { } /* Terminating entry */ | |
104 | +}; | |
105 | + | |
101 | 106 | static struct usb_device_id id_table_combined [] = { |
102 | 107 | { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB) }, |
103 | 108 | { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) }, |
104 | 109 | { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, |
110 | + { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) }, | |
105 | 111 | { } /* Terminating entry */ |
106 | 112 | }; |
107 | 113 | |
... | ... | @@ -149,6 +155,7 @@ |
149 | 155 | /* function prototypes for the Cypress USB to serial device */ |
150 | 156 | static int cypress_earthmate_startup (struct usb_serial *serial); |
151 | 157 | static int cypress_hidcom_startup (struct usb_serial *serial); |
158 | +static int cypress_ca42v2_startup (struct usb_serial *serial); | |
152 | 159 | static void cypress_shutdown (struct usb_serial *serial); |
153 | 160 | static int cypress_open (struct usb_serial_port *port, struct file *filp); |
154 | 161 | static void cypress_close (struct usb_serial_port *port, struct file *filp); |
... | ... | @@ -235,6 +242,34 @@ |
235 | 242 | .write_int_callback = cypress_write_int_callback, |
236 | 243 | }; |
237 | 244 | |
245 | +static struct usb_serial_driver cypress_ca42v2_device = { | |
246 | + .driver = { | |
247 | + .owner = THIS_MODULE, | |
248 | + .name = "nokiaca42v2", | |
249 | + }, | |
250 | + .description = "Nokia CA-42 V2 Adapter", | |
251 | + .id_table = id_table_nokiaca42v2, | |
252 | + .num_interrupt_in = 1, | |
253 | + .num_interrupt_out = 1, | |
254 | + .num_bulk_in = NUM_DONT_CARE, | |
255 | + .num_bulk_out = NUM_DONT_CARE, | |
256 | + .num_ports = 1, | |
257 | + .attach = cypress_ca42v2_startup, | |
258 | + .shutdown = cypress_shutdown, | |
259 | + .open = cypress_open, | |
260 | + .close = cypress_close, | |
261 | + .write = cypress_write, | |
262 | + .write_room = cypress_write_room, | |
263 | + .ioctl = cypress_ioctl, | |
264 | + .set_termios = cypress_set_termios, | |
265 | + .tiocmget = cypress_tiocmget, | |
266 | + .tiocmset = cypress_tiocmset, | |
267 | + .chars_in_buffer = cypress_chars_in_buffer, | |
268 | + .throttle = cypress_throttle, | |
269 | + .unthrottle = cypress_unthrottle, | |
270 | + .read_int_callback = cypress_read_int_callback, | |
271 | + .write_int_callback = cypress_write_int_callback, | |
272 | +}; | |
238 | 273 | |
239 | 274 | /***************************************************************************** |
240 | 275 | * Cypress serial helper functions |
... | ... | @@ -286,6 +321,12 @@ |
286 | 321 | __FUNCTION__); |
287 | 322 | new_baudrate = priv->baud_rate; |
288 | 323 | } |
324 | + } else if (priv->chiptype == CT_CA42V2) { | |
325 | + if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) { | |
326 | + err("%s - failed setting baud rate, unsupported speed", | |
327 | + __FUNCTION__); | |
328 | + new_baudrate = priv->baud_rate; | |
329 | + } | |
289 | 330 | } else if (priv->chiptype == CT_GENERIC) { |
290 | 331 | if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) { |
291 | 332 | err("%s - failed setting baud rate, unsupported speed", |
... | ... | @@ -499,6 +540,25 @@ |
499 | 540 | } /* cypress_hidcom_startup */ |
500 | 541 | |
501 | 542 | |
543 | +static int cypress_ca42v2_startup (struct usb_serial *serial) | |
544 | +{ | |
545 | + struct cypress_private *priv; | |
546 | + | |
547 | + dbg("%s", __FUNCTION__); | |
548 | + | |
549 | + if (generic_startup(serial)) { | |
550 | + dbg("%s - Failed setting up port %d", __FUNCTION__, | |
551 | + serial->port[0]->number); | |
552 | + return 1; | |
553 | + } | |
554 | + | |
555 | + priv = usb_get_serial_port_data(serial->port[0]); | |
556 | + priv->chiptype = CT_CA42V2; | |
557 | + | |
558 | + return 0; | |
559 | +} /* cypress_ca42v2_startup */ | |
560 | + | |
561 | + | |
502 | 562 | static void cypress_shutdown (struct usb_serial *serial) |
503 | 563 | { |
504 | 564 | struct cypress_private *priv; |
... | ... | @@ -943,6 +1003,10 @@ |
943 | 1003 | *(tty->termios) = tty_std_termios; |
944 | 1004 | tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | |
945 | 1005 | CLOCAL; |
1006 | + } else if (priv->chiptype == CT_CA42V2) { | |
1007 | + *(tty->termios) = tty_std_termios; | |
1008 | + tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | | |
1009 | + CLOCAL; | |
946 | 1010 | } |
947 | 1011 | priv->termios_initialized = 1; |
948 | 1012 | } |
... | ... | @@ -1541,6 +1605,9 @@ |
1541 | 1605 | retval = usb_serial_register(&cypress_hidcom_device); |
1542 | 1606 | if (retval) |
1543 | 1607 | goto failed_hidcom_register; |
1608 | + retval = usb_serial_register(&cypress_ca42v2_device); | |
1609 | + if (retval) | |
1610 | + goto failed_ca42v2_register; | |
1544 | 1611 | retval = usb_register(&cypress_driver); |
1545 | 1612 | if (retval) |
1546 | 1613 | goto failed_usb_register; |
... | ... | @@ -1549,6 +1616,8 @@ |
1549 | 1616 | return 0; |
1550 | 1617 | failed_usb_register: |
1551 | 1618 | usb_deregister(&cypress_driver); |
1619 | +failed_ca42v2_register: | |
1620 | + usb_serial_deregister(&cypress_ca42v2_device); | |
1552 | 1621 | failed_hidcom_register: |
1553 | 1622 | usb_serial_deregister(&cypress_hidcom_device); |
1554 | 1623 | failed_em_register: |
... | ... | @@ -1565,6 +1634,7 @@ |
1565 | 1634 | usb_deregister (&cypress_driver); |
1566 | 1635 | usb_serial_deregister (&cypress_earthmate_device); |
1567 | 1636 | usb_serial_deregister (&cypress_hidcom_device); |
1637 | + usb_serial_deregister (&cypress_ca42v2_device); | |
1568 | 1638 | } |
1569 | 1639 | |
1570 | 1640 |
drivers/usb/serial/cypress_m8.h
... | ... | @@ -18,6 +18,10 @@ |
18 | 18 | /* Cypress HID->COM RS232 Adapter */ |
19 | 19 | #define VENDOR_ID_CYPRESS 0x04b4 |
20 | 20 | #define PRODUCT_ID_CYPHIDCOM 0x5500 |
21 | + | |
22 | +/* Nokia CA-42 USB to serial cable */ | |
23 | +#define VENDOR_ID_DAZZLE 0x07d0 | |
24 | +#define PRODUCT_ID_CA42 0x4101 | |
21 | 25 | /* End of device listing */ |
22 | 26 | |
23 | 27 | /* Used for setting / requesting serial line settings */ |
... | ... | @@ -34,6 +38,7 @@ |
34 | 38 | |
35 | 39 | #define CT_EARTHMATE 0x01 |
36 | 40 | #define CT_CYPHIDCOM 0x02 |
41 | +#define CT_CA42V2 0x03 | |
37 | 42 | #define CT_GENERIC 0x0F |
38 | 43 | /* End of chiptype definitions */ |
39 | 44 |