-
Notifications
You must be signed in to change notification settings - Fork 132
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
soundwire/SOF: add SoundWire Interface support for AMD SOF stack #4699
soundwire/SOF: add SoundWire Interface support for AMD SOF stack #4699
Conversation
will fix build dependency error and post v2 set. |
cb5e5ee
to
2452259
Compare
posted new patch set after fixing build dependency errors. |
@plbossart, @ranj063 |
SOFCI TEST |
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.
Quite a few changes needed but at a high-level
a) some ACPI sharing is possible
b) there is no need for a startup() step I believe, no need to mimick what Intel did to follow specific power management flows.
2452259
to
fdc3632
Compare
@plbossart : fixed review comments and posted new patch set. Could you please review the patch set? |
drivers/soundwire/amd_init.c
Outdated
@@ -0,0 +1,168 @@ | |||
// SPDX-License-Identifier: GPL-2.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.
please check with your lawyers. The code is directly inspired from Intel and released with a GPL-2.0-only license.
// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
There is no '2.0 or later' in the initial Intel code.
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.
we will revisit license terms
sound/soc/sof/amd/acp.c
Outdated
|
||
/* save context */ | ||
acp_data->sdw = sdw; | ||
return sdw_amd_startup(acp_data->sdw); |
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.
so why do you need to implement the startup callback? Everything can be moved to sdw_amd_probe(&sdw_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.
As mentioned, earlier, its not possible to move startup callback to sdw_amd_probe(). It will break the interrupt handling functionality in parent driver code as in parent driver irq handler , it will try to deference using sdw_ctx structure. If we move this code to sdw_amd_probe(), we won't get soundwire context structure for handling Soundwire manager interrupts which results in kernel panic. i.e if we move the startup code to sdw_amd_probe() which returns ctx , once the link gets started, we get slave attach interrupt and corresponding SoundWire interrupt will be reported in parent driver IRQ handler.
For example, if we get SoundWire interrupt on SW0 link, in this case in parent driver irq handler code, we will retrieve amd_manger structure from ctx pdev get driver data as shown below.
if (val & ACP_SDW0_IRQ_MASK) {
amd_manager = dev_get_drvdata(&adata->sdw->pdev[0]->dev);
if startup is combined in sdw_amd_probe() call, as ctx is not returned to parent driver, it will result in kernel panic.
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.
Sorry, not following any of this.
sdw = sdw_amd_probe(&sdw_res);
if (!sdw) {
dev_err(sdev->dev, "SoundWire probe failed\n");
return -EINVAL;
}
/* save context */
acp_data->sdw = sdw;
return sdw_amd_startup(acp_data->sdw);
why can't you pass acp_data in the probe and store the context inside of sdw_amd_probe?
You are trying to stick to an Intel definition of interfaces which makes no sense for you.
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.
- acp_data is not a common private data structure for legacy stack and sof stack. It will be different one for legacy stack.
- We want to abstract usage of parent driver structures in amd_init.c file.
- I think its still possible, passing parent driver private data structure sdw member to the probe function and assign it in probe function itself followed by invoking start sequence in the same probe call.
- We want to divide whole probe and start functionality in two functions to increase the readability and scalability and we want to leave a place holder so that in future if start() functionality needs to move to some other place for example after FW loading, there will no option left with this approach.
- For example, we need to support a SOF scenario. In case of firmware load failure, there is no point in starting the soundwire managers. In this case if we don't have startup sequence separately, we can't support it.
We don't see any major issue in exporting one more function(start() function) other than probe().
Please note our intention is not to replicate everything in Intel style.
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.
You really want to start the links as early as possible to make sure the peripherals are enumerated in parallel with the rest of firmware loading.
I can't force you to listen or change your code, but at this point you really don't have a good technical rationale for splitting probe/start. I am not the final reviewer so others might have a different opinion.
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.
@plbossart : We accept your review comments. We will do the code modifications and respin the patch set and let you know the test results.
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 agree with @plbossart. sdw_amd_startup()
is only used here. It is not necessary to have a separated startup function.
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 : will make the changes as per @plbossart comments will combine probe and start sequence and remove separate export function.
89a8988
to
fdc3632
Compare
Posted new patch set after fixing review comments. |
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.
two minor points can be improved, see below.
Refactor amd SoundWire manager device node creation logic and implement generic functions to have a common functionality for SoundWire manager platform device creation, start and exit sequence for both legacy(NO DSP) and SOF stack for AMD platforms. These functions will be invoked from legacy and SOF stack. Signed-off-by: Vijendar Mukunda <[email protected]>
Implement function to extract slaves information connected on the bus. This information is required during machine select logic. This function will be called from machine select logic code. Signed-off-by: Vijendar Mukunda <[email protected]>
As sdw pads enable sequence is executed only once, invoke it from probe sequence. Program required pads for both manager instances based on link_mask during probe sequence. This will avoid acquiring mutex lock. Remove unnecessary delay after programming ACP_SW_PAD_KEEPER_EN register. Signed-off-by: Vijendar Mukunda <[email protected]>
register mask array structure is no longer needed as except interrupt control masks, rest of the register masks are not used in code. use array for interrupt masks instead of structure. Signed-off-by: Vijendar Mukunda <[email protected]>
Add code for invoking Soundwire manager helper functions when SoundWire configuration is selected. Signed-off-by: Vijendar Mukunda <[email protected]>
Add support for interrupt handling for soundwire manager platform devices. Signed-off-by: Vijendar Mukunda <[email protected]>
…orms Add support for configuring AMD Soundwire DAI from topology. Signed-off-by: Vijendar Mukunda <[email protected]>
Add machine select logic for soundwire endpoints for AMD platforms. Signed-off-by: Vijendar Mukunda <[email protected]>
Update acp descriptor fields for acp6.3 version based platform. Signed-off-by: Vijendar Mukunda <[email protected]>
…tform Select SoundWire dependency flag for acp6.3 based platform for SoundWire configuration. Signed-off-by: Vijendar Mukunda <[email protected]>
Refactor acp driver pm ops to support SoundWire interface. When SoundWire configuration is enabled, In case of ClockStopMode, DSP soft reset should be applied and for rest of the scenarios acp init/deinit sequence should be invoked. Signed-off-by: Vijendar Mukunda <[email protected]>
5e3af75
to
75c548c
Compare
pushed new patch set after fixing review comments |
@bardliao can you take a look? |
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
@vijendarmukunda probably best to wait until next year and the rc1 to send those patches upstream. |
@plbossart : will wait till rc1 release. I do have one more question. How can i send patch series which has to go two sub systems? If I push only SoundWire patches then i need to wait till SoundWire patches got reflected in AsoC tree which blocks submitting Is it possible to send whole patch series at one go so that two subsystems will pick the patch series? |
The dependency between the two subsystem is not easy to navigate. You have to CC: both Mark Brown and Vinod Koul , clearly spell out the dependency in the cover letter and let them figure things out. One of the two will provide his Acked-by tag and the other will apply the patches. |
Merge series from Vijendar Mukunda <[email protected]>: This patch series is to redesign existing platform device creation logic for SoundWire managers and Implement generic functions for SoundWire manager probe, start and exit sequence which are common for both Legacy (NO DSP enabled) and SOF stack, and add SoundWire Interface support for AMD SOF stack (ACP 6.3 based platform). The patch series was reviewed in thesofproject/linux#4699
We have redesigned existing platform device creation logic for SoundWire managers (folder path :sound/soc/amd/ps ) and Implemented generic functions for SoundWire manager probe, start and exit sequence which are common for both Legacy(NO DSP enabled) and SOF stack.
We have also prepared legacy driver patches (folder path: sound/soc/amd/ps), as this PR is targeted for pushing SoundWire/SOF stack changes, we haven't included in this PR. We will push legacy patches for upstream review for alsa devel list once this PR review is completed and merged.
We took Intel code as a reference for implementing generic functions for SoundWire managers.
We are working on generic SoundWire machine driver for AMD platforms. There are some functions implemented in intel SoundWire machine driver code, we want to use it in our machine driver code. we will start a separate thread for the discussion.
Firmware changes are submitted for review. Below is the PR.
thesofproject/sof#8472