1 // SPDX-License-Identifier: GPL-2.0-only
2 // Copyright (c) 2023 Intel Corporation
5 * sof_sdw_cs_amp - Helpers to handle CS35L56 from generic machine driver
8 #include <linux/device.h>
9 #include <linux/errno.h>
10 #include <sound/soc.h>
11 #include <sound/soc-acpi.h>
12 #include "sof_sdw_common.h"
14 #define CODEC_NAME_SIZE 8
16 static int cs_spk_init(struct snd_soc_pcm_runtime *rtd)
18 const char *dai_name = rtd->dai_link->codecs->dai_name;
19 struct snd_soc_card *card = rtd->card;
20 char codec_name[CODEC_NAME_SIZE];
22 snprintf(codec_name, CODEC_NAME_SIZE, "%s", dai_name);
23 card->components = devm_kasprintf(card->dev, GFP_KERNEL,
25 card->components, codec_name);
26 if (!card->components)
33 int sof_sdw_cs_amp_init(struct snd_soc_card *card,
34 const struct snd_soc_acpi_link_adr *link,
35 struct snd_soc_dai_link *dai_links,
36 struct sof_sdw_codec_info *info,
39 /* Count amp number and do init on playback link only. */
44 dai_links->init = cs_spk_init;