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

applications: nrf_desktop: Use clock api for DVFS #17562

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

zycz
Copy link
Contributor

@zycz zycz commented Sep 30, 2024

Use clock api in nrf_desktop dvfs module.
Use notification handler to notify correct
completion of DVFS.

JIRA: NCSDK-29351

@zycz zycz requested review from a team as code owners September 30, 2024 14:46
@github-actions github-actions bot added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Sep 30, 2024
@NordicBuilder
Copy link
Contributor

NordicBuilder commented Sep 30, 2024

CI Information

To view the history of this post, clich the 'edited' button above
Build number: 19

Inputs:

Sources:

sdk-nrf: PR head: dbf7537c8cd1198a654ec40bf7e474c07b2e447c

more details

sdk-nrf:

PR head: dbf7537c8cd1198a654ec40bf7e474c07b2e447c
merge base: 012b7ba1396e2e6a3b864a4946c2dbf2ea122459
target head (main): 4b32dada658b7c84a5a7b2e1d59a6a0eefb35419
Diff

Github labels

Enabled Name Description
ci-disabled Disable the ci execution
ci-all-test Run all of ci, no test spec filtering will be done
ci-force-downstream Force execution of downstream even if twister fails
ci-run-twister Force run twister
ci-run-zephyr-twister Force run zephyr twister
List of changed files detected by CI (3)
applications
│  ├── nrf_desktop
│  │  ├── configuration
│  │  │  ├── nrf54h20dk_nrf54h20_cpuapp
│  │  │  │  │ app.overlay
│  │  ├── src
│  │  │  ├── modules
│  │  │  │  ├── Kconfig.dvfs
│  │  │  │  │ dvfs.c

Outputs:

Toolchain

Version: 3dd8985b56
Build docker image: docker-dtr.nordicsemi.no/sw-production/ncs-build:3dd8985b56_912848a074

Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped; ⚠️ Quarantine

  • ◻️ Toolchain - Skipped: existing toolchain is used
  • ✅ Build twister
    • sdk-nrf test count: 73
  • ✅ Integration tests
    • ✅ desktop52_verification
Disabled integration tests
    • doc-internal
    • test_ble_nrf_config
    • test-fw-nrfconnect-apps
    • test-fw-nrfconnect-ble_mesh
    • test-fw-nrfconnect-ble_samples
    • test-fw-nrfconnect-boot
    • test-fw-nrfconnect-chip
    • test-fw-nrfconnect-fem
    • test-fw-nrfconnect-nfc
    • test-fw-nrfconnect-nrf-iot_cloud
    • test-fw-nrfconnect-nrf-iot_libmodem-nrf
    • test-fw-nrfconnect-nrf-iot_lwm2m
    • test-fw-nrfconnect-nrf-iot_mosh
    • test-fw-nrfconnect-nrf-iot_nrf_provisioning
    • test-fw-nrfconnect-nrf-iot_positioning
    • test-fw-nrfconnect-nrf-iot_samples
    • test-fw-nrfconnect-nrf-iot_serial_lte_modem
    • test-fw-nrfconnect-nrf-iot_thingy91
    • test-fw-nrfconnect-nrf-iot_zephyr_lwm2m
    • test-fw-nrfconnect-nrf_crypto
    • test-fw-nrfconnect-proprietary_esb
    • test-fw-nrfconnect-ps
    • test-fw-nrfconnect-rpc
    • test-fw-nrfconnect-rs
    • test-fw-nrfconnect-tfm
    • test-fw-nrfconnect-thread
    • test-fw-nrfconnect-zigbee
    • test-low-level
    • test-sdk-audio
    • test-sdk-dfu
    • test-sdk-find-my
    • test-sdk-mcuboot
    • test-sdk-pmic-samples
    • test-sdk-sidewalk
    • test-sdk-wifi

Note: This message is automatically posted and updated by the CI

@NordicBuilder
Copy link
Contributor

You can find the documentation preview for this PR at this link. It will be updated about 10 minutes after the documentation build succeeds.

Note: This comment is automatically posted by the Documentation Publishing GitHub Action.

@zycz zycz removed the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Oct 1, 2024
applications/nrf_desktop/src/modules/Kconfig.dvfs Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/Kconfig.dvfs Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Show resolved Hide resolved
applications/nrf_desktop/src/modules/Kconfig.dvfs Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/Kconfig.dvfs Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/Kconfig.dvfs Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
@github-actions github-actions bot added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Oct 2, 2024
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
@zycz zycz force-pushed the issue29351_clock_api branch 2 times, most recently from 4f1fcd7 to 56d247f Compare October 8, 2024 14:40
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
@zycz zycz removed the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Oct 15, 2024
@zycz zycz added this to the 2.8.0 milestone Oct 15, 2024
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
@zycz
Copy link
Contributor Author

zycz commented Oct 21, 2024

rebased

applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Show resolved Hide resolved
@@ -59,6 +59,10 @@
in-polling-period-us = <125>;
in-report-size = <64>;
};

aliases {
nrfdesktop-dvfs-clock = &cpuapp_hsfll;
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we could refer to cpuapp's clock here to avoid introducing the DT alias.
zephyr/dts/common/nordic/nrf54h20.dtsi defines cpuapp's clock nicely:

                cpuapp: cpu@2 {                                                                      
                        compatible = "arm,cortex-m33";                                               
                        reg = <2>;                                                                   
                        device_type = "cpu";                                                         
                        clocks = <&cpuapp_hsfll>;                                                    
                        clock-frequency = <DT_FREQ_M(320)>;                                          
                        cpu-power-states = <&idle_cache_disabled &s2ram>;                            
                };  

Copy link
Contributor

Choose a reason for hiding this comment

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

Furthermore, zephyr/dts/arm/nordic/nrf54h20_cpuapp.dtsi assigns cpu label to the cpuapp.

Copy link
Contributor

Choose a reason for hiding this comment

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

The change would allow us to explicitly show that we want to control frequency of the cpuapp here. It could also simplify maintenance and configuration (we will remove risk that user enables the module without configuring the used DT alias too).

Copy link
Contributor

Choose a reason for hiding this comment

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

Then we would be able to call the module e.g. cpu_freq_control later on (FYI: @kapi-no - you asked for more generic name)

Copy link
Contributor

Choose a reason for hiding this comment

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

Changes may be applied under follow-up tickets, but if we plan to change the name or configuration scheme after the NCS 2.8, we should mark the module as experimental for NCS 2.8 (breaking APIs)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

applications/nrf_desktop/src/modules/dvfs.c Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
}
if (requested_freq != current_freq) {
/*
* In current solution it is assumed tht no other module
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* In current solution it is assumed tht no other module
* In current solution it is assumed that no other module

@zycz zycz removed the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Oct 23, 2024
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dvfs.c Outdated Show resolved Hide resolved
Use clock api in nrf_desktop dvfs module.
Use notification handler to notify correct
completion of DVFS.

JIRA: NCSDK-29351

Signed-off-by: Jan Zyczkowski <jan.zyczkowski@nordicsemi.no>
@github-actions github-actions bot added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Oct 23, 2024
Comment on lines +20 to +30
config DESKTOP_DVFS_FREQ_HIGH
int
default 320000000

config DESKTOP_DVFS_FREQ_MED
int
default 128000000

config DESKTOP_DVFS_FREQ_LOW
int
default 64000000
Copy link
Contributor

Choose a reason for hiding this comment

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

@gmarull these should come from dts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But we don't have those frequencies in dts

Copy link
Member

Choose a reason for hiding this comment

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

The range of valid frequencies should definitely be in DT, this is a HW capability thing. The software choices are fine in Kconfig. However, adjusting frequencies directly in applications doesn't seem like a great design. This should be governed by some framework.

Copy link
Contributor Author

@zycz zycz Oct 24, 2024

Choose a reason for hiding this comment

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

Ok, but valid frequencies should be added globally in dts at board level. Till it is not added shouldn't we base on frequencies from Kconfig?

However, adjusting frequencies directly in applications doesn't seem like a great design.

Object of this task is to move responsibility of changing frequencies to clock_api instead directly from application (module has been written prior to clock driver)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nordicjm @gmarull lets merge as it is for 2.8 release and change to dts later when those frequencies will be properly added to dts.

@zycz zycz requested a review from nordicjm October 24, 2024 07:51
Copy link
Contributor

@nordicjm nordicjm left a comment

Choose a reason for hiding this comment

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

Approving with caveat that this is properly moved to DTS in a future PR

@rlubos rlubos merged commit 81e9846 into nrfconnect:main Oct 24, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants