]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: Intel: ti-common: support tas2563 amplifier
authorDavid Lin <david.lin@intel.com>
Wed, 17 Dec 2025 11:04:31 +0000 (19:04 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 17 Dec 2025 12:04:27 +0000 (12:04 +0000)
Implement tas2563 support code in this common module so it could be
shared between multiple SOF machine drivers.

Signed-off-by: David Lin <david.lin@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://patch.msgid.link/20251217110433.3558136-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-acpi-intel-ssp-common.h
sound/soc/intel/boards/Kconfig
sound/soc/intel/boards/Makefile
sound/soc/intel/boards/sof_ti_common.c [new file with mode: 0644]
sound/soc/intel/boards/sof_ti_common.h [new file with mode: 0644]
sound/soc/intel/common/soc-acpi-intel-ssp-common.c

index b4597c8dac782a739d42c640da0c430822610b45..fdb2fce421158f19fdc71b71273b8b0662059bb6 100644 (file)
@@ -37,6 +37,9 @@
 #define RT5682_ACPI_HID                "10EC5682"
 #define RT5682S_ACPI_HID       "RTL5682"
 
+/* Texas Instruments */
+#define TAS2563_ACPI_HID       "TXNW2563"
+
 enum snd_soc_acpi_intel_codec {
        CODEC_NONE,
 
@@ -63,6 +66,7 @@ enum snd_soc_acpi_intel_codec {
        CODEC_RT1015P,
        CODEC_RT1019P,
        CODEC_RT1308,
+       CODEC_TAS2563,
 };
 
 enum snd_soc_acpi_intel_codec
index c23fdb6aad4ca4dd53c6460243aee0675664f979..724064149906a5f626b42dc4b9e73293f3249dce 100644 (file)
@@ -41,6 +41,9 @@ config SND_SOC_INTEL_SOF_CIRRUS_COMMON
 config SND_SOC_INTEL_SOF_NUVOTON_COMMON
        tristate
 
+config SND_SOC_INTEL_SOF_TI_COMMON
+       tristate
+
 config SND_SOC_INTEL_SOF_BOARD_HELPERS
        select SND_SOC_ACPI_INTEL_MATCH
        tristate
index fcd517d6c27912668bba7d5d9264fc040b3fff65..25a1a9066cbfa571b2094271ddee545a3a3ba7d7 100644 (file)
@@ -69,5 +69,8 @@ obj-$(CONFIG_SND_SOC_INTEL_SOF_CIRRUS_COMMON) += snd-soc-intel-sof-cirrus-common
 snd-soc-intel-sof-nuvoton-common-y += sof_nuvoton_common.o
 obj-$(CONFIG_SND_SOC_INTEL_SOF_NUVOTON_COMMON) += snd-soc-intel-sof-nuvoton-common.o
 
+snd-soc-intel-sof-ti-common-y += sof_ti_common.o
+obj-$(CONFIG_SND_SOC_INTEL_SOF_TI_COMMON) += snd-soc-intel-sof-ti-common.o
+
 snd-soc-intel-sof-board-helpers-y += sof_board_helpers.o
 obj-$(CONFIG_SND_SOC_INTEL_SOF_BOARD_HELPERS) += snd-soc-intel-sof-board-helpers.o
diff --git a/sound/soc/intel/boards/sof_ti_common.c b/sound/soc/intel/boards/sof_ti_common.c
new file mode 100644 (file)
index 0000000..218c353
--- /dev/null
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// Copyright(c) 2025 Intel Corporation
+#include <linux/module.h>
+#include <linux/string.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
+#include <sound/soc-acpi.h>
+#include <sound/soc-dai.h>
+#include <sound/soc-dapm.h>
+#include <sound/sof.h>
+#include <uapi/sound/asound.h>
+#include "../common/soc-intel-quirks.h"
+#include "sof_ti_common.h"
+
+/*
+ * Texas Instruments TAS2563 just mount one device to manage multiple devices,
+ * so the kcontrols, widgets and routes just keep one item, respectively.
+ */
+static const struct snd_kcontrol_new tas2563_spk_kcontrols[] = {
+       SOC_DAPM_PIN_SWITCH("Spk"),
+};
+
+static const struct snd_soc_dapm_widget tas2563_spk_dapm_widgets[] = {
+       SND_SOC_DAPM_SPK("Spk", NULL),
+};
+
+static const struct snd_soc_dapm_route tas2563_spk_dapm_routes[] = {
+       { "Spk", NULL, "OUT" },
+};
+
+static struct snd_soc_dai_link_component tas2563_dai_link_components[] = {
+       {
+               .name = TAS2563_DEV0_NAME,
+               .dai_name = TAS2563_CODEC_DAI,
+       },
+};
+
+static int tas2563_init(struct snd_soc_pcm_runtime *rtd)
+{
+       struct snd_soc_card *card = rtd->card;
+       int ret;
+
+       ret = snd_soc_dapm_new_controls(&card->dapm, tas2563_spk_dapm_widgets,
+                                       ARRAY_SIZE(tas2563_spk_dapm_widgets));
+       if (ret) {
+               dev_err(rtd->dev, "unable to add dapm widgets, ret %d\n", ret);
+               return ret;
+       }
+
+       ret = snd_soc_add_card_controls(card, tas2563_spk_kcontrols,
+                                       ARRAY_SIZE(tas2563_spk_kcontrols));
+       if (ret) {
+               dev_err(rtd->dev, "unable to add controls, ret %d\n", ret);
+               return ret;
+       }
+
+       ret = snd_soc_dapm_add_routes(&card->dapm, tas2563_spk_dapm_routes,
+                                     ARRAY_SIZE(tas2563_spk_dapm_routes));
+       if (ret)
+               dev_err(rtd->dev, "unable to add dapm routes, ret %d\n", ret);
+
+       return ret;
+}
+
+void sof_tas2563_dai_link(struct snd_soc_dai_link *link)
+{
+       link->codecs = tas2563_dai_link_components;
+       link->num_codecs = ARRAY_SIZE(tas2563_dai_link_components);
+       link->init = tas2563_init;
+}
+EXPORT_SYMBOL_NS(sof_tas2563_dai_link, "SND_SOC_INTEL_SOF_TI_COMMON");
+
+MODULE_DESCRIPTION("ASoC Intel SOF Texas Instruments helpers");
+MODULE_LICENSE("GPL");
diff --git a/sound/soc/intel/boards/sof_ti_common.h b/sound/soc/intel/boards/sof_ti_common.h
new file mode 100644 (file)
index 0000000..de15845
--- /dev/null
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright(c) 2025 Intel Corporation.
+ */
+
+/*
+ * This file defines data structures used in Machine Driver for Intel
+ * platforms with Texas Instruments Codecs.
+ */
+#ifndef __SOF_TI_COMMON_H
+#define __SOF_TI_COMMON_H
+
+#include <sound/soc.h>
+#include <sound/soc-acpi-intel-ssp-common.h>
+
+/*
+ * Texas Instruments TAS2563
+ */
+#define TAS2563_CODEC_DAI      "tasdev_codec"
+#define TAS2563_DEV0_NAME      "i2c-" TAS2563_ACPI_HID ":00"
+
+void sof_tas2563_dai_link(struct snd_soc_dai_link *link);
+
+#endif /* __SOF_TI_COMMON_H */
index f56f4bfa518718ab8ee6c03405e031143ffd9e17..a12b11f2cd7ac3659ec8429e4c00888c7ef44669 100644 (file)
@@ -65,6 +65,9 @@ static const struct codec_map amps[] = {
        CODEC_MAP_ENTRY("RT1019P", "rt1019", RT1019P_ACPI_HID, CODEC_RT1019P),
        CODEC_MAP_ENTRY("RT1308", "rt1308", RT1308_ACPI_HID, CODEC_RT1308),
 
+       /* Texas Instruments */
+       CODEC_MAP_ENTRY("TAS2563", "tas2563", TAS2563_ACPI_HID, CODEC_TAS2563),
+
        /*
         * Monolithic components
         *