Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1755231ybh; Mon, 20 Jul 2020 06:31:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZm9dATDZOMOkdx1ck59T1po4ecigBl5hLYw7jKYi56r06U5/kDZ6+uRvBmyOrg7v+0+x5 X-Received: by 2002:a17:906:29d8:: with SMTP id y24mr20437100eje.212.1595251866597; Mon, 20 Jul 2020 06:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595251866; cv=none; d=google.com; s=arc-20160816; b=p7gpc07L4f/1V5DOBVzI1ykesX7imzHf6GKkAByAYr1dngiT0b7Tvu6yLjZdzsGMaa zxByN4js0EXUSSpqg3yS06RZ+urNRhEG53UlE5JtfPC0nAdDB0HE7JWqiKdu0KRPLikn R4deNdfurfY/WVqAKF4B0hd7SGQ4klqEJJyPvlc82dL89H5TdNNR89e4xwraehPO11Hz SNgr+IOYRUIqnP1x8p0/sY8RUVMgaTohGcS7WzqaU3b+F4mc84BEUVkhTpepLMc0FmAc qBjBmoAR66Ka9GO+i8y0qmhg12uS0zETfT4nVNXrUOxD/liISvk2GDWH3ZMLLhjOl/3p /czg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=mp6LALlp8qXO0hQK+ZPqgYaoiGTkIYAeGfZO2TaAqF0=; b=LRkPe9FlKKPU5kyd8dEo3MeJIwZUde4QLfF40UcRUJXdaGQnEAzS3k4BpS5pskaJOu qUJ1aXJQ7iakB6z7ysPFBX15rbBnjevU7JBQGty7Wa02iIVCaPf3o7MB44lH6r0rF9Yv xF7dtVr9TVsMXjTn7Y1QyWhekffhukkqvP3Wbc4Td98HRKbYnZMOGP3fh/V/jH32Vv96 qVSlhvOKryA10PDZLZ3Xsobd+bIpx+qcRP4lNUQ9D30s0JIcqSv8NDR+lcnbM6P9VrjL pIy4n4i1GP5npmAEpfisAp5YW/qAKZgKLWN+PUE/Jq2/PpQzj7rJf6MGLBhY0MI9CuzH SttQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=O7PlODg5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v6si10985535ejr.238.2020.07.20.06.30.41; Mon, 20 Jul 2020 06:31:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=O7PlODg5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726555AbgGTN2V (ORCPT + 99 others); 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