From patchwork Thu Jul 13 22:36:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lukas Wunner X-Patchwork-Id: 9839669 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 96EC2603F3 for ; Thu, 13 Jul 2017 22:38:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA66927F8F for ; Thu, 13 Jul 2017 22:38:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF50227FB0; Thu, 13 Jul 2017 22:38:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 437DF27F97 for ; Thu, 13 Jul 2017 22:38:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752735AbdGMWiZ (ORCPT ); Thu, 13 Jul 2017 18:38:25 -0400 Received: from mailout3.hostsharing.net ([176.9.242.54]:54931 "EHLO mailout3.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752072AbdGMWiY (ORCPT ); Thu, 13 Jul 2017 18:38:24 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailout3.hostsharing.net (Postfix) with ESMTPS id 350CF100B089F; Fri, 14 Jul 2017 00:38:23 +0200 (CEST) Received: from localhost (5-38-90-81.adsl.cmo.de [81.90.38.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by h08.hostsharing.net (Postfix) with ESMTPSA id F0ADC604DB97; Fri, 14 Jul 2017 00:38:21 +0200 (CEST) X-Mailbox-Line: From 5e1e3da2efb3bb8dea5b49d29585b90cf76891be Mon Sep 17 00:00:00 2001 Message-Id: <5e1e3da2efb3bb8dea5b49d29585b90cf76891be.1499983092.git.lukas@wunner.de> In-Reply-To: References: From: Lukas Wunner Date: Fri, 14 Jul 2017 00:36:19 +0200 Subject: [PATCH v3 5/6] ACPI / scan: Recognize Apple SPI and I2C slaves MIME-Version: 1.0 To: "Rafael J. Wysocki" Cc: Ronald Tschalaer , Federico Lorenzi , Mika Westerberg , Andy Shevchenko , Lv Zheng , Leif Liddy , Daniel Roschka , Mark Brown , linux-acpi@vger.kernel.org, linux-spi@vger.kernel.org Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP SPI and I2C slaves are enumerated by their respective parents rather than the ACPI core. They are recognized by presence of _CRS resources, which however are missing on Macs. Check for presence of device properties instead. Cc: Federico Lorenzi Cc: Mika Westerberg Cc: Andy Shevchenko Reported-and-tested-by: Ronald Tschalär Signed-off-by: Lukas Wunner --- Changes v2 -> v3: - Use fwnode_property_present() instead of device_property_present(), the latter doesn't work as the fwnode pointer of the struct device embedded in a struct acpi_device is always NULL. (Ronald) drivers/acpi/scan.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 59ebbd5f7b83..e84e5eb23222 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1452,6 +1452,12 @@ static bool acpi_is_spi_i2c_slave(struct acpi_device *device) struct list_head resource_list; bool is_spi_i2c_slave = false; + /* Macs use device properties in lieu of _CRS resources */ + if (is_apple_system && + (fwnode_property_present(&device->fwnode, "spiSclkPeriod") || + fwnode_property_present(&device->fwnode, "i2cAddress"))) + return true; + INIT_LIST_HEAD(&resource_list); acpi_dev_get_resources(device, &resource_list, acpi_check_spi_i2c_slave, &is_spi_i2c_slave);