USB: Use ACPI device information
Subsystems (3)
PATCH v3 1/2 USB: Use ACPI device information
From: Faouaz TENOUTIT <[email protected]>
Use ACPI device pld information instead of calling acpi_get_physical_device_location.
Signed-off-by Faouaz TENOUTIT <[email protected]>
Acked-by Samuel Ortiz <[email protected]>
--- drivers/acpi/scan.c | 13 +++++++++++++ drivers/usb/core/usb-acpi.c | 14 +++++--------- include/acpi/acpi_bus.h | 1 + 3 files changed, 19 insertions(+), 9 deletions(-)
drivers/acpi/scan.c +13 -0
@@ -767,6 +767,13 @@ static int acpi_device_setup_files(struct acpi_device *dev) &dev_attr_real_power_state); } +/* +* If device has _PLD, initialize the 'pld' struct +*/ +if (acpi_has_method (dev->handle,"_PLD" )) +acpi_get_physical_device_location (dev->handle, + &dev->pld); + end:return result; }
@@ -806,6 +813,12 @@ static void acpi_device_remove_files(struct acpi_device *dev)device_remove_file (&dev->dev, &dev_attr_status);if (dev->handle)device_remove_file (&dev->dev, &dev_attr_path); + +/* +* If device has _PLD, free 'pld' struct +*/ +if (dev->pld) +ACPI_FREE (dev->pld); }/* -------------------------------------------------------------------------- ACPI Bus operations
drivers/usb/core/usb-acpi.c +5 -9
@@ -157,9 +157,6 @@ static struct acpi_device *usb_acpi_find_companion(struct device *dev) }else if (is_usb_port (dev)) {struct usb_port *port_dev =to_usb_port (dev);int port1 = port_dev->portnum; -struct acpi_pld_info *pld; -acpi_handle *handle; -acpi_status status;/* Get the struct usb_device point of port's hub */ udev =to_usb_device (dev->parent->parent);
@@ -190,15 +187,14 @@ static struct acpi_device *usb_acpi_find_companion(struct device *dev)if (!adev)return NULL ; } - handle = adev->handle; - status =acpi_get_physical_device_location (handle, &pld); -if (ACPI_FAILURE (status) || !pld) +if (!adev->pld)return adev; port_dev->location =USB_ACPI_LOCATION_VALID - | pld->group_token <<8 | pld->group_position; - port_dev->connect_type =usb_acpi_get_connect_type (handle, pld); -ACPI_FREE (pld); + | adev->pld->group_token <<8 + | adev->pld->group_position; + port_dev->connect_type =usb_acpi_get_connect_type (adev->handle, + adev->pld);return adev; }
include/acpi/acpi_bus.h +1 -0
@@ -357,6 +357,7 @@ struct acpi_device {struct acpi_scan_handler *handler;struct acpi_hotplug_context *hp;struct acpi_driver *driver; +struct acpi_pld_info *pld;void *driver_data;struct device dev;unsigned int physical_node_count;
Signature · 1 line
2.0.0
PATCH v3 2/2 ACPI: Export PLD (Physical Location of Device)
From: Faouaz TENOUTIT <[email protected]>
This patch exports a sysfs directory with ACPI _PLD information:
$ ls -l /sys/bus/acpi/devices/ACPI-DEV/pld -r--r--r-- root root 4096 2014-05-30 08:39 panel -r--r--r-- root root 4096 2014-05-30 08:39 revision -r--r--r-- root root 4096 2014-05-30 08:39 rotation -r--r--r-- root root 4096 2014-05-30 08:39 shape
This information can be used by user applications to:
- Determine which specific connector or device input mechanism may be used for a given task.
- Describes which panel surface of the system's housing the device connection point resides on (Front, Back, ...)
More information about these _PLD fields can be found here:Documentation/ABI/testing/sysfs-bus-acpi
Signed-off-by Faouaz TENOUTIT <[email protected]>
Acked-by Samuel Ortiz <[email protected]>
Acked-by Andrew J Ross <[email protected]>
--- Documentation/ABI/testing/sysfs-bus-acpi | 60 ++++++++++++++++++++++++++++++++ drivers/acpi/scan.c | 53 ++++++++++++++++++++++++---- 2 files changed, 107 insertions(+), 6 deletions(-)
Documentation/ABI/testing/sysfs-bus-acpi +60 -0
@@ -56,3 +56,63 @@ Description: Writing 1 to this attribute will trigger hot removal of this device object. This file exists for every device object that has _EJ0 method. + +What: /sys/bus/acpi/devices/.../pld +Date: August 2014 +Contact: Faouaz Tenoutit <[email protected]> +Description: + This optional directory provides description of the physical + location, orientation and position of external devices. + It is for example used to describe how camera sensors are + physically mounted and allows user space software to rotate + images accordingly. + +What: /sys/bus/acpi/devices/.../pld/revision +Date: August 2014 +Contact: Faouaz Tenoutit <[email protected]> +Description: + The current Revision is 0x2 + +What: /sys/bus/acpi/devices/.../pld/panel +Date: August 2014 +Contact: Faouaz Tenoutit <[email protected]> +Description: + Describes which panel surface of the system's housing the device + connection point resides on: + 0 Top + 1 Bottom + 2 Left + 3 Right + 4 Front + 5 Back + 6 Unknown + +What: /sys/bus/acpi/devices/.../pld/shape +Date: August 2014 +Contact: Faouaz Tenoutit <[email protected]> +Description: + Describes the shape of the device connection point: + 0 Round + 1 Oval + 2 Square + 3 Vertical Rectangle + 4 Horizontal Rectangle + 5 Vertical Trapezoid + 6 Horizontal Trapezoid + 7 Unknown - Shape rendered as a Rectangle with dotted lines + 8 Chamfered + +What: /sys/bus/acpi/devices/.../pld/rotation +Date: August 2014 +Contact: Faouaz Tenoutit <[email protected]> +Description: + Rotates the Shape clockwise in 45 degree steps around its + origin where: + 0 0° + 1 45° + 2 90° + 3 135° + 4 180° + 5 225° + 6 270° + 7 315°
drivers/acpi/scan.c +47 -6
74 lines not on this page · raw message
Signature · 6 lines
2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html