17 #include <linux/module.h>
20 #include <linux/device.h>
21 #include <linux/wait.h>
23 #include <linux/tty.h>
29 #define MAX_SMD_TTYS 32
44 { .id = 0, .name =
"SMD_DS" },
45 { .id = 27, .name =
"SMD_GPSNMEA" },
49 smd_default_tty_channels;
50 static int smd_tty_channels_len =
ARRAY_SIZE(smd_default_tty_channels);
52 static void smd_tty_notify(
void *
priv,
unsigned event)
80 pr_err(
"OOPS - smd_tty_buffer mismatch?!");
98 for (i = 0; i < smd_tty_channels_len; i++) {
99 if (smd_tty_channels[i].
id == n) {
100 name = smd_tty_channels[
i].
name;
110 res =
smd_open(name, &info->
ch, info, smd_tty_notify);
118 static void smd_tty_port_shutdown(
struct tty_port *tport)
147 static int smd_tty_write(
struct tty_struct *tty,
148 const unsigned char *
buf,
int len)
164 static int smd_tty_write_room(
struct tty_struct *tty)
170 static int smd_tty_chars_in_buffer(
struct tty_struct *tty)
176 static void smd_tty_unthrottle(
struct tty_struct *tty)
183 .shutdown = smd_tty_port_shutdown,
184 .activate = smd_tty_port_activate,
188 .open = smd_tty_open,
189 .close = smd_tty_close,
190 .write = smd_tty_write,
191 .write_room = smd_tty_write_room,
192 .chars_in_buffer = smd_tty_chars_in_buffer,
193 .unthrottle = smd_tty_unthrottle,
198 static int __init smd_tty_init(
void)
203 if (smd_tty_driver == 0)
207 smd_tty_driver->
name =
"smd";
208 smd_tty_driver->
major = 0;
225 for (i = 0; i < smd_tty_channels_len; i++) {
228 port->
ops = &smd_tty_port_ops;
230 smd_tty_channels[i].
id,
NULL);