From patchwork Tue Oct 24 19:54:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Berger X-Patchwork-Id: 10025445 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 7E02960375 for ; Tue, 24 Oct 2017 19:57:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6DAE728A67 for ; Tue, 24 Oct 2017 19:57:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60BDA28A6A; Tue, 24 Oct 2017 19:57:21 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5E93528A67 for ; Tue, 24 Oct 2017 19:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Jk4SS8LeKE3oHaoBxuQ67JcDeQQrDkPZC6T0OG+RlIg=; b=DahNEraUDwTsdfKJNiIAnjLmDZ lPB/d0BYBSUWHp3F0h6hYpx10qy+aT7WC6L++g8wAObh5rcCl6esobxkqKT+vdpAHnZyTRNKiY9f1 SQYfZf3RM25fbEfhIEHsym6TqmF6h0h2nwgYkXy9mJNy2YgHzd2P9USPiAhBLOyG/K3m/68VloluJ 4JIxKzQ6g3QWPOaQ2NaxbSlBqbELkusRvfPWGZw/+j29tkiHWeVJwpTN5i/Gq7vvPLTQLX1kH8lg9 TRub8JbcOoG6yoSbNk3WX8vlGtoUbA0F1O1av48MUpUY1kPgMS8cu7NW2V1ieCtcNdHHW7e6xaWVv uV1aYJnQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e75K7-0000tU-CL; Tue, 24 Oct 2017 19:57:15 +0000 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e75Iw-0008ND-0A for linux-arm-kernel@lists.infradead.org; Tue, 24 Oct 2017 19:56:06 +0000 Received: by mail-qt0-x243.google.com with SMTP id d9so25217157qtd.7 for ; Tue, 24 Oct 2017 12:55:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+g4GxcALUyFwPMO/rm/fRWN/cK9+qiTaV9zKwdRfZEg=; b=MSVfIJve34oZtRvF8e7Q+1HYQ+/F9J3nFS4uqluU0qRmnIacJQ3f3Zl/QLG6t6xwNu XBTwXqgTXMac0Sw4G4hfkRBGtwyl2bslH3Jn3YxWiMgBC4thusz7e51P6DuOHfbkb2j1 /RUNuFesibWKf+m/7bJ1hncj1II5yjWv54CA/DZ2lt5r/d7unUAgEBqSP29qUoI/qPRy Ku8qswYbZXMKi+2C4xiokAe4f0Vea0tdYZx0K7iOgbeJQ6Pa/endmR1D+xdZiAg5HK62 TIQp+WnghxqvJzsn08TRNZiBEHhVYdsgLDULEXjdotMO0UhmpwS1W0FIRza3JW/E0c/Q +IXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+g4GxcALUyFwPMO/rm/fRWN/cK9+qiTaV9zKwdRfZEg=; b=csfnSdl/2R8FMfXwlDhjsRc9qjlVj/vh0x4gAARiorOdxsmZ3hMUnwLBfzyHWNtRKj F+zEIrpPJPhU7uaLFlYJinixRyW0b1sxbi+nV3tVdX0Mypz+TY0V+CTYWw1aU7PHO+zh 1ArtASkMq8PO48Ijsj5XdjJrYCMH3KpgYRVvt554VcmWGgGBAc9h0GIIH1ARVV+ZcFr1 FxLMoJEh/a9ldl80bpALHK4mFSI6903Ki1vgCoE7vixIfrJZnXfc6fcP+hqWHQrDAGL1 5Ujwk8LubQD07+aQz2xyAdLEzfLnDWtzTNhAeIbseHkE5iU6qR1npTg4GXzJ5mxL1t6w /HzQ== X-Gm-Message-State: AMCzsaU/HecJ3GpFBglvGY0qDmJiTw75Ef2dn3T46gEeyH3lAcA/wNQg nnXdWWO9mtSnoXNvh+DgQ7o= X-Google-Smtp-Source: ABhQp+T3aQXn8udVM8h13Pa8vWqYSFbljHjLIprXelGbcCkWstEFeK0QhYVJZ0aJvkUsjt/UthJQKA== X-Received: by 10.200.43.252 with SMTP id n57mr26494845qtn.141.1508874940647; Tue, 24 Oct 2017 12:55:40 -0700 (PDT) Received: from stb-bld-02.irv.broadcom.com ([192.19.255.250]) by smtp.gmail.com with ESMTPSA id s27sm794249qtj.3.2017.10.24.12.55.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 12:55:40 -0700 (PDT) From: Doug Berger To: Gregory Fong Subject: [PATCH v2 2/7] gpio: brcmstb: allow all instances to be wakeup sources Date: Tue, 24 Oct 2017 12:54:46 -0700 Message-Id: <20171024195451.30535-3-opendmb@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171024195451.30535-1-opendmb@gmail.com> References: <20171024195451.30535-1-opendmb@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171024_125602_141316_A9CF708A X-CRM114-Status: GOOD ( 14.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Fainelli , Linus Walleij , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Doug Berger , bcm-kernel-feedback-list@broadcom.com, Brian Norris , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This commit allows a wakeup parent interrupt to be shared between instances. It also removes the redundant can_wake member of the private data structure by using whether the parent_wake_irq has been defined to indicate that the GPIO device can wake. Fixes: 19a7b6940b78 ("gpio: brcmstb: Add interrupt and wakeup source support") Signed-off-by: Doug Berger Reviewed-by: Florian Fainelli Acked-by: Gregory Fong --- drivers/gpio/gpio-brcmstb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c index 9b8fcca7ad17..2031b73e066c 100644 --- a/drivers/gpio/gpio-brcmstb.c +++ b/drivers/gpio/gpio-brcmstb.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Broadcom Corporation + * Copyright (C) 2015-2017 Broadcom * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -47,7 +47,6 @@ struct brcmstb_gpio_priv { struct platform_device *pdev; int parent_irq; int gpio_base; - bool can_wake; int parent_wake_irq; struct notifier_block reboot_notifier; }; @@ -349,10 +348,11 @@ static int brcmstb_gpio_irq_setup(struct platform_device *pdev, /* Ensures that all non-wakeup IRQs are disabled at suspend */ bank->irq_chip.flags = IRQCHIP_MASK_ON_SUSPEND; - if (IS_ENABLED(CONFIG_PM_SLEEP) && !priv->can_wake && + if (IS_ENABLED(CONFIG_PM_SLEEP) && !priv->parent_wake_irq && of_property_read_bool(np, "wakeup-source")) { priv->parent_wake_irq = platform_get_irq(pdev, 1); if (priv->parent_wake_irq < 0) { + priv->parent_wake_irq = 0; dev_warn(dev, "Couldn't get wake IRQ - GPIOs will not be able to wake from sleep"); } else { @@ -364,8 +364,9 @@ static int brcmstb_gpio_irq_setup(struct platform_device *pdev, device_set_wakeup_capable(dev, true); device_wakeup_enable(dev); err = devm_request_irq(dev, priv->parent_wake_irq, - brcmstb_gpio_wake_irq_handler, 0, - "brcmstb-gpio-wake", priv); + brcmstb_gpio_wake_irq_handler, + IRQF_SHARED, + "brcmstb-gpio-wake", priv); if (err < 0) { dev_err(dev, "Couldn't request wake IRQ"); @@ -375,11 +376,10 @@ static int brcmstb_gpio_irq_setup(struct platform_device *pdev, priv->reboot_notifier.notifier_call = brcmstb_gpio_reboot; register_reboot_notifier(&priv->reboot_notifier); - priv->can_wake = true; } } - if (priv->can_wake) + if (priv->parent_wake_irq) bank->irq_chip.irq_set_wake = brcmstb_gpio_irq_set_wake; err = gpiochip_irqchip_add(&bank->gc, &bank->irq_chip, 0,