]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: intel/sdw_utils: move rtk amp codec helper functions
authorVijendar Mukunda <Vijendar.Mukunda@amd.com>
Thu, 1 Aug 2024 09:14:33 +0000 (14:44 +0530)
committerMark Brown <broonie@kernel.org>
Thu, 1 Aug 2024 11:44:07 +0000 (12:44 +0100)
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>
include/sound/soc_sdw_utils.h
sound/soc/intel/boards/Makefile
sound/soc/intel/boards/sof_sdw_common.h
sound/soc/sdw_utils/Makefile
sound/soc/sdw_utils/soc_sdw_rt_amp.c [moved from sound/soc/intel/boards/sof_sdw_rt_amp.c with 93% similarity]
sound/soc/sdw_utils/soc_sdw_rt_amp_coeff_tables.h [moved from sound/soc/intel/boards/sof_sdw_amp_coeff_tables.h with 97% similarity]

index 3e55cac33176ca19354d109453a2939d0edf6c4b..450542eb3ea0aa1eb7d4d1304f6ec82f783ff8c4 100644 (file)
@@ -99,9 +99,20 @@ int asoc_sdw_rt_sdca_jack_init(struct snd_soc_card *card,
                               bool playback);
 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 */
 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_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_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);
index 9f92f49cc517630a0278d9afbb1bf30039e19e6c..70c56bdc180c315c42c40e9be026028d8b2d3b08 100644 (file)
@@ -35,7 +35,7 @@ snd-soc-skl_nau88l25_ssm4567-y := skl_nau88l25_ssm4567.o
 snd-soc-ehl-rt5660-y := ehl_rt5660.o
 snd-soc-sof-ssp-amp-y := sof_ssp_amp.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                        \
                        sof_sdw_cs42l42.o sof_sdw_cs42l43.o     \
                        sof_sdw_cs_amp.o                        \
index 1d7e6df02247e0632c2b0a349064d4c62d24c8ab..7f856c6018aae291b7ef3b02aca36a9a36f94188 100644 (file)
@@ -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);
 
-/* 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 */
 int asoc_sdw_maxim_init(struct snd_soc_card *card,
                        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
 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_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
index 20516094f4532ab753816c8f1e527380dcde2908..7851af9b85936df5fdded8f9bc26840a635c1e37 100644 (file)
@@ -2,5 +2,6 @@
 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_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
similarity index 93%
rename from sound/soc/intel/boards/sof_sdw_rt_amp.c
rename to sound/soc/sdw_utils/soc_sdw_rt_amp.c
index fff746671c1d65e3be4e526a5442fe9a0e0cebd1..42be01405ab4e3822b7d40916abb4976d9001aab 100644 (file)
@@ -1,8 +1,10 @@
 // SPDX-License-Identifier: GPL-2.0-only
+// This file incorporates work covered by the following copyright notice:
 // 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>
@@ -14,9 +16,9 @@
 #include <linux/soundwire/sdw.h>
 #include <linux/soundwire/sdw_type.h>
 #include <linux/dmi.h>
-#include "sof_sdw_common.h"
-#include "sof_sdw_amp_coeff_tables.h"
-#include "../../codecs/rt1308.h"
+#include <sound/soc_sdw_utils.h>
+#include "soc_sdw_rt_amp_coeff_tables.h"
+#include "../codecs/rt1308.h"
 
 #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
 
        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,
                                struct snd_pcm_hw_params *params)
@@ -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 = {
        .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)
 {
@@ -253,6 +257,7 @@ int asoc_sdw_rt_amp_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai
 
        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,
                         struct snd_soc_dai_link *dai_links,
@@ -295,3 +300,4 @@ int asoc_sdw_rt_amp_init(struct snd_soc_card *card,
 
        return 0;
 }
+EXPORT_SYMBOL_NS(asoc_sdw_rt_amp_init, SND_SOC_SDW_UTILS);
similarity index 97%
rename from sound/soc/intel/boards/sof_sdw_amp_coeff_tables.h
rename to sound/soc/sdw_utils/soc_sdw_rt_amp_coeff_tables.h
index 4a3e6fdbd6237924021798b504a6a96251d2fe07..4803d134d071f6eeb85a892d5eba44d70e4bb586 100644 (file)
@@ -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
-#define SND_SOC_SOF_SDW_AMP_COEFF_H
+#ifndef SND_SOC_SDW_RT_SDW_AMP_COEFF_H
+#define SND_SOC_SDW_RT_SDW_AMP_COEFF_H
 
 #define RT1308_MAX_BQ_REG 480
 #define RT1316_MAX_BQ_REG 580