summaryrefslogtreecommitdiff
path: root/drivers/base/physical_location.h
diff options
context:
space:
mode:
authorWon Chung <wonchung@google.com>2022-03-14 19:54:58 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-27 09:51:57 +0200
commit6423d2951087231706246f81851067f7f0593d4a (patch)
tree7bef65f539da19fd619fa25ebf70015dd337ea59 /drivers/base/physical_location.h
parentce753ad1549cbe9ccaea4c06a1f5fa47432c8289 (diff)
driver core: Add sysfs support for physical location of a device
When ACPI table includes _PLD fields for a device, create a new directory (physical_location) in sysfs to share _PLD fields. Currently without PLD information, when there are multiple of same devices, it is hard to distinguish which device corresponds to which physical device at which location. For example, when there are two Type C connectors, it is hard to find out which connector corresponds to the Type C port on the left panel versus the Type C port on the right panel. With PLD information provided, we can determine which specific device at which location is doing what. _PLD output includes much more fields, but only generic fields are added and exposed to sysfs, so that non-ACPI devices can also support it in the future. The minimal generic fields needed for locating a device are the following. - panel - vertical_position - horizontal_position - dock - lid Signed-off-by: Won Chung <wonchung@google.com> Link: https://lore.kernel.org/r/20220314195458.271430-1-wonchung@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/physical_location.h')
-rw-r--r--drivers/base/physical_location.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/base/physical_location.h b/drivers/base/physical_location.h
new file mode 100644
index 000000000000..82cde9f1b161
--- /dev/null
+++ b/drivers/base/physical_location.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Device physical location support
+ *
+ * Author: Won Chung <wonchung@google.com>
+ */
+
+#include <linux/device.h>
+
+#ifdef CONFIG_ACPI
+extern bool dev_add_physical_location(struct device *dev);
+extern const struct attribute_group dev_attr_physical_location_group;
+#else
+static inline bool dev_add_physical_location(struct device *dev) { return false; };
+static const struct attribute_group dev_attr_physical_location_group = {};
+#endif