Greg Kroah-Hartman | 6496922 | 2018-01-11 11:08:40 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 2 | #include <linux/interrupt.h> |
| 3 | #include <linux/ioport.h> |
| 4 | |
| 5 | #include "spk_types.h" |
| 6 | #include "speakup.h" |
| 7 | #include "spk_priv.h" |
| 8 | #include "serialio.h" |
| 9 | |
Samuel Thibault | 327b882 | 2016-01-15 00:47:41 +0100 | [diff] [blame] | 10 | #include <linux/serial_core.h> |
| 11 | /* WARNING: Do not change this to <linux/serial.h> without testing that |
Janani Ravichandran | e6ceec82 | 2016-02-13 22:05:01 -0500 | [diff] [blame] | 12 | * SERIAL_PORT_DFNS does get defined to the appropriate value. |
| 13 | */ |
Samuel Thibault | 327b882 | 2016-01-15 00:47:41 +0100 | [diff] [blame] | 14 | #include <asm/serial.h> |
| 15 | |
Chen Gang | 5e6dc54 | 2013-10-31 15:27:37 +0800 | [diff] [blame] | 16 | #ifndef SERIAL_PORT_DFNS |
| 17 | #define SERIAL_PORT_DFNS |
| 18 | #endif |
| 19 | |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 20 | static void start_serial_interrupt(int irq); |
| 21 | |
Jiri Slaby | 3ee0017 | 2012-03-05 14:52:11 +0100 | [diff] [blame] | 22 | static const struct old_serial_port rs_table[] = { |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 23 | SERIAL_PORT_DFNS |
| 24 | }; |
Arushi Singhal | defaa9a | 2017-03-14 10:46:42 +0530 | [diff] [blame] | 25 | |
Jiri Slaby | 3ee0017 | 2012-03-05 14:52:11 +0100 | [diff] [blame] | 26 | static const struct old_serial_port *serstate; |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 27 | static int timeouts; |
| 28 | |
Okash Khawaja | 1e44159 | 2017-03-14 13:41:53 +0000 | [diff] [blame] | 29 | static int spk_serial_out(struct spk_synth *in_synth, const char ch); |
Samuel Thibault | 1941ab1 | 2021-01-26 23:21:44 +0100 | [diff] [blame] | 30 | static void spk_serial_send_xchar(struct spk_synth *in_synth, char ch); |
| 31 | static void spk_serial_tiocmset(struct spk_synth *in_synth, unsigned int set, unsigned int clear); |
| 32 | static unsigned char spk_serial_in(struct spk_synth *in_synth); |
| 33 | static unsigned char spk_serial_in_nowait(struct spk_synth *in_synth); |
| 34 | static void spk_serial_flush_buffer(struct spk_synth *in_synth); |
Samuel Thibault | 2b86d9b | 2020-08-04 18:06:37 +0200 | [diff] [blame] | 35 | static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth); |
Okash Khawaja | be223d5 | 2017-04-22 09:00:28 +0100 | [diff] [blame] | 36 | |
Okash Khawaja | 1e44159 | 2017-03-14 13:41:53 +0000 | [diff] [blame] | 37 | struct spk_io_ops spk_serial_io_ops = { |
| 38 | .synth_out = spk_serial_out, |
Okash Khawaja | be223d5 | 2017-04-22 09:00:28 +0100 | [diff] [blame] | 39 | .send_xchar = spk_serial_send_xchar, |
| 40 | .tiocmset = spk_serial_tiocmset, |
Okash Khawaja | ca693dc | 2017-04-29 20:52:58 +0100 | [diff] [blame] | 41 | .synth_in = spk_serial_in, |
| 42 | .synth_in_nowait = spk_serial_in_nowait, |
Okash Khawaja | 1c59736 | 2017-05-15 18:45:37 +0100 | [diff] [blame] | 43 | .flush_buffer = spk_serial_flush_buffer, |
Samuel Thibault | 2b86d9b | 2020-08-04 18:06:37 +0200 | [diff] [blame] | 44 | .wait_for_xmitr = spk_serial_wait_for_xmitr, |
Okash Khawaja | 1e44159 | 2017-03-14 13:41:53 +0000 | [diff] [blame] | 45 | }; |
| 46 | EXPORT_SYMBOL_GPL(spk_serial_io_ops); |
| 47 | |
Jiri Slaby | 3ee0017 | 2012-03-05 14:52:11 +0100 | [diff] [blame] | 48 | const struct old_serial_port *spk_serial_init(int index) |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 49 | { |
| 50 | int baud = 9600, quot = 0; |
| 51 | unsigned int cval = 0; |
| 52 | int cflag = CREAD | HUPCL | CLOCAL | B9600 | CS8; |
Samuel Thibault | 327b882 | 2016-01-15 00:47:41 +0100 | [diff] [blame] | 53 | const struct old_serial_port *ser; |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 54 | int err; |
| 55 | |
Samuel Thibault | 327b882 | 2016-01-15 00:47:41 +0100 | [diff] [blame] | 56 | if (index >= ARRAY_SIZE(rs_table)) { |
| 57 | pr_info("no port info for ttyS%d\n", index); |
| 58 | return NULL; |
| 59 | } |
| 60 | ser = rs_table + index; |
| 61 | |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 62 | /* Divisor, bytesize and parity */ |
| 63 | quot = ser->baud_base / baud; |
| 64 | cval = cflag & (CSIZE | CSTOPB); |
| 65 | #if defined(__powerpc__) || defined(__alpha__) |
| 66 | cval >>= 8; |
| 67 | #else /* !__powerpc__ && !__alpha__ */ |
| 68 | cval >>= 4; |
| 69 | #endif /* !__powerpc__ && !__alpha__ */ |
| 70 | if (cflag & PARENB) |
| 71 | cval |= UART_LCR_PARITY; |
| 72 | if (!(cflag & PARODD)) |
| 73 | cval |= UART_LCR_EPAR; |
| 74 | if (synth_request_region(ser->port, 8)) { |
| 75 | /* try to take it back. */ |
Keerthimai Janarthanan | 3a046c1 | 2014-03-18 14:10:13 +0530 | [diff] [blame] | 76 | pr_info("Ports not available, trying to steal them\n"); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 77 | __release_region(&ioport_resource, ser->port, 8); |
| 78 | err = synth_request_region(ser->port, 8); |
| 79 | if (err) { |
Jiri Slaby | 3ee0017 | 2012-03-05 14:52:11 +0100 | [diff] [blame] | 80 | pr_warn("Unable to allocate port at %x, errno %i", |
William Hubbs | baf9ac9 | 2010-10-15 22:13:36 -0500 | [diff] [blame] | 81 | ser->port, err); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 82 | return NULL; |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | /* Disable UART interrupts, set DTR and RTS high |
Aleksei Fedotov | 13d825e | 2015-08-14 22:34:37 +0300 | [diff] [blame] | 87 | * and set speed. |
| 88 | */ |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 89 | outb(cval | UART_LCR_DLAB, ser->port + UART_LCR); /* set DLAB */ |
| 90 | outb(quot & 0xff, ser->port + UART_DLL); /* LS of divisor */ |
| 91 | outb(quot >> 8, ser->port + UART_DLM); /* MS of divisor */ |
| 92 | outb(cval, ser->port + UART_LCR); /* reset DLAB */ |
| 93 | |
| 94 | /* Turn off Interrupts */ |
| 95 | outb(0, ser->port + UART_IER); |
| 96 | outb(UART_MCR_DTR | UART_MCR_RTS, ser->port + UART_MCR); |
| 97 | |
| 98 | /* If we read 0xff from the LSR, there is no UART here. */ |
| 99 | if (inb(ser->port + UART_LSR) == 0xff) { |
| 100 | synth_release_region(ser->port, 8); |
| 101 | serstate = NULL; |
| 102 | return NULL; |
| 103 | } |
| 104 | |
| 105 | mdelay(1); |
| 106 | speakup_info.port_tts = ser->port; |
| 107 | serstate = ser; |
| 108 | |
| 109 | start_serial_interrupt(ser->irq); |
| 110 | |
| 111 | return ser; |
| 112 | } |
| 113 | |
| 114 | static irqreturn_t synth_readbuf_handler(int irq, void *dev_id) |
| 115 | { |
| 116 | unsigned long flags; |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 117 | int c; |
Domagoj Trsan | 8e69a81 | 2014-09-09 20:04:34 +0200 | [diff] [blame] | 118 | |
William Hubbs | 9fb31b1 | 2013-05-13 00:02:58 -0500 | [diff] [blame] | 119 | spin_lock_irqsave(&speakup_info.spinlock, flags); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 120 | while (inb_p(speakup_info.port_tts + UART_LSR) & UART_LSR_DR) { |
Varsha Rao | e3bab5e | 2017-02-22 23:16:40 +0530 | [diff] [blame] | 121 | c = inb_p(speakup_info.port_tts + UART_RX); |
Shiva Kerdel | d290eff | 2016-11-06 15:09:18 +0100 | [diff] [blame] | 122 | synth->read_buff_add((u_char)c); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 123 | } |
William Hubbs | 9fb31b1 | 2013-05-13 00:02:58 -0500 | [diff] [blame] | 124 | spin_unlock_irqrestore(&speakup_info.spinlock, flags); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 125 | return IRQ_HANDLED; |
| 126 | } |
| 127 | |
| 128 | static void start_serial_interrupt(int irq) |
| 129 | { |
| 130 | int rv; |
| 131 | |
Shraddha Barke | 114885e | 2015-09-11 11:32:27 +0530 | [diff] [blame] | 132 | if (!synth->read_buff_add) |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 133 | return; |
| 134 | |
| 135 | rv = request_irq(irq, synth_readbuf_handler, IRQF_SHARED, |
Shiva Kerdel | d290eff | 2016-11-06 15:09:18 +0100 | [diff] [blame] | 136 | "serial", (void *)synth_readbuf_handler); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 137 | |
| 138 | if (rv) |
Keerthimai Janarthanan | 3a046c1 | 2014-03-18 14:10:13 +0530 | [diff] [blame] | 139 | pr_err("Unable to request Speakup serial I R Q\n"); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 140 | /* Set MCR */ |
| 141 | outb(UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2, |
Arushi Singhal | 65bf4ea1 | 2017-03-21 17:12:34 +0530 | [diff] [blame] | 142 | speakup_info.port_tts + UART_MCR); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 143 | /* Turn on Interrupts */ |
Bo YU | 79de2d0 | 2017-06-05 23:44:11 -0400 | [diff] [blame] | 144 | outb(UART_IER_MSI | UART_IER_RLSI | UART_IER_RDI, |
Bo YU | e5770b7 | 2017-06-05 23:44:40 -0400 | [diff] [blame] | 145 | speakup_info.port_tts + UART_IER); |
Varsha Rao | e3bab5e | 2017-02-22 23:16:40 +0530 | [diff] [blame] | 146 | inb(speakup_info.port_tts + UART_LSR); |
| 147 | inb(speakup_info.port_tts + UART_RX); |
| 148 | inb(speakup_info.port_tts + UART_IIR); |
| 149 | inb(speakup_info.port_tts + UART_MSR); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 150 | outb(1, speakup_info.port_tts + UART_FCR); /* Turn FIFO On */ |
| 151 | } |
| 152 | |
Samuel Thibault | 1941ab1 | 2021-01-26 23:21:44 +0100 | [diff] [blame] | 153 | static void spk_serial_send_xchar(struct spk_synth *synth, char ch) |
Okash Khawaja | be223d5 | 2017-04-22 09:00:28 +0100 | [diff] [blame] | 154 | { |
| 155 | int timeout = SPK_XMITR_TIMEOUT; |
| 156 | |
| 157 | while (spk_serial_tx_busy()) { |
| 158 | if (!--timeout) |
| 159 | break; |
| 160 | udelay(1); |
| 161 | } |
| 162 | outb(ch, speakup_info.port_tts); |
| 163 | } |
| 164 | |
Samuel Thibault | 1941ab1 | 2021-01-26 23:21:44 +0100 | [diff] [blame] | 165 | static void spk_serial_tiocmset(struct spk_synth *in_synth, unsigned int set, unsigned int clear) |
Okash Khawaja | be223d5 | 2017-04-22 09:00:28 +0100 | [diff] [blame] | 166 | { |
| 167 | int old = inb(speakup_info.port_tts + UART_MCR); |
Bo YU | f6089ae | 2017-06-05 23:43:55 -0400 | [diff] [blame] | 168 | |
Okash Khawaja | be223d5 | 2017-04-22 09:00:28 +0100 | [diff] [blame] | 169 | outb((old & ~clear) | set, speakup_info.port_tts + UART_MCR); |
| 170 | } |
| 171 | |
Okash Khawaja | 98c1fda | 2017-03-16 08:10:17 +0000 | [diff] [blame] | 172 | int spk_serial_synth_probe(struct spk_synth *synth) |
| 173 | { |
| 174 | const struct old_serial_port *ser; |
| 175 | int failed = 0; |
| 176 | |
| 177 | if ((synth->ser >= SPK_LO_TTY) && (synth->ser <= SPK_HI_TTY)) { |
| 178 | ser = spk_serial_init(synth->ser); |
| 179 | if (!ser) { |
| 180 | failed = -1; |
| 181 | } else { |
| 182 | outb_p(0, ser->port); |
| 183 | mdelay(1); |
| 184 | outb_p('\r', ser->port); |
| 185 | } |
| 186 | } else { |
| 187 | failed = -1; |
| 188 | pr_warn("ttyS%i is an invalid port\n", synth->ser); |
| 189 | } |
| 190 | if (failed) { |
| 191 | pr_info("%s: not found\n", synth->long_name); |
| 192 | return -ENODEV; |
| 193 | } |
| 194 | pr_info("%s: ttyS%i, Driver Version %s\n", |
| 195 | synth->long_name, synth->ser, synth->version); |
| 196 | synth->alive = 1; |
| 197 | return 0; |
| 198 | } |
| 199 | EXPORT_SYMBOL_GPL(spk_serial_synth_probe); |
| 200 | |
Samuel Thibault | ca2beaf | 2013-01-02 02:37:40 +0100 | [diff] [blame] | 201 | void spk_stop_serial_interrupt(void) |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 202 | { |
| 203 | if (speakup_info.port_tts == 0) |
| 204 | return; |
| 205 | |
Shraddha Barke | 114885e | 2015-09-11 11:32:27 +0530 | [diff] [blame] | 206 | if (!synth->read_buff_add) |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 207 | return; |
| 208 | |
| 209 | /* Turn off interrupts */ |
Varsha Rao | e3bab5e | 2017-02-22 23:16:40 +0530 | [diff] [blame] | 210 | outb(0, speakup_info.port_tts + UART_IER); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 211 | /* Free IRQ */ |
Shiva Kerdel | d290eff | 2016-11-06 15:09:18 +0100 | [diff] [blame] | 212 | free_irq(serstate->irq, (void *)synth_readbuf_handler); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 213 | } |
Okash Khawaja | a50ef31 | 2017-03-14 13:41:54 +0000 | [diff] [blame] | 214 | EXPORT_SYMBOL_GPL(spk_stop_serial_interrupt); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 215 | |
Samuel Thibault | 2b86d9b | 2020-08-04 18:06:37 +0200 | [diff] [blame] | 216 | static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth) |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 217 | { |
| 218 | int tmout = SPK_XMITR_TIMEOUT; |
Domagoj Trsan | 8e69a81 | 2014-09-09 20:04:34 +0200 | [diff] [blame] | 219 | |
Okash Khawaja | 9176d15 | 2017-03-14 13:41:52 +0000 | [diff] [blame] | 220 | if ((in_synth->alive) && (timeouts >= NUM_DISABLE_TIMEOUTS)) { |
William Hubbs | baf9ac9 | 2010-10-15 22:13:36 -0500 | [diff] [blame] | 221 | pr_warn("%s: too many timeouts, deactivating speakup\n", |
Okash Khawaja | 9176d15 | 2017-03-14 13:41:52 +0000 | [diff] [blame] | 222 | in_synth->long_name); |
| 223 | in_synth->alive = 0; |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 224 | /* No synth any more, so nobody will restart TTYs, and we thus |
| 225 | * need to do it ourselves. Now that there is no synth we can |
Aleksei Fedotov | 13d825e | 2015-08-14 22:34:37 +0300 | [diff] [blame] | 226 | * let application flood anyway |
| 227 | */ |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 228 | speakup_start_ttys(); |
| 229 | timeouts = 0; |
| 230 | return 0; |
| 231 | } |
| 232 | while (spk_serial_tx_busy()) { |
| 233 | if (--tmout == 0) { |
Bo YU | 1f10145 | 2017-06-05 23:44:26 -0400 | [diff] [blame] | 234 | pr_warn("%s: timed out (tx busy)\n", |
| 235 | in_synth->long_name); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 236 | timeouts++; |
| 237 | return 0; |
| 238 | } |
| 239 | udelay(1); |
| 240 | } |
| 241 | tmout = SPK_CTS_TIMEOUT; |
| 242 | while (!((inb_p(speakup_info.port_tts + UART_MSR)) & UART_MSR_CTS)) { |
| 243 | /* CTS */ |
| 244 | if (--tmout == 0) { |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 245 | timeouts++; |
| 246 | return 0; |
| 247 | } |
| 248 | udelay(1); |
| 249 | } |
| 250 | timeouts = 0; |
| 251 | return 1; |
| 252 | } |
| 253 | |
Samuel Thibault | 1941ab1 | 2021-01-26 23:21:44 +0100 | [diff] [blame] | 254 | static unsigned char spk_serial_in(struct spk_synth *in_synth) |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 255 | { |
| 256 | int tmout = SPK_SERIAL_TIMEOUT; |
| 257 | |
| 258 | while (!(inb_p(speakup_info.port_tts + UART_LSR) & UART_LSR_DR)) { |
| 259 | if (--tmout == 0) { |
| 260 | pr_warn("time out while waiting for input.\n"); |
| 261 | return 0xff; |
| 262 | } |
| 263 | udelay(1); |
| 264 | } |
| 265 | return inb_p(speakup_info.port_tts + UART_RX); |
| 266 | } |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 267 | |
Samuel Thibault | 1941ab1 | 2021-01-26 23:21:44 +0100 | [diff] [blame] | 268 | static unsigned char spk_serial_in_nowait(struct spk_synth *in_synth) |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 269 | { |
| 270 | unsigned char lsr; |
| 271 | |
| 272 | lsr = inb_p(speakup_info.port_tts + UART_LSR); |
| 273 | if (!(lsr & UART_LSR_DR)) |
| 274 | return 0; |
| 275 | return inb_p(speakup_info.port_tts + UART_RX); |
| 276 | } |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 277 | |
Samuel Thibault | 1941ab1 | 2021-01-26 23:21:44 +0100 | [diff] [blame] | 278 | static void spk_serial_flush_buffer(struct spk_synth *in_synth) |
Okash Khawaja | 1c59736 | 2017-05-15 18:45:37 +0100 | [diff] [blame] | 279 | { |
| 280 | /* TODO: flush the UART 16550 buffer */ |
| 281 | } |
| 282 | |
Gustavo A. R. Silva | a15505e | 2017-03-27 01:37:29 -0500 | [diff] [blame] | 283 | static int spk_serial_out(struct spk_synth *in_synth, const char ch) |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 284 | { |
Samuel Thibault | 2b86d9b | 2020-08-04 18:06:37 +0200 | [diff] [blame] | 285 | if (in_synth->alive && spk_serial_wait_for_xmitr(in_synth)) { |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 286 | outb_p(ch, speakup_info.port_tts); |
| 287 | return 1; |
| 288 | } |
| 289 | return 0; |
| 290 | } |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 291 | |
Bo YU | 1f10145 | 2017-06-05 23:44:26 -0400 | [diff] [blame] | 292 | const char *spk_serial_synth_immediate(struct spk_synth *synth, |
| 293 | const char *buff) |
Okash Khawaja | 98c1fda | 2017-03-16 08:10:17 +0000 | [diff] [blame] | 294 | { |
| 295 | u_char ch; |
| 296 | |
| 297 | while ((ch = *buff)) { |
| 298 | if (ch == '\n') |
| 299 | ch = synth->procspeech; |
Samuel Thibault | 2b86d9b | 2020-08-04 18:06:37 +0200 | [diff] [blame] | 300 | if (spk_serial_wait_for_xmitr(synth)) |
Okash Khawaja | 98c1fda | 2017-03-16 08:10:17 +0000 | [diff] [blame] | 301 | outb(ch, speakup_info.port_tts); |
| 302 | else |
| 303 | return buff; |
| 304 | buff++; |
| 305 | } |
| 306 | return NULL; |
| 307 | } |
| 308 | EXPORT_SYMBOL_GPL(spk_serial_synth_immediate); |
| 309 | |
Samuel Thibault | 1941ab1 | 2021-01-26 23:21:44 +0100 | [diff] [blame] | 310 | void spk_serial_release(struct spk_synth *synth) |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 311 | { |
Okash Khawaja | a50ef31 | 2017-03-14 13:41:54 +0000 | [diff] [blame] | 312 | spk_stop_serial_interrupt(); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 313 | if (speakup_info.port_tts == 0) |
| 314 | return; |
| 315 | synth_release_region(speakup_info.port_tts, 8); |
| 316 | speakup_info.port_tts = 0; |
| 317 | } |
| 318 | EXPORT_SYMBOL_GPL(spk_serial_release); |