Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 Google, Inc. |
| 3 | * Copyright (C) 2012 Intel, Inc. |
| 4 | * |
| 5 | * This software is licensed under the terms of the GNU General Public |
| 6 | * License version 2, as published by the Free Software Foundation, and |
| 7 | * may be copied, distributed, and modified under those terms. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | */ |
| 15 | |
| 16 | #include <linux/console.h> |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 17 | #include <linux/interrupt.h> |
| 18 | #include <linux/platform_device.h> |
| 19 | #include <linux/tty.h> |
| 20 | #include <linux/tty_flip.h> |
| 21 | #include <linux/slab.h> |
| 22 | #include <linux/io.h> |
| 23 | #include <linux/module.h> |
Alan | e0f682e | 2014-05-12 16:57:05 +0100 | [diff] [blame] | 24 | #include <linux/goldfish.h> |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 25 | |
| 26 | enum { |
| 27 | GOLDFISH_TTY_PUT_CHAR = 0x00, |
| 28 | GOLDFISH_TTY_BYTES_READY = 0x04, |
| 29 | GOLDFISH_TTY_CMD = 0x08, |
| 30 | |
| 31 | GOLDFISH_TTY_DATA_PTR = 0x10, |
| 32 | GOLDFISH_TTY_DATA_LEN = 0x14, |
Jun Tian | b8658bc | 2014-05-12 16:55:26 +0100 | [diff] [blame] | 33 | GOLDFISH_TTY_DATA_PTR_HIGH = 0x18, |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 34 | |
| 35 | GOLDFISH_TTY_CMD_INT_DISABLE = 0, |
| 36 | GOLDFISH_TTY_CMD_INT_ENABLE = 1, |
| 37 | GOLDFISH_TTY_CMD_WRITE_BUFFER = 2, |
| 38 | GOLDFISH_TTY_CMD_READ_BUFFER = 3, |
| 39 | }; |
| 40 | |
| 41 | struct goldfish_tty { |
| 42 | struct tty_port port; |
| 43 | spinlock_t lock; |
| 44 | void __iomem *base; |
| 45 | u32 irq; |
| 46 | int opencount; |
| 47 | struct console console; |
| 48 | }; |
| 49 | |
| 50 | static DEFINE_MUTEX(goldfish_tty_lock); |
| 51 | static struct tty_driver *goldfish_tty_driver; |
| 52 | static u32 goldfish_tty_line_count = 8; |
| 53 | static u32 goldfish_tty_current_line_count; |
| 54 | static struct goldfish_tty *goldfish_ttys; |
| 55 | |
| 56 | static void goldfish_tty_do_write(int line, const char *buf, unsigned count) |
| 57 | { |
| 58 | unsigned long irq_flags; |
| 59 | struct goldfish_tty *qtty = &goldfish_ttys[line]; |
| 60 | void __iomem *base = qtty->base; |
| 61 | spin_lock_irqsave(&qtty->lock, irq_flags); |
Peter Senna Tschudin | 07d783f | 2015-05-19 11:44:46 +0200 | [diff] [blame] | 62 | gf_write_ptr(buf, base + GOLDFISH_TTY_DATA_PTR, |
Alan | e0f682e | 2014-05-12 16:57:05 +0100 | [diff] [blame] | 63 | base + GOLDFISH_TTY_DATA_PTR_HIGH); |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 64 | writel(count, base + GOLDFISH_TTY_DATA_LEN); |
| 65 | writel(GOLDFISH_TTY_CMD_WRITE_BUFFER, base + GOLDFISH_TTY_CMD); |
| 66 | spin_unlock_irqrestore(&qtty->lock, irq_flags); |
| 67 | } |
| 68 | |
| 69 | static irqreturn_t goldfish_tty_interrupt(int irq, void *dev_id) |
| 70 | { |
Greg Hackmann | 465893e | 2016-02-26 19:01:05 +0000 | [diff] [blame] | 71 | struct goldfish_tty *qtty = dev_id; |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 72 | void __iomem *base = qtty->base; |
| 73 | unsigned long irq_flags; |
| 74 | unsigned char *buf; |
| 75 | u32 count; |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 76 | |
| 77 | count = readl(base + GOLDFISH_TTY_BYTES_READY); |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 78 | if (count == 0) |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 79 | return IRQ_NONE; |
| 80 | |
Alan Cox | ebcf098 | 2013-01-25 15:05:30 +0000 | [diff] [blame] | 81 | count = tty_prepare_flip_string(&qtty->port, &buf, count); |
| 82 | spin_lock_irqsave(&qtty->lock, irq_flags); |
Peter Senna Tschudin | 07d783f | 2015-05-19 11:44:46 +0200 | [diff] [blame] | 83 | gf_write_ptr(buf, base + GOLDFISH_TTY_DATA_PTR, |
Alan | e0f682e | 2014-05-12 16:57:05 +0100 | [diff] [blame] | 84 | base + GOLDFISH_TTY_DATA_PTR_HIGH); |
Alan Cox | ebcf098 | 2013-01-25 15:05:30 +0000 | [diff] [blame] | 85 | writel(count, base + GOLDFISH_TTY_DATA_LEN); |
| 86 | writel(GOLDFISH_TTY_CMD_READ_BUFFER, base + GOLDFISH_TTY_CMD); |
| 87 | spin_unlock_irqrestore(&qtty->lock, irq_flags); |
| 88 | tty_schedule_flip(&qtty->port); |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 89 | return IRQ_HANDLED; |
| 90 | } |
| 91 | |
| 92 | static int goldfish_tty_activate(struct tty_port *port, struct tty_struct *tty) |
| 93 | { |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 94 | struct goldfish_tty *qtty = container_of(port, struct goldfish_tty, |
| 95 | port); |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 96 | writel(GOLDFISH_TTY_CMD_INT_ENABLE, qtty->base + GOLDFISH_TTY_CMD); |
| 97 | return 0; |
| 98 | } |
| 99 | |
| 100 | static void goldfish_tty_shutdown(struct tty_port *port) |
| 101 | { |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 102 | struct goldfish_tty *qtty = container_of(port, struct goldfish_tty, |
| 103 | port); |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 104 | writel(GOLDFISH_TTY_CMD_INT_DISABLE, qtty->base + GOLDFISH_TTY_CMD); |
| 105 | } |
| 106 | |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 107 | static int goldfish_tty_open(struct tty_struct *tty, struct file *filp) |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 108 | { |
| 109 | struct goldfish_tty *qtty = &goldfish_ttys[tty->index]; |
| 110 | return tty_port_open(&qtty->port, tty, filp); |
| 111 | } |
| 112 | |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 113 | static void goldfish_tty_close(struct tty_struct *tty, struct file *filp) |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 114 | { |
| 115 | tty_port_close(tty->port, tty, filp); |
| 116 | } |
| 117 | |
| 118 | static void goldfish_tty_hangup(struct tty_struct *tty) |
| 119 | { |
| 120 | tty_port_hangup(tty->port); |
| 121 | } |
| 122 | |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 123 | static int goldfish_tty_write(struct tty_struct *tty, const unsigned char *buf, |
| 124 | int count) |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 125 | { |
| 126 | goldfish_tty_do_write(tty->index, buf, count); |
| 127 | return count; |
| 128 | } |
| 129 | |
| 130 | static int goldfish_tty_write_room(struct tty_struct *tty) |
| 131 | { |
| 132 | return 0x10000; |
| 133 | } |
| 134 | |
| 135 | static int goldfish_tty_chars_in_buffer(struct tty_struct *tty) |
| 136 | { |
| 137 | struct goldfish_tty *qtty = &goldfish_ttys[tty->index]; |
| 138 | void __iomem *base = qtty->base; |
| 139 | return readl(base + GOLDFISH_TTY_BYTES_READY); |
| 140 | } |
| 141 | |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 142 | static void goldfish_tty_console_write(struct console *co, const char *b, |
| 143 | unsigned count) |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 144 | { |
| 145 | goldfish_tty_do_write(co->index, b, count); |
| 146 | } |
| 147 | |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 148 | static struct tty_driver *goldfish_tty_console_device(struct console *c, |
| 149 | int *index) |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 150 | { |
| 151 | *index = c->index; |
| 152 | return goldfish_tty_driver; |
| 153 | } |
| 154 | |
| 155 | static int goldfish_tty_console_setup(struct console *co, char *options) |
| 156 | { |
Dan Carpenter | fda2b41 | 2014-10-29 11:43:25 +0300 | [diff] [blame] | 157 | if ((unsigned)co->index >= goldfish_tty_line_count) |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 158 | return -ENODEV; |
Fabian Frederick | a4dc923 | 2014-09-28 20:10:17 +0200 | [diff] [blame] | 159 | if (!goldfish_ttys[co->index].base) |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 160 | return -ENODEV; |
| 161 | return 0; |
| 162 | } |
| 163 | |
Aya Mahfouz | 04b757d | 2015-12-15 01:53:36 +0200 | [diff] [blame] | 164 | static const struct tty_port_operations goldfish_port_ops = { |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 165 | .activate = goldfish_tty_activate, |
| 166 | .shutdown = goldfish_tty_shutdown |
| 167 | }; |
| 168 | |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 169 | static const struct tty_operations goldfish_tty_ops = { |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 170 | .open = goldfish_tty_open, |
| 171 | .close = goldfish_tty_close, |
| 172 | .hangup = goldfish_tty_hangup, |
| 173 | .write = goldfish_tty_write, |
| 174 | .write_room = goldfish_tty_write_room, |
| 175 | .chars_in_buffer = goldfish_tty_chars_in_buffer, |
| 176 | }; |
| 177 | |
| 178 | static int goldfish_tty_create_driver(void) |
| 179 | { |
| 180 | int ret; |
| 181 | struct tty_driver *tty; |
| 182 | |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 183 | goldfish_ttys = kzalloc(sizeof(*goldfish_ttys) * |
| 184 | goldfish_tty_line_count, GFP_KERNEL); |
| 185 | if (goldfish_ttys == NULL) { |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 186 | ret = -ENOMEM; |
| 187 | goto err_alloc_goldfish_ttys_failed; |
| 188 | } |
| 189 | tty = alloc_tty_driver(goldfish_tty_line_count); |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 190 | if (tty == NULL) { |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 191 | ret = -ENOMEM; |
| 192 | goto err_alloc_tty_driver_failed; |
| 193 | } |
| 194 | tty->driver_name = "goldfish"; |
| 195 | tty->name = "ttyGF"; |
| 196 | tty->type = TTY_DRIVER_TYPE_SERIAL; |
| 197 | tty->subtype = SERIAL_TYPE_NORMAL; |
| 198 | tty->init_termios = tty_std_termios; |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 199 | tty->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | |
| 200 | TTY_DRIVER_DYNAMIC_DEV; |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 201 | tty_set_operations(tty, &goldfish_tty_ops); |
| 202 | ret = tty_register_driver(tty); |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 203 | if (ret) |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 204 | goto err_tty_register_driver_failed; |
| 205 | |
| 206 | goldfish_tty_driver = tty; |
| 207 | return 0; |
| 208 | |
| 209 | err_tty_register_driver_failed: |
| 210 | put_tty_driver(tty); |
| 211 | err_alloc_tty_driver_failed: |
| 212 | kfree(goldfish_ttys); |
| 213 | goldfish_ttys = NULL; |
| 214 | err_alloc_goldfish_ttys_failed: |
| 215 | return ret; |
| 216 | } |
| 217 | |
| 218 | static void goldfish_tty_delete_driver(void) |
| 219 | { |
| 220 | tty_unregister_driver(goldfish_tty_driver); |
| 221 | put_tty_driver(goldfish_tty_driver); |
| 222 | goldfish_tty_driver = NULL; |
| 223 | kfree(goldfish_ttys); |
| 224 | goldfish_ttys = NULL; |
| 225 | } |
| 226 | |
| 227 | static int goldfish_tty_probe(struct platform_device *pdev) |
| 228 | { |
| 229 | struct goldfish_tty *qtty; |
| 230 | int ret = -EINVAL; |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 231 | struct resource *r; |
| 232 | struct device *ttydev; |
| 233 | void __iomem *base; |
| 234 | u32 irq; |
Greg Hackmann | 465893e | 2016-02-26 19:01:05 +0000 | [diff] [blame] | 235 | unsigned int line; |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 236 | |
| 237 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 238 | if (r == NULL) |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 239 | return -EINVAL; |
| 240 | |
| 241 | base = ioremap(r->start, 0x1000); |
| 242 | if (base == NULL) |
| 243 | pr_err("goldfish_tty: unable to remap base\n"); |
| 244 | |
| 245 | r = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 246 | if (r == NULL) |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 247 | goto err_unmap; |
| 248 | |
| 249 | irq = r->start; |
| 250 | |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 251 | mutex_lock(&goldfish_tty_lock); |
Greg Hackmann | 465893e | 2016-02-26 19:01:05 +0000 | [diff] [blame] | 252 | |
| 253 | if (pdev->id == PLATFORM_DEVID_NONE) |
| 254 | line = goldfish_tty_current_line_count; |
| 255 | else |
| 256 | line = pdev->id; |
| 257 | |
| 258 | if (line >= goldfish_tty_line_count) |
| 259 | goto err_create_driver_failed; |
| 260 | |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 261 | if (goldfish_tty_current_line_count == 0) { |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 262 | ret = goldfish_tty_create_driver(); |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 263 | if (ret) |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 264 | goto err_create_driver_failed; |
| 265 | } |
| 266 | goldfish_tty_current_line_count++; |
| 267 | |
Greg Hackmann | 465893e | 2016-02-26 19:01:05 +0000 | [diff] [blame] | 268 | qtty = &goldfish_ttys[line]; |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 269 | spin_lock_init(&qtty->lock); |
| 270 | tty_port_init(&qtty->port); |
| 271 | qtty->port.ops = &goldfish_port_ops; |
| 272 | qtty->base = base; |
| 273 | qtty->irq = irq; |
| 274 | |
| 275 | writel(GOLDFISH_TTY_CMD_INT_DISABLE, base + GOLDFISH_TTY_CMD); |
| 276 | |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 277 | ret = request_irq(irq, goldfish_tty_interrupt, IRQF_SHARED, |
Greg Hackmann | 465893e | 2016-02-26 19:01:05 +0000 | [diff] [blame] | 278 | "goldfish_tty", qtty); |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 279 | if (ret) |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 280 | goto err_request_irq_failed; |
| 281 | |
| 282 | |
| 283 | ttydev = tty_port_register_device(&qtty->port, goldfish_tty_driver, |
Greg Hackmann | 465893e | 2016-02-26 19:01:05 +0000 | [diff] [blame] | 284 | line, &pdev->dev); |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 285 | if (IS_ERR(ttydev)) { |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 286 | ret = PTR_ERR(ttydev); |
| 287 | goto err_tty_register_device_failed; |
| 288 | } |
| 289 | |
| 290 | strcpy(qtty->console.name, "ttyGF"); |
| 291 | qtty->console.write = goldfish_tty_console_write; |
| 292 | qtty->console.device = goldfish_tty_console_device; |
| 293 | qtty->console.setup = goldfish_tty_console_setup; |
| 294 | qtty->console.flags = CON_PRINTBUFFER; |
Greg Hackmann | 465893e | 2016-02-26 19:01:05 +0000 | [diff] [blame] | 295 | qtty->console.index = line; |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 296 | register_console(&qtty->console); |
Greg Hackmann | 465893e | 2016-02-26 19:01:05 +0000 | [diff] [blame] | 297 | platform_set_drvdata(pdev, qtty); |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 298 | |
| 299 | mutex_unlock(&goldfish_tty_lock); |
| 300 | return 0; |
| 301 | |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 302 | err_tty_register_device_failed: |
Christophe JAILLET | 1a5c2d1 | 2017-01-09 01:26:37 +0100 | [diff] [blame] | 303 | free_irq(irq, qtty); |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 304 | err_request_irq_failed: |
| 305 | goldfish_tty_current_line_count--; |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 306 | if (goldfish_tty_current_line_count == 0) |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 307 | goldfish_tty_delete_driver(); |
| 308 | err_create_driver_failed: |
| 309 | mutex_unlock(&goldfish_tty_lock); |
| 310 | err_unmap: |
| 311 | iounmap(base); |
| 312 | return ret; |
| 313 | } |
| 314 | |
| 315 | static int goldfish_tty_remove(struct platform_device *pdev) |
| 316 | { |
Greg Hackmann | 465893e | 2016-02-26 19:01:05 +0000 | [diff] [blame] | 317 | struct goldfish_tty *qtty = platform_get_drvdata(pdev); |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 318 | |
| 319 | mutex_lock(&goldfish_tty_lock); |
| 320 | |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 321 | unregister_console(&qtty->console); |
Greg Hackmann | 465893e | 2016-02-26 19:01:05 +0000 | [diff] [blame] | 322 | tty_unregister_device(goldfish_tty_driver, qtty->console.index); |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 323 | iounmap(qtty->base); |
Fabian Frederick | a4dc923 | 2014-09-28 20:10:17 +0200 | [diff] [blame] | 324 | qtty->base = NULL; |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 325 | free_irq(qtty->irq, pdev); |
| 326 | goldfish_tty_current_line_count--; |
Alan | d78055d | 2014-05-12 16:57:14 +0100 | [diff] [blame] | 327 | if (goldfish_tty_current_line_count == 0) |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 328 | goldfish_tty_delete_driver(); |
| 329 | mutex_unlock(&goldfish_tty_lock); |
| 330 | return 0; |
| 331 | } |
| 332 | |
Miodrag Dinic | 9b883ee | 2016-02-26 19:00:44 +0000 | [diff] [blame] | 333 | static const struct of_device_id goldfish_tty_of_match[] = { |
| 334 | { .compatible = "google,goldfish-tty", }, |
| 335 | {}, |
| 336 | }; |
| 337 | |
| 338 | MODULE_DEVICE_TABLE(of, goldfish_tty_of_match); |
| 339 | |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 340 | static struct platform_driver goldfish_tty_platform_driver = { |
| 341 | .probe = goldfish_tty_probe, |
| 342 | .remove = goldfish_tty_remove, |
| 343 | .driver = { |
Miodrag Dinic | 9b883ee | 2016-02-26 19:00:44 +0000 | [diff] [blame] | 344 | .name = "goldfish_tty", |
| 345 | .of_match_table = goldfish_tty_of_match, |
Arve Hjønnevåg | 666b779 | 2013-01-21 23:38:47 +0000 | [diff] [blame] | 346 | } |
| 347 | }; |
| 348 | |
| 349 | module_platform_driver(goldfish_tty_platform_driver); |
| 350 | |
| 351 | MODULE_LICENSE("GPL v2"); |