From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EAC1C433DF for ; Mon, 20 Jul 2020 13:29:41 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 694BC20729 for ; Mon, 20 Jul 2020 13:29:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AALxKtKz"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="O7PlODg5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 694BC20729 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=P0pugauK+3H7ugEdnMGPZawKiFy+NBOdb/kNwVxVlgk=; b=AALxKtKzprP0P9pLYFB/OeJW1E 6JI7HiPpJcBScB6AS9A3LOQh7CYgMqY7fQZ9LlnOXDmCaC2U0xU9XD93Yrdgz5UFCQmGxGmsWuDkn ZtsDHm+2sK552akpsTLKFPwc3+oeb+Dp70s56O1K+E1t/sJmx4rdNW8gkxbFUXOLUHHVukIzYWCj0 FZIsbftwcmBplyzNGUEVqGJbrqjyxB38UsBI7E22KOsiQEEWaLDHhDdqfBswAioQNWreEcaVk4Q3V 9WG5ltPmfX7zvbSWA41t1YFJB53YGrACNNKbJCd7jq8FExWq5+0VP0ZV8rzBn8mXOTGwWcru5uoLJ 6XH5Ja9w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxVqG-0003Tr-T2; Mon, 20 Jul 2020 13:28:29 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxVq9-0003Rg-5z for linux-arm-kernel@lists.infradead.org; Mon, 20 Jul 2020 13:28:25 +0000 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.194.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 421F120729; Mon, 20 Jul 2020 13:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595251700; bh=NJ2250te8v8tlFOpV4OLmV7BWL8Xr/txR4PHTbvuTSc=; h=From:To:Cc:Subject:Date:From; b=O7PlODg5hjUPIR3iNkhJ1WhJw3YJQ7pknCH6+wrbRPJi5hGiOcdeMmyBhpzXu6X2w +GGXhN+GeejEXiIvJJ3xu42rfGpwI74LxDPmA8l0UH7ulnWOEFT9US9PGdI0gNCTia oCxYTc+47UxBjAx93qtnPOa/bu2Qr8VmYbOq5oOU= Received: by wens.tw (Postfix, from userid 1000) id CFAD55FC86; Mon, 20 Jul 2020 21:28:17 +0800 (CST) From: Chen-Yu Tsai To: Mark Brown , Liam Girdwood Subject: [PATCH v3] regulator: gpio: Honor regulator-boot-on property Date: Mon, 20 Jul 2020 21:28:09 +0800 Message-Id: <20200720132809.26908-1-wens@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200720_092821_304839_9E8CFA86 X-CRM114-Status: GOOD ( 13.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maxime Ripard , Chen-Yu Tsai , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Chen-Yu Tsai When requesting the enable GPIO, the driver should do so with the correct output level matching some expected state. This is especially important if the regulator is a critical one, such as a supply for the boot CPU. This is currently done by checking for the enable-at-boot property, but this is not documented in the device tree binding, nor does it match the common regulator properties. Honor the common regulator-boot-on property by checking the boot_on constraint setting within the DT probe path. This is the same as what is done in the fixed regulator driver. Also add a comment stating that the enable-at-boot property should not be used. Fixes: 006694d099e8 ("regulator: gpio-regulator: Allow use of GPIO controlled regulators though DT") Signed-off-by: Chen-Yu Tsai --- Changes since v2: - Keep enable-at-boot property support - Add comment stating enable-at-boot should not be used Changes since v1: - Reworded commit log - Fixed typo in subject --- drivers/regulator/gpio-regulator.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index 110ee6fe76c4..044e45ee9629 100644 --- a/drivers/regulator/gpio-regulator.c +++ b/drivers/regulator/gpio-regulator.c @@ -148,6 +148,13 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np, config->supply_name = config->init_data->constraints.name; + if (config->init_data->constraints.boot_on) + config->enabled_at_boot = true; + + /* + * Do not use: undocumented device tree property. + * This is kept around solely for device tree ABI stability. + */ if (of_property_read_bool(np, "enable-at-boot")) config->enabled_at_boot = true; -- 2.27.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24006C433E1 for ; Mon, 20 Jul 2020 13:28:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E95B422C9C for ; Mon, 20 Jul 2020 13:28:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595251703; bh=NJ2250te8v8tlFOpV4OLmV7BWL8Xr/txR4PHTbvuTSc=; h=From:To:Cc:Subject:Date:List-ID:From; b=11nGgFtRMW4Ao4Gh8BsKlYwjwI186Dhwjplc+/5sGOiKZyi3uS7mDBlvNrk7jHRf+ +buMAsxQKZmMNq/Fkb8XnOxGtc3OTnbwTqvr1QmI5XR4y4QjJcm3G41WKRxvx2+uQ/ M46CSEX9xaWFWrjDYWhixc74mrIKwqhm2tzIFC9I= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726649AbgGTN2V (ORCPT ); Mon, 20 Jul 2020 09:28:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:53988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725815AbgGTN2U (ORCPT ); Mon, 20 Jul 2020 09:28:20 -0400 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.194.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 421F120729; Mon, 20 Jul 2020 13:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595251700; bh=NJ2250te8v8tlFOpV4OLmV7BWL8Xr/txR4PHTbvuTSc=; h=From:To:Cc:Subject:Date:From; b=O7PlODg5hjUPIR3iNkhJ1WhJw3YJQ7pknCH6+wrbRPJi5hGiOcdeMmyBhpzXu6X2w +GGXhN+GeejEXiIvJJ3xu42rfGpwI74LxDPmA8l0UH7ulnWOEFT9US9PGdI0gNCTia oCxYTc+47UxBjAx93qtnPOa/bu2Qr8VmYbOq5oOU= Received: by wens.tw (Postfix, from userid 1000) id CFAD55FC86; Mon, 20 Jul 2020 21:28:17 +0800 (CST) From: Chen-Yu Tsai To: Mark Brown , Liam Girdwood Cc: Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Maxime Ripard Subject: [PATCH v3] regulator: gpio: Honor regulator-boot-on property Date: Mon, 20 Jul 2020 21:28:09 +0800 Message-Id: <20200720132809.26908-1-wens@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen-Yu Tsai When requesting the enable GPIO, the driver should do so with the correct output level matching some expected state. This is especially important if the regulator is a critical one, such as a supply for the boot CPU. This is currently done by checking for the enable-at-boot property, but this is not documented in the device tree binding, nor does it match the common regulator properties. Honor the common regulator-boot-on property by checking the boot_on constraint setting within the DT probe path. This is the same as what is done in the fixed regulator driver. Also add a comment stating that the enable-at-boot property should not be used. Fixes: 006694d099e8 ("regulator: gpio-regulator: Allow use of GPIO controlled regulators though DT") Signed-off-by: Chen-Yu Tsai --- Changes since v2: - Keep enable-at-boot property support - Add comment stating enable-at-boot should not be used Changes since v1: - Reworded commit log - Fixed typo in subject --- drivers/regulator/gpio-regulator.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index 110ee6fe76c4..044e45ee9629 100644 --- a/drivers/regulator/gpio-regulator.c +++ b/drivers/regulator/gpio-regulator.c @@ -148,6 +148,13 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np, config->supply_name = config->init_data->constraints.name; + if (config->init_data->constraints.boot_on) + config->enabled_at_boot = true; + + /* + * Do not use: undocumented device tree property. + * This is kept around solely for device tree ABI stability. + */ if (of_property_read_bool(np, "enable-at-boot")) config->enabled_at_boot = true; -- 2.27.0