From patchwork Tue Jun 20 13:35:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen-chien Jesse Sung X-Patchwork-Id: 778325 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3wsTPg5kpnz9s2G; Tue, 20 Jun 2017 23:35:51 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1dNJJt-0001gX-17; Tue, 20 Jun 2017 13:35:49 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dNJJf-0001YT-LF for kernel-team@lists.ubuntu.com; Tue, 20 Jun 2017 13:35:35 +0000 Received: from 1.general.jesse.uk.vpn ([10.172.197.96] helo=cola.voip.idv.tw) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1dNJJe-00006b-RE; Tue, 20 Jun 2017 13:35:35 +0000 From: Wen-chien Jesse Sung To: kernel-team@lists.ubuntu.com Subject: [linux-joule][PATCH 8/9] mfd: arizona: Request interrupt gpio for arizona to fix pinmux issues Date: Tue, 20 Jun 2017 21:35:15 +0800 Message-Id: <1497965716-31326-8-git-send-email-jesse.sung@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497965716-31326-1-git-send-email-jesse.sung@canonical.com> References: <1497965716-31326-1-git-send-email-jesse.sung@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Jukka Laitinen BugLink: https://launchpad.net/bugs/1698051 This complements the commit 3092f8050ec. In case the arizona IRQ is defined in the ACPI, request the GPIO to make sure that the GPIO is muxed as input. Signed-off-by: Jukka Laitinen Signed-off-by: Wen-chien Jesse Sung --- drivers/mfd/arizona-irq.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/mfd/arizona-irq.c b/drivers/mfd/arizona-irq.c index 3d425e9..0f2f515 100644 --- a/drivers/mfd/arizona-irq.c +++ b/drivers/mfd/arizona-irq.c @@ -24,6 +24,8 @@ #include #include +#include +#include "../gpio/gpiolib.h" #include "arizona.h" static int arizona_map_irq(struct arizona *arizona, int irq) @@ -190,6 +192,7 @@ int arizona_irq_init(struct arizona *arizona) int ret, i; const struct regmap_irq_chip *aod, *irq; struct irq_data *irq_data; + struct gpio_desc *acpi_gpio; arizona->ctrlif_error = true; @@ -334,6 +337,15 @@ int arizona_irq_init(struct arizona *arizona) } /* Used to emulate edge trigger and to work around broken pinmux */ + + /* If the irq is not defined by pdata, but is defined in ACPI, set the gpio number + into the pdata to fix the pinmux */ + if (arizona->pdata.irq_gpio <= 0) { + acpi_gpio=acpi_get_gpiod_by_index(ACPI_COMPANION(arizona->dev),NULL,0,NULL); + if (!IS_ERR(acpi_gpio)) + arizona->pdata.irq_gpio=desc_to_gpio(acpi_gpio); + } + if (arizona->pdata.irq_gpio) { if (gpio_to_irq(arizona->pdata.irq_gpio) != arizona->irq) { dev_warn(arizona->dev, "IRQ %d is not GPIO %d (%d)\n",