forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 140
soundwire: stream: Poll for DP prepare to avoid interrupt deadlock #5636
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
Draft
rfvirgil
wants to merge
1
commit into
thesofproject:topic/sof-dev
Choose a base branch
from
CirrusLogic:topic/soundwire-polled-dp-prepare
base: topic/sof-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
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 hidden or 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 |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| #include <linux/delay.h> | ||
| #include <linux/device.h> | ||
| #include <linux/init.h> | ||
| #include <linux/iopoll.h> | ||
| #include <linux/module.h> | ||
| #include <linux/mod_devicetable.h> | ||
| #include <linux/slab.h> | ||
|
|
@@ -26,6 +27,8 @@ static int p_lane; | |
| module_param(p_lane, int, 0444); | ||
| MODULE_PARM_DESC(p_lane, "Peripheral lane"); | ||
|
|
||
| #define SDW_PORT_PREP_POLL_USEC 1000 | ||
|
|
||
| /* | ||
| * Array of supported rows and columns as per MIPI SoundWire Specification 1.1 | ||
| * | ||
|
|
@@ -451,7 +454,6 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus, | |
| struct sdw_port_runtime *p_rt, | ||
| bool prep) | ||
| { | ||
| struct completion *port_ready; | ||
| struct sdw_dpn_prop *dpn_prop; | ||
| struct sdw_prepare_ch prep_ch; | ||
| u32 imp_def_interrupts; | ||
|
|
@@ -492,7 +494,7 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus, | |
|
|
||
| prep_ch.bank = bus->params.next_bank; | ||
|
|
||
| if (imp_def_interrupts || !simple_ch_prep_sm || | ||
| if (imp_def_interrupts || | ||
| bus->params.s_data_mode != SDW_PORT_DATA_MODE_NORMAL) | ||
| intr = true; | ||
|
|
||
|
|
@@ -526,13 +528,15 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus, | |
| return ret; | ||
| } | ||
|
|
||
| /* Wait for completion on port ready */ | ||
| port_ready = &s_rt->slave->port_ready[prep_ch.num]; | ||
| wait_for_completion_timeout(port_ready, | ||
| msecs_to_jiffies(ch_prep_timeout)); | ||
|
|
||
| val = sdw_read_no_pm(s_rt->slave, SDW_DPN_PREPARESTATUS(p_rt->num)); | ||
| if ((val < 0) || (val & p_rt->ch_mask)) { | ||
| /* | ||
| * Poll for NOT_PREPARED. Cannot use the interrupt because this | ||
| * code holds bus_lock which blocks interrupt handling. | ||
| */ | ||
| ret = read_poll_timeout(sdw_read_no_pm, val, | ||
| (val < 0) || ((val & p_rt->ch_mask) == 0), | ||
| SDW_PORT_PREP_POLL_USEC, ch_prep_timeout * USEC_PER_MSEC, | ||
| false, s_rt->slave, SDW_DPN_PREPARESTATUS(p_rt->num)); | ||
| if (ret || (val < 0) || (val & p_rt->ch_mask)) { | ||
| ret = (val < 0) ? val : -ETIMEDOUT; | ||
|
Collaborator
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. Should we not convert |
||
| dev_err(&s_rt->slave->dev, | ||
| "Chn prep failed for port %d: %d\n", prep_ch.num, ret); | ||
|
|
||
Oops, something went wrong.
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.
Not sure why this change is needed.