.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | #ifndef __SOUND_TIMER_H |
---|
2 | 3 | #define __SOUND_TIMER_H |
---|
3 | 4 | |
---|
.. | .. |
---|
5 | 6 | * Timer abstract layer |
---|
6 | 7 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, |
---|
7 | 8 | * Abramo Bagnara <abramo@alsa-project.org> |
---|
8 | | - * |
---|
9 | | - * |
---|
10 | | - * This program is free software; you can redistribute it and/or modify |
---|
11 | | - * it under the terms of the GNU General Public License as published by |
---|
12 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
13 | | - * (at your option) any later version. |
---|
14 | | - * |
---|
15 | | - * This program is distributed in the hope that it will be useful, |
---|
16 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 | | - * GNU General Public License for more details. |
---|
19 | | - * |
---|
20 | | - * You should have received a copy of the GNU General Public License |
---|
21 | | - * along with this program; if not, write to the Free Software |
---|
22 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
23 | | - * |
---|
24 | 9 | */ |
---|
25 | 10 | |
---|
26 | 11 | #include <sound/asound.h> |
---|
27 | 12 | #include <linux/interrupt.h> |
---|
| 13 | +#include <linux/android_kabi.h> |
---|
28 | 14 | |
---|
29 | 15 | #define snd_timer_chip(timer) ((timer)->private_data) |
---|
30 | 16 | |
---|
.. | .. |
---|
36 | 22 | #define SNDRV_TIMER_HW_STOP 0x00000002 /* call stop before start */ |
---|
37 | 23 | #define SNDRV_TIMER_HW_SLAVE 0x00000004 /* only slave timer (variable resolution) */ |
---|
38 | 24 | #define SNDRV_TIMER_HW_FIRST 0x00000008 /* first tick can be incomplete */ |
---|
39 | | -#define SNDRV_TIMER_HW_TASKLET 0x00000010 /* timer is called from tasklet */ |
---|
| 25 | +#define SNDRV_TIMER_HW_WORK 0x00000010 /* timer is called from work */ |
---|
40 | 26 | |
---|
41 | 27 | #define SNDRV_TIMER_IFLG_SLAVE 0x00000001 |
---|
42 | 28 | #define SNDRV_TIMER_IFLG_RUNNING 0x00000002 |
---|
43 | 29 | #define SNDRV_TIMER_IFLG_START 0x00000004 |
---|
44 | 30 | #define SNDRV_TIMER_IFLG_AUTO 0x00000008 /* auto restart */ |
---|
45 | | -#define SNDRV_TIMER_IFLG_FAST 0x00000010 /* fast callback (do not use tasklet) */ |
---|
| 31 | +#define SNDRV_TIMER_IFLG_FAST 0x00000010 /* fast callback (do not use work) */ |
---|
46 | 32 | #define SNDRV_TIMER_IFLG_CALLBACK 0x00000020 /* timer callback is active */ |
---|
47 | 33 | #define SNDRV_TIMER_IFLG_EXCLUSIVE 0x00000040 /* exclusive owner - no more instances */ |
---|
48 | 34 | #define SNDRV_TIMER_IFLG_EARLY_EVENT 0x00000080 /* write early event to the poll queue */ |
---|
.. | .. |
---|
67 | 53 | int (*stop) (struct snd_timer * timer); |
---|
68 | 54 | int (*set_period) (struct snd_timer * timer, unsigned long period_num, unsigned long period_den); |
---|
69 | 55 | int (*precise_resolution) (struct snd_timer * timer, unsigned long *num, unsigned long *den); |
---|
| 56 | + |
---|
| 57 | + ANDROID_KABI_RESERVE(1); |
---|
70 | 58 | }; |
---|
71 | 59 | |
---|
72 | 60 | struct snd_timer { |
---|
.. | .. |
---|
89 | 77 | struct list_head active_list_head; |
---|
90 | 78 | struct list_head ack_list_head; |
---|
91 | 79 | struct list_head sack_list_head; /* slow ack list head */ |
---|
92 | | - struct tasklet_struct task_queue; |
---|
| 80 | + struct work_struct task_work; |
---|
93 | 81 | int max_instances; /* upper limit of timer instances */ |
---|
94 | 82 | int num_instances; /* current number of timer instances */ |
---|
| 83 | + |
---|
| 84 | + ANDROID_KABI_RESERVE(1); |
---|
95 | 85 | }; |
---|
96 | 86 | |
---|
97 | 87 | struct snd_timer_instance { |
---|
.. | .. |
---|
104 | 94 | unsigned long ticks, unsigned long resolution); |
---|
105 | 95 | void (*ccallback) (struct snd_timer_instance * timeri, |
---|
106 | 96 | int event, |
---|
107 | | - struct timespec * tstamp, |
---|
| 97 | + struct timespec64 * tstamp, |
---|
108 | 98 | unsigned long resolution); |
---|
109 | 99 | void (*disconnect)(struct snd_timer_instance *timeri); |
---|
110 | 100 | void *callback_data; |
---|
111 | 101 | unsigned long ticks; /* auto-load ticks when expired */ |
---|
112 | 102 | unsigned long cticks; /* current ticks */ |
---|
113 | 103 | unsigned long pticks; /* accumulated ticks for callback */ |
---|
114 | | - unsigned long resolution; /* current resolution for tasklet */ |
---|
| 104 | + unsigned long resolution; /* current resolution for work */ |
---|
115 | 105 | unsigned long lost; /* lost ticks */ |
---|
116 | 106 | int slave_class; |
---|
117 | 107 | unsigned int slave_id; |
---|
.. | .. |
---|
121 | 111 | struct list_head slave_list_head; |
---|
122 | 112 | struct list_head slave_active_head; |
---|
123 | 113 | struct snd_timer_instance *master; |
---|
| 114 | + |
---|
| 115 | + ANDROID_KABI_RESERVE(1); |
---|
124 | 116 | }; |
---|
125 | 117 | |
---|
126 | 118 | /* |
---|
.. | .. |
---|
128 | 120 | */ |
---|
129 | 121 | |
---|
130 | 122 | int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid, struct snd_timer **rtimer); |
---|
131 | | -void snd_timer_notify(struct snd_timer *timer, int event, struct timespec *tstamp); |
---|
| 123 | +void snd_timer_notify(struct snd_timer *timer, int event, struct timespec64 *tstamp); |
---|
132 | 124 | int snd_timer_global_new(char *id, int device, struct snd_timer **rtimer); |
---|
133 | 125 | int snd_timer_global_free(struct snd_timer *timer); |
---|
134 | 126 | int snd_timer_global_register(struct snd_timer *timer); |
---|
135 | 127 | |
---|
136 | | -int snd_timer_open(struct snd_timer_instance **ti, char *owner, struct snd_timer_id *tid, unsigned int slave_id); |
---|
137 | | -int snd_timer_close(struct snd_timer_instance *timeri); |
---|
| 128 | +struct snd_timer_instance *snd_timer_instance_new(const char *owner); |
---|
| 129 | +void snd_timer_instance_free(struct snd_timer_instance *timeri); |
---|
| 130 | +int snd_timer_open(struct snd_timer_instance *timeri, struct snd_timer_id *tid, unsigned int slave_id); |
---|
| 131 | +void snd_timer_close(struct snd_timer_instance *timeri); |
---|
138 | 132 | unsigned long snd_timer_resolution(struct snd_timer_instance *timeri); |
---|
139 | 133 | int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks); |
---|
140 | 134 | int snd_timer_stop(struct snd_timer_instance *timeri); |
---|