From patchwork Sat Sep 30 03:40:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Berger X-Patchwork-Id: 9979087 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 B4DF56037F for ; Sat, 30 Sep 2017 03:42:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5145298D6 for ; Sat, 30 Sep 2017 03:42:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A1A9298D9; Sat, 30 Sep 2017 03:42:37 +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 0E84B298D6 for ; Sat, 30 Sep 2017 03:42:36 +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=KxcUT4FyIEzgKY6PEwAf2Q4hInom0yxjrjRxz1SUzJY=; b=u3OVu2LxoJpfGmwTfAG9E4hoHv 5fhm6OnKRfA38QWxwgRbWCH3uKUD6saErNUFFmue1QLW53uh5u3YDdMnr3InjeNGIOFIGp/SNQ5nK XK3sJTPXBo4JHlG5h6sBTHJmC4vTohcA1u0h4Ob+BMgUAFN4fGdwgoLMOOs2/F1eHta2rxVi042ks Jw74jidjZ/JenrK0eHhpTUB5oKWhqKkQBlHnBrk9YItxZlkDa9axVbYbO1dkYBMppdA2zzBJG2sVJ Ss0ku3jGBnE0ANDFZZyW8KkuKVL2TZ4CdxM/mL2BPL8jisYpr9mgjQpSfPtxQt/OxqvAmJ0uiUfcV NKTrTrLA==; 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 1dy8fb-0005rO-TP; Sat, 30 Sep 2017 03:42:27 +0000 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dy8fF-0005J2-Un for linux-arm-kernel@lists.infradead.org; Sat, 30 Sep 2017 03:42:08 +0000 Received: by mail-qk0-x242.google.com with SMTP id o77so946611qke.2 for ; Fri, 29 Sep 2017 20:41:46 -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=Hg4655dg7RZUabjCTFaoTWSXfd8gQkx/bcH+7CAGnZo=; b=TiOc/dBuSLqwtTh8U3l+0ac30IGnSp/kwOSnikBYhwVNpNUFwOGLICO20EougXnCGG ar+W9BkdkgYAZtYrP1qPVfVo5GEQToRTgsQuTRy2tSNL6KOytHF+ZeEcSKaqMZsAwYt5 y/9RrkZ9O31q+1sWEuaE6ovRSUX32k+gdENQkgZ0HwyDZw7lpsqRBtLHrPgqBU5speIm wP04HbGS8CIRoQHno5LeCMy2ZYnqPRVlGdlkDPG/CQICHBGi4z8SD+8sl5YOBNQKQBBP N9V+ZkfZ8w8LLcrLidA4tbd26yIlDk4pUWBNsWOcw8xj8hZ61LEelQOFQEab9MiLxbOy 0UWQ== 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=Hg4655dg7RZUabjCTFaoTWSXfd8gQkx/bcH+7CAGnZo=; b=bNnbacUG+h1uGBxphnBaZW8OsQjYtAMTYEntsbZmnum5bwjMiJOVhgMlgJdWR5ZjQb pQRrLvV2jp5x7s0zf3BU2Xr+cA0OqtgUhDeB8wDusl7hRWouosQb+LO3jekszt2crMHp YjresZEOS85oTkV2G1PviMeR/A5u4DrKN/cvUzWgOhTD0Ml7JSjZA0SX03pqJymRsuBN FygIXypkhWWYLS9oagcwZtvUphcXJDG7sJu+OSask4AsAfCPJCtpIiz1fhpGWuxlSAaa tfgZ8beoTxlbviKGQyMSUcp39xtv4lcIGI40/wzDgSt+0LuSJQyeeMKZgLhGxm+xKxGc aY8w== X-Gm-Message-State: AMCzsaWHDdenjtr0JC4T5395izU1v5fijSi/c31bmLnyv/B2AaOYwnzl YPx98XykPbZ5ClzaopVLVZ0= X-Google-Smtp-Source: AOwi7QDGNbR1h6IZplJmi9qZiy/dF5p0s6K4dINy9DLi0Wa9CpESTEi7DObDagXwQrT8Df/nG95qbQ== X-Received: by 10.55.42.73 with SMTP id q70mr6111169qkh.337.1506742905422; Fri, 29 Sep 2017 20:41:45 -0700 (PDT) Received: from stb-bld-02.irv.broadcom.com ([192.19.255.250]) by smtp.gmail.com with ESMTPSA id 4sm3574693qke.50.2017.09.29.20.41.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Sep 2017 20:41:45 -0700 (PDT) From: Doug Berger To: Gregory Fong Subject: [PATCH 1/7] gpio: brcmstb: allow all instances to be wakeup sources Date: Fri, 29 Sep 2017 20:40:51 -0700 Message-Id: <20170930034057.15166-2-opendmb@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170930034057.15166-1-opendmb@gmail.com> References: <20170930034057.15166-1-opendmb@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170929_204206_108088_D6068D93 X-CRM114-Status: GOOD ( 13.75 ) 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 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 27e92e57adae..7f39b160a4d5 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 @@ -46,7 +46,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,