Skip to content

Commit 1a4bc75

Browse files
softwareckinashif
authored andcommitted
adsp: Rename cpu clock related functions
The word cpu was added to the names of functions, structs, types and definitions to disambiguate the names and make room in the namespace for soc clock control functions. Signed-off-by: Adrian Warecki <[email protected]>
1 parent b9e5cf5 commit 1a4bc75

File tree

4 files changed

+42
-42
lines changed

4 files changed

+42
-42
lines changed

drivers/clock_control/clock_control_adsp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ static int cavs_clock_ctrl_set_rate(const struct device *clk,
1313
{
1414
uint32_t freq_idx = (uint32_t)rate;
1515

16-
return adsp_clock_set_freq(freq_idx);
16+
return adsp_clock_set_cpu_freq(freq_idx);
1717
}
1818

1919
static int cavs_clock_ctrl_init(const struct device *dev)

soc/xtensa/intel_adsp/common/clk.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
#include <adsp_clk.h>
1414
#include <adsp_shim.h>
1515

16-
static struct adsp_clock_info platform_clocks[CONFIG_MP_MAX_NUM_CPUS];
16+
static struct adsp_cpu_clock_info platform_cpu_clocks[CONFIG_MP_MAX_NUM_CPUS];
1717
static struct k_spinlock lock;
1818

19-
int adsp_clock_freq_enc[] = ADSP_CLOCK_FREQ_ENC;
20-
int adsp_clock_freq_mask[] = ADSP_CLOCK_FREQ_MASK;
19+
int adsp_clock_freq_enc[] = ADSP_CPU_CLOCK_FREQ_ENC;
20+
int adsp_clock_freq_mask[] = ADSP_CPU_CLOCK_FREQ_MASK;
2121

2222
static void select_cpu_clock_hw(uint32_t freq_idx)
2323
{
@@ -40,12 +40,12 @@ static void select_cpu_clock_hw(uint32_t freq_idx)
4040
ADSP_CLKCTL &= ~ADSP_CLKCTL_OSC_REQUEST_MASK | enc;
4141
}
4242

43-
int adsp_clock_set_freq(uint32_t freq_idx)
43+
int adsp_clock_set_cpu_freq(uint32_t freq_idx)
4444
{
4545
k_spinlock_key_t k;
4646
int i;
4747

48-
if (freq_idx >= ADSP_CLOCK_FREQ_LEN) {
48+
if (freq_idx >= ADSP_CPU_CLOCK_FREQ_LEN) {
4949
return -EINVAL;
5050
}
5151

@@ -56,22 +56,22 @@ int adsp_clock_set_freq(uint32_t freq_idx)
5656
unsigned int num_cpus = arch_num_cpus();
5757

5858
for (i = 0; i < num_cpus; i++) {
59-
platform_clocks[i].current_freq = freq_idx;
59+
platform_cpu_clocks[i].current_freq = freq_idx;
6060
}
6161

6262
k_spin_unlock(&lock, k);
6363

6464
return 0;
6565
}
6666

67-
struct adsp_clock_info *adsp_clocks_get(void)
67+
struct adsp_cpu_clock_info *adsp_cpu_clocks_get(void)
6868
{
69-
return platform_clocks;
69+
return platform_cpu_clocks;
7070
}
7171

7272
void adsp_clock_init(void)
7373
{
74-
uint32_t platform_lowest_freq_idx = ADSP_CLOCK_FREQ_LOWEST;
74+
uint32_t platform_lowest_freq_idx = ADSP_CPU_CLOCK_FREQ_LOWEST;
7575
int i;
7676

7777
#ifdef ADSP_CLOCK_HAS_WOVCRO
@@ -80,23 +80,23 @@ void adsp_clock_init(void)
8080
if (ACE_DfPMCCU.dfclkctl & ACE_CLKCTL_WOVCRO) {
8181
ACE_DfPMCCU.dfclkctl = ACE_DfPMCCU.dfclkctl & ~ACE_CLKCTL_WOVCRO;
8282
} else {
83-
platform_lowest_freq_idx = ADSP_CLOCK_FREQ_LPRO;
83+
platform_lowest_freq_idx = ADSP_CPU_CLOCK_FREQ_LPRO;
8484
}
8585
#else
8686
CAVS_SHIM.clkctl |= CAVS_CLKCTL_WOVCRO;
8787
if (CAVS_SHIM.clkctl & CAVS_CLKCTL_WOVCRO) {
8888
CAVS_SHIM.clkctl = CAVS_SHIM.clkctl & ~CAVS_CLKCTL_WOVCRO;
8989
} else {
90-
platform_lowest_freq_idx = ADSP_CLOCK_FREQ_LPRO;
90+
platform_lowest_freq_idx = ADSP_CPU_CLOCK_FREQ_LPRO;
9191
}
9292
#endif /* CONFIG_SOC_SERIES_INTEL_ACE */
9393
#endif /* ADSP_CLOCK_HAS_WOVCRO */
9494

9595
unsigned int num_cpus = arch_num_cpus();
9696

9797
for (i = 0; i < num_cpus; i++) {
98-
platform_clocks[i].default_freq = ADSP_CLOCK_FREQ_DEFAULT;
99-
platform_clocks[i].current_freq = ADSP_CLOCK_FREQ_DEFAULT;
100-
platform_clocks[i].lowest_freq = platform_lowest_freq_idx;
98+
platform_cpu_clocks[i].default_freq = ADSP_CPU_CLOCK_FREQ_DEFAULT;
99+
platform_cpu_clocks[i].current_freq = ADSP_CPU_CLOCK_FREQ_DEFAULT;
100+
platform_cpu_clocks[i].lowest_freq = platform_lowest_freq_idx;
101101
}
102102
}

soc/xtensa/intel_adsp/common/include/adsp_clk.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <stdint.h>
1010
#include <adsp_shim.h>
1111

12-
struct adsp_clock_info {
12+
struct adsp_cpu_clock_info {
1313
uint32_t default_freq;
1414
uint32_t current_freq;
1515
uint32_t lowest_freq;
@@ -25,15 +25,15 @@ void adsp_clock_init(void);
2525
*
2626
* @return 0 on success, -EINVAL if freq_idx is not valid
2727
*/
28-
int adsp_clock_set_freq(uint32_t freq_idx);
28+
int adsp_clock_set_cpu_freq(uint32_t freq_idx);
2929

3030
/** @brief Get list of cAVS clock information
3131
*
3232
* Returns an array of clock information, one for each core.
3333
*
3434
* @return array with clock information
3535
*/
36-
struct adsp_clock_info *adsp_clocks_get(void);
36+
struct adsp_cpu_clock_info *adsp_cpu_clocks_get(void);
3737

3838
/* Device tree defined constants */
3939
#ifdef CONFIG_SOC_SERIES_INTEL_ACE
@@ -42,23 +42,23 @@ struct adsp_clock_info *adsp_clocks_get(void);
4242
#define ADSP_CLKCTL CAVS_SHIM.clkctl
4343
#endif
4444

45-
#define ADSP_CLOCK_FREQ_ENC DT_PROP(DT_NODELABEL(clkctl), adsp_clkctl_freq_enc)
46-
#define ADSP_CLOCK_FREQ_MASK DT_PROP(DT_NODELABEL(clkctl), adsp_clkctl_freq_mask)
47-
#define ADSP_CLOCK_FREQ_LEN DT_PROP_LEN(DT_NODELABEL(clkctl), adsp_clkctl_freq_enc)
45+
#define ADSP_CPU_CLOCK_FREQ_ENC DT_PROP(DT_NODELABEL(clkctl), adsp_clkctl_freq_enc)
46+
#define ADSP_CPU_CLOCK_FREQ_MASK DT_PROP(DT_NODELABEL(clkctl), adsp_clkctl_freq_mask)
47+
#define ADSP_CPU_CLOCK_FREQ_LEN DT_PROP_LEN(DT_NODELABEL(clkctl), adsp_clkctl_freq_enc)
4848

49-
#define ADSP_CLOCK_FREQ_DEFAULT DT_PROP(DT_NODELABEL(clkctl), adsp_clkctl_freq_default)
50-
#define ADSP_CLOCK_FREQ_LOWEST DT_PROP(DT_NODELABEL(clkctl), adsp_clkctl_freq_lowest)
49+
#define ADSP_CPU_CLOCK_FREQ_DEFAULT DT_PROP(DT_NODELABEL(clkctl), adsp_clkctl_freq_default)
50+
#define ADSP_CPU_CLOCK_FREQ_LOWEST DT_PROP(DT_NODELABEL(clkctl), adsp_clkctl_freq_lowest)
5151

52-
#define ADSP_CLOCK_FREQ(name) DT_PROP(DT_NODELABEL(clkctl), adsp_clkctl_clk_##name)
52+
#define ADSP_CPU_CLOCK_FREQ(name) DT_PROP(DT_NODELABEL(clkctl), adsp_clkctl_clk_##name)
5353

5454
#if DT_PROP(DT_NODELABEL(clkctl), wovcro_supported)
5555
#define ADSP_CLOCK_HAS_WOVCRO
5656
#endif
5757

58-
#define ADSP_CLOCK_FREQ_LPRO ADSP_CLOCK_FREQ(lpro)
59-
#define ADSP_CLOCK_FREQ_HPRO ADSP_CLOCK_FREQ(hpro)
58+
#define ADSP_CPU_CLOCK_FREQ_LPRO ADSP_CPU_CLOCK_FREQ(lpro)
59+
#define ADSP_CPU_CLOCK_FREQ_HPRO ADSP_CPU_CLOCK_FREQ(hpro)
6060
#ifdef ADSP_CLOCK_HAS_WOVCRO
61-
#define ADSP_CLOCK_FREQ_WOVCRO ADSP_CLOCK_FREQ(wovcro)
61+
#define ADSP_CPU_CLOCK_FREQ_WOVCRO ADSP_CPU_CLOCK_FREQ(wovcro)
6262
#endif
6363

6464
#endif /* ZEPHYR_SOC_INTEL_ADSP_CAVS_CLK_H_ */

tests/drivers/clock_control/adsp_clock/src/main.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <zephyr/drivers/clock_control/clock_control_adsp.h>
88
#include <zephyr/drivers/clock_control.h>
99

10-
static void check_clocks(struct adsp_clock_info *clocks, uint32_t freq_idx)
10+
static void check_clocks(struct adsp_cpu_clock_info *clocks, uint32_t freq_idx)
1111
{
1212
int i;
1313
unsigned int num_cpus = arch_num_cpus();
@@ -19,41 +19,41 @@ static void check_clocks(struct adsp_clock_info *clocks, uint32_t freq_idx)
1919

2020
ZTEST(adsp_clock_control, test_adsp_clock_driver)
2121
{
22-
struct adsp_clock_info *clocks = adsp_clocks_get();
22+
struct adsp_cpu_clock_info *clocks = adsp_cpu_clocks_get();
2323

2424
zassert_not_null(clocks, "");
2525

26-
adsp_clock_set_freq(ADSP_CLOCK_FREQ_LPRO);
27-
check_clocks(clocks, ADSP_CLOCK_FREQ_LPRO);
26+
adsp_clock_set_cpu_freq(ADSP_CPU_CLOCK_FREQ_LPRO);
27+
check_clocks(clocks, ADSP_CPU_CLOCK_FREQ_LPRO);
2828

29-
adsp_clock_set_freq(ADSP_CLOCK_FREQ_HPRO);
30-
check_clocks(clocks, ADSP_CLOCK_FREQ_HPRO);
29+
adsp_clock_set_cpu_freq(ADSP_CPU_CLOCK_FREQ_HPRO);
30+
check_clocks(clocks, ADSP_CPU_CLOCK_FREQ_HPRO);
3131

3232
#ifdef ADSP_CLOCK_HAS_WOVCRO
33-
adsp_clock_set_freq(ADSP_CLOCK_FREQ_WOVCRO);
34-
check_clocks(clocks, ADSP_CLOCK_FREQ_WOVCRO);
33+
adsp_clock_set_cpu_freq(ADSP_CPU_CLOCK_FREQ_WOVCRO);
34+
check_clocks(clocks, ADSP_CPU_CLOCK_FREQ_WOVCRO);
3535
#endif
3636
}
3737

3838
ZTEST(adsp_clock_control, test_adsp_clock_control)
3939
{
40-
struct adsp_clock_info *clocks = adsp_clocks_get();
40+
struct adsp_cpu_clock_info *clocks = adsp_cpu_clocks_get();
4141
const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(clkctl));
4242

4343
zassert_not_null(clocks, "");
4444

4545
clock_control_set_rate(dev, NULL, (clock_control_subsys_rate_t)
46-
ADSP_CLOCK_FREQ_LPRO);
47-
check_clocks(clocks, ADSP_CLOCK_FREQ_LPRO);
46+
ADSP_CPU_CLOCK_FREQ_LPRO);
47+
check_clocks(clocks, ADSP_CPU_CLOCK_FREQ_LPRO);
4848

4949
clock_control_set_rate(dev, NULL, (clock_control_subsys_rate_t)
50-
ADSP_CLOCK_FREQ_HPRO);
51-
check_clocks(clocks, ADSP_CLOCK_FREQ_HPRO);
50+
ADSP_CPU_CLOCK_FREQ_HPRO);
51+
check_clocks(clocks, ADSP_CPU_CLOCK_FREQ_HPRO);
5252

5353
#ifdef ADSP_CLOCK_HAS_WOVCRO
5454
clock_control_set_rate(dev, NULL, (clock_control_subsys_rate_t)
55-
ADSP_CLOCK_FREQ_WOVCRO);
56-
check_clocks(clocks, ADSP_CLOCK_FREQ_WOVCRO);
55+
ADSP_CPU_CLOCK_FREQ_WOVCRO);
56+
check_clocks(clocks, ADSP_CPU_CLOCK_FREQ_WOVCRO);
5757
#endif
5858
}
5959
ZTEST_SUITE(adsp_clock_control, NULL, NULL, NULL, NULL, NULL);

0 commit comments

Comments
 (0)