Pull sound fixes from Takashi Iwai: "Mostly HD-audio and USB-audio regression fixes: - Oops fix at unloading of snd-hda-codec-conexant module - A few trivial regression fixes for Cirrus and Conexant HD-audio codecs - Relax the USB-audio descriptor parse errors as non-fatal - Fix locking of HD-audio CA0132 DSP loader - Fix the generic HD-audio parser for VIA codecs" * tag 'sound-3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda - Fix DAC assignment for independent HP ALSA: hda - Fix abuse of snd_hda_lock_devices() for DSP loader ALSA: hda - Fix typo in checking IEC958 emphasis bit ALSA: snd-usb: mixer: ignore -EINVAL in snd_usb_mixer_controls() ALSA: snd-usb: mixer: propagate errors up the call chain ALSA: usb: Parse UAC2 extension unit like for UAC1 ALSA: hda - Fix yet missing GPIO/EAPD setup in cirrus driver ALSA: hda/cirrus - Fix the digital beep registration ALSA: hda - Fix missing beep detach in patch_conexant.c ALSA: documentation: Fix typo in Documentation/sound
Unified · Split
| @@ -912,7 +912,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. · 911 unmodified lines | ||
| 912 | 912 | models depending on the codec chip. The list of available models |
| 913 | 913 | is found in HD-Audio-Models.txt |
| 914 | 914 | |
| 915 | − The model name "genric" is treated as a special case. When this | |
| 915 | + The model name "generic" is treated as a special case. When this | |
| 916 | 916 | model is given, the driver uses the generic codec parser without |
| 917 | 917 | "codec-patch". It's sometimes good for testing and debugging. |
| 918 | 918 | |
| @@ -285,7 +285,7 @@ sample data. · 284 unmodified lines | ||
| 285 | 285 | <H4> |
| 286 | 286 | 7.2.4 Close Callback</H4> |
| 287 | 287 | The <TT>close</TT> callback is called when this device is closed by the |
| 288 | −applicaion. If any private data was allocated in open callback, it must | |
| 288 | +application. If any private data was allocated in open callback, it must | |
| 289 | 289 | be released in the close callback. The deletion of ALSA port should be |
| 290 | 290 | done here, too. This callback must not be NULL. |
| 291 | 291 | <H4> |
| @@ -3144,7 +3144,7 @@ static unsigned int convert_to_spdif_status(unsigned short val) · 3143 unmodified lines | ||
| 3144 | 3144 | if (val & AC_DIG1_PROFESSIONAL) |
| 3145 | 3145 | sbits |= IEC958_AES0_PROFESSIONAL; |
| 3146 | 3146 | if (sbits & IEC958_AES0_PROFESSIONAL) { |
| 3147 | − if (sbits & AC_DIG1_EMPHASIS) | |
| 3147 | + if (val & AC_DIG1_EMPHASIS) | |
| 3148 | 3148 | sbits |= IEC958_AES0_PRO_EMPHASIS_5015; |
| 3149 | 3149 | } else { |
| 3150 | 3150 | if (val & AC_DIG1_EMPHASIS) |
| @@ -995,6 +995,8 @@ enum { · 994 unmodified lines | ||
| 995 | 995 | BAD_NO_EXTRA_SURR_DAC = 0x101, |
| 996 | 996 | /* Primary DAC shared with main surrounds */ |
| 997 | 997 | BAD_SHARED_SURROUND = 0x100, |
| 998 | + /* No independent HP possible */ | |
| 999 | + BAD_NO_INDEP_HP = 0x40, | |
| 998 | 1000 | /* Primary DAC shared with main CLFE */ |
| 999 | 1001 | BAD_SHARED_CLFE = 0x10, |
| 1000 | 1002 | /* Primary DAC shared with extra surrounds */ |
| @@ -1392,6 +1394,43 @@ static int check_aamix_out_path(struct hda_codec *codec, int path_idx) · 391 unmodified lines | ||
| 1392 | 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 */ | |
| 1398 | +static 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 | 1434 | /* fill the empty entries in the dac array for speaker/hp with the |
| 1396 | 1435 | * shared dac pointed by the paths |
| 1397 | 1436 | */ |
| @@ -1545,6 +1584,9 @@ static int fill_and_eval_dacs(struct hda_codec *codec, · 147 unmodified lines | ||
| 1545 | 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 | 1590 | /* re-fill the shared DAC for speaker / headphone */ |
| 1549 | 1591 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
| 1550 | 1592 | refill_shared_dacs(codec, cfg->hp_outs, |
| @@ -1758,6 +1800,10 @@ static int parse_output_paths(struct hda_codec *codec) · 207 unmodified lines | ||
| 1758 | 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 | 1807 | kfree(best_cfg); |
| 1762 | 1808 | return 0; |
| 1763 | 1809 | } |
| @@ -415,6 +415,8 @@ struct azx_dev { · 414 unmodified lines | ||
| 415 | 415 | unsigned int opened :1; |
| 416 | 416 | unsigned int running :1; |
| 417 | 417 | unsigned int irq_pending :1; |
| 418 | + unsigned int prepared:1; | |
| 419 | + unsigned int locked:1; | |
| 418 | 420 | /* |
| 419 | 421 | * For VIA: |
| 420 | 422 | * A flag to ensure DMA position is 0 |
| @@ -426,8 +428,25 @@ struct azx_dev { · 5 unmodified lines | ||
| 426 | 428 | |
| 427 | 429 | struct timecounter azx_tc; |
| 428 | 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 | 450 | /* CORB/RIRB */ |
| 432 | 451 | struct azx_rb { |
| 433 | 452 | u32 *buf; /* CORB/RIRB buffer |
| @@ -527,6 +546,10 @@ struct azx { · 93 unmodified lines | ||
| 527 | 546 | |
| 528 | 547 | /* card list (for power_save trigger) */ |
| 529 | 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 | 555 | #define CREATE_TRACE_POINTS |
| @@ -1793,15 +1816,25 @@ azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream) · 1260 unmodified lines | ||
| 1793 | 1816 | dev = chip->capture_index_offset; |
| 1794 | 1817 | nums = chip->capture_streams; |
| 1795 | 1818 | } |
| 1796 | − for (i = 0; i < nums; i++, dev++) | |
| 1797 | − if (!chip->azx_dev[dev].opened) { | |
| 1798 | − res = &chip->azx_dev[dev]; | |
| 1799 | − if (res->assigned_key == key) | |
| 1800 | − break; | |
| 1819 | + for (i = 0; i < nums; i++, dev++) { | |
| 1820 | + struct azx_dev *azx_dev = &chip->azx_dev[dev]; | |
| 1821 | + dsp_lock(azx_dev); | |
| 1822 | + if (!azx_dev->opened && !dsp_is_locked(azx_dev)) { | |
| 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 | 1833 | if (res) { |
| 1834 | + dsp_lock(res); | |
| 1803 | 1835 | res->opened = 1; |
| 1804 | 1836 | res->assigned_key = key; |
| 1837 | + dsp_unlock(res); | |
| 1805 | 1838 | } |
| 1806 | 1839 | return res; |
| 1807 | 1840 | } |
| @@ -2009,6 +2042,12 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream, · 201 unmodified lines | ||
| 2009 | 2042 | struct azx_dev *azx_dev = get_azx_dev(substream); |
| 2010 | 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 | 2051 | mark_runtime_wc(chip, azx_dev, substream, false); |
| 2013 | 2052 | azx_dev->bufsize = 0; |
| 2014 | 2053 | azx_dev->period_bytes = 0; |
| @@ -2016,8 +2055,10 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream, · 1 unmodified line | ||
| 2016 | 2055 | ret = snd_pcm_lib_malloc_pages(substream, |
| 2017 | 2056 | params_buffer_bytes(hw_params)); |
| 2018 | 2057 | if (ret < 0) |
| 2019 | − return ret; | |
| 2058 | + goto unlock; | |
| 2020 | 2059 | mark_runtime_wc(chip, azx_dev, substream, true); |
| 2060 | + unlock: | |
| 2061 | + dsp_unlock(azx_dev); | |
| 2021 | 2062 | return ret; |
| 2022 | 2063 | } |
| 2023 | 2064 | |
| @@ -2029,16 +2070,21 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream) · 5 unmodified lines | ||
| 2029 | 2070 | struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; |
| 2030 | 2071 | |
| 2031 | 2072 | /* reset BDL address */ |
| 2032 | − azx_sd_writel(azx_dev, SD_BDLPL, 0); | |
| 2033 | − azx_sd_writel(azx_dev, SD_BDLPU, 0); | |
| 2034 | − azx_sd_writel(azx_dev, SD_CTL, 0); | |
| 2035 | − azx_dev->bufsize = 0; | |
| 2036 | − azx_dev->period_bytes = 0; | |
| 2037 | − azx_dev->format_val = 0; | |
| 2073 | + dsp_lock(azx_dev); | |
| 2074 | + if (!dsp_is_locked(azx_dev)) { | |
| 2075 | + azx_sd_writel(azx_dev, SD_BDLPL, 0); | |
| 2076 | + azx_sd_writel(azx_dev, SD_BDLPU, 0); | |
| 2077 | + azx_sd_writel(azx_dev, SD_CTL, 0); | |
| 2078 | + azx_dev->bufsize = 0; | |
| 2079 | + azx_dev->period_bytes = 0; | |
| 2080 | + azx_dev->format_val = 0; | |
| 2081 | + } | |
| 2038 | 2082 | |
| 2039 | 2083 | snd_hda_codec_cleanup(apcm->codec, hinfo, substream); |
| 2040 | 2084 | |
| 2041 | 2085 | mark_runtime_wc(chip, azx_dev, substream, false); |
| 2086 | + azx_dev->prepared = 0; | |
| 2087 | + dsp_unlock(azx_dev); | |
| 2042 | 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) · 10 unmodified lines | ||
| 2055 | 2101 | snd_hda_spdif_out_of_nid(apcm->codec, hinfo->nid); |
| 2056 | 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 | 2110 | azx_stream_reset(chip, azx_dev); |
| 2059 | 2111 | format_val = snd_hda_calc_stream_format(runtime->rate, |
| 2060 | 2112 | runtime->channels, |
| @@ -2065,7 +2117,8 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) · 4 unmodified lines | ||
| 2065 | 2117 | snd_printk(KERN_ERR SFX |
| 2066 | 2118 | "%s: invalid format_val, rate=%d, ch=%d, format=%d\n", |
| 2067 | 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 | 2124 | bufsize = snd_pcm_lib_buffer_bytes(substream); |
| @@ -2084,7 +2137,7 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) · 12 unmodified lines | ||
| 2084 | 2137 | azx_dev->no_period_wakeup = runtime->no_period_wakeup; |
| 2085 | 2138 | err = azx_setup_periods(chip, substream, azx_dev); |
| 2086 | 2139 | if (err < 0) |
| 2087 | − return err; | |
| 2140 | + goto unlock; | |
| 2088 | 2141 | } |
| 2089 | 2142 | |
| 2090 | 2143 | /* wallclk has 24Mhz clock source */ |
| @@ -2101,8 +2154,14 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) · 10 unmodified lines | ||
| 2101 | 2154 | if ((chip->driver_caps & AZX_DCAPS_CTX_WORKAROUND) && |
| 2102 | 2155 | stream_tag > chip->capture_streams) |
| 2103 | 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 | 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 | |
| 2108 | 2167 | static 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) · 8 unmodified lines | ||
| 2117 | 2176 | azx_dev = get_azx_dev(substream); |
| 2118 | 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 | 2182 | switch (cmd) { |
| 2121 | 2183 | case SNDRV_PCM_TRIGGER_START: |
| 2122 | 2184 | rstart = 1; |
| @@ -2621,17 +2683,27 @@ static int azx_load_dsp_prepare(struct hda_bus *bus, unsigned int format, · 498 unmodified lines | ||
| 2621 | 2683 | struct azx_dev *azx_dev; |
| 2622 | 2684 | int err; |
| 2623 | 2685 | |
| 2624 | − if (snd_hda_lock_devices(bus)) | |
| 2625 | − return -EBUSY; | |
| 2686 | + azx_dev = azx_get_dsp_loader_dev(chip); | |
| 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 | 2700 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, |
| 2628 | 2701 | snd_dma_pci_data(chip->pci), |
| 2629 | 2702 | byte_size, bufp); |
| 2630 | 2703 | if (err < 0) |
| 2631 | − goto unlock; | |
| 2704 | + goto err_alloc; | |
| 2632 | 2705 | |
| 2633 | 2706 | mark_pages_wc(chip, bufp, true); |
| 2634 | − azx_dev = azx_get_dsp_loader_dev(chip); | |
| 2635 | 2707 | azx_dev->bufsize = byte_size; |
| 2636 | 2708 | azx_dev->period_bytes = byte_size; |
| 2637 | 2709 | azx_dev->format_val = format; |
| @@ -2649,13 +2721,20 @@ static int azx_load_dsp_prepare(struct hda_bus *bus, unsigned int format, · 11 unmodified lines | ||
| 2649 | 2721 | goto error; |
| 2650 | 2722 | |
| 2651 | 2723 | azx_setup_controller(chip, azx_dev); |
| 2724 | + dsp_unlock(azx_dev); | |
| 2652 | 2725 | return azx_dev->stream_tag; |
| 2653 | 2726 | |
| 2654 | 2727 | error: |
| 2655 | 2728 | mark_pages_wc(chip, bufp, false); |
| 2656 | 2729 | snd_dma_free_pages(bufp); |
| 2657 | −unlock: | |
| 2658 | − snd_hda_unlock_devices(bus); | |
| 2730 | + err_alloc: | |
| 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 | 2738 | return err; |
| 2660 | 2739 | } |
| 2661 | 2740 | |
| @@ -2677,9 +2756,10 @@ static void azx_load_dsp_cleanup(struct hda_bus *bus, · 15 unmodified lines | ||
| 2677 | 2756 | struct azx *chip = bus->private_data; |
| 2678 | 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 | 2760 | return; |
| 2682 | 2761 | |
| 2762 | + dsp_lock(azx_dev); | |
| 2683 | 2763 | /* reset BDL address */ |
| 2684 | 2764 | azx_sd_writel(azx_dev, SD_BDLPL, 0); |
| 2685 | 2765 | azx_sd_writel(azx_dev, SD_BDLPU, 0); |
| @@ -2692,7 +2772,12 @@ static void azx_load_dsp_cleanup(struct hda_bus *bus, · 6 unmodified lines | ||
| 2692 | 2772 | snd_dma_free_pages(dmab); |
| 2693 | 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 | 2782 | #endif /* CONFIG_SND_HDA_DSP_LOADER */ |
| 2698 | 2783 | |
| @@ -3481,6 +3566,7 @@ static int azx_first_init(struct azx *chip) · 782 unmodified lines | ||
| 3481 | 3566 | } |
| 3482 | 3567 | |
| 3483 | 3568 | for (i = 0; i < chip->num_streams; i++) { |
| 3569 | + dsp_lock_init(&chip->azx_dev[i]); | |
| 3484 | 3570 | /* allocate memory for the BDL for each stream */ |
| 3485 | 3571 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, |
| 3486 | 3572 | snd_dma_pci_data(chip->pci), |
| @@ -168,10 +168,10 @@ static void cs_automute(struct hda_codec *codec) · 167 unmodified lines | ||
| 168 | 168 | snd_hda_gen_update_outputs(codec); |
| 169 | 169 | |
| 170 | 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 | 172 | spec->gpio_eapd_hp : spec->gpio_eapd_speaker; |
| 173 | 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 | |
| @@ -1142,7 +1142,7 @@ static int patch_cxt5045(struct hda_codec *codec) · 1141 unmodified lines | ||
| 1142 | 1142 | } |
| 1143 | 1143 | |
| 1144 | 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 | 1147 | return 0; |
| 1148 | 1148 | } |
| @@ -1921,7 +1921,7 @@ static int patch_cxt5051(struct hda_codec *codec) · 772 unmodified lines | ||
| 1921 | 1921 | } |
| 1922 | 1922 | |
| 1923 | 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 | 1926 | return 0; |
| 1927 | 1927 | } |
| @@ -3099,7 +3099,7 @@ static int patch_cxt5066(struct hda_codec *codec) · 1171 unmodified lines | ||
| 3099 | 3099 | } |
| 3100 | 3100 | |
| 3101 | 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 | 3104 | return 0; |
| 3105 | 3105 | } |
| @@ -3191,11 +3191,17 @@ static int cx_auto_build_controls(struct hda_codec *codec) · 85 unmodified lines | ||
| 3191 | 3191 | return 0; |
| 3192 | 3192 | } |
| 3193 | 3193 | |
| 3194 | +static void cx_auto_free(struct hda_codec *codec) | |
| 3195 | +{ | |
| 3196 | + snd_hda_detach_beep_device(codec); | |
| 3197 | + snd_hda_gen_free(codec); | |
| 3198 | +} | |
| 3199 | + | |
| 3194 | 3200 | static const struct hda_codec_ops cx_auto_patch_ops = { |
| 3195 | 3201 | .build_controls = cx_auto_build_controls, |
| 3196 | 3202 | .build_pcms = snd_hda_gen_build_pcms, |
| 3197 | 3203 | .init = snd_hda_gen_init, |
| 3198 | − .free = snd_hda_gen_free, | |
| 3204 | + .free = cx_auto_free, | |
| 3199 | 3205 | .unsol_event = snd_hda_jack_unsol_event, |
| 3200 | 3206 | #ifdef CONFIG_PM |
| 3201 | 3207 | .check_power_status = snd_hda_gen_check_power_status, |
| @@ -3391,7 +3397,7 @@ static int patch_conexant_auto(struct hda_codec *codec) · 189 unmodified lines | ||
| 3391 | 3397 | |
| 3392 | 3398 | codec->patch_ops = cx_auto_patch_ops; |
| 3393 | 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 | 3402 | /* Some laptops with Conexant chips show stalls in S3 resume, |
| 3397 | 3403 | * which falls into the single-cmd mode. |
| @@ -715,8 +715,9 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_ · 714 unmodified lines | ||
| 715 | 715 | case UAC2_CLOCK_SELECTOR: { |
| 716 | 716 | struct uac_selector_unit_descriptor *d = p1; |
| 717 | 717 | /* call recursively to retrieve the channel info */ |
| 718 | − if (check_input_term(state, d->baSourceID[0], term) < 0) | |
| 719 | − return -ENODEV; | |
| 718 | + err = check_input_term(state, d->baSourceID[0], term); | |
| 719 | + if (err < 0) | |
| 720 | + return err; | |
| 720 | 721 | term->type = d->bDescriptorSubtype << 16; /* virtual type */ |
| 721 | 722 | term->id = id; |
| 722 | 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_ · 2 unmodified lines | ||
| 725 | 726 | case UAC1_PROCESSING_UNIT: |
| 726 | 727 | case UAC1_EXTENSION_UNIT: |
| 727 | 728 | /* UAC2_PROCESSING_UNIT_V2 */ |
| 728 | − /* UAC2_EFFECT_UNIT */ { | |
| 729 | + /* UAC2_EFFECT_UNIT */ | |
| 730 | + case UAC2_EXTENSION_UNIT_V2: { | |
| 729 | 731 | struct uac_processing_unit_descriptor *d = p1; |
| 730 | 732 | |
| 731 | 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 · 624 unmodified lines | ||
| 1356 | 1358 | return err; |
| 1357 | 1359 | |
| 1358 | 1360 | /* determine the input source type and name */ |
| 1359 | − if (check_input_term(state, hdr->bSourceID, &iterm) < 0) | |
| 1360 | − return -EINVAL; | |
| 1361 | + err = check_input_term(state, hdr->bSourceID, &iterm); | |
| 1362 | + if (err < 0) | |
| 1363 | + return err; | |
| 1361 | 1364 | |
| 1362 | 1365 | master_bits = snd_usb_combine_bytes(bmaControls, csize); |
| 1363 | 1366 | /* master configuration quirks */ |
| @@ -2052,6 +2055,8 @@ static int parse_audio_unit(struct mixer_build *state, int unitid) · 688 unmodified lines | ||
| 2052 | 2055 | return parse_audio_extension_unit(state, unitid, p1); |
| 2053 | 2056 | else /* UAC_VERSION_2 */ |
| 2054 | 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 | 2060 | default: |
| 2056 | 2061 | snd_printk(KERN_ERR "usbaudio: unit %u: unexpected type 0x%02x\n", unitid, p1[2]); |
| 2057 | 2062 | return -EINVAL; |
| @@ -2118,7 +2123,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) · 60 unmodified lines | ||
| 2118 | 2123 | state.oterm.type = le16_to_cpu(desc->wTerminalType); |
| 2119 | 2124 | state.oterm.name = desc->iTerminal; |
| 2120 | 2125 | err = parse_audio_unit(&state, desc->bSourceID); |
| 2121 | − if (err < 0) | |
| 2126 | + if (err < 0 && err != -EINVAL) | |
| 2122 | 2127 | return err; |
| 2123 | 2128 | } else { /* UAC_VERSION_2 */ |
| 2124 | 2129 | struct uac2_output_terminal_descriptor *desc = p; |
| @@ -2130,12 +2135,12 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) · 5 unmodified lines | ||
| 2130 | 2135 | state.oterm.type = le16_to_cpu(desc->wTerminalType); |
| 2131 | 2136 | state.oterm.name = desc->iTerminal; |
| 2132 | 2137 | err = parse_audio_unit(&state, desc->bSourceID); |
| 2133 | − if (err < 0) | |
| 2138 | + if (err < 0 && err != -EINVAL) | |
| 2134 | 2139 | return err; |
| 2135 | 2140 | |
| 2136 | 2141 | /* for UAC2, use the same approach to also add the clock selectors */ |
| 2137 | 2142 | err = parse_audio_unit(&state, desc->bCSourceID); |
| 2138 | − if (err < 0) | |
| 2143 | + if (err < 0 && err != -EINVAL) | |
| 2139 | 2144 | return err; |
| 2140 | 2145 | } |
| 2141 | 2146 | } |