blob: c8248a7fd6021cb2aca9d577383c64f8eda3cf92 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* arch/arm/mach-msm/smd_tty.c
2 *
3 * Copyright (C) 2007 Google, Inc.
4 * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
5 * Author: Brian Swetland <swetland@google.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#include <linux/module.h>
19#include <linux/fs.h>
20#include <linux/cdev.h>
21#include <linux/device.h>
22#include <linux/interrupt.h>
23#include <linux/delay.h>
24#include <linux/wakelock.h>
25#include <linux/platform_device.h>
26#include <linux/sched.h>
27
28#include <linux/tty.h>
29#include <linux/tty_driver.h>
30#include <linux/tty_flip.h>
31
32#include <mach/msm_smd.h>
33#include <mach/peripheral-loader.h>
Jeff Hugo4c0ba6c2011-07-15 11:47:13 -060034#include <mach/socinfo.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070035
36#include "smd_private.h"
37
38#define MAX_SMD_TTYS 37
39#define MAX_TTY_BUF_SIZE 2048
40
41static DEFINE_MUTEX(smd_tty_lock);
42
43static uint smd_tty_modem_wait;
44module_param_named(modem_wait, smd_tty_modem_wait,
45 uint, S_IRUGO | S_IWUSR | S_IWGRP);
46
47struct smd_tty_info {
48 smd_channel_t *ch;
49 struct tty_struct *tty;
50 struct wake_lock wake_lock;
51 int open_count;
52 struct tasklet_struct tty_tsklt;
53 struct timer_list buf_req_timer;
54 struct completion ch_allocated;
55 struct platform_driver driver;
56 void *pil;
57 int in_reset;
58 int in_reset_updated;
Karthikeyan Ramasubramaniand5e63af2011-07-29 11:30:59 -060059 int is_open;
60 wait_queue_head_t ch_opened_wait_queue;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070061 spinlock_t reset_lock;
Eric Holmberg513ad582011-12-14 16:27:13 -070062 struct smd_config *smd;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063};
64
Eric Holmberg513ad582011-12-14 16:27:13 -070065/**
66 * SMD port configuration.
67 *
68 * @tty_dev_index Index into smd_tty[]
69 * @port_name Name of the SMD port
70 * @dev_name Name of the TTY Device (if NULL, @port_name is used)
71 * @edge SMD edge
72 */
73struct smd_config {
74 uint32_t tty_dev_index;
75 const char *port_name;
76 const char *dev_name;
77 uint32_t edge;
78};
79
80static struct smd_config smd_configs[] = {
81 {0, "DS", NULL, SMD_APPS_MODEM},
82 {1, "APPS_FM", NULL, SMD_APPS_WCNSS},
83 {2, "APPS_RIVA_BT_ACL", NULL, SMD_APPS_WCNSS},
84 {3, "APPS_RIVA_BT_CMD", NULL, SMD_APPS_WCNSS},
85 {4, "MBALBRIDGE", NULL, SMD_APPS_MODEM},
86 {7, "DATA1", NULL, SMD_APPS_MODEM},
Eric Holmbergbe1dc5f2011-12-14 21:35:12 -070087 {11, "DATA11", NULL, SMD_APPS_MODEM},
Eric Holmberg513ad582011-12-14 16:27:13 -070088 {21, "DATA21", NULL, SMD_APPS_MODEM},
89 {27, "GPSNMEA", NULL, SMD_APPS_MODEM},
90 {36, "LOOPBACK", "LOOPBACK_TTY", SMD_APPS_MODEM},
91};
92#define DS_IDX 0
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093#define LOOPBACK_IDX 36
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070094
95static struct delayed_work loopback_work;
96static struct smd_tty_info smd_tty[MAX_SMD_TTYS];
97
98static int is_in_reset(struct smd_tty_info *info)
99{
100 return info->in_reset;
101}
102
103static void buf_req_retry(unsigned long param)
104{
105 struct smd_tty_info *info = (struct smd_tty_info *)param;
Karthikeyan Ramasubramanianf8ad4132011-11-22 09:11:18 -0700106 unsigned long flags;
107
108 spin_lock_irqsave(&info->reset_lock, flags);
109 if (info->is_open) {
110 spin_unlock_irqrestore(&info->reset_lock, flags);
111 tasklet_hi_schedule(&info->tty_tsklt);
112 return;
113 }
114 spin_unlock_irqrestore(&info->reset_lock, flags);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700115}
116
117static void smd_tty_read(unsigned long param)
118{
119 unsigned char *ptr;
120 int avail;
121 struct smd_tty_info *info = (struct smd_tty_info *)param;
122 struct tty_struct *tty = info->tty;
123
124 if (!tty)
125 return;
126
127 for (;;) {
128 if (is_in_reset(info)) {
129 /* signal TTY clients using TTY_BREAK */
130 tty_insert_flip_char(tty, 0x00, TTY_BREAK);
131 tty_flip_buffer_push(tty);
132 break;
133 }
134
135 if (test_bit(TTY_THROTTLED, &tty->flags)) break;
136 avail = smd_read_avail(info->ch);
137 if (avail == 0)
138 break;
139
140 if (avail > MAX_TTY_BUF_SIZE)
141 avail = MAX_TTY_BUF_SIZE;
142
143 avail = tty_prepare_flip_string(tty, &ptr, avail);
144 if (avail <= 0) {
145 if (!timer_pending(&info->buf_req_timer)) {
146 init_timer(&info->buf_req_timer);
147 info->buf_req_timer.expires = jiffies +
148 ((30 * HZ)/1000);
149 info->buf_req_timer.function = buf_req_retry;
150 info->buf_req_timer.data = param;
151 add_timer(&info->buf_req_timer);
152 }
153 return;
154 }
155
156 if (smd_read(info->ch, ptr, avail) != avail) {
157 /* shouldn't be possible since we're in interrupt
158 ** context here and nobody else could 'steal' our
159 ** characters.
160 */
161 printk(KERN_ERR "OOPS - smd_tty_buffer mismatch?!");
162 }
163
164 wake_lock_timeout(&info->wake_lock, HZ / 2);
165 tty_flip_buffer_push(tty);
166 }
167
168 /* XXX only when writable and necessary */
169 tty_wakeup(tty);
170}
171
172static void smd_tty_notify(void *priv, unsigned event)
173{
174 struct smd_tty_info *info = priv;
175 unsigned long flags;
176
177 switch (event) {
178 case SMD_EVENT_DATA:
Karthikeyan Ramasubramanianf8ad4132011-11-22 09:11:18 -0700179 spin_lock_irqsave(&info->reset_lock, flags);
180 if (!info->is_open) {
181 spin_unlock_irqrestore(&info->reset_lock, flags);
182 break;
183 }
184 spin_unlock_irqrestore(&info->reset_lock, flags);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700185 /* There may be clients (tty framework) that are blocked
186 * waiting for space to write data, so if a possible read
187 * interrupt came in wake anyone waiting and disable the
188 * interrupts
189 */
190 if (smd_write_avail(info->ch)) {
191 smd_disable_read_intr(info->ch);
192 if (info->tty)
193 wake_up_interruptible(&info->tty->write_wait);
194 }
195 tasklet_hi_schedule(&info->tty_tsklt);
196 break;
197
198 case SMD_EVENT_OPEN:
199 spin_lock_irqsave(&info->reset_lock, flags);
200 info->in_reset = 0;
201 info->in_reset_updated = 1;
Karthikeyan Ramasubramaniand5e63af2011-07-29 11:30:59 -0600202 info->is_open = 1;
203 wake_up_interruptible(&info->ch_opened_wait_queue);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700204 spin_unlock_irqrestore(&info->reset_lock, flags);
205 break;
206
207 case SMD_EVENT_CLOSE:
208 spin_lock_irqsave(&info->reset_lock, flags);
209 info->in_reset = 1;
210 info->in_reset_updated = 1;
Karthikeyan Ramasubramaniand5e63af2011-07-29 11:30:59 -0600211 info->is_open = 0;
212 wake_up_interruptible(&info->ch_opened_wait_queue);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700213 spin_unlock_irqrestore(&info->reset_lock, flags);
214 /* schedule task to send TTY_BREAK */
215 tasklet_hi_schedule(&info->tty_tsklt);
216
217 if (info->tty->index == LOOPBACK_IDX)
218 schedule_delayed_work(&loopback_work,
219 msecs_to_jiffies(1000));
220 break;
221 }
222}
223
224static uint32_t is_modem_smsm_inited(void)
225{
226 uint32_t modem_state;
227 uint32_t ready_state = (SMSM_INIT | SMSM_SMDINIT);
228
229 modem_state = smsm_get_state(SMSM_MODEM_STATE);
230 return (modem_state & ready_state) == ready_state;
231}
232
233static int smd_tty_open(struct tty_struct *tty, struct file *f)
234{
235 int res = 0;
Eric Holmberg513ad582011-12-14 16:27:13 -0700236 unsigned int n = tty->index;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700237 struct smd_tty_info *info;
238 char *peripheral = NULL;
239
240
Eric Holmberg513ad582011-12-14 16:27:13 -0700241 if (n >= MAX_SMD_TTYS || !smd_tty[n].smd)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700242 return -ENODEV;
243
244 info = smd_tty + n;
245
246 mutex_lock(&smd_tty_lock);
247 tty->driver_data = info;
248
249 if (info->open_count++ == 0) {
Eric Holmberg513ad582011-12-14 16:27:13 -0700250 if (smd_tty[n].smd->edge == SMD_APPS_MODEM)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700251 peripheral = "modem";
252
253 if (peripheral) {
Eric Holmberg513ad582011-12-14 16:27:13 -0700254 info->pil = pil_get(peripheral);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700255 if (IS_ERR(info->pil)) {
256 res = PTR_ERR(info->pil);
257 goto out;
258 }
259
260 /* Wait for the modem SMSM to be inited for the SMD
261 * Loopback channel to be allocated at the modem. Since
262 * the wait need to be done atmost once, using msleep
263 * doesn't degrade the performance.
264 */
Eric Holmberg513ad582011-12-14 16:27:13 -0700265 if (n == LOOPBACK_IDX) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700266 if (!is_modem_smsm_inited())
267 msleep(5000);
268 smsm_change_state(SMSM_APPS_STATE,
269 0, SMSM_SMD_LOOPBACK);
270 msleep(100);
271 }
272
273
274 /*
275 * Wait for a channel to be allocated so we know
276 * the modem is ready enough.
277 */
278 if (smd_tty_modem_wait) {
279 res = wait_for_completion_interruptible_timeout(
280 &info->ch_allocated,
281 msecs_to_jiffies(smd_tty_modem_wait *
282 1000));
283
284 if (res == 0) {
285 pr_err("Timed out waiting for SMD"
286 " channel\n");
287 res = -ETIMEDOUT;
288 goto release_pil;
289 } else if (res < 0) {
290 pr_err("Error waiting for SMD channel:"
291 " %d\n",
292 res);
293 goto release_pil;
294 }
295
296 res = 0;
297 }
298 }
299
300
301 info->tty = tty;
302 tasklet_init(&info->tty_tsklt, smd_tty_read,
303 (unsigned long)info);
304 wake_lock_init(&info->wake_lock, WAKE_LOCK_SUSPEND,
Eric Holmberg513ad582011-12-14 16:27:13 -0700305 smd_tty[n].smd->port_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700306 if (!info->ch) {
Eric Holmberg513ad582011-12-14 16:27:13 -0700307 res = smd_named_open_on_edge(smd_tty[n].smd->port_name,
308 smd_tty[n].smd->edge,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700309 &info->ch, info,
310 smd_tty_notify);
Karthikeyan Ramasubramaniand5e63af2011-07-29 11:30:59 -0600311 if (res < 0) {
312 pr_err("%s: %s open failed %d\n", __func__,
Eric Holmberg513ad582011-12-14 16:27:13 -0700313 smd_tty[n].smd->port_name, res);
Karthikeyan Ramasubramaniand5e63af2011-07-29 11:30:59 -0600314 goto release_pil;
315 }
316
317 res = wait_event_interruptible_timeout(
318 info->ch_opened_wait_queue,
319 info->is_open, (2 * HZ));
320 if (res == 0)
321 res = -ETIMEDOUT;
322 if (res < 0) {
323 pr_err("%s: wait for %s smd_open failed %d\n",
Eric Holmberg513ad582011-12-14 16:27:13 -0700324 __func__, smd_tty[n].smd->port_name,
325 res);
Karthikeyan Ramasubramaniand5e63af2011-07-29 11:30:59 -0600326 goto release_pil;
327 }
328 res = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700329 }
330 }
331
332release_pil:
333 if (res < 0)
334 pil_put(info->pil);
335 else
336 smd_disable_read_intr(info->ch);
337out:
338 mutex_unlock(&smd_tty_lock);
339
340 return res;
341}
342
343static void smd_tty_close(struct tty_struct *tty, struct file *f)
344{
345 struct smd_tty_info *info = tty->driver_data;
Karthikeyan Ramasubramaniand563de52011-11-22 08:38:17 -0700346 unsigned long flags;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700347
348 if (info == 0)
349 return;
350
351 mutex_lock(&smd_tty_lock);
352 if (--info->open_count == 0) {
Karthikeyan Ramasubramaniand563de52011-11-22 08:38:17 -0700353 spin_lock_irqsave(&info->reset_lock, flags);
354 info->is_open = 0;
355 spin_unlock_irqrestore(&info->reset_lock, flags);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700356 if (info->tty) {
357 tasklet_kill(&info->tty_tsklt);
358 wake_lock_destroy(&info->wake_lock);
359 info->tty = 0;
360 }
361 tty->driver_data = 0;
362 del_timer(&info->buf_req_timer);
363 if (info->ch) {
364 smd_close(info->ch);
365 info->ch = 0;
366 pil_put(info->pil);
367 }
368 }
369 mutex_unlock(&smd_tty_lock);
370}
371
372static int smd_tty_write(struct tty_struct *tty, const unsigned char *buf, int len)
373{
374 struct smd_tty_info *info = tty->driver_data;
375 int avail;
376
377 /* if we're writing to a packet channel we will
378 ** never be able to write more data than there
379 ** is currently space for
380 */
381 if (is_in_reset(info))
382 return -ENETRESET;
383
384 avail = smd_write_avail(info->ch);
385 /* if no space, we'll have to setup a notification later to wake up the
386 * tty framework when space becomes avaliable
387 */
388 if (!avail) {
389 smd_enable_read_intr(info->ch);
390 return 0;
391 }
392 if (len > avail)
393 len = avail;
394
395 return smd_write(info->ch, buf, len);
396}
397
398static int smd_tty_write_room(struct tty_struct *tty)
399{
400 struct smd_tty_info *info = tty->driver_data;
401 return smd_write_avail(info->ch);
402}
403
404static int smd_tty_chars_in_buffer(struct tty_struct *tty)
405{
406 struct smd_tty_info *info = tty->driver_data;
407 return smd_read_avail(info->ch);
408}
409
410static void smd_tty_unthrottle(struct tty_struct *tty)
411{
412 struct smd_tty_info *info = tty->driver_data;
Karthikeyan Ramasubramanianf8ad4132011-11-22 09:11:18 -0700413 unsigned long flags;
414
415 spin_lock_irqsave(&info->reset_lock, flags);
416 if (info->is_open) {
417 spin_unlock_irqrestore(&info->reset_lock, flags);
418 tasklet_hi_schedule(&info->tty_tsklt);
419 return;
420 }
421 spin_unlock_irqrestore(&info->reset_lock, flags);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700422}
423
424/*
425 * Returns the current TIOCM status bits including:
426 * SMD Signals (DTR/DSR, CTS/RTS, CD, RI)
427 * TIOCM_OUT1 - reset state (1=in reset)
428 * TIOCM_OUT2 - reset state updated (1=updated)
429 */
430static int smd_tty_tiocmget(struct tty_struct *tty)
431{
432 struct smd_tty_info *info = tty->driver_data;
433 unsigned long flags;
434 int tiocm;
435
436 tiocm = smd_tiocmget(info->ch);
437
438 spin_lock_irqsave(&info->reset_lock, flags);
439 tiocm |= (info->in_reset ? TIOCM_OUT1 : 0);
440 if (info->in_reset_updated) {
441 tiocm |= TIOCM_OUT2;
442 info->in_reset_updated = 0;
443 }
444 spin_unlock_irqrestore(&info->reset_lock, flags);
445
446 return tiocm;
447}
448
449static int smd_tty_tiocmset(struct tty_struct *tty,
450 unsigned int set, unsigned int clear)
451{
452 struct smd_tty_info *info = tty->driver_data;
453
454 if (info->in_reset)
455 return -ENETRESET;
456
457 return smd_tiocmset(info->ch, set, clear);
458}
459
460static void loopback_probe_worker(struct work_struct *work)
461{
462 /* wait for modem to restart before requesting loopback server */
463 if (!is_modem_smsm_inited())
464 schedule_delayed_work(&loopback_work, msecs_to_jiffies(1000));
465 else
466 smsm_change_state(SMSM_APPS_STATE,
467 0, SMSM_SMD_LOOPBACK);
468}
469
470static struct tty_operations smd_tty_ops = {
471 .open = smd_tty_open,
472 .close = smd_tty_close,
473 .write = smd_tty_write,
474 .write_room = smd_tty_write_room,
475 .chars_in_buffer = smd_tty_chars_in_buffer,
476 .unthrottle = smd_tty_unthrottle,
477 .tiocmget = smd_tty_tiocmget,
478 .tiocmset = smd_tty_tiocmset,
479};
480
481static int smd_tty_dummy_probe(struct platform_device *pdev)
482{
Eric Holmberg513ad582011-12-14 16:27:13 -0700483 int n;
484 int idx;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700485
Eric Holmberg513ad582011-12-14 16:27:13 -0700486 for (n = 0; n < ARRAY_SIZE(smd_configs); ++n) {
487 idx = smd_configs[n].tty_dev_index;
488
489 if (!smd_configs[n].dev_name)
490 continue;
491
492 if (!strncmp(pdev->name, smd_configs[n].dev_name,
493 SMD_MAX_CH_NAME_LEN)) {
494 complete_all(&smd_tty[idx].ch_allocated);
495 return 0;
496 }
497 }
498 pr_err("%s: unknown device '%s'\n", __func__, pdev->name);
499
500 return -ENODEV;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700501}
502
503static struct tty_driver *smd_tty_driver;
504
505static int __init smd_tty_init(void)
506{
507 int ret;
Eric Holmberg513ad582011-12-14 16:27:13 -0700508 int n;
509 int idx;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700510
511 smd_tty_driver = alloc_tty_driver(MAX_SMD_TTYS);
512 if (smd_tty_driver == 0)
513 return -ENOMEM;
514
515 smd_tty_driver->owner = THIS_MODULE;
516 smd_tty_driver->driver_name = "smd_tty_driver";
517 smd_tty_driver->name = "smd";
518 smd_tty_driver->major = 0;
519 smd_tty_driver->minor_start = 0;
520 smd_tty_driver->type = TTY_DRIVER_TYPE_SERIAL;
521 smd_tty_driver->subtype = SERIAL_TYPE_NORMAL;
522 smd_tty_driver->init_termios = tty_std_termios;
523 smd_tty_driver->init_termios.c_iflag = 0;
524 smd_tty_driver->init_termios.c_oflag = 0;
525 smd_tty_driver->init_termios.c_cflag = B38400 | CS8 | CREAD;
526 smd_tty_driver->init_termios.c_lflag = 0;
527 smd_tty_driver->flags = TTY_DRIVER_RESET_TERMIOS |
528 TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
529 tty_set_operations(smd_tty_driver, &smd_tty_ops);
530
531 ret = tty_register_driver(smd_tty_driver);
Eric Holmberg513ad582011-12-14 16:27:13 -0700532 if (ret) {
533 put_tty_driver(smd_tty_driver);
534 pr_err("%s: driver registration failed %d\n", __func__, ret);
535 return ret;
Jeff Hugo4c0ba6c2011-07-15 11:47:13 -0600536 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700537
Eric Holmberg513ad582011-12-14 16:27:13 -0700538 for (n = 0; n < ARRAY_SIZE(smd_configs); ++n) {
539 idx = smd_configs[n].tty_dev_index;
540
541 if (smd_configs[n].dev_name == NULL)
542 smd_configs[n].dev_name = smd_configs[n].port_name;
543
544 if (idx == DS_IDX) {
545 /*
546 * DS port uses the kernel API starting with
547 * 8660 Fusion. Only register the userspace
548 * platform device for older targets.
549 */
550 int legacy_ds = 0;
551
552 legacy_ds |= cpu_is_msm7x01() || cpu_is_msm7x25();
553 legacy_ds |= cpu_is_msm7x27() || cpu_is_msm7x30();
554 legacy_ds |= cpu_is_qsd8x50() || cpu_is_msm8x55();
555 legacy_ds |= cpu_is_msm8x60() &&
556 (socinfo_get_platform_subtype() == 0x1);
557
558 if (!legacy_ds)
559 continue;
560 }
561
562 tty_register_device(smd_tty_driver, idx, 0);
563 init_completion(&smd_tty[idx].ch_allocated);
564
565 /* register platform device */
566 smd_tty[idx].driver.probe = smd_tty_dummy_probe;
567 smd_tty[idx].driver.driver.name = smd_configs[n].dev_name;
568 smd_tty[idx].driver.driver.owner = THIS_MODULE;
569 spin_lock_init(&smd_tty[idx].reset_lock);
570 smd_tty[idx].is_open = 0;
571 init_waitqueue_head(&smd_tty[idx].ch_opened_wait_queue);
572 ret = platform_driver_register(&smd_tty[idx].driver);
573
574 if (ret) {
575 pr_err("%s: init failed %d (%d)\n", __func__, idx, ret);
576 smd_tty[idx].driver.probe = NULL;
577 goto out;
578 }
579 smd_tty[idx].smd = &smd_configs[n];
580 }
581 INIT_DELAYED_WORK(&loopback_work, loopback_probe_worker);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700582 return 0;
583
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700584out:
Eric Holmberg513ad582011-12-14 16:27:13 -0700585 /* unregister platform devices */
586 for (n = 0; n < ARRAY_SIZE(smd_configs); ++n) {
587 idx = smd_configs[n].tty_dev_index;
588
589 if (smd_tty[idx].driver.probe) {
590 platform_driver_unregister(&smd_tty[idx].driver);
591 tty_unregister_device(smd_tty_driver, idx);
592 }
593 }
594
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700595 tty_unregister_driver(smd_tty_driver);
596 put_tty_driver(smd_tty_driver);
597 return ret;
598}
599
600module_init(smd_tty_init);