-
Notifications
You must be signed in to change notification settings - Fork 349
[RFC] Dai zephyr stub #5731
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
[RFC] Dai zephyr stub #5731
Conversation
8c94447 to
6d8c379
Compare
lyakh
left a comment
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 don't understand what the first of the two commits - the merge commit - in this PR is doing, hopefully it's really something that's needed here. The approval is to the actual commit with code
src/drivers/intel/ssp/ssp-zephyr.c
Outdated
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.
Suggestion: ssp-zephyr-shim.c
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, Liam has a better solution: #5727 (review)
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.
hmm ok, let me check if I can do something like that
src/lib/dai.c
Outdated
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.
What if dai_get_zephyr returns NULL? Currently the flow will go through non-zephyr dai creation. I think we rather should return NULL here.
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.
the problem is that in this transient period we have drivers both in zephyr and xtos side. So even if ZEPHYR is defined, we might have only like ssp and alh in zephyr. So the dai_get_zephyr will check the type and not do anything if driver is noton zephyr side.
dec7307 to
1e4e93e
Compare
src/audio/dai.c
Outdated
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.
why and what the op postfix means? Would it sound better if they are postfixed instead with sof?
dai_trigger -> sof_dai_trigger
nitpick
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.
...and you already use dai_*_xtos(), so why not use "xtos" everywhere? And I agree with @ujfalusi - a prefix seems both more common and more logical - you usually go from the least to the most specific part. I.e. "xtos" is the least specific part, "dai" is the next level, and the actual operation is the most specific part
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.
This may be a naming challenges we can't win.
I wonder if it'd be cleaner to rename the public "dai.h" to have "sof_" prefix, and then just have different implementations for this in src/lib/dai.c.
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.
yeah totally fine with that, will try and see
src/lib/dai.c
Outdated
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.
For minimized #ifdef __ZEPHYR__ I would have the dai_get(uint32_t type, uint32_t index, uint32_t flags) ifdefed.
Or use the same name for the sub dai_get / dai_put OS dependent implementation, but the naming can get funny...
os_dai_get / dai_get_from_os / ...
758d12d to
a8d81d7
Compare
lgirdwood
left a comment
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.
@abonislawski @marcinszkudlinski any comments ?
src/audio/dai-zephyr.c
Outdated
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.
this could be made static inline (if Zephyr) and go away ?
|
@juimonen one other thing, it would be good to add inline TODO comments in these files where we have future Zephyr integration to help align everyone. |
a8d81d7 to
181c083
Compare
|
SOFCI TEST |
kv2019i
left a comment
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.
Started the review, but didn't have time to complete. Will resume.
fd19609 to
3b4319f
Compare
@lgirdwood... I'm not seeing currently obvious TODO in files changed in this PR... for example lib/dma.c should be changed to similar mechanism than here with dai. That might effect some of the struct members in this PR, but can't really say for sure in some TODO. |
kv2019i
left a comment
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.
Looks good. I think further improvements to dai-zephyr.h are better done in follow-up PRs.
src/lib/dai.c
Outdated
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.
minor: I think this could be a good actual usage of an assert to check that strlen of drv_name is sufficient.
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.
oh, something is missing as I changed this to Liams suggerstion.... hold on for awhile
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.
@kv2019i I screwed up yesterday with git reset... now includes the "dai array" changes suggested by Liam for this part of the code... apologies
30b2ea1 to
d16ad08
Compare
This patch adds a mechanism to load and use dai driver from zephyr instead of xtos driver. Patch includes following changes: - dai-zephyr.c calls directly zephyr driver methods - include/lib/dai.h is divided into dai-legacy.h and dai-zephyr.h - use zephyr dais by configuring CONFIG_ZEPHYR_NATIVE_DRIVERS=y Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
9aeab38 to
cd90420
Compare
lgirdwood
left a comment
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.
Some logging could be added later. @abonislawski @marcinszkudlinski @ArsenEloglian any comments ?
| group->group_id = 0; | ||
| } | ||
|
|
||
| #if CONFIG_ZEPHYR_NATIVE_DRIVERS |
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.
@juimonen @ArsenEloglian it seems like future steps are to split lib/dai.c into legacy and Zephyr versions. For another PR though...
| {"SSP_", { | ||
| .type = SOF_DAI_INTEL_SSP, | ||
| .dma_dev = DMA_DEV_SSP, | ||
| .dma_caps = DMA_CAP_GP_LP | DMA_CAP_GP_HP, |
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 supose these caps are not needed for Zephyr (as the Zephyr driver will probably know via DT which memory) ?
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.
This is interesting thing. Currently we still need this as our dma_get() API is asking for a DMA instance that matches a given filter and the filter includes "caps". Zephyr DT described HW capabilities, but the lookup code is still on SOF side in src/lib/dma.c and database is filled in src/platform/intel/cavs/lib/dma.c . The latter could be filled directly from Zephyr, but some lookup logic is still needed.
But indeed, @juimonen and @ArsenEloglian , I guess we could leave "dma_caps==0" here when doing dma_get() for native Zephyr drivers. The caps checks will be skipped and DMA is chosen based on dma_dev alone. But this seems good enough. Zephyr drivers don't need this info, this is only to select the DMA instance.
|
|
||
| drv = device_get_binding(dai_name); | ||
| if (!drv) | ||
| return NULL; |
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.
shall we tell the user in the logs ?
| } | ||
|
|
||
| if (!found) | ||
| return NULL; |
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.
Log the error ?
kv2019i
left a comment
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.
Still good to go, but do check the dai_info_table comment. Maybe we can drop the "dma_caps" from the dai query.
| {"SSP_", { | ||
| .type = SOF_DAI_INTEL_SSP, | ||
| .dma_dev = DMA_DEV_SSP, | ||
| .dma_caps = DMA_CAP_GP_LP | DMA_CAP_GP_HP, |
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.
This is interesting thing. Currently we still need this as our dma_get() API is asking for a DMA instance that matches a given filter and the filter includes "caps". Zephyr DT described HW capabilities, but the lookup code is still on SOF side in src/lib/dma.c and database is filled in src/platform/intel/cavs/lib/dma.c . The latter could be filled directly from Zephyr, but some lookup logic is still needed.
But indeed, @juimonen and @ArsenEloglian , I guess we could leave "dma_caps==0" here when doing dma_get() for native Zephyr drivers. The caps checks will be skipped and DMA is chosen based on dma_dev alone. But this seems good enough. Zephyr drivers don't need this info, this is only to select the DMA instance.
|
As discovered by @deb-intel, the duplication between @juimonen can you please remove all the doxygen duplication? (The duplication of code is fine, the docs don't care about that) |
|
Why no |
This is in plan for @juimonen @ArsenEloglian @abonislawski |
From time to time sof-docs regressions are introduced in sof.git. This introduces a random and sometimes long delay between when the regression is introduced and when it is found. A recent example is thesofproject#5731 (comment) where the doxygen comments were duplicated. Doxygen alone did not mind, then the sof-docs build failed much later which took multiple people a lot of time to understand and bisect. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
From time to time sof-docs regressions are introduced in sof.git. This introduces a random and sometimes long delay between when the regression is introduced and when it is found. A recent example is #5731 (comment) where the doxygen comments were duplicated. Doxygen alone did not mind, then the sof-docs build failed much later which took multiple people a lot of time to understand and bisect. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This fixes the sof-docs build and stops producing a dai-drivers-api.html
garbage that randomly mixed the two .h files.
```
Warning: Duplicate target detected:
group__sof__dai__drivers_1ga8c720c310f408b2f97ce014562d6a910
sof-docs/api/dai-drivers-api.rst:4: WARNING: Duplicate ID:
"group__sof__dai__drivers_1ga8c720c310f408b2f97ce014562d6a910".
sof-docs/api/dai-drivers-api.rst:4: WARNING: Duplicate explicit target name:
"group__sof__dai__drivers_1ga8c720c310f408b2f97ce014562d6a910".
sof/sof-docs/api/dai-drivers-api.rst:6: WARNING:
Duplicate declaration, const struct device* dai::drv
```
(Temporarily?) fixes commit 015ec63 ("zephyr: add glue code to
use zephyr dai drivers") that introduced a lot of duplication with
dai-zephyr.h. See more details at
thesofproject#5731 (comment)
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
|
Just learned @juimonen is on vacation. 2-lines fix/workaround submitted at: This simply excludes |
This fixes the sof-docs build and stops producing a dai-drivers-api.html
garbage that randomly mixed the two .h files.
```
Warning: Duplicate target detected:
group__sof__dai__drivers_1ga8c720c310f408b2f97ce014562d6a910
sof-docs/api/dai-drivers-api.rst:4: WARNING: Duplicate ID:
"group__sof__dai__drivers_1ga8c720c310f408b2f97ce014562d6a910".
sof-docs/api/dai-drivers-api.rst:4: WARNING: Duplicate explicit target name:
"group__sof__dai__drivers_1ga8c720c310f408b2f97ce014562d6a910".
sof/sof-docs/api/dai-drivers-api.rst:6: WARNING:
Duplicate declaration, const struct device* dai::drv
```
(Temporarily?) fixes commit 015ec63 ("zephyr: add glue code to
use zephyr dai drivers") that introduced a lot of duplication with
dai-zephyr.h. See more details at
#5731 (comment)
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
No description provided.