Repository navigation
ASoC: SOF: Intel: hda: make sure the DMA is started/stopped by checking the RUN bit #997
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,6 +158,12 @@ | |
| #define HDA_DSP_MBOX_UPLINK_OFFSET 0x81000 | ||
|
|
||
| #define HDA_DSP_STREAM_RESET_TIMEOUT 300 | ||
| /* | ||
| * Timeout in us, for setting the stream RUN bit, during | ||
| * start/stop the stream. The timeout expires if new RUN bit | ||
| * value cannot be read back within the specified time. | ||
| */ | ||
| #define HDA_DSP_STREAM_RUN_TIMEOUT 300 | ||
|
Member
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. still doesn't tell me where this value comes from, is this a hardware recommendation or 'same as the other drivers'
Author
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. @plbossart it is "same as the other drivers" |
||
| #define HDA_DSP_CL_TRIGGER_TIMEOUT 300 | ||
|
|
||
| #define HDA_DSP_SPIB_ENABLE 1 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
((run & SOF_HDA_SD_CTL_DMA_START) == 0x0),is a lot for a parameter, it's always better to define the variable on an earlier line e.g.run_value = !(run &SOF_HDA_SD_CTL_DMA_START)This can be fixed incrementally.
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.
agree with @lgirdwood please add an intermediate variable and simplify this.
Uh oh!
There was an error while loading. Please reload this page.
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.
@lgirdwood @plbossart @kv2019i
The snd_sof_dsp_read_poll_timeout is a macro #define, not a really function, if using predefined variable as @lgirdwood suggested, the result should be not the same. Because the #define need first get the value of "run", and then the
run & SOF_HDA_SD_CTL_DMA_STARTcan be calculated.@kv2019i Do you agree?
Another solution maybe define a macro for
run & SOF_HDA_SD_CTL_DMA_START, as:1):
#define RUN_VALUE ((run) & SOF_HDA_SD_CTL_DMA_START)and use
RUN_VALUE == SOF_HDA_SD_CTL_DMA_STARTandRUN_VALUE == 0as the parameter.or
2):
#define RUN_DMA_START (((run) & SOF_HDA_SD_CTL_DMA_START) == SOF_HDA_SD_CTL_DMA_START)#define RUN_DMA_STOP (((run) & SOF_HDA_SD_CTL_DMA_START) == 0x0)and use as:
What do you think?
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.
@zhuyingjiang I'm ok with the original as well -- this is used elsewhere in the codebase already. I'm not sure how much this helps readability to define more macros. Upto @plbossart and @lgirdwood who made the review comments.
One more option is to use a local variable to describe the mask only:
But yeah, the improvement is limited.
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.
i like this update much better...
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.
OK, thanks @kv2019i , I will update with this solution.