mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
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.
This commit is contained in:
commit
2ea176304d
@ -173,5 +173,6 @@ struct sof_dev_desc {
|
||||
|
||||
int sof_dai_get_mclk(struct snd_soc_pcm_runtime *rtd);
|
||||
int sof_dai_get_bclk(struct snd_soc_pcm_runtime *rtd);
|
||||
int sof_dai_get_tdm_slots(struct snd_soc_pcm_runtime *rtd);
|
||||
|
||||
#endif
|
||||
|
@ -86,12 +86,10 @@ enum {
|
||||
/*
|
||||
* sof_da7219_private: private data for da7219 machine driver
|
||||
*
|
||||
* @is_jsl_board: true for JSL boards
|
||||
* @mclk_en: true for mclk pin is connected
|
||||
* @pll_bypass: true for PLL bypass mode
|
||||
*/
|
||||
struct sof_da7219_private {
|
||||
bool is_jsl_board;
|
||||
bool mclk_en;
|
||||
bool pll_bypass;
|
||||
};
|
||||
|
@ -178,42 +178,21 @@ static void da7219_codec_exit(struct snd_soc_pcm_runtime *rtd)
|
||||
snd_soc_component_set_jack(component, NULL, NULL);
|
||||
}
|
||||
|
||||
static int max98373_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *runtime = snd_soc_substream_to_rtd(substream);
|
||||
int ret, j;
|
||||
|
||||
for (j = 0; j < runtime->dai_link->num_codecs; j++) {
|
||||
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(runtime, j);
|
||||
|
||||
if (!strcmp(codec_dai->component->name, MAX_98373_DEV0_NAME)) {
|
||||
/* vmon_slot_no = 0 imon_slot_no = 1 for TX slots */
|
||||
ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x3, 3, 4, 16);
|
||||
if (ret < 0) {
|
||||
dev_err(runtime->dev, "DEV0 TDM slot err:%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (!strcmp(codec_dai->component->name, MAX_98373_DEV1_NAME)) {
|
||||
/* vmon_slot_no = 2 imon_slot_no = 3 for TX slots */
|
||||
ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xC, 3, 4, 16);
|
||||
if (ret < 0) {
|
||||
dev_err(runtime->dev, "DEV1 TDM slot err:%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_ops max98373_ops = {
|
||||
.hw_params = max98373_hw_params,
|
||||
};
|
||||
|
||||
static int card_late_probe(struct snd_soc_card *card)
|
||||
{
|
||||
struct sof_card_private *ctx = snd_soc_card_get_drvdata(card);
|
||||
struct snd_soc_dapm_context *dapm = &card->dapm;
|
||||
int err;
|
||||
|
||||
if (ctx->amp_type == CODEC_MAX98373) {
|
||||
/* Disable Left and Right Spk pin after boot */
|
||||
snd_soc_dapm_disable_pin(dapm, "Left Spk");
|
||||
snd_soc_dapm_disable_pin(dapm, "Right Spk");
|
||||
err = snd_soc_dapm_sync(dapm);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
|
||||
return sof_intel_board_card_late_probe(card);
|
||||
}
|
||||
|
||||
@ -276,14 +255,6 @@ sof_card_dai_links_create(struct device *dev, struct snd_soc_card *card,
|
||||
break;
|
||||
case CODEC_MAX98373:
|
||||
max_98373_dai_link(dev, ctx->amp_link);
|
||||
|
||||
if (ctx->da7219.is_jsl_board) {
|
||||
ctx->amp_link->ops = &max98373_ops; /* use local ops */
|
||||
} else {
|
||||
/* TBD: implement the amp for later platform */
|
||||
dev_err(dev, "max98373 not support yet\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
case CODEC_MAX98390:
|
||||
max_98390_dai_link(dev, ctx->amp_link);
|
||||
@ -388,8 +359,6 @@ static int audio_probe(struct platform_device *pdev)
|
||||
break;
|
||||
}
|
||||
} else if (board_quirk & SOF_DA7219_JSL_BOARD) {
|
||||
ctx->da7219.is_jsl_board = true;
|
||||
|
||||
/* overwrite the DAI link order for JSL boards */
|
||||
ctx->link_order_overwrite = JSL_LINK_ORDER;
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <sound/soc-acpi.h>
|
||||
#include <sound/soc-dai.h>
|
||||
#include <sound/soc-dapm.h>
|
||||
#include <sound/sof.h>
|
||||
#include <uapi/sound/asound.h>
|
||||
#include "../common/soc-intel-quirks.h"
|
||||
#include "sof_maxim_common.h"
|
||||
@ -72,26 +73,85 @@ static struct snd_soc_dai_link_component max_98373_components[] = {
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* According to the definition of 'DAI Sel Mux' mixer in max98373.c, rx mask
|
||||
* should choose two channels from TDM slots, the LSB of rx mask is left channel
|
||||
* and the other one is right channel.
|
||||
*
|
||||
* For tx mask, each codec requires two channels: one for V-sense and the other
|
||||
* one for I-sense. Must match the device property "maxim,vmon-slot-no" and
|
||||
* "maxim,imon-slot-no" in ACPI table.
|
||||
*/
|
||||
static const struct {
|
||||
unsigned int tx;
|
||||
unsigned int rx;
|
||||
} max_98373_tdm_mask[] = {
|
||||
{.tx = 0x03, .rx = 0x3},
|
||||
{.tx = 0x0c, .rx = 0x3},
|
||||
};
|
||||
|
||||
static int max_98373_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
|
||||
struct snd_soc_dai_link *dai_link = rtd->dai_link;
|
||||
struct snd_soc_dai *codec_dai;
|
||||
int i;
|
||||
int tdm_slots;
|
||||
int ret = 0;
|
||||
int j;
|
||||
|
||||
for_each_rtd_codec_dais(rtd, j, codec_dai) {
|
||||
if (!strcmp(codec_dai->component->name, MAX_98373_DEV0_NAME)) {
|
||||
/* DEV0 tdm slot configuration */
|
||||
ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x03, 3, 8, 32);
|
||||
} else if (!strcmp(codec_dai->component->name, MAX_98373_DEV1_NAME)) {
|
||||
/* DEV1 tdm slot configuration */
|
||||
ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x0C, 3, 8, 32);
|
||||
for_each_rtd_codec_dais(rtd, i, codec_dai) {
|
||||
if (i >= ARRAY_SIZE(max_98373_tdm_mask)) {
|
||||
dev_err(codec_dai->dev, "only 2 amps are supported\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (ret < 0) {
|
||||
dev_err(codec_dai->dev, "fail to set tdm slot, ret %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
|
||||
switch (dai_link->dai_fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
|
||||
case SND_SOC_DAIFMT_DSP_A:
|
||||
case SND_SOC_DAIFMT_DSP_B:
|
||||
/* get the tplg configured tdm slot number */
|
||||
tdm_slots = sof_dai_get_tdm_slots(rtd);
|
||||
if (tdm_slots <= 0) {
|
||||
dev_err(rtd->dev, "invalid tdm slots %d\n",
|
||||
tdm_slots);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* check if tdm slot number is too small for channel
|
||||
* allocation
|
||||
*/
|
||||
if (fls(max_98373_tdm_mask[i].tx) > tdm_slots) {
|
||||
dev_err(codec_dai->dev, "slot mismatch, tx %d slots %d\n",
|
||||
fls(max_98373_tdm_mask[i].tx), tdm_slots);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (fls(max_98373_tdm_mask[i].rx) > tdm_slots) {
|
||||
dev_err(codec_dai->dev, "slot mismatch, rx %d slots %d\n",
|
||||
fls(max_98373_tdm_mask[i].rx), tdm_slots);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev_dbg(codec_dai->dev, "set tdm slot: tx 0x%x rx 0x%x slots %d width %d\n",
|
||||
max_98373_tdm_mask[i].tx,
|
||||
max_98373_tdm_mask[i].rx,
|
||||
tdm_slots, params_width(params));
|
||||
|
||||
ret = snd_soc_dai_set_tdm_slot(codec_dai,
|
||||
max_98373_tdm_mask[i].tx,
|
||||
max_98373_tdm_mask[i].rx,
|
||||
tdm_slots,
|
||||
params_width(params));
|
||||
if (ret < 0) {
|
||||
dev_err(codec_dai->dev, "fail to set tdm slot, ret %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
dev_dbg(codec_dai->dev, "codec is in I2S mode\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -505,6 +505,22 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = {
|
||||
},
|
||||
.driver_data = (void *)(RT711_JD2),
|
||||
},
|
||||
{
|
||||
.callback = sof_sdw_quirk_cb,
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
|
||||
DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0CE3")
|
||||
},
|
||||
.driver_data = (void *)(SOF_SIDECAR_AMPS),
|
||||
},
|
||||
{
|
||||
.callback = sof_sdw_quirk_cb,
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
|
||||
DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0CE4")
|
||||
},
|
||||
.driver_data = (void *)(SOF_SIDECAR_AMPS),
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
@ -559,24 +575,6 @@ static const struct snd_kcontrol_new rt700_controls[] = {
|
||||
SOC_DAPM_PIN_SWITCH("Speaker"),
|
||||
};
|
||||
|
||||
struct snd_soc_dai *get_codec_dai_by_name(struct snd_soc_pcm_runtime *rtd,
|
||||
const char * const dai_name[],
|
||||
int num_dais)
|
||||
{
|
||||
struct snd_soc_dai *dai;
|
||||
int index;
|
||||
int i;
|
||||
|
||||
for (index = 0; index < num_dais; index++)
|
||||
for_each_rtd_codec_dais(rtd, i, dai)
|
||||
if (strstr(dai->name, dai_name[index])) {
|
||||
dev_dbg(rtd->card->dev, "get dai %s\n", dai->name);
|
||||
return dai;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* these wrappers are only needed to avoid typecast compilation errors */
|
||||
int sdw_startup(struct snd_pcm_substream *substream)
|
||||
{
|
||||
@ -1077,6 +1075,8 @@ static struct sof_sdw_codec_info codec_info_list[] = {
|
||||
.dailink = {SDW_AMP_OUT_DAI_ID, SDW_AMP_IN_DAI_ID},
|
||||
.init = sof_sdw_cs_amp_init,
|
||||
.rtd_init = cs_spk_rtd_init,
|
||||
.controls = generic_spk_controls,
|
||||
.num_controls = ARRAY_SIZE(generic_spk_controls),
|
||||
.widgets = generic_spk_widgets,
|
||||
.num_widgets = ARRAY_SIZE(generic_spk_widgets),
|
||||
},
|
||||
@ -1112,6 +1112,8 @@ static struct sof_sdw_codec_info codec_info_list[] = {
|
||||
.dai_type = SOF_SDW_DAI_TYPE_JACK,
|
||||
.dailink = {SDW_JACK_OUT_DAI_ID, SDW_UNUSED_DAI_ID},
|
||||
.rtd_init = cs42l43_hs_rtd_init,
|
||||
.controls = generic_jack_controls,
|
||||
.num_controls = ARRAY_SIZE(generic_jack_controls),
|
||||
.widgets = generic_jack_widgets,
|
||||
.num_widgets = ARRAY_SIZE(generic_jack_widgets),
|
||||
},
|
||||
@ -1137,6 +1139,8 @@ static struct sof_sdw_codec_info codec_info_list[] = {
|
||||
.dailink = {SDW_AMP_OUT_DAI_ID, SDW_UNUSED_DAI_ID},
|
||||
.init = sof_sdw_cs42l43_spk_init,
|
||||
.rtd_init = cs42l43_spk_rtd_init,
|
||||
.controls = generic_spk_controls,
|
||||
.num_controls = ARRAY_SIZE(generic_spk_controls),
|
||||
.widgets = generic_spk_widgets,
|
||||
.num_widgets = ARRAY_SIZE(generic_spk_widgets),
|
||||
.quirk = SOF_CODEC_SPKR | SOF_SIDECAR_AMPS,
|
||||
|
@ -134,10 +134,6 @@ struct mc_private {
|
||||
|
||||
extern unsigned long sof_sdw_quirk;
|
||||
|
||||
struct snd_soc_dai *get_codec_dai_by_name(struct snd_soc_pcm_runtime *rtd,
|
||||
const char * const dai_name[],
|
||||
int num_dais);
|
||||
|
||||
int sdw_startup(struct snd_pcm_substream *substream);
|
||||
int sdw_prepare(struct snd_pcm_substream *substream);
|
||||
int sdw_trigger(struct snd_pcm_substream *substream, int cmd);
|
||||
|
@ -36,24 +36,15 @@ static struct snd_soc_jack_pin cs42l42_jack_pins[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static const char * const jack_codecs[] = {
|
||||
"cs42l42"
|
||||
};
|
||||
|
||||
int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_card *card = rtd->card;
|
||||
struct mc_private *ctx = snd_soc_card_get_drvdata(card);
|
||||
struct snd_soc_dai *codec_dai;
|
||||
struct snd_soc_component *component;
|
||||
struct snd_soc_jack *jack;
|
||||
int ret;
|
||||
|
||||
codec_dai = get_codec_dai_by_name(rtd, jack_codecs, ARRAY_SIZE(jack_codecs));
|
||||
if (!codec_dai)
|
||||
return -EINVAL;
|
||||
|
||||
component = codec_dai->component;
|
||||
component = dai->component;
|
||||
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
|
||||
"%s hs:cs42l42",
|
||||
card->components);
|
||||
|
@ -35,24 +35,15 @@ static struct snd_soc_jack_pin rt5682_jack_pins[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static const char * const jack_codecs[] = {
|
||||
"rt5682"
|
||||
};
|
||||
|
||||
int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_card *card = rtd->card;
|
||||
struct mc_private *ctx = snd_soc_card_get_drvdata(card);
|
||||
struct snd_soc_dai *codec_dai;
|
||||
struct snd_soc_component *component;
|
||||
struct snd_soc_jack *jack;
|
||||
int ret;
|
||||
|
||||
codec_dai = get_codec_dai_by_name(rtd, jack_codecs, ARRAY_SIZE(jack_codecs));
|
||||
if (!codec_dai)
|
||||
return -EINVAL;
|
||||
|
||||
component = codec_dai->component;
|
||||
component = dai->component;
|
||||
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
|
||||
"%s hs:rt5682",
|
||||
card->components);
|
||||
|
@ -33,24 +33,15 @@ static struct snd_soc_jack_pin rt700_jack_pins[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static const char * const jack_codecs[] = {
|
||||
"rt700"
|
||||
};
|
||||
|
||||
int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_card *card = rtd->card;
|
||||
struct mc_private *ctx = snd_soc_card_get_drvdata(card);
|
||||
struct snd_soc_dai *codec_dai;
|
||||
struct snd_soc_component *component;
|
||||
struct snd_soc_jack *jack;
|
||||
int ret;
|
||||
|
||||
codec_dai = get_codec_dai_by_name(rtd, jack_codecs, ARRAY_SIZE(jack_codecs));
|
||||
if (!codec_dai)
|
||||
return -EINVAL;
|
||||
|
||||
component = codec_dai->component;
|
||||
component = dai->component;
|
||||
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
|
||||
"%s hs:rt700",
|
||||
card->components);
|
||||
|
@ -59,24 +59,15 @@ static struct snd_soc_jack_pin rt711_jack_pins[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static const char * const jack_codecs[] = {
|
||||
"rt711"
|
||||
};
|
||||
|
||||
int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_card *card = rtd->card;
|
||||
struct mc_private *ctx = snd_soc_card_get_drvdata(card);
|
||||
struct snd_soc_dai *codec_dai;
|
||||
struct snd_soc_component *component;
|
||||
struct snd_soc_jack *jack;
|
||||
int ret;
|
||||
|
||||
codec_dai = get_codec_dai_by_name(rtd, jack_codecs, ARRAY_SIZE(jack_codecs));
|
||||
if (!codec_dai)
|
||||
return -EINVAL;
|
||||
|
||||
component = codec_dai->component;
|
||||
component = dai->component;
|
||||
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
|
||||
"%s hs:rt711",
|
||||
card->components);
|
||||
|
@ -12,25 +12,13 @@
|
||||
#include "sof_board_helpers.h"
|
||||
#include "sof_sdw_common.h"
|
||||
|
||||
static const char * const dmics[] = {
|
||||
"rt715",
|
||||
"rt715-sdca",
|
||||
"rt712-sdca-dmic",
|
||||
"rt722-sdca",
|
||||
};
|
||||
|
||||
int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_card *card = rtd->card;
|
||||
struct snd_soc_component *component;
|
||||
struct snd_soc_dai *codec_dai;
|
||||
char *mic_name;
|
||||
|
||||
codec_dai = get_codec_dai_by_name(rtd, dmics, ARRAY_SIZE(dmics));
|
||||
if (!codec_dai)
|
||||
return -EINVAL;
|
||||
|
||||
component = codec_dai->component;
|
||||
component = dai->component;
|
||||
|
||||
/*
|
||||
* rt715-sdca (aka rt714) is a special case that uses different name in card->components
|
||||
|
@ -74,10 +74,6 @@ static struct snd_soc_jack_pin rt_sdca_jack_pins[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static const char * const jack_codecs[] = {
|
||||
"rt711", "rt712", "rt713", "rt722"
|
||||
};
|
||||
|
||||
/*
|
||||
* The sdca suffix is required for rt711 since there are two generations of the same chip.
|
||||
* RT713 is an SDCA device but the sdca suffix is required for backwards-compatibility with
|
||||
@ -91,17 +87,12 @@ int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *d
|
||||
{
|
||||
struct snd_soc_card *card = rtd->card;
|
||||
struct mc_private *ctx = snd_soc_card_get_drvdata(card);
|
||||
struct snd_soc_dai *codec_dai;
|
||||
struct snd_soc_component *component;
|
||||
struct snd_soc_jack *jack;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
codec_dai = get_codec_dai_by_name(rtd, jack_codecs, ARRAY_SIZE(jack_codecs));
|
||||
if (!codec_dai)
|
||||
return -EINVAL;
|
||||
|
||||
component = codec_dai->component;
|
||||
component = dai->component;
|
||||
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
|
||||
"%s hs:%s",
|
||||
card->components, component->name_prefix);
|
||||
|
@ -15,6 +15,42 @@ static const struct snd_soc_acpi_endpoint single_endpoint = {
|
||||
.group_id = 0,
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = {
|
||||
{ /* Jack Playback Endpoint */
|
||||
.num = 0,
|
||||
.aggregated = 0,
|
||||
.group_position = 0,
|
||||
.group_id = 0,
|
||||
},
|
||||
{ /* DMIC Capture Endpoint */
|
||||
.num = 1,
|
||||
.aggregated = 0,
|
||||
.group_position = 0,
|
||||
.group_id = 0,
|
||||
},
|
||||
{ /* Jack Capture Endpoint */
|
||||
.num = 2,
|
||||
.aggregated = 0,
|
||||
.group_position = 0,
|
||||
.group_id = 0,
|
||||
},
|
||||
{ /* Speaker Playback Endpoint */
|
||||
.num = 3,
|
||||
.aggregated = 0,
|
||||
.group_position = 0,
|
||||
.group_id = 0,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = {
|
||||
{
|
||||
.adr = 0x00003001FA424301ull,
|
||||
.num_endpoints = ARRAY_SIZE(cs42l43_endpoints),
|
||||
.endpoints = cs42l43_endpoints,
|
||||
.name_prefix = "cs42l43"
|
||||
}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_adr_device rt711_0_adr[] = {
|
||||
{
|
||||
.adr = 0x000020025D071100ull,
|
||||
@ -33,6 +69,14 @@ static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
|
||||
}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_link_adr arl_cs42l43_l0[] = {
|
||||
{
|
||||
.mask = BIT(0),
|
||||
.num_adr = ARRAY_SIZE(cs42l43_0_adr),
|
||||
.adr_d = cs42l43_0_adr,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_link_adr arl_rvp[] = {
|
||||
{
|
||||
.mask = BIT(0),
|
||||
@ -58,6 +102,12 @@ EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_arl_machines);
|
||||
|
||||
/* this table is used when there is no I2S codec present */
|
||||
struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_sdw_machines[] = {
|
||||
{
|
||||
.link_mask = BIT(0),
|
||||
.links = arl_cs42l43_l0,
|
||||
.drv_name = "sof_sdw",
|
||||
.sof_tplg_filename = "sof-arl-cs42l43-l0.tplg",
|
||||
},
|
||||
{
|
||||
.link_mask = 0x1, /* link0 required */
|
||||
.links = arl_rvp,
|
||||
|
@ -30,6 +30,42 @@ static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
|
||||
.group_id = 1,
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = {
|
||||
{ /* Jack Playback Endpoint */
|
||||
.num = 0,
|
||||
.aggregated = 0,
|
||||
.group_position = 0,
|
||||
.group_id = 0,
|
||||
},
|
||||
{ /* DMIC Capture Endpoint */
|
||||
.num = 1,
|
||||
.aggregated = 0,
|
||||
.group_position = 0,
|
||||
.group_id = 0,
|
||||
},
|
||||
{ /* Jack Capture Endpoint */
|
||||
.num = 2,
|
||||
.aggregated = 0,
|
||||
.group_position = 0,
|
||||
.group_id = 0,
|
||||
},
|
||||
{ /* Speaker Playback Endpoint */
|
||||
.num = 3,
|
||||
.aggregated = 0,
|
||||
.group_position = 0,
|
||||
.group_id = 0,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = {
|
||||
{
|
||||
.adr = 0x00003001FA424301ull,
|
||||
.num_endpoints = ARRAY_SIZE(cs42l43_endpoints),
|
||||
.endpoints = cs42l43_endpoints,
|
||||
.name_prefix = "cs42l43"
|
||||
}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_adr_device rt711_0_adr[] = {
|
||||
{
|
||||
.adr = 0x000020025D071100ull,
|
||||
@ -156,6 +192,14 @@ static const struct snd_soc_acpi_adr_device rt714_3_adr[] = {
|
||||
}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_link_adr rpl_cs42l43_l0[] = {
|
||||
{
|
||||
.mask = BIT(0),
|
||||
.num_adr = ARRAY_SIZE(cs42l43_0_adr),
|
||||
.adr_d = cs42l43_0_adr,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_link_adr rpl_sdca_3_in_1[] = {
|
||||
{
|
||||
.mask = BIT(0),
|
||||
@ -446,6 +490,12 @@ EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_rpl_machines);
|
||||
|
||||
/* this table is used when there is no I2S codec present */
|
||||
struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_sdw_machines[] = {
|
||||
{
|
||||
.link_mask = BIT(0),
|
||||
.links = rpl_cs42l43_l0,
|
||||
.drv_name = "sof_sdw",
|
||||
.sof_tplg_filename = "sof-rpl-cs42l43-l0.tplg",
|
||||
},
|
||||
{
|
||||
.link_mask = 0xF, /* 4 active links required */
|
||||
.links = rpl_sdca_3_in_1,
|
||||
|
@ -2500,7 +2500,7 @@ static int sof_ipc3_tear_down_all_pipelines(struct snd_sof_dev *sdev, bool verif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sof_ipc3_dai_get_clk(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int clk_type)
|
||||
static int sof_ipc3_dai_get_param(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int param_type)
|
||||
{
|
||||
struct sof_dai_private_data *private = dai->private;
|
||||
|
||||
@ -2509,15 +2509,17 @@ static int sof_ipc3_dai_get_clk(struct snd_sof_dev *sdev, struct snd_sof_dai *da
|
||||
|
||||
switch (private->dai_config->type) {
|
||||
case SOF_DAI_INTEL_SSP:
|
||||
switch (clk_type) {
|
||||
case SOF_DAI_CLK_INTEL_SSP_MCLK:
|
||||
switch (param_type) {
|
||||
case SOF_DAI_PARAM_INTEL_SSP_MCLK:
|
||||
return private->dai_config->ssp.mclk_rate;
|
||||
case SOF_DAI_CLK_INTEL_SSP_BCLK:
|
||||
case SOF_DAI_PARAM_INTEL_SSP_BCLK:
|
||||
return private->dai_config->ssp.bclk_rate;
|
||||
case SOF_DAI_PARAM_INTEL_SSP_TDM_SLOTS:
|
||||
return private->dai_config->ssp.tdm_slots;
|
||||
default:
|
||||
dev_err(sdev->dev, "invalid SSP param %d\n", param_type);
|
||||
break;
|
||||
}
|
||||
dev_err(sdev->dev, "fail to get SSP clk %d rate\n", clk_type);
|
||||
break;
|
||||
default:
|
||||
/* not yet implemented for platforms other than the above */
|
||||
@ -2692,7 +2694,7 @@ const struct sof_ipc_tplg_ops ipc3_tplg_ops = {
|
||||
.widget_free = sof_ipc3_widget_free,
|
||||
.widget_setup = sof_ipc3_widget_setup,
|
||||
.dai_config = sof_ipc3_dai_config,
|
||||
.dai_get_clk = sof_ipc3_dai_get_clk,
|
||||
.dai_get_param = sof_ipc3_dai_get_param,
|
||||
.set_up_all_pipelines = sof_ipc3_set_up_all_pipelines,
|
||||
.tear_down_all_pipelines = sof_ipc3_tear_down_all_pipelines,
|
||||
.parse_manifest = sof_ipc3_parse_manifest,
|
||||
|
@ -3149,7 +3149,7 @@ static int sof_ipc4_parse_manifest(struct snd_soc_component *scomp, int index,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sof_ipc4_dai_get_clk(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int clk_type)
|
||||
static int sof_ipc4_dai_get_param(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int param_type)
|
||||
{
|
||||
struct sof_ipc4_copier *ipc4_copier = dai->private;
|
||||
struct snd_soc_tplg_hw_config *hw_config;
|
||||
@ -3188,13 +3188,15 @@ static int sof_ipc4_dai_get_clk(struct snd_sof_dev *sdev, struct snd_sof_dai *da
|
||||
|
||||
switch (ipc4_copier->dai_type) {
|
||||
case SOF_DAI_INTEL_SSP:
|
||||
switch (clk_type) {
|
||||
case SOF_DAI_CLK_INTEL_SSP_MCLK:
|
||||
switch (param_type) {
|
||||
case SOF_DAI_PARAM_INTEL_SSP_MCLK:
|
||||
return le32_to_cpu(hw_config->mclk_rate);
|
||||
case SOF_DAI_CLK_INTEL_SSP_BCLK:
|
||||
case SOF_DAI_PARAM_INTEL_SSP_BCLK:
|
||||
return le32_to_cpu(hw_config->bclk_rate);
|
||||
case SOF_DAI_PARAM_INTEL_SSP_TDM_SLOTS:
|
||||
return le32_to_cpu(hw_config->tdm_slots);
|
||||
default:
|
||||
dev_err(sdev->dev, "Invalid clk type for SSP %d\n", clk_type);
|
||||
dev_err(sdev->dev, "invalid SSP param %d\n", param_type);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -3371,7 +3373,7 @@ const struct sof_ipc_tplg_ops ipc4_tplg_ops = {
|
||||
.route_free = sof_ipc4_route_free,
|
||||
.dai_config = sof_ipc4_dai_config,
|
||||
.parse_manifest = sof_ipc4_parse_manifest,
|
||||
.dai_get_clk = sof_ipc4_dai_get_clk,
|
||||
.dai_get_param = sof_ipc4_dai_get_param,
|
||||
.tear_down_all_pipelines = sof_ipc4_tear_down_all_pipelines,
|
||||
.link_setup = sof_ipc4_link_setup,
|
||||
};
|
||||
|
@ -978,7 +978,7 @@ struct snd_sof_dai *snd_sof_find_dai(struct snd_soc_component *scomp,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int sof_dai_get_clk(struct snd_soc_pcm_runtime *rtd, int clk_type)
|
||||
static int sof_dai_get_param(struct snd_soc_pcm_runtime *rtd, int param_type)
|
||||
{
|
||||
struct snd_soc_component *component =
|
||||
snd_soc_rtdcom_lookup(rtd, SOF_AUDIO_PCM_DRV_NAME);
|
||||
@ -991,8 +991,8 @@ static int sof_dai_get_clk(struct snd_soc_pcm_runtime *rtd, int clk_type)
|
||||
if (!dai)
|
||||
return 0;
|
||||
|
||||
if (tplg_ops && tplg_ops->dai_get_clk)
|
||||
return tplg_ops->dai_get_clk(sdev, dai, clk_type);
|
||||
if (tplg_ops && tplg_ops->dai_get_param)
|
||||
return tplg_ops->dai_get_param(sdev, dai, param_type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1003,7 +1003,7 @@ static int sof_dai_get_clk(struct snd_soc_pcm_runtime *rtd, int clk_type)
|
||||
*/
|
||||
int sof_dai_get_mclk(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
return sof_dai_get_clk(rtd, SOF_DAI_CLK_INTEL_SSP_MCLK);
|
||||
return sof_dai_get_param(rtd, SOF_DAI_PARAM_INTEL_SSP_MCLK);
|
||||
}
|
||||
EXPORT_SYMBOL(sof_dai_get_mclk);
|
||||
|
||||
@ -1013,6 +1013,16 @@ EXPORT_SYMBOL(sof_dai_get_mclk);
|
||||
*/
|
||||
int sof_dai_get_bclk(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
return sof_dai_get_clk(rtd, SOF_DAI_CLK_INTEL_SSP_BCLK);
|
||||
return sof_dai_get_param(rtd, SOF_DAI_PARAM_INTEL_SSP_BCLK);
|
||||
}
|
||||
EXPORT_SYMBOL(sof_dai_get_bclk);
|
||||
|
||||
/*
|
||||
* Helper to get SSP TDM slot number from a pcm_runtime.
|
||||
* Return 0 if not exist.
|
||||
*/
|
||||
int sof_dai_get_tdm_slots(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
return sof_dai_get_param(rtd, SOF_DAI_PARAM_INTEL_SSP_TDM_SLOTS);
|
||||
}
|
||||
EXPORT_SYMBOL(sof_dai_get_tdm_slots);
|
||||
|
@ -44,8 +44,9 @@
|
||||
#define WIDGET_IS_AIF_OR_DAI(id) (WIDGET_IS_DAI(id) || WIDGET_IS_AIF(id))
|
||||
#define WIDGET_IS_COPIER(id) (WIDGET_IS_AIF_OR_DAI(id) || (id) == snd_soc_dapm_buffer)
|
||||
|
||||
#define SOF_DAI_CLK_INTEL_SSP_MCLK 0
|
||||
#define SOF_DAI_CLK_INTEL_SSP_BCLK 1
|
||||
#define SOF_DAI_PARAM_INTEL_SSP_MCLK 0
|
||||
#define SOF_DAI_PARAM_INTEL_SSP_BCLK 1
|
||||
#define SOF_DAI_PARAM_INTEL_SSP_TDM_SLOTS 2
|
||||
|
||||
enum sof_widget_op {
|
||||
SOF_WIDGET_PREPARE,
|
||||
@ -208,7 +209,7 @@ struct sof_ipc_tplg_widget_ops {
|
||||
* @widget_setup: Function pointer for setting up setup in the DSP
|
||||
* @widget_free: Function pointer for freeing widget in the DSP
|
||||
* @dai_config: Function pointer for sending DAI config IPC to the DSP
|
||||
* @dai_get_clk: Function pointer for getting the DAI clock setting
|
||||
* @dai_get_param: Function pointer for getting the DAI parameter
|
||||
* @set_up_all_pipelines: Function pointer for setting up all topology pipelines
|
||||
* @tear_down_all_pipelines: Function pointer for tearing down all topology pipelines
|
||||
* @parse_manifest: Function pointer for ipc4 specific parsing of topology manifest
|
||||
@ -229,7 +230,7 @@ struct sof_ipc_tplg_ops {
|
||||
int (*widget_free)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);
|
||||
int (*dai_config)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget,
|
||||
unsigned int flags, struct snd_sof_dai_config_data *data);
|
||||
int (*dai_get_clk)(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int clk_type);
|
||||
int (*dai_get_param)(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int param_type);
|
||||
int (*set_up_all_pipelines)(struct snd_sof_dev *sdev, bool verify);
|
||||
int (*tear_down_all_pipelines)(struct snd_sof_dev *sdev, bool verify);
|
||||
int (*parse_manifest)(struct snd_soc_component *scomp, int index,
|
||||
|
Loading…
Reference in New Issue
Block a user