@@ -1653,92 +1653,95 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev
1653
1653
hdev = pdata -> hw_pdata ;
1654
1654
link_mask = hdev -> info .link_mask ;
1655
1655
1656
+ if (!link_mask ) {
1657
+ dev_info (sdev -> dev , "SoundWire links not enabled\n" );
1658
+ return NULL ;
1659
+ }
1660
+
1656
1661
/*
1657
1662
* Select SoundWire machine driver if needed using the
1658
1663
* alternate tables. This case deals with SoundWire-only
1659
1664
* machines, for mixed cases with I2C/I2S the detection relies
1660
1665
* on the HID list.
1661
1666
*/
1662
- if (link_mask ) {
1663
- for (mach = pdata -> desc -> alt_machines ;
1664
- mach && mach -> link_mask ; mach ++ ) {
1665
- /*
1666
- * On some platforms such as Up Extreme all links
1667
- * are enabled but only one link can be used by
1668
- * external codec. Instead of exact match of two masks,
1669
- * first check whether link_mask of mach is subset of
1670
- * link_mask supported by hw and then go on searching
1671
- * link_adr
1672
- */
1673
- if (~link_mask & mach -> link_mask )
1674
- continue ;
1675
-
1676
- /* No need to match adr if there is no links defined */
1677
- if (!mach -> links )
1678
- break ;
1679
-
1680
- link = mach -> links ;
1681
- for (i = 0 ; i < hdev -> info .count && link -> num_adr ;
1682
- i ++ , link ++ ) {
1683
- /*
1684
- * Try next machine if any expected Slaves
1685
- * are not found on this link.
1686
- */
1687
- if (!snd_soc_acpi_sdw_link_slaves_found (sdev -> dev , link ,
1688
- hdev -> sdw -> ids ,
1689
- hdev -> sdw -> num_slaves ))
1690
- break ;
1691
- }
1692
- /* Found if all Slaves are checked */
1693
- if (i == hdev -> info .count || !link -> num_adr )
1694
- break ;
1695
- }
1696
- if (mach && mach -> link_mask ) {
1697
- int dmic_num = 0 ;
1698
- bool tplg_fixup ;
1699
- const char * tplg_filename ;
1700
-
1701
- mach -> mach_params .links = mach -> links ;
1702
- mach -> mach_params .link_mask = mach -> link_mask ;
1703
- mach -> mach_params .platform = dev_name (sdev -> dev );
1667
+ for (mach = pdata -> desc -> alt_machines ;
1668
+ mach && mach -> link_mask ; mach ++ ) {
1669
+ /*
1670
+ * On some platforms such as Up Extreme all links
1671
+ * are enabled but only one link can be used by
1672
+ * external codec. Instead of exact match of two masks,
1673
+ * first check whether link_mask of mach is subset of
1674
+ * link_mask supported by hw and then go on searching
1675
+ * link_adr
1676
+ */
1677
+ if (~link_mask & mach -> link_mask )
1678
+ continue ;
1704
1679
1705
- if (pdata -> tplg_filename ) {
1706
- tplg_fixup = false;
1707
- } else {
1708
- tplg_fixup = true;
1709
- tplg_filename = mach -> sof_tplg_filename ;
1710
- }
1680
+ /* No need to match adr if there is no links defined */
1681
+ if (!mach -> links )
1682
+ break ;
1711
1683
1684
+ link = mach -> links ;
1685
+ for (i = 0 ; i < hdev -> info .count && link -> num_adr ;
1686
+ i ++ , link ++ ) {
1712
1687
/*
1713
- * DMICs use up to 4 pins and are typically pin-muxed with SoundWire
1714
- * link 2 and 3, or link 1 and 2, thus we only try to enable dmics
1715
- * if all conditions are true:
1716
- * a) 2 or fewer links are used by SoundWire
1717
- * b) the NHLT table reports the presence of microphones
1688
+ * Try next machine if any expected Slaves
1689
+ * are not found on this link.
1718
1690
*/
1719
- if (hweight_long (mach -> link_mask ) <= 2 ) {
1720
- int ret ;
1721
-
1722
- ret = dmic_detect_topology_fixup (sdev , & tplg_filename , "" ,
1723
- & dmic_num , tplg_fixup );
1724
- if (ret < 0 )
1725
- return NULL ;
1726
- }
1727
- if (tplg_fixup )
1728
- pdata -> tplg_filename = tplg_filename ;
1729
- mach -> mach_params .dmic_num = dmic_num ;
1691
+ if (!snd_soc_acpi_sdw_link_slaves_found (sdev -> dev , link ,
1692
+ hdev -> sdw -> ids ,
1693
+ hdev -> sdw -> num_slaves ))
1694
+ break ;
1695
+ }
1696
+ /* Found if all Slaves are checked */
1697
+ if (i == hdev -> info .count || !link -> num_adr )
1698
+ break ;
1699
+ }
1700
+ if (mach && mach -> link_mask ) {
1701
+ int dmic_num = 0 ;
1702
+ bool tplg_fixup ;
1703
+ const char * tplg_filename ;
1704
+
1705
+ mach -> mach_params .links = mach -> links ;
1706
+ mach -> mach_params .link_mask = mach -> link_mask ;
1707
+ mach -> mach_params .platform = dev_name (sdev -> dev );
1708
+
1709
+ if (pdata -> tplg_filename ) {
1710
+ tplg_fixup = false;
1711
+ } else {
1712
+ tplg_fixup = true;
1713
+ tplg_filename = mach -> sof_tplg_filename ;
1714
+ }
1730
1715
1731
- dev_dbg (sdev -> dev ,
1732
- "SoundWire machine driver %s topology %s\n" ,
1733
- mach -> drv_name ,
1734
- pdata -> tplg_filename );
1716
+ /*
1717
+ * DMICs use up to 4 pins and are typically pin-muxed with SoundWire
1718
+ * link 2 and 3, or link 1 and 2, thus we only try to enable dmics
1719
+ * if all conditions are true:
1720
+ * a) 2 or fewer links are used by SoundWire
1721
+ * b) the NHLT table reports the presence of microphones
1722
+ */
1723
+ if (hweight_long (mach -> link_mask ) <= 2 ) {
1724
+ int ret ;
1735
1725
1736
- return mach ;
1726
+ ret = dmic_detect_topology_fixup (sdev , & tplg_filename , "" ,
1727
+ & dmic_num , tplg_fixup );
1728
+ if (ret < 0 )
1729
+ return NULL ;
1737
1730
}
1731
+ if (tplg_fixup )
1732
+ pdata -> tplg_filename = tplg_filename ;
1733
+ mach -> mach_params .dmic_num = dmic_num ;
1738
1734
1739
- dev_info (sdev -> dev , "No SoundWire machine driver found\n" );
1735
+ dev_dbg (sdev -> dev ,
1736
+ "SoundWire machine driver %s topology %s\n" ,
1737
+ mach -> drv_name ,
1738
+ pdata -> tplg_filename );
1739
+
1740
+ return mach ;
1740
1741
}
1741
1742
1743
+ dev_info (sdev -> dev , "No SoundWire machine driver found\n" );
1744
+
1742
1745
return NULL ;
1743
1746
}
1744
1747
#else
0 commit comments