From patchwork Sun Jun 5 00:17:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 9155041 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 6C16B60221 for ; Sun, 5 Jun 2016 00:19:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DF2227C8F for ; Sun, 5 Jun 2016 00:19:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5254C28327; Sun, 5 Jun 2016 00:19:15 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D5FED27C8F for ; Sun, 5 Jun 2016 00:19:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b9Lmc-00035Y-1C; Sun, 05 Jun 2016 00:19:14 +0000 Received: from mail.kmu-office.ch ([178.209.48.109]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b9LmC-0002gJ-Sc; Sun, 05 Jun 2016 00:18:49 +0000 Received: from trochilidae.toradex.int (unknown [IPv6:2601:602:8f02:dcfc:3e97:eff:fe92:db3b]) by mail.kmu-office.ch (Postfix) with ESMTPSA id A92915C1824; Sun, 5 Jun 2016 02:15:31 +0200 (CEST) From: Stefan Agner To: lee.jones@linaro.org, lgirdwood@gmail.com, broonie@kernel.org, khilman@baylibre.com, carlo@caione.org Subject: [PATCH 4/5] mfd: rn5t618: register power off callback optionally Date: Sat, 4 Jun 2016 17:17:48 -0700 Message-Id: <20160605001749.4062-6-stefan@agner.ch> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20160605001749.4062-1-stefan@agner.ch> References: <20160605001749.4062-1-stefan@agner.ch> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1465085735; bh=tGAoIiphwwisXMBwC7a+J8f2gJkwngxHYcjNctR1+VA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=tyS0kyxfDOSZEjAq5sJ1GazgEHOtZJvKc7968cHCEPElh0Qjw2PzFxESZQh4WlRYugt8CFtmhPDm5yo3Vw/8sfb4WgzyXjWIa3PUX7zUXu5eh5uVtdL08grBlv5WeSMiUkiQryPLHCnmvgnxg+/hh+q34cPn41wJFTCOgqP7lSI= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160604_171849_226281_F20202FD X-CRM114-Status: UNSURE ( 8.61 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, pawel.moll@arm.com, ijc+devicetree@hellion.org.uk, max.oss.09@gmail.com, linux@armlinux.org.uk, Stefan Agner , linux-kernel@vger.kernel.org, b.galvani@gmail.com, robh+dt@kernel.org, marcel@ziswiler.com, galak@codeaurora.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Only register power off if the PMIC is defined as system power controller (see Documentation/devicetree/bindings/power/ power-controller.txt). Signed-off-by: Stefan Agner --- drivers/mfd/rn5t618.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/mfd/rn5t618.c b/drivers/mfd/rn5t618.c index 7607ced..d9b4d40 100644 --- a/drivers/mfd/rn5t618.c +++ b/drivers/mfd/rn5t618.c @@ -103,9 +103,13 @@ static int rn5t618_i2c_probe(struct i2c_client *i2c, return ret; } - if (!pm_power_off) { - rn5t618_pm_power_off = priv; - pm_power_off = rn5t618_power_off; + if (of_device_is_system_power_controller(i2c->dev.of_node)) { + if (!pm_power_off) { + rn5t618_pm_power_off = priv; + pm_power_off = rn5t618_power_off; + } else { + dev_err(&i2c->dev, "Failed to set poweroff capability, already defined\n"); + } } return 0;