From patchwork Mon Mar 3 19:51:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 3757171 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6EB5FBF13A for ; Mon, 3 Mar 2014 19:54:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98A442041A for ; Mon, 3 Mar 2014 19:54:36 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ABE8F20412 for ; Mon, 3 Mar 2014 19:54:35 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKYv5-0002UV-M8; Mon, 03 Mar 2014 19:53:00 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKYum-0003Ov-NB; Mon, 03 Mar 2014 19:52:40 +0000 Received: from avon.wwwdotorg.org ([70.85.31.133]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKYuO-0003KJ-OQ for linux-arm-kernel@lists.infradead.org; Mon, 03 Mar 2014 19:52:18 +0000 Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id 8D6326413; Mon, 3 Mar 2014 12:51:57 -0700 (MST) Received: from swarren-lx1.nvidia.com (localhost [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id 73BCBE40E6; Mon, 3 Mar 2014 12:51:55 -0700 (MST) From: Stephen Warren To: Thomas Gleixner , Samuel Ortiz , Lee Jones , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala Subject: [PATCH V3 4/5] mfd: palmas: support IRQ inversion at the board level Date: Mon, 3 Mar 2014 12:51:39 -0700 Message-Id: <1393876300-3061-4-git-send-email-swarren@wwwdotorg.org> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1393876300-3061-1-git-send-email-swarren@wwwdotorg.org> References: <1393876300-3061-1-git-send-email-swarren@wwwdotorg.org> X-NVConfidentiality: public X-Virus-Scanned: clamav-milter 0.97.8 at avon.wwwdotorg.org X-Virus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140303_145217_018592_F4DF7B89 X-CRM114-Status: GOOD ( 12.52 ) X-Spam-Score: 1.1 (+) Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, Stephen Warren , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Stephen Warren Implement the new DT property ti,irq-externally-inverted, and add an equivalent platform data field to match. This allows the driver to correctly automatically configure the IRQ output polarity when the board or SoC contains an inverter between the Palmas IRQ output and IRQ controller input. Signed-off-by: Stephen Warren Acked-by: Lee Jones --- v3: * Use an IRQD flag to represent the data, rather than a custom DT property. v2: * Split V1's patch 1/2 into separate patches 1/3 and 2/3. --- drivers/mfd/palmas.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c index d280d789e55a..3281d4103e9d 100644 --- a/drivers/mfd/palmas.c +++ b/drivers/mfd/palmas.c @@ -292,7 +292,8 @@ static int palmas_set_pdata_irq_flag(struct i2c_client *i2c, return -EINVAL; } - pdata->irq_flags = irqd_get_trigger_type(irq_data); + pdata->irq_flags = irqd_get_trigger_type(irq_data) | + irqd_get_src_dst_inverted(irq_data); dev_info(&i2c->dev, "Irq flag is 0x%08x\n", pdata->irq_flags); return 0; } @@ -447,6 +448,8 @@ static int palmas_i2c_probe(struct i2c_client *i2c, reg = PALMAS_POLARITY_CTRL_INT_POLARITY; else reg = 0; + if (pdata->irq_flags & IRQ_SRC_DST_INVERTED) + reg ^= PALMAS_POLARITY_CTRL_INT_POLARITY; ret = palmas_update_bits(palmas, PALMAS_PU_PD_OD_BASE, PALMAS_POLARITY_CTRL, PALMAS_POLARITY_CTRL_INT_POLARITY, reg);