From patchwork Fri Jun 23 13:03:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffy Chen X-Patchwork-Id: 9806523 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 DFC3A60329 for ; Fri, 23 Jun 2017 13:05:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE378285FB for ; Fri, 23 Jun 2017 13:05:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1E0B2875F; Fri, 23 Jun 2017 13:05:51 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID 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 4D7F3285FB for ; Fri, 23 Jun 2017 13:05:51 +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: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:In-Reply-To: References:List-Owner; bh=w8ZJHRbL0DVQTBY63TkcNjpGEsgO43WeqNhDuITnARU=; b=PRt pdWb3baWYAUtlZAIOvG+ZG4WDIdIElcc2l/+CxQyIPwnD01pgD5bIBtvLSUGIZOY03LloPkJ3KgWb 1t7RHbM/L5uQohM4b72RAHN5oM5BIka4XovFA/FhzjSyMhabz17lfn9TtHuDjM0OoMca5+4EVYoTa d6d30p6n6Vz6sZxTbt+QRRhHPiG1dsPULc0n98XITsjYkO5VFlyIaGPBbiXipbSxotHjFro8FSh44 BI0QiZHnoQj5e6ETos7qkHdKjDJ7/3Fx6qM4IJc/BqVz8djiILPJ9vb+PTnqbvUqxI0rsSIRmeFSz 9tdfchAExH/XaQz0ylLWfKIxGKDG3AQ==; 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 1dOOHV-00085O-F9; Fri, 23 Jun 2017 13:05:49 +0000 Received: from regular1.263xmail.com ([211.150.99.132]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dOOFx-0005CP-SE; Fri, 23 Jun 2017 13:04:16 +0000 Received: from jeffy.chen?rock-chips.com (unknown [192.168.167.83]) by regular1.263xmail.com (Postfix) with ESMTP id 23FFB93CD; Fri, 23 Jun 2017 21:03:42 +0800 (CST) X-263anti-spam: X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ABS-CHECKED: 4 Received: from localhost (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id 65649323; Fri, 23 Jun 2017 21:03:39 +0800 (CST) X-RL-SENDER: jeffy.chen@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jeffy.chen@rock-chips.com X-UNIQUE-TAG: <357224104010de80d2a06233f081f12d> X-ATTACHMENT-NUM: 0 X-SENDER: cjf@rock-chips.com X-DNS-TYPE: 0 Received: from localhost (unknown [103.29.142.67]) by smtp.263.net (Postfix) whith ESMTP id 286145TM881; Fri, 23 Jun 2017 21:03:43 +0800 (CST) From: Jeffy Chen To: linux-kernel@vger.kernel.org Subject: [RFC PATCH] pinctrl: rockchip: add irq_shutdown Date: Fri, 23 Jun 2017 21:03:39 +0800 Message-Id: <1498223019-9123-1-git-send-email-jeffy.chen@rock-chips.com> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170623_060414_319902_3A2A180D X-CRM114-Status: UNSURE ( 5.91 ) X-CRM114-Notice: Please train this message. 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: briannorris@chromium.org, heiko@sntech.de, linux-gpio@vger.kernel.org, Linus Walleij , Jeffy Chen , dianders@chromium.org, tfiga@chromium.org, linux-rockchip@lists.infradead.org, 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 Currently the rockchip pinctrl driver would try to enable/disable the gpio bank clk when enable/disable an irq. So when the irq core trying to shutdown an already disabled irq, it would result in unbalanced clk disable request: [ 35.911955] WARNING: at drivers/clk/clk.c:680 ... [ 37.272271] Call trace: [ 37.274729] [] clk_core_disable+0x28/0x194 [ 37.280395] [] clk_disable+0x34/0x48 [ 37.285544] [] rockchip_irq_disable+0x30/0x3c [ 37.291472] [] __irq_disable+0x40/0x64 [ 37.296791] [] irq_shutdown+0x68/0x8c [ 37.302023] [] __free_irq+0x110/0x218 [ 37.307254] [] free_irq+0x54/0x64 [ 37.312138] [] devm_irq_release+0x24/0x30 Add an irq_shutdown callback, and do a sanity check for irq state to prevent that. Signed-off-by: Jeffy Chen --- drivers/pinctrl/pinctrl-rockchip.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 607f52c..b0e3130 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -2551,6 +2551,12 @@ static void rockchip_irq_disable(struct irq_data *d) clk_disable(bank->clk); } +static void rockchip_irq_shutdown(struct irq_data *d) +{ + if (!irqd_irq_disabled(d)) + rockchip_irq_disable(d); +} + static void rockchip_irq_bus_lock(struct irq_data *d) { struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); @@ -2641,6 +2647,7 @@ static int rockchip_interrupts_register(struct platform_device *pdev, gc->chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit; gc->chip_types[0].chip.irq_enable = rockchip_irq_enable; gc->chip_types[0].chip.irq_disable = rockchip_irq_disable; + gc->chip_types[0].chip.irq_shutdown = rockchip_irq_shutdown; gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake; gc->chip_types[0].chip.irq_suspend = rockchip_irq_suspend; gc->chip_types[0].chip.irq_resume = rockchip_irq_resume;