driver core: Add sysfs support for physical location of a device
authorWon Chung <wonchung@google.com>
Mon, 14 Mar 2022 19:54:58 +0000 (19:54 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Apr 2022 07:51:57 +0000 (09:51 +0200)
commit6423d2951087231706246f81851067f7f0593d4a
tree7bef65f539da19fd619fa25ebf70015dd337ea59
parentce753ad1549cbe9ccaea4c06a1f5fa47432c8289
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>
Documentation/ABI/testing/sysfs-devices-physical_location [new file with mode: 0644]
drivers/base/Makefile
drivers/base/core.c
drivers/base/physical_location.c [new file with mode: 0644]
drivers/base/physical_location.h [new file with mode: 0644]
include/linux/device.h