Merge branch 'for-linus' into for-next

Back-merge of 6.3 devel branch for further changes of PCM and
documentation.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2023-03-24 14:52:03 +01:00
commit a7a0dcdff4
38 changed files with 281 additions and 105 deletions

View File

@ -2155,6 +2155,8 @@ int pcm_lib_apply_appl_ptr(struct snd_pcm_substream *substream,
ret = substream->ops->ack(substream); ret = substream->ops->ack(substream);
if (ret < 0) { if (ret < 0) {
runtime->control->appl_ptr = old_appl_ptr; runtime->control->appl_ptr = old_appl_ptr;
if (ret == -EPIPE)
__snd_pcm_xrun(substream);
return ret; return ret;
} }
} }

View File

@ -472,6 +472,15 @@ static const struct config_entry config_table[] = {
}, },
#endif #endif
/* Meteor Lake */
#if IS_ENABLED(CONFIG_SND_SOC_SOF_METEORLAKE)
/* Meteorlake-P */
{
.flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
.device = 0x7e28,
},
#endif
}; };
static const struct config_entry *snd_intel_dsp_find_config static const struct config_entry *snd_intel_dsp_find_config

View File

@ -430,7 +430,7 @@ void HPI_6205(struct hpi_message *phm, struct hpi_response *phr)
pao = hpi_find_adapter(phm->adapter_index); pao = hpi_find_adapter(phm->adapter_index);
} else { } else {
/* subsys messages don't address an adapter */ /* subsys messages don't address an adapter */
_HPI_6205(NULL, phm, phr); phr->error = HPI_ERROR_INVALID_OBJ_INDEX;
return; return;
} }

View File

@ -328,14 +328,15 @@ enum {
#define needs_eld_notify_link(chip) false #define needs_eld_notify_link(chip) false
#endif #endif
#define CONTROLLER_IN_GPU(pci) (((pci)->device == 0x0a0c) || \ #define CONTROLLER_IN_GPU(pci) (((pci)->vendor == 0x8086) && \
(((pci)->device == 0x0a0c) || \
((pci)->device == 0x0c0c) || \ ((pci)->device == 0x0c0c) || \
((pci)->device == 0x0d0c) || \ ((pci)->device == 0x0d0c) || \
((pci)->device == 0x160c) || \ ((pci)->device == 0x160c) || \
((pci)->device == 0x490d) || \ ((pci)->device == 0x490d) || \
((pci)->device == 0x4f90) || \ ((pci)->device == 0x4f90) || \
((pci)->device == 0x4f91) || \ ((pci)->device == 0x4f91) || \
((pci)->device == 0x4f92)) ((pci)->device == 0x4f92)))
#define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98) #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)

View File

@ -4228,8 +4228,10 @@ static int tuning_ctl_set(struct hda_codec *codec, hda_nid_t nid,
for (i = 0; i < TUNING_CTLS_COUNT; i++) for (i = 0; i < TUNING_CTLS_COUNT; i++)
if (nid == ca0132_tuning_ctls[i].nid) if (nid == ca0132_tuning_ctls[i].nid)
break; goto found;
return -EINVAL;
found:
snd_hda_power_up(codec); snd_hda_power_up(codec);
dspio_set_param(codec, ca0132_tuning_ctls[i].mid, 0x20, dspio_set_param(codec, ca0132_tuning_ctls[i].mid, 0x20,
ca0132_tuning_ctls[i].req, ca0132_tuning_ctls[i].req,

View File

@ -980,7 +980,10 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
SND_PCI_QUIRK(0x17aa, 0x3905, "Lenovo G50-30", CXT_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x17aa, 0x3905, "Lenovo G50-30", CXT_FIXUP_STEREO_DMIC),
SND_PCI_QUIRK(0x17aa, 0x390b, "Lenovo G50-80", CXT_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x17aa, 0x390b, "Lenovo G50-80", CXT_FIXUP_STEREO_DMIC),
SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_PINCFG_LENOVO_NOTEBOOK), /* NOTE: we'd need to extend the quirk for 17aa:3977 as the same
* PCI SSID is used on multiple Lenovo models
*/
SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC),
SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo G50-70", CXT_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo G50-70", CXT_FIXUP_STEREO_DMIC),
SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", CXT_FIXUP_THINKPAD_ACPI), SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", CXT_FIXUP_THINKPAD_ACPI),
@ -1003,6 +1006,7 @@ static const struct hda_model_fixup cxt5066_fixup_models[] = {
{ .id = CXT_FIXUP_MUTE_LED_GPIO, .name = "mute-led-gpio" }, { .id = CXT_FIXUP_MUTE_LED_GPIO, .name = "mute-led-gpio" },
{ .id = CXT_FIXUP_HP_ZBOOK_MUTE_LED, .name = "hp-zbook-mute-led" }, { .id = CXT_FIXUP_HP_ZBOOK_MUTE_LED, .name = "hp-zbook-mute-led" },
{ .id = CXT_FIXUP_HP_MIC_NO_PRESENCE, .name = "hp-mic-fix" }, { .id = CXT_FIXUP_HP_MIC_NO_PRESENCE, .name = "hp-mic-fix" },
{ .id = CXT_PINCFG_LENOVO_NOTEBOOK, .name = "lenovo-20149" },
{} {}
}; };

View File

@ -2631,6 +2631,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS), SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
@ -2651,6 +2652,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950), SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950), SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950), SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
@ -9260,7 +9262,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK), SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x0ac9, "Dell Precision 3260", ALC295_FIXUP_CHROME_BOOK), SND_PCI_QUIRK(0x1028, 0x0ac9, "Dell Precision 3260", ALC283_FIXUP_CHROME_BOOK),
SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK), SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK), SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS), SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
@ -9447,6 +9449,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
@ -9539,6 +9542,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP), SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP), SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC), SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC), SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC), SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
@ -9573,6 +9577,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
@ -9607,6 +9612,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),

View File

@ -968,6 +968,8 @@ int da7219_aad_init(struct snd_soc_component *component)
INIT_WORK(&da7219_aad->hptest_work, da7219_aad_hptest_work); INIT_WORK(&da7219_aad->hptest_work, da7219_aad_hptest_work);
INIT_WORK(&da7219_aad->jack_det_work, da7219_aad_jack_det_work); INIT_WORK(&da7219_aad->jack_det_work, da7219_aad_jack_det_work);
mutex_init(&da7219_aad->jack_det_mutex);
ret = request_threaded_irq(da7219_aad->irq, da7219_aad_pre_irq_thread, ret = request_threaded_irq(da7219_aad->irq, da7219_aad_pre_irq_thread,
da7219_aad_irq_thread, da7219_aad_irq_thread,
IRQF_TRIGGER_LOW | IRQF_ONESHOT, IRQF_TRIGGER_LOW | IRQF_ONESHOT,

View File

@ -428,8 +428,13 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream,
{ {
struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
bool has_capture = !hcp->hcd.no_i2s_capture;
bool has_playback = !hcp->hcd.no_i2s_playback;
int ret = 0; int ret = 0;
if (!((has_playback && tx) || (has_capture && !tx)))
return 0;
mutex_lock(&hcp->lock); mutex_lock(&hcp->lock);
if (hcp->busy) { if (hcp->busy) {
dev_err(dai->dev, "Only one simultaneous stream supported!\n"); dev_err(dai->dev, "Only one simultaneous stream supported!\n");
@ -468,6 +473,12 @@ static void hdmi_codec_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
bool has_capture = !hcp->hcd.no_i2s_capture;
bool has_playback = !hcp->hcd.no_i2s_playback;
if (!((has_playback && tx) || (has_capture && !tx)))
return;
hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN;
hcp->hcd.ops->audio_shutdown(dai->dev->parent, hcp->hcd.data); hcp->hcd.ops->audio_shutdown(dai->dev->parent, hcp->hcd.data);

View File

@ -242,7 +242,7 @@ enum {
struct tx_mute_work { struct tx_mute_work {
struct tx_macro *tx; struct tx_macro *tx;
u32 decimator; u8 decimator;
struct delayed_work dwork; struct delayed_work dwork;
}; };
@ -635,7 +635,7 @@ exit:
return 0; return 0;
} }
static bool is_amic_enabled(struct snd_soc_component *component, int decimator) static bool is_amic_enabled(struct snd_soc_component *component, u8 decimator)
{ {
u16 adc_mux_reg, adc_reg, adc_n; u16 adc_mux_reg, adc_reg, adc_n;
@ -849,7 +849,7 @@ static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
unsigned int decimator; u8 decimator;
u16 tx_vol_ctl_reg, dec_cfg_reg, hpf_gate_reg, tx_gain_ctl_reg; u16 tx_vol_ctl_reg, dec_cfg_reg, hpf_gate_reg, tx_gain_ctl_reg;
u8 hpf_cut_off_freq; u8 hpf_cut_off_freq;
int hpf_delay = TX_MACRO_DMIC_HPF_DELAY_MS; int hpf_delay = TX_MACRO_DMIC_HPF_DELAY_MS;
@ -1064,7 +1064,8 @@ static int tx_macro_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_component *component = dai->component; struct snd_soc_component *component = dai->component;
u32 decimator, sample_rate; u32 sample_rate;
u8 decimator;
int tx_fs_rate; int tx_fs_rate;
struct tx_macro *tx = snd_soc_component_get_drvdata(component); struct tx_macro *tx = snd_soc_component_get_drvdata(component);
@ -1128,7 +1129,7 @@ static int tx_macro_digital_mute(struct snd_soc_dai *dai, int mute, int stream)
{ {
struct snd_soc_component *component = dai->component; struct snd_soc_component *component = dai->component;
struct tx_macro *tx = snd_soc_component_get_drvdata(component); struct tx_macro *tx = snd_soc_component_get_drvdata(component);
u16 decimator; u8 decimator;
/* active decimator not set yet */ /* active decimator not set yet */
if (tx->active_decimator[dai->id] == -1) if (tx->active_decimator[dai->id] == -1)

View File

@ -294,6 +294,10 @@ config SND_SOC_IMX_SGTL5000
Say Y if you want to add support for SoC audio on an i.MX board with Say Y if you want to add support for SoC audio on an i.MX board with
a sgtl5000 codec. a sgtl5000 codec.
Note that this is an old driver. Consider enabling
SND_SOC_FSL_ASOC_CARD and SND_SOC_SGTL5000 to use the newer
driver.
config SND_SOC_IMX_SPDIF config SND_SOC_IMX_SPDIF
tristate "SoC Audio support for i.MX boards with S/PDIF" tristate "SoC Audio support for i.MX boards with S/PDIF"
select SND_SOC_IMX_PCM_DMA select SND_SOC_IMX_PCM_DMA

View File

@ -117,6 +117,26 @@ static void avs_da7219_codec_exit(struct snd_soc_pcm_runtime *rtd)
snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component, NULL, NULL); snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component, NULL, NULL);
} }
static int
avs_da7219_be_fixup(struct snd_soc_pcm_runtime *runrime, struct snd_pcm_hw_params *params)
{
struct snd_interval *rate, *channels;
struct snd_mask *fmt;
rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
/* The ADSP will convert the FE rate to 48k, stereo */
rate->min = rate->max = 48000;
channels->min = channels->max = 2;
/* set SSP0 to 24 bit */
snd_mask_none(fmt);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
return 0;
}
static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port,
struct snd_soc_dai_link **dai_link) struct snd_soc_dai_link **dai_link)
{ {
@ -148,6 +168,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in
dl->num_platforms = 1; dl->num_platforms = 1;
dl->id = 0; dl->id = 0;
dl->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS; dl->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS;
dl->be_hw_params_fixup = avs_da7219_be_fixup;
dl->init = avs_da7219_codec_init; dl->init = avs_da7219_codec_init;
dl->exit = avs_da7219_codec_exit; dl->exit = avs_da7219_codec_exit;
dl->nonatomic = 1; dl->nonatomic = 1;

View File

@ -8,6 +8,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <sound/pcm_params.h>
#include <sound/soc.h> #include <sound/soc.h>
#include <sound/soc-acpi.h> #include <sound/soc-acpi.h>
#include <sound/soc-dapm.h> #include <sound/soc-dapm.h>
@ -24,6 +25,26 @@ static const struct snd_soc_dapm_route card_base_routes[] = {
{ "Spk", NULL, "Speaker" }, { "Spk", NULL, "Speaker" },
}; };
static int
avs_max98357a_be_fixup(struct snd_soc_pcm_runtime *runrime, struct snd_pcm_hw_params *params)
{
struct snd_interval *rate, *channels;
struct snd_mask *fmt;
rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
/* The ADSP will convert the FE rate to 48k, stereo */
rate->min = rate->max = 48000;
channels->min = channels->max = 2;
/* set SSP0 to 16 bit */
snd_mask_none(fmt);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
return 0;
}
static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port,
struct snd_soc_dai_link **dai_link) struct snd_soc_dai_link **dai_link)
{ {
@ -55,6 +76,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in
dl->num_platforms = 1; dl->num_platforms = 1;
dl->id = 0; dl->id = 0;
dl->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS; dl->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS;
dl->be_hw_params_fixup = avs_max98357a_be_fixup;
dl->nonatomic = 1; dl->nonatomic = 1;
dl->no_pcm = 1; dl->no_pcm = 1;
dl->dpcm_playback = 1; dl->dpcm_playback = 1;

View File

@ -33,15 +33,15 @@ avs_nau8825_clock_control(struct snd_soc_dapm_widget *w, struct snd_kcontrol *co
return -EINVAL; return -EINVAL;
} }
if (!SND_SOC_DAPM_EVENT_ON(event)) { if (SND_SOC_DAPM_EVENT_ON(event))
ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_MCLK, 24000000,
SND_SOC_CLOCK_IN);
else
ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_INTERNAL, 0, SND_SOC_CLOCK_IN); ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_INTERNAL, 0, SND_SOC_CLOCK_IN);
if (ret < 0) { if (ret < 0)
dev_err(card->dev, "set sysclk err = %d\n", ret); dev_err(card->dev, "Set sysclk failed: %d\n", ret);
return ret;
}
}
return 0; return ret;
} }
static const struct snd_kcontrol_new card_controls[] = { static const struct snd_kcontrol_new card_controls[] = {

View File

@ -169,6 +169,27 @@ static const struct snd_soc_ops avs_rt5682_ops = {
.hw_params = avs_rt5682_hw_params, .hw_params = avs_rt5682_hw_params,
}; };
static int
avs_rt5682_be_fixup(struct snd_soc_pcm_runtime *runtime, struct snd_pcm_hw_params *params)
{
struct snd_interval *rate, *channels;
struct snd_mask *fmt;
rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
/* The ADSP will convert the FE rate to 48k, stereo */
rate->min = rate->max = 48000;
channels->min = channels->max = 2;
/* set SSPN to 24 bit */
snd_mask_none(fmt);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
return 0;
}
static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port,
struct snd_soc_dai_link **dai_link) struct snd_soc_dai_link **dai_link)
{ {
@ -201,6 +222,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in
dl->id = 0; dl->id = 0;
dl->init = avs_rt5682_codec_init; dl->init = avs_rt5682_codec_init;
dl->exit = avs_rt5682_codec_exit; dl->exit = avs_rt5682_codec_exit;
dl->be_hw_params_fixup = avs_rt5682_be_fixup;
dl->ops = &avs_rt5682_ops; dl->ops = &avs_rt5682_ops;
dl->nonatomic = 1; dl->nonatomic = 1;
dl->no_pcm = 1; dl->no_pcm = 1;

View File

@ -15,7 +15,6 @@
#include <sound/soc-acpi.h> #include <sound/soc-acpi.h>
#include "../../../codecs/nau8825.h" #include "../../../codecs/nau8825.h"
#define SKL_NUVOTON_CODEC_DAI "nau8825-hifi"
#define SKL_SSM_CODEC_DAI "ssm4567-hifi" #define SKL_SSM_CODEC_DAI "ssm4567-hifi"
static struct snd_soc_codec_conf card_codec_conf[] = { static struct snd_soc_codec_conf card_codec_conf[] = {
@ -34,41 +33,11 @@ static const struct snd_kcontrol_new card_controls[] = {
SOC_DAPM_PIN_SWITCH("Right Speaker"), SOC_DAPM_PIN_SWITCH("Right Speaker"),
}; };
static int
platform_clock_control(struct snd_soc_dapm_widget *w, struct snd_kcontrol *control, int event)
{
struct snd_soc_dapm_context *dapm = w->dapm;
struct snd_soc_card *card = dapm->card;
struct snd_soc_dai *codec_dai;
int ret;
codec_dai = snd_soc_card_get_codec_dai(card, SKL_NUVOTON_CODEC_DAI);
if (!codec_dai) {
dev_err(card->dev, "Codec dai not found\n");
return -EINVAL;
}
if (SND_SOC_DAPM_EVENT_ON(event)) {
ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_MCLK, 24000000,
SND_SOC_CLOCK_IN);
if (ret < 0)
dev_err(card->dev, "set sysclk err = %d\n", ret);
} else {
ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_INTERNAL, 0, SND_SOC_CLOCK_IN);
if (ret < 0)
dev_err(card->dev, "set sysclk err = %d\n", ret);
}
return ret;
}
static const struct snd_soc_dapm_widget card_widgets[] = { static const struct snd_soc_dapm_widget card_widgets[] = {
SND_SOC_DAPM_SPK("Left Speaker", NULL), SND_SOC_DAPM_SPK("Left Speaker", NULL),
SND_SOC_DAPM_SPK("Right Speaker", NULL), SND_SOC_DAPM_SPK("Right Speaker", NULL),
SND_SOC_DAPM_SPK("DP1", NULL), SND_SOC_DAPM_SPK("DP1", NULL),
SND_SOC_DAPM_SPK("DP2", NULL), SND_SOC_DAPM_SPK("DP2", NULL),
SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0, platform_clock_control,
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
}; };
static const struct snd_soc_dapm_route card_base_routes[] = { static const struct snd_soc_dapm_route card_base_routes[] = {

View File

@ -559,7 +559,7 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
{ {
.comp_ids = &essx_83x6, .comp_ids = &essx_83x6,
.drv_name = "sof-essx8336", .drv_name = "sof-essx8336",
.sof_tplg_filename = "sof-adl-es83x6", /* the tplg suffix is added at run time */ .sof_tplg_filename = "sof-adl-es8336", /* the tplg suffix is added at run time */
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER | .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER |
SND_SOC_ACPI_TPLG_INTEL_SSP_MSB | SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER, SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,

View File

@ -184,9 +184,9 @@ int q6prm_set_lpass_clock(struct device *dev, int clk_id, int clk_attr, int clk_
unsigned int freq) unsigned int freq)
{ {
if (freq) if (freq)
return q6prm_request_lpass_clock(dev, clk_id, clk_attr, clk_attr, freq); return q6prm_request_lpass_clock(dev, clk_id, clk_attr, clk_root, freq);
return q6prm_release_lpass_clock(dev, clk_id, clk_attr, clk_attr, freq); return q6prm_release_lpass_clock(dev, clk_id, clk_attr, clk_root, freq);
} }
EXPORT_SYMBOL_GPL(q6prm_set_lpass_clock); EXPORT_SYMBOL_GPL(q6prm_set_lpass_clock);

View File

@ -196,12 +196,15 @@ int hda_dsp_ctrl_init_chip(struct snd_sof_dev *sdev)
goto err; goto err;
} }
usleep_range(500, 1000);
/* exit HDA controller reset */ /* exit HDA controller reset */
ret = hda_dsp_ctrl_link_reset(sdev, false); ret = hda_dsp_ctrl_link_reset(sdev, false);
if (ret < 0) { if (ret < 0) {
dev_err(sdev->dev, "error: failed to exit HDA controller reset\n"); dev_err(sdev->dev, "error: failed to exit HDA controller reset\n");
goto err; goto err;
} }
usleep_range(1000, 1200);
hda_codec_detect_mask(sdev); hda_codec_detect_mask(sdev);

View File

@ -392,6 +392,12 @@ static int hda_dsp_update_d0i3c_register(struct snd_sof_dev *sdev, u8 value)
snd_sof_dsp_update8(sdev, HDA_DSP_HDA_BAR, chip->d0i3_offset, snd_sof_dsp_update8(sdev, HDA_DSP_HDA_BAR, chip->d0i3_offset,
SOF_HDA_VS_D0I3C_I3, value); SOF_HDA_VS_D0I3C_I3, value);
/*
* The value written to the D0I3C::I3 bit may not be taken into account immediately.
* A delay is recommended before checking if D0I3C::CIP is cleared
*/
usleep_range(30, 40);
/* Wait for cmd in progress to be cleared before exiting the function */ /* Wait for cmd in progress to be cleared before exiting the function */
ret = hda_dsp_wait_d0i3c_done(sdev); ret = hda_dsp_wait_d0i3c_done(sdev);
if (ret < 0) { if (ret < 0) {
@ -400,6 +406,12 @@ static int hda_dsp_update_d0i3c_register(struct snd_sof_dev *sdev, u8 value)
} }
reg = snd_sof_dsp_read8(sdev, HDA_DSP_HDA_BAR, chip->d0i3_offset); reg = snd_sof_dsp_read8(sdev, HDA_DSP_HDA_BAR, chip->d0i3_offset);
/* Confirm d0i3 state changed with paranoia check */
if ((reg ^ value) & SOF_HDA_VS_D0I3C_I3) {
dev_err(sdev->dev, "failed to update D0I3C!\n");
return -EIO;
}
trace_sof_intel_D0I3C_updated(sdev, reg); trace_sof_intel_D0I3C_updated(sdev, reg);
return 0; return 0;

View File

@ -78,6 +78,7 @@ static const struct sof_dev_desc glk_desc = {
.nocodec_tplg_filename = "sof-glk-nocodec.tplg", .nocodec_tplg_filename = "sof-glk-nocodec.tplg",
.ops = &sof_apl_ops, .ops = &sof_apl_ops,
.ops_init = sof_apl_ops_init, .ops_init = sof_apl_ops_init,
.ops_free = hda_ops_free,
}; };
/* PCI IDs */ /* PCI IDs */

View File

@ -48,6 +48,7 @@ static const struct sof_dev_desc cnl_desc = {
.nocodec_tplg_filename = "sof-cnl-nocodec.tplg", .nocodec_tplg_filename = "sof-cnl-nocodec.tplg",
.ops = &sof_cnl_ops, .ops = &sof_cnl_ops,
.ops_init = sof_cnl_ops_init, .ops_init = sof_cnl_ops_init,
.ops_free = hda_ops_free,
}; };
static const struct sof_dev_desc cfl_desc = { static const struct sof_dev_desc cfl_desc = {
@ -111,6 +112,7 @@ static const struct sof_dev_desc cml_desc = {
.nocodec_tplg_filename = "sof-cnl-nocodec.tplg", .nocodec_tplg_filename = "sof-cnl-nocodec.tplg",
.ops = &sof_cnl_ops, .ops = &sof_cnl_ops,
.ops_init = sof_cnl_ops_init, .ops_init = sof_cnl_ops_init,
.ops_free = hda_ops_free,
}; };
/* PCI IDs */ /* PCI IDs */

View File

@ -79,6 +79,7 @@ static const struct sof_dev_desc jsl_desc = {
.nocodec_tplg_filename = "sof-jsl-nocodec.tplg", .nocodec_tplg_filename = "sof-jsl-nocodec.tplg",
.ops = &sof_cnl_ops, .ops = &sof_cnl_ops,
.ops_init = sof_cnl_ops_init, .ops_init = sof_cnl_ops_init,
.ops_free = hda_ops_free,
}; };
/* PCI IDs */ /* PCI IDs */

View File

@ -46,6 +46,7 @@ static const struct sof_dev_desc mtl_desc = {
.nocodec_tplg_filename = "sof-mtl-nocodec.tplg", .nocodec_tplg_filename = "sof-mtl-nocodec.tplg",
.ops = &sof_mtl_ops, .ops = &sof_mtl_ops,
.ops_init = sof_mtl_ops_init, .ops_init = sof_mtl_ops_init,
.ops_free = hda_ops_free,
}; };
/* PCI IDs */ /* PCI IDs */

View File

@ -38,6 +38,7 @@ static struct sof_dev_desc skl_desc = {
.nocodec_tplg_filename = "sof-skl-nocodec.tplg", .nocodec_tplg_filename = "sof-skl-nocodec.tplg",
.ops = &sof_skl_ops, .ops = &sof_skl_ops,
.ops_init = sof_skl_ops_init, .ops_init = sof_skl_ops_init,
.ops_free = hda_ops_free,
}; };
static struct sof_dev_desc kbl_desc = { static struct sof_dev_desc kbl_desc = {
@ -61,6 +62,7 @@ static struct sof_dev_desc kbl_desc = {
.nocodec_tplg_filename = "sof-kbl-nocodec.tplg", .nocodec_tplg_filename = "sof-kbl-nocodec.tplg",
.ops = &sof_skl_ops, .ops = &sof_skl_ops,
.ops_init = sof_skl_ops_init, .ops_init = sof_skl_ops_init,
.ops_free = hda_ops_free,
}; };
/* PCI IDs */ /* PCI IDs */

View File

@ -48,6 +48,7 @@ static const struct sof_dev_desc tgl_desc = {
.nocodec_tplg_filename = "sof-tgl-nocodec.tplg", .nocodec_tplg_filename = "sof-tgl-nocodec.tplg",
.ops = &sof_tgl_ops, .ops = &sof_tgl_ops,
.ops_init = sof_tgl_ops_init, .ops_init = sof_tgl_ops_init,
.ops_free = hda_ops_free,
}; };
static const struct sof_dev_desc tglh_desc = { static const struct sof_dev_desc tglh_desc = {
@ -110,6 +111,7 @@ static const struct sof_dev_desc ehl_desc = {
.nocodec_tplg_filename = "sof-ehl-nocodec.tplg", .nocodec_tplg_filename = "sof-ehl-nocodec.tplg",
.ops = &sof_tgl_ops, .ops = &sof_tgl_ops,
.ops_init = sof_tgl_ops_init, .ops_init = sof_tgl_ops_init,
.ops_free = hda_ops_free,
}; };
static const struct sof_dev_desc adls_desc = { static const struct sof_dev_desc adls_desc = {
@ -141,6 +143,7 @@ static const struct sof_dev_desc adls_desc = {
.nocodec_tplg_filename = "sof-adl-nocodec.tplg", .nocodec_tplg_filename = "sof-adl-nocodec.tplg",
.ops = &sof_tgl_ops, .ops = &sof_tgl_ops,
.ops_init = sof_tgl_ops_init, .ops_init = sof_tgl_ops_init,
.ops_free = hda_ops_free,
}; };
static const struct sof_dev_desc adl_desc = { static const struct sof_dev_desc adl_desc = {
@ -172,6 +175,7 @@ static const struct sof_dev_desc adl_desc = {
.nocodec_tplg_filename = "sof-adl-nocodec.tplg", .nocodec_tplg_filename = "sof-adl-nocodec.tplg",
.ops = &sof_tgl_ops, .ops = &sof_tgl_ops,
.ops_init = sof_tgl_ops_init, .ops_init = sof_tgl_ops_init,
.ops_free = hda_ops_free,
}; };
static const struct sof_dev_desc adl_n_desc = { static const struct sof_dev_desc adl_n_desc = {
@ -203,6 +207,7 @@ static const struct sof_dev_desc adl_n_desc = {
.nocodec_tplg_filename = "sof-adl-nocodec.tplg", .nocodec_tplg_filename = "sof-adl-nocodec.tplg",
.ops = &sof_tgl_ops, .ops = &sof_tgl_ops,
.ops_init = sof_tgl_ops_init, .ops_init = sof_tgl_ops_init,
.ops_free = hda_ops_free,
}; };
static const struct sof_dev_desc rpls_desc = { static const struct sof_dev_desc rpls_desc = {
@ -234,6 +239,7 @@ static const struct sof_dev_desc rpls_desc = {
.nocodec_tplg_filename = "sof-rpl-nocodec.tplg", .nocodec_tplg_filename = "sof-rpl-nocodec.tplg",
.ops = &sof_tgl_ops, .ops = &sof_tgl_ops,
.ops_init = sof_tgl_ops_init, .ops_init = sof_tgl_ops_init,
.ops_free = hda_ops_free,
}; };
static const struct sof_dev_desc rpl_desc = { static const struct sof_dev_desc rpl_desc = {
@ -265,6 +271,7 @@ static const struct sof_dev_desc rpl_desc = {
.nocodec_tplg_filename = "sof-rpl-nocodec.tplg", .nocodec_tplg_filename = "sof-rpl-nocodec.tplg",
.ops = &sof_tgl_ops, .ops = &sof_tgl_ops,
.ops_init = sof_tgl_ops_init, .ops_init = sof_tgl_ops_init,
.ops_free = hda_ops_free,
}; };
/* PCI IDs */ /* PCI IDs */

View File

@ -75,11 +75,7 @@ static int tangier_pci_probe(struct snd_sof_dev *sdev)
/* LPE base */ /* LPE base */
base = pci_resource_start(pci, desc->resindex_lpe_base) - IRAM_OFFSET; base = pci_resource_start(pci, desc->resindex_lpe_base) - IRAM_OFFSET;
size = pci_resource_len(pci, desc->resindex_lpe_base); size = PCI_BAR_SIZE;
if (size < PCI_BAR_SIZE) {
dev_err(sdev->dev, "error: I/O region is too small.\n");
return -ENODEV;
}
dev_dbg(sdev->dev, "LPE PHY base at 0x%x size 0x%x", base, size); dev_dbg(sdev->dev, "LPE PHY base at 0x%x size 0x%x", base, size);
sdev->bar[DSP_BAR] = devm_ioremap(sdev->dev, base, size); sdev->bar[DSP_BAR] = devm_ioremap(sdev->dev, base, size);

View File

@ -2081,7 +2081,9 @@ static int sof_ipc3_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget *
break; break;
case SOF_DAI_INTEL_ALH: case SOF_DAI_INTEL_ALH:
if (data) { if (data) {
config->dai_index = data->dai_index; /* save the dai_index during hw_params and reuse it for hw_free */
if (flags & SOF_DAI_CONFIG_FLAGS_HW_PARAMS)
config->dai_index = data->dai_index;
config->alh.stream_id = data->dai_data; config->alh.stream_id = data->dai_data;
} }
break; break;
@ -2089,7 +2091,30 @@ static int sof_ipc3_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget *
break; break;
} }
config->flags = flags; /*
* The dai_config op is invoked several times and the flags argument varies as below:
* BE DAI hw_params: When the op is invoked during the BE DAI hw_params, flags contains
* SOF_DAI_CONFIG_FLAGS_HW_PARAMS along with quirks
* FE DAI hw_params: When invoked during FE DAI hw_params after the DAI widget has
* just been set up in the DSP, flags is set to SOF_DAI_CONFIG_FLAGS_HW_PARAMS with no
* quirks
* BE DAI trigger: When invoked during the BE DAI trigger, flags is set to
* SOF_DAI_CONFIG_FLAGS_PAUSE and contains no quirks
* BE DAI hw_free: When invoked during the BE DAI hw_free, flags is set to
* SOF_DAI_CONFIG_FLAGS_HW_FREE and contains no quirks
* FE DAI hw_free: When invoked during the FE DAI hw_free, flags is set to
* SOF_DAI_CONFIG_FLAGS_HW_FREE and contains no quirks
*
* The DAI_CONFIG IPC is sent to the DSP, only after the widget is set up during the FE
* DAI hw_params. But since the BE DAI hw_params precedes the FE DAI hw_params, the quirks
* need to be preserved when assigning the flags before sending the IPC.
* For the case of PAUSE/HW_FREE, since there are no quirks, flags can be used as is.
*/
if (flags & SOF_DAI_CONFIG_FLAGS_HW_PARAMS)
config->flags |= flags;
else
config->flags = flags;
/* only send the IPC if the widget is set up in the DSP */ /* only send the IPC if the widget is set up in the DSP */
if (swidget->use_count > 0) { if (swidget->use_count > 0) {
@ -2097,6 +2122,9 @@ static int sof_ipc3_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget *
&reply, sizeof(reply)); &reply, sizeof(reply));
if (ret < 0) if (ret < 0)
dev_err(sdev->dev, "Failed to set dai config for %s\n", dai->name); dev_err(sdev->dev, "Failed to set dai config for %s\n", dai->name);
/* clear the flags once the IPC has been sent even if it fails */
config->flags = SOF_DAI_CONFIG_FLAGS_NONE;
} }
return ret; return ret;

View File

@ -970,8 +970,9 @@ static void sof_ipc3_rx_msg(struct snd_sof_dev *sdev)
return; return;
} }
if (hdr.size < sizeof(hdr)) { if (hdr.size < sizeof(hdr) || hdr.size > SOF_IPC_MSG_MAX_SIZE) {
dev_err(sdev->dev, "The received message size is invalid\n"); dev_err(sdev->dev, "The received message size is invalid: %u\n",
hdr.size);
return; return;
} }

View File

@ -97,7 +97,8 @@ sof_ipc4_set_volume_data(struct snd_sof_dev *sdev, struct snd_sof_widget *swidge
} }
/* set curve type and duration from topology */ /* set curve type and duration from topology */
data.curve_duration = gain->data.curve_duration; data.curve_duration_l = gain->data.curve_duration_l;
data.curve_duration_h = gain->data.curve_duration_h;
data.curve_type = gain->data.curve_type; data.curve_type = gain->data.curve_type;
msg->data_ptr = &data; msg->data_ptr = &data;

View File

@ -107,7 +107,7 @@ static const struct sof_topology_token gain_tokens[] = {
get_token_u32, offsetof(struct sof_ipc4_gain_data, curve_type)}, get_token_u32, offsetof(struct sof_ipc4_gain_data, curve_type)},
{SOF_TKN_GAIN_RAMP_DURATION, {SOF_TKN_GAIN_RAMP_DURATION,
SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct sof_ipc4_gain_data, curve_duration)}, offsetof(struct sof_ipc4_gain_data, curve_duration_l)},
{SOF_TKN_GAIN_VAL, SND_SOC_TPLG_TUPLE_TYPE_WORD, {SOF_TKN_GAIN_VAL, SND_SOC_TPLG_TUPLE_TYPE_WORD,
get_token_u32, offsetof(struct sof_ipc4_gain_data, init_val)}, get_token_u32, offsetof(struct sof_ipc4_gain_data, init_val)},
}; };
@ -155,7 +155,7 @@ static void sof_ipc4_dbg_audio_format(struct device *dev,
for (i = 0; i < num_format; i++, ptr = (u8 *)ptr + object_size) { for (i = 0; i < num_format; i++, ptr = (u8 *)ptr + object_size) {
fmt = ptr; fmt = ptr;
dev_dbg(dev, dev_dbg(dev,
" #%d: %uKHz, %ubit (ch_map %#x ch_cfg %u interleaving_style %u fmt_cfg %#x)\n", " #%d: %uHz, %ubit (ch_map %#x ch_cfg %u interleaving_style %u fmt_cfg %#x)\n",
i, fmt->sampling_frequency, fmt->bit_depth, fmt->ch_map, i, fmt->sampling_frequency, fmt->bit_depth, fmt->ch_map,
fmt->ch_cfg, fmt->interleaving_style, fmt->fmt_cfg); fmt->ch_cfg, fmt->interleaving_style, fmt->fmt_cfg);
} }
@ -692,7 +692,7 @@ static int sof_ipc4_widget_setup_comp_pga(struct snd_sof_widget *swidget)
dev_dbg(scomp->dev, dev_dbg(scomp->dev,
"pga widget %s: ramp type: %d, ramp duration %d, initial gain value: %#x, cpc %d\n", "pga widget %s: ramp type: %d, ramp duration %d, initial gain value: %#x, cpc %d\n",
swidget->widget->name, gain->data.curve_type, gain->data.curve_duration, swidget->widget->name, gain->data.curve_type, gain->data.curve_duration_l,
gain->data.init_val, gain->base_config.cpc); gain->data.init_val, gain->base_config.cpc);
ret = sof_ipc4_widget_setup_msg(swidget, &gain->msg); ret = sof_ipc4_widget_setup_msg(swidget, &gain->msg);
@ -980,6 +980,7 @@ static void sof_ipc4_unprepare_copier_module(struct snd_sof_widget *swidget)
ipc4_copier = dai->private; ipc4_copier = dai->private;
if (ipc4_copier->dai_type == SOF_DAI_INTEL_ALH) { if (ipc4_copier->dai_type == SOF_DAI_INTEL_ALH) {
struct sof_ipc4_copier_data *copier_data = &ipc4_copier->data;
struct sof_ipc4_alh_configuration_blob *blob; struct sof_ipc4_alh_configuration_blob *blob;
unsigned int group_id; unsigned int group_id;
@ -989,6 +990,9 @@ static void sof_ipc4_unprepare_copier_module(struct snd_sof_widget *swidget)
ALH_MULTI_GTW_BASE; ALH_MULTI_GTW_BASE;
ida_free(&alh_group_ida, group_id); ida_free(&alh_group_ida, group_id);
} }
/* clear the node ID */
copier_data->gtw_cfg.node_id &= ~SOF_IPC4_NODE_INDEX_MASK;
} }
} }
@ -1940,8 +1944,15 @@ static int sof_ipc4_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget *
pipeline->skip_during_fe_trigger = true; pipeline->skip_during_fe_trigger = true;
fallthrough; fallthrough;
case SOF_DAI_INTEL_ALH: case SOF_DAI_INTEL_ALH:
copier_data->gtw_cfg.node_id &= ~SOF_IPC4_NODE_INDEX_MASK; /*
copier_data->gtw_cfg.node_id |= SOF_IPC4_NODE_INDEX(data->dai_data); * Do not clear the node ID when this op is invoked with
* SOF_DAI_CONFIG_FLAGS_HW_FREE. It is needed to free the group_ida during
* unprepare.
*/
if (flags & SOF_DAI_CONFIG_FLAGS_HW_PARAMS) {
copier_data->gtw_cfg.node_id &= ~SOF_IPC4_NODE_INDEX_MASK;
copier_data->gtw_cfg.node_id |= SOF_IPC4_NODE_INDEX(data->dai_data);
}
break; break;
case SOF_DAI_INTEL_DMIC: case SOF_DAI_INTEL_DMIC:
case SOF_DAI_INTEL_SSP: case SOF_DAI_INTEL_SSP:

View File

@ -46,7 +46,7 @@
#define SOF_IPC4_NODE_INDEX_INTEL_SSP(x) (((x) & 0xf) << 4) #define SOF_IPC4_NODE_INDEX_INTEL_SSP(x) (((x) & 0xf) << 4)
/* Node ID for DMIC type DAI copiers */ /* Node ID for DMIC type DAI copiers */
#define SOF_IPC4_NODE_INDEX_INTEL_DMIC(x) (((x) & 0x7) << 5) #define SOF_IPC4_NODE_INDEX_INTEL_DMIC(x) ((x) & 0x7)
#define SOF_IPC4_GAIN_ALL_CHANNELS_MASK 0xffffffff #define SOF_IPC4_GAIN_ALL_CHANNELS_MASK 0xffffffff
#define SOF_IPC4_VOL_ZERO_DB 0x7fffffff #define SOF_IPC4_VOL_ZERO_DB 0x7fffffff
@ -277,14 +277,16 @@ struct sof_ipc4_control_data {
* @init_val: Initial value * @init_val: Initial value
* @curve_type: Curve type * @curve_type: Curve type
* @reserved: reserved for future use * @reserved: reserved for future use
* @curve_duration: Curve duration * @curve_duration_l: Curve duration low part
* @curve_duration_h: Curve duration high part
*/ */
struct sof_ipc4_gain_data { struct sof_ipc4_gain_data {
uint32_t channels; uint32_t channels;
uint32_t init_val; uint32_t init_val;
uint32_t curve_type; uint32_t curve_type;
uint32_t reserved; uint32_t reserved;
uint32_t curve_duration; uint32_t curve_duration_l;
uint32_t curve_duration_h;
} __aligned(8); } __aligned(8);
/** /**

View File

@ -50,9 +50,27 @@ static int sof_widget_free_unlocked(struct snd_sof_dev *sdev,
/* reset route setup status for all routes that contain this widget */ /* reset route setup status for all routes that contain this widget */
sof_reset_route_setup_status(sdev, swidget); sof_reset_route_setup_status(sdev, swidget);
/* free DAI config and continue to free widget even if it fails */
if (WIDGET_IS_DAI(swidget->id)) {
struct snd_sof_dai_config_data data;
unsigned int flags = SOF_DAI_CONFIG_FLAGS_HW_FREE;
data.dai_data = DMA_CHAN_INVALID;
if (tplg_ops && tplg_ops->dai_config) {
err = tplg_ops->dai_config(sdev, swidget, flags, &data);
if (err < 0)
dev_err(sdev->dev, "failed to free config for widget %s\n",
swidget->widget->name);
}
}
/* continue to disable core even if IPC fails */ /* continue to disable core even if IPC fails */
if (tplg_ops && tplg_ops->widget_free) if (tplg_ops && tplg_ops->widget_free) {
err = tplg_ops->widget_free(sdev, swidget); ret = tplg_ops->widget_free(sdev, swidget);
if (ret < 0 && !err)
err = ret;
}
/* /*
* disable widget core. continue to route setup status and complete flag * disable widget core. continue to route setup status and complete flag
@ -151,8 +169,12 @@ static int sof_widget_setup_unlocked(struct snd_sof_dev *sdev,
/* send config for DAI components */ /* send config for DAI components */
if (WIDGET_IS_DAI(swidget->id)) { if (WIDGET_IS_DAI(swidget->id)) {
unsigned int flags = SOF_DAI_CONFIG_FLAGS_NONE; unsigned int flags = SOF_DAI_CONFIG_FLAGS_HW_PARAMS;
/*
* The config flags saved during BE DAI hw_params will be used for IPC3. IPC4 does
* not use the flags argument.
*/
if (tplg_ops && tplg_ops->dai_config) { if (tplg_ops && tplg_ops->dai_config) {
ret = tplg_ops->dai_config(sdev, swidget, flags, NULL); ret = tplg_ops->dai_config(sdev, swidget, flags, NULL);
if (ret < 0) if (ret < 0)
@ -588,8 +610,8 @@ int sof_widget_list_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm,
ret = sof_walk_widgets_in_order(sdev, spcm, fe_params, platform_params, ret = sof_walk_widgets_in_order(sdev, spcm, fe_params, platform_params,
dir, SOF_WIDGET_SETUP); dir, SOF_WIDGET_SETUP);
if (ret < 0) { if (ret < 0) {
ret = sof_walk_widgets_in_order(sdev, spcm, fe_params, platform_params, sof_walk_widgets_in_order(sdev, spcm, fe_params, platform_params,
dir, SOF_WIDGET_UNPREPARE); dir, SOF_WIDGET_UNPREPARE);
return ret; return ret;
} }

View File

@ -1388,14 +1388,15 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
if (ret < 0) { if (ret < 0) {
dev_err(scomp->dev, "failed to parse component pin tokens for %s\n", dev_err(scomp->dev, "failed to parse component pin tokens for %s\n",
w->name); w->name);
return ret; goto widget_free;
} }
if (swidget->num_sink_pins > SOF_WIDGET_MAX_NUM_PINS || if (swidget->num_sink_pins > SOF_WIDGET_MAX_NUM_PINS ||
swidget->num_source_pins > SOF_WIDGET_MAX_NUM_PINS) { swidget->num_source_pins > SOF_WIDGET_MAX_NUM_PINS) {
dev_err(scomp->dev, "invalid pins for %s: [sink: %d, src: %d]\n", dev_err(scomp->dev, "invalid pins for %s: [sink: %d, src: %d]\n",
swidget->widget->name, swidget->num_sink_pins, swidget->num_source_pins); swidget->widget->name, swidget->num_sink_pins, swidget->num_source_pins);
return -EINVAL; ret = -EINVAL;
goto widget_free;
} }
if (swidget->num_sink_pins > 1) { if (swidget->num_sink_pins > 1) {
@ -1404,7 +1405,7 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
if (ret < 0) { if (ret < 0) {
dev_err(scomp->dev, "failed to parse sink pin binding for %s\n", dev_err(scomp->dev, "failed to parse sink pin binding for %s\n",
w->name); w->name);
return ret; goto widget_free;
} }
} }
@ -1414,7 +1415,7 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
if (ret < 0) { if (ret < 0) {
dev_err(scomp->dev, "failed to parse source pin binding for %s\n", dev_err(scomp->dev, "failed to parse source pin binding for %s\n",
w->name); w->name);
return ret; goto widget_free;
} }
} }
@ -1436,9 +1437,8 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
case snd_soc_dapm_dai_out: case snd_soc_dapm_dai_out:
dai = kzalloc(sizeof(*dai), GFP_KERNEL); dai = kzalloc(sizeof(*dai), GFP_KERNEL);
if (!dai) { if (!dai) {
kfree(swidget); ret = -ENOMEM;
return -ENOMEM; goto widget_free;
} }
ret = sof_widget_parse_tokens(scomp, swidget, tw, token_list, token_list_size); ret = sof_widget_parse_tokens(scomp, swidget, tw, token_list, token_list_size);
@ -1496,8 +1496,7 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
tw->shift, swidget->id, tw->name, tw->shift, swidget->id, tw->name,
strnlen(tw->sname, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) > 0 strnlen(tw->sname, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) > 0
? tw->sname : "none"); ? tw->sname : "none");
kfree(swidget); goto widget_free;
return ret;
} }
if (sof_debug_check_flag(SOF_DBG_DISABLE_MULTICORE)) { if (sof_debug_check_flag(SOF_DBG_DISABLE_MULTICORE)) {
@ -1518,10 +1517,7 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
if (ret) { if (ret) {
dev_err(scomp->dev, "widget event binding failed for %s\n", dev_err(scomp->dev, "widget event binding failed for %s\n",
swidget->widget->name); swidget->widget->name);
kfree(swidget->private); goto free;
kfree(swidget->tuples);
kfree(swidget);
return ret;
} }
} }
} }
@ -1532,10 +1528,8 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
spipe = kzalloc(sizeof(*spipe), GFP_KERNEL); spipe = kzalloc(sizeof(*spipe), GFP_KERNEL);
if (!spipe) { if (!spipe) {
kfree(swidget->private); ret = -ENOMEM;
kfree(swidget->tuples); goto free;
kfree(swidget);
return -ENOMEM;
} }
spipe->pipe_widget = swidget; spipe->pipe_widget = swidget;
@ -1546,6 +1540,12 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
w->dobj.private = swidget; w->dobj.private = swidget;
list_add(&swidget->list, &sdev->widget_list); list_add(&swidget->list, &sdev->widget_list);
return ret; return ret;
free:
kfree(swidget->private);
kfree(swidget->tuples);
widget_free:
kfree(swidget);
return ret;
} }
static int sof_route_unload(struct snd_soc_component *scomp, static int sof_route_unload(struct snd_soc_component *scomp,

View File

@ -455,8 +455,8 @@ static void push_back_to_ready_list(struct snd_usb_endpoint *ep,
* This function is used both for implicit feedback endpoints and in low- * This function is used both for implicit feedback endpoints and in low-
* latency playback mode. * latency playback mode.
*/ */
void snd_usb_queue_pending_output_urbs(struct snd_usb_endpoint *ep, int snd_usb_queue_pending_output_urbs(struct snd_usb_endpoint *ep,
bool in_stream_lock) bool in_stream_lock)
{ {
bool implicit_fb = snd_usb_endpoint_implicit_feedback_sink(ep); bool implicit_fb = snd_usb_endpoint_implicit_feedback_sink(ep);
@ -480,7 +480,7 @@ void snd_usb_queue_pending_output_urbs(struct snd_usb_endpoint *ep,
spin_unlock_irqrestore(&ep->lock, flags); spin_unlock_irqrestore(&ep->lock, flags);
if (ctx == NULL) if (ctx == NULL)
return; break;
/* copy over the length information */ /* copy over the length information */
if (implicit_fb) { if (implicit_fb) {
@ -495,11 +495,14 @@ void snd_usb_queue_pending_output_urbs(struct snd_usb_endpoint *ep,
break; break;
if (err < 0) { if (err < 0) {
/* push back to ready list again for -EAGAIN */ /* push back to ready list again for -EAGAIN */
if (err == -EAGAIN) if (err == -EAGAIN) {
push_back_to_ready_list(ep, ctx); push_back_to_ready_list(ep, ctx);
else break;
}
if (!in_stream_lock)
notify_xrun(ep); notify_xrun(ep);
return; return -EPIPE;
} }
err = usb_submit_urb(ctx->urb, GFP_ATOMIC); err = usb_submit_urb(ctx->urb, GFP_ATOMIC);
@ -507,13 +510,16 @@ void snd_usb_queue_pending_output_urbs(struct snd_usb_endpoint *ep,
usb_audio_err(ep->chip, usb_audio_err(ep->chip,
"Unable to submit urb #%d: %d at %s\n", "Unable to submit urb #%d: %d at %s\n",
ctx->index, err, __func__); ctx->index, err, __func__);
notify_xrun(ep); if (!in_stream_lock)
return; notify_xrun(ep);
return -EPIPE;
} }
set_bit(ctx->index, &ep->active_mask); set_bit(ctx->index, &ep->active_mask);
atomic_inc(&ep->submitted_urbs); atomic_inc(&ep->submitted_urbs);
} }
return 0;
} }
/* /*

View File

@ -52,7 +52,7 @@ int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep);
int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep, int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep,
struct snd_urb_ctx *ctx, int idx, struct snd_urb_ctx *ctx, int idx,
unsigned int avail); unsigned int avail);
void snd_usb_queue_pending_output_urbs(struct snd_usb_endpoint *ep, int snd_usb_queue_pending_output_urbs(struct snd_usb_endpoint *ep,
bool in_stream_lock); bool in_stream_lock);
#endif /* __USBAUDIO_ENDPOINT_H */ #endif /* __USBAUDIO_ENDPOINT_H */

View File

@ -39,8 +39,12 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
case UAC_VERSION_1: case UAC_VERSION_1:
default: { default: {
struct uac_format_type_i_discrete_descriptor *fmt = _fmt; struct uac_format_type_i_discrete_descriptor *fmt = _fmt;
if (format >= 64) if (format >= 64) {
return 0; /* invalid format */ usb_audio_info(chip,
"%u:%d: invalid format type 0x%llx is detected, processed as PCM\n",
fp->iface, fp->altsetting, format);
format = UAC_FORMAT_TYPE_I_PCM;
}
sample_width = fmt->bBitResolution; sample_width = fmt->bBitResolution;
sample_bytes = fmt->bSubframeSize; sample_bytes = fmt->bSubframeSize;
format = 1ULL << format; format = 1ULL << format;

View File

@ -1639,7 +1639,7 @@ static int snd_usb_pcm_playback_ack(struct snd_pcm_substream *substream)
* outputs here * outputs here
*/ */
if (!ep->active_mask) if (!ep->active_mask)
snd_usb_queue_pending_output_urbs(ep, true); return snd_usb_queue_pending_output_urbs(ep, true);
return 0; return 0;
} }