Skip to content

Commit 35d4670

Browse files
roadrunner2gregkh
authored andcommitted
serdev: Fix detection of UART devices on Apple machines.
On Apple devices the _CRS method returns an empty resource template, and the resource settings are instead provided by the _DSM method. But commit 33364d6 (serdev: Add ACPI devices by ResourceSource field) changed the search for serdev devices to require valid, non-empty resource template, thereby breaking Apple devices and causing bluetooth devices to not be found. This expands the check so that if we don't find a valid template, and we're on an Apple machine, then just check for the device being an immediate child of the controller and having a "baud" property. Cc: <[email protected]> # 5.5 Fixes: 33364d6 ("serdev: Add ACPI devices by ResourceSource field") Signed-off-by: Ronald Tschalär <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b85c821 commit 35d4670

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/tty/serdev/core.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/sched.h>
1919
#include <linux/serdev.h>
2020
#include <linux/slab.h>
21+
#include <linux/platform_data/x86/apple.h>
2122

2223
static bool is_registered;
2324
static DEFINE_IDA(ctrl_ida);
@@ -631,6 +632,15 @@ static int acpi_serdev_check_resources(struct serdev_controller *ctrl,
631632
if (ret)
632633
return ret;
633634

635+
/*
636+
* Apple machines provide an empty resource template, so on those
637+
* machines just look for immediate children with a "baud" property
638+
* (from the _DSM method) instead.
639+
*/
640+
if (!lookup.controller_handle && x86_apple_machine &&
641+
!acpi_dev_get_property(adev, "baud", ACPI_TYPE_BUFFER, NULL))
642+
acpi_get_parent(adev->handle, &lookup.controller_handle);
643+
634644
/* Make sure controller and ResourceSource handle match */
635645
if (ACPI_HANDLE(ctrl->dev.parent) != lookup.controller_handle)
636646
return -ENODEV;

0 commit comments

Comments
 (0)