Skip to content

Commit f7b2651

Browse files
Ravulapati Vishnu vardhan raobroonie
authored andcommitted
ASoC: amd: Adding DAI LINK for rt1015 codec
DAI link support for RTK 1015 and providing the codec details depending on the snd_soc_card selected by ACPI ID. Signed-off-by: Ravulapati Vishnu vardhan rao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 414e3ca commit f7b2651

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

sound/soc/amd/acp3x-rt5682-max9836.c

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ static struct clk *rt5682_dai_bclk;
3333
static struct gpio_desc *dmic_sel;
3434
void *soc_is_rltk_max(struct device *dev);
3535

36+
enum {
37+
RT5682 = 0,
38+
MAX,
39+
EC,
40+
};
41+
3642
static int acp3x_5682_init(struct snd_soc_pcm_runtime *rtd)
3743
{
3844
int ret;
@@ -242,6 +248,9 @@ SND_SOC_DAILINK_DEF(rt5682,
242248
DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC5682:00", "rt5682-aif1")));
243249
SND_SOC_DAILINK_DEF(max,
244250
DAILINK_COMP_ARRAY(COMP_CODEC("MX98357A:00", "HiFi")));
251+
SND_SOC_DAILINK_DEF(rt1015,
252+
DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC1015:00", "rt1015-aif"),
253+
COMP_CODEC("i2c-10EC1015:01", "rt1015-aif")));
245254
SND_SOC_DAILINK_DEF(cros_ec,
246255
DAILINK_COMP_ARRAY(COMP_CODEC("GOOG0013:00", "EC Codec I2S RX")));
247256

@@ -260,7 +269,7 @@ static struct snd_soc_codec_conf rt1015_conf[] = {
260269
};
261270

262271
static struct snd_soc_dai_link acp3x_dai[] = {
263-
{
272+
[RT5682] = {
264273
.name = "acp3x-5682-play",
265274
.stream_name = "Playback",
266275
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
@@ -271,16 +280,19 @@ static struct snd_soc_dai_link acp3x_dai[] = {
271280
.ops = &acp3x_5682_ops,
272281
SND_SOC_DAILINK_REG(acp3x_i2s, rt5682, platform),
273282
},
274-
{
283+
[MAX] = {
275284
.name = "acp3x-max98357-play",
276285
.stream_name = "HiFi Playback",
277286
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
278-
| SND_SOC_DAIFMT_CBM_CFM,
287+
| SND_SOC_DAIFMT_CBS_CFS,
279288
.dpcm_playback = 1,
280289
.ops = &acp3x_max_play_ops,
281-
SND_SOC_DAILINK_REG(acp3x_bt, max, platform),
290+
.cpus = acp3x_bt,
291+
.num_cpus = ARRAY_SIZE(acp3x_bt),
292+
.platforms = platform,
293+
.num_platforms = ARRAY_SIZE(platform),
282294
},
283-
{
295+
[EC] = {
284296
.name = "acp3x-ec-dmic0-capture",
285297
.stream_name = "Capture DMIC0",
286298
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
@@ -390,6 +402,18 @@ void *soc_is_rltk_max(struct device *dev)
390402
return (void *)match->driver_data;
391403
}
392404

405+
static void card_spk_dai_link_present(struct snd_soc_dai_link *links,
406+
const char *card_name)
407+
{
408+
if (!strcmp(card_name, "acp3xalc56821015")) {
409+
links[1].codecs = rt1015;
410+
links[1].num_codecs = ARRAY_SIZE(rt1015);
411+
} else {
412+
links[1].codecs = max;
413+
links[1].num_codecs = ARRAY_SIZE(max);
414+
}
415+
}
416+
393417
static int acp3x_probe(struct platform_device *pdev)
394418
{
395419
int ret;
@@ -405,6 +429,7 @@ static int acp3x_probe(struct platform_device *pdev)
405429
if (!machine)
406430
return -ENOMEM;
407431

432+
card_spk_dai_link_present(card->dai_link, card->name);
408433
card->dev = &pdev->dev;
409434
platform_set_drvdata(pdev, card);
410435
snd_soc_card_set_drvdata(card, machine);

0 commit comments

Comments
 (0)