diff options
author | Lonnie Mendez <lmendez19@austin.rr.com> | 2006-03-01 11:45:24 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-03-20 17:50:00 -0500 |
commit | a5c44e29e5637b5e6fe59d225eb4f438688b3849 (patch) | |
tree | 1a39af521d6be62c57f1bc39083a95aaf6eac67d /drivers/usb/serial/cypress_m8.c | |
parent | a847423905c6a8ccd6671d05f5877d893d10cd9f (diff) |
[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>
Diffstat (limited to 'drivers/usb/serial/cypress_m8.c')
-rw-r--r-- | drivers/usb/serial/cypress_m8.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 71af3bf5adb7..7212fbe3b6f2 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -98,10 +98,16 @@ static struct usb_device_id id_table_cyphidcomrs232 [] = { | |||
98 | { } /* Terminating entry */ | 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 | static struct usb_device_id id_table_combined [] = { | 106 | static struct usb_device_id id_table_combined [] = { |
102 | { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB) }, | 107 | { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB) }, |
103 | { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) }, | 108 | { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) }, |
104 | { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, | 109 | { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, |
110 | { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) }, | ||
105 | { } /* Terminating entry */ | 111 | { } /* Terminating entry */ |
106 | }; | 112 | }; |
107 | 113 | ||
@@ -149,6 +155,7 @@ struct cypress_buf { | |||
149 | /* function prototypes for the Cypress USB to serial device */ | 155 | /* function prototypes for the Cypress USB to serial device */ |
150 | static int cypress_earthmate_startup (struct usb_serial *serial); | 156 | static int cypress_earthmate_startup (struct usb_serial *serial); |
151 | static int cypress_hidcom_startup (struct usb_serial *serial); | 157 | static int cypress_hidcom_startup (struct usb_serial *serial); |
158 | static int cypress_ca42v2_startup (struct usb_serial *serial); | ||
152 | static void cypress_shutdown (struct usb_serial *serial); | 159 | static void cypress_shutdown (struct usb_serial *serial); |
153 | static int cypress_open (struct usb_serial_port *port, struct file *filp); | 160 | static int cypress_open (struct usb_serial_port *port, struct file *filp); |
154 | static void cypress_close (struct usb_serial_port *port, struct file *filp); | 161 | static void cypress_close (struct usb_serial_port *port, struct file *filp); |
@@ -235,6 +242,34 @@ static struct usb_serial_driver cypress_hidcom_device = { | |||
235 | .write_int_callback = cypress_write_int_callback, | 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 | * Cypress serial helper functions | 275 | * Cypress serial helper functions |
@@ -286,6 +321,12 @@ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_m | |||
286 | __FUNCTION__); | 321 | __FUNCTION__); |
287 | new_baudrate = priv->baud_rate; | 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 | } else if (priv->chiptype == CT_GENERIC) { | 330 | } else if (priv->chiptype == CT_GENERIC) { |
290 | if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) { | 331 | if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) { |
291 | err("%s - failed setting baud rate, unsupported speed", | 332 | err("%s - failed setting baud rate, unsupported speed", |
@@ -499,6 +540,25 @@ static int cypress_hidcom_startup (struct usb_serial *serial) | |||
499 | } /* cypress_hidcom_startup */ | 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 | static void cypress_shutdown (struct usb_serial *serial) | 562 | static void cypress_shutdown (struct usb_serial *serial) |
503 | { | 563 | { |
504 | struct cypress_private *priv; | 564 | struct cypress_private *priv; |
@@ -943,6 +1003,10 @@ static void cypress_set_termios (struct usb_serial_port *port, | |||
943 | *(tty->termios) = tty_std_termios; | 1003 | *(tty->termios) = tty_std_termios; |
944 | tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | | 1004 | tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | |
945 | CLOCAL; | 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 | priv->termios_initialized = 1; | 1011 | priv->termios_initialized = 1; |
948 | } | 1012 | } |
@@ -1541,6 +1605,9 @@ static int __init cypress_init(void) | |||
1541 | retval = usb_serial_register(&cypress_hidcom_device); | 1605 | retval = usb_serial_register(&cypress_hidcom_device); |
1542 | if (retval) | 1606 | if (retval) |
1543 | goto failed_hidcom_register; | 1607 | goto failed_hidcom_register; |
1608 | retval = usb_serial_register(&cypress_ca42v2_device); | ||
1609 | if (retval) | ||
1610 | goto failed_ca42v2_register; | ||
1544 | retval = usb_register(&cypress_driver); | 1611 | retval = usb_register(&cypress_driver); |
1545 | if (retval) | 1612 | if (retval) |
1546 | goto failed_usb_register; | 1613 | goto failed_usb_register; |
@@ -1549,6 +1616,8 @@ static int __init cypress_init(void) | |||
1549 | return 0; | 1616 | return 0; |
1550 | failed_usb_register: | 1617 | failed_usb_register: |
1551 | usb_deregister(&cypress_driver); | 1618 | usb_deregister(&cypress_driver); |
1619 | failed_ca42v2_register: | ||
1620 | usb_serial_deregister(&cypress_ca42v2_device); | ||
1552 | failed_hidcom_register: | 1621 | failed_hidcom_register: |
1553 | usb_serial_deregister(&cypress_hidcom_device); | 1622 | usb_serial_deregister(&cypress_hidcom_device); |
1554 | failed_em_register: | 1623 | failed_em_register: |
@@ -1565,6 +1634,7 @@ static void __exit cypress_exit (void) | |||
1565 | usb_deregister (&cypress_driver); | 1634 | usb_deregister (&cypress_driver); |
1566 | usb_serial_deregister (&cypress_earthmate_device); | 1635 | usb_serial_deregister (&cypress_earthmate_device); |
1567 | usb_serial_deregister (&cypress_hidcom_device); | 1636 | usb_serial_deregister (&cypress_hidcom_device); |
1637 | usb_serial_deregister (&cypress_ca42v2_device); | ||
1568 | } | 1638 | } |
1569 | 1639 | ||
1570 | 1640 | ||