]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - drivers/accessibility/speakup/speakup_acntsa.c
Merge tag 'iommu-updates-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git...
[mirror_ubuntu-hirsute-kernel.git] / drivers / accessibility / speakup / speakup_acntsa.c
CommitLineData
64969228 1// SPDX-License-Identifier: GPL-2.0+
c6e3fd22
WH
2/*
3 * originally written by: Kirk Reiser <kirk@braille.uwo.ca>
4d0bdcb1 4 * this version considerably modified by David Borowski, david575@rogers.com
c6e3fd22
WH
5 *
6 * Copyright (C) 1998-99 Kirk Reiser.
7 * Copyright (C) 2003 David Borowski.
8 *
c6e3fd22
WH
9 * this code is specificly written as a driver for the speakup screenreview
10 * package and is not a general device driver.
11 */
12
13#include "spk_priv.h"
14#include "speakup.h"
15#include "speakup_acnt.h" /* local header file for Accent values */
16
17#define DRV_VERSION "2.11"
c6e3fd22
WH
18#define PROCSPEECH '\r'
19
20static int synth_probe(struct spk_synth *synth);
21
22static struct var_t vars[] = {
28ba8677
CB
23 { CAPS_START, .u.s = {"\033P8" } },
24 { CAPS_STOP, .u.s = {"\033P5" } },
25 { RATE, .u.n = {"\033R%c", 9, 0, 17, 0, 0, "0123456789abcdefgh" } },
26 { PITCH, .u.n = {"\033P%d", 5, 0, 9, 0, 0, NULL } },
27 { VOL, .u.n = {"\033A%d", 9, 0, 9, 0, 0, NULL } },
28 { TONE, .u.n = {"\033V%d", 5, 0, 9, 0, 0, NULL } },
29 { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } },
c6e3fd22
WH
30 V_LAST_VAR
31};
32
33/*
34 * These attributes will appear in /sys/accessibility/speakup/acntsa.
35 */
36static struct kobj_attribute caps_start_attribute =
73c3700e 37 __ATTR(caps_start, 0644, spk_var_show, spk_var_store);
c6e3fd22 38static struct kobj_attribute caps_stop_attribute =
73c3700e 39 __ATTR(caps_stop, 0644, spk_var_show, spk_var_store);
c6e3fd22 40static struct kobj_attribute pitch_attribute =
73c3700e 41 __ATTR(pitch, 0644, spk_var_show, spk_var_store);
c6e3fd22 42static struct kobj_attribute rate_attribute =
73c3700e 43 __ATTR(rate, 0644, spk_var_show, spk_var_store);
c6e3fd22 44static struct kobj_attribute tone_attribute =
73c3700e 45 __ATTR(tone, 0644, spk_var_show, spk_var_store);
c6e3fd22 46static struct kobj_attribute vol_attribute =
73c3700e 47 __ATTR(vol, 0644, spk_var_show, spk_var_store);
c6e3fd22
WH
48
49static struct kobj_attribute delay_time_attribute =
73c3700e 50 __ATTR(delay_time, 0644, spk_var_show, spk_var_store);
c6e3fd22 51static struct kobj_attribute direct_attribute =
73c3700e 52 __ATTR(direct, 0644, spk_var_show, spk_var_store);
c6e3fd22 53static struct kobj_attribute full_time_attribute =
73c3700e 54 __ATTR(full_time, 0644, spk_var_show, spk_var_store);
c6e3fd22 55static struct kobj_attribute jiffy_delta_attribute =
73c3700e 56 __ATTR(jiffy_delta, 0644, spk_var_show, spk_var_store);
c6e3fd22 57static struct kobj_attribute trigger_time_attribute =
73c3700e 58 __ATTR(trigger_time, 0644, spk_var_show, spk_var_store);
c6e3fd22
WH
59
60/*
61 * Create a group of attributes so that we can create and destroy them all
62 * at once.
63 */
64static struct attribute *synth_attrs[] = {
65 &caps_start_attribute.attr,
66 &caps_stop_attribute.attr,
67 &pitch_attribute.attr,
68 &rate_attribute.attr,
69 &tone_attribute.attr,
70 &vol_attribute.attr,
71 &delay_time_attribute.attr,
72 &direct_attribute.attr,
73 &full_time_attribute.attr,
74 &jiffy_delta_attribute.attr,
75 &trigger_time_attribute.attr,
76 NULL, /* need to NULL terminate the list of attributes */
77};
78
79static struct spk_synth synth_acntsa = {
80 .name = "acntsa",
81 .version = DRV_VERSION,
82 .long_name = "Accent-SA",
83 .init = "\033T2\033=M\033Oi\033N1\n",
84 .procspeech = PROCSPEECH,
85 .clear = SYNTH_CLEAR,
86 .delay = 400,
87 .trigger = 50,
88 .jiffies = 30,
89 .full = 40000,
8a21ff77 90 .dev_name = SYNTH_DEFAULT_DEV,
c6e3fd22
WH
91 .startup = SYNTH_START,
92 .checkval = SYNTH_CHECK,
93 .vars = vars,
bd697e29 94 .io_ops = &spk_ttyio_ops,
c6e3fd22 95 .probe = synth_probe,
bd697e29
OK
96 .release = spk_ttyio_release,
97 .synth_immediate = spk_ttyio_synth_immediate,
c6e3fd22
WH
98 .catch_up = spk_do_catch_up,
99 .flush = spk_synth_flush,
100 .is_alive = spk_synth_is_alive_restart,
101 .synth_adjust = NULL,
102 .read_buff_add = NULL,
103 .get_index = NULL,
104 .indexing = {
105 .command = NULL,
106 .lowindex = 0,
107 .highindex = 0,
108 .currindex = 0,
109 },
110 .attributes = {
111 .attrs = synth_attrs,
112 .name = "acntsa",
113 },
114};
115
116static int synth_probe(struct spk_synth *synth)
117{
118 int failed;
119
bd697e29 120 failed = spk_ttyio_synth_probe(synth);
c6e3fd22 121 if (failed == 0) {
98c1fda7 122 synth->synth_immediate(synth, "\033=R\r");
c6e3fd22
WH
123 mdelay(100);
124 }
125 synth->alive = !failed;
126 return failed;
127}
128
73c3700e 129module_param_named(ser, synth_acntsa.ser, int, 0444);
a33adacd 130module_param_named(dev, synth_acntsa.dev_name, charp, 0444);
73c3700e 131module_param_named(start, synth_acntsa.startup, short, 0444);
c6e3fd22
WH
132
133MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based).");
8a21ff77 134MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer.");
c6e3fd22
WH
135MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded.");
136
ae89facc 137module_spk_synth(synth_acntsa);
c6e3fd22 138
c6e3fd22
WH
139MODULE_AUTHOR("Kirk Reiser <kirk@braille.uwo.ca>");
140MODULE_AUTHOR("David Borowski");
141MODULE_DESCRIPTION("Speakup support for Accent SA synthesizer");
142MODULE_LICENSE("GPL");
143MODULE_VERSION(DRV_VERSION);
144