aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/core/pcm_native.c12
-rw-r--r--sound/core/seq/seq_timer.c8
-rw-r--r--sound/oss/sequencer.c6
-rw-r--r--sound/pci/asihpi/asihpi.c3
-rw-r--r--sound/pci/hda/hda_codec.c28
-rw-r--r--sound/pci/hda/hda_eld.c2
-rw-r--r--sound/pci/hda/hda_generic.c48
-rw-r--r--sound/pci/hda/hda_intel.c138
-rw-r--r--sound/pci/hda/patch_ca0132.c28
-rw-r--r--sound/pci/hda/patch_cirrus.c8
-rw-r--r--sound/pci/hda/patch_conexant.c16
-rw-r--r--sound/pci/hda/patch_hdmi.c2
-rw-r--r--sound/pci/hda/patch_realtek.c4
-rw-r--r--sound/pci/hda/patch_sigmatel.c29
-rw-r--r--sound/soc/codecs/Kconfig2
-rw-r--r--[-rwxr-xr-x]sound/soc/codecs/max98090.c0
-rw-r--r--[-rwxr-xr-x]sound/soc/codecs/max98090.h0
-rw-r--r--sound/soc/codecs/si476x.c1
-rw-r--r--sound/soc/codecs/wm5102.c2
-rw-r--r--sound/soc/codecs/wm8903.c2
-rw-r--r--sound/soc/codecs/wm_adsp.c5
-rw-r--r--sound/soc/fsl/imx-ssi.c5
-rw-r--r--sound/soc/fsl/pcm030-audio-fabric.c2
-rw-r--r--sound/soc/samsung/i2s.c17
-rw-r--r--sound/soc/sh/dma-sh7760.c4
-rw-r--r--sound/soc/soc-compress.c14
-rw-r--r--sound/soc/soc-core.c39
-rw-r--r--sound/soc/soc-dapm.c15
-rw-r--r--sound/soc/soc-io.c5
-rw-r--r--sound/soc/soc-utils.c25
-rw-r--r--sound/soc/spear/spear_pcm.c12
-rw-r--r--sound/soc/tegra/tegra_pcm.c24
-rw-r--r--sound/usb/card.c15
-rw-r--r--sound/usb/clock.c45
-rw-r--r--sound/usb/mixer.c21
-rw-r--r--sound/usb/mixer_quirks.c4
-rw-r--r--sound/usb/quirks.c2
37 files changed, 426 insertions, 167 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 71ae86ca64ac..eb560fa32321 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -3222,18 +3222,10 @@ EXPORT_SYMBOL_GPL(snd_pcm_lib_default_mmap);
3222int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, 3222int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream,
3223 struct vm_area_struct *area) 3223 struct vm_area_struct *area)
3224{ 3224{
3225 long size; 3225 struct snd_pcm_runtime *runtime = substream->runtime;;
3226 unsigned long offset;
3227 3226
3228 area->vm_page_prot = pgprot_noncached(area->vm_page_prot); 3227 area->vm_page_prot = pgprot_noncached(area->vm_page_prot);
3229 area->vm_flags |= VM_IO; 3228 return vm_iomap_memory(area, runtime->dma_addr, runtime->dma_bytes);
3230 size = area->vm_end - area->vm_start;
3231 offset = area->vm_pgoff << PAGE_SHIFT;
3232 if (io_remap_pfn_range(area, area->vm_start,
3233 (substream->runtime->dma_addr + offset) >> PAGE_SHIFT,
3234 size, area->vm_page_prot))
3235 return -EAGAIN;
3236 return 0;
3237} 3229}
3238 3230
3239EXPORT_SYMBOL(snd_pcm_lib_mmap_iomem); 3231EXPORT_SYMBOL(snd_pcm_lib_mmap_iomem);
diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c
index 160b1bd0cd62..24d44b2f61ac 100644
--- a/sound/core/seq/seq_timer.c
+++ b/sound/core/seq/seq_timer.c
@@ -290,10 +290,10 @@ int snd_seq_timer_open(struct snd_seq_queue *q)
290 tid.device = SNDRV_TIMER_GLOBAL_SYSTEM; 290 tid.device = SNDRV_TIMER_GLOBAL_SYSTEM;
291 err = snd_timer_open(&t, str, &tid, q->queue); 291 err = snd_timer_open(&t, str, &tid, q->queue);
292 } 292 }
293 if (err < 0) { 293 }
294 snd_printk(KERN_ERR "seq fatal error: cannot create timer (%i)\n", err); 294 if (err < 0) {
295 return err; 295 snd_printk(KERN_ERR "seq fatal error: cannot create timer (%i)\n", err);
296 } 296 return err;
297 } 297 }
298 t->callback = snd_seq_timer_interrupt; 298 t->callback = snd_seq_timer_interrupt;
299 t->callback_data = q; 299 t->callback_data = q;
diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c
index 30bcfe470f83..4ff60a6427d9 100644
--- a/sound/oss/sequencer.c
+++ b/sound/oss/sequencer.c
@@ -545,6 +545,9 @@ static void seq_chn_common_event(unsigned char *event_rec)
545 case MIDI_PGM_CHANGE: 545 case MIDI_PGM_CHANGE:
546 if (seq_mode == SEQ_2) 546 if (seq_mode == SEQ_2)
547 { 547 {
548 if (chn > 15)
549 break;
550
548 synth_devs[dev]->chn_info[chn].pgm_num = p1; 551 synth_devs[dev]->chn_info[chn].pgm_num = p1;
549 if ((int) dev >= num_synths) 552 if ((int) dev >= num_synths)
550 synth_devs[dev]->set_instr(dev, chn, p1); 553 synth_devs[dev]->set_instr(dev, chn, p1);
@@ -596,6 +599,9 @@ static void seq_chn_common_event(unsigned char *event_rec)
596 case MIDI_PITCH_BEND: 599 case MIDI_PITCH_BEND:
597 if (seq_mode == SEQ_2) 600 if (seq_mode == SEQ_2)
598 { 601 {
602 if (chn > 15)
603 break;
604
599 synth_devs[dev]->chn_info[chn].bender_value = w14; 605 synth_devs[dev]->chn_info[chn].bender_value = w14;
600 606
601 if ((int) dev < num_synths) 607 if ((int) dev < num_synths)
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c
index 3536b076b529..0aabfedeecba 100644
--- a/sound/pci/asihpi/asihpi.c
+++ b/sound/pci/asihpi/asihpi.c
@@ -2549,7 +2549,7 @@ static int snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi,
2549 2549
2550static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) 2550static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
2551{ 2551{
2552 struct snd_card *card = asihpi->card; 2552 struct snd_card *card;
2553 unsigned int idx = 0; 2553 unsigned int idx = 0;
2554 unsigned int subindex = 0; 2554 unsigned int subindex = 0;
2555 int err; 2555 int err;
@@ -2557,6 +2557,7 @@ static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
2557 2557
2558 if (snd_BUG_ON(!asihpi)) 2558 if (snd_BUG_ON(!asihpi))
2559 return -EINVAL; 2559 return -EINVAL;
2560 card = asihpi->card;
2560 strcpy(card->mixername, "Asihpi Mixer"); 2561 strcpy(card->mixername, "Asihpi Mixer");
2561 2562
2562 err = 2563 err =
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 97c68dd24ef5..4aba7646dd9c 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -173,7 +173,7 @@ const char *snd_hda_get_jack_type(u32 cfg)
173 "Line Out", "Speaker", "HP Out", "CD", 173 "Line Out", "Speaker", "HP Out", "CD",
174 "SPDIF Out", "Digital Out", "Modem Line", "Modem Hand", 174 "SPDIF Out", "Digital Out", "Modem Line", "Modem Hand",
175 "Line In", "Aux", "Mic", "Telephony", 175 "Line In", "Aux", "Mic", "Telephony",
176 "SPDIF In", "Digitial In", "Reserved", "Other" 176 "SPDIF In", "Digital In", "Reserved", "Other"
177 }; 177 };
178 178
179 return jack_types[(cfg & AC_DEFCFG_DEVICE) 179 return jack_types[(cfg & AC_DEFCFG_DEVICE)
@@ -494,7 +494,7 @@ static unsigned int get_num_conns(struct hda_codec *codec, hda_nid_t nid)
494 494
495int snd_hda_get_num_raw_conns(struct hda_codec *codec, hda_nid_t nid) 495int snd_hda_get_num_raw_conns(struct hda_codec *codec, hda_nid_t nid)
496{ 496{
497 return get_num_conns(codec, nid) & AC_CLIST_LENGTH; 497 return snd_hda_get_raw_connections(codec, nid, NULL, 0);
498} 498}
499 499
500/** 500/**
@@ -517,9 +517,6 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
517 hda_nid_t prev_nid; 517 hda_nid_t prev_nid;
518 int null_count = 0; 518 int null_count = 0;
519 519
520 if (snd_BUG_ON(!conn_list || max_conns <= 0))
521 return -EINVAL;
522
523 parm = get_num_conns(codec, nid); 520 parm = get_num_conns(codec, nid);
524 if (!parm) 521 if (!parm)
525 return 0; 522 return 0;
@@ -545,7 +542,8 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
545 AC_VERB_GET_CONNECT_LIST, 0); 542 AC_VERB_GET_CONNECT_LIST, 0);
546 if (parm == -1 && codec->bus->rirb_error) 543 if (parm == -1 && codec->bus->rirb_error)
547 return -EIO; 544 return -EIO;
548 conn_list[0] = parm & mask; 545 if (conn_list)
546 conn_list[0] = parm & mask;
549 return 1; 547 return 1;
550 } 548 }
551 549
@@ -580,14 +578,20 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
580 continue; 578 continue;
581 } 579 }
582 for (n = prev_nid + 1; n <= val; n++) { 580 for (n = prev_nid + 1; n <= val; n++) {
581 if (conn_list) {
582 if (conns >= max_conns)
583 return -ENOSPC;
584 conn_list[conns] = n;
585 }
586 conns++;
587 }
588 } else {
589 if (conn_list) {
583 if (conns >= max_conns) 590 if (conns >= max_conns)
584 return -ENOSPC; 591 return -ENOSPC;
585 conn_list[conns++] = n; 592 conn_list[conns] = val;
586 } 593 }
587 } else { 594 conns++;
588 if (conns >= max_conns)
589 return -ENOSPC;
590 conn_list[conns++] = val;
591 } 595 }
592 prev_nid = val; 596 prev_nid = val;
593 } 597 }
@@ -3140,7 +3144,7 @@ static unsigned int convert_to_spdif_status(unsigned short val)
3140 if (val & AC_DIG1_PROFESSIONAL) 3144 if (val & AC_DIG1_PROFESSIONAL)
3141 sbits |= IEC958_AES0_PROFESSIONAL; 3145 sbits |= IEC958_AES0_PROFESSIONAL;
3142 if (sbits & IEC958_AES0_PROFESSIONAL) { 3146 if (sbits & IEC958_AES0_PROFESSIONAL) {
3143 if (sbits & AC_DIG1_EMPHASIS) 3147 if (val & AC_DIG1_EMPHASIS)
3144 sbits |= IEC958_AES0_PRO_EMPHASIS_5015; 3148 sbits |= IEC958_AES0_PRO_EMPHASIS_5015;
3145 } else { 3149 } else {
3146 if (val & AC_DIG1_EMPHASIS) 3150 if (val & AC_DIG1_EMPHASIS)
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index 7dd846380a50..d0d7ac1e99d2 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -320,7 +320,7 @@ int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid,
320 unsigned char *buf, int *eld_size) 320 unsigned char *buf, int *eld_size)
321{ 321{
322 int i; 322 int i;
323 int ret; 323 int ret = 0;
324 int size; 324 int size;
325 325
326 /* 326 /*
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 78897d05d80f..2dbe767be16b 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -740,7 +740,7 @@ EXPORT_SYMBOL_HDA(snd_hda_activate_path);
740static void path_power_down_sync(struct hda_codec *codec, struct nid_path *path) 740static void path_power_down_sync(struct hda_codec *codec, struct nid_path *path)
741{ 741{
742 struct hda_gen_spec *spec = codec->spec; 742 struct hda_gen_spec *spec = codec->spec;
743 bool changed; 743 bool changed = false;
744 int i; 744 int i;
745 745
746 if (!spec->power_down_unused || path->active) 746 if (!spec->power_down_unused || path->active)
@@ -995,6 +995,8 @@ enum {
995 BAD_NO_EXTRA_SURR_DAC = 0x101, 995 BAD_NO_EXTRA_SURR_DAC = 0x101,
996 /* Primary DAC shared with main surrounds */ 996 /* Primary DAC shared with main surrounds */
997 BAD_SHARED_SURROUND = 0x100, 997 BAD_SHARED_SURROUND = 0x100,
998 /* No independent HP possible */
999 BAD_NO_INDEP_HP = 0x40,
998 /* Primary DAC shared with main CLFE */ 1000 /* Primary DAC shared with main CLFE */
999 BAD_SHARED_CLFE = 0x10, 1001 BAD_SHARED_CLFE = 0x10,
1000 /* Primary DAC shared with extra surrounds */ 1002 /* Primary DAC shared with extra surrounds */
@@ -1392,6 +1394,43 @@ static int check_aamix_out_path(struct hda_codec *codec, int path_idx)
1392 return snd_hda_get_path_idx(codec, path); 1394 return snd_hda_get_path_idx(codec, path);
1393} 1395}
1394 1396
1397/* check whether the independent HP is available with the current config */
1398static bool indep_hp_possible(struct hda_codec *codec)
1399{
1400 struct hda_gen_spec *spec = codec->spec;
1401 struct auto_pin_cfg *cfg = &spec->autocfg;
1402 struct nid_path *path;
1403 int i, idx;
1404
1405 if (cfg->line_out_type == AUTO_PIN_HP_OUT)
1406 idx = spec->out_paths[0];
1407 else
1408 idx = spec->hp_paths[0];
1409 path = snd_hda_get_path_from_idx(codec, idx);
1410 if (!path)
1411 return false;
1412
1413 /* assume no path conflicts unless aamix is involved */
1414 if (!spec->mixer_nid || !is_nid_contained(path, spec->mixer_nid))
1415 return true;
1416
1417 /* check whether output paths contain aamix */
1418 for (i = 0; i < cfg->line_outs; i++) {
1419 if (spec->out_paths[i] == idx)
1420 break;
1421 path = snd_hda_get_path_from_idx(codec, spec->out_paths[i]);
1422 if (path && is_nid_contained(path, spec->mixer_nid))
1423 return false;
1424 }
1425 for (i = 0; i < cfg->speaker_outs; i++) {
1426 path = snd_hda_get_path_from_idx(codec, spec->speaker_paths[i]);
1427 if (path && is_nid_contained(path, spec->mixer_nid))
1428 return false;
1429 }
1430
1431 return true;
1432}
1433
1395/* fill the empty entries in the dac array for speaker/hp with the 1434/* fill the empty entries in the dac array for speaker/hp with the
1396 * shared dac pointed by the paths 1435 * shared dac pointed by the paths
1397 */ 1436 */
@@ -1545,6 +1584,9 @@ static int fill_and_eval_dacs(struct hda_codec *codec,
1545 badness += BAD_MULTI_IO; 1584 badness += BAD_MULTI_IO;
1546 } 1585 }
1547 1586
1587 if (spec->indep_hp && !indep_hp_possible(codec))
1588 badness += BAD_NO_INDEP_HP;
1589
1548 /* re-fill the shared DAC for speaker / headphone */ 1590 /* re-fill the shared DAC for speaker / headphone */
1549 if (cfg->line_out_type != AUTO_PIN_HP_OUT) 1591 if (cfg->line_out_type != AUTO_PIN_HP_OUT)
1550 refill_shared_dacs(codec, cfg->hp_outs, 1592 refill_shared_dacs(codec, cfg->hp_outs,
@@ -1758,6 +1800,10 @@ static int parse_output_paths(struct hda_codec *codec)
1758 cfg->speaker_pins, val); 1800 cfg->speaker_pins, val);
1759 } 1801 }
1760 1802
1803 /* clear indep_hp flag if not available */
1804 if (spec->indep_hp && !indep_hp_possible(codec))
1805 spec->indep_hp = 0;
1806
1761 kfree(best_cfg); 1807 kfree(best_cfg);
1762 return 0; 1808 return 0;
1763} 1809}
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 4cea6bb6fade..bcd40ee488e3 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -134,8 +134,8 @@ MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "
134 * this may give more power-saving, but will take longer time to 134 * this may give more power-saving, but will take longer time to
135 * wake up. 135 * wake up.
136 */ 136 */
137static int power_save_controller = -1; 137static bool power_save_controller = 1;
138module_param(power_save_controller, bint, 0644); 138module_param(power_save_controller, bool, 0644);
139MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); 139MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode.");
140#endif /* CONFIG_PM */ 140#endif /* CONFIG_PM */
141 141
@@ -415,6 +415,8 @@ struct azx_dev {
415 unsigned int opened :1; 415 unsigned int opened :1;
416 unsigned int running :1; 416 unsigned int running :1;
417 unsigned int irq_pending :1; 417 unsigned int irq_pending :1;
418 unsigned int prepared:1;
419 unsigned int locked:1;
418 /* 420 /*
419 * For VIA: 421 * For VIA:
420 * A flag to ensure DMA position is 0 422 * A flag to ensure DMA position is 0
@@ -426,8 +428,25 @@ struct azx_dev {
426 428
427 struct timecounter azx_tc; 429 struct timecounter azx_tc;
428 struct cyclecounter azx_cc; 430 struct cyclecounter azx_cc;
431
432#ifdef CONFIG_SND_HDA_DSP_LOADER
433 struct mutex dsp_mutex;
434#endif
429}; 435};
430 436
437/* DSP lock helpers */
438#ifdef CONFIG_SND_HDA_DSP_LOADER
439#define dsp_lock_init(dev) mutex_init(&(dev)->dsp_mutex)
440#define dsp_lock(dev) mutex_lock(&(dev)->dsp_mutex)
441#define dsp_unlock(dev) mutex_unlock(&(dev)->dsp_mutex)
442#define dsp_is_locked(dev) ((dev)->locked)
443#else
444#define dsp_lock_init(dev) do {} while (0)
445#define dsp_lock(dev) do {} while (0)
446#define dsp_unlock(dev) do {} while (0)
447#define dsp_is_locked(dev) 0
448#endif
449
431/* CORB/RIRB */ 450/* CORB/RIRB */
432struct azx_rb { 451struct azx_rb {
433 u32 *buf; /* CORB/RIRB buffer 452 u32 *buf; /* CORB/RIRB buffer
@@ -527,6 +546,10 @@ struct azx {
527 546
528 /* card list (for power_save trigger) */ 547 /* card list (for power_save trigger) */
529 struct list_head list; 548 struct list_head list;
549
550#ifdef CONFIG_SND_HDA_DSP_LOADER
551 struct azx_dev saved_azx_dev;
552#endif
530}; 553};
531 554
532#define CREATE_TRACE_POINTS 555#define CREATE_TRACE_POINTS
@@ -1793,15 +1816,25 @@ azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream)
1793 dev = chip->capture_index_offset; 1816 dev = chip->capture_index_offset;
1794 nums = chip->capture_streams; 1817 nums = chip->capture_streams;
1795 } 1818 }
1796 for (i = 0; i < nums; i++, dev++) 1819 for (i = 0; i < nums; i++, dev++) {
1797 if (!chip->azx_dev[dev].opened) { 1820 struct azx_dev *azx_dev = &chip->azx_dev[dev];
1798 res = &chip->azx_dev[dev]; 1821 dsp_lock(azx_dev);
1799 if (res->assigned_key == key) 1822 if (!azx_dev->opened && !dsp_is_locked(azx_dev)) {
1800 break; 1823 res = azx_dev;
1824 if (res->assigned_key == key) {
1825 res->opened = 1;
1826 res->assigned_key = key;
1827 dsp_unlock(azx_dev);
1828 return azx_dev;
1829 }
1801 } 1830 }
1831 dsp_unlock(azx_dev);
1832 }
1802 if (res) { 1833 if (res) {
1834 dsp_lock(res);
1803 res->opened = 1; 1835 res->opened = 1;
1804 res->assigned_key = key; 1836 res->assigned_key = key;
1837 dsp_unlock(res);
1805 } 1838 }
1806 return res; 1839 return res;
1807} 1840}
@@ -2009,6 +2042,12 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream,
2009 struct azx_dev *azx_dev = get_azx_dev(substream); 2042 struct azx_dev *azx_dev = get_azx_dev(substream);
2010 int ret; 2043 int ret;
2011 2044
2045 dsp_lock(azx_dev);
2046 if (dsp_is_locked(azx_dev)) {
2047 ret = -EBUSY;
2048 goto unlock;
2049 }
2050
2012 mark_runtime_wc(chip, azx_dev, substream, false); 2051 mark_runtime_wc(chip, azx_dev, substream, false);
2013 azx_dev->bufsize = 0; 2052 azx_dev->bufsize = 0;
2014 azx_dev->period_bytes = 0; 2053 azx_dev->period_bytes = 0;
@@ -2016,8 +2055,10 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream,
2016 ret = snd_pcm_lib_malloc_pages(substream, 2055 ret = snd_pcm_lib_malloc_pages(substream,
2017 params_buffer_bytes(hw_params)); 2056 params_buffer_bytes(hw_params));
2018 if (ret < 0) 2057 if (ret < 0)
2019 return ret; 2058 goto unlock;
2020 mark_runtime_wc(chip, azx_dev, substream, true); 2059 mark_runtime_wc(chip, azx_dev, substream, true);
2060 unlock:
2061 dsp_unlock(azx_dev);
2021 return ret; 2062 return ret;
2022} 2063}
2023 2064
@@ -2029,16 +2070,21 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream)
2029 struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; 2070 struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream];
2030 2071
2031 /* reset BDL address */ 2072 /* reset BDL address */
2032 azx_sd_writel(azx_dev, SD_BDLPL, 0); 2073 dsp_lock(azx_dev);
2033 azx_sd_writel(azx_dev, SD_BDLPU, 0); 2074 if (!dsp_is_locked(azx_dev)) {
2034 azx_sd_writel(azx_dev, SD_CTL, 0); 2075 azx_sd_writel(azx_dev, SD_BDLPL, 0);
2035 azx_dev->bufsize = 0; 2076 azx_sd_writel(azx_dev, SD_BDLPU, 0);
2036 azx_dev->period_bytes = 0; 2077 azx_sd_writel(azx_dev, SD_CTL, 0);
2037 azx_dev->format_val = 0; 2078 azx_dev->bufsize = 0;
2079 azx_dev->period_bytes = 0;
2080 azx_dev->format_val = 0;
2081 }
2038 2082
2039 snd_hda_codec_cleanup(apcm->codec, hinfo, substream); 2083 snd_hda_codec_cleanup(apcm->codec, hinfo, substream);
2040 2084
2041 mark_runtime_wc(chip, azx_dev, substream, false); 2085 mark_runtime_wc(chip, azx_dev, substream, false);
2086 azx_dev->prepared = 0;
2087 dsp_unlock(azx_dev);
2042 return snd_pcm_lib_free_pages(substream); 2088 return snd_pcm_lib_free_pages(substream);
2043} 2089}
2044 2090
@@ -2055,6 +2101,12 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream)
2055 snd_hda_spdif_out_of_nid(apcm->codec, hinfo->nid); 2101 snd_hda_spdif_out_of_nid(apcm->codec, hinfo->nid);
2056 unsigned short ctls = spdif ? spdif->ctls : 0; 2102 unsigned short ctls = spdif ? spdif->ctls : 0;
2057 2103
2104 dsp_lock(azx_dev);
2105 if (dsp_is_locked(azx_dev)) {
2106 err = -EBUSY;
2107 goto unlock;
2108 }
2109
2058 azx_stream_reset(chip, azx_dev); 2110 azx_stream_reset(chip, azx_dev);
2059 format_val = snd_hda_calc_stream_format(runtime->rate, 2111 format_val = snd_hda_calc_stream_format(runtime->rate,
2060 runtime->channels, 2112 runtime->channels,
@@ -2065,7 +2117,8 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream)
2065 snd_printk(KERN_ERR SFX 2117 snd_printk(KERN_ERR SFX
2066 "%s: invalid format_val, rate=%d, ch=%d, format=%d\n", 2118 "%s: invalid format_val, rate=%d, ch=%d, format=%d\n",
2067 pci_name(chip->pci), runtime->rate, runtime->channels, runtime->format); 2119 pci_name(chip->pci), runtime->rate, runtime->channels, runtime->format);
2068 return -EINVAL; 2120 err = -EINVAL;
2121 goto unlock;
2069 } 2122 }
2070 2123
2071 bufsize = snd_pcm_lib_buffer_bytes(substream); 2124 bufsize = snd_pcm_lib_buffer_bytes(substream);
@@ -2084,7 +2137,7 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream)
2084 azx_dev->no_period_wakeup = runtime->no_period_wakeup; 2137 azx_dev->no_period_wakeup = runtime->no_period_wakeup;
2085 err = azx_setup_periods(chip, substream, azx_dev); 2138 err = azx_setup_periods(chip, substream, azx_dev);
2086 if (err < 0) 2139 if (err < 0)
2087 return err; 2140 goto unlock;
2088 } 2141 }
2089 2142
2090 /* wallclk has 24Mhz clock source */ 2143 /* wallclk has 24Mhz clock source */
@@ -2101,8 +2154,14 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream)
2101 if ((chip->driver_caps & AZX_DCAPS_CTX_WORKAROUND) && 2154 if ((chip->driver_caps & AZX_DCAPS_CTX_WORKAROUND) &&
2102 stream_tag > chip->capture_streams) 2155 stream_tag > chip->capture_streams)
2103 stream_tag -= chip->capture_streams; 2156 stream_tag -= chip->capture_streams;
2104 return snd_hda_codec_prepare(apcm->codec, hinfo, stream_tag, 2157 err = snd_hda_codec_prepare(apcm->codec, hinfo, stream_tag,
2105 azx_dev->format_val, substream); 2158 azx_dev->format_val, substream);
2159
2160 unlock:
2161 if (!err)
2162 azx_dev->prepared = 1;
2163 dsp_unlock(azx_dev);
2164 return err;
2106} 2165}
2107 2166
2108static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) 2167static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
@@ -2117,6 +2176,9 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
2117 azx_dev = get_azx_dev(substream); 2176 azx_dev = get_azx_dev(substream);
2118 trace_azx_pcm_trigger(chip, azx_dev, cmd); 2177 trace_azx_pcm_trigger(chip, azx_dev, cmd);
2119 2178
2179 if (dsp_is_locked(azx_dev) || !azx_dev->prepared)
2180 return -EPIPE;
2181
2120 switch (cmd) { 2182 switch (cmd) {
2121 case SNDRV_PCM_TRIGGER_START: 2183 case SNDRV_PCM_TRIGGER_START:
2122 rstart = 1; 2184 rstart = 1;
@@ -2621,17 +2683,27 @@ static int azx_load_dsp_prepare(struct hda_bus *bus, unsigned int format,
2621 struct azx_dev *azx_dev; 2683 struct azx_dev *azx_dev;
2622 int err; 2684 int err;
2623 2685
2624 if (snd_hda_lock_devices(bus)) 2686 azx_dev = azx_get_dsp_loader_dev(chip);
2625 return -EBUSY; 2687
2688 dsp_lock(azx_dev);
2689 spin_lock_irq(&chip->reg_lock);
2690 if (azx_dev->running || azx_dev->locked) {
2691 spin_unlock_irq(&chip->reg_lock);
2692 err = -EBUSY;
2693 goto unlock;
2694 }
2695 azx_dev->prepared = 0;
2696 chip->saved_azx_dev = *azx_dev;
2697 azx_dev->locked = 1;
2698 spin_unlock_irq(&chip->reg_lock);
2626 2699
2627 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, 2700 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG,
2628 snd_dma_pci_data(chip->pci), 2701 snd_dma_pci_data(chip->pci),
2629 byte_size, bufp); 2702 byte_size, bufp);
2630 if (err < 0) 2703 if (err < 0)
2631 goto unlock; 2704 goto err_alloc;
2632 2705
2633 mark_pages_wc(chip, bufp, true); 2706 mark_pages_wc(chip, bufp, true);
2634 azx_dev = azx_get_dsp_loader_dev(chip);
2635 azx_dev->bufsize = byte_size; 2707 azx_dev->bufsize = byte_size;
2636 azx_dev->period_bytes = byte_size; 2708 azx_dev->period_bytes = byte_size;
2637 azx_dev->format_val = format; 2709 azx_dev->format_val = format;
@@ -2649,13 +2721,20 @@ static int azx_load_dsp_prepare(struct hda_bus *bus, unsigned int format,
2649 goto error; 2721 goto error;
2650 2722
2651 azx_setup_controller(chip, azx_dev); 2723 azx_setup_controller(chip, azx_dev);
2724 dsp_unlock(azx_dev);
2652 return azx_dev->stream_tag; 2725 return azx_dev->stream_tag;
2653 2726
2654 error: 2727 error:
2655 mark_pages_wc(chip, bufp, false); 2728 mark_pages_wc(chip, bufp, false);
2656 snd_dma_free_pages(bufp); 2729 snd_dma_free_pages(bufp);
2657unlock: 2730 err_alloc:
2658 snd_hda_unlock_devices(bus); 2731 spin_lock_irq(&chip->reg_lock);
2732 if (azx_dev->opened)
2733 *azx_dev = chip->saved_azx_dev;
2734 azx_dev->locked = 0;
2735 spin_unlock_irq(&chip->reg_lock);
2736 unlock:
2737 dsp_unlock(azx_dev);
2659 return err; 2738 return err;
2660} 2739}
2661 2740
@@ -2677,9 +2756,10 @@ static void azx_load_dsp_cleanup(struct hda_bus *bus,
2677 struct azx *chip = bus->private_data; 2756 struct azx *chip = bus->private_data;
2678 struct azx_dev *azx_dev = azx_get_dsp_loader_dev(chip); 2757 struct azx_dev *azx_dev = azx_get_dsp_loader_dev(chip);
2679 2758
2680 if (!dmab->area) 2759 if (!dmab->area || !azx_dev->locked)
2681 return; 2760 return;
2682 2761
2762 dsp_lock(azx_dev);
2683 /* reset BDL address */ 2763 /* reset BDL address */
2684 azx_sd_writel(azx_dev, SD_BDLPL, 0); 2764 azx_sd_writel(azx_dev, SD_BDLPL, 0);
2685 azx_sd_writel(azx_dev, SD_BDLPU, 0); 2765 azx_sd_writel(azx_dev, SD_BDLPU, 0);
@@ -2692,7 +2772,12 @@ static void azx_load_dsp_cleanup(struct hda_bus *bus,
2692 snd_dma_free_pages(dmab); 2772 snd_dma_free_pages(dmab);
2693 dmab->area = NULL; 2773 dmab->area = NULL;
2694 2774
2695 snd_hda_unlock_devices(bus); 2775 spin_lock_irq(&chip->reg_lock);
2776 if (azx_dev->opened)
2777 *azx_dev = chip->saved_azx_dev;
2778 azx_dev->locked = 0;
2779 spin_unlock_irq(&chip->reg_lock);
2780 dsp_unlock(azx_dev);
2696} 2781}
2697#endif /* CONFIG_SND_HDA_DSP_LOADER */ 2782#endif /* CONFIG_SND_HDA_DSP_LOADER */
2698 2783
@@ -2846,8 +2931,6 @@ static int azx_runtime_idle(struct device *dev)
2846 struct snd_card *card = dev_get_drvdata(dev); 2931 struct snd_card *card = dev_get_drvdata(dev);
2847 struct azx *chip = card->private_data; 2932 struct azx *chip = card->private_data;
2848 2933
2849 if (power_save_controller > 0)
2850 return 0;
2851 if (!power_save_controller || 2934 if (!power_save_controller ||
2852 !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) 2935 !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
2853 return -EBUSY; 2936 return -EBUSY;
@@ -3481,6 +3564,7 @@ static int azx_first_init(struct azx *chip)
3481 } 3564 }
3482 3565
3483 for (i = 0; i < chip->num_streams; i++) { 3566 for (i = 0; i < chip->num_streams; i++) {
3567 dsp_lock_init(&chip->azx_dev[i]);
3484 /* allocate memory for the BDL for each stream */ 3568 /* allocate memory for the BDL for each stream */
3485 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, 3569 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
3486 snd_dma_pci_data(chip->pci), 3570 snd_dma_pci_data(chip->pci),
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index eefc4563b2f9..0792b5725f9c 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -3239,7 +3239,7 @@ static int ca0132_set_vipsource(struct hda_codec *codec, int val)
3239 struct ca0132_spec *spec = codec->spec; 3239 struct ca0132_spec *spec = codec->spec;
3240 unsigned int tmp; 3240 unsigned int tmp;
3241 3241
3242 if (!dspload_is_loaded(codec)) 3242 if (spec->dsp_state != DSP_DOWNLOADED)
3243 return 0; 3243 return 0;
3244 3244
3245 /* if CrystalVoice if off, vipsource should be 0 */ 3245 /* if CrystalVoice if off, vipsource should be 0 */
@@ -4267,11 +4267,12 @@ static void ca0132_refresh_widget_caps(struct hda_codec *codec)
4267 */ 4267 */
4268static void ca0132_setup_defaults(struct hda_codec *codec) 4268static void ca0132_setup_defaults(struct hda_codec *codec)
4269{ 4269{
4270 struct ca0132_spec *spec = codec->spec;
4270 unsigned int tmp; 4271 unsigned int tmp;
4271 int num_fx; 4272 int num_fx;
4272 int idx, i; 4273 int idx, i;
4273 4274
4274 if (!dspload_is_loaded(codec)) 4275 if (spec->dsp_state != DSP_DOWNLOADED)
4275 return; 4276 return;
4276 4277
4277 /* out, in effects + voicefx */ 4278 /* out, in effects + voicefx */
@@ -4351,12 +4352,16 @@ static bool ca0132_download_dsp_images(struct hda_codec *codec)
4351 return false; 4352 return false;
4352 4353
4353 dsp_os_image = (struct dsp_image_seg *)(fw_entry->data); 4354 dsp_os_image = (struct dsp_image_seg *)(fw_entry->data);
4354 dspload_image(codec, dsp_os_image, 0, 0, true, 0); 4355 if (dspload_image(codec, dsp_os_image, 0, 0, true, 0)) {
4356 pr_err("ca0132 dspload_image failed.\n");
4357 goto exit_download;
4358 }
4359
4355 dsp_loaded = dspload_wait_loaded(codec); 4360 dsp_loaded = dspload_wait_loaded(codec);
4356 4361
4362exit_download:
4357 release_firmware(fw_entry); 4363 release_firmware(fw_entry);
4358 4364
4359
4360 return dsp_loaded; 4365 return dsp_loaded;
4361} 4366}
4362 4367
@@ -4367,16 +4372,13 @@ static void ca0132_download_dsp(struct hda_codec *codec)
4367#ifndef CONFIG_SND_HDA_CODEC_CA0132_DSP 4372#ifndef CONFIG_SND_HDA_CODEC_CA0132_DSP
4368 return; /* NOP */ 4373 return; /* NOP */
4369#endif 4374#endif
4370 spec->dsp_state = DSP_DOWNLOAD_INIT;
4371 4375
4372 if (spec->dsp_state == DSP_DOWNLOAD_INIT) { 4376 chipio_enable_clocks(codec);
4373 chipio_enable_clocks(codec); 4377 spec->dsp_state = DSP_DOWNLOADING;
4374 spec->dsp_state = DSP_DOWNLOADING; 4378 if (!ca0132_download_dsp_images(codec))
4375 if (!ca0132_download_dsp_images(codec)) 4379 spec->dsp_state = DSP_DOWNLOAD_FAILED;
4376 spec->dsp_state = DSP_DOWNLOAD_FAILED; 4380 else
4377 else 4381 spec->dsp_state = DSP_DOWNLOADED;
4378 spec->dsp_state = DSP_DOWNLOADED;
4379 }
4380 4382
4381 if (spec->dsp_state == DSP_DOWNLOADED) 4383 if (spec->dsp_state == DSP_DOWNLOADED)
4382 ca0132_set_dsp_msr(codec, true); 4384 ca0132_set_dsp_msr(codec, true);
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 72ebb8a36b13..0d9c58f13560 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -168,10 +168,10 @@ static void cs_automute(struct hda_codec *codec)
168 snd_hda_gen_update_outputs(codec); 168 snd_hda_gen_update_outputs(codec);
169 169
170 if (spec->gpio_eapd_hp) { 170 if (spec->gpio_eapd_hp) {
171 unsigned int gpio = spec->gen.hp_jack_present ? 171 spec->gpio_data = spec->gen.hp_jack_present ?
172 spec->gpio_eapd_hp : spec->gpio_eapd_speaker; 172 spec->gpio_eapd_hp : spec->gpio_eapd_speaker;
173 snd_hda_codec_write(codec, 0x01, 0, 173 snd_hda_codec_write(codec, 0x01, 0,
174 AC_VERB_SET_GPIO_DATA, gpio); 174 AC_VERB_SET_GPIO_DATA, spec->gpio_data);
175 } 175 }
176} 176}
177 177
@@ -506,6 +506,8 @@ static int patch_cs420x(struct hda_codec *codec)
506 if (!spec) 506 if (!spec)
507 return -ENOMEM; 507 return -ENOMEM;
508 508
509 spec->gen.automute_hook = cs_automute;
510
509 snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl, 511 snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl,
510 cs420x_fixups); 512 cs420x_fixups);
511 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); 513 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
@@ -893,6 +895,8 @@ static int patch_cs4210(struct hda_codec *codec)
893 if (!spec) 895 if (!spec)
894 return -ENOMEM; 896 return -ENOMEM;
895 897
898 spec->gen.automute_hook = cs_automute;
899
896 snd_hda_pick_fixup(codec, cs421x_models, cs421x_fixup_tbl, 900 snd_hda_pick_fixup(codec, cs421x_models, cs421x_fixup_tbl,
897 cs421x_fixups); 901 cs421x_fixups);
898 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); 902 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 941bf6c766ec..2a89d1eefeb6 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -1142,7 +1142,7 @@ static int patch_cxt5045(struct hda_codec *codec)
1142 } 1142 }
1143 1143
1144 if (spec->beep_amp) 1144 if (spec->beep_amp)
1145 snd_hda_attach_beep_device(codec, spec->beep_amp); 1145 snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp));
1146 1146
1147 return 0; 1147 return 0;
1148} 1148}
@@ -1921,7 +1921,7 @@ static int patch_cxt5051(struct hda_codec *codec)
1921 } 1921 }
1922 1922
1923 if (spec->beep_amp) 1923 if (spec->beep_amp)
1924 snd_hda_attach_beep_device(codec, spec->beep_amp); 1924 snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp));
1925 1925
1926 return 0; 1926 return 0;
1927} 1927}
@@ -3099,7 +3099,7 @@ static int patch_cxt5066(struct hda_codec *codec)
3099 } 3099 }
3100 3100
3101 if (spec->beep_amp) 3101 if (spec->beep_amp)
3102 snd_hda_attach_beep_device(codec, spec->beep_amp); 3102 snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp));
3103 3103
3104 return 0; 3104 return 0;
3105} 3105}
@@ -3191,11 +3191,17 @@ static int cx_auto_build_controls(struct hda_codec *codec)
3191 return 0; 3191 return 0;
3192} 3192}
3193 3193
3194static void cx_auto_free(struct hda_codec *codec)
3195{
3196 snd_hda_detach_beep_device(codec);
3197 snd_hda_gen_free(codec);
3198}
3199
3194static const struct hda_codec_ops cx_auto_patch_ops = { 3200static const struct hda_codec_ops cx_auto_patch_ops = {
3195 .build_controls = cx_auto_build_controls, 3201 .build_controls = cx_auto_build_controls,
3196 .build_pcms = snd_hda_gen_build_pcms, 3202 .build_pcms = snd_hda_gen_build_pcms,
3197 .init = snd_hda_gen_init, 3203 .init = snd_hda_gen_init,
3198 .free = snd_hda_gen_free, 3204 .free = cx_auto_free,
3199 .unsol_event = snd_hda_jack_unsol_event, 3205 .unsol_event = snd_hda_jack_unsol_event,
3200#ifdef CONFIG_PM 3206#ifdef CONFIG_PM
3201 .check_power_status = snd_hda_gen_check_power_status, 3207 .check_power_status = snd_hda_gen_check_power_status,
@@ -3391,7 +3397,7 @@ static int patch_conexant_auto(struct hda_codec *codec)
3391 3397
3392 codec->patch_ops = cx_auto_patch_ops; 3398 codec->patch_ops = cx_auto_patch_ops;
3393 if (spec->beep_amp) 3399 if (spec->beep_amp)
3394 snd_hda_attach_beep_device(codec, spec->beep_amp); 3400 snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp));
3395 3401
3396 /* Some laptops with Conexant chips show stalls in S3 resume, 3402 /* Some laptops with Conexant chips show stalls in S3 resume,
3397 * which falls into the single-cmd mode. 3403 * which falls into the single-cmd mode.
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 78e1827d0a95..de8ac5c07fd0 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1196,7 +1196,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
1196 1196
1197 _snd_printd(SND_PR_VERBOSE, 1197 _snd_printd(SND_PR_VERBOSE,
1198 "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", 1198 "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n",
1199 codec->addr, pin_nid, eld->monitor_present, eld->eld_valid); 1199 codec->addr, pin_nid, pin_eld->monitor_present, eld->eld_valid);
1200 1200
1201 if (eld->eld_valid) { 1201 if (eld->eld_valid) {
1202 if (snd_hdmi_get_eld(codec, pin_nid, eld->eld_buffer, 1202 if (snd_hdmi_get_eld(codec, pin_nid, eld->eld_buffer,
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 563c24df4d6f..f15c36bde540 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3440,7 +3440,8 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
3440 const hda_nid_t *ssids; 3440 const hda_nid_t *ssids;
3441 3441
3442 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || 3442 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
3443 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) 3443 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 ||
3444 codec->vendor_id == 0x10ec0671)
3444 ssids = alc663_ssids; 3445 ssids = alc663_ssids;
3445 else 3446 else
3446 ssids = alc662_ssids; 3447 ssids = alc662_ssids;
@@ -3894,6 +3895,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = {
3894 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, 3895 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
3895 { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 }, 3896 { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
3896 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, 3897 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
3898 { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 },
3897 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, 3899 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
3898 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, 3900 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
3899 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, 3901 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 83d5335ac348..dafe04ae8c72 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -815,6 +815,29 @@ static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
815 return 0; 815 return 0;
816} 816}
817 817
818/* check whether a built-in speaker is included in parsed pins */
819static bool has_builtin_speaker(struct hda_codec *codec)
820{
821 struct sigmatel_spec *spec = codec->spec;
822 hda_nid_t *nid_pin;
823 int nids, i;
824
825 if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) {
826 nid_pin = spec->gen.autocfg.line_out_pins;
827 nids = spec->gen.autocfg.line_outs;
828 } else {
829 nid_pin = spec->gen.autocfg.speaker_pins;
830 nids = spec->gen.autocfg.speaker_outs;
831 }
832
833 for (i = 0; i < nids; i++) {
834 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid_pin[i]);
835 if (snd_hda_get_input_pin_attr(def_conf) == INPUT_PIN_ATTR_INT)
836 return true;
837 }
838 return false;
839}
840
818/* 841/*
819 * PC beep controls 842 * PC beep controls
820 */ 843 */
@@ -3890,6 +3913,12 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
3890 return err; 3913 return err;
3891 } 3914 }
3892 3915
3916 /* Don't GPIO-mute speakers if there are no internal speakers, because
3917 * the GPIO might be necessary for Headphone
3918 */
3919 if (spec->eapd_switch && !has_builtin_speaker(codec))
3920 spec->eapd_switch = 0;
3921
3893 codec->proc_widget_hook = stac92hd7x_proc_hook; 3922 codec->proc_widget_hook = stac92hd7x_proc_hook;
3894 3923
3895 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); 3924 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 45b72561c615..350b86458971 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -324,7 +324,7 @@ config SND_SOC_TLV320AIC23
324 tristate 324 tristate
325 325
326config SND_SOC_TLV320AIC26 326config SND_SOC_TLV320AIC26
327 tristate "TI TLV320AIC26 Codec support" if SND_SOC_OF_SIMPLE 327 tristate
328 depends on SPI 328 depends on SPI
329 329
330config SND_SOC_TLV320AIC32X4 330config SND_SOC_TLV320AIC32X4
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index fc176044994d..fc176044994d 100755..100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
diff --git a/sound/soc/codecs/max98090.h b/sound/soc/codecs/max98090.h
index 7e103f249053..7e103f249053 100755..100644
--- a/sound/soc/codecs/max98090.h
+++ b/sound/soc/codecs/max98090.h
diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c
index f2d61a187830..566ea3256e2d 100644
--- a/sound/soc/codecs/si476x.c
+++ b/sound/soc/codecs/si476x.c
@@ -159,6 +159,7 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream,
159 switch (params_format(params)) { 159 switch (params_format(params)) {
160 case SNDRV_PCM_FORMAT_S8: 160 case SNDRV_PCM_FORMAT_S8:
161 width = SI476X_PCM_FORMAT_S8; 161 width = SI476X_PCM_FORMAT_S8;
162 break;
162 case SNDRV_PCM_FORMAT_S16_LE: 163 case SNDRV_PCM_FORMAT_S16_LE:
163 width = SI476X_PCM_FORMAT_S16_LE; 164 width = SI476X_PCM_FORMAT_S16_LE;
164 break; 165 break;
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index b82bbf584146..34d0201d6a78 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -584,7 +584,7 @@ static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w,
584 struct snd_kcontrol *kcontrol, int event) 584 struct snd_kcontrol *kcontrol, int event)
585{ 585{
586 struct snd_soc_codec *codec = w->codec; 586 struct snd_soc_codec *codec = w->codec;
587 struct arizona *arizona = dev_get_drvdata(codec->dev); 587 struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
588 struct regmap *regmap = codec->control_data; 588 struct regmap *regmap = codec->control_data;
589 const struct reg_default *patch = NULL; 589 const struct reg_default *patch = NULL;
590 int i, patch_size; 590 int i, patch_size;
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index 134e41c870b9..f8a31ad0b203 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -1083,6 +1083,8 @@ static const struct snd_soc_dapm_route wm8903_intercon[] = {
1083 { "ROP", NULL, "Right Speaker PGA" }, 1083 { "ROP", NULL, "Right Speaker PGA" },
1084 { "RON", NULL, "Right Speaker PGA" }, 1084 { "RON", NULL, "Right Speaker PGA" },
1085 1085
1086 { "Charge Pump", NULL, "CLK_DSP" },
1087
1086 { "Left Headphone Output PGA", NULL, "Charge Pump" }, 1088 { "Left Headphone Output PGA", NULL, "Charge Pump" },
1087 { "Right Headphone Output PGA", NULL, "Charge Pump" }, 1089 { "Right Headphone Output PGA", NULL, "Charge Pump" },
1088 { "Left Line Output PGA", NULL, "Charge Pump" }, 1090 { "Left Line Output PGA", NULL, "Charge Pump" },
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index f3f7e75f8628..9af1bddc4c62 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -828,7 +828,8 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
828 &buf_list); 828 &buf_list);
829 if (!buf) { 829 if (!buf) {
830 adsp_err(dsp, "Out of memory\n"); 830 adsp_err(dsp, "Out of memory\n");
831 return -ENOMEM; 831 ret = -ENOMEM;
832 goto out_fw;
832 } 833 }
833 834
834 adsp_dbg(dsp, "%s.%d: Writing %d bytes at %x\n", 835 adsp_dbg(dsp, "%s.%d: Writing %d bytes at %x\n",
@@ -865,7 +866,7 @@ out_fw:
865 wm_adsp_buf_free(&buf_list); 866 wm_adsp_buf_free(&buf_list);
866out: 867out:
867 kfree(file); 868 kfree(file);
868 return 0; 869 return ret;
869} 870}
870 871
871int wm_adsp1_init(struct wm_adsp *adsp) 872int wm_adsp1_init(struct wm_adsp *adsp)
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 55464a5b0706..810c7eeb7b03 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -496,6 +496,8 @@ static void imx_ssi_ac97_reset(struct snd_ac97 *ac97)
496 496
497 if (imx_ssi->ac97_reset) 497 if (imx_ssi->ac97_reset)
498 imx_ssi->ac97_reset(ac97); 498 imx_ssi->ac97_reset(ac97);
499 /* First read sometimes fails, do a dummy read */
500 imx_ssi_ac97_read(ac97, 0);
499} 501}
500 502
501static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97) 503static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97)
@@ -504,6 +506,9 @@ static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97)
504 506
505 if (imx_ssi->ac97_warm_reset) 507 if (imx_ssi->ac97_warm_reset)
506 imx_ssi->ac97_warm_reset(ac97); 508 imx_ssi->ac97_warm_reset(ac97);
509
510 /* First read sometimes fails, do a dummy read */
511 imx_ssi_ac97_read(ac97, 0);
507} 512}
508 513
509struct snd_ac97_bus_ops soc_ac97_ops = { 514struct snd_ac97_bus_ops soc_ac97_ops = {
diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c
index 8e52c1485df3..eb4373840bb6 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -51,7 +51,7 @@ static struct snd_soc_card pcm030_card = {
51 .num_links = ARRAY_SIZE(pcm030_fabric_dai), 51 .num_links = ARRAY_SIZE(pcm030_fabric_dai),
52}; 52};
53 53
54static int __init pcm030_fabric_probe(struct platform_device *op) 54static int pcm030_fabric_probe(struct platform_device *op)
55{ 55{
56 struct device_node *np = op->dev.of_node; 56 struct device_node *np = op->dev.of_node;
57 struct device_node *platform_np; 57 struct device_node *platform_np;
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index d7231e336a7c..6bbeb0bf1a73 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -972,6 +972,7 @@ static const struct snd_soc_dai_ops samsung_i2s_dai_ops = {
972static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) 972static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
973{ 973{
974 struct i2s_dai *i2s; 974 struct i2s_dai *i2s;
975 int ret;
975 976
976 i2s = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dai), GFP_KERNEL); 977 i2s = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dai), GFP_KERNEL);
977 if (i2s == NULL) 978 if (i2s == NULL)
@@ -996,15 +997,17 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
996 i2s->i2s_dai_drv.capture.channels_max = 2; 997 i2s->i2s_dai_drv.capture.channels_max = 2;
997 i2s->i2s_dai_drv.capture.rates = SAMSUNG_I2S_RATES; 998 i2s->i2s_dai_drv.capture.rates = SAMSUNG_I2S_RATES;
998 i2s->i2s_dai_drv.capture.formats = SAMSUNG_I2S_FMTS; 999 i2s->i2s_dai_drv.capture.formats = SAMSUNG_I2S_FMTS;
1000 dev_set_drvdata(&i2s->pdev->dev, i2s);
999 } else { /* Create a new platform_device for Secondary */ 1001 } else { /* Create a new platform_device for Secondary */
1000 i2s->pdev = platform_device_register_resndata(NULL, 1002 i2s->pdev = platform_device_alloc("samsung-i2s-sec", -1);
1001 "samsung-i2s-sec", -1, NULL, 0, NULL, 0);
1002 if (IS_ERR(i2s->pdev)) 1003 if (IS_ERR(i2s->pdev))
1003 return NULL; 1004 return NULL;
1004 }
1005 1005
1006 /* Pre-assign snd_soc_dai_set_drvdata */ 1006 platform_set_drvdata(i2s->pdev, i2s);
1007 dev_set_drvdata(&i2s->pdev->dev, i2s); 1007 ret = platform_device_add(i2s->pdev);
1008 if (ret < 0)
1009 return NULL;
1010 }
1008 1011
1009 return i2s; 1012 return i2s;
1010} 1013}
@@ -1107,6 +1110,10 @@ static int samsung_i2s_probe(struct platform_device *pdev)
1107 1110
1108 if (samsung_dai_type == TYPE_SEC) { 1111 if (samsung_dai_type == TYPE_SEC) {
1109 sec_dai = dev_get_drvdata(&pdev->dev); 1112 sec_dai = dev_get_drvdata(&pdev->dev);
1113 if (!sec_dai) {
1114 dev_err(&pdev->dev, "Unable to get drvdata\n");
1115 return -EFAULT;
1116 }
1110 snd_soc_register_dai(&sec_dai->pdev->dev, 1117 snd_soc_register_dai(&sec_dai->pdev->dev,
1111 &sec_dai->i2s_dai_drv); 1118 &sec_dai->i2s_dai_drv);
1112 asoc_dma_platform_register(&pdev->dev); 1119 asoc_dma_platform_register(&pdev->dev);
diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c
index 19eff8fc4fdd..1a8b03e4b41b 100644
--- a/sound/soc/sh/dma-sh7760.c
+++ b/sound/soc/sh/dma-sh7760.c
@@ -342,8 +342,8 @@ static int camelot_pcm_new(struct snd_soc_pcm_runtime *rtd)
342 return 0; 342 return 0;
343} 343}
344 344
345static struct snd_soc_platform sh7760_soc_platform = { 345static struct snd_soc_platform_driver sh7760_soc_platform = {
346 .pcm_ops = &camelot_pcm_ops, 346 .ops = &camelot_pcm_ops,
347 .pcm_new = camelot_pcm_new, 347 .pcm_new = camelot_pcm_new,
348 .pcm_free = camelot_pcm_free, 348 .pcm_free = camelot_pcm_free,
349}; 349};
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index b5b3db71e253..ed0bfb0ddb96 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -211,19 +211,27 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream,
211 if (platform->driver->compr_ops && platform->driver->compr_ops->set_params) { 211 if (platform->driver->compr_ops && platform->driver->compr_ops->set_params) {
212 ret = platform->driver->compr_ops->set_params(cstream, params); 212 ret = platform->driver->compr_ops->set_params(cstream, params);
213 if (ret < 0) 213 if (ret < 0)
214 goto out; 214 goto err;
215 } 215 }
216 216
217 if (rtd->dai_link->compr_ops && rtd->dai_link->compr_ops->set_params) { 217 if (rtd->dai_link->compr_ops && rtd->dai_link->compr_ops->set_params) {
218 ret = rtd->dai_link->compr_ops->set_params(cstream); 218 ret = rtd->dai_link->compr_ops->set_params(cstream);
219 if (ret < 0) 219 if (ret < 0)
220 goto out; 220 goto err;
221 } 221 }
222 222
223 snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_PLAYBACK, 223 snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_PLAYBACK,
224 SND_SOC_DAPM_STREAM_START); 224 SND_SOC_DAPM_STREAM_START);
225 225
226out: 226 /* cancel any delayed stream shutdown that is pending */
227 rtd->pop_wait = 0;
228 mutex_unlock(&rtd->pcm_mutex);
229
230 cancel_delayed_work_sync(&rtd->delayed_work);
231
232 return ret;
233
234err:
227 mutex_unlock(&rtd->pcm_mutex); 235 mutex_unlock(&rtd->pcm_mutex);
228 return ret; 236 return ret;
229} 237}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b7e84a7cd9ee..c70f9e072043 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2963,7 +2963,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
2963 val = val << shift; 2963 val = val << shift;
2964 2964
2965 ret = snd_soc_update_bits_locked(codec, reg, val_mask, val); 2965 ret = snd_soc_update_bits_locked(codec, reg, val_mask, val);
2966 if (ret != 0) 2966 if (ret < 0)
2967 return ret; 2967 return ret;
2968 2968
2969 if (snd_soc_volsw_is_stereo(mc)) { 2969 if (snd_soc_volsw_is_stereo(mc)) {
@@ -3140,7 +3140,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
3140 if (params->mask) { 3140 if (params->mask) {
3141 ret = regmap_read(codec->control_data, params->base, &val); 3141 ret = regmap_read(codec->control_data, params->base, &val);
3142 if (ret != 0) 3142 if (ret != 0)
3143 return ret; 3143 goto out;
3144 3144
3145 val &= params->mask; 3145 val &= params->mask;
3146 3146
@@ -3158,13 +3158,15 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
3158 ((u32 *)data)[0] |= cpu_to_be32(val); 3158 ((u32 *)data)[0] |= cpu_to_be32(val);
3159 break; 3159 break;
3160 default: 3160 default:
3161 return -EINVAL; 3161 ret = -EINVAL;
3162 goto out;
3162 } 3163 }
3163 } 3164 }
3164 3165
3165 ret = regmap_raw_write(codec->control_data, params->base, 3166 ret = regmap_raw_write(codec->control_data, params->base,
3166 data, len); 3167 data, len);
3167 3168
3169out:
3168 kfree(data); 3170 kfree(data);
3169 3171
3170 return ret; 3172 return ret;
@@ -3906,7 +3908,7 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_dais);
3906 * @platform: platform to register 3908 * @platform: platform to register
3907 */ 3909 */
3908int snd_soc_register_platform(struct device *dev, 3910int snd_soc_register_platform(struct device *dev,
3909 struct snd_soc_platform_driver *platform_drv) 3911 const struct snd_soc_platform_driver *platform_drv)
3910{ 3912{
3911 struct snd_soc_platform *platform; 3913 struct snd_soc_platform *platform;
3912 3914
@@ -4022,8 +4024,8 @@ int snd_soc_register_codec(struct device *dev,
4022 /* create CODEC component name */ 4024 /* create CODEC component name */
4023 codec->name = fmt_single_name(dev, &codec->id); 4025 codec->name = fmt_single_name(dev, &codec->id);
4024 if (codec->name == NULL) { 4026 if (codec->name == NULL) {
4025 kfree(codec); 4027 ret = -ENOMEM;
4026 return -ENOMEM; 4028 goto fail_codec;
4027 } 4029 }
4028 4030
4029 if (codec_drv->compress_type) 4031 if (codec_drv->compress_type)
@@ -4062,7 +4064,7 @@ int snd_soc_register_codec(struct device *dev,
4062 reg_size, GFP_KERNEL); 4064 reg_size, GFP_KERNEL);
4063 if (!codec->reg_def_copy) { 4065 if (!codec->reg_def_copy) {
4064 ret = -ENOMEM; 4066 ret = -ENOMEM;
4065 goto fail; 4067 goto fail_codec_name;
4066 } 4068 }
4067 } 4069 }
4068 } 4070 }
@@ -4086,18 +4088,22 @@ int snd_soc_register_codec(struct device *dev,
4086 mutex_unlock(&client_mutex); 4088 mutex_unlock(&client_mutex);
4087 4089
4088 /* register any DAIs */ 4090 /* register any DAIs */
4089 if (num_dai) { 4091 ret = snd_soc_register_dais(dev, dai_drv, num_dai);
4090 ret = snd_soc_register_dais(dev, dai_drv, num_dai); 4092 if (ret < 0) {
4091 if (ret < 0) 4093 dev_err(codec->dev, "ASoC: Failed to regster DAIs: %d\n", ret);
4092 dev_err(codec->dev, "ASoC: Failed to regster" 4094 goto fail_codec_name;
4093 " DAIs: %d\n", ret);
4094 } 4095 }
4095 4096
4096 dev_dbg(codec->dev, "ASoC: Registered codec '%s'\n", codec->name); 4097 dev_dbg(codec->dev, "ASoC: Registered codec '%s'\n", codec->name);
4097 return 0; 4098 return 0;
4098 4099
4099fail: 4100fail_codec_name:
4101 mutex_lock(&client_mutex);
4102 list_del(&codec->list);
4103 mutex_unlock(&client_mutex);
4104
4100 kfree(codec->name); 4105 kfree(codec->name);
4106fail_codec:
4101 kfree(codec); 4107 kfree(codec);
4102 return ret; 4108 return ret;
4103} 4109}
@@ -4111,7 +4117,6 @@ EXPORT_SYMBOL_GPL(snd_soc_register_codec);
4111void snd_soc_unregister_codec(struct device *dev) 4117void snd_soc_unregister_codec(struct device *dev)
4112{ 4118{
4113 struct snd_soc_codec *codec; 4119 struct snd_soc_codec *codec;
4114 int i;
4115 4120
4116 list_for_each_entry(codec, &codec_list, list) { 4121 list_for_each_entry(codec, &codec_list, list) {
4117 if (dev == codec->dev) 4122 if (dev == codec->dev)
@@ -4120,9 +4125,7 @@ void snd_soc_unregister_codec(struct device *dev)
4120 return; 4125 return;
4121 4126
4122found: 4127found:
4123 if (codec->num_dai) 4128 snd_soc_unregister_dais(dev, codec->num_dai);
4124 for (i = 0; i < codec->num_dai; i++)
4125 snd_soc_unregister_dai(dev);
4126 4129
4127 mutex_lock(&client_mutex); 4130 mutex_lock(&client_mutex);
4128 list_del(&codec->list); 4131 list_del(&codec->list);
@@ -4197,7 +4200,6 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
4197 dev_err(card->dev, 4200 dev_err(card->dev,
4198 "ASoC: Property '%s' index %d could not be read: %d\n", 4201 "ASoC: Property '%s' index %d could not be read: %d\n",
4199 propname, 2 * i, ret); 4202 propname, 2 * i, ret);
4200 kfree(routes);
4201 return -EINVAL; 4203 return -EINVAL;
4202 } 4204 }
4203 ret = of_property_read_string_index(np, propname, 4205 ret = of_property_read_string_index(np, propname,
@@ -4206,7 +4208,6 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
4206 dev_err(card->dev, 4208 dev_err(card->dev,
4207 "ASoC: Property '%s' index %d could not be read: %d\n", 4209 "ASoC: Property '%s' index %d could not be read: %d\n",
4208 propname, (2 * i) + 1, ret); 4210 propname, (2 * i) + 1, ret);
4209 kfree(routes);
4210 return -EINVAL; 4211 return -EINVAL;
4211 } 4212 }
4212 } 4213 }
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 1d6a9b3ceb27..33acd8b892dc 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -831,6 +831,9 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget,
831 if (path->weak) 831 if (path->weak)
832 continue; 832 continue;
833 833
834 if (path->walking)
835 return 1;
836
834 if (path->walked) 837 if (path->walked)
835 continue; 838 continue;
836 839
@@ -838,6 +841,7 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget,
838 841
839 if (path->sink && path->connect) { 842 if (path->sink && path->connect) {
840 path->walked = 1; 843 path->walked = 1;
844 path->walking = 1;
841 845
842 /* do we need to add this widget to the list ? */ 846 /* do we need to add this widget to the list ? */
843 if (list) { 847 if (list) {
@@ -847,11 +851,14 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget,
847 dev_err(widget->dapm->dev, 851 dev_err(widget->dapm->dev,
848 "ASoC: could not add widget %s\n", 852 "ASoC: could not add widget %s\n",
849 widget->name); 853 widget->name);
854 path->walking = 0;
850 return con; 855 return con;
851 } 856 }
852 } 857 }
853 858
854 con += is_connected_output_ep(path->sink, list); 859 con += is_connected_output_ep(path->sink, list);
860
861 path->walking = 0;
855 } 862 }
856 } 863 }
857 864
@@ -931,6 +938,9 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,
931 if (path->weak) 938 if (path->weak)
932 continue; 939 continue;
933 940
941 if (path->walking)
942 return 1;
943
934 if (path->walked) 944 if (path->walked)
935 continue; 945 continue;
936 946
@@ -938,6 +948,7 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,
938 948
939 if (path->source && path->connect) { 949 if (path->source && path->connect) {
940 path->walked = 1; 950 path->walked = 1;
951 path->walking = 1;
941 952
942 /* do we need to add this widget to the list ? */ 953 /* do we need to add this widget to the list ? */
943 if (list) { 954 if (list) {
@@ -947,11 +958,14 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,
947 dev_err(widget->dapm->dev, 958 dev_err(widget->dapm->dev,
948 "ASoC: could not add widget %s\n", 959 "ASoC: could not add widget %s\n",
949 widget->name); 960 widget->name);
961 path->walking = 0;
950 return con; 962 return con;
951 } 963 }
952 } 964 }
953 965
954 con += is_connected_input_ep(path->source, list); 966 con += is_connected_input_ep(path->source, list);
967
968 path->walking = 0;
955 } 969 }
956 } 970 }
957 971
@@ -3123,7 +3137,6 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
3123 break; 3137 break;
3124 } 3138 }
3125 3139
3126 dapm->n_widgets++;
3127 w->dapm = dapm; 3140 w->dapm = dapm;
3128 w->codec = dapm->codec; 3141 w->codec = dapm->codec;
3129 w->platform = dapm->platform; 3142 w->platform = dapm->platform;
diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c
index 29183ef2b93d..8ca9ecc5ac57 100644
--- a/sound/soc/soc-io.c
+++ b/sound/soc/soc-io.c
@@ -158,10 +158,7 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
158 return -EINVAL; 158 return -EINVAL;
159 } 159 }
160 160
161 if (IS_ERR(codec->control_data)) 161 return PTR_RET(codec->control_data);
162 return PTR_ERR(codec->control_data);
163
164 return 0;
165} 162}
166EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io); 163EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io);
167#else 164#else
diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
index fe4541df498c..4b3be6c3c91e 100644
--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c
@@ -90,8 +90,33 @@ static struct snd_soc_platform_driver dummy_platform = {
90}; 90};
91 91
92static struct snd_soc_codec_driver dummy_codec; 92static struct snd_soc_codec_driver dummy_codec;
93
94#define STUB_RATES SNDRV_PCM_RATE_8000_192000
95#define STUB_FORMATS (SNDRV_PCM_FMTBIT_S8 | \
96 SNDRV_PCM_FMTBIT_U8 | \
97 SNDRV_PCM_FMTBIT_S16_LE | \
98 SNDRV_PCM_FMTBIT_U16_LE | \
99 SNDRV_PCM_FMTBIT_S24_LE | \
100 SNDRV_PCM_FMTBIT_U24_LE | \
101 SNDRV_PCM_FMTBIT_S32_LE | \
102 SNDRV_PCM_FMTBIT_U32_LE | \
103 SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE)
93static struct snd_soc_dai_driver dummy_dai = { 104static struct snd_soc_dai_driver dummy_dai = {
94 .name = "snd-soc-dummy-dai", 105 .name = "snd-soc-dummy-dai",
106 .playback = {
107 .stream_name = "Playback",
108 .channels_min = 1,
109 .channels_max = 384,
110 .rates = STUB_RATES,
111 .formats = STUB_FORMATS,
112 },
113 .capture = {
114 .stream_name = "Capture",
115 .channels_min = 1,
116 .channels_max = 384,
117 .rates = STUB_RATES,
118 .formats = STUB_FORMATS,
119 },
95}; 120};
96 121
97static int snd_soc_dummy_probe(struct platform_device *pdev) 122static int snd_soc_dummy_probe(struct platform_device *pdev)
diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c
index 9b76cc5a1148..5e7aebe1e664 100644
--- a/sound/soc/spear/spear_pcm.c
+++ b/sound/soc/spear/spear_pcm.c
@@ -149,9 +149,9 @@ static void spear_pcm_free(struct snd_pcm *pcm)
149 149
150static u64 spear_pcm_dmamask = DMA_BIT_MASK(32); 150static u64 spear_pcm_dmamask = DMA_BIT_MASK(32);
151 151
152static int spear_pcm_new(struct snd_card *card, 152static int spear_pcm_new(struct snd_soc_pcm_runtime *rtd)
153 struct snd_soc_dai *dai, struct snd_pcm *pcm)
154{ 153{
154 struct snd_card *card = rtd->card->snd_card;
155 int ret; 155 int ret;
156 156
157 if (!card->dev->dma_mask) 157 if (!card->dev->dma_mask)
@@ -159,16 +159,16 @@ static int spear_pcm_new(struct snd_card *card,
159 if (!card->dev->coherent_dma_mask) 159 if (!card->dev->coherent_dma_mask)
160 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 160 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
161 161
162 if (dai->driver->playback.channels_min) { 162 if (rtd->cpu_dai->driver->playback.channels_min) {
163 ret = spear_pcm_preallocate_dma_buffer(pcm, 163 ret = spear_pcm_preallocate_dma_buffer(rtd->pcm,
164 SNDRV_PCM_STREAM_PLAYBACK, 164 SNDRV_PCM_STREAM_PLAYBACK,
165 spear_pcm_hardware.buffer_bytes_max); 165 spear_pcm_hardware.buffer_bytes_max);
166 if (ret) 166 if (ret)
167 return ret; 167 return ret;
168 } 168 }
169 169
170 if (dai->driver->capture.channels_min) { 170 if (rtd->cpu_dai->driver->capture.channels_min) {
171 ret = spear_pcm_preallocate_dma_buffer(pcm, 171 ret = spear_pcm_preallocate_dma_buffer(rtd->pcm,
172 SNDRV_PCM_STREAM_CAPTURE, 172 SNDRV_PCM_STREAM_CAPTURE,
173 spear_pcm_hardware.buffer_bytes_max); 173 spear_pcm_hardware.buffer_bytes_max);
174 if (ret) 174 if (ret)
diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c
index c925ab0adeb6..5e2c55c5b255 100644
--- a/sound/soc/tegra/tegra_pcm.c
+++ b/sound/soc/tegra/tegra_pcm.c
@@ -43,8 +43,6 @@
43static const struct snd_pcm_hardware tegra_pcm_hardware = { 43static const struct snd_pcm_hardware tegra_pcm_hardware = {
44 .info = SNDRV_PCM_INFO_MMAP | 44 .info = SNDRV_PCM_INFO_MMAP |
45 SNDRV_PCM_INFO_MMAP_VALID | 45 SNDRV_PCM_INFO_MMAP_VALID |
46 SNDRV_PCM_INFO_PAUSE |
47 SNDRV_PCM_INFO_RESUME |
48 SNDRV_PCM_INFO_INTERLEAVED, 46 SNDRV_PCM_INFO_INTERLEAVED,
49 .formats = SNDRV_PCM_FMTBIT_S16_LE, 47 .formats = SNDRV_PCM_FMTBIT_S16_LE,
50 .channels_min = 2, 48 .channels_min = 2,
@@ -127,26 +125,6 @@ static int tegra_pcm_hw_free(struct snd_pcm_substream *substream)
127 return 0; 125 return 0;
128} 126}
129 127
130static int tegra_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
131{
132 switch (cmd) {
133 case SNDRV_PCM_TRIGGER_START:
134 case SNDRV_PCM_TRIGGER_RESUME:
135 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
136 return snd_dmaengine_pcm_trigger(substream,
137 SNDRV_PCM_TRIGGER_START);
138
139 case SNDRV_PCM_TRIGGER_STOP:
140 case SNDRV_PCM_TRIGGER_SUSPEND:
141 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
142 return snd_dmaengine_pcm_trigger(substream,
143 SNDRV_PCM_TRIGGER_STOP);
144 default:
145 return -EINVAL;
146 }
147 return 0;
148}
149
150static int tegra_pcm_mmap(struct snd_pcm_substream *substream, 128static int tegra_pcm_mmap(struct snd_pcm_substream *substream,
151 struct vm_area_struct *vma) 129 struct vm_area_struct *vma)
152{ 130{
@@ -164,7 +142,7 @@ static struct snd_pcm_ops tegra_pcm_ops = {
164 .ioctl = snd_pcm_lib_ioctl, 142 .ioctl = snd_pcm_lib_ioctl,
165 .hw_params = tegra_pcm_hw_params, 143 .hw_params = tegra_pcm_hw_params,
166 .hw_free = tegra_pcm_hw_free, 144 .hw_free = tegra_pcm_hw_free,
167 .trigger = tegra_pcm_trigger, 145 .trigger = snd_dmaengine_pcm_trigger,
168 .pointer = snd_dmaengine_pcm_pointer, 146 .pointer = snd_dmaengine_pcm_pointer,
169 .mmap = tegra_pcm_mmap, 147 .mmap = tegra_pcm_mmap,
170}; 148};
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 803953a9bff3..2da8ad75fd96 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -244,6 +244,21 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
244 usb_ifnum_to_if(dev, ctrlif)->intf_assoc; 244 usb_ifnum_to_if(dev, ctrlif)->intf_assoc;
245 245
246 if (!assoc) { 246 if (!assoc) {
247 /*
248 * Firmware writers cannot count to three. So to find
249 * the IAD on the NuForce UDH-100, also check the next
250 * interface.
251 */
252 struct usb_interface *iface =
253 usb_ifnum_to_if(dev, ctrlif + 1);
254 if (iface &&
255 iface->intf_assoc &&
256 iface->intf_assoc->bFunctionClass == USB_CLASS_AUDIO &&
257 iface->intf_assoc->bFunctionProtocol == UAC_VERSION_2)
258 assoc = iface->intf_assoc;
259 }
260
261 if (!assoc) {
247 snd_printk(KERN_ERR "Audio class v2 interfaces need an interface association\n"); 262 snd_printk(KERN_ERR "Audio class v2 interfaces need an interface association\n");
248 return -EINVAL; 263 return -EINVAL;
249 } 264 }
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 5e634a2eb282..9e2703a25156 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -253,7 +253,7 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
253{ 253{
254 struct usb_device *dev = chip->dev; 254 struct usb_device *dev = chip->dev;
255 unsigned char data[4]; 255 unsigned char data[4];
256 int err, crate; 256 int err, cur_rate, prev_rate;
257 int clock = snd_usb_clock_find_source(chip, fmt->clock); 257 int clock = snd_usb_clock_find_source(chip, fmt->clock);
258 258
259 if (clock < 0) 259 if (clock < 0)
@@ -266,6 +266,19 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
266 return -ENXIO; 266 return -ENXIO;
267 } 267 }
268 268
269 err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
270 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
271 UAC2_CS_CONTROL_SAM_FREQ << 8,
272 snd_usb_ctrl_intf(chip) | (clock << 8),
273 data, sizeof(data));
274 if (err < 0) {
275 snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n",
276 dev->devnum, iface, fmt->altsetting);
277 prev_rate = 0;
278 } else {
279 prev_rate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
280 }
281
269 data[0] = rate; 282 data[0] = rate;
270 data[1] = rate >> 8; 283 data[1] = rate >> 8;
271 data[2] = rate >> 16; 284 data[2] = rate >> 16;
@@ -280,19 +293,31 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
280 return err; 293 return err;
281 } 294 }
282 295
283 if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR, 296 err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
284 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, 297 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
285 UAC2_CS_CONTROL_SAM_FREQ << 8, 298 UAC2_CS_CONTROL_SAM_FREQ << 8,
286 snd_usb_ctrl_intf(chip) | (clock << 8), 299 snd_usb_ctrl_intf(chip) | (clock << 8),
287 data, sizeof(data))) < 0) { 300 data, sizeof(data));
301 if (err < 0) {
288 snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n", 302 snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n",
289 dev->devnum, iface, fmt->altsetting); 303 dev->devnum, iface, fmt->altsetting);
290 return err; 304 cur_rate = 0;
305 } else {
306 cur_rate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
291 } 307 }
292 308
293 crate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); 309 if (cur_rate != rate) {
294 if (crate != rate) 310 snd_printd(KERN_WARNING
295 snd_printd(KERN_WARNING "current rate %d is different from the runtime rate %d\n", crate, rate); 311 "current rate %d is different from the runtime rate %d\n",
312 cur_rate, rate);
313 }
314
315 /* Some devices doesn't respond to sample rate changes while the
316 * interface is active. */
317 if (rate != prev_rate) {
318 usb_set_interface(dev, iface, 0);
319 usb_set_interface(dev, iface, fmt->altsetting);
320 }
296 321
297 return 0; 322 return 0;
298} 323}
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 638e7f738018..ca4739c3f650 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -715,8 +715,9 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_
715 case UAC2_CLOCK_SELECTOR: { 715 case UAC2_CLOCK_SELECTOR: {
716 struct uac_selector_unit_descriptor *d = p1; 716 struct uac_selector_unit_descriptor *d = p1;
717 /* call recursively to retrieve the channel info */ 717 /* call recursively to retrieve the channel info */
718 if (check_input_term(state, d->baSourceID[0], term) < 0) 718 err = check_input_term(state, d->baSourceID[0], term);
719 return -ENODEV; 719 if (err < 0)
720 return err;
720 term->type = d->bDescriptorSubtype << 16; /* virtual type */ 721 term->type = d->bDescriptorSubtype << 16; /* virtual type */
721 term->id = id; 722 term->id = id;
722 term->name = uac_selector_unit_iSelector(d); 723 term->name = uac_selector_unit_iSelector(d);
@@ -725,7 +726,8 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_
725 case UAC1_PROCESSING_UNIT: 726 case UAC1_PROCESSING_UNIT:
726 case UAC1_EXTENSION_UNIT: 727 case UAC1_EXTENSION_UNIT:
727 /* UAC2_PROCESSING_UNIT_V2 */ 728 /* UAC2_PROCESSING_UNIT_V2 */
728 /* UAC2_EFFECT_UNIT */ { 729 /* UAC2_EFFECT_UNIT */
730 case UAC2_EXTENSION_UNIT_V2: {
729 struct uac_processing_unit_descriptor *d = p1; 731 struct uac_processing_unit_descriptor *d = p1;
730 732
731 if (state->mixer->protocol == UAC_VERSION_2 && 733 if (state->mixer->protocol == UAC_VERSION_2 &&
@@ -1356,8 +1358,9 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
1356 return err; 1358 return err;
1357 1359
1358 /* determine the input source type and name */ 1360 /* determine the input source type and name */
1359 if (check_input_term(state, hdr->bSourceID, &iterm) < 0) 1361 err = check_input_term(state, hdr->bSourceID, &iterm);
1360 return -EINVAL; 1362 if (err < 0)
1363 return err;
1361 1364
1362 master_bits = snd_usb_combine_bytes(bmaControls, csize); 1365 master_bits = snd_usb_combine_bytes(bmaControls, csize);
1363 /* master configuration quirks */ 1366 /* master configuration quirks */
@@ -2052,6 +2055,8 @@ static int parse_audio_unit(struct mixer_build *state, int unitid)
2052 return parse_audio_extension_unit(state, unitid, p1); 2055 return parse_audio_extension_unit(state, unitid, p1);
2053 else /* UAC_VERSION_2 */ 2056 else /* UAC_VERSION_2 */
2054 return parse_audio_processing_unit(state, unitid, p1); 2057 return parse_audio_processing_unit(state, unitid, p1);
2058 case UAC2_EXTENSION_UNIT_V2:
2059 return parse_audio_extension_unit(state, unitid, p1);
2055 default: 2060 default:
2056 snd_printk(KERN_ERR "usbaudio: unit %u: unexpected type 0x%02x\n", unitid, p1[2]); 2061 snd_printk(KERN_ERR "usbaudio: unit %u: unexpected type 0x%02x\n", unitid, p1[2]);
2057 return -EINVAL; 2062 return -EINVAL;
@@ -2118,7 +2123,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
2118 state.oterm.type = le16_to_cpu(desc->wTerminalType); 2123 state.oterm.type = le16_to_cpu(desc->wTerminalType);
2119 state.oterm.name = desc->iTerminal; 2124 state.oterm.name = desc->iTerminal;
2120 err = parse_audio_unit(&state, desc->bSourceID); 2125 err = parse_audio_unit(&state, desc->bSourceID);
2121 if (err < 0) 2126 if (err < 0 && err != -EINVAL)
2122 return err; 2127 return err;
2123 } else { /* UAC_VERSION_2 */ 2128 } else { /* UAC_VERSION_2 */
2124 struct uac2_output_terminal_descriptor *desc = p; 2129 struct uac2_output_terminal_descriptor *desc = p;
@@ -2130,12 +2135,12 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
2130 state.oterm.type = le16_to_cpu(desc->wTerminalType); 2135 state.oterm.type = le16_to_cpu(desc->wTerminalType);
2131 state.oterm.name = desc->iTerminal; 2136 state.oterm.name = desc->iTerminal;
2132 err = parse_audio_unit(&state, desc->bSourceID); 2137 err = parse_audio_unit(&state, desc->bSourceID);
2133 if (err < 0) 2138 if (err < 0 && err != -EINVAL)
2134 return err; 2139 return err;
2135 2140
2136 /* for UAC2, use the same approach to also add the clock selectors */ 2141 /* for UAC2, use the same approach to also add the clock selectors */
2137 err = parse_audio_unit(&state, desc->bCSourceID); 2142 err = parse_audio_unit(&state, desc->bCSourceID);
2138 if (err < 0) 2143 if (err < 0 && err != -EINVAL)
2139 return err; 2144 return err;
2140 } 2145 }
2141 } 2146 }
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 497d2741d119..ebe91440a068 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -509,7 +509,7 @@ static int snd_nativeinstruments_control_get(struct snd_kcontrol *kcontrol,
509 else 509 else
510 ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest, 510 ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest,
511 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 511 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
512 0, cpu_to_le16(wIndex), 512 0, wIndex,
513 &tmp, sizeof(tmp), 1000); 513 &tmp, sizeof(tmp), 1000);
514 up_read(&mixer->chip->shutdown_rwsem); 514 up_read(&mixer->chip->shutdown_rwsem);
515 515
@@ -540,7 +540,7 @@ static int snd_nativeinstruments_control_put(struct snd_kcontrol *kcontrol,
540 else 540 else
541 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest, 541 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest,
542 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, 542 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
543 cpu_to_le16(wValue), cpu_to_le16(wIndex), 543 wValue, wIndex,
544 NULL, 0, 1000); 544 NULL, 0, 1000);
545 up_read(&mixer->chip->shutdown_rwsem); 545 up_read(&mixer->chip->shutdown_rwsem);
546 546
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 5325a3869bb7..9c5ab22358b1 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -486,7 +486,7 @@ static int snd_usb_nativeinstruments_boot_quirk(struct usb_device *dev)
486{ 486{
487 int ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 487 int ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
488 0xaf, USB_TYPE_VENDOR | USB_RECIP_DEVICE, 488 0xaf, USB_TYPE_VENDOR | USB_RECIP_DEVICE,
489 cpu_to_le16(1), 0, NULL, 0, 1000); 489 1, 0, NULL, 0, 1000);
490 490
491 if (ret < 0) 491 if (ret < 0)
492 return ret; 492 return ret;