From patchwork Tue Nov 21 08:21:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Reid X-Patchwork-Id: 839926 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 3ygz8C2Gxfz9s7B for ; Tue, 21 Nov 2017 19:21:47 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751409AbdKUIVo (ORCPT ); Tue, 21 Nov 2017 03:21:44 -0500 Received: from anchovy3.45ru.net.au ([203.30.46.155]:33047 "EHLO anchovy.45ru.net.au" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751462AbdKUIVh (ORCPT ); Tue, 21 Nov 2017 03:21:37 -0500 Received: (qmail 21340 invoked by uid 5089); 21 Nov 2017 08:21:35 -0000 Received: by simscan 1.2.0 ppid: 21276, pid: 21278, t: 0.0273s 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 anchovy2.45ru.net.au with ESMTPA; 21 Nov 2017 08:21:34 -0000 Received: by preid-centos7.electromag.com.au (Postfix, from userid 1000) id 8EF54337B336E; 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 4/5] pinctrl: mcp23s08: configure irq polarity using irq data Date: Tue, 21 Nov 2017 16:21:30 +0800 Message-Id: <1511252491-79952-5-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 irq polarity is already encoded in the irq config. Use that to determine the polarity for the mcp32s08 irq output instead of the custom microchip,irq-active-high property. Signed-off-by: Phil Reid --- drivers/pinctrl/pinctrl-mcp23s08.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c index 8ff9b77..6b3f810 100644 --- a/drivers/pinctrl/pinctrl-mcp23s08.c +++ b/drivers/pinctrl/pinctrl-mcp23s08.c @@ -773,6 +773,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, bool mirror = false; bool irq_active_high = false; bool open_drain = false; + u32 irq_trig; mutex_init(&mcp->lock); @@ -863,9 +864,13 @@ 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) { - irq_active_high = - device_property_read_bool(dev, - "microchip,irq-active-high"); + if (device_property_present(dev, "microchip,irq-active-high")) + dev_warn(dev, + "microchip,irq-active-high is deprecated\n"); + + irq_trig = irqd_get_trigger_type(irq_get_irq_data(mcp->irq)); + if (irq_trig == IRQF_TRIGGER_HIGH) + irq_active_high = true; mirror = device_property_read_bool(dev, "microchip,irq-mirror"); open_drain = device_property_read_bool(dev, "drive-open-drain");