From patchwork Tue Oct 7 19:45:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 5048841 Return-Path: X-Original-To: patchwork-linux-omap@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 A6B97C11AB for ; Tue, 7 Oct 2014 19:43:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF2D12022A for ; Tue, 7 Oct 2014 19:43:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CE0FB2021F for ; Tue, 7 Oct 2014 19:43:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755181AbaJGTmQ (ORCPT ); Tue, 7 Oct 2014 15:42:16 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:46026 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754941AbaJGTmP (ORCPT ); Tue, 7 Oct 2014 15:42:15 -0400 Received: by mail-wi0-f177.google.com with SMTP id fb4so9030913wid.10 for ; Tue, 07 Oct 2014 12:42:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=mwPkPTRSLXFklcZsg8444EgiMc9k8pjq2IxVT4/JnG4=; b=aH7WGI5wHEL3McNt5Vc4jS2ddgInt1qVVEkrIc7RiOkISVcxmD7T5P9peLLGjq6BrO EUfCcOMcxMD12Zc7v3haBXW+4ECOqj/Y+CLXchq3whOlsTgMOZKp0CM5NeovZE+OqTih W2a78dwTshBj7dPOkeVzsPolsJyU/Fbcz/VDZFAPVHrPiVj/oEjZK0WQX80Hz+dSOH1V x1/E47842RAWh0hfnE28gs215vdIGlR4uxD6VqgXyZtPHsn2OaGxQcHGJZNlTHQm4Jzf 9d83CodoFAV/vEA/sndnxGmH2XXFSvbVFTozcttiUZeV38S+mRF+hHtbzJHMQBUzVqCy zJrA== X-Received: by 10.181.27.197 with SMTP id ji5mr30633941wid.54.1412710933480; Tue, 07 Oct 2014 12:42:13 -0700 (PDT) Received: from localhost.localdomain (AToulouse-554-1-19-116.w92-149.abo.wanadoo.fr. [92.149.98.116]) by mx.google.com with ESMTPSA id wk5sm21970337wjb.12.2014.10.07.12.42.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Oct 2014 12:42:12 -0700 (PDT) From: Romain Perier To: devicetree@vger.kernel.org Cc: broonie@kernel.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, heiko@sntech.de, sameo@linux.intel.com, lee.jones@linaro.org, grant.likely@linaro.org, robh@kernel.org, sre@kernel.org, dbaryshkov@gmail.com, dwmw2@infradead.org, anton@enomsg.org, ldewangan@nvidia.com, linux-omap@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [RFC PATCH v2 1/4] regulator: Add helper function to get "poweroff-source" property Date: Tue, 7 Oct 2014 19:45:01 +0000 Message-Id: <1412711104-15902-1-git-send-email-romain.perier@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Several drivers create their own devicetree property when they register poweroff capabilities. This is for example the case for mfd, regulator or power drivers which define "vendor,system-power-controller" property. This patch adds support for a standard property "poweroff-source" which marks the device as able to shutdown the system. Signed-off-by: Romain Perier --- drivers/regulator/of_regulator.c | 12 ++++++++++++ include/linux/regulator/of_regulator.h | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 7a51814..8b898e6 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -240,3 +240,15 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev, return init_data; } + +/** + * is_system_poweroff_source - Tells if poweroff-source is found for device_node + * @np: Pointer to the given device_node + * + * return true if present false otherwise + */ +bool is_system_poweroff_source(const struct device_node *np) +{ + return of_property_read_bool(np, "poweroff-source"); +} +EXPORT_SYMBOL_GPL(is_system_poweroff_source); diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h index f921796..9d8fbb2 100644 --- a/include/linux/regulator/of_regulator.h +++ b/include/linux/regulator/of_regulator.h @@ -20,6 +20,7 @@ extern struct regulator_init_data extern int of_regulator_match(struct device *dev, struct device_node *node, struct of_regulator_match *matches, unsigned int num_matches); +extern bool is_system_poweroff_source(const struct device_node *np); #else static inline struct regulator_init_data *of_get_regulator_init_data(struct device *dev, @@ -35,6 +36,11 @@ static inline int of_regulator_match(struct device *dev, { return 0; } + +static inline bool is_system_poweroff_source(const struct device_node *np) +{ + return false; +} #endif /* CONFIG_OF */ #endif /* __LINUX_OF_REG_H */