Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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
...

+735 -263
+9 -2
include/sound/soc.h
··· 802 802 int probe_order; 803 803 int remove_order; 804 804 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; 807 812 808 813 /* bits */ 809 814 unsigned int idle_bias_on:1; ··· 1087 1082 1088 1083 struct mutex mutex; 1089 1084 struct mutex dapm_mutex; 1085 + 1086 + spinlock_t dpcm_lock; 1090 1087 1091 1088 bool instantiated; 1092 1089 bool topology_shortname_created;
+1
include/uapi/sound/asound.h
··· 32 32 33 33 #ifndef __KERNEL__ 34 34 #include <stdlib.h> 35 + #include <time.h> 35 36 #endif 36 37 37 38 /*
+3 -3
sound/core/seq/seq_clientmgr.c
··· 1252 1252 1253 1253 /* fill the info fields */ 1254 1254 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)); 1256 1256 1257 1257 client->filter = client_info->filter; 1258 1258 client->event_lost = client_info->event_lost; ··· 1530 1530 /* set queue name */ 1531 1531 if (!info->name[0]) 1532 1532 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)); 1534 1534 snd_use_lock_free(&q->use_lock); 1535 1535 1536 1536 return 0; ··· 1592 1592 queuefree(q); 1593 1593 return -EPERM; 1594 1594 } 1595 - strlcpy(q->name, info->name, sizeof(q->name)); 1595 + strscpy(q->name, info->name, sizeof(q->name)); 1596 1596 queuefree(q); 1597 1597 1598 1598 return 0;
-1
sound/hda/ext/hdac_ext_bus.c
··· 107 107 INIT_LIST_HEAD(&bus->hlink_list); 108 108 bus->idx = idx++; 109 109 110 - mutex_init(&bus->lock); 111 110 bus->cmd_dma_state = true; 112 111 113 112 return 0;
+1
sound/hda/hdac_bus.c
··· 38 38 INIT_WORK(&bus->unsol_work, snd_hdac_bus_process_unsol_events); 39 39 spin_lock_init(&bus->reg_lock); 40 40 mutex_init(&bus->cmd_mutex); 41 + mutex_init(&bus->lock); 41 42 bus->irq = -1; 42 43 return 0; 43 44 }
+5 -1
sound/hda/hdac_component.c
··· 69 69 70 70 dev_dbg(bus->dev, "display power %s\n", 71 71 enable ? "enable" : "disable"); 72 + 73 + mutex_lock(&bus->lock); 72 74 if (enable) 73 75 set_bit(idx, &bus->display_power_status); 74 76 else 75 77 clear_bit(idx, &bus->display_power_status); 76 78 77 79 if (!acomp || !acomp->ops) 78 - return; 80 + goto unlock; 79 81 80 82 if (bus->display_power_status) { 81 83 if (!bus->display_power_active) { ··· 94 92 bus->display_power_active = false; 95 93 } 96 94 } 95 + unlock: 96 + mutex_unlock(&bus->lock); 97 97 } 98 98 EXPORT_SYMBOL_GPL(snd_hdac_display_power); 99 99
+4
sound/pci/hda/hda_intel.c
··· 2142 2142 SND_PCI_QUIRK(0x8086, 0x2040, "Intel DZ77BH-55K", 0), 2143 2143 /* https://bugzilla.kernel.org/show_bug.cgi?id=199607 */ 2144 2144 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), 2145 2147 /* https://bugzilla.redhat.com/show_bug.cgi?id=1520902 */ 2146 2148 SND_PCI_QUIRK(0x8086, 0x2068, "Intel NUC7i3BNB", 0), 2147 2149 /* https://bugzilla.kernel.org/show_bug.cgi?id=198611 */ ··· 2152 2150 SND_PCI_QUIRK(0x17aa, 0x367b, "Lenovo IdeaCentre B550", 0), 2153 2151 /* https://bugzilla.redhat.com/show_bug.cgi?id=1572975 */ 2154 2152 SND_PCI_QUIRK(0x17aa, 0x36a7, "Lenovo C50 All in one", 0), 2153 + /* https://bugs.launchpad.net/bugs/1821663 */ 2154 + SND_PCI_QUIRK(0x1631, 0xe017, "Packard Bell NEC IMEDIA 5204", 0), 2155 2155 {} 2156 2156 }; 2157 2157 #endif /* CONFIG_PM */
+51 -21
sound/pci/hda/patch_realtek.c
··· 1864 1864 ALC887_FIXUP_BASS_CHMAP, 1865 1865 ALC1220_FIXUP_GB_DUAL_CODECS, 1866 1866 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, 1869 1869 }; 1870 1870 1871 1871 static void alc889_fixup_coef(struct hda_codec *codec, ··· 2070 2070 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, 2071 2071 const struct hda_fixup *fix, int action); 2072 2072 2073 - static void alc1220_fixup_system76_oryp5(struct hda_codec *codec, 2073 + static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec, 2074 2074 const struct hda_fixup *fix, 2075 2075 int action) 2076 2076 { ··· 2322 2322 .type = HDA_FIXUP_FUNC, 2323 2323 .v.func = alc1220_fixup_clevo_p950, 2324 2324 }, 2325 - [ALC1220_FIXUP_SYSTEM76_ORYP5] = { 2325 + [ALC1220_FIXUP_CLEVO_PB51ED] = { 2326 2326 .type = HDA_FIXUP_FUNC, 2327 - .v.func = alc1220_fixup_system76_oryp5, 2327 + .v.func = alc1220_fixup_clevo_pb51ed, 2328 2328 }, 2329 - [ALC1220_FIXUP_SYSTEM76_ORYP5_PINS] = { 2329 + [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = { 2330 2330 .type = HDA_FIXUP_PINS, 2331 2331 .v.pins = (const struct hda_pintbl[]) { 2332 2332 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ 2333 2333 {} 2334 2334 }, 2335 2335 .chained = true, 2336 - .chain_id = ALC1220_FIXUP_SYSTEM76_ORYP5, 2336 + .chain_id = ALC1220_FIXUP_CLEVO_PB51ED, 2337 2337 }, 2338 2338 }; 2339 2339 ··· 2411 2411 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950), 2412 2412 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950), 2413 2413 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), 2416 2417 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), 2417 2418 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), 2418 2419 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), ··· 5492 5491 jack->jack->button_state = report; 5493 5492 } 5494 5493 5495 - static void alc295_fixup_chromebook(struct hda_codec *codec, 5494 + static void alc_fixup_headset_jack(struct hda_codec *codec, 5496 5495 const struct hda_fixup *fix, int action) 5497 5496 { 5498 5497 ··· 5502 5501 alc_headset_btn_callback); 5503 5502 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false, 5504 5503 SND_JACK_HEADSET, alc_headset_btn_keymap); 5505 - switch (codec->core.vendor_id) { 5506 - case 0x10ec0295: 5507 - alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ 5508 - alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); 5509 - break; 5510 - case 0x10ec0236: 5511 - alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ 5512 - alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); 5513 - break; 5514 - } 5515 5504 break; 5516 5505 case HDA_FIXUP_ACT_INIT: 5517 5506 switch (codec->core.vendor_id) { ··· 5516 5525 case 0x10ec0256: 5517 5526 alc_write_coef_idx(codec, 0x48, 0xd011); 5518 5527 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); 5528 + break; 5529 + } 5530 + break; 5531 + } 5532 + } 5533 + 5534 + static void alc295_fixup_chromebook(struct hda_codec *codec, 5535 + const struct hda_fixup *fix, int action) 5536 + { 5537 + switch (action) { 5538 + case HDA_FIXUP_ACT_INIT: 5539 + switch (codec->core.vendor_id) { 5540 + case 0x10ec0295: 5541 + alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ 5542 + alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); 5543 + break; 5544 + case 0x10ec0236: 5545 + alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ 5546 + alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); 5519 5547 break; 5520 5548 } 5521 5549 break; ··· 5673 5663 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, 5674 5664 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, 5675 5665 ALC233_FIXUP_LENOVO_MULTI_CODECS, 5666 + ALC233_FIXUP_ACER_HEADSET_MIC, 5676 5667 ALC294_FIXUP_LENOVO_MIC_LOCATION, 5677 5668 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, 5678 5669 ALC700_FIXUP_INTEL_REFERENCE, ··· 5695 5684 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE, 5696 5685 ALC255_FIXUP_ACER_HEADSET_MIC, 5697 5686 ALC295_FIXUP_CHROME_BOOK, 5687 + ALC225_FIXUP_HEADSET_JACK, 5698 5688 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE, 5699 5689 ALC225_FIXUP_WYSE_AUTO_MUTE, 5700 5690 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF, ··· 6502 6490 .type = HDA_FIXUP_FUNC, 6503 6491 .v.func = alc233_alc662_fixup_lenovo_dual_codecs, 6504 6492 }, 6493 + [ALC233_FIXUP_ACER_HEADSET_MIC] = { 6494 + .type = HDA_FIXUP_VERBS, 6495 + .v.verbs = (const struct hda_verb[]) { 6496 + { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 }, 6497 + { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 }, 6498 + { } 6499 + }, 6500 + .chained = true, 6501 + .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE 6502 + }, 6505 6503 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = { 6506 6504 .type = HDA_FIXUP_PINS, 6507 6505 .v.pins = (const struct hda_pintbl[]) { ··· 6657 6635 [ALC295_FIXUP_CHROME_BOOK] = { 6658 6636 .type = HDA_FIXUP_FUNC, 6659 6637 .v.func = alc295_fixup_chromebook, 6638 + .chained = true, 6639 + .chain_id = ALC225_FIXUP_HEADSET_JACK 6640 + }, 6641 + [ALC225_FIXUP_HEADSET_JACK] = { 6642 + .type = HDA_FIXUP_FUNC, 6643 + .v.func = alc_fixup_headset_jack, 6660 6644 }, 6661 6645 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = { 6662 6646 .type = HDA_FIXUP_PINS, ··· 6765 6737 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), 6766 6738 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), 6767 6739 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), 6740 + SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC), 6768 6741 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC), 6769 6742 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), 6770 6743 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS), ··· 7161 7132 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"}, 7162 7133 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"}, 7163 7134 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"}, 7164 - {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-sense-combo"}, 7135 + {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"}, 7136 + {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"}, 7165 7137 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"}, 7166 7138 {} 7167 7139 };
+1
sound/soc/codecs/Kconfig
··· 1151 1151 tristate "WCD9335 Codec" 1152 1152 depends on SLIMBUS 1153 1153 select REGMAP_SLIMBUS 1154 + select REGMAP_IRQ 1154 1155 help 1155 1156 The WCD9335 is a standalone Hi-Fi audio CODEC IC, supports 1156 1157 Qualcomm Technologies, Inc. (QTI) multimedia solutions,
+1
sound/soc/codecs/ab8500-codec.c
··· 2129 2129 dev_err(dai->component->dev, 2130 2130 "%s: ERROR: The device is either a master or a slave.\n", 2131 2131 __func__); 2132 + /* fall through */ 2132 2133 default: 2133 2134 dev_err(dai->component->dev, 2134 2135 "%s: ERROR: Unsupporter master mask 0x%x\n",
+11
sound/soc/codecs/cs35l35.c
··· 1635 1635 return ret; 1636 1636 } 1637 1637 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 + 1638 1648 static const struct of_device_id cs35l35_of_match[] = { 1639 1649 {.compatible = "cirrus,cs35l35"}, 1640 1650 {}, ··· 1665 1655 }, 1666 1656 .id_table = cs35l35_id, 1667 1657 .probe = cs35l35_i2c_probe, 1658 + .remove = cs35l35_i2c_remove, 1668 1659 }; 1669 1660 1670 1661 module_i2c_driver(cs35l35_i2c_driver);
+1
sound/soc/codecs/cs4270.c
··· 642 642 .reg_defaults = cs4270_reg_defaults, 643 643 .num_reg_defaults = ARRAY_SIZE(cs4270_reg_defaults), 644 644 .cache_type = REGCACHE_RBTREE, 645 + .write_flag_mask = CS4270_I2C_INCR, 645 646 646 647 .readable_reg = cs4270_reg_is_readable, 647 648 .volatile_reg = cs4270_reg_is_volatile,
+40 -15
sound/soc/codecs/hdac_hda.c
··· 38 38 struct snd_soc_dai *dai); 39 39 static int hdac_hda_dai_prepare(struct snd_pcm_substream *substream, 40 40 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); 41 44 static int hdac_hda_dai_hw_free(struct snd_pcm_substream *substream, 42 45 struct snd_soc_dai *dai); 43 46 static int hdac_hda_dai_set_tdm_slot(struct snd_soc_dai *dai, ··· 53 50 .startup = hdac_hda_dai_open, 54 51 .shutdown = hdac_hda_dai_close, 55 52 .prepare = hdac_hda_dai_prepare, 53 + .hw_params = hdac_hda_dai_hw_params, 56 54 .hw_free = hdac_hda_dai_hw_free, 57 55 .set_tdm_slot = hdac_hda_dai_set_tdm_slot, 58 56 }; ··· 143 139 return 0; 144 140 } 145 141 142 + static int hdac_hda_dai_hw_params(struct snd_pcm_substream *substream, 143 + struct snd_pcm_hw_params *params, 144 + struct snd_soc_dai *dai) 145 + { 146 + struct snd_soc_component *component = dai->component; 147 + struct hdac_hda_priv *hda_pvt; 148 + unsigned int format_val; 149 + unsigned int maxbps; 150 + 151 + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 152 + maxbps = dai->driver->playback.sig_bits; 153 + else 154 + maxbps = dai->driver->capture.sig_bits; 155 + 156 + hda_pvt = snd_soc_component_get_drvdata(component); 157 + format_val = snd_hdac_calc_stream_format(params_rate(params), 158 + params_channels(params), 159 + params_format(params), 160 + maxbps, 161 + 0); 162 + if (!format_val) { 163 + dev_err(dai->dev, 164 + "invalid format_val, rate=%d, ch=%d, format=%d, maxbps=%d\n", 165 + params_rate(params), params_channels(params), 166 + params_format(params), maxbps); 167 + 168 + return -EINVAL; 169 + } 170 + 171 + hda_pvt->pcm[dai->id].format_val[substream->stream] = format_val; 172 + return 0; 173 + } 174 + 146 175 static int hdac_hda_dai_hw_free(struct snd_pcm_substream *substream, 147 176 struct snd_soc_dai *dai) 148 177 { ··· 199 162 struct snd_soc_dai *dai) 200 163 { 201 164 struct snd_soc_component *component = dai->component; 202 - struct hdac_hda_priv *hda_pvt; 203 - struct snd_pcm_runtime *runtime = substream->runtime; 204 - struct hdac_device *hdev; 205 165 struct hda_pcm_stream *hda_stream; 166 + struct hdac_hda_priv *hda_pvt; 167 + struct hdac_device *hdev; 206 168 unsigned int format_val; 207 169 struct hda_pcm *pcm; 208 170 unsigned int stream; ··· 215 179 216 180 hda_stream = &pcm->stream[substream->stream]; 217 181 218 - format_val = snd_hdac_calc_stream_format(runtime->rate, 219 - runtime->channels, 220 - runtime->format, 221 - hda_stream->maxbps, 222 - 0); 223 - if (!format_val) { 224 - dev_err(&hdev->dev, 225 - "invalid format_val, rate=%d, ch=%d, format=%d\n", 226 - runtime->rate, runtime->channels, runtime->format); 227 - return -EINVAL; 228 - } 229 - 230 182 stream = hda_pvt->pcm[dai->id].stream_tag[substream->stream]; 183 + format_val = hda_pvt->pcm[dai->id].format_val[substream->stream]; 231 184 232 185 ret = snd_hda_codec_prepare(&hda_pvt->codec, hda_stream, 233 186 stream, format_val, substream);
+1
sound/soc/codecs/hdac_hda.h
··· 8 8 9 9 struct hdac_hda_pcm { 10 10 int stream_tag[2]; 11 + unsigned int format_val[2]; 11 12 }; 12 13 13 14 struct hdac_hda_priv {
+59 -62
sound/soc/codecs/hdmi-codec.c
··· 484 484 params_width(params), params_rate(params), 485 485 params_channels(params)); 486 486 487 - if (params_width(params) > 24) 488 - params->msbits = 24; 489 - 490 487 ret = snd_pcm_create_iec958_consumer_hw_params(params, hp.iec.status, 491 488 sizeof(hp.iec.status)); 492 489 if (ret < 0) { ··· 526 529 { 527 530 struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); 528 531 struct hdmi_codec_daifmt cf = { 0 }; 529 - int ret = 0; 530 532 531 533 dev_dbg(dai->dev, "%s()\n", __func__); 532 534 533 - if (dai->id == DAI_ID_SPDIF) { 534 - cf.fmt = HDMI_SPDIF; 535 - } else { 536 - switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 537 - case SND_SOC_DAIFMT_CBM_CFM: 538 - cf.bit_clk_master = 1; 539 - cf.frame_clk_master = 1; 540 - break; 541 - case SND_SOC_DAIFMT_CBS_CFM: 542 - cf.frame_clk_master = 1; 543 - break; 544 - case SND_SOC_DAIFMT_CBM_CFS: 545 - cf.bit_clk_master = 1; 546 - break; 547 - case SND_SOC_DAIFMT_CBS_CFS: 548 - break; 549 - default: 550 - return -EINVAL; 551 - } 535 + if (dai->id == DAI_ID_SPDIF) 536 + return 0; 552 537 553 - switch (fmt & SND_SOC_DAIFMT_INV_MASK) { 554 - case SND_SOC_DAIFMT_NB_NF: 555 - break; 556 - case SND_SOC_DAIFMT_NB_IF: 557 - cf.frame_clk_inv = 1; 558 - break; 559 - case SND_SOC_DAIFMT_IB_NF: 560 - cf.bit_clk_inv = 1; 561 - break; 562 - case SND_SOC_DAIFMT_IB_IF: 563 - cf.frame_clk_inv = 1; 564 - cf.bit_clk_inv = 1; 565 - break; 566 - } 538 + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 539 + case SND_SOC_DAIFMT_CBM_CFM: 540 + cf.bit_clk_master = 1; 541 + cf.frame_clk_master = 1; 542 + break; 543 + case SND_SOC_DAIFMT_CBS_CFM: 544 + cf.frame_clk_master = 1; 545 + break; 546 + case SND_SOC_DAIFMT_CBM_CFS: 547 + cf.bit_clk_master = 1; 548 + break; 549 + case SND_SOC_DAIFMT_CBS_CFS: 550 + break; 551 + default: 552 + return -EINVAL; 553 + } 567 554 568 - switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 569 - case SND_SOC_DAIFMT_I2S: 570 - cf.fmt = HDMI_I2S; 571 - break; 572 - case SND_SOC_DAIFMT_DSP_A: 573 - cf.fmt = HDMI_DSP_A; 574 - break; 575 - case SND_SOC_DAIFMT_DSP_B: 576 - cf.fmt = HDMI_DSP_B; 577 - break; 578 - case SND_SOC_DAIFMT_RIGHT_J: 579 - cf.fmt = HDMI_RIGHT_J; 580 - break; 581 - case SND_SOC_DAIFMT_LEFT_J: 582 - cf.fmt = HDMI_LEFT_J; 583 - break; 584 - case SND_SOC_DAIFMT_AC97: 585 - cf.fmt = HDMI_AC97; 586 - break; 587 - default: 588 - dev_err(dai->dev, "Invalid DAI interface format\n"); 589 - return -EINVAL; 590 - } 555 + switch (fmt & SND_SOC_DAIFMT_INV_MASK) { 556 + case SND_SOC_DAIFMT_NB_NF: 557 + break; 558 + case SND_SOC_DAIFMT_NB_IF: 559 + cf.frame_clk_inv = 1; 560 + break; 561 + case SND_SOC_DAIFMT_IB_NF: 562 + cf.bit_clk_inv = 1; 563 + break; 564 + case SND_SOC_DAIFMT_IB_IF: 565 + cf.frame_clk_inv = 1; 566 + cf.bit_clk_inv = 1; 567 + break; 568 + } 569 + 570 + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 571 + case SND_SOC_DAIFMT_I2S: 572 + cf.fmt = HDMI_I2S; 573 + break; 574 + case SND_SOC_DAIFMT_DSP_A: 575 + cf.fmt = HDMI_DSP_A; 576 + break; 577 + case SND_SOC_DAIFMT_DSP_B: 578 + cf.fmt = HDMI_DSP_B; 579 + break; 580 + case SND_SOC_DAIFMT_RIGHT_J: 581 + cf.fmt = HDMI_RIGHT_J; 582 + break; 583 + case SND_SOC_DAIFMT_LEFT_J: 584 + cf.fmt = HDMI_LEFT_J; 585 + break; 586 + case SND_SOC_DAIFMT_AC97: 587 + cf.fmt = HDMI_AC97; 588 + break; 589 + default: 590 + dev_err(dai->dev, "Invalid DAI interface format\n"); 591 + return -EINVAL; 591 592 } 592 593 593 594 hcp->daifmt[dai->id] = cf; 594 595 595 - return ret; 596 + return 0; 596 597 } 597 598 598 599 static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute) ··· 787 792 i++; 788 793 } 789 794 790 - if (hcd->spdif) 795 + if (hcd->spdif) { 791 796 hcp->daidrv[i] = hdmi_spdif_dai; 797 + hcp->daifmt[DAI_ID_SPDIF].fmt = HDMI_SPDIF; 798 + } 792 799 793 800 dev_set_drvdata(dev, hcp); 794 801
+2 -2
sound/soc/codecs/nau8810.c
··· 411 411 SND_SOC_DAPM_MIXER("Mono Mixer", NAU8810_REG_POWER3, 412 412 NAU8810_MOUTMX_EN_SFT, 0, &nau8810_mono_mixer_controls[0], 413 413 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, 415 415 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, 417 417 NAU8810_ADC_EN_SFT, 0), 418 418 SND_SOC_DAPM_PGA("SpkN Out", NAU8810_REG_POWER3, 419 419 NAU8810_NSPK_EN_SFT, 0, NULL, 0),
+38 -8
sound/soc/codecs/nau8824.c
··· 681 681 SND_SOC_DAPM_ADC("ADCR", NULL, NAU8824_REG_ANALOG_ADC_2, 682 682 NAU8824_ADCR_EN_SFT, 0), 683 683 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), 686 686 687 687 SND_SOC_DAPM_DAC("DACL", NULL, NAU8824_REG_RDAC, 688 688 NAU8824_DACL_EN_SFT, 0), ··· 831 831 } 832 832 } 833 833 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 + 834 864 static void nau8824_eject_jack(struct nau8824 *nau8824) 835 865 { 836 866 struct snd_soc_dapm_context *dapm = nau8824->dapm; ··· 869 839 /* Clear all interruption status */ 870 840 nau8824_int_status_clear_all(regmap); 871 841 872 - snd_soc_dapm_disable_pin(dapm, "SAR"); 873 - snd_soc_dapm_disable_pin(dapm, "MICBIAS"); 842 + nau8824_dapm_disable_pin(nau8824, "SAR"); 843 + nau8824_dapm_disable_pin(nau8824, "MICBIAS"); 874 844 snd_soc_dapm_sync(dapm); 875 845 876 846 /* Enable the insertion interruption, disable the ejection ··· 900 870 struct regmap *regmap = nau8824->regmap; 901 871 int adc_value, event = 0, event_mask = 0; 902 872 903 - snd_soc_dapm_force_enable_pin(dapm, "MICBIAS"); 904 - snd_soc_dapm_force_enable_pin(dapm, "SAR"); 873 + nau8824_dapm_enable_pin(nau8824, "MICBIAS"); 874 + nau8824_dapm_enable_pin(nau8824, "SAR"); 905 875 snd_soc_dapm_sync(dapm); 906 876 907 877 msleep(100); ··· 912 882 if (adc_value < HEADSET_SARADC_THD) { 913 883 event |= SND_JACK_HEADPHONE; 914 884 915 - snd_soc_dapm_disable_pin(dapm, "SAR"); 916 - snd_soc_dapm_disable_pin(dapm, "MICBIAS"); 885 + nau8824_dapm_disable_pin(nau8824, "SAR"); 886 + nau8824_dapm_disable_pin(nau8824, "MICBIAS"); 917 887 snd_soc_dapm_sync(dapm); 918 888 } else { 919 889 event |= SND_JACK_HEADSET;
+25 -31
sound/soc/codecs/rt5682.c
··· 910 910 int jack_insert) 911 911 { 912 912 struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); 913 - struct snd_soc_dapm_context *dapm = 914 - snd_soc_component_get_dapm(component); 915 913 unsigned int val, count; 916 914 917 915 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 + 920 928 snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1, 921 929 RT5682_TRIG_JD_MASK, RT5682_TRIG_JD_HIGH); 922 930 ··· 952 944 rt5682_enable_push_button_irq(component, false); 953 945 snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1, 954 946 RT5682_TRIG_JD_MASK, RT5682_TRIG_JD_LOW); 955 - snd_soc_dapm_disable_pin(dapm, "CBJ Power"); 956 - snd_soc_dapm_sync(dapm); 947 + snd_soc_component_update_bits(component, RT5682_PWR_ANLG_1, 948 + RT5682_PWR_VREF2 | RT5682_PWR_MB, 0); 949 + snd_soc_component_update_bits(component, RT5682_PWR_ANLG_3, 950 + RT5682_PWR_CBJ, 0); 957 951 958 952 rt5682->jack_type = 0; 959 953 } ··· 1208 1198 struct snd_soc_component *component = 1209 1199 snd_soc_dapm_to_component(w->dapm); 1210 1200 struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); 1211 - int ref, val, reg, sft, mask, idx = -EINVAL; 1201 + int ref, val, reg, idx = -EINVAL; 1212 1202 static const int div_f[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48}; 1213 1203 static const int div_o[] = {1, 2, 4, 6, 8, 12, 16, 24, 32, 48}; 1214 1204 ··· 1222 1212 1223 1213 idx = rt5682_div_sel(rt5682, ref, div_f, ARRAY_SIZE(div_f)); 1224 1214 1225 - if (w->shift == RT5682_PWR_ADC_S1F_BIT) { 1215 + if (w->shift == RT5682_PWR_ADC_S1F_BIT) 1226 1216 reg = RT5682_PLL_TRACK_3; 1227 - sft = RT5682_ADC_OSR_SFT; 1228 - mask = RT5682_ADC_OSR_MASK; 1229 - } else { 1217 + else 1230 1218 reg = RT5682_PLL_TRACK_2; 1231 - sft = RT5682_DAC_OSR_SFT; 1232 - mask = RT5682_DAC_OSR_MASK; 1233 - } 1234 1219 1235 1220 snd_soc_component_update_bits(component, reg, 1236 1221 RT5682_FILTER_CLK_DIV_MASK, idx << RT5682_FILTER_CLK_DIV_SFT); ··· 1237 1232 } 1238 1233 1239 1234 snd_soc_component_update_bits(component, RT5682_ADDA_CLK_1, 1240 - mask, idx << sft); 1235 + RT5682_ADC_OSR_MASK | RT5682_DAC_OSR_MASK, 1236 + (idx << RT5682_ADC_OSR_SFT) | (idx << RT5682_DAC_OSR_SFT)); 1241 1237 1242 1238 return 0; 1243 1239 } ··· 1597 1591 0, NULL, 0), 1598 1592 SND_SOC_DAPM_SUPPLY("Vref1", RT5682_PWR_ANLG_1, RT5682_PWR_VREF1_BIT, 0, 1599 1593 rt5655_set_verf, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), 1600 - SND_SOC_DAPM_SUPPLY("Vref2", RT5682_PWR_ANLG_1, RT5682_PWR_VREF2_BIT, 0, 1601 - rt5655_set_verf, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), 1602 1594 1603 1595 /* ASRC */ 1604 1596 SND_SOC_DAPM_SUPPLY_S("DAC STO1 ASRC", 1, RT5682_PLL_TRACK_1, ··· 1630 1626 /* Boost */ 1631 1627 SND_SOC_DAPM_PGA("BST1 CBJ", SND_SOC_NOPM, 1632 1628 0, 0, NULL, 0), 1633 - 1634 - SND_SOC_DAPM_SUPPLY("CBJ Power", RT5682_PWR_ANLG_3, 1635 - RT5682_PWR_CBJ_BIT, 0, NULL, 0), 1636 1629 1637 1630 /* REC Mixer */ 1638 1631 SND_SOC_DAPM_MIXER("RECMIX1L", SND_SOC_NOPM, 0, 0, rt5682_rec1_l_mix, ··· 1793 1792 1794 1793 /*Vref*/ 1795 1794 {"MICBIAS1", NULL, "Vref1"}, 1796 - {"MICBIAS1", NULL, "Vref2"}, 1797 1795 {"MICBIAS2", NULL, "Vref1"}, 1798 - {"MICBIAS2", NULL, "Vref2"}, 1799 1796 1800 1797 {"CLKDET SYS", NULL, "CLKDET"}, 1801 1798 1802 1799 {"IN1P", NULL, "LDO2"}, 1803 1800 1804 1801 {"BST1 CBJ", NULL, "IN1P"}, 1805 - {"BST1 CBJ", NULL, "CBJ Power"}, 1806 - {"CBJ Power", NULL, "Vref2"}, 1807 1802 1808 1803 {"RECMIX1L", "CBJ Switch", "BST1 CBJ"}, 1809 1804 {"RECMIX1L", NULL, "RECMIX1L Power"}, ··· 1909 1912 {"HP Amp", NULL, "Capless"}, 1910 1913 {"HP Amp", NULL, "Charge Pump"}, 1911 1914 {"HP Amp", NULL, "CLKDET SYS"}, 1912 - {"HP Amp", NULL, "CBJ Power"}, 1913 1915 {"HP Amp", NULL, "Vref1"}, 1914 - {"HP Amp", NULL, "Vref2"}, 1915 1916 {"HPOL Playback", "Switch", "HP Amp"}, 1916 1917 {"HPOR Playback", "Switch", "HP Amp"}, 1917 1918 {"HPOL", NULL, "HPOL Playback"}, ··· 2298 2303 switch (level) { 2299 2304 case SND_SOC_BIAS_PREPARE: 2300 2305 regmap_update_bits(rt5682->regmap, RT5682_PWR_ANLG_1, 2301 - RT5682_PWR_MB | RT5682_PWR_BG, 2302 - RT5682_PWR_MB | RT5682_PWR_BG); 2306 + RT5682_PWR_BG, RT5682_PWR_BG); 2303 2307 regmap_update_bits(rt5682->regmap, RT5682_PWR_DIG_1, 2304 2308 RT5682_DIG_GATE_CTRL | RT5682_PWR_LDO, 2305 2309 RT5682_DIG_GATE_CTRL | RT5682_PWR_LDO); 2306 2310 break; 2307 2311 2308 2312 case SND_SOC_BIAS_STANDBY: 2309 - regmap_update_bits(rt5682->regmap, RT5682_PWR_ANLG_1, 2310 - RT5682_PWR_MB, RT5682_PWR_MB); 2311 2313 regmap_update_bits(rt5682->regmap, RT5682_PWR_DIG_1, 2312 2314 RT5682_DIG_GATE_CTRL, RT5682_DIG_GATE_CTRL); 2313 2315 break; ··· 2312 2320 regmap_update_bits(rt5682->regmap, RT5682_PWR_DIG_1, 2313 2321 RT5682_DIG_GATE_CTRL | RT5682_PWR_LDO, 0); 2314 2322 regmap_update_bits(rt5682->regmap, RT5682_PWR_ANLG_1, 2315 - RT5682_PWR_MB | RT5682_PWR_BG, 0); 2323 + RT5682_PWR_BG, 0); 2316 2324 break; 2317 2325 2318 2326 default: ··· 2354 2362 2355 2363 regcache_cache_only(rt5682->regmap, false); 2356 2364 regcache_sync(rt5682->regmap); 2365 + 2366 + rt5682_irq(0, rt5682); 2357 2367 2358 2368 return 0; 2359 2369 }
+2 -2
sound/soc/codecs/tlv320aic32x4-i2c.c
··· 3 3 * 4 4 * Copyright 2011 NW Digital Radio 5 5 * 6 - * Author: Jeremy McDermond <nh6z@nh6z.net> 6 + * Author: Annaliese McDermond <nh6z@nh6z.net> 7 7 * 8 8 * Based on sound/soc/codecs/wm8974 and TI driver for kernel 2.6.27. 9 9 * ··· 72 72 module_i2c_driver(aic32x4_i2c_driver); 73 73 74 74 MODULE_DESCRIPTION("ASoC TLV320AIC32x4 codec driver I2C"); 75 - MODULE_AUTHOR("Jeremy McDermond <nh6z@nh6z.net>"); 75 + MODULE_AUTHOR("Annaliese McDermond <nh6z@nh6z.net>"); 76 76 MODULE_LICENSE("GPL");
+2 -2
sound/soc/codecs/tlv320aic32x4-spi.c
··· 3 3 * 4 4 * Copyright 2011 NW Digital Radio 5 5 * 6 - * Author: Jeremy McDermond <nh6z@nh6z.net> 6 + * Author: Annaliese McDermond <nh6z@nh6z.net> 7 7 * 8 8 * Based on sound/soc/codecs/wm8974 and TI driver for kernel 2.6.27. 9 9 * ··· 74 74 module_spi_driver(aic32x4_spi_driver); 75 75 76 76 MODULE_DESCRIPTION("ASoC TLV320AIC32x4 codec driver SPI"); 77 - MODULE_AUTHOR("Jeremy McDermond <nh6z@nh6z.net>"); 77 + MODULE_AUTHOR("Annaliese McDermond <nh6z@nh6z.net>"); 78 78 MODULE_LICENSE("GPL");
+2
sound/soc/codecs/tlv320aic32x4.c
··· 490 490 SND_SOC_DAPM_INPUT("IN2_R"), 491 491 SND_SOC_DAPM_INPUT("IN3_L"), 492 492 SND_SOC_DAPM_INPUT("IN3_R"), 493 + SND_SOC_DAPM_INPUT("CM_L"), 494 + SND_SOC_DAPM_INPUT("CM_R"), 493 495 }; 494 496 495 497 static const struct snd_soc_dapm_route aic32x4_dapm_routes[] = {
+3 -1
sound/soc/codecs/tlv320aic3x.c
··· 1609 1609 struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component); 1610 1610 int ret, i; 1611 1611 1612 - INIT_LIST_HEAD(&aic3x->list); 1613 1612 aic3x->component = component; 1614 1613 1615 1614 for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++) { ··· 1872 1873 if (ret != 0) 1873 1874 goto err_gpio; 1874 1875 1876 + INIT_LIST_HEAD(&aic3x->list); 1875 1877 list_add(&aic3x->list, &reset_list); 1876 1878 1877 1879 return 0; ··· 1888 1888 static int aic3x_i2c_remove(struct i2c_client *client) 1889 1889 { 1890 1890 struct aic3x_priv *aic3x = i2c_get_clientdata(client); 1891 + 1892 + list_del(&aic3x->list); 1891 1893 1892 1894 if (gpio_is_valid(aic3x->gpio_reset) && 1893 1895 !aic3x_is_shared_reset(aic3x)) {
+33 -7
sound/soc/codecs/wm_adsp.c
··· 2905 2905 if (wm_adsp_fw[dsp->fw].num_caps != 0) 2906 2906 wm_adsp_buffer_free(dsp); 2907 2907 2908 + dsp->fatal_error = false; 2909 + 2908 2910 mutex_unlock(&dsp->pwr_lock); 2909 2911 2910 2912 adsp_dbg(dsp, "Execution stopped\n"); ··· 3001 2999 static int wm_adsp_compr_attach(struct wm_adsp_compr *compr) 3002 3000 { 3003 3001 struct wm_adsp_compr_buf *buf = NULL, *tmp; 3002 + 3003 + if (compr->dsp->fatal_error) 3004 + return -EINVAL; 3004 3005 3005 3006 list_for_each_entry(tmp, &compr->dsp->buffer_list, list) { 3006 3007 if (!tmp->name || !strcmp(compr->name, tmp->name)) { ··· 3540 3535 3541 3536 ret = wm_adsp_buffer_read(buf, HOST_BUFFER_FIELD(error), &buf->error); 3542 3537 if (ret < 0) { 3543 - adsp_err(buf->dsp, "Failed to check buffer error: %d\n", ret); 3538 + compr_err(buf, "Failed to check buffer error: %d\n", ret); 3544 3539 return ret; 3545 3540 } 3546 3541 if (buf->error != 0) { 3547 - adsp_err(buf->dsp, "Buffer error occurred: %d\n", buf->error); 3542 + compr_err(buf, "Buffer error occurred: %d\n", buf->error); 3548 3543 return -EIO; 3549 3544 } 3550 3545 ··· 3576 3571 if (ret < 0) 3577 3572 break; 3578 3573 3579 - wm_adsp_buffer_clear(compr->buf); 3580 - 3581 3574 /* Trigger the IRQ at one fragment of data */ 3582 3575 ret = wm_adsp_buffer_write(compr->buf, 3583 3576 HOST_BUFFER_FIELD(high_water_mark), ··· 3587 3584 } 3588 3585 break; 3589 3586 case SNDRV_PCM_TRIGGER_STOP: 3587 + if (wm_adsp_compr_attached(compr)) 3588 + wm_adsp_buffer_clear(compr->buf); 3590 3589 break; 3591 3590 default: 3592 3591 ret = -EINVAL; ··· 3922 3917 } 3923 3918 EXPORT_SYMBOL_GPL(wm_adsp2_lock); 3924 3919 3920 + static void wm_adsp_fatal_error(struct wm_adsp *dsp) 3921 + { 3922 + struct wm_adsp_compr *compr; 3923 + 3924 + dsp->fatal_error = true; 3925 + 3926 + list_for_each_entry(compr, &dsp->compr_list, list) { 3927 + if (compr->stream) { 3928 + snd_compr_stop_error(compr->stream, 3929 + SNDRV_PCM_STATE_XRUN); 3930 + snd_compr_fragment_elapsed(compr->stream); 3931 + } 3932 + } 3933 + } 3934 + 3925 3935 irqreturn_t wm_adsp2_bus_error(struct wm_adsp *dsp) 3926 3936 { 3927 3937 unsigned int val; 3928 3938 struct regmap *regmap = dsp->regmap; 3929 3939 int ret = 0; 3930 3940 3941 + mutex_lock(&dsp->pwr_lock); 3942 + 3931 3943 ret = regmap_read(regmap, dsp->base + ADSP2_LOCK_REGION_CTRL, &val); 3932 3944 if (ret) { 3933 3945 adsp_err(dsp, 3934 3946 "Failed to read Region Lock Ctrl register: %d\n", ret); 3935 - return IRQ_HANDLED; 3947 + goto error; 3936 3948 } 3937 3949 3938 3950 if (val & ADSP2_WDT_TIMEOUT_STS_MASK) { 3939 3951 adsp_err(dsp, "watchdog timeout error\n"); 3940 3952 wm_adsp_stop_watchdog(dsp); 3953 + wm_adsp_fatal_error(dsp); 3941 3954 } 3942 3955 3943 3956 if (val & (ADSP2_SLAVE_ERR_MASK | ADSP2_REGION_LOCK_ERR_MASK)) { ··· 3969 3946 adsp_err(dsp, 3970 3947 "Failed to read Bus Err Addr register: %d\n", 3971 3948 ret); 3972 - return IRQ_HANDLED; 3949 + goto error; 3973 3950 } 3974 3951 3975 3952 adsp_err(dsp, "bus error address = 0x%x\n", ··· 3982 3959 adsp_err(dsp, 3983 3960 "Failed to read Pmem Xmem Err Addr register: %d\n", 3984 3961 ret); 3985 - return IRQ_HANDLED; 3962 + goto error; 3986 3963 } 3987 3964 3988 3965 adsp_err(dsp, "xmem error address = 0x%x\n", ··· 3994 3971 3995 3972 regmap_update_bits(regmap, dsp->base + ADSP2_LOCK_REGION_CTRL, 3996 3973 ADSP2_CTRL_ERR_EINT, ADSP2_CTRL_ERR_EINT); 3974 + 3975 + error: 3976 + mutex_unlock(&dsp->pwr_lock); 3997 3977 3998 3978 return IRQ_HANDLED; 3999 3979 }
+1
sound/soc/codecs/wm_adsp.h
··· 85 85 bool preloaded; 86 86 bool booted; 87 87 bool running; 88 + bool fatal_error; 88 89 89 90 struct list_head ctl_list; 90 91
+14
sound/soc/fsl/fsl_asrc.c
··· 445 445 } 446 446 EXPORT_SYMBOL_GPL(fsl_asrc_get_dma_channel); 447 447 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 + 448 461 static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream, 449 462 struct snd_pcm_hw_params *params, 450 463 struct snd_soc_dai *dai) ··· 552 539 } 553 540 554 541 static const struct snd_soc_dai_ops fsl_asrc_dai_ops = { 542 + .startup = fsl_asrc_dai_startup, 555 543 .hw_params = fsl_asrc_dai_hw_params, 556 544 .hw_free = fsl_asrc_dai_hw_free, 557 545 .trigger = fsl_asrc_dai_trigger,
+37 -10
sound/soc/fsl/fsl_esai.c
··· 54 54 u32 fifo_depth; 55 55 u32 slot_width; 56 56 u32 slots; 57 + u32 tx_mask; 58 + u32 rx_mask; 57 59 u32 hck_rate[2]; 58 60 u32 sck_rate[2]; 59 61 bool hck_dir[2]; ··· 363 361 regmap_update_bits(esai_priv->regmap, REG_ESAI_TCCR, 364 362 ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(slots)); 365 363 366 - regmap_update_bits(esai_priv->regmap, REG_ESAI_TSMA, 367 - ESAI_xSMA_xS_MASK, ESAI_xSMA_xS(tx_mask)); 368 - regmap_update_bits(esai_priv->regmap, REG_ESAI_TSMB, 369 - ESAI_xSMB_xS_MASK, ESAI_xSMB_xS(tx_mask)); 370 - 371 364 regmap_update_bits(esai_priv->regmap, REG_ESAI_RCCR, 372 365 ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(slots)); 373 366 374 - regmap_update_bits(esai_priv->regmap, REG_ESAI_RSMA, 375 - ESAI_xSMA_xS_MASK, ESAI_xSMA_xS(rx_mask)); 376 - regmap_update_bits(esai_priv->regmap, REG_ESAI_RSMB, 377 - ESAI_xSMB_xS_MASK, ESAI_xSMB_xS(rx_mask)); 378 - 379 367 esai_priv->slot_width = slot_width; 380 368 esai_priv->slots = slots; 369 + esai_priv->tx_mask = tx_mask; 370 + esai_priv->rx_mask = rx_mask; 381 371 382 372 return 0; 383 373 } ··· 590 596 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; 591 597 u8 i, channels = substream->runtime->channels; 592 598 u32 pins = DIV_ROUND_UP(channels, esai_priv->slots); 599 + u32 mask; 593 600 594 601 switch (cmd) { 595 602 case SNDRV_PCM_TRIGGER_START: ··· 603 608 for (i = 0; tx && i < channels; i++) 604 609 regmap_write(esai_priv->regmap, REG_ESAI_ETDR, 0x0); 605 610 611 + /* 612 + * When set the TE/RE in the end of enablement flow, there 613 + * will be channel swap issue for multi data line case. 614 + * In order to workaround this issue, we switch the bit 615 + * enablement sequence to below sequence 616 + * 1) clear the xSMB & xSMA: which is done in probe and 617 + * stop state. 618 + * 2) set TE/RE 619 + * 3) set xSMB 620 + * 4) set xSMA: xSMA is the last one in this flow, which 621 + * will trigger esai to start. 622 + */ 606 623 regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx), 607 624 tx ? ESAI_xCR_TE_MASK : ESAI_xCR_RE_MASK, 608 625 tx ? ESAI_xCR_TE(pins) : ESAI_xCR_RE(pins)); 626 + mask = tx ? esai_priv->tx_mask : esai_priv->rx_mask; 627 + 628 + regmap_update_bits(esai_priv->regmap, REG_ESAI_xSMB(tx), 629 + ESAI_xSMB_xS_MASK, ESAI_xSMB_xS(mask)); 630 + regmap_update_bits(esai_priv->regmap, REG_ESAI_xSMA(tx), 631 + ESAI_xSMA_xS_MASK, ESAI_xSMA_xS(mask)); 632 + 609 633 break; 610 634 case SNDRV_PCM_TRIGGER_SUSPEND: 611 635 case SNDRV_PCM_TRIGGER_STOP: 612 636 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 613 637 regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx), 614 638 tx ? ESAI_xCR_TE_MASK : ESAI_xCR_RE_MASK, 0); 639 + regmap_update_bits(esai_priv->regmap, REG_ESAI_xSMA(tx), 640 + ESAI_xSMA_xS_MASK, 0); 641 + regmap_update_bits(esai_priv->regmap, REG_ESAI_xSMB(tx), 642 + ESAI_xSMB_xS_MASK, 0); 615 643 616 644 /* Disable and reset FIFO */ 617 645 regmap_update_bits(esai_priv->regmap, REG_ESAI_xFCR(tx), ··· 923 905 dev_err(&pdev->dev, "failed to enable ESAI: %d\n", ret); 924 906 return ret; 925 907 } 908 + 909 + esai_priv->tx_mask = 0xFFFFFFFF; 910 + esai_priv->rx_mask = 0xFFFFFFFF; 911 + 912 + /* Clear the TSMA, TSMB, RSMA, RSMB */ 913 + regmap_write(esai_priv->regmap, REG_ESAI_TSMA, 0); 914 + regmap_write(esai_priv->regmap, REG_ESAI_TSMB, 0); 915 + regmap_write(esai_priv->regmap, REG_ESAI_RSMA, 0); 916 + regmap_write(esai_priv->regmap, REG_ESAI_RSMB, 0); 926 917 927 918 ret = devm_snd_soc_register_component(&pdev->dev, &fsl_esai_component, 928 919 &fsl_esai_dai, 1);
+8 -3
sound/soc/generic/audio-graph-card.c
··· 20 20 #include <linux/string.h> 21 21 #include <sound/simple_card_utils.h> 22 22 23 + #define DPCM_SELECTABLE 1 24 + 23 25 struct graph_priv { 24 26 struct snd_soc_card snd_card; 25 27 struct graph_dai_props { ··· 442 440 struct device_node *codec_port; 443 441 struct device_node *codec_port_old = NULL; 444 442 struct asoc_simple_card_data adata; 443 + uintptr_t dpcm_selectable = (uintptr_t)of_device_get_match_data(dev); 445 444 int rc, ret; 446 445 447 446 /* loop for all listed CPU port */ ··· 473 470 * if Codec port has many endpoints, 474 471 * or has convert-xxx property 475 472 */ 476 - if ((of_get_child_count(codec_port) > 1) || 477 - adata.convert_rate || adata.convert_channels) 473 + if (dpcm_selectable && 474 + ((of_get_child_count(codec_port) > 1) || 475 + adata.convert_rate || adata.convert_channels)) 478 476 ret = func_dpcm(priv, cpu_ep, codec_ep, li, 479 477 (codec_port_old == codec_port)); 480 478 /* else normal sound */ ··· 736 732 737 733 static const struct of_device_id graph_of_match[] = { 738 734 { .compatible = "audio-graph-card", }, 739 - { .compatible = "audio-graph-scu-card", }, 735 + { .compatible = "audio-graph-scu-card", 736 + .data = (void *)DPCM_SELECTABLE }, 740 737 {}, 741 738 }; 742 739 MODULE_DEVICE_TABLE(of, graph_of_match);
+9 -3
sound/soc/generic/simple-card.c
··· 9 9 #include <linux/device.h> 10 10 #include <linux/module.h> 11 11 #include <linux/of.h> 12 + #include <linux/of_device.h> 12 13 #include <linux/platform_device.h> 13 14 #include <linux/string.h> 14 15 #include <sound/simple_card.h> 15 16 #include <sound/soc-dai.h> 16 17 #include <sound/soc.h> 18 + 19 + #define DPCM_SELECTABLE 1 17 20 18 21 struct simple_priv { 19 22 struct snd_soc_card snd_card; ··· 444 441 struct device *dev = simple_priv_to_dev(priv); 445 442 struct device_node *top = dev->of_node; 446 443 struct device_node *node; 444 + uintptr_t dpcm_selectable = (uintptr_t)of_device_get_match_data(dev); 447 445 bool is_top = 0; 448 446 int ret = 0; 449 447 ··· 484 480 * if it has many CPUs, 485 481 * or has convert-xxx property 486 482 */ 487 - if (num > 2 || 488 - adata.convert_rate || adata.convert_channels) 483 + if (dpcm_selectable && 484 + (num > 2 || 485 + adata.convert_rate || adata.convert_channels)) 489 486 ret = func_dpcm(priv, np, codec, li, is_top); 490 487 /* else normal sound */ 491 488 else ··· 827 822 828 823 static const struct of_device_id simple_of_match[] = { 829 824 { .compatible = "simple-audio-card", }, 830 - { .compatible = "simple-scu-audio-card", }, 825 + { .compatible = "simple-scu-audio-card", 826 + .data = (void *)DPCM_SELECTABLE }, 831 827 {}, 832 828 }; 833 829 MODULE_DEVICE_TABLE(of, simple_of_match);
+8
sound/soc/intel/atom/sst-mfld-platform-pcm.c
··· 706 706 return sst_dsp_init_v2_dpcm(component); 707 707 } 708 708 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 + 709 716 static const struct snd_soc_component_driver sst_soc_platform_drv = { 710 717 .name = DRV_NAME, 711 718 .probe = sst_soc_probe, 719 + .remove = sst_soc_remove, 712 720 .ops = &sst_platform_ops, 713 721 .compr_ops = &sst_platform_compr_ops, 714 722 .pcm_new = sst_pcm_new,
+41 -6
sound/soc/intel/boards/cht_bsw_max98090_ti.c
··· 43 43 struct clk *mclk; 44 44 struct snd_soc_jack jack; 45 45 bool ts3a227e_present; 46 + int quirks; 46 47 }; 47 48 48 49 static int platform_clock_control(struct snd_soc_dapm_widget *w, ··· 54 53 struct snd_soc_dai *codec_dai; 55 54 struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card); 56 55 int ret; 56 + 57 + /* See the comment in snd_cht_mc_probe() */ 58 + if (ctx->quirks & QUIRK_PMC_PLT_CLK_0) 59 + return 0; 57 60 58 61 codec_dai = snd_soc_card_get_codec_dai(card, CHT_CODEC_DAI); 59 62 if (!codec_dai) { ··· 227 222 dev_err(runtime->dev, 228 223 "jack detection gpios not added, error %d\n", ret); 229 224 } 225 + 226 + /* See the comment in snd_cht_mc_probe() */ 227 + if (ctx->quirks & QUIRK_PMC_PLT_CLK_0) 228 + return 0; 230 229 231 230 /* 232 231 * The firmware might enable the clock at ··· 432 423 const char *mclk_name; 433 424 struct snd_soc_acpi_mach *mach; 434 425 const char *platform_name; 435 - int quirks = 0; 436 - 437 - dmi_id = dmi_first_match(cht_max98090_quirk_table); 438 - if (dmi_id) 439 - quirks = (unsigned long)dmi_id->driver_data; 440 426 441 427 drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); 442 428 if (!drv) 443 429 return -ENOMEM; 430 + 431 + dmi_id = dmi_first_match(cht_max98090_quirk_table); 432 + if (dmi_id) 433 + drv->quirks = (unsigned long)dmi_id->driver_data; 444 434 445 435 drv->ts3a227e_present = acpi_dev_found("104C227E"); 446 436 if (!drv->ts3a227e_present) { ··· 466 458 snd_soc_card_cht.dev = &pdev->dev; 467 459 snd_soc_card_set_drvdata(&snd_soc_card_cht, drv); 468 460 469 - if (quirks & QUIRK_PMC_PLT_CLK_0) 461 + if (drv->quirks & QUIRK_PMC_PLT_CLK_0) 470 462 mclk_name = "pmc_plt_clk_0"; 471 463 else 472 464 mclk_name = "pmc_plt_clk_3"; ··· 479 471 return PTR_ERR(drv->mclk); 480 472 } 481 473 474 + /* 475 + * Boards which have the MAX98090's clk connected to clk_0 do not seem 476 + * to like it if we muck with the clock. If we disable the clock when 477 + * it is unused we get "max98090 i2c-193C9890:00: PLL unlocked" errors 478 + * and the PLL never seems to lock again. 479 + * So for these boards we enable it here once and leave it at that. 480 + */ 481 + if (drv->quirks & QUIRK_PMC_PLT_CLK_0) { 482 + ret_val = clk_prepare_enable(drv->mclk); 483 + if (ret_val < 0) { 484 + dev_err(&pdev->dev, "MCLK enable error: %d\n", ret_val); 485 + return ret_val; 486 + } 487 + } 488 + 482 489 ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht); 483 490 if (ret_val) { 484 491 dev_err(&pdev->dev, ··· 504 481 return ret_val; 505 482 } 506 483 484 + static int snd_cht_mc_remove(struct platform_device *pdev) 485 + { 486 + struct snd_soc_card *card = platform_get_drvdata(pdev); 487 + struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card); 488 + 489 + if (ctx->quirks & QUIRK_PMC_PLT_CLK_0) 490 + clk_disable_unprepare(ctx->mclk); 491 + 492 + return 0; 493 + } 494 + 507 495 static struct platform_driver snd_cht_mc_driver = { 508 496 .driver = { 509 497 .name = "cht-bsw-max98090", 510 498 }, 511 499 .probe = snd_cht_mc_probe, 500 + .remove = snd_cht_mc_remove, 512 501 }; 513 502 514 503 module_platform_driver(snd_cht_mc_driver)
+1 -1
sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
··· 405 405 }; 406 406 407 407 static const unsigned int dmic_2ch[] = { 408 - 4, 408 + 2, 409 409 }; 410 410 411 411 static const struct snd_pcm_hw_constraint_list constraints_dmic_2ch = {
+1
sound/soc/intel/skylake/skl-messages.c
··· 483 483 base_cfg->audio_fmt.bit_depth = format->bit_depth; 484 484 base_cfg->audio_fmt.valid_bit_depth = format->valid_bit_depth; 485 485 base_cfg->audio_fmt.ch_cfg = format->ch_cfg; 486 + base_cfg->audio_fmt.sample_type = format->sample_type; 486 487 487 488 dev_dbg(ctx->dev, "bit_depth=%x valid_bd=%x ch_config=%x\n", 488 489 format->bit_depth, format->valid_bit_depth,
+22 -6
sound/soc/intel/skylake/skl-pcm.c
··· 181 181 struct hdac_stream *hstream; 182 182 struct hdac_ext_stream *stream; 183 183 struct hdac_ext_link *link; 184 + unsigned char stream_tag; 184 185 185 186 hstream = snd_hdac_get_stream(bus, params->stream, 186 187 params->link_dma_id + 1); ··· 200 199 201 200 snd_hdac_ext_link_stream_setup(stream, format_val); 202 201 203 - list_for_each_entry(link, &bus->hlink_list, list) { 204 - if (link->index == params->link_index) 205 - snd_hdac_ext_link_set_stream_id(link, 206 - hstream->stream_tag); 202 + stream_tag = hstream->stream_tag; 203 + if (stream->hstream.direction == SNDRV_PCM_STREAM_PLAYBACK) { 204 + list_for_each_entry(link, &bus->hlink_list, list) { 205 + if (link->index == params->link_index) 206 + snd_hdac_ext_link_set_stream_id(link, 207 + stream_tag); 208 + } 207 209 } 208 210 209 211 stream->link_prepared = 1; ··· 649 645 struct hdac_ext_stream *link_dev = 650 646 snd_soc_dai_get_dma_data(dai, substream); 651 647 struct hdac_ext_link *link; 648 + unsigned char stream_tag; 652 649 653 650 dev_dbg(dai->dev, "%s: %s\n", __func__, dai->name); 654 651 ··· 659 654 if (!link) 660 655 return -EINVAL; 661 656 662 - snd_hdac_ext_link_clear_stream_id(link, hdac_stream(link_dev)->stream_tag); 657 + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 658 + stream_tag = hdac_stream(link_dev)->stream_tag; 659 + snd_hdac_ext_link_clear_stream_id(link, stream_tag); 660 + } 661 + 663 662 snd_hdac_ext_stream_release(link_dev, HDAC_EXT_STREAM_TYPE_LINK); 664 663 return 0; 665 664 } ··· 1462 1453 return 0; 1463 1454 } 1464 1455 1456 + static void skl_pcm_remove(struct snd_soc_component *component) 1457 + { 1458 + /* remove topology */ 1459 + snd_soc_tplg_component_remove(component, SND_SOC_TPLG_INDEX_ALL); 1460 + } 1461 + 1465 1462 static const struct snd_soc_component_driver skl_component = { 1466 1463 .name = "pcm", 1467 1464 .probe = skl_platform_soc_probe, 1465 + .remove = skl_pcm_remove, 1468 1466 .ops = &skl_platform_ops, 1469 1467 .pcm_new = skl_pcm_new, 1470 1468 .pcm_free = skl_pcm_free, 1471 - .ignore_module_refcount = 1, /* do not increase the refcount in core */ 1469 + .module_get_upon_open = 1, /* increment refcount when a pcm is opened */ 1472 1470 }; 1473 1471 1474 1472 int skl_platform_register(struct device *dev)
+68 -1
sound/soc/mediatek/common/mtk-btcvsd.c
··· 49 49 BT_SCO_STATE_IDLE, 50 50 BT_SCO_STATE_RUNNING, 51 51 BT_SCO_STATE_ENDING, 52 + BT_SCO_STATE_LOOPBACK, 52 53 }; 53 54 54 55 enum bt_sco_direct { ··· 487 486 if (bt->rx->state != BT_SCO_STATE_RUNNING && 488 487 bt->rx->state != BT_SCO_STATE_ENDING && 489 488 bt->tx->state != BT_SCO_STATE_RUNNING && 490 - bt->tx->state != BT_SCO_STATE_ENDING) { 489 + bt->tx->state != BT_SCO_STATE_ENDING && 490 + bt->tx->state != BT_SCO_STATE_LOOPBACK) { 491 491 dev_warn(bt->dev, "%s(), in idle state: rx->state: %d, tx->state: %d\n", 492 492 __func__, bt->rx->state, bt->tx->state); 493 493 goto irq_handler_exit; ··· 513 511 packet_num = btsco_packet_info[packet_type][1]; 514 512 buf_cnt_tx = btsco_packet_info[packet_type][2]; 515 513 buf_cnt_rx = btsco_packet_info[packet_type][3]; 514 + 515 + if (bt->tx->state == BT_SCO_STATE_LOOPBACK) { 516 + u8 *src, *dst; 517 + unsigned long connsys_addr_rx, ap_addr_rx; 518 + unsigned long connsys_addr_tx, ap_addr_tx; 519 + 520 + connsys_addr_rx = *bt->bt_reg_pkt_r; 521 + ap_addr_rx = (unsigned long)bt->bt_sram_bank2_base + 522 + (connsys_addr_rx & 0xFFFF); 523 + 524 + connsys_addr_tx = *bt->bt_reg_pkt_w; 525 + ap_addr_tx = (unsigned long)bt->bt_sram_bank2_base + 526 + (connsys_addr_tx & 0xFFFF); 527 + 528 + if (connsys_addr_tx == 0xdeadfeed || 529 + connsys_addr_rx == 0xdeadfeed) { 530 + /* bt return 0xdeadfeed if read reg during bt sleep */ 531 + dev_warn(bt->dev, "%s(), connsys_addr_tx == 0xdeadfeed\n", 532 + __func__); 533 + goto irq_handler_exit; 534 + } 535 + 536 + src = (u8 *)ap_addr_rx; 537 + dst = (u8 *)ap_addr_tx; 538 + 539 + mtk_btcvsd_snd_data_transfer(BT_SCO_DIRECT_BT2ARM, src, 540 + bt->tx->temp_packet_buf, 541 + packet_length, 542 + packet_num); 543 + mtk_btcvsd_snd_data_transfer(BT_SCO_DIRECT_ARM2BT, 544 + bt->tx->temp_packet_buf, dst, 545 + packet_length, 546 + packet_num); 547 + bt->rx->rw_cnt++; 548 + bt->tx->rw_cnt++; 549 + } 516 550 517 551 if (bt->rx->state == BT_SCO_STATE_RUNNING || 518 552 bt->rx->state == BT_SCO_STATE_ENDING) { ··· 1105 1067 return 0; 1106 1068 } 1107 1069 1070 + static int btcvsd_loopback_get(struct snd_kcontrol *kcontrol, 1071 + struct snd_ctl_elem_value *ucontrol) 1072 + { 1073 + struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); 1074 + struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(cmpnt); 1075 + bool lpbk_en = bt->tx->state == BT_SCO_STATE_LOOPBACK; 1076 + 1077 + ucontrol->value.integer.value[0] = lpbk_en; 1078 + return 0; 1079 + } 1080 + 1081 + static int btcvsd_loopback_set(struct snd_kcontrol *kcontrol, 1082 + struct snd_ctl_elem_value *ucontrol) 1083 + { 1084 + struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol); 1085 + struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(cmpnt); 1086 + 1087 + if (ucontrol->value.integer.value[0]) { 1088 + mtk_btcvsd_snd_set_state(bt, bt->tx, BT_SCO_STATE_LOOPBACK); 1089 + mtk_btcvsd_snd_set_state(bt, bt->rx, BT_SCO_STATE_LOOPBACK); 1090 + } else { 1091 + mtk_btcvsd_snd_set_state(bt, bt->tx, BT_SCO_STATE_RUNNING); 1092 + mtk_btcvsd_snd_set_state(bt, bt->rx, BT_SCO_STATE_RUNNING); 1093 + } 1094 + return 0; 1095 + } 1096 + 1108 1097 static int btcvsd_tx_mute_get(struct snd_kcontrol *kcontrol, 1109 1098 struct snd_ctl_elem_value *ucontrol) 1110 1099 { ··· 1267 1202 static const struct snd_kcontrol_new mtk_btcvsd_snd_controls[] = { 1268 1203 SOC_ENUM_EXT("BTCVSD Band", btcvsd_enum[0], 1269 1204 btcvsd_band_get, btcvsd_band_set), 1205 + SOC_SINGLE_BOOL_EXT("BTCVSD Loopback Switch", 0, 1206 + btcvsd_loopback_get, btcvsd_loopback_set), 1270 1207 SOC_SINGLE_BOOL_EXT("BTCVSD Tx Mute Switch", 0, 1271 1208 btcvsd_tx_mute_get, btcvsd_tx_mute_set), 1272 1209 SOC_SINGLE_BOOL_EXT("BTCVSD Tx Irq Received Switch", 0,
+4
sound/soc/mediatek/mt8183/mt8183-afe-clk.c
··· 605 605 int m_sel_id = mck_div[mck_id].m_sel_id; 606 606 int div_clk_id = mck_div[mck_id].div_clk_id; 607 607 608 + /* i2s5 mck not support */ 609 + if (mck_id == MT8183_I2S5_MCK) 610 + return; 611 + 608 612 clk_disable_unprepare(afe_priv->clk[div_clk_id]); 609 613 if (m_sel_id >= 0) 610 614 clk_disable_unprepare(afe_priv->clk[m_sel_id]);
+3 -1
sound/soc/rockchip/rockchip_pdm.c
··· 24 24 25 25 #include "rockchip_pdm.h" 26 26 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 */ 28 28 29 29 struct rk_pdm_dev { 30 30 struct device *dev; ··· 208 208 return -EINVAL; 209 209 } 210 210 211 + pm_runtime_get_sync(cpu_dai->dev); 211 212 regmap_update_bits(pdm->regmap, PDM_CLK_CTRL, mask, val); 213 + pm_runtime_put(cpu_dai->dev); 212 214 213 215 return 0; 214 216 }
+6 -4
sound/soc/samsung/i2s.c
··· 1130 1130 }; 1131 1131 1132 1132 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" }, 1135 1135 1136 1136 { "Mixer DAI TX", NULL, "Playback Mixer" }, 1137 - { "Playback Mixer", NULL, "Mixer DAI RX" }, 1137 + { "Primary Capture", NULL, "Mixer DAI RX" }, 1138 1138 }; 1139 1139 1140 1140 static const struct snd_soc_component_driver samsung_i2s_component = { ··· 1155 1155 int num_dais) 1156 1156 { 1157 1157 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" }; 1159 1160 struct snd_soc_dai_driver *dai_drv; 1160 1161 struct i2s_dai *dai; 1161 1162 int i; ··· 1202 1201 dai_drv->capture.channels_max = 2; 1203 1202 dai_drv->capture.rates = i2s_dai_data->pcm_rates; 1204 1203 dai_drv->capture.formats = SAMSUNG_I2S_FMTS; 1204 + dai_drv->capture.stream_name = "Primary Capture"; 1205 1205 1206 1206 return 0; 1207 1207 }
+2 -2
sound/soc/samsung/odroid.c
··· 91 91 return ret; 92 92 93 93 /* 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 95 95 * frequency values due to the EPLL output frequency not being exact 96 96 * multiple of the audio sampling rate. 97 97 */ 98 - rclk_freq = params_rate(params) * rfs + 1; 98 + rclk_freq = params_rate(params) * rfs + 2; 99 99 100 100 ret = clk_set_rate(priv->sclk_i2s, rclk_freq); 101 101 if (ret < 0)
+2
sound/soc/sh/rcar/core.c
··· 110 110 { .compatible = "renesas,rcar_sound-gen1", .data = (void *)RSND_GEN1 }, 111 111 { .compatible = "renesas,rcar_sound-gen2", .data = (void *)RSND_GEN2 }, 112 112 { .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) }, 113 115 {}, 114 116 }; 115 117 MODULE_DEVICE_TABLE(of, rsnd_of_match);
+5
sound/soc/sh/rcar/rsnd.h
··· 607 607 #define RSND_GEN1 (1 << 0) 608 608 #define RSND_GEN2 (2 << 0) 609 609 #define RSND_GEN3 (3 << 0) 610 + #define RSND_SOC_MASK (0xFF << 4) 611 + #define RSND_SOC_E (1 << 4) /* E1/E2/E3 */ 610 612 611 613 /* 612 614 * below value will be filled on rsnd_gen_probe() ··· 681 679 #define rsnd_is_gen1(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN1) 682 680 #define rsnd_is_gen2(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN2) 683 681 #define rsnd_is_gen3(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN3) 682 + #define rsnd_is_e3(priv) (((priv)->flags & \ 683 + (RSND_GEN_MASK | RSND_SOC_MASK)) == \ 684 + (RSND_GEN3 | RSND_SOC_E)) 684 685 685 686 #define rsnd_flags_has(p, f) ((p)->flags & (f)) 686 687 #define rsnd_flags_set(p, f) ((p)->flags |= (f))
+7 -14
sound/soc/sh/rcar/src.c
··· 14 14 */ 15 15 16 16 #include "rsnd.h" 17 - #include <linux/sys_soc.h> 18 17 19 18 #define SRC_NAME "src" 20 19 ··· 134 135 return rate; 135 136 } 136 137 137 - const static u32 bsdsr_table_pattern1[] = { 138 + static const u32 bsdsr_table_pattern1[] = { 138 139 0x01800000, /* 6 - 1/6 */ 139 140 0x01000000, /* 6 - 1/4 */ 140 141 0x00c00000, /* 6 - 1/3 */ ··· 143 144 0x00400000, /* 6 - 1 */ 144 145 }; 145 146 146 - const static u32 bsdsr_table_pattern2[] = { 147 + static const u32 bsdsr_table_pattern2[] = { 147 148 0x02400000, /* 6 - 1/6 */ 148 149 0x01800000, /* 6 - 1/4 */ 149 150 0x01200000, /* 6 - 1/3 */ ··· 152 153 0x00600000, /* 6 - 1 */ 153 154 }; 154 155 155 - const static u32 bsisr_table[] = { 156 + static const u32 bsisr_table[] = { 156 157 0x00100060, /* 6 - 1/6 */ 157 158 0x00100040, /* 6 - 1/4 */ 158 159 0x00100030, /* 6 - 1/3 */ ··· 161 162 0x00100020, /* 6 - 1 */ 162 163 }; 163 164 164 - const static u32 chan288888[] = { 165 + static const u32 chan288888[] = { 165 166 0x00000006, /* 1 to 2 */ 166 167 0x000001fe, /* 1 to 8 */ 167 168 0x000001fe, /* 1 to 8 */ ··· 170 171 0x000001fe, /* 1 to 8 */ 171 172 }; 172 173 173 - const static u32 chan244888[] = { 174 + static const u32 chan244888[] = { 174 175 0x00000006, /* 1 to 2 */ 175 176 0x0000001e, /* 1 to 4 */ 176 177 0x0000001e, /* 1 to 4 */ ··· 179 180 0x000001fe, /* 1 to 8 */ 180 181 }; 181 182 182 - const static u32 chan222222[] = { 183 + static const u32 chan222222[] = { 183 184 0x00000006, /* 1 to 2 */ 184 185 0x00000006, /* 1 to 2 */ 185 186 0x00000006, /* 1 to 2 */ 186 187 0x00000006, /* 1 to 2 */ 187 188 0x00000006, /* 1 to 2 */ 188 189 0x00000006, /* 1 to 2 */ 189 - }; 190 - 191 - static const struct soc_device_attribute ov_soc[] = { 192 - { .soc_id = "r8a77990" }, /* E3 */ 193 - { /* sentinel */ } 194 190 }; 195 191 196 192 static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io, ··· 194 200 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); 195 201 struct device *dev = rsnd_priv_to_dev(priv); 196 202 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); 197 - const struct soc_device_attribute *soc = soc_device_match(ov_soc); 198 203 int is_play = rsnd_io_is_play(io); 199 204 int use_src = 0; 200 205 u32 fin, fout; ··· 300 307 /* 301 308 * E3 need to overwrite 302 309 */ 303 - if (soc) 310 + if (rsnd_is_e3(priv)) 304 311 switch (rsnd_mod_id(mod)) { 305 312 case 0: 306 313 case 4:
+4 -2
sound/soc/soc-core.c
··· 947 947 snd_soc_dapm_free(snd_soc_component_get_dapm(component)); 948 948 soc_cleanup_component_debugfs(component); 949 949 component->card = NULL; 950 - if (!component->driver->ignore_module_refcount) 950 + if (!component->driver->module_get_upon_open) 951 951 module_put(component->dev->driver->owner); 952 952 } 953 953 ··· 1381 1381 return 0; 1382 1382 } 1383 1383 1384 - if (!component->driver->ignore_module_refcount && 1384 + if (!component->driver->module_get_upon_open && 1385 1385 !try_module_get(component->dev->driver->owner)) 1386 1386 return -ENODEV; 1387 1387 ··· 2797 2797 2798 2798 ret = soc_init_dai_link(card, link); 2799 2799 if (ret) { 2800 + soc_cleanup_platform(card); 2800 2801 dev_err(card->dev, "ASoC: failed to init link %s\n", 2801 2802 link->name); 2802 2803 mutex_unlock(&client_mutex); ··· 2820 2819 card->instantiated = 0; 2821 2820 mutex_init(&card->mutex); 2822 2821 mutex_init(&card->dapm_mutex); 2822 + spin_lock_init(&card->dpcm_lock); 2823 2823 2824 2824 return snd_soc_bind_card(card); 2825 2825 }
+11
sound/soc/soc-dapm.c
··· 3650 3650 case snd_soc_dapm_dac: 3651 3651 case snd_soc_dapm_aif_in: 3652 3652 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: 3653 3660 case snd_soc_dapm_out_drv: 3654 3661 case snd_soc_dapm_micbias: 3655 3662 case snd_soc_dapm_line: ··· 3964 3957 int count; 3965 3958 3966 3959 devm_kfree(card->dev, (void *)*private_value); 3960 + 3961 + if (!w_param_text) 3962 + return; 3963 + 3967 3964 for (count = 0 ; count < num_params; count++) 3968 3965 devm_kfree(card->dev, (void *)w_param_text[count]); 3969 3966 devm_kfree(card->dev, w_param_text);
+55 -11
sound/soc/soc-pcm.c
··· 15 15 #include <linux/delay.h> 16 16 #include <linux/pinctrl/consumer.h> 17 17 #include <linux/pm_runtime.h> 18 + #include <linux/module.h> 18 19 #include <linux/slab.h> 19 20 #include <linux/workqueue.h> 20 21 #include <linux/export.h> ··· 464 463 continue; 465 464 466 465 component->driver->ops->close(substream); 466 + 467 + if (component->driver->module_get_upon_open) 468 + module_put(component->dev->driver->owner); 467 469 } 468 470 469 471 return 0; ··· 516 512 if (!component->driver->ops || 517 513 !component->driver->ops->open) 518 514 continue; 515 + 516 + if (component->driver->module_get_upon_open && 517 + !try_module_get(component->dev->driver->owner)) { 518 + ret = -ENODEV; 519 + goto module_err; 520 + } 519 521 520 522 ret = component->driver->ops->open(substream); 521 523 if (ret < 0) { ··· 638 628 639 629 component_err: 640 630 soc_pcm_components_close(substream, component); 641 - 631 + module_err: 642 632 if (cpu_dai->driver->ops->shutdown) 643 633 cpu_dai->driver->ops->shutdown(substream, cpu_dai); 644 634 out: ··· 964 954 codec_params = *params; 965 955 966 956 /* fixup params based on TDM slot masks */ 967 - if (codec_dai->tx_mask) 957 + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && 958 + codec_dai->tx_mask) 968 959 soc_pcm_codec_params_fixup(&codec_params, 969 960 codec_dai->tx_mask); 970 - if (codec_dai->rx_mask) 961 + 962 + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && 963 + codec_dai->rx_mask) 971 964 soc_pcm_codec_params_fixup(&codec_params, 972 965 codec_dai->rx_mask); 973 966 ··· 1226 1213 struct snd_soc_pcm_runtime *be, int stream) 1227 1214 { 1228 1215 struct snd_soc_dpcm *dpcm; 1216 + unsigned long flags; 1229 1217 1230 1218 /* only add new dpcms */ 1231 1219 for_each_dpcm_be(fe, stream, dpcm) { ··· 1242 1228 dpcm->fe = fe; 1243 1229 be->dpcm[stream].runtime = fe->dpcm[stream].runtime; 1244 1230 dpcm->state = SND_SOC_DPCM_LINK_STATE_NEW; 1231 + spin_lock_irqsave(&fe->card->dpcm_lock, flags); 1245 1232 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); 1246 1233 list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); 1234 + spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); 1247 1235 1248 1236 dev_dbg(fe->dev, "connected new DPCM %s path %s %s %s\n", 1249 1237 stream ? "capture" : "playback", fe->dai_link->name, ··· 1291 1275 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) 1292 1276 { 1293 1277 struct snd_soc_dpcm *dpcm, *d; 1278 + unsigned long flags; 1294 1279 1295 1280 for_each_dpcm_be_safe(fe, stream, dpcm, d) { 1296 1281 dev_dbg(fe->dev, "ASoC: BE %s disconnect check for %s\n", ··· 1311 1294 #ifdef CONFIG_DEBUG_FS 1312 1295 debugfs_remove(dpcm->debugfs_state); 1313 1296 #endif 1297 + spin_lock_irqsave(&fe->card->dpcm_lock, flags); 1314 1298 list_del(&dpcm->list_be); 1315 1299 list_del(&dpcm->list_fe); 1300 + spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); 1316 1301 kfree(dpcm); 1317 1302 } 1318 1303 } ··· 1566 1547 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) 1567 1548 { 1568 1549 struct snd_soc_dpcm *dpcm; 1550 + unsigned long flags; 1569 1551 1552 + spin_lock_irqsave(&fe->card->dpcm_lock, flags); 1570 1553 for_each_dpcm_be(fe, stream, dpcm) 1571 1554 dpcm->be->dpcm[stream].runtime_update = 1572 1555 SND_SOC_DPCM_UPDATE_NO; 1556 + spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); 1573 1557 } 1574 1558 1575 1559 static void dpcm_be_dai_startup_unwind(struct snd_soc_pcm_runtime *fe, ··· 1921 1899 struct snd_soc_pcm_runtime *be = dpcm->be; 1922 1900 struct snd_pcm_substream *be_substream = 1923 1901 snd_soc_dpcm_get_substream(be, stream); 1924 - struct snd_soc_pcm_runtime *rtd = be_substream->private_data; 1902 + struct snd_soc_pcm_runtime *rtd; 1925 1903 struct snd_soc_dai *codec_dai; 1926 1904 int i; 1927 1905 1906 + /* A backend may not have the requested substream */ 1907 + if (!be_substream) 1908 + continue; 1909 + 1910 + rtd = be_substream->private_data; 1928 1911 if (rtd->dai_link->be_hw_params_fixup) 1929 1912 continue; 1930 1913 ··· 2598 2571 struct snd_soc_dpcm *dpcm; 2599 2572 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; 2600 2573 int ret; 2574 + unsigned long flags; 2601 2575 2602 2576 dev_dbg(fe->dev, "ASoC: runtime %s open on FE %s\n", 2603 2577 stream ? "capture" : "playback", fe->dai_link->name); ··· 2668 2640 dpcm_be_dai_shutdown(fe, stream); 2669 2641 disconnect: 2670 2642 /* disconnect any non started BEs */ 2643 + spin_lock_irqsave(&fe->card->dpcm_lock, flags); 2671 2644 for_each_dpcm_be(fe, stream, dpcm) { 2672 2645 struct snd_soc_pcm_runtime *be = dpcm->be; 2673 2646 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) 2674 2647 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; 2675 2648 } 2649 + spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); 2676 2650 2677 2651 return ret; 2678 2652 } ··· 3251 3221 { 3252 3222 struct snd_soc_dpcm *dpcm; 3253 3223 int state; 3224 + int ret = 1; 3225 + unsigned long flags; 3254 3226 3227 + spin_lock_irqsave(&fe->card->dpcm_lock, flags); 3255 3228 for_each_dpcm_fe(be, stream, dpcm) { 3256 3229 3257 3230 if (dpcm->fe == fe) ··· 3263 3230 state = dpcm->fe->dpcm[stream].state; 3264 3231 if (state == SND_SOC_DPCM_STATE_START || 3265 3232 state == SND_SOC_DPCM_STATE_PAUSED || 3266 - state == SND_SOC_DPCM_STATE_SUSPEND) 3267 - return 0; 3233 + state == SND_SOC_DPCM_STATE_SUSPEND) { 3234 + ret = 0; 3235 + break; 3236 + } 3268 3237 } 3238 + spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); 3269 3239 3270 3240 /* it's safe to free/stop this BE DAI */ 3271 - return 1; 3241 + return ret; 3272 3242 } 3273 3243 EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_free_stop); 3274 3244 ··· 3284 3248 { 3285 3249 struct snd_soc_dpcm *dpcm; 3286 3250 int state; 3251 + int ret = 1; 3252 + unsigned long flags; 3287 3253 3254 + spin_lock_irqsave(&fe->card->dpcm_lock, flags); 3288 3255 for_each_dpcm_fe(be, stream, dpcm) { 3289 3256 3290 3257 if (dpcm->fe == fe) ··· 3297 3258 if (state == SND_SOC_DPCM_STATE_START || 3298 3259 state == SND_SOC_DPCM_STATE_PAUSED || 3299 3260 state == SND_SOC_DPCM_STATE_SUSPEND || 3300 - state == SND_SOC_DPCM_STATE_PREPARE) 3301 - return 0; 3261 + state == SND_SOC_DPCM_STATE_PREPARE) { 3262 + ret = 0; 3263 + break; 3264 + } 3302 3265 } 3266 + spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); 3303 3267 3304 3268 /* it's safe to change hw_params */ 3305 - return 1; 3269 + return ret; 3306 3270 } 3307 3271 EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_params); 3308 3272 ··· 3344 3302 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; 3345 3303 struct snd_soc_dpcm *dpcm; 3346 3304 ssize_t offset = 0; 3305 + unsigned long flags; 3347 3306 3348 3307 /* FE state */ 3349 3308 offset += snprintf(buf + offset, size - offset, ··· 3372 3329 goto out; 3373 3330 } 3374 3331 3332 + spin_lock_irqsave(&fe->card->dpcm_lock, flags); 3375 3333 for_each_dpcm_be(fe, stream, dpcm) { 3376 3334 struct snd_soc_pcm_runtime *be = dpcm->be; 3377 3335 params = &dpcm->hw_params; ··· 3393 3349 params_channels(params), 3394 3350 params_rate(params)); 3395 3351 } 3396 - 3352 + spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); 3397 3353 out: 3398 3354 return offset; 3399 3355 }
+4 -3
sound/soc/soc-topology.c
··· 482 482 483 483 snd_ctl_remove(card, kcontrol); 484 484 485 - kfree(dobj->control.dvalues); 485 + /* free enum kcontrol's dvalues and dtexts */ 486 + kfree(se->dobj.control.dvalues); 486 487 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); 489 490 490 491 kfree(se); 491 492 kfree(w->kcontrol_news[i].name);
+34 -4
sound/soc/stm/stm32_adfsdm.c
··· 9 9 10 10 #include <linux/clk.h> 11 11 #include <linux/module.h> 12 + #include <linux/mutex.h> 12 13 #include <linux/platform_device.h> 13 14 #include <linux/slab.h> 14 15 ··· 38 37 /* PCM buffer */ 39 38 unsigned char *pcm_buff; 40 39 unsigned int pos; 40 + 41 + struct mutex lock; /* protect against race condition on iio state */ 41 42 }; 42 43 43 44 static const struct snd_pcm_hardware stm32_adfsdm_pcm_hw = { ··· 65 62 { 66 63 struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(dai); 67 64 65 + mutex_lock(&priv->lock); 68 66 if (priv->iio_active) { 69 67 iio_channel_stop_all_cb(priv->iio_cb); 70 68 priv->iio_active = false; 71 69 } 70 + mutex_unlock(&priv->lock); 72 71 } 73 72 74 73 static int stm32_adfsdm_dai_prepare(struct snd_pcm_substream *substream, ··· 79 74 struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(dai); 80 75 int ret; 81 76 77 + mutex_lock(&priv->lock); 78 + if (priv->iio_active) { 79 + iio_channel_stop_all_cb(priv->iio_cb); 80 + priv->iio_active = false; 81 + } 82 + 82 83 ret = iio_write_channel_attribute(priv->iio_ch, 83 84 substream->runtime->rate, 0, 84 85 IIO_CHAN_INFO_SAMP_FREQ); 85 86 if (ret < 0) { 86 87 dev_err(dai->dev, "%s: Failed to set %d sampling rate\n", 87 88 __func__, substream->runtime->rate); 88 - return ret; 89 + goto out; 89 90 } 90 91 91 92 if (!priv->iio_active) { ··· 102 91 dev_err(dai->dev, "%s: IIO channel start failed (%d)\n", 103 92 __func__, ret); 104 93 } 94 + 95 + out: 96 + mutex_unlock(&priv->lock); 105 97 106 98 return ret; 107 99 } ··· 305 291 static int stm32_adfsdm_probe(struct platform_device *pdev) 306 292 { 307 293 struct stm32_adfsdm_priv *priv; 294 + struct snd_soc_component *component; 308 295 int ret; 309 296 310 297 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); ··· 314 299 315 300 priv->dev = &pdev->dev; 316 301 priv->dai_drv = stm32_adfsdm_dai; 302 + mutex_init(&priv->lock); 317 303 318 304 dev_set_drvdata(&pdev->dev, priv); 319 305 ··· 333 317 if (IS_ERR(priv->iio_cb)) 334 318 return PTR_ERR(priv->iio_cb); 335 319 336 - ret = devm_snd_soc_register_component(&pdev->dev, 337 - &stm32_adfsdm_soc_platform, 338 - NULL, 0); 320 + component = devm_kzalloc(&pdev->dev, sizeof(*component), GFP_KERNEL); 321 + if (!component) 322 + return -ENOMEM; 323 + #ifdef CONFIG_DEBUG_FS 324 + component->debugfs_prefix = "pcm"; 325 + #endif 326 + 327 + ret = snd_soc_add_component(&pdev->dev, component, 328 + &stm32_adfsdm_soc_platform, NULL, 0); 339 329 if (ret < 0) 340 330 dev_err(&pdev->dev, "%s: Failed to register PCM platform\n", 341 331 __func__); 342 332 343 333 return ret; 334 + } 335 + 336 + static int stm32_adfsdm_remove(struct platform_device *pdev) 337 + { 338 + snd_soc_unregister_component(&pdev->dev); 339 + 340 + return 0; 344 341 } 345 342 346 343 static struct platform_driver stm32_adfsdm_driver = { ··· 362 333 .of_match_table = stm32_adfsdm_of_match, 363 334 }, 364 335 .probe = stm32_adfsdm_probe, 336 + .remove = stm32_adfsdm_remove, 365 337 }; 366 338 367 339 module_platform_driver(stm32_adfsdm_driver);
+1 -2
sound/soc/stm/stm32_i2s.c
··· 281 281 case STM32_I2S_CFG2_REG: 282 282 case STM32_I2S_IER_REG: 283 283 case STM32_I2S_SR_REG: 284 - case STM32_I2S_TXDR_REG: 285 284 case STM32_I2S_RXDR_REG: 286 285 case STM32_I2S_CGFR_REG: 287 286 return true; ··· 292 293 static bool stm32_i2s_volatile_reg(struct device *dev, unsigned int reg) 293 294 { 294 295 switch (reg) { 295 - case STM32_I2S_TXDR_REG: 296 + case STM32_I2S_SR_REG: 296 297 case STM32_I2S_RXDR_REG: 297 298 return true; 298 299 default:
+5 -3
sound/soc/stm/stm32_sai.c
··· 105 105 if (!pdev) { 106 106 dev_err(&sai_client->pdev->dev, 107 107 "Device not found for node %pOFn\n", np_provider); 108 + of_node_put(np_provider); 108 109 return -ENODEV; 109 110 } 110 111 ··· 114 113 dev_err(&sai_client->pdev->dev, 115 114 "SAI sync provider data not found\n"); 116 115 ret = -EINVAL; 117 - goto out_put_dev; 116 + goto error; 118 117 } 119 118 120 119 /* Configure sync client */ 121 120 ret = stm32_sai_sync_conf_client(sai_client, synci); 122 121 if (ret < 0) 123 - goto out_put_dev; 122 + goto error; 124 123 125 124 /* Configure sync provider */ 126 125 ret = stm32_sai_sync_conf_provider(sai_provider, synco); 127 126 128 - out_put_dev: 127 + error: 129 128 put_device(&pdev->dev); 129 + of_node_put(np_provider); 130 130 return ret; 131 131 } 132 132
+86 -28
sound/soc/stm/stm32_sai_sub.c
··· 70 70 #define SAI_IEC60958_STATUS_BYTES 24 71 71 72 72 #define SAI_MCLK_NAME_LEN 32 73 + #define SAI_RATE_11K 11025 73 74 74 75 /** 75 76 * struct stm32_sai_sub_data - private data of SAI sub block (block A or B) ··· 101 100 * @slot_mask: rx or tx active slots mask. set at init or at runtime 102 101 * @data_size: PCM data width. corresponds to PCM substream width. 103 102 * @spdif_frm_cnt: S/PDIF playback frame counter 104 - * @snd_aes_iec958: iec958 data 103 + * @iec958: iec958 data 105 104 * @ctrl_lock: control lock 105 + * @irq_lock: prevent race condition with IRQ 106 106 */ 107 107 struct stm32_sai_sub_data { 108 108 struct platform_device *pdev; ··· 135 133 unsigned int spdif_frm_cnt; 136 134 struct snd_aes_iec958 iec958; 137 135 struct mutex ctrl_lock; /* protect resources accessed by controls */ 136 + spinlock_t irq_lock; /* used to prevent race condition with IRQ */ 138 137 }; 139 138 140 139 enum stm32_sai_fifo_th { ··· 310 307 return ret; 311 308 } 312 309 310 + static int stm32_sai_set_parent_clock(struct stm32_sai_sub_data *sai, 311 + unsigned int rate) 312 + { 313 + struct platform_device *pdev = sai->pdev; 314 + struct clk *parent_clk = sai->pdata->clk_x8k; 315 + int ret; 316 + 317 + if (!(rate % SAI_RATE_11K)) 318 + parent_clk = sai->pdata->clk_x11k; 319 + 320 + ret = clk_set_parent(sai->sai_ck, parent_clk); 321 + if (ret) 322 + dev_err(&pdev->dev, " Error %d setting sai_ck parent clock. %s", 323 + ret, ret == -EBUSY ? 324 + "Active stream rates conflict\n" : "\n"); 325 + 326 + return ret; 327 + } 328 + 313 329 static long stm32_sai_mclk_round_rate(struct clk_hw *hw, unsigned long rate, 314 330 unsigned long *prate) 315 331 { ··· 496 474 status = SNDRV_PCM_STATE_XRUN; 497 475 } 498 476 499 - if (status != SNDRV_PCM_STATE_RUNNING) 477 + spin_lock(&sai->irq_lock); 478 + if (status != SNDRV_PCM_STATE_RUNNING && sai->substream) 500 479 snd_pcm_stop_xrun(sai->substream); 480 + spin_unlock(&sai->irq_lock); 501 481 502 482 return IRQ_HANDLED; 503 483 } ··· 510 486 struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai); 511 487 int ret; 512 488 513 - if (dir == SND_SOC_CLOCK_OUT) { 489 + if (dir == SND_SOC_CLOCK_OUT && sai->sai_mclk) { 514 490 ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, 515 491 SAI_XCR1_NODIV, 516 492 (unsigned int)~SAI_XCR1_NODIV); 517 493 if (ret < 0) 518 494 return ret; 519 495 496 + /* If master clock is used, set parent clock now */ 497 + ret = stm32_sai_set_parent_clock(sai, freq); 498 + if (ret) 499 + return ret; 500 + 501 + ret = clk_set_rate_exclusive(sai->sai_mclk, freq); 502 + if (ret) { 503 + dev_err(cpu_dai->dev, 504 + ret == -EBUSY ? 505 + "Active streams have incompatible rates" : 506 + "Could not set mclk rate\n"); 507 + return ret; 508 + } 509 + 520 510 dev_dbg(cpu_dai->dev, "SAI MCLK frequency is %uHz\n", freq); 521 511 sai->mclk_rate = freq; 522 - 523 - if (sai->sai_mclk) { 524 - ret = clk_set_rate_exclusive(sai->sai_mclk, 525 - sai->mclk_rate); 526 - if (ret) { 527 - dev_err(cpu_dai->dev, 528 - "Could not set mclk rate\n"); 529 - return ret; 530 - } 531 - } 532 512 } 533 513 534 514 return 0; ··· 707 679 { 708 680 struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai); 709 681 int imr, cr2, ret; 682 + unsigned long flags; 710 683 684 + spin_lock_irqsave(&sai->irq_lock, flags); 711 685 sai->substream = substream; 686 + spin_unlock_irqrestore(&sai->irq_lock, flags); 687 + 688 + if (STM_SAI_PROTOCOL_IS_SPDIF(sai)) { 689 + snd_pcm_hw_constraint_mask64(substream->runtime, 690 + SNDRV_PCM_HW_PARAM_FORMAT, 691 + SNDRV_PCM_FMTBIT_S32_LE); 692 + snd_pcm_hw_constraint_single(substream->runtime, 693 + SNDRV_PCM_HW_PARAM_CHANNELS, 2); 694 + } 712 695 713 696 ret = clk_prepare_enable(sai->sai_ck); 714 697 if (ret < 0) { ··· 937 898 struct snd_pcm_hw_params *params) 938 899 { 939 900 struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai); 940 - int div = 0; 901 + int div = 0, cr1 = 0; 941 902 int sai_clk_rate, mclk_ratio, den; 942 903 unsigned int rate = params_rate(params); 904 + int ret; 943 905 944 - if (!(rate % 11025)) 945 - clk_set_parent(sai->sai_ck, sai->pdata->clk_x11k); 946 - else 947 - clk_set_parent(sai->sai_ck, sai->pdata->clk_x8k); 906 + if (!sai->sai_mclk) { 907 + ret = stm32_sai_set_parent_clock(sai, rate); 908 + if (ret) 909 + return ret; 910 + } 948 911 sai_clk_rate = clk_get_rate(sai->sai_ck); 949 912 950 913 if (STM_SAI_IS_F4(sai->pdata)) { ··· 984 943 } else { 985 944 if (sai->mclk_rate) { 986 945 mclk_ratio = sai->mclk_rate / rate; 987 - if ((mclk_ratio != 512) && 988 - (mclk_ratio != 256)) { 946 + if (mclk_ratio == 512) { 947 + cr1 = SAI_XCR1_OSR; 948 + } else if (mclk_ratio != 256) { 989 949 dev_err(cpu_dai->dev, 990 950 "Wrong mclk ratio %d\n", 991 951 mclk_ratio); 992 952 return -EINVAL; 993 953 } 954 + 955 + regmap_update_bits(sai->regmap, 956 + STM_SAI_CR1_REGX, 957 + SAI_XCR1_OSR, cr1); 958 + 994 959 div = stm32_sai_get_clk_div(sai, sai_clk_rate, 995 960 sai->mclk_rate); 996 961 if (div < 0) ··· 1098 1051 struct snd_soc_dai *cpu_dai) 1099 1052 { 1100 1053 struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai); 1054 + unsigned long flags; 1101 1055 1102 1056 regmap_update_bits(sai->regmap, STM_SAI_IMR_REGX, SAI_XIMR_MASK, 0); 1103 1057 1104 1058 regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, SAI_XCR1_NODIV, 1105 1059 SAI_XCR1_NODIV); 1106 1060 1061 + /* Release mclk rate only if rate was actually set */ 1062 + if (sai->mclk_rate) { 1063 + clk_rate_exclusive_put(sai->sai_mclk); 1064 + sai->mclk_rate = 0; 1065 + } 1066 + 1107 1067 clk_disable_unprepare(sai->sai_ck); 1108 1068 1109 - clk_rate_exclusive_put(sai->sai_mclk); 1110 - 1069 + spin_lock_irqsave(&sai->irq_lock, flags); 1111 1070 sai->substream = NULL; 1071 + spin_unlock_irqrestore(&sai->irq_lock, flags); 1112 1072 } 1113 1073 1114 1074 static int stm32_sai_pcm_new(struct snd_soc_pcm_runtime *rtd, 1115 1075 struct snd_soc_dai *cpu_dai) 1116 1076 { 1117 1077 struct stm32_sai_sub_data *sai = dev_get_drvdata(cpu_dai->dev); 1078 + struct snd_kcontrol_new knew = iec958_ctls; 1118 1079 1119 1080 if (STM_SAI_PROTOCOL_IS_SPDIF(sai)) { 1120 1081 dev_dbg(&sai->pdev->dev, "%s: register iec controls", __func__); 1121 - return snd_ctl_add(rtd->pcm->card, 1122 - snd_ctl_new1(&iec958_ctls, sai)); 1082 + knew.device = rtd->pcm->device; 1083 + return snd_ctl_add(rtd->pcm->card, snd_ctl_new1(&knew, sai)); 1123 1084 } 1124 1085 1125 1086 return 0; ··· 1136 1081 static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai) 1137 1082 { 1138 1083 struct stm32_sai_sub_data *sai = dev_get_drvdata(cpu_dai->dev); 1139 - int cr1 = 0, cr1_mask; 1084 + int cr1 = 0, cr1_mask, ret; 1140 1085 1141 1086 sai->cpu_dai = cpu_dai; 1142 1087 ··· 1166 1111 /* Configure synchronization */ 1167 1112 if (sai->sync == SAI_SYNC_EXTERNAL) { 1168 1113 /* Configure synchro client and provider */ 1169 - sai->pdata->set_sync(sai->pdata, sai->np_sync_provider, 1170 - sai->synco, sai->synci); 1114 + ret = sai->pdata->set_sync(sai->pdata, sai->np_sync_provider, 1115 + sai->synco, sai->synci); 1116 + if (ret) 1117 + return ret; 1171 1118 } 1172 1119 1173 1120 cr1_mask |= SAI_XCR1_SYNCEN_MASK; ··· 1449 1392 if (!sai->cpu_dai_drv) 1450 1393 return -ENOMEM; 1451 1394 1452 - sai->cpu_dai_drv->name = dev_name(&pdev->dev); 1453 1395 if (STM_SAI_IS_PLAYBACK(sai)) { 1454 1396 memcpy(sai->cpu_dai_drv, &stm32_sai_playback_dai, 1455 1397 sizeof(stm32_sai_playback_dai)); ··· 1458 1402 sizeof(stm32_sai_capture_dai)); 1459 1403 sai->cpu_dai_drv->capture.stream_name = sai->cpu_dai_drv->name; 1460 1404 } 1405 + sai->cpu_dai_drv->name = dev_name(&pdev->dev); 1461 1406 1462 1407 return 0; 1463 1408 } ··· 1481 1424 1482 1425 sai->pdev = pdev; 1483 1426 mutex_init(&sai->ctrl_lock); 1427 + spin_lock_init(&sai->irq_lock); 1484 1428 platform_set_drvdata(pdev, sai); 1485 1429 1486 1430 sai->pdata = dev_get_drvdata(pdev->dev.parent);
+1 -1
sound/xen/xen_snd_front_alsa.c
··· 441 441 { 442 442 int i; 443 443 444 - stream->buffer = alloc_pages_exact(stream->buffer_sz, GFP_KERNEL); 444 + stream->buffer = alloc_pages_exact(buffer_sz, GFP_KERNEL); 445 445 if (!stream->buffer) 446 446 return -ENOMEM; 447 447