.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Driver for C-Media's CMI8330 and CMI8329 soundcards. |
---|
3 | 4 | * Copyright (c) by George Talusan <gstalusan@uwaterloo.ca> |
---|
4 | 5 | * 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 | | - * |
---|
20 | 6 | */ |
---|
21 | 7 | |
---|
22 | 8 | /* |
---|
.. | .. |
---|
134 | 120 | #define CMI8330_LINGAIN 25 |
---|
135 | 121 | #define CMI8330_CDINGAIN 26 |
---|
136 | 122 | |
---|
137 | | -static unsigned char snd_cmi8330_image[((CMI8330_CDINGAIN)-16) + 1] = |
---|
| 123 | +static const unsigned char snd_cmi8330_image[((CMI8330_CDINGAIN)-16) + 1] = |
---|
138 | 124 | { |
---|
139 | 125 | 0x40, /* 16 - recording mux (SB-mixer-enabled) */ |
---|
140 | 126 | #ifdef ENABLE_SB_MIXER |
---|
.. | .. |
---|
193 | 179 | #endif |
---|
194 | 180 | |
---|
195 | 181 | |
---|
196 | | -static struct snd_kcontrol_new snd_cmi8330_controls[] = { |
---|
| 182 | +static const struct snd_kcontrol_new snd_cmi8330_controls[] = { |
---|
197 | 183 | WSS_DOUBLE("Master Playback Volume", 0, |
---|
198 | 184 | CMI8330_MASTVOL, CMI8330_MASTVOL, 4, 0, 15, 0), |
---|
199 | 185 | WSS_SINGLE("Loud Playback Switch", 0, |
---|
.. | .. |
---|
249 | 235 | }; |
---|
250 | 236 | |
---|
251 | 237 | #ifdef ENABLE_SB_MIXER |
---|
252 | | -static struct sbmix_elem cmi8330_sb_mixers[] = { |
---|
| 238 | +static const struct sbmix_elem cmi8330_sb_mixers[] = { |
---|
253 | 239 | SB_DOUBLE("SB Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31), |
---|
254 | 240 | SB_DOUBLE("Tone Control - Bass", SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15), |
---|
255 | 241 | SB_DOUBLE("Tone Control - Treble", SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15), |
---|
.. | .. |
---|
267 | 253 | SB_SINGLE("SB Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1), |
---|
268 | 254 | }; |
---|
269 | 255 | |
---|
270 | | -static unsigned char cmi8330_sb_init_values[][2] = { |
---|
| 256 | +static const unsigned char cmi8330_sb_init_values[][2] = { |
---|
271 | 257 | { SB_DSP4_MASTER_DEV + 0, 0 }, |
---|
272 | 258 | { SB_DSP4_MASTER_DEV + 1, 0 }, |
---|
273 | 259 | { SB_DSP4_PCM_DEV + 0, 0 }, |
---|
.. | .. |
---|
442 | 428 | struct snd_pcm *pcm; |
---|
443 | 429 | const struct snd_pcm_ops *ops; |
---|
444 | 430 | 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] = { |
---|
446 | 432 | snd_cmi8330_playback_open, |
---|
447 | 433 | snd_cmi8330_capture_open |
---|
448 | 434 | }; |
---|
.. | .. |
---|
469 | 455 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &chip->streams[SNDRV_PCM_STREAM_PLAYBACK].ops); |
---|
470 | 456 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &chip->streams[SNDRV_PCM_STREAM_CAPTURE].ops); |
---|
471 | 457 | |
---|
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); |
---|
475 | 460 | chip->pcm = pcm; |
---|
476 | 461 | |
---|
477 | 462 | return 0; |
---|
.. | .. |
---|
484 | 469 | struct snd_cmi8330 *acard = card->private_data; |
---|
485 | 470 | |
---|
486 | 471 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
---|
487 | | - snd_pcm_suspend_all(acard->pcm); |
---|
488 | 472 | acard->wss->suspend(acard->wss); |
---|
489 | 473 | snd_sbmixer_suspend(acard->sb); |
---|
490 | 474 | return 0; |
---|