Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: Intel: boards: updates for 6.11

Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

More simplifications from Brent Lu for Chromebooks, Bard Liao for
SoundWire, and support for new Dell SKUs w/ Cirrus Logic codecs added
by Charles Keepax.

+250 -164
+1
include/sound/sof.h
··· 173 173 174 174 int sof_dai_get_mclk(struct snd_soc_pcm_runtime *rtd); 175 175 int sof_dai_get_bclk(struct snd_soc_pcm_runtime *rtd); 176 + int sof_dai_get_tdm_slots(struct snd_soc_pcm_runtime *rtd); 176 177 177 178 #endif
-2
sound/soc/intel/boards/sof_board_helpers.h
··· 86 86 /* 87 87 * sof_da7219_private: private data for da7219 machine driver 88 88 * 89 - * @is_jsl_board: true for JSL boards 90 89 * @mclk_en: true for mclk pin is connected 91 90 * @pll_bypass: true for PLL bypass mode 92 91 */ 93 92 struct sof_da7219_private { 94 - bool is_jsl_board; 95 93 bool mclk_en; 96 94 bool pll_bypass; 97 95 };
+13 -44
sound/soc/intel/boards/sof_da7219.c
··· 178 178 snd_soc_component_set_jack(component, NULL, NULL); 179 179 } 180 180 181 - static int max98373_hw_params(struct snd_pcm_substream *substream, 182 - struct snd_pcm_hw_params *params) 183 - { 184 - struct snd_soc_pcm_runtime *runtime = snd_soc_substream_to_rtd(substream); 185 - int ret, j; 186 - 187 - for (j = 0; j < runtime->dai_link->num_codecs; j++) { 188 - struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(runtime, j); 189 - 190 - if (!strcmp(codec_dai->component->name, MAX_98373_DEV0_NAME)) { 191 - /* vmon_slot_no = 0 imon_slot_no = 1 for TX slots */ 192 - ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x3, 3, 4, 16); 193 - if (ret < 0) { 194 - dev_err(runtime->dev, "DEV0 TDM slot err:%d\n", ret); 195 - return ret; 196 - } 197 - } 198 - if (!strcmp(codec_dai->component->name, MAX_98373_DEV1_NAME)) { 199 - /* vmon_slot_no = 2 imon_slot_no = 3 for TX slots */ 200 - ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xC, 3, 4, 16); 201 - if (ret < 0) { 202 - dev_err(runtime->dev, "DEV1 TDM slot err:%d\n", ret); 203 - return ret; 204 - } 205 - } 206 - } 207 - 208 - return 0; 209 - } 210 - 211 - static const struct snd_soc_ops max98373_ops = { 212 - .hw_params = max98373_hw_params, 213 - }; 214 - 215 181 static int card_late_probe(struct snd_soc_card *card) 216 182 { 183 + struct sof_card_private *ctx = snd_soc_card_get_drvdata(card); 184 + struct snd_soc_dapm_context *dapm = &card->dapm; 185 + int err; 186 + 187 + if (ctx->amp_type == CODEC_MAX98373) { 188 + /* Disable Left and Right Spk pin after boot */ 189 + snd_soc_dapm_disable_pin(dapm, "Left Spk"); 190 + snd_soc_dapm_disable_pin(dapm, "Right Spk"); 191 + err = snd_soc_dapm_sync(dapm); 192 + if (err < 0) 193 + return err; 194 + } 195 + 217 196 return sof_intel_board_card_late_probe(card); 218 197 } 219 198 ··· 255 276 break; 256 277 case CODEC_MAX98373: 257 278 max_98373_dai_link(dev, ctx->amp_link); 258 - 259 - if (ctx->da7219.is_jsl_board) { 260 - ctx->amp_link->ops = &max98373_ops; /* use local ops */ 261 - } else { 262 - /* TBD: implement the amp for later platform */ 263 - dev_err(dev, "max98373 not support yet\n"); 264 - return -EINVAL; 265 - } 266 279 break; 267 280 case CODEC_MAX98390: 268 281 max_98390_dai_link(dev, ctx->amp_link); ··· 359 388 break; 360 389 } 361 390 } else if (board_quirk & SOF_DA7219_JSL_BOARD) { 362 - ctx->da7219.is_jsl_board = true; 363 - 364 391 /* overwrite the DAI link order for JSL boards */ 365 392 ctx->link_order_overwrite = JSL_LINK_ORDER; 366 393
+72 -12
sound/soc/intel/boards/sof_maxim_common.c
··· 9 9 #include <sound/soc-acpi.h> 10 10 #include <sound/soc-dai.h> 11 11 #include <sound/soc-dapm.h> 12 + #include <sound/sof.h> 12 13 #include <uapi/sound/asound.h> 13 14 #include "../common/soc-intel-quirks.h" 14 15 #include "sof_maxim_common.h" ··· 73 72 }, 74 73 }; 75 74 75 + /* 76 + * According to the definition of 'DAI Sel Mux' mixer in max98373.c, rx mask 77 + * should choose two channels from TDM slots, the LSB of rx mask is left channel 78 + * and the other one is right channel. 79 + * 80 + * For tx mask, each codec requires two channels: one for V-sense and the other 81 + * one for I-sense. Must match the device property "maxim,vmon-slot-no" and 82 + * "maxim,imon-slot-no" in ACPI table. 83 + */ 84 + static const struct { 85 + unsigned int tx; 86 + unsigned int rx; 87 + } max_98373_tdm_mask[] = { 88 + {.tx = 0x03, .rx = 0x3}, 89 + {.tx = 0x0c, .rx = 0x3}, 90 + }; 91 + 76 92 static int max_98373_hw_params(struct snd_pcm_substream *substream, 77 93 struct snd_pcm_hw_params *params) 78 94 { 79 95 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 96 + struct snd_soc_dai_link *dai_link = rtd->dai_link; 80 97 struct snd_soc_dai *codec_dai; 98 + int i; 99 + int tdm_slots; 81 100 int ret = 0; 82 - int j; 83 101 84 - for_each_rtd_codec_dais(rtd, j, codec_dai) { 85 - if (!strcmp(codec_dai->component->name, MAX_98373_DEV0_NAME)) { 86 - /* DEV0 tdm slot configuration */ 87 - ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x03, 3, 8, 32); 88 - } else if (!strcmp(codec_dai->component->name, MAX_98373_DEV1_NAME)) { 89 - /* DEV1 tdm slot configuration */ 90 - ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x0C, 3, 8, 32); 102 + for_each_rtd_codec_dais(rtd, i, codec_dai) { 103 + if (i >= ARRAY_SIZE(max_98373_tdm_mask)) { 104 + dev_err(codec_dai->dev, "only 2 amps are supported\n"); 105 + return -EINVAL; 91 106 } 92 - if (ret < 0) { 93 - dev_err(codec_dai->dev, "fail to set tdm slot, ret %d\n", 94 - ret); 95 - return ret; 107 + 108 + switch (dai_link->dai_fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 109 + case SND_SOC_DAIFMT_DSP_A: 110 + case SND_SOC_DAIFMT_DSP_B: 111 + /* get the tplg configured tdm slot number */ 112 + tdm_slots = sof_dai_get_tdm_slots(rtd); 113 + if (tdm_slots <= 0) { 114 + dev_err(rtd->dev, "invalid tdm slots %d\n", 115 + tdm_slots); 116 + return -EINVAL; 117 + } 118 + 119 + /* 120 + * check if tdm slot number is too small for channel 121 + * allocation 122 + */ 123 + if (fls(max_98373_tdm_mask[i].tx) > tdm_slots) { 124 + dev_err(codec_dai->dev, "slot mismatch, tx %d slots %d\n", 125 + fls(max_98373_tdm_mask[i].tx), tdm_slots); 126 + return -EINVAL; 127 + } 128 + 129 + if (fls(max_98373_tdm_mask[i].rx) > tdm_slots) { 130 + dev_err(codec_dai->dev, "slot mismatch, rx %d slots %d\n", 131 + fls(max_98373_tdm_mask[i].rx), tdm_slots); 132 + return -EINVAL; 133 + } 134 + 135 + dev_dbg(codec_dai->dev, "set tdm slot: tx 0x%x rx 0x%x slots %d width %d\n", 136 + max_98373_tdm_mask[i].tx, 137 + max_98373_tdm_mask[i].rx, 138 + tdm_slots, params_width(params)); 139 + 140 + ret = snd_soc_dai_set_tdm_slot(codec_dai, 141 + max_98373_tdm_mask[i].tx, 142 + max_98373_tdm_mask[i].rx, 143 + tdm_slots, 144 + params_width(params)); 145 + if (ret < 0) { 146 + dev_err(codec_dai->dev, "fail to set tdm slot, ret %d\n", 147 + ret); 148 + return ret; 149 + } 150 + break; 151 + default: 152 + dev_dbg(codec_dai->dev, "codec is in I2S mode\n"); 153 + break; 96 154 } 97 155 } 98 156 return 0;
+22 -18
sound/soc/intel/boards/sof_sdw.c
··· 505 505 }, 506 506 .driver_data = (void *)(RT711_JD2), 507 507 }, 508 + { 509 + .callback = sof_sdw_quirk_cb, 510 + .matches = { 511 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), 512 + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0CE3") 513 + }, 514 + .driver_data = (void *)(SOF_SIDECAR_AMPS), 515 + }, 516 + { 517 + .callback = sof_sdw_quirk_cb, 518 + .matches = { 519 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), 520 + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0CE4") 521 + }, 522 + .driver_data = (void *)(SOF_SIDECAR_AMPS), 523 + }, 508 524 {} 509 525 }; 510 526 ··· 574 558 SOC_DAPM_PIN_SWITCH("AMIC"), 575 559 SOC_DAPM_PIN_SWITCH("Speaker"), 576 560 }; 577 - 578 - struct snd_soc_dai *get_codec_dai_by_name(struct snd_soc_pcm_runtime *rtd, 579 - const char * const dai_name[], 580 - int num_dais) 581 - { 582 - struct snd_soc_dai *dai; 583 - int index; 584 - int i; 585 - 586 - for (index = 0; index < num_dais; index++) 587 - for_each_rtd_codec_dais(rtd, i, dai) 588 - if (strstr(dai->name, dai_name[index])) { 589 - dev_dbg(rtd->card->dev, "get dai %s\n", dai->name); 590 - return dai; 591 - } 592 - 593 - return NULL; 594 - } 595 561 596 562 /* these wrappers are only needed to avoid typecast compilation errors */ 597 563 int sdw_startup(struct snd_pcm_substream *substream) ··· 1075 1077 .dailink = {SDW_AMP_OUT_DAI_ID, SDW_AMP_IN_DAI_ID}, 1076 1078 .init = sof_sdw_cs_amp_init, 1077 1079 .rtd_init = cs_spk_rtd_init, 1080 + .controls = generic_spk_controls, 1081 + .num_controls = ARRAY_SIZE(generic_spk_controls), 1078 1082 .widgets = generic_spk_widgets, 1079 1083 .num_widgets = ARRAY_SIZE(generic_spk_widgets), 1080 1084 }, ··· 1112 1112 .dai_type = SOF_SDW_DAI_TYPE_JACK, 1113 1113 .dailink = {SDW_JACK_OUT_DAI_ID, SDW_UNUSED_DAI_ID}, 1114 1114 .rtd_init = cs42l43_hs_rtd_init, 1115 + .controls = generic_jack_controls, 1116 + .num_controls = ARRAY_SIZE(generic_jack_controls), 1115 1117 .widgets = generic_jack_widgets, 1116 1118 .num_widgets = ARRAY_SIZE(generic_jack_widgets), 1117 1119 }, ··· 1139 1137 .dailink = {SDW_AMP_OUT_DAI_ID, SDW_UNUSED_DAI_ID}, 1140 1138 .init = sof_sdw_cs42l43_spk_init, 1141 1139 .rtd_init = cs42l43_spk_rtd_init, 1140 + .controls = generic_spk_controls, 1141 + .num_controls = ARRAY_SIZE(generic_spk_controls), 1142 1142 .widgets = generic_spk_widgets, 1143 1143 .num_widgets = ARRAY_SIZE(generic_spk_widgets), 1144 1144 .quirk = SOF_CODEC_SPKR | SOF_SIDECAR_AMPS,
-4
sound/soc/intel/boards/sof_sdw_common.h
··· 134 134 135 135 extern unsigned long sof_sdw_quirk; 136 136 137 - struct snd_soc_dai *get_codec_dai_by_name(struct snd_soc_pcm_runtime *rtd, 138 - const char * const dai_name[], 139 - int num_dais); 140 - 141 137 int sdw_startup(struct snd_pcm_substream *substream); 142 138 int sdw_prepare(struct snd_pcm_substream *substream); 143 139 int sdw_trigger(struct snd_pcm_substream *substream, int cmd);
+1 -10
sound/soc/intel/boards/sof_sdw_cs42l42.c
··· 36 36 }, 37 37 }; 38 38 39 - static const char * const jack_codecs[] = { 40 - "cs42l42" 41 - }; 42 - 43 39 int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai) 44 40 { 45 41 struct snd_soc_card *card = rtd->card; 46 42 struct mc_private *ctx = snd_soc_card_get_drvdata(card); 47 - struct snd_soc_dai *codec_dai; 48 43 struct snd_soc_component *component; 49 44 struct snd_soc_jack *jack; 50 45 int ret; 51 46 52 - codec_dai = get_codec_dai_by_name(rtd, jack_codecs, ARRAY_SIZE(jack_codecs)); 53 - if (!codec_dai) 54 - return -EINVAL; 55 - 56 - component = codec_dai->component; 47 + component = dai->component; 57 48 card->components = devm_kasprintf(card->dev, GFP_KERNEL, 58 49 "%s hs:cs42l42", 59 50 card->components);
+1 -10
sound/soc/intel/boards/sof_sdw_rt5682.c
··· 35 35 }, 36 36 }; 37 37 38 - static const char * const jack_codecs[] = { 39 - "rt5682" 40 - }; 41 - 42 38 int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai) 43 39 { 44 40 struct snd_soc_card *card = rtd->card; 45 41 struct mc_private *ctx = snd_soc_card_get_drvdata(card); 46 - struct snd_soc_dai *codec_dai; 47 42 struct snd_soc_component *component; 48 43 struct snd_soc_jack *jack; 49 44 int ret; 50 45 51 - codec_dai = get_codec_dai_by_name(rtd, jack_codecs, ARRAY_SIZE(jack_codecs)); 52 - if (!codec_dai) 53 - return -EINVAL; 54 - 55 - component = codec_dai->component; 46 + component = dai->component; 56 47 card->components = devm_kasprintf(card->dev, GFP_KERNEL, 57 48 "%s hs:rt5682", 58 49 card->components);
+1 -10
sound/soc/intel/boards/sof_sdw_rt700.c
··· 33 33 }, 34 34 }; 35 35 36 - static const char * const jack_codecs[] = { 37 - "rt700" 38 - }; 39 - 40 36 int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai) 41 37 { 42 38 struct snd_soc_card *card = rtd->card; 43 39 struct mc_private *ctx = snd_soc_card_get_drvdata(card); 44 - struct snd_soc_dai *codec_dai; 45 40 struct snd_soc_component *component; 46 41 struct snd_soc_jack *jack; 47 42 int ret; 48 43 49 - codec_dai = get_codec_dai_by_name(rtd, jack_codecs, ARRAY_SIZE(jack_codecs)); 50 - if (!codec_dai) 51 - return -EINVAL; 52 - 53 - component = codec_dai->component; 44 + component = dai->component; 54 45 card->components = devm_kasprintf(card->dev, GFP_KERNEL, 55 46 "%s hs:rt700", 56 47 card->components);
+1 -10
sound/soc/intel/boards/sof_sdw_rt711.c
··· 59 59 }, 60 60 }; 61 61 62 - static const char * const jack_codecs[] = { 63 - "rt711" 64 - }; 65 - 66 62 int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai) 67 63 { 68 64 struct snd_soc_card *card = rtd->card; 69 65 struct mc_private *ctx = snd_soc_card_get_drvdata(card); 70 - struct snd_soc_dai *codec_dai; 71 66 struct snd_soc_component *component; 72 67 struct snd_soc_jack *jack; 73 68 int ret; 74 69 75 - codec_dai = get_codec_dai_by_name(rtd, jack_codecs, ARRAY_SIZE(jack_codecs)); 76 - if (!codec_dai) 77 - return -EINVAL; 78 - 79 - component = codec_dai->component; 70 + component = dai->component; 80 71 card->components = devm_kasprintf(card->dev, GFP_KERNEL, 81 72 "%s hs:rt711", 82 73 card->components);
+1 -13
sound/soc/intel/boards/sof_sdw_rt_dmic.c
··· 12 12 #include "sof_board_helpers.h" 13 13 #include "sof_sdw_common.h" 14 14 15 - static const char * const dmics[] = { 16 - "rt715", 17 - "rt715-sdca", 18 - "rt712-sdca-dmic", 19 - "rt722-sdca", 20 - }; 21 - 22 15 int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai) 23 16 { 24 17 struct snd_soc_card *card = rtd->card; 25 18 struct snd_soc_component *component; 26 - struct snd_soc_dai *codec_dai; 27 19 char *mic_name; 28 20 29 - codec_dai = get_codec_dai_by_name(rtd, dmics, ARRAY_SIZE(dmics)); 30 - if (!codec_dai) 31 - return -EINVAL; 32 - 33 - component = codec_dai->component; 21 + component = dai->component; 34 22 35 23 /* 36 24 * rt715-sdca (aka rt714) is a special case that uses different name in card->components
+1 -10
sound/soc/intel/boards/sof_sdw_rt_sdca_jack_common.c
··· 74 74 }, 75 75 }; 76 76 77 - static const char * const jack_codecs[] = { 78 - "rt711", "rt712", "rt713", "rt722" 79 - }; 80 - 81 77 /* 82 78 * The sdca suffix is required for rt711 since there are two generations of the same chip. 83 79 * RT713 is an SDCA device but the sdca suffix is required for backwards-compatibility with ··· 87 91 { 88 92 struct snd_soc_card *card = rtd->card; 89 93 struct mc_private *ctx = snd_soc_card_get_drvdata(card); 90 - struct snd_soc_dai *codec_dai; 91 94 struct snd_soc_component *component; 92 95 struct snd_soc_jack *jack; 93 96 int ret; 94 97 int i; 95 98 96 - codec_dai = get_codec_dai_by_name(rtd, jack_codecs, ARRAY_SIZE(jack_codecs)); 97 - if (!codec_dai) 98 - return -EINVAL; 99 - 100 - component = codec_dai->component; 99 + component = dai->component; 101 100 card->components = devm_kasprintf(card->dev, GFP_KERNEL, 102 101 "%s hs:%s", 103 102 card->components, component->name_prefix);
+50
sound/soc/intel/common/soc-acpi-intel-arl-match.c
··· 15 15 .group_id = 0, 16 16 }; 17 17 18 + static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = { 19 + { /* Jack Playback Endpoint */ 20 + .num = 0, 21 + .aggregated = 0, 22 + .group_position = 0, 23 + .group_id = 0, 24 + }, 25 + { /* DMIC Capture Endpoint */ 26 + .num = 1, 27 + .aggregated = 0, 28 + .group_position = 0, 29 + .group_id = 0, 30 + }, 31 + { /* Jack Capture Endpoint */ 32 + .num = 2, 33 + .aggregated = 0, 34 + .group_position = 0, 35 + .group_id = 0, 36 + }, 37 + { /* Speaker Playback Endpoint */ 38 + .num = 3, 39 + .aggregated = 0, 40 + .group_position = 0, 41 + .group_id = 0, 42 + }, 43 + }; 44 + 45 + static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = { 46 + { 47 + .adr = 0x00003001FA424301ull, 48 + .num_endpoints = ARRAY_SIZE(cs42l43_endpoints), 49 + .endpoints = cs42l43_endpoints, 50 + .name_prefix = "cs42l43" 51 + } 52 + }; 53 + 18 54 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = { 19 55 { 20 56 .adr = 0x000020025D071100ull, ··· 67 31 .endpoints = &single_endpoint, 68 32 .name_prefix = "rt711" 69 33 } 34 + }; 35 + 36 + static const struct snd_soc_acpi_link_adr arl_cs42l43_l0[] = { 37 + { 38 + .mask = BIT(0), 39 + .num_adr = ARRAY_SIZE(cs42l43_0_adr), 40 + .adr_d = cs42l43_0_adr, 41 + }, 70 42 }; 71 43 72 44 static const struct snd_soc_acpi_link_adr arl_rvp[] = { ··· 102 58 103 59 /* this table is used when there is no I2S codec present */ 104 60 struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_sdw_machines[] = { 61 + { 62 + .link_mask = BIT(0), 63 + .links = arl_cs42l43_l0, 64 + .drv_name = "sof_sdw", 65 + .sof_tplg_filename = "sof-arl-cs42l43-l0.tplg", 66 + }, 105 67 { 106 68 .link_mask = 0x1, /* link0 required */ 107 69 .links = arl_rvp,
+50
sound/soc/intel/common/soc-acpi-intel-rpl-match.c
··· 30 30 .group_id = 1, 31 31 }; 32 32 33 + static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = { 34 + { /* Jack Playback Endpoint */ 35 + .num = 0, 36 + .aggregated = 0, 37 + .group_position = 0, 38 + .group_id = 0, 39 + }, 40 + { /* DMIC Capture Endpoint */ 41 + .num = 1, 42 + .aggregated = 0, 43 + .group_position = 0, 44 + .group_id = 0, 45 + }, 46 + { /* Jack Capture Endpoint */ 47 + .num = 2, 48 + .aggregated = 0, 49 + .group_position = 0, 50 + .group_id = 0, 51 + }, 52 + { /* Speaker Playback Endpoint */ 53 + .num = 3, 54 + .aggregated = 0, 55 + .group_position = 0, 56 + .group_id = 0, 57 + }, 58 + }; 59 + 60 + static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = { 61 + { 62 + .adr = 0x00003001FA424301ull, 63 + .num_endpoints = ARRAY_SIZE(cs42l43_endpoints), 64 + .endpoints = cs42l43_endpoints, 65 + .name_prefix = "cs42l43" 66 + } 67 + }; 68 + 33 69 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = { 34 70 { 35 71 .adr = 0x000020025D071100ull, ··· 190 154 .endpoints = &single_endpoint, 191 155 .name_prefix = "rt714" 192 156 } 157 + }; 158 + 159 + static const struct snd_soc_acpi_link_adr rpl_cs42l43_l0[] = { 160 + { 161 + .mask = BIT(0), 162 + .num_adr = ARRAY_SIZE(cs42l43_0_adr), 163 + .adr_d = cs42l43_0_adr, 164 + }, 193 165 }; 194 166 195 167 static const struct snd_soc_acpi_link_adr rpl_sdca_3_in_1[] = { ··· 490 446 491 447 /* this table is used when there is no I2S codec present */ 492 448 struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_sdw_machines[] = { 449 + { 450 + .link_mask = BIT(0), 451 + .links = rpl_cs42l43_l0, 452 + .drv_name = "sof_sdw", 453 + .sof_tplg_filename = "sof-rpl-cs42l43-l0.tplg", 454 + }, 493 455 { 494 456 .link_mask = 0xF, /* 4 active links required */ 495 457 .links = rpl_sdca_3_in_1,
+8 -6
sound/soc/sof/ipc3-topology.c
··· 2500 2500 return 0; 2501 2501 } 2502 2502 2503 - static int sof_ipc3_dai_get_clk(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int clk_type) 2503 + static int sof_ipc3_dai_get_param(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int param_type) 2504 2504 { 2505 2505 struct sof_dai_private_data *private = dai->private; 2506 2506 ··· 2509 2509 2510 2510 switch (private->dai_config->type) { 2511 2511 case SOF_DAI_INTEL_SSP: 2512 - switch (clk_type) { 2513 - case SOF_DAI_CLK_INTEL_SSP_MCLK: 2512 + switch (param_type) { 2513 + case SOF_DAI_PARAM_INTEL_SSP_MCLK: 2514 2514 return private->dai_config->ssp.mclk_rate; 2515 - case SOF_DAI_CLK_INTEL_SSP_BCLK: 2515 + case SOF_DAI_PARAM_INTEL_SSP_BCLK: 2516 2516 return private->dai_config->ssp.bclk_rate; 2517 + case SOF_DAI_PARAM_INTEL_SSP_TDM_SLOTS: 2518 + return private->dai_config->ssp.tdm_slots; 2517 2519 default: 2520 + dev_err(sdev->dev, "invalid SSP param %d\n", param_type); 2518 2521 break; 2519 2522 } 2520 - dev_err(sdev->dev, "fail to get SSP clk %d rate\n", clk_type); 2521 2523 break; 2522 2524 default: 2523 2525 /* not yet implemented for platforms other than the above */ ··· 2694 2692 .widget_free = sof_ipc3_widget_free, 2695 2693 .widget_setup = sof_ipc3_widget_setup, 2696 2694 .dai_config = sof_ipc3_dai_config, 2697 - .dai_get_clk = sof_ipc3_dai_get_clk, 2695 + .dai_get_param = sof_ipc3_dai_get_param, 2698 2696 .set_up_all_pipelines = sof_ipc3_set_up_all_pipelines, 2699 2697 .tear_down_all_pipelines = sof_ipc3_tear_down_all_pipelines, 2700 2698 .parse_manifest = sof_ipc3_parse_manifest,
+8 -6
sound/soc/sof/ipc4-topology.c
··· 3149 3149 return 0; 3150 3150 } 3151 3151 3152 - static int sof_ipc4_dai_get_clk(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int clk_type) 3152 + static int sof_ipc4_dai_get_param(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int param_type) 3153 3153 { 3154 3154 struct sof_ipc4_copier *ipc4_copier = dai->private; 3155 3155 struct snd_soc_tplg_hw_config *hw_config; ··· 3188 3188 3189 3189 switch (ipc4_copier->dai_type) { 3190 3190 case SOF_DAI_INTEL_SSP: 3191 - switch (clk_type) { 3192 - case SOF_DAI_CLK_INTEL_SSP_MCLK: 3191 + switch (param_type) { 3192 + case SOF_DAI_PARAM_INTEL_SSP_MCLK: 3193 3193 return le32_to_cpu(hw_config->mclk_rate); 3194 - case SOF_DAI_CLK_INTEL_SSP_BCLK: 3194 + case SOF_DAI_PARAM_INTEL_SSP_BCLK: 3195 3195 return le32_to_cpu(hw_config->bclk_rate); 3196 + case SOF_DAI_PARAM_INTEL_SSP_TDM_SLOTS: 3197 + return le32_to_cpu(hw_config->tdm_slots); 3196 3198 default: 3197 - dev_err(sdev->dev, "Invalid clk type for SSP %d\n", clk_type); 3199 + dev_err(sdev->dev, "invalid SSP param %d\n", param_type); 3198 3200 break; 3199 3201 } 3200 3202 break; ··· 3373 3371 .route_free = sof_ipc4_route_free, 3374 3372 .dai_config = sof_ipc4_dai_config, 3375 3373 .parse_manifest = sof_ipc4_parse_manifest, 3376 - .dai_get_clk = sof_ipc4_dai_get_clk, 3374 + .dai_get_param = sof_ipc4_dai_get_param, 3377 3375 .tear_down_all_pipelines = sof_ipc4_tear_down_all_pipelines, 3378 3376 .link_setup = sof_ipc4_link_setup, 3379 3377 };
+15 -5
sound/soc/sof/sof-audio.c
··· 978 978 return NULL; 979 979 } 980 980 981 - static int sof_dai_get_clk(struct snd_soc_pcm_runtime *rtd, int clk_type) 981 + static int sof_dai_get_param(struct snd_soc_pcm_runtime *rtd, int param_type) 982 982 { 983 983 struct snd_soc_component *component = 984 984 snd_soc_rtdcom_lookup(rtd, SOF_AUDIO_PCM_DRV_NAME); ··· 991 991 if (!dai) 992 992 return 0; 993 993 994 - if (tplg_ops && tplg_ops->dai_get_clk) 995 - return tplg_ops->dai_get_clk(sdev, dai, clk_type); 994 + if (tplg_ops && tplg_ops->dai_get_param) 995 + return tplg_ops->dai_get_param(sdev, dai, param_type); 996 996 997 997 return 0; 998 998 } ··· 1003 1003 */ 1004 1004 int sof_dai_get_mclk(struct snd_soc_pcm_runtime *rtd) 1005 1005 { 1006 - return sof_dai_get_clk(rtd, SOF_DAI_CLK_INTEL_SSP_MCLK); 1006 + return sof_dai_get_param(rtd, SOF_DAI_PARAM_INTEL_SSP_MCLK); 1007 1007 } 1008 1008 EXPORT_SYMBOL(sof_dai_get_mclk); 1009 1009 ··· 1013 1013 */ 1014 1014 int sof_dai_get_bclk(struct snd_soc_pcm_runtime *rtd) 1015 1015 { 1016 - return sof_dai_get_clk(rtd, SOF_DAI_CLK_INTEL_SSP_BCLK); 1016 + return sof_dai_get_param(rtd, SOF_DAI_PARAM_INTEL_SSP_BCLK); 1017 1017 } 1018 1018 EXPORT_SYMBOL(sof_dai_get_bclk); 1019 + 1020 + /* 1021 + * Helper to get SSP TDM slot number from a pcm_runtime. 1022 + * Return 0 if not exist. 1023 + */ 1024 + int sof_dai_get_tdm_slots(struct snd_soc_pcm_runtime *rtd) 1025 + { 1026 + return sof_dai_get_param(rtd, SOF_DAI_PARAM_INTEL_SSP_TDM_SLOTS); 1027 + } 1028 + EXPORT_SYMBOL(sof_dai_get_tdm_slots);
+5 -4
sound/soc/sof/sof-audio.h
··· 44 44 #define WIDGET_IS_AIF_OR_DAI(id) (WIDGET_IS_DAI(id) || WIDGET_IS_AIF(id)) 45 45 #define WIDGET_IS_COPIER(id) (WIDGET_IS_AIF_OR_DAI(id) || (id) == snd_soc_dapm_buffer) 46 46 47 - #define SOF_DAI_CLK_INTEL_SSP_MCLK 0 48 - #define SOF_DAI_CLK_INTEL_SSP_BCLK 1 47 + #define SOF_DAI_PARAM_INTEL_SSP_MCLK 0 48 + #define SOF_DAI_PARAM_INTEL_SSP_BCLK 1 49 + #define SOF_DAI_PARAM_INTEL_SSP_TDM_SLOTS 2 49 50 50 51 enum sof_widget_op { 51 52 SOF_WIDGET_PREPARE, ··· 209 208 * @widget_setup: Function pointer for setting up setup in the DSP 210 209 * @widget_free: Function pointer for freeing widget in the DSP 211 210 * @dai_config: Function pointer for sending DAI config IPC to the DSP 212 - * @dai_get_clk: Function pointer for getting the DAI clock setting 211 + * @dai_get_param: Function pointer for getting the DAI parameter 213 212 * @set_up_all_pipelines: Function pointer for setting up all topology pipelines 214 213 * @tear_down_all_pipelines: Function pointer for tearing down all topology pipelines 215 214 * @parse_manifest: Function pointer for ipc4 specific parsing of topology manifest ··· 230 229 int (*widget_free)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget); 231 230 int (*dai_config)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget, 232 231 unsigned int flags, struct snd_sof_dai_config_data *data); 233 - int (*dai_get_clk)(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int clk_type); 232 + int (*dai_get_param)(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int param_type); 234 233 int (*set_up_all_pipelines)(struct snd_sof_dev *sdev, bool verify); 235 234 int (*tear_down_all_pipelines)(struct snd_sof_dev *sdev, bool verify); 236 235 int (*parse_manifest)(struct snd_soc_component *scomp, int index,