summaryrefslogtreecommitdiff
path: root/sound/soc/intel/avs/boards
diff options
context:
space:
mode:
authorAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>2023-10-12 11:35:12 +0300
committerMark Brown <broonie@kernel.org>2023-10-12 15:04:50 +0300
commitcc7ea744970176134d48cc6e004ebe7c9a0bb3da (patch)
tree461a12fc8405f668799bc5cf46cc8d2e42f2e3d5 /sound/soc/intel/avs/boards
parent70c101917aa1efa52a89dae5d5deee2a0c74de07 (diff)
downloadlinux-cc7ea744970176134d48cc6e004ebe7c9a0bb3da.tar.xz
ASoC: Intel: avs: rt286: Validate machine board configuration
Allow for board to be used with TDMs. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20231012083514.492626-15-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/avs/boards')
-rw-r--r--sound/soc/intel/avs/boards/rt286.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sound/soc/intel/avs/boards/rt286.c b/sound/soc/intel/avs/boards/rt286.c
index 36da0578d5b4..131237471e3e 100644
--- a/sound/soc/intel/avs/boards/rt286.c
+++ b/sound/soc/intel/avs/boards/rt286.c
@@ -13,6 +13,7 @@
#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include "../../../codecs/rt286.h"
+#include "../utils.h"
#define RT286_CODEC_DAI "rt286-aif1"
@@ -114,7 +115,7 @@ static const struct snd_soc_ops avs_rt286_ops = {
};
static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port,
- struct snd_soc_dai_link **dai_link)
+ int tdm_slot, struct snd_soc_dai_link **dai_link)
{
struct snd_soc_dai_link_component *platform;
struct snd_soc_dai_link *dl;
@@ -126,13 +127,15 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in
platform->name = platform_name;
- dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port);
+ dl->name = devm_kasprintf(dev, GFP_KERNEL,
+ AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot));
dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL);
dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL);
if (!dl->name || !dl->cpus || !dl->codecs)
return -ENOMEM;
- dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port);
+ dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL,
+ AVS_STRING_FMT("SSP", " Pin", ssp_port, tdm_slot));
dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-INT343A:00");
dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, RT286_CODEC_DAI);
if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name)
@@ -181,13 +184,17 @@ static int avs_rt286_probe(struct platform_device *pdev)
struct snd_soc_jack *jack;
struct device *dev = &pdev->dev;
const char *pname;
- int ssp_port, ret;
+ int ssp_port, tdm_slot, ret;
mach = dev_get_platdata(dev);
pname = mach->mach_params.platform;
- ssp_port = __ffs(mach->mach_params.i2s_link_mask);
- ret = avs_create_dai_link(dev, pname, ssp_port, &dai_link);
+ ret = avs_mach_get_ssp_tdm(dev, mach, &ssp_port, &tdm_slot);
+ if (ret)
+ return ret;
+
+ ret = avs_create_dai_link(dev, pname, ssp_port, tdm_slot, &dai_link);
+
if (ret) {
dev_err(dev, "Failed to create dai link: %d", ret);
return ret;