Commit c3c5ac4b authored by Mark Brown's avatar Mark Brown

ASoC: Intel: updates for 6.10 - part7

Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

This patchset should be the last batch for this kernel cycle!

Brent Lu continued his cleanups to refactor and use fewer machine
drivers on Chrmebooks.

Bard Liao updated the sof-sdw machine driver to deal with UCM support
of the RT712 configuration. Note that this sof-sdw driver will be
refactored in the next kernel cycle to allow AMD and others to reuse
common SoundWire parts that are not Intel-specific. Initial changes
are described here: https://github.com/thesofproject/linux/pull/4967
parents c8bdf9e7 4c11132a
...@@ -681,7 +681,6 @@ config SND_SOC_INTEL_SOUNDWIRE_SOF_MACH ...@@ -681,7 +681,6 @@ config SND_SOC_INTEL_SOUNDWIRE_SOF_MACH
select SND_SOC_CS35L56_SDW select SND_SOC_CS35L56_SDW
select SND_SOC_DMIC select SND_SOC_DMIC
select SND_SOC_INTEL_HDA_DSP_COMMON select SND_SOC_INTEL_HDA_DSP_COMMON
select SND_SOC_INTEL_SOF_MAXIM_COMMON
imply SND_SOC_SDW_MOCKUP imply SND_SOC_SDW_MOCKUP
help help
Add support for Intel SoundWire-based platforms connected to Add support for Intel SoundWire-based platforms connected to
......
...@@ -275,9 +275,8 @@ sof_card_dai_links_create(struct device *dev, struct snd_soc_card *card, ...@@ -275,9 +275,8 @@ sof_card_dai_links_create(struct device *dev, struct snd_soc_card *card,
max_98360a_dai_link(ctx->amp_link); max_98360a_dai_link(ctx->amp_link);
break; break;
case CODEC_MAX98373: case CODEC_MAX98373:
ctx->amp_link->codecs = max_98373_components; max_98373_dai_link(dev, ctx->amp_link);
ctx->amp_link->num_codecs = ARRAY_SIZE(max_98373_components);
ctx->amp_link->init = max_98373_spk_codec_init;
if (ctx->da7219.is_jsl_board) { if (ctx->da7219.is_jsl_board) {
ctx->amp_link->ops = &max98373_ops; /* use local ops */ ctx->amp_link->ops = &max98373_ops; /* use local ops */
} else { } else {
......
...@@ -39,14 +39,16 @@ static unsigned int get_num_codecs(const char *hid) ...@@ -39,14 +39,16 @@ static unsigned int get_num_codecs(const char *hid)
return dev_num; return dev_num;
} }
/*
* Maxim MAX98373
*/
#define MAX_98373_PIN_NAME 16 #define MAX_98373_PIN_NAME 16
const struct snd_soc_dapm_route max_98373_dapm_routes[] = { static const struct snd_soc_dapm_route max_98373_dapm_routes[] = {
/* speaker */ /* speaker */
{ "Left Spk", NULL, "Left BE_OUT" }, { "Left Spk", NULL, "Left BE_OUT" },
{ "Right Spk", NULL, "Right BE_OUT" }, { "Right Spk", NULL, "Right BE_OUT" },
}; };
EXPORT_SYMBOL_NS(max_98373_dapm_routes, SND_SOC_INTEL_SOF_MAXIM_COMMON);
static struct snd_soc_codec_conf max_98373_codec_conf[] = { static struct snd_soc_codec_conf max_98373_codec_conf[] = {
{ {
...@@ -59,7 +61,7 @@ static struct snd_soc_codec_conf max_98373_codec_conf[] = { ...@@ -59,7 +61,7 @@ static struct snd_soc_codec_conf max_98373_codec_conf[] = {
}, },
}; };
struct snd_soc_dai_link_component max_98373_components[] = { static struct snd_soc_dai_link_component max_98373_components[] = {
{ /* For Right */ { /* For Right */
.name = MAX_98373_DEV0_NAME, .name = MAX_98373_DEV0_NAME,
.dai_name = MAX_98373_CODEC_DAI, .dai_name = MAX_98373_CODEC_DAI,
...@@ -69,7 +71,6 @@ struct snd_soc_dai_link_component max_98373_components[] = { ...@@ -69,7 +71,6 @@ struct snd_soc_dai_link_component max_98373_components[] = {
.dai_name = MAX_98373_CODEC_DAI, .dai_name = MAX_98373_CODEC_DAI,
}, },
}; };
EXPORT_SYMBOL_NS(max_98373_components, SND_SOC_INTEL_SOF_MAXIM_COMMON);
static int max_98373_hw_params(struct snd_pcm_substream *substream, static int max_98373_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
...@@ -96,7 +97,7 @@ static int max_98373_hw_params(struct snd_pcm_substream *substream, ...@@ -96,7 +97,7 @@ static int max_98373_hw_params(struct snd_pcm_substream *substream,
return 0; return 0;
} }
int max_98373_trigger(struct snd_pcm_substream *substream, int cmd) static int max_98373_trigger(struct snd_pcm_substream *substream, int cmd)
{ {
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_soc_dai *codec_dai; struct snd_soc_dai *codec_dai;
...@@ -139,15 +140,13 @@ int max_98373_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -139,15 +140,13 @@ int max_98373_trigger(struct snd_pcm_substream *substream, int cmd)
return ret; return ret;
} }
EXPORT_SYMBOL_NS(max_98373_trigger, SND_SOC_INTEL_SOF_MAXIM_COMMON);
struct snd_soc_ops max_98373_ops = { static const struct snd_soc_ops max_98373_ops = {
.hw_params = max_98373_hw_params, .hw_params = max_98373_hw_params,
.trigger = max_98373_trigger, .trigger = max_98373_trigger,
}; };
EXPORT_SYMBOL_NS(max_98373_ops, SND_SOC_INTEL_SOF_MAXIM_COMMON);
int max_98373_spk_codec_init(struct snd_soc_pcm_runtime *rtd) static int max_98373_spk_codec_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
unsigned int num_codecs = get_num_codecs(MAX_98373_ACPI_HID); unsigned int num_codecs = get_num_codecs(MAX_98373_ACPI_HID);
...@@ -186,7 +185,15 @@ int max_98373_spk_codec_init(struct snd_soc_pcm_runtime *rtd) ...@@ -186,7 +185,15 @@ int max_98373_spk_codec_init(struct snd_soc_pcm_runtime *rtd)
return ret; return ret;
} }
EXPORT_SYMBOL_NS(max_98373_spk_codec_init, SND_SOC_INTEL_SOF_MAXIM_COMMON);
void max_98373_dai_link(struct device *dev, struct snd_soc_dai_link *link)
{
link->codecs = max_98373_components;
link->num_codecs = ARRAY_SIZE(max_98373_components);
link->init = max_98373_spk_codec_init;
link->ops = &max_98373_ops;
}
EXPORT_SYMBOL_NS(max_98373_dai_link, SND_SOC_INTEL_SOF_MAXIM_COMMON);
void max_98373_set_codec_conf(struct snd_soc_card *card) void max_98373_set_codec_conf(struct snd_soc_card *card)
{ {
......
...@@ -20,13 +20,8 @@ ...@@ -20,13 +20,8 @@
#define MAX_98373_DEV0_NAME "i2c-" MAX_98373_ACPI_HID ":00" #define MAX_98373_DEV0_NAME "i2c-" MAX_98373_ACPI_HID ":00"
#define MAX_98373_DEV1_NAME "i2c-" MAX_98373_ACPI_HID ":01" #define MAX_98373_DEV1_NAME "i2c-" MAX_98373_ACPI_HID ":01"
extern struct snd_soc_dai_link_component max_98373_components[2]; void max_98373_dai_link(struct device *dev, struct snd_soc_dai_link *link);
extern struct snd_soc_ops max_98373_ops;
extern const struct snd_soc_dapm_route max_98373_dapm_routes[];
int max_98373_spk_codec_init(struct snd_soc_pcm_runtime *rtd);
void max_98373_set_codec_conf(struct snd_soc_card *card); void max_98373_set_codec_conf(struct snd_soc_card *card);
int max_98373_trigger(struct snd_pcm_substream *substream, int cmd);
/* /*
* Maxim MAX98390 * Maxim MAX98390
......
...@@ -213,10 +213,7 @@ sof_card_dai_links_create(struct device *dev, struct snd_soc_card *card, ...@@ -213,10 +213,7 @@ sof_card_dai_links_create(struct device *dev, struct snd_soc_card *card,
max_98360a_dai_link(ctx->amp_link); max_98360a_dai_link(ctx->amp_link);
break; break;
case CODEC_MAX98373: case CODEC_MAX98373:
ctx->amp_link->codecs = max_98373_components; max_98373_dai_link(dev, ctx->amp_link);
ctx->amp_link->num_codecs = ARRAY_SIZE(max_98373_components);
ctx->amp_link->init = max_98373_spk_codec_init;
ctx->amp_link->ops = &max_98373_ops;
break; break;
case CODEC_NAU8318: case CODEC_NAU8318:
nau8318_set_dai_link(ctx->amp_link); nau8318_set_dai_link(ctx->amp_link);
......
...@@ -314,59 +314,21 @@ EXPORT_SYMBOL_NS(sof_rt1011_codec_conf, SND_SOC_INTEL_SOF_REALTEK_COMMON); ...@@ -314,59 +314,21 @@ EXPORT_SYMBOL_NS(sof_rt1011_codec_conf, SND_SOC_INTEL_SOF_REALTEK_COMMON);
* *
* For stereo output, there are always two amplifiers on the board. * For stereo output, there are always two amplifiers on the board.
* However, the ACPI implements only one device instance (UID=0) if they * However, the ACPI implements only one device instance (UID=0) if they
* are sharing the same enable pin. The code will detect the number of * are sharing the same enable pin. This is the case of rt1015p.
* device instance and use corresponding DAPM structures for
* initialization.
*/ */
static const struct snd_soc_dapm_route rt1015p_1dev_dapm_routes[] = { static const struct snd_soc_dapm_route rt1015p_dapm_routes[] = {
/* speaker */ /* speaker */
{ "Left Spk", NULL, "Speaker" }, { "Left Spk", NULL, "Speaker" },
{ "Right Spk", NULL, "Speaker" }, { "Right Spk", NULL, "Speaker" },
}; };
static const struct snd_soc_dapm_route rt1015p_2dev_dapm_routes[] = {
/* speaker */
{ "Left Spk", NULL, "Left Speaker" },
{ "Right Spk", NULL, "Right Speaker" },
};
static struct snd_soc_codec_conf rt1015p_codec_confs[] = {
{
.dlc = COMP_CODEC_CONF(RT1015P_DEV0_NAME),
.name_prefix = "Left",
},
{
.dlc = COMP_CODEC_CONF(RT1015P_DEV1_NAME),
.name_prefix = "Right",
},
};
static struct snd_soc_dai_link_component rt1015p_dai_link_components[] = { static struct snd_soc_dai_link_component rt1015p_dai_link_components[] = {
{ {
.name = RT1015P_DEV0_NAME, .name = RT1015P_DEV0_NAME,
.dai_name = RT1015P_CODEC_DAI, .dai_name = RT1015P_CODEC_DAI,
}, },
{
.name = RT1015P_DEV1_NAME,
.dai_name = RT1015P_CODEC_DAI,
},
}; };
static int rt1015p_get_num_codecs(void)
{
static int dev_num;
if (dev_num)
return dev_num;
if (!acpi_dev_present("RTL1015", "1", -1))
dev_num = 1;
else
dev_num = 2;
return dev_num;
}
static int rt1015p_hw_params(struct snd_pcm_substream *substream, static int rt1015p_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
...@@ -398,12 +360,8 @@ static int rt1015p_init(struct snd_soc_pcm_runtime *rtd) ...@@ -398,12 +360,8 @@ static int rt1015p_init(struct snd_soc_pcm_runtime *rtd)
return ret; return ret;
} }
if (rt1015p_get_num_codecs() == 1) ret = snd_soc_dapm_add_routes(&card->dapm, rt1015p_dapm_routes,
ret = snd_soc_dapm_add_routes(&card->dapm, rt1015p_1dev_dapm_routes, ARRAY_SIZE(rt1015p_dapm_routes));
ARRAY_SIZE(rt1015p_1dev_dapm_routes));
else
ret = snd_soc_dapm_add_routes(&card->dapm, rt1015p_2dev_dapm_routes,
ARRAY_SIZE(rt1015p_2dev_dapm_routes));
if (ret) if (ret)
dev_err(rtd->dev, "Speaker map addition failed: %d\n", ret); dev_err(rtd->dev, "Speaker map addition failed: %d\n", ret);
return ret; return ret;
...@@ -412,7 +370,7 @@ static int rt1015p_init(struct snd_soc_pcm_runtime *rtd) ...@@ -412,7 +370,7 @@ static int rt1015p_init(struct snd_soc_pcm_runtime *rtd)
void sof_rt1015p_dai_link(struct snd_soc_dai_link *link) void sof_rt1015p_dai_link(struct snd_soc_dai_link *link)
{ {
link->codecs = rt1015p_dai_link_components; link->codecs = rt1015p_dai_link_components;
link->num_codecs = rt1015p_get_num_codecs(); link->num_codecs = ARRAY_SIZE(rt1015p_dai_link_components);
link->init = rt1015p_init; link->init = rt1015p_init;
link->ops = &rt1015p_ops; link->ops = &rt1015p_ops;
} }
...@@ -420,11 +378,6 @@ EXPORT_SYMBOL_NS(sof_rt1015p_dai_link, SND_SOC_INTEL_SOF_REALTEK_COMMON); ...@@ -420,11 +378,6 @@ EXPORT_SYMBOL_NS(sof_rt1015p_dai_link, SND_SOC_INTEL_SOF_REALTEK_COMMON);
void sof_rt1015p_codec_conf(struct snd_soc_card *card) void sof_rt1015p_codec_conf(struct snd_soc_card *card)
{ {
if (rt1015p_get_num_codecs() == 1)
return;
card->codec_conf = rt1015p_codec_confs;
card->num_configs = ARRAY_SIZE(rt1015p_codec_confs);
} }
EXPORT_SYMBOL_NS(sof_rt1015p_codec_conf, SND_SOC_INTEL_SOF_REALTEK_COMMON); EXPORT_SYMBOL_NS(sof_rt1015p_codec_conf, SND_SOC_INTEL_SOF_REALTEK_COMMON);
......
...@@ -31,7 +31,6 @@ void sof_rt1011_codec_conf(struct device *dev, struct snd_soc_card *card); ...@@ -31,7 +31,6 @@ void sof_rt1011_codec_conf(struct device *dev, struct snd_soc_card *card);
*/ */
#define RT1015P_CODEC_DAI "HiFi" #define RT1015P_CODEC_DAI "HiFi"
#define RT1015P_DEV0_NAME RT1015P_ACPI_HID ":00" #define RT1015P_DEV0_NAME RT1015P_ACPI_HID ":00"
#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);
......
...@@ -67,15 +67,6 @@ static const struct dmi_system_id sof_rt5682_quirk_table[] = { ...@@ -67,15 +67,6 @@ static const struct dmi_system_id sof_rt5682_quirk_table[] = {
.driver_data = (void *)(SOF_RT5682_MCLK_EN | .driver_data = (void *)(SOF_RT5682_MCLK_EN |
SOF_SSP_PORT_CODEC(1)), SOF_SSP_PORT_CODEC(1)),
}, },
{
.callback = sof_rt5682_quirk_cb,
.matches = {
DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Hatch"),
},
.driver_data = (void *)(SOF_RT5682_MCLK_EN |
SOF_SSP_PORT_CODEC(0) |
SOF_SSP_PORT_AMP(1)),
},
{ {
.callback = sof_rt5682_quirk_cb, .callback = sof_rt5682_quirk_cb,
.matches = { .matches = {
...@@ -600,10 +591,7 @@ sof_card_dai_links_create(struct device *dev, struct snd_soc_card *card, ...@@ -600,10 +591,7 @@ sof_card_dai_links_create(struct device *dev, struct snd_soc_card *card,
max_98360a_dai_link(ctx->amp_link); max_98360a_dai_link(ctx->amp_link);
break; break;
case CODEC_MAX98373: case CODEC_MAX98373:
ctx->amp_link->codecs = max_98373_components; max_98373_dai_link(dev, ctx->amp_link);
ctx->amp_link->num_codecs = ARRAY_SIZE(max_98373_components);
ctx->amp_link->init = max_98373_spk_codec_init;
ctx->amp_link->ops = &max_98373_ops;
break; break;
case CODEC_MAX98390: case CODEC_MAX98390:
max_98390_dai_link(dev, ctx->amp_link); max_98390_dai_link(dev, ctx->amp_link);
...@@ -875,27 +863,13 @@ static const struct platform_device_id board_ids[] = { ...@@ -875,27 +863,13 @@ static const struct platform_device_id board_ids[] = {
SOF_SSP_MASK_HDMI_CAPTURE(0x5)), SOF_SSP_MASK_HDMI_CAPTURE(0x5)),
}, },
{ {
.name = "mtl_mx98357_rt5682", .name = "mtl_rt5682_def",
.driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN | .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
SOF_SSP_PORT_CODEC(0) | SOF_SSP_PORT_CODEC(0) |
SOF_SSP_PORT_AMP(1) | SOF_SSP_PORT_AMP(1) |
SOF_SSP_PORT_BT_OFFLOAD(2) | SOF_SSP_PORT_BT_OFFLOAD(2) |
SOF_BT_OFFLOAD_PRESENT), SOF_BT_OFFLOAD_PRESENT),
}, },
{
.name = "mtl_mx98360_rt5682",
.driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
SOF_SSP_PORT_CODEC(0) |
SOF_SSP_PORT_AMP(1)),
},
{
.name = "mtl_rt5682_def",
.driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
SOF_SSP_PORT_CODEC(2) |
SOF_SSP_PORT_AMP(0) |
SOF_SSP_PORT_BT_OFFLOAD(1) |
SOF_BT_OFFLOAD_PRESENT),
},
{ } { }
}; };
MODULE_DEVICE_TABLE(platform, board_ids); MODULE_DEVICE_TABLE(platform, board_ids);
......
This diff is collapsed.
...@@ -86,12 +86,16 @@ struct sof_sdw_dai_info { ...@@ -86,12 +86,16 @@ struct sof_sdw_dai_info {
const char *dai_name; const char *dai_name;
const int dai_type; const int dai_type;
const int dailink[2]; /* dailink id for each direction */ const int dailink[2]; /* dailink id for each direction */
const struct snd_kcontrol_new *controls;
const int num_controls;
const struct snd_soc_dapm_widget *widgets;
const int num_widgets;
int (*init)(struct snd_soc_card *card, int (*init)(struct snd_soc_card *card,
struct snd_soc_dai_link *dai_links, struct snd_soc_dai_link *dai_links,
struct sof_sdw_codec_info *info, struct sof_sdw_codec_info *info,
bool playback); bool playback);
int (*exit)(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link); int (*exit)(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
int (*rtd_init)(struct snd_soc_pcm_runtime *rtd); int (*rtd_init)(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
bool rtd_init_done; /* Indicate that the rtd_init callback is done */ bool rtd_init_done; /* Indicate that the rtd_init callback is done */
unsigned long quirk; unsigned long quirk;
}; };
...@@ -204,19 +208,19 @@ int sof_sdw_cs_amp_init(struct snd_soc_card *card, ...@@ -204,19 +208,19 @@ int sof_sdw_cs_amp_init(struct snd_soc_card *card,
/* dai_link init callbacks */ /* dai_link init callbacks */
int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd); int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd); int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd); int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
#endif #endif
...@@ -17,11 +17,6 @@ ...@@ -17,11 +17,6 @@
#include <sound/jack.h> #include <sound/jack.h>
#include "sof_sdw_common.h" #include "sof_sdw_common.h"
static const struct snd_soc_dapm_widget cs42l42_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL),
};
static const struct snd_soc_dapm_route cs42l42_map[] = { static const struct snd_soc_dapm_route cs42l42_map[] = {
/* HP jack connectors - unknown if we have jack detection */ /* HP jack connectors - unknown if we have jack detection */
{"Headphone", NULL, "cs42l42 HP"}, {"Headphone", NULL, "cs42l42 HP"},
...@@ -30,11 +25,6 @@ static const struct snd_soc_dapm_route cs42l42_map[] = { ...@@ -30,11 +25,6 @@ static const struct snd_soc_dapm_route cs42l42_map[] = {
{"cs42l42 HS", NULL, "Headset Mic"}, {"cs42l42 HS", NULL, "Headset Mic"},
}; };
static const struct snd_kcontrol_new cs42l42_controls[] = {
SOC_DAPM_PIN_SWITCH("Headphone"),
SOC_DAPM_PIN_SWITCH("Headset Mic"),
};
static struct snd_soc_jack_pin cs42l42_jack_pins[] = { static struct snd_soc_jack_pin cs42l42_jack_pins[] = {
{ {
.pin = "Headphone", .pin = "Headphone",
...@@ -50,7 +40,7 @@ static const char * const jack_codecs[] = { ...@@ -50,7 +40,7 @@ static const char * const jack_codecs[] = {
"cs42l42" "cs42l42"
}; };
int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd) int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct mc_private *ctx = snd_soc_card_get_drvdata(card);
...@@ -70,20 +60,6 @@ int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -70,20 +60,6 @@ int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_add_card_controls(card, cs42l42_controls,
ARRAY_SIZE(cs42l42_controls));
if (ret) {
dev_err(card->dev, "cs42l42 control addition failed: %d\n", ret);
return ret;
}
ret = snd_soc_dapm_new_controls(&card->dapm, cs42l42_widgets,
ARRAY_SIZE(cs42l42_widgets));
if (ret) {
dev_err(card->dev, "cs42l42 widgets addition failed: %d\n", ret);
return ret;
}
ret = snd_soc_dapm_add_routes(&card->dapm, cs42l42_map, ret = snd_soc_dapm_add_routes(&card->dapm, cs42l42_map,
ARRAY_SIZE(cs42l42_map)); ARRAY_SIZE(cs42l42_map));
......
...@@ -18,11 +18,6 @@ ...@@ -18,11 +18,6 @@
#include <sound/soc-dapm.h> #include <sound/soc-dapm.h>
#include "sof_sdw_common.h" #include "sof_sdw_common.h"
static const struct snd_soc_dapm_widget cs42l43_hs_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL),
};
static const struct snd_soc_dapm_route cs42l43_hs_map[] = { static const struct snd_soc_dapm_route cs42l43_hs_map[] = {
{ "Headphone", NULL, "cs42l43 AMP3_OUT" }, { "Headphone", NULL, "cs42l43 AMP3_OUT" },
{ "Headphone", NULL, "cs42l43 AMP4_OUT" }, { "Headphone", NULL, "cs42l43 AMP4_OUT" },
...@@ -30,10 +25,6 @@ static const struct snd_soc_dapm_route cs42l43_hs_map[] = { ...@@ -30,10 +25,6 @@ static const struct snd_soc_dapm_route cs42l43_hs_map[] = {
{ "cs42l43 ADC1_IN1_N", NULL, "Headset Mic" }, { "cs42l43 ADC1_IN1_N", NULL, "Headset Mic" },
}; };
static const struct snd_soc_dapm_widget cs42l43_spk_widgets[] = {
SND_SOC_DAPM_SPK("Speaker", NULL),
};
static const struct snd_soc_dapm_route cs42l43_spk_map[] = { static const struct snd_soc_dapm_route cs42l43_spk_map[] = {
{ "Speaker", NULL, "cs42l43 AMP1_OUT_P", }, { "Speaker", NULL, "cs42l43 AMP1_OUT_P", },
{ "Speaker", NULL, "cs42l43 AMP1_OUT_N", }, { "Speaker", NULL, "cs42l43 AMP1_OUT_N", },
...@@ -41,10 +32,6 @@ static const struct snd_soc_dapm_route cs42l43_spk_map[] = { ...@@ -41,10 +32,6 @@ static const struct snd_soc_dapm_route cs42l43_spk_map[] = {
{ "Speaker", NULL, "cs42l43 AMP2_OUT_N", }, { "Speaker", NULL, "cs42l43 AMP2_OUT_N", },
}; };
static const struct snd_soc_dapm_widget cs42l43_dmic_widgets[] = {
SND_SOC_DAPM_MIC("DMIC", NULL),
};
static const struct snd_soc_dapm_route cs42l43_dmic_map[] = { static const struct snd_soc_dapm_route cs42l43_dmic_map[] = {
{ "cs42l43 PDM1_DIN", NULL, "DMIC" }, { "cs42l43 PDM1_DIN", NULL, "DMIC" },
{ "cs42l43 PDM2_DIN", NULL, "DMIC" }, { "cs42l43 PDM2_DIN", NULL, "DMIC" },
...@@ -61,7 +48,7 @@ static struct snd_soc_jack_pin sof_jack_pins[] = { ...@@ -61,7 +48,7 @@ static struct snd_soc_jack_pin sof_jack_pins[] = {
}, },
}; };
int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd) int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component; struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component;
struct mc_private *ctx = snd_soc_card_get_drvdata(rtd->card); struct mc_private *ctx = snd_soc_card_get_drvdata(rtd->card);
...@@ -74,13 +61,6 @@ int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -74,13 +61,6 @@ int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_dapm_new_controls(&card->dapm, cs42l43_hs_widgets,
ARRAY_SIZE(cs42l43_hs_widgets));
if (ret) {
dev_err(card->dev, "cs42l43 hs widgets addition failed: %d\n", ret);
return ret;
}
ret = snd_soc_dapm_add_routes(&card->dapm, cs42l43_hs_map, ret = snd_soc_dapm_add_routes(&card->dapm, cs42l43_hs_map,
ARRAY_SIZE(cs42l43_hs_map)); ARRAY_SIZE(cs42l43_hs_map));
if (ret) { if (ret) {
...@@ -119,7 +99,7 @@ int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -119,7 +99,7 @@ int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd)
return ret; return ret;
} }
int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
int ret; int ret;
...@@ -133,13 +113,6 @@ int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -133,13 +113,6 @@ int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
return -ENOMEM; return -ENOMEM;
} }
ret = snd_soc_dapm_new_controls(&card->dapm, cs42l43_spk_widgets,
ARRAY_SIZE(cs42l43_spk_widgets));
if (ret) {
dev_err(card->dev, "cs42l43 speaker widgets addition failed: %d\n", ret);
return ret;
}
ret = snd_soc_dapm_add_routes(&card->dapm, cs42l43_spk_map, ret = snd_soc_dapm_add_routes(&card->dapm, cs42l43_spk_map,
ARRAY_SIZE(cs42l43_spk_map)); ARRAY_SIZE(cs42l43_spk_map));
if (ret) if (ret)
...@@ -162,7 +135,7 @@ int sof_sdw_cs42l43_spk_init(struct snd_soc_card *card, ...@@ -162,7 +135,7 @@ int sof_sdw_cs42l43_spk_init(struct snd_soc_card *card,
return bridge_cs35l56_spk_init(card, dai_links, info, playback); return bridge_cs35l56_spk_init(card, dai_links, info, playback);
} }
int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd) int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
int ret; int ret;
...@@ -172,13 +145,6 @@ int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -172,13 +145,6 @@ int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_dapm_new_controls(&card->dapm, cs42l43_dmic_widgets,
ARRAY_SIZE(cs42l43_dmic_widgets));
if (ret) {
dev_err(card->dev, "cs42l43 dmic widgets addition failed: %d\n", ret);
return ret;
}
ret = snd_soc_dapm_add_routes(&card->dapm, cs42l43_dmic_map, ret = snd_soc_dapm_add_routes(&card->dapm, cs42l43_dmic_map,
ARRAY_SIZE(cs42l43_dmic_map)); ARRAY_SIZE(cs42l43_dmic_map));
if (ret) if (ret)
......
...@@ -14,17 +14,13 @@ ...@@ -14,17 +14,13 @@
#define CODEC_NAME_SIZE 8 #define CODEC_NAME_SIZE 8
static const struct snd_soc_dapm_widget sof_widgets[] = { int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
SND_SOC_DAPM_SPK("Speakers", NULL),
};
int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
const char *dai_name = rtd->dai_link->codecs->dai_name; const char *dai_name = rtd->dai_link->codecs->dai_name;
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
char codec_name[CODEC_NAME_SIZE]; char codec_name[CODEC_NAME_SIZE];
char widget_name[16]; char widget_name[16];
struct snd_soc_dapm_route route = { "Speakers", NULL, widget_name }; struct snd_soc_dapm_route route = { "Speaker", NULL, widget_name };
struct snd_soc_dai *codec_dai; struct snd_soc_dai *codec_dai;
int i, ret; int i, ret;
...@@ -35,13 +31,6 @@ int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -35,13 +31,6 @@ int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_dapm_new_controls(&card->dapm, sof_widgets,
ARRAY_SIZE(sof_widgets));
if (ret) {
dev_err(card->dev, "widgets addition failed: %d\n", ret);
return ret;
}
for_each_rtd_codec_dais(rtd, i, codec_dai) { for_each_rtd_codec_dais(rtd, i, codec_dai) {
if (!strstr(codec_dai->name, "cs35l56")) if (!strstr(codec_dai->name, "cs35l56"))
continue; continue;
......
...@@ -11,23 +11,17 @@ ...@@ -11,23 +11,17 @@
#include <sound/soc-acpi.h> #include <sound/soc-acpi.h>
#include <sound/soc-dapm.h> #include <sound/soc-dapm.h>
#include "sof_sdw_common.h" #include "sof_sdw_common.h"
#include "sof_maxim_common.h"
static int maxim_part_id; static int maxim_part_id;
#define SOF_SDW_PART_ID_MAX98363 0x8363 #define SOF_SDW_PART_ID_MAX98363 0x8363
#define SOF_SDW_PART_ID_MAX98373 0x8373 #define SOF_SDW_PART_ID_MAX98373 0x8373
static const struct snd_soc_dapm_widget maxim_widgets[] = { static const struct snd_soc_dapm_route max_98373_dapm_routes[] = {
SND_SOC_DAPM_SPK("Left Spk", NULL), { "Left Spk", NULL, "Left BE_OUT" },
SND_SOC_DAPM_SPK("Right Spk", NULL), { "Right Spk", NULL, "Right BE_OUT" },
}; };
static const struct snd_kcontrol_new maxim_controls[] = { int maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
SOC_DAPM_PIN_SWITCH("Left Spk"),
SOC_DAPM_PIN_SWITCH("Right Spk"),
};
int maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
int ret; int ret;
...@@ -41,20 +35,6 @@ int maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -41,20 +35,6 @@ int maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
dev_dbg(card->dev, "soundwire maxim card components assigned : %s\n", dev_dbg(card->dev, "soundwire maxim card components assigned : %s\n",
card->components); card->components);
ret = snd_soc_add_card_controls(card, maxim_controls,
ARRAY_SIZE(maxim_controls));
if (ret) {
dev_err(card->dev, "mx%04x ctrls addition failed: %d\n", maxim_part_id, ret);
return ret;
}
ret = snd_soc_dapm_new_controls(&card->dapm, maxim_widgets,
ARRAY_SIZE(maxim_widgets));
if (ret) {
dev_err(card->dev, "mx%04x widgets addition failed: %d\n", maxim_part_id, ret);
return ret;
}
ret = snd_soc_dapm_add_routes(&card->dapm, max_98373_dapm_routes, 2); ret = snd_soc_dapm_add_routes(&card->dapm, max_98373_dapm_routes, 2);
if (ret) if (ret)
dev_err(rtd->dev, "failed to add first SPK map: %d\n", ret); dev_err(rtd->dev, "failed to add first SPK map: %d\n", ret);
......
...@@ -17,11 +17,6 @@ ...@@ -17,11 +17,6 @@
#include <sound/jack.h> #include <sound/jack.h>
#include "sof_sdw_common.h" #include "sof_sdw_common.h"
static const struct snd_soc_dapm_widget rt5682_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL),
};
static const struct snd_soc_dapm_route rt5682_map[] = { static const struct snd_soc_dapm_route rt5682_map[] = {
/*Headphones*/ /*Headphones*/
{ "Headphone", NULL, "rt5682 HPOL" }, { "Headphone", NULL, "rt5682 HPOL" },
...@@ -29,11 +24,6 @@ static const struct snd_soc_dapm_route rt5682_map[] = { ...@@ -29,11 +24,6 @@ static const struct snd_soc_dapm_route rt5682_map[] = {
{ "rt5682 IN1P", NULL, "Headset Mic" }, { "rt5682 IN1P", NULL, "Headset Mic" },
}; };
static const struct snd_kcontrol_new rt5682_controls[] = {
SOC_DAPM_PIN_SWITCH("Headphone"),
SOC_DAPM_PIN_SWITCH("Headset Mic"),
};
static struct snd_soc_jack_pin rt5682_jack_pins[] = { static struct snd_soc_jack_pin rt5682_jack_pins[] = {
{ {
.pin = "Headphone", .pin = "Headphone",
...@@ -49,7 +39,7 @@ static const char * const jack_codecs[] = { ...@@ -49,7 +39,7 @@ static const char * const jack_codecs[] = {
"rt5682" "rt5682"
}; };
int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct mc_private *ctx = snd_soc_card_get_drvdata(card);
...@@ -69,20 +59,6 @@ int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -69,20 +59,6 @@ int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_add_card_controls(card, rt5682_controls,
ARRAY_SIZE(rt5682_controls));
if (ret) {
dev_err(card->dev, "rt5682 control addition failed: %d\n", ret);
return ret;
}
ret = snd_soc_dapm_new_controls(&card->dapm, rt5682_widgets,
ARRAY_SIZE(rt5682_widgets));
if (ret) {
dev_err(card->dev, "rt5682 widgets addition failed: %d\n", ret);
return ret;
}
ret = snd_soc_dapm_add_routes(&card->dapm, rt5682_map, ret = snd_soc_dapm_add_routes(&card->dapm, rt5682_map,
ARRAY_SIZE(rt5682_map)); ARRAY_SIZE(rt5682_map));
......
...@@ -15,12 +15,6 @@ ...@@ -15,12 +15,6 @@
#include <sound/jack.h> #include <sound/jack.h>
#include "sof_sdw_common.h" #include "sof_sdw_common.h"
static const struct snd_soc_dapm_widget rt700_widgets[] = {
SND_SOC_DAPM_HP("Headphones", NULL),
SND_SOC_DAPM_MIC("AMIC", NULL),
SND_SOC_DAPM_SPK("Speaker", NULL),
};
static const struct snd_soc_dapm_route rt700_map[] = { static const struct snd_soc_dapm_route rt700_map[] = {
/* Headphones */ /* Headphones */
{ "Headphones", NULL, "rt700 HP" }, { "Headphones", NULL, "rt700 HP" },
...@@ -28,12 +22,6 @@ static const struct snd_soc_dapm_route rt700_map[] = { ...@@ -28,12 +22,6 @@ static const struct snd_soc_dapm_route rt700_map[] = {
{ "rt700 MIC2", NULL, "AMIC" }, { "rt700 MIC2", NULL, "AMIC" },
}; };
static const struct snd_kcontrol_new rt700_controls[] = {
SOC_DAPM_PIN_SWITCH("Headphones"),
SOC_DAPM_PIN_SWITCH("AMIC"),
SOC_DAPM_PIN_SWITCH("Speaker"),
};
static struct snd_soc_jack_pin rt700_jack_pins[] = { static struct snd_soc_jack_pin rt700_jack_pins[] = {
{ {
.pin = "Headphones", .pin = "Headphones",
...@@ -49,7 +37,7 @@ static const char * const jack_codecs[] = { ...@@ -49,7 +37,7 @@ static const char * const jack_codecs[] = {
"rt700" "rt700"
}; };
int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct mc_private *ctx = snd_soc_card_get_drvdata(card);
...@@ -69,20 +57,6 @@ int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -69,20 +57,6 @@ int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_add_card_controls(card, rt700_controls,
ARRAY_SIZE(rt700_controls));
if (ret) {
dev_err(card->dev, "rt700 controls addition failed: %d\n", ret);
return ret;
}
ret = snd_soc_dapm_new_controls(&card->dapm, rt700_widgets,
ARRAY_SIZE(rt700_widgets));
if (ret) {
dev_err(card->dev, "rt700 widgets addition failed: %d\n", ret);
return ret;
}
ret = snd_soc_dapm_add_routes(&card->dapm, rt700_map, ret = snd_soc_dapm_add_routes(&card->dapm, rt700_map,
ARRAY_SIZE(rt700_map)); ARRAY_SIZE(rt700_map));
......
...@@ -42,22 +42,12 @@ static int rt711_add_codec_device_props(struct device *sdw_dev) ...@@ -42,22 +42,12 @@ static int rt711_add_codec_device_props(struct device *sdw_dev)
return ret; return ret;
} }
static const struct snd_soc_dapm_widget rt711_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL),
};
static const struct snd_soc_dapm_route rt711_map[] = { static const struct snd_soc_dapm_route rt711_map[] = {
/* Headphones */ /* Headphones */
{ "Headphone", NULL, "rt711 HP" }, { "Headphone", NULL, "rt711 HP" },
{ "rt711 MIC2", NULL, "Headset Mic" }, { "rt711 MIC2", NULL, "Headset Mic" },
}; };
static const struct snd_kcontrol_new rt711_controls[] = {
SOC_DAPM_PIN_SWITCH("Headphone"),
SOC_DAPM_PIN_SWITCH("Headset Mic"),
};
static struct snd_soc_jack_pin rt711_jack_pins[] = { static struct snd_soc_jack_pin rt711_jack_pins[] = {
{ {
.pin = "Headphone", .pin = "Headphone",
...@@ -73,7 +63,7 @@ static const char * const jack_codecs[] = { ...@@ -73,7 +63,7 @@ static const char * const jack_codecs[] = {
"rt711" "rt711"
}; };
int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct mc_private *ctx = snd_soc_card_get_drvdata(card);
...@@ -93,20 +83,6 @@ int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -93,20 +83,6 @@ int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_add_card_controls(card, rt711_controls,
ARRAY_SIZE(rt711_controls));
if (ret) {
dev_err(card->dev, "rt711 controls addition failed: %d\n", ret);
return ret;
}
ret = snd_soc_dapm_new_controls(&card->dapm, rt711_widgets,
ARRAY_SIZE(rt711_widgets));
if (ret) {
dev_err(card->dev, "rt711 widgets addition failed: %d\n", ret);
return ret;
}
ret = snd_soc_dapm_add_routes(&card->dapm, rt711_map, ret = snd_soc_dapm_add_routes(&card->dapm, rt711_map,
ARRAY_SIZE(rt711_map)); ARRAY_SIZE(rt711_map));
......
...@@ -15,10 +15,6 @@ ...@@ -15,10 +15,6 @@
#include <sound/soc-dapm.h> #include <sound/soc-dapm.h>
#include "sof_sdw_common.h" #include "sof_sdw_common.h"
static const struct snd_soc_dapm_widget rt712_spk_widgets[] = {
SND_SOC_DAPM_SPK("Speaker", NULL),
};
/* /*
* dapm routes for rt712 spk will be registered dynamically according * dapm routes for rt712 spk will be registered dynamically according
* to the number of rt712 spk used. The first two entries will be registered * to the number of rt712 spk used. The first two entries will be registered
...@@ -30,11 +26,7 @@ static const struct snd_soc_dapm_route rt712_spk_map[] = { ...@@ -30,11 +26,7 @@ static const struct snd_soc_dapm_route rt712_spk_map[] = {
{ "Speaker", NULL, "rt712 SPOR" }, { "Speaker", NULL, "rt712 SPOR" },
}; };
static const struct snd_kcontrol_new rt712_spk_controls[] = { int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
SOC_DAPM_PIN_SWITCH("Speaker"),
};
int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
int ret; int ret;
...@@ -45,20 +37,6 @@ int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -45,20 +37,6 @@ int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_add_card_controls(card, rt712_spk_controls,
ARRAY_SIZE(rt712_spk_controls));
if (ret) {
dev_err(card->dev, "rt712 spk controls addition failed: %d\n", ret);
return ret;
}
ret = snd_soc_dapm_new_controls(&card->dapm, rt712_spk_widgets,
ARRAY_SIZE(rt712_spk_widgets));
if (ret) {
dev_err(card->dev, "rt712 spk widgets addition failed: %d\n", ret);
return ret;
}
ret = snd_soc_dapm_add_routes(&card->dapm, rt712_spk_map, ARRAY_SIZE(rt712_spk_map)); ret = snd_soc_dapm_add_routes(&card->dapm, rt712_spk_map, ARRAY_SIZE(rt712_spk_map));
if (ret) if (ret)
dev_err(rtd->dev, "failed to add SPK map: %d\n", ret); dev_err(rtd->dev, "failed to add SPK map: %d\n", ret);
......
...@@ -15,19 +15,11 @@ ...@@ -15,19 +15,11 @@
#include <sound/soc-dapm.h> #include <sound/soc-dapm.h>
#include "sof_sdw_common.h" #include "sof_sdw_common.h"
static const struct snd_soc_dapm_widget rt722_spk_widgets[] = {
SND_SOC_DAPM_SPK("Speaker", NULL),
};
static const struct snd_soc_dapm_route rt722_spk_map[] = { static const struct snd_soc_dapm_route rt722_spk_map[] = {
{ "Speaker", NULL, "rt722 SPK" }, { "Speaker", NULL, "rt722 SPK" },
}; };
static const struct snd_kcontrol_new rt722_spk_controls[] = { int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
SOC_DAPM_PIN_SWITCH("Speaker"),
};
int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
int ret; int ret;
...@@ -38,20 +30,6 @@ int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -38,20 +30,6 @@ int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_add_card_controls(card, rt722_spk_controls,
ARRAY_SIZE(rt722_spk_controls));
if (ret) {
dev_err(card->dev, "failed to add rt722 spk controls: %d\n", ret);
return ret;
}
ret = snd_soc_dapm_new_controls(&card->dapm, rt722_spk_widgets,
ARRAY_SIZE(rt722_spk_widgets));
if (ret) {
dev_err(card->dev, "failed to add rt722 spk widgets: %d\n", ret);
return ret;
}
ret = snd_soc_dapm_add_routes(&card->dapm, rt722_spk_map, ARRAY_SIZE(rt722_spk_map)); ret = snd_soc_dapm_add_routes(&card->dapm, rt722_spk_map, ARRAY_SIZE(rt722_spk_map));
if (ret) if (ret)
dev_err(rtd->dev, "failed to add rt722 spk map: %d\n", ret); dev_err(rtd->dev, "failed to add rt722 spk map: %d\n", ret);
......
...@@ -131,14 +131,6 @@ static int rt_amp_add_device_props(struct device *sdw_dev) ...@@ -131,14 +131,6 @@ static int rt_amp_add_device_props(struct device *sdw_dev)
return ret; return ret;
} }
static const struct snd_kcontrol_new rt_amp_controls[] = {
SOC_DAPM_PIN_SWITCH("Speaker"),
};
static const struct snd_soc_dapm_widget rt_amp_widgets[] = {
SND_SOC_DAPM_SPK("Speaker", NULL),
};
/* /*
* dapm routes for rt1308/rt1316/rt1318 will be registered dynamically * dapm routes for rt1308/rt1316/rt1318 will be registered dynamically
* according to the number of rt1308/rt1316/rt1318 used. The first two * according to the number of rt1308/rt1316/rt1318 used. The first two
...@@ -166,15 +158,11 @@ static const struct snd_soc_dapm_route rt1318_map[] = { ...@@ -166,15 +158,11 @@ static const struct snd_soc_dapm_route rt1318_map[] = {
{ "Speaker", NULL, "rt1318-2 SPOR" }, { "Speaker", NULL, "rt1318-2 SPOR" },
}; };
static const struct snd_soc_dapm_route *get_codec_name_and_route(struct snd_soc_pcm_runtime *rtd, static const struct snd_soc_dapm_route *get_codec_name_and_route(struct snd_soc_dai *dai,
char *codec_name) char *codec_name)
{ {
const char *dai_name;
dai_name = rtd->dai_link->codecs->dai_name;
/* get the codec name */ /* get the codec name */
snprintf(codec_name, CODEC_NAME_SIZE, "%s", dai_name); snprintf(codec_name, CODEC_NAME_SIZE, "%s", dai->name);
/* choose the right codec's map */ /* choose the right codec's map */
if (strcmp(codec_name, "rt1308") == 0) if (strcmp(codec_name, "rt1308") == 0)
...@@ -185,16 +173,16 @@ static const struct snd_soc_dapm_route *get_codec_name_and_route(struct snd_soc_ ...@@ -185,16 +173,16 @@ static const struct snd_soc_dapm_route *get_codec_name_and_route(struct snd_soc_
return rt1318_map; return rt1318_map;
} }
int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
const struct snd_soc_dapm_route *rt_amp_map; const struct snd_soc_dapm_route *rt_amp_map;
char codec_name[CODEC_NAME_SIZE]; char codec_name[CODEC_NAME_SIZE];
struct snd_soc_dai *dai; struct snd_soc_dai *codec_dai;
int ret; int ret;
int i; int i;
rt_amp_map = get_codec_name_and_route(rtd, codec_name); rt_amp_map = get_codec_name_and_route(dai, codec_name);
card->components = devm_kasprintf(card->dev, GFP_KERNEL, card->components = devm_kasprintf(card->dev, GFP_KERNEL,
"%s spk:%s", "%s spk:%s",
...@@ -202,24 +190,10 @@ int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -202,24 +190,10 @@ int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_add_card_controls(card, rt_amp_controls, for_each_rtd_codec_dais(rtd, i, codec_dai) {
ARRAY_SIZE(rt_amp_controls)); if (strstr(codec_dai->component->name_prefix, "-1"))
if (ret) {
dev_err(card->dev, "%s controls addition failed: %d\n", codec_name, ret);
return ret;
}
ret = snd_soc_dapm_new_controls(&card->dapm, rt_amp_widgets,
ARRAY_SIZE(rt_amp_widgets));
if (ret) {
dev_err(card->dev, "%s widgets addition failed: %d\n", codec_name, ret);
return ret;
}
for_each_rtd_codec_dais(rtd, i, dai) {
if (strstr(dai->component->name_prefix, "-1"))
ret = snd_soc_dapm_add_routes(&card->dapm, rt_amp_map, 2); ret = snd_soc_dapm_add_routes(&card->dapm, rt_amp_map, 2);
else if (strstr(dai->component->name_prefix, "-2")) else if (strstr(codec_dai->component->name_prefix, "-2"))
ret = snd_soc_dapm_add_routes(&card->dapm, rt_amp_map + 2, 2); ret = snd_soc_dapm_add_routes(&card->dapm, rt_amp_map + 2, 2);
} }
......
...@@ -19,7 +19,7 @@ static const char * const dmics[] = { ...@@ -19,7 +19,7 @@ static const char * const dmics[] = {
"rt722-sdca", "rt722-sdca",
}; };
int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
struct snd_soc_component *component; struct snd_soc_component *component;
......
...@@ -43,11 +43,6 @@ static int rt_sdca_jack_add_codec_device_props(struct device *sdw_dev) ...@@ -43,11 +43,6 @@ static int rt_sdca_jack_add_codec_device_props(struct device *sdw_dev)
return ret; return ret;
} }
static const struct snd_soc_dapm_widget rt_sdca_jack_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL),
};
static const struct snd_soc_dapm_route rt711_sdca_map[] = { static const struct snd_soc_dapm_route rt711_sdca_map[] = {
{ "Headphone", NULL, "rt711 HP" }, { "Headphone", NULL, "rt711 HP" },
{ "rt711 MIC2", NULL, "Headset Mic" }, { "rt711 MIC2", NULL, "Headset Mic" },
...@@ -68,11 +63,6 @@ static const struct snd_soc_dapm_route rt722_sdca_map[] = { ...@@ -68,11 +63,6 @@ static const struct snd_soc_dapm_route rt722_sdca_map[] = {
{ "rt722 MIC2", NULL, "Headset Mic" }, { "rt722 MIC2", NULL, "Headset Mic" },
}; };
static const struct snd_kcontrol_new rt_sdca_jack_controls[] = {
SOC_DAPM_PIN_SWITCH("Headphone"),
SOC_DAPM_PIN_SWITCH("Headset Mic"),
};
static struct snd_soc_jack_pin rt_sdca_jack_pins[] = { static struct snd_soc_jack_pin rt_sdca_jack_pins[] = {
{ {
.pin = "Headphone", .pin = "Headphone",
...@@ -88,7 +78,16 @@ static const char * const jack_codecs[] = { ...@@ -88,7 +78,16 @@ static const char * const jack_codecs[] = {
"rt711", "rt712", "rt713", "rt722" "rt711", "rt712", "rt713", "rt722"
}; };
int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd) /*
* The sdca suffix is required for rt711 since there are two generations of the same chip.
* RT713 is an SDCA device but the sdca suffix is required for backwards-compatibility with
* previous UCM definitions.
*/
static const char * const need_sdca_suffix[] = {
"rt711", "rt713"
};
int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct mc_private *ctx = snd_soc_card_get_drvdata(card);
...@@ -96,6 +95,7 @@ int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -96,6 +95,7 @@ int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_jack *jack; struct snd_soc_jack *jack;
int ret; int ret;
int i;
codec_dai = get_codec_dai_by_name(rtd, jack_codecs, ARRAY_SIZE(jack_codecs)); codec_dai = get_codec_dai_by_name(rtd, jack_codecs, ARRAY_SIZE(jack_codecs));
if (!codec_dai) if (!codec_dai)
...@@ -103,23 +103,20 @@ int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -103,23 +103,20 @@ int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd)
component = codec_dai->component; component = codec_dai->component;
card->components = devm_kasprintf(card->dev, GFP_KERNEL, card->components = devm_kasprintf(card->dev, GFP_KERNEL,
"%s hs:%s-sdca", "%s hs:%s",
card->components, component->name_prefix); card->components, component->name_prefix);
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_add_card_controls(card, rt_sdca_jack_controls, for (i = 0; i < ARRAY_SIZE(need_sdca_suffix); i++) {
ARRAY_SIZE(rt_sdca_jack_controls)); if (strstr(codec_dai->name, need_sdca_suffix[i])) {
if (ret) { /* Add -sdca suffix for existing UCMs */
dev_err(card->dev, "rt sdca jack controls addition failed: %d\n", ret); card->components = devm_kasprintf(card->dev, GFP_KERNEL,
return ret; "%s-sdca", card->components);
} if (!card->components)
return -ENOMEM;
ret = snd_soc_dapm_new_controls(&card->dapm, rt_sdca_jack_widgets, break;
ARRAY_SIZE(rt_sdca_jack_widgets)); }
if (ret) {
dev_err(card->dev, "rt sdca jack widgets addition failed: %d\n", ret);
return ret;
} }
if (strstr(component->name_prefix, "rt711")) { if (strstr(component->name_prefix, "rt711")) {
......
...@@ -76,6 +76,42 @@ static const struct snd_soc_acpi_endpoint rt722_endpoints[] = { ...@@ -76,6 +76,42 @@ static const struct snd_soc_acpi_endpoint rt722_endpoints[] = {
}, },
}; };
static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = {
{ /* Jack Playback Endpoint */
.num = 0,
.aggregated = 0,
.group_position = 0,
.group_id = 0,
},
{ /* DMIC Capture Endpoint */
.num = 1,
.aggregated = 0,
.group_position = 0,
.group_id = 0,
},
{ /* Jack Capture Endpoint */
.num = 2,
.aggregated = 0,
.group_position = 0,
.group_id = 0,
},
{ /* Speaker Playback Endpoint */
.num = 3,
.aggregated = 0,
.group_position = 0,
.group_id = 0,
},
};
static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = {
{
.adr = 0x00003001FA424301ull,
.num_endpoints = ARRAY_SIZE(cs42l43_endpoints),
.endpoints = cs42l43_endpoints,
.name_prefix = "cs42l43"
}
};
static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = { static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
{ {
.adr = 0x000030025D071101ull, .adr = 0x000030025D071101ull,
...@@ -166,6 +202,14 @@ static const struct snd_soc_acpi_adr_device rt714_1_adr[] = { ...@@ -166,6 +202,14 @@ static const struct snd_soc_acpi_adr_device rt714_1_adr[] = {
} }
}; };
static const struct snd_soc_acpi_link_adr lnl_cs42l43_l0[] = {
{
.mask = BIT(0),
.num_adr = ARRAY_SIZE(cs42l43_0_adr),
.adr_d = cs42l43_0_adr,
},
};
static const struct snd_soc_acpi_link_adr lnl_rvp[] = { static const struct snd_soc_acpi_link_adr lnl_rvp[] = {
{ {
.mask = BIT(0), .mask = BIT(0),
...@@ -268,6 +312,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[] = { ...@@ -268,6 +312,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[] = {
.drv_name = "sof_sdw", .drv_name = "sof_sdw",
.sof_tplg_filename = "sof-lnl-rt711-l0-rt1316-l23-rt714-l1.tplg", .sof_tplg_filename = "sof-lnl-rt711-l0-rt1316-l23-rt714-l1.tplg",
}, },
{
.link_mask = BIT(0),
.links = lnl_cs42l43_l0,
.drv_name = "sof_sdw",
.sof_tplg_filename = "sof-lnl-cs42l43-l0.tplg",
},
{ {
.link_mask = BIT(0), .link_mask = BIT(0),
.links = lnl_rvp, .links = lnl_rvp,
......
...@@ -11,16 +11,6 @@ ...@@ -11,16 +11,6 @@
#include <sound/soc-acpi-intel-ssp-common.h> #include <sound/soc-acpi-intel-ssp-common.h>
#include "soc-acpi-intel-sdw-mockup-match.h" #include "soc-acpi-intel-sdw-mockup-match.h"
static const struct snd_soc_acpi_codecs mtl_max98357a_amp = {
.num_codecs = 1,
.codecs = {"MX98357A"}
};
static const struct snd_soc_acpi_codecs mtl_max98360a_amp = {
.num_codecs = 1,
.codecs = {"MX98360A"}
};
static const struct snd_soc_acpi_codecs mtl_rt5682_rt5682s_hp = { static const struct snd_soc_acpi_codecs mtl_rt5682_rt5682s_hp = {
.num_codecs = 2, .num_codecs = 2,
.codecs = {RT5682_ACPI_HID, RT5682S_ACPI_HID}, .codecs = {RT5682_ACPI_HID, RT5682S_ACPI_HID},
...@@ -37,20 +27,6 @@ static const struct snd_soc_acpi_codecs mtl_lt6911_hdmi = { ...@@ -37,20 +27,6 @@ static const struct snd_soc_acpi_codecs mtl_lt6911_hdmi = {
}; };
struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[] = { struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[] = {
{
.comp_ids = &mtl_rt5682_rt5682s_hp,
.drv_name = "mtl_mx98357_rt5682",
.machine_quirk = snd_soc_acpi_codec_list,
.quirk_data = &mtl_max98357a_amp,
.sof_tplg_filename = "sof-mtl-max98357a-rt5682.tplg",
},
{
.comp_ids = &mtl_rt5682_rt5682s_hp,
.drv_name = "mtl_mx98360_rt5682",
.machine_quirk = snd_soc_acpi_codec_list,
.quirk_data = &mtl_max98360a_amp,
.sof_tplg_filename = "sof-mtl-max98360a-rt5682.tplg",
},
{ {
.comp_ids = &mtl_essx_83x6, .comp_ids = &mtl_essx_83x6,
.drv_name = "mtl_es83x6_c1_h02", .drv_name = "mtl_es83x6_c1_h02",
...@@ -692,6 +668,14 @@ static const struct snd_soc_acpi_link_adr cs42l42_link0_max98363_link2[] = { ...@@ -692,6 +668,14 @@ static const struct snd_soc_acpi_link_adr cs42l42_link0_max98363_link2[] = {
{} {}
}; };
static const struct snd_soc_acpi_link_adr mtl_cs42l43_l0[] = {
{
.mask = BIT(0),
.num_adr = ARRAY_SIZE(cs42l43_0_adr),
.adr_d = cs42l43_0_adr,
},
};
static const struct snd_soc_acpi_link_adr mtl_cs42l43_cs35l56[] = { static const struct snd_soc_acpi_link_adr mtl_cs42l43_cs35l56[] = {
{ {
.mask = BIT(0), .mask = BIT(0),
...@@ -806,6 +790,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = { ...@@ -806,6 +790,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = {
.drv_name = "sof_sdw", .drv_name = "sof_sdw",
.sof_tplg_filename = "sof-mtl-cs42l43-l0-cs35l56-l12.tplg", .sof_tplg_filename = "sof-mtl-cs42l43-l0-cs35l56-l12.tplg",
}, },
{
.link_mask = BIT(0),
.links = mtl_cs42l43_l0,
.drv_name = "sof_sdw",
.sof_tplg_filename = "sof-mtl-cs42l43-l0.tplg",
},
{ {
.link_mask = GENMASK(3, 0), .link_mask = GENMASK(3, 0),
.links = mtl_3_in_1_sdca, .links = mtl_3_in_1_sdca,
......
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