Changeset 679 for GPL/trunk/alsa-kernel/isa/sb/emu8000.c
- Timestamp:
- Mar 18, 2021, 8:57:36 PM (4 years ago)
- Location:
- GPL/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-linux-3.2.102 (added) merged: 611-614 /GPL/branches/uniaud32-next (added) merged: 615-678
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/isa/sb/emu8000.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> … … 5 6 * 6 7 * Routines for control of EMU8000 chip 7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License as published by10 * the Free Software Foundation; either version 2 of the License, or11 * (at your option) any later version.12 *13 * This program is distributed in the hope that it will be useful,14 * but WITHOUT ANY WARRANTY; without even the implied warranty of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU General Public License for more details.17 *18 * You should have received a copy of the GNU General Public License19 * along with this program; if not, write to the Free Software20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA21 8 */ 22 9 23 10 #include <linux/wait.h> 24 #include <linux/sched .h>11 #include <linux/sched/signal.h> 25 12 #include <linux/slab.h> 26 13 #include <linux/ioport.h> 14 #include <linux/export.h> 27 15 #include <linux/delay.h> 16 #include <linux/io.h> 28 17 #include <sound/core.h> 29 18 #include <sound/emu8000.h> 30 19 #include <sound/emu8000_reg.h> 31 #include <asm/io.h> 32 #include <asm/uaccess.h> 20 #include <linux/uaccess.h> 33 21 #include <linux/init.h> 34 22 #include <sound/control.h> … … 131 119 /* 132 120 */ 133 static void __devinit121 static void 134 122 snd_emu8000_read_wait(struct snd_emu8000 *emu) 135 123 { … … 143 131 /* 144 132 */ 145 static void __devinit133 static void 146 134 snd_emu8000_write_wait(struct snd_emu8000 *emu) 147 135 { … … 156 144 * detect a card at the given port 157 145 */ 158 static int __devinit146 static int 159 147 snd_emu8000_detect(struct snd_emu8000 *emu) 160 148 { … … 182 170 * intiailize audio channels 183 171 */ 184 static void __devinit172 static void 185 173 init_audio(struct snd_emu8000 *emu) 186 174 { … … 223 211 * initialize DMA address 224 212 */ 225 static void __devinit213 static void 226 214 init_dma(struct snd_emu8000 *emu) 227 215 { … … 235 223 * initialization arrays; from ADIP 236 224 */ 237 static unsigned short init1[128] /*__devinitdata*/= {225 static const unsigned short init1[128] = { 238 226 0x03ff, 0x0030, 0x07ff, 0x0130, 0x0bff, 0x0230, 0x0fff, 0x0330, 239 227 0x13ff, 0x0430, 0x17ff, 0x0530, 0x1bff, 0x0630, 0x1fff, 0x0730, … … 257 245 }; 258 246 259 static unsigned short init2[128] /*__devinitdata*/= {247 static const unsigned short init2[128] = { 260 248 0x03ff, 0x8030, 0x07ff, 0x8130, 0x0bff, 0x8230, 0x0fff, 0x8330, 261 249 0x13ff, 0x8430, 0x17ff, 0x8530, 0x1bff, 0x8630, 0x1fff, 0x8730, … … 279 267 }; 280 268 281 static unsigned short init3[128] /*__devinitdata*/= {269 static const unsigned short init3[128] = { 282 270 0x0C10, 0x8470, 0x14FE, 0xB488, 0x167F, 0xA470, 0x18E7, 0x84B5, 283 271 0x1B6E, 0x842A, 0x1F1D, 0x852A, 0x0DA3, 0x8F7C, 0x167E, 0xF254, … … 301 289 }; 302 290 303 static unsigned short init4[128] /*__devinitdata*/= {291 static const unsigned short init4[128] = { 304 292 0x0C10, 0x8470, 0x14FE, 0xB488, 0x167F, 0xA470, 0x18E7, 0x84B5, 305 293 0x1B6E, 0x842A, 0x1F1D, 0x852A, 0x0DA3, 0x0F7C, 0x167E, 0x7254, … … 327 315 * is meant to work 328 316 */ 329 static void __devinit330 send_array(struct snd_emu8000 *emu, unsigned short *data, int size)317 static void 318 send_array(struct snd_emu8000 *emu, const unsigned short *data, int size) 331 319 { 332 320 int i; 333 unsigned short *p;321 const unsigned short *p; 334 322 335 323 p = data; … … 349 337 * initialisation sequence in the adip. 350 338 */ 351 static void __devinit339 static void 352 340 init_arrays(struct snd_emu8000 *emu) 353 341 { … … 371 359 /* 372 360 * Size the onboard memory. 373 * This is written so as not to need arbit ary delays after the write. It361 * This is written so as not to need arbitrary delays after the write. It 374 362 * seems that the only way to do this is to use the one channel and keep 375 363 * reallocating between read and write. 376 364 */ 377 static void __devinit365 static void 378 366 size_dram(struct snd_emu8000 *emu) 379 367 { 380 int i, size , detected_size;368 int i, size; 381 369 382 370 if (emu->dram_checked) … … 384 372 385 373 size = 0; 386 detected_size = 0;387 374 388 375 /* write out a magic number */ … … 392 379 EMU8000_SMLD_WRITE(emu, UNIQUE_ID1); 393 380 snd_emu8000_init_fm(emu); /* This must really be here and not 2 lines back even */ 394 395 while (size < EMU8000_MAX_DRAM) { 396 397 size += 512 * 1024; /* increment 512kbytes */ 381 snd_emu8000_write_wait(emu); 382 383 /* 384 * Detect first 512 KiB. If a write succeeds at the beginning of a 385 * 512 KiB page we assume that the whole page is there. 386 */ 387 EMU8000_SMALR_WRITE(emu, EMU8000_DRAM_OFFSET); 388 EMU8000_SMLD_READ(emu); /* discard stale data */ 389 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID1) 390 goto skip_detect; /* No RAM */ 391 snd_emu8000_read_wait(emu); 392 393 for (size = 512 * 1024; size < EMU8000_MAX_DRAM; size += 512 * 1024) { 398 394 399 395 /* Write a unique data on the test address. … … 417 413 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2) 418 414 break; /* no memory at this address */ 419 420 detected_size = size;421 422 415 snd_emu8000_read_wait(emu); 423 416 … … 432 425 break; /* we must have wrapped around */ 433 426 snd_emu8000_read_wait(emu); 434 } 435 427 428 /* Otherwise, it's valid memory. */ 429 } 430 431 skip_detect: 436 432 /* wait until FULL bit in SMAxW register is false */ 437 433 for (i = 0; i < 10000; i++) { … … 445 441 snd_emu8000_dma_chan(emu, 1, EMU8000_RAM_CLOSE); 446 442 447 snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memorydetected\n",448 emu->port1, detected_size/1024);449 450 emu->mem_size = detected_size;443 pr_info("EMU8000 [0x%lx]: %d KiB on-board DRAM detected\n", 444 emu->port1, size/1024); 445 446 emu->mem_size = size; 451 447 emu->dram_checked = 1; 452 448 } … … 503 499 * The main initialization routine. 504 500 */ 505 static void __devinit501 static void 506 502 snd_emu8000_init_hw(struct snd_emu8000 *emu) 507 503 { … … 553 549 *----------------------------------------------------------------*/ 554 550 555 static unsigned short bass_parm[12][3] = {551 static const unsigned short bass_parm[12][3] = { 556 552 {0xD26A, 0xD36A, 0x0000}, /* -12 dB */ 557 553 {0xD25B, 0xD35B, 0x0000}, /* -8 */ … … 568 564 }; 569 565 570 static unsigned short treble_parm[12][9] = {566 static const unsigned short treble_parm[12][9] = { 571 567 {0x821E, 0xC26A, 0x031E, 0xC36A, 0x021E, 0xD208, 0x831E, 0xD308, 0x0001}, /* -12 dB */ 572 568 {0x821E, 0xC25B, 0x031E, 0xC35B, 0x021E, 0xD208, 0x831E, 0xD308, 0x0001}, … … 860 856 } 861 857 862 static struct snd_kcontrol_new mixer_bass_control =858 static const struct snd_kcontrol_new mixer_bass_control = 863 859 { 864 860 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 870 866 }; 871 867 872 static struct snd_kcontrol_new mixer_treble_control =868 static const struct snd_kcontrol_new mixer_treble_control = 873 869 { 874 870 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 927 923 } 928 924 929 static struct snd_kcontrol_new mixer_chorus_mode_control =925 static const struct snd_kcontrol_new mixer_chorus_mode_control = 930 926 { 931 927 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 937 933 }; 938 934 939 static struct snd_kcontrol_new mixer_reverb_mode_control =935 static const struct snd_kcontrol_new mixer_reverb_mode_control = 940 936 { 941 937 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 989 985 } 990 986 991 static struct snd_kcontrol_new mixer_fm_chorus_depth_control =987 static const struct snd_kcontrol_new mixer_fm_chorus_depth_control = 992 988 { 993 989 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 999 995 }; 1000 996 1001 static struct snd_kcontrol_new mixer_fm_reverb_depth_control =997 static const struct snd_kcontrol_new mixer_fm_reverb_depth_control = 1002 998 { 1003 999 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 1010 1006 1011 1007 1012 static struct snd_kcontrol_new *mixer_defs[EMU8000_NUM_CONTROLS] = {1008 static const struct snd_kcontrol_new *mixer_defs[EMU8000_NUM_CONTROLS] = { 1013 1009 &mixer_bass_control, 1014 1010 &mixer_treble_control, … … 1022 1018 * create and attach mixer elements for WaveTable treble/bass controls 1023 1019 */ 1024 static int __devinit1020 static int 1025 1021 snd_emu8000_create_mixer(struct snd_card *card, struct snd_emu8000 *emu) 1026 1022 { … … 1073 1069 * initialize and register emu8000 synth device. 1074 1070 */ 1075 int __devinit1071 int 1076 1072 snd_emu8000_new(struct snd_card *card, int index, long port, int seq_ports, 1077 1073 struct snd_seq_device **awe_ret) … … 1080 1076 struct snd_emu8000 *hw; 1081 1077 int err; 1082 static struct snd_device_ops ops = {1078 static const struct snd_device_ops ops = { 1083 1079 .dev_free = snd_emu8000_dev_free, 1084 1080 }; … … 1130 1126 return err; 1131 1127 } 1132 #if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))1128 #if IS_ENABLED(CONFIG_SND_SEQUENCER) 1133 1129 if (snd_seq_device_new(card, index, SNDRV_SEQ_DEV_ID_EMU8000, 1134 1130 sizeof(struct snd_emu8000*), &awe) >= 0) {
Note:
See TracChangeset
for help on using the changeset viewer.