-
Notifications
You must be signed in to change notification settings - Fork 140
Add basic support for Mediatek mt8195 platform #3160
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
Conversation
|
|
||
| /* DSP memories */ | ||
| #define MBOX_OFFSET 0x800000 // DRAM | ||
| #define MBOX_SIZE 0x1000 // memory.h in sof fw |
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.
Please do not use C++ style comments. Use /* */
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. I will modify it. thanks
|
@yaochunhung thanks. This PR is now much easier to review. Few general comments:
https://github.com/thesofproject/linux/pull/3160/checks?check_run_id=3621871638 |
ef81334 to
617aaae
Compare
@dbaluta Thanks. I reorder the patches but there is still sparse warning shown as below, The symbol 'sof_mt8195_ops' will be used in mediatek/mediatek-ops.h and cannot be set as static. Do you have any suggestion to fix it? Thanks. |
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.
nothing critical, all should be easy to address, but maybe good to do so at least for some of the comments before merging
| } | ||
|
|
||
| adsp->pa_sram = (phys_addr_t)res->start; | ||
| adsp->srammsize = (u32)resource_size(res); |
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 does .srammsize have two "m"s in it?
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.
It is typo and I will modify it. thanks
| struct adsp_chip_info *adsp = data; | ||
| int i, ret; | ||
|
|
||
| res = &resource; |
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.
optional / cosmetic: you reuse res for different resources below. Maybe it would be better to just use &resource for the part, where that's what's needed to avoid confusion
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. I will use struct resource res for of_address_to_resource and struct resource *mmio for platform_get_resource to avoid confusion. thanks.
| adsp->dram_offset = offset; | ||
| offset >>= DRAM_REMAP_SHIFT; | ||
| dev_dbg(dev, "adsp->pa_dram %llx, offset 0x%x\n", adsp->pa_dram, offset); | ||
| WARN_ON(offset < 0); |
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.
first of all, it would be better to check for this apparent error immediately after calculating offset or maybe even before that by chacking adsp->pa_dram < DRAM_PHYS_BASE_FROM_DSP_VIEW perhaps where it's obtained from res->start. Secondly what does a WARN_ON() bring? Is this a valid value? If not, perhaps it shouldn't be used.
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.
Thanks for suggestion but I think WARN_ON could be removed since offset can be negative value for mt8195 hardware design. thanks
| #include "../../ops.h" | ||
| #include "../../sof-audio.h" | ||
|
|
||
| static struct adsp_chip_info *adsp_info; |
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.
is this global variable really needed? I don't see any other platforms doing this.
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. I will remove this global variable and use priv->adsp to replace it. thanks.
| goto err_adsp_sram_power_off; | ||
| } | ||
| adsp_info->va_dram = sdev->bar[SOF_FW_BLK_TYPE_SRAM]; | ||
| mailbox_type = SOF_FW_BLK_TYPE_SRAM; |
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 really needed, you can use SOF_FW_BLK_TYPE_SRAM directly in assignments below
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. I will remove it. thanks
| #define DSP_RESERVED_1 (0x03F4) | ||
|
|
||
| /* dsp wdt */ | ||
| #define DSP_WDT_MODE (0x0400) |
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.
parentheses around individual constants aren't needed
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. I will modify it. thanks
| (SIZE_SHARED_DRAM_DL + SIZE_SHARED_DRAM_UL) | ||
|
|
||
| #define SRAM_PHYS_BASE_FROM_DSP_VIEW (0x40000000) /* MT8195 DSP view */ | ||
| #define DRAM_PHYS_BASE_FROM_DSP_VIEW (0x60000000) /* MT8195 DSP view */ |
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.
ditto: parentheses unneeded
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. I will modify them. thanks
sound/soc/sof/sof-of-dev.c
Outdated
| }; | ||
| #endif | ||
| #if IS_ENABLED(CONFIG_SND_SOC_SOF_MT8195) | ||
| static struct sof_dev_desc sof_of_mt8195_desc = { |
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.
const
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. I will add it. thanks
| } | ||
|
|
||
| /* mt8195 ops */ | ||
| struct snd_sof_dsp_ops sof_mt8195_ops = { |
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.
const
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. I will add it. thanks
617aaae to
e76689b
Compare
|
@dbaluta There are conflicts in dai.h and topology.c. It seems caused by AMD's patch. Could you please help advice how to resolve it? Should I fetch the latest codes and create another PR? I tried to resolve conflicts but I don't have permission to commit merge after resolving conflicts. thanks. |
You don't need to create another Pull Request. Just do something like this on your branch that this PR was created from: That should be it. |
e76689b to
88017e2
Compare
|
@dbaluta I will try it.Thanks |
plbossart
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.
minor nit-picks below, the main issue is really that we need the ability to compile this code with GitHub actions so that we can see any compilation-level issues on this PR and any changes to the SOF tree. Thanks!
263987d to
1d5fe57
Compare
c7433a7 to
3dc11be
Compare
|
@ujfalusi yes, IPC will be next PR. I also modify the PR by your comments. Please help to check if there is still anything I need to modify. thanks. |
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.
Just forward declare the sdev struct in the header, no need to include anything else:
struct snd_sof_dev;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 think you should have
void hifixdsp_boot_sequence(struct snd_sof_dev *sdev, u32 boot_addr)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.
Here you want to have
void hifixdsp_shutdown(struct snd_sof_dev *sdev)I would probably prefix these functions with sof_
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.
Is it a good idea to do devm_ioremap() every time this function is called?
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 will replace it with ioremap and iounmap. thanks.
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 might have used different name instead of val, on perhaps is 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. I will modify it. thanks
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 void *data and not directly struct mtk_adsp_chip_info *adsp?
If you need, just forward declare it in the header.
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. I will modify it.thanks.
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 not much of a help if it happens, it might be better to
dev_err(dev, "ioremap failed for shared DRAM\n");
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 I will modify it. thanks
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.
Is there real information comes out from the [ADSP] prefix, you will have the device name in prints.
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. I will remove it. thanks
86e7df1 to
d5d22d8
Compare
ujfalusi
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.
@yaochunhung, thanks for the quick updates, it really looks fine, if you could align the numbers in the header I can approve it right away.
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.
Can you align the numbers, there is one tab line jump 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.
ok. I will align them. thanks!
d5d22d8 to
a325da3
Compare
yaochunhung
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.
@ujfalusi Thanks for comments. I update the patch. Please help to check it. thanks.
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. I will align them. thanks!
ujfalusi
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.
@yaochunhung, one comment needs to be moved up one line.
This patch initialize to support SOF on Mediatek mt8195 platform. MT8195 has four Cortex A78 cores paired with four Cortex A55 cores. It also has Cadence HiFi-4 DSP single core. There are shared DRAM and mailbox interrupt between AP and DSP to use for IPC communication. Signed-off-by: YC Hung <yc.hung@mediatek.com>
Add the definition for Mediatek audio front end(AFE) tokens,include AFE sampling rate, channels, and format. Signed-off-by: YC Hung <yc.hung@mediatek.com>
Add new sof dai and config to pass topology file configuration to SOF firmware running on Mediatek platform DSP core. Add mediatek audio front end(AFE) to the list of supported sof_dais Signed-off-by: YC Hung <yc.hung@mediatek.com>
Add mt8195-loader module with ops callback to load and run firmware on mt8195 platform. Signed-off-by: YC Hung <yc.hung@mediatek.com>
Add SOF device and DT descriptor for Mediatek mt8195 platform. Signed-off-by: YC Hung <yc.hung@mediatek.com>
Add dsp ops callback to register AFE DL2/DL3/UL4/UL5 sof dai's with ALSA Signed-off-by: YC Hung <yc.hung@mediatek.com>
a325da3 to
124404c
Compare
yaochunhung
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.
@ujfalusi I will modify it. thanks.
ujfalusi
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.
@yaochunhung, thank you for the prompt updates!
The PR looks fine from my side.
|
@ujfalusi thanks for your comments and approval. :) |
dbaluta
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.
LGTM, sorry for the late answer I had a day off on Friday.
|
@dbaluta Thanks a lot for your suggestion and comments. |
Hi,
This PR is for basic support MT8195 platform on SOF.
MT8195 include Cadence HiFi-4 single core, currently we support 4 DAI interfaces, SOF_DL2/DL3/UL4/UL5(Downlink/Uplink paths) on MT8195 Audio Hardware(which we call AFE, the Abbreviation of Audio Front End). This PR includes basic skeleton hardware support on MT8195, Mediatek AFE DAIs for toplolgy, fw loader ops, and dai driver defintions.
Thanks!