@@ -181,7 +181,7 @@ static void genpd_recalc_cpu_exit_latency(struct generic_pm_domain *genpd)
181
181
genpd -> cpuidle_data -> idle_state -> exit_latency = usecs64 ;
182
182
}
183
183
184
- static int genpd_power_on (struct generic_pm_domain * genpd )
184
+ static int genpd_power_on (struct generic_pm_domain * genpd , bool timed )
185
185
{
186
186
ktime_t time_start ;
187
187
s64 elapsed_ns ;
@@ -190,6 +190,9 @@ static int genpd_power_on(struct generic_pm_domain *genpd)
190
190
if (!genpd -> power_on )
191
191
return 0 ;
192
192
193
+ if (!timed )
194
+ return genpd -> power_on (genpd );
195
+
193
196
time_start = ktime_get ();
194
197
ret = genpd -> power_on (genpd );
195
198
if (ret )
@@ -208,7 +211,7 @@ static int genpd_power_on(struct generic_pm_domain *genpd)
208
211
return ret ;
209
212
}
210
213
211
- static int genpd_power_off (struct generic_pm_domain * genpd )
214
+ static int genpd_power_off (struct generic_pm_domain * genpd , bool timed )
212
215
{
213
216
ktime_t time_start ;
214
217
s64 elapsed_ns ;
@@ -217,6 +220,9 @@ static int genpd_power_off(struct generic_pm_domain *genpd)
217
220
if (!genpd -> power_off )
218
221
return 0 ;
219
222
223
+ if (!timed )
224
+ return genpd -> power_off (genpd );
225
+
220
226
time_start = ktime_get ();
221
227
ret = genpd -> power_off (genpd );
222
228
if (ret == - EBUSY )
@@ -305,7 +311,7 @@ static int __pm_genpd_poweron(struct generic_pm_domain *genpd)
305
311
}
306
312
}
307
313
308
- ret = genpd_power_on (genpd );
314
+ ret = genpd_power_on (genpd , true );
309
315
if (ret )
310
316
goto err ;
311
317
@@ -615,7 +621,7 @@ static int pm_genpd_poweroff(struct generic_pm_domain *genpd)
615
621
* the pm_genpd_poweron() restore power for us (this shouldn't
616
622
* happen very often).
617
623
*/
618
- ret = genpd_power_off (genpd );
624
+ ret = genpd_power_off (genpd , true );
619
625
if (ret == - EBUSY ) {
620
626
genpd_set_active (genpd );
621
627
goto out ;
@@ -827,6 +833,7 @@ static bool genpd_dev_active_wakeup(struct generic_pm_domain *genpd,
827
833
/**
828
834
* pm_genpd_sync_poweroff - Synchronously power off a PM domain and its masters.
829
835
* @genpd: PM domain to power off, if possible.
836
+ * @timed: True if latency measurements are allowed.
830
837
*
831
838
* Check if the given PM domain can be powered off (during system suspend or
832
839
* hibernation) and do that if so. Also, in that case propagate to its masters.
@@ -836,7 +843,8 @@ static bool genpd_dev_active_wakeup(struct generic_pm_domain *genpd,
836
843
* executed sequentially, so it is guaranteed that it will never run twice in
837
844
* parallel).
838
845
*/
839
- static void pm_genpd_sync_poweroff (struct generic_pm_domain * genpd )
846
+ static void pm_genpd_sync_poweroff (struct generic_pm_domain * genpd ,
847
+ bool timed )
840
848
{
841
849
struct gpd_link * link ;
842
850
@@ -847,38 +855,40 @@ static void pm_genpd_sync_poweroff(struct generic_pm_domain *genpd)
847
855
|| atomic_read (& genpd -> sd_count ) > 0 )
848
856
return ;
849
857
850
- genpd_power_off (genpd );
858
+ genpd_power_off (genpd , timed );
851
859
852
860
genpd -> status = GPD_STATE_POWER_OFF ;
853
861
854
862
list_for_each_entry (link , & genpd -> slave_links , slave_node ) {
855
863
genpd_sd_counter_dec (link -> master );
856
- pm_genpd_sync_poweroff (link -> master );
864
+ pm_genpd_sync_poweroff (link -> master , timed );
857
865
}
858
866
}
859
867
860
868
/**
861
869
* pm_genpd_sync_poweron - Synchronously power on a PM domain and its masters.
862
870
* @genpd: PM domain to power on.
871
+ * @timed: True if latency measurements are allowed.
863
872
*
864
873
* This function is only called in "noirq" and "syscore" stages of system power
865
874
* transitions, so it need not acquire locks (all of the "noirq" callbacks are
866
875
* executed sequentially, so it is guaranteed that it will never run twice in
867
876
* parallel).
868
877
*/
869
- static void pm_genpd_sync_poweron (struct generic_pm_domain * genpd )
878
+ static void pm_genpd_sync_poweron (struct generic_pm_domain * genpd ,
879
+ bool timed )
870
880
{
871
881
struct gpd_link * link ;
872
882
873
883
if (genpd -> status != GPD_STATE_POWER_OFF )
874
884
return ;
875
885
876
886
list_for_each_entry (link , & genpd -> slave_links , slave_node ) {
877
- pm_genpd_sync_poweron (link -> master );
887
+ pm_genpd_sync_poweron (link -> master , timed );
878
888
genpd_sd_counter_inc (link -> master );
879
889
}
880
890
881
- genpd_power_on (genpd );
891
+ genpd_power_on (genpd , timed );
882
892
883
893
genpd -> status = GPD_STATE_ACTIVE ;
884
894
}
@@ -1056,7 +1066,7 @@ static int pm_genpd_suspend_noirq(struct device *dev)
1056
1066
* the same PM domain, so it is not necessary to use locking here.
1057
1067
*/
1058
1068
genpd -> suspended_count ++ ;
1059
- pm_genpd_sync_poweroff (genpd );
1069
+ pm_genpd_sync_poweroff (genpd , true );
1060
1070
1061
1071
return 0 ;
1062
1072
}
@@ -1086,7 +1096,7 @@ static int pm_genpd_resume_noirq(struct device *dev)
1086
1096
* guaranteed that this function will never run twice in parallel for
1087
1097
* the same PM domain, so it is not necessary to use locking here.
1088
1098
*/
1089
- pm_genpd_sync_poweron (genpd );
1099
+ pm_genpd_sync_poweron (genpd , true );
1090
1100
genpd -> suspended_count -- ;
1091
1101
1092
1102
return genpd_start_dev (genpd , dev );
@@ -1300,7 +1310,7 @@ static int pm_genpd_restore_noirq(struct device *dev)
1300
1310
* If the domain was off before the hibernation, make
1301
1311
* sure it will be off going forward.
1302
1312
*/
1303
- genpd_power_off (genpd );
1313
+ genpd_power_off (genpd , true );
1304
1314
1305
1315
return 0 ;
1306
1316
}
@@ -1309,7 +1319,7 @@ static int pm_genpd_restore_noirq(struct device *dev)
1309
1319
if (genpd -> suspend_power_off )
1310
1320
return 0 ;
1311
1321
1312
- pm_genpd_sync_poweron (genpd );
1322
+ pm_genpd_sync_poweron (genpd , true );
1313
1323
1314
1324
return genpd_start_dev (genpd , dev );
1315
1325
}
@@ -1367,9 +1377,9 @@ static void genpd_syscore_switch(struct device *dev, bool suspend)
1367
1377
1368
1378
if (suspend ) {
1369
1379
genpd -> suspended_count ++ ;
1370
- pm_genpd_sync_poweroff (genpd );
1380
+ pm_genpd_sync_poweroff (genpd , false );
1371
1381
} else {
1372
- pm_genpd_sync_poweron (genpd );
1382
+ pm_genpd_sync_poweron (genpd , false );
1373
1383
genpd -> suspended_count -- ;
1374
1384
}
1375
1385
}
0 commit comments