From patchwork Wed Jun 28 17:20: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: 9814943 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 E781160383 for ; Wed, 28 Jun 2017 17:41:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D14F628641 for ; Wed, 28 Jun 2017 17:41:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C627728640; Wed, 28 Jun 2017 17:41:36 +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 6535928637 for ; Wed, 28 Jun 2017 17:41:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751654AbdF1Rlf (ORCPT ); Wed, 28 Jun 2017 13:41:35 -0400 Received: from mailout1.hostsharing.net ([83.223.95.204]:57143 "EHLO mailout1.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751630AbdF1Rlf (ORCPT ); Wed, 28 Jun 2017 13:41:35 -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 mailout1.hostsharing.net (Postfix) with ESMTPS id 7D8FE100492BC; Wed, 28 Jun 2017 19:41:02 +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 C006C6002961; Wed, 28 Jun 2017 19:41:31 +0200 (CEST) X-Mailbox-Line: From 9f06a7ce1cc6dd4cb33004c7d37adc1a5c0f80e2 Mon Sep 17 00:00:00 2001 Message-Id: <9f06a7ce1cc6dd4cb33004c7d37adc1a5c0f80e2.1498636759.git.lukas@wunner.de> In-Reply-To: References: From: Lukas Wunner Date: Wed, 28 Jun 2017 19:20:19 +0200 Subject: [PATCH v2 3/4] ACPI / scan: Recognize Apple SPI and I2C slaves MIME-Version: 1.0 To: "Rafael J. Wysocki" , Mark Brown , Ronald Tschalaer , Federico Lorenzi Cc: Mika Westerberg , Andy Shevchenko , Leif Liddy , Daniel Roschka , 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: Rafael J. Wysocki Cc: Mika Westerberg Cc: Andy Shevchenko Cc: Federico Lorenzi Reported-and-tested-by: Ronald Tschalär Signed-off-by: Lukas Wunner --- Changes v1 -> v2: - Newly inserted patch in v2 to fix an enumeration issue. (Ronald) drivers/acpi/scan.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index d4ff2cd1f738..c565e74bd2dd 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1444,6 +1444,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_ENABLED(CONFIG_X86) && dmi_match(DMI_SYS_VENDOR, "Apple Inc.") && + (device_property_present(&device->dev, "spiSclkPeriod") || + device_property_present(&device->dev, "i2cAddress"))) + return true; + INIT_LIST_HEAD(&resource_list); acpi_dev_get_resources(device, &resource_list, acpi_check_spi_i2c_slave, &is_spi_i2c_slave);