Skip to content
Open
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
74 changes: 74 additions & 0 deletions sound/soc/intel/common/soc-acpi-intel-ptl-match.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,25 @@ static const struct snd_soc_acpi_adr_device cs42l43_2_adr[] = {
}
};

static const struct snd_soc_acpi_adr_device cs42l43_3_agg_rt722_ghost_adr[] = {
{
.adr = 0x00033001FA424301ull,
.num_endpoints = ARRAY_SIZE(cs42l43_amp_spkagg_endpoints),
.endpoints = cs42l43_amp_spkagg_endpoints,
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I will wait for the test result since I am not quite sure if cs42l43 amp is aggregated with cs35l56s. @charleskeepax FYI

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@charleskeepax Is there a way that we can support the same codec/amp combination but with different endpoints? To be more specific, cs42l43 with and without amp aggregated. The endpoint will be skipped by the machine driver, but the topology was selected before we check is the endpoint present.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yeah its not aggregated here, I think the host thinks it is because of the smart amps bits on the rt722. If we use match tables you can't tell the difference between two systems with identical parts one of which aggregates.

I kinda wonder if this match table approach is the best way to go, it makes me nervous because I don't like mixing match tables and function topologies. Feels like it introduces chances of things matching when they should actually have used function topologies. Two other approaches that I can think of:

  1. We could disable the realtek codec using a SSDT something like:
DefinitionBlock ("", "SSDT", 2, "Test", "rt722", 0x00001000)
{
    External (_SB.PC00.HDAS.IDA.SNDW.SWD0, DeviceObj)
    Scope (\_SB.PC00.HDAS.IDA.SNDW.SWD0)
    {
        Method (_STA, 0, NotSerialized)
        {
            Return (Zero)
        }
    }
}

That should make the kernel ignore the device. Leaves the kernel code the cleanest and since this is an ACPI problem perhaps its the right place to fix it? Does mean people have to install and SSDT to make the laptop work though.... so dunno.

  1. Could we do some sort of quirk thing, like the stuff in sdca_device.c? Get the core to ignore the rt722 just for this system.

.name_prefix = "cs42l43"
},
/*
* To handle cases where the rt722 codec is listed in the BIOS while the
* hardware is not physically present.
*/
{
.adr = 0x000330025d072201ull, /* Ghost rt722 */
.num_endpoints = 0,
.endpoints = NULL,
.name_prefix = "ghost"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

gah :(

}
};

static const struct snd_soc_acpi_adr_device cs42l43_3_agg_adr[] = {
{
.adr = 0x00033001FA424301ull,
Expand All @@ -235,6 +254,36 @@ static const struct snd_soc_acpi_adr_device cs35l56_2_lr_adr[] = {
}
};

static const struct snd_soc_acpi_adr_device cs35l56_2_2amp_adr[] = {
{
.adr = 0x00023001fa355601ull,
.num_endpoints = 1,
.endpoints = &spk_1_endpoint,
.name_prefix = "AMP1"
},
{
.adr = 0x00023101fa355601ull,
.num_endpoints = 1,
.endpoints = &spk_2_endpoint,
.name_prefix = "AMP2"
}
};

static const struct snd_soc_acpi_adr_device cs35l56_1_2amp_adr[] = {
{
.adr = 0x00013201fa355601ull,
.num_endpoints = 1,
.endpoints = &spk_3_endpoint,
.name_prefix = "AMP3"
},
{
.adr = 0x00013301fa355601ull,
.num_endpoints = 1,
.endpoints = &spk_4_endpoint,
.name_prefix = "AMP4"
}
};

static const struct snd_soc_acpi_adr_device cs35l56_1_3amp_adr[] = {
{
.adr = 0x00013001fa355601ull,
Expand Down Expand Up @@ -394,6 +443,25 @@ static const struct snd_soc_acpi_adr_device rt1320_3_group2_adr[] = {
}
};

static const struct snd_soc_acpi_link_adr ptl_cs42l43_agg_l3_cs35l56_l12_ghost_rt722[] = {
{
.mask = BIT(3),
.num_adr = ARRAY_SIZE(cs42l43_3_agg_rt722_ghost_adr),
.adr_d = cs42l43_3_agg_rt722_ghost_adr,
},
{
.mask = BIT(2),
.num_adr = ARRAY_SIZE(cs35l56_2_2amp_adr),
.adr_d = cs35l56_2_2amp_adr,
},
{
.mask = BIT(1),
.num_adr = ARRAY_SIZE(cs35l56_1_2amp_adr),
.adr_d = cs35l56_1_2amp_adr,
},
{}
};

static const struct snd_soc_acpi_link_adr ptl_cs42l43_agg_l3_cs35l56_l2[] = {
{
.mask = BIT(3),
Expand Down Expand Up @@ -584,6 +652,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = {
.drv_name = "sof_sdw",
.sof_tplg_filename = "sof-ptl-cs42l43-l2-cs35l56x6-l13.tplg",
},
{
.link_mask = BIT(1) | BIT(2) | BIT(3),
.links = ptl_cs42l43_agg_l3_cs35l56_l12_ghost_rt722,
.drv_name = "sof_sdw",
.sof_tplg_filename = "sof-ptl-cs42l43-agg-l3-cs35l56-l12.tplg",
},
{
.link_mask = BIT(0) | BIT(2) | BIT(3),
.links = ptl_rt722_l0_rt1320_l23,
Expand Down
Loading