Skip to content

Commit

Permalink
ASoC: Intel: sof_ssp_amp: use common module for amp link
Browse files Browse the repository at this point in the history
Use intel_board module for speaker amplifier DAI link initialization.

Signed-off-by: Brent Lu <[email protected]>
  • Loading branch information
brentlu committed Nov 9, 2023
1 parent 30a46ac commit 1d1b24e
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions sound/soc/intel/boards/sof_ssp_amp.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static struct snd_soc_dai_link_component platform_component[] = {

static struct snd_soc_dai_link *
sof_card_dai_links_create(struct device *dev, enum sof_ssp_codec amp_type,
int ssp_codec, int dmic_be_num, int hdmi_num,
int ssp_amp, int dmic_be_num, int hdmi_num,
bool idisp_codec)
{
struct snd_soc_dai_link_component *cpus;
Expand Down Expand Up @@ -152,12 +152,13 @@ sof_card_dai_links_create(struct device *dev, enum sof_ssp_codec amp_type,

/* codec SSP */
if (amp_type != CODEC_NONE) {
links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_codec);
if (!links[id].name)
be_id = fixed_be ? SPK_BE_ID : id;
ret = sof_intel_board_set_ssp_amp_link(dev, &links[id], be_id,
amp_type, ssp_amp);
if (ret)
return NULL;

links[id].id = fixed_be ? SPK_BE_ID : id;

/* codec-specific fields */
switch (amp_type) {
case CODEC_CS35L41:
cs35l41_set_dai_link(&links[id]);
Expand All @@ -170,18 +171,6 @@ sof_card_dai_links_create(struct device *dev, enum sof_ssp_codec amp_type,
return NULL;
}

links[id].platforms = platform_component;
links[id].num_platforms = ARRAY_SIZE(platform_component);
links[id].dpcm_playback = 1;
/* feedback from amplifier or firmware-generated echo reference */
links[id].dpcm_capture = 1;
links[id].no_pcm = 1;
links[id].cpus = &cpus[id];
links[id].num_cpus = 1;
links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_codec);
if (!links[id].cpus->dai_name)
return NULL;

id++;
}

Expand Down Expand Up @@ -254,7 +243,7 @@ static int sof_ssp_amp_probe(struct platform_device *pdev)
struct snd_soc_acpi_mach *mach = pdev->dev.platform_data;
struct snd_soc_dai_link *dai_links;
struct sof_card_private *ctx;
int ret, ssp_codec;
int ret;

ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx)
Expand All @@ -270,7 +259,7 @@ static int sof_ssp_amp_probe(struct platform_device *pdev)
else
ctx->dmic_be_num = 0;

ssp_codec = sof_ssp_amp_quirk & SOF_AMPLIFIER_SSP_MASK;
ctx->ssp_amp = sof_ssp_amp_quirk & SOF_AMPLIFIER_SSP_MASK;

/* set number of dai links */
sof_ssp_amp_card.num_links = ctx->dmic_be_num;
Expand Down Expand Up @@ -301,7 +290,7 @@ static int sof_ssp_amp_probe(struct platform_device *pdev)
sof_ssp_amp_card.num_links++;

dai_links = sof_card_dai_links_create(&pdev->dev, ctx->amp_type,
ssp_codec, ctx->dmic_be_num,
ctx->ssp_amp, ctx->dmic_be_num,
ctx->hdmi_num,
ctx->hdmi.idisp_codec);
if (!dai_links)
Expand Down

0 comments on commit 1d1b24e

Please sign in to comment.