All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, broonie@kernel.org,
	Bard Liao <yung-chuan.liao@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Subject: [PATCH 07/10] ASoC: Intel: sof_es8336: remove hard-coded SSP selection
Date: Mon, 25 Jul 2022 14:49:06 -0500	[thread overview]
Message-ID: <20220725194909.145418-8-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <20220725194909.145418-1-pierre-louis.bossart@linux.intel.com>

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>
---
 sound/soc/intel/boards/sof_es8336.c | 14 +++++---------
 1 file 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;
 		}
-- 
2.34.1


  parent reply	other threads:[~2022-07-25 19:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25 19:48 [PATCH 00/10] ASoC: Intel: machine driver updates for 5.20 Pierre-Louis Bossart
2022-07-25 19:49 ` [PATCH 01/10] ASoC: Intel: sof_sdw: add support for Dell SKU 0AF0 Pierre-Louis Bossart
2022-07-25 19:49 ` [PATCH 02/10] ASoC: Intel: soc-acpi: Add entry for sof_es8336 in ADL match table Pierre-Louis Bossart
2022-07-25 19:49 ` [PATCH 03/10] ASoC: Intel: sof_es8336: Fix GPIO quirks set via module option Pierre-Louis Bossart
2022-07-25 19:49 ` [PATCH 04/10] ASoC: Intel: sof_es8336: ignore GpioInt when looking for speaker/headset GPIO lines Pierre-Louis Bossart
2022-07-25 19:49 ` [PATCH 05/10] ASoC: Intel: sof_es8336: add support for HDMI_In capture Pierre-Louis Bossart
2022-07-25 19:49 ` [PATCH 06/10] ASoC: Intel: sof_es8336: reset the num_links during probe Pierre-Louis Bossart
2022-07-25 19:49 ` Pierre-Louis Bossart [this message]
2022-07-25 19:49 ` [PATCH 08/10] ASoC: Intel: sof_rt5682: Add support for mtl_mx98357_rt5682 Pierre-Louis Bossart
2022-07-25 19:49 ` [PATCH 09/10] ASoC: Intel: sof_rt5682: Perform quirk check first in card late probe Pierre-Louis Bossart
2022-07-25 19:49 ` [PATCH 10/10] ASoC: Intel: sof_nau8825: Move quirk check to the front in " Pierre-Louis Bossart
2022-07-26 11:30 ` [PATCH 00/10] ASoC: Intel: machine driver updates for 5.20 Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220725194909.145418-8-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.de \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.