lkml.org 
[lkml]   [2020]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.5 091/189] serdev: Fix detection of UART devices on Apple machines.
    Date
    From: Ronald Tschalär <ronald@innovation.ch>

    commit 35d4670aaec7206b5ef19c842ca33076bde562e4 upstream.

    On Apple devices the _CRS method returns an empty resource template, and
    the resource settings are instead provided by the _DSM method. But
    commit 33364d63c75d6182fa369cea80315cf1bb0ee38e (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: <stable@vger.kernel.org> # 5.5
    Fixes: 33364d63c75d ("serdev: Add ACPI devices by ResourceSource field")
    Signed-off-by: Ronald Tschalär <ronald@innovation.ch>
    Link: https://lore.kernel.org/r/20200211194723.486217-1-ronald@innovation.ch
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/tty/serdev/core.c | 10 ++++++++++
    1 file changed, 10 insertions(+)

    --- a/drivers/tty/serdev/core.c
    +++ b/drivers/tty/serdev/core.c
    @@ -18,6 +18,7 @@
    #include <linux/sched.h>
    #include <linux/serdev.h>
    #include <linux/slab.h>
    +#include <linux/platform_data/x86/apple.h>

    static bool is_registered;
    static DEFINE_IDA(ctrl_ida);
    @@ -630,6 +631,15 @@ static int acpi_serdev_check_resources(s
    if (ret)
    return ret;

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

    \
     
     \ /
      Last update: 2020-03-10 14:23    [W:4.105 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site