aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorPierre-Louis Bossart2022-07-25 14:49:06 -0500
committerMark Brown2022-07-25 22:37:09 +0100
commit24913664b5103c3dd454081f79ba663ec18f65a1 (patch)
tree492a309c131034e15eea260b32c87caf8aef5a37 /sound
parentfae93e3b952aeb0bad1a3d80ed9592cfc24aa8c6 (diff)
ASoC: Intel: sof_es8336: remove hard-coded SSP selection
For some reason we open-coded the SSP selection and only supported SSP0, 1 and 2. On ApolloLake platforms, the SSP5 can be used as well for the ES8336 hardware link. Remove hard-coded if/else code and align with same code already used in the SOF driver. BugLink: https://github.com/thesofproject/sof/issues/6015 Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220725194909.145418-8-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/intel/boards/sof_es8336.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c
index b616d22bc0fa..c7f33c89588e 100644
--- a/sound/soc/intel/boards/sof_es8336.c
+++ b/sound/soc/intel/boards/sof_es8336.c
@@ -604,18 +604,14 @@ static int sof_es8336_probe(struct platform_device *pdev)
/*
* Set configuration based on platform NHLT.
* In this machine driver, we can only support one SSP for the
- * ES8336 link, the else-if below are intentional.
+ * ES8336 link.
* In some cases multiple SSPs can be reported by NHLT, starting MSB-first
* seems to pick the right connection.
*/
- unsigned long ssp = 0;
-
- if (mach->mach_params.i2s_link_mask & BIT(2))
- ssp = SOF_ES8336_SSP_CODEC(2);
- else if (mach->mach_params.i2s_link_mask & BIT(1))
- ssp = SOF_ES8336_SSP_CODEC(1);
- else if (mach->mach_params.i2s_link_mask & BIT(0))
- ssp = SOF_ES8336_SSP_CODEC(0);
+ unsigned long ssp;
+
+ /* fls returns 1-based results, SSPs indices are 0-based */
+ ssp = fls(mach->mach_params.i2s_link_mask) - 1;
quirk |= ssp;
}