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

drivers: pwm: nrfx: add global hsfll request for fast PWM #82133

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

mstasiaknordic
Copy link
Contributor

@mstasiaknordic mstasiaknordic commented Nov 27, 2024

Added clock control api for global hsfll used in fast PWM120 driver.

@mstasiaknordic mstasiaknordic force-pushed the pwm_global_hsfll branch 3 times, most recently from e94eb66 to 1e59406 Compare December 4, 2024 08:08
@mstasiaknordic mstasiaknordic marked this pull request as ready for review December 11, 2024 09:56
@zephyrbot zephyrbot added platform: nRF Nordic nRFx area: PWM Pulse Width Modulation labels Dec 11, 2024
@mstasiaknordic
Copy link
Contributor Author

@bjarki-andreasen You can have a look

Copy link
Collaborator

@bjarki-andreasen bjarki-andreasen left a comment

Choose a reason for hiding this comment

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

Looks good

nordic-krch
nordic-krch previously approved these changes Jan 13, 2025
masz-nordic
masz-nordic previously approved these changes Jan 17, 2025
nika-nordic
nika-nordic previously approved these changes Jan 17, 2025
@@ -248,6 +283,20 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel,
* until another playback is requested (new values will be
* loaded then) or the PWM peripheral is stopped.
*/
#if PWM_NRFX_USE_CLOCK_CONTROL
if (!data->clock_requested && config->clk_dev) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: with config->clk_dev && !data->clock_requested you could avoid clock_requested being checked for instances that don't need to request clock anyway

@@ -229,6 +252,18 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel,
* ensure it is stopped before starting the next playback.
*/
nrfx_pwm_stop(&config->pwm, false);
#if PWM_NRFX_USE_CLOCK_CONTROL
if (data->clock_requested && config->clk_dev) {
Copy link
Member

Choose a reason for hiding this comment

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

Checking of config->clk_dev is redundant here.
Same piece of code for stopping the PWM and releasing the clock is used in pwm_suspend(). How about using a helper function for this to avoid duplication?

Added clock control api for global hsfll used in fast PWM120 driver.

Signed-off-by: Michał Stasiak <[email protected]>
@kartben kartben merged commit 2c89ed5 into zephyrproject-rtos:main Jan 17, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Base OS Base OS Library (lib/os) area: Clock Control area: PWM Pulse Width Modulation platform: nRF Nordic nRFx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants