From patchwork Tue Nov 21 08:21:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Reid X-Patchwork-Id: 839919 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3ygz8617lmz9s7B for ; Tue, 21 Nov 2017 19:21:42 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751309AbdKUIVj (ORCPT ); Tue, 21 Nov 2017 03:21:39 -0500 Received: from anchovy2.45ru.net.au ([203.30.46.146]:53013 "EHLO anchovy.45ru.net.au" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751330AbdKUIVh (ORCPT ); Tue, 21 Nov 2017 03:21:37 -0500 Received: (qmail 31012 invoked by uid 5089); 21 Nov 2017 08:21:35 -0000 Received: by simscan 1.2.0 ppid: 30924, pid: 30926, t: 0.0307s scanners: regex: 1.2.0 attach: 1.2.0 clamav: 0.88.3/m:40/d:1950 X-RBL: $rbltext Received: from unknown (HELO preid-centos7.electromag.com.au) (preid@electromag.com.au@203.59.230.133) by anchovy3.45ru.net.au with ESMTPA; 21 Nov 2017 08:21:34 -0000 Received: by preid-centos7.electromag.com.au (Postfix, from userid 1000) id 84DD4337B284F; Tue, 21 Nov 2017 16:21:33 +0800 (AWST) From: Phil Reid To: linus.walleij@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, sre@kernel.org, preid@electromag.com.au, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v3 1/5] pinctrl: mcp23s08: remove hard coded irq polarity in irq_setup Date: Tue, 21 Nov 2017 16:21:27 +0800 Message-Id: <1511252491-79952-2-git-send-email-preid@electromag.com.au> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1511252491-79952-1-git-send-email-preid@electromag.com.au> References: <1511252491-79952-1-git-send-email-preid@electromag.com.au> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The polarity of the irq should be defined in the configuration for the irq. eg The device tree bind already allows for either active high / low interrupt configuration. Signed-off-by: Phil Reid --- drivers/pinctrl/pinctrl-mcp23s08.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c index 0aef30e..cc1f9f6 100644 --- a/drivers/pinctrl/pinctrl-mcp23s08.c +++ b/drivers/pinctrl/pinctrl-mcp23s08.c @@ -56,7 +56,6 @@ struct mcp23s08 { u8 addr; - bool irq_active_high; bool reg_shift; u16 irq_rise; @@ -627,11 +626,6 @@ static int mcp23s08_irq_setup(struct mcp23s08 *mcp) int err; unsigned long irqflags = IRQF_ONESHOT | IRQF_SHARED; - if (mcp->irq_active_high) - irqflags |= IRQF_TRIGGER_HIGH; - else - irqflags |= IRQF_TRIGGER_LOW; - err = devm_request_threaded_irq(chip->parent, mcp->irq, NULL, mcp23s08_irq, irqflags, dev_name(chip->parent), mcp); @@ -777,12 +771,12 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, { int status, ret; bool mirror = false; + bool irq_active_high = false; mutex_init(&mcp->lock); mcp->dev = dev; mcp->addr = addr; - mcp->irq_active_high = false; mcp->chip.direction_input = mcp23s08_direction_input; mcp->chip.get = mcp23s08_get; @@ -868,7 +862,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, mcp->irq_controller = device_property_read_bool(dev, "interrupt-controller"); if (mcp->irq && mcp->irq_controller) { - mcp->irq_active_high = + irq_active_high = device_property_read_bool(dev, "microchip,irq-active-high"); @@ -876,11 +870,11 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, } if ((status & IOCON_SEQOP) || !(status & IOCON_HAEN) || mirror || - mcp->irq_active_high) { + irq_active_high) { /* mcp23s17 has IOCON twice, make sure they are in sync */ status &= ~(IOCON_SEQOP | (IOCON_SEQOP << 8)); status |= IOCON_HAEN | (IOCON_HAEN << 8); - if (mcp->irq_active_high) + if (irq_active_high) status |= IOCON_INTPOL | (IOCON_INTPOL << 8); else status &= ~(IOCON_INTPOL | (IOCON_INTPOL << 8));