| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * cht-bsw-rt5645.c - ASoc Machine driver for Intel Cherryview-based platforms |
|---|
| 3 | 4 | * Cherrytrail and Braswell, with RT5645 codec. |
|---|
| .. | .. |
|---|
| 8 | 9 | * This file is modified from cht_bsw_rt5672.c |
|---|
| 9 | 10 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 10 | 11 | * |
|---|
| 11 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 12 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 13 | | - * the Free Software Foundation; version 2 of the License. |
|---|
| 14 | | - * |
|---|
| 15 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 16 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 17 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 18 | | - * General Public License for more details. |
|---|
| 19 | | - * |
|---|
| 20 | 12 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 21 | 13 | */ |
|---|
| 22 | 14 | |
|---|
| .. | .. |
|---|
| 26 | 18 | #include <linux/clk.h> |
|---|
| 27 | 19 | #include <linux/dmi.h> |
|---|
| 28 | 20 | #include <linux/slab.h> |
|---|
| 29 | | -#include <asm/cpu_device_id.h> |
|---|
| 30 | | -#include <asm/platform_sst_audio.h> |
|---|
| 31 | 21 | #include <sound/pcm.h> |
|---|
| 32 | 22 | #include <sound/pcm_params.h> |
|---|
| 33 | 23 | #include <sound/soc.h> |
|---|
| .. | .. |
|---|
| 35 | 25 | #include <sound/soc-acpi.h> |
|---|
| 36 | 26 | #include "../../codecs/rt5645.h" |
|---|
| 37 | 27 | #include "../atom/sst-atom-controls.h" |
|---|
| 28 | +#include "../common/soc-intel-quirks.h" |
|---|
| 38 | 29 | |
|---|
| 39 | 30 | #define CHT_PLAT_CLK_3_HZ 19200000 |
|---|
| 40 | 31 | #define CHT_CODEC_DAI1 "rt5645-aif1" |
|---|
| .. | .. |
|---|
| 57 | 48 | #define CHT_RT5645_SSP2_AIF2 BIT(16) /* default is using AIF1 */ |
|---|
| 58 | 49 | #define CHT_RT5645_SSP0_AIF1 BIT(17) |
|---|
| 59 | 50 | #define CHT_RT5645_SSP0_AIF2 BIT(18) |
|---|
| 51 | +#define CHT_RT5645_PMC_PLT_CLK_0 BIT(19) |
|---|
| 60 | 52 | |
|---|
| 61 | 53 | static unsigned long cht_rt5645_quirk = 0; |
|---|
| 62 | 54 | |
|---|
| .. | .. |
|---|
| 68 | 60 | dev_info(dev, "quirk SSP0_AIF1 enabled"); |
|---|
| 69 | 61 | if (cht_rt5645_quirk & CHT_RT5645_SSP0_AIF2) |
|---|
| 70 | 62 | dev_info(dev, "quirk SSP0_AIF2 enabled"); |
|---|
| 63 | + if (cht_rt5645_quirk & CHT_RT5645_PMC_PLT_CLK_0) |
|---|
| 64 | + dev_info(dev, "quirk PMC_PLT_CLK_0 enabled"); |
|---|
| 71 | 65 | } |
|---|
| 72 | 66 | |
|---|
| 73 | 67 | static int platform_clock_control(struct snd_soc_dapm_widget *w, |
|---|
| .. | .. |
|---|
| 213 | 207 | static int cht_aif1_hw_params(struct snd_pcm_substream *substream, |
|---|
| 214 | 208 | struct snd_pcm_hw_params *params) |
|---|
| 215 | 209 | { |
|---|
| 216 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
|---|
| 217 | | - struct snd_soc_dai *codec_dai = rtd->codec_dai; |
|---|
| 210 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
|---|
| 211 | + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); |
|---|
| 218 | 212 | int ret; |
|---|
| 219 | 213 | |
|---|
| 220 | 214 | /* set codec PLL source to the 19.2MHz platform clock (MCLK) */ |
|---|
| .. | .. |
|---|
| 235 | 229 | return 0; |
|---|
| 236 | 230 | } |
|---|
| 237 | 231 | |
|---|
| 238 | | -/* uncomment when we have a real quirk |
|---|
| 239 | 232 | static int cht_rt5645_quirk_cb(const struct dmi_system_id *id) |
|---|
| 240 | 233 | { |
|---|
| 241 | 234 | cht_rt5645_quirk = (unsigned long)id->driver_data; |
|---|
| 242 | 235 | return 1; |
|---|
| 243 | 236 | } |
|---|
| 244 | | -*/ |
|---|
| 245 | 237 | |
|---|
| 246 | 238 | static const struct dmi_system_id cht_rt5645_quirk_table[] = { |
|---|
| 239 | + { |
|---|
| 240 | + /* Strago family Chromebooks */ |
|---|
| 241 | + .callback = cht_rt5645_quirk_cb, |
|---|
| 242 | + .matches = { |
|---|
| 243 | + DMI_MATCH(DMI_PRODUCT_FAMILY, "Intel_Strago"), |
|---|
| 244 | + }, |
|---|
| 245 | + .driver_data = (void *)CHT_RT5645_PMC_PLT_CLK_0, |
|---|
| 246 | + }, |
|---|
| 247 | 247 | { |
|---|
| 248 | 248 | }, |
|---|
| 249 | 249 | }; |
|---|
| .. | .. |
|---|
| 252 | 252 | { |
|---|
| 253 | 253 | struct snd_soc_card *card = runtime->card; |
|---|
| 254 | 254 | struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card); |
|---|
| 255 | | - struct snd_soc_component *component = runtime->codec_dai->component; |
|---|
| 255 | + struct snd_soc_component *component = asoc_rtd_to_codec(runtime, 0)->component; |
|---|
| 256 | 256 | int jack_type; |
|---|
| 257 | 257 | int ret; |
|---|
| 258 | 258 | |
|---|
| .. | .. |
|---|
| 359 | 359 | * with explicit setting to I2S 2ch 16-bit. The word length is set with |
|---|
| 360 | 360 | * dai_set_tdm_slot() since there is no other API exposed |
|---|
| 361 | 361 | */ |
|---|
| 362 | | - ret = snd_soc_dai_set_fmt(rtd->cpu_dai, |
|---|
| 362 | + ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0), |
|---|
| 363 | 363 | SND_SOC_DAIFMT_I2S | |
|---|
| 364 | 364 | SND_SOC_DAIFMT_NB_NF | |
|---|
| 365 | 365 | SND_SOC_DAIFMT_CBS_CFS |
|---|
| .. | .. |
|---|
| 369 | 369 | return ret; |
|---|
| 370 | 370 | } |
|---|
| 371 | 371 | |
|---|
| 372 | | - ret = snd_soc_dai_set_fmt(rtd->codec_dai, |
|---|
| 372 | + ret = snd_soc_dai_set_fmt(asoc_rtd_to_codec(rtd, 0), |
|---|
| 373 | 373 | SND_SOC_DAIFMT_I2S | |
|---|
| 374 | 374 | SND_SOC_DAIFMT_NB_NF | |
|---|
| 375 | 375 | SND_SOC_DAIFMT_CBS_CFS |
|---|
| .. | .. |
|---|
| 379 | 379 | return ret; |
|---|
| 380 | 380 | } |
|---|
| 381 | 381 | |
|---|
| 382 | | - ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, 16); |
|---|
| 382 | + ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd, 0), 0x3, 0x3, 2, 16); |
|---|
| 383 | 383 | if (ret < 0) { |
|---|
| 384 | 384 | dev_err(rtd->dev, "can't set I2S config, err %d\n", ret); |
|---|
| 385 | 385 | return ret; |
|---|
| .. | .. |
|---|
| 393 | 393 | /* |
|---|
| 394 | 394 | * Default mode for SSP configuration is TDM 4 slot |
|---|
| 395 | 395 | */ |
|---|
| 396 | | - ret = snd_soc_dai_set_fmt(rtd->codec_dai, |
|---|
| 396 | + ret = snd_soc_dai_set_fmt(asoc_rtd_to_codec(rtd, 0), |
|---|
| 397 | 397 | SND_SOC_DAIFMT_DSP_B | |
|---|
| 398 | 398 | SND_SOC_DAIFMT_IB_NF | |
|---|
| 399 | 399 | SND_SOC_DAIFMT_CBS_CFS); |
|---|
| .. | .. |
|---|
| 403 | 403 | } |
|---|
| 404 | 404 | |
|---|
| 405 | 405 | /* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */ |
|---|
| 406 | | - ret = snd_soc_dai_set_tdm_slot(rtd->codec_dai, 0xF, 0xF, 4, 24); |
|---|
| 406 | + ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_codec(rtd, 0), 0xF, 0xF, 4, 24); |
|---|
| 407 | 407 | if (ret < 0) { |
|---|
| 408 | 408 | dev_err(rtd->dev, "can't set codec TDM slot %d\n", ret); |
|---|
| 409 | 409 | return ret; |
|---|
| .. | .. |
|---|
| 426 | 426 | .hw_params = cht_aif1_hw_params, |
|---|
| 427 | 427 | }; |
|---|
| 428 | 428 | |
|---|
| 429 | +SND_SOC_DAILINK_DEF(dummy, |
|---|
| 430 | + DAILINK_COMP_ARRAY(COMP_DUMMY())); |
|---|
| 431 | + |
|---|
| 432 | +SND_SOC_DAILINK_DEF(media, |
|---|
| 433 | + DAILINK_COMP_ARRAY(COMP_CPU("media-cpu-dai"))); |
|---|
| 434 | + |
|---|
| 435 | +SND_SOC_DAILINK_DEF(deepbuffer, |
|---|
| 436 | + DAILINK_COMP_ARRAY(COMP_CPU("deepbuffer-cpu-dai"))); |
|---|
| 437 | + |
|---|
| 438 | +SND_SOC_DAILINK_DEF(ssp2_port, |
|---|
| 439 | + DAILINK_COMP_ARRAY(COMP_CPU("ssp2-port"))); |
|---|
| 440 | +SND_SOC_DAILINK_DEF(ssp2_codec, |
|---|
| 441 | + DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC5645:00", "rt5645-aif1"))); |
|---|
| 442 | + |
|---|
| 443 | +SND_SOC_DAILINK_DEF(platform, |
|---|
| 444 | + DAILINK_COMP_ARRAY(COMP_PLATFORM("sst-mfld-platform"))); |
|---|
| 445 | + |
|---|
| 429 | 446 | static struct snd_soc_dai_link cht_dailink[] = { |
|---|
| 430 | 447 | [MERR_DPCM_AUDIO] = { |
|---|
| 431 | 448 | .name = "Audio Port", |
|---|
| 432 | 449 | .stream_name = "Audio", |
|---|
| 433 | | - .cpu_dai_name = "media-cpu-dai", |
|---|
| 434 | | - .codec_dai_name = "snd-soc-dummy-dai", |
|---|
| 435 | | - .codec_name = "snd-soc-dummy", |
|---|
| 436 | | - .platform_name = "sst-mfld-platform", |
|---|
| 437 | 450 | .nonatomic = true, |
|---|
| 438 | 451 | .dynamic = 1, |
|---|
| 439 | 452 | .dpcm_playback = 1, |
|---|
| 440 | 453 | .dpcm_capture = 1, |
|---|
| 441 | 454 | .ops = &cht_aif1_ops, |
|---|
| 455 | + SND_SOC_DAILINK_REG(media, dummy, platform), |
|---|
| 442 | 456 | }, |
|---|
| 443 | 457 | [MERR_DPCM_DEEP_BUFFER] = { |
|---|
| 444 | 458 | .name = "Deep-Buffer Audio Port", |
|---|
| 445 | 459 | .stream_name = "Deep-Buffer Audio", |
|---|
| 446 | | - .cpu_dai_name = "deepbuffer-cpu-dai", |
|---|
| 447 | | - .codec_dai_name = "snd-soc-dummy-dai", |
|---|
| 448 | | - .codec_name = "snd-soc-dummy", |
|---|
| 449 | | - .platform_name = "sst-mfld-platform", |
|---|
| 450 | 460 | .nonatomic = true, |
|---|
| 451 | 461 | .dynamic = 1, |
|---|
| 452 | 462 | .dpcm_playback = 1, |
|---|
| 453 | 463 | .ops = &cht_aif1_ops, |
|---|
| 464 | + SND_SOC_DAILINK_REG(deepbuffer, dummy, platform), |
|---|
| 454 | 465 | }, |
|---|
| 455 | 466 | /* CODEC<->CODEC link */ |
|---|
| 456 | 467 | /* back ends */ |
|---|
| 457 | 468 | { |
|---|
| 458 | 469 | .name = "SSP2-Codec", |
|---|
| 459 | 470 | .id = 0, |
|---|
| 460 | | - .cpu_dai_name = "ssp2-port", |
|---|
| 461 | | - .platform_name = "sst-mfld-platform", |
|---|
| 462 | 471 | .no_pcm = 1, |
|---|
| 463 | | - .codec_dai_name = "rt5645-aif1", |
|---|
| 464 | | - .codec_name = "i2c-10EC5645:00", |
|---|
| 465 | 472 | .init = cht_codec_init, |
|---|
| 466 | 473 | .be_hw_params_fixup = cht_codec_fixup, |
|---|
| 467 | 474 | .nonatomic = true, |
|---|
| 468 | 475 | .dpcm_playback = 1, |
|---|
| 469 | 476 | .dpcm_capture = 1, |
|---|
| 470 | 477 | .ops = &cht_be_ssp2_ops, |
|---|
| 478 | + SND_SOC_DAILINK_REG(ssp2_port, ssp2_codec, platform), |
|---|
| 471 | 479 | }, |
|---|
| 472 | 480 | }; |
|---|
| 473 | 481 | |
|---|
| 482 | +#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL) |
|---|
| 483 | +/* use space before codec name to simplify card ID, and simplify driver name */ |
|---|
| 484 | +#define CARD_RT5645_NAME "bytcht rt5645" /* card name 'sof-bytcht rt5645' */ |
|---|
| 485 | +#define CARD_RT5650_NAME "bytcht rt5650" /* card name 'sof-bytcht rt5650' */ |
|---|
| 486 | +#define DRIVER_NAME "SOF" |
|---|
| 487 | +#else |
|---|
| 488 | +#define CARD_RT5645_NAME "chtrt5645" |
|---|
| 489 | +#define CARD_RT5650_NAME "chtrt5650" |
|---|
| 490 | +#define DRIVER_NAME NULL /* card name will be used for driver name */ |
|---|
| 491 | +#endif |
|---|
| 492 | + |
|---|
| 474 | 493 | /* SoC card */ |
|---|
| 475 | 494 | static struct snd_soc_card snd_soc_card_chtrt5645 = { |
|---|
| 476 | | - .name = "chtrt5645", |
|---|
| 495 | + .name = CARD_RT5645_NAME, |
|---|
| 496 | + .driver_name = DRIVER_NAME, |
|---|
| 477 | 497 | .owner = THIS_MODULE, |
|---|
| 478 | 498 | .dai_link = cht_dailink, |
|---|
| 479 | 499 | .num_links = ARRAY_SIZE(cht_dailink), |
|---|
| .. | .. |
|---|
| 486 | 506 | }; |
|---|
| 487 | 507 | |
|---|
| 488 | 508 | static struct snd_soc_card snd_soc_card_chtrt5650 = { |
|---|
| 489 | | - .name = "chtrt5650", |
|---|
| 509 | + .name = CARD_RT5650_NAME, |
|---|
| 510 | + .driver_name = DRIVER_NAME, |
|---|
| 490 | 511 | .owner = THIS_MODULE, |
|---|
| 491 | 512 | .dai_link = cht_dailink, |
|---|
| 492 | 513 | .num_links = ARRAY_SIZE(cht_dailink), |
|---|
| .. | .. |
|---|
| 507 | 528 | }; |
|---|
| 508 | 529 | |
|---|
| 509 | 530 | static char cht_rt5645_codec_name[SND_ACPI_I2C_ID_LEN]; |
|---|
| 510 | | -static char cht_rt5645_codec_aif_name[12]; /* = "rt5645-aif[1|2]" */ |
|---|
| 511 | | -static char cht_rt5645_cpu_dai_name[10]; /* = "ssp[0|2]-port" */ |
|---|
| 512 | | - |
|---|
| 513 | | -static bool is_valleyview(void) |
|---|
| 514 | | -{ |
|---|
| 515 | | - static const struct x86_cpu_id cpu_ids[] = { |
|---|
| 516 | | - { X86_VENDOR_INTEL, 6, 55 }, /* Valleyview, Bay Trail */ |
|---|
| 517 | | - {} |
|---|
| 518 | | - }; |
|---|
| 519 | | - |
|---|
| 520 | | - if (!x86_match_cpu(cpu_ids)) |
|---|
| 521 | | - return false; |
|---|
| 522 | | - return true; |
|---|
| 523 | | -} |
|---|
| 524 | 531 | |
|---|
| 525 | 532 | struct acpi_chan_package { /* ACPICA seems to require 64 bit integers */ |
|---|
| 526 | 533 | u64 aif_value; /* 1: AIF1, 2: AIF2 */ |
|---|
| .. | .. |
|---|
| 531 | 538 | { |
|---|
| 532 | 539 | struct snd_soc_card *card = snd_soc_cards[0].soc_card; |
|---|
| 533 | 540 | struct snd_soc_acpi_mach *mach; |
|---|
| 541 | + const char *platform_name; |
|---|
| 534 | 542 | struct cht_mc_private *drv; |
|---|
| 535 | | - const char *i2c_name = NULL; |
|---|
| 543 | + struct acpi_device *adev; |
|---|
| 536 | 544 | bool found = false; |
|---|
| 537 | 545 | bool is_bytcr = false; |
|---|
| 538 | 546 | int dai_index = 0; |
|---|
| 539 | 547 | int ret_val = 0; |
|---|
| 540 | 548 | int i; |
|---|
| 549 | + const char *mclk_name; |
|---|
| 541 | 550 | |
|---|
| 542 | 551 | drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); |
|---|
| 543 | 552 | if (!drv) |
|---|
| 544 | 553 | return -ENOMEM; |
|---|
| 545 | 554 | |
|---|
| 546 | | - mach = (&pdev->dev)->platform_data; |
|---|
| 555 | + mach = pdev->dev.platform_data; |
|---|
| 547 | 556 | |
|---|
| 548 | 557 | for (i = 0; i < ARRAY_SIZE(snd_soc_cards); i++) { |
|---|
| 549 | 558 | if (acpi_dev_found(snd_soc_cards[i].codec_id) && |
|---|
| .. | .. |
|---|
| 567 | 576 | |
|---|
| 568 | 577 | /* set correct codec name */ |
|---|
| 569 | 578 | for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) |
|---|
| 570 | | - if (!strcmp(card->dai_link[i].codec_name, "i2c-10EC5645:00")) { |
|---|
| 571 | | - card->dai_link[i].codec_name = drv->codec_name; |
|---|
| 579 | + if (!strcmp(card->dai_link[i].codecs->name, |
|---|
| 580 | + "i2c-10EC5645:00")) { |
|---|
| 581 | + card->dai_link[i].codecs->name = drv->codec_name; |
|---|
| 572 | 582 | dai_index = i; |
|---|
| 573 | 583 | } |
|---|
| 574 | 584 | |
|---|
| 575 | 585 | /* fixup codec name based on HID */ |
|---|
| 576 | | - i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1); |
|---|
| 577 | | - if (i2c_name) { |
|---|
| 586 | + adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1); |
|---|
| 587 | + if (adev) { |
|---|
| 578 | 588 | snprintf(cht_rt5645_codec_name, sizeof(cht_rt5645_codec_name), |
|---|
| 579 | | - "%s%s", "i2c-", i2c_name); |
|---|
| 580 | | - cht_dailink[dai_index].codec_name = cht_rt5645_codec_name; |
|---|
| 589 | + "i2c-%s", acpi_dev_name(adev)); |
|---|
| 590 | + put_device(&adev->dev); |
|---|
| 591 | + cht_dailink[dai_index].codecs->name = cht_rt5645_codec_name; |
|---|
| 581 | 592 | } |
|---|
| 582 | 593 | |
|---|
| 583 | 594 | /* |
|---|
| 584 | 595 | * swap SSP0 if bytcr is detected |
|---|
| 585 | 596 | * (will be overridden if DMI quirk is detected) |
|---|
| 586 | 597 | */ |
|---|
| 587 | | - if (is_valleyview()) { |
|---|
| 588 | | - struct sst_platform_info *p_info = mach->pdata; |
|---|
| 589 | | - const struct sst_res_info *res_info = p_info->res_info; |
|---|
| 590 | | - |
|---|
| 591 | | - if (res_info->acpi_ipc_irq_index == 0) |
|---|
| 598 | + if (soc_intel_is_byt()) { |
|---|
| 599 | + if (mach->mach_params.acpi_ipc_irq_index == 0) |
|---|
| 592 | 600 | is_bytcr = true; |
|---|
| 593 | 601 | } |
|---|
| 594 | 602 | |
|---|
| .. | .. |
|---|
| 644 | 652 | log_quirks(&pdev->dev); |
|---|
| 645 | 653 | |
|---|
| 646 | 654 | if ((cht_rt5645_quirk & CHT_RT5645_SSP2_AIF2) || |
|---|
| 647 | | - (cht_rt5645_quirk & CHT_RT5645_SSP0_AIF2)) { |
|---|
| 648 | | - |
|---|
| 649 | | - /* fixup codec aif name */ |
|---|
| 650 | | - snprintf(cht_rt5645_codec_aif_name, |
|---|
| 651 | | - sizeof(cht_rt5645_codec_aif_name), |
|---|
| 652 | | - "%s", "rt5645-aif2"); |
|---|
| 653 | | - |
|---|
| 654 | | - cht_dailink[dai_index].codec_dai_name = |
|---|
| 655 | | - cht_rt5645_codec_aif_name; |
|---|
| 656 | | - } |
|---|
| 655 | + (cht_rt5645_quirk & CHT_RT5645_SSP0_AIF2)) |
|---|
| 656 | + cht_dailink[dai_index].codecs->dai_name = "rt5645-aif2"; |
|---|
| 657 | 657 | |
|---|
| 658 | 658 | if ((cht_rt5645_quirk & CHT_RT5645_SSP0_AIF1) || |
|---|
| 659 | | - (cht_rt5645_quirk & CHT_RT5645_SSP0_AIF2)) { |
|---|
| 659 | + (cht_rt5645_quirk & CHT_RT5645_SSP0_AIF2)) |
|---|
| 660 | + cht_dailink[dai_index].cpus->dai_name = "ssp0-port"; |
|---|
| 660 | 661 | |
|---|
| 661 | | - /* fixup cpu dai name name */ |
|---|
| 662 | | - snprintf(cht_rt5645_cpu_dai_name, |
|---|
| 663 | | - sizeof(cht_rt5645_cpu_dai_name), |
|---|
| 664 | | - "%s", "ssp0-port"); |
|---|
| 662 | + /* override plaform name, if required */ |
|---|
| 663 | + platform_name = mach->mach_params.platform; |
|---|
| 665 | 664 | |
|---|
| 666 | | - cht_dailink[dai_index].cpu_dai_name = |
|---|
| 667 | | - cht_rt5645_cpu_dai_name; |
|---|
| 668 | | - } |
|---|
| 665 | + ret_val = snd_soc_fixup_dai_links_platform_name(card, |
|---|
| 666 | + platform_name); |
|---|
| 667 | + if (ret_val) |
|---|
| 668 | + return ret_val; |
|---|
| 669 | 669 | |
|---|
| 670 | | - drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3"); |
|---|
| 670 | + if (cht_rt5645_quirk & CHT_RT5645_PMC_PLT_CLK_0) |
|---|
| 671 | + mclk_name = "pmc_plt_clk_0"; |
|---|
| 672 | + else |
|---|
| 673 | + mclk_name = "pmc_plt_clk_3"; |
|---|
| 674 | + |
|---|
| 675 | + drv->mclk = devm_clk_get(&pdev->dev, mclk_name); |
|---|
| 671 | 676 | if (IS_ERR(drv->mclk)) { |
|---|
| 672 | | - dev_err(&pdev->dev, |
|---|
| 673 | | - "Failed to get MCLK from pmc_plt_clk_3: %ld\n", |
|---|
| 674 | | - PTR_ERR(drv->mclk)); |
|---|
| 677 | + dev_err(&pdev->dev, "Failed to get MCLK from %s: %ld\n", |
|---|
| 678 | + mclk_name, PTR_ERR(drv->mclk)); |
|---|
| 675 | 679 | return PTR_ERR(drv->mclk); |
|---|
| 676 | 680 | } |
|---|
| 677 | 681 | |
|---|
| .. | .. |
|---|
| 689 | 693 | static struct platform_driver snd_cht_mc_driver = { |
|---|
| 690 | 694 | .driver = { |
|---|
| 691 | 695 | .name = "cht-bsw-rt5645", |
|---|
| 696 | +#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL) |
|---|
| 697 | + .pm = &snd_soc_pm_ops, |
|---|
| 698 | +#endif |
|---|
| 692 | 699 | }, |
|---|
| 693 | 700 | .probe = snd_cht_mc_probe, |
|---|
| 694 | 701 | }; |
|---|