]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/usb/serial/empeg.c
Merge branch 'for-3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
[mirror_ubuntu-artful-kernel.git] / drivers / usb / serial / empeg.c
CommitLineData
1da177e4
LT
1/*
2 * USB Empeg empeg-car player driver
3 *
4 * Copyright (C) 2000, 2001
5 * Gary Brubaker (xavyer@ix.netcom.com)
6 *
7 * Copyright (C) 1999 - 2001
8 * Greg Kroah-Hartman (greg@kroah.com)
9 *
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.
13 *
93c46795
AC
14 * See Documentation/usb/usb-serial.txt for more information on using this
15 * driver
1da177e4
LT
16 */
17
1da177e4
LT
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>
93c46795 27#include <linux/uaccess.h>
1da177e4 28#include <linux/usb.h>
a969888c 29#include <linux/usb/serial.h>
1da177e4 30
1da177e4
LT
31#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Gary Brubaker <xavyer@ix.netcom.com>"
32#define DRIVER_DESC "USB Empeg Mark I/II Driver"
33
34#define EMPEG_VENDOR_ID 0x084f
35#define EMPEG_PRODUCT_ID 0x0001
36
37/* function prototypes for an empeg-car player */
93c46795 38static int empeg_startup(struct usb_serial *serial);
fe1ae7fd 39static void empeg_init_termios(struct tty_struct *tty);
1da177e4 40
7d40d7e8 41static const struct usb_device_id id_table[] = {
1da177e4
LT
42 { USB_DEVICE(EMPEG_VENDOR_ID, EMPEG_PRODUCT_ID) },
43 { } /* Terminating entry */
44};
45
93c46795 46MODULE_DEVICE_TABLE(usb, id_table);
1da177e4 47
ea65370d 48static struct usb_serial_driver empeg_device = {
18fcac35
GKH
49 .driver = {
50 .owner = THIS_MODULE,
269bda1c 51 .name = "empeg",
18fcac35 52 },
1da177e4 53 .id_table = id_table,
1da177e4 54 .num_ports = 1,
695aaae6
JH
55 .bulk_out_size = 256,
56 .throttle = usb_serial_generic_throttle,
57 .unthrottle = usb_serial_generic_unthrottle,
1da177e4 58 .attach = empeg_startup,
fe1ae7fd 59 .init_termios = empeg_init_termios,
1da177e4
LT
60};
61
97b6b6d2
AS
62static struct usb_serial_driver * const serial_drivers[] = {
63 &empeg_device, NULL
64};
65
695aaae6 66static int empeg_startup(struct usb_serial *serial)
1da177e4
LT
67{
68 int r;
69
1da177e4 70 if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
194343d9 71 dev_err(&serial->dev->dev, "active config #%d != 1 ??\n",
1da177e4
LT
72 serial->dev->actconfig->desc.bConfigurationValue);
73 return -ENODEV;
74 }
4e512ab9 75
93c46795 76 r = usb_reset_configuration(serial->dev);
1da177e4
LT
77
78 /* continue on with initialization */
79 return r;
1da177e4
LT
80}
81
fe1ae7fd 82static void empeg_init_termios(struct tty_struct *tty)
1da177e4 83{
adc8d746 84 struct ktermios *termios = &tty->termios;
1da177e4 85
1da177e4 86 /*
93c46795
AC
87 * The empeg-car player wants these particular tty settings.
88 * You could, for example, change the baud rate, however the
89 * player only supports 115200 (currently), so there is really
90 * no point in support for changes to the tty settings.
91 * (at least for now)
92 *
93 * The default requirements for this device are:
94 */
998e8638 95 termios->c_iflag
1da177e4
LT
96 &= ~(IGNBRK /* disable ignore break */
97 | BRKINT /* disable break causes interrupt */
98 | PARMRK /* disable mark parity errors */
99 | ISTRIP /* disable clear high bit of input characters */
100 | INLCR /* disable translate NL to CR */
101 | IGNCR /* disable ignore CR */
102 | ICRNL /* disable translate CR to NL */
103 | IXON); /* disable enable XON/XOFF flow control */
104
998e8638 105 termios->c_oflag
1da177e4
LT
106 &= ~OPOST; /* disable postprocess output characters */
107
998e8638 108 termios->c_lflag
1da177e4
LT
109 &= ~(ECHO /* disable echo input characters */
110 | ECHONL /* disable echo new line */
111 | ICANON /* disable erase, kill, werase, and rprnt special characters */
112 | ISIG /* disable interrupt, quit, and suspend special characters */
113 | IEXTEN); /* disable non-POSIX special characters */
114
998e8638 115 termios->c_cflag
1da177e4
LT
116 &= ~(CSIZE /* no size */
117 | PARENB /* disable parity bit */
118 | CBAUD); /* clear current baud rate */
119
998e8638
AC
120 termios->c_cflag
121 |= CS8; /* character size 8 bits */
1da177e4 122
95da310e 123 tty_encode_baud_rate(tty, 115200, 115200);
1da177e4
LT
124}
125
68e24113 126module_usb_serial_driver(serial_drivers, id_table);
1da177e4 127
93c46795
AC
128MODULE_AUTHOR(DRIVER_AUTHOR);
129MODULE_DESCRIPTION(DRIVER_DESC);
1da177e4 130MODULE_LICENSE("GPL");