Commit 051b7cb3 authored by Vijendar Mukunda's avatar Vijendar Mukunda Committed by Mark Brown

ASoC: intel/sdw_utils: move maxim codec helper functions

Move maxim codec helper functions to common place holder so that
it can be used by other platform machine driver.

Link: https://github.com/thesofproject/linux/pull/5068Signed-off-by: default avatarVijendar Mukunda <Vijendar.Mukunda@amd.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://patch.msgid.link/20240801091446.10457-21-Vijendar.Mukunda@amd.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5fa46627
...@@ -144,6 +144,12 @@ int asoc_sdw_cs_amp_init(struct snd_soc_card *card, ...@@ -144,6 +144,12 @@ int asoc_sdw_cs_amp_init(struct snd_soc_card *card,
struct asoc_sdw_codec_info *info, struct asoc_sdw_codec_info *info,
bool playback); bool playback);
/* MAXIM codec support */
int asoc_sdw_maxim_init(struct snd_soc_card *card,
struct snd_soc_dai_link *dai_links,
struct asoc_sdw_codec_info *info,
bool playback);
/* dai_link init callbacks */ /* dai_link init callbacks */
int asoc_sdw_rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); int asoc_sdw_rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int asoc_sdw_rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); int asoc_sdw_rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
...@@ -158,5 +164,6 @@ int asoc_sdw_cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc ...@@ -158,5 +164,6 @@ int asoc_sdw_cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc
int asoc_sdw_cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); int asoc_sdw_cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int asoc_sdw_cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); int asoc_sdw_cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int asoc_sdw_cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); int asoc_sdw_cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int asoc_sdw_maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
#endif #endif
...@@ -35,7 +35,6 @@ snd-soc-skl_nau88l25_ssm4567-y := skl_nau88l25_ssm4567.o ...@@ -35,7 +35,6 @@ snd-soc-skl_nau88l25_ssm4567-y := skl_nau88l25_ssm4567.o
snd-soc-ehl-rt5660-y := ehl_rt5660.o snd-soc-ehl-rt5660-y := ehl_rt5660.o
snd-soc-sof-ssp-amp-y := sof_ssp_amp.o snd-soc-sof-ssp-amp-y := sof_ssp_amp.o
snd-soc-sof-sdw-y += sof_sdw.o \ snd-soc-sof-sdw-y += sof_sdw.o \
sof_sdw_maxim.o \
sof_sdw_hdmi.o sof_sdw_hdmi.o
obj-$(CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH) += snd-soc-sof_rt5682.o 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
......
...@@ -77,14 +77,4 @@ int sof_sdw_hdmi_init(struct snd_soc_pcm_runtime *rtd); ...@@ -77,14 +77,4 @@ int sof_sdw_hdmi_init(struct snd_soc_pcm_runtime *rtd);
int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card); int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card);
/* MAXIM codec support */
int asoc_sdw_maxim_init(struct snd_soc_card *card,
struct snd_soc_dai_link *dai_links,
struct asoc_sdw_codec_info *info,
bool playback);
/* dai_link init callbacks */
int asoc_sdw_maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
#endif #endif
...@@ -6,5 +6,6 @@ snd-soc-sdw-utils-y := soc_sdw_utils.o soc_sdw_dmic.o soc_sdw_rt_dmic.o \ ...@@ -6,5 +6,6 @@ snd-soc-sdw-utils-y := soc_sdw_utils.o soc_sdw_dmic.o soc_sdw_rt_dmic.o \
soc_sdw_rt_amp.o \ soc_sdw_rt_amp.o \
soc_sdw_bridge_cs35l56.o \ soc_sdw_bridge_cs35l56.o \
soc_sdw_cs42l42.o soc_sdw_cs42l43.o \ soc_sdw_cs42l42.o soc_sdw_cs42l43.o \
soc_sdw_cs_amp.o soc_sdw_cs_amp.o \
soc_sdw_maxim.o
obj-$(CONFIG_SND_SOC_SDW_UTILS) += snd-soc-sdw-utils.o obj-$(CONFIG_SND_SOC_SDW_UTILS) += snd-soc-sdw-utils.o
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
// This file incorporates work covered by the following copyright notice:
// Copyright (c) 2020 Intel Corporation // Copyright (c) 2020 Intel Corporation
// Copyright (c) 2024 Advanced Micro Devices, Inc.
// //
// sof_sdw_maxim - Helpers to handle maxim codecs // soc_sdw_maxim - Helpers to handle maxim codecs
// codec devices from generic machine driver // codec devices from generic machine driver
#include <linux/device.h> #include <linux/device.h>
...@@ -10,7 +12,7 @@ ...@@ -10,7 +12,7 @@
#include <sound/soc.h> #include <sound/soc.h>
#include <sound/soc-acpi.h> #include <sound/soc-acpi.h>
#include <sound/soc-dapm.h> #include <sound/soc-dapm.h>
#include "sof_sdw_common.h" #include <sound/soc_sdw_utils.h>
static int maxim_part_id; static int maxim_part_id;
#define SOC_SDW_PART_ID_MAX98363 0x8363 #define SOC_SDW_PART_ID_MAX98363 0x8363
...@@ -41,8 +43,9 @@ int asoc_sdw_maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_ ...@@ -41,8 +43,9 @@ int asoc_sdw_maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_
return ret; return ret;
} }
EXPORT_SYMBOL_NS(asoc_sdw_maxim_spk_rtd_init, SND_SOC_SDW_UTILS);
static int mx8373_enable_spk_pin(struct snd_pcm_substream *substream, bool enable) static int asoc_sdw_mx8373_enable_spk_pin(struct snd_pcm_substream *substream, bool enable)
{ {
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;
...@@ -84,7 +87,7 @@ static int asoc_sdw_mx8373_prepare(struct snd_pcm_substream *substream) ...@@ -84,7 +87,7 @@ static int asoc_sdw_mx8373_prepare(struct snd_pcm_substream *substream)
if (ret < 0) if (ret < 0)
return ret; return ret;
return mx8373_enable_spk_pin(substream, true); return asoc_sdw_mx8373_enable_spk_pin(substream, true);
} }
static int asoc_sdw_mx8373_hw_free(struct snd_pcm_substream *substream) static int asoc_sdw_mx8373_hw_free(struct snd_pcm_substream *substream)
...@@ -96,7 +99,7 @@ static int asoc_sdw_mx8373_hw_free(struct snd_pcm_substream *substream) ...@@ -96,7 +99,7 @@ static int asoc_sdw_mx8373_hw_free(struct snd_pcm_substream *substream)
if (ret < 0) if (ret < 0)
return ret; return ret;
return mx8373_enable_spk_pin(substream, false); return asoc_sdw_mx8373_enable_spk_pin(substream, false);
} }
static const struct snd_soc_ops max_98373_sdw_ops = { static const struct snd_soc_ops max_98373_sdw_ops = {
...@@ -142,3 +145,4 @@ int asoc_sdw_maxim_init(struct snd_soc_card *card, ...@@ -142,3 +145,4 @@ int asoc_sdw_maxim_init(struct snd_soc_card *card,
} }
return 0; return 0;
} }
EXPORT_SYMBOL_NS(asoc_sdw_maxim_init, SND_SOC_SDW_UTILS);
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