summaryrefslogtreecommitdiffstats
path: root/sound/isa
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-06 13:56:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-06 13:56:51 -0400
commit920f2ecdf6c3b3526f60fbd38c68597953cad3ee (patch)
tree18188922ba38a5c53ee8d17032eb5c46dffc7fa2 /sound/isa
parent9ced560b82606b35adb33a27012a148d418a4c1f (diff)
parentfc18282cdcba984ab89c74d7e844c10114ae0795 (diff)
Merge tag 'sound-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai: "This development cycle resulted in a fair amount of changes in both core and driver sides. The most significant change in ALSA core is about PCM. Also the support of of-graph card and the new DAPM widget for DSP are noteworthy changes in ASoC core. And there're lots of small changes splat over the tree, as you can see in diffstat. Below are a few highlights: ALSA core: - Removal of set_fs() hackery from PCM core stuff, and the code reorganization / optimization thereafter - Improved support of PCM ack ops, and a new ABI for improved control/status mmap handling - Lots of constifications in various codes ASoC core: - The support of of-graph card, which may work as a better generic device for a replacement of simple-card - New widget types intended mainly for use with DSPs ASoC drivers: - New drivers for Allwinner V3s SoCs - Ensonic ES8316 codec support - More Intel SKL and KBL works - More device support for Intel SST Atom (mostly for cheap tablets and 2-in-1 devices) - Support for Rockchip PDM controllers - Support for STM32 I2S and S/PDIF controllers - Support for ZTE AUD96P22 codecs HD-audio: - Support of new Realtek codecs (ALC215/ALC285/ALC289), more quirks for HP and Dell machines - A few more fixes for i915 component binding" * tag 'sound-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (418 commits) ALSA: hda - Fix unbalance of i915 module refcount ASoC: Intel: Skylake: Remove driver debugfs exit ASoC: Intel: Skylake: explicitly add the headers sst-dsp.h ALSA: hda/realtek - Remove GPIO_MASK ALSA: hda/realtek - Fix typo of pincfg for Dell quirk ALSA: pcm: add a documentation for tracepoints ALSA: atmel: ac97c: fix error return code in atmel_ac97c_probe() ALSA: x86: fix error return code in hdmi_lpe_audio_probe() ASoC: Intel: Skylake: Add support to read firmware registers ASoC: Intel: Skylake: Add sram address to sst_addr structure ASoC: Intel: Skylake: Debugfs facility to dump module config ASoC: Intel: Skylake: Add debugfs support ASoC: fix semicolon.cocci warnings ASoC: rt5645: Add quirk override by module option ASoC: rsnd: make arrays path and cmd_case static const ASoC: audio-graph-card: add widgets and routing for external amplifier support ASoC: audio-graph-card: update bindings for amplifier support ASoC: rt5665: calibration should be done before jack detection ASoC: rsnd: constify dev_pm_ops structures. ASoC: nau8825: change crosstalk-bypass property to bool type ...
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/Kconfig8
-rw-r--r--sound/isa/cmi8328.c2
-rw-r--r--sound/isa/cs423x/cs4236_lib.c4
-rw-r--r--sound/isa/es1688/es1688_lib.c4
-rw-r--r--sound/isa/es18xx.c8
-rw-r--r--sound/isa/gus/gus_main.c2
-rw-r--r--sound/isa/gus/gus_pcm.c122
-rw-r--r--sound/isa/sb/emu8000.c2
-rw-r--r--sound/isa/sb/emu8000_callback.c6
-rw-r--r--sound/isa/sb/emu8000_pcm.c214
-rw-r--r--sound/isa/sb/sb16.c2
-rw-r--r--sound/isa/sb/sb16_csp.c4
-rw-r--r--sound/isa/sb/sb16_main.c2
-rw-r--r--sound/isa/sb/sb8_main.c6
-rw-r--r--sound/isa/sscape.c2
-rw-r--r--sound/isa/wss/wss_lib.c4
16 files changed, 211 insertions, 181 deletions
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig
index 37adcc6cbe6b..cb54d9c0a77f 100644
--- a/sound/isa/Kconfig
+++ b/sound/isa/Kconfig
@@ -377,6 +377,7 @@ config SND_SBAWE
377 select SND_OPL3_LIB 377 select SND_OPL3_LIB
378 select SND_MPU401_UART 378 select SND_MPU401_UART
379 select SND_SB16_DSP 379 select SND_SB16_DSP
380 select SND_SEQ_DEVICE if SND_SEQUENCER != n
380 help 381 help
381 Say Y here to include support for Sound Blaster AWE soundcards 382 Say Y here to include support for Sound Blaster AWE soundcards
382 (including the Plug and Play version). 383 (including the Plug and Play version).
@@ -384,6 +385,13 @@ config SND_SBAWE
384 To compile this driver as a module, choose M here: the module 385 To compile this driver as a module, choose M here: the module
385 will be called snd-sbawe. 386 will be called snd-sbawe.
386 387
388# select SEQ stuff to min(SND_SEQUENCER,SND_XXX)
389config SND_SBAWE_SEQ
390 def_tristate SND_SEQUENCER && SND_SBAWE
391 select SND_SEQ_MIDI_EMUL
392 select SND_SEQ_VIRMIDI
393 select SND_SYNTH_EMUX
394
387config SND_SB16_CSP 395config SND_SB16_CSP
388 bool "Sound Blaster 16/AWE CSP support" 396 bool "Sound Blaster 16/AWE CSP support"
389 depends on (SND_SB16 || SND_SBAWE) && (BROKEN || !PPC) 397 depends on (SND_SB16 || SND_SBAWE) && (BROKEN || !PPC)
diff --git a/sound/isa/cmi8328.c b/sound/isa/cmi8328.c
index 8e1756c3b9bb..d09e456107ad 100644
--- a/sound/isa/cmi8328.c
+++ b/sound/isa/cmi8328.c
@@ -26,7 +26,7 @@ MODULE_AUTHOR("Ondrej Zary <linux@rainbow-software.org>");
26MODULE_DESCRIPTION("C-Media CMI8328"); 26MODULE_DESCRIPTION("C-Media CMI8328");
27MODULE_LICENSE("GPL"); 27MODULE_LICENSE("GPL");
28 28
29#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE) 29#if IS_ENABLED(CONFIG_GAMEPORT)
30#define SUPPORT_JOYSTICK 1 30#define SUPPORT_JOYSTICK 1
31#endif 31#endif
32 32
diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c
index 2b7cc596f4c6..2012936f6756 100644
--- a/sound/isa/cs423x/cs4236_lib.c
+++ b/sound/isa/cs423x/cs4236_lib.c
@@ -138,7 +138,7 @@ static unsigned char snd_cs4236_ctrl_in(struct snd_wss *chip, unsigned char reg)
138 138
139#define CLOCKS 8 139#define CLOCKS 8
140 140
141static struct snd_ratnum clocks[CLOCKS] = { 141static const struct snd_ratnum clocks[CLOCKS] = {
142 { .num = 16934400, .den_min = 353, .den_max = 353, .den_step = 1 }, 142 { .num = 16934400, .den_min = 353, .den_max = 353, .den_step = 1 },
143 { .num = 16934400, .den_min = 529, .den_max = 529, .den_step = 1 }, 143 { .num = 16934400, .den_min = 529, .den_max = 529, .den_step = 1 },
144 { .num = 16934400, .den_min = 617, .den_max = 617, .den_step = 1 }, 144 { .num = 16934400, .den_min = 617, .den_max = 617, .den_step = 1 },
@@ -149,7 +149,7 @@ static struct snd_ratnum clocks[CLOCKS] = {
149 { .num = 16934400/16, .den_min = 21, .den_max = 192, .den_step = 1 } 149 { .num = 16934400/16, .den_min = 21, .den_max = 192, .den_step = 1 }
150}; 150};
151 151
152static struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = { 152static const struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = {
153 .nrats = CLOCKS, 153 .nrats = CLOCKS,
154 .rats = clocks, 154 .rats = clocks,
155}; 155};
diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c
index 81cf26fa28d6..5d3df96c5e5b 100644
--- a/sound/isa/es1688/es1688_lib.c
+++ b/sound/isa/es1688/es1688_lib.c
@@ -290,7 +290,7 @@ static int snd_es1688_init(struct snd_es1688 * chip, int enable)
290 290
291 */ 291 */
292 292
293static struct snd_ratnum clocks[2] = { 293static const struct snd_ratnum clocks[2] = {
294 { 294 {
295 .num = 795444, 295 .num = 795444,
296 .den_min = 1, 296 .den_min = 1,
@@ -305,7 +305,7 @@ static struct snd_ratnum clocks[2] = {
305 } 305 }
306}; 306};
307 307
308static struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = { 308static const struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = {
309 .nrats = 2, 309 .nrats = 2,
310 .rats = clocks, 310 .rats = clocks,
311}; 311};
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 0cabe2b8974f..ae17a6584061 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -369,7 +369,7 @@ static int snd_es18xx_reset_fifo(struct snd_es18xx *chip)
369 return 0; 369 return 0;
370} 370}
371 371
372static struct snd_ratnum new_clocks[2] = { 372static const struct snd_ratnum new_clocks[2] = {
373 { 373 {
374 .num = 793800, 374 .num = 793800,
375 .den_min = 1, 375 .den_min = 1,
@@ -384,12 +384,12 @@ static struct snd_ratnum new_clocks[2] = {
384 } 384 }
385}; 385};
386 386
387static struct snd_pcm_hw_constraint_ratnums new_hw_constraints_clocks = { 387static const struct snd_pcm_hw_constraint_ratnums new_hw_constraints_clocks = {
388 .nrats = 2, 388 .nrats = 2,
389 .rats = new_clocks, 389 .rats = new_clocks,
390}; 390};
391 391
392static struct snd_ratnum old_clocks[2] = { 392static const struct snd_ratnum old_clocks[2] = {
393 { 393 {
394 .num = 795444, 394 .num = 795444,
395 .den_min = 1, 395 .den_min = 1,
@@ -404,7 +404,7 @@ static struct snd_ratnum old_clocks[2] = {
404 } 404 }
405}; 405};
406 406
407static struct snd_pcm_hw_constraint_ratnums old_hw_constraints_clocks = { 407static const struct snd_pcm_hw_constraint_ratnums old_hw_constraints_clocks = {
408 .nrats = 2, 408 .nrats = 2,
409 .rats = old_clocks, 409 .rats = old_clocks,
410}; 410};
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c
index 4490ee442ff4..3cf9b13c780a 100644
--- a/sound/isa/gus/gus_main.c
+++ b/sound/isa/gus/gus_main.c
@@ -82,7 +82,7 @@ static int snd_gus_joystick_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
82 return change; 82 return change;
83} 83}
84 84
85static struct snd_kcontrol_new snd_gus_joystick_control = { 85static const struct snd_kcontrol_new snd_gus_joystick_control = {
86 .iface = SNDRV_CTL_ELEM_IFACE_CARD, 86 .iface = SNDRV_CTL_ELEM_IFACE_CARD,
87 .name = "Joystick Speed", 87 .name = "Joystick Speed",
88 .info = snd_gus_joystick_info, 88 .info = snd_gus_joystick_info,
diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c
index 06505999155f..6b3da01a93b7 100644
--- a/sound/isa/gus/gus_pcm.c
+++ b/sound/isa/gus/gus_pcm.c
@@ -61,8 +61,6 @@ struct gus_pcm_private {
61 int final_volume; 61 int final_volume;
62}; 62};
63 63
64static int snd_gf1_pcm_use_dma = 1;
65
66static void snd_gf1_pcm_block_change_ack(struct snd_gus_card * gus, void *private_data) 64static void snd_gf1_pcm_block_change_ack(struct snd_gus_card * gus, void *private_data)
67{ 65{
68 struct gus_pcm_private *pcmp = private_data; 66 struct gus_pcm_private *pcmp = private_data;
@@ -355,66 +353,83 @@ static int snd_gf1_pcm_poke_block(struct snd_gus_card *gus, unsigned char *buf,
355 return 0; 353 return 0;
356} 354}
357 355
358static int snd_gf1_pcm_playback_copy(struct snd_pcm_substream *substream, 356static int get_bpos(struct gus_pcm_private *pcmp, int voice, unsigned int pos,
359 int voice, 357 unsigned int len)
360 snd_pcm_uframes_t pos,
361 void __user *src,
362 snd_pcm_uframes_t count)
363{ 358{
364 struct snd_pcm_runtime *runtime = substream->runtime; 359 unsigned int bpos = pos + (voice * (pcmp->dma_size / 2));
365 struct gus_pcm_private *pcmp = runtime->private_data;
366 unsigned int bpos, len;
367
368 bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2));
369 len = samples_to_bytes(runtime, count);
370 if (snd_BUG_ON(bpos > pcmp->dma_size)) 360 if (snd_BUG_ON(bpos > pcmp->dma_size))
371 return -EIO; 361 return -EIO;
372 if (snd_BUG_ON(bpos + len > pcmp->dma_size)) 362 if (snd_BUG_ON(bpos + len > pcmp->dma_size))
373 return -EIO; 363 return -EIO;
364 return bpos;
365}
366
367static int playback_copy_ack(struct snd_pcm_substream *substream,
368 unsigned int bpos, unsigned int len)
369{
370 struct snd_pcm_runtime *runtime = substream->runtime;
371 struct gus_pcm_private *pcmp = runtime->private_data;
372 struct snd_gus_card *gus = pcmp->gus;
373 int w16, invert;
374
375 if (len > 32)
376 return snd_gf1_pcm_block_change(substream, bpos,
377 pcmp->memory + bpos, len);
378
379 w16 = (snd_pcm_format_width(runtime->format) == 16);
380 invert = snd_pcm_format_unsigned(runtime->format);
381 return snd_gf1_pcm_poke_block(gus, runtime->dma_area + bpos,
382 pcmp->memory + bpos, len, w16, invert);
383}
384
385static int snd_gf1_pcm_playback_copy(struct snd_pcm_substream *substream,
386 int voice, unsigned long pos,
387 void __user *src, unsigned long count)
388{
389 struct snd_pcm_runtime *runtime = substream->runtime;
390 struct gus_pcm_private *pcmp = runtime->private_data;
391 unsigned int len = count;
392 int bpos;
393
394 bpos = get_bpos(pcmp, voice, pos, len);
395 if (bpos < 0)
396 return pos;
374 if (copy_from_user(runtime->dma_area + bpos, src, len)) 397 if (copy_from_user(runtime->dma_area + bpos, src, len))
375 return -EFAULT; 398 return -EFAULT;
376 if (snd_gf1_pcm_use_dma && len > 32) { 399 return playback_copy_ack(substream, bpos, len);
377 return snd_gf1_pcm_block_change(substream, bpos, pcmp->memory + bpos, len); 400}
378 } else {
379 struct snd_gus_card *gus = pcmp->gus;
380 int err, w16, invert;
381 401
382 w16 = (snd_pcm_format_width(runtime->format) == 16); 402static int snd_gf1_pcm_playback_copy_kernel(struct snd_pcm_substream *substream,
383 invert = snd_pcm_format_unsigned(runtime->format); 403 int voice, unsigned long pos,
384 if ((err = snd_gf1_pcm_poke_block(gus, runtime->dma_area + bpos, pcmp->memory + bpos, len, w16, invert)) < 0) 404 void *src, unsigned long count)
385 return err; 405{
386 } 406 struct snd_pcm_runtime *runtime = substream->runtime;
387 return 0; 407 struct gus_pcm_private *pcmp = runtime->private_data;
408 unsigned int len = count;
409 int bpos;
410
411 bpos = get_bpos(pcmp, voice, pos, len);
412 if (bpos < 0)
413 return pos;
414 memcpy(runtime->dma_area + bpos, src, len);
415 return playback_copy_ack(substream, bpos, len);
388} 416}
389 417
390static int snd_gf1_pcm_playback_silence(struct snd_pcm_substream *substream, 418static int snd_gf1_pcm_playback_silence(struct snd_pcm_substream *substream,
391 int voice, 419 int voice, unsigned long pos,
392 snd_pcm_uframes_t pos, 420 unsigned long count)
393 snd_pcm_uframes_t count)
394{ 421{
395 struct snd_pcm_runtime *runtime = substream->runtime; 422 struct snd_pcm_runtime *runtime = substream->runtime;
396 struct gus_pcm_private *pcmp = runtime->private_data; 423 struct gus_pcm_private *pcmp = runtime->private_data;
397 unsigned int bpos, len; 424 unsigned int len = count;
425 int bpos;
398 426
399 bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2)); 427 bpos = get_bpos(pcmp, voice, pos, len);
400 len = samples_to_bytes(runtime, count); 428 if (bpos < 0)
401 if (snd_BUG_ON(bpos > pcmp->dma_size)) 429 return pos;
402 return -EIO; 430 snd_pcm_format_set_silence(runtime->format, runtime->dma_area + bpos,
403 if (snd_BUG_ON(bpos + len > pcmp->dma_size)) 431 bytes_to_samples(runtime, count));
404 return -EIO; 432 return playback_copy_ack(substream, bpos, len);
405 snd_pcm_format_set_silence(runtime->format, runtime->dma_area + bpos, count);
406 if (snd_gf1_pcm_use_dma && len > 32) {
407 return snd_gf1_pcm_block_change(substream, bpos, pcmp->memory + bpos, len);
408 } else {
409 struct snd_gus_card *gus = pcmp->gus;
410 int err, w16, invert;
411
412 w16 = (snd_pcm_format_width(runtime->format) == 16);
413 invert = snd_pcm_format_unsigned(runtime->format);
414 if ((err = snd_gf1_pcm_poke_block(gus, runtime->dma_area + bpos, pcmp->memory + bpos, len, w16, invert)) < 0)
415 return err;
416 }
417 return 0;
418} 433}
419 434
420static int snd_gf1_pcm_playback_hw_params(struct snd_pcm_substream *substream, 435static int snd_gf1_pcm_playback_hw_params(struct snd_pcm_substream *substream,
@@ -547,14 +562,14 @@ static snd_pcm_uframes_t snd_gf1_pcm_playback_pointer(struct snd_pcm_substream *
547 return pos; 562 return pos;
548} 563}
549 564
550static struct snd_ratnum clock = { 565static const struct snd_ratnum clock = {
551 .num = 9878400/16, 566 .num = 9878400/16,
552 .den_min = 2, 567 .den_min = 2,
553 .den_max = 257, 568 .den_max = 257,
554 .den_step = 1, 569 .den_step = 1,
555}; 570};
556 571
557static struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = { 572static const struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = {
558 .nrats = 1, 573 .nrats = 1,
559 .rats = &clock, 574 .rats = &clock,
560}; 575};
@@ -809,7 +824,7 @@ static int snd_gf1_pcm_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
809 return change; 824 return change;
810} 825}
811 826
812static struct snd_kcontrol_new snd_gf1_pcm_volume_control = 827static const struct snd_kcontrol_new snd_gf1_pcm_volume_control =
813{ 828{
814 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 829 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
815 .name = "PCM Playback Volume", 830 .name = "PCM Playback Volume",
@@ -818,7 +833,7 @@ static struct snd_kcontrol_new snd_gf1_pcm_volume_control =
818 .put = snd_gf1_pcm_volume_put 833 .put = snd_gf1_pcm_volume_put
819}; 834};
820 835
821static struct snd_kcontrol_new snd_gf1_pcm_volume_control1 = 836static const struct snd_kcontrol_new snd_gf1_pcm_volume_control1 =
822{ 837{
823 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 838 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
824 .name = "GPCM Playback Volume", 839 .name = "GPCM Playback Volume",
@@ -836,8 +851,9 @@ static struct snd_pcm_ops snd_gf1_pcm_playback_ops = {
836 .prepare = snd_gf1_pcm_playback_prepare, 851 .prepare = snd_gf1_pcm_playback_prepare,
837 .trigger = snd_gf1_pcm_playback_trigger, 852 .trigger = snd_gf1_pcm_playback_trigger,
838 .pointer = snd_gf1_pcm_playback_pointer, 853 .pointer = snd_gf1_pcm_playback_pointer,
839 .copy = snd_gf1_pcm_playback_copy, 854 .copy_user = snd_gf1_pcm_playback_copy,
840 .silence = snd_gf1_pcm_playback_silence, 855 .copy_kernel = snd_gf1_pcm_playback_copy_kernel,
856 .fill_silence = snd_gf1_pcm_playback_silence,
841}; 857};
842 858
843static struct snd_pcm_ops snd_gf1_pcm_capture_ops = { 859static struct snd_pcm_ops snd_gf1_pcm_capture_ops = {
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c
index ec180708f160..d56973b770c7 100644
--- a/sound/isa/sb/emu8000.c
+++ b/sound/isa/sb/emu8000.c
@@ -1138,7 +1138,7 @@ snd_emu8000_new(struct snd_card *card, int index, long port, int seq_ports,
1138 snd_emu8000_free(hw); 1138 snd_emu8000_free(hw);
1139 return err; 1139 return err;
1140 } 1140 }
1141#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) 1141#if IS_ENABLED(CONFIG_SND_SEQUENCER)
1142 if (snd_seq_device_new(card, index, SNDRV_SEQ_DEV_ID_EMU8000, 1142 if (snd_seq_device_new(card, index, SNDRV_SEQ_DEV_ID_EMU8000,
1143 sizeof(struct snd_emu8000*), &awe) >= 0) { 1143 sizeof(struct snd_emu8000*), &awe) >= 0) {
1144 strcpy(awe->name, "EMU-8000"); 1144 strcpy(awe->name, "EMU-8000");
diff --git a/sound/isa/sb/emu8000_callback.c b/sound/isa/sb/emu8000_callback.c
index 72a9ac5efb40..d28d712f99f4 100644
--- a/sound/isa/sb/emu8000_callback.c
+++ b/sound/isa/sb/emu8000_callback.c
@@ -36,7 +36,7 @@ static void reset_voice(struct snd_emux *emu, int ch);
36static void terminate_voice(struct snd_emux_voice *vp); 36static void terminate_voice(struct snd_emux_voice *vp);
37static void sysex(struct snd_emux *emu, char *buf, int len, int parsed, 37static void sysex(struct snd_emux *emu, char *buf, int len, int parsed,
38 struct snd_midi_channel_set *chset); 38 struct snd_midi_channel_set *chset);
39#ifdef CONFIG_SND_SEQUENCER_OSS 39#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
40static int oss_ioctl(struct snd_emux *emu, int cmd, int p1, int p2); 40static int oss_ioctl(struct snd_emux *emu, int cmd, int p1, int p2);
41#endif 41#endif
42static int load_fx(struct snd_emux *emu, int type, int mode, 42static int load_fx(struct snd_emux *emu, int type, int mode,
@@ -76,7 +76,7 @@ static struct snd_emux_operators emu8000_ops = {
76 .sample_reset = snd_emu8000_sample_reset, 76 .sample_reset = snd_emu8000_sample_reset,
77 .load_fx = load_fx, 77 .load_fx = load_fx,
78 .sysex = sysex, 78 .sysex = sysex,
79#ifdef CONFIG_SND_SEQUENCER_OSS 79#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
80 .oss_ioctl = oss_ioctl, 80 .oss_ioctl = oss_ioctl,
81#endif 81#endif
82}; 82};
@@ -477,7 +477,7 @@ sysex(struct snd_emux *emu, char *buf, int len, int parsed, struct snd_midi_chan
477} 477}
478 478
479 479
480#ifdef CONFIG_SND_SEQUENCER_OSS 480#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
481/* 481/*
482 * OSS ioctl callback 482 * OSS ioctl callback
483 */ 483 */
diff --git a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c
index 32f234f494e5..2ee8d67871ec 100644
--- a/sound/isa/sb/emu8000_pcm.c
+++ b/sound/isa/sb/emu8000_pcm.c
@@ -422,143 +422,148 @@ do { \
422 return -EAGAIN;\ 422 return -EAGAIN;\
423} while (0) 423} while (0)
424 424
425enum {
426 COPY_USER, COPY_KERNEL, FILL_SILENCE,
427};
428
429#define GET_VAL(sval, buf, mode) \
430 do { \
431 switch (mode) { \
432 case FILL_SILENCE: \
433 sval = 0; \
434 break; \
435 case COPY_KERNEL: \
436 sval = *buf++; \
437 break; \
438 default: \
439 if (get_user(sval, (unsigned short __user *)buf)) \
440 return -EFAULT; \
441 buf++; \
442 break; \
443 } \
444 } while (0)
425 445
426#ifdef USE_NONINTERLEAVE 446#ifdef USE_NONINTERLEAVE
447
448#define LOOP_WRITE(rec, offset, _buf, count, mode) \
449 do { \
450 struct snd_emu8000 *emu = (rec)->emu; \
451 unsigned short *buf = (unsigned short *)(_buf); \
452 snd_emu8000_write_wait(emu, 1); \
453 EMU8000_SMALW_WRITE(emu, offset); \
454 while (count > 0) { \
455 unsigned short sval; \
456 CHECK_SCHEDULER(); \
457 GET_VAL(sval, buf, mode); \
458 EMU8000_SMLD_WRITE(emu, sval); \
459 count--; \
460 } \
461 } while (0)
462
427/* copy one channel block */ 463/* copy one channel block */
428static int emu8k_transfer_block(struct snd_emu8000 *emu, int offset, unsigned short *buf, int count) 464static int emu8k_pcm_copy(struct snd_pcm_substream *subs,
465 int voice, unsigned long pos,
466 void __user *src, unsigned long count)
429{ 467{
430 EMU8000_SMALW_WRITE(emu, offset); 468 struct snd_emu8k_pcm *rec = subs->runtime->private_data;
431 while (count > 0) { 469
432 unsigned short sval; 470 /* convert to word unit */
433 CHECK_SCHEDULER(); 471 pos = (pos << 1) + rec->loop_start[voice];
434 if (get_user(sval, buf)) 472 count <<= 1;
435 return -EFAULT; 473 LOOP_WRITE(rec, pos, src, count, COPY_UESR);
436 EMU8000_SMLD_WRITE(emu, sval);
437 buf++;
438 count--;
439 }
440 return 0; 474 return 0;
441} 475}
442 476
443static int emu8k_pcm_copy(struct snd_pcm_substream *subs, 477static int emu8k_pcm_copy_kernel(struct snd_pcm_substream *subs,
444 int voice, 478 int voice, unsigned long pos,
445 snd_pcm_uframes_t pos, 479 void *src, unsigned long count)
446 void *src,
447 snd_pcm_uframes_t count)
448{ 480{
449 struct snd_emu8k_pcm *rec = subs->runtime->private_data; 481 struct snd_emu8k_pcm *rec = subs->runtime->private_data;
450 struct snd_emu8000 *emu = rec->emu;
451
452 snd_emu8000_write_wait(emu, 1);
453 if (voice == -1) {
454 unsigned short *buf = src;
455 int i, err;
456 count /= rec->voices;
457 for (i = 0; i < rec->voices; i++) {
458 err = emu8k_transfer_block(emu, pos + rec->loop_start[i], buf, count);
459 if (err < 0)
460 return err;
461 buf += count;
462 }
463 return 0;
464 } else {
465 return emu8k_transfer_block(emu, pos + rec->loop_start[voice], src, count);
466 }
467}
468 482
469/* make a channel block silence */ 483 /* convert to word unit */
470static int emu8k_silence_block(struct snd_emu8000 *emu, int offset, int count) 484 pos = (pos << 1) + rec->loop_start[voice];
471{ 485 count <<= 1;
472 EMU8000_SMALW_WRITE(emu, offset); 486 LOOP_WRITE(rec, pos, src, count, COPY_KERNEL);
473 while (count > 0) {
474 CHECK_SCHEDULER();
475 EMU8000_SMLD_WRITE(emu, 0);
476 count--;
477 }
478 return 0; 487 return 0;
479} 488}
480 489
490/* make a channel block silence */
481static int emu8k_pcm_silence(struct snd_pcm_substream *subs, 491static int emu8k_pcm_silence(struct snd_pcm_substream *subs,
482 int voice, 492 int voice, unsigned long pos, unsigned long count)
483 snd_pcm_uframes_t pos,
484 snd_pcm_uframes_t count)
485{ 493{
486 struct snd_emu8k_pcm *rec = subs->runtime->private_data; 494 struct snd_emu8k_pcm *rec = subs->runtime->private_data;
487 struct snd_emu8000 *emu = rec->emu; 495
488 496 /* convert to word unit */
489 snd_emu8000_write_wait(emu, 1); 497 pos = (pos << 1) + rec->loop_start[voice];
490 if (voice == -1 && rec->voices == 1) 498 count <<= 1;
491 voice = 0; 499 LOOP_WRITE(rec, pos, NULL, count, FILL_SILENCE);
492 if (voice == -1) { 500 return 0;
493 int err;
494 err = emu8k_silence_block(emu, pos + rec->loop_start[0], count / 2);
495 if (err < 0)
496 return err;
497 return emu8k_silence_block(emu, pos + rec->loop_start[1], count / 2);
498 } else {
499 return emu8k_silence_block(emu, pos + rec->loop_start[voice], count);
500 }
501} 501}
502 502
503#else /* interleave */ 503#else /* interleave */
504 504
505#define LOOP_WRITE(rec, pos, _buf, count, mode) \
506 do { \
507 struct snd_emu8000 *emu = rec->emu; \
508 unsigned short *buf = (unsigned short *)(_buf); \
509 snd_emu8000_write_wait(emu, 1); \
510 EMU8000_SMALW_WRITE(emu, pos + rec->loop_start[0]); \
511 if (rec->voices > 1) \
512 EMU8000_SMARW_WRITE(emu, pos + rec->loop_start[1]); \
513 while (count > 0) { \
514 unsigned short sval; \
515 CHECK_SCHEDULER(); \
516 GET_VAL(sval, buf, mode); \
517 EMU8000_SMLD_WRITE(emu, sval); \
518 if (rec->voices > 1) { \
519 CHECK_SCHEDULER(); \
520 GET_VAL(sval, buf, mode); \
521 EMU8000_SMRD_WRITE(emu, sval); \
522 } \
523 count--; \
524 } \
525 } while (0)
526
527
505/* 528/*
506 * copy the interleaved data can be done easily by using 529 * copy the interleaved data can be done easily by using
507 * DMA "left" and "right" channels on emu8k engine. 530 * DMA "left" and "right" channels on emu8k engine.
508 */ 531 */
509static int emu8k_pcm_copy(struct snd_pcm_substream *subs, 532static int emu8k_pcm_copy(struct snd_pcm_substream *subs,
510 int voice, 533 int voice, unsigned long pos,
511 snd_pcm_uframes_t pos, 534 void __user *src, unsigned long count)
512 void __user *src,
513 snd_pcm_uframes_t count)
514{ 535{
515 struct snd_emu8k_pcm *rec = subs->runtime->private_data; 536 struct snd_emu8k_pcm *rec = subs->runtime->private_data;
516 struct snd_emu8000 *emu = rec->emu;
517 unsigned short __user *buf = src;
518 537
519 snd_emu8000_write_wait(emu, 1); 538 /* convert to frames */
520 EMU8000_SMALW_WRITE(emu, pos + rec->loop_start[0]); 539 pos = bytes_to_frames(subs->runtime, pos);
521 if (rec->voices > 1) 540 count = bytes_to_frames(subs->runtime, count);
522 EMU8000_SMARW_WRITE(emu, pos + rec->loop_start[1]); 541 LOOP_WRITE(rec, pos, src, count, COPY_USER);
523 542 return 0;
524 while (count-- > 0) { 543}
525 unsigned short sval; 544
526 CHECK_SCHEDULER(); 545static int emu8k_pcm_copy_kernel(struct snd_pcm_substream *subs,
527 if (get_user(sval, buf)) 546 int voice, unsigned long pos,
528 return -EFAULT; 547 void *src, unsigned long count)
529 EMU8000_SMLD_WRITE(emu, sval); 548{
530 buf++; 549 struct snd_emu8k_pcm *rec = subs->runtime->private_data;
531 if (rec->voices > 1) { 550
532 CHECK_SCHEDULER(); 551 /* convert to frames */
533 if (get_user(sval, buf)) 552 pos = bytes_to_frames(subs->runtime, pos);
534 return -EFAULT; 553 count = bytes_to_frames(subs->runtime, count);
535 EMU8000_SMRD_WRITE(emu, sval); 554 LOOP_WRITE(rec, pos, src, count, COPY_KERNEL);
536 buf++;
537 }
538 }
539 return 0; 555 return 0;
540} 556}
541 557
542static int emu8k_pcm_silence(struct snd_pcm_substream *subs, 558static int emu8k_pcm_silence(struct snd_pcm_substream *subs,
543 int voice, 559 int voice, unsigned long pos, unsigned long count)
544 snd_pcm_uframes_t pos,
545 snd_pcm_uframes_t count)
546{ 560{
547 struct snd_emu8k_pcm *rec = subs->runtime->private_data; 561 struct snd_emu8k_pcm *rec = subs->runtime->private_data;
548 struct snd_emu8000 *emu = rec->emu;
549 562
550 snd_emu8000_write_wait(emu, 1); 563 /* convert to frames */
551 EMU8000_SMALW_WRITE(emu, rec->loop_start[0] + pos); 564 pos = bytes_to_frames(subs->runtime, pos);
552 if (rec->voices > 1) 565 count = bytes_to_frames(subs->runtime, count);
553 EMU8000_SMARW_WRITE(emu, rec->loop_start[1] + pos); 566 LOOP_WRITE(rec, pos, NULL, count, FILL_SILENCE);
554 while (count-- > 0) {
555 CHECK_SCHEDULER();
556 EMU8000_SMLD_WRITE(emu, 0);
557 if (rec->voices > 1) {
558 CHECK_SCHEDULER();
559 EMU8000_SMRD_WRITE(emu, 0);
560 }
561 }
562 return 0; 567 return 0;
563} 568}
564#endif 569#endif
@@ -674,8 +679,9 @@ static struct snd_pcm_ops emu8k_pcm_ops = {
674 .prepare = emu8k_pcm_prepare, 679 .prepare = emu8k_pcm_prepare,
675 .trigger = emu8k_pcm_trigger, 680 .trigger = emu8k_pcm_trigger,
676 .pointer = emu8k_pcm_pointer, 681 .pointer = emu8k_pcm_pointer,
677 .copy = emu8k_pcm_copy, 682 .copy_user = emu8k_pcm_copy,
678 .silence = emu8k_pcm_silence, 683 .copy_kernel = emu8k_pcm_copy_kernel,
684 .fill_silence = emu8k_pcm_silence,
679}; 685};
680 686
681 687
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 3b2e4f405ff2..917a93d696c3 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -62,7 +62,7 @@ MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB AWE 32},"
62#define SNDRV_DEBUG_IRQ 62#define SNDRV_DEBUG_IRQ
63#endif 63#endif
64 64
65#if defined(SNDRV_SBAWE) && (defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))) 65#if defined(SNDRV_SBAWE) && IS_ENABLED(CONFIG_SND_SEQUENCER)
66#define SNDRV_SBAWE_EMU8000 66#define SNDRV_SBAWE_EMU8000
67#endif 67#endif
68 68
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c
index 48da2276683d..fa5780bb0c68 100644
--- a/sound/isa/sb/sb16_csp.c
+++ b/sound/isa/sb/sb16_csp.c
@@ -1029,7 +1029,7 @@ static int snd_sb_qsound_space_put(struct snd_kcontrol *kcontrol, struct snd_ctl
1029 return change; 1029 return change;
1030} 1030}
1031 1031
1032static struct snd_kcontrol_new snd_sb_qsound_switch = { 1032static const struct snd_kcontrol_new snd_sb_qsound_switch = {
1033 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1033 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1034 .name = "3D Control - Switch", 1034 .name = "3D Control - Switch",
1035 .info = snd_sb_qsound_switch_info, 1035 .info = snd_sb_qsound_switch_info,
@@ -1037,7 +1037,7 @@ static struct snd_kcontrol_new snd_sb_qsound_switch = {
1037 .put = snd_sb_qsound_switch_put 1037 .put = snd_sb_qsound_switch_put
1038}; 1038};
1039 1039
1040static struct snd_kcontrol_new snd_sb_qsound_space = { 1040static const struct snd_kcontrol_new snd_sb_qsound_space = {
1041 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1041 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1042 .name = "3D Control - Space", 1042 .name = "3D Control - Space",
1043 .info = snd_sb_qsound_space_info, 1043 .info = snd_sb_qsound_space_info,
diff --git a/sound/isa/sb/sb16_main.c b/sound/isa/sb/sb16_main.c
index 8b2d6c6bfe97..4be1350f6649 100644
--- a/sound/isa/sb/sb16_main.c
+++ b/sound/isa/sb/sb16_main.c
@@ -737,7 +737,7 @@ static int snd_sb16_dma_control_put(struct snd_kcontrol *kcontrol, struct snd_ct
737 return change; 737 return change;
738} 738}
739 739
740static struct snd_kcontrol_new snd_sb16_dma_control = { 740static const struct snd_kcontrol_new snd_sb16_dma_control = {
741 .iface = SNDRV_CTL_ELEM_IFACE_CARD, 741 .iface = SNDRV_CTL_ELEM_IFACE_CARD,
742 .name = "16-bit DMA Allocation", 742 .name = "16-bit DMA Allocation",
743 .info = snd_sb16_dma_control_info, 743 .info = snd_sb16_dma_control_info,
diff --git a/sound/isa/sb/sb8_main.c b/sound/isa/sb/sb8_main.c
index 9043397fe62f..0f302be4fb6d 100644
--- a/sound/isa/sb/sb8_main.c
+++ b/sound/isa/sb/sb8_main.c
@@ -46,19 +46,19 @@ MODULE_LICENSE("GPL");
46#define SB8_DEN(v) ((SB8_CLOCK + (v) / 2) / (v)) 46#define SB8_DEN(v) ((SB8_CLOCK + (v) / 2) / (v))
47#define SB8_RATE(v) (SB8_CLOCK / SB8_DEN(v)) 47#define SB8_RATE(v) (SB8_CLOCK / SB8_DEN(v))
48 48
49static struct snd_ratnum clock = { 49static const struct snd_ratnum clock = {
50 .num = SB8_CLOCK, 50 .num = SB8_CLOCK,
51 .den_min = 1, 51 .den_min = 1,
52 .den_max = 256, 52 .den_max = 256,
53 .den_step = 1, 53 .den_step = 1,
54}; 54};
55 55
56static struct snd_pcm_hw_constraint_ratnums hw_constraints_clock = { 56static const struct snd_pcm_hw_constraint_ratnums hw_constraints_clock = {
57 .nrats = 1, 57 .nrats = 1,
58 .rats = &clock, 58 .rats = &clock,
59}; 59};
60 60
61static struct snd_ratnum stereo_clocks[] = { 61static const struct snd_ratnum stereo_clocks[] = {
62 { 62 {
63 .num = SB8_CLOCK, 63 .num = SB8_CLOCK,
64 .den_min = SB8_DEN(22050), 64 .den_min = SB8_DEN(22050),
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index 54f5758a1bb3..1cd2908e4f12 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -671,7 +671,7 @@ __skip_change:
671 return change; 671 return change;
672} 672}
673 673
674static struct snd_kcontrol_new midi_mixer_ctl = { 674static const struct snd_kcontrol_new midi_mixer_ctl = {
675 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 675 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
676 .name = "MIDI", 676 .name = "MIDI",
677 .info = sscape_midi_info, 677 .info = sscape_midi_info,
diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c
index 913b731d2236..9f4e2e34cbe1 100644
--- a/sound/isa/wss/wss_lib.c
+++ b/sound/isa/wss/wss_lib.c
@@ -69,12 +69,12 @@ static unsigned char freq_bits[14] = {
69 /* 48000 */ 0x0C | CS4231_XTAL1 69 /* 48000 */ 0x0C | CS4231_XTAL1
70}; 70};
71 71
72static unsigned int rates[14] = { 72static const unsigned int rates[14] = {
73 5510, 6620, 8000, 9600, 11025, 16000, 18900, 22050, 73 5510, 6620, 8000, 9600, 11025, 16000, 18900, 22050,
74 27042, 32000, 33075, 37800, 44100, 48000 74 27042, 32000, 33075, 37800, 44100, 48000
75}; 75};
76 76
77static struct snd_pcm_hw_constraint_list hw_constraints_rates = { 77static const struct snd_pcm_hw_constraint_list hw_constraints_rates = {
78 .count = ARRAY_SIZE(rates), 78 .count = ARRAY_SIZE(rates),
79 .list = rates, 79 .list = rates,
80 .mask = 0, 80 .mask = 0,