f81232.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Fintek F81232 USB to serial adaptor driver
  4. *
  5. * Copyright (C) 2012 Greg Kroah-Hartman (gregkh@linuxfoundation.org)
  6. * Copyright (C) 2012 Linux Foundation
  7. */
  8. #include <linux/kernel.h>
  9. #include <linux/errno.h>
  10. #include <linux/slab.h>
  11. #include <linux/tty.h>
  12. #include <linux/tty_driver.h>
  13. #include <linux/tty_flip.h>
  14. #include <linux/serial.h>
  15. #include <linux/module.h>
  16. #include <linux/moduleparam.h>
  17. #include <linux/mutex.h>
  18. #include <linux/uaccess.h>
  19. #include <linux/usb.h>
  20. #include <linux/usb/serial.h>
  21. #include <linux/serial_reg.h>
  22. static const struct usb_device_id id_table[] = {
  23. { USB_DEVICE(0x1934, 0x0706) },
  24. { } /* Terminating entry */
  25. };
  26. MODULE_DEVICE_TABLE(usb, id_table);
  27. /* Maximum baudrate for F81232 */
  28. #define F81232_MAX_BAUDRATE 115200
  29. /* USB Control EP parameter */
  30. #define F81232_REGISTER_REQUEST 0xa0
  31. #define F81232_GET_REGISTER 0xc0
  32. #define F81232_SET_REGISTER 0x40
  33. #define SERIAL_BASE_ADDRESS 0x0120
  34. #define RECEIVE_BUFFER_REGISTER (0x00 + SERIAL_BASE_ADDRESS)
  35. #define INTERRUPT_ENABLE_REGISTER (0x01 + SERIAL_BASE_ADDRESS)
  36. #define FIFO_CONTROL_REGISTER (0x02 + SERIAL_BASE_ADDRESS)
  37. #define LINE_CONTROL_REGISTER (0x03 + SERIAL_BASE_ADDRESS)
  38. #define MODEM_CONTROL_REGISTER (0x04 + SERIAL_BASE_ADDRESS)
  39. #define MODEM_STATUS_REGISTER (0x06 + SERIAL_BASE_ADDRESS)
  40. struct f81232_private {
  41. struct mutex lock;
  42. u8 modem_control;
  43. u8 modem_status;
  44. struct work_struct interrupt_work;
  45. struct usb_serial_port *port;
  46. };
  47. static int calc_baud_divisor(speed_t baudrate)
  48. {
  49. return DIV_ROUND_CLOSEST(F81232_MAX_BAUDRATE, baudrate);
  50. }
  51. static int f81232_get_register(struct usb_serial_port *port, u16 reg, u8 *val)
  52. {
  53. int status;
  54. u8 *tmp;
  55. struct usb_device *dev = port->serial->dev;
  56. tmp = kmalloc(sizeof(*val), GFP_KERNEL);
  57. if (!tmp)
  58. return -ENOMEM;
  59. status = usb_control_msg(dev,
  60. usb_rcvctrlpipe(dev, 0),
  61. F81232_REGISTER_REQUEST,
  62. F81232_GET_REGISTER,
  63. reg,
  64. 0,
  65. tmp,
  66. sizeof(*val),
  67. USB_CTRL_GET_TIMEOUT);
  68. if (status != sizeof(*val)) {
  69. dev_err(&port->dev, "%s failed status: %d\n", __func__, status);
  70. if (status < 0)
  71. status = usb_translate_errors(status);
  72. else
  73. status = -EIO;
  74. } else {
  75. status = 0;
  76. *val = *tmp;
  77. }
  78. kfree(tmp);
  79. return status;
  80. }
  81. static int f81232_set_register(struct usb_serial_port *port, u16 reg, u8 val)
  82. {
  83. int status;
  84. u8 *tmp;
  85. struct usb_device *dev = port->serial->dev;
  86. tmp = kmalloc(sizeof(val), GFP_KERNEL);
  87. if (!tmp)
  88. return -ENOMEM;
  89. *tmp = val;
  90. status = usb_control_msg(dev,
  91. usb_sndctrlpipe(dev, 0),
  92. F81232_REGISTER_REQUEST,
  93. F81232_SET_REGISTER,
  94. reg,
  95. 0,
  96. tmp,
  97. sizeof(val),
  98. USB_CTRL_SET_TIMEOUT);
  99. if (status != sizeof(val)) {
  100. dev_err(&port->dev, "%s failed status: %d\n", __func__, status);
  101. if (status < 0)
  102. status = usb_translate_errors(status);
  103. else
  104. status = -EIO;
  105. } else {
  106. status = 0;
  107. }
  108. kfree(tmp);
  109. return status;
  110. }
  111. static void f81232_read_msr(struct usb_serial_port *port)
  112. {
  113. int status;
  114. u8 current_msr;
  115. struct tty_struct *tty;
  116. struct f81232_private *priv = usb_get_serial_port_data(port);
  117. mutex_lock(&priv->lock);
  118. status = f81232_get_register(port, MODEM_STATUS_REGISTER,
  119. &current_msr);
  120. if (status) {
  121. dev_err(&port->dev, "%s fail, status: %d\n", __func__, status);
  122. mutex_unlock(&priv->lock);
  123. return;
  124. }
  125. if (!(current_msr & UART_MSR_ANY_DELTA)) {
  126. mutex_unlock(&priv->lock);
  127. return;
  128. }
  129. priv->modem_status = current_msr;
  130. if (current_msr & UART_MSR_DCTS)
  131. port->icount.cts++;
  132. if (current_msr & UART_MSR_DDSR)
  133. port->icount.dsr++;
  134. if (current_msr & UART_MSR_TERI)
  135. port->icount.rng++;
  136. if (current_msr & UART_MSR_DDCD) {
  137. port->icount.dcd++;
  138. tty = tty_port_tty_get(&port->port);
  139. if (tty) {
  140. usb_serial_handle_dcd_change(port, tty,
  141. current_msr & UART_MSR_DCD);
  142. tty_kref_put(tty);
  143. }
  144. }
  145. wake_up_interruptible(&port->port.delta_msr_wait);
  146. mutex_unlock(&priv->lock);
  147. }
  148. static int f81232_set_mctrl(struct usb_serial_port *port,
  149. unsigned int set, unsigned int clear)
  150. {
  151. u8 val;
  152. int status;
  153. struct f81232_private *priv = usb_get_serial_port_data(port);
  154. if (((set | clear) & (TIOCM_DTR | TIOCM_RTS)) == 0)
  155. return 0; /* no change */
  156. /* 'set' takes precedence over 'clear' */
  157. clear &= ~set;
  158. /* force enable interrupt with OUT2 */
  159. mutex_lock(&priv->lock);
  160. val = UART_MCR_OUT2 | priv->modem_control;
  161. if (clear & TIOCM_DTR)
  162. val &= ~UART_MCR_DTR;
  163. if (clear & TIOCM_RTS)
  164. val &= ~UART_MCR_RTS;
  165. if (set & TIOCM_DTR)
  166. val |= UART_MCR_DTR;
  167. if (set & TIOCM_RTS)
  168. val |= UART_MCR_RTS;
  169. dev_dbg(&port->dev, "%s new:%02x old:%02x\n", __func__,
  170. val, priv->modem_control);
  171. status = f81232_set_register(port, MODEM_CONTROL_REGISTER, val);
  172. if (status) {
  173. dev_err(&port->dev, "%s set MCR status < 0\n", __func__);
  174. mutex_unlock(&priv->lock);
  175. return status;
  176. }
  177. priv->modem_control = val;
  178. mutex_unlock(&priv->lock);
  179. return 0;
  180. }
  181. static void f81232_update_line_status(struct usb_serial_port *port,
  182. unsigned char *data,
  183. size_t actual_length)
  184. {
  185. struct f81232_private *priv = usb_get_serial_port_data(port);
  186. if (!actual_length)
  187. return;
  188. switch (data[0] & 0x07) {
  189. case 0x00: /* msr change */
  190. dev_dbg(&port->dev, "IIR: MSR Change: %02x\n", data[0]);
  191. schedule_work(&priv->interrupt_work);
  192. break;
  193. case 0x02: /* tx-empty */
  194. break;
  195. case 0x04: /* rx data available */
  196. break;
  197. case 0x06: /* lsr change */
  198. /* we can forget it. the LSR will read from bulk-in */
  199. dev_dbg(&port->dev, "IIR: LSR Change: %02x\n", data[0]);
  200. break;
  201. }
  202. }
  203. static void f81232_read_int_callback(struct urb *urb)
  204. {
  205. struct usb_serial_port *port = urb->context;
  206. unsigned char *data = urb->transfer_buffer;
  207. unsigned int actual_length = urb->actual_length;
  208. int status = urb->status;
  209. int retval;
  210. switch (status) {
  211. case 0:
  212. /* success */
  213. break;
  214. case -ECONNRESET:
  215. case -ENOENT:
  216. case -ESHUTDOWN:
  217. /* this urb is terminated, clean up */
  218. dev_dbg(&port->dev, "%s - urb shutting down with status: %d\n",
  219. __func__, status);
  220. return;
  221. default:
  222. dev_dbg(&port->dev, "%s - nonzero urb status received: %d\n",
  223. __func__, status);
  224. goto exit;
  225. }
  226. usb_serial_debug_data(&port->dev, __func__,
  227. urb->actual_length, urb->transfer_buffer);
  228. f81232_update_line_status(port, data, actual_length);
  229. exit:
  230. retval = usb_submit_urb(urb, GFP_ATOMIC);
  231. if (retval)
  232. dev_err(&urb->dev->dev,
  233. "%s - usb_submit_urb failed with result %d\n",
  234. __func__, retval);
  235. }
  236. static void f81232_process_read_urb(struct urb *urb)
  237. {
  238. struct usb_serial_port *port = urb->context;
  239. unsigned char *data = urb->transfer_buffer;
  240. char tty_flag;
  241. unsigned int i;
  242. u8 lsr;
  243. /*
  244. * When opening the port we get a 1-byte packet with the current LSR,
  245. * which we discard.
  246. */
  247. if ((urb->actual_length < 2) || (urb->actual_length % 2))
  248. return;
  249. /* bulk-in data: [LSR(1Byte)+DATA(1Byte)][LSR(1Byte)+DATA(1Byte)]... */
  250. for (i = 0; i < urb->actual_length; i += 2) {
  251. tty_flag = TTY_NORMAL;
  252. lsr = data[i];
  253. if (lsr & UART_LSR_BRK_ERROR_BITS) {
  254. if (lsr & UART_LSR_BI) {
  255. tty_flag = TTY_BREAK;
  256. port->icount.brk++;
  257. usb_serial_handle_break(port);
  258. } else if (lsr & UART_LSR_PE) {
  259. tty_flag = TTY_PARITY;
  260. port->icount.parity++;
  261. } else if (lsr & UART_LSR_FE) {
  262. tty_flag = TTY_FRAME;
  263. port->icount.frame++;
  264. }
  265. if (lsr & UART_LSR_OE) {
  266. port->icount.overrun++;
  267. tty_insert_flip_char(&port->port, 0,
  268. TTY_OVERRUN);
  269. }
  270. }
  271. if (port->port.console && port->sysrq) {
  272. if (usb_serial_handle_sysrq_char(port, data[i + 1]))
  273. continue;
  274. }
  275. tty_insert_flip_char(&port->port, data[i + 1], tty_flag);
  276. }
  277. tty_flip_buffer_push(&port->port);
  278. }
  279. static void f81232_break_ctl(struct tty_struct *tty, int break_state)
  280. {
  281. /* FIXME - Stubbed out for now */
  282. /*
  283. * break_state = -1 to turn on break, and 0 to turn off break
  284. * see drivers/char/tty_io.c to see it used.
  285. * last_set_data_urb_value NEVER has the break bit set in it.
  286. */
  287. }
  288. static void f81232_set_baudrate(struct usb_serial_port *port, speed_t baudrate)
  289. {
  290. u8 lcr;
  291. int divisor;
  292. int status = 0;
  293. divisor = calc_baud_divisor(baudrate);
  294. status = f81232_get_register(port, LINE_CONTROL_REGISTER,
  295. &lcr); /* get LCR */
  296. if (status) {
  297. dev_err(&port->dev, "%s failed to get LCR: %d\n",
  298. __func__, status);
  299. return;
  300. }
  301. status = f81232_set_register(port, LINE_CONTROL_REGISTER,
  302. lcr | UART_LCR_DLAB); /* Enable DLAB */
  303. if (status) {
  304. dev_err(&port->dev, "%s failed to set DLAB: %d\n",
  305. __func__, status);
  306. return;
  307. }
  308. status = f81232_set_register(port, RECEIVE_BUFFER_REGISTER,
  309. divisor & 0x00ff); /* low */
  310. if (status) {
  311. dev_err(&port->dev, "%s failed to set baudrate MSB: %d\n",
  312. __func__, status);
  313. goto reapply_lcr;
  314. }
  315. status = f81232_set_register(port, INTERRUPT_ENABLE_REGISTER,
  316. (divisor & 0xff00) >> 8); /* high */
  317. if (status) {
  318. dev_err(&port->dev, "%s failed to set baudrate LSB: %d\n",
  319. __func__, status);
  320. }
  321. reapply_lcr:
  322. status = f81232_set_register(port, LINE_CONTROL_REGISTER,
  323. lcr & ~UART_LCR_DLAB);
  324. if (status) {
  325. dev_err(&port->dev, "%s failed to set DLAB: %d\n",
  326. __func__, status);
  327. }
  328. }
  329. static int f81232_port_enable(struct usb_serial_port *port)
  330. {
  331. u8 val;
  332. int status;
  333. /* fifo on, trigger8, clear TX/RX*/
  334. val = UART_FCR_TRIGGER_8 | UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR |
  335. UART_FCR_CLEAR_XMIT;
  336. status = f81232_set_register(port, FIFO_CONTROL_REGISTER, val);
  337. if (status) {
  338. dev_err(&port->dev, "%s failed to set FCR: %d\n",
  339. __func__, status);
  340. return status;
  341. }
  342. /* MSR Interrupt only, LSR will read from Bulk-in odd byte */
  343. status = f81232_set_register(port, INTERRUPT_ENABLE_REGISTER,
  344. UART_IER_MSI);
  345. if (status) {
  346. dev_err(&port->dev, "%s failed to set IER: %d\n",
  347. __func__, status);
  348. return status;
  349. }
  350. return 0;
  351. }
  352. static int f81232_port_disable(struct usb_serial_port *port)
  353. {
  354. int status;
  355. status = f81232_set_register(port, INTERRUPT_ENABLE_REGISTER, 0);
  356. if (status) {
  357. dev_err(&port->dev, "%s failed to set IER: %d\n",
  358. __func__, status);
  359. return status;
  360. }
  361. return 0;
  362. }
  363. static void f81232_set_termios(struct tty_struct *tty,
  364. struct usb_serial_port *port, struct ktermios *old_termios)
  365. {
  366. u8 new_lcr = 0;
  367. int status = 0;
  368. speed_t baudrate;
  369. /* Don't change anything if nothing has changed */
  370. if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios))
  371. return;
  372. if (C_BAUD(tty) == B0)
  373. f81232_set_mctrl(port, 0, TIOCM_DTR | TIOCM_RTS);
  374. else if (old_termios && (old_termios->c_cflag & CBAUD) == B0)
  375. f81232_set_mctrl(port, TIOCM_DTR | TIOCM_RTS, 0);
  376. baudrate = tty_get_baud_rate(tty);
  377. if (baudrate > 0) {
  378. if (baudrate > F81232_MAX_BAUDRATE) {
  379. baudrate = F81232_MAX_BAUDRATE;
  380. tty_encode_baud_rate(tty, baudrate, baudrate);
  381. }
  382. f81232_set_baudrate(port, baudrate);
  383. }
  384. if (C_PARENB(tty)) {
  385. new_lcr |= UART_LCR_PARITY;
  386. if (!C_PARODD(tty))
  387. new_lcr |= UART_LCR_EPAR;
  388. if (C_CMSPAR(tty))
  389. new_lcr |= UART_LCR_SPAR;
  390. }
  391. if (C_CSTOPB(tty))
  392. new_lcr |= UART_LCR_STOP;
  393. switch (C_CSIZE(tty)) {
  394. case CS5:
  395. new_lcr |= UART_LCR_WLEN5;
  396. break;
  397. case CS6:
  398. new_lcr |= UART_LCR_WLEN6;
  399. break;
  400. case CS7:
  401. new_lcr |= UART_LCR_WLEN7;
  402. break;
  403. default:
  404. case CS8:
  405. new_lcr |= UART_LCR_WLEN8;
  406. break;
  407. }
  408. status = f81232_set_register(port, LINE_CONTROL_REGISTER, new_lcr);
  409. if (status) {
  410. dev_err(&port->dev, "%s failed to set LCR: %d\n",
  411. __func__, status);
  412. }
  413. }
  414. static int f81232_tiocmget(struct tty_struct *tty)
  415. {
  416. int r;
  417. struct usb_serial_port *port = tty->driver_data;
  418. struct f81232_private *port_priv = usb_get_serial_port_data(port);
  419. u8 mcr, msr;
  420. /* force get current MSR changed state */
  421. f81232_read_msr(port);
  422. mutex_lock(&port_priv->lock);
  423. mcr = port_priv->modem_control;
  424. msr = port_priv->modem_status;
  425. mutex_unlock(&port_priv->lock);
  426. r = (mcr & UART_MCR_DTR ? TIOCM_DTR : 0) |
  427. (mcr & UART_MCR_RTS ? TIOCM_RTS : 0) |
  428. (msr & UART_MSR_CTS ? TIOCM_CTS : 0) |
  429. (msr & UART_MSR_DCD ? TIOCM_CAR : 0) |
  430. (msr & UART_MSR_RI ? TIOCM_RI : 0) |
  431. (msr & UART_MSR_DSR ? TIOCM_DSR : 0);
  432. return r;
  433. }
  434. static int f81232_tiocmset(struct tty_struct *tty,
  435. unsigned int set, unsigned int clear)
  436. {
  437. struct usb_serial_port *port = tty->driver_data;
  438. return f81232_set_mctrl(port, set, clear);
  439. }
  440. static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port)
  441. {
  442. int result;
  443. result = f81232_port_enable(port);
  444. if (result)
  445. return result;
  446. /* Setup termios */
  447. if (tty)
  448. f81232_set_termios(tty, port, NULL);
  449. result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
  450. if (result) {
  451. dev_err(&port->dev, "%s - failed submitting interrupt urb,"
  452. " error %d\n", __func__, result);
  453. return result;
  454. }
  455. result = usb_serial_generic_open(tty, port);
  456. if (result) {
  457. usb_kill_urb(port->interrupt_in_urb);
  458. return result;
  459. }
  460. return 0;
  461. }
  462. static void f81232_close(struct usb_serial_port *port)
  463. {
  464. struct f81232_private *port_priv = usb_get_serial_port_data(port);
  465. f81232_port_disable(port);
  466. usb_serial_generic_close(port);
  467. usb_kill_urb(port->interrupt_in_urb);
  468. flush_work(&port_priv->interrupt_work);
  469. }
  470. static void f81232_dtr_rts(struct usb_serial_port *port, int on)
  471. {
  472. if (on)
  473. f81232_set_mctrl(port, TIOCM_DTR | TIOCM_RTS, 0);
  474. else
  475. f81232_set_mctrl(port, 0, TIOCM_DTR | TIOCM_RTS);
  476. }
  477. static int f81232_carrier_raised(struct usb_serial_port *port)
  478. {
  479. u8 msr;
  480. struct f81232_private *priv = usb_get_serial_port_data(port);
  481. mutex_lock(&priv->lock);
  482. msr = priv->modem_status;
  483. mutex_unlock(&priv->lock);
  484. if (msr & UART_MSR_DCD)
  485. return 1;
  486. return 0;
  487. }
  488. static int f81232_get_serial_info(struct usb_serial_port *port,
  489. unsigned long arg)
  490. {
  491. struct serial_struct ser;
  492. memset(&ser, 0, sizeof(ser));
  493. ser.type = PORT_16550A;
  494. ser.line = port->minor;
  495. ser.port = port->port_number;
  496. ser.baud_base = F81232_MAX_BAUDRATE;
  497. if (copy_to_user((void __user *)arg, &ser, sizeof(ser)))
  498. return -EFAULT;
  499. return 0;
  500. }
  501. static int f81232_ioctl(struct tty_struct *tty,
  502. unsigned int cmd, unsigned long arg)
  503. {
  504. struct usb_serial_port *port = tty->driver_data;
  505. switch (cmd) {
  506. case TIOCGSERIAL:
  507. return f81232_get_serial_info(port, arg);
  508. default:
  509. break;
  510. }
  511. return -ENOIOCTLCMD;
  512. }
  513. static void f81232_interrupt_work(struct work_struct *work)
  514. {
  515. struct f81232_private *priv =
  516. container_of(work, struct f81232_private, interrupt_work);
  517. f81232_read_msr(priv->port);
  518. }
  519. static int f81232_port_probe(struct usb_serial_port *port)
  520. {
  521. struct f81232_private *priv;
  522. priv = kzalloc(sizeof(*priv), GFP_KERNEL);
  523. if (!priv)
  524. return -ENOMEM;
  525. mutex_init(&priv->lock);
  526. INIT_WORK(&priv->interrupt_work, f81232_interrupt_work);
  527. usb_set_serial_port_data(port, priv);
  528. port->port.drain_delay = 256;
  529. priv->port = port;
  530. return 0;
  531. }
  532. static int f81232_port_remove(struct usb_serial_port *port)
  533. {
  534. struct f81232_private *priv;
  535. priv = usb_get_serial_port_data(port);
  536. kfree(priv);
  537. return 0;
  538. }
  539. static int f81232_suspend(struct usb_serial *serial, pm_message_t message)
  540. {
  541. struct usb_serial_port *port = serial->port[0];
  542. struct f81232_private *port_priv = usb_get_serial_port_data(port);
  543. int i;
  544. for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i)
  545. usb_kill_urb(port->read_urbs[i]);
  546. usb_kill_urb(port->interrupt_in_urb);
  547. if (port_priv)
  548. flush_work(&port_priv->interrupt_work);
  549. return 0;
  550. }
  551. static int f81232_resume(struct usb_serial *serial)
  552. {
  553. struct usb_serial_port *port = serial->port[0];
  554. int result;
  555. if (tty_port_initialized(&port->port)) {
  556. result = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO);
  557. if (result) {
  558. dev_err(&port->dev, "submit interrupt urb failed: %d\n",
  559. result);
  560. return result;
  561. }
  562. }
  563. return usb_serial_generic_resume(serial);
  564. }
  565. static struct usb_serial_driver f81232_device = {
  566. .driver = {
  567. .owner = THIS_MODULE,
  568. .name = "f81232",
  569. },
  570. .id_table = id_table,
  571. .num_ports = 1,
  572. .bulk_in_size = 256,
  573. .bulk_out_size = 256,
  574. .open = f81232_open,
  575. .close = f81232_close,
  576. .dtr_rts = f81232_dtr_rts,
  577. .carrier_raised = f81232_carrier_raised,
  578. .ioctl = f81232_ioctl,
  579. .break_ctl = f81232_break_ctl,
  580. .set_termios = f81232_set_termios,
  581. .tiocmget = f81232_tiocmget,
  582. .tiocmset = f81232_tiocmset,
  583. .tiocmiwait = usb_serial_generic_tiocmiwait,
  584. .process_read_urb = f81232_process_read_urb,
  585. .read_int_callback = f81232_read_int_callback,
  586. .port_probe = f81232_port_probe,
  587. .port_remove = f81232_port_remove,
  588. .suspend = f81232_suspend,
  589. .resume = f81232_resume,
  590. };
  591. static struct usb_serial_driver * const serial_drivers[] = {
  592. &f81232_device,
  593. NULL,
  594. };
  595. module_usb_serial_driver(serial_drivers, id_table);
  596. MODULE_DESCRIPTION("Fintek F81232 USB to serial adaptor driver");
  597. MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@linuxfoundation.org>");
  598. MODULE_AUTHOR("Peter Hong <peter_hong@fintek.com.tw>");
  599. MODULE_LICENSE("GPL v2");