Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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/5068
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://patch.msgid.link/20240801091446.10457-19-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Vijendar Mukunda and committed by
Mark Brown
ccc96ae2 8e84fd22

+27 -20
+11
include/sound/soc_sdw_utils.h
··· 99 99 bool playback); 100 100 int asoc_sdw_rt_sdca_jack_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link); 101 101 102 + /* RT1308 I2S support */ 103 + extern const struct snd_soc_ops soc_sdw_rt1308_i2s_ops; 104 + 105 + /* generic amp support */ 106 + int asoc_sdw_rt_amp_init(struct snd_soc_card *card, 107 + struct snd_soc_dai_link *dai_links, 108 + struct asoc_sdw_codec_info *info, 109 + bool playback); 110 + int asoc_sdw_rt_amp_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link); 111 + 102 112 /* dai_link init callbacks */ 103 113 int asoc_sdw_rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 104 114 int asoc_sdw_rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 115 + int asoc_sdw_rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 105 116 int asoc_sdw_rt700_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 106 117 int asoc_sdw_rt711_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 107 118 int asoc_sdw_rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
+1 -1
sound/soc/intel/boards/Makefile
··· 35 35 snd-soc-ehl-rt5660-y := ehl_rt5660.o 36 36 snd-soc-sof-ssp-amp-y := sof_ssp_amp.o 37 37 snd-soc-sof-sdw-y += sof_sdw.o \ 38 - sof_sdw_maxim.o sof_sdw_rt_amp.o \ 38 + sof_sdw_maxim.o \ 39 39 bridge_cs35l56.o \ 40 40 sof_sdw_cs42l42.o sof_sdw_cs42l43.o \ 41 41 sof_sdw_cs_amp.o \
+3 -3
sound/soc/intel/boards/sof_sdw_amp_coeff_tables.h sound/soc/sdw_utils/soc_sdw_rt_amp_coeff_tables.h
··· 2 2 */ 3 3 4 4 /* 5 - * sof_sdw_amp_coeff_tables.h - related coefficients for amplifier parameters 5 + * soc_sdw_rt_amp_coeff_tables.h - related coefficients for RTK amplifier parameters 6 6 */ 7 7 8 - #ifndef SND_SOC_SOF_SDW_AMP_COEFF_H 9 - #define SND_SOC_SOF_SDW_AMP_COEFF_H 8 + #ifndef SND_SOC_SDW_RT_SDW_AMP_COEFF_H 9 + #define SND_SOC_SDW_RT_SDW_AMP_COEFF_H 10 10 11 11 #define RT1308_MAX_BQ_REG 480 12 12 #define RT1316_MAX_BQ_REG 580
-11
sound/soc/intel/boards/sof_sdw_common.h
··· 89 89 90 90 int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card); 91 91 92 - /* RT1308 I2S support */ 93 - extern const struct snd_soc_ops soc_sdw_rt1308_i2s_ops; 94 - 95 - /* generic amp support */ 96 - int asoc_sdw_rt_amp_init(struct snd_soc_card *card, 97 - struct snd_soc_dai_link *dai_links, 98 - struct asoc_sdw_codec_info *info, 99 - bool playback); 100 - int asoc_sdw_rt_amp_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link); 101 - 102 92 /* MAXIM codec support */ 103 93 int asoc_sdw_maxim_init(struct snd_soc_card *card, 104 94 struct snd_soc_dai_link *dai_links, ··· 125 135 int asoc_sdw_cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 126 136 int asoc_sdw_cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 127 137 int asoc_sdw_maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 128 - int asoc_sdw_rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 129 138 130 139 #endif
+10 -4
sound/soc/intel/boards/sof_sdw_rt_amp.c sound/soc/sdw_utils/soc_sdw_rt_amp.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 + // This file incorporates work covered by the following copyright notice: 2 3 // Copyright (c) 2022 Intel Corporation 4 + // Copyright (c) 2024 Advanced Micro Devices, Inc. 3 5 4 6 /* 5 - * sof_sdw_rt_amp - Helpers to handle RT1308/RT1316/RT1318 from generic machine driver 7 + * soc_sdw_rt_amp - Helpers to handle RT1308/RT1316/RT1318 from generic machine driver 6 8 */ 7 9 8 10 #include <linux/device.h> ··· 16 14 #include <linux/soundwire/sdw.h> 17 15 #include <linux/soundwire/sdw_type.h> 18 16 #include <linux/dmi.h> 19 - #include "sof_sdw_common.h" 20 - #include "sof_sdw_amp_coeff_tables.h" 21 - #include "../../codecs/rt1308.h" 17 + #include <sound/soc_sdw_utils.h> 18 + #include "soc_sdw_rt_amp_coeff_tables.h" 19 + #include "../codecs/rt1308.h" 22 20 23 21 #define CODEC_NAME_SIZE 7 24 22 ··· 201 199 202 200 return ret; 203 201 } 202 + EXPORT_SYMBOL_NS(asoc_sdw_rt_amp_spk_rtd_init, SND_SOC_SDW_UTILS); 204 203 205 204 static int rt1308_i2s_hw_params(struct snd_pcm_substream *substream, 206 205 struct snd_pcm_hw_params *params) ··· 239 236 const struct snd_soc_ops soc_sdw_rt1308_i2s_ops = { 240 237 .hw_params = rt1308_i2s_hw_params, 241 238 }; 239 + EXPORT_SYMBOL_NS(soc_sdw_rt1308_i2s_ops, SND_SOC_SDW_UTILS); 242 240 243 241 int asoc_sdw_rt_amp_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) 244 242 { ··· 257 253 258 254 return 0; 259 255 } 256 + EXPORT_SYMBOL_NS(asoc_sdw_rt_amp_exit, SND_SOC_SDW_UTILS); 260 257 261 258 int asoc_sdw_rt_amp_init(struct snd_soc_card *card, 262 259 struct snd_soc_dai_link *dai_links, ··· 300 295 301 296 return 0; 302 297 } 298 + EXPORT_SYMBOL_NS(asoc_sdw_rt_amp_init, SND_SOC_SDW_UTILS);
+2 -1
sound/soc/sdw_utils/Makefile
··· 2 2 snd-soc-sdw-utils-y := soc_sdw_utils.o soc_sdw_dmic.o soc_sdw_rt_dmic.o \ 3 3 soc_sdw_rt700.o soc_sdw_rt711.o \ 4 4 soc_sdw_rt712_sdca.o soc_sdw_rt722_sdca.o \ 5 - soc_sdw_rt5682.o soc_sdw_rt_sdca_jack_common.o 5 + soc_sdw_rt5682.o soc_sdw_rt_sdca_jack_common.o \ 6 + soc_sdw_rt_amp.o 6 7 obj-$(CONFIG_SND_SOC_SDW_UTILS) += snd-soc-sdw-utils.o