diff options
Diffstat (limited to 'drivers/base/power/domain.c')
-rw-r--r-- | drivers/base/power/domain.c | 253 |
1 files changed, 195 insertions, 58 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 978bbf7ac6af..73ce9fbe9839 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c | |||
@@ -366,7 +366,7 @@ static int pm_genpd_poweroff(struct generic_pm_domain *genpd) | |||
366 | not_suspended = 0; | 366 | not_suspended = 0; |
367 | list_for_each_entry(pdd, &genpd->dev_list, list_node) | 367 | list_for_each_entry(pdd, &genpd->dev_list, list_node) |
368 | if (pdd->dev->driver && (!pm_runtime_suspended(pdd->dev) | 368 | if (pdd->dev->driver && (!pm_runtime_suspended(pdd->dev) |
369 | || pdd->dev->power.irq_safe)) | 369 | || pdd->dev->power.irq_safe || to_gpd_data(pdd)->always_on)) |
370 | not_suspended++; | 370 | not_suspended++; |
371 | 371 | ||
372 | if (not_suspended > genpd->in_progress) | 372 | if (not_suspended > genpd->in_progress) |
@@ -503,6 +503,9 @@ static int pm_genpd_runtime_suspend(struct device *dev) | |||
503 | 503 | ||
504 | might_sleep_if(!genpd->dev_irq_safe); | 504 | might_sleep_if(!genpd->dev_irq_safe); |
505 | 505 | ||
506 | if (dev_gpd_data(dev)->always_on) | ||
507 | return -EBUSY; | ||
508 | |||
506 | stop_ok = genpd->gov ? genpd->gov->stop_ok : NULL; | 509 | stop_ok = genpd->gov ? genpd->gov->stop_ok : NULL; |
507 | if (stop_ok && !stop_ok(dev)) | 510 | if (stop_ok && !stop_ok(dev)) |
508 | return -EBUSY; | 511 | return -EBUSY; |
@@ -764,8 +767,10 @@ static int pm_genpd_prepare(struct device *dev) | |||
764 | 767 | ||
765 | genpd_acquire_lock(genpd); | 768 | genpd_acquire_lock(genpd); |
766 | 769 | ||
767 | if (genpd->prepared_count++ == 0) | 770 | if (genpd->prepared_count++ == 0) { |
771 | genpd->suspended_count = 0; | ||
768 | genpd->suspend_power_off = genpd->status == GPD_STATE_POWER_OFF; | 772 | genpd->suspend_power_off = genpd->status == GPD_STATE_POWER_OFF; |
773 | } | ||
769 | 774 | ||
770 | genpd_release_lock(genpd); | 775 | genpd_release_lock(genpd); |
771 | 776 | ||
@@ -820,17 +825,16 @@ static int pm_genpd_suspend(struct device *dev) | |||
820 | } | 825 | } |
821 | 826 | ||
822 | /** | 827 | /** |
823 | * pm_genpd_suspend_noirq - Late suspend of a device from an I/O PM domain. | 828 | * pm_genpd_suspend_late - Late suspend of a device from an I/O PM domain. |
824 | * @dev: Device to suspend. | 829 | * @dev: Device to suspend. |
825 | * | 830 | * |
826 | * Carry out a late suspend of a device under the assumption that its | 831 | * Carry out a late suspend of a device under the assumption that its |
827 | * pm_domain field points to the domain member of an object of type | 832 | * pm_domain field points to the domain member of an object of type |
828 | * struct generic_pm_domain representing a PM domain consisting of I/O devices. | 833 | * struct generic_pm_domain representing a PM domain consisting of I/O devices. |
829 | */ | 834 | */ |
830 | static int pm_genpd_suspend_noirq(struct device *dev) | 835 | static int pm_genpd_suspend_late(struct device *dev) |
831 | { | 836 | { |
832 | struct generic_pm_domain *genpd; | 837 | struct generic_pm_domain *genpd; |
833 | int ret; | ||
834 | 838 | ||
835 | dev_dbg(dev, "%s()\n", __func__); | 839 | dev_dbg(dev, "%s()\n", __func__); |
836 | 840 | ||
@@ -838,14 +842,28 @@ static int pm_genpd_suspend_noirq(struct device *dev) | |||
838 | if (IS_ERR(genpd)) | 842 | if (IS_ERR(genpd)) |
839 | return -EINVAL; | 843 | return -EINVAL; |
840 | 844 | ||
841 | if (genpd->suspend_power_off) | 845 | return genpd->suspend_power_off ? 0 : genpd_suspend_late(genpd, dev); |
842 | return 0; | 846 | } |
843 | 847 | ||
844 | ret = genpd_suspend_late(genpd, dev); | 848 | /** |
845 | if (ret) | 849 | * pm_genpd_suspend_noirq - Completion of suspend of device in an I/O PM domain. |
846 | return ret; | 850 | * @dev: Device to suspend. |
851 | * | ||
852 | * Stop the device and remove power from the domain if all devices in it have | ||
853 | * been stopped. | ||
854 | */ | ||
855 | static int pm_genpd_suspend_noirq(struct device *dev) | ||
856 | { | ||
857 | struct generic_pm_domain *genpd; | ||
847 | 858 | ||
848 | if (dev->power.wakeup_path && genpd_dev_active_wakeup(genpd, dev)) | 859 | dev_dbg(dev, "%s()\n", __func__); |
860 | |||
861 | genpd = dev_to_genpd(dev); | ||
862 | if (IS_ERR(genpd)) | ||
863 | return -EINVAL; | ||
864 | |||
865 | if (genpd->suspend_power_off || dev_gpd_data(dev)->always_on | ||
866 | || (dev->power.wakeup_path && genpd_dev_active_wakeup(genpd, dev))) | ||
849 | return 0; | 867 | return 0; |
850 | 868 | ||
851 | genpd_stop_dev(genpd, dev); | 869 | genpd_stop_dev(genpd, dev); |
@@ -862,13 +880,10 @@ static int pm_genpd_suspend_noirq(struct device *dev) | |||
862 | } | 880 | } |
863 | 881 | ||
864 | /** | 882 | /** |
865 | * pm_genpd_resume_noirq - Early resume of a device from an I/O power domain. | 883 | * pm_genpd_resume_noirq - Start of resume of device in an I/O PM domain. |
866 | * @dev: Device to resume. | 884 | * @dev: Device to resume. |
867 | * | 885 | * |
868 | * Carry out an early resume of a device under the assumption that its | 886 | * Restore power to the device's PM domain, if necessary, and start the device. |
869 | * pm_domain field points to the domain member of an object of type | ||
870 | * struct generic_pm_domain representing a power domain consisting of I/O | ||
871 | * devices. | ||
872 | */ | 887 | */ |
873 | static int pm_genpd_resume_noirq(struct device *dev) | 888 | static int pm_genpd_resume_noirq(struct device *dev) |
874 | { | 889 | { |
@@ -880,7 +895,8 @@ static int pm_genpd_resume_noirq(struct device *dev) | |||
880 | if (IS_ERR(genpd)) | 895 | if (IS_ERR(genpd)) |
881 | return -EINVAL; | 896 | return -EINVAL; |
882 | 897 | ||
883 | if (genpd->suspend_power_off) | 898 | if (genpd->suspend_power_off || dev_gpd_data(dev)->always_on |
899 | || (dev->power.wakeup_path && genpd_dev_active_wakeup(genpd, dev))) | ||
884 | return 0; | 900 | return 0; |
885 | 901 | ||
886 | /* | 902 | /* |
@@ -890,13 +906,34 @@ static int pm_genpd_resume_noirq(struct device *dev) | |||
890 | */ | 906 | */ |
891 | pm_genpd_poweron(genpd); | 907 | pm_genpd_poweron(genpd); |
892 | genpd->suspended_count--; | 908 | genpd->suspended_count--; |
893 | genpd_start_dev(genpd, dev); | ||
894 | 909 | ||
895 | return genpd_resume_early(genpd, dev); | 910 | return genpd_start_dev(genpd, dev); |
896 | } | 911 | } |
897 | 912 | ||
898 | /** | 913 | /** |
899 | * pm_genpd_resume - Resume a device belonging to an I/O power domain. | 914 | * pm_genpd_resume_early - Early resume of a device in an I/O PM domain. |
915 | * @dev: Device to resume. | ||
916 | * | ||
917 | * Carry out an early resume of a device under the assumption that its | ||
918 | * pm_domain field points to the domain member of an object of type | ||
919 | * struct generic_pm_domain representing a power domain consisting of I/O | ||
920 | * devices. | ||
921 | */ | ||
922 | static int pm_genpd_resume_early(struct device *dev) | ||
923 | { | ||
924 | struct generic_pm_domain *genpd; | ||
925 | |||
926 | dev_dbg(dev, "%s()\n", __func__); | ||
927 | |||
928 | genpd = dev_to_genpd(dev); | ||
929 | if (IS_ERR(genpd)) | ||
930 | return -EINVAL; | ||
931 | |||
932 | return genpd->suspend_power_off ? 0 : genpd_resume_early(genpd, dev); | ||
933 | } | ||
934 | |||
935 | /** | ||
936 | * pm_genpd_resume - Resume of device in an I/O PM domain. | ||
900 | * @dev: Device to resume. | 937 | * @dev: Device to resume. |
901 | * | 938 | * |
902 | * Resume a device under the assumption that its pm_domain field points to the | 939 | * Resume a device under the assumption that its pm_domain field points to the |
@@ -917,7 +954,7 @@ static int pm_genpd_resume(struct device *dev) | |||
917 | } | 954 | } |
918 | 955 | ||
919 | /** | 956 | /** |
920 | * pm_genpd_freeze - Freeze a device belonging to an I/O power domain. | 957 | * pm_genpd_freeze - Freezing a device in an I/O PM domain. |
921 | * @dev: Device to freeze. | 958 | * @dev: Device to freeze. |
922 | * | 959 | * |
923 | * Freeze a device under the assumption that its pm_domain field points to the | 960 | * Freeze a device under the assumption that its pm_domain field points to the |
@@ -938,7 +975,29 @@ static int pm_genpd_freeze(struct device *dev) | |||
938 | } | 975 | } |
939 | 976 | ||
940 | /** | 977 | /** |
941 | * pm_genpd_freeze_noirq - Late freeze of a device from an I/O power domain. | 978 | * pm_genpd_freeze_late - Late freeze of a device in an I/O PM domain. |
979 | * @dev: Device to freeze. | ||
980 | * | ||
981 | * Carry out a late freeze of a device under the assumption that its | ||
982 | * pm_domain field points to the domain member of an object of type | ||
983 | * struct generic_pm_domain representing a power domain consisting of I/O | ||
984 | * devices. | ||
985 | */ | ||
986 | static int pm_genpd_freeze_late(struct device *dev) | ||
987 | { | ||
988 | struct generic_pm_domain *genpd; | ||
989 | |||
990 | dev_dbg(dev, "%s()\n", __func__); | ||
991 | |||
992 | genpd = dev_to_genpd(dev); | ||
993 | if (IS_ERR(genpd)) | ||
994 | return -EINVAL; | ||
995 | |||
996 | return genpd->suspend_power_off ? 0 : genpd_freeze_late(genpd, dev); | ||
997 | } | ||
998 | |||
999 | /** | ||
1000 | * pm_genpd_freeze_noirq - Completion of freezing a device in an I/O PM domain. | ||
942 | * @dev: Device to freeze. | 1001 | * @dev: Device to freeze. |
943 | * | 1002 | * |
944 | * Carry out a late freeze of a device under the assumption that its | 1003 | * Carry out a late freeze of a device under the assumption that its |
@@ -949,7 +1008,6 @@ static int pm_genpd_freeze(struct device *dev) | |||
949 | static int pm_genpd_freeze_noirq(struct device *dev) | 1008 | static int pm_genpd_freeze_noirq(struct device *dev) |
950 | { | 1009 | { |
951 | struct generic_pm_domain *genpd; | 1010 | struct generic_pm_domain *genpd; |
952 | int ret; | ||
953 | 1011 | ||
954 | dev_dbg(dev, "%s()\n", __func__); | 1012 | dev_dbg(dev, "%s()\n", __func__); |
955 | 1013 | ||
@@ -957,20 +1015,33 @@ static int pm_genpd_freeze_noirq(struct device *dev) | |||
957 | if (IS_ERR(genpd)) | 1015 | if (IS_ERR(genpd)) |
958 | return -EINVAL; | 1016 | return -EINVAL; |
959 | 1017 | ||
960 | if (genpd->suspend_power_off) | 1018 | return genpd->suspend_power_off || dev_gpd_data(dev)->always_on ? |
961 | return 0; | 1019 | 0 : genpd_stop_dev(genpd, dev); |
1020 | } | ||
962 | 1021 | ||
963 | ret = genpd_freeze_late(genpd, dev); | 1022 | /** |
964 | if (ret) | 1023 | * pm_genpd_thaw_noirq - Early thaw of device in an I/O PM domain. |
965 | return ret; | 1024 | * @dev: Device to thaw. |
1025 | * | ||
1026 | * Start the device, unless power has been removed from the domain already | ||
1027 | * before the system transition. | ||
1028 | */ | ||
1029 | static int pm_genpd_thaw_noirq(struct device *dev) | ||
1030 | { | ||
1031 | struct generic_pm_domain *genpd; | ||
966 | 1032 | ||
967 | genpd_stop_dev(genpd, dev); | 1033 | dev_dbg(dev, "%s()\n", __func__); |
968 | 1034 | ||
969 | return 0; | 1035 | genpd = dev_to_genpd(dev); |
1036 | if (IS_ERR(genpd)) | ||
1037 | return -EINVAL; | ||
1038 | |||
1039 | return genpd->suspend_power_off || dev_gpd_data(dev)->always_on ? | ||
1040 | 0 : genpd_start_dev(genpd, dev); | ||
970 | } | 1041 | } |
971 | 1042 | ||
972 | /** | 1043 | /** |
973 | * pm_genpd_thaw_noirq - Early thaw of a device from an I/O power domain. | 1044 | * pm_genpd_thaw_early - Early thaw of device in an I/O PM domain. |
974 | * @dev: Device to thaw. | 1045 | * @dev: Device to thaw. |
975 | * | 1046 | * |
976 | * Carry out an early thaw of a device under the assumption that its | 1047 | * Carry out an early thaw of a device under the assumption that its |
@@ -978,7 +1049,7 @@ static int pm_genpd_freeze_noirq(struct device *dev) | |||
978 | * struct generic_pm_domain representing a power domain consisting of I/O | 1049 | * struct generic_pm_domain representing a power domain consisting of I/O |
979 | * devices. | 1050 | * devices. |
980 | */ | 1051 | */ |
981 | static int pm_genpd_thaw_noirq(struct device *dev) | 1052 | static int pm_genpd_thaw_early(struct device *dev) |
982 | { | 1053 | { |
983 | struct generic_pm_domain *genpd; | 1054 | struct generic_pm_domain *genpd; |
984 | 1055 | ||
@@ -988,12 +1059,7 @@ static int pm_genpd_thaw_noirq(struct device *dev) | |||
988 | if (IS_ERR(genpd)) | 1059 | if (IS_ERR(genpd)) |
989 | return -EINVAL; | 1060 | return -EINVAL; |
990 | 1061 | ||
991 | if (genpd->suspend_power_off) | 1062 | return genpd->suspend_power_off ? 0 : genpd_thaw_early(genpd, dev); |
992 | return 0; | ||
993 | |||
994 | genpd_start_dev(genpd, dev); | ||
995 | |||
996 | return genpd_thaw_early(genpd, dev); | ||
997 | } | 1063 | } |
998 | 1064 | ||
999 | /** | 1065 | /** |
@@ -1018,13 +1084,11 @@ static int pm_genpd_thaw(struct device *dev) | |||
1018 | } | 1084 | } |
1019 | 1085 | ||
1020 | /** | 1086 | /** |
1021 | * pm_genpd_restore_noirq - Early restore of a device from an I/O power domain. | 1087 | * pm_genpd_restore_noirq - Start of restore of device in an I/O PM domain. |
1022 | * @dev: Device to resume. | 1088 | * @dev: Device to resume. |
1023 | * | 1089 | * |
1024 | * Carry out an early restore of a device under the assumption that its | 1090 | * Make sure the domain will be in the same power state as before the |
1025 | * pm_domain field points to the domain member of an object of type | 1091 | * hibernation the system is resuming from and start the device if necessary. |
1026 | * struct generic_pm_domain representing a power domain consisting of I/O | ||
1027 | * devices. | ||
1028 | */ | 1092 | */ |
1029 | static int pm_genpd_restore_noirq(struct device *dev) | 1093 | static int pm_genpd_restore_noirq(struct device *dev) |
1030 | { | 1094 | { |
@@ -1040,23 +1104,35 @@ static int pm_genpd_restore_noirq(struct device *dev) | |||
1040 | * Since all of the "noirq" callbacks are executed sequentially, it is | 1104 | * Since all of the "noirq" callbacks are executed sequentially, it is |
1041 | * guaranteed that this function will never run twice in parallel for | 1105 | * guaranteed that this function will never run twice in parallel for |
1042 | * the same PM domain, so it is not necessary to use locking here. | 1106 | * the same PM domain, so it is not necessary to use locking here. |
1107 | * | ||
1108 | * At this point suspended_count == 0 means we are being run for the | ||
1109 | * first time for the given domain in the present cycle. | ||
1043 | */ | 1110 | */ |
1044 | genpd->status = GPD_STATE_POWER_OFF; | 1111 | if (genpd->suspended_count++ == 0) { |
1045 | if (genpd->suspend_power_off) { | ||
1046 | /* | 1112 | /* |
1047 | * The boot kernel might put the domain into the power on state, | 1113 | * The boot kernel might put the domain into arbitrary state, |
1048 | * so make sure it really is powered off. | 1114 | * so make it appear as powered off to pm_genpd_poweron(), so |
1115 | * that it tries to power it on in case it was really off. | ||
1049 | */ | 1116 | */ |
1050 | if (genpd->power_off) | 1117 | genpd->status = GPD_STATE_POWER_OFF; |
1051 | genpd->power_off(genpd); | 1118 | if (genpd->suspend_power_off) { |
1052 | return 0; | 1119 | /* |
1120 | * If the domain was off before the hibernation, make | ||
1121 | * sure it will be off going forward. | ||
1122 | */ | ||
1123 | if (genpd->power_off) | ||
1124 | genpd->power_off(genpd); | ||
1125 | |||
1126 | return 0; | ||
1127 | } | ||
1053 | } | 1128 | } |
1054 | 1129 | ||
1130 | if (genpd->suspend_power_off) | ||
1131 | return 0; | ||
1132 | |||
1055 | pm_genpd_poweron(genpd); | 1133 | pm_genpd_poweron(genpd); |
1056 | genpd->suspended_count--; | ||
1057 | genpd_start_dev(genpd, dev); | ||
1058 | 1134 | ||
1059 | return genpd_resume_early(genpd, dev); | 1135 | return dev_gpd_data(dev)->always_on ? 0 : genpd_start_dev(genpd, dev); |
1060 | } | 1136 | } |
1061 | 1137 | ||
1062 | /** | 1138 | /** |
@@ -1099,11 +1175,15 @@ static void pm_genpd_complete(struct device *dev) | |||
1099 | 1175 | ||
1100 | #define pm_genpd_prepare NULL | 1176 | #define pm_genpd_prepare NULL |
1101 | #define pm_genpd_suspend NULL | 1177 | #define pm_genpd_suspend NULL |
1178 | #define pm_genpd_suspend_late NULL | ||
1102 | #define pm_genpd_suspend_noirq NULL | 1179 | #define pm_genpd_suspend_noirq NULL |
1180 | #define pm_genpd_resume_early NULL | ||
1103 | #define pm_genpd_resume_noirq NULL | 1181 | #define pm_genpd_resume_noirq NULL |
1104 | #define pm_genpd_resume NULL | 1182 | #define pm_genpd_resume NULL |
1105 | #define pm_genpd_freeze NULL | 1183 | #define pm_genpd_freeze NULL |
1184 | #define pm_genpd_freeze_late NULL | ||
1106 | #define pm_genpd_freeze_noirq NULL | 1185 | #define pm_genpd_freeze_noirq NULL |
1186 | #define pm_genpd_thaw_early NULL | ||
1107 | #define pm_genpd_thaw_noirq NULL | 1187 | #define pm_genpd_thaw_noirq NULL |
1108 | #define pm_genpd_thaw NULL | 1188 | #define pm_genpd_thaw NULL |
1109 | #define pm_genpd_restore_noirq NULL | 1189 | #define pm_genpd_restore_noirq NULL |
@@ -1171,6 +1251,38 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, | |||
1171 | } | 1251 | } |
1172 | 1252 | ||
1173 | /** | 1253 | /** |
1254 | * __pm_genpd_of_add_device - Add a device to an I/O PM domain. | ||
1255 | * @genpd_node: Device tree node pointer representing a PM domain to which the | ||
1256 | * the device is added to. | ||
1257 | * @dev: Device to be added. | ||
1258 | * @td: Set of PM QoS timing parameters to attach to the device. | ||
1259 | */ | ||
1260 | int __pm_genpd_of_add_device(struct device_node *genpd_node, struct device *dev, | ||
1261 | struct gpd_timing_data *td) | ||
1262 | { | ||
1263 | struct generic_pm_domain *genpd = NULL, *gpd; | ||
1264 | |||
1265 | dev_dbg(dev, "%s()\n", __func__); | ||
1266 | |||
1267 | if (IS_ERR_OR_NULL(genpd_node) || IS_ERR_OR_NULL(dev)) | ||
1268 | return -EINVAL; | ||
1269 | |||
1270 | mutex_lock(&gpd_list_lock); | ||
1271 | list_for_each_entry(gpd, &gpd_list, gpd_list_node) { | ||
1272 | if (gpd->of_node == genpd_node) { | ||
1273 | genpd = gpd; | ||
1274 | break; | ||
1275 | } | ||
1276 | } | ||
1277 | mutex_unlock(&gpd_list_lock); | ||
1278 | |||
1279 | if (!genpd) | ||
1280 | return -EINVAL; | ||
1281 | |||
1282 | return __pm_genpd_add_device(genpd, dev, td); | ||
1283 | } | ||
1284 | |||
1285 | /** | ||
1174 | * pm_genpd_remove_device - Remove a device from an I/O PM domain. | 1286 | * pm_genpd_remove_device - Remove a device from an I/O PM domain. |
1175 | * @genpd: PM domain to remove the device from. | 1287 | * @genpd: PM domain to remove the device from. |
1176 | * @dev: Device to be removed. | 1288 | * @dev: Device to be removed. |
@@ -1216,6 +1328,26 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd, | |||
1216 | } | 1328 | } |
1217 | 1329 | ||
1218 | /** | 1330 | /** |
1331 | * pm_genpd_dev_always_on - Set/unset the "always on" flag for a given device. | ||
1332 | * @dev: Device to set/unset the flag for. | ||
1333 | * @val: The new value of the device's "always on" flag. | ||
1334 | */ | ||
1335 | void pm_genpd_dev_always_on(struct device *dev, bool val) | ||
1336 | { | ||
1337 | struct pm_subsys_data *psd; | ||
1338 | unsigned long flags; | ||
1339 | |||
1340 | spin_lock_irqsave(&dev->power.lock, flags); | ||
1341 | |||
1342 | psd = dev_to_psd(dev); | ||
1343 | if (psd && psd->domain_data) | ||
1344 | to_gpd_data(psd->domain_data)->always_on = val; | ||
1345 | |||
1346 | spin_unlock_irqrestore(&dev->power.lock, flags); | ||
1347 | } | ||
1348 | EXPORT_SYMBOL_GPL(pm_genpd_dev_always_on); | ||
1349 | |||
1350 | /** | ||
1219 | * pm_genpd_add_subdomain - Add a subdomain to an I/O PM domain. | 1351 | * pm_genpd_add_subdomain - Add a subdomain to an I/O PM domain. |
1220 | * @genpd: Master PM domain to add the subdomain to. | 1352 | * @genpd: Master PM domain to add the subdomain to. |
1221 | * @subdomain: Subdomain to be added. | 1353 | * @subdomain: Subdomain to be added. |
@@ -1450,7 +1582,7 @@ static int pm_genpd_default_suspend_late(struct device *dev) | |||
1450 | { | 1582 | { |
1451 | int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.suspend_late; | 1583 | int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.suspend_late; |
1452 | 1584 | ||
1453 | return cb ? cb(dev) : pm_generic_suspend_noirq(dev); | 1585 | return cb ? cb(dev) : pm_generic_suspend_late(dev); |
1454 | } | 1586 | } |
1455 | 1587 | ||
1456 | /** | 1588 | /** |
@@ -1461,7 +1593,7 @@ static int pm_genpd_default_resume_early(struct device *dev) | |||
1461 | { | 1593 | { |
1462 | int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.resume_early; | 1594 | int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.resume_early; |
1463 | 1595 | ||
1464 | return cb ? cb(dev) : pm_generic_resume_noirq(dev); | 1596 | return cb ? cb(dev) : pm_generic_resume_early(dev); |
1465 | } | 1597 | } |
1466 | 1598 | ||
1467 | /** | 1599 | /** |
@@ -1494,7 +1626,7 @@ static int pm_genpd_default_freeze_late(struct device *dev) | |||
1494 | { | 1626 | { |
1495 | int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.freeze_late; | 1627 | int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.freeze_late; |
1496 | 1628 | ||
1497 | return cb ? cb(dev) : pm_generic_freeze_noirq(dev); | 1629 | return cb ? cb(dev) : pm_generic_freeze_late(dev); |
1498 | } | 1630 | } |
1499 | 1631 | ||
1500 | /** | 1632 | /** |
@@ -1505,7 +1637,7 @@ static int pm_genpd_default_thaw_early(struct device *dev) | |||
1505 | { | 1637 | { |
1506 | int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.thaw_early; | 1638 | int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.thaw_early; |
1507 | 1639 | ||
1508 | return cb ? cb(dev) : pm_generic_thaw_noirq(dev); | 1640 | return cb ? cb(dev) : pm_generic_thaw_early(dev); |
1509 | } | 1641 | } |
1510 | 1642 | ||
1511 | /** | 1643 | /** |
@@ -1557,23 +1689,28 @@ void pm_genpd_init(struct generic_pm_domain *genpd, | |||
1557 | genpd->poweroff_task = NULL; | 1689 | genpd->poweroff_task = NULL; |
1558 | genpd->resume_count = 0; | 1690 | genpd->resume_count = 0; |
1559 | genpd->device_count = 0; | 1691 | genpd->device_count = 0; |
1560 | genpd->suspended_count = 0; | ||
1561 | genpd->max_off_time_ns = -1; | 1692 | genpd->max_off_time_ns = -1; |
1562 | genpd->domain.ops.runtime_suspend = pm_genpd_runtime_suspend; | 1693 | genpd->domain.ops.runtime_suspend = pm_genpd_runtime_suspend; |
1563 | genpd->domain.ops.runtime_resume = pm_genpd_runtime_resume; | 1694 | genpd->domain.ops.runtime_resume = pm_genpd_runtime_resume; |
1564 | genpd->domain.ops.runtime_idle = pm_generic_runtime_idle; | 1695 | genpd->domain.ops.runtime_idle = pm_generic_runtime_idle; |
1565 | genpd->domain.ops.prepare = pm_genpd_prepare; | 1696 | genpd->domain.ops.prepare = pm_genpd_prepare; |
1566 | genpd->domain.ops.suspend = pm_genpd_suspend; | 1697 | genpd->domain.ops.suspend = pm_genpd_suspend; |
1698 | genpd->domain.ops.suspend_late = pm_genpd_suspend_late; | ||
1567 | genpd->domain.ops.suspend_noirq = pm_genpd_suspend_noirq; | 1699 | genpd->domain.ops.suspend_noirq = pm_genpd_suspend_noirq; |
1568 | genpd->domain.ops.resume_noirq = pm_genpd_resume_noirq; | 1700 | genpd->domain.ops.resume_noirq = pm_genpd_resume_noirq; |
1701 | genpd->domain.ops.resume_early = pm_genpd_resume_early; | ||
1569 | genpd->domain.ops.resume = pm_genpd_resume; | 1702 | genpd->domain.ops.resume = pm_genpd_resume; |
1570 | genpd->domain.ops.freeze = pm_genpd_freeze; | 1703 | genpd->domain.ops.freeze = pm_genpd_freeze; |
1704 | genpd->domain.ops.freeze_late = pm_genpd_freeze_late; | ||
1571 | genpd->domain.ops.freeze_noirq = pm_genpd_freeze_noirq; | 1705 | genpd->domain.ops.freeze_noirq = pm_genpd_freeze_noirq; |
1572 | genpd->domain.ops.thaw_noirq = pm_genpd_thaw_noirq; | 1706 | genpd->domain.ops.thaw_noirq = pm_genpd_thaw_noirq; |
1707 | genpd->domain.ops.thaw_early = pm_genpd_thaw_early; | ||
1573 | genpd->domain.ops.thaw = pm_genpd_thaw; | 1708 | genpd->domain.ops.thaw = pm_genpd_thaw; |
1574 | genpd->domain.ops.poweroff = pm_genpd_suspend; | 1709 | genpd->domain.ops.poweroff = pm_genpd_suspend; |
1710 | genpd->domain.ops.poweroff_late = pm_genpd_suspend_late; | ||
1575 | genpd->domain.ops.poweroff_noirq = pm_genpd_suspend_noirq; | 1711 | genpd->domain.ops.poweroff_noirq = pm_genpd_suspend_noirq; |
1576 | genpd->domain.ops.restore_noirq = pm_genpd_restore_noirq; | 1712 | genpd->domain.ops.restore_noirq = pm_genpd_restore_noirq; |
1713 | genpd->domain.ops.restore_early = pm_genpd_resume_early; | ||
1577 | genpd->domain.ops.restore = pm_genpd_resume; | 1714 | genpd->domain.ops.restore = pm_genpd_resume; |
1578 | genpd->domain.ops.complete = pm_genpd_complete; | 1715 | genpd->domain.ops.complete = pm_genpd_complete; |
1579 | genpd->dev_ops.save_state = pm_genpd_default_save_state; | 1716 | genpd->dev_ops.save_state = pm_genpd_default_save_state; |