forked from tiwai/sound
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For soundwire 20190819 #5
Closed
bardliao
wants to merge
3
commits into
plbossart:integration/soundwire-20190819
from
bardliao:for-soundwire-20190819
Closed
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -918,6 +918,8 @@ static int cdns_allocate_pdi(struct sdw_cdns *cdns, | |
for (i = 0; i < num; i++) { | ||
pdi[i].num = i + pdi_offset; | ||
pdi[i].assigned = false; | ||
pdi[i].link_id = -1; | ||
pdi[i].dai_id = -1; | ||
} | ||
|
||
*stream = pdi; | ||
|
@@ -1276,10 +1278,21 @@ EXPORT_SYMBOL(cdns_set_sdw_stream); | |
static struct sdw_cdns_pdi *cdns_find_pdi(struct sdw_cdns *cdns, | ||
unsigned int offset, | ||
unsigned int num, | ||
struct sdw_cdns_pdi *pdi) | ||
struct sdw_cdns_pdi *pdi, | ||
int link_id, | ||
int dai_id) | ||
{ | ||
int i; | ||
|
||
/* Check if we can find assigned pdi first */ | ||
for (i = offset; i < num; i++) { | ||
if (pdi[i].link_id == link_id && pdi[i].dai_id == dai_id) { | ||
pdi[i].assigned = true; | ||
return &pdi[i]; | ||
} | ||
} | ||
|
||
/* Assign a new one, if we can't find a assigned one */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually this whole code is now irrelevant, we just need to use pdi[dai->id] |
||
for (i = offset; i < num; i++) { | ||
if (pdi[i].assigned) | ||
continue; | ||
|
@@ -1325,24 +1338,30 @@ EXPORT_SYMBOL(sdw_cdns_config_stream); | |
*/ | ||
struct sdw_cdns_pdi *sdw_cdns_alloc_pdi(struct sdw_cdns *cdns, | ||
struct sdw_cdns_streams *stream, | ||
u32 ch, u32 dir) | ||
u32 ch, u32 dir, int dai_id) | ||
{ | ||
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, 0, stream->num_in, stream->in, | ||
cdns->bus.link_id, dai_id); | ||
else | ||
pdi = cdns_find_pdi(cdns, 0, stream->num_out, stream->out); | ||
pdi = cdns_find_pdi(cdns, 0, stream->num_out, stream->out, | ||
cdns->bus.link_id, dai_id); | ||
|
||
/* check if we found a PDI, else find in bi-directional */ | ||
if (!pdi) | ||
pdi = cdns_find_pdi(cdns, 2, stream->num_bd, stream->bd); | ||
pdi = cdns_find_pdi(cdns, 2, stream->num_bd, stream->bd, | ||
cdns->bus.link_id, dai_id); | ||
|
||
if (pdi) { | ||
pdi->l_ch_num = 0; | ||
pdi->h_ch_num = ch - 1; | ||
pdi->dir = dir; | ||
pdi->ch_count = ch; | ||
/* assign link_id and dai_id and we will reuse the pdi */ | ||
pdi->link_id = cdns->bus.link_id; | ||
pdi->dai_id = dai_id; | ||
} | ||
|
||
return pdi; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bardliao I don't think we need to use the link_id. The PDIs are already relative to the DAI being used. I will take this patch and remove the link_id