Adding support for MOXA ART SoC. Testing port of linux-2.6.32.60-moxart.
[linux-3.6.7-moxart.git] / drivers / usb / serial / empeg.c
blobcdf61dd0731837fb0acf62fc6cd44f0a199ef38f
1 /*
2 * USB Empeg empeg-car player driver
4 * Copyright (C) 2000, 2001
5 * Gary Brubaker (xavyer@ix.netcom.com)
7 * Copyright (C) 1999 - 2001
8 * Greg Kroah-Hartman (greg@kroah.com)
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License, as published by
12 * the Free Software Foundation, version 2.
14 * See Documentation/usb/usb-serial.txt for more information on using this
15 * driver
18 #include <linux/kernel.h>
19 #include <linux/errno.h>
20 #include <linux/init.h>
21 #include <linux/slab.h>
22 #include <linux/tty.h>
23 #include <linux/tty_driver.h>
24 #include <linux/tty_flip.h>
25 #include <linux/module.h>
26 #include <linux/spinlock.h>
27 #include <linux/uaccess.h>
28 #include <linux/usb.h>
29 #include <linux/usb/serial.h>
31 static bool debug;
34 * Version Information
36 #define DRIVER_VERSION "v1.3"
37 #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Gary Brubaker <xavyer@ix.netcom.com>"
38 #define DRIVER_DESC "USB Empeg Mark I/II Driver"
40 #define EMPEG_VENDOR_ID 0x084f
41 #define EMPEG_PRODUCT_ID 0x0001
43 /* function prototypes for an empeg-car player */
44 static int empeg_startup(struct usb_serial *serial);
45 static void empeg_init_termios(struct tty_struct *tty);
47 static const struct usb_device_id id_table[] = {
48 { USB_DEVICE(EMPEG_VENDOR_ID, EMPEG_PRODUCT_ID) },
49 { } /* Terminating entry */
52 MODULE_DEVICE_TABLE(usb, id_table);
54 static struct usb_serial_driver empeg_device = {
55 .driver = {
56 .owner = THIS_MODULE,
57 .name = "empeg",
59 .id_table = id_table,
60 .num_ports = 1,
61 .bulk_out_size = 256,
62 .throttle = usb_serial_generic_throttle,
63 .unthrottle = usb_serial_generic_unthrottle,
64 .attach = empeg_startup,
65 .init_termios = empeg_init_termios,
68 static struct usb_serial_driver * const serial_drivers[] = {
69 &empeg_device, NULL
72 static int empeg_startup(struct usb_serial *serial)
74 int r;
76 if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
77 dev_err(&serial->dev->dev, "active config #%d != 1 ??\n",
78 serial->dev->actconfig->desc.bConfigurationValue);
79 return -ENODEV;
82 r = usb_reset_configuration(serial->dev);
84 /* continue on with initialization */
85 return r;
88 static void empeg_init_termios(struct tty_struct *tty)
90 struct ktermios *termios = tty->termios;
93 * The empeg-car player wants these particular tty settings.
94 * You could, for example, change the baud rate, however the
95 * player only supports 115200 (currently), so there is really
96 * no point in support for changes to the tty settings.
97 * (at least for now)
99 * The default requirements for this device are:
101 termios->c_iflag
102 &= ~(IGNBRK /* disable ignore break */
103 | BRKINT /* disable break causes interrupt */
104 | PARMRK /* disable mark parity errors */
105 | ISTRIP /* disable clear high bit of input characters */
106 | INLCR /* disable translate NL to CR */
107 | IGNCR /* disable ignore CR */
108 | ICRNL /* disable translate CR to NL */
109 | IXON); /* disable enable XON/XOFF flow control */
111 termios->c_oflag
112 &= ~OPOST; /* disable postprocess output characters */
114 termios->c_lflag
115 &= ~(ECHO /* disable echo input characters */
116 | ECHONL /* disable echo new line */
117 | ICANON /* disable erase, kill, werase, and rprnt special characters */
118 | ISIG /* disable interrupt, quit, and suspend special characters */
119 | IEXTEN); /* disable non-POSIX special characters */
121 termios->c_cflag
122 &= ~(CSIZE /* no size */
123 | PARENB /* disable parity bit */
124 | CBAUD); /* clear current baud rate */
126 termios->c_cflag
127 |= CS8; /* character size 8 bits */
129 tty_encode_baud_rate(tty, 115200, 115200);
132 module_usb_serial_driver(serial_drivers, id_table);
134 MODULE_AUTHOR(DRIVER_AUTHOR);
135 MODULE_DESCRIPTION(DRIVER_DESC);
136 MODULE_LICENSE("GPL");
138 module_param(debug, bool, S_IRUGO | S_IWUSR);
139 MODULE_PARM_DESC(debug, "Debug enabled or not");