Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 51 additions & 70 deletions sound/soc/intel/common/soc-acpi-intel-ptl-match.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,23 @@ static const struct snd_soc_acpi_endpoint jack_dmic_endpoints[] = {
},
};

static const struct snd_soc_acpi_endpoint amp_dmic_endpoints[] = {
/* AMP Endpoint */
{
.num = 0,
.aggregated = 0,
.group_position = 0,
.group_id = 0,
},
/* DMIC Endpoint */
{
.num = 1,
.aggregated = 0,
.group_position = 0,
.group_id = 0,
},
};

static const struct snd_soc_acpi_endpoint jack_amp_g1_dmic_endpoints[] = {
/* Jack Endpoint */
{
Expand Down Expand Up @@ -365,29 +382,11 @@ static const struct snd_soc_acpi_adr_device rt722_0_agg_adr[] = {
}
};

static const struct snd_soc_acpi_adr_device rt722_0_single_adr[] = {
{
.adr = 0x000030025d072201ull,
.num_endpoints = ARRAY_SIZE(rt_mf_endpoints),
.endpoints = rt_mf_endpoints,
.name_prefix = "rt722"
}
};

static const struct snd_soc_acpi_adr_device rt722_1_single_adr[] = {
{
.adr = 0x000130025d072201ull,
.num_endpoints = ARRAY_SIZE(rt_mf_endpoints),
.endpoints = rt_mf_endpoints,
.name_prefix = "rt722"
}
};

static const struct snd_soc_acpi_adr_device rt722_3_single_adr[] = {
static const struct snd_soc_acpi_adr_device rt722_vb_single_adr[] = {
{
.adr = 0x000330025d072201ull,
.num_endpoints = ARRAY_SIZE(rt_mf_endpoints),
.endpoints = rt_mf_endpoints,
.adr = 0x000330025D072201ull,
.num_endpoints = 1,
.endpoints = &single_endpoint,
.name_prefix = "rt722"
}
};
Expand Down Expand Up @@ -446,6 +445,15 @@ static const struct snd_soc_acpi_adr_device rt1320_3_group2_adr[] = {
}
};

static const struct snd_soc_acpi_adr_device rt1320_4_group1_adr[] = {
{
.adr = 0x000230025D132001ull,
.num_endpoints = ARRAY_SIZE(amp_dmic_endpoints),
.endpoints = amp_dmic_endpoints,
.name_prefix = "rt1320-1"
}
};

static const struct snd_soc_acpi_link_adr ptl_cs42l43_agg_l3_cs35l56_l2[] = {
{
.mask = BIT(3),
Expand Down Expand Up @@ -479,33 +487,6 @@ static const struct snd_soc_acpi_link_adr ptl_cs42l43_l2_cs35l56x6_l13[] = {
{}
};

static const struct snd_soc_acpi_link_adr ptl_rt722_only[] = {
{
.mask = BIT(0),
.num_adr = ARRAY_SIZE(rt722_0_single_adr),
.adr_d = rt722_0_single_adr,
},
{}
};

static const struct snd_soc_acpi_link_adr ptl_rt722_l1[] = {
{
.mask = BIT(1),
.num_adr = ARRAY_SIZE(rt722_1_single_adr),
.adr_d = rt722_1_single_adr,
},
{}
};

static const struct snd_soc_acpi_link_adr ptl_rt722_l3[] = {
{
.mask = BIT(3),
.num_adr = ARRAY_SIZE(rt722_3_single_adr),
.adr_d = rt722_3_single_adr,
},
{}
};

static const struct snd_soc_acpi_link_adr ptl_rt722_l0_rt1320_l23[] = {
{
.mask = BIT(0),
Expand Down Expand Up @@ -614,6 +595,20 @@ static const struct snd_soc_acpi_link_adr ptl_sdw_rt712_vb_l3_rt1320_l3[] = {
{}
};

static const struct snd_soc_acpi_link_adr ptl_sdw_rt722_vb_l3_rt1320_l2[] = {
{
.mask = BIT(3),
.num_adr = ARRAY_SIZE(rt722_vb_single_adr),
.adr_d = rt722_vb_single_adr,
},
{
.mask = BIT(2),
.num_adr = ARRAY_SIZE(rt1320_4_group1_adr),
.adr_d = rt1320_4_group1_adr,
},
{}
};

/* this table is used when there is no I2S codec present */
struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = {
/* Order Priority: mockup > most links > most bit link-mask > alphabetical */
Expand Down Expand Up @@ -686,6 +681,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = {
.sof_tplg_filename = "sof-ptl-rt712-l3-rt1320-l2.tplg",
.get_function_tplg_files = sof_sdw_get_tplg_files,
},
{
.link_mask = BIT(2) | BIT(3),
.links = ptl_sdw_rt722_vb_l3_rt1320_l2,
.drv_name = "sof_sdw",
.sof_tplg_filename = "sof-ptl-rt722-l3-rt1320-l2.tplg",
.get_function_tplg_files = sof_sdw_get_tplg_files,
},
{
.link_mask = BIT(2) | BIT(3),
.links = ptl_cs42l43_agg_l3_cs35l56_l2,
Expand All @@ -698,20 +700,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = {
.drv_name = "sof_sdw",
.sof_tplg_filename = "sof-ptl-rt711.tplg",
},
{
.link_mask = BIT(0),
.links = ptl_rt722_only,
.drv_name = "sof_sdw",
.sof_tplg_filename = "sof-ptl-rt722.tplg",
.get_function_tplg_files = sof_sdw_get_tplg_files,
},
{
.link_mask = BIT(1),
.links = ptl_rt722_l1,
.drv_name = "sof_sdw",
.sof_tplg_filename = "sof-ptl-rt722.tplg",
.get_function_tplg_files = sof_sdw_get_tplg_files,
},
{
.link_mask = BIT(3),
.links = ptl_sdw_rt712_vb_l3_rt1320_l3,
Expand All @@ -720,13 +708,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = {
.sof_tplg_filename = "sof-ptl-rt712-l3-rt1320-l3.tplg",
.get_function_tplg_files = sof_sdw_get_tplg_files,
},
{
.link_mask = BIT(3),
.links = ptl_rt722_l3,
.drv_name = "sof_sdw",
.sof_tplg_filename = "sof-ptl-rt722.tplg",
.get_function_tplg_files = sof_sdw_get_tplg_files,
},
{},
};
EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_ptl_sdw_machines);
38 changes: 34 additions & 4 deletions sound/soc/sdw_utils/soc_sdw_rt_dmic.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@
#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include <sound/soc_sdw_utils.h>
#include <sound/sdca_function.h>

int asoc_sdw_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 sdw_slave *sdw_peripheral;
struct asoc_sdw_codec_info *codec_info;
char *mic_name;
int rt1320_dmic_num = 0, part_id, i;

component = dai->component;

Expand All @@ -27,14 +31,40 @@ int asoc_sdw_rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_da
*/
if (!strcmp(component->name_prefix, "rt714"))
mic_name = devm_kasprintf(card->dev, GFP_KERNEL, "rt715-sdca");
else
/*
* If there is any rt1320 DMIC belonging to this card, try to count the `cfg-mics` to be used in card->components.
*/
else if (!strcmp(dai->name, "rt1320-aif2")) {
codec_info = asoc_sdw_find_codec_info_dai(dai->name, &i);
part_id = codec_info->part_id;
mic_name = devm_kasprintf(card->dev, GFP_KERNEL, "%s", codec_info->dais[i].component_name);

for_each_card_components(card, component) {
sdw_peripheral = dev_to_sdw_dev(component->dev);
if (sdw_peripheral->id.part_id != part_id)
continue;
// Count the DMIC with SDCA function type as RT1320 DMIC.
for (i = 0; i < sdw_peripheral->sdca_data.num_functions; i++) {
if (sdw_peripheral->sdca_data.function[i].type == SDCA_FUNCTION_TYPE_SMART_MIC) {
dev_dbg(component->dev, " - SDCA function[%d] type %s found\n", i, SDCA_FUNCTION_TYPE_SMART_MIC_NAME);
rt1320_dmic_num++;
break;
}
}
}
} else
mic_name = devm_kasprintf(card->dev, GFP_KERNEL, "%s", component->name_prefix);
if (!mic_name)
return -ENOMEM;

card->components = devm_kasprintf(card->dev, GFP_KERNEL,
"%s mic:%s", card->components,
mic_name);
if (rt1320_dmic_num > 0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if dai->name == rt1320-aif2 but rt1320_dmic_num == 0?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The situation you said should never have happened.
Might use
if (!strcmp(dai->name, "rt1320-aif2"))
instead of
if (rt1320_dmic_num > 0)

card->components = devm_kasprintf(card->dev, GFP_KERNEL,
"%s mic:%s cfg-mics:%d", card->components,
mic_name, rt1320_dmic_num);
else
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
"%s mic:%s", card->components,
mic_name);
if (!card->components)
return -ENOMEM;

Expand Down
12 changes: 11 additions & 1 deletion sound/soc/sdw_utils/soc_sdw_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,18 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.widgets = generic_spk_widgets,
.num_widgets = ARRAY_SIZE(generic_spk_widgets),
},
{
.direction = {false, true},
.dai_name = "rt1320-aif2",
.component_name = "rt1320",
.dai_type = SOC_SDW_DAI_TYPE_MIC,
.dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_DMIC_DAI_ID},
.rtd_init = asoc_sdw_rt_dmic_rtd_init,
.widgets = generic_dmic_widgets,
.num_widgets = ARRAY_SIZE(generic_dmic_widgets),
},
},
.dai_num = 1,
.dai_num = 2,
},
{
.part_id = 0x1321,
Expand Down
Loading