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

ASoC: intel/sdw_utils: move rt700 and rt711 codec helper functions

Move RT700 and RT711 Soundwire 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/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-18-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Vijendar Mukunda and committed by
Mark Brown
8e84fd22 da5b1831

+26 -20
+9
include/sound/soc_sdw_utils.h
··· 85 85 /* DMIC support */ 86 86 int asoc_sdw_dmic_init(struct snd_soc_pcm_runtime *rtd); 87 87 88 + /* RT711 support */ 89 + int asoc_sdw_rt711_init(struct snd_soc_card *card, 90 + struct snd_soc_dai_link *dai_links, 91 + struct asoc_sdw_codec_info *info, 92 + bool playback); 93 + int asoc_sdw_rt711_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link); 94 + 88 95 /* RT711-SDCA support */ 89 96 int asoc_sdw_rt_sdca_jack_init(struct snd_soc_card *card, 90 97 struct snd_soc_dai_link *dai_links, ··· 102 95 /* dai_link init callbacks */ 103 96 int asoc_sdw_rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 104 97 int asoc_sdw_rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 98 + int asoc_sdw_rt700_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 99 + int asoc_sdw_rt711_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 105 100 int asoc_sdw_rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 106 101 int asoc_sdw_rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 107 102 int asoc_sdw_rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
-1
sound/soc/intel/boards/Makefile
··· 37 37 snd-soc-sof-sdw-y += sof_sdw.o \ 38 38 sof_sdw_maxim.o sof_sdw_rt_amp.o \ 39 39 bridge_cs35l56.o \ 40 - sof_sdw_rt700.o sof_sdw_rt711.o \ 41 40 sof_sdw_cs42l42.o sof_sdw_cs42l43.o \ 42 41 sof_sdw_cs_amp.o \ 43 42 sof_sdw_hdmi.o
-9
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 - /* RT711 support */ 93 - int asoc_sdw_rt711_init(struct snd_soc_card *card, 94 - struct snd_soc_dai_link *dai_links, 95 - struct asoc_sdw_codec_info *info, 96 - bool playback); 97 - int asoc_sdw_rt711_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link); 98 - 99 92 /* RT1308 I2S support */ 100 93 extern const struct snd_soc_ops soc_sdw_rt1308_i2s_ops; 101 94 ··· 135 142 int asoc_sdw_cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 136 143 int asoc_sdw_cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 137 144 int asoc_sdw_maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 138 - int asoc_sdw_rt700_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 139 - int asoc_sdw_rt711_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 140 145 int asoc_sdw_rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); 141 146 142 147 #endif
+5 -3
sound/soc/intel/boards/sof_sdw_rt700.c sound/soc/sdw_utils/soc_sdw_rt700.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) 2020 Intel Corporation 4 + // Copyright (c) 2024 Advanced Micro Devices, Inc. 3 5 4 6 /* 5 - * sof_sdw_rt700 - Helpers to handle RT700 from generic machine driver 7 + * soc_sdw_rt700 - Helpers to handle RT700 from generic machine driver 6 8 */ 7 9 8 10 #include <linux/device.h> ··· 15 13 #include <sound/soc-acpi.h> 16 14 #include <sound/soc-dapm.h> 17 15 #include <sound/jack.h> 18 - #include "sof_sdw_common.h" 16 + #include <sound/soc_sdw_utils.h> 19 17 20 18 static const struct snd_soc_dapm_route rt700_map[] = { 21 19 /* Headphones */ ··· 85 83 86 84 return ret; 87 85 } 88 - MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS); 86 + EXPORT_SYMBOL_NS(asoc_sdw_rt700_rtd_init, SND_SOC_SDW_UTILS);
+11 -7
sound/soc/intel/boards/sof_sdw_rt711.c sound/soc/sdw_utils/soc_sdw_rt711.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) 2020 Intel Corporation 4 + // Copyright (c) 2024 Advanced Micro Devices, Inc. 3 5 4 6 /* 5 - * sof_sdw_rt711 - Helpers to handle RT711 from generic machine driver 7 + * soc_sdw_rt711 - Helpers to handle RT711 from generic machine driver 6 8 */ 7 9 8 10 #include <linux/device.h> ··· 17 15 #include <sound/soc-acpi.h> 18 16 #include <sound/soc-dapm.h> 19 17 #include <sound/jack.h> 20 - #include "sof_sdw_common.h" 18 + #include <sound/soc_sdw_utils.h> 21 19 22 20 /* 23 21 * Note this MUST be called before snd_soc_register_card(), so that the props 24 22 * are in place before the codec component driver's probe function parses them. 25 23 */ 26 - static int rt711_add_codec_device_props(struct device *sdw_dev) 24 + static int rt711_add_codec_device_props(struct device *sdw_dev, unsigned long quirk) 27 25 { 28 26 struct property_entry props[SOC_SDW_MAX_NO_PROPS] = {}; 29 27 struct fwnode_handle *fwnode; 30 28 int ret; 31 29 32 - if (!SOC_SDW_JACK_JDSRC(sof_sdw_quirk)) 30 + if (!SOC_SDW_JACK_JDSRC(quirk)) 33 31 return 0; 34 - props[0] = PROPERTY_ENTRY_U32("realtek,jd-src", SOC_SDW_JACK_JDSRC(sof_sdw_quirk)); 32 + props[0] = PROPERTY_ENTRY_U32("realtek,jd-src", SOC_SDW_JACK_JDSRC(quirk)); 35 33 36 34 fwnode = fwnode_create_software_node(props, NULL); 37 35 if (IS_ERR(fwnode)) ··· 112 110 113 111 return ret; 114 112 } 113 + EXPORT_SYMBOL_NS(asoc_sdw_rt711_rtd_init, SND_SOC_SDW_UTILS); 115 114 116 115 int asoc_sdw_rt711_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) 117 116 { ··· 126 123 127 124 return 0; 128 125 } 126 + EXPORT_SYMBOL_NS(asoc_sdw_rt711_exit, SND_SOC_SDW_UTILS); 129 127 130 128 int asoc_sdw_rt711_init(struct snd_soc_card *card, 131 129 struct snd_soc_dai_link *dai_links, ··· 148 144 if (!sdw_dev) 149 145 return -EPROBE_DEFER; 150 146 151 - ret = rt711_add_codec_device_props(sdw_dev); 147 + ret = rt711_add_codec_device_props(sdw_dev, ctx->mc_quirk); 152 148 if (ret < 0) { 153 149 put_device(sdw_dev); 154 150 return ret; ··· 157 153 158 154 return 0; 159 155 } 160 - MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS); 156 + EXPORT_SYMBOL_NS(asoc_sdw_rt711_init, SND_SOC_SDW_UTILS);
+1
sound/soc/sdw_utils/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 snd-soc-sdw-utils-y := soc_sdw_utils.o soc_sdw_dmic.o soc_sdw_rt_dmic.o \ 3 + soc_sdw_rt700.o soc_sdw_rt711.o \ 3 4 soc_sdw_rt712_sdca.o soc_sdw_rt722_sdca.o \ 4 5 soc_sdw_rt5682.o soc_sdw_rt_sdca_jack_common.o 5 6 obj-$(CONFIG_SND_SOC_SDW_UTILS) += snd-soc-sdw-utils.o