mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bard Liao <yung-chuan.liao@linux.intel.com>
To: alsa-devel@alsa-project.org, vkoul@kernel.org
Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org,
	pierre-louis.bossart@linux.intel.com, bard.liao@intel.com
Subject: [PATCH 4/4] soundwire: intel_auxdevice: use SDW_DEV_NUM_ALLOC_IDA_WAKE_ONLY
Date: Wed, 31 May 2023 11:37:36 +0800	[thread overview]
Message-ID: <20230531033736.792464-5-yung-chuan.liao@linux.intel.com> (raw)
In-Reply-To: <20230531033736.792464-1-yung-chuan.liao@linux.intel.com>

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Change the allocation strategy on Intel platforms to use Device Numbers

[1..5]: unconstrained allocation with bus-specific Device Numbers,
typically for amplifiers.

[6..11]: IDA-based system-unique Device Number to be used for
wake-capable devices such as jack codecs or microphone codecs.

These values were chosen based on the typical maximum number of
devices per link given electrical/PHY limitations. This configuration
will e.g. allow for 8 amplifiers on 2 links, and additional devices on
the remaining links.

Example on Dell SDCA device with jack codec, two amplifiers and one
microphone codec: only the jack codec relies on the IDA, others use
the same Device Number 1 on separate links.

rt711-sdca sdw:0:025d:0711:01: signaling enumeration completion for Slave 6
rt1316-sdca sdw:1:025d:1316:01: signaling enumeration completion for Slave 1
rt1316-sdca sdw:2:025d:1316:01: signaling enumeration completion for Slave 1
rt715-sdca sdw:3:025d:0714:01: signaling enumeration completion for Slave 1

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/intel_auxdevice.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_auxdevice.c
index c1df6f014e6b..917edc75ddfb 100644
--- a/drivers/soundwire/intel_auxdevice.c
+++ b/drivers/soundwire/intel_auxdevice.c
@@ -23,8 +23,12 @@
 #include "intel.h"
 #include "intel_auxdevice.h"
 
-/* IDA min selected to avoid conflicts with HDaudio/iDISP SDI values */
-#define INTEL_DEV_NUM_IDA_MIN           4
+/*
+ * IDA min selected to allow for 5 unconstrained devices per link,
+ * and 6 system-unique Device Numbers for wake-capable devices.
+ */
+
+#define INTEL_DEV_NUM_IDA_MIN           6
 
 #define INTEL_MASTER_SUSPEND_DELAY_MS	3000
 
@@ -66,9 +70,20 @@ static void generic_new_peripheral_assigned(struct sdw_bus *bus,
 {
 	struct sdw_cdns *cdns = bus_to_cdns(bus);
 	struct sdw_intel *sdw = cdns_to_intel(cdns);
+	int min_dev = 1;
+	int max_dev = SDW_MAX_DEVICES;
+
+	if (bus->dev_num_alloc == SDW_DEV_NUM_ALLOC_IDA) {
+		min_dev = INTEL_DEV_NUM_IDA_MIN;
+	} else if (bus->dev_num_alloc == SDW_DEV_NUM_ALLOC_IDA_WAKE_ONLY) {
+		if (slave->prop.wake_capable)
+			min_dev = INTEL_DEV_NUM_IDA_MIN;
+		else
+			max_dev = INTEL_DEV_NUM_IDA_MIN - 1;
+	}
 
 	/* paranoia check, this should never happen */
-	if (dev_num < INTEL_DEV_NUM_IDA_MIN || dev_num > SDW_MAX_DEVICES)  {
+	if (dev_num < min_dev || dev_num > max_dev)  {
 		dev_err(bus->dev, "%s: invalid dev_num %d\n", __func__, dev_num);
 		return;
 	}
@@ -167,7 +182,7 @@ static int intel_link_probe(struct auxiliary_device *auxdev,
 	cdns->msg_count = 0;
 
 	bus->link_id = auxdev->id;
-	bus->dev_num_alloc = SDW_DEV_NUM_ALLOC_IDA;
+	bus->dev_num_alloc = SDW_DEV_NUM_ALLOC_IDA_WAKE_ONLY;
 	bus->dev_num_ida_min = INTEL_DEV_NUM_IDA_MIN;
 	bus->clk_stop_timeout = 1;
 
-- 
2.25.1


      parent reply	other threads:[~2023-05-31  3:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31  3:37 [PATCH 0/4] soundwire: allow for more than 8 devices, keep IDA for wake-capable devices Bard Liao
2023-05-31  3:37 ` [PATCH 1/4] soundwire: add enum to control device number allocation Bard Liao
2023-06-08  7:02   ` Vinod Koul
2023-06-08 13:25     ` Pierre-Louis Bossart
2023-05-31  3:37 ` [PATCH 2/4] soundwire: introduce SDW_DEV_NUM_ALLOC_IDA_WAKE_ONLY Bard Liao
2023-06-08  7:06   ` Vinod Koul
2023-06-08 15:09     ` Pierre-Louis Bossart
2023-06-21 11:00       ` Vinod Koul
2023-06-21 11:28         ` Pierre-Louis Bossart
2023-05-31  3:37 ` [PATCH 3/4] soundwire: extend parameters of new_peripheral_assigned() callback Bard Liao
2023-06-08  7:07   ` Vinod Koul
2023-06-08 13:24     ` Pierre-Louis Bossart
2023-06-21 10:59       ` Vinod Koul
2023-05-31  3:37 ` Bard Liao [this message]

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=20230531033736.792464-5-yung-chuan.liao@linux.intel.com \
    --to=yung-chuan.liao@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bard.liao@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=vinod.koul@linaro.org \
    --cc=vkoul@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®