Commit 07acee58 authored by Brent Lu's avatar Brent Lu Committed by Mark Brown

ASoC: Intel: maxim-common: support max98360a

Move max98360a code to this common module so it could be shared
between multiple SOF machine drivers. MAX98357A and MAX98360A are
sharing same codec driver so here we also share some function and
structures.
Reviewed-by: default avatarBard Liao <bard.liao@intel.com>
Signed-off-by: default avatarBrent Lu <brent.lu@intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210712203240.46960-3-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 3cb97cf3
...@@ -134,7 +134,7 @@ void max_98373_set_codec_conf(struct snd_soc_card *card) ...@@ -134,7 +134,7 @@ void max_98373_set_codec_conf(struct snd_soc_card *card)
EXPORT_SYMBOL_NS(max_98373_set_codec_conf, SND_SOC_INTEL_SOF_MAXIM_COMMON); EXPORT_SYMBOL_NS(max_98373_set_codec_conf, SND_SOC_INTEL_SOF_MAXIM_COMMON);
/* /*
* Maxim MAX98357A * Maxim MAX98357A/MAX98360A
*/ */
static const struct snd_kcontrol_new max_98357a_kcontrols[] = { static const struct snd_kcontrol_new max_98357a_kcontrols[] = {
SOC_DAPM_PIN_SWITCH("Spk"), SOC_DAPM_PIN_SWITCH("Spk"),
...@@ -156,6 +156,13 @@ static struct snd_soc_dai_link_component max_98357a_components[] = { ...@@ -156,6 +156,13 @@ static struct snd_soc_dai_link_component max_98357a_components[] = {
} }
}; };
static struct snd_soc_dai_link_component max_98360a_components[] = {
{
.name = MAX_98360A_DEV0_NAME,
.dai_name = MAX_98357A_CODEC_DAI,
}
};
static int max_98357a_init(struct snd_soc_pcm_runtime *rtd) static int max_98357a_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
...@@ -193,5 +200,13 @@ void max_98357a_dai_link(struct snd_soc_dai_link *link) ...@@ -193,5 +200,13 @@ void max_98357a_dai_link(struct snd_soc_dai_link *link)
} }
EXPORT_SYMBOL_NS(max_98357a_dai_link, SND_SOC_INTEL_SOF_MAXIM_COMMON); EXPORT_SYMBOL_NS(max_98357a_dai_link, SND_SOC_INTEL_SOF_MAXIM_COMMON);
void max_98360a_dai_link(struct snd_soc_dai_link *link)
{
link->codecs = max_98360a_components;
link->num_codecs = ARRAY_SIZE(max_98360a_components);
link->init = max_98357a_init;
}
EXPORT_SYMBOL_NS(max_98360a_dai_link, SND_SOC_INTEL_SOF_MAXIM_COMMON);
MODULE_DESCRIPTION("ASoC Intel SOF Maxim helpers"); MODULE_DESCRIPTION("ASoC Intel SOF Maxim helpers");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -25,11 +25,13 @@ void max_98373_set_codec_conf(struct snd_soc_card *card); ...@@ -25,11 +25,13 @@ void max_98373_set_codec_conf(struct snd_soc_card *card);
int max_98373_trigger(struct snd_pcm_substream *substream, int cmd); int max_98373_trigger(struct snd_pcm_substream *substream, int cmd);
/* /*
* Maxim MAX98357A * 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 "MX98357A:00"
#define MAX_98360A_DEV0_NAME "MX98360A: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);
#endif /* __SOF_MAXIM_COMMON_H */ #endif /* __SOF_MAXIM_COMMON_H */
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