Commit 309d4014 authored by Mark Brown's avatar Mark Brown

ASoC: Merge up 6.2 fixes

To resolve a conflict and support further development.
parents 24b401f3 c1619ea2
...@@ -16,6 +16,7 @@ properties: ...@@ -16,6 +16,7 @@ properties:
compatible: compatible:
enum: enum:
- mediatek,mt8186-mt6366-rt1019-rt5682s-sound - mediatek,mt8186-mt6366-rt1019-rt5682s-sound
- mediatek,mt8186-mt6366-rt5682s-max98360-sound
mediatek,platform: mediatek,platform:
$ref: "/schemas/types.yaml#/definitions/phandle" $ref: "/schemas/types.yaml#/definitions/phandle"
......
...@@ -1253,6 +1253,11 @@ static int mtk_spi_probe(struct platform_device *pdev) ...@@ -1253,6 +1253,11 @@ static int mtk_spi_probe(struct platform_device *pdev)
dev_notice(dev, "SPI dma_set_mask(%d) failed, ret:%d\n", dev_notice(dev, "SPI dma_set_mask(%d) failed, ret:%d\n",
addr_bits, ret); addr_bits, ret);
ret = devm_request_irq(dev, irq, mtk_spi_interrupt,
IRQF_TRIGGER_NONE, dev_name(dev), master);
if (ret)
return dev_err_probe(dev, ret, "failed to register irq\n");
pm_runtime_enable(dev); pm_runtime_enable(dev);
ret = devm_spi_register_master(dev, master); ret = devm_spi_register_master(dev, master);
...@@ -1261,13 +1266,6 @@ static int mtk_spi_probe(struct platform_device *pdev) ...@@ -1261,13 +1266,6 @@ static int mtk_spi_probe(struct platform_device *pdev)
return dev_err_probe(dev, ret, "failed to register master\n"); return dev_err_probe(dev, ret, "failed to register master\n");
} }
ret = devm_request_irq(dev, irq, mtk_spi_interrupt,
IRQF_TRIGGER_NONE, dev_name(dev), master);
if (ret) {
pm_runtime_disable(dev);
return dev_err_probe(dev, ret, "failed to register irq\n");
}
return 0; return 0;
} }
......
...@@ -198,9 +198,11 @@ static int st_es8336_late_probe(struct snd_soc_card *card) ...@@ -198,9 +198,11 @@ static int st_es8336_late_probe(struct snd_soc_card *card)
int ret; int ret;
adev = acpi_dev_get_first_match_dev("ESSX8336", NULL, -1); adev = acpi_dev_get_first_match_dev("ESSX8336", NULL, -1);
if (adev) if (!adev)
put_device(&adev->dev); return -ENODEV;
codec_dev = acpi_get_first_physical_node(adev); codec_dev = acpi_get_first_physical_node(adev);
acpi_dev_put(adev);
if (!codec_dev) if (!codec_dev)
dev_err(card->dev, "can not find codec dev\n"); dev_err(card->dev, "can not find codec dev\n");
......
...@@ -206,6 +206,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { ...@@ -206,6 +206,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "UM5302TA"), DMI_MATCH(DMI_PRODUCT_NAME, "UM5302TA"),
} }
}, },
{
.driver_data = &acp6x_card,
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "M5402RA"),
}
},
{ {
.driver_data = &acp6x_card, .driver_data = &acp6x_card,
.matches = { .matches = {
...@@ -220,6 +227,27 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { ...@@ -220,6 +227,27 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "Redmi Book Pro 14 2022"), DMI_MATCH(DMI_PRODUCT_NAME, "Redmi Book Pro 14 2022"),
} }
}, },
{
.driver_data = &acp6x_card,
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Razer"),
DMI_MATCH(DMI_PRODUCT_NAME, "Blade 14 (2022) - RZ09-0427"),
}
},
{
.driver_data = &acp6x_card,
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "RB"),
DMI_MATCH(DMI_PRODUCT_NAME, "Swift SFA16-41"),
}
},
{
.driver_data = &acp6x_card,
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "IRBIS"),
DMI_MATCH(DMI_PRODUCT_NAME, "15NBC1011"),
}
},
{} {}
}; };
......
...@@ -177,8 +177,20 @@ static int rt9120_codec_probe(struct snd_soc_component *comp) ...@@ -177,8 +177,20 @@ static int rt9120_codec_probe(struct snd_soc_component *comp)
return 0; return 0;
} }
static int rt9120_codec_suspend(struct snd_soc_component *comp)
{
return pm_runtime_force_suspend(comp->dev);
}
static int rt9120_codec_resume(struct snd_soc_component *comp)
{
return pm_runtime_force_resume(comp->dev);
}
static const struct snd_soc_component_driver rt9120_component_driver = { static const struct snd_soc_component_driver rt9120_component_driver = {
.probe = rt9120_codec_probe, .probe = rt9120_codec_probe,
.suspend = rt9120_codec_suspend,
.resume = rt9120_codec_resume,
.controls = rt9120_snd_controls, .controls = rt9120_snd_controls,
.num_controls = ARRAY_SIZE(rt9120_snd_controls), .num_controls = ARRAY_SIZE(rt9120_snd_controls),
.dapm_widgets = rt9120_dapm_widgets, .dapm_widgets = rt9120_dapm_widgets,
......
...@@ -697,6 +697,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, ...@@ -697,6 +697,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
int dcs_mask; int dcs_mask;
int dcs_l, dcs_r; int dcs_l, dcs_r;
int dcs_l_reg, dcs_r_reg; int dcs_l_reg, dcs_r_reg;
int an_out_reg;
int timeout; int timeout;
int pwr_reg; int pwr_reg;
...@@ -712,6 +713,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, ...@@ -712,6 +713,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
dcs_mask = WM8904_DCS_ENA_CHAN_0 | WM8904_DCS_ENA_CHAN_1; dcs_mask = WM8904_DCS_ENA_CHAN_0 | WM8904_DCS_ENA_CHAN_1;
dcs_r_reg = WM8904_DC_SERVO_8; dcs_r_reg = WM8904_DC_SERVO_8;
dcs_l_reg = WM8904_DC_SERVO_9; dcs_l_reg = WM8904_DC_SERVO_9;
an_out_reg = WM8904_ANALOGUE_OUT1_LEFT;
dcs_l = 0; dcs_l = 0;
dcs_r = 1; dcs_r = 1;
break; break;
...@@ -720,6 +722,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, ...@@ -720,6 +722,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
dcs_mask = WM8904_DCS_ENA_CHAN_2 | WM8904_DCS_ENA_CHAN_3; dcs_mask = WM8904_DCS_ENA_CHAN_2 | WM8904_DCS_ENA_CHAN_3;
dcs_r_reg = WM8904_DC_SERVO_6; dcs_r_reg = WM8904_DC_SERVO_6;
dcs_l_reg = WM8904_DC_SERVO_7; dcs_l_reg = WM8904_DC_SERVO_7;
an_out_reg = WM8904_ANALOGUE_OUT2_LEFT;
dcs_l = 2; dcs_l = 2;
dcs_r = 3; dcs_r = 3;
break; break;
...@@ -792,6 +795,10 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, ...@@ -792,6 +795,10 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
snd_soc_component_update_bits(component, reg, snd_soc_component_update_bits(component, reg,
WM8904_HPL_ENA_OUTP | WM8904_HPR_ENA_OUTP, WM8904_HPL_ENA_OUTP | WM8904_HPR_ENA_OUTP,
WM8904_HPL_ENA_OUTP | WM8904_HPR_ENA_OUTP); WM8904_HPL_ENA_OUTP | WM8904_HPR_ENA_OUTP);
/* Update volume, requires PGA to be powered */
val = snd_soc_component_read(component, an_out_reg);
snd_soc_component_write(component, an_out_reg, val);
break; break;
case SND_SOC_DAPM_POST_PMU: case SND_SOC_DAPM_POST_PMU:
......
...@@ -121,11 +121,11 @@ static const struct snd_soc_dapm_route audio_map[] = { ...@@ -121,11 +121,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
static const struct snd_soc_dapm_route audio_map_ac97[] = { static const struct snd_soc_dapm_route audio_map_ac97[] = {
/* 1st half -- Normal DAPM routes */ /* 1st half -- Normal DAPM routes */
{"Playback", NULL, "AC97 Playback"}, {"AC97 Playback", NULL, "CPU AC97 Playback"},
{"AC97 Capture", NULL, "Capture"}, {"CPU AC97 Capture", NULL, "AC97 Capture"},
/* 2nd half -- ASRC DAPM routes */ /* 2nd half -- ASRC DAPM routes */
{"AC97 Playback", NULL, "ASRC-Playback"}, {"CPU AC97 Playback", NULL, "ASRC-Playback"},
{"ASRC-Capture", NULL, "AC97 Capture"}, {"ASRC-Capture", NULL, "CPU AC97 Capture"},
}; };
static const struct snd_soc_dapm_route audio_map_tx[] = { static const struct snd_soc_dapm_route audio_map_tx[] = {
......
...@@ -315,21 +315,21 @@ static int hwvad_detected(struct snd_kcontrol *kcontrol, ...@@ -315,21 +315,21 @@ static int hwvad_detected(struct snd_kcontrol *kcontrol,
static const struct snd_kcontrol_new fsl_micfil_snd_controls[] = { static const struct snd_kcontrol_new fsl_micfil_snd_controls[] = {
SOC_SINGLE_SX_TLV("CH0 Volume", REG_MICFIL_OUT_CTRL, SOC_SINGLE_SX_TLV("CH0 Volume", REG_MICFIL_OUT_CTRL,
MICFIL_OUTGAIN_CHX_SHIFT(0), 0xF, 0x7, gain_tlv), MICFIL_OUTGAIN_CHX_SHIFT(0), 0x8, 0xF, gain_tlv),
SOC_SINGLE_SX_TLV("CH1 Volume", REG_MICFIL_OUT_CTRL, SOC_SINGLE_SX_TLV("CH1 Volume", REG_MICFIL_OUT_CTRL,
MICFIL_OUTGAIN_CHX_SHIFT(1), 0xF, 0x7, gain_tlv), MICFIL_OUTGAIN_CHX_SHIFT(1), 0x8, 0xF, gain_tlv),
SOC_SINGLE_SX_TLV("CH2 Volume", REG_MICFIL_OUT_CTRL, SOC_SINGLE_SX_TLV("CH2 Volume", REG_MICFIL_OUT_CTRL,
MICFIL_OUTGAIN_CHX_SHIFT(2), 0xF, 0x7, gain_tlv), MICFIL_OUTGAIN_CHX_SHIFT(2), 0x8, 0xF, gain_tlv),
SOC_SINGLE_SX_TLV("CH3 Volume", REG_MICFIL_OUT_CTRL, SOC_SINGLE_SX_TLV("CH3 Volume", REG_MICFIL_OUT_CTRL,
MICFIL_OUTGAIN_CHX_SHIFT(3), 0xF, 0x7, gain_tlv), MICFIL_OUTGAIN_CHX_SHIFT(3), 0x8, 0xF, gain_tlv),
SOC_SINGLE_SX_TLV("CH4 Volume", REG_MICFIL_OUT_CTRL, SOC_SINGLE_SX_TLV("CH4 Volume", REG_MICFIL_OUT_CTRL,
MICFIL_OUTGAIN_CHX_SHIFT(4), 0xF, 0x7, gain_tlv), MICFIL_OUTGAIN_CHX_SHIFT(4), 0x8, 0xF, gain_tlv),
SOC_SINGLE_SX_TLV("CH5 Volume", REG_MICFIL_OUT_CTRL, SOC_SINGLE_SX_TLV("CH5 Volume", REG_MICFIL_OUT_CTRL,
MICFIL_OUTGAIN_CHX_SHIFT(5), 0xF, 0x7, gain_tlv), MICFIL_OUTGAIN_CHX_SHIFT(5), 0x8, 0xF, gain_tlv),
SOC_SINGLE_SX_TLV("CH6 Volume", REG_MICFIL_OUT_CTRL, SOC_SINGLE_SX_TLV("CH6 Volume", REG_MICFIL_OUT_CTRL,
MICFIL_OUTGAIN_CHX_SHIFT(6), 0xF, 0x7, gain_tlv), MICFIL_OUTGAIN_CHX_SHIFT(6), 0x8, 0xF, gain_tlv),
SOC_SINGLE_SX_TLV("CH7 Volume", REG_MICFIL_OUT_CTRL, SOC_SINGLE_SX_TLV("CH7 Volume", REG_MICFIL_OUT_CTRL,
MICFIL_OUTGAIN_CHX_SHIFT(7), 0xF, 0x7, gain_tlv), MICFIL_OUTGAIN_CHX_SHIFT(7), 0x8, 0xF, gain_tlv),
SOC_ENUM_EXT("MICFIL Quality Select", SOC_ENUM_EXT("MICFIL Quality Select",
fsl_micfil_quality_enum, fsl_micfil_quality_enum,
micfil_quality_get, micfil_quality_set), micfil_quality_get, micfil_quality_set),
......
...@@ -1189,14 +1189,14 @@ static struct snd_soc_dai_driver fsl_ssi_ac97_dai = { ...@@ -1189,14 +1189,14 @@ static struct snd_soc_dai_driver fsl_ssi_ac97_dai = {
.symmetric_channels = 1, .symmetric_channels = 1,
.probe = fsl_ssi_dai_probe, .probe = fsl_ssi_dai_probe,
.playback = { .playback = {
.stream_name = "AC97 Playback", .stream_name = "CPU AC97 Playback",
.channels_min = 2, .channels_min = 2,
.channels_max = 2, .channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_48000, .rates = SNDRV_PCM_RATE_8000_48000,
.formats = SNDRV_PCM_FMTBIT_S16 | SNDRV_PCM_FMTBIT_S20, .formats = SNDRV_PCM_FMTBIT_S16 | SNDRV_PCM_FMTBIT_S20,
}, },
.capture = { .capture = {
.stream_name = "AC97 Capture", .stream_name = "CPU AC97 Capture",
.channels_min = 2, .channels_min = 2,
.channels_max = 2, .channels_max = 2,
.rates = SNDRV_PCM_RATE_48000, .rates = SNDRV_PCM_RATE_48000,
......
...@@ -481,6 +481,29 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) ...@@ -481,6 +481,29 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)
return ret; return ret;
} }
static void avs_pci_shutdown(struct pci_dev *pci)
{
struct hdac_bus *bus = pci_get_drvdata(pci);
struct avs_dev *adev = hdac_to_avs(bus);
cancel_work_sync(&adev->probe_work);
avs_ipc_block(adev->ipc);
snd_hdac_stop_streams(bus);
avs_dsp_op(adev, int_control, false);
snd_hdac_ext_bus_ppcap_int_enable(bus, false);
snd_hdac_ext_bus_link_power_down_all(bus);
snd_hdac_bus_stop_chip(bus);
snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false);
if (avs_platattr_test(adev, CLDMA))
pci_free_irq(pci, 0, &code_loader);
pci_free_irq(pci, 0, adev);
pci_free_irq(pci, 0, bus);
pci_free_irq_vectors(pci);
}
static void avs_pci_remove(struct pci_dev *pci) static void avs_pci_remove(struct pci_dev *pci)
{ {
struct hdac_device *hdev, *save; struct hdac_device *hdev, *save;
...@@ -739,6 +762,7 @@ static struct pci_driver avs_pci_driver = { ...@@ -739,6 +762,7 @@ static struct pci_driver avs_pci_driver = {
.id_table = avs_ids, .id_table = avs_ids,
.probe = avs_pci_probe, .probe = avs_pci_probe,
.remove = avs_pci_remove, .remove = avs_pci_remove,
.shutdown = avs_pci_shutdown,
.driver = { .driver = {
.pm = &avs_dev_pm, .pm = &avs_dev_pm,
}, },
......
...@@ -554,10 +554,12 @@ config SND_SOC_INTEL_SOF_NAU8825_MACH ...@@ -554,10 +554,12 @@ config SND_SOC_INTEL_SOF_NAU8825_MACH
select SND_SOC_RT1015P select SND_SOC_RT1015P
select SND_SOC_MAX98373_I2C select SND_SOC_MAX98373_I2C
select SND_SOC_MAX98357A select SND_SOC_MAX98357A
select SND_SOC_NAU8315
select SND_SOC_DMIC select SND_SOC_DMIC
select SND_SOC_HDAC_HDMI select SND_SOC_HDAC_HDMI
select SND_SOC_INTEL_HDA_DSP_COMMON select SND_SOC_INTEL_HDA_DSP_COMMON
select SND_SOC_INTEL_SOF_MAXIM_COMMON select SND_SOC_INTEL_SOF_MAXIM_COMMON
select SND_SOC_INTEL_SOF_REALTEK_COMMON
help help
This adds support for ASoC machine driver for SOF platforms This adds support for ASoC machine driver for SOF platforms
with nau8825 codec. with nau8825 codec.
......
...@@ -497,21 +497,28 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) ...@@ -497,21 +497,28 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
if (adev) { if (adev) {
snprintf(codec_name, sizeof(codec_name), snprintf(codec_name, sizeof(codec_name),
"i2c-%s", acpi_dev_name(adev)); "i2c-%s", acpi_dev_name(adev));
put_device(&adev->dev);
byt_cht_es8316_dais[dai_index].codecs->name = codec_name; byt_cht_es8316_dais[dai_index].codecs->name = codec_name;
} else { } else {
dev_err(dev, "Error cannot find '%s' dev\n", mach->id); dev_err(dev, "Error cannot find '%s' dev\n", mach->id);
return -ENXIO; return -ENXIO;
} }
codec_dev = acpi_get_first_physical_node(adev);
acpi_dev_put(adev);
if (!codec_dev)
return -EPROBE_DEFER;
priv->codec_dev = get_device(codec_dev);
/* override platform name, if required */ /* override platform name, if required */
byt_cht_es8316_card.dev = dev; byt_cht_es8316_card.dev = dev;
platform_name = mach->mach_params.platform; platform_name = mach->mach_params.platform;
ret = snd_soc_fixup_dai_links_platform_name(&byt_cht_es8316_card, ret = snd_soc_fixup_dai_links_platform_name(&byt_cht_es8316_card,
platform_name); platform_name);
if (ret) if (ret) {
put_device(codec_dev);
return ret; return ret;
}
/* Check for BYTCR or other platform and setup quirks */ /* Check for BYTCR or other platform and setup quirks */
dmi_id = dmi_first_match(byt_cht_es8316_quirk_table); dmi_id = dmi_first_match(byt_cht_es8316_quirk_table);
...@@ -539,13 +546,10 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) ...@@ -539,13 +546,10 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
/* get the clock */ /* get the clock */
priv->mclk = devm_clk_get(dev, "pmc_plt_clk_3"); priv->mclk = devm_clk_get(dev, "pmc_plt_clk_3");
if (IS_ERR(priv->mclk)) if (IS_ERR(priv->mclk)) {
put_device(codec_dev);
return dev_err_probe(dev, PTR_ERR(priv->mclk), "clk_get pmc_plt_clk_3 failed\n"); return dev_err_probe(dev, PTR_ERR(priv->mclk), "clk_get pmc_plt_clk_3 failed\n");
}
codec_dev = acpi_get_first_physical_node(adev);
if (!codec_dev)
return -EPROBE_DEFER;
priv->codec_dev = get_device(codec_dev);
if (quirk & BYT_CHT_ES8316_JD_INVERTED) if (quirk & BYT_CHT_ES8316_JD_INVERTED)
props[cnt++] = PROPERTY_ENTRY_BOOL("everest,jack-detect-inverted"); props[cnt++] = PROPERTY_ENTRY_BOOL("everest,jack-detect-inverted");
......
...@@ -1636,13 +1636,18 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) ...@@ -1636,13 +1636,18 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
if (adev) { if (adev) {
snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name), snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name),
"i2c-%s", acpi_dev_name(adev)); "i2c-%s", acpi_dev_name(adev));
put_device(&adev->dev);
byt_rt5640_dais[dai_index].codecs->name = byt_rt5640_codec_name; byt_rt5640_dais[dai_index].codecs->name = byt_rt5640_codec_name;
} else { } else {
dev_err(dev, "Error cannot find '%s' dev\n", mach->id); dev_err(dev, "Error cannot find '%s' dev\n", mach->id);
return -ENXIO; return -ENXIO;
} }
codec_dev = acpi_get_first_physical_node(adev);
acpi_dev_put(adev);
if (!codec_dev)
return -EPROBE_DEFER;
priv->codec_dev = get_device(codec_dev);
/* /*
* swap SSP0 if bytcr is detected * swap SSP0 if bytcr is detected
* (will be overridden if DMI quirk is detected) * (will be overridden if DMI quirk is detected)
...@@ -1717,11 +1722,6 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) ...@@ -1717,11 +1722,6 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
byt_rt5640_quirk = quirk_override; byt_rt5640_quirk = quirk_override;
} }
codec_dev = acpi_get_first_physical_node(adev);
if (!codec_dev)
return -EPROBE_DEFER;
priv->codec_dev = get_device(codec_dev);
if (byt_rt5640_quirk & BYT_RT5640_JD_HP_ELITEP_1000G2) { if (byt_rt5640_quirk & BYT_RT5640_JD_HP_ELITEP_1000G2) {
acpi_dev_add_driver_gpios(ACPI_COMPANION(priv->codec_dev), acpi_dev_add_driver_gpios(ACPI_COMPANION(priv->codec_dev),
byt_rt5640_hp_elitepad_1000g2_gpios); byt_rt5640_hp_elitepad_1000g2_gpios);
......
...@@ -922,7 +922,6 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev) ...@@ -922,7 +922,6 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
if (adev) { if (adev) {
snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name), snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name),
"i2c-%s", acpi_dev_name(adev)); "i2c-%s", acpi_dev_name(adev));
put_device(&adev->dev);
byt_rt5651_dais[dai_index].codecs->name = byt_rt5651_codec_name; byt_rt5651_dais[dai_index].codecs->name = byt_rt5651_codec_name;
} else { } else {
dev_err(dev, "Error cannot find '%s' dev\n", mach->id); dev_err(dev, "Error cannot find '%s' dev\n", mach->id);
...@@ -930,6 +929,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev) ...@@ -930,6 +929,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
} }
codec_dev = acpi_get_first_physical_node(adev); codec_dev = acpi_get_first_physical_node(adev);
acpi_dev_put(adev);
if (!codec_dev) if (!codec_dev)
return -EPROBE_DEFER; return -EPROBE_DEFER;
priv->codec_dev = get_device(codec_dev); priv->codec_dev = get_device(codec_dev);
......
...@@ -411,9 +411,9 @@ static int snd_byt_wm5102_mc_probe(struct platform_device *pdev) ...@@ -411,9 +411,9 @@ static int snd_byt_wm5102_mc_probe(struct platform_device *pdev)
return -ENOENT; return -ENOENT;
} }
snprintf(codec_name, sizeof(codec_name), "spi-%s", acpi_dev_name(adev)); snprintf(codec_name, sizeof(codec_name), "spi-%s", acpi_dev_name(adev));
put_device(&adev->dev);
codec_dev = bus_find_device_by_name(&spi_bus_type, NULL, codec_name); codec_dev = bus_find_device_by_name(&spi_bus_type, NULL, codec_name);
acpi_dev_put(adev);
if (!codec_dev) if (!codec_dev)
return -EPROBE_DEFER; return -EPROBE_DEFER;
......
...@@ -681,7 +681,6 @@ static int sof_es8336_probe(struct platform_device *pdev) ...@@ -681,7 +681,6 @@ static int sof_es8336_probe(struct platform_device *pdev)
if (adev) { if (adev) {
snprintf(codec_name, sizeof(codec_name), snprintf(codec_name, sizeof(codec_name),
"i2c-%s", acpi_dev_name(adev)); "i2c-%s", acpi_dev_name(adev));
put_device(&adev->dev);
dai_links[0].codecs->name = codec_name; dai_links[0].codecs->name = codec_name;
/* also fixup codec dai name if relevant */ /* also fixup codec dai name if relevant */
...@@ -692,16 +691,19 @@ static int sof_es8336_probe(struct platform_device *pdev) ...@@ -692,16 +691,19 @@ static int sof_es8336_probe(struct platform_device *pdev)
return -ENXIO; return -ENXIO;
} }
ret = snd_soc_fixup_dai_links_platform_name(&sof_es8336_card,
mach->mach_params.platform);
if (ret)
return ret;
codec_dev = acpi_get_first_physical_node(adev); codec_dev = acpi_get_first_physical_node(adev);
acpi_dev_put(adev);
if (!codec_dev) if (!codec_dev)
return -EPROBE_DEFER; return -EPROBE_DEFER;
priv->codec_dev = get_device(codec_dev); priv->codec_dev = get_device(codec_dev);
ret = snd_soc_fixup_dai_links_platform_name(&sof_es8336_card,
mach->mach_params.platform);
if (ret) {
put_device(codec_dev);
return ret;
}
if (quirk & SOF_ES8336_JD_INVERTED) if (quirk & SOF_ES8336_JD_INVERTED)
props[cnt++] = PROPERTY_ENTRY_BOOL("everest,jack-detect-inverted"); props[cnt++] = PROPERTY_ENTRY_BOOL("everest,jack-detect-inverted");
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#define SOF_MAX98373_SPEAKER_AMP_PRESENT BIT(15) #define SOF_MAX98373_SPEAKER_AMP_PRESENT BIT(15)
#define SOF_MAX98360A_SPEAKER_AMP_PRESENT BIT(16) #define SOF_MAX98360A_SPEAKER_AMP_PRESENT BIT(16)
#define SOF_RT1015P_SPEAKER_AMP_PRESENT BIT(17) #define SOF_RT1015P_SPEAKER_AMP_PRESENT BIT(17)
#define SOF_NAU8318_SPEAKER_AMP_PRESENT BIT(18)
static unsigned long sof_nau8825_quirk = SOF_NAU8825_SSP_CODEC(0); static unsigned long sof_nau8825_quirk = SOF_NAU8825_SSP_CODEC(0);
...@@ -338,6 +339,13 @@ static struct snd_soc_dai_link_component rt1019p_component[] = { ...@@ -338,6 +339,13 @@ static struct snd_soc_dai_link_component rt1019p_component[] = {
} }
}; };
static struct snd_soc_dai_link_component nau8318_components[] = {
{
.name = "NVTN2012:00",
.dai_name = "nau8315-hifi",
}
};
static struct snd_soc_dai_link_component dummy_component[] = { static struct snd_soc_dai_link_component dummy_component[] = {
{ {
.name = "snd-soc-dummy", .name = "snd-soc-dummy",
...@@ -486,6 +494,11 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, ...@@ -486,6 +494,11 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
max_98360a_dai_link(&links[id]); max_98360a_dai_link(&links[id]);
} else if (sof_nau8825_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT) { } else if (sof_nau8825_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT) {
sof_rt1015p_dai_link(&links[id]); sof_rt1015p_dai_link(&links[id]);
} else if (sof_nau8825_quirk &
SOF_NAU8318_SPEAKER_AMP_PRESENT) {
links[id].codecs = nau8318_components;
links[id].num_codecs = ARRAY_SIZE(nau8318_components);
links[id].init = speaker_codec_init;
} else { } else {
goto devm_err; goto devm_err;
} }
...@@ -618,7 +631,7 @@ static const struct platform_device_id board_ids[] = { ...@@ -618,7 +631,7 @@ static const struct platform_device_id board_ids[] = {
}, },
{ {
.name = "adl_rt1019p_nau8825", .name = "adl_rt1019p_8825",
.driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) | .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) |
SOF_SPEAKER_AMP_PRESENT | SOF_SPEAKER_AMP_PRESENT |
SOF_RT1019P_SPEAKER_AMP_PRESENT | SOF_RT1019P_SPEAKER_AMP_PRESENT |
...@@ -626,7 +639,7 @@ static const struct platform_device_id board_ids[] = { ...@@ -626,7 +639,7 @@ static const struct platform_device_id board_ids[] = {
SOF_NAU8825_NUM_HDMIDEV(4)), SOF_NAU8825_NUM_HDMIDEV(4)),
}, },
{ {
.name = "adl_max98373_nau8825", .name = "adl_max98373_8825",
.driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) | .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) |
SOF_SPEAKER_AMP_PRESENT | SOF_SPEAKER_AMP_PRESENT |
SOF_MAX98373_SPEAKER_AMP_PRESENT | SOF_MAX98373_SPEAKER_AMP_PRESENT |
...@@ -637,7 +650,7 @@ static const struct platform_device_id board_ids[] = { ...@@ -637,7 +650,7 @@ static const struct platform_device_id board_ids[] = {
}, },
{ {
/* The limitation of length of char array, shorten the name */ /* The limitation of length of char array, shorten the name */
.name = "adl_mx98360a_nau8825", .name = "adl_mx98360a_8825",
.driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) | .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) |
SOF_SPEAKER_AMP_PRESENT | SOF_SPEAKER_AMP_PRESENT |
SOF_MAX98360A_SPEAKER_AMP_PRESENT | SOF_MAX98360A_SPEAKER_AMP_PRESENT |
...@@ -648,7 +661,7 @@ static const struct platform_device_id board_ids[] = { ...@@ -648,7 +661,7 @@ static const struct platform_device_id board_ids[] = {
}, },
{ {
.name = "adl_rt1015p_nau8825", .name = "adl_rt1015p_8825",
.driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) | .driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) |
SOF_SPEAKER_AMP_PRESENT | SOF_SPEAKER_AMP_PRESENT |
SOF_RT1015P_SPEAKER_AMP_PRESENT | SOF_RT1015P_SPEAKER_AMP_PRESENT |
...@@ -657,6 +670,16 @@ static const struct platform_device_id board_ids[] = { ...@@ -657,6 +670,16 @@ static const struct platform_device_id board_ids[] = {
SOF_BT_OFFLOAD_SSP(2) | SOF_BT_OFFLOAD_SSP(2) |
SOF_SSP_BT_OFFLOAD_PRESENT), SOF_SSP_BT_OFFLOAD_PRESENT),
}, },
{
.name = "adl_nau8318_8825",
.driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) |
SOF_SPEAKER_AMP_PRESENT |
SOF_NAU8318_SPEAKER_AMP_PRESENT |
SOF_NAU8825_SSP_AMP(1) |
SOF_NAU8825_NUM_HDMIDEV(4) |
SOF_BT_OFFLOAD_SSP(2) |
SOF_SSP_BT_OFFLOAD_PRESENT),
},
{ } { }
}; };
MODULE_DEVICE_TABLE(platform, board_ids); MODULE_DEVICE_TABLE(platform, board_ids);
......
...@@ -450,6 +450,11 @@ static const struct snd_soc_acpi_codecs adl_lt6911_hdmi = { ...@@ -450,6 +450,11 @@ static const struct snd_soc_acpi_codecs adl_lt6911_hdmi = {
.codecs = {"INTC10B0"} .codecs = {"INTC10B0"}
}; };
static const struct snd_soc_acpi_codecs adl_nau8318_amp = {
.num_codecs = 1,
.codecs = {"NVTN2012"}
};
struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = { struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
{ {
.comp_ids = &adl_rt5682_rt5682s_hp, .comp_ids = &adl_rt5682_rt5682s_hp,
...@@ -474,21 +479,21 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = { ...@@ -474,21 +479,21 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
}, },
{ {
.id = "10508825", .id = "10508825",
.drv_name = "adl_rt1019p_nau8825", .drv_name = "adl_rt1019p_8825",
.machine_quirk = snd_soc_acpi_codec_list, .machine_quirk = snd_soc_acpi_codec_list,
.quirk_data = &adl_rt1019p_amp, .quirk_data = &adl_rt1019p_amp,
.sof_tplg_filename = "sof-adl-rt1019-nau8825.tplg", .sof_tplg_filename = "sof-adl-rt1019-nau8825.tplg",
}, },
{ {
.id = "10508825", .id = "10508825",
.drv_name = "adl_max98373_nau8825", .drv_name = "adl_max98373_8825",
.machine_quirk = snd_soc_acpi_codec_list, .machine_quirk = snd_soc_acpi_codec_list,
.quirk_data = &adl_max98373_amp, .quirk_data = &adl_max98373_amp,
.sof_tplg_filename = "sof-adl-max98373-nau8825.tplg", .sof_tplg_filename = "sof-adl-max98373-nau8825.tplg",
}, },
{ {
.id = "10508825", .id = "10508825",
.drv_name = "adl_mx98360a_nau8825", .drv_name = "adl_mx98360a_8825",
.machine_quirk = snd_soc_acpi_codec_list, .machine_quirk = snd_soc_acpi_codec_list,
.quirk_data = &adl_max98360a_amp, .quirk_data = &adl_max98360a_amp,
.sof_tplg_filename = "sof-adl-max98360a-nau8825.tplg", .sof_tplg_filename = "sof-adl-max98360a-nau8825.tplg",
...@@ -502,11 +507,18 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = { ...@@ -502,11 +507,18 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
}, },
{ {
.id = "10508825", .id = "10508825",
.drv_name = "adl_rt1015p_nau8825", .drv_name = "adl_rt1015p_8825",
.machine_quirk = snd_soc_acpi_codec_list, .machine_quirk = snd_soc_acpi_codec_list,
.quirk_data = &adl_rt1015p_amp, .quirk_data = &adl_rt1015p_amp,
.sof_tplg_filename = "sof-adl-rt1015-nau8825.tplg", .sof_tplg_filename = "sof-adl-rt1015-nau8825.tplg",
}, },
{
.id = "10508825",
.drv_name = "adl_nau8318_8825",
.machine_quirk = snd_soc_acpi_codec_list,
.quirk_data = &adl_nau8318_amp,
.sof_tplg_filename = "sof-adl-nau8318-nau8825.tplg",
},
{ {
.id = "10508825", .id = "10508825",
.drv_name = "sof_nau8825", .drv_name = "sof_nau8825",
......
...@@ -203,6 +203,25 @@ static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link2_rt1316_link01_rt71 ...@@ -203,6 +203,25 @@ static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link2_rt1316_link01_rt71
{} {}
}; };
static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link2_rt1316_link01[] = {
{
.mask = BIT(2),
.num_adr = ARRAY_SIZE(rt711_sdca_2_adr),
.adr_d = rt711_sdca_2_adr,
},
{
.mask = BIT(0),
.num_adr = ARRAY_SIZE(rt1316_0_group2_adr),
.adr_d = rt1316_0_group2_adr,
},
{
.mask = BIT(1),
.num_adr = ARRAY_SIZE(rt1316_1_group2_adr),
.adr_d = rt1316_1_group2_adr,
},
{}
};
static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1318_link12_rt714_link3[] = { static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1318_link12_rt714_link3[] = {
{ {
.mask = BIT(0), .mask = BIT(0),
...@@ -227,6 +246,25 @@ static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1318_link12_rt71 ...@@ -227,6 +246,25 @@ static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1318_link12_rt71
{} {}
}; };
static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1318_link12[] = {
{
.mask = BIT(0),
.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
.adr_d = rt711_sdca_0_adr,
},
{
.mask = BIT(1),
.num_adr = ARRAY_SIZE(rt1318_1_group1_adr),
.adr_d = rt1318_1_group1_adr,
},
{
.mask = BIT(2),
.num_adr = ARRAY_SIZE(rt1318_2_group1_adr),
.adr_d = rt1318_2_group1_adr,
},
{}
};
static const struct snd_soc_acpi_link_adr rpl_sdw_rt1316_link12_rt714_link0[] = { static const struct snd_soc_acpi_link_adr rpl_sdw_rt1316_link12_rt714_link0[] = {
{ {
.mask = BIT(1), .mask = BIT(1),
...@@ -271,12 +309,24 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_sdw_machines[] = { ...@@ -271,12 +309,24 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_sdw_machines[] = {
.drv_name = "sof_sdw", .drv_name = "sof_sdw",
.sof_tplg_filename = "sof-rpl-rt711-l0-rt1318-l12-rt714-l3.tplg", .sof_tplg_filename = "sof-rpl-rt711-l0-rt1318-l12-rt714-l3.tplg",
}, },
{
.link_mask = 0x7, /* rt711 on link0 & two rt1318s on link1 and link2 */
.links = rpl_sdw_rt711_link0_rt1318_link12,
.drv_name = "sof_sdw",
.sof_tplg_filename = "sof-rpl-rt711-l0-rt1318-l12.tplg",
},
{ {
.link_mask = 0x7, /* rt714 on link0 & two rt1316s on link1 and link2 */ .link_mask = 0x7, /* rt714 on link0 & two rt1316s on link1 and link2 */
.links = rpl_sdw_rt1316_link12_rt714_link0, .links = rpl_sdw_rt1316_link12_rt714_link0,
.drv_name = "sof_sdw", .drv_name = "sof_sdw",
.sof_tplg_filename = "sof-rpl-rt1316-l12-rt714-l0.tplg", .sof_tplg_filename = "sof-rpl-rt1316-l12-rt714-l0.tplg",
}, },
{
.link_mask = 0x7, /* rt711 on link2 & two rt1316s on link0 and link1 */
.links = rpl_sdw_rt711_link2_rt1316_link01,
.drv_name = "sof_sdw",
.sof_tplg_filename = "sof-rpl-rt711-l2-rt1316-l01.tplg",
},
{ {
.link_mask = 0x1, /* link0 required */ .link_mask = 0x1, /* link0 required */
.links = rpl_rvp, .links = rpl_rvp,
......
...@@ -182,10 +182,12 @@ config SND_SOC_MT8186_MT6366_DA7219_MAX98357 ...@@ -182,10 +182,12 @@ config SND_SOC_MT8186_MT6366_DA7219_MAX98357
If unsure select "N". If unsure select "N".
config SND_SOC_MT8186_MT6366_RT1019_RT5682S config SND_SOC_MT8186_MT6366_RT1019_RT5682S
tristate "ASoC Audio driver for MT8186 with RT1019 RT5682S codec" tristate "ASoC Audio driver for MT8186 with RT1019 RT5682S MAX98357A/MAX98360 codec"
depends on I2C && GPIOLIB depends on I2C && GPIOLIB
depends on SND_SOC_MT8186 && MTK_PMIC_WRAP depends on SND_SOC_MT8186 && MTK_PMIC_WRAP
select SND_SOC_MAX98357A
select SND_SOC_MT6358 select SND_SOC_MT6358
select SND_SOC_MAX98357A
select SND_SOC_RT1015P select SND_SOC_RT1015P
select SND_SOC_RT5682S select SND_SOC_RT5682S
select SND_SOC_BT_SCO select SND_SOC_BT_SCO
......
...@@ -1083,6 +1083,21 @@ static struct snd_soc_card mt8186_mt6366_rt1019_rt5682s_soc_card = { ...@@ -1083,6 +1083,21 @@ static struct snd_soc_card mt8186_mt6366_rt1019_rt5682s_soc_card = {
.num_configs = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_codec_conf), .num_configs = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_codec_conf),
}; };
static struct snd_soc_card mt8186_mt6366_rt5682s_max98360_soc_card = {
.name = "mt8186_rt5682s_max98360",
.owner = THIS_MODULE,
.dai_link = mt8186_mt6366_rt1019_rt5682s_dai_links,
.num_links = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_dai_links),
.controls = mt8186_mt6366_rt1019_rt5682s_controls,
.num_controls = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_controls),
.dapm_widgets = mt8186_mt6366_rt1019_rt5682s_widgets,
.num_dapm_widgets = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_widgets),
.dapm_routes = mt8186_mt6366_rt1019_rt5682s_routes,
.num_dapm_routes = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_routes),
.codec_conf = mt8186_mt6366_rt1019_rt5682s_codec_conf,
.num_configs = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_codec_conf),
};
static int mt8186_mt6366_rt1019_rt5682s_dev_probe(struct platform_device *pdev) static int mt8186_mt6366_rt1019_rt5682s_dev_probe(struct platform_device *pdev)
{ {
struct snd_soc_card *card; struct snd_soc_card *card;
...@@ -1232,9 +1247,14 @@ static int mt8186_mt6366_rt1019_rt5682s_dev_probe(struct platform_device *pdev) ...@@ -1232,9 +1247,14 @@ static int mt8186_mt6366_rt1019_rt5682s_dev_probe(struct platform_device *pdev)
#if IS_ENABLED(CONFIG_OF) #if IS_ENABLED(CONFIG_OF)
static const struct of_device_id mt8186_mt6366_rt1019_rt5682s_dt_match[] = { static const struct of_device_id mt8186_mt6366_rt1019_rt5682s_dt_match[] = {
{ .compatible = "mediatek,mt8186-mt6366-rt1019-rt5682s-sound", {
.compatible = "mediatek,mt8186-mt6366-rt1019-rt5682s-sound",
.data = &mt8186_mt6366_rt1019_rt5682s_soc_card, .data = &mt8186_mt6366_rt1019_rt5682s_soc_card,
}, },
{
.compatible = "mediatek,mt8186-mt6366-rt5682s-max98360-sound",
.data = &mt8186_mt6366_rt5682s_max98360_soc_card,
},
{} {}
}; };
MODULE_DEVICE_TABLE(of, mt8186_mt6366_rt1019_rt5682s_dt_match); MODULE_DEVICE_TABLE(of, mt8186_mt6366_rt1019_rt5682s_dt_match);
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
menuconfig SND_SOC_QCOM menuconfig SND_SOC_QCOM
tristate "ASoC support for QCOM platforms" tristate "ASoC support for QCOM platforms"
depends on ARCH_QCOM || COMPILE_TEST depends on ARCH_QCOM || COMPILE_TEST
imply SND_SOC_QCOM_COMMON
help help
Say Y or M if you want to add support to use audio devices Say Y or M if you want to add support to use audio devices
in Qualcomm Technologies SOC-based platforms. in Qualcomm Technologies SOC-based platforms.
...@@ -60,14 +59,16 @@ config SND_SOC_STORM ...@@ -60,14 +59,16 @@ config SND_SOC_STORM
config SND_SOC_APQ8016_SBC config SND_SOC_APQ8016_SBC
tristate "SoC Audio support for APQ8016 SBC platforms" tristate "SoC Audio support for APQ8016 SBC platforms"
select SND_SOC_LPASS_APQ8016 select SND_SOC_LPASS_APQ8016
depends on SND_SOC_QCOM_COMMON select SND_SOC_QCOM_COMMON
help help
Support for Qualcomm Technologies LPASS audio block in Support for Qualcomm Technologies LPASS audio block in
APQ8016 SOC-based systems. APQ8016 SOC-based systems.
Say Y if you want to use audio devices on MI2S. Say Y if you want to use audio devices on MI2S.
config SND_SOC_QCOM_COMMON config SND_SOC_QCOM_COMMON
depends on SOUNDWIRE tristate
config SND_SOC_QCOM_SDW
tristate tristate
config SND_SOC_QDSP6_COMMON config SND_SOC_QDSP6_COMMON
...@@ -144,7 +145,7 @@ config SND_SOC_MSM8996 ...@@ -144,7 +145,7 @@ config SND_SOC_MSM8996
depends on QCOM_APR depends on QCOM_APR
depends on COMMON_CLK depends on COMMON_CLK
select SND_SOC_QDSP6 select SND_SOC_QDSP6
depends on SND_SOC_QCOM_COMMON select SND_SOC_QCOM_COMMON
help help
Support for Qualcomm Technologies LPASS audio block in Support for Qualcomm Technologies LPASS audio block in
APQ8096 SoC-based systems. APQ8096 SoC-based systems.
...@@ -155,7 +156,7 @@ config SND_SOC_SDM845 ...@@ -155,7 +156,7 @@ config SND_SOC_SDM845
depends on QCOM_APR && I2C && SOUNDWIRE depends on QCOM_APR && I2C && SOUNDWIRE
depends on COMMON_CLK depends on COMMON_CLK
select SND_SOC_QDSP6 select SND_SOC_QDSP6
depends on SND_SOC_QCOM_COMMON select SND_SOC_QCOM_COMMON
select SND_SOC_RT5663 select SND_SOC_RT5663
select SND_SOC_MAX98927 select SND_SOC_MAX98927
imply SND_SOC_CROS_EC_CODEC imply SND_SOC_CROS_EC_CODEC
...@@ -169,7 +170,8 @@ config SND_SOC_SM8250 ...@@ -169,7 +170,8 @@ config SND_SOC_SM8250
depends on QCOM_APR && SOUNDWIRE depends on QCOM_APR && SOUNDWIRE
depends on COMMON_CLK depends on COMMON_CLK
select SND_SOC_QDSP6 select SND_SOC_QDSP6
depends on SND_SOC_QCOM_COMMON select SND_SOC_QCOM_COMMON
select SND_SOC_QCOM_SDW
help help
To add support for audio on Qualcomm Technologies Inc. To add support for audio on Qualcomm Technologies Inc.
SM8250 SoC-based systems. SM8250 SoC-based systems.
...@@ -180,7 +182,8 @@ config SND_SOC_SC8280XP ...@@ -180,7 +182,8 @@ config SND_SOC_SC8280XP
depends on QCOM_APR && SOUNDWIRE depends on QCOM_APR && SOUNDWIRE
depends on COMMON_CLK depends on COMMON_CLK
select SND_SOC_QDSP6 select SND_SOC_QDSP6
depends on SND_SOC_QCOM_COMMON select SND_SOC_QCOM_COMMON
select SND_SOC_QCOM_SDW
help help
To add support for audio on Qualcomm Technologies Inc. To add support for audio on Qualcomm Technologies Inc.
SC8280XP SoC-based systems. SC8280XP SoC-based systems.
...@@ -190,7 +193,7 @@ config SND_SOC_SC7180 ...@@ -190,7 +193,7 @@ config SND_SOC_SC7180
tristate "SoC Machine driver for SC7180 boards" tristate "SoC Machine driver for SC7180 boards"
depends on I2C && GPIOLIB depends on I2C && GPIOLIB
depends on SOUNDWIRE || SOUNDWIRE=n depends on SOUNDWIRE || SOUNDWIRE=n
depends on SND_SOC_QCOM_COMMON select SND_SOC_QCOM_COMMON
select SND_SOC_LPASS_SC7180 select SND_SOC_LPASS_SC7180
select SND_SOC_MAX98357A select SND_SOC_MAX98357A
select SND_SOC_RT5682_I2C select SND_SOC_RT5682_I2C
...@@ -204,7 +207,7 @@ config SND_SOC_SC7180 ...@@ -204,7 +207,7 @@ config SND_SOC_SC7180
config SND_SOC_SC7280 config SND_SOC_SC7280
tristate "SoC Machine driver for SC7280 boards" tristate "SoC Machine driver for SC7280 boards"
depends on I2C && SOUNDWIRE depends on I2C && SOUNDWIRE
depends on SND_SOC_QCOM_COMMON select SND_SOC_QCOM_COMMON
select SND_SOC_LPASS_SC7280 select SND_SOC_LPASS_SC7280
select SND_SOC_MAX98357A select SND_SOC_MAX98357A
select SND_SOC_WCD938X_SDW select SND_SOC_WCD938X_SDW
......
...@@ -28,6 +28,7 @@ snd-soc-sdm845-objs := sdm845.o ...@@ -28,6 +28,7 @@ snd-soc-sdm845-objs := sdm845.o
snd-soc-sm8250-objs := sm8250.o snd-soc-sm8250-objs := sm8250.o
snd-soc-sc8280xp-objs := sc8280xp.o snd-soc-sc8280xp-objs := sc8280xp.o
snd-soc-qcom-common-objs := common.o snd-soc-qcom-common-objs := common.o
snd-soc-qcom-sdw-objs := sdw.o
obj-$(CONFIG_SND_SOC_STORM) += snd-soc-storm.o obj-$(CONFIG_SND_SOC_STORM) += snd-soc-storm.o
obj-$(CONFIG_SND_SOC_APQ8016_SBC) += snd-soc-apq8016-sbc.o obj-$(CONFIG_SND_SOC_APQ8016_SBC) += snd-soc-apq8016-sbc.o
...@@ -38,6 +39,7 @@ obj-$(CONFIG_SND_SOC_SC8280XP) += snd-soc-sc8280xp.o ...@@ -38,6 +39,7 @@ obj-$(CONFIG_SND_SOC_SC8280XP) += snd-soc-sc8280xp.o
obj-$(CONFIG_SND_SOC_SDM845) += snd-soc-sdm845.o obj-$(CONFIG_SND_SOC_SDM845) += snd-soc-sdm845.o
obj-$(CONFIG_SND_SOC_SM8250) += snd-soc-sm8250.o obj-$(CONFIG_SND_SOC_SM8250) += snd-soc-sm8250.o
obj-$(CONFIG_SND_SOC_QCOM_COMMON) += snd-soc-qcom-common.o obj-$(CONFIG_SND_SOC_QCOM_COMMON) += snd-soc-qcom-common.o
obj-$(CONFIG_SND_SOC_QCOM_SDW) += snd-soc-qcom-sdw.o
#DSP lib #DSP lib
obj-$(CONFIG_SND_SOC_QDSP6) += qdsp6/ obj-$(CONFIG_SND_SOC_QDSP6) += qdsp6/
...@@ -180,120 +180,6 @@ int qcom_snd_parse_of(struct snd_soc_card *card) ...@@ -180,120 +180,6 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
} }
EXPORT_SYMBOL_GPL(qcom_snd_parse_of); EXPORT_SYMBOL_GPL(qcom_snd_parse_of);
int qcom_snd_sdw_prepare(struct snd_pcm_substream *substream,
struct sdw_stream_runtime *sruntime,
bool *stream_prepared)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int ret;
if (!sruntime)
return 0;
switch (cpu_dai->id) {
case WSA_CODEC_DMA_RX_0:
case WSA_CODEC_DMA_RX_1:
case RX_CODEC_DMA_RX_0:
case RX_CODEC_DMA_RX_1:
case TX_CODEC_DMA_TX_0:
case TX_CODEC_DMA_TX_1:
case TX_CODEC_DMA_TX_2:
case TX_CODEC_DMA_TX_3:
break;
default:
return 0;
}
if (*stream_prepared) {
sdw_disable_stream(sruntime);
sdw_deprepare_stream(sruntime);
*stream_prepared = false;
}
ret = sdw_prepare_stream(sruntime);
if (ret)
return ret;
/**
* NOTE: there is a strict hw requirement about the ordering of port
* enables and actual WSA881x PA enable. PA enable should only happen
* after soundwire ports are enabled if not DC on the line is
* accumulated resulting in Click/Pop Noise
* PA enable/mute are handled as part of codec DAPM and digital mute.
*/
ret = sdw_enable_stream(sruntime);
if (ret) {
sdw_deprepare_stream(sruntime);
return ret;
}
*stream_prepared = true;
return ret;
}
EXPORT_SYMBOL_GPL(qcom_snd_sdw_prepare);
int qcom_snd_sdw_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct sdw_stream_runtime **psruntime)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
struct sdw_stream_runtime *sruntime;
int i;
switch (cpu_dai->id) {
case WSA_CODEC_DMA_RX_0:
case RX_CODEC_DMA_RX_0:
case RX_CODEC_DMA_RX_1:
case TX_CODEC_DMA_TX_0:
case TX_CODEC_DMA_TX_1:
case TX_CODEC_DMA_TX_2:
case TX_CODEC_DMA_TX_3:
for_each_rtd_codec_dais(rtd, i, codec_dai) {
sruntime = snd_soc_dai_get_stream(codec_dai, substream->stream);
if (sruntime != ERR_PTR(-ENOTSUPP))
*psruntime = sruntime;
}
break;
}
return 0;
}
EXPORT_SYMBOL_GPL(qcom_snd_sdw_hw_params);
int qcom_snd_sdw_hw_free(struct snd_pcm_substream *substream,
struct sdw_stream_runtime *sruntime, bool *stream_prepared)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
switch (cpu_dai->id) {
case WSA_CODEC_DMA_RX_0:
case WSA_CODEC_DMA_RX_1:
case RX_CODEC_DMA_RX_0:
case RX_CODEC_DMA_RX_1:
case TX_CODEC_DMA_TX_0:
case TX_CODEC_DMA_TX_1:
case TX_CODEC_DMA_TX_2:
case TX_CODEC_DMA_TX_3:
if (sruntime && *stream_prepared) {
sdw_disable_stream(sruntime);
sdw_deprepare_stream(sruntime);
*stream_prepared = false;
}
break;
default:
break;
}
return 0;
}
EXPORT_SYMBOL_GPL(qcom_snd_sdw_hw_free);
int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd, int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_jack *jack, bool *jack_setup) struct snd_soc_jack *jack, bool *jack_setup)
{ {
......
...@@ -5,19 +5,9 @@ ...@@ -5,19 +5,9 @@
#define __QCOM_SND_COMMON_H__ #define __QCOM_SND_COMMON_H__
#include <sound/soc.h> #include <sound/soc.h>
#include <linux/soundwire/sdw.h>
int qcom_snd_parse_of(struct snd_soc_card *card); int qcom_snd_parse_of(struct snd_soc_card *card);
int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd, int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_jack *jack, bool *jack_setup); struct snd_soc_jack *jack, bool *jack_setup);
int qcom_snd_sdw_prepare(struct snd_pcm_substream *substream,
struct sdw_stream_runtime *runtime,
bool *stream_prepared);
int qcom_snd_sdw_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct sdw_stream_runtime **psruntime);
int qcom_snd_sdw_hw_free(struct snd_pcm_substream *substream,
struct sdw_stream_runtime *sruntime,
bool *stream_prepared);
#endif #endif
...@@ -1037,10 +1037,11 @@ static void of_lpass_cpu_parse_dai_data(struct device *dev, ...@@ -1037,10 +1037,11 @@ static void of_lpass_cpu_parse_dai_data(struct device *dev,
struct lpass_data *data) struct lpass_data *data)
{ {
struct device_node *node; struct device_node *node;
int ret, id; int ret, i, id;
/* Allow all channels by default for backwards compatibility */ /* Allow all channels by default for backwards compatibility */
for (id = 0; id < data->variant->num_dai; id++) { for (i = 0; i < data->variant->num_dai; i++) {
id = data->variant->dai_driver[i].id;
data->mi2s_playback_sd_mode[id] = LPAIF_I2SCTL_MODE_8CH; data->mi2s_playback_sd_mode[id] = LPAIF_I2SCTL_MODE_8CH;
data->mi2s_capture_sd_mode[id] = LPAIF_I2SCTL_MODE_8CH; data->mi2s_capture_sd_mode[id] = LPAIF_I2SCTL_MODE_8CH;
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/input-event-codes.h> #include <linux/input-event-codes.h>
#include "qdsp6/q6afe.h" #include "qdsp6/q6afe.h"
#include "common.h" #include "common.h"
#include "sdw.h"
#define DRIVER_NAME "sc8280xp" #define DRIVER_NAME "sc8280xp"
......
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2018, Linaro Limited.
// Copyright (c) 2018, The Linux Foundation. All rights reserved.
#include <linux/module.h>
#include <sound/soc.h>
#include "qdsp6/q6afe.h"
#include "sdw.h"
int qcom_snd_sdw_prepare(struct snd_pcm_substream *substream,
struct sdw_stream_runtime *sruntime,
bool *stream_prepared)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int ret;
if (!sruntime)
return 0;
switch (cpu_dai->id) {
case WSA_CODEC_DMA_RX_0:
case WSA_CODEC_DMA_RX_1:
case RX_CODEC_DMA_RX_0:
case RX_CODEC_DMA_RX_1:
case TX_CODEC_DMA_TX_0:
case TX_CODEC_DMA_TX_1:
case TX_CODEC_DMA_TX_2:
case TX_CODEC_DMA_TX_3:
break;
default:
return 0;
}
if (*stream_prepared) {
sdw_disable_stream(sruntime);
sdw_deprepare_stream(sruntime);
*stream_prepared = false;
}
ret = sdw_prepare_stream(sruntime);
if (ret)
return ret;
/**
* NOTE: there is a strict hw requirement about the ordering of port
* enables and actual WSA881x PA enable. PA enable should only happen
* after soundwire ports are enabled if not DC on the line is
* accumulated resulting in Click/Pop Noise
* PA enable/mute are handled as part of codec DAPM and digital mute.
*/
ret = sdw_enable_stream(sruntime);
if (ret) {
sdw_deprepare_stream(sruntime);
return ret;
}
*stream_prepared = true;
return ret;
}
EXPORT_SYMBOL_GPL(qcom_snd_sdw_prepare);
int qcom_snd_sdw_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct sdw_stream_runtime **psruntime)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
struct sdw_stream_runtime *sruntime;
int i;
switch (cpu_dai->id) {
case WSA_CODEC_DMA_RX_0:
case RX_CODEC_DMA_RX_0:
case RX_CODEC_DMA_RX_1:
case TX_CODEC_DMA_TX_0:
case TX_CODEC_DMA_TX_1:
case TX_CODEC_DMA_TX_2:
case TX_CODEC_DMA_TX_3:
for_each_rtd_codec_dais(rtd, i, codec_dai) {
sruntime = snd_soc_dai_get_stream(codec_dai, substream->stream);
if (sruntime != ERR_PTR(-ENOTSUPP))
*psruntime = sruntime;
}
break;
}
return 0;
}
EXPORT_SYMBOL_GPL(qcom_snd_sdw_hw_params);
int qcom_snd_sdw_hw_free(struct snd_pcm_substream *substream,
struct sdw_stream_runtime *sruntime, bool *stream_prepared)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
switch (cpu_dai->id) {
case WSA_CODEC_DMA_RX_0:
case WSA_CODEC_DMA_RX_1:
case RX_CODEC_DMA_RX_0:
case RX_CODEC_DMA_RX_1:
case TX_CODEC_DMA_TX_0:
case TX_CODEC_DMA_TX_1:
case TX_CODEC_DMA_TX_2:
case TX_CODEC_DMA_TX_3:
if (sruntime && *stream_prepared) {
sdw_disable_stream(sruntime);
sdw_deprepare_stream(sruntime);
*stream_prepared = false;
}
break;
default:
break;
}
return 0;
}
EXPORT_SYMBOL_GPL(qcom_snd_sdw_hw_free);
MODULE_LICENSE("GPL v2");
/* SPDX-License-Identifier: GPL-2.0 */
// Copyright (c) 2018, The Linux Foundation. All rights reserved.
#ifndef __QCOM_SND_SDW_H__
#define __QCOM_SND_SDW_H__
#include <linux/soundwire/sdw.h>
int qcom_snd_sdw_prepare(struct snd_pcm_substream *substream,
struct sdw_stream_runtime *runtime,
bool *stream_prepared);
int qcom_snd_sdw_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct sdw_stream_runtime **psruntime);
int qcom_snd_sdw_hw_free(struct snd_pcm_substream *substream,
struct sdw_stream_runtime *sruntime,
bool *stream_prepared);
#endif
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/input-event-codes.h> #include <linux/input-event-codes.h>
#include "qdsp6/q6afe.h" #include "qdsp6/q6afe.h"
#include "common.h" #include "common.h"
#include "sdw.h"
#define DRIVER_NAME "sm8250" #define DRIVER_NAME "sm8250"
#define MI2S_BCLK_RATE 1536000 #define MI2S_BCLK_RATE 1536000
......
...@@ -353,7 +353,9 @@ int snd_sof_dbg_init(struct snd_sof_dev *sdev) ...@@ -353,7 +353,9 @@ int snd_sof_dbg_init(struct snd_sof_dev *sdev)
return err; return err;
} }
return 0; return snd_sof_debugfs_buf_item(sdev, &sdev->fw_state,
sizeof(sdev->fw_state),
"fw_state", 0444);
} }
EXPORT_SYMBOL_GPL(snd_sof_dbg_init); EXPORT_SYMBOL_GPL(snd_sof_dbg_init);
......
...@@ -182,7 +182,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) ...@@ -182,7 +182,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
const struct sof_ipc_pm_ops *pm_ops = sof_ipc_get_ops(sdev, pm); const struct sof_ipc_pm_ops *pm_ops = sof_ipc_get_ops(sdev, pm);
const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg); const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
pm_message_t pm_state; pm_message_t pm_state;
u32 target_state = 0; u32 target_state = snd_sof_dsp_power_target(sdev);
int ret; int ret;
/* do nothing if dsp suspend callback is not set */ /* do nothing if dsp suspend callback is not set */
...@@ -192,6 +192,9 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) ...@@ -192,6 +192,9 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
if (runtime_suspend && !sof_ops(sdev)->runtime_suspend) if (runtime_suspend && !sof_ops(sdev)->runtime_suspend)
return 0; return 0;
if (tplg_ops && tplg_ops->tear_down_all_pipelines)
tplg_ops->tear_down_all_pipelines(sdev, false);
if (sdev->fw_state != SOF_FW_BOOT_COMPLETE) if (sdev->fw_state != SOF_FW_BOOT_COMPLETE)
goto suspend; goto suspend;
...@@ -206,7 +209,6 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) ...@@ -206,7 +209,6 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
} }
} }
target_state = snd_sof_dsp_power_target(sdev);
pm_state.event = target_state; pm_state.event = target_state;
/* Skip to platform-specific suspend if DSP is entering D0 */ /* Skip to platform-specific suspend if DSP is entering D0 */
...@@ -217,9 +219,6 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) ...@@ -217,9 +219,6 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
goto suspend; goto suspend;
} }
if (tplg_ops->tear_down_all_pipelines)
tplg_ops->tear_down_all_pipelines(sdev, false);
/* suspend DMA trace */ /* suspend DMA trace */
sof_fw_trace_suspend(sdev, pm_state); sof_fw_trace_suspend(sdev, pm_state);
......
...@@ -273,9 +273,9 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg ...@@ -273,9 +273,9 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg
const struct sof_ipc_tplg_widget_ops *widget_ops; const struct sof_ipc_tplg_widget_ops *widget_ops;
struct snd_soc_dapm_path *p; struct snd_soc_dapm_path *p;
/* return if the widget is in use or if it is already unprepared */ /* skip if the widget is in use or if it is already unprepared */
if (!swidget->prepared || swidget->use_count > 1) if (!swidget || !swidget->prepared || swidget->use_count > 0)
return; goto sink_unprepare;
widget_ops = tplg_ops ? tplg_ops->widget : NULL; widget_ops = tplg_ops ? tplg_ops->widget : NULL;
if (widget_ops && widget_ops[widget->id].ipc_unprepare) if (widget_ops && widget_ops[widget->id].ipc_unprepare)
...@@ -284,6 +284,7 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg ...@@ -284,6 +284,7 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg
swidget->prepared = false; swidget->prepared = false;
sink_unprepare:
/* unprepare all widgets in the sink paths */ /* unprepare all widgets in the sink paths */
snd_soc_dapm_widget_for_each_sink_path(widget, p) { snd_soc_dapm_widget_for_each_sink_path(widget, p) {
if (!p->walking && p->sink->dobj.private) { if (!p->walking && p->sink->dobj.private) {
...@@ -310,7 +311,7 @@ sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget ...@@ -310,7 +311,7 @@ sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget
if (!widget_ops) if (!widget_ops)
return 0; return 0;
if (!widget_ops[widget->id].ipc_prepare || swidget->prepared) if (!swidget || !widget_ops[widget->id].ipc_prepare || swidget->prepared)
goto sink_prepare; goto sink_prepare;
/* prepare the source widget */ /* prepare the source widget */
...@@ -436,11 +437,11 @@ sof_walk_widgets_in_order(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget_l ...@@ -436,11 +437,11 @@ sof_walk_widgets_in_order(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget_l
for_each_dapm_widgets(list, i, widget) { for_each_dapm_widgets(list, i, widget) {
/* starting widget for playback is AIF type */ /* starting widget for playback is AIF type */
if (dir == SNDRV_PCM_STREAM_PLAYBACK && !WIDGET_IS_AIF(widget->id)) if (dir == SNDRV_PCM_STREAM_PLAYBACK && widget->id != snd_soc_dapm_aif_in)
continue; continue;
/* starting widget for capture is DAI type */ /* starting widget for capture is DAI type */
if (dir == SNDRV_PCM_STREAM_CAPTURE && !WIDGET_IS_DAI(widget->id)) if (dir == SNDRV_PCM_STREAM_CAPTURE && widget->id != snd_soc_dapm_dai_out)
continue; continue;
switch (op) { switch (op) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment