1 /*
2  * Copyright (c) 2024 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef LD_DVFS_H
7 #define LD_DVFS_H
8 
9 #include <dvfs_oppoint.h>
10 #include <nrfs_common.h>
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 /**
17  * @brief Function for initializing the Dynamic Voltage and Frequency Scaling service
18  *        from LD perspective..
19  *
20  */
21 void ld_dvfs_init(void);
22 
23 /**
24  * @brief Function for clearing the zero bias
25  *
26  */
27 void ld_dvfs_clear_zbb(void);
28 
29 /**
30  * @brief Configure ABB registers to transition process.
31  *
32  * @param transient_opp current operation point
33  * @param curr_targ_opp target operation point
34  */
35 void ld_dvfs_configure_abb_for_transition(enum dvfs_frequency_setting transient_opp,
36 					  enum dvfs_frequency_setting curr_targ_opp);
37 
38 /**
39  * @brief Configure hsfll depending on selected oppoint
40  *
41  * @param enum oppoint target operation point
42  * @return 0 value indicates no error.
43  * @return -EINVAL invalid oppoint or domain.
44  * @return -ETIMEDOUT frequency change took more than HSFLL_FREQ_CHANGE_MAX_DELAY_MS
45  */
46 int32_t ld_dvfs_configure_hsfll(enum dvfs_frequency_setting oppoint);
47 
48 /**
49  * @brief Background process during scaling.
50  *
51  * @param downscaling indicates if down-scaling is running
52  */
53 void ld_dvfs_scaling_background_process(bool downscaling);
54 
55 /**
56  * @brief Last step for local domain in downscale procedure
57  *
58  * @param downscaling indicates if down-scaling is running
59  */
60 void ld_dvfs_scaling_finish(bool downscaling);
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 #endif /* LD_DVFS_H */
67