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.intel.com, bard.liao@intel.com
Subject: [PATCH 2/7] soundwire: cadence: remove PDI offset completely
Date: Tue, 26 Mar 2024 09:01:17 +0000 [thread overview]
Message-ID: <20240326090122.1051806-3-yung-chuan.liao@linux.intel.com> (raw)
In-Reply-To: <20240326090122.1051806-1-yung-chuan.liao@linux.intel.com>
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
This offset is set to exactly zero and serves no purpose. Remove.
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/cadence_master.c | 30 +++++++++---------------------
1 file changed, 9 insertions(+), 21 deletions(-)
diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c
index 3e7cf04aaf2a..c2c1463a5c53 100644
--- a/drivers/soundwire/cadence_master.c
+++ b/drivers/soundwire/cadence_master.c
@@ -1236,7 +1236,7 @@ EXPORT_SYMBOL(sdw_cdns_enable_interrupt);
static int cdns_allocate_pdi(struct sdw_cdns *cdns,
struct sdw_cdns_pdi **stream,
- u32 num, u32 pdi_offset)
+ u32 num)
{
struct sdw_cdns_pdi *pdi;
int i;
@@ -1249,7 +1249,7 @@ static int cdns_allocate_pdi(struct sdw_cdns *cdns,
return -ENOMEM;
for (i = 0; i < num; i++) {
- pdi[i].num = i + pdi_offset;
+ pdi[i].num = i;
}
*stream = pdi;
@@ -1266,7 +1266,6 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns,
struct sdw_cdns_stream_config config)
{
struct sdw_cdns_streams *stream;
- int offset;
int ret;
cdns->pcm.num_bd = config.pcm_bd;
@@ -1277,24 +1276,15 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns,
stream = &cdns->pcm;
/* we allocate PDI0 and PDI1 which are used for Bulk */
- offset = 0;
-
- ret = cdns_allocate_pdi(cdns, &stream->bd,
- stream->num_bd, offset);
+ ret = cdns_allocate_pdi(cdns, &stream->bd, stream->num_bd);
if (ret)
return ret;
- offset += stream->num_bd;
-
- ret = cdns_allocate_pdi(cdns, &stream->in,
- stream->num_in, offset);
+ ret = cdns_allocate_pdi(cdns, &stream->in, stream->num_in);
if (ret)
return ret;
- offset += stream->num_in;
-
- ret = cdns_allocate_pdi(cdns, &stream->out,
- stream->num_out, offset);
+ ret = cdns_allocate_pdi(cdns, &stream->out, stream->num_out);
if (ret)
return ret;
@@ -1802,7 +1792,6 @@ EXPORT_SYMBOL(cdns_set_sdw_stream);
* cdns_find_pdi() - Find a free PDI
*
* @cdns: Cadence instance
- * @offset: Starting offset
* @num: Number of PDIs
* @pdi: PDI instances
* @dai_id: DAI id
@@ -1811,14 +1800,13 @@ EXPORT_SYMBOL(cdns_set_sdw_stream);
* expected to match, return NULL otherwise.
*/
static struct sdw_cdns_pdi *cdns_find_pdi(struct sdw_cdns *cdns,
- unsigned int offset,
unsigned int num,
struct sdw_cdns_pdi *pdi,
int dai_id)
{
int i;
- for (i = offset; i < offset + num; i++)
+ for (i = 0; i < num; i++)
if (pdi[i].num == dai_id)
return &pdi[i];
@@ -1872,15 +1860,15 @@ struct sdw_cdns_pdi *sdw_cdns_alloc_pdi(struct sdw_cdns *cdns,
struct sdw_cdns_pdi *pdi = NULL;
if (dir == SDW_DATA_DIR_RX)
- pdi = cdns_find_pdi(cdns, 0, stream->num_in, stream->in,
+ pdi = cdns_find_pdi(cdns, stream->num_in, stream->in,
dai_id);
else
- pdi = cdns_find_pdi(cdns, 0, stream->num_out, stream->out,
+ pdi = cdns_find_pdi(cdns, stream->num_out, stream->out,
dai_id);
/* check if we found a PDI, else find in bi-directional */
if (!pdi)
- pdi = cdns_find_pdi(cdns, 0, stream->num_bd, stream->bd,
+ pdi = cdns_find_pdi(cdns, stream->num_bd, stream->bd,
dai_id);
if (pdi) {
--
2.34.1
next prev parent reply other threads:[~2024-03-26 9:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-26 9:01 [PATCH 0/7] soundwire: add BTP/BRA prerequisites Bard Liao
2024-03-26 9:01 ` [PATCH 1/7] soundwire: cadence: fix invalid PDI offset Bard Liao
2024-03-26 9:01 ` Bard Liao [this message]
2024-03-26 9:01 ` [PATCH 3/7] soundwire: remove unused sdw_bus_conf structure Bard Liao
2024-03-26 9:01 ` [PATCH 4/7] soundwire: reconcile dp0_prop and dpn_prop Bard Liao
2024-04-05 11:33 ` Vinod Koul
2024-04-08 6:39 ` Liao, Bard
2024-03-26 9:01 ` [PATCH 5/7] soundwire: clarify maximum allowed address Bard Liao
2024-03-26 9:01 ` [PATCH 6/7] soundwire: debugfs: add interface to read/write commands Bard Liao
2024-04-05 11:45 ` Vinod Koul
2024-04-05 15:12 ` Pierre-Louis Bossart
2024-04-11 9:28 ` Vinod Koul
2024-04-11 14:24 ` Pierre-Louis Bossart
2024-03-26 9:01 ` [PATCH 7/7] soundwire: bus: add stream refcount Bard Liao
2024-04-05 11:47 ` Vinod Koul
2024-04-05 11:52 ` (subset) [PATCH 0/7] soundwire: add BTP/BRA prerequisites 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=20240326090122.1051806-3-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.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