Commit ccc96ae2 authored by Vijendar Mukunda's avatar Vijendar Mukunda Committed by Mark Brown

ASoC: intel/sdw_utils: move rtk amp codec helper functions

Move RTK amp codec helper functions related implementation to common
place holder to make it generic so that these helper functions will be
used by other platform machine driver modules.

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-19-Vijendar.Mukunda@amd.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8e84fd22
...@@ -99,9 +99,20 @@ int asoc_sdw_rt_sdca_jack_init(struct snd_soc_card *card, ...@@ -99,9 +99,20 @@ int asoc_sdw_rt_sdca_jack_init(struct snd_soc_card *card,
bool playback); bool playback);
int asoc_sdw_rt_sdca_jack_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link); int asoc_sdw_rt_sdca_jack_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
/* RT1308 I2S support */
extern const struct snd_soc_ops soc_sdw_rt1308_i2s_ops;
/* generic amp support */
int asoc_sdw_rt_amp_init(struct snd_soc_card *card,
struct snd_soc_dai_link *dai_links,
struct asoc_sdw_codec_info *info,
bool playback);
int asoc_sdw_rt_amp_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
/* 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);
int asoc_sdw_rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int asoc_sdw_rt700_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); int asoc_sdw_rt700_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int asoc_sdw_rt711_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); int asoc_sdw_rt711_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int asoc_sdw_rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); int asoc_sdw_rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
......
...@@ -35,7 +35,7 @@ snd-soc-skl_nau88l25_ssm4567-y := skl_nau88l25_ssm4567.o ...@@ -35,7 +35,7 @@ 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_rt_amp.o \ sof_sdw_maxim.o \
bridge_cs35l56.o \ bridge_cs35l56.o \
sof_sdw_cs42l42.o sof_sdw_cs42l43.o \ sof_sdw_cs42l42.o sof_sdw_cs42l43.o \
sof_sdw_cs_amp.o \ sof_sdw_cs_amp.o \
......
...@@ -89,16 +89,6 @@ int sof_sdw_hdmi_init(struct snd_soc_pcm_runtime *rtd); ...@@ -89,16 +89,6 @@ 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);
/* RT1308 I2S support */
extern const struct snd_soc_ops soc_sdw_rt1308_i2s_ops;
/* generic amp support */
int asoc_sdw_rt_amp_init(struct snd_soc_card *card,
struct snd_soc_dai_link *dai_links,
struct asoc_sdw_codec_info *info,
bool playback);
int asoc_sdw_rt_amp_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
/* MAXIM codec support */ /* MAXIM codec support */
int asoc_sdw_maxim_init(struct snd_soc_card *card, int asoc_sdw_maxim_init(struct snd_soc_card *card,
struct snd_soc_dai_link *dai_links, struct snd_soc_dai_link *dai_links,
...@@ -135,6 +125,5 @@ int asoc_sdw_cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_so ...@@ -135,6 +125,5 @@ int asoc_sdw_cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_so
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); int asoc_sdw_maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int asoc_sdw_rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
#endif #endif
...@@ -2,5 +2,6 @@ ...@@ -2,5 +2,6 @@
snd-soc-sdw-utils-y := soc_sdw_utils.o soc_sdw_dmic.o soc_sdw_rt_dmic.o \ snd-soc-sdw-utils-y := soc_sdw_utils.o soc_sdw_dmic.o soc_sdw_rt_dmic.o \
soc_sdw_rt700.o soc_sdw_rt711.o \ soc_sdw_rt700.o soc_sdw_rt711.o \
soc_sdw_rt712_sdca.o soc_sdw_rt722_sdca.o \ soc_sdw_rt712_sdca.o soc_sdw_rt722_sdca.o \
soc_sdw_rt5682.o soc_sdw_rt_sdca_jack_common.o soc_sdw_rt5682.o soc_sdw_rt_sdca_jack_common.o \
soc_sdw_rt_amp.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) 2022 Intel Corporation // Copyright (c) 2022 Intel Corporation
// Copyright (c) 2024 Advanced Micro Devices, Inc.
/* /*
* sof_sdw_rt_amp - Helpers to handle RT1308/RT1316/RT1318 from generic machine driver * soc_sdw_rt_amp - Helpers to handle RT1308/RT1316/RT1318 from generic machine driver
*/ */
#include <linux/device.h> #include <linux/device.h>
...@@ -14,9 +16,9 @@ ...@@ -14,9 +16,9 @@
#include <linux/soundwire/sdw.h> #include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_type.h> #include <linux/soundwire/sdw_type.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include "sof_sdw_common.h" #include <sound/soc_sdw_utils.h>
#include "sof_sdw_amp_coeff_tables.h" #include "soc_sdw_rt_amp_coeff_tables.h"
#include "../../codecs/rt1308.h" #include "../codecs/rt1308.h"
#define CODEC_NAME_SIZE 7 #define CODEC_NAME_SIZE 7
...@@ -199,6 +201,7 @@ int asoc_sdw_rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc ...@@ -199,6 +201,7 @@ int asoc_sdw_rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc
return ret; return ret;
} }
EXPORT_SYMBOL_NS(asoc_sdw_rt_amp_spk_rtd_init, SND_SOC_SDW_UTILS);
static int rt1308_i2s_hw_params(struct snd_pcm_substream *substream, static int rt1308_i2s_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
...@@ -236,6 +239,7 @@ static int rt1308_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -236,6 +239,7 @@ static int rt1308_i2s_hw_params(struct snd_pcm_substream *substream,
const struct snd_soc_ops soc_sdw_rt1308_i2s_ops = { const struct snd_soc_ops soc_sdw_rt1308_i2s_ops = {
.hw_params = rt1308_i2s_hw_params, .hw_params = rt1308_i2s_hw_params,
}; };
EXPORT_SYMBOL_NS(soc_sdw_rt1308_i2s_ops, SND_SOC_SDW_UTILS);
int asoc_sdw_rt_amp_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) int asoc_sdw_rt_amp_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link)
{ {
...@@ -253,6 +257,7 @@ int asoc_sdw_rt_amp_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai ...@@ -253,6 +257,7 @@ int asoc_sdw_rt_amp_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai
return 0; return 0;
} }
EXPORT_SYMBOL_NS(asoc_sdw_rt_amp_exit, SND_SOC_SDW_UTILS);
int asoc_sdw_rt_amp_init(struct snd_soc_card *card, int asoc_sdw_rt_amp_init(struct snd_soc_card *card,
struct snd_soc_dai_link *dai_links, struct snd_soc_dai_link *dai_links,
...@@ -295,3 +300,4 @@ int asoc_sdw_rt_amp_init(struct snd_soc_card *card, ...@@ -295,3 +300,4 @@ int asoc_sdw_rt_amp_init(struct snd_soc_card *card,
return 0; return 0;
} }
EXPORT_SYMBOL_NS(asoc_sdw_rt_amp_init, SND_SOC_SDW_UTILS);
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
*/ */
/* /*
* sof_sdw_amp_coeff_tables.h - related coefficients for amplifier parameters * soc_sdw_rt_amp_coeff_tables.h - related coefficients for RTK amplifier parameters
*/ */
#ifndef SND_SOC_SOF_SDW_AMP_COEFF_H #ifndef SND_SOC_SDW_RT_SDW_AMP_COEFF_H
#define SND_SOC_SOF_SDW_AMP_COEFF_H #define SND_SOC_SDW_RT_SDW_AMP_COEFF_H
#define RT1308_MAX_BQ_REG 480 #define RT1308_MAX_BQ_REG 480
#define RT1316_MAX_BQ_REG 580 #define RT1316_MAX_BQ_REG 580
......
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