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: nrf: nrf pwm driver modification to use DT #11726

Conversation

gamnes
Copy link
Collaborator

@gamnes gamnes commented Nov 29, 2018

  1. Kconfig options clock_prescaler removed.
  2. Kconfig options CH pin selection moved to DT.
  3. pwm device node added with alias to all
    nRF5x DTSI files.
  4. Added yaml binding for Nordic PWM node.
  5. Rewritten pwm_nrfx.c nRF HW PWM driver.
  6. Modified fade_led PWM example to also
    include nRF HW PWM option.

Fixes #10035

Signed-off-by: Gaute Gamnes [email protected]

@gamnes
Copy link
Collaborator Author

gamnes commented Nov 29, 2018

This pull request is done as part of issue 8758.

This pull request fixes issue 10035.

This pull request assumes issue 6958 will be merged and function get_cycles_per_sec() will eventually be removed.

Setting duty to either 0% or 100% for all channels of a PWM instance will disable the peripheral, see 9507 - if better semantics are introduced, this should be fixed in this driver as well.

@gamnes gamnes requested a review from anangl November 29, 2018 09:17
anangl
anangl previously requested changes Nov 29, 2018
dts/arm/nordic/nrf52840.dtsi Show resolved Hide resolved
dts/bindings/pwm/nordic,nrf-pwm.yaml Outdated Show resolved Hide resolved
dts/bindings/pwm/nordic,nrf-pwm.yaml Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Nov 29, 2018

Codecov Report

Merging #11726 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #11726   +/-   ##
=======================================
  Coverage   48.13%   48.13%           
=======================================
  Files         281      281           
  Lines       43425    43425           
  Branches    10406    10406           
=======================================
  Hits        20902    20902           
  Misses      18368    18368           
  Partials     4155     4155

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e21d7cc...43c18de. Read the comment docs.

@gamnes gamnes force-pushed the issue8758_migrate_nRF_HW_PWM_config_to_dts branch from 634e847 to a624026 Compare November 29, 2018 10:55
@zephyrproject-rtos zephyrproject-rtos deleted a comment from zephyrbot Nov 29, 2018
Copy link
Member

@ioannisg ioannisg left a comment

Choose a reason for hiding this comment

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

Why is only the nrf52_pca10040 board DTS fixed?

@gamnes gamnes force-pushed the issue8758_migrate_nRF_HW_PWM_config_to_dts branch from a624026 to 4470988 Compare November 30, 2018 13:28
@zephyrproject-rtos zephyrproject-rtos deleted a comment from zephyrbot Nov 30, 2018
@gamnes gamnes force-pushed the issue8758_migrate_nRF_HW_PWM_config_to_dts branch 2 times, most recently from 9fd8245 to 21a3041 Compare November 30, 2018 14:12
@zephyrproject-rtos zephyrproject-rtos deleted a comment from zephyrbot Nov 30, 2018
@zephyrbot
Copy link
Collaborator

zephyrbot commented Nov 30, 2018

All checks are passing now.

Review history of this comment for details about previous failed status.
Note that some checks might have not completed yet.

@gamnes gamnes force-pushed the issue8758_migrate_nRF_HW_PWM_config_to_dts branch from 21a3041 to 3cde910 Compare November 30, 2018 14:45
@nashif nashif dismissed stale reviews from anangl and ioannisg December 2, 2018 19:26

addressed

@carlescufi
Copy link
Member

carlescufi commented Dec 3, 2018

@ioannisg @anangl @Mierunski can you re-review please?

anangl
anangl previously requested changes Dec 4, 2018
dts/bindings/pwm/nordic,nrf-pwm.yaml Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
@anangl
Copy link
Member

anangl commented Dec 4, 2018

Split these changes into several commits. Use separate commits for logically related changes (for instance, don't add DTS entries and change PWM prescaler handling in one commit as these things are unrelated).

@gamnes
Copy link
Collaborator Author

gamnes commented Dec 4, 2018

Ok. Will split these changes into multiple commits.

@galak galak added area: PWM Pulse Width Modulation area: Devicetree platform: nRF Nordic nRFx labels Dec 4, 2018
galak
galak previously requested changes Dec 4, 2018
Copy link
Collaborator

@galak galak left a comment

Choose a reason for hiding this comment

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

one DT change to the binding.

@gamnes gamnes force-pushed the issue8758_migrate_nRF_HW_PWM_config_to_dts branch from 3cde910 to 960ccae Compare December 4, 2018 16:53
@gamnes gamnes dismissed stale reviews from galak and anangl December 7, 2018 09:38

DT binding was changed to boolean

anangl
anangl previously requested changes Dec 7, 2018
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
@anangl
Copy link
Member

anangl commented Dec 7, 2018

@anangl: Split up into multiple commits, and all the changes you requested should have been resolved.

The changes are split but all the commits have the same title, which is not always adequate to what is actually changed by the commit (for instance the first commit add only dts entries and bindings, but the title says "drivers: pwm: nrf: ...").

@gamnes
Copy link
Collaborator Author

gamnes commented Dec 7, 2018

Got it, will change the wording of the commit message to be more clear

@gamnes gamnes force-pushed the issue8758_migrate_nRF_HW_PWM_config_to_dts branch 2 times, most recently from a0ee886 to 7a33b56 Compare December 10, 2018 13:32
@gamnes
Copy link
Collaborator Author

gamnes commented Dec 10, 2018

@anangl - Please see if changes were OK. Thanks

@anangl anangl dismissed their stale review December 11, 2018 08:02

All my comments were addressed.

Copy link
Member

@anangl anangl 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.
Two minor corrections suggested.

drivers/pwm/Kconfig.nrfx Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
@gamnes gamnes force-pushed the issue8758_migrate_nRF_HW_PWM_config_to_dts branch 2 times, most recently from 203d29a to ea8aa9e Compare December 11, 2018 10:56
@gamnes gamnes force-pushed the issue8758_migrate_nRF_HW_PWM_config_to_dts branch from ea8aa9e to e805c0d Compare December 11, 2018 11:05
@gamnes
Copy link
Collaborator Author

gamnes commented Dec 11, 2018

Thanks @anangl - The last force-push was just to align some indentation in pwm_nrfx.c

@carlescufi
Copy link
Member

@gamnes can you fix CI?

Copy link
Collaborator

@Mierunski Mierunski 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, just a few nitpicks

drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
drivers/pwm/pwm_nrfx.c Outdated Show resolved Hide resolved
@carlescufi
Copy link
Member

@Mierunski can you take another look?

@gamnes gamnes force-pushed the issue8758_migrate_nRF_HW_PWM_config_to_dts branch from e805c0d to 4249544 Compare December 11, 2018 12:28
1. PWM device node added with alias to all
   nRF52x DTSI files. 1 instance for
   nRF52810, 3 instances for nRF52832, and
   4 instance for nRF52840.
2. Added yaml binding for Nordic PWM node.

Signed-off-by: Gaute Gamnes <[email protected]>
1. Kconfig options CH pin removed.
2. Kconfig options CH inverted removed.
3. Modified pwm_nrfx.c driver to use DT
   defines instead of Kconfig.

Signed-off-by: Gaute Gamnes <[email protected]>
1. Kconfig options clock_prescaler removed.
2. Rewritten pwm_nrfx.c nRF HW PWM driver.

Signed-off-by: Gaute Gamnes <[email protected]>
1. Modified fade_led PWM example to include
   nRF HW PWM option.
2. Added fade_led nrf52_pca10040.overlay
   in order to enable PWM node and choose
   output PWM GPIO for channel 0. Channel 1
   GPIO enable but not used in sample src.

Signed-off-by: Gaute Gamnes <[email protected]>
@gamnes gamnes force-pushed the issue8758_migrate_nRF_HW_PWM_config_to_dts branch from 4249544 to 43c18de Compare December 11, 2018 12:45
@gamnes
Copy link
Collaborator Author

gamnes commented Dec 11, 2018

Latest force-push was rebase onto upstream master.

@carlescufi carlescufi merged commit 596a11c into zephyrproject-rtos:master Dec 11, 2018
@gamnes gamnes deleted the issue8758_migrate_nRF_HW_PWM_config_to_dts branch December 11, 2018 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree area: PWM Pulse Width Modulation platform: nRF Nordic nRFx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants