Commit 5a7d9aaf authored by Mark Brown's avatar Mark Brown

ASoC: Intel: machine driver update

Merge series from Bard Liao <yung-chuan.liao@linux.intel.com>:

Some cleanups from Brent Lu for I2S platforms. And minor additions for
RVPs and Chromebooks.
parents 925819c7 5f017134
...@@ -38,6 +38,12 @@ config SND_SOC_INTEL_SOF_REALTEK_COMMON ...@@ -38,6 +38,12 @@ config SND_SOC_INTEL_SOF_REALTEK_COMMON
config SND_SOC_INTEL_SOF_CIRRUS_COMMON config SND_SOC_INTEL_SOF_CIRRUS_COMMON
tristate tristate
config SND_SOC_INTEL_SOF_NUVOTON_COMMON
tristate
config SND_SOC_INTEL_SOF_SSP_COMMON
tristate
if SND_SOC_INTEL_CATPT if SND_SOC_INTEL_CATPT
config SND_SOC_INTEL_HASWELL_MACH config SND_SOC_INTEL_HASWELL_MACH
...@@ -493,6 +499,7 @@ config SND_SOC_INTEL_SOF_RT5682_MACH ...@@ -493,6 +499,7 @@ config SND_SOC_INTEL_SOF_RT5682_MACH
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 select SND_SOC_INTEL_SOF_REALTEK_COMMON
select SND_SOC_INTEL_SOF_SSP_COMMON
help help
This adds support for ASoC machine driver for SOF platforms This adds support for ASoC machine driver for SOF platforms
with rt5650 or rt5682 codec. with rt5650 or rt5682 codec.
...@@ -510,6 +517,7 @@ config SND_SOC_INTEL_SOF_CS42L42_MACH ...@@ -510,6 +517,7 @@ config SND_SOC_INTEL_SOF_CS42L42_MACH
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_SSP_COMMON
help help
This adds support for ASoC machine driver for SOF platforms This adds support for ASoC machine driver for SOF platforms
with cs42l42 codec. with cs42l42 codec.
...@@ -560,7 +568,9 @@ config SND_SOC_INTEL_SOF_NAU8825_MACH ...@@ -560,7 +568,9 @@ config SND_SOC_INTEL_SOF_NAU8825_MACH
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_NUVOTON_COMMON
select SND_SOC_INTEL_SOF_REALTEK_COMMON select SND_SOC_INTEL_SOF_REALTEK_COMMON
select SND_SOC_INTEL_SOF_SSP_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.
...@@ -600,25 +610,24 @@ config SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH ...@@ -600,25 +610,24 @@ config SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH
endif ## SND_SOC_SOF_COMETLAKE && SND_SOC_SOF_HDA_LINK endif ## SND_SOC_SOF_COMETLAKE && SND_SOC_SOF_HDA_LINK
if SND_SOC_SOF_JASPERLAKE config SND_SOC_INTEL_SOF_DA7219_MACH
tristate "SOF with DA7219 codec in I2S Mode"
config SND_SOC_INTEL_SOF_DA7219_MAX98373_MACH
tristate "SOF with DA7219 and MAX98373/MAX98360A in I2S Mode"
depends on I2C && ACPI depends on I2C && ACPI
depends on MFD_INTEL_LPSS || COMPILE_TEST depends on MFD_INTEL_LPSS || COMPILE_TEST
depends on SND_HDA_CODEC_HDMI && SND_SOC_SOF_HDA_AUDIO_CODEC depends on SND_HDA_CODEC_HDMI && SND_SOC_SOF_HDA_AUDIO_CODEC
select SND_SOC_INTEL_HDA_DSP_COMMON select SND_SOC_INTEL_HDA_DSP_COMMON
select SND_SOC_DA7219 select SND_SOC_DA7219
select SND_SOC_MAX98357A
select SND_SOC_MAX98373_I2C select SND_SOC_MAX98373_I2C
select SND_SOC_DMIC select SND_SOC_DMIC
select SND_SOC_INTEL_SOF_MAXIM_COMMON
select SND_SOC_INTEL_SOF_SSP_COMMON
help help
This adds support for ASoC machine driver for SOF platforms This adds support for ASoC machine driver for SOF platforms
with DA7219 + MAX98373/MAX98360A I2S audio codec. with Dialog DA7219 I2S audio codec.
Say Y if you have such a device. Say Y if you have such a device.
If unsure select "N". If unsure select "N".
endif ## SND_SOC_SOF_JASPERLAKE
if SND_SOC_SOF_HDA_LINK if SND_SOC_SOF_HDA_LINK
config SND_SOC_INTEL_SOF_SSP_AMP_MACH config SND_SOC_INTEL_SOF_SSP_AMP_MACH
...@@ -632,6 +641,7 @@ config SND_SOC_INTEL_SOF_SSP_AMP_MACH ...@@ -632,6 +641,7 @@ config SND_SOC_INTEL_SOF_SSP_AMP_MACH
select SND_SOC_INTEL_HDA_DSP_COMMON select SND_SOC_INTEL_HDA_DSP_COMMON
select SND_SOC_INTEL_SOF_REALTEK_COMMON select SND_SOC_INTEL_SOF_REALTEK_COMMON
select SND_SOC_INTEL_SOF_CIRRUS_COMMON select SND_SOC_INTEL_SOF_CIRRUS_COMMON
select SND_SOC_INTEL_SOF_SSP_COMMON
help help
This adds support for ASoC machine driver for SOF platforms This adds support for ASoC machine driver for SOF platforms
with RT1308/CS35L41 I2S audio codec. with RT1308/CS35L41 I2S audio codec.
......
...@@ -23,6 +23,7 @@ snd-soc-sof_rt5682-objs := sof_rt5682.o ...@@ -23,6 +23,7 @@ snd-soc-sof_rt5682-objs := sof_rt5682.o
snd-soc-sof_cs42l42-objs := sof_cs42l42.o snd-soc-sof_cs42l42-objs := sof_cs42l42.o
snd-soc-sof_es8336-objs := sof_es8336.o snd-soc-sof_es8336-objs := sof_es8336.o
snd-soc-sof_nau8825-objs := sof_nau8825.o snd-soc-sof_nau8825-objs := sof_nau8825.o
snd-soc-sof_da7219-objs := sof_da7219.o
snd-soc-cml_rt1011_rt5682-objs := cml_rt1011_rt5682.o snd-soc-cml_rt1011_rt5682-objs := cml_rt1011_rt5682.o
snd-soc-kbl_da7219_max98357a-objs := kbl_da7219_max98357a.o snd-soc-kbl_da7219_max98357a-objs := kbl_da7219_max98357a.o
snd-soc-kbl_da7219_max98927-objs := kbl_da7219_max98927.o snd-soc-kbl_da7219_max98927-objs := kbl_da7219_max98927.o
...@@ -33,7 +34,6 @@ snd-soc-skl_rt286-objs := skl_rt286.o ...@@ -33,7 +34,6 @@ snd-soc-skl_rt286-objs := skl_rt286.o
snd-soc-skl_hda_dsp-objs := skl_hda_dsp_generic.o skl_hda_dsp_common.o snd-soc-skl_hda_dsp-objs := skl_hda_dsp_generic.o skl_hda_dsp_common.o
snd-skl_nau88l25_max98357a-objs := skl_nau88l25_max98357a.o snd-skl_nau88l25_max98357a-objs := skl_nau88l25_max98357a.o
snd-soc-skl_nau88l25_ssm4567-objs := skl_nau88l25_ssm4567.o snd-soc-skl_nau88l25_ssm4567-objs := skl_nau88l25_ssm4567.o
snd-soc-sof_da7219_max98373-objs := sof_da7219_max98373.o
snd-soc-ehl-rt5660-objs := ehl_rt5660.o snd-soc-ehl-rt5660-objs := ehl_rt5660.o
snd-soc-sof-ssp-amp-objs := sof_ssp_amp.o snd-soc-sof-ssp-amp-objs := sof_ssp_amp.o
snd-soc-sof-sdw-objs += sof_sdw.o \ snd-soc-sof-sdw-objs += sof_sdw.o \
...@@ -48,6 +48,7 @@ obj-$(CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH) += snd-soc-sof_rt5682.o ...@@ -48,6 +48,7 @@ obj-$(CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH) += snd-soc-sof_rt5682.o
obj-$(CONFIG_SND_SOC_INTEL_SOF_CS42L42_MACH) += snd-soc-sof_cs42l42.o obj-$(CONFIG_SND_SOC_INTEL_SOF_CS42L42_MACH) += snd-soc-sof_cs42l42.o
obj-$(CONFIG_SND_SOC_INTEL_SOF_ES8336_MACH) += snd-soc-sof_es8336.o obj-$(CONFIG_SND_SOC_INTEL_SOF_ES8336_MACH) += snd-soc-sof_es8336.o
obj-$(CONFIG_SND_SOC_INTEL_SOF_NAU8825_MACH) += snd-soc-sof_nau8825.o obj-$(CONFIG_SND_SOC_INTEL_SOF_NAU8825_MACH) += snd-soc-sof_nau8825.o
obj-$(CONFIG_SND_SOC_INTEL_SOF_DA7219_MACH) += snd-soc-sof_da7219.o
obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-hsw-rt5640.o obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-hsw-rt5640.o
obj-$(CONFIG_SND_SOC_INTEL_BXT_DA7219_MAX98357A_COMMON) += snd-soc-sst-bxt-da7219_max98357a.o obj-$(CONFIG_SND_SOC_INTEL_BXT_DA7219_MAX98357A_COMMON) += snd-soc-sst-bxt-da7219_max98357a.o
obj-$(CONFIG_SND_SOC_INTEL_BXT_RT298_MACH) += snd-soc-sst-bxt-rt298.o obj-$(CONFIG_SND_SOC_INTEL_BXT_RT298_MACH) += snd-soc-sst-bxt-rt298.o
...@@ -78,7 +79,6 @@ obj-$(CONFIG_SND_SOC_INTEL_SKL_RT286_MACH) += snd-soc-skl_rt286.o ...@@ -78,7 +79,6 @@ obj-$(CONFIG_SND_SOC_INTEL_SKL_RT286_MACH) += snd-soc-skl_rt286.o
obj-$(CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH) += snd-skl_nau88l25_max98357a.o obj-$(CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH) += snd-skl_nau88l25_max98357a.o
obj-$(CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH) += snd-soc-skl_nau88l25_ssm4567.o obj-$(CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH) += snd-soc-skl_nau88l25_ssm4567.o
obj-$(CONFIG_SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH) += snd-soc-skl_hda_dsp.o obj-$(CONFIG_SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH) += snd-soc-skl_hda_dsp.o
obj-$(CONFIG_SND_SOC_INTEL_SOF_DA7219_MAX98373_MACH) += snd-soc-sof_da7219_max98373.o
obj-$(CONFIG_SND_SOC_INTEL_EHL_RT5660_MACH) += snd-soc-ehl-rt5660.o obj-$(CONFIG_SND_SOC_INTEL_EHL_RT5660_MACH) += snd-soc-ehl-rt5660.o
obj-$(CONFIG_SND_SOC_INTEL_SOUNDWIRE_SOF_MACH) += snd-soc-sof-sdw.o obj-$(CONFIG_SND_SOC_INTEL_SOUNDWIRE_SOF_MACH) += snd-soc-sof-sdw.o
obj-$(CONFIG_SND_SOC_INTEL_SOF_SSP_AMP_MACH) += snd-soc-sof-ssp-amp.o obj-$(CONFIG_SND_SOC_INTEL_SOF_SSP_AMP_MACH) += snd-soc-sof-ssp-amp.o
...@@ -95,3 +95,9 @@ obj-$(CONFIG_SND_SOC_INTEL_SOF_REALTEK_COMMON) += snd-soc-intel-sof-realtek-comm ...@@ -95,3 +95,9 @@ obj-$(CONFIG_SND_SOC_INTEL_SOF_REALTEK_COMMON) += snd-soc-intel-sof-realtek-comm
snd-soc-intel-sof-cirrus-common-objs += sof_cirrus_common.o snd-soc-intel-sof-cirrus-common-objs += sof_cirrus_common.o
obj-$(CONFIG_SND_SOC_INTEL_SOF_CIRRUS_COMMON) += snd-soc-intel-sof-cirrus-common.o obj-$(CONFIG_SND_SOC_INTEL_SOF_CIRRUS_COMMON) += snd-soc-intel-sof-cirrus-common.o
snd-soc-intel-sof-nuvoton-common-objs += sof_nuvoton_common.o
obj-$(CONFIG_SND_SOC_INTEL_SOF_NUVOTON_COMMON) += snd-soc-intel-sof-nuvoton-common.o
snd-soc-intel-sof-ssp-common-objs += sof_ssp_common.o
obj-$(CONFIG_SND_SOC_INTEL_SOF_SSP_COMMON) += snd-soc-intel-sof-ssp-common.o
...@@ -9,15 +9,16 @@ ...@@ -9,15 +9,16 @@
#define __SOF_CIRRUS_COMMON_H #define __SOF_CIRRUS_COMMON_H
#include <sound/soc.h> #include <sound/soc.h>
#include "sof_ssp_common.h"
/* /*
* Cirrus Logic CS35L41/CS35L53 * Cirrus Logic CS35L41/CS35L53
*/ */
#define CS35L41_CODEC_DAI "cs35l41-pcm" #define CS35L41_CODEC_DAI "cs35l41-pcm"
#define CS35L41_DEV0_NAME "i2c-CSC3541:00" #define CS35L41_DEV0_NAME "i2c-" CS35L41_ACPI_HID ":00"
#define CS35L41_DEV1_NAME "i2c-CSC3541:01" #define CS35L41_DEV1_NAME "i2c-" CS35L41_ACPI_HID ":01"
#define CS35L41_DEV2_NAME "i2c-CSC3541:02" #define CS35L41_DEV2_NAME "i2c-" CS35L41_ACPI_HID ":02"
#define CS35L41_DEV3_NAME "i2c-CSC3541:03" #define CS35L41_DEV3_NAME "i2c-" CS35L41_ACPI_HID ":03"
void cs35l41_set_dai_link(struct snd_soc_dai_link *link); void cs35l41_set_dai_link(struct snd_soc_dai_link *link);
void cs35l41_set_codec_conf(struct snd_soc_card *card); void cs35l41_set_codec_conf(struct snd_soc_card *card);
......
...@@ -23,12 +23,12 @@ ...@@ -23,12 +23,12 @@
#include "../common/soc-intel-quirks.h" #include "../common/soc-intel-quirks.h"
#include "hda_dsp_common.h" #include "hda_dsp_common.h"
#include "sof_maxim_common.h" #include "sof_maxim_common.h"
#include "sof_ssp_common.h"
#define NAME_SIZE 32 #define NAME_SIZE 32
#define SOF_CS42L42_SSP_CODEC(quirk) ((quirk) & GENMASK(2, 0)) #define SOF_CS42L42_SSP_CODEC(quirk) ((quirk) & GENMASK(2, 0))
#define SOF_CS42L42_SSP_CODEC_MASK (GENMASK(2, 0)) #define SOF_CS42L42_SSP_CODEC_MASK (GENMASK(2, 0))
#define SOF_SPEAKER_AMP_PRESENT BIT(3)
#define SOF_CS42L42_SSP_AMP_SHIFT 4 #define SOF_CS42L42_SSP_AMP_SHIFT 4
#define SOF_CS42L42_SSP_AMP_MASK (GENMASK(6, 4)) #define SOF_CS42L42_SSP_AMP_MASK (GENMASK(6, 4))
#define SOF_CS42L42_SSP_AMP(quirk) \ #define SOF_CS42L42_SSP_AMP(quirk) \
...@@ -46,8 +46,6 @@ ...@@ -46,8 +46,6 @@
#define SOF_CS42L42_SSP_BT_MASK (GENMASK(28, 26)) #define SOF_CS42L42_SSP_BT_MASK (GENMASK(28, 26))
#define SOF_CS42L42_SSP_BT(quirk) \ #define SOF_CS42L42_SSP_BT(quirk) \
(((quirk) << SOF_CS42L42_SSP_BT_SHIFT) & SOF_CS42L42_SSP_BT_MASK) (((quirk) << SOF_CS42L42_SSP_BT_SHIFT) & SOF_CS42L42_SSP_BT_MASK)
#define SOF_MAX98357A_SPEAKER_AMP_PRESENT BIT(29)
#define SOF_MAX98360A_SPEAKER_AMP_PRESENT BIT(30)
enum { enum {
LINK_NONE = 0, LINK_NONE = 0,
...@@ -83,6 +81,8 @@ struct sof_card_private { ...@@ -83,6 +81,8 @@ struct sof_card_private {
struct snd_soc_jack headset_jack; struct snd_soc_jack headset_jack;
struct list_head hdmi_pcm_list; struct list_head hdmi_pcm_list;
bool common_hdmi_codec_drv; bool common_hdmi_codec_drv;
enum sof_ssp_codec codec_type;
enum sof_ssp_codec amp_type;
}; };
static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd) static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd)
...@@ -299,12 +299,13 @@ static struct snd_soc_dai_link_component dmic_component[] = { ...@@ -299,12 +299,13 @@ static struct snd_soc_dai_link_component dmic_component[] = {
static int create_spk_amp_dai_links(struct device *dev, static int create_spk_amp_dai_links(struct device *dev,
struct snd_soc_dai_link *links, struct snd_soc_dai_link *links,
struct snd_soc_dai_link_component *cpus, struct snd_soc_dai_link_component *cpus,
int *id, int ssp_amp) int *id, enum sof_ssp_codec amp_type,
int ssp_amp)
{ {
int ret = 0; int ret = 0;
/* speaker amp */ /* speaker amp */
if (!(sof_cs42l42_quirk & SOF_SPEAKER_AMP_PRESENT)) if (amp_type == CODEC_NONE)
return 0; return 0;
links[*id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", links[*id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec",
...@@ -316,14 +317,16 @@ static int create_spk_amp_dai_links(struct device *dev, ...@@ -316,14 +317,16 @@ static int create_spk_amp_dai_links(struct device *dev,
links[*id].id = *id; links[*id].id = *id;
if (sof_cs42l42_quirk & SOF_MAX98357A_SPEAKER_AMP_PRESENT) { switch (amp_type) {
case CODEC_MAX98357A:
max_98357a_dai_link(&links[*id]); max_98357a_dai_link(&links[*id]);
} else if (sof_cs42l42_quirk & SOF_MAX98360A_SPEAKER_AMP_PRESENT) { break;
case CODEC_MAX98360A:
max_98360a_dai_link(&links[*id]); max_98360a_dai_link(&links[*id]);
} else { break;
dev_err(dev, "no amp defined\n"); default:
ret = -EINVAL; dev_err(dev, "invalid amp type %d\n", amp_type);
goto devm_err; return -EINVAL;
} }
links[*id].platforms = platform_component; links[*id].platforms = platform_component;
...@@ -528,12 +531,10 @@ static int create_bt_offload_dai_links(struct device *dev, ...@@ -528,12 +531,10 @@ static int create_bt_offload_dai_links(struct device *dev,
return -ENOMEM; return -ENOMEM;
} }
static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, static struct snd_soc_dai_link *
int ssp_codec, sof_card_dai_links_create(struct device *dev, enum sof_ssp_codec amp_type,
int ssp_amp, int ssp_codec, int ssp_amp, int ssp_bt,
int ssp_bt, int dmic_be_num, int hdmi_num)
int dmic_be_num,
int hdmi_num)
{ {
struct snd_soc_dai_link_component *cpus; struct snd_soc_dai_link_component *cpus;
struct snd_soc_dai_link *links; struct snd_soc_dai_link *links;
...@@ -561,7 +562,8 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, ...@@ -561,7 +562,8 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
} }
break; break;
case LINK_SPK: case LINK_SPK:
ret = create_spk_amp_dai_links(dev, links, cpus, &id, ssp_amp); ret = create_spk_amp_dai_links(dev, links, cpus, &id,
amp_type, ssp_amp);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "fail to create spk amp dai links, ret %d\n", dev_err(dev, "fail to create spk amp dai links, ret %d\n",
ret); ret);
...@@ -624,6 +626,9 @@ static int sof_audio_probe(struct platform_device *pdev) ...@@ -624,6 +626,9 @@ static int sof_audio_probe(struct platform_device *pdev)
mach = pdev->dev.platform_data; mach = pdev->dev.platform_data;
ctx->codec_type = sof_ssp_detect_codec_type(&pdev->dev);
ctx->amp_type = sof_ssp_detect_amp_type(&pdev->dev);
if (soc_intel_is_glk()) { if (soc_intel_is_glk()) {
dmic_be_num = 1; dmic_be_num = 1;
hdmi_num = 3; hdmi_num = 3;
...@@ -649,13 +654,14 @@ static int sof_audio_probe(struct platform_device *pdev) ...@@ -649,13 +654,14 @@ static int sof_audio_probe(struct platform_device *pdev)
/* compute number of dai links */ /* compute number of dai links */
sof_audio_card_cs42l42.num_links = 1 + dmic_be_num + hdmi_num; sof_audio_card_cs42l42.num_links = 1 + dmic_be_num + hdmi_num;
if (sof_cs42l42_quirk & SOF_SPEAKER_AMP_PRESENT) if (ctx->amp_type != CODEC_NONE)
sof_audio_card_cs42l42.num_links++; sof_audio_card_cs42l42.num_links++;
if (sof_cs42l42_quirk & SOF_BT_OFFLOAD_PRESENT) if (sof_cs42l42_quirk & SOF_BT_OFFLOAD_PRESENT)
sof_audio_card_cs42l42.num_links++; sof_audio_card_cs42l42.num_links++;
dai_links = sof_card_dai_links_create(&pdev->dev, ssp_codec, ssp_amp, dai_links = sof_card_dai_links_create(&pdev->dev, ctx->amp_type,
ssp_bt, dmic_be_num, hdmi_num); ssp_codec, ssp_amp, ssp_bt,
dmic_be_num, hdmi_num);
if (!dai_links) if (!dai_links)
return -ENOMEM; return -ENOMEM;
...@@ -683,24 +689,18 @@ static const struct platform_device_id board_ids[] = { ...@@ -683,24 +689,18 @@ static const struct platform_device_id board_ids[] = {
{ {
.name = "glk_cs4242_mx98357a", .name = "glk_cs4242_mx98357a",
.driver_data = (kernel_ulong_t)(SOF_CS42L42_SSP_CODEC(2) | .driver_data = (kernel_ulong_t)(SOF_CS42L42_SSP_CODEC(2) |
SOF_SPEAKER_AMP_PRESENT |
SOF_MAX98357A_SPEAKER_AMP_PRESENT |
SOF_CS42L42_SSP_AMP(1)) | SOF_CS42L42_SSP_AMP(1)) |
SOF_CS42L42_DAILINK(LINK_SPK, LINK_HP, LINK_DMIC, LINK_HDMI, LINK_NONE), SOF_CS42L42_DAILINK(LINK_SPK, LINK_HP, LINK_DMIC, LINK_HDMI, LINK_NONE),
}, },
{ {
.name = "jsl_cs4242_mx98360a", .name = "jsl_cs4242_mx98360a",
.driver_data = (kernel_ulong_t)(SOF_CS42L42_SSP_CODEC(0) | .driver_data = (kernel_ulong_t)(SOF_CS42L42_SSP_CODEC(0) |
SOF_SPEAKER_AMP_PRESENT |
SOF_MAX98360A_SPEAKER_AMP_PRESENT |
SOF_CS42L42_SSP_AMP(1)) | SOF_CS42L42_SSP_AMP(1)) |
SOF_CS42L42_DAILINK(LINK_HP, LINK_DMIC, LINK_HDMI, LINK_SPK, LINK_NONE), SOF_CS42L42_DAILINK(LINK_HP, LINK_DMIC, LINK_HDMI, LINK_SPK, LINK_NONE),
}, },
{ {
.name = "adl_mx98360a_cs4242", .name = "adl_mx98360a_cs4242",
.driver_data = (kernel_ulong_t)(SOF_CS42L42_SSP_CODEC(0) | .driver_data = (kernel_ulong_t)(SOF_CS42L42_SSP_CODEC(0) |
SOF_SPEAKER_AMP_PRESENT |
SOF_MAX98360A_SPEAKER_AMP_PRESENT |
SOF_CS42L42_SSP_AMP(1) | SOF_CS42L42_SSP_AMP(1) |
SOF_CS42L42_NUM_HDMIDEV(4) | SOF_CS42L42_NUM_HDMIDEV(4) |
SOF_BT_OFFLOAD_PRESENT | SOF_BT_OFFLOAD_PRESENT |
...@@ -727,3 +727,4 @@ MODULE_AUTHOR("Brent Lu <brent.lu@intel.com>"); ...@@ -727,3 +727,4 @@ MODULE_AUTHOR("Brent Lu <brent.lu@intel.com>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(SND_SOC_INTEL_HDA_DSP_COMMON); MODULE_IMPORT_NS(SND_SOC_INTEL_HDA_DSP_COMMON);
MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_MAXIM_COMMON); MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_MAXIM_COMMON);
MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_SSP_COMMON);
...@@ -11,10 +11,14 @@ ...@@ -11,10 +11,14 @@
#define __SOF_MAXIM_COMMON_H #define __SOF_MAXIM_COMMON_H
#include <sound/soc.h> #include <sound/soc.h>
#include "sof_ssp_common.h"
/*
* Maxim MAX98373
*/
#define MAX_98373_CODEC_DAI "max98373-aif1" #define MAX_98373_CODEC_DAI "max98373-aif1"
#define MAX_98373_DEV0_NAME "i2c-MX98373:00" #define MAX_98373_DEV0_NAME "i2c-" MAX_98373_ACPI_HID ":00"
#define MAX_98373_DEV1_NAME "i2c-MX98373:01" #define MAX_98373_DEV1_NAME "i2c-" MAX_98373_ACPI_HID ":01"
extern struct snd_soc_dai_link_component max_98373_components[2]; extern struct snd_soc_dai_link_component max_98373_components[2];
extern struct snd_soc_ops max_98373_ops; extern struct snd_soc_ops max_98373_ops;
...@@ -27,7 +31,6 @@ int max_98373_trigger(struct snd_pcm_substream *substream, int cmd); ...@@ -27,7 +31,6 @@ int max_98373_trigger(struct snd_pcm_substream *substream, int cmd);
/* /*
* Maxim MAX98390 * Maxim MAX98390
*/ */
#define MAX_98390_ACPI_HID "MX98390"
#define MAX_98390_CODEC_DAI "max98390-aif1" #define MAX_98390_CODEC_DAI "max98390-aif1"
#define MAX_98390_DEV0_NAME "i2c-" MAX_98390_ACPI_HID ":00" #define MAX_98390_DEV0_NAME "i2c-" MAX_98390_ACPI_HID ":00"
#define MAX_98390_DEV1_NAME "i2c-" MAX_98390_ACPI_HID ":01" #define MAX_98390_DEV1_NAME "i2c-" MAX_98390_ACPI_HID ":01"
...@@ -41,8 +44,8 @@ void max_98390_set_codec_conf(struct device *dev, struct snd_soc_card *card); ...@@ -41,8 +44,8 @@ void max_98390_set_codec_conf(struct device *dev, struct snd_soc_card *card);
* Maxim MAX98357A/MAX98360A * Maxim MAX98357A/MAX98360A
*/ */
#define MAX_98357A_CODEC_DAI "HiFi" #define MAX_98357A_CODEC_DAI "HiFi"
#define MAX_98357A_DEV0_NAME "MX98357A:00" #define MAX_98357A_DEV0_NAME MAX_98357A_ACPI_HID ":00"
#define MAX_98360A_DEV0_NAME "MX98360A:00" #define MAX_98360A_DEV0_NAME MAX_98360A_ACPI_HID ":00"
void max_98357a_dai_link(struct snd_soc_dai_link *link); void max_98357a_dai_link(struct snd_soc_dai_link *link);
void max_98360a_dai_link(struct snd_soc_dai_link *link); void max_98360a_dai_link(struct snd_soc_dai_link *link);
......
This diff is collapsed.
// SPDX-License-Identifier: GPL-2.0-only
/*
* This file defines data structures and functions used in Machine
* Driver for Intel platforms with Nuvoton Codecs.
*
* Copyright 2023 Intel Corporation.
*/
#include <linux/module.h>
#include <sound/sof.h>
#include "sof_nuvoton_common.h"
/*
* Nuvoton NAU8318
*/
static const struct snd_kcontrol_new nau8318_kcontrols[] = {
SOC_DAPM_PIN_SWITCH("Spk"),
};
static const struct snd_soc_dapm_widget nau8318_widgets[] = {
SND_SOC_DAPM_SPK("Spk", NULL),
};
static const struct snd_soc_dapm_route nau8318_routes[] = {
{ "Spk", NULL, "Speaker" },
};
static struct snd_soc_dai_link_component nau8318_components[] = {
{
.name = NAU8318_DEV0_NAME,
.dai_name = NAU8318_CODEC_DAI,
}
};
static int nau8318_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
int ret;
ret = snd_soc_dapm_new_controls(&card->dapm, nau8318_widgets,
ARRAY_SIZE(nau8318_widgets));
if (ret) {
dev_err(rtd->dev, "fail to add nau8318 widgets, ret %d\n", ret);
return ret;
}
ret = snd_soc_add_card_controls(card, nau8318_kcontrols,
ARRAY_SIZE(nau8318_kcontrols));
if (ret) {
dev_err(rtd->dev, "fail to add nau8318 kcontrols, ret %d\n", ret);
return ret;
}
ret = snd_soc_dapm_add_routes(&card->dapm, nau8318_routes,
ARRAY_SIZE(nau8318_routes));
if (ret) {
dev_err(rtd->dev, "fail to add nau8318 routes, ret %d\n", ret);
return ret;
}
return ret;
}
void nau8318_set_dai_link(struct snd_soc_dai_link *link)
{
link->codecs = nau8318_components;
link->num_codecs = ARRAY_SIZE(nau8318_components);
link->init = nau8318_init;
}
EXPORT_SYMBOL_NS(nau8318_set_dai_link, SND_SOC_INTEL_SOF_NUVOTON_COMMON);
MODULE_DESCRIPTION("ASoC Intel SOF Nuvoton helpers");
MODULE_LICENSE("GPL");
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* This file defines data structures used in Machine Driver for Intel
* platforms with Nuvoton Codecs.
*
* Copyright 2023 Intel Corporation.
*/
#ifndef __SOF_NUVOTON_COMMON_H
#define __SOF_NUVOTON_COMMON_H
#include <sound/soc.h>
#include "sof_ssp_common.h"
/*
* Nuvoton NAU8318
*/
#define NAU8318_CODEC_DAI "nau8315-hifi"
#define NAU8318_DEV0_NAME "i2c-" NAU8318_ACPI_HID ":00"
void nau8318_set_dai_link(struct snd_soc_dai_link *link);
#endif /* __SOF_NUVOTON_COMMON_H */
...@@ -11,36 +11,53 @@ ...@@ -11,36 +11,53 @@
#define __SOF_REALTEK_COMMON_H #define __SOF_REALTEK_COMMON_H
#include <sound/soc.h> #include <sound/soc.h>
#include "sof_ssp_common.h"
/*
* Realtek ALC1011
*/
#define RT1011_CODEC_DAI "rt1011-aif" #define RT1011_CODEC_DAI "rt1011-aif"
#define RT1011_DEV0_NAME "i2c-10EC1011:00" #define RT1011_DEV0_NAME "i2c-" RT1011_ACPI_HID ":00"
#define RT1011_DEV1_NAME "i2c-10EC1011:01" #define RT1011_DEV1_NAME "i2c-" RT1011_ACPI_HID ":01"
#define RT1011_DEV2_NAME "i2c-10EC1011:02" #define RT1011_DEV2_NAME "i2c-" RT1011_ACPI_HID ":02"
#define RT1011_DEV3_NAME "i2c-10EC1011:03" #define RT1011_DEV3_NAME "i2c-" RT1011_ACPI_HID ":03"
void sof_rt1011_dai_link(struct snd_soc_dai_link *link); void sof_rt1011_dai_link(struct snd_soc_dai_link *link);
void sof_rt1011_codec_conf(struct snd_soc_card *card); void sof_rt1011_codec_conf(struct snd_soc_card *card);
/*
* Realtek ALC1015 (AUTO)
*/
#define RT1015P_CODEC_DAI "HiFi" #define RT1015P_CODEC_DAI "HiFi"
#define RT1015P_DEV0_NAME "RTL1015:00" #define RT1015P_DEV0_NAME RT1015P_ACPI_HID ":00"
#define RT1015P_DEV1_NAME "RTL1015:01" #define RT1015P_DEV1_NAME RT1015P_ACPI_HID ":01"
void sof_rt1015p_dai_link(struct snd_soc_dai_link *link); void sof_rt1015p_dai_link(struct snd_soc_dai_link *link);
void sof_rt1015p_codec_conf(struct snd_soc_card *card); void sof_rt1015p_codec_conf(struct snd_soc_card *card);
/*
* Realtek ALC1015 (I2C)
*/
#define RT1015_CODEC_DAI "rt1015-aif" #define RT1015_CODEC_DAI "rt1015-aif"
#define RT1015_DEV0_NAME "i2c-10EC1015:00" #define RT1015_DEV0_NAME "i2c-" RT1015_ACPI_HID ":00"
#define RT1015_DEV1_NAME "i2c-10EC1015:01" #define RT1015_DEV1_NAME "i2c-" RT1015_ACPI_HID ":01"
void sof_rt1015_dai_link(struct snd_soc_dai_link *link); void sof_rt1015_dai_link(struct snd_soc_dai_link *link);
void sof_rt1015_codec_conf(struct snd_soc_card *card); void sof_rt1015_codec_conf(struct snd_soc_card *card);
/*
* Realtek ALC1308
*/
#define RT1308_CODEC_DAI "rt1308-aif" #define RT1308_CODEC_DAI "rt1308-aif"
#define RT1308_DEV0_NAME "i2c-10EC1308:00" #define RT1308_DEV0_NAME "i2c-" RT1308_ACPI_HID ":00"
void sof_rt1308_dai_link(struct snd_soc_dai_link *link); void sof_rt1308_dai_link(struct snd_soc_dai_link *link);
/*
* Realtek ALC1019
*/
#define RT1019P_CODEC_DAI "HiFi" #define RT1019P_CODEC_DAI "HiFi"
#define RT1019P_DEV0_NAME "RTL1019:00" #define RT1019P_DEV0_NAME RT1019P_ACPI_HID ":00"
void sof_rt1019p_dai_link(struct snd_soc_dai_link *link); void sof_rt1019p_dai_link(struct snd_soc_dai_link *link);
......
This diff is collapsed.
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "hda_dsp_common.h" #include "hda_dsp_common.h"
#include "sof_realtek_common.h" #include "sof_realtek_common.h"
#include "sof_cirrus_common.h" #include "sof_cirrus_common.h"
#include "sof_ssp_common.h"
#define NAME_SIZE 32 #define NAME_SIZE 32
...@@ -59,10 +60,6 @@ ...@@ -59,10 +60,6 @@
#define SOF_BT_OFFLOAD_SSP(quirk) \ #define SOF_BT_OFFLOAD_SSP(quirk) \
(((quirk) << SOF_BT_OFFLOAD_SSP_SHIFT) & SOF_BT_OFFLOAD_SSP_MASK) (((quirk) << SOF_BT_OFFLOAD_SSP_SHIFT) & SOF_BT_OFFLOAD_SSP_MASK)
/* Speaker amplifiers */
#define SOF_RT1308_SPEAKER_AMP_PRESENT BIT(21)
#define SOF_CS35L41_SPEAKER_AMP_PRESENT BIT(22)
/* Default: SSP2 */ /* Default: SSP2 */
static unsigned long sof_ssp_amp_quirk = SOF_AMPLIFIER_SSP(2); static unsigned long sof_ssp_amp_quirk = SOF_AMPLIFIER_SSP(2);
...@@ -77,6 +74,7 @@ struct sof_card_private { ...@@ -77,6 +74,7 @@ struct sof_card_private {
struct list_head hdmi_pcm_list; struct list_head hdmi_pcm_list;
bool common_hdmi_codec_drv; bool common_hdmi_codec_drv;
bool idisp_codec; bool idisp_codec;
enum sof_ssp_codec amp_type;
}; };
static const struct dmi_system_id chromebook_platforms[] = { static const struct dmi_system_id chromebook_platforms[] = {
...@@ -188,16 +186,22 @@ static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd) ...@@ -188,16 +186,22 @@ static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd)
#define IDISP_CODEC_MASK 0x4 #define IDISP_CODEC_MASK 0x4
static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, /* BE ID defined in sof-tgl-rt1308-hdmi-ssp.m4 */
int ssp_codec, #define HDMI_IN_BE_ID 0
int dmic_be_num, #define SPK_BE_ID 2
int hdmi_num, #define DMIC01_BE_ID 3
bool idisp_codec) #define INTEL_HDMI_BE_ID 5
static struct snd_soc_dai_link *
sof_card_dai_links_create(struct device *dev, enum sof_ssp_codec amp_type,
int ssp_codec, int dmic_be_num, int hdmi_num,
bool idisp_codec)
{ {
struct snd_soc_dai_link_component *idisp_components; struct snd_soc_dai_link_component *idisp_components;
struct snd_soc_dai_link_component *cpus; struct snd_soc_dai_link_component *cpus;
struct snd_soc_dai_link *links; struct snd_soc_dai_link *links;
int i, id = 0; int i, id = 0;
bool fixed_be = false;
links = devm_kcalloc(dev, sof_ssp_amp_card.num_links, links = devm_kcalloc(dev, sof_ssp_amp_card.num_links,
sizeof(struct snd_soc_dai_link), GFP_KERNEL); sizeof(struct snd_soc_dai_link), GFP_KERNEL);
...@@ -211,6 +215,9 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, ...@@ -211,6 +215,9 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
int num_of_hdmi_ssp = (sof_ssp_amp_quirk & SOF_NO_OF_HDMI_CAPTURE_SSP_MASK) >> int num_of_hdmi_ssp = (sof_ssp_amp_quirk & SOF_NO_OF_HDMI_CAPTURE_SSP_MASK) >>
SOF_NO_OF_HDMI_CAPTURE_SSP_SHIFT; SOF_NO_OF_HDMI_CAPTURE_SSP_SHIFT;
/* the topology supports HDMI-IN uses fixed BE ID for DAI links */
fixed_be = true;
for (i = 1; i <= num_of_hdmi_ssp; i++) { for (i = 1; i <= num_of_hdmi_ssp; i++) {
int port = (i == 1 ? (sof_ssp_amp_quirk & SOF_HDMI_CAPTURE_1_SSP_MASK) >> int port = (i == 1 ? (sof_ssp_amp_quirk & SOF_HDMI_CAPTURE_1_SSP_MASK) >>
SOF_HDMI_CAPTURE_1_SSP_SHIFT : SOF_HDMI_CAPTURE_1_SSP_SHIFT :
...@@ -225,7 +232,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, ...@@ -225,7 +232,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-HDMI", port); links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-HDMI", port);
if (!links[id].name) if (!links[id].name)
return NULL; return NULL;
links[id].id = id; links[id].id = fixed_be ? (HDMI_IN_BE_ID + i - 1) : id;
links[id].codecs = &asoc_dummy_dlc; links[id].codecs = &asoc_dummy_dlc;
links[id].num_codecs = 1; links[id].num_codecs = 1;
links[id].platforms = platform_component; links[id].platforms = platform_component;
...@@ -238,29 +245,39 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, ...@@ -238,29 +245,39 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
} }
/* codec SSP */ /* codec SSP */
links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_codec); if (amp_type != CODEC_NONE) {
if (!links[id].name) links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_codec);
return NULL; if (!links[id].name)
return NULL;
links[id].id = fixed_be ? SPK_BE_ID : id;
switch (amp_type) {
case CODEC_CS35L41:
cs35l41_set_dai_link(&links[id]);
break;
case CODEC_RT1308:
sof_rt1308_dai_link(&links[id]);
break;
default:
dev_err(dev, "invalid amp type %d\n", amp_type);
return NULL;
}
links[id].id = id; links[id].platforms = platform_component;
if (sof_ssp_amp_quirk & SOF_RT1308_SPEAKER_AMP_PRESENT) { links[id].num_platforms = ARRAY_SIZE(platform_component);
sof_rt1308_dai_link(&links[id]); links[id].dpcm_playback = 1;
} else if (sof_ssp_amp_quirk & SOF_CS35L41_SPEAKER_AMP_PRESENT) { /* feedback from amplifier or firmware-generated echo reference */
cs35l41_set_dai_link(&links[id]); links[id].dpcm_capture = 1;
} links[id].no_pcm = 1;
links[id].platforms = platform_component; links[id].cpus = &cpus[id];
links[id].num_platforms = ARRAY_SIZE(platform_component); links[id].num_cpus = 1;
links[id].dpcm_playback = 1; links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_codec);
/* feedback from amplifier or firmware-generated echo reference */ if (!links[id].cpus->dai_name)
links[id].dpcm_capture = 1; return NULL;
links[id].no_pcm = 1;
links[id].cpus = &cpus[id];
links[id].num_cpus = 1;
links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_codec);
if (!links[id].cpus->dai_name)
return NULL;
id++; id++;
}
/* dmic */ /* dmic */
if (dmic_be_num > 0) { if (dmic_be_num > 0) {
...@@ -278,7 +295,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, ...@@ -278,7 +295,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
} }
for (i = 0; i < dmic_be_num; i++) { for (i = 0; i < dmic_be_num; i++) {
links[id].id = id; links[id].id = fixed_be ? (DMIC01_BE_ID + i) : id;
links[id].num_cpus = 1; links[id].num_cpus = 1;
links[id].codecs = dmic_component; links[id].codecs = dmic_component;
links[id].num_codecs = ARRAY_SIZE(dmic_component); links[id].num_codecs = ARRAY_SIZE(dmic_component);
...@@ -307,7 +324,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, ...@@ -307,7 +324,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
if (!links[id].name) if (!links[id].name)
goto devm_err; goto devm_err;
links[id].id = id; links[id].id = fixed_be ? (INTEL_HDMI_BE_ID + i - 1) : id;
links[id].cpus = &cpus[id]; links[id].cpus = &cpus[id];
links[id].num_cpus = 1; links[id].num_cpus = 1;
links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL,
...@@ -385,13 +402,18 @@ static int sof_ssp_amp_probe(struct platform_device *pdev) ...@@ -385,13 +402,18 @@ static int sof_ssp_amp_probe(struct platform_device *pdev)
mach = pdev->dev.platform_data; mach = pdev->dev.platform_data;
ctx->amp_type = sof_ssp_detect_amp_type(&pdev->dev);
if (dmi_check_system(chromebook_platforms) || mach->mach_params.dmic_num > 0) if (dmi_check_system(chromebook_platforms) || mach->mach_params.dmic_num > 0)
dmic_be_num = 2; dmic_be_num = 2;
ssp_codec = sof_ssp_amp_quirk & SOF_AMPLIFIER_SSP_MASK; ssp_codec = sof_ssp_amp_quirk & SOF_AMPLIFIER_SSP_MASK;
/* set number of dai links */ /* set number of dai links */
sof_ssp_amp_card.num_links = 1 + dmic_be_num; sof_ssp_amp_card.num_links = dmic_be_num;
if (ctx->amp_type != CODEC_NONE)
sof_ssp_amp_card.num_links++;
if (sof_ssp_amp_quirk & SOF_SSP_HDMI_CAPTURE_PRESENT) if (sof_ssp_amp_quirk & SOF_SSP_HDMI_CAPTURE_PRESENT)
sof_ssp_amp_card.num_links += (sof_ssp_amp_quirk & SOF_NO_OF_HDMI_CAPTURE_SSP_MASK) >> sof_ssp_amp_card.num_links += (sof_ssp_amp_quirk & SOF_NO_OF_HDMI_CAPTURE_SSP_MASK) >>
...@@ -413,15 +435,26 @@ static int sof_ssp_amp_probe(struct platform_device *pdev) ...@@ -413,15 +435,26 @@ static int sof_ssp_amp_probe(struct platform_device *pdev)
if (sof_ssp_amp_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) if (sof_ssp_amp_quirk & SOF_SSP_BT_OFFLOAD_PRESENT)
sof_ssp_amp_card.num_links++; sof_ssp_amp_card.num_links++;
dai_links = sof_card_dai_links_create(&pdev->dev, ssp_codec, dmic_be_num, hdmi_num, ctx->idisp_codec); dai_links = sof_card_dai_links_create(&pdev->dev, ctx->amp_type,
ssp_codec, dmic_be_num, hdmi_num,
ctx->idisp_codec);
if (!dai_links) if (!dai_links)
return -ENOMEM; return -ENOMEM;
sof_ssp_amp_card.dai_link = dai_links; sof_ssp_amp_card.dai_link = dai_links;
/* update codec_conf */ /* update codec_conf */
if (sof_ssp_amp_quirk & SOF_CS35L41_SPEAKER_AMP_PRESENT) { switch (ctx->amp_type) {
case CODEC_CS35L41:
cs35l41_set_codec_conf(&sof_ssp_amp_card); cs35l41_set_codec_conf(&sof_ssp_amp_card);
break;
case CODEC_NONE:
case CODEC_RT1308:
/* no codec conf required */
break;
default:
dev_err(&pdev->dev, "invalid amp type %d\n", ctx->amp_type);
return -EINVAL;
} }
INIT_LIST_HEAD(&ctx->hdmi_pcm_list); INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
...@@ -451,8 +484,7 @@ static const struct platform_device_id board_ids[] = { ...@@ -451,8 +484,7 @@ static const struct platform_device_id board_ids[] = {
SOF_NO_OF_HDMI_CAPTURE_SSP(2) | SOF_NO_OF_HDMI_CAPTURE_SSP(2) |
SOF_HDMI_CAPTURE_1_SSP(1) | SOF_HDMI_CAPTURE_1_SSP(1) |
SOF_HDMI_CAPTURE_2_SSP(5) | SOF_HDMI_CAPTURE_2_SSP(5) |
SOF_SSP_HDMI_CAPTURE_PRESENT | SOF_SSP_HDMI_CAPTURE_PRESENT),
SOF_RT1308_SPEAKER_AMP_PRESENT),
}, },
{ {
.name = "adl_cs35l41", .name = "adl_cs35l41",
...@@ -460,8 +492,7 @@ static const struct platform_device_id board_ids[] = { ...@@ -460,8 +492,7 @@ static const struct platform_device_id board_ids[] = {
SOF_NO_OF_HDMI_PLAYBACK(4) | SOF_NO_OF_HDMI_PLAYBACK(4) |
SOF_HDMI_PLAYBACK_PRESENT | SOF_HDMI_PLAYBACK_PRESENT |
SOF_BT_OFFLOAD_SSP(2) | SOF_BT_OFFLOAD_SSP(2) |
SOF_SSP_BT_OFFLOAD_PRESENT | SOF_SSP_BT_OFFLOAD_PRESENT),
SOF_CS35L41_SPEAKER_AMP_PRESENT),
}, },
{ {
.name = "adl_lt6911_hdmi_ssp", .name = "adl_lt6911_hdmi_ssp",
...@@ -502,3 +533,4 @@ MODULE_LICENSE("GPL"); ...@@ -502,3 +533,4 @@ MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(SND_SOC_INTEL_HDA_DSP_COMMON); MODULE_IMPORT_NS(SND_SOC_INTEL_HDA_DSP_COMMON);
MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_REALTEK_COMMON); MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_REALTEK_COMMON);
MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_CIRRUS_COMMON); MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_CIRRUS_COMMON);
MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_SSP_COMMON);
// SPDX-License-Identifier: GPL-2.0-only
//
// Copyright(c) 2023 Intel Corporation. All rights reserved.
#include <linux/device.h>
#include <sound/soc-acpi.h>
#include "sof_ssp_common.h"
/*
* Codec probe function
*/
#define CODEC_MAP_ENTRY(n, h, t) \
{ \
.name = n, \
.acpi_hid = h, \
.codec_type = t, \
}
struct codec_map {
const char *name;
const char *acpi_hid;
enum sof_ssp_codec codec_type;
};
static const struct codec_map codecs[] = {
/* Cirrus Logic */
CODEC_MAP_ENTRY("CS42L42", CS42L42_ACPI_HID, CODEC_CS42L42),
/* Dialog */
CODEC_MAP_ENTRY("DA7219", DA7219_ACPI_HID, CODEC_DA7219),
/* Everest */
CODEC_MAP_ENTRY("ES8316", ES8316_ACPI_HID, CODEC_ES8316),
CODEC_MAP_ENTRY("ES8326", ES8326_ACPI_HID, CODEC_ES8326),
CODEC_MAP_ENTRY("ES8336", ES8336_ACPI_HID, CODEC_ES8336),
/* Nuvoton */
CODEC_MAP_ENTRY("NAU8825", NAU8825_ACPI_HID, CODEC_NAU8825),
/* Realtek */
CODEC_MAP_ENTRY("RT5650", RT5650_ACPI_HID, CODEC_RT5650),
CODEC_MAP_ENTRY("RT5682", RT5682_ACPI_HID, CODEC_RT5682),
CODEC_MAP_ENTRY("RT5682S", RT5682S_ACPI_HID, CODEC_RT5682S),
};
static const struct codec_map amps[] = {
/* Cirrus Logic */
CODEC_MAP_ENTRY("CS35L41", CS35L41_ACPI_HID, CODEC_CS35L41),
/* Maxim */
CODEC_MAP_ENTRY("MAX98357A", MAX_98357A_ACPI_HID, CODEC_MAX98357A),
CODEC_MAP_ENTRY("MAX98360A", MAX_98360A_ACPI_HID, CODEC_MAX98360A),
CODEC_MAP_ENTRY("MAX98373", MAX_98373_ACPI_HID, CODEC_MAX98373),
CODEC_MAP_ENTRY("MAX98390", MAX_98390_ACPI_HID, CODEC_MAX98390),
/* Nuvoton */
CODEC_MAP_ENTRY("NAU8318", NAU8318_ACPI_HID, CODEC_NAU8318),
/* Realtek */
CODEC_MAP_ENTRY("RT1011", RT1011_ACPI_HID, CODEC_RT1011),
CODEC_MAP_ENTRY("RT1015", RT1015_ACPI_HID, CODEC_RT1015),
CODEC_MAP_ENTRY("RT1015P", RT1015P_ACPI_HID, CODEC_RT1015P),
CODEC_MAP_ENTRY("RT1019P", RT1019P_ACPI_HID, CODEC_RT1019P),
CODEC_MAP_ENTRY("RT1308", RT1308_ACPI_HID, CODEC_RT1308),
};
enum sof_ssp_codec sof_ssp_detect_codec_type(struct device *dev)
{
int i;
for (i = 0; i < ARRAY_SIZE(codecs); i++) {
if (!acpi_dev_present(codecs[i].acpi_hid, NULL, -1))
continue;
dev_dbg(dev, "codec %s found\n", codecs[i].name);
return codecs[i].codec_type;
}
return CODEC_NONE;
}
EXPORT_SYMBOL_NS(sof_ssp_detect_codec_type, SND_SOC_INTEL_SOF_SSP_COMMON);
enum sof_ssp_codec sof_ssp_detect_amp_type(struct device *dev)
{
int i;
for (i = 0; i < ARRAY_SIZE(amps); i++) {
if (!acpi_dev_present(amps[i].acpi_hid, NULL, -1))
continue;
dev_dbg(dev, "amp %s found\n", amps[i].name);
return amps[i].codec_type;
}
return CODEC_NONE;
}
EXPORT_SYMBOL_NS(sof_ssp_detect_amp_type, SND_SOC_INTEL_SOF_SSP_COMMON);
MODULE_DESCRIPTION("ASoC Intel SOF Common Machine Driver Helpers");
MODULE_AUTHOR("Brent Lu <brent.lu@intel.com>");
MODULE_LICENSE("GPL");
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright(c) 2023 Intel Corporation.
*/
#ifndef __SOF_SSP_COMMON_H
#define __SOF_SSP_COMMON_H
/* Cirrus Logic */
#define CS35L41_ACPI_HID "CSC3541"
#define CS42L42_ACPI_HID "10134242"
/* Dialog */
#define DA7219_ACPI_HID "DLGS7219"
/* Everest */
#define ES8316_ACPI_HID "ESSX8316"
#define ES8326_ACPI_HID "ESSX8326"
#define ES8336_ACPI_HID "ESSX8336"
#define MAX_98357A_ACPI_HID "MX98357A"
#define MAX_98360A_ACPI_HID "MX98360A"
#define MAX_98373_ACPI_HID "MX98373"
#define MAX_98390_ACPI_HID "MX98390"
/* Nuvoton */
#define NAU8318_ACPI_HID "NVTN2012"
#define NAU8825_ACPI_HID "10508825"
/* Realtek */
#define RT1011_ACPI_HID "10EC1011"
#define RT1015_ACPI_HID "10EC1015"
#define RT1015P_ACPI_HID "RTL1015"
#define RT1019P_ACPI_HID "RTL1019"
#define RT1308_ACPI_HID "10EC1308"
#define RT5650_ACPI_HID "10EC5650"
#define RT5682_ACPI_HID "10EC5682"
#define RT5682S_ACPI_HID "RTL5682"
enum sof_ssp_codec {
CODEC_NONE,
/* headphone codec */
CODEC_CS42L42,
CODEC_DA7219,
CODEC_ES8316,
CODEC_ES8326,
CODEC_ES8336,
CODEC_NAU8825,
CODEC_RT5650,
CODEC_RT5682,
CODEC_RT5682S,
/* speaker amplifier */
CODEC_CS35L41,
CODEC_MAX98357A,
CODEC_MAX98360A,
CODEC_MAX98373,
CODEC_MAX98390,
CODEC_NAU8318,
CODEC_RT1011,
CODEC_RT1015,
CODEC_RT1015P,
CODEC_RT1019P,
CODEC_RT1308,
};
enum sof_ssp_codec sof_ssp_detect_codec_type(struct device *dev);
enum sof_ssp_codec sof_ssp_detect_amp_type(struct device *dev);
#endif /* __SOF_SSP_COMMON_H */
...@@ -492,6 +492,11 @@ static const struct snd_soc_acpi_codecs adl_nau8318_amp = { ...@@ -492,6 +492,11 @@ static const struct snd_soc_acpi_codecs adl_nau8318_amp = {
.codecs = {"NVTN2012"} .codecs = {"NVTN2012"}
}; };
static struct snd_soc_acpi_codecs adl_rt5650_amp = {
.num_codecs = 1,
.codecs = {"10EC5650"}
};
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,
...@@ -602,6 +607,20 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = { ...@@ -602,6 +607,20 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
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,
}, },
{
.id = "10EC5650",
.drv_name = "adl_rt5650",
.machine_quirk = snd_soc_acpi_codec_list,
.quirk_data = &adl_rt5650_amp,
.sof_tplg_filename = "sof-adl-rt5650.tplg",
},
{
.id = "DLGS7219",
.drv_name = "adl_mx98360_da7219",
.machine_quirk = snd_soc_acpi_codec_list,
.quirk_data = &adl_max98360a_amp,
.sof_tplg_filename = "sof-adl-max98360a-da7219.tplg",
},
/* place amp-only boards in the end of table */ /* place amp-only boards in the end of table */
{ {
.id = "CSC3541", .id = "CSC3541",
......
...@@ -14,7 +14,7 @@ static const struct snd_soc_acpi_codecs essx_83x6 = { ...@@ -14,7 +14,7 @@ static const struct snd_soc_acpi_codecs essx_83x6 = {
.codecs = { "ESSX8316", "ESSX8326", "ESSX8336"}, .codecs = { "ESSX8316", "ESSX8326", "ESSX8336"},
}; };
static const struct snd_soc_acpi_codecs jsl_7219_98373_codecs = { static const struct snd_soc_acpi_codecs mx98373_spk = {
.num_codecs = 1, .num_codecs = 1,
.codecs = {"MX98373"} .codecs = {"MX98373"}
}; };
...@@ -52,14 +52,16 @@ static const struct snd_soc_acpi_codecs rt5682_rt5682s_hp = { ...@@ -52,14 +52,16 @@ static const struct snd_soc_acpi_codecs rt5682_rt5682s_hp = {
struct snd_soc_acpi_mach snd_soc_acpi_intel_jsl_machines[] = { struct snd_soc_acpi_mach snd_soc_acpi_intel_jsl_machines[] = {
{ {
.id = "DLGS7219", .id = "DLGS7219",
.drv_name = "sof_da7219_mx98373", .drv_name = "jsl_mx98373_da7219",
.sof_tplg_filename = "sof-jsl-da7219.tplg",
.machine_quirk = snd_soc_acpi_codec_list, .machine_quirk = snd_soc_acpi_codec_list,
.quirk_data = &jsl_7219_98373_codecs, .quirk_data = &mx98373_spk,
.sof_tplg_filename = "sof-jsl-da7219.tplg",
}, },
{ {
.id = "DLGS7219", .id = "DLGS7219",
.drv_name = "sof_da7219_mx98360a", .drv_name = "jsl_mx98360_da7219",
.machine_quirk = snd_soc_acpi_codec_list,
.quirk_data = &mx98360a_spk,
.sof_tplg_filename = "sof-jsl-da7219-mx98360a.tplg", .sof_tplg_filename = "sof-jsl-da7219-mx98360a.tplg",
}, },
{ {
......
...@@ -402,6 +402,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_machines[] = { ...@@ -402,6 +402,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_machines[] = {
.quirk_data = &rpl_rt1019p_amp, .quirk_data = &rpl_rt1019p_amp,
.sof_tplg_filename = "sof-rpl-rt1019-rt5682.tplg", .sof_tplg_filename = "sof-rpl-rt1019-rt5682.tplg",
}, },
{
.comp_ids = &rpl_rt5682_hp,
.drv_name = "rpl_rt5682_c1_h02",
.machine_quirk = snd_soc_acpi_codec_list,
.quirk_data = &rpl_lt6911_hdmi,
.sof_tplg_filename = "sof-rpl-rt5682-ssp1-hdmi-ssp02.tplg",
},
{ {
.comp_ids = &rpl_essx_83x6, .comp_ids = &rpl_essx_83x6,
.drv_name = "rpl_es83x6_c1_h02", .drv_name = "rpl_es83x6_c1_h02",
......
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