3636#include <sof/alloc.h>
3737#include <sof/lock.h>
3838#include <sof/notifier.h>
39+ #include <sof/cpu.h>
3940#include <platform/clk.h>
4041#include <platform/clk-map.h>
4142#include <platform/platcfg.h>
@@ -76,16 +77,20 @@ static inline uint32_t clock_get_freq(const struct freq_table *table,
7677
7778uint32_t clock_set_freq (int clock , uint32_t hz )
7879{
79- struct clock_notify_data notify_data ;
80+ struct notify_data notify_data ;
81+ struct clock_notify_data clk_notify_data ;
8082 set_frequency set_freq = NULL ;
8183 const struct freq_table * freq_table = NULL ;
8284 uint32_t freq_table_size = 0 ;
83- uint32_t notifier_id = 0 ;
8485 uint32_t idx ;
8586 uint32_t flags ;
8687
87- notify_data .old_freq = clk_pdata -> clk [clock ].freq ;
88- notify_data .old_ticks_per_msec = clk_pdata -> clk [clock ].ticks_per_msec ;
88+ notify_data .data_size = sizeof (clk_notify_data );
89+ notify_data .data = & clk_notify_data ;
90+
91+ clk_notify_data .old_freq = clk_pdata -> clk [clock ].freq ;
92+ clk_notify_data .old_ticks_per_msec =
93+ clk_pdata -> clk [clock ].ticks_per_msec ;
8994
9095 /* atomic context for changing clocks */
9196 spin_lock_irq (& clk_pdata -> clk [clock ].lock , flags );
@@ -95,24 +100,28 @@ uint32_t clock_set_freq(int clock, uint32_t hz)
95100 set_freq = & clock_platform_set_cpu_freq ;
96101 freq_table = cpu_freq ;
97102 freq_table_size = ARRAY_SIZE (cpu_freq );
98- notifier_id = NOTIFIER_ID_CPU_FREQ ;
103+ notify_data .id = NOTIFIER_ID_CPU_FREQ ;
104+ notify_data .target_core_mask =
105+ NOTIFIER_TARGET_CORE_MASK (cpu_get_id ());
99106 break ;
100107 case CLK_SSP :
101108 set_freq = & clock_platform_set_ssp_freq ;
102109 freq_table = ssp_freq ;
103110 freq_table_size = ARRAY_SIZE (ssp_freq );
104- notifier_id = NOTIFIER_ID_SSP_FREQ ;
111+ notify_data .id = NOTIFIER_ID_SSP_FREQ ;
112+ notify_data .target_core_mask = NOTIFIER_TARGET_CORE_ALL_MASK ;
105113 break ;
106114 default :
107115 break ;
108116 }
109117
110118 /* get nearest frequency that is >= requested Hz */
111119 idx = clock_get_freq (freq_table , freq_table_size , hz );
112- notify_data .freq = freq_table [idx ].freq ;
120+ clk_notify_data .freq = freq_table [idx ].freq ;
113121
114122 /* tell anyone interested we are about to change freq */
115- notifier_event (notifier_id , CLOCK_NOTIFY_PRE , & notify_data );
123+ notify_data .message = CLOCK_NOTIFY_PRE ;
124+ notifier_event (& notify_data );
116125
117126 if (set_freq (freq_table [idx ].enc ) == 0 ) {
118127 /* update clock frequency */
@@ -122,7 +131,8 @@ uint32_t clock_set_freq(int clock, uint32_t hz)
122131 }
123132
124133 /* tell anyone interested we have now changed freq */
125- notifier_event (notifier_id , CLOCK_NOTIFY_POST , & notify_data );
134+ notify_data .message = CLOCK_NOTIFY_POST ;
135+ notifier_event (& notify_data );
126136
127137 spin_unlock_irq (& clk_pdata -> clk [clock ].lock , flags );
128138
0 commit comments