Skip to content

Commit 08095e2

Browse files
naveen-manoharbroonie
authored andcommitted
ASoC: Intel: soc-acpi-intel-ptl-match: Sort ACPI link/machine tables
Check subset of link mask when matching the machine driver, rule is superset match should be ordered before subset matches. Priority: mockup > most links > most bit link-mask > alphabetical Reorder acpi_link_adr & sdw_machine tables per defined criteria: 1.Mock Test 1st 2.Most links 1st 3.link_mask with more bit first 4.link_number number order 5.Alphabetical order Signed-off-by: Naveen Manohar <naveen.m@intel.com> Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://patch.msgid.link/20250506014930.5408-1-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent a71b261 commit 08095e2

1 file changed

Lines changed: 45 additions & 41 deletions

File tree

sound/soc/intel/common/soc-acpi-intel-ptl-match.c

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
*
55
* Copyright (c) 2024, Intel Corporation.
66
*
7+
* Order of entries in snd_soc_acpi_intel_ptl_sdw_machines[] matters.
8+
* Check subset of link mask when matching the machine driver, rule is
9+
* superset match should be ordered before subset matches.
710
*/
811

912
#include <sound/soc-acpi.h>
@@ -540,7 +543,7 @@ static const struct snd_soc_acpi_link_adr ptl_sdw_rt712_vb_l3_rt1320_l2[] = {
540543

541544
/* this table is used when there is no I2S codec present */
542545
struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = {
543-
/* mockup tests need to be first */
546+
/* Order Priority: mockup > most links > most bit link-mask > alphabetical */
544547
{
545548
.link_mask = GENMASK(3, 0),
546549
.links = sdw_mockup_headset_2amps_mic,
@@ -559,88 +562,89 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = {
559562
.drv_name = "sof_sdw",
560563
.sof_tplg_filename = "sof-ptl-rt715-rt711-rt1308-mono.tplg",
561564
},
562-
{
563-
.link_mask = BIT(1) | BIT(2) | BIT(3),
564-
.links = ptl_cs42l43_l2_cs35l56x6_l13,
565-
.drv_name = "sof_sdw",
566-
.sof_tplg_filename = "sof-ptl-cs42l43-l2-cs35l56x6-l13.tplg",
567-
},
568565
{
569566
.link_mask = BIT(0),
570567
.links = sdw_mockup_multi_func,
571568
.drv_name = "sof_sdw",
572569
.sof_tplg_filename = "sof-ptl-rt722.tplg", /* Reuse the existing tplg file */
573570
},
574571
{
575-
.link_mask = BIT(0),
576-
.links = ptl_rvp,
572+
.link_mask = BIT(1) | BIT(2) | BIT(3),
573+
.links = ptl_sdw_rt713_vb_l2_rt1320_l13,
577574
.drv_name = "sof_sdw",
578-
.sof_tplg_filename = "sof-ptl-rt711.tplg",
575+
.machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb,
576+
.sof_tplg_filename = "sof-ptl-rt713-l2-rt1320-l13.tplg",
577+
.get_function_tplg_files = sof_sdw_get_tplg_files,
579578
},
580579
{
581-
.link_mask = BIT(3),
582-
.links = ptl_cs42l43_l3,
580+
.link_mask = BIT(1) | BIT(2) | BIT(3),
581+
.links = ptl_sdw_rt713_vb_l3_rt1320_l12,
583582
.drv_name = "sof_sdw",
584-
.sof_tplg_filename = "sof-ptl-cs42l43-l3.tplg",
583+
.machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb,
584+
.sof_tplg_filename = "sof-ptl-rt713-l3-rt1320-l12.tplg",
585+
.get_function_tplg_files = sof_sdw_get_tplg_files,
585586
},
586587
{
587-
.link_mask = BIT(3),
588-
.links = ptl_rt721_l3,
588+
.link_mask = BIT(1) | BIT(2) | BIT(3),
589+
.links = ptl_cs42l43_l2_cs35l56x6_l13,
589590
.drv_name = "sof_sdw",
590-
.sof_tplg_filename = "sof-ptl-rt721.tplg",
591-
.get_function_tplg_files = sof_sdw_get_tplg_files,
591+
.sof_tplg_filename = "sof-ptl-cs42l43-l2-cs35l56x6-l13.tplg",
592592
},
593593
{
594-
.link_mask = BIT(0),
595-
.links = ptl_rt722_only,
594+
.link_mask = BIT(1) | BIT(2),
595+
.links = ptl_sdw_rt712_vb_l2_rt1320_l1,
596596
.drv_name = "sof_sdw",
597-
.sof_tplg_filename = "sof-ptl-rt722.tplg",
597+
.machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb,
598+
.sof_tplg_filename = "sof-ptl-rt712-l2-rt1320-l1.tplg",
598599
.get_function_tplg_files = sof_sdw_get_tplg_files,
599600
},
600601
{
601-
.link_mask = BIT(1),
602-
.links = ptl_rt722_l1,
602+
.link_mask = BIT(2) | BIT(3),
603+
.links = ptl_sdw_rt712_vb_l3_rt1320_l2,
603604
.drv_name = "sof_sdw",
604-
.sof_tplg_filename = "sof-ptl-rt722.tplg",
605+
.machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb,
606+
.sof_tplg_filename = "sof-ptl-rt712-l3-rt1320-l2.tplg",
605607
.get_function_tplg_files = sof_sdw_get_tplg_files,
606608
},
607609
{
608-
.link_mask = BIT(3),
609-
.links = ptl_rt722_l3,
610+
.link_mask = BIT(0),
611+
.links = ptl_rvp,
612+
.drv_name = "sof_sdw",
613+
.sof_tplg_filename = "sof-ptl-rt711.tplg",
614+
},
615+
{
616+
.link_mask = BIT(0),
617+
.links = ptl_rt722_only,
610618
.drv_name = "sof_sdw",
611619
.sof_tplg_filename = "sof-ptl-rt722.tplg",
612620
.get_function_tplg_files = sof_sdw_get_tplg_files,
613621
},
614622
{
615-
.link_mask = BIT(1) | BIT(2),
616-
.links = ptl_sdw_rt712_vb_l2_rt1320_l1,
623+
.link_mask = BIT(1),
624+
.links = ptl_rt722_l1,
617625
.drv_name = "sof_sdw",
618-
.machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb,
619-
.sof_tplg_filename = "sof-ptl-rt712-l2-rt1320-l1.tplg",
626+
.sof_tplg_filename = "sof-ptl-rt722.tplg",
620627
.get_function_tplg_files = sof_sdw_get_tplg_files,
621628
},
622629
{
623-
.link_mask = BIT(2) | BIT(3),
624-
.links = ptl_sdw_rt712_vb_l3_rt1320_l2,
630+
.link_mask = BIT(3),
631+
.links = ptl_cs42l43_l3,
625632
.drv_name = "sof_sdw",
626-
.machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb,
627-
.sof_tplg_filename = "sof-ptl-rt712-l3-rt1320-l2.tplg",
633+
.sof_tplg_filename = "sof-ptl-cs42l43-l3.tplg",
628634
.get_function_tplg_files = sof_sdw_get_tplg_files,
629635
},
630636
{
631-
.link_mask = BIT(1) | BIT(2) | BIT(3),
632-
.links = ptl_sdw_rt713_vb_l2_rt1320_l13,
637+
.link_mask = BIT(3),
638+
.links = ptl_rt721_l3,
633639
.drv_name = "sof_sdw",
634-
.machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb,
635-
.sof_tplg_filename = "sof-ptl-rt713-l2-rt1320-l13.tplg",
640+
.sof_tplg_filename = "sof-ptl-rt721.tplg",
636641
.get_function_tplg_files = sof_sdw_get_tplg_files,
637642
},
638643
{
639-
.link_mask = BIT(1) | BIT(2) | BIT(3),
640-
.links = ptl_sdw_rt713_vb_l3_rt1320_l12,
644+
.link_mask = BIT(3),
645+
.links = ptl_rt722_l3,
641646
.drv_name = "sof_sdw",
642-
.machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb,
643-
.sof_tplg_filename = "sof-ptl-rt713-l3-rt1320-l12.tplg",
647+
.sof_tplg_filename = "sof-ptl-rt722.tplg",
644648
.get_function_tplg_files = sof_sdw_get_tplg_files,
645649
},
646650
{},

0 commit comments

Comments
 (0)