mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bard Liao <yung-chuan.liao@linux.intel.com>
To: linux-sound@vger.kernel.org, vkoul@kernel.org
Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org,
	pierre-louis.bossart@linux.dev, bard.liao@intel.com
Subject: [PATCH v3 09/14] soundwire: generic_bandwidth_allocation: correct clk_freq check in sdw_select_row_col
Date: Wed, 18 Dec 2024 16:01:50 +0800	[thread overview]
Message-ID: <20241218080155.102405-10-yung-chuan.liao@linux.intel.com> (raw)
In-Reply-To: <20241218080155.102405-1-yung-chuan.liao@linux.intel.com>

The bits in Column 0 of Rows 0 to 47 are for control word and cannot be
used for audio. In practice, entire Column 0 is skipped.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
 drivers/soundwire/generic_bandwidth_allocation.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/soundwire/generic_bandwidth_allocation.c b/drivers/soundwire/generic_bandwidth_allocation.c
index d847413141d3..5c4dac36ad1a 100644
--- a/drivers/soundwire/generic_bandwidth_allocation.c
+++ b/drivers/soundwire/generic_bandwidth_allocation.c
@@ -302,7 +302,6 @@ static int sdw_compute_port_params(struct sdw_bus *bus)
 static int sdw_select_row_col(struct sdw_bus *bus, int clk_freq)
 {
 	struct sdw_master_prop *prop = &bus->prop;
-	int frame_int, frame_freq;
 	int r, c;
 
 	for (c = 0; c < SDW_FRAME_COLS; c++) {
@@ -311,11 +310,8 @@ static int sdw_select_row_col(struct sdw_bus *bus, int clk_freq)
 			    sdw_cols[c] != prop->default_col)
 				continue;
 
-			frame_int = sdw_rows[r] * sdw_cols[c];
-			frame_freq = clk_freq / frame_int;
-
-			if ((clk_freq - (frame_freq * SDW_FRAME_CTRL_BITS)) <
-			    bus->params.bandwidth)
+			if (clk_freq * (sdw_cols[c] - 1) <
+			    bus->params.bandwidth * sdw_cols[c])
 				continue;
 
 			bus->params.row = sdw_rows[r];
-- 
2.43.0


  parent reply	other threads:[~2024-12-18  8:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18  8:01 [PATCH v3 00/14] soundwire: add multi-lane support Bard Liao
2024-12-18  8:01 ` [PATCH v3 01/14] soundwire: add lane field in sdw_port_runtime Bard Liao
2024-12-18  8:01 ` [PATCH v3 02/14] soundwire: mipi_disco: read lane mapping properties from ACPI Bard Liao
2024-12-18  8:01 ` [PATCH v3 03/14] soundwire: add lane_used_bandwidth in struct sdw_bus Bard Liao
2024-12-18  8:01 ` [PATCH v3 04/14] soundwire: stream: set DEPREPARED state earlier Bard Liao
2024-12-18  8:01 ` [PATCH v3 05/14] soundwire: generic_bandwidth_allocation: skip DEPREPARED streams Bard Liao
2024-12-18  8:01 ` [PATCH v3 06/14] Soundwire: add sdw_slave_get_scale_index helper Bard Liao
2024-12-18  8:01 ` [PATCH v3 07/14] Soundwire: stream: program BUSCLOCK_SCALE Bard Liao
2024-12-18  8:01 ` [PATCH v3 08/14] Soundwire: generic_bandwidth_allocation: set frame shape on fly Bard Liao
2024-12-18  8:01 ` Bard Liao [this message]
2024-12-18  8:01 ` [PATCH v3 10/14] soundwire: generic_bandwidth_allocation: check required freq accurately Bard Liao
2024-12-18  8:01 ` [PATCH v3 11/14] soundwire: generic_bandwidth_allocation: select data lane Bard Liao
2024-12-18  8:01 ` [PATCH v3 12/14] soundwire: generic_bandwidth_allocation: add lane in sdw_group_params Bard Liao
2024-12-18  8:01 ` [PATCH v3 13/14] SoundWire: pass stream to compute_params() Bard Liao
2024-12-18  8:01 ` [PATCH v3 14/14] soundwire: generic_bandwidth_allocation: count the bandwidth of active streams only Bard Liao
2024-12-23  9:12 ` [PATCH v3 00/14] soundwire: add multi-lane support Vinod Koul

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=20241218080155.102405-10-yung-chuan.liao@linux.intel.com \
    --to=yung-chuan.liao@linux.intel.com \
    --cc=bard.liao@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.dev \
    --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®