diff options
author | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2016-04-22 20:58:05 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-04-25 04:41:46 -0400 |
commit | 34ce71a96dcba24c71b07f1b087bd179b885784d (patch) | |
tree | 89da0d835f6764133acfc4c1f086c7139953c6cd | |
parent | b610386c8afba397238329c50c45a3abc79ba45f (diff) |
ALSA: timer: remove legacy rtctimer
There are no users of rtctimer left. Remove its code as this is the
in-kernel user of the legacy PC RTC driver that will hopefully be removed
at some point.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | include/uapi/sound/asound.h | 2 | ||||
-rw-r--r-- | sound/core/Kconfig | 29 | ||||
-rw-r--r-- | sound/core/Makefile | 1 | ||||
-rw-r--r-- | sound/core/rtctimer.c | 187 | ||||
-rw-r--r-- | sound/core/seq/seq.c | 2 | ||||
-rw-r--r-- | sound/core/timer.c | 2 |
6 files changed, 1 insertions, 222 deletions
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h index 67bf49d8c944..609cadb8739d 100644 --- a/include/uapi/sound/asound.h +++ b/include/uapi/sound/asound.h | |||
@@ -672,7 +672,7 @@ enum { | |||
672 | 672 | ||
673 | /* global timers (device member) */ | 673 | /* global timers (device member) */ |
674 | #define SNDRV_TIMER_GLOBAL_SYSTEM 0 | 674 | #define SNDRV_TIMER_GLOBAL_SYSTEM 0 |
675 | #define SNDRV_TIMER_GLOBAL_RTC 1 | 675 | #define SNDRV_TIMER_GLOBAL_RTC 1 /* unused */ |
676 | #define SNDRV_TIMER_GLOBAL_HPET 2 | 676 | #define SNDRV_TIMER_GLOBAL_HPET 2 |
677 | #define SNDRV_TIMER_GLOBAL_HRTIMER 3 | 677 | #define SNDRV_TIMER_GLOBAL_HRTIMER 3 |
678 | 678 | ||
diff --git a/sound/core/Kconfig b/sound/core/Kconfig index 6d12ca9bcb80..9749f9e8b45c 100644 --- a/sound/core/Kconfig +++ b/sound/core/Kconfig | |||
@@ -141,35 +141,6 @@ config SND_SEQ_HRTIMER_DEFAULT | |||
141 | Say Y here to use the HR-timer backend as the default sequencer | 141 | Say Y here to use the HR-timer backend as the default sequencer |
142 | timer. | 142 | timer. |
143 | 143 | ||
144 | config SND_RTCTIMER | ||
145 | tristate "RTC Timer support" | ||
146 | depends on RTC | ||
147 | select SND_TIMER | ||
148 | help | ||
149 | Say Y here to enable RTC timer support for ALSA. ALSA uses | ||
150 | the RTC timer as a precise timing source and maps the RTC | ||
151 | timer to ALSA's timer interface. The ALSA sequencer code also | ||
152 | can use this timing source. | ||
153 | |||
154 | To compile this driver as a module, choose M here: the module | ||
155 | will be called snd-rtctimer. | ||
156 | |||
157 | Note that this option is exclusive with the new RTC drivers | ||
158 | (CONFIG_RTC_CLASS) since this requires the old API. | ||
159 | |||
160 | config SND_SEQ_RTCTIMER_DEFAULT | ||
161 | bool "Use RTC as default sequencer timer" | ||
162 | depends on SND_RTCTIMER && SND_SEQUENCER | ||
163 | depends on !SND_SEQ_HRTIMER_DEFAULT | ||
164 | default y | ||
165 | help | ||
166 | Say Y here to use the RTC timer as the default sequencer | ||
167 | timer. This is strongly recommended because it ensures | ||
168 | precise MIDI timing even when the system timer runs at less | ||
169 | than 1000 Hz. | ||
170 | |||
171 | If in doubt, say Y. | ||
172 | |||
173 | config SND_DYNAMIC_MINORS | 144 | config SND_DYNAMIC_MINORS |
174 | bool "Dynamic device file minor numbers" | 145 | bool "Dynamic device file minor numbers" |
175 | help | 146 | help |
diff --git a/sound/core/Makefile b/sound/core/Makefile index 48ab4b8f8279..e85d9dd12c2d 100644 --- a/sound/core/Makefile +++ b/sound/core/Makefile | |||
@@ -37,7 +37,6 @@ obj-$(CONFIG_SND) += snd.o | |||
37 | obj-$(CONFIG_SND_HWDEP) += snd-hwdep.o | 37 | obj-$(CONFIG_SND_HWDEP) += snd-hwdep.o |
38 | obj-$(CONFIG_SND_TIMER) += snd-timer.o | 38 | obj-$(CONFIG_SND_TIMER) += snd-timer.o |
39 | obj-$(CONFIG_SND_HRTIMER) += snd-hrtimer.o | 39 | obj-$(CONFIG_SND_HRTIMER) += snd-hrtimer.o |
40 | obj-$(CONFIG_SND_RTCTIMER) += snd-rtctimer.o | ||
41 | obj-$(CONFIG_SND_PCM) += snd-pcm.o | 40 | obj-$(CONFIG_SND_PCM) += snd-pcm.o |
42 | obj-$(CONFIG_SND_DMAENGINE_PCM) += snd-pcm-dmaengine.o | 41 | obj-$(CONFIG_SND_DMAENGINE_PCM) += snd-pcm-dmaengine.o |
43 | obj-$(CONFIG_SND_RAWMIDI) += snd-rawmidi.o | 42 | obj-$(CONFIG_SND_RAWMIDI) += snd-rawmidi.o |
diff --git a/sound/core/rtctimer.c b/sound/core/rtctimer.c deleted file mode 100644 index f3420d11a12f..000000000000 --- a/sound/core/rtctimer.c +++ /dev/null | |||
@@ -1,187 +0,0 @@ | |||
1 | /* | ||
2 | * RTC based high-frequency timer | ||
3 | * | ||
4 | * Copyright (C) 2000 Takashi Iwai | ||
5 | * based on rtctimer.c by Steve Ratcliffe | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #include <linux/init.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/log2.h> | ||
27 | #include <sound/core.h> | ||
28 | #include <sound/timer.h> | ||
29 | |||
30 | #if IS_ENABLED(CONFIG_RTC) | ||
31 | |||
32 | #include <linux/mc146818rtc.h> | ||
33 | |||
34 | #define RTC_FREQ 1024 /* default frequency */ | ||
35 | #define NANO_SEC 1000000000L /* 10^9 in sec */ | ||
36 | |||
37 | /* | ||
38 | * prototypes | ||
39 | */ | ||
40 | static int rtctimer_open(struct snd_timer *t); | ||
41 | static int rtctimer_close(struct snd_timer *t); | ||
42 | static int rtctimer_start(struct snd_timer *t); | ||
43 | static int rtctimer_stop(struct snd_timer *t); | ||
44 | |||
45 | |||
46 | /* | ||
47 | * The hardware dependent description for this timer. | ||
48 | */ | ||
49 | static struct snd_timer_hardware rtc_hw = { | ||
50 | .flags = SNDRV_TIMER_HW_AUTO | | ||
51 | SNDRV_TIMER_HW_FIRST | | ||
52 | SNDRV_TIMER_HW_TASKLET, | ||
53 | .ticks = 100000000L, /* FIXME: XXX */ | ||
54 | .open = rtctimer_open, | ||
55 | .close = rtctimer_close, | ||
56 | .start = rtctimer_start, | ||
57 | .stop = rtctimer_stop, | ||
58 | }; | ||
59 | |||
60 | static int rtctimer_freq = RTC_FREQ; /* frequency */ | ||
61 | static struct snd_timer *rtctimer; | ||
62 | static struct tasklet_struct rtc_tasklet; | ||
63 | static rtc_task_t rtc_task; | ||
64 | |||
65 | |||
66 | static int | ||
67 | rtctimer_open(struct snd_timer *t) | ||
68 | { | ||
69 | int err; | ||
70 | |||
71 | err = rtc_register(&rtc_task); | ||
72 | if (err < 0) | ||
73 | return err; | ||
74 | t->private_data = &rtc_task; | ||
75 | return 0; | ||
76 | } | ||
77 | |||
78 | static int | ||
79 | rtctimer_close(struct snd_timer *t) | ||
80 | { | ||
81 | rtc_task_t *rtc = t->private_data; | ||
82 | if (rtc) { | ||
83 | rtc_unregister(rtc); | ||
84 | tasklet_kill(&rtc_tasklet); | ||
85 | t->private_data = NULL; | ||
86 | } | ||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | static int | ||
91 | rtctimer_start(struct snd_timer *timer) | ||
92 | { | ||
93 | rtc_task_t *rtc = timer->private_data; | ||
94 | if (snd_BUG_ON(!rtc)) | ||
95 | return -EINVAL; | ||
96 | rtc_control(rtc, RTC_IRQP_SET, rtctimer_freq); | ||
97 | rtc_control(rtc, RTC_PIE_ON, 0); | ||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | static int | ||
102 | rtctimer_stop(struct snd_timer *timer) | ||
103 | { | ||
104 | rtc_task_t *rtc = timer->private_data; | ||
105 | if (snd_BUG_ON(!rtc)) | ||
106 | return -EINVAL; | ||
107 | rtc_control(rtc, RTC_PIE_OFF, 0); | ||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | static void rtctimer_tasklet(unsigned long data) | ||
112 | { | ||
113 | snd_timer_interrupt((struct snd_timer *)data, 1); | ||
114 | } | ||
115 | |||
116 | /* | ||
117 | * interrupt | ||
118 | */ | ||
119 | static void rtctimer_interrupt(void *private_data) | ||
120 | { | ||
121 | tasklet_schedule(private_data); | ||
122 | } | ||
123 | |||
124 | |||
125 | /* | ||
126 | * ENTRY functions | ||
127 | */ | ||
128 | static int __init rtctimer_init(void) | ||
129 | { | ||
130 | int err; | ||
131 | struct snd_timer *timer; | ||
132 | |||
133 | if (rtctimer_freq < 2 || rtctimer_freq > 8192 || | ||
134 | !is_power_of_2(rtctimer_freq)) { | ||
135 | pr_err("ALSA: rtctimer: invalid frequency %d\n", rtctimer_freq); | ||
136 | return -EINVAL; | ||
137 | } | ||
138 | |||
139 | /* Create a new timer and set up the fields */ | ||
140 | err = snd_timer_global_new("rtc", SNDRV_TIMER_GLOBAL_RTC, &timer); | ||
141 | if (err < 0) | ||
142 | return err; | ||
143 | |||
144 | timer->module = THIS_MODULE; | ||
145 | strcpy(timer->name, "RTC timer"); | ||
146 | timer->hw = rtc_hw; | ||
147 | timer->hw.resolution = NANO_SEC / rtctimer_freq; | ||
148 | |||
149 | tasklet_init(&rtc_tasklet, rtctimer_tasklet, (unsigned long)timer); | ||
150 | |||
151 | /* set up RTC callback */ | ||
152 | rtc_task.func = rtctimer_interrupt; | ||
153 | rtc_task.private_data = &rtc_tasklet; | ||
154 | |||
155 | err = snd_timer_global_register(timer); | ||
156 | if (err < 0) { | ||
157 | snd_timer_global_free(timer); | ||
158 | return err; | ||
159 | } | ||
160 | rtctimer = timer; /* remember this */ | ||
161 | |||
162 | return 0; | ||
163 | } | ||
164 | |||
165 | static void __exit rtctimer_exit(void) | ||
166 | { | ||
167 | if (rtctimer) { | ||
168 | snd_timer_global_free(rtctimer); | ||
169 | rtctimer = NULL; | ||
170 | } | ||
171 | } | ||
172 | |||
173 | |||
174 | /* | ||
175 | * exported stuff | ||
176 | */ | ||
177 | module_init(rtctimer_init) | ||
178 | module_exit(rtctimer_exit) | ||
179 | |||
180 | module_param(rtctimer_freq, int, 0444); | ||
181 | MODULE_PARM_DESC(rtctimer_freq, "timer frequency in Hz"); | ||
182 | |||
183 | MODULE_LICENSE("GPL"); | ||
184 | |||
185 | MODULE_ALIAS("snd-timer-" __stringify(SNDRV_TIMER_GLOBAL_RTC)); | ||
186 | |||
187 | #endif /* IS_ENABLED(CONFIG_RTC) */ | ||
diff --git a/sound/core/seq/seq.c b/sound/core/seq/seq.c index 7e0aabb808a6..639544b4fb04 100644 --- a/sound/core/seq/seq.c +++ b/sound/core/seq/seq.c | |||
@@ -47,8 +47,6 @@ int seq_default_timer_card = -1; | |||
47 | int seq_default_timer_device = | 47 | int seq_default_timer_device = |
48 | #ifdef CONFIG_SND_SEQ_HRTIMER_DEFAULT | 48 | #ifdef CONFIG_SND_SEQ_HRTIMER_DEFAULT |
49 | SNDRV_TIMER_GLOBAL_HRTIMER | 49 | SNDRV_TIMER_GLOBAL_HRTIMER |
50 | #elif defined(CONFIG_SND_SEQ_RTCTIMER_DEFAULT) | ||
51 | SNDRV_TIMER_GLOBAL_RTC | ||
52 | #else | 50 | #else |
53 | SNDRV_TIMER_GLOBAL_SYSTEM | 51 | SNDRV_TIMER_GLOBAL_SYSTEM |
54 | #endif | 52 | #endif |
diff --git a/sound/core/timer.c b/sound/core/timer.c index 6469bedda2f3..0cfc028c1193 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -37,8 +37,6 @@ | |||
37 | 37 | ||
38 | #if IS_ENABLED(CONFIG_SND_HRTIMER) | 38 | #if IS_ENABLED(CONFIG_SND_HRTIMER) |
39 | #define DEFAULT_TIMER_LIMIT 4 | 39 | #define DEFAULT_TIMER_LIMIT 4 |
40 | #elif IS_ENABLED(CONFIG_SND_RTCTIMER) | ||
41 | #define DEFAULT_TIMER_LIMIT 2 | ||
42 | #else | 40 | #else |
43 | #define DEFAULT_TIMER_LIMIT 1 | 41 | #define DEFAULT_TIMER_LIMIT 1 |
44 | #endif | 42 | #endif |