Skip to content
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

soc: intel_adsp/ace: use functions to do CPU power control #59799

Merged

Conversation

dcpleung
Copy link
Member

@dcpleung dcpleung commented Jun 27, 2023

Instead of relying on direct memory access via structs to control CPU power and status, using inline functions instead to hide the details. This makes reading the common code a bit cleaner.

The function names are generic and not architecture or platform specific, in an attempt to ease future arch or platform additions with code reuse. Or else we would need to rename these.

ACE_PWRCTL->wpdsphpxpg &= ~BIT(cpu_num);
}

static ALWAYS_INLINE bool soc_cpu_is_powered(int cpu_num)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't these names a bit too generic? I mean no ace_ prefix/namespace or anything.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could change these if you insist. I made these generic so we don't need to rename stuff if we ever need to share code with another audio DSP architecture in the future.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could change these if you insist. I made these generic so we don't need to rename stuff if we ever need to share code with another audio DSP architecture in the future.

Thanks, I was wondering if this was by design. If this is generic by design then great but then leave a short comment that it's meant to be. There is zero comment right now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the function description (doxygen). Hopefully this would be enough.

Unless we have a porting guide, it's hard to convey the idea of "generic function name to ease future platform addition" in the comment without it sounding out of place.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the doxygen looks useful but that's not what I had in mind.

it's hard to convey the idea of "generic function name to ease future platform addition" in the comment

I think you just did, brilliantly :-)

without it sounding out of place.

I don't see why it would sound out of place.

It's not important, nevermind.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opt for including this in the commit message.

jxstelter
jxstelter previously approved these changes Jun 28, 2023
tmleman
tmleman previously approved these changes Jun 28, 2023
@dcpleung dcpleung dismissed stale reviews from tmleman and jxstelter via 8a3a2b7 June 28, 2023 18:19
@dcpleung dcpleung force-pushed the intel_adsp/soc_cpu_power_funcs branch from 22ca3e5 to 8a3a2b7 Compare June 28, 2023 18:19
Instead of relying on direct memory access via structs to
control CPU power and status, using inline functions instead
to hide the details. This makes reading the common code a bit
cleaner.

The function names are generic and not architecture or
platform specific, in an attempt to ease future arch or
platform additions with code reuse. Or else we would need to
rename these.

Signed-off-by: Daniel Leung <[email protected]>
@dcpleung dcpleung force-pushed the intel_adsp/soc_cpu_power_funcs branch from 8a3a2b7 to aab4f7d Compare June 28, 2023 20:54
@nashif nashif merged commit 25c6553 into zephyrproject-rtos:main Jul 10, 2023
15 checks passed
@dcpleung dcpleung deleted the intel_adsp/soc_cpu_power_funcs branch July 10, 2023 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Intel ADSP Intel Audio platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants