Commit 9a7e4f5633f0c733820091cc9c643cc0c257c349

Authored by Linus Torvalds

Merge tag 'sound-3.18-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "This batch ended up as a relatively high volume due to pending ASoC
  fixes.  But most of fixes there are trivial and/or device- specific
  fixes and quirks, so safe to apply.  The only (ASoC) core fixes are
  the DPCM race fix and the machine-driver matching fix for
  componentization"

* tag 'sound-3.18-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda - fix the mic mute led problem for Latitude E5550
  ALSA: hda - move DELL_WMI_MIC_MUTE_LED to the tail in the quirk chain
  ASoC: wm_adsp: Avoid attempt to free buffers that might still be in use
  ALSA: usb-audio: Set the Control Selector to SU_SELECTOR_CONTROL for UAC2
  ALSA: usb-audio: Add ctrl message delay quirk for Marantz/Denon devices
  ASoC: sgtl5000: Fix SMALL_POP bit definition
  ASoC: cs42l51: re-hook of_match_table pointer
  ASoC: rt5670: change dapm routes of PLL connection
  ASoC: rt5670: correct the incorrect default values
  ASoC: samsung: Add MODULE_DEVICE_TABLE for Snow
  ASoC: max98090: Correct pclk divisor settings
  ASoC: dpcm: Fix race between FE/BE updates and trigger
  ASoC: Fix snd_soc_find_dai() matching component by name
  ASoC: rsnd: remove unsupported PAUSE flag
  ASoC: fsi: remove unsupported PAUSE flag
  ASoC: rt5645: Mark RT5645_TDM_CTRL_3 as readable
  ASoC: rockchip-i2s: fix infinite loop in rockchip_snd_rxctrl
  ASoC: es8328-i2c: Fix i2c_device_id name field in es8328_id
  ASoC: fsl_asrc: Add reg_defaults for regmap to fix kernel dump

Showing 21 changed files Side-by-side Diff

include/sound/soc-dpcm.h
... ... @@ -102,6 +102,8 @@
102 102 /* state and update */
103 103 enum snd_soc_dpcm_update runtime_update;
104 104 enum snd_soc_dpcm_state state;
  105 +
  106 + int trigger_pending; /* trigger cmd + 1 if pending, 0 if not */
105 107 };
106 108  
107 109 /* can this BE stop and free */
sound/pci/hda/patch_realtek.c
... ... @@ -4520,6 +4520,8 @@
4520 4520 [ALC269_FIXUP_HEADSET_MODE] = {
4521 4521 .type = HDA_FIXUP_FUNC,
4522 4522 .v.func = alc_fixup_headset_mode,
  4523 + .chained = true,
  4524 + .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
4523 4525 },
4524 4526 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
4525 4527 .type = HDA_FIXUP_FUNC,
... ... @@ -4709,6 +4711,8 @@
4709 4711 [ALC255_FIXUP_HEADSET_MODE] = {
4710 4712 .type = HDA_FIXUP_FUNC,
4711 4713 .v.func = alc_fixup_headset_mode_alc255,
  4714 + .chained = true,
  4715 + .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
4712 4716 },
4713 4717 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
4714 4718 .type = HDA_FIXUP_FUNC,
... ... @@ -4744,8 +4748,6 @@
4744 4748 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
4745 4749 .type = HDA_FIXUP_FUNC,
4746 4750 .v.func = alc_fixup_dell_wmi,
4747   - .chained_before = true,
4748   - .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
4749 4751 },
4750 4752 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
4751 4753 .type = HDA_FIXUP_PINS,
4752 4754  
... ... @@ -4783,10 +4785,8 @@
4783 4785 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4784 4786 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4785 4787 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4786   - SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED),
4787 4788 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4788 4789 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4789   - SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED),
4790 4790 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
4791 4791 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4792 4792 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
sound/soc/codecs/cs42l51-i2c.c
... ... @@ -46,6 +46,7 @@
46 46 .driver = {
47 47 .name = "cs42l51",
48 48 .owner = THIS_MODULE,
  49 + .of_match_table = cs42l51_of_match,
49 50 },
50 51 .probe = cs42l51_i2c_probe,
51 52 .remove = cs42l51_i2c_remove,
sound/soc/codecs/cs42l51.c
... ... @@ -558,11 +558,13 @@
558 558 }
559 559 EXPORT_SYMBOL_GPL(cs42l51_probe);
560 560  
561   -static const struct of_device_id cs42l51_of_match[] = {
  561 +const struct of_device_id cs42l51_of_match[] = {
562 562 { .compatible = "cirrus,cs42l51", },
563 563 { }
564 564 };
565 565 MODULE_DEVICE_TABLE(of, cs42l51_of_match);
  566 +EXPORT_SYMBOL_GPL(cs42l51_of_match);
  567 +
566 568 MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>");
567 569 MODULE_DESCRIPTION("Cirrus Logic CS42L51 ALSA SoC Codec Driver");
568 570 MODULE_LICENSE("GPL");
sound/soc/codecs/cs42l51.h
... ... @@ -22,6 +22,7 @@
22 22  
23 23 extern const struct regmap_config cs42l51_regmap;
24 24 int cs42l51_probe(struct device *dev, struct regmap *regmap);
  25 +extern const struct of_device_id cs42l51_of_match[];
25 26  
26 27 #define CS42L51_CHIP_ID 0x1B
27 28 #define CS42L51_CHIP_REV_A 0x00
sound/soc/codecs/es8328-i2c.c
... ... @@ -19,7 +19,7 @@
19 19 #include "es8328.h"
20 20  
21 21 static const struct i2c_device_id es8328_id[] = {
22   - { "everest,es8328", 0 },
  22 + { "es8328", 0 },
23 23 { }
24 24 };
25 25 MODULE_DEVICE_TABLE(i2c, es8328_id);
sound/soc/codecs/max98090.c
... ... @@ -1941,13 +1941,13 @@
1941 1941 * 0x02 (when master clk is 20MHz to 40MHz)..
1942 1942 * 0x03 (when master clk is 40MHz to 60MHz)..
1943 1943 */
1944   - if ((freq >= 10000000) && (freq < 20000000)) {
  1944 + if ((freq >= 10000000) && (freq <= 20000000)) {
1945 1945 snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK,
1946 1946 M98090_PSCLK_DIV1);
1947   - } else if ((freq >= 20000000) && (freq < 40000000)) {
  1947 + } else if ((freq > 20000000) && (freq <= 40000000)) {
1948 1948 snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK,
1949 1949 M98090_PSCLK_DIV2);
1950   - } else if ((freq >= 40000000) && (freq < 60000000)) {
  1950 + } else if ((freq > 40000000) && (freq <= 60000000)) {
1951 1951 snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK,
1952 1952 M98090_PSCLK_DIV4);
1953 1953 } else {
sound/soc/codecs/rt5645.c
... ... @@ -139,6 +139,7 @@
139 139 { 0x76, 0x000a },
140 140 { 0x77, 0x0c00 },
141 141 { 0x78, 0x0000 },
  142 + { 0x79, 0x0123 },
142 143 { 0x80, 0x0000 },
143 144 { 0x81, 0x0000 },
144 145 { 0x82, 0x0000 },
... ... @@ -334,6 +335,7 @@
334 335 case RT5645_DMIC_CTRL2:
335 336 case RT5645_TDM_CTRL_1:
336 337 case RT5645_TDM_CTRL_2:
  338 + case RT5645_TDM_CTRL_3:
337 339 case RT5645_GLB_CLK:
338 340 case RT5645_PLL_CTRL1:
339 341 case RT5645_PLL_CTRL2:
sound/soc/codecs/rt5670.c
... ... @@ -100,18 +100,18 @@
100 100 { 0x4c, 0x5380 },
101 101 { 0x4f, 0x0073 },
102 102 { 0x52, 0x00d3 },
103   - { 0x53, 0xf0f0 },
  103 + { 0x53, 0xf000 },
104 104 { 0x61, 0x0000 },
105 105 { 0x62, 0x0001 },
106 106 { 0x63, 0x00c3 },
107 107 { 0x64, 0x0000 },
108   - { 0x65, 0x0000 },
  108 + { 0x65, 0x0001 },
109 109 { 0x66, 0x0000 },
110 110 { 0x6f, 0x8000 },
111 111 { 0x70, 0x8000 },
112 112 { 0x71, 0x8000 },
113 113 { 0x72, 0x8000 },
114   - { 0x73, 0x1110 },
  114 + { 0x73, 0x7770 },
115 115 { 0x74, 0x0e00 },
116 116 { 0x75, 0x1505 },
117 117 { 0x76, 0x0015 },
118 118  
119 119  
... ... @@ -125,21 +125,21 @@
125 125 { 0x83, 0x0000 },
126 126 { 0x84, 0x0000 },
127 127 { 0x85, 0x0000 },
128   - { 0x86, 0x0008 },
  128 + { 0x86, 0x0004 },
129 129 { 0x87, 0x0000 },
130 130 { 0x88, 0x0000 },
131 131 { 0x89, 0x0000 },
132 132 { 0x8a, 0x0000 },
133 133 { 0x8b, 0x0000 },
134   - { 0x8c, 0x0007 },
  134 + { 0x8c, 0x0003 },
135 135 { 0x8d, 0x0000 },
136 136 { 0x8e, 0x0004 },
137 137 { 0x8f, 0x1100 },
138 138 { 0x90, 0x0646 },
139 139 { 0x91, 0x0c06 },
140 140 { 0x93, 0x0000 },
141   - { 0x94, 0x0000 },
142   - { 0x95, 0x0000 },
  141 + { 0x94, 0x1270 },
  142 + { 0x95, 0x1000 },
143 143 { 0x97, 0x0000 },
144 144 { 0x98, 0x0000 },
145 145 { 0x99, 0x0000 },
146 146  
... ... @@ -150,11 +150,11 @@
150 150 { 0x9e, 0x0400 },
151 151 { 0xae, 0x7000 },
152 152 { 0xaf, 0x0000 },
153   - { 0xb0, 0x6000 },
  153 + { 0xb0, 0x7000 },
154 154 { 0xb1, 0x0000 },
155 155 { 0xb2, 0x0000 },
156 156 { 0xb3, 0x001f },
157   - { 0xb4, 0x2206 },
  157 + { 0xb4, 0x220c },
158 158 { 0xb5, 0x1f00 },
159 159 { 0xb6, 0x0000 },
160 160 { 0xb7, 0x0000 },
161 161  
162 162  
163 163  
164 164  
... ... @@ -171,25 +171,25 @@
171 171 { 0xcf, 0x1813 },
172 172 { 0xd0, 0x0690 },
173 173 { 0xd1, 0x1c17 },
174   - { 0xd3, 0xb320 },
  174 + { 0xd3, 0xa220 },
175 175 { 0xd4, 0x0000 },
176 176 { 0xd6, 0x0400 },
177 177 { 0xd9, 0x0809 },
178 178 { 0xda, 0x0000 },
179 179 { 0xdb, 0x0001 },
180 180 { 0xdc, 0x0049 },
181   - { 0xdd, 0x0009 },
  181 + { 0xdd, 0x0024 },
182 182 { 0xe6, 0x8000 },
183 183 { 0xe7, 0x0000 },
184   - { 0xec, 0xb300 },
  184 + { 0xec, 0xa200 },
185 185 { 0xed, 0x0000 },
186   - { 0xee, 0xb300 },
  186 + { 0xee, 0xa200 },
187 187 { 0xef, 0x0000 },
188 188 { 0xf8, 0x0000 },
189 189 { 0xf9, 0x0000 },
190 190 { 0xfa, 0x8010 },
191 191 { 0xfb, 0x0033 },
192   - { 0xfc, 0x0080 },
  192 + { 0xfc, 0x0100 },
193 193 };
194 194  
195 195 static bool rt5670_volatile_register(struct device *dev, unsigned int reg)
... ... @@ -1877,6 +1877,10 @@
1877 1877 { "DAC1 MIXR", "DAC1 Switch", "DAC1 R Mux" },
1878 1878 { "DAC1 MIXR", NULL, "DAC Stereo1 Filter" },
1879 1879  
  1880 + { "DAC Stereo1 Filter", NULL, "PLL1", is_sys_clk_from_pll },
  1881 + { "DAC Mono Left Filter", NULL, "PLL1", is_sys_clk_from_pll },
  1882 + { "DAC Mono Right Filter", NULL, "PLL1", is_sys_clk_from_pll },
  1883 +
1880 1884 { "DAC MIX", NULL, "DAC1 MIXL" },
1881 1885 { "DAC MIX", NULL, "DAC1 MIXR" },
1882 1886  
1883 1887  
1884 1888  
1885 1889  
... ... @@ -1926,14 +1930,10 @@
1926 1930  
1927 1931 { "DAC L1", NULL, "DAC L1 Power" },
1928 1932 { "DAC L1", NULL, "Stereo DAC MIXL" },
1929   - { "DAC L1", NULL, "PLL1", is_sys_clk_from_pll },
1930 1933 { "DAC R1", NULL, "DAC R1 Power" },
1931 1934 { "DAC R1", NULL, "Stereo DAC MIXR" },
1932   - { "DAC R1", NULL, "PLL1", is_sys_clk_from_pll },
1933 1935 { "DAC L2", NULL, "Mono DAC MIXL" },
1934   - { "DAC L2", NULL, "PLL1", is_sys_clk_from_pll },
1935 1936 { "DAC R2", NULL, "Mono DAC MIXR" },
1936   - { "DAC R2", NULL, "PLL1", is_sys_clk_from_pll },
1937 1937  
1938 1938 { "OUT MIXL", "BST1 Switch", "BST1" },
1939 1939 { "OUT MIXL", "INL Switch", "INL VOL" },
sound/soc/codecs/sgtl5000.c
... ... @@ -1299,8 +1299,7 @@
1299 1299  
1300 1300 /* enable small pop, introduce 400ms delay in turning off */
1301 1301 snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL,
1302   - SGTL5000_SMALL_POP,
1303   - SGTL5000_SMALL_POP);
  1302 + SGTL5000_SMALL_POP, 1);
1304 1303  
1305 1304 /* disable short cut detector */
1306 1305 snd_soc_write(codec, SGTL5000_CHIP_SHORT_CTRL, 0);
sound/soc/codecs/sgtl5000.h
... ... @@ -275,7 +275,7 @@
275 275 #define SGTL5000_BIAS_CTRL_MASK 0x000e
276 276 #define SGTL5000_BIAS_CTRL_SHIFT 1
277 277 #define SGTL5000_BIAS_CTRL_WIDTH 3
278   -#define SGTL5000_SMALL_POP 0x0001
  278 +#define SGTL5000_SMALL_POP 0
279 279  
280 280 /*
281 281 * SGTL5000_CHIP_MIC_CTRL
sound/soc/codecs/wm_adsp.c
... ... @@ -1355,6 +1355,7 @@
1355 1355 file, blocks, pos - firmware->size);
1356 1356  
1357 1357 out_fw:
  1358 + regmap_async_complete(regmap);
1358 1359 release_firmware(firmware);
1359 1360 wm_adsp_buf_free(&buf_list);
1360 1361 out:
sound/soc/fsl/fsl_asrc.c
... ... @@ -684,12 +684,38 @@
684 684 }
685 685 }
686 686  
  687 +static struct reg_default fsl_asrc_reg[] = {
  688 + { REG_ASRCTR, 0x0000 }, { REG_ASRIER, 0x0000 },
  689 + { REG_ASRCNCR, 0x0000 }, { REG_ASRCFG, 0x0000 },
  690 + { REG_ASRCSR, 0x0000 }, { REG_ASRCDR1, 0x0000 },
  691 + { REG_ASRCDR2, 0x0000 }, { REG_ASRSTR, 0x0000 },
  692 + { REG_ASRRA, 0x0000 }, { REG_ASRRB, 0x0000 },
  693 + { REG_ASRRC, 0x0000 }, { REG_ASRPM1, 0x0000 },
  694 + { REG_ASRPM2, 0x0000 }, { REG_ASRPM3, 0x0000 },
  695 + { REG_ASRPM4, 0x0000 }, { REG_ASRPM5, 0x0000 },
  696 + { REG_ASRTFR1, 0x0000 }, { REG_ASRCCR, 0x0000 },
  697 + { REG_ASRDIA, 0x0000 }, { REG_ASRDOA, 0x0000 },
  698 + { REG_ASRDIB, 0x0000 }, { REG_ASRDOB, 0x0000 },
  699 + { REG_ASRDIC, 0x0000 }, { REG_ASRDOC, 0x0000 },
  700 + { REG_ASRIDRHA, 0x0000 }, { REG_ASRIDRLA, 0x0000 },
  701 + { REG_ASRIDRHB, 0x0000 }, { REG_ASRIDRLB, 0x0000 },
  702 + { REG_ASRIDRHC, 0x0000 }, { REG_ASRIDRLC, 0x0000 },
  703 + { REG_ASR76K, 0x0A47 }, { REG_ASR56K, 0x0DF3 },
  704 + { REG_ASRMCRA, 0x0000 }, { REG_ASRFSTA, 0x0000 },
  705 + { REG_ASRMCRB, 0x0000 }, { REG_ASRFSTB, 0x0000 },
  706 + { REG_ASRMCRC, 0x0000 }, { REG_ASRFSTC, 0x0000 },
  707 + { REG_ASRMCR1A, 0x0000 }, { REG_ASRMCR1B, 0x0000 },
  708 + { REG_ASRMCR1C, 0x0000 },
  709 +};
  710 +
687 711 static const struct regmap_config fsl_asrc_regmap_config = {
688 712 .reg_bits = 32,
689 713 .reg_stride = 4,
690 714 .val_bits = 32,
691 715  
692 716 .max_register = REG_ASRMCR1C,
  717 + .reg_defaults = fsl_asrc_reg,
  718 + .num_reg_defaults = ARRAY_SIZE(fsl_asrc_reg),
693 719 .readable_reg = fsl_asrc_readable_reg,
694 720 .volatile_reg = fsl_asrc_volatile_reg,
695 721 .writeable_reg = fsl_asrc_writeable_reg,
sound/soc/rockchip/rockchip_i2s.c
... ... @@ -154,8 +154,10 @@
154 154 while (val) {
155 155 regmap_read(i2s->regmap, I2S_CLR, &val);
156 156 retry--;
157   - if (!retry)
  157 + if (!retry) {
158 158 dev_warn(i2s->dev, "fail to clear\n");
  159 + break;
  160 + }
159 161 }
160 162 }
161 163 }
sound/soc/samsung/snow.c
... ... @@ -110,6 +110,7 @@
110 110 { .compatible = "google,snow-audio-max98095", },
111 111 {},
112 112 };
  113 +MODULE_DEVICE_TABLE(of, snow_of_match);
113 114  
114 115 static struct platform_driver snow_driver = {
115 116 .driver = {
... ... @@ -1711,8 +1711,7 @@
1711 1711 static struct snd_pcm_hardware fsi_pcm_hardware = {
1712 1712 .info = SNDRV_PCM_INFO_INTERLEAVED |
1713 1713 SNDRV_PCM_INFO_MMAP |
1714   - SNDRV_PCM_INFO_MMAP_VALID |
1715   - SNDRV_PCM_INFO_PAUSE,
  1714 + SNDRV_PCM_INFO_MMAP_VALID,
1716 1715 .buffer_bytes_max = 64 * 1024,
1717 1716 .period_bytes_min = 32,
1718 1717 .period_bytes_max = 8192,
sound/soc/sh/rcar/core.c
... ... @@ -886,8 +886,7 @@
886 886 static struct snd_pcm_hardware rsnd_pcm_hardware = {
887 887 .info = SNDRV_PCM_INFO_INTERLEAVED |
888 888 SNDRV_PCM_INFO_MMAP |
889   - SNDRV_PCM_INFO_MMAP_VALID |
890   - SNDRV_PCM_INFO_PAUSE,
  889 + SNDRV_PCM_INFO_MMAP_VALID,
891 890 .buffer_bytes_max = 64 * 1024,
892 891 .period_bytes_min = 32,
893 892 .period_bytes_max = 8192,
sound/soc/soc-core.c
... ... @@ -884,7 +884,7 @@
884 884 list_for_each_entry(component, &component_list, list) {
885 885 if (dlc->of_node && component->dev->of_node != dlc->of_node)
886 886 continue;
887   - if (dlc->name && strcmp(dev_name(component->dev), dlc->name))
  887 + if (dlc->name && strcmp(component->name, dlc->name))
888 888 continue;
889 889 list_for_each_entry(dai, &component->dai_list, list) {
890 890 if (dlc->dai_name && strcmp(dai->name, dlc->dai_name))
... ... @@ -1522,13 +1522,36 @@
1522 1522 dpcm_init_runtime_hw(runtime, &cpu_dai_drv->capture);
1523 1523 }
1524 1524  
  1525 +static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd);
  1526 +
  1527 +/* Set FE's runtime_update state; the state is protected via PCM stream lock
  1528 + * for avoiding the race with trigger callback.
  1529 + * If the state is unset and a trigger is pending while the previous operation,
  1530 + * process the pending trigger action here.
  1531 + */
  1532 +static void dpcm_set_fe_update_state(struct snd_soc_pcm_runtime *fe,
  1533 + int stream, enum snd_soc_dpcm_update state)
  1534 +{
  1535 + struct snd_pcm_substream *substream =
  1536 + snd_soc_dpcm_get_substream(fe, stream);
  1537 +
  1538 + snd_pcm_stream_lock_irq(substream);
  1539 + if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) {
  1540 + dpcm_fe_dai_do_trigger(substream,
  1541 + fe->dpcm[stream].trigger_pending - 1);
  1542 + fe->dpcm[stream].trigger_pending = 0;
  1543 + }
  1544 + fe->dpcm[stream].runtime_update = state;
  1545 + snd_pcm_stream_unlock_irq(substream);
  1546 +}
  1547 +
1525 1548 static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
1526 1549 {
1527 1550 struct snd_soc_pcm_runtime *fe = fe_substream->private_data;
1528 1551 struct snd_pcm_runtime *runtime = fe_substream->runtime;
1529 1552 int stream = fe_substream->stream, ret = 0;
1530 1553  
1531   - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
  1554 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
1532 1555  
1533 1556 ret = dpcm_be_dai_startup(fe, fe_substream->stream);
1534 1557 if (ret < 0) {
1535 1558  
... ... @@ -1550,13 +1573,13 @@
1550 1573 dpcm_set_fe_runtime(fe_substream);
1551 1574 snd_pcm_limit_hw_rates(runtime);
1552 1575  
1553   - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
  1576 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
1554 1577 return 0;
1555 1578  
1556 1579 unwind:
1557 1580 dpcm_be_dai_startup_unwind(fe, fe_substream->stream);
1558 1581 be_err:
1559   - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
  1582 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
1560 1583 return ret;
1561 1584 }
1562 1585  
... ... @@ -1603,7 +1626,7 @@
1603 1626 struct snd_soc_pcm_runtime *fe = substream->private_data;
1604 1627 int stream = substream->stream;
1605 1628  
1606   - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
  1629 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
1607 1630  
1608 1631 /* shutdown the BEs */
1609 1632 dpcm_be_dai_shutdown(fe, substream->stream);
... ... @@ -1617,7 +1640,7 @@
1617 1640 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP);
1618 1641  
1619 1642 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE;
1620   - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
  1643 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
1621 1644 return 0;
1622 1645 }
1623 1646  
... ... @@ -1665,7 +1688,7 @@
1665 1688 int err, stream = substream->stream;
1666 1689  
1667 1690 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
1668   - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
  1691 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
1669 1692  
1670 1693 dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name);
1671 1694  
... ... @@ -1680,7 +1703,7 @@
1680 1703 err = dpcm_be_dai_hw_free(fe, stream);
1681 1704  
1682 1705 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE;
1683   - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
  1706 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
1684 1707  
1685 1708 mutex_unlock(&fe->card->mutex);
1686 1709 return 0;
... ... @@ -1773,7 +1796,7 @@
1773 1796 int ret, stream = substream->stream;
1774 1797  
1775 1798 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
1776   - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
  1799 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
1777 1800  
1778 1801 memcpy(&fe->dpcm[substream->stream].hw_params, params,
1779 1802 sizeof(struct snd_pcm_hw_params));
... ... @@ -1796,7 +1819,7 @@
1796 1819 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS;
1797 1820  
1798 1821 out:
1799   - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
  1822 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
1800 1823 mutex_unlock(&fe->card->mutex);
1801 1824 return ret;
1802 1825 }
... ... @@ -1910,7 +1933,7 @@
1910 1933 }
1911 1934 EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger);
1912 1935  
1913   -static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
  1936 +static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd)
1914 1937 {
1915 1938 struct snd_soc_pcm_runtime *fe = substream->private_data;
1916 1939 int stream = substream->stream, ret;
... ... @@ -1984,6 +2007,23 @@
1984 2007 return ret;
1985 2008 }
1986 2009  
  2010 +static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
  2011 +{
  2012 + struct snd_soc_pcm_runtime *fe = substream->private_data;
  2013 + int stream = substream->stream;
  2014 +
  2015 + /* if FE's runtime_update is already set, we're in race;
  2016 + * process this trigger later at exit
  2017 + */
  2018 + if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) {
  2019 + fe->dpcm[stream].trigger_pending = cmd + 1;
  2020 + return 0; /* delayed, assuming it's successful */
  2021 + }
  2022 +
  2023 + /* we're alone, let's trigger */
  2024 + return dpcm_fe_dai_do_trigger(substream, cmd);
  2025 +}
  2026 +
1987 2027 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream)
1988 2028 {
1989 2029 struct snd_soc_dpcm *dpcm;
... ... @@ -2027,7 +2067,7 @@
2027 2067  
2028 2068 dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name);
2029 2069  
2030   - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
  2070 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
2031 2071  
2032 2072 /* there is no point preparing this FE if there are no BEs */
2033 2073 if (list_empty(&fe->dpcm[stream].be_clients)) {
... ... @@ -2054,7 +2094,7 @@
2054 2094 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE;
2055 2095  
2056 2096 out:
2057   - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
  2097 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
2058 2098 mutex_unlock(&fe->card->mutex);
2059 2099  
2060 2100 return ret;
2061 2101  
... ... @@ -2201,11 +2241,11 @@
2201 2241 {
2202 2242 int ret;
2203 2243  
2204   - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE;
  2244 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE);
2205 2245 ret = dpcm_run_update_startup(fe, stream);
2206 2246 if (ret < 0)
2207 2247 dev_err(fe->dev, "ASoC: failed to startup some BEs\n");
2208   - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
  2248 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
2209 2249  
2210 2250 return ret;
2211 2251 }
2212 2252  
... ... @@ -2214,11 +2254,11 @@
2214 2254 {
2215 2255 int ret;
2216 2256  
2217   - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE;
  2257 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE);
2218 2258 ret = dpcm_run_update_shutdown(fe, stream);
2219 2259 if (ret < 0)
2220 2260 dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n");
2221   - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
  2261 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
2222 2262  
2223 2263 return ret;
2224 2264 }
... ... @@ -2033,10 +2033,11 @@
2033 2033 cval->res = 1;
2034 2034 cval->initialized = 1;
2035 2035  
2036   - if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR)
2037   - cval->control = UAC2_CX_CLOCK_SELECTOR;
2038   - else
  2036 + if (state->mixer->protocol == UAC_VERSION_1)
2039 2037 cval->control = 0;
  2038 + else /* UAC_VERSION_2 */
  2039 + cval->control = (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR) ?
  2040 + UAC2_CX_CLOCK_SELECTOR : UAC2_SU_SELECTOR;
2040 2041  
2041 2042 namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL);
2042 2043 if (!namelist) {
... ... @@ -1146,6 +1146,20 @@
1146 1146 if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) &&
1147 1147 (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
1148 1148 mdelay(20);
  1149 +
  1150 + /* Marantz/Denon devices with USB DAC functionality need a delay
  1151 + * after each class compliant request
  1152 + */
  1153 + if ((le16_to_cpu(dev->descriptor.idVendor) == 0x154e) &&
  1154 + (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) {
  1155 +
  1156 + switch (le16_to_cpu(dev->descriptor.idProduct)) {
  1157 + case 0x3005: /* Marantz HD-DAC1 */
  1158 + case 0x3006: /* Marantz SA-14S1 */
  1159 + mdelay(20);
  1160 + break;
  1161 + }
  1162 + }
1149 1163 }
1150 1164  
1151 1165 /*