From patchwork Mon Aug 19 13:27:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Xu X-Patchwork-Id: 171628 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp2983508ily; Mon, 19 Aug 2019 06:29:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvDQOjIduSBP/+b2zBphZbUBP8tdUfCm3JjWjPud7QQ3Yo4SeeLOLTgfShfnlbsD/tULy2 X-Received: by 2002:a63:d301:: with SMTP id b1mr19575638pgg.379.1566221359018; Mon, 19 Aug 2019 06:29:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566221359; cv=none; d=google.com; s=arc-20160816; b=KQ9nyFi51GyhcarPOu2FNWP0VPXiHGNt6b77NdAS90KemLfm/Tkb5hKlnkDFDszSSR 1zz5kEiC70ru17oZM3XmyTVixm2B4RFXRbeBLbE+9eNzdNTj8tke2Y8hKvcL45fIsiV6 0erZ+NOSlAS0WeAIwjios9ucsH/CF+vcw/+Rr6Mw7q8mZEG9HDx9QKk0vlZF0Xu3CZw0 SWIpGU5YzaZPjg12QmU65iOTL+kEfi1Do+/cN4DxEnRkQKasQxz8cz7QtjWsDdlXiV1r kIJETsf5ShBbI023QyE1ovxzyPojR8kqu80WK7d68izeE+1e4IWj1MGa5OS0wtBGkUxa rpgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=OxganjbRglt4pRjC4Sz5C2zOSoISSucydD/1XRh2fTg=; b=wDeT8pi583DHEnVfpITKEgAtfHukDx0C3WFpufGxvEQfZDikFQhpcC4SnI5tcSlrLC pqJSgc4oWdcmgUiMviQepDmSXxFJRJY67KUhkYQhpWMOOYu/QrK3qWdfU6o9tze4xfqG tlHxoAinvN3QaziFCHH1PBP1QVn4U3b4tbNH81aQxiRD9gvlLSwIDb+JFRdIMpwu494S 28FOuavrMGQ2L+1h9uL+fTXZERRjxFEmWFBbTQQkCLS1uuQ3NMFV2e8otc11llPDsQMG mO2ZudA2Uu6Qh8FKQiIBeF6I8AdgoqVHpSGf4FZIpSJoc5GTEnRNbWe83M8NMJwbVswx U8fg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7si7087400plr.408.2019.08.19.06.29.18; Mon, 19 Aug 2019 06:29:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727332AbfHSN3S (ORCPT + 5 others); Mon, 19 Aug 2019 09:29:18 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5157 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727172AbfHSN3S (ORCPT ); Mon, 19 Aug 2019 09:29:18 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 8EC5B6C097E5FE472E6A; Mon, 19 Aug 2019 21:29:11 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.439.0; Mon, 19 Aug 2019 21:29:05 +0800 From: Wei Xu To: , , , , , , , , CC: , , , , , , , , , , Subject: [PATCH v3] gpio: pl061: Fix the issue failed to register the ACPI interrtupion Date: Mon, 19 Aug 2019 21:27:05 +0800 Message-ID: <1566221225-5170-1-git-send-email-xuwei5@hisilicon.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Invoke acpi_gpiochip_request_interrupts after the acpi data has been attached to the pl061 acpi node to register interruption. Otherwise it will be failed to register interruption for the ACPI case. Because in the gpiochip_add_data_with_key, acpi_gpiochip_add is invoked after gpiochip_add_irqchip but at that time the acpi data has not been attached yet. Tested with below steps: qemu-system-aarch64 \ -machine virt,gic-version=3 -cpu cortex-a57 \ -m 1G,maxmem=4G,slots=4 \ -kernel Image -initrd rootfs.cpio.gz \ -net none -nographic \ -bios QEMU_EFI.fd \ -append "console=ttyAMA0 acpi=force earlycon=pl011,0x9000000" The pl061 interruption is missed and the following output is not in the /proc/interrupts on the v5.3-rc4 compared with the v5.2.0-rc7. 43: 0 ARMH0061:00 3 Edge ACPI:Event Fixes: 04ce935c6b2a ("gpio: pl061: Pass irqchip when adding gpiochip") Signed-off-by: Wei Xu --- v2 -> v3: * addressed the comments of Andy to show only affected output of /proc/interrupts and drop the whole log of v5.2.0-rc7 v1- > v2: * rebased on https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/log/?h=devel * attached the log based on QEMU v3.0.0 and Linux kernel v5.2.0-rc7 --- drivers/gpio/gpio-pl061.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.8.1 diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index 722ce5c..e1a434e 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c @@ -8,6 +8,7 @@ * * Data sheet: ARM DDI 0190B, September 2000 */ +#include #include #include #include @@ -24,6 +25,9 @@ #include #include +#include "gpiolib.h" +#include "gpiolib-acpi.h" + #define GPIODIR 0x400 #define GPIOIS 0x404 #define GPIOIBE 0x408 @@ -345,6 +349,9 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) if (ret) return ret; + if (has_acpi_companion(dev)) + acpi_gpiochip_request_interrupts(&pl061->gc); + amba_set_drvdata(adev, pl061); dev_info(dev, "PL061 GPIO chip registered\n");