Skip to content

ASoC: Intel: soc-acpi-intel-ptl-match: Sort ACPI link/machine tables#5352

Merged
ranj063 merged 1 commit intothesofproject:topic/sof-devfrom
naveen-manohar:ptlacpi-sort
Mar 19, 2025
Merged

ASoC: Intel: soc-acpi-intel-ptl-match: Sort ACPI link/machine tables#5352
ranj063 merged 1 commit intothesofproject:topic/sof-devfrom
naveen-manohar:ptlacpi-sort

Conversation

@naveen-manohar
Copy link
Copy Markdown

@naveen-manohar naveen-manohar commented Mar 7, 2025

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.
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

Per above criteria sorted entries in snd_soc_acpi_link_adr & snd_soc_acpi_intel_ptl_sdw_machines table:
sdw_mockup_headset_2amps_mic
sdw_mockup_headset_1amp_mic
sdw_mockup_mic_headset_1amp
sdw_mockup_multi_func
ptl_sdw_rt713_vb_l2_rt1320_l13
ptl_sdw_rt713_vb_l3_rt1320_l12
ptl_cs42l43_l2_cs35l56x6_l13
ptl_sdw_rt712_vb_l2_rt1320_l1
ptl_sdw_rt712_vb_l3_rt1320_l2
ptl_rvp
ptl_rt722_only
ptl_rt722_l1
ptl_cs42l43_l3
ptl_rt721_l3
ptl_rt722_l3

@lgirdwood
Copy link
Copy Markdown
Member

why the reorder ? Is this to make it easier to access ?

@bardliao
Copy link
Copy Markdown
Collaborator

why the reorder ? Is this to make it easier to access ?

We check subset of link mask when matching the machine driver. IOW, if a subset match is in front of a superset match, the subset match will be selected.
https://github.com/thesofproject/linux/blob/topic/sof-dev/sound/soc/sof/intel/hda.c#L1153
For example, say we have 2 matches
A: rt722 on link 0
B: rt722 on link 0 and rt1320 on link 1.
If the order is A -> B, then A will be selected even if there are some other codecs in the laptop.
But, if the order is B -> A, B will not be selected if there is only rt722 in the laptop.
The hard rule is that the superset match should be in front of the subset match.
We don't have subset/superset cases in PTL match so far. But it is worth to make a rule to ensure the superset match is always in front of the subset match.

@naveen-manohar naveen-manohar force-pushed the ptlacpi-sort branch 2 times, most recently from d49fdfc to 190936e Compare March 10, 2025 05:24
@lgirdwood
Copy link
Copy Markdown
Member

why the reorder ? Is this to make it easier to access ?

We check subset of link mask when matching the machine driver. IOW, if a subset match is in front of a superset match, the subset match will be selected. https://github.com/thesofproject/linux/blob/topic/sof-dev/sound/soc/sof/intel/hda.c#L1153 For example, say we have 2 matches A: rt722 on link 0 B: rt722 on link 0 and rt1320 on link 1. If the order is A -> B, then A will be selected even if there are some other codecs in the laptop. But, if the order is B -> A, B will not be selected if there is only rt722 in the laptop. The hard rule is that the superset match should be in front of the subset match. We don't have subset/superset cases in PTL match so far. But it is worth to make a rule to ensure the superset match is always in front of the subset match.

Do we spell this out in a BIG comment at the top of the file ?

@naveen-manohar
Copy link
Copy Markdown
Author

why the reorder ? Is this to make it easier to access ?

We check subset of link mask when matching the machine driver. IOW, if a subset match is in front of a superset match, the subset match will be selected. https://github.com/thesofproject/linux/blob/topic/sof-dev/sound/soc/sof/intel/hda.c#L1153 For example, say we have 2 matches A: rt722 on link 0 B: rt722 on link 0 and rt1320 on link 1. If the order is A -> B, then A will be selected even if there are some other codecs in the laptop. But, if the order is B -> A, B will not be selected if there is only rt722 in the laptop. The hard rule is that the superset match should be in front of the subset match. We don't have subset/superset cases in PTL match so far. But it is worth to make a rule to ensure the superset match is always in front of the subset match.

Do we spell this out in a BIG comment at the top of the file ?

Did comment on this, please let me know if anything more to be added.
190936e#:~:text=/*%20mockup%20tests%20need%20to%20be%20first%20*/,*/

}
};

static const struct snd_soc_acpi_adr_device cs42l43_3_adr[] = {
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.

Reordering snd_soc_acpi_intel_ptl_sdw_machines[] is enough. Let's leave other stuff as it is and help people focus on the required change.

bardliao
bardliao previously approved these changes Mar 14, 2025
@lgirdwood
Copy link
Copy Markdown
Member

Did comment on this, please let me know if anything more to be added. 190936e#:~:text=/%20mockup%20tests%20need%20to%20be%20first%20/,*/

Ok, this is good - but it needs to be at the top of the file so that patch authors and maintainers can easily see the rule and apply. No one will check the git commit log before making changes to a file.

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>
@naveen-manohar
Copy link
Copy Markdown
Author

Did comment on this, please let me know if anything more to be added. 190936e#:~:text=/%20mockup%20tests%20need%20to%20be%20first%20/,*/

Ok, this is good - but it needs to be at the top of the file so that patch authors and maintainers can easily see the rule and apply. No one will check the git commit log before making changes to a file.

Agreed, have updated.
Kindly review

Copy link
Copy Markdown
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

@ujfalusi @ranj063 pls review/merge.

@ranj063 ranj063 merged commit 35deb2f into thesofproject:topic/sof-dev Mar 19, 2025
12 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants