Re: [PATCH] usb: acpi: Get correct location data for Apple macs
From: Greg Kroah-Hartman
Date: Mon Nov 23 2026 - 00:44:52 EST
On Mon, Nov 23, 2026 at 12:39:09AM -0500, Atharva Tiwari wrote:
> In All macs, the _PLD values in ACPI is just garbage values
> and provide no real data, and that may cause errors like:
>
> usb: port power management may be unreliable
>
> On Internal controllers, with multiple USB2.0 and USB3.0.
>
> To fix this we use Apple's own location methods called SSD
> for USB2.0, and they use _ADR for USB3.0.
>
> With this patch we get proper location and peering:
>
> [ 0.280281] usb usb2-port2: peered to usb1-port10
> [ 0.280298] usb usb2-port3: peered to usb1-port3
> [ 0.280311] usb usb2-port4: peered to usb1-port14
> [ 0.280325] usb usb2-port5: peered to usb1-port8
> [ 0.280354] usb usb2-port9: peered to usb1-port9
>
> NOTE: All USB controller has bad _PLD values but SSD is only available
> on internal USB controller, and even only new intel macs has SSD
> method, so we check for SSD and XHC1 before using apple's methods.
>
> Signed-off-by: Atharva Tiwari <atharvatiwarilinuxdev@xxxxxxxxx>
> ---
> drivers/usb/core/usb-acpi.c | 71 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 71 insertions(+)
>
> diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
> index 489dbdc96..b5c61a2ea 100644
> --- a/drivers/usb/core/usb-acpi.c
> +++ b/drivers/usb/core/usb-acpi.c
> @@ -12,6 +12,7 @@
> #include <linux/acpi.h>
> #include <linux/pci.h>
> #include <linux/usb/hcd.h>
> +#include <linux/platform_data/x86/apple.h>
Again, platform specific files for a generic .c file?
>
> #include "hub.h"
>
> @@ -199,6 +200,66 @@ static int usb_acpi_add_usb4_devlink(struct usb_device *udev)
> */
> #define USB_ACPI_LOCATION_VALID (1 << 31)
>
> +/*
> + * Set at registration time on x86 Apple Macs whose internal XHC1 controller
> + * has ports exposing an SSP object. Apple reports the port location through
> + * SSP (USB 2.0) and _ADR (USB 3.x) instead of _PLD.
> + */
> +static bool is_apple_location;
Local static variables are usually not a good idea. Why is this needed
as it's only referenced once?
thanks,
greg k-h