Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 133559
b: refs/heads/master
c: d2ad67b
h: refs/heads/master
i:
  133557: 4547ca0
  133555: 76942e6
  133551: 66c6c1a
v: v3
  • Loading branch information
VomLehn authored and Greg Kroah-Hartman committed Mar 24, 2009
1 parent 0199174 commit 7d37a94
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d23bac9f8b3cf1ad674d6390364d559103013213
refs/heads/master: d2ad67b3fa61eed52b22491210c668a94c7bf17e
53 changes: 43 additions & 10 deletions trunk/drivers/usb/serial/cp210x.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,21 @@ static int cp2101_open(struct tty_struct *, struct usb_serial_port *,
static void cp2101_cleanup(struct usb_serial_port *);
static void cp2101_close(struct tty_struct *, struct usb_serial_port *,
struct file*);
static void cp2101_get_termios(struct tty_struct *);
static void cp2101_get_termios(struct tty_struct *,
struct usb_serial_port *port);
static void cp2101_get_termios_port(struct usb_serial_port *port,
unsigned int *cflagp, unsigned int *baudp);
static void cp2101_set_termios(struct tty_struct *, struct usb_serial_port *,
struct ktermios*);
static int cp2101_tiocmget(struct tty_struct *, struct file *);
static int cp2101_tiocmset(struct tty_struct *, struct file *,
unsigned int, unsigned int);
static int cp2101_tiocmset_port(struct usb_serial_port *port, struct file *,
unsigned int, unsigned int);
static void cp2101_break_ctl(struct tty_struct *, int);
static int cp2101_startup(struct usb_serial *);
static void cp2101_shutdown(struct usb_serial *);


static int debug;

static struct usb_device_id id_table [] = {
Expand Down Expand Up @@ -369,10 +373,12 @@ static int cp2101_open(struct tty_struct *tty, struct usb_serial_port *port,
}

/* Configure the termios structure */
cp2101_get_termios(tty);
cp2101_get_termios(tty, port);

/* Set the DTR and RTS pins low */
cp2101_tiocmset(tty, NULL, TIOCM_DTR | TIOCM_RTS, 0);
cp2101_tiocmset_port(tty ? (struct usb_serial_port *) tty->driver_data
: port,
NULL, TIOCM_DTR | TIOCM_RTS, 0);

return 0;
}
Expand Down Expand Up @@ -414,9 +420,31 @@ static void cp2101_close(struct tty_struct *tty, struct usb_serial_port *port,
* from the device, corrects any unsupported values, and configures the
* termios structure to reflect the state of the device
*/
static void cp2101_get_termios (struct tty_struct *tty)
static void cp2101_get_termios(struct tty_struct *tty,
struct usb_serial_port *port)
{
unsigned int baud;

if (tty) {
cp2101_get_termios_port(tty->driver_data,
&tty->termios->c_cflag, &baud);
tty_encode_baud_rate(tty, baud, baud);
}

else {
unsigned int cflag;
cflag = 0;
cp2101_get_termios_port(port, &cflag, &baud);
}
}

/*
* cp2101_get_termios_port
* This is the heart of cp2101_get_termios which always uses a &usb_serial_port.
*/
static void cp2101_get_termios_port(struct usb_serial_port *port,
unsigned int *cflagp, unsigned int *baudp)
{
struct usb_serial_port *port = tty->driver_data;
unsigned int cflag, modem_ctl[4];
unsigned int baud;
unsigned int bits;
Expand All @@ -429,9 +457,9 @@ static void cp2101_get_termios (struct tty_struct *tty)
baud = cp2101_quantise_baudrate((BAUD_RATE_GEN_FREQ + baud/2)/ baud);

dbg("%s - baud rate = %d", __func__, baud);
*baudp = baud;

tty_encode_baud_rate(tty, baud, baud);
cflag = tty->termios->c_cflag;
cflag = *cflagp;

cp2101_get_config(port, CP2101_BITS, &bits, 2);
cflag &= ~CSIZE;
Expand Down Expand Up @@ -537,7 +565,7 @@ static void cp2101_get_termios (struct tty_struct *tty)
cflag &= ~CRTSCTS;
}

tty->termios->c_cflag = cflag;
*cflagp = cflag;
}

static void cp2101_set_termios(struct tty_struct *tty,
Expand Down Expand Up @@ -669,6 +697,12 @@ static int cp2101_tiocmset (struct tty_struct *tty, struct file *file,
unsigned int set, unsigned int clear)
{
struct usb_serial_port *port = tty->driver_data;
return cp2101_tiocmset_port(port, file, set, clear);
}

static int cp2101_tiocmset_port(struct usb_serial_port *port, struct file *file,
unsigned int set, unsigned int clear)
{
unsigned int control = 0;

dbg("%s - port %d", __func__, port->number);
Expand All @@ -693,7 +727,6 @@ static int cp2101_tiocmset (struct tty_struct *tty, struct file *file,
dbg("%s - control = 0x%.4x", __func__, control);

return cp2101_set_config(port, CP2101_CONTROL, &control, 2);

}

static int cp2101_tiocmget (struct tty_struct *tty, struct file *file)
Expand Down

0 comments on commit 7d37a94

Please sign in to comment.