Commit 1845165f authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Vinod Koul

soundwire: cadence: remove PDI offset completely

This offset is set to exactly zero and serves no purpose. Remove.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarRander Wang <rander.wang@intel.com>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20240326090122.1051806-3-yung-chuan.liao@linux.intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 8ee1b439
...@@ -1236,7 +1236,7 @@ EXPORT_SYMBOL(sdw_cdns_enable_interrupt); ...@@ -1236,7 +1236,7 @@ EXPORT_SYMBOL(sdw_cdns_enable_interrupt);
static int cdns_allocate_pdi(struct sdw_cdns *cdns, static int cdns_allocate_pdi(struct sdw_cdns *cdns,
struct sdw_cdns_pdi **stream, struct sdw_cdns_pdi **stream,
u32 num, u32 pdi_offset) u32 num)
{ {
struct sdw_cdns_pdi *pdi; struct sdw_cdns_pdi *pdi;
int i; int i;
...@@ -1249,7 +1249,7 @@ static int cdns_allocate_pdi(struct sdw_cdns *cdns, ...@@ -1249,7 +1249,7 @@ static int cdns_allocate_pdi(struct sdw_cdns *cdns,
return -ENOMEM; return -ENOMEM;
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
pdi[i].num = i + pdi_offset; pdi[i].num = i;
} }
*stream = pdi; *stream = pdi;
...@@ -1266,7 +1266,6 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns, ...@@ -1266,7 +1266,6 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns,
struct sdw_cdns_stream_config config) struct sdw_cdns_stream_config config)
{ {
struct sdw_cdns_streams *stream; struct sdw_cdns_streams *stream;
int offset;
int ret; int ret;
cdns->pcm.num_bd = config.pcm_bd; cdns->pcm.num_bd = config.pcm_bd;
...@@ -1277,24 +1276,15 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns, ...@@ -1277,24 +1276,15 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns,
stream = &cdns->pcm; stream = &cdns->pcm;
/* we allocate PDI0 and PDI1 which are used for Bulk */ /* we allocate PDI0 and PDI1 which are used for Bulk */
offset = 0; ret = cdns_allocate_pdi(cdns, &stream->bd, stream->num_bd);
ret = cdns_allocate_pdi(cdns, &stream->bd,
stream->num_bd, offset);
if (ret) if (ret)
return ret; return ret;
offset += stream->num_bd; ret = cdns_allocate_pdi(cdns, &stream->in, stream->num_in);
ret = cdns_allocate_pdi(cdns, &stream->in,
stream->num_in, offset);
if (ret) if (ret)
return ret; return ret;
offset += stream->num_in; ret = cdns_allocate_pdi(cdns, &stream->out, stream->num_out);
ret = cdns_allocate_pdi(cdns, &stream->out,
stream->num_out, offset);
if (ret) if (ret)
return ret; return ret;
...@@ -1802,7 +1792,6 @@ EXPORT_SYMBOL(cdns_set_sdw_stream); ...@@ -1802,7 +1792,6 @@ EXPORT_SYMBOL(cdns_set_sdw_stream);
* cdns_find_pdi() - Find a free PDI * cdns_find_pdi() - Find a free PDI
* *
* @cdns: Cadence instance * @cdns: Cadence instance
* @offset: Starting offset
* @num: Number of PDIs * @num: Number of PDIs
* @pdi: PDI instances * @pdi: PDI instances
* @dai_id: DAI id * @dai_id: DAI id
...@@ -1811,14 +1800,13 @@ EXPORT_SYMBOL(cdns_set_sdw_stream); ...@@ -1811,14 +1800,13 @@ EXPORT_SYMBOL(cdns_set_sdw_stream);
* expected to match, return NULL otherwise. * expected to match, return NULL otherwise.
*/ */
static struct sdw_cdns_pdi *cdns_find_pdi(struct sdw_cdns *cdns, static struct sdw_cdns_pdi *cdns_find_pdi(struct sdw_cdns *cdns,
unsigned int offset,
unsigned int num, unsigned int num,
struct sdw_cdns_pdi *pdi, struct sdw_cdns_pdi *pdi,
int dai_id) int dai_id)
{ {
int i; int i;
for (i = offset; i < offset + num; i++) for (i = 0; i < num; i++)
if (pdi[i].num == dai_id) if (pdi[i].num == dai_id)
return &pdi[i]; return &pdi[i];
...@@ -1872,15 +1860,15 @@ struct sdw_cdns_pdi *sdw_cdns_alloc_pdi(struct sdw_cdns *cdns, ...@@ -1872,15 +1860,15 @@ struct sdw_cdns_pdi *sdw_cdns_alloc_pdi(struct sdw_cdns *cdns,
struct sdw_cdns_pdi *pdi = NULL; struct sdw_cdns_pdi *pdi = NULL;
if (dir == SDW_DATA_DIR_RX) 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); dai_id);
else else
pdi = cdns_find_pdi(cdns, 0, stream->num_out, stream->out, pdi = cdns_find_pdi(cdns, stream->num_out, stream->out,
dai_id); dai_id);
/* check if we found a PDI, else find in bi-directional */ /* check if we found a PDI, else find in bi-directional */
if (!pdi) 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); dai_id);
if (pdi) { if (pdi) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment