FILE
sof_realtek_common.c
File preview with syntax highlighting.
linux-6.19.14/sound/soc/intel/boards/sof_realtek_common.c
1// SPDX-License-Identifier: GPL-2.0-only 2// 3// Copyright(c) 2020 Intel Corporation 4 5#include <linux/device.h> 6#include <linux/kernel.h> 7#include <sound/pcm.h> 8#include <sound/pcm_params.h> 9#include <sound/soc.h> 10#include <sound/soc-acpi.h> 11#include <sound/soc-dai.h> 12#include <sound/soc-dapm.h> 13#include <sound/sof.h> 14#include <uapi/sound/asound.h> 15#include "../../codecs/rt1011.h" 16#include "../../codecs/rt1015.h" 17#include "../../codecs/rt1308.h" 18#include "../common/soc-intel-quirks.h" 19#include "sof_realtek_common.h" 20 21/* 22 * Common structures and functions 23 */ 24static const struct snd_kcontrol_new realtek_2spk_kcontrols[] = { 25 SOC_DAPM_PIN_SWITCH("Left Spk"), 26 SOC_DAPM_PIN_SWITCH("Right Spk"), 27 28}; 29 30static const struct snd_soc_dapm_widget realtek_2spk_widgets[] = { 31 SND_SOC_DAPM_SPK("Left Spk", NULL), 32 SND_SOC_DAPM_SPK("Right Spk", NULL), 33}; 34 35static const struct snd_kcontrol_new realtek_4spk_kcontrols[] = { 36 SOC_DAPM_PIN_SWITCH("WL Ext Spk"), 37 SOC_DAPM_PIN_SWITCH("WR Ext Spk"), 38 SOC_DAPM_PIN_SWITCH("TL Ext Spk"), 39 SOC_DAPM_PIN_SWITCH("TR Ext Spk"), 40}; 41 42static const struct snd_soc_dapm_widget realtek_4spk_widgets[] = { 43 SND_SOC_DAPM_SPK("WL Ext Spk", NULL), 44 SND_SOC_DAPM_SPK("WR Ext Spk", NULL), 45 SND_SOC_DAPM_SPK("TL Ext Spk", NULL), 46 SND_SOC_DAPM_SPK("TR Ext Spk", NULL), 47}; 48 49/* helper function to get the number of specific codec */ 50static unsigned int get_num_codecs(const char *hid) 51{ 52 struct acpi_device *adev; 53 unsigned int dev_num = 0; 54 55 for_each_acpi_dev_match(adev, hid, NULL, -1) 56 dev_num++; 57 58 return dev_num; 59} 60 61/* 62 * Realtek ALC1011 63 */ 64static const struct snd_soc_dapm_route speaker_map_lr[] = { 65 /* speaker */ 66 { "Left Spk", NULL, "Left SPO" }, 67 { "Right Spk", NULL, "Right SPO" }, 68}; 69 70static const struct snd_soc_dapm_route rt1011_4spk_routes[] = { 71 {"WL Ext Spk", NULL, "WL SPO" }, 72 {"WR Ext Spk", NULL, "WR SPO" }, 73 {"TL Ext Spk", NULL, "TL SPO" }, 74 {"TR Ext Spk", NULL, "TR SPO" }, 75}; 76 77static struct snd_soc_codec_conf rt1011_2spk_codec_confs[] = { 78 { 79 .dlc = COMP_CODEC_CONF(RT1011_DEV0_NAME), 80 .name_prefix = "Left", 81 }, 82 { 83 .dlc = COMP_CODEC_CONF(RT1011_DEV1_NAME), 84 .name_prefix = "Right", 85 }, 86}; 87 88static struct snd_soc_codec_conf rt1011_4spk_codec_confs[] = { 89 { 90 .dlc = COMP_CODEC_CONF(RT1011_DEV0_NAME), 91 .name_prefix = "WL", 92 }, 93 { 94 .dlc = COMP_CODEC_CONF(RT1011_DEV1_NAME), 95 .name_prefix = "WR", 96 }, 97 { 98 .dlc = COMP_CODEC_CONF(RT1011_DEV2_NAME), 99 .name_prefix = "TL", 100 }, 101 { 102 .dlc = COMP_CODEC_CONF(RT1011_DEV3_NAME), 103 .name_prefix = "TR", 104 }, 105}; 106 107static struct snd_soc_dai_link_component rt1011_dai_link_components[] = { 108 { 109 .name = RT1011_DEV0_NAME, 110 .dai_name = RT1011_CODEC_DAI, 111 }, 112 { 113 .name = RT1011_DEV1_NAME, 114 .dai_name = RT1011_CODEC_DAI, 115 }, 116 { 117 .name = RT1011_DEV2_NAME, 118 .dai_name = RT1011_CODEC_DAI, 119 }, 120 { 121 .name = RT1011_DEV3_NAME, 122 .dai_name = RT1011_CODEC_DAI, 123 }, 124}; 125 126static const struct { 127 unsigned int tx; 128 unsigned int rx; 129} rt1011_tdm_mask[] = { 130 {.tx = 0x4, .rx = 0x1}, 131 {.tx = 0x8, .rx = 0x2}, 132 {.tx = 0x1, .rx = 0x1}, 133 {.tx = 0x2, .rx = 0x2}, 134}; 135 136static int rt1011_hw_params(struct snd_pcm_substream *substream, 137 struct snd_pcm_hw_params *params) 138{ 139 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 140 struct snd_soc_dai *codec_dai; 141 int srate, i, ret = 0; 142 143 srate = params_rate(params); 144 145 for_each_rtd_codec_dais(rtd, i, codec_dai) { 146 /* 100 Fs to drive 24 bit data */ 147 ret = snd_soc_dai_set_pll(codec_dai, 0, RT1011_PLL1_S_BCLK, 148 100 * srate, 256 * srate); 149 if (ret < 0) { 150 dev_err(codec_dai->dev, "fail to set pll, ret %d\n", 151 ret); 152 return ret; 153 } 154 155 ret = snd_soc_dai_set_sysclk(codec_dai, RT1011_FS_SYS_PRE_S_PLL1, 156 256 * srate, SND_SOC_CLOCK_IN); 157 if (ret < 0) { 158 dev_err(codec_dai->dev, "fail to set sysclk, ret %d\n", 159 ret); 160 return ret; 161 } 162 163 if (i >= ARRAY_SIZE(rt1011_tdm_mask)) { 164 dev_err(codec_dai->dev, "invalid codec index %d\n", 165 i); 166 return -ENODEV; 167 } 168 169 ret = snd_soc_dai_set_tdm_slot(codec_dai, rt1011_tdm_mask[i].tx, 170 rt1011_tdm_mask[i].rx, 4, 171 params_width(params)); 172 if (ret < 0) { 173 dev_err(codec_dai->dev, "fail to set tdm slot, ret %d\n", 174 ret); 175 return ret; 176 } 177 } 178 179 return 0; 180} 181 182static const struct snd_soc_ops rt1011_ops = { 183 .hw_params = rt1011_hw_params, 184}; 185 186static int rt1011_init(struct snd_soc_pcm_runtime *rtd) 187{ 188 struct snd_soc_card *card = rtd->card; 189 struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); 190 unsigned int num_codecs = get_num_codecs(RT1011_ACPI_HID); 191 int ret; 192 193 switch (num_codecs) { 194 case 2: 195 if (!soc_intel_is_cml()) { 196 ret = snd_soc_dapm_new_controls(dapm, realtek_2spk_widgets, 197 ARRAY_SIZE(realtek_2spk_widgets)); 198 if (ret) { 199 dev_err(rtd->dev, "fail to add rt1011 widgets, ret %d\n", 200 ret); 201 return ret; 202 } 203 204 ret = snd_soc_add_card_controls(card, realtek_2spk_kcontrols, 205 ARRAY_SIZE(realtek_2spk_kcontrols)); 206 if (ret) { 207 dev_err(rtd->dev, "fail to add rt1011 kcontrols, ret %d\n", 208 ret); 209 return ret; 210 } 211 212 ret = snd_soc_dapm_add_routes(dapm, speaker_map_lr, 213 ARRAY_SIZE(speaker_map_lr)); 214 if (ret) { 215 dev_err(rtd->dev, "fail to add rt1011 routes, ret %d\n", 216 ret); 217 return ret; 218 } 219 220 break; 221 } 222 223 /* 224 * register speaker widgets "WL Ext Spk" and "WR Ext Spk" to 225 * keep backward compatible with cml devices 226 */ 227 fallthrough; 228 case 4: 229 ret = snd_soc_dapm_new_controls(dapm, realtek_4spk_widgets, num_codecs); 230 if (ret) { 231 dev_err(rtd->dev, "fail to add rt1011 widgets, ret %d\n", 232 ret); 233 return ret; 234 } 235 236 ret = snd_soc_add_card_controls(card, realtek_4spk_kcontrols, num_codecs); 237 if (ret) { 238 dev_err(rtd->dev, "fail to add rt1011 controls, ret %d\n", 239 ret); 240 return ret; 241 } 242 243 ret = snd_soc_dapm_add_routes(dapm, rt1011_4spk_routes, num_codecs); 244 if (ret) { 245 dev_err(rtd->dev, "fail to add rt1011 routes, ret %d\n", 246 ret); 247 return ret; 248 } 249 break; 250 default: 251 dev_err(rtd->dev, "rt1011: invalid num_codecs %d\n", num_codecs); 252 return -EINVAL; 253 } 254 255 return ret; 256} 257 258void sof_rt1011_dai_link(struct device *dev, struct snd_soc_dai_link *link) 259{ 260 unsigned int num_codecs = get_num_codecs(RT1011_ACPI_HID); 261 262 link->codecs = rt1011_dai_link_components; 263 264 switch (num_codecs) { 265 case 2: 266 case 4: 267 link->num_codecs = num_codecs; 268 break; 269 default: 270 dev_err(dev, "rt1011: invalid num_codecs %d\n", num_codecs); 271 break; 272 } 273 274 link->init = rt1011_init; 275 link->ops = &rt1011_ops; 276} 277EXPORT_SYMBOL_NS(sof_rt1011_dai_link, "SND_SOC_INTEL_SOF_REALTEK_COMMON"); 278 279void sof_rt1011_codec_conf(struct device *dev, struct snd_soc_card *card) 280{ 281 unsigned int num_codecs = get_num_codecs(RT1011_ACPI_HID); 282 283 switch (num_codecs) { 284 case 2: 285 if (soc_intel_is_cml()) { 286 /* 287 * use name prefix 'WL' and 'WR' for speaker widgets to 288 * keep backward compatible with cml devices 289 */ 290 card->codec_conf = rt1011_4spk_codec_confs; 291 } else { 292 card->codec_conf = rt1011_2spk_codec_confs; 293 } 294 295 card->num_configs = num_codecs; 296 break; 297 case 4: 298 card->codec_conf = rt1011_4spk_codec_confs; 299 card->num_configs = ARRAY_SIZE(rt1011_4spk_codec_confs); 300 break; 301 default: 302 dev_err(dev, "rt1011: invalid num_codecs %d\n", num_codecs); 303 break; 304 } 305 306} 307EXPORT_SYMBOL_NS(sof_rt1011_codec_conf, "SND_SOC_INTEL_SOF_REALTEK_COMMON"); 308 309/* 310 * rt1015: i2c mode driver for ALC1015 and ALC1015Q 311 * rt1015p: auto-mode driver for ALC1015, ALC1015Q, and ALC1015Q-VB 312 * 313 * For stereo output, there are always two amplifiers on the board. 314 * However, the ACPI implements only one device instance (UID=0) if they 315 * are sharing the same enable pin. This is the case of rt1015p. 316 */ 317static const struct snd_soc_dapm_route rt1015p_dapm_routes[] = { 318 /* speaker */ 319 { "Left Spk", NULL, "Speaker" }, 320 { "Right Spk", NULL, "Speaker" }, 321}; 322 323static struct snd_soc_dai_link_component rt1015p_dai_link_components[] = { 324 { 325 .name = RT1015P_DEV0_NAME, 326 .dai_name = RT1015P_CODEC_DAI, 327 }, 328}; 329 330static int rt1015p_hw_params(struct snd_pcm_substream *substream, 331 struct snd_pcm_hw_params *params) 332{ 333 /* reserved for debugging purpose */ 334 335 return 0; 336} 337 338static const struct snd_soc_ops rt1015p_ops = { 339 .hw_params = rt1015p_hw_params, 340}; 341 342static int rt1015p_init(struct snd_soc_pcm_runtime *rtd) 343{ 344 struct snd_soc_card *card = rtd->card; 345 struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); 346 int ret; 347 348 ret = snd_soc_dapm_new_controls(dapm, realtek_2spk_widgets, 349 ARRAY_SIZE(realtek_2spk_widgets)); 350 if (ret) { 351 dev_err(rtd->dev, "fail to add rt1015p widgets, ret %d\n", ret); 352 return ret; 353 } 354 355 ret = snd_soc_add_card_controls(card, realtek_2spk_kcontrols, 356 ARRAY_SIZE(realtek_2spk_kcontrols)); 357 if (ret) { 358 dev_err(rtd->dev, "fail to add rt1015p kcontrols, ret %d\n", ret); 359 return ret; 360 } 361 362 ret = snd_soc_dapm_add_routes(dapm, rt1015p_dapm_routes, 363 ARRAY_SIZE(rt1015p_dapm_routes)); 364 if (ret) 365 dev_err(rtd->dev, "Speaker map addition failed: %d\n", ret); 366 return ret; 367} 368 369void sof_rt1015p_dai_link(struct snd_soc_dai_link *link) 370{ 371 link->codecs = rt1015p_dai_link_components; 372 link->num_codecs = ARRAY_SIZE(rt1015p_dai_link_components); 373 link->init = rt1015p_init; 374 link->ops = &rt1015p_ops; 375} 376EXPORT_SYMBOL_NS(sof_rt1015p_dai_link, "SND_SOC_INTEL_SOF_REALTEK_COMMON"); 377 378void sof_rt1015p_codec_conf(struct snd_soc_card *card) 379{ 380} 381EXPORT_SYMBOL_NS(sof_rt1015p_codec_conf, "SND_SOC_INTEL_SOF_REALTEK_COMMON"); 382 383/* 384 * RT1015 audio amplifier 385 */ 386 387static const struct { 388 unsigned int tx; 389 unsigned int rx; 390} rt1015_tdm_mask[] = { 391 {.tx = 0x0, .rx = 0x1}, 392 {.tx = 0x0, .rx = 0x2}, 393}; 394 395static int rt1015_hw_params(struct snd_pcm_substream *substream, 396 struct snd_pcm_hw_params *params) 397{ 398 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 399 struct snd_soc_dai_link *dai_link = rtd->dai_link; 400 struct snd_soc_dai *codec_dai; 401 int i, clk_freq; 402 int ret = 0; 403 404 clk_freq = sof_dai_get_bclk(rtd); 405 406 if (clk_freq <= 0) { 407 dev_err(rtd->dev, "fail to get bclk freq, ret %d\n", clk_freq); 408 return -EINVAL; 409 } 410 411 for_each_rtd_codec_dais(rtd, i, codec_dai) { 412 ret = snd_soc_dai_set_pll(codec_dai, 0, RT1015_PLL_S_BCLK, 413 clk_freq, 414 params_rate(params) * 256); 415 if (ret) { 416 dev_err(codec_dai->dev, "fail to set pll, ret %d\n", 417 ret); 418 return ret; 419 } 420 421 ret = snd_soc_dai_set_sysclk(codec_dai, RT1015_SCLK_S_PLL, 422 params_rate(params) * 256, 423 SND_SOC_CLOCK_IN); 424 if (ret) { 425 dev_err(codec_dai->dev, "fail to set sysclk, ret %d\n", 426 ret); 427 return ret; 428 } 429 430 switch (dai_link->dai_fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 431 case SND_SOC_DAIFMT_DSP_A: 432 case SND_SOC_DAIFMT_DSP_B: 433 /* 4-slot TDM */ 434 ret = snd_soc_dai_set_tdm_slot(codec_dai, 435 rt1015_tdm_mask[i].tx, 436 rt1015_tdm_mask[i].rx, 437 4, 438 params_width(params)); 439 if (ret < 0) { 440 dev_err(codec_dai->dev, "fail to set tdm slot, ret %d\n", 441 ret); 442 return ret; 443 } 444 break; 445 default: 446 dev_dbg(codec_dai->dev, "codec is in I2S mode\n"); 447 break; 448 } 449 } 450 451 return ret; 452} 453 454static const struct snd_soc_ops rt1015_ops = { 455 .hw_params = rt1015_hw_params, 456}; 457 458static struct snd_soc_codec_conf rt1015_amp_conf[] = { 459 { 460 .dlc = COMP_CODEC_CONF(RT1015_DEV0_NAME), 461 .name_prefix = "Left", 462 }, 463 { 464 .dlc = COMP_CODEC_CONF(RT1015_DEV1_NAME), 465 .name_prefix = "Right", 466 }, 467}; 468 469static struct snd_soc_dai_link_component rt1015_components[] = { 470 { 471 .name = RT1015_DEV0_NAME, 472 .dai_name = RT1015_CODEC_DAI, 473 }, 474 { 475 .name = RT1015_DEV1_NAME, 476 .dai_name = RT1015_CODEC_DAI, 477 }, 478}; 479 480static int speaker_codec_init_lr(struct snd_soc_pcm_runtime *rtd) 481{ 482 struct snd_soc_card *card = rtd->card; 483 struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); 484 unsigned int num_codecs = get_num_codecs(RT1015_ACPI_HID); 485 int ret; 486 487 switch (num_codecs) { 488 case 2: 489 ret = snd_soc_dapm_new_controls(dapm, realtek_2spk_widgets, 490 ARRAY_SIZE(realtek_2spk_widgets)); 491 if (ret) { 492 dev_err(rtd->dev, "fail to add rt1015 widgets, ret %d\n", 493 ret); 494 return ret; 495 } 496 497 ret = snd_soc_add_card_controls(card, realtek_2spk_kcontrols, 498 ARRAY_SIZE(realtek_2spk_kcontrols)); 499 if (ret) { 500 dev_err(rtd->dev, "fail to add rt1015 kcontrols, ret %d\n", 501 ret); 502 return ret; 503 } 504 505 ret = snd_soc_dapm_add_routes(dapm, speaker_map_lr, 506 ARRAY_SIZE(speaker_map_lr)); 507 if (ret) { 508 dev_err(rtd->dev, "fail to add rt1015 routes, ret %d\n", 509 ret); 510 return ret; 511 } 512 break; 513 default: 514 dev_err(rtd->dev, "rt1015: invalid num_codecs %d\n", num_codecs); 515 return -EINVAL; 516 } 517 518 return ret; 519} 520 521void sof_rt1015_codec_conf(struct snd_soc_card *card) 522{ 523 card->codec_conf = rt1015_amp_conf; 524 card->num_configs = ARRAY_SIZE(rt1015_amp_conf); 525} 526EXPORT_SYMBOL_NS(sof_rt1015_codec_conf, "SND_SOC_INTEL_SOF_REALTEK_COMMON"); 527 528void sof_rt1015_dai_link(struct snd_soc_dai_link *link) 529{ 530 link->codecs = rt1015_components; 531 link->num_codecs = ARRAY_SIZE(rt1015_components); 532 link->init = speaker_codec_init_lr; 533 link->ops = &rt1015_ops; 534} 535EXPORT_SYMBOL_NS(sof_rt1015_dai_link, "SND_SOC_INTEL_SOF_REALTEK_COMMON"); 536 537/* 538 * RT1308 audio amplifier 539 */ 540static const struct snd_kcontrol_new rt1308_kcontrols[] = { 541 SOC_DAPM_PIN_SWITCH("Speakers"), 542}; 543 544static const struct snd_soc_dapm_widget rt1308_dapm_widgets[] = { 545 SND_SOC_DAPM_SPK("Speakers", NULL), 546}; 547 548static const struct snd_soc_dapm_route rt1308_dapm_routes[] = { 549 /* speaker */ 550 {"Speakers", NULL, "SPOL"}, 551 {"Speakers", NULL, "SPOR"}, 552}; 553 554static struct snd_soc_dai_link_component rt1308_components[] = { 555 { 556 .name = RT1308_DEV0_NAME, 557 .dai_name = RT1308_CODEC_DAI, 558 } 559}; 560 561static int rt1308_init(struct snd_soc_pcm_runtime *rtd) 562{ 563 struct snd_soc_card *card = rtd->card; 564 struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); 565 int ret; 566 567 ret = snd_soc_dapm_new_controls(dapm, rt1308_dapm_widgets, 568 ARRAY_SIZE(rt1308_dapm_widgets)); 569 if (ret) { 570 dev_err(rtd->dev, "fail to add dapm controls, ret %d\n", ret); 571 return ret; 572 } 573 574 ret = snd_soc_add_card_controls(card, rt1308_kcontrols, 575 ARRAY_SIZE(rt1308_kcontrols)); 576 if (ret) { 577 dev_err(rtd->dev, "fail to add card controls, ret %d\n", ret); 578 return ret; 579 } 580 581 ret = snd_soc_dapm_add_routes(dapm, rt1308_dapm_routes, 582 ARRAY_SIZE(rt1308_dapm_routes)); 583 584 if (ret) 585 dev_err(rtd->dev, "fail to add dapm routes, ret %d\n", ret); 586 587 return ret; 588} 589 590static int rt1308_hw_params(struct snd_pcm_substream *substream, 591 struct snd_pcm_hw_params *params) 592{ 593 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 594 struct snd_soc_card *card = rtd->card; 595 struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); 596 int clk_id, clk_freq, pll_out; 597 int ret; 598 599 clk_id = RT1308_PLL_S_MCLK; 600 /* get the tplg configured mclk. */ 601 clk_freq = sof_dai_get_mclk(rtd); 602 603 pll_out = params_rate(params) * 512; 604 605 /* Set rt1308 pll */ 606 ret = snd_soc_dai_set_pll(codec_dai, 0, clk_id, clk_freq, pll_out); 607 if (ret < 0) { 608 dev_err(card->dev, "Failed to set RT1308 PLL: %d\n", ret); 609 return ret; 610 } 611 612 /* Set rt1308 sysclk */ 613 ret = snd_soc_dai_set_sysclk(codec_dai, RT1308_FS_SYS_S_PLL, pll_out, 614 SND_SOC_CLOCK_IN); 615 if (ret < 0) 616 dev_err(card->dev, "Failed to set RT1308 SYSCLK: %d\n", ret); 617 618 return ret; 619} 620 621static const struct snd_soc_ops rt1308_ops = { 622 .hw_params = rt1308_hw_params, 623}; 624 625void sof_rt1308_dai_link(struct snd_soc_dai_link *link) 626{ 627 link->codecs = rt1308_components; 628 link->num_codecs = ARRAY_SIZE(rt1308_components); 629 link->init = rt1308_init; 630 link->ops = &rt1308_ops; 631} 632EXPORT_SYMBOL_NS(sof_rt1308_dai_link, "SND_SOC_INTEL_SOF_REALTEK_COMMON"); 633 634/* 635 * 2-amp Configuration for RT1019 636 */ 637 638static const struct snd_soc_dapm_route rt1019p_dapm_routes[] = { 639 /* speaker */ 640 { "Left Spk", NULL, "Speaker" }, 641 { "Right Spk", NULL, "Speaker" }, 642}; 643 644static struct snd_soc_dai_link_component rt1019p_components[] = { 645 { 646 .name = RT1019P_DEV0_NAME, 647 .dai_name = RT1019P_CODEC_DAI, 648 }, 649}; 650 651static int rt1019p_init(struct snd_soc_pcm_runtime *rtd) 652{ 653 struct snd_soc_card *card = rtd->card; 654 struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); 655 int ret; 656 657 ret = snd_soc_dapm_new_controls(dapm, realtek_2spk_widgets, 658 ARRAY_SIZE(realtek_2spk_widgets)); 659 if (ret) { 660 dev_err(rtd->dev, "fail to add rt1019p widgets, ret %d\n", ret); 661 return ret; 662 } 663 664 ret = snd_soc_add_card_controls(card, realtek_2spk_kcontrols, 665 ARRAY_SIZE(realtek_2spk_kcontrols)); 666 if (ret) { 667 dev_err(rtd->dev, "fail to add rt1019p kcontrols, ret %d\n", ret); 668 return ret; 669 } 670 671 ret = snd_soc_dapm_add_routes(dapm, rt1019p_dapm_routes, 672 ARRAY_SIZE(rt1019p_dapm_routes)); 673 if (ret) { 674 dev_err(rtd->dev, "Speaker map addition failed: %d\n", ret); 675 return ret; 676 } 677 return ret; 678} 679 680void sof_rt1019p_dai_link(struct snd_soc_dai_link *link) 681{ 682 link->codecs = rt1019p_components; 683 link->num_codecs = ARRAY_SIZE(rt1019p_components); 684 link->init = rt1019p_init; 685} 686EXPORT_SYMBOL_NS(sof_rt1019p_dai_link, "SND_SOC_INTEL_SOF_REALTEK_COMMON"); 687 688MODULE_DESCRIPTION("ASoC Intel SOF Realtek helpers"); 689MODULE_LICENSE("GPL");
~/
Read-only file preview.