History

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

Pull sound fixes from Takashi Iwai: "Well, this one became unpleasantly larger than previous pull requests, but it's a kind of usual pattern: now it contains a collection of ASoC fixes, and nothing to worry too much. The fixes for ASoC core (DAPM, DPCM, topology) are all small and just covering corner cases. The rest changes are driver-specific, many of which are for x86 platforms and new drivers like STM32, in addition to the usual fixups for HD-audio" * tag 'sound-5.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (66 commits) ASoC: wcd9335: Fix missing regmap requirement ALSA: hda: Fix racy display power access ASoC: pcm: fix error handling when try_module_get() fails. ASoC: stm32: sai: fix master clock management ASoC: Intel: kbl: fix wrong number of channels ALSA: hda - Add two more machines to the power_save_blacklist ASoC: pcm: update module refcount if module_get_upon_open is set ASoC: core: conditionally increase module refcount on component open ASoC: stm32: fix sai driver name initialisation ASoC: topology: Use the correct dobj to free enum control values and texts ALSA: seq: Fix OOB-reads from strlcpy ASoC: intel: skylake: add remove() callback for component driver ASoC: cs35l35: Disable regulators on driver removal ALSA: xen-front: Do not use stream buffer size before it is set ASoC: rockchip: pdm: change dma burst to 8 ASoC: rockchip: pdm: fix regmap_ops hang issue ASoC: simple-card: don't select DPCM via simple-audio-card ASoC: audio-graph-card: don't select DPCM via audio-graph-card ASoC: tlv320aic32x4: Change author's name ALSA: hda/realtek - Add quirk for Tuxedo XC 1509 ...

Linus Torvalds committed 7 years ago

Commit 372686e2 parents f2a7346 9b0dcd050 files · +734 −262Browse files

Unified · Split

50 files
  1. include/sound/soc.h +9 −2
  2. include/uapi/sound/asound.h +1 −0
  3. sound/core/seq/seq_clientmgr.c +3 −3
  4. sound/hda/ext/hdac_ext_bus.c +0 −1
  5. sound/hda/hdac_bus.c +1 −0
  6. sound/hda/hdac_component.c +5 −1
  7. sound/pci/hda/hda_intel.c +4 −0
  8. sound/pci/hda/patch_realtek.c +51 −21
  9. sound/soc/codecs/Kconfig +1 −0
  10. sound/soc/codecs/ab8500-codec.c +1 −0
  11. sound/soc/codecs/cs35l35.c +11 −0
  12. sound/soc/codecs/cs4270.c +1 −0
  13. sound/soc/codecs/hdac_hda.c +39 −14
  14. sound/soc/codecs/hdac_hda.h +1 −0
  15. sound/soc/codecs/hdmi-codec.c +59 −62
  16. sound/soc/codecs/nau8810.c +2 −2
  17. sound/soc/codecs/nau8824.c +38 −8
  18. sound/soc/codecs/rt5682.c +25 −31
  19. sound/soc/codecs/tlv320aic32x4-i2c.c +2 −2
  20. sound/soc/codecs/tlv320aic32x4-spi.c +2 −2
  21. sound/soc/codecs/tlv320aic32x4.c +2 −0
  22. sound/soc/codecs/tlv320aic3x.c +3 −1
  23. sound/soc/codecs/wm_adsp.c +33 −7
  24. sound/soc/codecs/wm_adsp.h +1 −0
  25. sound/soc/fsl/fsl_asrc.c +14 −0
  26. sound/soc/fsl/fsl_esai.c +37 −10
  27. sound/soc/generic/audio-graph-card.c +8 −3
  28. sound/soc/generic/simple-card.c +9 −3
  29. sound/soc/intel/atom/sst-mfld-platform-pcm.c +8 −0
  30. sound/soc/intel/boards/cht_bsw_max98090_ti.c +41 −6
  31. sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c +1 −1
  32. sound/soc/intel/skylake/skl-messages.c +1 −0
  33. sound/soc/intel/skylake/skl-pcm.c +22 −6
  34. sound/soc/mediatek/common/mtk-btcvsd.c +68 −1
  35. sound/soc/mediatek/mt8183/mt8183-afe-clk.c +4 −0
  36. sound/soc/rockchip/rockchip_pdm.c +3 −1
  37. sound/soc/samsung/i2s.c +6 −4
  38. sound/soc/samsung/odroid.c +2 −2
  39. sound/soc/sh/rcar/core.c +2 −0
  40. sound/soc/sh/rcar/rsnd.h +5 −0
  41. sound/soc/sh/rcar/src.c +7 −14
  42. sound/soc/soc-core.c +4 −2
  43. sound/soc/soc-dapm.c +11 −0
  44. sound/soc/soc-pcm.c +55 −11
  45. sound/soc/soc-topology.c +4 −3
  46. sound/soc/stm/stm32_adfsdm.c +34 −4
  47. sound/soc/stm/stm32_i2s.c +1 −2
  48. sound/soc/stm/stm32_sai.c +5 −3
  49. sound/soc/stm/stm32_sai_sub.c +86 −28
  50. sound/xen/xen_snd_front_alsa.c +1 −1
include/sound/soc.h+9−2
@@ -802,8 +802,13 @@ struct snd_soc_component_driver { · 801 unmodified lines
802802 int probe_order;
803803 int remove_order;
804804
805− /* signal if the module handling the component cannot be removed */
806− unsigned int ignore_module_refcount:1;
805+ /*
806+ * signal if the module handling the component should not be removed
807+ * if a pcm is open. Setting this would prevent the module
808+ * refcount being incremented in probe() but allow it be incremented
809+ * when a pcm is opened and decremented when it is closed.
810+ */
811+ unsigned int module_get_upon_open:1;
807812
808813 /* bits */
809814 unsigned int idle_bias_on:1;
@@ -1083,6 +1088,8 @@ struct snd_soc_card { · 273 unmodified lines
10831088 struct mutex mutex;
10841089 struct mutex dapm_mutex;
10851090
1091+ spinlock_t dpcm_lock;
1092+
10861093 bool instantiated;
10871094 bool topology_shortname_created;
10881095
include/uapi/sound/asound.h+1−0
@@ -32,6 +32,7 @@ · 31 unmodified lines
3232
3333 #ifndef __KERNEL__
3434 #include <stdlib.h>
35+#include <time.h>
3536 #endif
3637
3738 /*
sound/core/seq/seq_clientmgr.c+3−3
@@ -1252,7 +1252,7 @@ static int snd_seq_ioctl_set_client_info(struct snd_seq_client *client, · 1251 unmodified lines
12521252
12531253 /* fill the info fields */
12541254 if (client_info->name[0])
1255− strlcpy(client->name, client_info->name, sizeof(client->name));
1255+ strscpy(client->name, client_info->name, sizeof(client->name));
12561256
12571257 client->filter = client_info->filter;
12581258 client->event_lost = client_info->event_lost;
@@ -1530,7 +1530,7 @@ static int snd_seq_ioctl_create_queue(struct snd_seq_client *client, void *arg) · 271 unmodified lines
15301530 /* set queue name */
15311531 if (!info->name[0])
15321532 snprintf(info->name, sizeof(info->name), "Queue-%d", q->queue);
1533− strlcpy(q->name, info->name, sizeof(q->name));
1533+ strscpy(q->name, info->name, sizeof(q->name));
15341534 snd_use_lock_free(&q->use_lock);
15351535
15361536 return 0;
@@ -1592,7 +1592,7 @@ static int snd_seq_ioctl_set_queue_info(struct snd_seq_client *client, · 55 unmodified lines
15921592 queuefree(q);
15931593 return -EPERM;
15941594 }
1595− strlcpy(q->name, info->name, sizeof(q->name));
1595+ strscpy(q->name, info->name, sizeof(q->name));
15961596 queuefree(q);
15971597
15981598 return 0;
sound/hda/ext/hdac_ext_bus.c+0−1
@@ -107,7 +107,6 @@ int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev, · 106 unmodified lines
107107 INIT_LIST_HEAD(&bus->hlink_list);
108108 bus->idx = idx++;
109109
110− mutex_init(&bus->lock);
111110 bus->cmd_dma_state = true;
112111
113112 return 0;
sound/hda/hdac_bus.c+1−0
@@ -38,6 +38,7 @@ int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev, · 37 unmodified lines
3838 INIT_WORK(&bus->unsol_work, snd_hdac_bus_process_unsol_events);
3939 spin_lock_init(&bus->reg_lock);
4040 mutex_init(&bus->cmd_mutex);
41+ mutex_init(&bus->lock);
4142 bus->irq = -1;
4243 return 0;
4344 }
sound/hda/hdac_component.c+5−1
@@ -69,13 +69,15 @@ void snd_hdac_display_power(struct hdac_bus *bus, unsigned int idx, bool enable) · 68 unmodified lines
6969
7070 dev_dbg(bus->dev, "display power %s\n",
7171 enable ? "enable" : "disable");
72+
73+ mutex_lock(&bus->lock);
7274 if (enable)
7375 set_bit(idx, &bus->display_power_status);
7476 else
7577 clear_bit(idx, &bus->display_power_status);
7678
7779 if (!acomp || !acomp->ops)
78− return;
80+ goto unlock;
7981
8082 if (bus->display_power_status) {
8183 if (!bus->display_power_active) {
@@ -92,6 +94,8 @@ void snd_hdac_display_power(struct hdac_bus *bus, unsigned int idx, bool enable) · 10 unmodified lines
9294 bus->display_power_active = false;
9395 }
9496 }
97+ unlock:
98+ mutex_unlock(&bus->lock);
9599 }
96100 EXPORT_SYMBOL_GPL(snd_hdac_display_power);
97101
sound/pci/hda/hda_intel.c+4−0
@@ -2142,6 +2142,8 @@ static struct snd_pci_quirk power_save_blacklist[] = { · 2141 unmodified lines
21422142 SND_PCI_QUIRK(0x8086, 0x2040, "Intel DZ77BH-55K", 0),
21432143 /* https://bugzilla.kernel.org/show_bug.cgi?id=199607 */
21442144 SND_PCI_QUIRK(0x8086, 0x2057, "Intel NUC5i7RYB", 0),
2145+ /* https://bugs.launchpad.net/bugs/1821663 */
2146+ SND_PCI_QUIRK(0x8086, 0x2064, "Intel SDP 8086:2064", 0),
21452147 /* https://bugzilla.redhat.com/show_bug.cgi?id=1520902 */
21462148 SND_PCI_QUIRK(0x8086, 0x2068, "Intel NUC7i3BNB", 0),
21472149 /* https://bugzilla.kernel.org/show_bug.cgi?id=198611 */
@@ -2150,6 +2152,8 @@ static struct snd_pci_quirk power_save_blacklist[] = { · 2 unmodified lines
21502152 SND_PCI_QUIRK(0x17aa, 0x367b, "Lenovo IdeaCentre B550", 0),
21512153 /* https://bugzilla.redhat.com/show_bug.cgi?id=1572975 */
21522154 SND_PCI_QUIRK(0x17aa, 0x36a7, "Lenovo C50 All in one", 0),
2155+ /* https://bugs.launchpad.net/bugs/1821663 */
2156+ SND_PCI_QUIRK(0x1631, 0xe017, "Packard Bell NEC IMEDIA 5204", 0),
21532157 {}
21542158 };
21552159 #endif /* CONFIG_PM */
sound/pci/hda/patch_realtek.c+51−21
@@ -1864,8 +1864,8 @@ enum { · 1863 unmodified lines
18641864 ALC887_FIXUP_BASS_CHMAP,
18651865 ALC1220_FIXUP_GB_DUAL_CODECS,
18661866 ALC1220_FIXUP_CLEVO_P950,
1867− ALC1220_FIXUP_SYSTEM76_ORYP5,
1868− ALC1220_FIXUP_SYSTEM76_ORYP5_PINS,
1867+ ALC1220_FIXUP_CLEVO_PB51ED,
1868+ ALC1220_FIXUP_CLEVO_PB51ED_PINS,
18691869 };
18701870
18711871 static void alc889_fixup_coef(struct hda_codec *codec,
@@ -2070,7 +2070,7 @@ static void alc1220_fixup_clevo_p950(struct hda_codec *codec, · 198 unmodified lines
20702070 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
20712071 const struct hda_fixup *fix, int action);
20722072
2073−static void alc1220_fixup_system76_oryp5(struct hda_codec *codec,
2073+static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
20742074 const struct hda_fixup *fix,
20752075 int action)
20762076 {
@@ -2322,18 +2322,18 @@ static const struct hda_fixup alc882_fixups[] = { · 245 unmodified lines
23222322 .type = HDA_FIXUP_FUNC,
23232323 .v.func = alc1220_fixup_clevo_p950,
23242324 },
2325− [ALC1220_FIXUP_SYSTEM76_ORYP5] = {
2325+ [ALC1220_FIXUP_CLEVO_PB51ED] = {
23262326 .type = HDA_FIXUP_FUNC,
2327− .v.func = alc1220_fixup_system76_oryp5,
2327+ .v.func = alc1220_fixup_clevo_pb51ed,
23282328 },
2329− [ALC1220_FIXUP_SYSTEM76_ORYP5_PINS] = {
2329+ [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
23302330 .type = HDA_FIXUP_PINS,
23312331 .v.pins = (const struct hda_pintbl[]) {
23322332 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
23332333 {}
23342334 },
23352335 .chained = true,
2336− .chain_id = ALC1220_FIXUP_SYSTEM76_ORYP5,
2336+ .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
23372337 },
23382338 };
23392339
@@ -2411,8 +2411,9 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { · 71 unmodified lines
24112411 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
24122412 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
24132413 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2414− SND_PCI_QUIRK(0x1558, 0x96e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_SYSTEM76_ORYP5_PINS),
2415− SND_PCI_QUIRK(0x1558, 0x97e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_SYSTEM76_ORYP5_PINS),
2414+ SND_PCI_QUIRK(0x1558, 0x96e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2415+ SND_PCI_QUIRK(0x1558, 0x97e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2416+ SND_PCI_QUIRK(0x1558, 0x65d1, "Tuxedo Book XC1509", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
24162417 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
24172418 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
24182419 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
@@ -5491,7 +5492,7 @@ static void alc_headset_btn_callback(struct hda_codec *codec, · 3072 unmodified lines
54915492 jack->jack->button_state = report;
54925493 }
54935494
5494−static void alc295_fixup_chromebook(struct hda_codec *codec,
5495+static void alc_fixup_headset_jack(struct hda_codec *codec,
54955496 const struct hda_fixup *fix, int action)
54965497 {
54975498
@@ -5501,16 +5502,6 @@ static void alc295_fixup_chromebook(struct hda_codec *codec, · 3 unmodified lines
55015502 alc_headset_btn_callback);
55025503 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
55035504 SND_JACK_HEADSET, alc_headset_btn_keymap);
5504− switch (codec->core.vendor_id) {
5505− case 0x10ec0295:
5506− alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
5507− alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
5508− break;
5509− case 0x10ec0236:
5510− alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
5511− alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
5512− break;
5513− }
55145505 break;
55155506 case HDA_FIXUP_ACT_INIT:
55165507 switch (codec->core.vendor_id) {
@@ -5531,6 +5522,25 @@ static void alc295_fixup_chromebook(struct hda_codec *codec, · 14 unmodified lines
55315522 }
55325523 }
55335524
5525+static void alc295_fixup_chromebook(struct hda_codec *codec,
5526+ const struct hda_fixup *fix, int action)
5527+{
5528+ switch (action) {
5529+ case HDA_FIXUP_ACT_INIT:
5530+ switch (codec->core.vendor_id) {
5531+ case 0x10ec0295:
5532+ alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
5533+ alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
5534+ break;
5535+ case 0x10ec0236:
5536+ alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
5537+ alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
5538+ break;
5539+ }
5540+ break;
5541+ }
5542+}
5543+
55345544 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
55355545 const struct hda_fixup *fix, int action)
55365546 {
@@ -5663,6 +5673,7 @@ enum { · 126 unmodified lines
56635673 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
56645674 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
56655675 ALC233_FIXUP_LENOVO_MULTI_CODECS,
5676+ ALC233_FIXUP_ACER_HEADSET_MIC,
56665677 ALC294_FIXUP_LENOVO_MIC_LOCATION,
56675678 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
56685679 ALC700_FIXUP_INTEL_REFERENCE,
@@ -5684,6 +5695,7 @@ enum { · 15 unmodified lines
56845695 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
56855696 ALC255_FIXUP_ACER_HEADSET_MIC,
56865697 ALC295_FIXUP_CHROME_BOOK,
5698+ ALC225_FIXUP_HEADSET_JACK,
56875699 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
56885700 ALC225_FIXUP_WYSE_AUTO_MUTE,
56895701 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
@@ -6490,6 +6502,16 @@ static const struct hda_fixup alc269_fixups[] = { · 800 unmodified lines
64906502 .type = HDA_FIXUP_FUNC,
64916503 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
64926504 },
6505+ [ALC233_FIXUP_ACER_HEADSET_MIC] = {
6506+ .type = HDA_FIXUP_VERBS,
6507+ .v.verbs = (const struct hda_verb[]) {
6508+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
6509+ { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
6510+ { }
6511+ },
6512+ .chained = true,
6513+ .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6514+ },
64936515 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
64946516 .type = HDA_FIXUP_PINS,
64956517 .v.pins = (const struct hda_pintbl[]) {
@@ -6635,6 +6657,12 @@ static const struct hda_fixup alc269_fixups[] = { · 139 unmodified lines
66356657 [ALC295_FIXUP_CHROME_BOOK] = {
66366658 .type = HDA_FIXUP_FUNC,
66376659 .v.func = alc295_fixup_chromebook,
6660+ .chained = true,
6661+ .chain_id = ALC225_FIXUP_HEADSET_JACK
6662+ },
6663+ [ALC225_FIXUP_HEADSET_JACK] = {
6664+ .type = HDA_FIXUP_FUNC,
6665+ .v.func = alc_fixup_headset_jack,
66386666 },
66396667 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
66406668 .type = HDA_FIXUP_PINS,
@@ -6737,6 +6765,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 96 unmodified lines
67376765 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
67386766 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
67396767 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6768+ SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
67406769 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
67416770 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
67426771 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
@@ -7132,7 +7161,8 @@ static const struct hda_model_fixup alc269_fixup_models[] = { · 389 unmodified lines
71327161 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
71337162 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
71347163 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
7135− {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-sense-combo"},
7164+ {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
7165+ {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
71367166 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
71377167 {}
71387168 };
sound/soc/codecs/Kconfig+1−0
@@ -1151,6 +1151,7 @@ config SND_SOC_WCD9335 · 1150 unmodified lines
11511151 tristate "WCD9335 Codec"
11521152 depends on SLIMBUS
11531153 select REGMAP_SLIMBUS
1154+ select REGMAP_IRQ
11541155 help
11551156 The WCD9335 is a standalone Hi-Fi audio CODEC IC, supports
11561157 Qualcomm Technologies, Inc. (QTI) multimedia solutions,
sound/soc/codecs/ab8500-codec.c+1−0
@@ -2129,6 +2129,7 @@ static int ab8500_codec_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) · 2128 unmodified lines
21292129 dev_err(dai->component->dev,
21302130 "%s: ERROR: The device is either a master or a slave.\n",
21312131 __func__);
2132+ /* fall through */
21322133 default:
21332134 dev_err(dai->component->dev,
21342135 "%s: ERROR: Unsupporter master mask 0x%x\n",
sound/soc/codecs/cs35l35.c+11−0
@@ -1635,6 +1635,16 @@ err: · 1634 unmodified lines
16351635 return ret;
16361636 }
16371637
1638+static int cs35l35_i2c_remove(struct i2c_client *i2c_client)
1639+{
1640+ struct cs35l35_private *cs35l35 = i2c_get_clientdata(i2c_client);
1641+
1642+ regulator_bulk_disable(cs35l35->num_supplies, cs35l35->supplies);
1643+ gpiod_set_value_cansleep(cs35l35->reset_gpio, 0);
1644+
1645+ return 0;
1646+}
1647+
16381648 static const struct of_device_id cs35l35_of_match[] = {
16391649 {.compatible = "cirrus,cs35l35"},
16401650 {},
@@ -1655,6 +1665,7 @@ static struct i2c_driver cs35l35_i2c_driver = { · 14 unmodified lines
16551665 },
16561666 .id_table = cs35l35_id,
16571667 .probe = cs35l35_i2c_probe,
1668+ .remove = cs35l35_i2c_remove,
16581669 };
16591670
16601671 module_i2c_driver(cs35l35_i2c_driver);
sound/soc/codecs/cs4270.c+1−0
@@ -642,6 +642,7 @@ static const struct regmap_config cs4270_regmap = { · 641 unmodified lines
642642 .reg_defaults = cs4270_reg_defaults,
643643 .num_reg_defaults = ARRAY_SIZE(cs4270_reg_defaults),
644644 .cache_type = REGCACHE_RBTREE,
645+ .write_flag_mask = CS4270_I2C_INCR,
645646
646647 .readable_reg = cs4270_reg_is_readable,
647648 .volatile_reg = cs4270_reg_is_volatile,
sound/soc/codecs/hdac_hda.c+39−14
@@ -38,6 +38,9 @@ static void hdac_hda_dai_close(struct snd_pcm_substream *substream, · 37 unmodified lines
3838 struct snd_soc_dai *dai);
3939 static int hdac_hda_dai_prepare(struct snd_pcm_substream *substream,
4040 struct snd_soc_dai *dai);
41+static int hdac_hda_dai_hw_params(struct snd_pcm_substream *substream,
42+ struct snd_pcm_hw_params *params,
43+ struct snd_soc_dai *dai);
4144 static int hdac_hda_dai_hw_free(struct snd_pcm_substream *substream,
4245 struct snd_soc_dai *dai);
4346 static int hdac_hda_dai_set_tdm_slot(struct snd_soc_dai *dai,
@@ -50,6 +53,7 @@ static const struct snd_soc_dai_ops hdac_hda_dai_ops = { · 6 unmodified lines
5053 .startup = hdac_hda_dai_open,
5154 .shutdown = hdac_hda_dai_close,
5255 .prepare = hdac_hda_dai_prepare,
56+ .hw_params = hdac_hda_dai_hw_params,
5357 .hw_free = hdac_hda_dai_hw_free,
5458 .set_tdm_slot = hdac_hda_dai_set_tdm_slot,
5559 };
@@ -139,6 +143,39 @@ static int hdac_hda_dai_set_tdm_slot(struct snd_soc_dai *dai, · 83 unmodified lines
139143 return 0;
140144 }
141145
146+static int hdac_hda_dai_hw_params(struct snd_pcm_substream *substream,
147+ struct snd_pcm_hw_params *params,
148+ struct snd_soc_dai *dai)
149+{
150+ struct snd_soc_component *component = dai->component;
151+ struct hdac_hda_priv *hda_pvt;
152+ unsigned int format_val;
153+ unsigned int maxbps;
154+
155+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
156+ maxbps = dai->driver->playback.sig_bits;
157+ else
158+ maxbps = dai->driver->capture.sig_bits;
159+
160+ hda_pvt = snd_soc_component_get_drvdata(component);
161+ format_val = snd_hdac_calc_stream_format(params_rate(params),
162+ params_channels(params),
163+ params_format(params),
164+ maxbps,
165+ 0);
166+ if (!format_val) {
167+ dev_err(dai->dev,
168+ "invalid format_val, rate=%d, ch=%d, format=%d, maxbps=%d\n",
169+ params_rate(params), params_channels(params),
170+ params_format(params), maxbps);
171+
172+ return -EINVAL;
173+ }
174+
175+ hda_pvt->pcm[dai->id].format_val[substream->stream] = format_val;
176+ return 0;
177+}
178+
142179 static int hdac_hda_dai_hw_free(struct snd_pcm_substream *substream,
143180 struct snd_soc_dai *dai)
144181 {
@@ -162,10 +199,9 @@ static int hdac_hda_dai_prepare(struct snd_pcm_substream *substream, · 17 unmodified lines
162199 struct snd_soc_dai *dai)
163200 {
164201 struct snd_soc_component *component = dai->component;
202+ struct hda_pcm_stream *hda_stream;
165203 struct hdac_hda_priv *hda_pvt;
166− struct snd_pcm_runtime *runtime = substream->runtime;
167204 struct hdac_device *hdev;
168− struct hda_pcm_stream *hda_stream;
169205 unsigned int format_val;
170206 struct hda_pcm *pcm;
171207 unsigned int stream;
@@ -179,19 +215,8 @@ static int hdac_hda_dai_prepare(struct snd_pcm_substream *substream, · 7 unmodified lines
179215
180216 hda_stream = &pcm->stream[substream->stream];
181217
182− format_val = snd_hdac_calc_stream_format(runtime->rate,
183− runtime->channels,
184− runtime->format,
185− hda_stream->maxbps,
186− 0);
187− if (!format_val) {
188− dev_err(&hdev->dev,
189− "invalid format_val, rate=%d, ch=%d, format=%d\n",
190− runtime->rate, runtime->channels, runtime->format);
191− return -EINVAL;
192− }
193−
194218 stream = hda_pvt->pcm[dai->id].stream_tag[substream->stream];
219+ format_val = hda_pvt->pcm[dai->id].format_val[substream->stream];
195220
196221 ret = snd_hda_codec_prepare(&hda_pvt->codec, hda_stream,
197222 stream, format_val, substream);
sound/soc/codecs/hdac_hda.h+1−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88
99 struct hdac_hda_pcm {
1010 int stream_tag[2];
11+ unsigned int format_val[2];
1112 };
1213
1314 struct hdac_hda_priv {
sound/soc/codecs/hdmi-codec.c+59−62
@@ -484,9 +484,6 @@ static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, · 483 unmodified lines
484484 params_width(params), params_rate(params),
485485 params_channels(params));
486486
487− if (params_width(params) > 24)
488− params->msbits = 24;
489−
490487 ret = snd_pcm_create_iec958_consumer_hw_params(params, hp.iec.status,
491488 sizeof(hp.iec.status));
492489 if (ret < 0) {
@@ -529,73 +526,71 @@ static int hdmi_codec_set_fmt(struct snd_soc_dai *dai, · 36 unmodified lines
529526 {
530527 struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
531528 struct hdmi_codec_daifmt cf = { 0 };
532− int ret = 0;
533529
534530 dev_dbg(dai->dev, "%s()\n", __func__);
535531
536− if (dai->id == DAI_ID_SPDIF) {
537− cf.fmt = HDMI_SPDIF;
538− } else {
539− switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
540− case SND_SOC_DAIFMT_CBM_CFM:
541− cf.bit_clk_master = 1;
542− cf.frame_clk_master = 1;
543− break;
544− case SND_SOC_DAIFMT_CBS_CFM:
545− cf.frame_clk_master = 1;
546− break;
547− case SND_SOC_DAIFMT_CBM_CFS:
548− cf.bit_clk_master = 1;
549− break;
550− case SND_SOC_DAIFMT_CBS_CFS:
551− break;
552− default:
553− return -EINVAL;
554− }
532+ if (dai->id == DAI_ID_SPDIF)
533+ return 0;
534+
535+ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
536+ case SND_SOC_DAIFMT_CBM_CFM:
537+ cf.bit_clk_master = 1;
538+ cf.frame_clk_master = 1;
539+ break;
540+ case SND_SOC_DAIFMT_CBS_CFM:
541+ cf.frame_clk_master = 1;
542+ break;
543+ case SND_SOC_DAIFMT_CBM_CFS:
544+ cf.bit_clk_master = 1;
545+ break;
546+ case SND_SOC_DAIFMT_CBS_CFS:
547+ break;
548+ default:
549+ return -EINVAL;
550+ }
555551
556− switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
557− case SND_SOC_DAIFMT_NB_NF:
558− break;
559− case SND_SOC_DAIFMT_NB_IF:
560− cf.frame_clk_inv = 1;
561− break;
562− case SND_SOC_DAIFMT_IB_NF:
563− cf.bit_clk_inv = 1;
564− break;
565− case SND_SOC_DAIFMT_IB_IF:
566− cf.frame_clk_inv = 1;
567− cf.bit_clk_inv = 1;
568− break;
569− }
552+ switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
553+ case SND_SOC_DAIFMT_NB_NF:
554+ break;
555+ case SND_SOC_DAIFMT_NB_IF:
556+ cf.frame_clk_inv = 1;
557+ break;
558+ case SND_SOC_DAIFMT_IB_NF:
559+ cf.bit_clk_inv = 1;
560+ break;
561+ case SND_SOC_DAIFMT_IB_IF:
562+ cf.frame_clk_inv = 1;
563+ cf.bit_clk_inv = 1;
564+ break;
565+ }
570566
571− switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
572− case SND_SOC_DAIFMT_I2S:
573− cf.fmt = HDMI_I2S;
574− break;
575− case SND_SOC_DAIFMT_DSP_A:
576− cf.fmt = HDMI_DSP_A;
577− break;
578− case SND_SOC_DAIFMT_DSP_B:
579− cf.fmt = HDMI_DSP_B;
580− break;
581− case SND_SOC_DAIFMT_RIGHT_J:
582− cf.fmt = HDMI_RIGHT_J;
583− break;
584− case SND_SOC_DAIFMT_LEFT_J:
585− cf.fmt = HDMI_LEFT_J;
586− break;
587− case SND_SOC_DAIFMT_AC97:
588− cf.fmt = HDMI_AC97;
589− break;
590− default:
591− dev_err(dai->dev, "Invalid DAI interface format\n");
592− return -EINVAL;
593− }
567+ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
568+ case SND_SOC_DAIFMT_I2S:
569+ cf.fmt = HDMI_I2S;
570+ break;
571+ case SND_SOC_DAIFMT_DSP_A:
572+ cf.fmt = HDMI_DSP_A;
573+ break;
574+ case SND_SOC_DAIFMT_DSP_B:
575+ cf.fmt = HDMI_DSP_B;
576+ break;
577+ case SND_SOC_DAIFMT_RIGHT_J:
578+ cf.fmt = HDMI_RIGHT_J;
579+ break;
580+ case SND_SOC_DAIFMT_LEFT_J:
581+ cf.fmt = HDMI_LEFT_J;
582+ break;
583+ case SND_SOC_DAIFMT_AC97:
584+ cf.fmt = HDMI_AC97;
585+ break;
586+ default:
587+ dev_err(dai->dev, "Invalid DAI interface format\n");
588+ return -EINVAL;
594589 }
595590
596591 hcp->daifmt[dai->id] = cf;
597592
598− return ret;
593+ return 0;
599594 }
600595
601596 static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute)
@@ -792,8 +787,10 @@ static int hdmi_codec_probe(struct platform_device *pdev) · 190 unmodified lines
792787 i++;
793788 }
794789
795− if (hcd->spdif)
790+ if (hcd->spdif) {
796791 hcp->daidrv[i] = hdmi_spdif_dai;
792+ hcp->daifmt[DAI_ID_SPDIF].fmt = HDMI_SPDIF;
793+ }
797794
798795 dev_set_drvdata(dev, hcp);
799796
sound/soc/codecs/nau8810.c+2−2
@@ -411,9 +411,9 @@ static const struct snd_soc_dapm_widget nau8810_dapm_widgets[] = { · 410 unmodified lines
411411 SND_SOC_DAPM_MIXER("Mono Mixer", NAU8810_REG_POWER3,
412412 NAU8810_MOUTMX_EN_SFT, 0, &nau8810_mono_mixer_controls[0],
413413 ARRAY_SIZE(nau8810_mono_mixer_controls)),
414− SND_SOC_DAPM_DAC("DAC", "HiFi Playback", NAU8810_REG_POWER3,
414+ SND_SOC_DAPM_DAC("DAC", "Playback", NAU8810_REG_POWER3,
415415 NAU8810_DAC_EN_SFT, 0),
416− SND_SOC_DAPM_ADC("ADC", "HiFi Capture", NAU8810_REG_POWER2,
416+ SND_SOC_DAPM_ADC("ADC", "Capture", NAU8810_REG_POWER2,
417417 NAU8810_ADC_EN_SFT, 0),
418418 SND_SOC_DAPM_PGA("SpkN Out", NAU8810_REG_POWER3,
419419 NAU8810_NSPK_EN_SFT, 0, NULL, 0),
sound/soc/codecs/nau8824.c+38−8
@@ -681,8 +681,8 @@ static const struct snd_soc_dapm_widget nau8824_dapm_widgets[] = { · 680 unmodified lines
681681 SND_SOC_DAPM_ADC("ADCR", NULL, NAU8824_REG_ANALOG_ADC_2,
682682 NAU8824_ADCR_EN_SFT, 0),
683683
684− SND_SOC_DAPM_AIF_OUT("AIFTX", "HiFi Capture", 0, SND_SOC_NOPM, 0, 0),
685− SND_SOC_DAPM_AIF_IN("AIFRX", "HiFi Playback", 0, SND_SOC_NOPM, 0, 0),
684+ SND_SOC_DAPM_AIF_OUT("AIFTX", "Capture", 0, SND_SOC_NOPM, 0, 0),
685+ SND_SOC_DAPM_AIF_IN("AIFRX", "Playback", 0, SND_SOC_NOPM, 0, 0),
686686
687687 SND_SOC_DAPM_DAC("DACL", NULL, NAU8824_REG_RDAC,
688688 NAU8824_DACL_EN_SFT, 0),
@@ -831,6 +831,36 @@ static void nau8824_int_status_clear_all(struct regmap *regmap) · 142 unmodified lines
831831 }
832832 }
833833
834+static void nau8824_dapm_disable_pin(struct nau8824 *nau8824, const char *pin)
835+{
836+ struct snd_soc_dapm_context *dapm = nau8824->dapm;
837+ const char *prefix = dapm->component->name_prefix;
838+ char prefixed_pin[80];
839+
840+ if (prefix) {
841+ snprintf(prefixed_pin, sizeof(prefixed_pin), "%s %s",
842+ prefix, pin);
843+ snd_soc_dapm_disable_pin(dapm, prefixed_pin);
844+ } else {
845+ snd_soc_dapm_disable_pin(dapm, pin);
846+ }
847+}
848+
849+static void nau8824_dapm_enable_pin(struct nau8824 *nau8824, const char *pin)
850+{
851+ struct snd_soc_dapm_context *dapm = nau8824->dapm;
852+ const char *prefix = dapm->component->name_prefix;
853+ char prefixed_pin[80];
854+
855+ if (prefix) {
856+ snprintf(prefixed_pin, sizeof(prefixed_pin), "%s %s",
857+ prefix, pin);
858+ snd_soc_dapm_force_enable_pin(dapm, prefixed_pin);
859+ } else {
860+ snd_soc_dapm_force_enable_pin(dapm, pin);
861+ }
862+}
863+
834864 static void nau8824_eject_jack(struct nau8824 *nau8824)
835865 {
836866 struct snd_soc_dapm_context *dapm = nau8824->dapm;
@@ -839,8 +869,8 @@ static void nau8824_eject_jack(struct nau8824 *nau8824) · 2 unmodified lines
839869 /* Clear all interruption status */
840870 nau8824_int_status_clear_all(regmap);
841871
842− snd_soc_dapm_disable_pin(dapm, "SAR");
843− snd_soc_dapm_disable_pin(dapm, "MICBIAS");
872+ nau8824_dapm_disable_pin(nau8824, "SAR");
873+ nau8824_dapm_disable_pin(nau8824, "MICBIAS");
844874 snd_soc_dapm_sync(dapm);
845875
846876 /* Enable the insertion interruption, disable the ejection
@@ -870,8 +900,8 @@ static void nau8824_jdet_work(struct work_struct *work) · 23 unmodified lines
870900 struct regmap *regmap = nau8824->regmap;
871901 int adc_value, event = 0, event_mask = 0;
872902
873− snd_soc_dapm_force_enable_pin(dapm, "MICBIAS");
874− snd_soc_dapm_force_enable_pin(dapm, "SAR");
903+ nau8824_dapm_enable_pin(nau8824, "MICBIAS");
904+ nau8824_dapm_enable_pin(nau8824, "SAR");
875905 snd_soc_dapm_sync(dapm);
876906
877907 msleep(100);
@@ -882,8 +912,8 @@ static void nau8824_jdet_work(struct work_struct *work) · 4 unmodified lines
882912 if (adc_value < HEADSET_SARADC_THD) {
883913 event |= SND_JACK_HEADPHONE;
884914
885− snd_soc_dapm_disable_pin(dapm, "SAR");
886− snd_soc_dapm_disable_pin(dapm, "MICBIAS");
915+ nau8824_dapm_disable_pin(nau8824, "SAR");
916+ nau8824_dapm_disable_pin(nau8824, "MICBIAS");
887917 snd_soc_dapm_sync(dapm);
888918 } else {
889919 event |= SND_JACK_HEADSET;
sound/soc/codecs/rt5682.c+25−31
@@ -910,13 +910,21 @@ static int rt5682_headset_detect(struct snd_soc_component *component, · 909 unmodified lines
910910 int jack_insert)
911911 {
912912 struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
913− struct snd_soc_dapm_context *dapm =
914− snd_soc_component_get_dapm(component);
915913 unsigned int val, count;
916914
917915 if (jack_insert) {
918− snd_soc_dapm_force_enable_pin(dapm, "CBJ Power");
919− snd_soc_dapm_sync(dapm);
916+
917+ snd_soc_component_update_bits(component, RT5682_PWR_ANLG_1,
918+ RT5682_PWR_VREF2 | RT5682_PWR_MB,
919+ RT5682_PWR_VREF2 | RT5682_PWR_MB);
920+ snd_soc_component_update_bits(component,
921+ RT5682_PWR_ANLG_1, RT5682_PWR_FV2, 0);
922+ usleep_range(15000, 20000);
923+ snd_soc_component_update_bits(component,
924+ RT5682_PWR_ANLG_1, RT5682_PWR_FV2, RT5682_PWR_FV2);
925+ snd_soc_component_update_bits(component, RT5682_PWR_ANLG_3,
926+ RT5682_PWR_CBJ, RT5682_PWR_CBJ);
927+
920928 snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,
921929 RT5682_TRIG_JD_MASK, RT5682_TRIG_JD_HIGH);
922930
@@ -944,8 +952,10 @@ static int rt5682_headset_detect(struct snd_soc_component *component, · 21 unmodified lines
944952 rt5682_enable_push_button_irq(component, false);
945953 snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,
946954 RT5682_TRIG_JD_MASK, RT5682_TRIG_JD_LOW);
947− snd_soc_dapm_disable_pin(dapm, "CBJ Power");
948− snd_soc_dapm_sync(dapm);
955+ snd_soc_component_update_bits(component, RT5682_PWR_ANLG_1,
956+ RT5682_PWR_VREF2 | RT5682_PWR_MB, 0);
957+ snd_soc_component_update_bits(component, RT5682_PWR_ANLG_3,
958+ RT5682_PWR_CBJ, 0);
949959
950960 rt5682->jack_type = 0;
951961 }
@@ -1198,7 +1208,7 @@ static int set_filter_clk(struct snd_soc_dapm_widget *w, · 246 unmodified lines
11981208 struct snd_soc_component *component =
11991209 snd_soc_dapm_to_component(w->dapm);
12001210 struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
1201− int ref, val, reg, sft, mask, idx = -EINVAL;
1211+ int ref, val, reg, idx = -EINVAL;
12021212 static const int div_f[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48};
12031213 static const int div_o[] = {1, 2, 4, 6, 8, 12, 16, 24, 32, 48};
12041214
@@ -1212,15 +1222,10 @@ static int set_filter_clk(struct snd_soc_dapm_widget *w, · 7 unmodified lines
12121222
12131223 idx = rt5682_div_sel(rt5682, ref, div_f, ARRAY_SIZE(div_f));
12141224
1215− if (w->shift == RT5682_PWR_ADC_S1F_BIT) {
1225+ if (w->shift == RT5682_PWR_ADC_S1F_BIT)
12161226 reg = RT5682_PLL_TRACK_3;
1217− sft = RT5682_ADC_OSR_SFT;
1218− mask = RT5682_ADC_OSR_MASK;
1219− } else {
1227+ else
12201228 reg = RT5682_PLL_TRACK_2;
1221− sft = RT5682_DAC_OSR_SFT;
1222− mask = RT5682_DAC_OSR_MASK;
1223− }
12241229
12251230 snd_soc_component_update_bits(component, reg,
12261231 RT5682_FILTER_CLK_DIV_MASK, idx << RT5682_FILTER_CLK_DIV_SFT);
@@ -1232,7 +1237,8 @@ static int set_filter_clk(struct snd_soc_dapm_widget *w, · 5 unmodified lines
12321237 }
12331238
12341239 snd_soc_component_update_bits(component, RT5682_ADDA_CLK_1,
1235− mask, idx << sft);
1240+ RT5682_ADC_OSR_MASK | RT5682_DAC_OSR_MASK,
1241+ (idx << RT5682_ADC_OSR_SFT) | (idx << RT5682_DAC_OSR_SFT));
12361242
12371243 return 0;
12381244 }
@@ -1591,8 +1597,6 @@ static const struct snd_soc_dapm_widget rt5682_dapm_widgets[] = { · 352 unmodified lines
15911597 0, NULL, 0),
15921598 SND_SOC_DAPM_SUPPLY("Vref1", RT5682_PWR_ANLG_1, RT5682_PWR_VREF1_BIT, 0,
15931599 rt5655_set_verf, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
1594− SND_SOC_DAPM_SUPPLY("Vref2", RT5682_PWR_ANLG_1, RT5682_PWR_VREF2_BIT, 0,
1595− rt5655_set_verf, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
15961600
15971601 /* ASRC */
15981602 SND_SOC_DAPM_SUPPLY_S("DAC STO1 ASRC", 1, RT5682_PLL_TRACK_1,
@@ -1627,9 +1631,6 @@ static const struct snd_soc_dapm_widget rt5682_dapm_widgets[] = { · 28 unmodified lines
16271631 SND_SOC_DAPM_PGA("BST1 CBJ", SND_SOC_NOPM,
16281632 0, 0, NULL, 0),
16291633
1630− SND_SOC_DAPM_SUPPLY("CBJ Power", RT5682_PWR_ANLG_3,
1631− RT5682_PWR_CBJ_BIT, 0, NULL, 0),
1632−
16331634 /* REC Mixer */
16341635 SND_SOC_DAPM_MIXER("RECMIX1L", SND_SOC_NOPM, 0, 0, rt5682_rec1_l_mix,
16351636 ARRAY_SIZE(rt5682_rec1_l_mix)),
@@ -1792,17 +1793,13 @@ static const struct snd_soc_dapm_route rt5682_dapm_routes[] = { · 156 unmodified lines
17921793
17931794 /*Vref*/
17941795 {"MICBIAS1", NULL, "Vref1"},
1795− {"MICBIAS1", NULL, "Vref2"},
17961796 {"MICBIAS2", NULL, "Vref1"},
1797− {"MICBIAS2", NULL, "Vref2"},
17981797
17991798 {"CLKDET SYS", NULL, "CLKDET"},
18001799
18011800 {"IN1P", NULL, "LDO2"},
18021801
18031802 {"BST1 CBJ", NULL, "IN1P"},
1804− {"BST1 CBJ", NULL, "CBJ Power"},
1805− {"CBJ Power", NULL, "Vref2"},
18061803
18071804 {"RECMIX1L", "CBJ Switch", "BST1 CBJ"},
18081805 {"RECMIX1L", NULL, "RECMIX1L Power"},
@@ -1912,9 +1909,7 @@ static const struct snd_soc_dapm_route rt5682_dapm_routes[] = { · 103 unmodified lines
19121909 {"HP Amp", NULL, "Capless"},
19131910 {"HP Amp", NULL, "Charge Pump"},
19141911 {"HP Amp", NULL, "CLKDET SYS"},
1915− {"HP Amp", NULL, "CBJ Power"},
19161912 {"HP Amp", NULL, "Vref1"},
1917− {"HP Amp", NULL, "Vref2"},
19181913 {"HPOL Playback", "Switch", "HP Amp"},
19191914 {"HPOR Playback", "Switch", "HP Amp"},
19201915 {"HPOL", NULL, "HPOL Playback"},
@@ -2303,16 +2298,13 @@ static int rt5682_set_bias_level(struct snd_soc_component *component, · 382 unmodified lines
23032298 switch (level) {
23042299 case SND_SOC_BIAS_PREPARE:
23052300 regmap_update_bits(rt5682->regmap, RT5682_PWR_ANLG_1,
2306− RT5682_PWR_MB | RT5682_PWR_BG,
2307− RT5682_PWR_MB | RT5682_PWR_BG);
2301+ RT5682_PWR_BG, RT5682_PWR_BG);
23082302 regmap_update_bits(rt5682->regmap, RT5682_PWR_DIG_1,
23092303 RT5682_DIG_GATE_CTRL | RT5682_PWR_LDO,
23102304 RT5682_DIG_GATE_CTRL | RT5682_PWR_LDO);
23112305 break;
23122306
23132307 case SND_SOC_BIAS_STANDBY:
2314− regmap_update_bits(rt5682->regmap, RT5682_PWR_ANLG_1,
2315− RT5682_PWR_MB, RT5682_PWR_MB);
23162308 regmap_update_bits(rt5682->regmap, RT5682_PWR_DIG_1,
23172309 RT5682_DIG_GATE_CTRL, RT5682_DIG_GATE_CTRL);
23182310 break;
@@ -2320,7 +2312,7 @@ static int rt5682_set_bias_level(struct snd_soc_component *component, · 1 unmodified line
23202312 regmap_update_bits(rt5682->regmap, RT5682_PWR_DIG_1,
23212313 RT5682_DIG_GATE_CTRL | RT5682_PWR_LDO, 0);
23222314 regmap_update_bits(rt5682->regmap, RT5682_PWR_ANLG_1,
2323− RT5682_PWR_MB | RT5682_PWR_BG, 0);
2315+ RT5682_PWR_BG, 0);
23242316 break;
23252317
23262318 default:
@@ -2363,6 +2355,8 @@ static int rt5682_resume(struct snd_soc_component *component) · 36 unmodified lines
23632355 regcache_cache_only(rt5682->regmap, false);
23642356 regcache_sync(rt5682->regmap);
23652357
2358+ rt5682_irq(0, rt5682);
2359+
23662360 return 0;
23672361 }
23682362 #else
sound/soc/codecs/tlv320aic32x4-i2c.c+2−2
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 *
44 * Copyright 2011 NW Digital Radio
55 *
6− * Author: Jeremy McDermond <nh6z@nh6z.net>
6+ * Author: Annaliese McDermond <nh6z@nh6z.net>
77 *
88 * Based on sound/soc/codecs/wm8974 and TI driver for kernel 2.6.27.
99 *
@@ -72,5 +72,5 @@ static struct i2c_driver aic32x4_i2c_driver = { · 62 unmodified lines
7272 module_i2c_driver(aic32x4_i2c_driver);
7373
7474 MODULE_DESCRIPTION("ASoC TLV320AIC32x4 codec driver I2C");
75−MODULE_AUTHOR("Jeremy McDermond <nh6z@nh6z.net>");
75+MODULE_AUTHOR("Annaliese McDermond <nh6z@nh6z.net>");
7676 MODULE_LICENSE("GPL");
sound/soc/codecs/tlv320aic32x4-spi.c+2−2
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 *
44 * Copyright 2011 NW Digital Radio
55 *
6− * Author: Jeremy McDermond <nh6z@nh6z.net>
6+ * Author: Annaliese McDermond <nh6z@nh6z.net>
77 *
88 * Based on sound/soc/codecs/wm8974 and TI driver for kernel 2.6.27.
99 *
@@ -74,5 +74,5 @@ static struct spi_driver aic32x4_spi_driver = { · 64 unmodified lines
7474 module_spi_driver(aic32x4_spi_driver);
7575
7676 MODULE_DESCRIPTION("ASoC TLV320AIC32x4 codec driver SPI");
77−MODULE_AUTHOR("Jeremy McDermond <nh6z@nh6z.net>");
77+MODULE_AUTHOR("Annaliese McDermond <nh6z@nh6z.net>");
7878 MODULE_LICENSE("GPL");
sound/soc/codecs/tlv320aic32x4.c+2−0
@@ -490,6 +490,8 @@ static const struct snd_soc_dapm_widget aic32x4_dapm_widgets[] = { · 489 unmodified lines
490490 SND_SOC_DAPM_INPUT("IN2_R"),
491491 SND_SOC_DAPM_INPUT("IN3_L"),
492492 SND_SOC_DAPM_INPUT("IN3_R"),
493+ SND_SOC_DAPM_INPUT("CM_L"),
494+ SND_SOC_DAPM_INPUT("CM_R"),
493495 };
494496
495497 static const struct snd_soc_dapm_route aic32x4_dapm_routes[] = {
sound/soc/codecs/tlv320aic3x.c+3−1
@@ -1609,7 +1609,6 @@ static int aic3x_probe(struct snd_soc_component *component) · 1608 unmodified lines
16091609 struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component);
16101610 int ret, i;
16111611
1612− INIT_LIST_HEAD(&aic3x->list);
16131612 aic3x->component = component;
16141613
16151614 for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++) {
@@ -1873,6 +1872,7 @@ static int aic3x_i2c_probe(struct i2c_client *i2c, · 257 unmodified lines
18731872 if (ret != 0)
18741873 goto err_gpio;
18751874
1875+ INIT_LIST_HEAD(&aic3x->list);
18761876 list_add(&aic3x->list, &reset_list);
18771877
18781878 return 0;
@@ -1889,6 +1889,8 @@ static int aic3x_i2c_remove(struct i2c_client *client) · 10 unmodified lines
18891889 {
18901890 struct aic3x_priv *aic3x = i2c_get_clientdata(client);
18911891
1892+ list_del(&aic3x->list);
1893+
18921894 if (gpio_is_valid(aic3x->gpio_reset) &&
18931895 !aic3x_is_shared_reset(aic3x)) {
18941896 gpio_set_value(aic3x->gpio_reset, 0);
sound/soc/codecs/wm_adsp.c+33−7
@@ -2905,6 +2905,8 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w, · 2904 unmodified lines
29052905 if (wm_adsp_fw[dsp->fw].num_caps != 0)
29062906 wm_adsp_buffer_free(dsp);
29072907
2908+ dsp->fatal_error = false;
2909+
29082910 mutex_unlock(&dsp->pwr_lock);
29092911
29102912 adsp_dbg(dsp, "Execution stopped\n");
@@ -3000,6 +3002,9 @@ static int wm_adsp_compr_attach(struct wm_adsp_compr *compr) · 89 unmodified lines
30003002 {
30013003 struct wm_adsp_compr_buf *buf = NULL, *tmp;
30023004
3005+ if (compr->dsp->fatal_error)
3006+ return -EINVAL;
3007+
30033008 list_for_each_entry(tmp, &compr->dsp->buffer_list, list) {
30043009 if (!tmp->name || !strcmp(compr->name, tmp->name)) {
30053010 buf = tmp;
@@ -3535,11 +3540,11 @@ static int wm_adsp_buffer_get_error(struct wm_adsp_compr_buf *buf) · 529 unmodified lines
35353540
35363541 ret = wm_adsp_buffer_read(buf, HOST_BUFFER_FIELD(error), &buf->error);
35373542 if (ret < 0) {
3538− adsp_err(buf->dsp, "Failed to check buffer error: %d\n", ret);
3543+ compr_err(buf, "Failed to check buffer error: %d\n", ret);
35393544 return ret;
35403545 }
35413546 if (buf->error != 0) {
3542− adsp_err(buf->dsp, "Buffer error occurred: %d\n", buf->error);
3547+ compr_err(buf, "Buffer error occurred: %d\n", buf->error);
35433548 return -EIO;
35443549 }
35453550
@@ -3571,8 +3576,6 @@ int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd) · 25 unmodified lines
35713576 if (ret < 0)
35723577 break;
35733578
3574− wm_adsp_buffer_clear(compr->buf);
3575−
35763579 /* Trigger the IRQ at one fragment of data */
35773580 ret = wm_adsp_buffer_write(compr->buf,
35783581 HOST_BUFFER_FIELD(high_water_mark),
@@ -3584,6 +3587,8 @@ int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd) · 5 unmodified lines
35843587 }
35853588 break;
35863589 case SNDRV_PCM_TRIGGER_STOP:
3590+ if (wm_adsp_compr_attached(compr))
3591+ wm_adsp_buffer_clear(compr->buf);
35873592 break;
35883593 default:
35893594 ret = -EINVAL;
@@ -3917,22 +3922,40 @@ int wm_adsp2_lock(struct wm_adsp *dsp, unsigned int lock_regions) · 327 unmodified lines
39173922 }
39183923 EXPORT_SYMBOL_GPL(wm_adsp2_lock);
39193924
3925+static void wm_adsp_fatal_error(struct wm_adsp *dsp)
3926+{
3927+ struct wm_adsp_compr *compr;
3928+
3929+ dsp->fatal_error = true;
3930+
3931+ list_for_each_entry(compr, &dsp->compr_list, list) {
3932+ if (compr->stream) {
3933+ snd_compr_stop_error(compr->stream,
3934+ SNDRV_PCM_STATE_XRUN);
3935+ snd_compr_fragment_elapsed(compr->stream);
3936+ }
3937+ }
3938+}
3939+
39203940 irqreturn_t wm_adsp2_bus_error(struct wm_adsp *dsp)
39213941 {
39223942 unsigned int val;
39233943 struct regmap *regmap = dsp->regmap;
39243944 int ret = 0;
39253945
3946+ mutex_lock(&dsp->pwr_lock);
3947+
39263948 ret = regmap_read(regmap, dsp->base + ADSP2_LOCK_REGION_CTRL, &val);
39273949 if (ret) {
39283950 adsp_err(dsp,
39293951 "Failed to read Region Lock Ctrl register: %d\n", ret);
3930− return IRQ_HANDLED;
3952+ goto error;
39313953 }
39323954
39333955 if (val & ADSP2_WDT_TIMEOUT_STS_MASK) {
39343956 adsp_err(dsp, "watchdog timeout error\n");
39353957 wm_adsp_stop_watchdog(dsp);
3958+ wm_adsp_fatal_error(dsp);
39363959 }
39373960
39383961 if (val & (ADSP2_SLAVE_ERR_MASK | ADSP2_REGION_LOCK_ERR_MASK)) {
@@ -3946,7 +3969,7 @@ irqreturn_t wm_adsp2_bus_error(struct wm_adsp *dsp) · 7 unmodified lines
39463969 adsp_err(dsp,
39473970 "Failed to read Bus Err Addr register: %d\n",
39483971 ret);
3949− return IRQ_HANDLED;
3972+ goto error;
39503973 }
39513974
39523975 adsp_err(dsp, "bus error address = 0x%x\n",
@@ -3959,7 +3982,7 @@ irqreturn_t wm_adsp2_bus_error(struct wm_adsp *dsp) · 6 unmodified lines
39593982 adsp_err(dsp,
39603983 "Failed to read Pmem Xmem Err Addr register: %d\n",
39613984 ret);
3962− return IRQ_HANDLED;
3985+ goto error;
39633986 }
39643987
39653988 adsp_err(dsp, "xmem error address = 0x%x\n",
@@ -3972,6 +3995,9 @@ irqreturn_t wm_adsp2_bus_error(struct wm_adsp *dsp) · 6 unmodified lines
39723995 regmap_update_bits(regmap, dsp->base + ADSP2_LOCK_REGION_CTRL,
39733996 ADSP2_CTRL_ERR_EINT, ADSP2_CTRL_ERR_EINT);
39743997
3998+error:
3999+ mutex_unlock(&dsp->pwr_lock);
4000+
39754001 return IRQ_HANDLED;
39764002 }
39774003 EXPORT_SYMBOL_GPL(wm_adsp2_bus_error);
sound/soc/codecs/wm_adsp.h+1−0
@@ -85,6 +85,7 @@ struct wm_adsp { · 84 unmodified lines
8585 bool preloaded;
8686 bool booted;
8787 bool running;
88+ bool fatal_error;
8889
8990 struct list_head ctl_list;
9091
sound/soc/fsl/fsl_asrc.c+14−0
@@ -445,6 +445,19 @@ struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair, bool dir) · 444 unmodified lines
445445 }
446446 EXPORT_SYMBOL_GPL(fsl_asrc_get_dma_channel);
447447
448+static int fsl_asrc_dai_startup(struct snd_pcm_substream *substream,
449+ struct snd_soc_dai *dai)
450+{
451+ struct fsl_asrc *asrc_priv = snd_soc_dai_get_drvdata(dai);
452+
453+ /* Odd channel number is not valid for older ASRC (channel_bits==3) */
454+ if (asrc_priv->channel_bits == 3)
455+ snd_pcm_hw_constraint_step(substream->runtime, 0,
456+ SNDRV_PCM_HW_PARAM_CHANNELS, 2);
457+
458+ return 0;
459+}
460+
448461 static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream,
449462 struct snd_pcm_hw_params *params,
450463 struct snd_soc_dai *dai)
@@ -539,6 +552,7 @@ static int fsl_asrc_dai_trigger(struct snd_pcm_substream *substream, int cmd, · 88 unmodified lines
539552 }
540553
541554 static const struct snd_soc_dai_ops fsl_asrc_dai_ops = {
555+ .startup = fsl_asrc_dai_startup,
542556 .hw_params = fsl_asrc_dai_hw_params,
543557 .hw_free = fsl_asrc_dai_hw_free,
544558 .trigger = fsl_asrc_dai_trigger,
sound/soc/fsl/fsl_esai.c+37−10
@@ -54,6 +54,8 @@ struct fsl_esai { · 53 unmodified lines
5454 u32 fifo_depth;
5555 u32 slot_width;
5656 u32 slots;
57+ u32 tx_mask;
58+ u32 rx_mask;
5759 u32 hck_rate[2];
5860 u32 sck_rate[2];
5961 bool hck_dir[2];
@@ -361,21 +363,13 @@ static int fsl_esai_set_dai_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask, · 301 unmodified lines
361363 regmap_update_bits(esai_priv->regmap, REG_ESAI_TCCR,
362364 ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(slots));
363365
364− regmap_update_bits(esai_priv->regmap, REG_ESAI_TSMA,
365− ESAI_xSMA_xS_MASK, ESAI_xSMA_xS(tx_mask));
366− regmap_update_bits(esai_priv->regmap, REG_ESAI_TSMB,
367− ESAI_xSMB_xS_MASK, ESAI_xSMB_xS(tx_mask));
368−
369366 regmap_update_bits(esai_priv->regmap, REG_ESAI_RCCR,
370367 ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(slots));
371368
372− regmap_update_bits(esai_priv->regmap, REG_ESAI_RSMA,
373− ESAI_xSMA_xS_MASK, ESAI_xSMA_xS(rx_mask));
374− regmap_update_bits(esai_priv->regmap, REG_ESAI_RSMB,
375− ESAI_xSMB_xS_MASK, ESAI_xSMB_xS(rx_mask));
376−
377369 esai_priv->slot_width = slot_width;
378370 esai_priv->slots = slots;
371+ esai_priv->tx_mask = tx_mask;
372+ esai_priv->rx_mask = rx_mask;
379373
380374 return 0;
381375 }
@@ -596,6 +590,7 @@ static int fsl_esai_trigger(struct snd_pcm_substream *substream, int cmd, · 214 unmodified lines
596590 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
597591 u8 i, channels = substream->runtime->channels;
598592 u32 pins = DIV_ROUND_UP(channels, esai_priv->slots);
593+ u32 mask;
599594
600595 switch (cmd) {
601596 case SNDRV_PCM_TRIGGER_START:
@@ -608,15 +603,38 @@ static int fsl_esai_trigger(struct snd_pcm_substream *substream, int cmd, · 6 unmodified lines
608603 for (i = 0; tx && i < channels; i++)
609604 regmap_write(esai_priv->regmap, REG_ESAI_ETDR, 0x0);
610605
606+ /*
607+ * When set the TE/RE in the end of enablement flow, there
608+ * will be channel swap issue for multi data line case.
609+ * In order to workaround this issue, we switch the bit
610+ * enablement sequence to below sequence
611+ * 1) clear the xSMB & xSMA: which is done in probe and
612+ * stop state.
613+ * 2) set TE/RE
614+ * 3) set xSMB
615+ * 4) set xSMA: xSMA is the last one in this flow, which
616+ * will trigger esai to start.
617+ */
611618 regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx),
612619 tx ? ESAI_xCR_TE_MASK : ESAI_xCR_RE_MASK,
613620 tx ? ESAI_xCR_TE(pins) : ESAI_xCR_RE(pins));
621+ mask = tx ? esai_priv->tx_mask : esai_priv->rx_mask;
622+
623+ regmap_update_bits(esai_priv->regmap, REG_ESAI_xSMB(tx),
624+ ESAI_xSMB_xS_MASK, ESAI_xSMB_xS(mask));
625+ regmap_update_bits(esai_priv->regmap, REG_ESAI_xSMA(tx),
626+ ESAI_xSMA_xS_MASK, ESAI_xSMA_xS(mask));
627+
614628 break;
615629 case SNDRV_PCM_TRIGGER_SUSPEND:
616630 case SNDRV_PCM_TRIGGER_STOP:
617631 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
618632 regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx),
619633 tx ? ESAI_xCR_TE_MASK : ESAI_xCR_RE_MASK, 0);
634+ regmap_update_bits(esai_priv->regmap, REG_ESAI_xSMA(tx),
635+ ESAI_xSMA_xS_MASK, 0);
636+ regmap_update_bits(esai_priv->regmap, REG_ESAI_xSMB(tx),
637+ ESAI_xSMB_xS_MASK, 0);
620638
621639 /* Disable and reset FIFO */
622640 regmap_update_bits(esai_priv->regmap, REG_ESAI_xFCR(tx),
@@ -906,6 +924,15 @@ static int fsl_esai_probe(struct platform_device *pdev) · 283 unmodified lines
906924 return ret;
907925 }
908926
927+ esai_priv->tx_mask = 0xFFFFFFFF;
928+ esai_priv->rx_mask = 0xFFFFFFFF;
929+
930+ /* Clear the TSMA, TSMB, RSMA, RSMB */
931+ regmap_write(esai_priv->regmap, REG_ESAI_TSMA, 0);
932+ regmap_write(esai_priv->regmap, REG_ESAI_TSMB, 0);
933+ regmap_write(esai_priv->regmap, REG_ESAI_RSMA, 0);
934+ regmap_write(esai_priv->regmap, REG_ESAI_RSMB, 0);
935+
909936 ret = devm_snd_soc_register_component(&pdev->dev, &fsl_esai_component,
910937 &fsl_esai_dai, 1);
911938 if (ret) {
sound/soc/generic/audio-graph-card.c+8−3
@@ -20,6 +20,8 @@ · 19 unmodified lines
2020 #include <linux/string.h>
2121 #include <sound/simple_card_utils.h>
2222
23+#define DPCM_SELECTABLE 1
24+
2325 struct graph_priv {
2426 struct snd_soc_card snd_card;
2527 struct graph_dai_props {
@@ -440,6 +442,7 @@ static int graph_for_each_link(struct graph_priv *priv, · 414 unmodified lines
440442 struct device_node *codec_port;
441443 struct device_node *codec_port_old = NULL;
442444 struct asoc_simple_card_data adata;
445+ uintptr_t dpcm_selectable = (uintptr_t)of_device_get_match_data(dev);
443446 int rc, ret;
444447
445448 /* loop for all listed CPU port */
@@ -470,8 +473,9 @@ static int graph_for_each_link(struct graph_priv *priv, · 24 unmodified lines
470473 * if Codec port has many endpoints,
471474 * or has convert-xxx property
472475 */
473− if ((of_get_child_count(codec_port) > 1) ||
474− adata.convert_rate || adata.convert_channels)
476+ if (dpcm_selectable &&
477+ ((of_get_child_count(codec_port) > 1) ||
478+ adata.convert_rate || adata.convert_channels))
475479 ret = func_dpcm(priv, cpu_ep, codec_ep, li,
476480 (codec_port_old == codec_port));
477481 /* else normal sound */
@@ -732,7 +736,8 @@ static int graph_remove(struct platform_device *pdev) · 254 unmodified lines
732736
733737 static const struct of_device_id graph_of_match[] = {
734738 { .compatible = "audio-graph-card", },
735− { .compatible = "audio-graph-scu-card", },
739+ { .compatible = "audio-graph-scu-card",
740+ .data = (void *)DPCM_SELECTABLE },
736741 {},
737742 };
738743 MODULE_DEVICE_TABLE(of, graph_of_match);
sound/soc/generic/simple-card.c+9−3
@@ -9,12 +9,15 @@ · 8 unmodified lines
99 #include <linux/device.h>
1010 #include <linux/module.h>
1111 #include <linux/of.h>
12+#include <linux/of_device.h>
1213 #include <linux/platform_device.h>
1314 #include <linux/string.h>
1415 #include <sound/simple_card.h>
1516 #include <sound/soc-dai.h>
1617 #include <sound/soc.h>
1718
19+#define DPCM_SELECTABLE 1
20+
1821 struct simple_priv {
1922 struct snd_soc_card snd_card;
2023 struct simple_dai_props {
@@ -441,6 +444,7 @@ static int simple_for_each_link(struct simple_priv *priv, · 420 unmodified lines
441444 struct device *dev = simple_priv_to_dev(priv);
442445 struct device_node *top = dev->of_node;
443446 struct device_node *node;
447+ uintptr_t dpcm_selectable = (uintptr_t)of_device_get_match_data(dev);
444448 bool is_top = 0;
445449 int ret = 0;
446450
@@ -480,8 +484,9 @@ static int simple_for_each_link(struct simple_priv *priv, · 33 unmodified lines
480484 * if it has many CPUs,
481485 * or has convert-xxx property
482486 */
483− if (num > 2 ||
484− adata.convert_rate || adata.convert_channels)
487+ if (dpcm_selectable &&
488+ (num > 2 ||
489+ adata.convert_rate || adata.convert_channels))
485490 ret = func_dpcm(priv, np, codec, li, is_top);
486491 /* else normal sound */
487492 else
@@ -822,7 +827,8 @@ static int simple_remove(struct platform_device *pdev) · 334 unmodified lines
822827
823828 static const struct of_device_id simple_of_match[] = {
824829 { .compatible = "simple-audio-card", },
825− { .compatible = "simple-scu-audio-card", },
830+ { .compatible = "simple-scu-audio-card",
831+ .data = (void *)DPCM_SELECTABLE },
826832 {},
827833 };
828834 MODULE_DEVICE_TABLE(of, simple_of_match);
sound/soc/intel/atom/sst-mfld-platform-pcm.c+8−0
@@ -706,9 +706,17 @@ static int sst_soc_probe(struct snd_soc_component *component) · 705 unmodified lines
706706 return sst_dsp_init_v2_dpcm(component);
707707 }
708708
709+static void sst_soc_remove(struct snd_soc_component *component)
710+{
711+ struct sst_data *drv = dev_get_drvdata(component->dev);
712+
713+ drv->soc_card = NULL;
714+}
715+
709716 static const struct snd_soc_component_driver sst_soc_platform_drv = {
710717 .name = DRV_NAME,
711718 .probe = sst_soc_probe,
719+ .remove = sst_soc_remove,
712720 .ops = &sst_platform_ops,
713721 .compr_ops = &sst_platform_compr_ops,
714722 .pcm_new = sst_pcm_new,
sound/soc/intel/boards/cht_bsw_max98090_ti.c+41−6
@@ -43,6 +43,7 @@ struct cht_mc_private { · 42 unmodified lines
4343 struct clk *mclk;
4444 struct snd_soc_jack jack;
4545 bool ts3a227e_present;
46+ int quirks;
4647 };
4748
4849 static int platform_clock_control(struct snd_soc_dapm_widget *w,
@@ -54,6 +55,10 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w, · 5 unmodified lines
5455 struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
5556 int ret;
5657
58+ /* See the comment in snd_cht_mc_probe() */
59+ if (ctx->quirks & QUIRK_PMC_PLT_CLK_0)
60+ return 0;
61+
5762 codec_dai = snd_soc_card_get_codec_dai(card, CHT_CODEC_DAI);
5863 if (!codec_dai) {
5964 dev_err(card->dev, "Codec dai not found; Unable to set platform clock\n");
@@ -223,6 +228,10 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) · 163 unmodified lines
223228 "jack detection gpios not added, error %d\n", ret);
224229 }
225230
231+ /* See the comment in snd_cht_mc_probe() */
232+ if (ctx->quirks & QUIRK_PMC_PLT_CLK_0)
233+ return 0;
234+
226235 /*
227236 * The firmware might enable the clock at
228237 * boot (this information may or may not
@@ -423,16 +432,15 @@ static int snd_cht_mc_probe(struct platform_device *pdev) · 194 unmodified lines
423432 const char *mclk_name;
424433 struct snd_soc_acpi_mach *mach;
425434 const char *platform_name;
426− int quirks = 0;
427−
428− dmi_id = dmi_first_match(cht_max98090_quirk_table);
429− if (dmi_id)
430− quirks = (unsigned long)dmi_id->driver_data;
431435
432436 drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
433437 if (!drv)
434438 return -ENOMEM;
435439
440+ dmi_id = dmi_first_match(cht_max98090_quirk_table);
441+ if (dmi_id)
442+ drv->quirks = (unsigned long)dmi_id->driver_data;
443+
436444 drv->ts3a227e_present = acpi_dev_found("104C227E");
437445 if (!drv->ts3a227e_present) {
438446 /* no need probe TI jack detection chip */
@@ -458,7 +466,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev) · 19 unmodified lines
458466 snd_soc_card_cht.dev = &pdev->dev;
459467 snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
460468
461− if (quirks & QUIRK_PMC_PLT_CLK_0)
469+ if (drv->quirks & QUIRK_PMC_PLT_CLK_0)
462470 mclk_name = "pmc_plt_clk_0";
463471 else
464472 mclk_name = "pmc_plt_clk_3";
@@ -471,6 +479,21 @@ static int snd_cht_mc_probe(struct platform_device *pdev) · 6 unmodified lines
471479 return PTR_ERR(drv->mclk);
472480 }
473481
482+ /*
483+ * Boards which have the MAX98090's clk connected to clk_0 do not seem
484+ * to like it if we muck with the clock. If we disable the clock when
485+ * it is unused we get "max98090 i2c-193C9890:00: PLL unlocked" errors
486+ * and the PLL never seems to lock again.
487+ * So for these boards we enable it here once and leave it at that.
488+ */
489+ if (drv->quirks & QUIRK_PMC_PLT_CLK_0) {
490+ ret_val = clk_prepare_enable(drv->mclk);
491+ if (ret_val < 0) {
492+ dev_err(&pdev->dev, "MCLK enable error: %d\n", ret_val);
493+ return ret_val;
494+ }
495+ }
496+
474497 ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
475498 if (ret_val) {
476499 dev_err(&pdev->dev,
@@ -481,11 +504,23 @@ static int snd_cht_mc_probe(struct platform_device *pdev) · 4 unmodified lines
481504 return ret_val;
482505 }
483506
507+static int snd_cht_mc_remove(struct platform_device *pdev)
508+{
509+ struct snd_soc_card *card = platform_get_drvdata(pdev);
510+ struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
511+
512+ if (ctx->quirks & QUIRK_PMC_PLT_CLK_0)
513+ clk_disable_unprepare(ctx->mclk);
514+
515+ return 0;
516+}
517+
484518 static struct platform_driver snd_cht_mc_driver = {
485519 .driver = {
486520 .name = "cht-bsw-max98090",
487521 },
488522 .probe = snd_cht_mc_probe,
523+ .remove = snd_cht_mc_remove,
489524 };
490525
491526 module_platform_driver(snd_cht_mc_driver)
sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c+1−1
@@ -405,7 +405,7 @@ static const struct snd_pcm_hw_constraint_list constraints_dmic_channels = { · 404 unmodified lines
405405 };
406406
407407 static const unsigned int dmic_2ch[] = {
408− 4,
408+ 2,
409409 };
410410
411411 static const struct snd_pcm_hw_constraint_list constraints_dmic_2ch = {
sound/soc/intel/skylake/skl-messages.c+1−0
@@ -483,6 +483,7 @@ static void skl_set_base_module_format(struct skl_sst *ctx, · 482 unmodified lines
483483 base_cfg->audio_fmt.bit_depth = format->bit_depth;
484484 base_cfg->audio_fmt.valid_bit_depth = format->valid_bit_depth;
485485 base_cfg->audio_fmt.ch_cfg = format->ch_cfg;
486+ base_cfg->audio_fmt.sample_type = format->sample_type;
486487
487488 dev_dbg(ctx->dev, "bit_depth=%x valid_bd=%x ch_config=%x\n",
488489 format->bit_depth, format->valid_bit_depth,
sound/soc/intel/skylake/skl-pcm.c+22−6
@@ -181,6 +181,7 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params) · 180 unmodified lines
181181 struct hdac_stream *hstream;
182182 struct hdac_ext_stream *stream;
183183 struct hdac_ext_link *link;
184+ unsigned char stream_tag;
184185
185186 hstream = snd_hdac_get_stream(bus, params->stream,
186187 params->link_dma_id + 1);
@@ -199,10 +200,13 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params) · 12 unmodified lines
199200
200201 snd_hdac_ext_link_stream_setup(stream, format_val);
201202
202− list_for_each_entry(link, &bus->hlink_list, list) {
203− if (link->index == params->link_index)
204− snd_hdac_ext_link_set_stream_id(link,
205− hstream->stream_tag);
203+ stream_tag = hstream->stream_tag;
204+ if (stream->hstream.direction == SNDRV_PCM_STREAM_PLAYBACK) {
205+ list_for_each_entry(link, &bus->hlink_list, list) {
206+ if (link->index == params->link_index)
207+ snd_hdac_ext_link_set_stream_id(link,
208+ stream_tag);
209+ }
206210 }
207211
208212 stream->link_prepared = 1;
@@ -645,6 +649,7 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream, · 436 unmodified lines
645649 struct hdac_ext_stream *link_dev =
646650 snd_soc_dai_get_dma_data(dai, substream);
647651 struct hdac_ext_link *link;
652+ unsigned char stream_tag;
648653
649654 dev_dbg(dai->dev, "%s: %s\n", __func__, dai->name);
650655
@@ -654,7 +659,11 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream, · 3 unmodified lines
654659 if (!link)
655660 return -EINVAL;
656661
657− snd_hdac_ext_link_clear_stream_id(link, hdac_stream(link_dev)->stream_tag);
662+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
663+ stream_tag = hdac_stream(link_dev)->stream_tag;
664+ snd_hdac_ext_link_clear_stream_id(link, stream_tag);
665+ }
666+
658667 snd_hdac_ext_stream_release(link_dev, HDAC_EXT_STREAM_TYPE_LINK);
659668 return 0;
660669 }
@@ -1453,13 +1462,20 @@ static int skl_platform_soc_probe(struct snd_soc_component *component) · 792 unmodified lines
14531462 return 0;
14541463 }
14551464
1465+static void skl_pcm_remove(struct snd_soc_component *component)
1466+{
1467+ /* remove topology */
1468+ snd_soc_tplg_component_remove(component, SND_SOC_TPLG_INDEX_ALL);
1469+}
1470+
14561471 static const struct snd_soc_component_driver skl_component = {
14571472 .name = "pcm",
14581473 .probe = skl_platform_soc_probe,
1474+ .remove = skl_pcm_remove,
14591475 .ops = &skl_platform_ops,
14601476 .pcm_new = skl_pcm_new,
14611477 .pcm_free = skl_pcm_free,
1462− .ignore_module_refcount = 1, /* do not increase the refcount in core */
1478+ .module_get_upon_open = 1, /* increment refcount when a pcm is opened */
14631479 };
14641480
14651481 int skl_platform_register(struct device *dev)
sound/soc/mediatek/common/mtk-btcvsd.c+68−1
@@ -49,6 +49,7 @@ enum bt_sco_state { · 48 unmodified lines
4949 BT_SCO_STATE_IDLE,
5050 BT_SCO_STATE_RUNNING,
5151 BT_SCO_STATE_ENDING,
52+ BT_SCO_STATE_LOOPBACK,
5253 };
5354
5455 enum bt_sco_direct {
@@ -486,7 +487,8 @@ static irqreturn_t mtk_btcvsd_snd_irq_handler(int irq_id, void *dev) · 431 unmodified lines
486487 if (bt->rx->state != BT_SCO_STATE_RUNNING &&
487488 bt->rx->state != BT_SCO_STATE_ENDING &&
488489 bt->tx->state != BT_SCO_STATE_RUNNING &&
489− bt->tx->state != BT_SCO_STATE_ENDING) {
490+ bt->tx->state != BT_SCO_STATE_ENDING &&
491+ bt->tx->state != BT_SCO_STATE_LOOPBACK) {
490492 dev_warn(bt->dev, "%s(), in idle state: rx->state: %d, tx->state: %d\n",
491493 __func__, bt->rx->state, bt->tx->state);
492494 goto irq_handler_exit;
@@ -512,6 +514,42 @@ static irqreturn_t mtk_btcvsd_snd_irq_handler(int irq_id, void *dev) · 19 unmodified lines
512514 buf_cnt_tx = btsco_packet_info[packet_type][2];
513515 buf_cnt_rx = btsco_packet_info[packet_type][3];
514516
517+ if (bt->tx->state == BT_SCO_STATE_LOOPBACK) {
518+ u8 *src, *dst;
519+ unsigned long connsys_addr_rx, ap_addr_rx;
520+ unsigned long connsys_addr_tx, ap_addr_tx;
521+
522+ connsys_addr_rx = *bt->bt_reg_pkt_r;
523+ ap_addr_rx = (unsigned long)bt->bt_sram_bank2_base +
524+ (connsys_addr_rx & 0xFFFF);
525+
526+ connsys_addr_tx = *bt->bt_reg_pkt_w;
527+ ap_addr_tx = (unsigned long)bt->bt_sram_bank2_base +
528+ (connsys_addr_tx & 0xFFFF);
529+
530+ if (connsys_addr_tx == 0xdeadfeed ||
531+ connsys_addr_rx == 0xdeadfeed) {
532+ /* bt return 0xdeadfeed if read reg during bt sleep */
533+ dev_warn(bt->dev, "%s(), connsys_addr_tx == 0xdeadfeed\n",
534+ __func__);
535+ goto irq_handler_exit;
536+ }
537+
538+ src = (u8 *)ap_addr_rx;
539+ dst = (u8 *)ap_addr_tx;
540+
541+ mtk_btcvsd_snd_data_transfer(BT_SCO_DIRECT_BT2ARM, src,
542+ bt->tx->temp_packet_buf,
543+ packet_length,
544+ packet_num);
545+ mtk_btcvsd_snd_data_transfer(BT_SCO_DIRECT_ARM2BT,
546+ bt->tx->temp_packet_buf, dst,
547+ packet_length,
548+ packet_num);
549+ bt->rx->rw_cnt++;
550+ bt->tx->rw_cnt++;
551+ }
552+
515553 if (bt->rx->state == BT_SCO_STATE_RUNNING ||
516554 bt->rx->state == BT_SCO_STATE_ENDING) {
517555 if (bt->rx->xrun) {
@@ -1067,6 +1105,33 @@ static int btcvsd_band_set(struct snd_kcontrol *kcontrol, · 549 unmodified lines
10671105 return 0;
10681106 }
10691107
1108+static int btcvsd_loopback_get(struct snd_kcontrol *kcontrol,
1109+ struct snd_ctl_elem_value *ucontrol)
1110+{
1111+ struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
1112+ struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(cmpnt);
1113+ bool lpbk_en = bt->tx->state == BT_SCO_STATE_LOOPBACK;
1114+
1115+ ucontrol->value.integer.value[0] = lpbk_en;
1116+ return 0;
1117+}
1118+
1119+static int btcvsd_loopback_set(struct snd_kcontrol *kcontrol,
1120+ struct snd_ctl_elem_value *ucontrol)
1121+{
1122+ struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
1123+ struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(cmpnt);
1124+
1125+ if (ucontrol->value.integer.value[0]) {
1126+ mtk_btcvsd_snd_set_state(bt, bt->tx, BT_SCO_STATE_LOOPBACK);
1127+ mtk_btcvsd_snd_set_state(bt, bt->rx, BT_SCO_STATE_LOOPBACK);
1128+ } else {
1129+ mtk_btcvsd_snd_set_state(bt, bt->tx, BT_SCO_STATE_RUNNING);
1130+ mtk_btcvsd_snd_set_state(bt, bt->rx, BT_SCO_STATE_RUNNING);
1131+ }
1132+ return 0;
1133+}
1134+
10701135 static int btcvsd_tx_mute_get(struct snd_kcontrol *kcontrol,
10711136 struct snd_ctl_elem_value *ucontrol)
10721137 {
@@ -1202,6 +1267,8 @@ static int btcvsd_tx_timestamp_get(struct snd_kcontrol *kcontrol, · 129 unmodified lines
12021267 static const struct snd_kcontrol_new mtk_btcvsd_snd_controls[] = {
12031268 SOC_ENUM_EXT("BTCVSD Band", btcvsd_enum[0],
12041269 btcvsd_band_get, btcvsd_band_set),
1270+ SOC_SINGLE_BOOL_EXT("BTCVSD Loopback Switch", 0,
1271+ btcvsd_loopback_get, btcvsd_loopback_set),
12051272 SOC_SINGLE_BOOL_EXT("BTCVSD Tx Mute Switch", 0,
12061273 btcvsd_tx_mute_get, btcvsd_tx_mute_set),
12071274 SOC_SINGLE_BOOL_EXT("BTCVSD Tx Irq Received Switch", 0,
sound/soc/mediatek/mt8183/mt8183-afe-clk.c+4−0
@@ -605,6 +605,10 @@ void mt8183_mck_disable(struct mtk_base_afe *afe, int mck_id) · 604 unmodified lines
605605 int m_sel_id = mck_div[mck_id].m_sel_id;
606606 int div_clk_id = mck_div[mck_id].div_clk_id;
607607
608+ /* i2s5 mck not support */
609+ if (mck_id == MT8183_I2S5_MCK)
610+ return;
611+
608612 clk_disable_unprepare(afe_priv->clk[div_clk_id]);
609613 if (m_sel_id >= 0)
610614 clk_disable_unprepare(afe_priv->clk[m_sel_id]);
sound/soc/rockchip/rockchip_pdm.c+3−1
@@ -24,7 +24,7 @@ · 23 unmodified lines
2424
2525 #include "rockchip_pdm.h"
2626
27−#define PDM_DMA_BURST_SIZE (16) /* size * width: 16*4 = 64 bytes */
27+#define PDM_DMA_BURST_SIZE (8) /* size * width: 8*4 = 32 bytes */
2828
2929 struct rk_pdm_dev {
3030 struct device *dev;
@@ -208,7 +208,9 @@ static int rockchip_pdm_set_fmt(struct snd_soc_dai *cpu_dai, · 177 unmodified lines
208208 return -EINVAL;
209209 }
210210
211+ pm_runtime_get_sync(cpu_dai->dev);
211212 regmap_update_bits(pdm->regmap, PDM_CLK_CTRL, mask, val);
213+ pm_runtime_put(cpu_dai->dev);
212214
213215 return 0;
214216 }
sound/soc/samsung/i2s.c+6−4
@@ -1130,11 +1130,11 @@ static const struct snd_soc_dapm_widget samsung_i2s_widgets[] = { · 1129 unmodified lines
11301130 };
11311131
11321132 static const struct snd_soc_dapm_route samsung_i2s_dapm_routes[] = {
1133− { "Playback Mixer", NULL, "Primary" },
1134− { "Playback Mixer", NULL, "Secondary" },
1133+ { "Playback Mixer", NULL, "Primary Playback" },
1134+ { "Playback Mixer", NULL, "Secondary Playback" },
11351135
11361136 { "Mixer DAI TX", NULL, "Playback Mixer" },
1137− { "Playback Mixer", NULL, "Mixer DAI RX" },
1137+ { "Primary Capture", NULL, "Mixer DAI RX" },
11381138 };
11391139
11401140 static const struct snd_soc_component_driver samsung_i2s_component = {
@@ -1155,7 +1155,8 @@ static int i2s_alloc_dais(struct samsung_i2s_priv *priv, · 14 unmodified lines
11551155 int num_dais)
11561156 {
11571157 static const char *dai_names[] = { "samsung-i2s", "samsung-i2s-sec" };
1158− static const char *stream_names[] = { "Primary", "Secondary" };
1158+ static const char *stream_names[] = { "Primary Playback",
1159+ "Secondary Playback" };
11591160 struct snd_soc_dai_driver *dai_drv;
11601161 struct i2s_dai *dai;
11611162 int i;
@@ -1201,6 +1202,7 @@ static int i2s_alloc_dais(struct samsung_i2s_priv *priv, · 39 unmodified lines
12011202 dai_drv->capture.channels_max = 2;
12021203 dai_drv->capture.rates = i2s_dai_data->pcm_rates;
12031204 dai_drv->capture.formats = SAMSUNG_I2S_FMTS;
1205+ dai_drv->capture.stream_name = "Primary Capture";
12041206
12051207 return 0;
12061208 }
sound/soc/samsung/odroid.c+2−2
@@ -91,11 +91,11 @@ static int odroid_card_be_hw_params(struct snd_pcm_substream *substream, · 90 unmodified lines
9191 return ret;
9292
9393 /*
94− * We add 1 to the rclk_freq value in order to avoid too low clock
94+ * We add 2 to the rclk_freq value in order to avoid too low clock
9595 * frequency values due to the EPLL output frequency not being exact
9696 * multiple of the audio sampling rate.
9797 */
98− rclk_freq = params_rate(params) * rfs + 1;
98+ rclk_freq = params_rate(params) * rfs + 2;
9999
100100 ret = clk_set_rate(priv->sclk_i2s, rclk_freq);
101101 if (ret < 0)
sound/soc/sh/rcar/core.c+2−0
@@ -110,6 +110,8 @@ static const struct of_device_id rsnd_of_match[] = { · 109 unmodified lines
110110 { .compatible = "renesas,rcar_sound-gen1", .data = (void *)RSND_GEN1 },
111111 { .compatible = "renesas,rcar_sound-gen2", .data = (void *)RSND_GEN2 },
112112 { .compatible = "renesas,rcar_sound-gen3", .data = (void *)RSND_GEN3 },
113+ /* Special Handling */
114+ { .compatible = "renesas,rcar_sound-r8a77990", .data = (void *)(RSND_GEN3 | RSND_SOC_E) },
113115 {},
114116 };
115117 MODULE_DEVICE_TABLE(of, rsnd_of_match);
sound/soc/sh/rcar/rsnd.h+5−0
@@ -607,6 +607,8 @@ struct rsnd_priv { · 606 unmodified lines
607607 #define RSND_GEN1 (1 << 0)
608608 #define RSND_GEN2 (2 << 0)
609609 #define RSND_GEN3 (3 << 0)
610+#define RSND_SOC_MASK (0xFF << 4)
611+#define RSND_SOC_E (1 << 4) /* E1/E2/E3 */
610612
611613 /*
612614 * below value will be filled on rsnd_gen_probe()
@@ -679,6 +681,9 @@ struct rsnd_priv { · 66 unmodified lines
679681 #define rsnd_is_gen1(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN1)
680682 #define rsnd_is_gen2(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN2)
681683 #define rsnd_is_gen3(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN3)
684+#define rsnd_is_e3(priv) (((priv)->flags & \
685+ (RSND_GEN_MASK | RSND_SOC_MASK)) == \
686+ (RSND_GEN3 | RSND_SOC_E))
682687
683688 #define rsnd_flags_has(p, f) ((p)->flags & (f))
684689 #define rsnd_flags_set(p, f) ((p)->flags |= (f))
sound/soc/sh/rcar/src.c+7−14
@@ -14,7 +14,6 @@ · 13 unmodified lines
1414 */
1515
1616 #include "rsnd.h"
17−#include <linux/sys_soc.h>
1817
1918 #define SRC_NAME "src"
2019
@@ -135,7 +134,7 @@ unsigned int rsnd_src_get_rate(struct rsnd_priv *priv, · 114 unmodified lines
135134 return rate;
136135 }
137136
138−const static u32 bsdsr_table_pattern1[] = {
137+static const u32 bsdsr_table_pattern1[] = {
139138 0x01800000, /* 6 - 1/6 */
140139 0x01000000, /* 6 - 1/4 */
141140 0x00c00000, /* 6 - 1/3 */
@@ -144,7 +143,7 @@ const static u32 bsdsr_table_pattern1[] = { · 2 unmodified lines
144143 0x00400000, /* 6 - 1 */
145144 };
146145
147−const static u32 bsdsr_table_pattern2[] = {
146+static const u32 bsdsr_table_pattern2[] = {
148147 0x02400000, /* 6 - 1/6 */
149148 0x01800000, /* 6 - 1/4 */
150149 0x01200000, /* 6 - 1/3 */
@@ -153,7 +152,7 @@ const static u32 bsdsr_table_pattern2[] = { · 2 unmodified lines
153152 0x00600000, /* 6 - 1 */
154153 };
155154
156−const static u32 bsisr_table[] = {
155+static const u32 bsisr_table[] = {
157156 0x00100060, /* 6 - 1/6 */
158157 0x00100040, /* 6 - 1/4 */
159158 0x00100030, /* 6 - 1/3 */
@@ -162,7 +161,7 @@ const static u32 bsisr_table[] = { · 2 unmodified lines
162161 0x00100020, /* 6 - 1 */
163162 };
164163
165−const static u32 chan288888[] = {
164+static const u32 chan288888[] = {
166165 0x00000006, /* 1 to 2 */
167166 0x000001fe, /* 1 to 8 */
168167 0x000001fe, /* 1 to 8 */
@@ -171,7 +170,7 @@ const static u32 chan288888[] = { · 2 unmodified lines
171170 0x000001fe, /* 1 to 8 */
172171 };
173172
174−const static u32 chan244888[] = {
173+static const u32 chan244888[] = {
175174 0x00000006, /* 1 to 2 */
176175 0x0000001e, /* 1 to 4 */
177176 0x0000001e, /* 1 to 4 */
@@ -180,7 +179,7 @@ const static u32 chan244888[] = { · 2 unmodified lines
180179 0x000001fe, /* 1 to 8 */
181180 };
182181
183−const static u32 chan222222[] = {
182+static const u32 chan222222[] = {
184183 0x00000006, /* 1 to 2 */
185184 0x00000006, /* 1 to 2 */
186185 0x00000006, /* 1 to 2 */
@@ -189,18 +188,12 @@ const static u32 chan222222[] = { · 2 unmodified lines
189188 0x00000006, /* 1 to 2 */
190189 };
191190
192−static const struct soc_device_attribute ov_soc[] = {
193− { .soc_id = "r8a77990" }, /* E3 */
194− { /* sentinel */ }
195−};
196−
197191 static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io,
198192 struct rsnd_mod *mod)
199193 {
200194 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
201195 struct device *dev = rsnd_priv_to_dev(priv);
202196 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
203− const struct soc_device_attribute *soc = soc_device_match(ov_soc);
204197 int is_play = rsnd_io_is_play(io);
205198 int use_src = 0;
206199 u32 fin, fout;
@@ -307,7 +300,7 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io, · 100 unmodified lines
307300 /*
308301 * E3 need to overwrite
309302 */
310− if (soc)
303+ if (rsnd_is_e3(priv))
311304 switch (rsnd_mod_id(mod)) {
312305 case 0:
313306 case 4:
sound/soc/soc-core.c+4−2
@@ -947,7 +947,7 @@ static void soc_cleanup_component(struct snd_soc_component *component) · 946 unmodified lines
947947 snd_soc_dapm_free(snd_soc_component_get_dapm(component));
948948 soc_cleanup_component_debugfs(component);
949949 component->card = NULL;
950− if (!component->driver->ignore_module_refcount)
950+ if (!component->driver->module_get_upon_open)
951951 module_put(component->dev->driver->owner);
952952 }
953953
@@ -1381,7 +1381,7 @@ static int soc_probe_component(struct snd_soc_card *card, · 427 unmodified lines
13811381 return 0;
13821382 }
13831383
1384− if (!component->driver->ignore_module_refcount &&
1384+ if (!component->driver->module_get_upon_open &&
13851385 !try_module_get(component->dev->driver->owner))
13861386 return -ENODEV;
13871387
@@ -2797,6 +2797,7 @@ int snd_soc_register_card(struct snd_soc_card *card) · 1409 unmodified lines
27972797
27982798 ret = soc_init_dai_link(card, link);
27992799 if (ret) {
2800+ soc_cleanup_platform(card);
28002801 dev_err(card->dev, "ASoC: failed to init link %s\n",
28012802 link->name);
28022803 mutex_unlock(&client_mutex);
@@ -2819,6 +2820,7 @@ int snd_soc_register_card(struct snd_soc_card *card) · 16 unmodified lines
28192820 card->instantiated = 0;
28202821 mutex_init(&card->mutex);
28212822 mutex_init(&card->dapm_mutex);
2823+ spin_lock_init(&card->dpcm_lock);
28222824
28232825 return snd_soc_bind_card(card);
28242826 }
sound/soc/soc-dapm.c+11−0
@@ -3650,6 +3650,13 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, · 3649 unmodified lines
36503650 case snd_soc_dapm_dac:
36513651 case snd_soc_dapm_aif_in:
36523652 case snd_soc_dapm_pga:
3653+ case snd_soc_dapm_buffer:
3654+ case snd_soc_dapm_scheduler:
3655+ case snd_soc_dapm_effect:
3656+ case snd_soc_dapm_src:
3657+ case snd_soc_dapm_asrc:
3658+ case snd_soc_dapm_encoder:
3659+ case snd_soc_dapm_decoder:
36533660 case snd_soc_dapm_out_drv:
36543661 case snd_soc_dapm_micbias:
36553662 case snd_soc_dapm_line:
@@ -3957,6 +3964,10 @@ snd_soc_dapm_free_kcontrol(struct snd_soc_card *card, · 301 unmodified lines
39573964 int count;
39583965
39593966 devm_kfree(card->dev, (void *)*private_value);
3967+
3968+ if (!w_param_text)
3969+ return;
3970+
39603971 for (count = 0 ; count < num_params; count++)
39613972 devm_kfree(card->dev, (void *)w_param_text[count]);
39623973 devm_kfree(card->dev, w_param_text);
sound/soc/soc-pcm.c+55−11
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <linux/delay.h>
1616 #include <linux/pinctrl/consumer.h>
1717 #include <linux/pm_runtime.h>
18+#include <linux/module.h>
1819 #include <linux/slab.h>
1920 #include <linux/workqueue.h>
2021 #include <linux/export.h>
@@ -463,6 +464,9 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream, · 442 unmodified lines
463464 continue;
464465
465466 component->driver->ops->close(substream);
467+
468+ if (component->driver->module_get_upon_open)
469+ module_put(component->dev->driver->owner);
466470 }
467471
468472 return 0;
@@ -513,6 +517,12 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) · 44 unmodified lines
513517 !component->driver->ops->open)
514518 continue;
515519
520+ if (component->driver->module_get_upon_open &&
521+ !try_module_get(component->dev->driver->owner)) {
522+ ret = -ENODEV;
523+ goto module_err;
524+ }
525+
516526 ret = component->driver->ops->open(substream);
517527 if (ret < 0) {
518528 dev_err(component->dev,
@@ -628,7 +638,7 @@ codec_dai_err: · 109 unmodified lines
628638
629639 component_err:
630640 soc_pcm_components_close(substream, component);
631−
641+module_err:
632642 if (cpu_dai->driver->ops->shutdown)
633643 cpu_dai->driver->ops->shutdown(substream, cpu_dai);
634644 out:
@@ -954,10 +964,13 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, · 319 unmodified lines
954964 codec_params = *params;
955965
956966 /* fixup params based on TDM slot masks */
957− if (codec_dai->tx_mask)
967+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
968+ codec_dai->tx_mask)
958969 soc_pcm_codec_params_fixup(&codec_params,
959970 codec_dai->tx_mask);
960− if (codec_dai->rx_mask)
971+
972+ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
973+ codec_dai->rx_mask)
961974 soc_pcm_codec_params_fixup(&codec_params,
962975 codec_dai->rx_mask);
963976
@@ -1213,6 +1226,7 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, · 249 unmodified lines
12131226 struct snd_soc_pcm_runtime *be, int stream)
12141227 {
12151228 struct snd_soc_dpcm *dpcm;
1229+ unsigned long flags;
12161230
12171231 /* only add new dpcms */
12181232 for_each_dpcm_be(fe, stream, dpcm) {
@@ -1228,8 +1242,10 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, · 9 unmodified lines
12281242 dpcm->fe = fe;
12291243 be->dpcm[stream].runtime = fe->dpcm[stream].runtime;
12301244 dpcm->state = SND_SOC_DPCM_LINK_STATE_NEW;
1245+ spin_lock_irqsave(&fe->card->dpcm_lock, flags);
12311246 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients);
12321247 list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients);
1248+ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
12331249
12341250 dev_dbg(fe->dev, "connected new DPCM %s path %s %s %s\n",
12351251 stream ? "capture" : "playback", fe->dai_link->name,
@@ -1275,6 +1291,7 @@ static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe, · 39 unmodified lines
12751291 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream)
12761292 {
12771293 struct snd_soc_dpcm *dpcm, *d;
1294+ unsigned long flags;
12781295
12791296 for_each_dpcm_be_safe(fe, stream, dpcm, d) {
12801297 dev_dbg(fe->dev, "ASoC: BE %s disconnect check for %s\n",
@@ -1294,8 +1311,10 @@ void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) · 13 unmodified lines
12941311 #ifdef CONFIG_DEBUG_FS
12951312 debugfs_remove(dpcm->debugfs_state);
12961313 #endif
1314+ spin_lock_irqsave(&fe->card->dpcm_lock, flags);
12971315 list_del(&dpcm->list_be);
12981316 list_del(&dpcm->list_fe);
1317+ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
12991318 kfree(dpcm);
13001319 }
13011320 }
@@ -1547,10 +1566,13 @@ int dpcm_process_paths(struct snd_soc_pcm_runtime *fe, · 245 unmodified lines
15471566 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream)
15481567 {
15491568 struct snd_soc_dpcm *dpcm;
1569+ unsigned long flags;
15501570
1571+ spin_lock_irqsave(&fe->card->dpcm_lock, flags);
15511572 for_each_dpcm_be(fe, stream, dpcm)
15521573 dpcm->be->dpcm[stream].runtime_update =
15531574 SND_SOC_DPCM_UPDATE_NO;
1575+ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
15541576 }
15551577
15561578 static void dpcm_be_dai_startup_unwind(struct snd_soc_pcm_runtime *fe,
@@ -1899,10 +1921,15 @@ static int dpcm_apply_symmetry(struct snd_pcm_substream *fe_substream, · 342 unmodified lines
18991921 struct snd_soc_pcm_runtime *be = dpcm->be;
19001922 struct snd_pcm_substream *be_substream =
19011923 snd_soc_dpcm_get_substream(be, stream);
1902− struct snd_soc_pcm_runtime *rtd = be_substream->private_data;
1924+ struct snd_soc_pcm_runtime *rtd;
19031925 struct snd_soc_dai *codec_dai;
19041926 int i;
19051927
1928+ /* A backend may not have the requested substream */
1929+ if (!be_substream)
1930+ continue;
1931+
1932+ rtd = be_substream->private_data;
19061933 if (rtd->dai_link->be_hw_params_fixup)
19071934 continue;
19081935
@@ -2571,6 +2598,7 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) · 662 unmodified lines
25712598 struct snd_soc_dpcm *dpcm;
25722599 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream];
25732600 int ret;
2601+ unsigned long flags;
25742602
25752603 dev_dbg(fe->dev, "ASoC: runtime %s open on FE %s\n",
25762604 stream ? "capture" : "playback", fe->dai_link->name);
@@ -2640,11 +2668,13 @@ close: · 63 unmodified lines
26402668 dpcm_be_dai_shutdown(fe, stream);
26412669 disconnect:
26422670 /* disconnect any non started BEs */
2671+ spin_lock_irqsave(&fe->card->dpcm_lock, flags);
26432672 for_each_dpcm_be(fe, stream, dpcm) {
26442673 struct snd_soc_pcm_runtime *be = dpcm->be;
26452674 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START)
26462675 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE;
26472676 }
2677+ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
26482678
26492679 return ret;
26502680 }
@@ -3221,7 +3251,10 @@ int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe, · 570 unmodified lines
32213251 {
32223252 struct snd_soc_dpcm *dpcm;
32233253 int state;
3254+ int ret = 1;
3255+ unsigned long flags;
32243256
3257+ spin_lock_irqsave(&fe->card->dpcm_lock, flags);
32253258 for_each_dpcm_fe(be, stream, dpcm) {
32263259
32273260 if (dpcm->fe == fe)
@@ -3230,12 +3263,15 @@ int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe, · 2 unmodified lines
32303263 state = dpcm->fe->dpcm[stream].state;
32313264 if (state == SND_SOC_DPCM_STATE_START ||
32323265 state == SND_SOC_DPCM_STATE_PAUSED ||
3233− state == SND_SOC_DPCM_STATE_SUSPEND)
3234− return 0;
3266+ state == SND_SOC_DPCM_STATE_SUSPEND) {
3267+ ret = 0;
3268+ break;
3269+ }
32353270 }
3271+ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
32363272
32373273 /* it's safe to free/stop this BE DAI */
3238− return 1;
3274+ return ret;
32393275 }
32403276 EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_free_stop);
32413277
@@ -3248,7 +3284,10 @@ int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe, · 6 unmodified lines
32483284 {
32493285 struct snd_soc_dpcm *dpcm;
32503286 int state;
3287+ int ret = 1;
3288+ unsigned long flags;
32513289
3290+ spin_lock_irqsave(&fe->card->dpcm_lock, flags);
32523291 for_each_dpcm_fe(be, stream, dpcm) {
32533292
32543293 if (dpcm->fe == fe)
@@ -3258,12 +3297,15 @@ int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe, · 3 unmodified lines
32583297 if (state == SND_SOC_DPCM_STATE_START ||
32593298 state == SND_SOC_DPCM_STATE_PAUSED ||
32603299 state == SND_SOC_DPCM_STATE_SUSPEND ||
3261− state == SND_SOC_DPCM_STATE_PREPARE)
3262− return 0;
3300+ state == SND_SOC_DPCM_STATE_PREPARE) {
3301+ ret = 0;
3302+ break;
3303+ }
32633304 }
3305+ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
32643306
32653307 /* it's safe to change hw_params */
3266− return 1;
3308+ return ret;
32673309 }
32683310 EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_params);
32693311
@@ -3302,6 +3344,7 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe, · 32 unmodified lines
33023344 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params;
33033345 struct snd_soc_dpcm *dpcm;
33043346 ssize_t offset = 0;
3347+ unsigned long flags;
33053348
33063349 /* FE state */
33073350 offset += snprintf(buf + offset, size - offset,
@@ -3329,6 +3372,7 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe, · 21 unmodified lines
33293372 goto out;
33303373 }
33313374
3375+ spin_lock_irqsave(&fe->card->dpcm_lock, flags);
33323376 for_each_dpcm_be(fe, stream, dpcm) {
33333377 struct snd_soc_pcm_runtime *be = dpcm->be;
33343378 params = &dpcm->hw_params;
@@ -3349,7 +3393,7 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe, · 14 unmodified lines
33493393 params_channels(params),
33503394 params_rate(params));
33513395 }
3352−
3396+ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
33533397 out:
33543398 return offset;
33553399 }
sound/soc/soc-topology.c+4−3
@@ -482,10 +482,11 @@ static void remove_widget(struct snd_soc_component *comp, · 481 unmodified lines
482482
483483 snd_ctl_remove(card, kcontrol);
484484
485− kfree(dobj->control.dvalues);
485+ /* free enum kcontrol's dvalues and dtexts */
486+ kfree(se->dobj.control.dvalues);
486487 for (j = 0; j < se->items; j++)
487− kfree(dobj->control.dtexts[j]);
488− kfree(dobj->control.dtexts);
488+ kfree(se->dobj.control.dtexts[j]);
489+ kfree(se->dobj.control.dtexts);
489490
490491 kfree(se);
491492 kfree(w->kcontrol_news[i].name);
sound/soc/stm/stm32_adfsdm.c+34−4
@@ -9,6 +9,7 @@ · 8 unmodified lines
99
1010 #include <linux/clk.h>
1111 #include <linux/module.h>
12+#include <linux/mutex.h>
1213 #include <linux/platform_device.h>
1314 #include <linux/slab.h>
1415
@@ -37,6 +38,8 @@ struct stm32_adfsdm_priv { · 22 unmodified lines
3738 /* PCM buffer */
3839 unsigned char *pcm_buff;
3940 unsigned int pos;
41+
42+ struct mutex lock; /* protect against race condition on iio state */
4043 };
4144
4245 static const struct snd_pcm_hardware stm32_adfsdm_pcm_hw = {
@@ -62,10 +65,12 @@ static void stm32_adfsdm_shutdown(struct snd_pcm_substream *substream, · 19 unmodified lines
6265 {
6366 struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(dai);
6467
68+ mutex_lock(&priv->lock);
6569 if (priv->iio_active) {
6670 iio_channel_stop_all_cb(priv->iio_cb);
6771 priv->iio_active = false;
6872 }
73+ mutex_unlock(&priv->lock);
6974 }
7075
7176 static int stm32_adfsdm_dai_prepare(struct snd_pcm_substream *substream,
@@ -74,13 +79,19 @@ static int stm32_adfsdm_dai_prepare(struct snd_pcm_substream *substream, · 2 unmodified lines
7479 struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(dai);
7580 int ret;
7681
82+ mutex_lock(&priv->lock);
83+ if (priv->iio_active) {
84+ iio_channel_stop_all_cb(priv->iio_cb);
85+ priv->iio_active = false;
86+ }
87+
7788 ret = iio_write_channel_attribute(priv->iio_ch,
7889 substream->runtime->rate, 0,
7990 IIO_CHAN_INFO_SAMP_FREQ);
8091 if (ret < 0) {
8192 dev_err(dai->dev, "%s: Failed to set %d sampling rate\n",
8293 __func__, substream->runtime->rate);
83− return ret;
94+ goto out;
8495 }
8596
8697 if (!priv->iio_active) {
@@ -92,6 +103,9 @@ static int stm32_adfsdm_dai_prepare(struct snd_pcm_substream *substream, · 5 unmodified lines
92103 __func__, ret);
93104 }
94105
106+out:
107+ mutex_unlock(&priv->lock);
108+
95109 return ret;
96110 }
97111
@@ -291,6 +305,7 @@ MODULE_DEVICE_TABLE(of, stm32_adfsdm_of_match); · 193 unmodified lines
291305 static int stm32_adfsdm_probe(struct platform_device *pdev)
292306 {
293307 struct stm32_adfsdm_priv *priv;
308+ struct snd_soc_component *component;
294309 int ret;
295310
296311 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
@@ -299,6 +314,7 @@ static int stm32_adfsdm_probe(struct platform_device *pdev) · 2 unmodified lines
299314
300315 priv->dev = &pdev->dev;
301316 priv->dai_drv = stm32_adfsdm_dai;
317+ mutex_init(&priv->lock);
302318
303319 dev_set_drvdata(&pdev->dev, priv);
304320
@@ -317,9 +333,15 @@ static int stm32_adfsdm_probe(struct platform_device *pdev) · 12 unmodified lines
317333 if (IS_ERR(priv->iio_cb))
318334 return PTR_ERR(priv->iio_cb);
319335
320− ret = devm_snd_soc_register_component(&pdev->dev,
321− &stm32_adfsdm_soc_platform,
322− NULL, 0);
336+ component = devm_kzalloc(&pdev->dev, sizeof(*component), GFP_KERNEL);
337+ if (!component)
338+ return -ENOMEM;
339+#ifdef CONFIG_DEBUG_FS
340+ component->debugfs_prefix = "pcm";
341+#endif
342+
343+ ret = snd_soc_add_component(&pdev->dev, component,
344+ &stm32_adfsdm_soc_platform, NULL, 0);
323345 if (ret < 0)
324346 dev_err(&pdev->dev, "%s: Failed to register PCM platform\n",
325347 __func__);
@@ -327,12 +349,20 @@ static int stm32_adfsdm_probe(struct platform_device *pdev) · 1 unmodified line
327349 return ret;
328350 }
329351
352+static int stm32_adfsdm_remove(struct platform_device *pdev)
353+{
354+ snd_soc_unregister_component(&pdev->dev);
355+
356+ return 0;
357+}
358+
330359 static struct platform_driver stm32_adfsdm_driver = {
331360 .driver = {
332361 .name = STM32_ADFSDM_DRV_NAME,
333362 .of_match_table = stm32_adfsdm_of_match,
334363 },
335364 .probe = stm32_adfsdm_probe,
365+ .remove = stm32_adfsdm_remove,
336366 };
337367
338368 module_platform_driver(stm32_adfsdm_driver);
sound/soc/stm/stm32_i2s.c+1−2
@@ -281,7 +281,6 @@ static bool stm32_i2s_readable_reg(struct device *dev, unsigned int reg) · 280 unmodified lines
281281 case STM32_I2S_CFG2_REG:
282282 case STM32_I2S_IER_REG:
283283 case STM32_I2S_SR_REG:
284− case STM32_I2S_TXDR_REG:
285284 case STM32_I2S_RXDR_REG:
286285 case STM32_I2S_CGFR_REG:
287286 return true;
@@ -293,7 +292,7 @@ static bool stm32_i2s_readable_reg(struct device *dev, unsigned int reg) · 5 unmodified lines
293292 static bool stm32_i2s_volatile_reg(struct device *dev, unsigned int reg)
294293 {
295294 switch (reg) {
296− case STM32_I2S_TXDR_REG:
295+ case STM32_I2S_SR_REG:
297296 case STM32_I2S_RXDR_REG:
298297 return true;
299298 default:
sound/soc/stm/stm32_sai.c+5−3
@@ -105,6 +105,7 @@ static int stm32_sai_set_sync(struct stm32_sai_data *sai_client, · 104 unmodified lines
105105 if (!pdev) {
106106 dev_err(&sai_client->pdev->dev,
107107 "Device not found for node %pOFn\n", np_provider);
108+ of_node_put(np_provider);
108109 return -ENODEV;
109110 }
110111
@@ -113,19 +114,20 @@ static int stm32_sai_set_sync(struct stm32_sai_data *sai_client, · 2 unmodified lines
113114 dev_err(&sai_client->pdev->dev,
114115 "SAI sync provider data not found\n");
115116 ret = -EINVAL;
116− goto out_put_dev;
117+ goto error;
117118 }
118119
119120 /* Configure sync client */
120121 ret = stm32_sai_sync_conf_client(sai_client, synci);
121122 if (ret < 0)
122− goto out_put_dev;
123+ goto error;
123124
124125 /* Configure sync provider */
125126 ret = stm32_sai_sync_conf_provider(sai_provider, synco);
126127
127−out_put_dev:
128+error:
128129 put_device(&pdev->dev);
130+ of_node_put(np_provider);
129131 return ret;
130132 }
131133
sound/soc/stm/stm32_sai_sub.c+86−28
@@ -70,6 +70,7 @@ · 69 unmodified lines
7070 #define SAI_IEC60958_STATUS_BYTES 24
7171
7272 #define SAI_MCLK_NAME_LEN 32
73+#define SAI_RATE_11K 11025
7374
7475 /**
7576 * struct stm32_sai_sub_data - private data of SAI sub block (block A or B)
@@ -100,8 +101,9 @@ · 24 unmodified lines
100101 * @slot_mask: rx or tx active slots mask. set at init or at runtime
101102 * @data_size: PCM data width. corresponds to PCM substream width.
102103 * @spdif_frm_cnt: S/PDIF playback frame counter
103− * @snd_aes_iec958: iec958 data
104+ * @iec958: iec958 data
104105 * @ctrl_lock: control lock
106+ * @irq_lock: prevent race condition with IRQ
105107 */
106108 struct stm32_sai_sub_data {
107109 struct platform_device *pdev;
@@ -133,6 +135,7 @@ struct stm32_sai_sub_data { · 25 unmodified lines
133135 unsigned int spdif_frm_cnt;
134136 struct snd_aes_iec958 iec958;
135137 struct mutex ctrl_lock; /* protect resources accessed by controls */
138+ spinlock_t irq_lock; /* used to prevent race condition with IRQ */
136139 };
137140
138141 enum stm32_sai_fifo_th {
@@ -307,6 +310,25 @@ static int stm32_sai_set_clk_div(struct stm32_sai_sub_data *sai, · 168 unmodified lines
307310 return ret;
308311 }
309312
313+static int stm32_sai_set_parent_clock(struct stm32_sai_sub_data *sai,
314+ unsigned int rate)
315+{
316+ struct platform_device *pdev = sai->pdev;
317+ struct clk *parent_clk = sai->pdata->clk_x8k;
318+ int ret;
319+
320+ if (!(rate % SAI_RATE_11K))
321+ parent_clk = sai->pdata->clk_x11k;
322+
323+ ret = clk_set_parent(sai->sai_ck, parent_clk);
324+ if (ret)
325+ dev_err(&pdev->dev, " Error %d setting sai_ck parent clock. %s",
326+ ret, ret == -EBUSY ?
327+ "Active stream rates conflict\n" : "\n");
328+
329+ return ret;
330+}
331+
310332 static long stm32_sai_mclk_round_rate(struct clk_hw *hw, unsigned long rate,
311333 unsigned long *prate)
312334 {
@@ -474,8 +496,10 @@ static irqreturn_t stm32_sai_isr(int irq, void *devid) · 161 unmodified lines
474496 status = SNDRV_PCM_STATE_XRUN;
475497 }
476498
477− if (status != SNDRV_PCM_STATE_RUNNING)
499+ spin_lock(&sai->irq_lock);
500+ if (status != SNDRV_PCM_STATE_RUNNING && sai->substream)
478501 snd_pcm_stop_xrun(sai->substream);
502+ spin_unlock(&sai->irq_lock);
479503
480504 return IRQ_HANDLED;
481505 }
@@ -486,25 +510,29 @@ static int stm32_sai_set_sysclk(struct snd_soc_dai *cpu_dai, · 4 unmodified lines
486510 struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai);
487511 int ret;
488512
489− if (dir == SND_SOC_CLOCK_OUT) {
513+ if (dir == SND_SOC_CLOCK_OUT && sai->sai_mclk) {
490514 ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX,
491515 SAI_XCR1_NODIV,
492516 (unsigned int)~SAI_XCR1_NODIV);
493517 if (ret < 0)
494518 return ret;
495519
496− dev_dbg(cpu_dai->dev, "SAI MCLK frequency is %uHz\n", freq);
497− sai->mclk_rate = freq;
520+ /* If master clock is used, set parent clock now */
521+ ret = stm32_sai_set_parent_clock(sai, freq);
522+ if (ret)
523+ return ret;
498524
499− if (sai->sai_mclk) {
500− ret = clk_set_rate_exclusive(sai->sai_mclk,
501− sai->mclk_rate);
502− if (ret) {
503− dev_err(cpu_dai->dev,
504− "Could not set mclk rate\n");
505− return ret;
506− }
525+ ret = clk_set_rate_exclusive(sai->sai_mclk, freq);
526+ if (ret) {
527+ dev_err(cpu_dai->dev,
528+ ret == -EBUSY ?
529+ "Active streams have incompatible rates" :
530+ "Could not set mclk rate\n");
531+ return ret;
507532 }
533+
534+ dev_dbg(cpu_dai->dev, "SAI MCLK frequency is %uHz\n", freq);
535+ sai->mclk_rate = freq;
508536 }
509537
510538 return 0;
@@ -679,8 +707,19 @@ static int stm32_sai_startup(struct snd_pcm_substream *substream, · 168 unmodified lines
679707 {
680708 struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai);
681709 int imr, cr2, ret;
710+ unsigned long flags;
682711
712+ spin_lock_irqsave(&sai->irq_lock, flags);
683713 sai->substream = substream;
714+ spin_unlock_irqrestore(&sai->irq_lock, flags);
715+
716+ if (STM_SAI_PROTOCOL_IS_SPDIF(sai)) {
717+ snd_pcm_hw_constraint_mask64(substream->runtime,
718+ SNDRV_PCM_HW_PARAM_FORMAT,
719+ SNDRV_PCM_FMTBIT_S32_LE);
720+ snd_pcm_hw_constraint_single(substream->runtime,
721+ SNDRV_PCM_HW_PARAM_CHANNELS, 2);
722+ }
684723
685724 ret = clk_prepare_enable(sai->sai_ck);
686725 if (ret < 0) {
@@ -898,14 +937,16 @@ static int stm32_sai_configure_clock(struct snd_soc_dai *cpu_dai, · 211 unmodified lines
898937 struct snd_pcm_hw_params *params)
899938 {
900939 struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai);
901− int div = 0;
940+ int div = 0, cr1 = 0;
902941 int sai_clk_rate, mclk_ratio, den;
903942 unsigned int rate = params_rate(params);
943+ int ret;
904944
905− if (!(rate % 11025))
906− clk_set_parent(sai->sai_ck, sai->pdata->clk_x11k);
907− else
908− clk_set_parent(sai->sai_ck, sai->pdata->clk_x8k);
945+ if (!sai->sai_mclk) {
946+ ret = stm32_sai_set_parent_clock(sai, rate);
947+ if (ret)
948+ return ret;
949+ }
909950 sai_clk_rate = clk_get_rate(sai->sai_ck);
910951
911952 if (STM_SAI_IS_F4(sai->pdata)) {
@@ -943,13 +984,19 @@ static int stm32_sai_configure_clock(struct snd_soc_dai *cpu_dai, · 31 unmodified lines
943984 } else {
944985 if (sai->mclk_rate) {
945986 mclk_ratio = sai->mclk_rate / rate;
946− if ((mclk_ratio != 512) &&
947− (mclk_ratio != 256)) {
987+ if (mclk_ratio == 512) {
988+ cr1 = SAI_XCR1_OSR;
989+ } else if (mclk_ratio != 256) {
948990 dev_err(cpu_dai->dev,
949991 "Wrong mclk ratio %d\n",
950992 mclk_ratio);
951993 return -EINVAL;
952994 }
995+
996+ regmap_update_bits(sai->regmap,
997+ STM_SAI_CR1_REGX,
998+ SAI_XCR1_OSR, cr1);
999+
9531000 div = stm32_sai_get_clk_div(sai, sai_clk_rate,
9541001 sai->mclk_rate);
9551002 if (div < 0)
@@ -1051,28 +1098,36 @@ static void stm32_sai_shutdown(struct snd_pcm_substream *substream, · 95 unmodified lines
10511098 struct snd_soc_dai *cpu_dai)
10521099 {
10531100 struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai);
1101+ unsigned long flags;
10541102
10551103 regmap_update_bits(sai->regmap, STM_SAI_IMR_REGX, SAI_XIMR_MASK, 0);
10561104
10571105 regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, SAI_XCR1_NODIV,
10581106 SAI_XCR1_NODIV);
10591107
1060− clk_disable_unprepare(sai->sai_ck);
1108+ /* Release mclk rate only if rate was actually set */
1109+ if (sai->mclk_rate) {
1110+ clk_rate_exclusive_put(sai->sai_mclk);
1111+ sai->mclk_rate = 0;
1112+ }
10611113
1062− clk_rate_exclusive_put(sai->sai_mclk);
1114+ clk_disable_unprepare(sai->sai_ck);
10631115
1116+ spin_lock_irqsave(&sai->irq_lock, flags);
10641117 sai->substream = NULL;
1118+ spin_unlock_irqrestore(&sai->irq_lock, flags);
10651119 }
10661120
10671121 static int stm32_sai_pcm_new(struct snd_soc_pcm_runtime *rtd,
10681122 struct snd_soc_dai *cpu_dai)
10691123 {
10701124 struct stm32_sai_sub_data *sai = dev_get_drvdata(cpu_dai->dev);
1125+ struct snd_kcontrol_new knew = iec958_ctls;
10711126
10721127 if (STM_SAI_PROTOCOL_IS_SPDIF(sai)) {
10731128 dev_dbg(&sai->pdev->dev, "%s: register iec controls", __func__);
1074− return snd_ctl_add(rtd->pcm->card,
1075− snd_ctl_new1(&iec958_ctls, sai));
1129+ knew.device = rtd->pcm->device;
1130+ return snd_ctl_add(rtd->pcm->card, snd_ctl_new1(&knew, sai));
10761131 }
10771132
10781133 return 0;
@@ -1081,7 +1136,7 @@ static int stm32_sai_pcm_new(struct snd_soc_pcm_runtime *rtd, · 2 unmodified lines
10811136 static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai)
10821137 {
10831138 struct stm32_sai_sub_data *sai = dev_get_drvdata(cpu_dai->dev);
1084− int cr1 = 0, cr1_mask;
1139+ int cr1 = 0, cr1_mask, ret;
10851140
10861141 sai->cpu_dai = cpu_dai;
10871142
@@ -1111,8 +1166,10 @@ static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai) · 23 unmodified lines
11111166 /* Configure synchronization */
11121167 if (sai->sync == SAI_SYNC_EXTERNAL) {
11131168 /* Configure synchro client and provider */
1114− sai->pdata->set_sync(sai->pdata, sai->np_sync_provider,
1115− sai->synco, sai->synci);
1169+ ret = sai->pdata->set_sync(sai->pdata, sai->np_sync_provider,
1170+ sai->synco, sai->synci);
1171+ if (ret)
1172+ return ret;
11161173 }
11171174
11181175 cr1_mask |= SAI_XCR1_SYNCEN_MASK;
@@ -1392,7 +1449,6 @@ static int stm32_sai_sub_dais_init(struct platform_device *pdev, · 273 unmodified lines
13921449 if (!sai->cpu_dai_drv)
13931450 return -ENOMEM;
13941451
1395− sai->cpu_dai_drv->name = dev_name(&pdev->dev);
13961452 if (STM_SAI_IS_PLAYBACK(sai)) {
13971453 memcpy(sai->cpu_dai_drv, &stm32_sai_playback_dai,
13981454 sizeof(stm32_sai_playback_dai));
@@ -1402,6 +1458,7 @@ static int stm32_sai_sub_dais_init(struct platform_device *pdev, · 3 unmodified lines
14021458 sizeof(stm32_sai_capture_dai));
14031459 sai->cpu_dai_drv->capture.stream_name = sai->cpu_dai_drv->name;
14041460 }
1461+ sai->cpu_dai_drv->name = dev_name(&pdev->dev);
14051462
14061463 return 0;
14071464 }
@@ -1424,6 +1481,7 @@ static int stm32_sai_sub_probe(struct platform_device *pdev) · 16 unmodified lines
14241481
14251482 sai->pdev = pdev;
14261483 mutex_init(&sai->ctrl_lock);
1484+ spin_lock_init(&sai->irq_lock);
14271485 platform_set_drvdata(pdev, sai);
14281486
14291487 sai->pdata = dev_get_drvdata(pdev->dev.parent);
sound/xen/xen_snd_front_alsa.c+1−1
@@ -441,7 +441,7 @@ static int shbuf_setup_backstore(struct xen_snd_front_pcm_stream_info *stream, · 440 unmodified lines
441441 {
442442 int i;
443443
444− stream->buffer = alloc_pages_exact(stream->buffer_sz, GFP_KERNEL);
444+ stream->buffer = alloc_pages_exact(buffer_sz, GFP_KERNEL);
445445 if (!stream->buffer)
446446 return -ENOMEM;
447447