2020LOG_MODULE_REGISTER (gpd , CONFIG_SOC_LOG_LEVEL );
2121
2222/* enforce alignment between DT<->nrfs */
23- BUILD_ASSERT (GDPWR_POWER_DOMAIN_ACTIVE_FAST == NRF_GPD_FAST_ACTIVE1 );
24- BUILD_ASSERT (GDPWR_POWER_DOMAIN_ACTIVE_SLOW == NRF_GPD_SLOW_ACTIVE );
25- BUILD_ASSERT (GDPWR_POWER_DOMAIN_MAIN_SLOW == NRF_GPD_SLOW_MAIN );
23+ BUILD_ASSERT (GDPWR_GD_FAST_ACTIVE_0 == NRF_GPD_FAST_ACTIVE0 );
24+ BUILD_ASSERT (GDPWR_GD_FAST_ACTIVE_1 == NRF_GPD_FAST_ACTIVE1 );
25+ BUILD_ASSERT (GDPWR_GD_FAST_MAIN == NRF_GPD_FAST_MAIN );
26+ BUILD_ASSERT (GDPWR_GD_SLOW_ACTIVE == NRF_GPD_SLOW_ACTIVE );
27+ BUILD_ASSERT (GDPWR_GD_SLOW_MAIN == NRF_GPD_SLOW_MAIN );
2628
2729struct gpd_onoff_manager {
2830 struct onoff_manager mgr ;
@@ -44,11 +46,21 @@ static void stop(struct onoff_manager *mgr, onoff_notify_fn notify);
4446#define GPD_SERVICE_REQ_ERR BIT(3)
4547static atomic_t gpd_service_status = ATOMIC_INIT (0 );
4648
49+ static struct gpd_onoff_manager fast_active0 = {
50+ .id = NRF_GPD_FAST_ACTIVE0 ,
51+ .lock = Z_MUTEX_INITIALIZER (fast_active0 .lock ),
52+ .sem = Z_SEM_INITIALIZER (fast_active0 .sem , 0 , 1 ),
53+ };
4754static struct gpd_onoff_manager fast_active1 = {
4855 .id = NRF_GPD_FAST_ACTIVE1 ,
4956 .lock = Z_MUTEX_INITIALIZER (fast_active1 .lock ),
5057 .sem = Z_SEM_INITIALIZER (fast_active1 .sem , 0 , 1 ),
5158};
59+ static struct gpd_onoff_manager fast_main = {
60+ .id = NRF_GPD_FAST_MAIN ,
61+ .lock = Z_MUTEX_INITIALIZER (fast_main .lock ),
62+ .sem = Z_SEM_INITIALIZER (fast_main .sem , 0 , 1 ),
63+ };
5264static struct gpd_onoff_manager slow_active = {
5365 .id = NRF_GPD_SLOW_ACTIVE ,
5466 .lock = Z_MUTEX_INITIALIZER (slow_active .lock ),
@@ -66,8 +78,12 @@ static const struct onoff_transitions transitions =
6678static struct gpd_onoff_manager * get_mgr (uint8_t id )
6779{
6880 switch (id ) {
81+ case NRF_GPD_FAST_ACTIVE0 :
82+ return & fast_active0 ;
6983 case NRF_GPD_FAST_ACTIVE1 :
7084 return & fast_active1 ;
85+ case NRF_GPD_FAST_MAIN :
86+ return & fast_main ;
7187 case NRF_GPD_SLOW_ACTIVE :
7288 return & slow_active ;
7389 case NRF_GPD_SLOW_MAIN :
@@ -286,11 +302,21 @@ static int nrf_gpd_pre_init(void)
286302{
287303 int ret ;
288304
305+ ret = onoff_manager_init (& fast_active0 .mgr , & transitions );
306+ if (ret < 0 ) {
307+ return ret ;
308+ }
309+
289310 ret = onoff_manager_init (& fast_active1 .mgr , & transitions );
290311 if (ret < 0 ) {
291312 return ret ;
292313 }
293314
315+ ret = onoff_manager_init (& fast_main .mgr , & transitions );
316+ if (ret < 0 ) {
317+ return ret ;
318+ }
319+
294320 ret = onoff_manager_init (& slow_active .mgr , & transitions );
295321 if (ret < 0 ) {
296322 return ret ;
@@ -322,11 +348,21 @@ static int nrf_gpd_post_init(void)
322348 }
323349
324350 /* submit GD requests now to align collected statuses */
351+ ret = nrf_gpd_sync (& fast_active0 );
352+ if (ret < 0 ) {
353+ goto err ;
354+ }
355+
325356 ret = nrf_gpd_sync (& fast_active1 );
326357 if (ret < 0 ) {
327358 goto err ;
328359 }
329360
361+ ret = nrf_gpd_sync (& fast_main );
362+ if (ret < 0 ) {
363+ goto err ;
364+ }
365+
330366 ret = nrf_gpd_sync (& slow_active );
331367 if (ret < 0 ) {
332368 goto err ;
0 commit comments