Path: blob/master/sound/soc/intel/boards/sof_ti_common.c
121834 views
// SPDX-License-Identifier: GPL-2.0-only1//2// Copyright(c) 2025 Intel Corporation3#include <linux/module.h>4#include <linux/string.h>5#include <sound/pcm.h>6#include <sound/pcm_params.h>7#include <sound/soc.h>8#include <sound/soc-acpi.h>9#include <sound/soc-dai.h>10#include <sound/soc-dapm.h>11#include <sound/sof.h>12#include <uapi/sound/asound.h>13#include "../common/soc-intel-quirks.h"14#include "sof_ti_common.h"1516/*17* Texas Instruments TAS2563 just mount one device to manage multiple devices,18* so the kcontrols, widgets and routes just keep one item, respectively.19*/20static const struct snd_kcontrol_new tas2563_spk_kcontrols[] = {21SOC_DAPM_PIN_SWITCH("Spk"),22};2324static const struct snd_soc_dapm_widget tas2563_spk_dapm_widgets[] = {25SND_SOC_DAPM_SPK("Spk", NULL),26};2728static const struct snd_soc_dapm_route tas2563_spk_dapm_routes[] = {29{ "Spk", NULL, "OUT" },30};3132static struct snd_soc_dai_link_component tas2563_dai_link_components[] = {33{34.name = TAS2563_DEV0_NAME,35.dai_name = TAS2563_CODEC_DAI,36},37};3839static int tas2563_init(struct snd_soc_pcm_runtime *rtd)40{41struct snd_soc_card *card = rtd->card;42struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);43int ret;4445ret = snd_soc_dapm_new_controls(dapm, tas2563_spk_dapm_widgets,46ARRAY_SIZE(tas2563_spk_dapm_widgets));47if (ret) {48dev_err(rtd->dev, "unable to add dapm widgets, ret %d\n", ret);49return ret;50}5152ret = snd_soc_add_card_controls(card, tas2563_spk_kcontrols,53ARRAY_SIZE(tas2563_spk_kcontrols));54if (ret) {55dev_err(rtd->dev, "unable to add controls, ret %d\n", ret);56return ret;57}5859ret = snd_soc_dapm_add_routes(dapm, tas2563_spk_dapm_routes,60ARRAY_SIZE(tas2563_spk_dapm_routes));61if (ret)62dev_err(rtd->dev, "unable to add dapm routes, ret %d\n", ret);6364return ret;65}6667void sof_tas2563_dai_link(struct snd_soc_dai_link *link)68{69link->codecs = tas2563_dai_link_components;70link->num_codecs = ARRAY_SIZE(tas2563_dai_link_components);71link->init = tas2563_init;72}73EXPORT_SYMBOL_NS(sof_tas2563_dai_link, "SND_SOC_INTEL_SOF_TI_COMMON");7475MODULE_DESCRIPTION("ASoC Intel SOF Texas Instruments helpers");76MODULE_LICENSE("GPL");777879