forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/sound/drivers/opl3/opl3_drums.c
....@@ -1,27 +1,13 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (c) by Uros Bizjak <uros@kss-loka.si>
34 *
45 * OPL2/OPL3/OPL4 FM routines for internal percussion channels
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- *
206 */
217
228 #include "opl3_voice.h"
239
24
-static char snd_opl3_drum_table[47] =
10
+static const char snd_opl3_drum_table[47] =
2511 {
2612 OPL3_BASSDRUM_ON, OPL3_BASSDRUM_ON, OPL3_HIHAT_ON, /* 35 - 37 */
2713 OPL3_SNAREDRUM_ON, OPL3_HIHAT_ON, OPL3_SNAREDRUM_ON, /* 38 - 40 */
....@@ -61,25 +47,25 @@
6147 unsigned char feedback_connection;
6248 };
6349
64
-static struct snd_opl3_drum_voice bass_op0 = {6, 0, 0x00, 0x32, 0xf8, 0x66, 0x30, 0x00};
65
-static struct snd_opl3_drum_voice bass_op1 = {6, 1, 0x00, 0x03, 0xf6, 0x57, 0x30, 0x00};
66
-static struct snd_opl3_drum_note bass_note = {6, 0x90, 0x09};
50
+static const struct snd_opl3_drum_voice bass_op0 = {6, 0, 0x00, 0x32, 0xf8, 0x66, 0x30, 0x00};
51
+static const struct snd_opl3_drum_voice bass_op1 = {6, 1, 0x00, 0x03, 0xf6, 0x57, 0x30, 0x00};
52
+static const struct snd_opl3_drum_note bass_note = {6, 0x90, 0x09};
6753
68
-static struct snd_opl3_drum_voice hihat = {7, 0, 0x00, 0x03, 0xf0, 0x06, 0x20, 0x00};
54
+static const struct snd_opl3_drum_voice hihat = {7, 0, 0x00, 0x03, 0xf0, 0x06, 0x20, 0x00};
6955
70
-static struct snd_opl3_drum_voice snare = {7, 1, 0x00, 0x03, 0xf0, 0x07, 0x20, 0x02};
71
-static struct snd_opl3_drum_note snare_note = {7, 0xf4, 0x0d};
56
+static const struct snd_opl3_drum_voice snare = {7, 1, 0x00, 0x03, 0xf0, 0x07, 0x20, 0x02};
57
+static const struct snd_opl3_drum_note snare_note = {7, 0xf4, 0x0d};
7258
73
-static struct snd_opl3_drum_voice tomtom = {8, 0, 0x02, 0x03, 0xf0, 0x06, 0x10, 0x00};
74
-static struct snd_opl3_drum_note tomtom_note = {8, 0xf4, 0x09};
59
+static const struct snd_opl3_drum_voice tomtom = {8, 0, 0x02, 0x03, 0xf0, 0x06, 0x10, 0x00};
60
+static const struct snd_opl3_drum_note tomtom_note = {8, 0xf4, 0x09};
7561
76
-static struct snd_opl3_drum_voice cymbal = {8, 1, 0x04, 0x03, 0xf0, 0x06, 0x10, 0x00};
62
+static const struct snd_opl3_drum_voice cymbal = {8, 1, 0x04, 0x03, 0xf0, 0x06, 0x10, 0x00};
7763
7864 /*
7965 * set drum voice characteristics
8066 */
8167 static void snd_opl3_drum_voice_set(struct snd_opl3 *opl3,
82
- struct snd_opl3_drum_voice *data)
68
+ const struct snd_opl3_drum_voice *data)
8369 {
8470 unsigned char op_offset = snd_opl3_regmap[data->voice][data->op];
8571 unsigned char voice_offset = data->voice;
....@@ -114,7 +100,7 @@
114100 * Set drum voice pitch
115101 */
116102 static void snd_opl3_drum_note_set(struct snd_opl3 *opl3,
117
- struct snd_opl3_drum_note *data)
103
+ const struct snd_opl3_drum_note *data)
118104 {
119105 unsigned char voice_offset = data->voice;
120106 unsigned short opl3_reg;
....@@ -132,7 +118,7 @@
132118 * Set drum voice volume and position
133119 */
134120 static void snd_opl3_drum_vol_set(struct snd_opl3 *opl3,
135
- struct snd_opl3_drum_voice *data,
121
+ const struct snd_opl3_drum_voice *data,
136122 int vel, struct snd_midi_channel *chan)
137123 {
138124 unsigned char op_offset = snd_opl3_regmap[data->voice][data->op];
....@@ -184,7 +170,7 @@
184170 struct snd_midi_channel *chan)
185171 {
186172 unsigned char drum_mask;
187
- struct snd_opl3_drum_voice *drum_voice;
173
+ const struct snd_opl3_drum_voice *drum_voice;
188174
189175 if (!(opl3->drum_reg & OPL3_PERCUSSION_ENABLE))
190176 return;