kl5kusb105.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. /*
  2. * KLSI KL5KUSB105 chip RS232 converter driver
  3. *
  4. * Copyright (C) 2010 Johan Hovold <jhovold@gmail.com>
  5. * Copyright (C) 2001 Utz-Uwe Haus <haus@uuhaus.de>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * All information about the device was acquired using SniffUSB ans snoopUSB
  13. * on Windows98.
  14. * It was written out of frustration with the PalmConnect USB Serial adapter
  15. * sold by Palm Inc.
  16. * Neither Palm, nor their contractor (MCCI) or their supplier (KLSI) provided
  17. * information that was not already available.
  18. *
  19. * It seems that KLSI bought some silicon-design information from ScanLogic,
  20. * whose SL11R processor is at the core of the KL5KUSB chipset from KLSI.
  21. * KLSI has firmware available for their devices; it is probable that the
  22. * firmware differs from that used by KLSI in their products. If you have an
  23. * original KLSI device and can provide some information on it, I would be
  24. * most interested in adding support for it here. If you have any information
  25. * on the protocol used (or find errors in my reverse-engineered stuff), please
  26. * let me know.
  27. *
  28. * The code was only tested with a PalmConnect USB adapter; if you
  29. * are adventurous, try it with any KLSI-based device and let me know how it
  30. * breaks so that I can fix it!
  31. */
  32. /* TODO:
  33. * check modem line signals
  34. * implement handshaking or decide that we do not support it
  35. */
  36. #include <linux/kernel.h>
  37. #include <linux/errno.h>
  38. #include <linux/slab.h>
  39. #include <linux/tty.h>
  40. #include <linux/tty_driver.h>
  41. #include <linux/tty_flip.h>
  42. #include <linux/module.h>
  43. #include <linux/uaccess.h>
  44. #include <asm/unaligned.h>
  45. #include <linux/usb.h>
  46. #include <linux/usb/serial.h>
  47. #include "kl5kusb105.h"
  48. #define DRIVER_AUTHOR "Utz-Uwe Haus <haus@uuhaus.de>, Johan Hovold <jhovold@gmail.com>"
  49. #define DRIVER_DESC "KLSI KL5KUSB105 chipset USB->Serial Converter driver"
  50. /*
  51. * Function prototypes
  52. */
  53. static int klsi_105_port_probe(struct usb_serial_port *port);
  54. static int klsi_105_port_remove(struct usb_serial_port *port);
  55. static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port);
  56. static void klsi_105_close(struct usb_serial_port *port);
  57. static void klsi_105_set_termios(struct tty_struct *tty,
  58. struct usb_serial_port *port, struct ktermios *old);
  59. static int klsi_105_tiocmget(struct tty_struct *tty);
  60. static void klsi_105_process_read_urb(struct urb *urb);
  61. static int klsi_105_prepare_write_buffer(struct usb_serial_port *port,
  62. void *dest, size_t size);
  63. /*
  64. * All of the device info needed for the KLSI converters.
  65. */
  66. static const struct usb_device_id id_table[] = {
  67. { USB_DEVICE(PALMCONNECT_VID, PALMCONNECT_PID) },
  68. { USB_DEVICE(KLSI_VID, KLSI_KL5KUSB105D_PID) },
  69. { } /* Terminating entry */
  70. };
  71. MODULE_DEVICE_TABLE(usb, id_table);
  72. static struct usb_serial_driver kl5kusb105d_device = {
  73. .driver = {
  74. .owner = THIS_MODULE,
  75. .name = "kl5kusb105d",
  76. },
  77. .description = "KL5KUSB105D / PalmConnect",
  78. .id_table = id_table,
  79. .num_ports = 1,
  80. .bulk_out_size = 64,
  81. .open = klsi_105_open,
  82. .close = klsi_105_close,
  83. .set_termios = klsi_105_set_termios,
  84. /*.break_ctl = klsi_105_break_ctl,*/
  85. .tiocmget = klsi_105_tiocmget,
  86. .port_probe = klsi_105_port_probe,
  87. .port_remove = klsi_105_port_remove,
  88. .throttle = usb_serial_generic_throttle,
  89. .unthrottle = usb_serial_generic_unthrottle,
  90. .process_read_urb = klsi_105_process_read_urb,
  91. .prepare_write_buffer = klsi_105_prepare_write_buffer,
  92. };
  93. static struct usb_serial_driver * const serial_drivers[] = {
  94. &kl5kusb105d_device, NULL
  95. };
  96. struct klsi_105_port_settings {
  97. __u8 pktlen; /* always 5, it seems */
  98. __u8 baudrate;
  99. __u8 databits;
  100. __u8 unknown1;
  101. __u8 unknown2;
  102. } __attribute__ ((packed));
  103. struct klsi_105_private {
  104. struct klsi_105_port_settings cfg;
  105. struct ktermios termios;
  106. unsigned long line_state; /* modem line settings */
  107. spinlock_t lock;
  108. };
  109. /*
  110. * Handle vendor specific USB requests
  111. */
  112. #define KLSI_TIMEOUT 5000 /* default urb timeout */
  113. static int klsi_105_chg_port_settings(struct usb_serial_port *port,
  114. struct klsi_105_port_settings *settings)
  115. {
  116. int rc;
  117. rc = usb_control_msg(port->serial->dev,
  118. usb_sndctrlpipe(port->serial->dev, 0),
  119. KL5KUSB105A_SIO_SET_DATA,
  120. USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_INTERFACE,
  121. 0, /* value */
  122. 0, /* index */
  123. settings,
  124. sizeof(struct klsi_105_port_settings),
  125. KLSI_TIMEOUT);
  126. if (rc < 0)
  127. dev_err(&port->dev,
  128. "Change port settings failed (error = %d)\n", rc);
  129. dev_info(&port->serial->dev->dev,
  130. "%d byte block, baudrate %x, databits %d, u1 %d, u2 %d\n",
  131. settings->pktlen, settings->baudrate, settings->databits,
  132. settings->unknown1, settings->unknown2);
  133. return rc;
  134. }
  135. /* translate a 16-bit status value from the device to linux's TIO bits */
  136. static unsigned long klsi_105_status2linestate(const __u16 status)
  137. {
  138. unsigned long res = 0;
  139. res = ((status & KL5KUSB105A_DSR) ? TIOCM_DSR : 0)
  140. | ((status & KL5KUSB105A_CTS) ? TIOCM_CTS : 0)
  141. ;
  142. return res;
  143. }
  144. /*
  145. * Read line control via vendor command and return result through
  146. * *line_state_p
  147. */
  148. /* It seems that the status buffer has always only 2 bytes length */
  149. #define KLSI_STATUSBUF_LEN 2
  150. static int klsi_105_get_line_state(struct usb_serial_port *port,
  151. unsigned long *line_state_p)
  152. {
  153. int rc;
  154. u8 *status_buf;
  155. __u16 status;
  156. dev_info(&port->serial->dev->dev, "sending SIO Poll request\n");
  157. status_buf = kmalloc(KLSI_STATUSBUF_LEN, GFP_KERNEL);
  158. if (!status_buf)
  159. return -ENOMEM;
  160. status_buf[0] = 0xff;
  161. status_buf[1] = 0xff;
  162. rc = usb_control_msg(port->serial->dev,
  163. usb_rcvctrlpipe(port->serial->dev, 0),
  164. KL5KUSB105A_SIO_POLL,
  165. USB_TYPE_VENDOR | USB_DIR_IN,
  166. 0, /* value */
  167. 0, /* index */
  168. status_buf, KLSI_STATUSBUF_LEN,
  169. 10000
  170. );
  171. if (rc != KLSI_STATUSBUF_LEN) {
  172. dev_err(&port->dev, "reading line status failed: %d\n", rc);
  173. if (rc >= 0)
  174. rc = -EIO;
  175. } else {
  176. status = get_unaligned_le16(status_buf);
  177. dev_info(&port->serial->dev->dev, "read status %x %x\n",
  178. status_buf[0], status_buf[1]);
  179. *line_state_p = klsi_105_status2linestate(status);
  180. }
  181. kfree(status_buf);
  182. return rc;
  183. }
  184. /*
  185. * Driver's tty interface functions
  186. */
  187. static int klsi_105_port_probe(struct usb_serial_port *port)
  188. {
  189. struct klsi_105_private *priv;
  190. priv = kmalloc(sizeof(*priv), GFP_KERNEL);
  191. if (!priv)
  192. return -ENOMEM;
  193. /* set initial values for control structures */
  194. priv->cfg.pktlen = 5;
  195. priv->cfg.baudrate = kl5kusb105a_sio_b9600;
  196. priv->cfg.databits = kl5kusb105a_dtb_8;
  197. priv->cfg.unknown1 = 0;
  198. priv->cfg.unknown2 = 1;
  199. priv->line_state = 0;
  200. spin_lock_init(&priv->lock);
  201. /* priv->termios is left uninitialized until port opening */
  202. usb_set_serial_port_data(port, priv);
  203. return 0;
  204. }
  205. static int klsi_105_port_remove(struct usb_serial_port *port)
  206. {
  207. struct klsi_105_private *priv;
  208. priv = usb_get_serial_port_data(port);
  209. kfree(priv);
  210. return 0;
  211. }
  212. static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port)
  213. {
  214. struct klsi_105_private *priv = usb_get_serial_port_data(port);
  215. int retval = 0;
  216. int rc;
  217. int i;
  218. unsigned long line_state;
  219. struct klsi_105_port_settings *cfg;
  220. unsigned long flags;
  221. /* Do a defined restart:
  222. * Set up sane default baud rate and send the 'READ_ON'
  223. * vendor command.
  224. * FIXME: set modem line control (how?)
  225. * Then read the modem line control and store values in
  226. * priv->line_state.
  227. */
  228. cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
  229. if (!cfg)
  230. return -ENOMEM;
  231. cfg->pktlen = 5;
  232. cfg->baudrate = kl5kusb105a_sio_b9600;
  233. cfg->databits = kl5kusb105a_dtb_8;
  234. cfg->unknown1 = 0;
  235. cfg->unknown2 = 1;
  236. klsi_105_chg_port_settings(port, cfg);
  237. /* set up termios structure */
  238. spin_lock_irqsave(&priv->lock, flags);
  239. priv->termios.c_iflag = tty->termios.c_iflag;
  240. priv->termios.c_oflag = tty->termios.c_oflag;
  241. priv->termios.c_cflag = tty->termios.c_cflag;
  242. priv->termios.c_lflag = tty->termios.c_lflag;
  243. for (i = 0; i < NCCS; i++)
  244. priv->termios.c_cc[i] = tty->termios.c_cc[i];
  245. priv->cfg.pktlen = cfg->pktlen;
  246. priv->cfg.baudrate = cfg->baudrate;
  247. priv->cfg.databits = cfg->databits;
  248. priv->cfg.unknown1 = cfg->unknown1;
  249. priv->cfg.unknown2 = cfg->unknown2;
  250. spin_unlock_irqrestore(&priv->lock, flags);
  251. /* READ_ON and urb submission */
  252. rc = usb_serial_generic_open(tty, port);
  253. if (rc) {
  254. retval = rc;
  255. goto err_free_cfg;
  256. }
  257. rc = usb_control_msg(port->serial->dev,
  258. usb_sndctrlpipe(port->serial->dev, 0),
  259. KL5KUSB105A_SIO_CONFIGURE,
  260. USB_TYPE_VENDOR|USB_DIR_OUT|USB_RECIP_INTERFACE,
  261. KL5KUSB105A_SIO_CONFIGURE_READ_ON,
  262. 0, /* index */
  263. NULL,
  264. 0,
  265. KLSI_TIMEOUT);
  266. if (rc < 0) {
  267. dev_err(&port->dev, "Enabling read failed (error = %d)\n", rc);
  268. retval = rc;
  269. goto err_generic_close;
  270. } else
  271. dev_dbg(&port->dev, "%s - enabled reading\n", __func__);
  272. rc = klsi_105_get_line_state(port, &line_state);
  273. if (rc < 0) {
  274. retval = rc;
  275. goto err_disable_read;
  276. }
  277. spin_lock_irqsave(&priv->lock, flags);
  278. priv->line_state = line_state;
  279. spin_unlock_irqrestore(&priv->lock, flags);
  280. dev_dbg(&port->dev, "%s - read line state 0x%lx\n", __func__,
  281. line_state);
  282. return 0;
  283. err_disable_read:
  284. usb_control_msg(port->serial->dev,
  285. usb_sndctrlpipe(port->serial->dev, 0),
  286. KL5KUSB105A_SIO_CONFIGURE,
  287. USB_TYPE_VENDOR | USB_DIR_OUT,
  288. KL5KUSB105A_SIO_CONFIGURE_READ_OFF,
  289. 0, /* index */
  290. NULL, 0,
  291. KLSI_TIMEOUT);
  292. err_generic_close:
  293. usb_serial_generic_close(port);
  294. err_free_cfg:
  295. kfree(cfg);
  296. return retval;
  297. }
  298. static void klsi_105_close(struct usb_serial_port *port)
  299. {
  300. int rc;
  301. /* send READ_OFF */
  302. rc = usb_control_msg(port->serial->dev,
  303. usb_sndctrlpipe(port->serial->dev, 0),
  304. KL5KUSB105A_SIO_CONFIGURE,
  305. USB_TYPE_VENDOR | USB_DIR_OUT,
  306. KL5KUSB105A_SIO_CONFIGURE_READ_OFF,
  307. 0, /* index */
  308. NULL, 0,
  309. KLSI_TIMEOUT);
  310. if (rc < 0)
  311. dev_err(&port->dev, "failed to disable read: %d\n", rc);
  312. /* shutdown our bulk reads and writes */
  313. usb_serial_generic_close(port);
  314. }
  315. /* We need to write a complete 64-byte data block and encode the
  316. * number actually sent in the first double-byte, LSB-order. That
  317. * leaves at most 62 bytes of payload.
  318. */
  319. #define KLSI_HDR_LEN 2
  320. static int klsi_105_prepare_write_buffer(struct usb_serial_port *port,
  321. void *dest, size_t size)
  322. {
  323. unsigned char *buf = dest;
  324. int count;
  325. count = kfifo_out_locked(&port->write_fifo, buf + KLSI_HDR_LEN, size,
  326. &port->lock);
  327. put_unaligned_le16(count, buf);
  328. return count + KLSI_HDR_LEN;
  329. }
  330. /* The data received is preceded by a length double-byte in LSB-first order.
  331. */
  332. static void klsi_105_process_read_urb(struct urb *urb)
  333. {
  334. struct usb_serial_port *port = urb->context;
  335. unsigned char *data = urb->transfer_buffer;
  336. unsigned len;
  337. /* empty urbs seem to happen, we ignore them */
  338. if (!urb->actual_length)
  339. return;
  340. if (urb->actual_length <= KLSI_HDR_LEN) {
  341. dev_dbg(&port->dev, "%s - malformed packet\n", __func__);
  342. return;
  343. }
  344. len = get_unaligned_le16(data);
  345. if (len > urb->actual_length - KLSI_HDR_LEN) {
  346. dev_dbg(&port->dev, "%s - packet length mismatch\n", __func__);
  347. len = urb->actual_length - KLSI_HDR_LEN;
  348. }
  349. tty_insert_flip_string(&port->port, data + KLSI_HDR_LEN, len);
  350. tty_flip_buffer_push(&port->port);
  351. }
  352. static void klsi_105_set_termios(struct tty_struct *tty,
  353. struct usb_serial_port *port,
  354. struct ktermios *old_termios)
  355. {
  356. struct klsi_105_private *priv = usb_get_serial_port_data(port);
  357. struct device *dev = &port->dev;
  358. unsigned int iflag = tty->termios.c_iflag;
  359. unsigned int old_iflag = old_termios->c_iflag;
  360. unsigned int cflag = tty->termios.c_cflag;
  361. unsigned int old_cflag = old_termios->c_cflag;
  362. struct klsi_105_port_settings *cfg;
  363. unsigned long flags;
  364. speed_t baud;
  365. cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
  366. if (!cfg)
  367. return;
  368. /* lock while we are modifying the settings */
  369. spin_lock_irqsave(&priv->lock, flags);
  370. /*
  371. * Update baud rate
  372. */
  373. baud = tty_get_baud_rate(tty);
  374. if ((cflag & CBAUD) != (old_cflag & CBAUD)) {
  375. /* reassert DTR and (maybe) RTS on transition from B0 */
  376. if ((old_cflag & CBAUD) == B0) {
  377. dev_dbg(dev, "%s: baud was B0\n", __func__);
  378. #if 0
  379. priv->control_state |= TIOCM_DTR;
  380. /* don't set RTS if using hardware flow control */
  381. if (!(old_cflag & CRTSCTS))
  382. priv->control_state |= TIOCM_RTS;
  383. mct_u232_set_modem_ctrl(serial, priv->control_state);
  384. #endif
  385. }
  386. }
  387. switch (baud) {
  388. case 0: /* handled below */
  389. break;
  390. case 1200:
  391. priv->cfg.baudrate = kl5kusb105a_sio_b1200;
  392. break;
  393. case 2400:
  394. priv->cfg.baudrate = kl5kusb105a_sio_b2400;
  395. break;
  396. case 4800:
  397. priv->cfg.baudrate = kl5kusb105a_sio_b4800;
  398. break;
  399. case 9600:
  400. priv->cfg.baudrate = kl5kusb105a_sio_b9600;
  401. break;
  402. case 19200:
  403. priv->cfg.baudrate = kl5kusb105a_sio_b19200;
  404. break;
  405. case 38400:
  406. priv->cfg.baudrate = kl5kusb105a_sio_b38400;
  407. break;
  408. case 57600:
  409. priv->cfg.baudrate = kl5kusb105a_sio_b57600;
  410. break;
  411. case 115200:
  412. priv->cfg.baudrate = kl5kusb105a_sio_b115200;
  413. break;
  414. default:
  415. dev_dbg(dev, "unsupported baudrate, using 9600\n");
  416. priv->cfg.baudrate = kl5kusb105a_sio_b9600;
  417. baud = 9600;
  418. break;
  419. }
  420. if ((cflag & CBAUD) == B0) {
  421. dev_dbg(dev, "%s: baud is B0\n", __func__);
  422. /* Drop RTS and DTR */
  423. /* maybe this should be simulated by sending read
  424. * disable and read enable messages?
  425. */
  426. ;
  427. #if 0
  428. priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS);
  429. mct_u232_set_modem_ctrl(serial, priv->control_state);
  430. #endif
  431. }
  432. tty_encode_baud_rate(tty, baud, baud);
  433. if ((cflag & CSIZE) != (old_cflag & CSIZE)) {
  434. /* set the number of data bits */
  435. switch (cflag & CSIZE) {
  436. case CS5:
  437. dev_dbg(dev, "%s - 5 bits/byte not supported\n", __func__);
  438. spin_unlock_irqrestore(&priv->lock, flags);
  439. goto err;
  440. case CS6:
  441. dev_dbg(dev, "%s - 6 bits/byte not supported\n", __func__);
  442. spin_unlock_irqrestore(&priv->lock, flags);
  443. goto err;
  444. case CS7:
  445. priv->cfg.databits = kl5kusb105a_dtb_7;
  446. break;
  447. case CS8:
  448. priv->cfg.databits = kl5kusb105a_dtb_8;
  449. break;
  450. default:
  451. dev_err(dev, "CSIZE was not CS5-CS8, using default of 8\n");
  452. priv->cfg.databits = kl5kusb105a_dtb_8;
  453. break;
  454. }
  455. }
  456. /*
  457. * Update line control register (LCR)
  458. */
  459. if ((cflag & (PARENB|PARODD)) != (old_cflag & (PARENB|PARODD))
  460. || (cflag & CSTOPB) != (old_cflag & CSTOPB)) {
  461. /* Not currently supported */
  462. tty->termios.c_cflag &= ~(PARENB|PARODD|CSTOPB);
  463. #if 0
  464. priv->last_lcr = 0;
  465. /* set the parity */
  466. if (cflag & PARENB)
  467. priv->last_lcr |= (cflag & PARODD) ?
  468. MCT_U232_PARITY_ODD : MCT_U232_PARITY_EVEN;
  469. else
  470. priv->last_lcr |= MCT_U232_PARITY_NONE;
  471. /* set the number of stop bits */
  472. priv->last_lcr |= (cflag & CSTOPB) ?
  473. MCT_U232_STOP_BITS_2 : MCT_U232_STOP_BITS_1;
  474. mct_u232_set_line_ctrl(serial, priv->last_lcr);
  475. #endif
  476. ;
  477. }
  478. /*
  479. * Set flow control: well, I do not really now how to handle DTR/RTS.
  480. * Just do what we have seen with SniffUSB on Win98.
  481. */
  482. if ((iflag & IXOFF) != (old_iflag & IXOFF)
  483. || (iflag & IXON) != (old_iflag & IXON)
  484. || (cflag & CRTSCTS) != (old_cflag & CRTSCTS)) {
  485. /* Not currently supported */
  486. tty->termios.c_cflag &= ~CRTSCTS;
  487. /* Drop DTR/RTS if no flow control otherwise assert */
  488. #if 0
  489. if ((iflag & IXOFF) || (iflag & IXON) || (cflag & CRTSCTS))
  490. priv->control_state |= TIOCM_DTR | TIOCM_RTS;
  491. else
  492. priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS);
  493. mct_u232_set_modem_ctrl(serial, priv->control_state);
  494. #endif
  495. ;
  496. }
  497. memcpy(cfg, &priv->cfg, sizeof(*cfg));
  498. spin_unlock_irqrestore(&priv->lock, flags);
  499. /* now commit changes to device */
  500. klsi_105_chg_port_settings(port, cfg);
  501. err:
  502. kfree(cfg);
  503. }
  504. #if 0
  505. static void mct_u232_break_ctl(struct tty_struct *tty, int break_state)
  506. {
  507. struct usb_serial_port *port = tty->driver_data;
  508. struct usb_serial *serial = port->serial;
  509. struct mct_u232_private *priv =
  510. (struct mct_u232_private *)port->private;
  511. unsigned char lcr = priv->last_lcr;
  512. dev_dbg(&port->dev, "%s - state=%d\n", __func__, break_state);
  513. /* LOCKING */
  514. if (break_state)
  515. lcr |= MCT_U232_SET_BREAK;
  516. mct_u232_set_line_ctrl(serial, lcr);
  517. }
  518. #endif
  519. static int klsi_105_tiocmget(struct tty_struct *tty)
  520. {
  521. struct usb_serial_port *port = tty->driver_data;
  522. struct klsi_105_private *priv = usb_get_serial_port_data(port);
  523. unsigned long flags;
  524. int rc;
  525. unsigned long line_state;
  526. rc = klsi_105_get_line_state(port, &line_state);
  527. if (rc < 0) {
  528. dev_err(&port->dev,
  529. "Reading line control failed (error = %d)\n", rc);
  530. /* better return value? EAGAIN? */
  531. return rc;
  532. }
  533. spin_lock_irqsave(&priv->lock, flags);
  534. priv->line_state = line_state;
  535. spin_unlock_irqrestore(&priv->lock, flags);
  536. dev_dbg(&port->dev, "%s - read line state 0x%lx\n", __func__, line_state);
  537. return (int)line_state;
  538. }
  539. module_usb_serial_driver(serial_drivers, id_table);
  540. MODULE_AUTHOR(DRIVER_AUTHOR);
  541. MODULE_DESCRIPTION(DRIVER_DESC);
  542. MODULE_LICENSE("GPL");