aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/speakup/serialio.c
diff options
context:
space:
mode:
authorOkash Khawaja <okash.khawaja@gmail.com>2017-04-22 09:00:28 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-25 20:45:12 +0200
commitbe223d577578c38c09f5dc9dd1fda8b5f0c91320 (patch)
tree31ecd431638c8471d2995a43f5702b1b181b458f /drivers/staging/speakup/serialio.c
parentstaging: comedi: addi_apci_3xxx: check return value (diff)
downloadlinux-dev-be223d577578c38c09f5dc9dd1fda8b5f0c91320.tar.xz
linux-dev-be223d577578c38c09f5dc9dd1fda8b5f0c91320.zip
staging: speakup: add send_xchar and tiocmset methods
This adds two methods to spk_synth struct: send_xchar and tiocmset, and creates serial implementation for each of them. It takes existing code in apollo, audptr and spkout which already fits the behaviour of send_xchar and tiocmset. In follow-up patches there will be TTY-based implementations of these methods. Then migrating the synths to TTY will include repointing these methods to their TTY implementations Rest of the changes simply make use of serial implementation of these two functions. Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/speakup/serialio.c')
-rw-r--r--drivers/staging/speakup/serialio.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c
index 3fab1c377a80..ba060d0ceca2 100644
--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -26,8 +26,13 @@ static const struct old_serial_port *serstate;
static int timeouts;
static int spk_serial_out(struct spk_synth *in_synth, const char ch);
+static void spk_serial_send_xchar(char ch);
+static void spk_serial_tiocmset(unsigned int set, unsigned int clear);
+
struct spk_io_ops spk_serial_io_ops = {
.synth_out = spk_serial_out,
+ .send_xchar = spk_serial_send_xchar,
+ .tiocmset = spk_serial_tiocmset,
};
EXPORT_SYMBOL_GPL(spk_serial_io_ops);
@@ -136,6 +141,24 @@ static void start_serial_interrupt(int irq)
outb(1, speakup_info.port_tts + UART_FCR); /* Turn FIFO On */
}
+static void spk_serial_send_xchar(char ch)
+{
+ int timeout = SPK_XMITR_TIMEOUT;
+
+ while (spk_serial_tx_busy()) {
+ if (!--timeout)
+ break;
+ udelay(1);
+ }
+ outb(ch, speakup_info.port_tts);
+}
+
+static void spk_serial_tiocmset(unsigned int set, unsigned int clear)
+{
+ int old = inb(speakup_info.port_tts + UART_MCR);
+ outb((old & ~clear) | set, speakup_info.port_tts + UART_MCR);
+}
+
int spk_serial_synth_probe(struct spk_synth *synth)
{
const struct old_serial_port *ser;