From patchwork Tue Apr 25 18:40:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Greer X-Patchwork-Id: 9699381 X-Patchwork-Delegate: sameo@linux.intel.com 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 9042F601D3 for ; Tue, 25 Apr 2017 18:40:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EC1D284DA for ; Tue, 25 Apr 2017 18:40:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 721562857D; Tue, 25 Apr 2017 18:40:52 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20E72284DA for ; Tue, 25 Apr 2017 18:40:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1947101AbdDYSku (ORCPT ); Tue, 25 Apr 2017 14:40:50 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:35003 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1176738AbdDYSko (ORCPT ); Tue, 25 Apr 2017 14:40:44 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 2D1B521B1E; Tue, 25 Apr 2017 14:40:43 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute3.internal (MEProxy); Tue, 25 Apr 2017 14:40:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=animalcreek.com; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=5M4 u8jCPxa4TKD1nPrl7P6sqkVpFO2OUDnsnu7/8lqo=; b=TbzXjTcpT0qm91uw/MT dEo0orR8WV5Ok4qieFM+/eMRhlqhfljtY5yN53Q+R6vxu9KtK2lDDcwdeSy8Hr5k vE7I3LLCezmdwFcFjopIGORfvSYjE6yxVV8uI9v9bJvZqArQgklMqlMjbm2RSKD6 W0ULsg9Sh5kwU2QUNTWbD7ak= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=5M4u8jCPxa4TKD1nPrl7P6sqkVpFO2OUDnsnu7/8l qo=; b=b1ZfE5E9R6VrEc5OAwxYZMs9iNJAWyZoLRrIOInUC/UUuSr+RCv8i7JuI Vg5nRHt0rP+WswMHB9sEGts6twjvf942FnEJd3kf9qrnps6QFJzJRNrJWJ9i8ko/ MUFPpYdr60QPnCH5s0d5l+FOxGv3BjLnxoLUySEDos7qL4uaXwLZOvK5/I+im1Uo mvuB6xIiNfrU3rlzJjfr7IS0GidPLXsFLtAppMC32q2UrWoUYVdqiHwZ4oKfnVK4 G+zDqGtWX/i9nwop1OP0j0XqpT9C1XQjkic32uBH6uDcYa8ZyZotqDxJux2YJ9Qx mr2erJzB76b7zW/j3d3Pz/eN3OGFg== X-ME-Sender: X-Sasl-enc: mbY02LbzF94abHBg+Gfsabbui8b0C3Hv1U3axXDGk0Y4 1493145642 Received: from blue.animalcreek.com (ip68-2-86-89.ph.ph.cox.net [68.2.86.89]) by mail.messagingengine.com (Postfix) with ESMTPA id DC55624774; Tue, 25 Apr 2017 14:40:42 -0400 (EDT) Received: from blue.animalcreek.com (localhost [127.0.0.1]) by blue.animalcreek.com (Postfix) with ESMTP id 372A4A222E2; Tue, 25 Apr 2017 11:40:42 -0700 (MST) From: Mark Greer To: Samuel Ortiz Cc: linux-wireless@vger.kernel.org, linux-nfc@lists.01.org, devicetree@vger.kernel.org, Mark Greer Subject: [PATCH v4 2/9] NFC: trf7970a: Don't de-assert EN2 unless it was asserted Date: Tue, 25 Apr 2017 11:40:29 -0700 Message-Id: <20170425184036.1212-3-mgreer@animalcreek.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170425184036.1212-1-mgreer@animalcreek.com> References: <20170425184036.1212-1-mgreer@animalcreek.com> Organization: Animal Creek Technologies, Inc. Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the trf7970a part has the bug related to 'en2-rf-quirk', the GPIO connected to the EN2 pin will not be asserted by the driver when powering up so it shouldn't be de-asserted when powering down. Signed-off-by: Mark Greer --- Note: I would rather use a single 'if' statement with '&&' but I did it this way to match what is in the trf7970a_power_up() routine. Either way, it is overwritten by a patch later in this series. drivers/nfc/trf7970a.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c index 2d1c8ca6e679..1a87525a88cd 100644 --- a/drivers/nfc/trf7970a.c +++ b/drivers/nfc/trf7970a.c @@ -1940,8 +1940,10 @@ static int trf7970a_power_down(struct trf7970a *trf) } gpio_set_value(trf->en_gpio, 0); - if (gpio_is_valid(trf->en2_gpio)) - gpio_set_value(trf->en2_gpio, 0); + + if (!(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW)) + if (gpio_is_valid(trf->en2_gpio)) + gpio_set_value(trf->en2_gpio, 0); ret = regulator_disable(trf->regulator); if (ret)