forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/sound/isa/cmi8330.c
....@@ -1,22 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Driver for C-Media's CMI8330 and CMI8329 soundcards.
34 * Copyright (c) by George Talusan <gstalusan@uwaterloo.ca>
45 * http://www.undergrad.math.uwaterloo.ca/~gstalusa
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 /*
....@@ -134,7 +120,7 @@
134120 #define CMI8330_LINGAIN 25
135121 #define CMI8330_CDINGAIN 26
136122
137
-static unsigned char snd_cmi8330_image[((CMI8330_CDINGAIN)-16) + 1] =
123
+static const unsigned char snd_cmi8330_image[((CMI8330_CDINGAIN)-16) + 1] =
138124 {
139125 0x40, /* 16 - recording mux (SB-mixer-enabled) */
140126 #ifdef ENABLE_SB_MIXER
....@@ -193,7 +179,7 @@
193179 #endif
194180
195181
196
-static struct snd_kcontrol_new snd_cmi8330_controls[] = {
182
+static const struct snd_kcontrol_new snd_cmi8330_controls[] = {
197183 WSS_DOUBLE("Master Playback Volume", 0,
198184 CMI8330_MASTVOL, CMI8330_MASTVOL, 4, 0, 15, 0),
199185 WSS_SINGLE("Loud Playback Switch", 0,
....@@ -249,7 +235,7 @@
249235 };
250236
251237 #ifdef ENABLE_SB_MIXER
252
-static struct sbmix_elem cmi8330_sb_mixers[] = {
238
+static const struct sbmix_elem cmi8330_sb_mixers[] = {
253239 SB_DOUBLE("SB Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31),
254240 SB_DOUBLE("Tone Control - Bass", SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15),
255241 SB_DOUBLE("Tone Control - Treble", SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15),
....@@ -267,7 +253,7 @@
267253 SB_SINGLE("SB Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1),
268254 };
269255
270
-static unsigned char cmi8330_sb_init_values[][2] = {
256
+static const unsigned char cmi8330_sb_init_values[][2] = {
271257 { SB_DSP4_MASTER_DEV + 0, 0 },
272258 { SB_DSP4_MASTER_DEV + 1, 0 },
273259 { SB_DSP4_PCM_DEV + 0, 0 },
....@@ -442,7 +428,7 @@
442428 struct snd_pcm *pcm;
443429 const struct snd_pcm_ops *ops;
444430 int err;
445
- static snd_pcm_open_callback_t cmi_open_callbacks[2] = {
431
+ static const snd_pcm_open_callback_t cmi_open_callbacks[2] = {
446432 snd_cmi8330_playback_open,
447433 snd_cmi8330_capture_open
448434 };
....@@ -469,9 +455,8 @@
469455 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &chip->streams[SNDRV_PCM_STREAM_PLAYBACK].ops);
470456 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &chip->streams[SNDRV_PCM_STREAM_CAPTURE].ops);
471457
472
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
473
- snd_dma_isa_data(),
474
- 64*1024, 128*1024);
458
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
459
+ card->dev, 64*1024, 128*1024);
475460 chip->pcm = pcm;
476461
477462 return 0;
....@@ -484,7 +469,6 @@
484469 struct snd_cmi8330 *acard = card->private_data;
485470
486471 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
487
- snd_pcm_suspend_all(acard->pcm);
488472 acard->wss->suspend(acard->wss);
489473 snd_sbmixer_suspend(acard->sb);
490474 return 0;