hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/acpi/device_pm.c
....@@ -1326,4 +1326,33 @@
13261326 return 1;
13271327 }
13281328 EXPORT_SYMBOL_GPL(acpi_dev_pm_attach);
1329
+
1330
+/**
1331
+ * acpi_storage_d3 - Check if D3 should be used in the suspend path
1332
+ * @dev: Device to check
1333
+ *
1334
+ * Return %true if the platform firmware wants @dev to be programmed
1335
+ * into D3hot or D3cold (if supported) in the suspend path, or %false
1336
+ * when there is no specific preference. On some platforms, if this
1337
+ * hint is ignored, @dev may remain unresponsive after suspending the
1338
+ * platform as a whole.
1339
+ *
1340
+ * Although the property has storage in the name it actually is
1341
+ * applied to the PCIe slot and plugging in a non-storage device the
1342
+ * same platform restrictions will likely apply.
1343
+ */
1344
+bool acpi_storage_d3(struct device *dev)
1345
+{
1346
+ struct acpi_device *adev = ACPI_COMPANION(dev);
1347
+ u8 val;
1348
+
1349
+ if (!adev)
1350
+ return false;
1351
+ if (fwnode_property_read_u8(acpi_fwnode_handle(adev), "StorageD3Enable",
1352
+ &val))
1353
+ return false;
1354
+ return val == 1;
1355
+}
1356
+EXPORT_SYMBOL_GPL(acpi_storage_d3);
1357
+
13291358 #endif /* CONFIG_PM */