aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/firewire/dice/dice.c4
-rw-r--r--sound/pci/hda/hda_intel.c64
-rw-r--r--sound/pci/hda/patch_ca0132.c3
-rw-r--r--sound/pci/hda/patch_conexant.c5
-rw-r--r--sound/pci/hda/patch_hdmi.c9
-rw-r--r--sound/pci/hda/patch_realtek.c96
-rw-r--r--sound/pci/hda/patch_sigmatel.c45
-rw-r--r--sound/pci/rme96.c41
-rw-r--r--sound/soc/codecs/arizona.c16
-rw-r--r--sound/soc/codecs/es8328.c41
-rw-r--r--sound/soc/codecs/es8328.h1
-rw-r--r--sound/soc/codecs/nau8825.c31
-rw-r--r--sound/soc/codecs/rl6231.c6
-rw-r--r--sound/soc/codecs/rt5645.c61
-rw-r--r--sound/soc/codecs/rt5670.h12
-rw-r--r--sound/soc/codecs/rt5677.c100
-rw-r--r--sound/soc/codecs/sgtl5000.c1
-rw-r--r--sound/soc/codecs/wm8960.c2
-rw-r--r--sound/soc/codecs/wm8962.c4
-rw-r--r--sound/soc/codecs/wm8974.c1
-rw-r--r--sound/soc/davinci/davinci-mcasp.c16
-rw-r--r--sound/soc/fsl/Kconfig2
-rw-r--r--sound/soc/fsl/fsl_sai.c21
-rw-r--r--sound/soc/intel/Kconfig2
-rw-r--r--sound/soc/intel/skylake/skl-topology.c1
-rw-r--r--sound/soc/rockchip/rockchip_spdif.c8
-rw-r--r--sound/soc/rockchip/rockchip_spdif.h8
-rw-r--r--sound/soc/sh/rcar/gen.c2
-rw-r--r--sound/soc/sh/rcar/src.c7
-rw-r--r--sound/soc/soc-core.c6
-rw-r--r--sound/soc/soc-dapm.c7
-rw-r--r--sound/soc/soc-ops.c2
-rw-r--r--sound/soc/soc-topology.c3
-rw-r--r--sound/soc/sti/uniperif_player.c9
-rw-r--r--sound/soc/sti/uniperif_reader.c3
-rw-r--r--sound/soc/sunxi/sun4i-codec.c27
-rw-r--r--sound/usb/midi.c46
-rw-r--r--sound/usb/mixer.c2
-rw-r--r--sound/usb/mixer_maps.c12
-rw-r--r--sound/usb/mixer_quirks.c37
-rw-r--r--sound/usb/mixer_quirks.h4
-rw-r--r--sound/usb/quirks-table.h11
-rw-r--r--sound/usb/quirks.c2
-rw-r--r--sound/usb/usbaudio.h1
44 files changed, 608 insertions, 174 deletions
diff --git a/sound/firewire/dice/dice.c b/sound/firewire/dice/dice.c
index 5d99436dfcae..0cda05c72f50 100644
--- a/sound/firewire/dice/dice.c
+++ b/sound/firewire/dice/dice.c
@@ -12,9 +12,11 @@ MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
12MODULE_LICENSE("GPL v2"); 12MODULE_LICENSE("GPL v2");
13 13
14#define OUI_WEISS 0x001c6a 14#define OUI_WEISS 0x001c6a
15#define OUI_LOUD 0x000ff2
15 16
16#define DICE_CATEGORY_ID 0x04 17#define DICE_CATEGORY_ID 0x04
17#define WEISS_CATEGORY_ID 0x00 18#define WEISS_CATEGORY_ID 0x00
19#define LOUD_CATEGORY_ID 0x10
18 20
19static int dice_interface_check(struct fw_unit *unit) 21static int dice_interface_check(struct fw_unit *unit)
20{ 22{
@@ -57,6 +59,8 @@ static int dice_interface_check(struct fw_unit *unit)
57 } 59 }
58 if (vendor == OUI_WEISS) 60 if (vendor == OUI_WEISS)
59 category = WEISS_CATEGORY_ID; 61 category = WEISS_CATEGORY_ID;
62 else if (vendor == OUI_LOUD)
63 category = LOUD_CATEGORY_ID;
60 else 64 else
61 category = DICE_CATEGORY_ID; 65 category = DICE_CATEGORY_ID;
62 if (device->config_rom[3] != ((vendor << 8) | category) || 66 if (device->config_rom[3] != ((vendor << 8) | category) ||
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 8a7fbdcb4072..3b3658297070 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -312,6 +312,10 @@ enum {
312 (AZX_DCAPS_INTEL_PCH | AZX_DCAPS_SEPARATE_STREAM_TAG |\ 312 (AZX_DCAPS_INTEL_PCH | AZX_DCAPS_SEPARATE_STREAM_TAG |\
313 AZX_DCAPS_I915_POWERWELL) 313 AZX_DCAPS_I915_POWERWELL)
314 314
315#define AZX_DCAPS_INTEL_BROXTON \
316 (AZX_DCAPS_INTEL_PCH | AZX_DCAPS_SEPARATE_STREAM_TAG |\
317 AZX_DCAPS_I915_POWERWELL)
318
315/* quirks for ATI SB / AMD Hudson */ 319/* quirks for ATI SB / AMD Hudson */
316#define AZX_DCAPS_PRESET_ATI_SB \ 320#define AZX_DCAPS_PRESET_ATI_SB \
317 (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB |\ 321 (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB |\
@@ -351,6 +355,8 @@ enum {
351 ((pci)->device == 0x0d0c) || \ 355 ((pci)->device == 0x0d0c) || \
352 ((pci)->device == 0x160c)) 356 ((pci)->device == 0x160c))
353 357
358#define IS_BROXTON(pci) ((pci)->device == 0x5a98)
359
354static char *driver_short_names[] = { 360static char *driver_short_names[] = {
355 [AZX_DRIVER_ICH] = "HDA Intel", 361 [AZX_DRIVER_ICH] = "HDA Intel",
356 [AZX_DRIVER_PCH] = "HDA Intel PCH", 362 [AZX_DRIVER_PCH] = "HDA Intel PCH",
@@ -502,15 +508,36 @@ static void azx_init_pci(struct azx *chip)
502 } 508 }
503} 509}
504 510
511/*
512 * In BXT-P A0, HD-Audio DMA requests is later than expected,
513 * and makes an audio stream sensitive to system latencies when
514 * 24/32 bits are playing.
515 * Adjusting threshold of DMA fifo to force the DMA request
516 * sooner to improve latency tolerance at the expense of power.
517 */
518static void bxt_reduce_dma_latency(struct azx *chip)
519{
520 u32 val;
521
522 val = azx_readl(chip, SKL_EM4L);
523 val &= (0x3 << 20);
524 azx_writel(chip, SKL_EM4L, val);
525}
526
505static void hda_intel_init_chip(struct azx *chip, bool full_reset) 527static void hda_intel_init_chip(struct azx *chip, bool full_reset)
506{ 528{
507 struct hdac_bus *bus = azx_bus(chip); 529 struct hdac_bus *bus = azx_bus(chip);
530 struct pci_dev *pci = chip->pci;
508 531
509 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) 532 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
510 snd_hdac_set_codec_wakeup(bus, true); 533 snd_hdac_set_codec_wakeup(bus, true);
511 azx_init_chip(chip, full_reset); 534 azx_init_chip(chip, full_reset);
512 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) 535 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
513 snd_hdac_set_codec_wakeup(bus, false); 536 snd_hdac_set_codec_wakeup(bus, false);
537
538 /* reduce dma latency to avoid noise */
539 if (IS_BROXTON(pci))
540 bxt_reduce_dma_latency(chip);
514} 541}
515 542
516/* calculate runtime delay from LPIB */ 543/* calculate runtime delay from LPIB */
@@ -927,6 +954,36 @@ static int azx_resume(struct device *dev)
927} 954}
928#endif /* CONFIG_PM_SLEEP || SUPPORT_VGA_SWITCHEROO */ 955#endif /* CONFIG_PM_SLEEP || SUPPORT_VGA_SWITCHEROO */
929 956
957#ifdef CONFIG_PM_SLEEP
958/* put codec down to D3 at hibernation for Intel SKL+;
959 * otherwise BIOS may still access the codec and screw up the driver
960 */
961#define IS_SKL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa170)
962#define IS_SKL_LP(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9d70)
963#define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
964#define IS_SKL_PLUS(pci) (IS_SKL(pci) || IS_SKL_LP(pci) || IS_BXT(pci))
965
966static int azx_freeze_noirq(struct device *dev)
967{
968 struct pci_dev *pci = to_pci_dev(dev);
969
970 if (IS_SKL_PLUS(pci))
971 pci_set_power_state(pci, PCI_D3hot);
972
973 return 0;
974}
975
976static int azx_thaw_noirq(struct device *dev)
977{
978 struct pci_dev *pci = to_pci_dev(dev);
979
980 if (IS_SKL_PLUS(pci))
981 pci_set_power_state(pci, PCI_D0);
982
983 return 0;
984}
985#endif /* CONFIG_PM_SLEEP */
986
930#ifdef CONFIG_PM 987#ifdef CONFIG_PM
931static int azx_runtime_suspend(struct device *dev) 988static int azx_runtime_suspend(struct device *dev)
932{ 989{
@@ -1036,6 +1093,10 @@ static int azx_runtime_idle(struct device *dev)
1036 1093
1037static const struct dev_pm_ops azx_pm = { 1094static const struct dev_pm_ops azx_pm = {
1038 SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume) 1095 SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume)
1096#ifdef CONFIG_PM_SLEEP
1097 .freeze_noirq = azx_freeze_noirq,
1098 .thaw_noirq = azx_thaw_noirq,
1099#endif
1039 SET_RUNTIME_PM_OPS(azx_runtime_suspend, azx_runtime_resume, azx_runtime_idle) 1100 SET_RUNTIME_PM_OPS(azx_runtime_suspend, azx_runtime_resume, azx_runtime_idle)
1040}; 1101};
1041 1102
@@ -2124,6 +2185,9 @@ static const struct pci_device_id azx_ids[] = {
2124 /* Sunrise Point-LP */ 2185 /* Sunrise Point-LP */
2125 { PCI_DEVICE(0x8086, 0x9d70), 2186 { PCI_DEVICE(0x8086, 0x9d70),
2126 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE }, 2187 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE },
2188 /* Broxton-P(Apollolake) */
2189 { PCI_DEVICE(0x8086, 0x5a98),
2190 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_BROXTON },
2127 /* Haswell */ 2191 /* Haswell */
2128 { PCI_DEVICE(0x8086, 0x0a0c), 2192 { PCI_DEVICE(0x8086, 0x0a0c),
2129 .driver_data = AZX_DRIVER_HDMI | AZX_DCAPS_INTEL_HASWELL }, 2193 .driver_data = AZX_DRIVER_HDMI | AZX_DCAPS_INTEL_HASWELL },
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index f8a12ca477f1..4ef2259f88ca 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -778,7 +778,8 @@ static const struct hda_pintbl alienware_pincfgs[] = {
778}; 778};
779 779
780static const struct snd_pci_quirk ca0132_quirks[] = { 780static const struct snd_pci_quirk ca0132_quirks[] = {
781 SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15", QUIRK_ALIENWARE), 781 SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15 2015", QUIRK_ALIENWARE),
782 SND_PCI_QUIRK(0x1028, 0x0688, "Alienware 17 2015", QUIRK_ALIENWARE),
782 {} 783 {}
783}; 784};
784 785
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index c8b8ef5246a6..ef198903c0c3 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -955,6 +955,7 @@ static int patch_conexant_auto(struct hda_codec *codec)
955 */ 955 */
956 956
957static const struct hda_device_id snd_hda_id_conexant[] = { 957static const struct hda_device_id snd_hda_id_conexant[] = {
958 HDA_CODEC_ENTRY(0x14f12008, "CX8200", patch_conexant_auto),
958 HDA_CODEC_ENTRY(0x14f15045, "CX20549 (Venice)", patch_conexant_auto), 959 HDA_CODEC_ENTRY(0x14f15045, "CX20549 (Venice)", patch_conexant_auto),
959 HDA_CODEC_ENTRY(0x14f15047, "CX20551 (Waikiki)", patch_conexant_auto), 960 HDA_CODEC_ENTRY(0x14f15047, "CX20551 (Waikiki)", patch_conexant_auto),
960 HDA_CODEC_ENTRY(0x14f15051, "CX20561 (Hermosa)", patch_conexant_auto), 961 HDA_CODEC_ENTRY(0x14f15051, "CX20561 (Hermosa)", patch_conexant_auto),
@@ -972,9 +973,9 @@ static const struct hda_device_id snd_hda_id_conexant[] = {
972 HDA_CODEC_ENTRY(0x14f150ac, "CX20652", patch_conexant_auto), 973 HDA_CODEC_ENTRY(0x14f150ac, "CX20652", patch_conexant_auto),
973 HDA_CODEC_ENTRY(0x14f150b8, "CX20664", patch_conexant_auto), 974 HDA_CODEC_ENTRY(0x14f150b8, "CX20664", patch_conexant_auto),
974 HDA_CODEC_ENTRY(0x14f150b9, "CX20665", patch_conexant_auto), 975 HDA_CODEC_ENTRY(0x14f150b9, "CX20665", patch_conexant_auto),
975 HDA_CODEC_ENTRY(0x14f150f1, "CX20721", patch_conexant_auto), 976 HDA_CODEC_ENTRY(0x14f150f1, "CX21722", patch_conexant_auto),
976 HDA_CODEC_ENTRY(0x14f150f2, "CX20722", patch_conexant_auto), 977 HDA_CODEC_ENTRY(0x14f150f2, "CX20722", patch_conexant_auto),
977 HDA_CODEC_ENTRY(0x14f150f3, "CX20723", patch_conexant_auto), 978 HDA_CODEC_ENTRY(0x14f150f3, "CX21724", patch_conexant_auto),
978 HDA_CODEC_ENTRY(0x14f150f4, "CX20724", patch_conexant_auto), 979 HDA_CODEC_ENTRY(0x14f150f4, "CX20724", patch_conexant_auto),
979 HDA_CODEC_ENTRY(0x14f1510f, "CX20751/2", patch_conexant_auto), 980 HDA_CODEC_ENTRY(0x14f1510f, "CX20751/2", patch_conexant_auto),
980 HDA_CODEC_ENTRY(0x14f15110, "CX20751/2", patch_conexant_auto), 981 HDA_CODEC_ENTRY(0x14f15110, "CX20751/2", patch_conexant_auto),
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 60cd9e700909..4b6fb668c91c 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -2352,6 +2352,12 @@ static void intel_pin_eld_notify(void *audio_ptr, int port)
2352 struct hda_codec *codec = audio_ptr; 2352 struct hda_codec *codec = audio_ptr;
2353 int pin_nid = port + 0x04; 2353 int pin_nid = port + 0x04;
2354 2354
2355 /* skip notification during system suspend (but not in runtime PM);
2356 * the state will be updated at resume
2357 */
2358 if (snd_power_get_state(codec->card) != SNDRV_CTL_POWER_D0)
2359 return;
2360
2355 check_presence_and_report(codec, pin_nid); 2361 check_presence_and_report(codec, pin_nid);
2356} 2362}
2357 2363
@@ -2378,7 +2384,8 @@ static int patch_generic_hdmi(struct hda_codec *codec)
2378 * can cover the codec power request, and so need not set this flag. 2384 * can cover the codec power request, and so need not set this flag.
2379 * For previous platforms, there is no such power well feature. 2385 * For previous platforms, there is no such power well feature.
2380 */ 2386 */
2381 if (is_valleyview_plus(codec) || is_skylake(codec)) 2387 if (is_valleyview_plus(codec) || is_skylake(codec) ||
2388 is_broxton(codec))
2382 codec->core.link_power_control = 1; 2389 codec->core.link_power_control = 1;
2383 2390
2384 if (is_haswell_plus(codec) || is_valleyview_plus(codec)) { 2391 if (is_haswell_plus(codec) || is_valleyview_plus(codec)) {
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 2f7b065f9ac4..fe96428aa403 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -111,6 +111,7 @@ struct alc_spec {
111 void (*power_hook)(struct hda_codec *codec); 111 void (*power_hook)(struct hda_codec *codec);
112#endif 112#endif
113 void (*shutup)(struct hda_codec *codec); 113 void (*shutup)(struct hda_codec *codec);
114 void (*reboot_notify)(struct hda_codec *codec);
114 115
115 int init_amp; 116 int init_amp;
116 int codec_variant; /* flag for other variants */ 117 int codec_variant; /* flag for other variants */
@@ -773,6 +774,25 @@ static inline void alc_shutup(struct hda_codec *codec)
773 snd_hda_shutup_pins(codec); 774 snd_hda_shutup_pins(codec);
774} 775}
775 776
777static void alc_reboot_notify(struct hda_codec *codec)
778{
779 struct alc_spec *spec = codec->spec;
780
781 if (spec && spec->reboot_notify)
782 spec->reboot_notify(codec);
783 else
784 alc_shutup(codec);
785}
786
787/* power down codec to D3 at reboot/shutdown; set as reboot_notify ops */
788static void alc_d3_at_reboot(struct hda_codec *codec)
789{
790 snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
791 snd_hda_codec_write(codec, codec->core.afg, 0,
792 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
793 msleep(10);
794}
795
776#define alc_free snd_hda_gen_free 796#define alc_free snd_hda_gen_free
777 797
778#ifdef CONFIG_PM 798#ifdef CONFIG_PM
@@ -818,7 +838,7 @@ static const struct hda_codec_ops alc_patch_ops = {
818 .suspend = alc_suspend, 838 .suspend = alc_suspend,
819 .check_power_status = snd_hda_gen_check_power_status, 839 .check_power_status = snd_hda_gen_check_power_status,
820#endif 840#endif
821 .reboot_notify = alc_shutup, 841 .reboot_notify = alc_reboot_notify,
822}; 842};
823 843
824 844
@@ -1755,10 +1775,12 @@ enum {
1755 ALC889_FIXUP_MBA11_VREF, 1775 ALC889_FIXUP_MBA11_VREF,
1756 ALC889_FIXUP_MBA21_VREF, 1776 ALC889_FIXUP_MBA21_VREF,
1757 ALC889_FIXUP_MP11_VREF, 1777 ALC889_FIXUP_MP11_VREF,
1778 ALC889_FIXUP_MP41_VREF,
1758 ALC882_FIXUP_INV_DMIC, 1779 ALC882_FIXUP_INV_DMIC,
1759 ALC882_FIXUP_NO_PRIMARY_HP, 1780 ALC882_FIXUP_NO_PRIMARY_HP,
1760 ALC887_FIXUP_ASUS_BASS, 1781 ALC887_FIXUP_ASUS_BASS,
1761 ALC887_FIXUP_BASS_CHMAP, 1782 ALC887_FIXUP_BASS_CHMAP,
1783 ALC882_FIXUP_DISABLE_AAMIX,
1762}; 1784};
1763 1785
1764static void alc889_fixup_coef(struct hda_codec *codec, 1786static void alc889_fixup_coef(struct hda_codec *codec,
@@ -1842,7 +1864,7 @@ static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1842 const struct hda_fixup *fix, int action) 1864 const struct hda_fixup *fix, int action)
1843{ 1865{
1844 struct alc_spec *spec = codec->spec; 1866 struct alc_spec *spec = codec->spec;
1845 static hda_nid_t nids[2] = { 0x14, 0x15 }; 1867 static hda_nid_t nids[3] = { 0x14, 0x15, 0x19 };
1846 int i; 1868 int i;
1847 1869
1848 if (action != HDA_FIXUP_ACT_INIT) 1870 if (action != HDA_FIXUP_ACT_INIT)
@@ -1920,6 +1942,8 @@ static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1920 1942
1921static void alc_fixup_bass_chmap(struct hda_codec *codec, 1943static void alc_fixup_bass_chmap(struct hda_codec *codec,
1922 const struct hda_fixup *fix, int action); 1944 const struct hda_fixup *fix, int action);
1945static void alc_fixup_disable_aamix(struct hda_codec *codec,
1946 const struct hda_fixup *fix, int action);
1923 1947
1924static const struct hda_fixup alc882_fixups[] = { 1948static const struct hda_fixup alc882_fixups[] = {
1925 [ALC882_FIXUP_ABIT_AW9D_MAX] = { 1949 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
@@ -2130,6 +2154,12 @@ static const struct hda_fixup alc882_fixups[] = {
2130 .chained = true, 2154 .chained = true,
2131 .chain_id = ALC885_FIXUP_MACPRO_GPIO, 2155 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2132 }, 2156 },
2157 [ALC889_FIXUP_MP41_VREF] = {
2158 .type = HDA_FIXUP_FUNC,
2159 .v.func = alc889_fixup_mbp_vref,
2160 .chained = true,
2161 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2162 },
2133 [ALC882_FIXUP_INV_DMIC] = { 2163 [ALC882_FIXUP_INV_DMIC] = {
2134 .type = HDA_FIXUP_FUNC, 2164 .type = HDA_FIXUP_FUNC,
2135 .v.func = alc_fixup_inv_dmic, 2165 .v.func = alc_fixup_inv_dmic,
@@ -2151,6 +2181,10 @@ static const struct hda_fixup alc882_fixups[] = {
2151 .type = HDA_FIXUP_FUNC, 2181 .type = HDA_FIXUP_FUNC,
2152 .v.func = alc_fixup_bass_chmap, 2182 .v.func = alc_fixup_bass_chmap,
2153 }, 2183 },
2184 [ALC882_FIXUP_DISABLE_AAMIX] = {
2185 .type = HDA_FIXUP_FUNC,
2186 .v.func = alc_fixup_disable_aamix,
2187 },
2154}; 2188};
2155 2189
2156static const struct snd_pci_quirk alc882_fixup_tbl[] = { 2190static const struct snd_pci_quirk alc882_fixup_tbl[] = {
@@ -2208,7 +2242,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2208 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF), 2242 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2209 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF), 2243 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2210 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF), 2244 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2211 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO), 2245 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2212 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF), 2246 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2213 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF), 2247 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2214 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF), 2248 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
@@ -2218,6 +2252,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2218 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), 2252 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2219 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), 2253 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2220 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE), 2254 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2255 SND_PCI_QUIRK(0x1458, 0xa182, "Gigabyte Z170X-UD3", ALC882_FIXUP_DISABLE_AAMIX),
2221 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), 2256 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2222 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), 2257 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2223 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), 2258 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
@@ -4190,6 +4225,8 @@ static void alc_fixup_tpt440_dock(struct hda_codec *codec,
4190 struct alc_spec *spec = codec->spec; 4225 struct alc_spec *spec = codec->spec;
4191 4226
4192 if (action == HDA_FIXUP_ACT_PRE_PROBE) { 4227 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4228 spec->shutup = alc_no_shutup; /* reduce click noise */
4229 spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */
4193 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; 4230 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4194 codec->power_save_node = 0; /* avoid click noises */ 4231 codec->power_save_node = 0; /* avoid click noises */
4195 snd_hda_apply_pincfgs(codec, pincfgs); 4232 snd_hda_apply_pincfgs(codec, pincfgs);
@@ -4570,6 +4607,7 @@ enum {
4570 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC, 4607 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
4571 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, 4608 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
4572 ALC292_FIXUP_TPT440_DOCK, 4609 ALC292_FIXUP_TPT440_DOCK,
4610 ALC292_FIXUP_TPT440,
4573 ALC283_FIXUP_BXBT2807_MIC, 4611 ALC283_FIXUP_BXBT2807_MIC,
4574 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, 4612 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
4575 ALC282_FIXUP_ASPIRE_V5_PINS, 4613 ALC282_FIXUP_ASPIRE_V5_PINS,
@@ -4585,8 +4623,11 @@ enum {
4585 ALC288_FIXUP_DISABLE_AAMIX, 4623 ALC288_FIXUP_DISABLE_AAMIX,
4586 ALC292_FIXUP_DELL_E7X, 4624 ALC292_FIXUP_DELL_E7X,
4587 ALC292_FIXUP_DISABLE_AAMIX, 4625 ALC292_FIXUP_DISABLE_AAMIX,
4626 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
4588 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, 4627 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
4589 ALC275_FIXUP_DELL_XPS, 4628 ALC275_FIXUP_DELL_XPS,
4629 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
4630 ALC293_FIXUP_LENOVO_SPK_NOISE,
4590}; 4631};
4591 4632
4592static const struct hda_fixup alc269_fixups[] = { 4633static const struct hda_fixup alc269_fixups[] = {
@@ -5041,6 +5082,12 @@ static const struct hda_fixup alc269_fixups[] = {
5041 .chained = true, 5082 .chained = true,
5042 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST 5083 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
5043 }, 5084 },
5085 [ALC292_FIXUP_TPT440] = {
5086 .type = HDA_FIXUP_FUNC,
5087 .v.func = alc_fixup_disable_aamix,
5088 .chained = true,
5089 .chain_id = ALC292_FIXUP_TPT440_DOCK,
5090 },
5044 [ALC283_FIXUP_BXBT2807_MIC] = { 5091 [ALC283_FIXUP_BXBT2807_MIC] = {
5045 .type = HDA_FIXUP_PINS, 5092 .type = HDA_FIXUP_PINS,
5046 .v.pins = (const struct hda_pintbl[]) { 5093 .v.pins = (const struct hda_pintbl[]) {
@@ -5140,6 +5187,12 @@ static const struct hda_fixup alc269_fixups[] = {
5140 .chained = true, 5187 .chained = true,
5141 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE 5188 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
5142 }, 5189 },
5190 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
5191 .type = HDA_FIXUP_FUNC,
5192 .v.func = alc_fixup_disable_aamix,
5193 .chained = true,
5194 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
5195 },
5143 [ALC292_FIXUP_DELL_E7X] = { 5196 [ALC292_FIXUP_DELL_E7X] = {
5144 .type = HDA_FIXUP_FUNC, 5197 .type = HDA_FIXUP_FUNC,
5145 .v.func = alc_fixup_dell_xps13, 5198 .v.func = alc_fixup_dell_xps13,
@@ -5167,6 +5220,23 @@ static const struct hda_fixup alc269_fixups[] = {
5167 {} 5220 {}
5168 } 5221 }
5169 }, 5222 },
5223 [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
5224 .type = HDA_FIXUP_VERBS,
5225 .v.verbs = (const struct hda_verb[]) {
5226 /* Disable pass-through path for FRONT 14h */
5227 {0x20, AC_VERB_SET_COEF_INDEX, 0x36},
5228 {0x20, AC_VERB_SET_PROC_COEF, 0x1737},
5229 {}
5230 },
5231 .chained = true,
5232 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
5233 },
5234 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
5235 .type = HDA_FIXUP_FUNC,
5236 .v.func = alc_fixup_disable_aamix,
5237 .chained = true,
5238 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
5239 },
5170}; 5240};
5171 5241
5172static const struct snd_pci_quirk alc269_fixup_tbl[] = { 5242static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -5180,8 +5250,10 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5180 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK), 5250 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
5181 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), 5251 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
5182 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS), 5252 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
5253 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
5183 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), 5254 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
5184 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS), 5255 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
5256 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
5185 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X), 5257 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
5186 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X), 5258 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
5187 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER), 5259 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
@@ -5199,11 +5271,12 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5199 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), 5271 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
5200 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 5272 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5201 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 5273 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5202 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC292_FIXUP_DISABLE_AAMIX), 5274 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
5203 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC292_FIXUP_DISABLE_AAMIX), 5275 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
5204 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC292_FIXUP_DISABLE_AAMIX), 5276 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
5205 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC292_FIXUP_DISABLE_AAMIX), 5277 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
5206 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC292_FIXUP_DISABLE_AAMIX), 5278 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
5279 SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
5207 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 5280 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5208 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 5281 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5209 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), 5282 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
@@ -5302,15 +5375,17 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5302 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK), 5375 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
5303 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK), 5376 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
5304 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK), 5377 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
5305 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK), 5378 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
5306 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK), 5379 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
5307 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK), 5380 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
5308 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK), 5381 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
5309 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK), 5382 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
5310 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK), 5383 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
5311 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 5384 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5385 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
5312 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK), 5386 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
5313 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK), 5387 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
5388 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
5314 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), 5389 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
5315 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP), 5390 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
5316 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 5391 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
@@ -5320,6 +5395,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5320 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK), 5395 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
5321 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK), 5396 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
5322 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK), 5397 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
5398 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
5323 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 5399 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5324 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), 5400 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
5325 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), 5401 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
@@ -5400,6 +5476,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
5400 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"}, 5476 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
5401 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"}, 5477 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
5402 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"}, 5478 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
5479 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
5403 {} 5480 {}
5404}; 5481};
5405 5482
@@ -6386,6 +6463,7 @@ static const struct hda_fixup alc662_fixups[] = {
6386static const struct snd_pci_quirk alc662_fixup_tbl[] = { 6463static const struct snd_pci_quirk alc662_fixup_tbl[] = {
6387 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2), 6464 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
6388 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC), 6465 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
6466 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
6389 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), 6467 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
6390 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), 6468 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
6391 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), 6469 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 826122d8acee..2c7c5eb8b1e9 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -3110,6 +3110,29 @@ static void stac92hd71bxx_fixup_hp_hdx(struct hda_codec *codec,
3110 spec->gpio_led = 0x08; 3110 spec->gpio_led = 0x08;
3111} 3111}
3112 3112
3113static bool is_hp_output(struct hda_codec *codec, hda_nid_t pin)
3114{
3115 unsigned int pin_cfg = snd_hda_codec_get_pincfg(codec, pin);
3116
3117 /* count line-out, too, as BIOS sets often so */
3118 return get_defcfg_connect(pin_cfg) != AC_JACK_PORT_NONE &&
3119 (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT ||
3120 get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT);
3121}
3122
3123static void fixup_hp_headphone(struct hda_codec *codec, hda_nid_t pin)
3124{
3125 unsigned int pin_cfg = snd_hda_codec_get_pincfg(codec, pin);
3126
3127 /* It was changed in the BIOS to just satisfy MS DTM.
3128 * Lets turn it back into slaved HP
3129 */
3130 pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE)) |
3131 (AC_JACK_HP_OUT << AC_DEFCFG_DEVICE_SHIFT);
3132 pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC | AC_DEFCFG_SEQUENCE))) |
3133 0x1f;
3134 snd_hda_codec_set_pincfg(codec, pin, pin_cfg);
3135}
3113 3136
3114static void stac92hd71bxx_fixup_hp(struct hda_codec *codec, 3137static void stac92hd71bxx_fixup_hp(struct hda_codec *codec,
3115 const struct hda_fixup *fix, int action) 3138 const struct hda_fixup *fix, int action)
@@ -3119,22 +3142,12 @@ static void stac92hd71bxx_fixup_hp(struct hda_codec *codec,
3119 if (action != HDA_FIXUP_ACT_PRE_PROBE) 3142 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3120 return; 3143 return;
3121 3144
3122 if (hp_blike_system(codec->core.subsystem_id)) { 3145 /* when both output A and F are assigned, these are supposedly
3123 unsigned int pin_cfg = snd_hda_codec_get_pincfg(codec, 0x0f); 3146 * dock and built-in headphones; fix both pin configs
3124 if (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT || 3147 */
3125 get_defcfg_device(pin_cfg) == AC_JACK_SPEAKER || 3148 if (is_hp_output(codec, 0x0a) && is_hp_output(codec, 0x0f)) {
3126 get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT) { 3149 fixup_hp_headphone(codec, 0x0a);
3127 /* It was changed in the BIOS to just satisfy MS DTM. 3150 fixup_hp_headphone(codec, 0x0f);
3128 * Lets turn it back into slaved HP
3129 */
3130 pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE))
3131 | (AC_JACK_HP_OUT <<
3132 AC_DEFCFG_DEVICE_SHIFT);
3133 pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC
3134 | AC_DEFCFG_SEQUENCE)))
3135 | 0x1f;
3136 snd_hda_codec_set_pincfg(codec, 0x0f, pin_cfg);
3137 }
3138 } 3151 }
3139 3152
3140 if (find_mute_led_cfg(codec, 1)) 3153 if (find_mute_led_cfg(codec, 1))
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 714df906249e..41c31db65039 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -741,10 +741,11 @@ snd_rme96_playback_setrate(struct rme96 *rme96,
741 { 741 {
742 /* change to/from double-speed: reset the DAC (if available) */ 742 /* change to/from double-speed: reset the DAC (if available) */
743 snd_rme96_reset_dac(rme96); 743 snd_rme96_reset_dac(rme96);
744 return 1; /* need to restore volume */
744 } else { 745 } else {
745 writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER); 746 writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
747 return 0;
746 } 748 }
747 return 0;
748} 749}
749 750
750static int 751static int
@@ -980,6 +981,7 @@ snd_rme96_playback_hw_params(struct snd_pcm_substream *substream,
980 struct rme96 *rme96 = snd_pcm_substream_chip(substream); 981 struct rme96 *rme96 = snd_pcm_substream_chip(substream);
981 struct snd_pcm_runtime *runtime = substream->runtime; 982 struct snd_pcm_runtime *runtime = substream->runtime;
982 int err, rate, dummy; 983 int err, rate, dummy;
984 bool apply_dac_volume = false;
983 985
984 runtime->dma_area = (void __force *)(rme96->iobase + 986 runtime->dma_area = (void __force *)(rme96->iobase +
985 RME96_IO_PLAY_BUFFER); 987 RME96_IO_PLAY_BUFFER);
@@ -993,24 +995,26 @@ snd_rme96_playback_hw_params(struct snd_pcm_substream *substream,
993 { 995 {
994 /* slave clock */ 996 /* slave clock */
995 if ((int)params_rate(params) != rate) { 997 if ((int)params_rate(params) != rate) {
996 spin_unlock_irq(&rme96->lock); 998 err = -EIO;
997 return -EIO; 999 goto error;
998 } 1000 }
999 } else if ((err = snd_rme96_playback_setrate(rme96, params_rate(params))) < 0) { 1001 } else {
1000 spin_unlock_irq(&rme96->lock); 1002 err = snd_rme96_playback_setrate(rme96, params_rate(params));
1001 return err; 1003 if (err < 0)
1002 } 1004 goto error;
1003 if ((err = snd_rme96_playback_setformat(rme96, params_format(params))) < 0) { 1005 apply_dac_volume = err > 0; /* need to restore volume later? */
1004 spin_unlock_irq(&rme96->lock);
1005 return err;
1006 } 1006 }
1007
1008 err = snd_rme96_playback_setformat(rme96, params_format(params));
1009 if (err < 0)
1010 goto error;
1007 snd_rme96_setframelog(rme96, params_channels(params), 1); 1011 snd_rme96_setframelog(rme96, params_channels(params), 1);
1008 if (rme96->capture_periodsize != 0) { 1012 if (rme96->capture_periodsize != 0) {
1009 if (params_period_size(params) << rme96->playback_frlog != 1013 if (params_period_size(params) << rme96->playback_frlog !=
1010 rme96->capture_periodsize) 1014 rme96->capture_periodsize)
1011 { 1015 {
1012 spin_unlock_irq(&rme96->lock); 1016 err = -EBUSY;
1013 return -EBUSY; 1017 goto error;
1014 } 1018 }
1015 } 1019 }
1016 rme96->playback_periodsize = 1020 rme96->playback_periodsize =
@@ -1021,9 +1025,16 @@ snd_rme96_playback_hw_params(struct snd_pcm_substream *substream,
1021 rme96->wcreg &= ~(RME96_WCR_PRO | RME96_WCR_DOLBY | RME96_WCR_EMP); 1025 rme96->wcreg &= ~(RME96_WCR_PRO | RME96_WCR_DOLBY | RME96_WCR_EMP);
1022 writel(rme96->wcreg |= rme96->wcreg_spdif_stream, rme96->iobase + RME96_IO_CONTROL_REGISTER); 1026 writel(rme96->wcreg |= rme96->wcreg_spdif_stream, rme96->iobase + RME96_IO_CONTROL_REGISTER);
1023 } 1027 }
1028
1029 err = 0;
1030 error:
1024 spin_unlock_irq(&rme96->lock); 1031 spin_unlock_irq(&rme96->lock);
1025 1032 if (apply_dac_volume) {
1026 return 0; 1033 usleep_range(3000, 10000);
1034 snd_rme96_apply_dac_volume(rme96);
1035 }
1036
1037 return err;
1027} 1038}
1028 1039
1029static int 1040static int
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 9929efc6b9aa..b3ea24d64c50 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1023,24 +1023,18 @@ void arizona_init_dvfs(struct arizona_priv *priv)
1023} 1023}
1024EXPORT_SYMBOL_GPL(arizona_init_dvfs); 1024EXPORT_SYMBOL_GPL(arizona_init_dvfs);
1025 1025
1026static unsigned int arizona_sysclk_48k_rates[] = { 1026static unsigned int arizona_opclk_ref_48k_rates[] = {
1027 6144000, 1027 6144000,
1028 12288000, 1028 12288000,
1029 24576000, 1029 24576000,
1030 49152000, 1030 49152000,
1031 73728000,
1032 98304000,
1033 147456000,
1034}; 1031};
1035 1032
1036static unsigned int arizona_sysclk_44k1_rates[] = { 1033static unsigned int arizona_opclk_ref_44k1_rates[] = {
1037 5644800, 1034 5644800,
1038 11289600, 1035 11289600,
1039 22579200, 1036 22579200,
1040 45158400, 1037 45158400,
1041 67737600,
1042 90316800,
1043 135475200,
1044}; 1038};
1045 1039
1046static int arizona_set_opclk(struct snd_soc_codec *codec, unsigned int clk, 1040static int arizona_set_opclk(struct snd_soc_codec *codec, unsigned int clk,
@@ -1065,11 +1059,11 @@ static int arizona_set_opclk(struct snd_soc_codec *codec, unsigned int clk,
1065 } 1059 }
1066 1060
1067 if (refclk % 8000) 1061 if (refclk % 8000)
1068 rates = arizona_sysclk_44k1_rates; 1062 rates = arizona_opclk_ref_44k1_rates;
1069 else 1063 else
1070 rates = arizona_sysclk_48k_rates; 1064 rates = arizona_opclk_ref_48k_rates;
1071 1065
1072 for (ref = 0; ref < ARRAY_SIZE(arizona_sysclk_48k_rates) && 1066 for (ref = 0; ref < ARRAY_SIZE(arizona_opclk_ref_48k_rates) &&
1073 rates[ref] <= refclk; ref++) { 1067 rates[ref] <= refclk; ref++) {
1074 div = 1; 1068 div = 1;
1075 while (rates[ref] / div >= freq && div < 32) { 1069 while (rates[ref] / div >= freq && div < 32) {
diff --git a/sound/soc/codecs/es8328.c b/sound/soc/codecs/es8328.c
index 969e337dc17c..afa6c5db9dcc 100644
--- a/sound/soc/codecs/es8328.c
+++ b/sound/soc/codecs/es8328.c
@@ -85,7 +85,15 @@ static const DECLARE_TLV_DB_SCALE(pga_tlv, 0, 300, 0);
85static const DECLARE_TLV_DB_SCALE(bypass_tlv, -1500, 300, 0); 85static const DECLARE_TLV_DB_SCALE(bypass_tlv, -1500, 300, 0);
86static const DECLARE_TLV_DB_SCALE(mic_tlv, 0, 300, 0); 86static const DECLARE_TLV_DB_SCALE(mic_tlv, 0, 300, 0);
87 87
88static const int deemph_settings[] = { 0, 32000, 44100, 48000 }; 88static const struct {
89 int rate;
90 unsigned int val;
91} deemph_settings[] = {
92 { 0, ES8328_DACCONTROL6_DEEMPH_OFF },
93 { 32000, ES8328_DACCONTROL6_DEEMPH_32k },
94 { 44100, ES8328_DACCONTROL6_DEEMPH_44_1k },
95 { 48000, ES8328_DACCONTROL6_DEEMPH_48k },
96};
89 97
90static int es8328_set_deemph(struct snd_soc_codec *codec) 98static int es8328_set_deemph(struct snd_soc_codec *codec)
91{ 99{
@@ -97,21 +105,22 @@ static int es8328_set_deemph(struct snd_soc_codec *codec)
97 * rate. 105 * rate.
98 */ 106 */
99 if (es8328->deemph) { 107 if (es8328->deemph) {
100 best = 1; 108 best = 0;
101 for (i = 2; i < ARRAY_SIZE(deemph_settings); i++) { 109 for (i = 1; i < ARRAY_SIZE(deemph_settings); i++) {
102 if (abs(deemph_settings[i] - es8328->playback_fs) < 110 if (abs(deemph_settings[i].rate - es8328->playback_fs) <
103 abs(deemph_settings[best] - es8328->playback_fs)) 111 abs(deemph_settings[best].rate - es8328->playback_fs))
104 best = i; 112 best = i;
105 } 113 }
106 114
107 val = best << 1; 115 val = deemph_settings[best].val;
108 } else { 116 } else {
109 val = 0; 117 val = ES8328_DACCONTROL6_DEEMPH_OFF;
110 } 118 }
111 119
112 dev_dbg(codec->dev, "Set deemphasis %d\n", val); 120 dev_dbg(codec->dev, "Set deemphasis %d\n", val);
113 121
114 return snd_soc_update_bits(codec, ES8328_DACCONTROL6, 0x6, val); 122 return snd_soc_update_bits(codec, ES8328_DACCONTROL6,
123 ES8328_DACCONTROL6_DEEMPH_MASK, val);
115} 124}
116 125
117static int es8328_get_deemph(struct snd_kcontrol *kcontrol, 126static int es8328_get_deemph(struct snd_kcontrol *kcontrol,
@@ -205,18 +214,18 @@ static const struct snd_kcontrol_new es8328_right_line_controls =
205 214
206/* Left Mixer */ 215/* Left Mixer */
207static const struct snd_kcontrol_new es8328_left_mixer_controls[] = { 216static const struct snd_kcontrol_new es8328_left_mixer_controls[] = {
208 SOC_DAPM_SINGLE("Playback Switch", ES8328_DACCONTROL17, 8, 1, 0), 217 SOC_DAPM_SINGLE("Playback Switch", ES8328_DACCONTROL17, 7, 1, 0),
209 SOC_DAPM_SINGLE("Left Bypass Switch", ES8328_DACCONTROL17, 7, 1, 0), 218 SOC_DAPM_SINGLE("Left Bypass Switch", ES8328_DACCONTROL17, 6, 1, 0),
210 SOC_DAPM_SINGLE("Right Playback Switch", ES8328_DACCONTROL18, 8, 1, 0), 219 SOC_DAPM_SINGLE("Right Playback Switch", ES8328_DACCONTROL18, 7, 1, 0),
211 SOC_DAPM_SINGLE("Right Bypass Switch", ES8328_DACCONTROL18, 7, 1, 0), 220 SOC_DAPM_SINGLE("Right Bypass Switch", ES8328_DACCONTROL18, 6, 1, 0),
212}; 221};
213 222
214/* Right Mixer */ 223/* Right Mixer */
215static const struct snd_kcontrol_new es8328_right_mixer_controls[] = { 224static const struct snd_kcontrol_new es8328_right_mixer_controls[] = {
216 SOC_DAPM_SINGLE("Left Playback Switch", ES8328_DACCONTROL19, 8, 1, 0), 225 SOC_DAPM_SINGLE("Left Playback Switch", ES8328_DACCONTROL19, 7, 1, 0),
217 SOC_DAPM_SINGLE("Left Bypass Switch", ES8328_DACCONTROL19, 7, 1, 0), 226 SOC_DAPM_SINGLE("Left Bypass Switch", ES8328_DACCONTROL19, 6, 1, 0),
218 SOC_DAPM_SINGLE("Playback Switch", ES8328_DACCONTROL20, 8, 1, 0), 227 SOC_DAPM_SINGLE("Playback Switch", ES8328_DACCONTROL20, 7, 1, 0),
219 SOC_DAPM_SINGLE("Right Bypass Switch", ES8328_DACCONTROL20, 7, 1, 0), 228 SOC_DAPM_SINGLE("Right Bypass Switch", ES8328_DACCONTROL20, 6, 1, 0),
220}; 229};
221 230
222static const char * const es8328_pga_sel[] = { 231static const char * const es8328_pga_sel[] = {
diff --git a/sound/soc/codecs/es8328.h b/sound/soc/codecs/es8328.h
index cb36afe10c0e..156c748c89c7 100644
--- a/sound/soc/codecs/es8328.h
+++ b/sound/soc/codecs/es8328.h
@@ -153,6 +153,7 @@ int es8328_probe(struct device *dev, struct regmap *regmap);
153#define ES8328_DACCONTROL6_CLICKFREE (1 << 3) 153#define ES8328_DACCONTROL6_CLICKFREE (1 << 3)
154#define ES8328_DACCONTROL6_DAC_INVR (1 << 4) 154#define ES8328_DACCONTROL6_DAC_INVR (1 << 4)
155#define ES8328_DACCONTROL6_DAC_INVL (1 << 5) 155#define ES8328_DACCONTROL6_DAC_INVL (1 << 5)
156#define ES8328_DACCONTROL6_DEEMPH_MASK (3 << 6)
156#define ES8328_DACCONTROL6_DEEMPH_OFF (0 << 6) 157#define ES8328_DACCONTROL6_DEEMPH_OFF (0 << 6)
157#define ES8328_DACCONTROL6_DEEMPH_32k (1 << 6) 158#define ES8328_DACCONTROL6_DEEMPH_32k (1 << 6)
158#define ES8328_DACCONTROL6_DEEMPH_44_1k (2 << 6) 159#define ES8328_DACCONTROL6_DEEMPH_44_1k (2 << 6)
diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c
index 7fc7b4e3f444..c1b87c5800b1 100644
--- a/sound/soc/codecs/nau8825.c
+++ b/sound/soc/codecs/nau8825.c
@@ -1271,6 +1271,36 @@ static int nau8825_i2c_remove(struct i2c_client *client)
1271 return 0; 1271 return 0;
1272} 1272}
1273 1273
1274#ifdef CONFIG_PM_SLEEP
1275static int nau8825_suspend(struct device *dev)
1276{
1277 struct i2c_client *client = to_i2c_client(dev);
1278 struct nau8825 *nau8825 = dev_get_drvdata(dev);
1279
1280 disable_irq(client->irq);
1281 regcache_cache_only(nau8825->regmap, true);
1282 regcache_mark_dirty(nau8825->regmap);
1283
1284 return 0;
1285}
1286
1287static int nau8825_resume(struct device *dev)
1288{
1289 struct i2c_client *client = to_i2c_client(dev);
1290 struct nau8825 *nau8825 = dev_get_drvdata(dev);
1291
1292 regcache_cache_only(nau8825->regmap, false);
1293 regcache_sync(nau8825->regmap);
1294 enable_irq(client->irq);
1295
1296 return 0;
1297}
1298#endif
1299
1300static const struct dev_pm_ops nau8825_pm = {
1301 SET_SYSTEM_SLEEP_PM_OPS(nau8825_suspend, nau8825_resume)
1302};
1303
1274static const struct i2c_device_id nau8825_i2c_ids[] = { 1304static const struct i2c_device_id nau8825_i2c_ids[] = {
1275 { "nau8825", 0 }, 1305 { "nau8825", 0 },
1276 { } 1306 { }
@@ -1297,6 +1327,7 @@ static struct i2c_driver nau8825_driver = {
1297 .name = "nau8825", 1327 .name = "nau8825",
1298 .of_match_table = of_match_ptr(nau8825_of_ids), 1328 .of_match_table = of_match_ptr(nau8825_of_ids),
1299 .acpi_match_table = ACPI_PTR(nau8825_acpi_match), 1329 .acpi_match_table = ACPI_PTR(nau8825_acpi_match),
1330 .pm = &nau8825_pm,
1300 }, 1331 },
1301 .probe = nau8825_i2c_probe, 1332 .probe = nau8825_i2c_probe,
1302 .remove = nau8825_i2c_remove, 1333 .remove = nau8825_i2c_remove,
diff --git a/sound/soc/codecs/rl6231.c b/sound/soc/codecs/rl6231.c
index aca479fa7670..1dc68ab08a17 100644
--- a/sound/soc/codecs/rl6231.c
+++ b/sound/soc/codecs/rl6231.c
@@ -80,8 +80,10 @@ int rl6231_calc_dmic_clk(int rate)
80 } 80 }
81 81
82 for (i = 0; i < ARRAY_SIZE(div); i++) { 82 for (i = 0; i < ARRAY_SIZE(div); i++) {
83 /* find divider that gives DMIC frequency below 3MHz */ 83 if ((div[i] % 3) == 0)
84 if (3000000 * div[i] >= rate) 84 continue;
85 /* find divider that gives DMIC frequency below 3.072MHz */
86 if (3072000 * div[i] >= rate)
85 return i; 87 return i;
86 } 88 }
87 89
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 28132375e427..ef76940f9dcb 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -245,7 +245,7 @@ struct rt5645_priv {
245 struct snd_soc_jack *hp_jack; 245 struct snd_soc_jack *hp_jack;
246 struct snd_soc_jack *mic_jack; 246 struct snd_soc_jack *mic_jack;
247 struct snd_soc_jack *btn_jack; 247 struct snd_soc_jack *btn_jack;
248 struct delayed_work jack_detect_work; 248 struct delayed_work jack_detect_work, rcclock_work;
249 struct regulator_bulk_data supplies[ARRAY_SIZE(rt5645_supply_names)]; 249 struct regulator_bulk_data supplies[ARRAY_SIZE(rt5645_supply_names)];
250 struct rt5645_eq_param_s *eq_param; 250 struct rt5645_eq_param_s *eq_param;
251 251
@@ -565,12 +565,33 @@ static int rt5645_hweq_put(struct snd_kcontrol *kcontrol,
565 .put = rt5645_hweq_put \ 565 .put = rt5645_hweq_put \
566} 566}
567 567
568static int rt5645_spk_put_volsw(struct snd_kcontrol *kcontrol,
569 struct snd_ctl_elem_value *ucontrol)
570{
571 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
572 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component);
573 int ret;
574
575 cancel_delayed_work_sync(&rt5645->rcclock_work);
576
577 regmap_update_bits(rt5645->regmap, RT5645_MICBIAS,
578 RT5645_PWR_CLK25M_MASK, RT5645_PWR_CLK25M_PU);
579
580 ret = snd_soc_put_volsw(kcontrol, ucontrol);
581
582 queue_delayed_work(system_power_efficient_wq, &rt5645->rcclock_work,
583 msecs_to_jiffies(200));
584
585 return ret;
586}
587
568static const struct snd_kcontrol_new rt5645_snd_controls[] = { 588static const struct snd_kcontrol_new rt5645_snd_controls[] = {
569 /* Speaker Output Volume */ 589 /* Speaker Output Volume */
570 SOC_DOUBLE("Speaker Channel Switch", RT5645_SPK_VOL, 590 SOC_DOUBLE("Speaker Channel Switch", RT5645_SPK_VOL,
571 RT5645_VOL_L_SFT, RT5645_VOL_R_SFT, 1, 1), 591 RT5645_VOL_L_SFT, RT5645_VOL_R_SFT, 1, 1),
572 SOC_DOUBLE_TLV("Speaker Playback Volume", RT5645_SPK_VOL, 592 SOC_DOUBLE_EXT_TLV("Speaker Playback Volume", RT5645_SPK_VOL,
573 RT5645_L_VOL_SFT, RT5645_R_VOL_SFT, 39, 1, out_vol_tlv), 593 RT5645_L_VOL_SFT, RT5645_R_VOL_SFT, 39, 1, snd_soc_get_volsw,
594 rt5645_spk_put_volsw, out_vol_tlv),
574 595
575 /* ClassD modulator Speaker Gain Ratio */ 596 /* ClassD modulator Speaker Gain Ratio */
576 SOC_SINGLE_TLV("Speaker ClassD Playback Volume", RT5645_SPO_CLSD_RATIO, 597 SOC_SINGLE_TLV("Speaker ClassD Playback Volume", RT5645_SPO_CLSD_RATIO,
@@ -1498,7 +1519,7 @@ static void hp_amp_power(struct snd_soc_codec *codec, int on)
1498 regmap_write(rt5645->regmap, RT5645_PR_BASE + 1519 regmap_write(rt5645->regmap, RT5645_PR_BASE +
1499 RT5645_MAMP_INT_REG2, 0xfc00); 1520 RT5645_MAMP_INT_REG2, 0xfc00);
1500 snd_soc_write(codec, RT5645_DEPOP_M2, 0x1140); 1521 snd_soc_write(codec, RT5645_DEPOP_M2, 0x1140);
1501 msleep(40); 1522 msleep(70);
1502 rt5645->hp_on = true; 1523 rt5645->hp_on = true;
1503 } else { 1524 } else {
1504 /* depop parameters */ 1525 /* depop parameters */
@@ -3122,6 +3143,15 @@ static void rt5645_jack_detect_work(struct work_struct *work)
3122 SND_JACK_BTN_2 | SND_JACK_BTN_3); 3143 SND_JACK_BTN_2 | SND_JACK_BTN_3);
3123} 3144}
3124 3145
3146static void rt5645_rcclock_work(struct work_struct *work)
3147{
3148 struct rt5645_priv *rt5645 =
3149 container_of(work, struct rt5645_priv, rcclock_work.work);
3150
3151 regmap_update_bits(rt5645->regmap, RT5645_MICBIAS,
3152 RT5645_PWR_CLK25M_MASK, RT5645_PWR_CLK25M_PD);
3153}
3154
3125static irqreturn_t rt5645_irq(int irq, void *data) 3155static irqreturn_t rt5645_irq(int irq, void *data)
3126{ 3156{
3127 struct rt5645_priv *rt5645 = data; 3157 struct rt5645_priv *rt5645 = data;
@@ -3348,6 +3378,27 @@ static const struct dmi_system_id dmi_platform_intel_braswell[] = {
3348 DMI_MATCH(DMI_PRODUCT_NAME, "Reks"), 3378 DMI_MATCH(DMI_PRODUCT_NAME, "Reks"),
3349 }, 3379 },
3350 }, 3380 },
3381 {
3382 .ident = "Google Edgar",
3383 .callback = strago_quirk_cb,
3384 .matches = {
3385 DMI_MATCH(DMI_PRODUCT_NAME, "Edgar"),
3386 },
3387 },
3388 {
3389 .ident = "Google Wizpig",
3390 .callback = strago_quirk_cb,
3391 .matches = {
3392 DMI_MATCH(DMI_PRODUCT_NAME, "Wizpig"),
3393 },
3394 },
3395 {
3396 .ident = "Google Terra",
3397 .callback = strago_quirk_cb,
3398 .matches = {
3399 DMI_MATCH(DMI_PRODUCT_NAME, "Terra"),
3400 },
3401 },
3351 { } 3402 { }
3352}; 3403};
3353 3404
@@ -3587,6 +3638,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
3587 } 3638 }
3588 3639
3589 INIT_DELAYED_WORK(&rt5645->jack_detect_work, rt5645_jack_detect_work); 3640 INIT_DELAYED_WORK(&rt5645->jack_detect_work, rt5645_jack_detect_work);
3641 INIT_DELAYED_WORK(&rt5645->rcclock_work, rt5645_rcclock_work);
3590 3642
3591 if (rt5645->i2c->irq) { 3643 if (rt5645->i2c->irq) {
3592 ret = request_threaded_irq(rt5645->i2c->irq, NULL, rt5645_irq, 3644 ret = request_threaded_irq(rt5645->i2c->irq, NULL, rt5645_irq,
@@ -3621,6 +3673,7 @@ static int rt5645_i2c_remove(struct i2c_client *i2c)
3621 free_irq(i2c->irq, rt5645); 3673 free_irq(i2c->irq, rt5645);
3622 3674
3623 cancel_delayed_work_sync(&rt5645->jack_detect_work); 3675 cancel_delayed_work_sync(&rt5645->jack_detect_work);
3676 cancel_delayed_work_sync(&rt5645->rcclock_work);
3624 3677
3625 snd_soc_unregister_codec(&i2c->dev); 3678 snd_soc_unregister_codec(&i2c->dev);
3626 regulator_bulk_disable(ARRAY_SIZE(rt5645->supplies), rt5645->supplies); 3679 regulator_bulk_disable(ARRAY_SIZE(rt5645->supplies), rt5645->supplies);
diff --git a/sound/soc/codecs/rt5670.h b/sound/soc/codecs/rt5670.h
index dc2b46236c5c..3f1b0f1df809 100644
--- a/sound/soc/codecs/rt5670.h
+++ b/sound/soc/codecs/rt5670.h
@@ -973,12 +973,12 @@
973#define RT5670_SCLK_SRC_MCLK (0x0 << 14) 973#define RT5670_SCLK_SRC_MCLK (0x0 << 14)
974#define RT5670_SCLK_SRC_PLL1 (0x1 << 14) 974#define RT5670_SCLK_SRC_PLL1 (0x1 << 14)
975#define RT5670_SCLK_SRC_RCCLK (0x2 << 14) /* 15MHz */ 975#define RT5670_SCLK_SRC_RCCLK (0x2 << 14) /* 15MHz */
976#define RT5670_PLL1_SRC_MASK (0x3 << 12) 976#define RT5670_PLL1_SRC_MASK (0x7 << 11)
977#define RT5670_PLL1_SRC_SFT 12 977#define RT5670_PLL1_SRC_SFT 11
978#define RT5670_PLL1_SRC_MCLK (0x0 << 12) 978#define RT5670_PLL1_SRC_MCLK (0x0 << 11)
979#define RT5670_PLL1_SRC_BCLK1 (0x1 << 12) 979#define RT5670_PLL1_SRC_BCLK1 (0x1 << 11)
980#define RT5670_PLL1_SRC_BCLK2 (0x2 << 12) 980#define RT5670_PLL1_SRC_BCLK2 (0x2 << 11)
981#define RT5670_PLL1_SRC_BCLK3 (0x3 << 12) 981#define RT5670_PLL1_SRC_BCLK3 (0x3 << 11)
982#define RT5670_PLL1_PD_MASK (0x1 << 3) 982#define RT5670_PLL1_PD_MASK (0x1 << 3)
983#define RT5670_PLL1_PD_SFT 3 983#define RT5670_PLL1_PD_SFT 3
984#define RT5670_PLL1_PD_1 (0x0 << 3) 984#define RT5670_PLL1_PD_1 (0x0 << 3)
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index b4cd7e3bf5f8..69d987a9935c 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -1386,90 +1386,90 @@ static const struct snd_kcontrol_new rt5677_dac_r_mix[] = {
1386}; 1386};
1387 1387
1388static const struct snd_kcontrol_new rt5677_sto1_dac_l_mix[] = { 1388static const struct snd_kcontrol_new rt5677_sto1_dac_l_mix[] = {
1389 SOC_DAPM_SINGLE("ST L Switch", RT5677_STO1_DAC_MIXER, 1389 SOC_DAPM_SINGLE_AUTODISABLE("ST L Switch", RT5677_STO1_DAC_MIXER,
1390 RT5677_M_ST_DAC1_L_SFT, 1, 1), 1390 RT5677_M_ST_DAC1_L_SFT, 1, 1),
1391 SOC_DAPM_SINGLE("DAC1 L Switch", RT5677_STO1_DAC_MIXER, 1391 SOC_DAPM_SINGLE_AUTODISABLE("DAC1 L Switch", RT5677_STO1_DAC_MIXER,
1392 RT5677_M_DAC1_L_STO_L_SFT, 1, 1), 1392 RT5677_M_DAC1_L_STO_L_SFT, 1, 1),
1393 SOC_DAPM_SINGLE("DAC2 L Switch", RT5677_STO1_DAC_MIXER, 1393 SOC_DAPM_SINGLE_AUTODISABLE("DAC2 L Switch", RT5677_STO1_DAC_MIXER,
1394 RT5677_M_DAC2_L_STO_L_SFT, 1, 1), 1394 RT5677_M_DAC2_L_STO_L_SFT, 1, 1),
1395 SOC_DAPM_SINGLE("DAC1 R Switch", RT5677_STO1_DAC_MIXER, 1395 SOC_DAPM_SINGLE_AUTODISABLE("DAC1 R Switch", RT5677_STO1_DAC_MIXER,
1396 RT5677_M_DAC1_R_STO_L_SFT, 1, 1), 1396 RT5677_M_DAC1_R_STO_L_SFT, 1, 1),
1397}; 1397};
1398 1398
1399static const struct snd_kcontrol_new rt5677_sto1_dac_r_mix[] = { 1399static const struct snd_kcontrol_new rt5677_sto1_dac_r_mix[] = {
1400 SOC_DAPM_SINGLE("ST R Switch", RT5677_STO1_DAC_MIXER, 1400 SOC_DAPM_SINGLE_AUTODISABLE("ST R Switch", RT5677_STO1_DAC_MIXER,
1401 RT5677_M_ST_DAC1_R_SFT, 1, 1), 1401 RT5677_M_ST_DAC1_R_SFT, 1, 1),
1402 SOC_DAPM_SINGLE("DAC1 R Switch", RT5677_STO1_DAC_MIXER, 1402 SOC_DAPM_SINGLE_AUTODISABLE("DAC1 R Switch", RT5677_STO1_DAC_MIXER,
1403 RT5677_M_DAC1_R_STO_R_SFT, 1, 1), 1403 RT5677_M_DAC1_R_STO_R_SFT, 1, 1),
1404 SOC_DAPM_SINGLE("DAC2 R Switch", RT5677_STO1_DAC_MIXER, 1404 SOC_DAPM_SINGLE_AUTODISABLE("DAC2 R Switch", RT5677_STO1_DAC_MIXER,
1405 RT5677_M_DAC2_R_STO_R_SFT, 1, 1), 1405 RT5677_M_DAC2_R_STO_R_SFT, 1, 1),
1406 SOC_DAPM_SINGLE("DAC1 L Switch", RT5677_STO1_DAC_MIXER, 1406 SOC_DAPM_SINGLE_AUTODISABLE("DAC1 L Switch", RT5677_STO1_DAC_MIXER,
1407 RT5677_M_DAC1_L_STO_R_SFT, 1, 1), 1407 RT5677_M_DAC1_L_STO_R_SFT, 1, 1),
1408}; 1408};
1409 1409
1410static const struct snd_kcontrol_new rt5677_mono_dac_l_mix[] = { 1410static const struct snd_kcontrol_new rt5677_mono_dac_l_mix[] = {
1411 SOC_DAPM_SINGLE("ST L Switch", RT5677_MONO_DAC_MIXER, 1411 SOC_DAPM_SINGLE_AUTODISABLE("ST L Switch", RT5677_MONO_DAC_MIXER,
1412 RT5677_M_ST_DAC2_L_SFT, 1, 1), 1412 RT5677_M_ST_DAC2_L_SFT, 1, 1),
1413 SOC_DAPM_SINGLE("DAC1 L Switch", RT5677_MONO_DAC_MIXER, 1413 SOC_DAPM_SINGLE_AUTODISABLE("DAC1 L Switch", RT5677_MONO_DAC_MIXER,
1414 RT5677_M_DAC1_L_MONO_L_SFT, 1, 1), 1414 RT5677_M_DAC1_L_MONO_L_SFT, 1, 1),
1415 SOC_DAPM_SINGLE("DAC2 L Switch", RT5677_MONO_DAC_MIXER, 1415 SOC_DAPM_SINGLE_AUTODISABLE("DAC2 L Switch", RT5677_MONO_DAC_MIXER,
1416 RT5677_M_DAC2_L_MONO_L_SFT, 1, 1), 1416 RT5677_M_DAC2_L_MONO_L_SFT, 1, 1),
1417 SOC_DAPM_SINGLE("DAC2 R Switch", RT5677_MONO_DAC_MIXER, 1417 SOC_DAPM_SINGLE_AUTODISABLE("DAC2 R Switch", RT5677_MONO_DAC_MIXER,
1418 RT5677_M_DAC2_R_MONO_L_SFT, 1, 1), 1418 RT5677_M_DAC2_R_MONO_L_SFT, 1, 1),
1419}; 1419};
1420 1420
1421static const struct snd_kcontrol_new rt5677_mono_dac_r_mix[] = { 1421static const struct snd_kcontrol_new rt5677_mono_dac_r_mix[] = {
1422 SOC_DAPM_SINGLE("ST R Switch", RT5677_MONO_DAC_MIXER, 1422 SOC_DAPM_SINGLE_AUTODISABLE("ST R Switch", RT5677_MONO_DAC_MIXER,
1423 RT5677_M_ST_DAC2_R_SFT, 1, 1), 1423 RT5677_M_ST_DAC2_R_SFT, 1, 1),
1424 SOC_DAPM_SINGLE("DAC1 R Switch", RT5677_MONO_DAC_MIXER, 1424 SOC_DAPM_SINGLE_AUTODISABLE("DAC1 R Switch", RT5677_MONO_DAC_MIXER,
1425 RT5677_M_DAC1_R_MONO_R_SFT, 1, 1), 1425 RT5677_M_DAC1_R_MONO_R_SFT, 1, 1),
1426 SOC_DAPM_SINGLE("DAC2 R Switch", RT5677_MONO_DAC_MIXER, 1426 SOC_DAPM_SINGLE_AUTODISABLE("DAC2 R Switch", RT5677_MONO_DAC_MIXER,
1427 RT5677_M_DAC2_R_MONO_R_SFT, 1, 1), 1427 RT5677_M_DAC2_R_MONO_R_SFT, 1, 1),
1428 SOC_DAPM_SINGLE("DAC2 L Switch", RT5677_MONO_DAC_MIXER, 1428 SOC_DAPM_SINGLE_AUTODISABLE("DAC2 L Switch", RT5677_MONO_DAC_MIXER,
1429 RT5677_M_DAC2_L_MONO_R_SFT, 1, 1), 1429 RT5677_M_DAC2_L_MONO_R_SFT, 1, 1),
1430}; 1430};
1431 1431
1432static const struct snd_kcontrol_new rt5677_dd1_l_mix[] = { 1432static const struct snd_kcontrol_new rt5677_dd1_l_mix[] = {
1433 SOC_DAPM_SINGLE("Sto DAC Mix L Switch", RT5677_DD1_MIXER, 1433 SOC_DAPM_SINGLE_AUTODISABLE("Sto DAC Mix L Switch", RT5677_DD1_MIXER,
1434 RT5677_M_STO_L_DD1_L_SFT, 1, 1), 1434 RT5677_M_STO_L_DD1_L_SFT, 1, 1),
1435 SOC_DAPM_SINGLE("Mono DAC Mix L Switch", RT5677_DD1_MIXER, 1435 SOC_DAPM_SINGLE_AUTODISABLE("Mono DAC Mix L Switch", RT5677_DD1_MIXER,
1436 RT5677_M_MONO_L_DD1_L_SFT, 1, 1), 1436 RT5677_M_MONO_L_DD1_L_SFT, 1, 1),
1437 SOC_DAPM_SINGLE("DAC3 L Switch", RT5677_DD1_MIXER, 1437 SOC_DAPM_SINGLE_AUTODISABLE("DAC3 L Switch", RT5677_DD1_MIXER,
1438 RT5677_M_DAC3_L_DD1_L_SFT, 1, 1), 1438 RT5677_M_DAC3_L_DD1_L_SFT, 1, 1),
1439 SOC_DAPM_SINGLE("DAC3 R Switch", RT5677_DD1_MIXER, 1439 SOC_DAPM_SINGLE_AUTODISABLE("DAC3 R Switch", RT5677_DD1_MIXER,
1440 RT5677_M_DAC3_R_DD1_L_SFT, 1, 1), 1440 RT5677_M_DAC3_R_DD1_L_SFT, 1, 1),
1441}; 1441};
1442 1442
1443static const struct snd_kcontrol_new rt5677_dd1_r_mix[] = { 1443static const struct snd_kcontrol_new rt5677_dd1_r_mix[] = {
1444 SOC_DAPM_SINGLE("Sto DAC Mix R Switch", RT5677_DD1_MIXER, 1444 SOC_DAPM_SINGLE_AUTODISABLE("Sto DAC Mix R Switch", RT5677_DD1_MIXER,
1445 RT5677_M_STO_R_DD1_R_SFT, 1, 1), 1445 RT5677_M_STO_R_DD1_R_SFT, 1, 1),
1446 SOC_DAPM_SINGLE("Mono DAC Mix R Switch", RT5677_DD1_MIXER, 1446 SOC_DAPM_SINGLE_AUTODISABLE("Mono DAC Mix R Switch", RT5677_DD1_MIXER,
1447 RT5677_M_MONO_R_DD1_R_SFT, 1, 1), 1447 RT5677_M_MONO_R_DD1_R_SFT, 1, 1),
1448 SOC_DAPM_SINGLE("DAC3 R Switch", RT5677_DD1_MIXER, 1448 SOC_DAPM_SINGLE_AUTODISABLE("DAC3 R Switch", RT5677_DD1_MIXER,
1449 RT5677_M_DAC3_R_DD1_R_SFT, 1, 1), 1449 RT5677_M_DAC3_R_DD1_R_SFT, 1, 1),
1450 SOC_DAPM_SINGLE("DAC3 L Switch", RT5677_DD1_MIXER, 1450 SOC_DAPM_SINGLE_AUTODISABLE("DAC3 L Switch", RT5677_DD1_MIXER,
1451 RT5677_M_DAC3_L_DD1_R_SFT, 1, 1), 1451 RT5677_M_DAC3_L_DD1_R_SFT, 1, 1),
1452}; 1452};
1453 1453
1454static const struct snd_kcontrol_new rt5677_dd2_l_mix[] = { 1454static const struct snd_kcontrol_new rt5677_dd2_l_mix[] = {
1455 SOC_DAPM_SINGLE("Sto DAC Mix L Switch", RT5677_DD2_MIXER, 1455 SOC_DAPM_SINGLE_AUTODISABLE("Sto DAC Mix L Switch", RT5677_DD2_MIXER,
1456 RT5677_M_STO_L_DD2_L_SFT, 1, 1), 1456 RT5677_M_STO_L_DD2_L_SFT, 1, 1),
1457 SOC_DAPM_SINGLE("Mono DAC Mix L Switch", RT5677_DD2_MIXER, 1457 SOC_DAPM_SINGLE_AUTODISABLE("Mono DAC Mix L Switch", RT5677_DD2_MIXER,
1458 RT5677_M_MONO_L_DD2_L_SFT, 1, 1), 1458 RT5677_M_MONO_L_DD2_L_SFT, 1, 1),
1459 SOC_DAPM_SINGLE("DAC4 L Switch", RT5677_DD2_MIXER, 1459 SOC_DAPM_SINGLE_AUTODISABLE("DAC4 L Switch", RT5677_DD2_MIXER,
1460 RT5677_M_DAC4_L_DD2_L_SFT, 1, 1), 1460 RT5677_M_DAC4_L_DD2_L_SFT, 1, 1),
1461 SOC_DAPM_SINGLE("DAC4 R Switch", RT5677_DD2_MIXER, 1461 SOC_DAPM_SINGLE_AUTODISABLE("DAC4 R Switch", RT5677_DD2_MIXER,
1462 RT5677_M_DAC4_R_DD2_L_SFT, 1, 1), 1462 RT5677_M_DAC4_R_DD2_L_SFT, 1, 1),
1463}; 1463};
1464 1464
1465static const struct snd_kcontrol_new rt5677_dd2_r_mix[] = { 1465static const struct snd_kcontrol_new rt5677_dd2_r_mix[] = {
1466 SOC_DAPM_SINGLE("Sto DAC Mix R Switch", RT5677_DD2_MIXER, 1466 SOC_DAPM_SINGLE_AUTODISABLE("Sto DAC Mix R Switch", RT5677_DD2_MIXER,
1467 RT5677_M_STO_R_DD2_R_SFT, 1, 1), 1467 RT5677_M_STO_R_DD2_R_SFT, 1, 1),
1468 SOC_DAPM_SINGLE("Mono DAC Mix R Switch", RT5677_DD2_MIXER, 1468 SOC_DAPM_SINGLE_AUTODISABLE("Mono DAC Mix R Switch", RT5677_DD2_MIXER,
1469 RT5677_M_MONO_R_DD2_R_SFT, 1, 1), 1469 RT5677_M_MONO_R_DD2_R_SFT, 1, 1),
1470 SOC_DAPM_SINGLE("DAC4 R Switch", RT5677_DD2_MIXER, 1470 SOC_DAPM_SINGLE_AUTODISABLE("DAC4 R Switch", RT5677_DD2_MIXER,
1471 RT5677_M_DAC4_R_DD2_R_SFT, 1, 1), 1471 RT5677_M_DAC4_R_DD2_R_SFT, 1, 1),
1472 SOC_DAPM_SINGLE("DAC4 L Switch", RT5677_DD2_MIXER, 1472 SOC_DAPM_SINGLE_AUTODISABLE("DAC4 L Switch", RT5677_DD2_MIXER,
1473 RT5677_M_DAC4_L_DD2_R_SFT, 1, 1), 1473 RT5677_M_DAC4_L_DD2_R_SFT, 1, 1),
1474}; 1474};
1475 1475
@@ -2596,6 +2596,21 @@ static int rt5677_vref_event(struct snd_soc_dapm_widget *w,
2596 return 0; 2596 return 0;
2597} 2597}
2598 2598
2599static int rt5677_filter_power_event(struct snd_soc_dapm_widget *w,
2600 struct snd_kcontrol *kcontrol, int event)
2601{
2602 switch (event) {
2603 case SND_SOC_DAPM_POST_PMU:
2604 msleep(50);
2605 break;
2606
2607 default:
2608 return 0;
2609 }
2610
2611 return 0;
2612}
2613
2599static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = { 2614static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = {
2600 SND_SOC_DAPM_SUPPLY("PLL1", RT5677_PWR_ANLG2, RT5677_PWR_PLL1_BIT, 2615 SND_SOC_DAPM_SUPPLY("PLL1", RT5677_PWR_ANLG2, RT5677_PWR_PLL1_BIT,
2601 0, rt5677_set_pll1_event, SND_SOC_DAPM_PRE_PMU | 2616 0, rt5677_set_pll1_event, SND_SOC_DAPM_PRE_PMU |
@@ -3072,19 +3087,26 @@ static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = {
3072 3087
3073 /* DAC Mixer */ 3088 /* DAC Mixer */
3074 SND_SOC_DAPM_SUPPLY("dac stereo1 filter", RT5677_PWR_DIG2, 3089 SND_SOC_DAPM_SUPPLY("dac stereo1 filter", RT5677_PWR_DIG2,
3075 RT5677_PWR_DAC_S1F_BIT, 0, NULL, 0), 3090 RT5677_PWR_DAC_S1F_BIT, 0, rt5677_filter_power_event,
3091 SND_SOC_DAPM_POST_PMU),
3076 SND_SOC_DAPM_SUPPLY("dac mono2 left filter", RT5677_PWR_DIG2, 3092 SND_SOC_DAPM_SUPPLY("dac mono2 left filter", RT5677_PWR_DIG2,
3077 RT5677_PWR_DAC_M2F_L_BIT, 0, NULL, 0), 3093 RT5677_PWR_DAC_M2F_L_BIT, 0, rt5677_filter_power_event,
3094 SND_SOC_DAPM_POST_PMU),
3078 SND_SOC_DAPM_SUPPLY("dac mono2 right filter", RT5677_PWR_DIG2, 3095 SND_SOC_DAPM_SUPPLY("dac mono2 right filter", RT5677_PWR_DIG2,
3079 RT5677_PWR_DAC_M2F_R_BIT, 0, NULL, 0), 3096 RT5677_PWR_DAC_M2F_R_BIT, 0, rt5677_filter_power_event,
3097 SND_SOC_DAPM_POST_PMU),
3080 SND_SOC_DAPM_SUPPLY("dac mono3 left filter", RT5677_PWR_DIG2, 3098 SND_SOC_DAPM_SUPPLY("dac mono3 left filter", RT5677_PWR_DIG2,
3081 RT5677_PWR_DAC_M3F_L_BIT, 0, NULL, 0), 3099 RT5677_PWR_DAC_M3F_L_BIT, 0, rt5677_filter_power_event,
3100 SND_SOC_DAPM_POST_PMU),
3082 SND_SOC_DAPM_SUPPLY("dac mono3 right filter", RT5677_PWR_DIG2, 3101 SND_SOC_DAPM_SUPPLY("dac mono3 right filter", RT5677_PWR_DIG2,
3083 RT5677_PWR_DAC_M3F_R_BIT, 0, NULL, 0), 3102 RT5677_PWR_DAC_M3F_R_BIT, 0, rt5677_filter_power_event,
3103 SND_SOC_DAPM_POST_PMU),
3084 SND_SOC_DAPM_SUPPLY("dac mono4 left filter", RT5677_PWR_DIG2, 3104 SND_SOC_DAPM_SUPPLY("dac mono4 left filter", RT5677_PWR_DIG2,
3085 RT5677_PWR_DAC_M4F_L_BIT, 0, NULL, 0), 3105 RT5677_PWR_DAC_M4F_L_BIT, 0, rt5677_filter_power_event,
3106 SND_SOC_DAPM_POST_PMU),
3086 SND_SOC_DAPM_SUPPLY("dac mono4 right filter", RT5677_PWR_DIG2, 3107 SND_SOC_DAPM_SUPPLY("dac mono4 right filter", RT5677_PWR_DIG2,
3087 RT5677_PWR_DAC_M4F_R_BIT, 0, NULL, 0), 3108 RT5677_PWR_DAC_M4F_R_BIT, 0, rt5677_filter_power_event,
3109 SND_SOC_DAPM_POST_PMU),
3088 3110
3089 SND_SOC_DAPM_MIXER("Stereo DAC MIXL", SND_SOC_NOPM, 0, 0, 3111 SND_SOC_DAPM_MIXER("Stereo DAC MIXL", SND_SOC_NOPM, 0, 0,
3090 rt5677_sto1_dac_l_mix, ARRAY_SIZE(rt5677_sto1_dac_l_mix)), 3112 rt5677_sto1_dac_l_mix, ARRAY_SIZE(rt5677_sto1_dac_l_mix)),
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index f540f82b1f27..08b40460663c 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -189,6 +189,7 @@ static int power_vag_event(struct snd_soc_dapm_widget *w,
189 case SND_SOC_DAPM_POST_PMU: 189 case SND_SOC_DAPM_POST_PMU:
190 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, 190 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER,
191 SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP); 191 SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP);
192 msleep(400);
192 break; 193 break;
193 194
194 case SND_SOC_DAPM_PRE_PMD: 195 case SND_SOC_DAPM_PRE_PMD:
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 056375339ea3..5380798883b5 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -229,7 +229,7 @@ SOC_DOUBLE_R_TLV("Capture Volume", WM8960_LINVOL, WM8960_RINVOL,
229SOC_DOUBLE_R("Capture Volume ZC Switch", WM8960_LINVOL, WM8960_RINVOL, 229SOC_DOUBLE_R("Capture Volume ZC Switch", WM8960_LINVOL, WM8960_RINVOL,
230 6, 1, 0), 230 6, 1, 0),
231SOC_DOUBLE_R("Capture Switch", WM8960_LINVOL, WM8960_RINVOL, 231SOC_DOUBLE_R("Capture Switch", WM8960_LINVOL, WM8960_RINVOL,
232 7, 1, 0), 232 7, 1, 1),
233 233
234SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT3 Volume", 234SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT3 Volume",
235 WM8960_INBMIX1, 4, 7, 0, lineinboost_tlv), 235 WM8960_INBMIX1, 4, 7, 0, lineinboost_tlv),
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 39ebd7bf4f53..a7e79784fc16 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -365,8 +365,8 @@ static const struct reg_default wm8962_reg[] = {
365 { 16924, 0x0059 }, /* R16924 - HDBASS_PG_1 */ 365 { 16924, 0x0059 }, /* R16924 - HDBASS_PG_1 */
366 { 16925, 0x999A }, /* R16925 - HDBASS_PG_0 */ 366 { 16925, 0x999A }, /* R16925 - HDBASS_PG_0 */
367 367
368 { 17048, 0x0083 }, /* R17408 - HPF_C_1 */ 368 { 17408, 0x0083 }, /* R17408 - HPF_C_1 */
369 { 17049, 0x98AD }, /* R17409 - HPF_C_0 */ 369 { 17409, 0x98AD }, /* R17409 - HPF_C_0 */
370 370
371 { 17920, 0x007F }, /* R17920 - ADCL_RETUNE_C1_1 */ 371 { 17920, 0x007F }, /* R17920 - ADCL_RETUNE_C1_1 */
372 { 17921, 0xFFFF }, /* R17921 - ADCL_RETUNE_C1_0 */ 372 { 17921, 0xFFFF }, /* R17921 - ADCL_RETUNE_C1_0 */
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
index 0a60677397b3..4c29bd2ae75c 100644
--- a/sound/soc/codecs/wm8974.c
+++ b/sound/soc/codecs/wm8974.c
@@ -574,6 +574,7 @@ static const struct regmap_config wm8974_regmap = {
574 .max_register = WM8974_MONOMIX, 574 .max_register = WM8974_MONOMIX,
575 .reg_defaults = wm8974_reg_defaults, 575 .reg_defaults = wm8974_reg_defaults,
576 .num_reg_defaults = ARRAY_SIZE(wm8974_reg_defaults), 576 .num_reg_defaults = ARRAY_SIZE(wm8974_reg_defaults),
577 .cache_type = REGCACHE_FLAT,
577}; 578};
578 579
579static int wm8974_probe(struct snd_soc_codec *codec) 580static int wm8974_probe(struct snd_soc_codec *codec)
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 4495a40a9468..2ccb8bccc9d4 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -223,8 +223,8 @@ static void mcasp_start_tx(struct davinci_mcasp *mcasp)
223 223
224 /* wait for XDATA to be cleared */ 224 /* wait for XDATA to be cleared */
225 cnt = 0; 225 cnt = 0;
226 while (!(mcasp_get_reg(mcasp, DAVINCI_MCASP_TXSTAT_REG) & 226 while ((mcasp_get_reg(mcasp, DAVINCI_MCASP_TXSTAT_REG) & XRDATA) &&
227 ~XRDATA) && (cnt < 100000)) 227 (cnt < 100000))
228 cnt++; 228 cnt++;
229 229
230 /* Release TX state machine */ 230 /* Release TX state machine */
@@ -681,8 +681,8 @@ static int davinci_mcasp_set_tdm_slot(struct snd_soc_dai *dai,
681 } 681 }
682 682
683 mcasp->tdm_slots = slots; 683 mcasp->tdm_slots = slots;
684 mcasp->tdm_mask[SNDRV_PCM_STREAM_PLAYBACK] = rx_mask; 684 mcasp->tdm_mask[SNDRV_PCM_STREAM_PLAYBACK] = tx_mask;
685 mcasp->tdm_mask[SNDRV_PCM_STREAM_CAPTURE] = tx_mask; 685 mcasp->tdm_mask[SNDRV_PCM_STREAM_CAPTURE] = rx_mask;
686 mcasp->slot_width = slot_width; 686 mcasp->slot_width = slot_width;
687 687
688 return davinci_mcasp_set_ch_constraints(mcasp); 688 return davinci_mcasp_set_ch_constraints(mcasp);
@@ -908,6 +908,14 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream,
908 mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, busel | RXORD); 908 mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, busel | RXORD);
909 mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, 909 mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG,
910 FSRMOD(total_slots), FSRMOD(0x1FF)); 910 FSRMOD(total_slots), FSRMOD(0x1FF));
911 /*
912 * If McASP is set to be TX/RX synchronous and the playback is
913 * not running already we need to configure the TX slots in
914 * order to have correct FSX on the bus
915 */
916 if (mcasp_is_synchronous(mcasp) && !mcasp->channels)
917 mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG,
918 FSXMOD(total_slots), FSXMOD(0x1FF));
911 } 919 }
912 920
913 return 0; 921 return 0;
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 19c302b0d763..14dfdee05fd5 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -283,6 +283,8 @@ config SND_SOC_IMX_MC13783
283config SND_SOC_FSL_ASOC_CARD 283config SND_SOC_FSL_ASOC_CARD
284 tristate "Generic ASoC Sound Card with ASRC support" 284 tristate "Generic ASoC Sound Card with ASRC support"
285 depends on OF && I2C 285 depends on OF && I2C
286 # enforce SND_SOC_FSL_ASOC_CARD=m if SND_AC97_CODEC=m:
287 depends on SND_AC97_CODEC || SND_AC97_CODEC=n
286 select SND_SOC_IMX_AUDMUX 288 select SND_SOC_IMX_AUDMUX
287 select SND_SOC_IMX_PCM_DMA 289 select SND_SOC_IMX_PCM_DMA
288 select SND_SOC_FSL_ESAI 290 select SND_SOC_FSL_ESAI
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index a4435f5e3be9..08b460ba06ef 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -454,7 +454,8 @@ static int fsl_sai_trigger(struct snd_pcm_substream *substream, int cmd,
454 * Rx sync with Tx clocks: Clear SYNC for Tx, set it for Rx. 454 * Rx sync with Tx clocks: Clear SYNC for Tx, set it for Rx.
455 * Tx sync with Rx clocks: Clear SYNC for Rx, set it for Tx. 455 * Tx sync with Rx clocks: Clear SYNC for Rx, set it for Tx.
456 */ 456 */
457 regmap_update_bits(sai->regmap, FSL_SAI_TCR2, FSL_SAI_CR2_SYNC, 0); 457 regmap_update_bits(sai->regmap, FSL_SAI_TCR2, FSL_SAI_CR2_SYNC,
458 sai->synchronous[TX] ? FSL_SAI_CR2_SYNC : 0);
458 regmap_update_bits(sai->regmap, FSL_SAI_RCR2, FSL_SAI_CR2_SYNC, 459 regmap_update_bits(sai->regmap, FSL_SAI_RCR2, FSL_SAI_CR2_SYNC,
459 sai->synchronous[RX] ? FSL_SAI_CR2_SYNC : 0); 460 sai->synchronous[RX] ? FSL_SAI_CR2_SYNC : 0);
460 461
@@ -504,6 +505,24 @@ static int fsl_sai_trigger(struct snd_pcm_substream *substream, int cmd,
504 FSL_SAI_CSR_FR, FSL_SAI_CSR_FR); 505 FSL_SAI_CSR_FR, FSL_SAI_CSR_FR);
505 regmap_update_bits(sai->regmap, FSL_SAI_RCSR, 506 regmap_update_bits(sai->regmap, FSL_SAI_RCSR,
506 FSL_SAI_CSR_FR, FSL_SAI_CSR_FR); 507 FSL_SAI_CSR_FR, FSL_SAI_CSR_FR);
508
509 /*
510 * For sai master mode, after several open/close sai,
511 * there will be no frame clock, and can't recover
512 * anymore. Add software reset to fix this issue.
513 * This is a hardware bug, and will be fix in the
514 * next sai version.
515 */
516 if (!sai->is_slave_mode) {
517 /* Software Reset for both Tx and Rx */
518 regmap_write(sai->regmap,
519 FSL_SAI_TCSR, FSL_SAI_CSR_SR);
520 regmap_write(sai->regmap,
521 FSL_SAI_RCSR, FSL_SAI_CSR_SR);
522 /* Clear SR bit to finish the reset */
523 regmap_write(sai->regmap, FSL_SAI_TCSR, 0);
524 regmap_write(sai->regmap, FSL_SAI_RCSR, 0);
525 }
507 } 526 }
508 break; 527 break;
509 default: 528 default:
diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig
index 7b778ab85f8b..d430ef5a4f38 100644
--- a/sound/soc/intel/Kconfig
+++ b/sound/soc/intel/Kconfig
@@ -144,7 +144,7 @@ config SND_SOC_INTEL_SKYLAKE
144 144
145config SND_SOC_INTEL_SKL_RT286_MACH 145config SND_SOC_INTEL_SKL_RT286_MACH
146 tristate "ASoC Audio driver for SKL with RT286 I2S mode" 146 tristate "ASoC Audio driver for SKL with RT286 I2S mode"
147 depends on X86 && ACPI 147 depends on X86 && ACPI && I2C
148 select SND_SOC_INTEL_SST 148 select SND_SOC_INTEL_SST
149 select SND_SOC_INTEL_SKYLAKE 149 select SND_SOC_INTEL_SKYLAKE
150 select SND_SOC_RT286 150 select SND_SOC_RT286
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index a7854c8fc523..ffea427aeca8 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -1240,6 +1240,7 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus)
1240 */ 1240 */
1241 ret = snd_soc_tplg_component_load(&platform->component, 1241 ret = snd_soc_tplg_component_load(&platform->component,
1242 &skl_tplg_ops, fw, 0); 1242 &skl_tplg_ops, fw, 0);
1243 release_firmware(fw);
1243 if (ret < 0) { 1244 if (ret < 0) {
1244 dev_err(bus->dev, "tplg component load failed%d\n", ret); 1245 dev_err(bus->dev, "tplg component load failed%d\n", ret);
1245 return -EINVAL; 1246 return -EINVAL;
diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c
index a38a3029062c..5a806da89f42 100644
--- a/sound/soc/rockchip/rockchip_spdif.c
+++ b/sound/soc/rockchip/rockchip_spdif.c
@@ -152,8 +152,10 @@ static int rk_spdif_trigger(struct snd_pcm_substream *substream,
152 case SNDRV_PCM_TRIGGER_RESUME: 152 case SNDRV_PCM_TRIGGER_RESUME:
153 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 153 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
154 ret = regmap_update_bits(spdif->regmap, SPDIF_DMACR, 154 ret = regmap_update_bits(spdif->regmap, SPDIF_DMACR,
155 SPDIF_DMACR_TDE_ENABLE, 155 SPDIF_DMACR_TDE_ENABLE |
156 SPDIF_DMACR_TDE_ENABLE); 156 SPDIF_DMACR_TDL_MASK,
157 SPDIF_DMACR_TDE_ENABLE |
158 SPDIF_DMACR_TDL(16));
157 159
158 if (ret != 0) 160 if (ret != 0)
159 return ret; 161 return ret;
@@ -280,7 +282,7 @@ static int rk_spdif_probe(struct platform_device *pdev)
280 int ret; 282 int ret;
281 283
282 match = of_match_node(rk_spdif_match, np); 284 match = of_match_node(rk_spdif_match, np);
283 if ((int) match->data == RK_SPDIF_RK3288) { 285 if (match->data == (void *)RK_SPDIF_RK3288) {
284 struct regmap *grf; 286 struct regmap *grf;
285 287
286 grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); 288 grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");
diff --git a/sound/soc/rockchip/rockchip_spdif.h b/sound/soc/rockchip/rockchip_spdif.h
index 07f86a21046a..3ef12770ae12 100644
--- a/sound/soc/rockchip/rockchip_spdif.h
+++ b/sound/soc/rockchip/rockchip_spdif.h
@@ -28,9 +28,9 @@
28#define SPDIF_CFGR_VDW(x) (x << SPDIF_CFGR_VDW_SHIFT) 28#define SPDIF_CFGR_VDW(x) (x << SPDIF_CFGR_VDW_SHIFT)
29#define SDPIF_CFGR_VDW_MASK (0xf << SPDIF_CFGR_VDW_SHIFT) 29#define SDPIF_CFGR_VDW_MASK (0xf << SPDIF_CFGR_VDW_SHIFT)
30 30
31#define SPDIF_CFGR_VDW_16 SPDIF_CFGR_VDW(0x00) 31#define SPDIF_CFGR_VDW_16 SPDIF_CFGR_VDW(0x0)
32#define SPDIF_CFGR_VDW_20 SPDIF_CFGR_VDW(0x01) 32#define SPDIF_CFGR_VDW_20 SPDIF_CFGR_VDW(0x1)
33#define SPDIF_CFGR_VDW_24 SPDIF_CFGR_VDW(0x10) 33#define SPDIF_CFGR_VDW_24 SPDIF_CFGR_VDW(0x2)
34 34
35/* 35/*
36 * DMACR 36 * DMACR
@@ -42,7 +42,7 @@
42 42
43#define SPDIF_DMACR_TDL_SHIFT 0 43#define SPDIF_DMACR_TDL_SHIFT 0
44#define SPDIF_DMACR_TDL(x) ((x) << SPDIF_DMACR_TDL_SHIFT) 44#define SPDIF_DMACR_TDL(x) ((x) << SPDIF_DMACR_TDL_SHIFT)
45#define SPDIF_DMACR_TDL_MASK (0x1f << SDPIF_DMACR_TDL_SHIFT) 45#define SPDIF_DMACR_TDL_MASK (0x1f << SPDIF_DMACR_TDL_SHIFT)
46 46
47/* 47/*
48 * XFER 48 * XFER
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 76da7620904c..edcf4cc2e84f 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -235,7 +235,7 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
235 RSND_GEN_S_REG(SCU_SYS_STATUS0, 0x1c8), 235 RSND_GEN_S_REG(SCU_SYS_STATUS0, 0x1c8),
236 RSND_GEN_S_REG(SCU_SYS_INT_EN0, 0x1cc), 236 RSND_GEN_S_REG(SCU_SYS_INT_EN0, 0x1cc),
237 RSND_GEN_S_REG(SCU_SYS_STATUS1, 0x1d0), 237 RSND_GEN_S_REG(SCU_SYS_STATUS1, 0x1d0),
238 RSND_GEN_S_REG(SCU_SYS_INT_EN1, 0x1c4), 238 RSND_GEN_S_REG(SCU_SYS_INT_EN1, 0x1d4),
239 RSND_GEN_M_REG(SRC_SWRSR, 0x200, 0x40), 239 RSND_GEN_M_REG(SRC_SWRSR, 0x200, 0x40),
240 RSND_GEN_M_REG(SRC_SRCIR, 0x204, 0x40), 240 RSND_GEN_M_REG(SRC_SRCIR, 0x204, 0x40),
241 RSND_GEN_M_REG(SRC_ADINR, 0x214, 0x40), 241 RSND_GEN_M_REG(SRC_ADINR, 0x214, 0x40),
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 261b50217c48..68b439ed22d7 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -923,6 +923,7 @@ static int rsnd_src_pcm_new_gen2(struct rsnd_mod *mod,
923 struct snd_soc_pcm_runtime *rtd) 923 struct snd_soc_pcm_runtime *rtd)
924{ 924{
925 struct rsnd_dai *rdai = rsnd_io_to_rdai(io); 925 struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
926 struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
926 struct rsnd_src *src = rsnd_mod_to_src(mod); 927 struct rsnd_src *src = rsnd_mod_to_src(mod);
927 int ret; 928 int ret;
928 929
@@ -937,6 +938,12 @@ static int rsnd_src_pcm_new_gen2(struct rsnd_mod *mod,
937 return 0; 938 return 0;
938 939
939 /* 940 /*
941 * SRC In doesn't work if DVC was enabled
942 */
943 if (dvc && !rsnd_io_is_play(io))
944 return 0;
945
946 /*
940 * enable sync convert 947 * enable sync convert
941 */ 948 */
942 ret = rsnd_kctrl_new_s(mod, io, rtd, 949 ret = rsnd_kctrl_new_s(mod, io, rtd,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 24b096066a07..a1305f827a98 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -795,12 +795,12 @@ static void soc_resume_deferred(struct work_struct *work)
795 795
796 dev_dbg(card->dev, "ASoC: resume work completed\n"); 796 dev_dbg(card->dev, "ASoC: resume work completed\n");
797 797
798 /* userspace can access us now we are back as we were before */
799 snd_power_change_state(card->snd_card, SNDRV_CTL_POWER_D0);
800
801 /* Recheck all endpoints too, their state is affected by suspend */ 798 /* Recheck all endpoints too, their state is affected by suspend */
802 dapm_mark_endpoints_dirty(card); 799 dapm_mark_endpoints_dirty(card);
803 snd_soc_dapm_sync(&card->dapm); 800 snd_soc_dapm_sync(&card->dapm);
801
802 /* userspace can access us now we are back as we were before */
803 snd_power_change_state(card->snd_card, SNDRV_CTL_POWER_D0);
804} 804}
805 805
806/* powers up audio subsystem after a suspend */ 806/* powers up audio subsystem after a suspend */
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 016eba10b1ec..7d009428934a 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2293,6 +2293,12 @@ void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w)
2293 kfree(w); 2293 kfree(w);
2294} 2294}
2295 2295
2296void snd_soc_dapm_reset_cache(struct snd_soc_dapm_context *dapm)
2297{
2298 dapm->path_sink_cache.widget = NULL;
2299 dapm->path_source_cache.widget = NULL;
2300}
2301
2296/* free all dapm widgets and resources */ 2302/* free all dapm widgets and resources */
2297static void dapm_free_widgets(struct snd_soc_dapm_context *dapm) 2303static void dapm_free_widgets(struct snd_soc_dapm_context *dapm)
2298{ 2304{
@@ -2303,6 +2309,7 @@ static void dapm_free_widgets(struct snd_soc_dapm_context *dapm)
2303 continue; 2309 continue;
2304 snd_soc_dapm_free_widget(w); 2310 snd_soc_dapm_free_widget(w);
2305 } 2311 }
2312 snd_soc_dapm_reset_cache(dapm);
2306} 2313}
2307 2314
2308static struct snd_soc_dapm_widget *dapm_find_widget( 2315static struct snd_soc_dapm_widget *dapm_find_widget(
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index ecd38e52285a..2f67ba6d7a8f 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -404,7 +404,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_sx);
404/** 404/**
405 * snd_soc_put_volsw_sx - double mixer set callback 405 * snd_soc_put_volsw_sx - double mixer set callback
406 * @kcontrol: mixer control 406 * @kcontrol: mixer control
407 * @uinfo: control element information 407 * @ucontrol: control element information
408 * 408 *
409 * Callback to set the value of a double mixer control that spans 2 registers. 409 * Callback to set the value of a double mixer control that spans 2 registers.
410 * 410 *
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 8d7ec80af51b..6963ba20991c 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -531,7 +531,7 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr,
531 /* TLV bytes controls need standard kcontrol info handler, 531 /* TLV bytes controls need standard kcontrol info handler,
532 * TLV callback and extended put/get handlers. 532 * TLV callback and extended put/get handlers.
533 */ 533 */
534 k->info = snd_soc_bytes_info; 534 k->info = snd_soc_bytes_info_ext;
535 k->tlv.c = snd_soc_bytes_tlv_callback; 535 k->tlv.c = snd_soc_bytes_tlv_callback;
536 536
537 ext_ops = tplg->bytes_ext_ops; 537 ext_ops = tplg->bytes_ext_ops;
@@ -1805,6 +1805,7 @@ void snd_soc_tplg_widget_remove_all(struct snd_soc_dapm_context *dapm,
1805 snd_soc_tplg_widget_remove(w); 1805 snd_soc_tplg_widget_remove(w);
1806 snd_soc_dapm_free_widget(w); 1806 snd_soc_dapm_free_widget(w);
1807 } 1807 }
1808 snd_soc_dapm_reset_cache(dapm);
1808} 1809}
1809EXPORT_SYMBOL_GPL(snd_soc_tplg_widget_remove_all); 1810EXPORT_SYMBOL_GPL(snd_soc_tplg_widget_remove_all);
1810 1811
diff --git a/sound/soc/sti/uniperif_player.c b/sound/soc/sti/uniperif_player.c
index 843f037a317d..5c2bc53f0a9b 100644
--- a/sound/soc/sti/uniperif_player.c
+++ b/sound/soc/sti/uniperif_player.c
@@ -669,6 +669,7 @@ static int uni_player_startup(struct snd_pcm_substream *substream,
669{ 669{
670 struct sti_uniperiph_data *priv = snd_soc_dai_get_drvdata(dai); 670 struct sti_uniperiph_data *priv = snd_soc_dai_get_drvdata(dai);
671 struct uniperif *player = priv->dai_data.uni; 671 struct uniperif *player = priv->dai_data.uni;
672 player->substream = substream;
672 673
673 player->clk_adj = 0; 674 player->clk_adj = 0;
674 675
@@ -950,6 +951,8 @@ static void uni_player_shutdown(struct snd_pcm_substream *substream,
950 if (player->state != UNIPERIF_STATE_STOPPED) 951 if (player->state != UNIPERIF_STATE_STOPPED)
951 /* Stop the player */ 952 /* Stop the player */
952 uni_player_stop(player); 953 uni_player_stop(player);
954
955 player->substream = NULL;
953} 956}
954 957
955static int uni_player_parse_dt_clk_glue(struct platform_device *pdev, 958static int uni_player_parse_dt_clk_glue(struct platform_device *pdev,
@@ -989,7 +992,7 @@ static int uni_player_parse_dt(struct platform_device *pdev,
989 if (!info) 992 if (!info)
990 return -ENOMEM; 993 return -ENOMEM;
991 994
992 if (of_property_read_u32(pnode, "version", &player->ver) || 995 if (of_property_read_u32(pnode, "st,version", &player->ver) ||
993 player->ver == SND_ST_UNIPERIF_VERSION_UNKNOWN) { 996 player->ver == SND_ST_UNIPERIF_VERSION_UNKNOWN) {
994 dev_err(dev, "Unknown uniperipheral version "); 997 dev_err(dev, "Unknown uniperipheral version ");
995 return -EINVAL; 998 return -EINVAL;
@@ -998,13 +1001,13 @@ static int uni_player_parse_dt(struct platform_device *pdev,
998 if (player->ver >= SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0) 1001 if (player->ver >= SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0)
999 info->underflow_enabled = 1; 1002 info->underflow_enabled = 1;
1000 1003
1001 if (of_property_read_u32(pnode, "uniperiph-id", &info->id)) { 1004 if (of_property_read_u32(pnode, "st,uniperiph-id", &info->id)) {
1002 dev_err(dev, "uniperipheral id not defined"); 1005 dev_err(dev, "uniperipheral id not defined");
1003 return -EINVAL; 1006 return -EINVAL;
1004 } 1007 }
1005 1008
1006 /* Read the device mode property */ 1009 /* Read the device mode property */
1007 if (of_property_read_string(pnode, "mode", &mode)) { 1010 if (of_property_read_string(pnode, "st,mode", &mode)) {
1008 dev_err(dev, "uniperipheral mode not defined"); 1011 dev_err(dev, "uniperipheral mode not defined");
1009 return -EINVAL; 1012 return -EINVAL;
1010 } 1013 }
diff --git a/sound/soc/sti/uniperif_reader.c b/sound/soc/sti/uniperif_reader.c
index f791239a3087..8a0eb2050169 100644
--- a/sound/soc/sti/uniperif_reader.c
+++ b/sound/soc/sti/uniperif_reader.c
@@ -316,7 +316,7 @@ static int uni_reader_parse_dt(struct platform_device *pdev,
316 if (!info) 316 if (!info)
317 return -ENOMEM; 317 return -ENOMEM;
318 318
319 if (of_property_read_u32(node, "version", &reader->ver) || 319 if (of_property_read_u32(node, "st,version", &reader->ver) ||
320 reader->ver == SND_ST_UNIPERIF_VERSION_UNKNOWN) { 320 reader->ver == SND_ST_UNIPERIF_VERSION_UNKNOWN) {
321 dev_err(&pdev->dev, "Unknown uniperipheral version "); 321 dev_err(&pdev->dev, "Unknown uniperipheral version ");
322 return -EINVAL; 322 return -EINVAL;
@@ -346,7 +346,6 @@ int uni_reader_init(struct platform_device *pdev,
346 reader->hw = &uni_reader_pcm_hw; 346 reader->hw = &uni_reader_pcm_hw;
347 reader->dai_ops = &uni_reader_dai_ops; 347 reader->dai_ops = &uni_reader_dai_ops;
348 348
349 dev_err(reader->dev, "%s: enter\n", __func__);
350 ret = uni_reader_parse_dt(pdev, reader); 349 ret = uni_reader_parse_dt(pdev, reader);
351 if (ret < 0) { 350 if (ret < 0) {
352 dev_err(reader->dev, "Failed to parse DeviceTree"); 351 dev_err(reader->dev, "Failed to parse DeviceTree");
diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index bcbf4da168b6..1bb896d78d09 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -2,6 +2,7 @@
2 * Copyright 2014 Emilio López <emilio@elopez.com.ar> 2 * Copyright 2014 Emilio López <emilio@elopez.com.ar>
3 * Copyright 2014 Jon Smirl <jonsmirl@gmail.com> 3 * Copyright 2014 Jon Smirl <jonsmirl@gmail.com>
4 * Copyright 2015 Maxime Ripard <maxime.ripard@free-electrons.com> 4 * Copyright 2015 Maxime Ripard <maxime.ripard@free-electrons.com>
5 * Copyright 2015 Adam Sampson <ats@offog.org>
5 * 6 *
6 * Based on the Allwinner SDK driver, released under the GPL. 7 * Based on the Allwinner SDK driver, released under the GPL.
7 * 8 *
@@ -404,7 +405,7 @@ static const struct snd_kcontrol_new sun4i_codec_pa_mute =
404static DECLARE_TLV_DB_SCALE(sun4i_codec_pa_volume_scale, -6300, 100, 1); 405static DECLARE_TLV_DB_SCALE(sun4i_codec_pa_volume_scale, -6300, 100, 1);
405 406
406static const struct snd_kcontrol_new sun4i_codec_widgets[] = { 407static const struct snd_kcontrol_new sun4i_codec_widgets[] = {
407 SOC_SINGLE_TLV("PA Volume", SUN4I_CODEC_DAC_ACTL, 408 SOC_SINGLE_TLV("Power Amplifier Volume", SUN4I_CODEC_DAC_ACTL,
408 SUN4I_CODEC_DAC_ACTL_PA_VOL, 0x3F, 0, 409 SUN4I_CODEC_DAC_ACTL_PA_VOL, 0x3F, 0,
409 sun4i_codec_pa_volume_scale), 410 sun4i_codec_pa_volume_scale),
410}; 411};
@@ -452,12 +453,12 @@ static const struct snd_soc_dapm_widget sun4i_codec_dapm_widgets[] = {
452 SND_SOC_DAPM_SUPPLY("Mixer Enable", SUN4I_CODEC_DAC_ACTL, 453 SND_SOC_DAPM_SUPPLY("Mixer Enable", SUN4I_CODEC_DAC_ACTL,
453 SUN4I_CODEC_DAC_ACTL_MIXEN, 0, NULL, 0), 454 SUN4I_CODEC_DAC_ACTL_MIXEN, 0, NULL, 0),
454 455
455 /* Pre-Amplifier */ 456 /* Power Amplifier */
456 SND_SOC_DAPM_MIXER("Pre-Amplifier", SUN4I_CODEC_ADC_ACTL, 457 SND_SOC_DAPM_MIXER("Power Amplifier", SUN4I_CODEC_ADC_ACTL,
457 SUN4I_CODEC_ADC_ACTL_PA_EN, 0, 458 SUN4I_CODEC_ADC_ACTL_PA_EN, 0,
458 sun4i_codec_pa_mixer_controls, 459 sun4i_codec_pa_mixer_controls,
459 ARRAY_SIZE(sun4i_codec_pa_mixer_controls)), 460 ARRAY_SIZE(sun4i_codec_pa_mixer_controls)),
460 SND_SOC_DAPM_SWITCH("Pre-Amplifier Mute", SND_SOC_NOPM, 0, 0, 461 SND_SOC_DAPM_SWITCH("Power Amplifier Mute", SND_SOC_NOPM, 0, 0,
461 &sun4i_codec_pa_mute), 462 &sun4i_codec_pa_mute),
462 463
463 SND_SOC_DAPM_OUTPUT("HP Right"), 464 SND_SOC_DAPM_OUTPUT("HP Right"),
@@ -480,16 +481,16 @@ static const struct snd_soc_dapm_route sun4i_codec_dapm_routes[] = {
480 { "Left Mixer", NULL, "Mixer Enable" }, 481 { "Left Mixer", NULL, "Mixer Enable" },
481 { "Left Mixer", "Left DAC Playback Switch", "Left DAC" }, 482 { "Left Mixer", "Left DAC Playback Switch", "Left DAC" },
482 483
483 /* Pre-Amplifier Mixer Routes */ 484 /* Power Amplifier Routes */
484 { "Pre-Amplifier", "Mixer Playback Switch", "Left Mixer" }, 485 { "Power Amplifier", "Mixer Playback Switch", "Left Mixer" },
485 { "Pre-Amplifier", "Mixer Playback Switch", "Right Mixer" }, 486 { "Power Amplifier", "Mixer Playback Switch", "Right Mixer" },
486 { "Pre-Amplifier", "DAC Playback Switch", "Left DAC" }, 487 { "Power Amplifier", "DAC Playback Switch", "Left DAC" },
487 { "Pre-Amplifier", "DAC Playback Switch", "Right DAC" }, 488 { "Power Amplifier", "DAC Playback Switch", "Right DAC" },
488 489
489 /* PA -> HP path */ 490 /* Headphone Output Routes */
490 { "Pre-Amplifier Mute", "Switch", "Pre-Amplifier" }, 491 { "Power Amplifier Mute", "Switch", "Power Amplifier" },
491 { "HP Right", NULL, "Pre-Amplifier Mute" }, 492 { "HP Right", NULL, "Power Amplifier Mute" },
492 { "HP Left", NULL, "Pre-Amplifier Mute" }, 493 { "HP Left", NULL, "Power Amplifier Mute" },
493}; 494};
494 495
495static struct snd_soc_codec_driver sun4i_codec_codec = { 496static struct snd_soc_codec_driver sun4i_codec_codec = {
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 7661616f3636..5b4c58c3e2c5 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -174,6 +174,8 @@ struct snd_usb_midi_in_endpoint {
174 u8 running_status_length; 174 u8 running_status_length;
175 } ports[0x10]; 175 } ports[0x10];
176 u8 seen_f5; 176 u8 seen_f5;
177 bool in_sysex;
178 u8 last_cin;
177 u8 error_resubmit; 179 u8 error_resubmit;
178 int current_port; 180 int current_port;
179}; 181};
@@ -468,6 +470,39 @@ static void snd_usbmidi_maudio_broken_running_status_input(
468} 470}
469 471
470/* 472/*
473 * QinHeng CH345 is buggy: every second packet inside a SysEx has not CIN 4
474 * but the previously seen CIN, but still with three data bytes.
475 */
476static void ch345_broken_sysex_input(struct snd_usb_midi_in_endpoint *ep,
477 uint8_t *buffer, int buffer_length)
478{
479 unsigned int i, cin, length;
480
481 for (i = 0; i + 3 < buffer_length; i += 4) {
482 if (buffer[i] == 0 && i > 0)
483 break;
484 cin = buffer[i] & 0x0f;
485 if (ep->in_sysex &&
486 cin == ep->last_cin &&
487 (buffer[i + 1 + (cin == 0x6)] & 0x80) == 0)
488 cin = 0x4;
489#if 0
490 if (buffer[i + 1] == 0x90) {
491 /*
492 * Either a corrupted running status or a real note-on
493 * message; impossible to detect reliably.
494 */
495 }
496#endif
497 length = snd_usbmidi_cin_length[cin];
498 snd_usbmidi_input_data(ep, 0, &buffer[i + 1], length);
499 ep->in_sysex = cin == 0x4;
500 if (!ep->in_sysex)
501 ep->last_cin = cin;
502 }
503}
504
505/*
471 * CME protocol: like the standard protocol, but SysEx commands are sent as a 506 * CME protocol: like the standard protocol, but SysEx commands are sent as a
472 * single USB packet preceded by a 0x0F byte. 507 * single USB packet preceded by a 0x0F byte.
473 */ 508 */
@@ -660,6 +695,12 @@ static struct usb_protocol_ops snd_usbmidi_cme_ops = {
660 .output_packet = snd_usbmidi_output_standard_packet, 695 .output_packet = snd_usbmidi_output_standard_packet,
661}; 696};
662 697
698static struct usb_protocol_ops snd_usbmidi_ch345_broken_sysex_ops = {
699 .input = ch345_broken_sysex_input,
700 .output = snd_usbmidi_standard_output,
701 .output_packet = snd_usbmidi_output_standard_packet,
702};
703
663/* 704/*
664 * AKAI MPD16 protocol: 705 * AKAI MPD16 protocol:
665 * 706 *
@@ -1341,6 +1382,7 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi *umidi,
1341 * Various chips declare a packet size larger than 4 bytes, but 1382 * Various chips declare a packet size larger than 4 bytes, but
1342 * do not actually work with larger packets: 1383 * do not actually work with larger packets:
1343 */ 1384 */
1385 case USB_ID(0x0a67, 0x5011): /* Medeli DD305 */
1344 case USB_ID(0x0a92, 0x1020): /* ESI M4U */ 1386 case USB_ID(0x0a92, 0x1020): /* ESI M4U */
1345 case USB_ID(0x1430, 0x474b): /* RedOctane GH MIDI INTERFACE */ 1387 case USB_ID(0x1430, 0x474b): /* RedOctane GH MIDI INTERFACE */
1346 case USB_ID(0x15ca, 0x0101): /* Textech USB Midi Cable */ 1388 case USB_ID(0x15ca, 0x0101): /* Textech USB Midi Cable */
@@ -2378,6 +2420,10 @@ int snd_usbmidi_create(struct snd_card *card,
2378 2420
2379 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); 2421 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
2380 break; 2422 break;
2423 case QUIRK_MIDI_CH345:
2424 umidi->usb_protocol_ops = &snd_usbmidi_ch345_broken_sysex_ops;
2425 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
2426 break;
2381 default: 2427 default:
2382 dev_err(&umidi->dev->dev, "invalid quirk type %d\n", 2428 dev_err(&umidi->dev->dev, "invalid quirk type %d\n",
2383 quirk->type); 2429 quirk->type);
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index f494dced3c11..4f85757009b3 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1354,6 +1354,8 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
1354 } 1354 }
1355 } 1355 }
1356 1356
1357 snd_usb_mixer_fu_apply_quirk(state->mixer, cval, unitid, kctl);
1358
1357 range = (cval->max - cval->min) / cval->res; 1359 range = (cval->max - cval->min) / cval->res;
1358 /* 1360 /*
1359 * Are there devices with volume range more than 255? I use a bit more 1361 * Are there devices with volume range more than 255? I use a bit more
diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c
index 6a803eff87f7..ddca6547399b 100644
--- a/sound/usb/mixer_maps.c
+++ b/sound/usb/mixer_maps.c
@@ -348,13 +348,6 @@ static struct usbmix_name_map bose_companion5_map[] = {
348 { 0 } /* terminator */ 348 { 0 } /* terminator */
349}; 349};
350 350
351/* Dragonfly DAC 1.2, the dB conversion factor is 1 instead of 256 */
352static struct usbmix_dB_map dragonfly_1_2_dB = {0, 5000};
353static struct usbmix_name_map dragonfly_1_2_map[] = {
354 { 7, NULL, .dB = &dragonfly_1_2_dB },
355 { 0 } /* terminator */
356};
357
358/* 351/*
359 * Control map entries 352 * Control map entries
360 */ 353 */
@@ -470,11 +463,6 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
470 .id = USB_ID(0x05a7, 0x1020), 463 .id = USB_ID(0x05a7, 0x1020),
471 .map = bose_companion5_map, 464 .map = bose_companion5_map,
472 }, 465 },
473 {
474 /* Dragonfly DAC 1.2 */
475 .id = USB_ID(0x21b4, 0x0081),
476 .map = dragonfly_1_2_map,
477 },
478 { 0 } /* terminator */ 466 { 0 } /* terminator */
479}; 467};
480 468
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index fe91184ce832..0ce888dceed0 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -37,6 +37,7 @@
37#include <sound/control.h> 37#include <sound/control.h>
38#include <sound/hwdep.h> 38#include <sound/hwdep.h>
39#include <sound/info.h> 39#include <sound/info.h>
40#include <sound/tlv.h>
40 41
41#include "usbaudio.h" 42#include "usbaudio.h"
42#include "mixer.h" 43#include "mixer.h"
@@ -1825,3 +1826,39 @@ void snd_usb_mixer_rc_memory_change(struct usb_mixer_interface *mixer,
1825 } 1826 }
1826} 1827}
1827 1828
1829static void snd_dragonfly_quirk_db_scale(struct usb_mixer_interface *mixer,
1830 struct snd_kcontrol *kctl)
1831{
1832 /* Approximation using 10 ranges based on output measurement on hw v1.2.
1833 * This seems close to the cubic mapping e.g. alsamixer uses. */
1834 static const DECLARE_TLV_DB_RANGE(scale,
1835 0, 1, TLV_DB_MINMAX_ITEM(-5300, -4970),
1836 2, 5, TLV_DB_MINMAX_ITEM(-4710, -4160),
1837 6, 7, TLV_DB_MINMAX_ITEM(-3884, -3710),
1838 8, 14, TLV_DB_MINMAX_ITEM(-3443, -2560),
1839 15, 16, TLV_DB_MINMAX_ITEM(-2475, -2324),
1840 17, 19, TLV_DB_MINMAX_ITEM(-2228, -2031),
1841 20, 26, TLV_DB_MINMAX_ITEM(-1910, -1393),
1842 27, 31, TLV_DB_MINMAX_ITEM(-1322, -1032),
1843 32, 40, TLV_DB_MINMAX_ITEM(-968, -490),
1844 41, 50, TLV_DB_MINMAX_ITEM(-441, 0),
1845 );
1846
1847 usb_audio_info(mixer->chip, "applying DragonFly dB scale quirk\n");
1848 kctl->tlv.p = scale;
1849 kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
1850 kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK;
1851}
1852
1853void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
1854 struct usb_mixer_elem_info *cval, int unitid,
1855 struct snd_kcontrol *kctl)
1856{
1857 switch (mixer->chip->usb_id) {
1858 case USB_ID(0x21b4, 0x0081): /* AudioQuest DragonFly */
1859 if (unitid == 7 && cval->min == 0 && cval->max == 50)
1860 snd_dragonfly_quirk_db_scale(mixer, kctl);
1861 break;
1862 }
1863}
1864
diff --git a/sound/usb/mixer_quirks.h b/sound/usb/mixer_quirks.h
index bdbfab093816..177c329cd4dd 100644
--- a/sound/usb/mixer_quirks.h
+++ b/sound/usb/mixer_quirks.h
@@ -9,5 +9,9 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip,
9void snd_usb_mixer_rc_memory_change(struct usb_mixer_interface *mixer, 9void snd_usb_mixer_rc_memory_change(struct usb_mixer_interface *mixer,
10 int unitid); 10 int unitid);
11 11
12void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
13 struct usb_mixer_elem_info *cval, int unitid,
14 struct snd_kcontrol *kctl);
15
12#endif /* SND_USB_MIXER_QUIRKS_H */ 16#endif /* SND_USB_MIXER_QUIRKS_H */
13 17
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index 1a1e2e4df35e..c60a776e815d 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -2829,6 +2829,17 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2829 .idProduct = 0x1020, 2829 .idProduct = 0x1020,
2830}, 2830},
2831 2831
2832/* QinHeng devices */
2833{
2834 USB_DEVICE(0x1a86, 0x752d),
2835 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
2836 .vendor_name = "QinHeng",
2837 .product_name = "CH345",
2838 .ifnum = 1,
2839 .type = QUIRK_MIDI_CH345
2840 }
2841},
2842
2832/* KeithMcMillen Stringport */ 2843/* KeithMcMillen Stringport */
2833{ 2844{
2834 USB_DEVICE(0x1f38, 0x0001), 2845 USB_DEVICE(0x1f38, 0x0001),
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 5ca80e7d30cd..b6c0c8e3b450 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -538,6 +538,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
538 [QUIRK_MIDI_CME] = create_any_midi_quirk, 538 [QUIRK_MIDI_CME] = create_any_midi_quirk,
539 [QUIRK_MIDI_AKAI] = create_any_midi_quirk, 539 [QUIRK_MIDI_AKAI] = create_any_midi_quirk,
540 [QUIRK_MIDI_FTDI] = create_any_midi_quirk, 540 [QUIRK_MIDI_FTDI] = create_any_midi_quirk,
541 [QUIRK_MIDI_CH345] = create_any_midi_quirk,
541 [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, 542 [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
542 [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, 543 [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
543 [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, 544 [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk,
@@ -1124,6 +1125,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)
1124 case USB_ID(0x045E, 0x0779): /* MS Lifecam HD-3000 */ 1125 case USB_ID(0x045E, 0x0779): /* MS Lifecam HD-3000 */
1125 case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ 1126 case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */
1126 case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */ 1127 case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */
1128 case USB_ID(0x21B4, 0x0081): /* AudioQuest DragonFly */
1127 return true; 1129 return true;
1128 } 1130 }
1129 return false; 1131 return false;
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 15a12715bd05..b665d85555cb 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -95,6 +95,7 @@ enum quirk_type {
95 QUIRK_MIDI_AKAI, 95 QUIRK_MIDI_AKAI,
96 QUIRK_MIDI_US122L, 96 QUIRK_MIDI_US122L,
97 QUIRK_MIDI_FTDI, 97 QUIRK_MIDI_FTDI,
98 QUIRK_MIDI_CH345,
98 QUIRK_AUDIO_STANDARD_INTERFACE, 99 QUIRK_AUDIO_STANDARD_INTERFACE,
99 QUIRK_AUDIO_FIXED_ENDPOINT, 100 QUIRK_AUDIO_FIXED_ENDPOINT,
100 QUIRK_AUDIO_EDIROL_UAXX, 101 QUIRK_AUDIO_EDIROL_UAXX,