Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4576100imu; Sat, 19 Jan 2019 12:47:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN6KronCpt/5DRCxgN/zZeSmN88amx44mUDFfnEQgL2fnuUk7DFkGerPyaZpeZRDDzBPSrmf X-Received: by 2002:a63:e302:: with SMTP id f2mr22887841pgh.320.1547930862874; Sat, 19 Jan 2019 12:47:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547930862; cv=none; d=google.com; s=arc-20160816; b=Q/djG+QdA1vb2jlaaI9T6P87biuSafSZ3IvgmLm46uzVSa5l+eJmuAygy7szdD/qat n3XDaDWwx/81/X3i2yspq2S4cIiD56asFcvS5xn5twdHAt1ujNS2qSZmGP4IEerbSPcI 5odOkJVJCP1yiwW4NLISvIEmbb8dON3j7FXEaPyUZGw3D4GlX3FlA0tStRlMSTFUeyTp R9NsP9gYvJFZod00Hxhl/QyebVmVaN8oHjiuVtLF2hy80SAB8jOVCx75Go3tL/4CyZ9Y TNpM1pcvfwnhjddDHMCdfKe4mp79cF7as8Mu0alCx2RktohBlmya5u26tKt1da1DD9BD CW/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=BSdU0FfySGEAF0WqYz9pjBYrl24c7hi7xrHM0FGpLBA=; b=YQ+fD24sWnGJgLND8Euzj4xUNVjrvKhVLAb/lbfGW+hR4EUlCQIsoMpESunWj8tKCh EF0ifzSLUzGFqmdkFfpAtTYG8wucSN1ZHF+c/xgltljKTla4yaD2C4sdz0HRggQLX4Gb eIY5oZlATi2Y8foW3j8tHyPILSmBBA5+XJBw9WDkkA2hyDVUyU+R2XzaXiO7y53+0bb7 wRYqEiBp5+L3ohSJYuiq7RW/wL+ejuJJcvgL6JGsNuQxVlcW7SVjqFDu37K9FZdNG8j9 mWoOJEk/PC13tvCtth/Y+AOuQEfTEJFPQsbBiTDsLPpOTAu1x5L+eXOj+lAS1+0EPpE6 Uk4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@onstation.org header.s=default header.b=B9q1DMrn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 i1si8365792pgi.480.2019.01.19.12.47.00; Sat, 19 Jan 2019 12:47:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@onstation.org header.s=default header.b=B9q1DMrn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730112AbfASUon (ORCPT + 99 others); Sat, 19 Jan 2019 15:44:43 -0500 Received: from onstation.org ([52.200.56.107]:35178 "EHLO onstation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729427AbfASUne (ORCPT ); Sat, 19 Jan 2019 15:43:34 -0500 Received: from localhost.localdomain (c-98-239-145-235.hsd1.wv.comcast.net [98.239.145.235]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: masneyb) by onstation.org (Postfix) with ESMTPSA id 7CE0035F; Sat, 19 Jan 2019 20:43:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=onstation.org; s=default; t=1547930614; bh=AxGdMVw+9dm8YxUPnUKVwGnMOxAF2TlqG+sCG3Bo3lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B9q1DMrnoowjgN/gm3X2+j3bHc6IQ1fZXhKj773rSnCZ/hXzXACRCPWM4IQnGgln/ xxRl3Y9MX9v7kGe74vY/m6S/DeKP8linFNiseAVeQM8QY3Cdf/d2hqg9nsr7T4rQQe Mv2VyuCcn/dgXbWSWpB8i025Ga6bT3w/TONyxrJw= From: Brian Masney To: linus.walleij@linaro.org, sboyd@kernel.org, bjorn.andersson@linaro.org, andy.gross@linaro.org, marc.zyngier@arm.com Cc: shawnguo@kernel.org, dianders@chromium.org, linux-gpio@vger.kernel.org, nicolas.dechesne@linaro.org, niklas.cassel@linaro.org, david.brown@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, thierry.reding@gmail.com, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v6 06/15] spmi: pmic-arb: disassociate old virq if hwirq mapping already exists Date: Sat, 19 Jan 2019 15:42:43 -0500 Message-Id: <20190119204252.18370-7-masneyb@onstation.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190119204252.18370-1-masneyb@onstation.org> References: <20190119204252.18370-1-masneyb@onstation.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Check to see if the hwirq is already associated with another virq on this IRQ domain. If so, then disassociate it before associating the hwirq with the new virq. This is a temporary hack that is needed in order to not break git bisect for existing boards. The next patch in this series converts spmi-gpio to be a hierarchical IRQ chip, then there are several patches to update all of the device tree files, and finally this patch will be reverted within the same patch series. IRQs for spmi-gpio are all initially setup without an IRQ hierarchy on pmic-arb when mfd/qcom-spmi-pmic.c is probed (via the devm_of_platform_populate call) due to the interrupts property in device tree. Once spmi-gpio is converted to be a hierarchical IRQ chip in the next patch, existing users of gpio[d]_to_irq() will call pmic_gpio_to_irq(), and that will use the new IRQ chip code in spmi-gpio that sets up the IRQ in an IRQ hierarchy. The hwirq is now associated with two Linux virqs and interrupts will not work as expected. This patch corrects that issue. Driver was tested using gpio-keys and iadc/vadc on the LG Nexus 5 (hammerhead) phone. Signed-off-by: Brian Masney Reviewed-by: Stephen Boyd Acked-by: Bjorn Andersson --- Changes since v5: - None Changes since v4: - None Patch introduced in v4. drivers/spmi/spmi-pmic-arb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 928759242e42..bc7dc1d6e4b2 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -745,10 +745,15 @@ static void qpnpint_irq_domain_map(struct spmi_pmic_arb *pmic_arb, irq_hw_number_t hwirq, unsigned int type) { irq_flow_handler_t handler; + unsigned int old_virq; dev_dbg(&pmic_arb->spmic->dev, "virq = %u, hwirq = %lu, type = %u\n", virq, hwirq, type); + old_virq = irq_find_mapping(domain, hwirq); + if (old_virq) + irq_domain_disassociate(domain, old_virq); + if (type & IRQ_TYPE_EDGE_BOTH) handler = handle_edge_irq; else -- 2.17.2