summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2017-01-10 11:39:52 -0500
committerMark Brown <broonie@kernel.org>2017-01-10 11:39:52 -0500
commit9c1852b459f04f6309e40d1d167512b0a5598529 (patch)
treea74526f1fe3f9826b81327f0b9ba9b98a543f87c /sound
parent9b41da80e09128574f09bed8dc5a5fc6f72a8239 (diff)
parent7ce7d89f48834cefece7804d38fc5d85382edf77 (diff)
Merge tag 'v4.10-rc1' into asoc-samsung
Linux 4.10-rc1
Diffstat (limited to 'sound')
-rw-r--r--sound/core/hrtimer.c2
-rw-r--r--sound/core/misc.c20
-rw-r--r--sound/core/oss/pcm_oss.c2
-rw-r--r--sound/core/rawmidi.c4
-rw-r--r--sound/drivers/opl3/opl3_lib.c2
-rw-r--r--sound/drivers/pcsp/pcsp_lib.c2
-rw-r--r--sound/firewire/bebob/bebob.c4
-rw-r--r--sound/firewire/lib.c6
-rw-r--r--sound/hda/hdac_i915.c18
-rw-r--r--sound/hda/hdac_stream.c6
-rw-r--r--sound/oss/dmasound/dmasound_atari.c2
-rw-r--r--sound/oss/dmasound/dmasound_core.c2
-rw-r--r--sound/oss/dmasound/dmasound_paula.c2
-rw-r--r--sound/oss/dmasound/dmasound_q40.c2
-rw-r--r--sound/oss/msnd.c2
-rw-r--r--sound/oss/os.h2
-rw-r--r--sound/oss/swarm_cs4297a.c2
-rw-r--r--sound/pci/ac97/ac97_codec.c2
-rw-r--r--sound/pci/als4000.c2
-rw-r--r--sound/pci/au88x0/au88x0_game.c2
-rw-r--r--sound/pci/azt3328.c2
-rw-r--r--sound/pci/cmipci.c2
-rw-r--r--sound/pci/cs4281.c2
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c2
-rw-r--r--sound/pci/cs46xx/dsp_spos.c3
-rw-r--r--sound/pci/echoaudio/layla24_dsp.c2
-rw-r--r--sound/pci/emu10k1/emu10k1.c11
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c228
-rw-r--r--sound/pci/ens1370.c2
-rw-r--r--sound/pci/es1938.c2
-rw-r--r--sound/pci/es1968.c2
-rw-r--r--sound/pci/hda/hda_auto_parser.c4
-rw-r--r--sound/pci/hda/patch_ca0132.c1
-rw-r--r--sound/pci/hda/patch_conexant.c17
-rw-r--r--sound/pci/hda/patch_hdmi.c7
-rw-r--r--sound/pci/hda/patch_realtek.c46
-rw-r--r--sound/pci/riptide/riptide.c2
-rw-r--r--sound/pci/sonicvibes.c2
-rw-r--r--sound/pci/trident/trident_main.c2
-rw-r--r--sound/pci/via82xx.c2
-rw-r--r--sound/pci/ymfpci/ymfpci.h2
-rw-r--r--sound/sh/sh_dac_audio.c2
-rw-r--r--sound/soc/codecs/hdac_hdmi.c2
-rw-r--r--sound/usb/card.c1
-rw-r--r--sound/usb/endpoint.c20
-rw-r--r--sound/usb/hiface/pcm.c2
-rw-r--r--sound/usb/line6/driver.h9
-rw-r--r--sound/usb/line6/podhd.c26
-rw-r--r--sound/usb/mixer.c3
-rw-r--r--sound/usb/pcm.c31
-rw-r--r--sound/usb/quirks.c38
51 files changed, 351 insertions, 212 deletions
diff --git a/sound/core/hrtimer.c b/sound/core/hrtimer.c
index e2f27022b363..1ac0c423903e 100644
--- a/sound/core/hrtimer.c
+++ b/sound/core/hrtimer.c
@@ -58,7 +58,7 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
58 58
59 /* calculate the drift */ 59 /* calculate the drift */
60 delta = ktime_sub(hrt->base->get_time(), hrtimer_get_expires(hrt)); 60 delta = ktime_sub(hrt->base->get_time(), hrtimer_get_expires(hrt));
61 if (delta.tv64 > 0) 61 if (delta > 0)
62 ticks += ktime_divns(delta, ticks * resolution); 62 ticks += ktime_divns(delta, ticks * resolution);
63 63
64 snd_timer_interrupt(stime->timer, ticks); 64 snd_timer_interrupt(stime->timer, ticks);
diff --git a/sound/core/misc.c b/sound/core/misc.c
index f2e8226c88fb..21b228046e88 100644
--- a/sound/core/misc.c
+++ b/sound/core/misc.c
@@ -71,6 +71,7 @@ void __snd_printk(unsigned int level, const char *path, int line,
71 int kern_level; 71 int kern_level;
72 struct va_format vaf; 72 struct va_format vaf;
73 char verbose_fmt[] = KERN_DEFAULT "ALSA %s:%d %pV"; 73 char verbose_fmt[] = KERN_DEFAULT "ALSA %s:%d %pV";
74 bool level_found = false;
74#endif 75#endif
75 76
76#ifdef CONFIG_SND_DEBUG 77#ifdef CONFIG_SND_DEBUG
@@ -83,15 +84,22 @@ void __snd_printk(unsigned int level, const char *path, int line,
83 vaf.fmt = format; 84 vaf.fmt = format;
84 vaf.va = &args; 85 vaf.va = &args;
85 86
86 kern_level = printk_get_level(format); 87 while ((kern_level = printk_get_level(vaf.fmt)) != 0) {
87 if (kern_level) { 88 const char *end_of_header = printk_skip_level(vaf.fmt);
88 const char *end_of_header = printk_skip_level(format); 89
89 memcpy(verbose_fmt, format, end_of_header - format); 90 /* Ignore KERN_CONT. We print filename:line for each piece. */
91 if (kern_level >= '0' && kern_level <= '7') {
92 memcpy(verbose_fmt, vaf.fmt, end_of_header - vaf.fmt);
93 level_found = true;
94 }
95
90 vaf.fmt = end_of_header; 96 vaf.fmt = end_of_header;
91 } else if (level) 97 }
98
99 if (!level_found && level)
92 memcpy(verbose_fmt, KERN_DEBUG, sizeof(KERN_DEBUG) - 1); 100 memcpy(verbose_fmt, KERN_DEBUG, sizeof(KERN_DEBUG) - 1);
93 printk(verbose_fmt, sanity_file_name(path), line, &vaf);
94 101
102 printk(verbose_fmt, sanity_file_name(path), line, &vaf);
95#else 103#else
96 vprintk(format, args); 104 vprintk(format, args);
97#endif 105#endif
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index ebc9fdfe64df..698a01419515 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -2501,7 +2501,7 @@ static long snd_pcm_oss_ioctl(struct file *file, unsigned int cmd, unsigned long
2501 return put_user(SNDRV_OSS_VERSION, p); 2501 return put_user(SNDRV_OSS_VERSION, p);
2502 if (cmd == OSS_ALSAEMULVER) 2502 if (cmd == OSS_ALSAEMULVER)
2503 return put_user(1, p); 2503 return put_user(1, p);
2504#if defined(CONFIG_SND_MIXER_OSS) || (defined(MODULE) && defined(CONFIG_SND_MIXER_OSS_MODULE)) 2504#if IS_REACHABLE(CONFIG_SND_MIXER_OSS)
2505 if (((cmd >> 8) & 0xff) == 'M') { /* mixer ioctl - for OSS compatibility */ 2505 if (((cmd >> 8) & 0xff) == 'M') { /* mixer ioctl - for OSS compatibility */
2506 struct snd_pcm_substream *substream; 2506 struct snd_pcm_substream *substream;
2507 int idx; 2507 int idx;
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index b450a27588c8..2096bb0835c8 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -1610,7 +1610,7 @@ static int snd_rawmidi_dev_free(struct snd_device *device)
1610 return snd_rawmidi_free(rmidi); 1610 return snd_rawmidi_free(rmidi);
1611} 1611}
1612 1612
1613#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) 1613#if IS_REACHABLE(CONFIG_SND_SEQUENCER)
1614static void snd_rawmidi_dev_seq_free(struct snd_seq_device *device) 1614static void snd_rawmidi_dev_seq_free(struct snd_seq_device *device)
1615{ 1615{
1616 struct snd_rawmidi *rmidi = device->private_data; 1616 struct snd_rawmidi *rmidi = device->private_data;
@@ -1691,7 +1691,7 @@ static int snd_rawmidi_dev_register(struct snd_device *device)
1691 } 1691 }
1692 } 1692 }
1693 rmidi->proc_entry = entry; 1693 rmidi->proc_entry = entry;
1694#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) 1694#if IS_REACHABLE(CONFIG_SND_SEQUENCER)
1695 if (!rmidi->ops || !rmidi->ops->dev_register) { /* own registration mechanism */ 1695 if (!rmidi->ops || !rmidi->ops->dev_register) { /* own registration mechanism */
1696 if (snd_seq_device_new(rmidi->card, rmidi->device, SNDRV_SEQ_DEV_ID_MIDISYNTH, 0, &rmidi->seq_dev) >= 0) { 1696 if (snd_seq_device_new(rmidi->card, rmidi->device, SNDRV_SEQ_DEV_ID_MIDISYNTH, 0, &rmidi->seq_dev) >= 0) {
1697 rmidi->seq_dev->private_data = rmidi; 1697 rmidi->seq_dev->private_data = rmidi;
diff --git a/sound/drivers/opl3/opl3_lib.c b/sound/drivers/opl3/opl3_lib.c
index 369cef212ea9..cd9e9f31720f 100644
--- a/sound/drivers/opl3/opl3_lib.c
+++ b/sound/drivers/opl3/opl3_lib.c
@@ -528,7 +528,7 @@ int snd_opl3_hwdep_new(struct snd_opl3 * opl3,
528 528
529 opl3->hwdep = hw; 529 opl3->hwdep = hw;
530 opl3->seq_dev_num = seq_device; 530 opl3->seq_dev_num = seq_device;
531#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) 531#if IS_REACHABLE(CONFIG_SND_SEQUENCER)
532 if (snd_seq_device_new(card, seq_device, SNDRV_SEQ_DEV_ID_OPL3, 532 if (snd_seq_device_new(card, seq_device, SNDRV_SEQ_DEV_ID_OPL3,
533 sizeof(struct snd_opl3 *), &opl3->seq_dev) >= 0) { 533 sizeof(struct snd_opl3 *), &opl3->seq_dev) >= 0) {
534 strcpy(opl3->seq_dev->name, hw->name); 534 strcpy(opl3->seq_dev->name, hw->name);
diff --git a/sound/drivers/pcsp/pcsp_lib.c b/sound/drivers/pcsp/pcsp_lib.c
index 3689f5f6be64..aca2d7d5f059 100644
--- a/sound/drivers/pcsp/pcsp_lib.c
+++ b/sound/drivers/pcsp/pcsp_lib.c
@@ -166,7 +166,7 @@ static int pcsp_start_playing(struct snd_pcsp *chip)
166 atomic_set(&chip->timer_active, 1); 166 atomic_set(&chip->timer_active, 1);
167 chip->thalf = 0; 167 chip->thalf = 0;
168 168
169 hrtimer_start(&pcsp_chip.timer, ktime_set(0, 0), HRTIMER_MODE_REL); 169 hrtimer_start(&pcsp_chip.timer, 0, HRTIMER_MODE_REL);
170 return 0; 170 return 0;
171} 171}
172 172
diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c
index 3469ac14c89c..730ea91d9be8 100644
--- a/sound/firewire/bebob/bebob.c
+++ b/sound/firewire/bebob/bebob.c
@@ -172,12 +172,12 @@ get_saffire_spec(struct fw_unit *unit)
172static bool 172static bool
173check_audiophile_booted(struct fw_unit *unit) 173check_audiophile_booted(struct fw_unit *unit)
174{ 174{
175 char name[24] = {0}; 175 char name[28] = {0};
176 176
177 if (fw_csr_string(unit->directory, CSR_MODEL, name, sizeof(name)) < 0) 177 if (fw_csr_string(unit->directory, CSR_MODEL, name, sizeof(name)) < 0)
178 return false; 178 return false;
179 179
180 return strncmp(name, "FW Audiophile Bootloader", 15) != 0; 180 return strncmp(name, "FW Audiophile Bootloader", 24) != 0;
181} 181}
182 182
183static void 183static void
diff --git a/sound/firewire/lib.c b/sound/firewire/lib.c
index ca4dfcf43175..7683238283b6 100644
--- a/sound/firewire/lib.c
+++ b/sound/firewire/lib.c
@@ -114,7 +114,7 @@ static void async_midi_port_callback(struct fw_card *card, int rcode,
114 snd_rawmidi_transmit_ack(substream, port->consume_bytes); 114 snd_rawmidi_transmit_ack(substream, port->consume_bytes);
115 else if (!rcode_is_permanent_error(rcode)) 115 else if (!rcode_is_permanent_error(rcode))
116 /* To start next transaction immediately for recovery. */ 116 /* To start next transaction immediately for recovery. */
117 port->next_ktime = ktime_set(0, 0); 117 port->next_ktime = 0;
118 else 118 else
119 /* Don't continue processing. */ 119 /* Don't continue processing. */
120 port->error = true; 120 port->error = true;
@@ -156,7 +156,7 @@ static void midi_port_work(struct work_struct *work)
156 if (port->consume_bytes <= 0) { 156 if (port->consume_bytes <= 0) {
157 /* Do it in next chance, immediately. */ 157 /* Do it in next chance, immediately. */
158 if (port->consume_bytes == 0) { 158 if (port->consume_bytes == 0) {
159 port->next_ktime = ktime_set(0, 0); 159 port->next_ktime = 0;
160 schedule_work(&port->work); 160 schedule_work(&port->work);
161 } else { 161 } else {
162 /* Fatal error. */ 162 /* Fatal error. */
@@ -219,7 +219,7 @@ int snd_fw_async_midi_port_init(struct snd_fw_async_midi_port *port,
219 port->addr = addr; 219 port->addr = addr;
220 port->fill = fill; 220 port->fill = fill;
221 port->idling = true; 221 port->idling = true;
222 port->next_ktime = ktime_set(0, 0); 222 port->next_ktime = 0;
223 port->error = false; 223 port->error = false;
224 224
225 INIT_WORK(&port->work, midi_port_work); 225 INIT_WORK(&port->work, midi_port_work);
diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
index c9af022676c2..0659bf389489 100644
--- a/sound/hda/hdac_i915.c
+++ b/sound/hda/hdac_i915.c
@@ -193,6 +193,7 @@ static int pin2port(struct hdac_device *codec, hda_nid_t pin_nid)
193 * snd_hdac_sync_audio_rate - Set N/CTS based on the sample rate 193 * snd_hdac_sync_audio_rate - Set N/CTS based on the sample rate
194 * @codec: HDA codec 194 * @codec: HDA codec
195 * @nid: the pin widget NID 195 * @nid: the pin widget NID
196 * @dev_id: device identifier
196 * @rate: the sample rate to set 197 * @rate: the sample rate to set
197 * 198 *
198 * This function is supposed to be used only by a HD-audio controller 199 * This function is supposed to be used only by a HD-audio controller
@@ -201,18 +202,20 @@ static int pin2port(struct hdac_device *codec, hda_nid_t pin_nid)
201 * This function sets N/CTS value based on the given sample rate. 202 * This function sets N/CTS value based on the given sample rate.
202 * Returns zero for success, or a negative error code. 203 * Returns zero for success, or a negative error code.
203 */ 204 */
204int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int rate) 205int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid,
206 int dev_id, int rate)
205{ 207{
206 struct hdac_bus *bus = codec->bus; 208 struct hdac_bus *bus = codec->bus;
207 struct i915_audio_component *acomp = bus->audio_component; 209 struct i915_audio_component *acomp = bus->audio_component;
208 int port; 210 int port, pipe;
209 211
210 if (!acomp || !acomp->ops || !acomp->ops->sync_audio_rate) 212 if (!acomp || !acomp->ops || !acomp->ops->sync_audio_rate)
211 return -ENODEV; 213 return -ENODEV;
212 port = pin2port(codec, nid); 214 port = pin2port(codec, nid);
213 if (port < 0) 215 if (port < 0)
214 return -EINVAL; 216 return -EINVAL;
215 return acomp->ops->sync_audio_rate(acomp->dev, port, rate); 217 pipe = dev_id;
218 return acomp->ops->sync_audio_rate(acomp->dev, port, pipe, rate);
216} 219}
217EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate); 220EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);
218 221
@@ -220,6 +223,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);
220 * snd_hdac_acomp_get_eld - Get the audio state and ELD via component 223 * snd_hdac_acomp_get_eld - Get the audio state and ELD via component
221 * @codec: HDA codec 224 * @codec: HDA codec
222 * @nid: the pin widget NID 225 * @nid: the pin widget NID
226 * @dev_id: device identifier
223 * @audio_enabled: the pointer to store the current audio state 227 * @audio_enabled: the pointer to store the current audio state
224 * @buffer: the buffer pointer to store ELD bytes 228 * @buffer: the buffer pointer to store ELD bytes
225 * @max_bytes: the max bytes to be stored on @buffer 229 * @max_bytes: the max bytes to be stored on @buffer
@@ -236,12 +240,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);
236 * thus it may be over @max_bytes. If it's over @max_bytes, it implies 240 * thus it may be over @max_bytes. If it's over @max_bytes, it implies
237 * that only a part of ELD bytes have been fetched. 241 * that only a part of ELD bytes have been fetched.
238 */ 242 */
239int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, 243int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id,
240 bool *audio_enabled, char *buffer, int max_bytes) 244 bool *audio_enabled, char *buffer, int max_bytes)
241{ 245{
242 struct hdac_bus *bus = codec->bus; 246 struct hdac_bus *bus = codec->bus;
243 struct i915_audio_component *acomp = bus->audio_component; 247 struct i915_audio_component *acomp = bus->audio_component;
244 int port; 248 int port, pipe;
245 249
246 if (!acomp || !acomp->ops || !acomp->ops->get_eld) 250 if (!acomp || !acomp->ops || !acomp->ops->get_eld)
247 return -ENODEV; 251 return -ENODEV;
@@ -249,7 +253,9 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid,
249 port = pin2port(codec, nid); 253 port = pin2port(codec, nid);
250 if (port < 0) 254 if (port < 0)
251 return -EINVAL; 255 return -EINVAL;
252 return acomp->ops->get_eld(acomp->dev, port, audio_enabled, 256
257 pipe = dev_id;
258 return acomp->ops->get_eld(acomp->dev, port, pipe, audio_enabled,
253 buffer, max_bytes); 259 buffer, max_bytes);
254} 260}
255EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld); 261EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld);
diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c
index 38990a77d7b7..c6994ebb4567 100644
--- a/sound/hda/hdac_stream.c
+++ b/sound/hda/hdac_stream.c
@@ -465,7 +465,7 @@ int snd_hdac_stream_set_params(struct hdac_stream *azx_dev,
465} 465}
466EXPORT_SYMBOL_GPL(snd_hdac_stream_set_params); 466EXPORT_SYMBOL_GPL(snd_hdac_stream_set_params);
467 467
468static cycle_t azx_cc_read(const struct cyclecounter *cc) 468static u64 azx_cc_read(const struct cyclecounter *cc)
469{ 469{
470 struct hdac_stream *azx_dev = container_of(cc, struct hdac_stream, cc); 470 struct hdac_stream *azx_dev = container_of(cc, struct hdac_stream, cc);
471 471
@@ -473,7 +473,7 @@ static cycle_t azx_cc_read(const struct cyclecounter *cc)
473} 473}
474 474
475static void azx_timecounter_init(struct hdac_stream *azx_dev, 475static void azx_timecounter_init(struct hdac_stream *azx_dev,
476 bool force, cycle_t last) 476 bool force, u64 last)
477{ 477{
478 struct timecounter *tc = &azx_dev->tc; 478 struct timecounter *tc = &azx_dev->tc;
479 struct cyclecounter *cc = &azx_dev->cc; 479 struct cyclecounter *cc = &azx_dev->cc;
@@ -523,7 +523,7 @@ void snd_hdac_stream_timecounter_init(struct hdac_stream *azx_dev,
523 struct snd_pcm_runtime *runtime = azx_dev->substream->runtime; 523 struct snd_pcm_runtime *runtime = azx_dev->substream->runtime;
524 struct hdac_stream *s; 524 struct hdac_stream *s;
525 bool inited = false; 525 bool inited = false;
526 cycle_t cycle_last = 0; 526 u64 cycle_last = 0;
527 int i = 0; 527 int i = 0;
528 528
529 list_for_each_entry(s, &bus->stream_list, list) { 529 list_for_each_entry(s, &bus->stream_list, list) {
diff --git a/sound/oss/dmasound/dmasound_atari.c b/sound/oss/dmasound/dmasound_atari.c
index 1c56bf58eff9..a1a2979c0bb1 100644
--- a/sound/oss/dmasound/dmasound_atari.c
+++ b/sound/oss/dmasound/dmasound_atari.c
@@ -22,7 +22,7 @@
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24 24
25#include <asm/uaccess.h> 25#include <linux/uaccess.h>
26#include <asm/atariints.h> 26#include <asm/atariints.h>
27#include <asm/atari_stram.h> 27#include <asm/atari_stram.h>
28 28
diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c
index f4ee85a4c42f..5f248fb41bea 100644
--- a/sound/oss/dmasound/dmasound_core.c
+++ b/sound/oss/dmasound/dmasound_core.c
@@ -183,7 +183,7 @@
183#include <linux/poll.h> 183#include <linux/poll.h>
184#include <linux/mutex.h> 184#include <linux/mutex.h>
185 185
186#include <asm/uaccess.h> 186#include <linux/uaccess.h>
187 187
188#include "dmasound.h" 188#include "dmasound.h"
189 189
diff --git a/sound/oss/dmasound/dmasound_paula.c b/sound/oss/dmasound/dmasound_paula.c
index 3f653618614d..81eb82c4675a 100644
--- a/sound/oss/dmasound/dmasound_paula.c
+++ b/sound/oss/dmasound/dmasound_paula.c
@@ -23,7 +23,7 @@
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25 25
26#include <asm/uaccess.h> 26#include <linux/uaccess.h>
27#include <asm/setup.h> 27#include <asm/setup.h>
28#include <asm/amigahw.h> 28#include <asm/amigahw.h>
29#include <asm/amigaints.h> 29#include <asm/amigaints.h>
diff --git a/sound/oss/dmasound/dmasound_q40.c b/sound/oss/dmasound/dmasound_q40.c
index 99bcb21c2281..be4fe15cfd6b 100644
--- a/sound/oss/dmasound/dmasound_q40.c
+++ b/sound/oss/dmasound/dmasound_q40.c
@@ -20,7 +20,7 @@
20#include <linux/soundcard.h> 20#include <linux/soundcard.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22 22
23#include <asm/uaccess.h> 23#include <linux/uaccess.h>
24#include <asm/q40ints.h> 24#include <asm/q40ints.h>
25#include <asm/q40_master.h> 25#include <asm/q40_master.h>
26 26
diff --git a/sound/oss/msnd.c b/sound/oss/msnd.c
index c0cc951ba97d..b63010ad22f1 100644
--- a/sound/oss/msnd.c
+++ b/sound/oss/msnd.c
@@ -32,7 +32,7 @@
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33 33
34#include <asm/io.h> 34#include <asm/io.h>
35#include <asm/uaccess.h> 35#include <linux/uaccess.h>
36#include <linux/spinlock.h> 36#include <linux/spinlock.h>
37#include <asm/irq.h> 37#include <asm/irq.h>
38#include "msnd.h" 38#include "msnd.h"
diff --git a/sound/oss/os.h b/sound/oss/os.h
index 75ad0cd0c0ab..0bf89e1d679c 100644
--- a/sound/oss/os.h
+++ b/sound/oss/os.h
@@ -17,7 +17,7 @@
17#include <linux/ioport.h> 17#include <linux/ioport.h>
18#include <asm/page.h> 18#include <asm/page.h>
19#include <linux/vmalloc.h> 19#include <linux/vmalloc.h>
20#include <asm/uaccess.h> 20#include <linux/uaccess.h>
21#include <linux/poll.h> 21#include <linux/poll.h>
22#include <linux/pci.h> 22#include <linux/pci.h>
23#endif 23#endif
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c
index 213a416b6e0b..f3af63e58b36 100644
--- a/sound/oss/swarm_cs4297a.c
+++ b/sound/oss/swarm_cs4297a.c
@@ -80,7 +80,7 @@
80#include <asm/byteorder.h> 80#include <asm/byteorder.h>
81#include <asm/dma.h> 81#include <asm/dma.h>
82#include <asm/io.h> 82#include <asm/io.h>
83#include <asm/uaccess.h> 83#include <linux/uaccess.h>
84 84
85#include <asm/sibyte/sb1250_regs.h> 85#include <asm/sibyte/sb1250_regs.h>
86#include <asm/sibyte/sb1250_int.h> 86#include <asm/sibyte/sb1250_int.h>
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 82259ca61e64..1ef7cdf1d3e8 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -1907,7 +1907,7 @@ static int ac97_reset_wait(struct snd_ac97 *ac97, int timeout, int with_modem)
1907 * write). The other callbacks, wait and reset, are not mandatory. 1907 * write). The other callbacks, wait and reset, are not mandatory.
1908 * 1908 *
1909 * The clock is set to 48000. If another clock is needed, set 1909 * The clock is set to 48000. If another clock is needed, set
1910 * (*rbus)->clock manually. 1910 * ``(*rbus)->clock`` manually.
1911 * 1911 *
1912 * The AC97 bus instance is registered as a low-level device, so you don't 1912 * The AC97 bus instance is registered as a low-level device, so you don't
1913 * have to release it manually. 1913 * have to release it manually.
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index edabe1371660..92bc06d01288 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -84,7 +84,7 @@ MODULE_DESCRIPTION("Avance Logic ALS4000");
84MODULE_LICENSE("GPL"); 84MODULE_LICENSE("GPL");
85MODULE_SUPPORTED_DEVICE("{{Avance Logic,ALS4000}}"); 85MODULE_SUPPORTED_DEVICE("{{Avance Logic,ALS4000}}");
86 86
87#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 87#if IS_REACHABLE(CONFIG_GAMEPORT)
88#define SUPPORT_JOYSTICK 1 88#define SUPPORT_JOYSTICK 1
89#endif 89#endif
90 90
diff --git a/sound/pci/au88x0/au88x0_game.c b/sound/pci/au88x0/au88x0_game.c
index 151815b857a0..53abcd3eccbd 100644
--- a/sound/pci/au88x0/au88x0_game.c
+++ b/sound/pci/au88x0/au88x0_game.c
@@ -36,7 +36,7 @@
36#include <linux/gameport.h> 36#include <linux/gameport.h>
37#include <linux/export.h> 37#include <linux/export.h>
38 38
39#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 39#if IS_REACHABLE(CONFIG_GAMEPORT)
40 40
41#define VORTEX_GAME_DWAIT 20 /* 20 ms */ 41#define VORTEX_GAME_DWAIT 20 /* 20 ms */
42 42
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index 80c4a4456197..79b2e6b7d88b 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -212,7 +212,7 @@ MODULE_DESCRIPTION("Aztech AZF3328 (PCI168)");
212MODULE_LICENSE("GPL"); 212MODULE_LICENSE("GPL");
213MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}"); 213MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}");
214 214
215#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 215#if IS_REACHABLE(CONFIG_GAMEPORT)
216#define SUPPORT_GAMEPORT 1 216#define SUPPORT_GAMEPORT 1
217#endif 217#endif
218 218
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 73f593526b2d..aeedc270ed9b 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -48,7 +48,7 @@ MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8738},"
48 "{C-Media,CMI8338A}," 48 "{C-Media,CMI8338A},"
49 "{C-Media,CMI8338B}}"); 49 "{C-Media,CMI8338B}}");
50 50
51#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 51#if IS_REACHABLE(CONFIG_GAMEPORT)
52#define SUPPORT_JOYSTICK 1 52#define SUPPORT_JOYSTICK 1
53#endif 53#endif
54 54
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index 615d8a99d8c8..8f0f5f24e40e 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -1194,7 +1194,7 @@ static void snd_cs4281_proc_init(struct cs4281 *chip)
1194 * joystick support 1194 * joystick support
1195 */ 1195 */
1196 1196
1197#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 1197#if IS_REACHABLE(CONFIG_GAMEPORT)
1198 1198
1199static void snd_cs4281_gameport_trigger(struct gameport *gameport) 1199static void snd_cs4281_gameport_trigger(struct gameport *gameport)
1200{ 1200{
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 528102cc2d5d..fde3cd48258c 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -2718,7 +2718,7 @@ int snd_cs46xx_midi(struct snd_cs46xx *chip, int device)
2718 * gameport interface 2718 * gameport interface
2719 */ 2719 */
2720 2720
2721#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 2721#if IS_REACHABLE(CONFIG_GAMEPORT)
2722 2722
2723static void snd_cs46xx_gameport_trigger(struct gameport *gameport) 2723static void snd_cs46xx_gameport_trigger(struct gameport *gameport)
2724{ 2724{
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c
index 4a0cbd2241d8..aa61615288ff 100644
--- a/sound/pci/cs46xx/dsp_spos.c
+++ b/sound/pci/cs46xx/dsp_spos.c
@@ -107,7 +107,8 @@ static int shadow_and_reallocate_code (struct snd_cs46xx * chip, u32 * data, u32
107 107
108 dev_dbg(chip->card->dev, 108 dev_dbg(chip->card->dev,
109 "handle_wideop:[2] %05x:%05x addr %04x\n", 109 "handle_wideop:[2] %05x:%05x addr %04x\n",
110 hival, loval, address); nreallocated++; 110 hival, loval, address);
111 nreallocated++;
111 } /* wide_opcodes[j] == wide_op */ 112 } /* wide_opcodes[j] == wide_op */
112 } /* for */ 113 } /* for */
113 } /* mod_type == 0 ... */ 114 } /* mod_type == 0 ... */
diff --git a/sound/pci/echoaudio/layla24_dsp.c b/sound/pci/echoaudio/layla24_dsp.c
index df28e5117359..c02bc1dcc170 100644
--- a/sound/pci/echoaudio/layla24_dsp.c
+++ b/sound/pci/echoaudio/layla24_dsp.c
@@ -135,7 +135,7 @@ static int load_asic(struct echoaudio *chip)
135 err = load_asic_generic(chip, DSP_FNC_LOAD_LAYLA24_EXTERNAL_ASIC, 135 err = load_asic_generic(chip, DSP_FNC_LOAD_LAYLA24_EXTERNAL_ASIC,
136 FW_LAYLA24_2S_ASIC); 136 FW_LAYLA24_2S_ASIC);
137 if (err < 0) 137 if (err < 0)
138 return false; 138 return err;
139 139
140 /* Now give the external ASIC a little time to set up */ 140 /* Now give the external ASIC a little time to set up */
141 mdelay(10); 141 mdelay(10);
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index db7a2e5e4a14..6a0e49ac5273 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -37,7 +37,7 @@ MODULE_LICENSE("GPL");
37MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB Live!/PCI512/E-mu APS}," 37MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB Live!/PCI512/E-mu APS},"
38 "{Creative Labs,SB Audigy}}"); 38 "{Creative Labs,SB Audigy}}");
39 39
40#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) 40#if IS_REACHABLE(CONFIG_SND_SEQUENCER)
41#define ENABLE_SYNTH 41#define ENABLE_SYNTH
42#include <sound/emu10k1_synth.h> 42#include <sound/emu10k1_synth.h>
43#endif 43#endif
@@ -194,6 +194,9 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci,
194 if ((err = snd_card_register(card)) < 0) 194 if ((err = snd_card_register(card)) < 0)
195 goto error; 195 goto error;
196 196
197 if (emu->card_capabilities->emu_model)
198 schedule_delayed_work(&emu->emu1010.firmware_work, 0);
199
197 pci_set_drvdata(pci, card); 200 pci_set_drvdata(pci, card);
198 dev++; 201 dev++;
199 return 0; 202 return 0;
@@ -219,6 +222,8 @@ static int snd_emu10k1_suspend(struct device *dev)
219 222
220 emu->suspend = 1; 223 emu->suspend = 1;
221 224
225 cancel_delayed_work_sync(&emu->emu1010.firmware_work);
226
222 snd_pcm_suspend_all(emu->pcm); 227 snd_pcm_suspend_all(emu->pcm);
223 snd_pcm_suspend_all(emu->pcm_mic); 228 snd_pcm_suspend_all(emu->pcm_mic);
224 snd_pcm_suspend_all(emu->pcm_efx); 229 snd_pcm_suspend_all(emu->pcm_efx);
@@ -252,6 +257,10 @@ static int snd_emu10k1_resume(struct device *dev)
252 emu->suspend = 0; 257 emu->suspend = 0;
253 258
254 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 259 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
260
261 if (emu->card_capabilities->emu_model)
262 schedule_delayed_work(&emu->emu1010.firmware_work, 0);
263
255 return 0; 264 return 0;
256} 265}
257 266
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 891453451543..ccf4415a1c7b 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -32,7 +32,6 @@
32 */ 32 */
33 33
34#include <linux/sched.h> 34#include <linux/sched.h>
35#include <linux/kthread.h>
36#include <linux/delay.h> 35#include <linux/delay.h>
37#include <linux/init.h> 36#include <linux/init.h>
38#include <linux/module.h> 37#include <linux/module.h>
@@ -662,7 +661,7 @@ static int snd_emu10k1_cardbus_init(struct snd_emu10k1 *emu)
662 return 0; 661 return 0;
663} 662}
664 663
665static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu, 664static int snd_emu1010_load_firmware_entry(struct snd_emu10k1 *emu,
666 const struct firmware *fw_entry) 665 const struct firmware *fw_entry)
667{ 666{
668 int n, i; 667 int n, i;
@@ -708,98 +707,104 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu,
708 return 0; 707 return 0;
709} 708}
710 709
711static int emu1010_firmware_thread(void *data) 710/* firmware file names, per model, init-fw and dock-fw (optional) */
711static const char * const firmware_names[5][2] = {
712 [EMU_MODEL_EMU1010] = {
713 HANA_FILENAME, DOCK_FILENAME
714 },
715 [EMU_MODEL_EMU1010B] = {
716 EMU1010B_FILENAME, MICRO_DOCK_FILENAME
717 },
718 [EMU_MODEL_EMU1616] = {
719 EMU1010_NOTEBOOK_FILENAME, MICRO_DOCK_FILENAME
720 },
721 [EMU_MODEL_EMU0404] = {
722 EMU0404_FILENAME, NULL
723 },
724};
725
726static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu, int dock,
727 const struct firmware **fw)
712{ 728{
713 struct snd_emu10k1 *emu = data; 729 const char *filename;
730 int err;
731
732 if (!*fw) {
733 filename = firmware_names[emu->card_capabilities->emu_model][dock];
734 if (!filename)
735 return 0;
736 err = request_firmware(fw, filename, &emu->pci->dev);
737 if (err)
738 return err;
739 }
740
741 return snd_emu1010_load_firmware_entry(emu, *fw);
742}
743
744static void emu1010_firmware_work(struct work_struct *work)
745{
746 struct snd_emu10k1 *emu;
714 u32 tmp, tmp2, reg; 747 u32 tmp, tmp2, reg;
715 u32 last_reg = 0;
716 int err; 748 int err;
717 749
718 for (;;) { 750 emu = container_of(work, struct snd_emu10k1,
719 /* Delay to allow Audio Dock to settle */ 751 emu1010.firmware_work.work);
720 msleep_interruptible(1000); 752 if (emu->card->shutdown)
721 if (kthread_should_stop()) 753 return;
722 break;
723#ifdef CONFIG_PM_SLEEP 754#ifdef CONFIG_PM_SLEEP
724 if (emu->suspend) 755 if (emu->suspend)
725 continue; 756 return;
726#endif 757#endif
727 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &tmp); /* IRQ Status */ 758 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &tmp); /* IRQ Status */
728 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg); /* OPTIONS: Which cards are attached to the EMU */ 759 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg); /* OPTIONS: Which cards are attached to the EMU */
729 if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) { 760 if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) {
730 /* Audio Dock attached */ 761 /* Audio Dock attached */
731 /* Return to Audio Dock programming mode */ 762 /* Return to Audio Dock programming mode */
732 dev_info(emu->card->dev, 763 dev_info(emu->card->dev,
733 "emu1010: Loading Audio Dock Firmware\n"); 764 "emu1010: Loading Audio Dock Firmware\n");
734 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK); 765 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG,
735 766 EMU_HANA_FPGA_CONFIG_AUDIODOCK);
736 if (!emu->dock_fw) { 767 err = snd_emu1010_load_firmware(emu, 1, &emu->dock_fw);
737 const char *filename = NULL; 768 if (err < 0)
738 switch (emu->card_capabilities->emu_model) { 769 goto next;
739 case EMU_MODEL_EMU1010:
740 filename = DOCK_FILENAME;
741 break;
742 case EMU_MODEL_EMU1010B:
743 filename = MICRO_DOCK_FILENAME;
744 break;
745 case EMU_MODEL_EMU1616:
746 filename = MICRO_DOCK_FILENAME;
747 break;
748 }
749 if (filename) {
750 err = request_firmware(&emu->dock_fw,
751 filename,
752 &emu->pci->dev);
753 if (err)
754 continue;
755 }
756 }
757
758 if (emu->dock_fw) {
759 err = snd_emu1010_load_firmware(emu, emu->dock_fw);
760 if (err)
761 continue;
762 }
763 770
764 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0); 771 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0);
765 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &reg); 772 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &tmp);
766 dev_info(emu->card->dev, 773 dev_info(emu->card->dev,
767 "emu1010: EMU_HANA+DOCK_IRQ_STATUS = 0x%x\n", 774 "emu1010: EMU_HANA+DOCK_IRQ_STATUS = 0x%x\n", tmp);
768 reg); 775 /* ID, should read & 0x7f = 0x55 when FPGA programmed. */
769 /* ID, should read & 0x7f = 0x55 when FPGA programmed. */ 776 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &tmp);
770 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg); 777 dev_info(emu->card->dev,
771 dev_info(emu->card->dev, 778 "emu1010: EMU_HANA+DOCK_ID = 0x%x\n", tmp);
772 "emu1010: EMU_HANA+DOCK_ID = 0x%x\n", reg); 779 if ((tmp & 0x1f) != 0x15) {
773 if ((reg & 0x1f) != 0x15) { 780 /* FPGA failed to be programmed */
774 /* FPGA failed to be programmed */
775 dev_info(emu->card->dev,
776 "emu1010: Loading Audio Dock Firmware file failed, reg = 0x%x\n",
777 reg);
778 continue;
779 }
780 dev_info(emu->card->dev,
781 "emu1010: Audio Dock Firmware loaded\n");
782 snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp);
783 snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2);
784 dev_info(emu->card->dev, "Audio Dock ver: %u.%u\n",
785 tmp, tmp2);
786 /* Sync clocking between 1010 and Dock */
787 /* Allow DLL to settle */
788 msleep(10);
789 /* Unmute all. Default is muted after a firmware load */
790 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE);
791 } else if (!reg && last_reg) {
792 /* Audio Dock removed */
793 dev_info(emu->card->dev, 781 dev_info(emu->card->dev,
794 "emu1010: Audio Dock detached\n"); 782 "emu1010: Loading Audio Dock Firmware file failed, reg = 0x%x\n",
795 /* Unmute all */ 783 tmp);
796 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE); 784 goto next;
797 } 785 }
798 786 dev_info(emu->card->dev,
799 last_reg = reg; 787 "emu1010: Audio Dock Firmware loaded\n");
788 snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp);
789 snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2);
790 dev_info(emu->card->dev, "Audio Dock ver: %u.%u\n", tmp, tmp2);
791 /* Sync clocking between 1010 and Dock */
792 /* Allow DLL to settle */
793 msleep(10);
794 /* Unmute all. Default is muted after a firmware load */
795 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE);
796 } else if (!reg && emu->emu1010.last_reg) {
797 /* Audio Dock removed */
798 dev_info(emu->card->dev, "emu1010: Audio Dock detached\n");
799 /* Unmute all */
800 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE);
800 } 801 }
801 dev_info(emu->card->dev, "emu1010: firmware thread stopping\n"); 802
802 return 0; 803 next:
804 emu->emu1010.last_reg = reg;
805 if (!emu->card->shutdown)
806 schedule_delayed_work(&emu->emu1010.firmware_work,
807 msecs_to_jiffies(1000));
803} 808}
804 809
805/* 810/*
@@ -881,39 +886,8 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
881 } 886 }
882 dev_info(emu->card->dev, "emu1010: EMU_HANA_ID = 0x%x\n", reg); 887 dev_info(emu->card->dev, "emu1010: EMU_HANA_ID = 0x%x\n", reg);
883 888
884 if (!emu->firmware) { 889 err = snd_emu1010_load_firmware(emu, 0, &emu->firmware);
885 const char *filename; 890 if (err < 0) {
886 switch (emu->card_capabilities->emu_model) {
887 case EMU_MODEL_EMU1010:
888 filename = HANA_FILENAME;
889 break;
890 case EMU_MODEL_EMU1010B:
891 filename = EMU1010B_FILENAME;
892 break;
893 case EMU_MODEL_EMU1616:
894 filename = EMU1010_NOTEBOOK_FILENAME;
895 break;
896 case EMU_MODEL_EMU0404:
897 filename = EMU0404_FILENAME;
898 break;
899 default:
900 return -ENODEV;
901 }
902
903 err = request_firmware(&emu->firmware, filename, &emu->pci->dev);
904 if (err != 0) {
905 dev_info(emu->card->dev,
906 "emu1010: firmware: %s not found. Err = %d\n",
907 filename, err);
908 return err;
909 }
910 dev_info(emu->card->dev,
911 "emu1010: firmware file = %s, size = 0x%zx\n",
912 filename, emu->firmware->size);
913 }
914
915 err = snd_emu1010_load_firmware(emu, emu->firmware);
916 if (err != 0) {
917 dev_info(emu->card->dev, "emu1010: Loading Firmware failed\n"); 891 dev_info(emu->card->dev, "emu1010: Loading Firmware failed\n");
918 return err; 892 return err;
919 } 893 }
@@ -1136,22 +1110,6 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
1136 snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp); 1110 snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp);
1137 snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10); /* SPDIF Format spdif (or 0x11 for aes/ebu) */ 1111 snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10); /* SPDIF Format spdif (or 0x11 for aes/ebu) */
1138 1112
1139 /* Start Micro/Audio Dock firmware loader thread */
1140 if (!emu->emu1010.firmware_thread) {
1141 emu->emu1010.firmware_thread =
1142 kthread_create(emu1010_firmware_thread, emu,
1143 "emu1010_firmware");
1144 if (IS_ERR(emu->emu1010.firmware_thread)) {
1145 err = PTR_ERR(emu->emu1010.firmware_thread);
1146 emu->emu1010.firmware_thread = NULL;
1147 dev_info(emu->card->dev,
1148 "emu1010: Creating thread failed\n");
1149 return err;
1150 }
1151
1152 wake_up_process(emu->emu1010.firmware_thread);
1153 }
1154
1155#if 0 1113#if 0
1156 snd_emu1010_fpga_link_dst_src_write(emu, 1114 snd_emu1010_fpga_link_dst_src_write(emu,
1157 EMU_DST_HAMOA_DAC_LEFT1, EMU_SRC_ALICE_EMU32B + 2); /* ALICE2 bus 0xa2 */ 1115 EMU_DST_HAMOA_DAC_LEFT1, EMU_SRC_ALICE_EMU32B + 2); /* ALICE2 bus 0xa2 */
@@ -1309,8 +1267,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu)
1309 /* Disable 48Volt power to Audio Dock */ 1267 /* Disable 48Volt power to Audio Dock */
1310 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0); 1268 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0);
1311 } 1269 }
1312 if (emu->emu1010.firmware_thread) 1270 cancel_delayed_work_sync(&emu->emu1010.firmware_work);
1313 kthread_stop(emu->emu1010.firmware_thread);
1314 release_firmware(emu->firmware); 1271 release_firmware(emu->firmware);
1315 release_firmware(emu->dock_fw); 1272 release_firmware(emu->dock_fw);
1316 if (emu->irq >= 0) 1273 if (emu->irq >= 0)
@@ -1852,6 +1809,7 @@ int snd_emu10k1_create(struct snd_card *card,
1852 emu->irq = -1; 1809 emu->irq = -1;
1853 emu->synth = NULL; 1810 emu->synth = NULL;
1854 emu->get_synth_voice = NULL; 1811 emu->get_synth_voice = NULL;
1812 INIT_DELAYED_WORK(&emu->emu1010.firmware_work, emu1010_firmware_work);
1855 /* read revision & serial */ 1813 /* read revision & serial */
1856 emu->revision = pci->revision; 1814 emu->revision = pci->revision;
1857 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial); 1815 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial);
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 7e760fed0728..51736c2b5a00 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -79,7 +79,7 @@ MODULE_SUPPORTED_DEVICE("{{Ensoniq,AudioPCI ES1371/73},"
79 "{Ectiva,EV1938}}"); 79 "{Ectiva,EV1938}}");
80#endif 80#endif
81 81
82#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 82#if IS_REACHABLE(CONFIG_GAMEPORT)
83#define SUPPORT_JOYSTICK 83#define SUPPORT_JOYSTICK
84#endif 84#endif
85 85
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 681355829484..e8d943071a8c 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -72,7 +72,7 @@ MODULE_SUPPORTED_DEVICE("{{ESS,ES1938},"
72 "{ESS,ES1969}," 72 "{ESS,ES1969},"
73 "{TerraTec,128i PCI}}"); 73 "{TerraTec,128i PCI}}");
74 74
75#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 75#if IS_REACHABLE(CONFIG_GAMEPORT)
76#define SUPPORT_JOYSTICK 1 76#define SUPPORT_JOYSTICK 1
77#endif 77#endif
78 78
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 8146fb76a4ad..2ec2b1ce0af6 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -126,7 +126,7 @@ MODULE_SUPPORTED_DEVICE("{{ESS,Maestro 2e},"
126 "{ESS,Maestro 1}," 126 "{ESS,Maestro 1},"
127 "{TerraTec,DMX}}"); 127 "{TerraTec,DMX}}");
128 128
129#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 129#if IS_REACHABLE(CONFIG_GAMEPORT)
130#define SUPPORT_JOYSTICK 1 130#define SUPPORT_JOYSTICK 1
131#endif 131#endif
132 132
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
index 7f57a145a47e..a03cf68d0bcd 100644
--- a/sound/pci/hda/hda_auto_parser.c
+++ b/sound/pci/hda/hda_auto_parser.c
@@ -884,6 +884,8 @@ void snd_hda_apply_fixup(struct hda_codec *codec, int action)
884} 884}
885EXPORT_SYMBOL_GPL(snd_hda_apply_fixup); 885EXPORT_SYMBOL_GPL(snd_hda_apply_fixup);
886 886
887#define IGNORE_SEQ_ASSOC (~(AC_DEFCFG_SEQUENCE | AC_DEFCFG_DEF_ASSOC))
888
887static bool pin_config_match(struct hda_codec *codec, 889static bool pin_config_match(struct hda_codec *codec,
888 const struct hda_pintbl *pins) 890 const struct hda_pintbl *pins)
889{ 891{
@@ -901,7 +903,7 @@ static bool pin_config_match(struct hda_codec *codec,
901 for (; t_pins->nid; t_pins++) { 903 for (; t_pins->nid; t_pins++) {
902 if (t_pins->nid == nid) { 904 if (t_pins->nid == nid) {
903 found = 1; 905 found = 1;
904 if (t_pins->val == cfg) 906 if ((t_pins->val & IGNORE_SEQ_ASSOC) == (cfg & IGNORE_SEQ_ASSOC))
905 break; 907 break;
906 else if ((cfg & 0xf0000000) == 0x40000000 && (t_pins->val & 0xf0000000) == 0x40000000) 908 else if ((cfg & 0xf0000000) == 0x40000000 && (t_pins->val & 0xf0000000) == 0x40000000)
907 break; 909 break;
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index ad06866d7c69..11b9b2f17a2e 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -780,6 +780,7 @@ static const struct hda_pintbl alienware_pincfgs[] = {
780static const struct snd_pci_quirk ca0132_quirks[] = { 780static const struct snd_pci_quirk ca0132_quirks[] = {
781 SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15 2015", QUIRK_ALIENWARE), 781 SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15 2015", QUIRK_ALIENWARE),
782 SND_PCI_QUIRK(0x1028, 0x0688, "Alienware 17 2015", QUIRK_ALIENWARE), 782 SND_PCI_QUIRK(0x1028, 0x0688, "Alienware 17 2015", QUIRK_ALIENWARE),
783 SND_PCI_QUIRK(0x1028, 0x0708, "Alienware 15 R2 2016", QUIRK_ALIENWARE),
783 {} 784 {}
784}; 785};
785 786
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index ed62748a6d55..c15c51bea26d 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -262,6 +262,7 @@ enum {
262 CXT_FIXUP_CAP_MIX_AMP_5047, 262 CXT_FIXUP_CAP_MIX_AMP_5047,
263 CXT_FIXUP_MUTE_LED_EAPD, 263 CXT_FIXUP_MUTE_LED_EAPD,
264 CXT_FIXUP_HP_SPECTRE, 264 CXT_FIXUP_HP_SPECTRE,
265 CXT_FIXUP_HP_GATE_MIC,
265}; 266};
266 267
267/* for hda_fixup_thinkpad_acpi() */ 268/* for hda_fixup_thinkpad_acpi() */
@@ -633,6 +634,17 @@ static void cxt_fixup_cap_mix_amp_5047(struct hda_codec *codec,
633 (1 << AC_AMPCAP_MUTE_SHIFT)); 634 (1 << AC_AMPCAP_MUTE_SHIFT));
634} 635}
635 636
637static void cxt_fixup_hp_gate_mic_jack(struct hda_codec *codec,
638 const struct hda_fixup *fix,
639 int action)
640{
641 /* the mic pin (0x19) doesn't give an unsolicited event;
642 * probe the mic pin together with the headphone pin (0x16)
643 */
644 if (action == HDA_FIXUP_ACT_PROBE)
645 snd_hda_jack_set_gating_jack(codec, 0x19, 0x16);
646}
647
636/* ThinkPad X200 & co with cxt5051 */ 648/* ThinkPad X200 & co with cxt5051 */
637static const struct hda_pintbl cxt_pincfg_lenovo_x200[] = { 649static const struct hda_pintbl cxt_pincfg_lenovo_x200[] = {
638 { 0x16, 0x042140ff }, /* HP (seq# overridden) */ 650 { 0x16, 0x042140ff }, /* HP (seq# overridden) */
@@ -774,6 +786,10 @@ static const struct hda_fixup cxt_fixups[] = {
774 { } 786 { }
775 } 787 }
776 }, 788 },
789 [CXT_FIXUP_HP_GATE_MIC] = {
790 .type = HDA_FIXUP_FUNC,
791 .v.func = cxt_fixup_hp_gate_mic_jack,
792 },
777}; 793};
778 794
779static const struct snd_pci_quirk cxt5045_fixups[] = { 795static const struct snd_pci_quirk cxt5045_fixups[] = {
@@ -824,6 +840,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
824 SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT_FIXUP_ASPIRE_DMIC), 840 SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT_FIXUP_ASPIRE_DMIC),
825 SND_PCI_QUIRK(0x1025, 0x054f, "Acer Aspire 4830T", CXT_FIXUP_ASPIRE_DMIC), 841 SND_PCI_QUIRK(0x1025, 0x054f, "Acer Aspire 4830T", CXT_FIXUP_ASPIRE_DMIC),
826 SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE), 842 SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE),
843 SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC),
827 SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN), 844 SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN),
828 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO), 845 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO),
829 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), 846 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 56e5204ac9c1..cf9bc042fe96 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1485,7 +1485,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec,
1485 1485
1486 mutex_lock(&per_pin->lock); 1486 mutex_lock(&per_pin->lock);
1487 eld->monitor_present = false; 1487 eld->monitor_present = false;
1488 size = snd_hdac_acomp_get_eld(&codec->core, per_pin->pin_nid, 1488 size = snd_hdac_acomp_get_eld(&codec->core, per_pin->pin_nid, -1,
1489 &eld->monitor_present, eld->eld_buffer, 1489 &eld->monitor_present, eld->eld_buffer,
1490 ELD_MAX_SIZE); 1490 ELD_MAX_SIZE);
1491 if (size > 0) { 1491 if (size > 0) {
@@ -1744,7 +1744,8 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1744 /* Call sync_audio_rate to set the N/CTS/M manually if necessary */ 1744 /* Call sync_audio_rate to set the N/CTS/M manually if necessary */
1745 /* Todo: add DP1.2 MST audio support later */ 1745 /* Todo: add DP1.2 MST audio support later */
1746 if (codec_has_acomp(codec)) 1746 if (codec_has_acomp(codec))
1747 snd_hdac_sync_audio_rate(&codec->core, pin_nid, runtime->rate); 1747 snd_hdac_sync_audio_rate(&codec->core, pin_nid, -1,
1748 runtime->rate);
1748 1749
1749 non_pcm = check_non_pcm_per_cvt(codec, cvt_nid); 1750 non_pcm = check_non_pcm_per_cvt(codec, cvt_nid);
1750 mutex_lock(&per_pin->lock); 1751 mutex_lock(&per_pin->lock);
@@ -2290,7 +2291,7 @@ static void haswell_set_power_state(struct hda_codec *codec, hda_nid_t fg,
2290 snd_hda_codec_set_power_to_all(codec, fg, power_state); 2291 snd_hda_codec_set_power_to_all(codec, fg, power_state);
2291} 2292}
2292 2293
2293static void intel_pin_eld_notify(void *audio_ptr, int port) 2294static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe)
2294{ 2295{
2295 struct hda_codec *codec = audio_ptr; 2296 struct hda_codec *codec = audio_ptr;
2296 int pin_nid; 2297 int pin_nid;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index ea81c08ddc7a..9448daff9d8b 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -420,7 +420,7 @@ static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
420} 420}
421 421
422/* generic shutup callback; 422/* generic shutup callback;
423 * just turning off EPAD and a little pause for avoiding pop-noise 423 * just turning off EAPD and a little pause for avoiding pop-noise
424 */ 424 */
425static void alc_eapd_shutup(struct hda_codec *codec) 425static void alc_eapd_shutup(struct hda_codec *codec)
426{ 426{
@@ -5917,6 +5917,9 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
5917 {0x12, 0x90a60180}, 5917 {0x12, 0x90a60180},
5918 {0x14, 0x90170120}, 5918 {0x14, 0x90170120},
5919 {0x21, 0x02211030}), 5919 {0x21, 0x02211030}),
5920 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5921 {0x1b, 0x01011020},
5922 {0x21, 0x02211010}),
5920 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, 5923 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5921 {0x12, 0x90a60160}, 5924 {0x12, 0x90a60160},
5922 {0x14, 0x90170120}, 5925 {0x14, 0x90170120},
@@ -6561,6 +6564,30 @@ static void alc662_fixup_led_gpio1(struct hda_codec *codec,
6561 } 6564 }
6562} 6565}
6563 6566
6567static void alc662_usi_automute_hook(struct hda_codec *codec,
6568 struct hda_jack_callback *jack)
6569{
6570 struct alc_spec *spec = codec->spec;
6571 int vref;
6572 msleep(200);
6573 snd_hda_gen_hp_automute(codec, jack);
6574
6575 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6576 msleep(100);
6577 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6578 vref);
6579}
6580
6581static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
6582 const struct hda_fixup *fix, int action)
6583{
6584 struct alc_spec *spec = codec->spec;
6585 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6586 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6587 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
6588 }
6589}
6590
6564static struct coef_fw alc668_coefs[] = { 6591static struct coef_fw alc668_coefs[] = {
6565 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0), 6592 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
6566 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80), 6593 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
@@ -6626,6 +6653,8 @@ enum {
6626 ALC891_FIXUP_DELL_MIC_NO_PRESENCE, 6653 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
6627 ALC662_FIXUP_ACER_VERITON, 6654 ALC662_FIXUP_ACER_VERITON,
6628 ALC892_FIXUP_ASROCK_MOBO, 6655 ALC892_FIXUP_ASROCK_MOBO,
6656 ALC662_FIXUP_USI_FUNC,
6657 ALC662_FIXUP_USI_HEADSET_MODE,
6629}; 6658};
6630 6659
6631static const struct hda_fixup alc662_fixups[] = { 6660static const struct hda_fixup alc662_fixups[] = {
@@ -6910,6 +6939,20 @@ static const struct hda_fixup alc662_fixups[] = {
6910 { } 6939 { }
6911 } 6940 }
6912 }, 6941 },
6942 [ALC662_FIXUP_USI_FUNC] = {
6943 .type = HDA_FIXUP_FUNC,
6944 .v.func = alc662_fixup_usi_headset_mic,
6945 },
6946 [ALC662_FIXUP_USI_HEADSET_MODE] = {
6947 .type = HDA_FIXUP_PINS,
6948 .v.pins = (const struct hda_pintbl[]) {
6949 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
6950 { 0x18, 0x01a1903d },
6951 { }
6952 },
6953 .chained = true,
6954 .chain_id = ALC662_FIXUP_USI_FUNC
6955 },
6913}; 6956};
6914 6957
6915static const struct snd_pci_quirk alc662_fixup_tbl[] = { 6958static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -6945,6 +6988,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
6945 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT), 6988 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
6946 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2), 6989 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
6947 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), 6990 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
6991 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
6948 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), 6992 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
6949 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), 6993 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
6950 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO), 6994 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index ada5f01d479c..19c9df6b0f3d 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -110,7 +110,7 @@
110#include <sound/opl3.h> 110#include <sound/opl3.h>
111#include <sound/initval.h> 111#include <sound/initval.h>
112 112
113#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 113#if IS_REACHABLE(CONFIG_GAMEPORT)
114#define SUPPORT_JOYSTICK 1 114#define SUPPORT_JOYSTICK 1
115#endif 115#endif
116 116
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index e1a13870bb80..a6aa48c5b969 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -45,7 +45,7 @@ MODULE_DESCRIPTION("S3 SonicVibes PCI");
45MODULE_LICENSE("GPL"); 45MODULE_LICENSE("GPL");
46MODULE_SUPPORTED_DEVICE("{{S3,SonicVibes PCI}}"); 46MODULE_SUPPORTED_DEVICE("{{S3,SonicVibes PCI}}");
47 47
48#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 48#if IS_REACHABLE(CONFIG_GAMEPORT)
49#define SUPPORT_JOYSTICK 1 49#define SUPPORT_JOYSTICK 1
50#endif 50#endif
51 51
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 27f0ed840979..92ad2d7a6bf8 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -3120,7 +3120,7 @@ static int snd_trident_mixer(struct snd_trident *trident, int pcm_spdif_device)
3120 * gameport interface 3120 * gameport interface
3121 */ 3121 */
3122 3122
3123#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 3123#if IS_REACHABLE(CONFIG_GAMEPORT)
3124 3124
3125static unsigned char snd_trident_gameport_read(struct gameport *gameport) 3125static unsigned char snd_trident_gameport_read(struct gameport *gameport)
3126{ 3126{
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 38a17b4342a6..2d8c14e3f8d2 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -72,7 +72,7 @@ MODULE_DESCRIPTION("VIA VT82xx audio");
72MODULE_LICENSE("GPL"); 72MODULE_LICENSE("GPL");
73MODULE_SUPPORTED_DEVICE("{{VIA,VT82C686A/B/C,pci},{VIA,VT8233A/C,8235}}"); 73MODULE_SUPPORTED_DEVICE("{{VIA,VT82C686A/B/C,pci},{VIA,VT8233A/C,8235}}");
74 74
75#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 75#if IS_REACHABLE(CONFIG_GAMEPORT)
76#define SUPPORT_JOYSTICK 1 76#define SUPPORT_JOYSTICK 1
77#endif 77#endif
78 78
diff --git a/sound/pci/ymfpci/ymfpci.h b/sound/pci/ymfpci/ymfpci.h
index 149d4cb46998..aa9bb065f385 100644
--- a/sound/pci/ymfpci/ymfpci.h
+++ b/sound/pci/ymfpci/ymfpci.h
@@ -176,7 +176,7 @@
176#define YMFPCI_LEGACY2_IMOD (1 << 15) /* legacy IRQ mode */ 176#define YMFPCI_LEGACY2_IMOD (1 << 15) /* legacy IRQ mode */
177/* SIEN:IMOD 0:0 = legacy irq, 0:1 = INTA, 1:0 = serialized IRQ */ 177/* SIEN:IMOD 0:0 = legacy irq, 0:1 = INTA, 1:0 = serialized IRQ */
178 178
179#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 179#if IS_REACHABLE(CONFIG_GAMEPORT)
180#define SUPPORT_JOYSTICK 180#define SUPPORT_JOYSTICK
181#endif 181#endif
182 182
diff --git a/sound/sh/sh_dac_audio.c b/sound/sh/sh_dac_audio.c
index abf9c0cab1e2..461b310c7872 100644
--- a/sound/sh/sh_dac_audio.c
+++ b/sound/sh/sh_dac_audio.c
@@ -87,7 +87,7 @@ static void dac_audio_reset(struct snd_sh_dac *chip)
87 87
88static void dac_audio_set_rate(struct snd_sh_dac *chip) 88static void dac_audio_set_rate(struct snd_sh_dac *chip)
89{ 89{
90 chip->wakeups_per_second = ktime_set(0, 1000000000 / chip->rate); 90 chip->wakeups_per_second = 1000000000 / chip->rate;
91} 91}
92 92
93 93
diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index c602c4960924..0c6228a0bf95 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -1368,7 +1368,7 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev,
1368 return hdac_hdmi_init_dai_map(edev); 1368 return hdac_hdmi_init_dai_map(edev);
1369} 1369}
1370 1370
1371static void hdac_hdmi_eld_notify_cb(void *aptr, int port) 1371static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe)
1372{ 1372{
1373 struct hdac_ext_device *edev = aptr; 1373 struct hdac_ext_device *edev = aptr;
1374 struct hdac_hdmi_priv *hdmi = edev->private_data; 1374 struct hdac_hdmi_priv *hdmi = edev->private_data;
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 2ddc034673a8..f36cb068dad3 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -206,7 +206,6 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
206 if (! snd_usb_parse_audio_interface(chip, interface)) { 206 if (! snd_usb_parse_audio_interface(chip, interface)) {
207 usb_set_interface(dev, interface, 0); /* reset the current interface */ 207 usb_set_interface(dev, interface, 0); /* reset the current interface */
208 usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L); 208 usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L);
209 return -EINVAL;
210 } 209 }
211 210
212 return 0; 211 return 0;
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index c470251cea4b..15d1d5c63c3c 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -630,10 +630,24 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep,
630 630
631 ep->datainterval = fmt->datainterval; 631 ep->datainterval = fmt->datainterval;
632 ep->stride = frame_bits >> 3; 632 ep->stride = frame_bits >> 3;
633 ep->silence_value = pcm_format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0;
634 633
635 /* assume max. frequency is 25% higher than nominal */ 634 switch (pcm_format) {
636 ep->freqmax = ep->freqn + (ep->freqn >> 2); 635 case SNDRV_PCM_FORMAT_U8:
636 ep->silence_value = 0x80;
637 break;
638 case SNDRV_PCM_FORMAT_DSD_U8:
639 case SNDRV_PCM_FORMAT_DSD_U16_LE:
640 case SNDRV_PCM_FORMAT_DSD_U32_LE:
641 case SNDRV_PCM_FORMAT_DSD_U16_BE:
642 case SNDRV_PCM_FORMAT_DSD_U32_BE:
643 ep->silence_value = 0x69;
644 break;
645 default:
646 ep->silence_value = 0;
647 }
648
649 /* assume max. frequency is 50% higher than nominal */
650 ep->freqmax = ep->freqn + (ep->freqn >> 1);
637 /* Round up freqmax to nearest integer in order to calculate maximum 651 /* Round up freqmax to nearest integer in order to calculate maximum
638 * packet size, which must represent a whole number of frames. 652 * packet size, which must represent a whole number of frames.
639 * This is accomplished by adding 0x0.ffff before converting the 653 * This is accomplished by adding 0x0.ffff before converting the
diff --git a/sound/usb/hiface/pcm.c b/sound/usb/hiface/pcm.c
index 2c44139b4041..33db205dd12b 100644
--- a/sound/usb/hiface/pcm.c
+++ b/sound/usb/hiface/pcm.c
@@ -445,6 +445,8 @@ static int hiface_pcm_prepare(struct snd_pcm_substream *alsa_sub)
445 445
446 mutex_lock(&rt->stream_mutex); 446 mutex_lock(&rt->stream_mutex);
447 447
448 hiface_pcm_stream_stop(rt);
449
448 sub->dma_off = 0; 450 sub->dma_off = 0;
449 sub->period_off = 0; 451 sub->period_off = 0;
450 452
diff --git a/sound/usb/line6/driver.h b/sound/usb/line6/driver.h
index 7e3a3aada222..a5c2e9ae5f17 100644
--- a/sound/usb/line6/driver.h
+++ b/sound/usb/line6/driver.h
@@ -98,10 +98,11 @@ struct line6_properties {
98 98
99 int altsetting; 99 int altsetting;
100 100
101 unsigned ep_ctrl_r; 101 unsigned int ctrl_if;
102 unsigned ep_ctrl_w; 102 unsigned int ep_ctrl_r;
103 unsigned ep_audio_r; 103 unsigned int ep_ctrl_w;
104 unsigned ep_audio_w; 104 unsigned int ep_audio_r;
105 unsigned int ep_audio_w;
105}; 106};
106 107
107/* Capability bits */ 108/* Capability bits */
diff --git a/sound/usb/line6/podhd.c b/sound/usb/line6/podhd.c
index 49cd4a65e390..6ab23e5aee71 100644
--- a/sound/usb/line6/podhd.c
+++ b/sound/usb/line6/podhd.c
@@ -153,6 +153,7 @@ static struct line6_pcm_properties podx3_pcm_properties = {
153 .rats = &podhd_ratden}, 153 .rats = &podhd_ratden},
154 .bytes_per_channel = 3 /* SNDRV_PCM_FMTBIT_S24_3LE */ 154 .bytes_per_channel = 3 /* SNDRV_PCM_FMTBIT_S24_3LE */
155}; 155};
156static struct usb_driver podhd_driver;
156 157
157static void podhd_startup_start_workqueue(unsigned long data); 158static void podhd_startup_start_workqueue(unsigned long data);
158static void podhd_startup_workqueue(struct work_struct *work); 159static void podhd_startup_workqueue(struct work_struct *work);
@@ -291,8 +292,14 @@ static void podhd_disconnect(struct usb_line6 *line6)
291 struct usb_line6_podhd *pod = (struct usb_line6_podhd *)line6; 292 struct usb_line6_podhd *pod = (struct usb_line6_podhd *)line6;
292 293
293 if (pod->line6.properties->capabilities & LINE6_CAP_CONTROL) { 294 if (pod->line6.properties->capabilities & LINE6_CAP_CONTROL) {
295 struct usb_interface *intf;
296
294 del_timer_sync(&pod->startup_timer); 297 del_timer_sync(&pod->startup_timer);
295 cancel_work_sync(&pod->startup_work); 298 cancel_work_sync(&pod->startup_work);
299
300 intf = usb_ifnum_to_if(line6->usbdev,
301 pod->line6.properties->ctrl_if);
302 usb_driver_release_interface(&podhd_driver, intf);
296 } 303 }
297} 304}
298 305
@@ -304,10 +311,27 @@ static int podhd_init(struct usb_line6 *line6,
304{ 311{
305 int err; 312 int err;
306 struct usb_line6_podhd *pod = (struct usb_line6_podhd *) line6; 313 struct usb_line6_podhd *pod = (struct usb_line6_podhd *) line6;
314 struct usb_interface *intf;
307 315
308 line6->disconnect = podhd_disconnect; 316 line6->disconnect = podhd_disconnect;
309 317
310 if (pod->line6.properties->capabilities & LINE6_CAP_CONTROL) { 318 if (pod->line6.properties->capabilities & LINE6_CAP_CONTROL) {
319 /* claim the data interface */
320 intf = usb_ifnum_to_if(line6->usbdev,
321 pod->line6.properties->ctrl_if);
322 if (!intf) {
323 dev_err(pod->line6.ifcdev, "interface %d not found\n",
324 pod->line6.properties->ctrl_if);
325 return -ENODEV;
326 }
327
328 err = usb_driver_claim_interface(&podhd_driver, intf, NULL);
329 if (err != 0) {
330 dev_err(pod->line6.ifcdev, "can't claim interface %d, error %d\n",
331 pod->line6.properties->ctrl_if, err);
332 return err;
333 }
334
311 /* create sysfs entries: */ 335 /* create sysfs entries: */
312 err = snd_card_add_dev_attr(line6->card, &podhd_dev_attr_group); 336 err = snd_card_add_dev_attr(line6->card, &podhd_dev_attr_group);
313 if (err < 0) 337 if (err < 0)
@@ -406,6 +430,7 @@ static const struct line6_properties podhd_properties_table[] = {
406 .altsetting = 1, 430 .altsetting = 1,
407 .ep_ctrl_r = 0x81, 431 .ep_ctrl_r = 0x81,
408 .ep_ctrl_w = 0x01, 432 .ep_ctrl_w = 0x01,
433 .ctrl_if = 1,
409 .ep_audio_r = 0x86, 434 .ep_audio_r = 0x86,
410 .ep_audio_w = 0x02, 435 .ep_audio_w = 0x02,
411 }, 436 },
@@ -417,6 +442,7 @@ static const struct line6_properties podhd_properties_table[] = {
417 .altsetting = 1, 442 .altsetting = 1,
418 .ep_ctrl_r = 0x81, 443 .ep_ctrl_r = 0x81,
419 .ep_ctrl_w = 0x01, 444 .ep_ctrl_w = 0x01,
445 .ctrl_if = 1,
420 .ep_audio_r = 0x86, 446 .ep_audio_r = 0x86,
421 .ep_audio_w = 0x02, 447 .ep_audio_w = 0x02,
422 }, 448 },
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 2f8c388ef84f..4703caea56b2 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -932,9 +932,10 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
932 case USB_ID(0x046d, 0x0826): /* HD Webcam c525 */ 932 case USB_ID(0x046d, 0x0826): /* HD Webcam c525 */
933 case USB_ID(0x046d, 0x08ca): /* Logitech Quickcam Fusion */ 933 case USB_ID(0x046d, 0x08ca): /* Logitech Quickcam Fusion */
934 case USB_ID(0x046d, 0x0991): 934 case USB_ID(0x046d, 0x0991):
935 case USB_ID(0x046d, 0x09a2): /* QuickCam Communicate Deluxe/S7500 */
935 /* Most audio usb devices lie about volume resolution. 936 /* Most audio usb devices lie about volume resolution.
936 * Most Logitech webcams have res = 384. 937 * Most Logitech webcams have res = 384.
937 * Proboly there is some logitech magic behind this number --fishor 938 * Probably there is some logitech magic behind this number --fishor
938 */ 939 */
939 if (!strcmp(kctl->id.name, "Mic Capture Volume")) { 940 if (!strcmp(kctl->id.name, "Mic Capture Volume")) {
940 usb_audio_info(chip, 941 usb_audio_info(chip,
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 44d178ee9177..34c6d4f2c0b6 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -348,6 +348,16 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
348 348
349 alts = &iface->altsetting[1]; 349 alts = &iface->altsetting[1];
350 goto add_sync_ep; 350 goto add_sync_ep;
351 case USB_ID(0x2466, 0x8003):
352 ep = 0x86;
353 iface = usb_ifnum_to_if(dev, 2);
354
355 if (!iface || iface->num_altsetting == 0)
356 return -EINVAL;
357
358 alts = &iface->altsetting[1];
359 goto add_sync_ep;
360
351 } 361 }
352 if (attr == USB_ENDPOINT_SYNC_ASYNC && 362 if (attr == USB_ENDPOINT_SYNC_ASYNC &&
353 altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC && 363 altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC &&
@@ -806,17 +816,18 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
806 if (ret < 0) 816 if (ret < 0)
807 goto unlock; 817 goto unlock;
808 818
809 iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface);
810 alts = &iface->altsetting[subs->cur_audiofmt->altset_idx];
811 ret = snd_usb_init_sample_rate(subs->stream->chip,
812 subs->cur_audiofmt->iface,
813 alts,
814 subs->cur_audiofmt,
815 subs->cur_rate);
816 if (ret < 0)
817 goto unlock;
818
819 if (subs->need_setup_ep) { 819 if (subs->need_setup_ep) {
820
821 iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface);
822 alts = &iface->altsetting[subs->cur_audiofmt->altset_idx];
823 ret = snd_usb_init_sample_rate(subs->stream->chip,
824 subs->cur_audiofmt->iface,
825 alts,
826 subs->cur_audiofmt,
827 subs->cur_rate);
828 if (ret < 0)
829 goto unlock;
830
820 ret = configure_endpoint(subs); 831 ret = configure_endpoint(subs);
821 if (ret < 0) 832 if (ret < 0)
822 goto unlock; 833 goto unlock;
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 2782155ae3ce..b3fd2382fdd9 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1165,6 +1165,18 @@ static bool is_marantz_denon_dac(unsigned int id)
1165 return false; 1165 return false;
1166} 1166}
1167 1167
1168/* TEAC UD-501/UD-503/NT-503 USB DACs need a vendor cmd to switch
1169 * between PCM/DOP and native DSD mode
1170 */
1171static bool is_teac_50X_dac(unsigned int id)
1172{
1173 switch (id) {
1174 case USB_ID(0x0644, 0x8043): /* TEAC UD-501/UD-503/NT-503 */
1175 return true;
1176 }
1177 return false;
1178}
1179
1168int snd_usb_select_mode_quirk(struct snd_usb_substream *subs, 1180int snd_usb_select_mode_quirk(struct snd_usb_substream *subs,
1169 struct audioformat *fmt) 1181 struct audioformat *fmt)
1170{ 1182{
@@ -1192,6 +1204,26 @@ int snd_usb_select_mode_quirk(struct snd_usb_substream *subs,
1192 break; 1204 break;
1193 } 1205 }
1194 mdelay(20); 1206 mdelay(20);
1207 } else if (is_teac_50X_dac(subs->stream->chip->usb_id)) {
1208 /* Vendor mode switch cmd is required. */
1209 switch (fmt->altsetting) {
1210 case 3: /* DSD mode (DSD_U32) requested */
1211 err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0,
1212 USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
1213 1, 1, NULL, 0);
1214 if (err < 0)
1215 return err;
1216 break;
1217
1218 case 2: /* PCM or DOP mode (S32) requested */
1219 case 1: /* PCM mode (S16) requested */
1220 err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0,
1221 USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
1222 0, 1, NULL, 0);
1223 if (err < 0)
1224 return err;
1225 break;
1226 }
1195 } 1227 }
1196 return 0; 1228 return 0;
1197} 1229}
@@ -1337,5 +1369,11 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
1337 return SNDRV_PCM_FMTBIT_DSD_U32_BE; 1369 return SNDRV_PCM_FMTBIT_DSD_U32_BE;
1338 } 1370 }
1339 1371
1372 /* TEAC devices with USB DAC functionality */
1373 if (is_teac_50X_dac(chip->usb_id)) {
1374 if (fp->altsetting == 3)
1375 return SNDRV_PCM_FMTBIT_DSD_U32_BE;
1376 }
1377
1340 return 0; 1378 return 0;
1341} 1379}