Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1689020rdh; Sat, 28 Oct 2023 03:25:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDNJpuDRn3iuzSTaP8MMFb0F1E3F7hentVREXpQeBXh1D8UvdF/mXpH3HPRH3CJQPSNFN0 X-Received: by 2002:a05:6870:6188:b0:1ea:69f6:fe09 with SMTP id a8-20020a056870618800b001ea69f6fe09mr7267676oah.10.1698488743894; Sat, 28 Oct 2023 03:25:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698488743; cv=none; d=google.com; s=arc-20160816; b=u1eZLD5S0qD9lLcglKLMrjJaZLb4ED3rnFDc2Uehk/REiZTKcZKXaSk29EqgBMkj4z JSeHO+UeLLBdivHUUs9LTbjQAVmViKwwdDBKPyDnL7tRFWhCcly6OizMFgWpdg+RmywF +qT8CZ1RjT9+dOhokJLiyDDE8E2ikFQQuTj4BcRHQZFyDWzFs3QmDqStsYQPNVoyxs7K lFRg+sPXBqa0JVK10VcZQEcS9RzPRUtBXYoSN8tQeLO3qe+udCWDcRwHtqjwLl4Fw6WY If0Nh1VkBBl8XUNl/JG09Dq3z7MuWIVMrGNd/E6KM03FsW/Yw0lHmRYTSby6gMWfsldC 37tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/MCG0fKq7dkA5vfmyvu/Vw865nGk2FxWSZE8uUZKj/c=; fh=NK7rCCZTPB9BDCFkCWMp8+k4I36viGCnI65a+hnjNNw=; b=FL+YNCCxgsxNFAyOAPZzvqY7W7yixw6sQChr35h4P5ezXFFjbR+d+PNuEH9+2zK01U 8HxsMA5bzp3HvQhyJ1ZviTorB1dQOtBaF0rSXYg3SuxXfHhTNVOt46lwa6CGLKd3LYtI +/SX7Ocu0lSav6V+de0l4D0GzupONIXVMnWHW/ftB/UM07cDffdFbb9Y8JDONPUqHu3G XPTo6ohU+WEY++cxcX9YLQqkYVpF4MviuMLnDZmK9l/23ejxO9mGrsxc7u0jVoRVxtS+ 2/ZrCK2JIEGneJZyexpyY4dHEdrbmnZ1B5d43xCDNUiuy32Yid4N9qcQbx/9qP9ofUS4 +U7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="WPh3KBX/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bz9-20020a056a02060900b005b969f7e4b0si442570pgb.377.2023.10.28.03.25.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 03:25:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="WPh3KBX/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D8CB280477A6; Sat, 28 Oct 2023 03:25:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229691AbjJ1KZl (ORCPT + 99 others); Sat, 28 Oct 2023 06:25:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbjJ1KZl (ORCPT ); Sat, 28 Oct 2023 06:25:41 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1060010A for ; Sat, 28 Oct 2023 03:24:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698488689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=/MCG0fKq7dkA5vfmyvu/Vw865nGk2FxWSZE8uUZKj/c=; b=WPh3KBX/6SpxAVBfSugaFe+JKAZr3rgO4g6LtL/aX971ik7RlVL955sC2lyIyUeHK5Jg1T rQxhKwDsqYF1QlH+T0CTA0fWr1tPqOj2VPHOr7x7KqN3e3rElDsHw8MlzMEcqbKtX8c2zS uvGGa8pcy7ydMz3DKEbEkj5xRZ0pzog= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-250-mc9gE-OdNSCZwKZujsOKlw-1; Sat, 28 Oct 2023 06:24:47 -0400 X-MC-Unique: mc9gE-OdNSCZwKZujsOKlw-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-402cd372b8bso22153635e9.2 for ; Sat, 28 Oct 2023 03:24:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698488686; x=1699093486; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/MCG0fKq7dkA5vfmyvu/Vw865nGk2FxWSZE8uUZKj/c=; b=cZr3kKdMQFag1Ju/f6vYGxxh8xZq8BaZor873Y80hmkM7cTVnF7+b9f+wuSxMQJ7o2 BY0XsEBmtCbBMRVN+rKJfSaSfqlywJd22mb7ZQxAPXvKvxk7VJY98pXEg5vj1MjhZHQL l3mFJINtAqGkjAQJy7aP+JLSaa3QFA6KgYJMjBAxyyIz/wBFKmNBpbTuNKa3m2auy2cs +4ljzeJ2/KaMfqph/+dtU8OnLVEvIyYjOPo/VNim9NhjjYst2aa/jrsVDGM5Lthl9gpT 5WGdWo0d7hWOJ23dcYBIeUpOQLl/TMHS5aOUjQX6knFVv7iOXJofgh7tzA9MHaZ9kZeH Cv0g== X-Gm-Message-State: AOJu0YwG3ZtjrgATcoWJ1q9KOdpJGg6ZOOoIG9ebVweMTYAOrHmQDCDf yVeiHhSgHKJvk7SO4rwN7dK09KUY78jpzGR3AFhI0IYyas7af68mBOictXh6ord0gfaTzPM7EFU JD6SK3C5cuxmLqByg1f88vo2Jy/xWKMQ1cGIewQOff9LA1B4UgmrnvmmjyNpCZUwzIG4Kfx3ftU 57ZPqw4b0= X-Received: by 2002:a05:6000:156f:b0:32f:62d5:79fd with SMTP id 15-20020a056000156f00b0032f62d579fdmr5354111wrz.23.1698488686515; Sat, 28 Oct 2023 03:24:46 -0700 (PDT) X-Received: by 2002:a05:6000:156f:b0:32f:62d5:79fd with SMTP id 15-20020a056000156f00b0032f62d579fdmr5354082wrz.23.1698488686028; Sat, 28 Oct 2023 03:24:46 -0700 (PDT) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id c6-20020adfed86000000b00326f0ca3566sm3552032wro.50.2023.10.28.03.24.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 03:24:45 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Manivannan Sadhasivam , Javier Martinez Canillas , Jonathan Corbet , Liam Girdwood , Mark Brown , "Paul E. McKenney" , "Rafael J. Wysocki" , Randy Dunlap , "Steven Rostedt (Google)" , Tejun Heo , linux-doc@vger.kernel.org Subject: [PATCH] regulator: core: Add option to prevent disabling unused regulators Date: Sat, 28 Oct 2023 12:24:03 +0200 Message-ID: <20231028102423.179400-1-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 28 Oct 2023 03:25:43 -0700 (PDT) This may be useful for debugging and develompent purposes, when there are drivers that depend on regulators to be enabled but do not request them. It is inspired from the clk_ignore_unused and pd_ignore_unused parameters, that are used to keep firmware-enabled clocks and power domains on even if these are not used by drivers. The parameter is not expected to be used in normal cases and should not be needed on a platform with proper driver support. Signed-off-by: Javier Martinez Canillas --- Documentation/admin-guide/kernel-parameters.txt | 7 +++++++ drivers/regulator/core.c | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 0a1731a0f0ef..91b58d767c2c 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -5461,6 +5461,13 @@ print every Nth verbose statement, where N is the value specified. + regulator_ignore_unused + [REGULATOR] + Prevents the regulator framework to disable regulators + that are unused due not driver claiming them. This may + be useful for debug and development, but should not be + needed on a platform with proper driver support. + relax_domain_level= [KNL, SMP] Set scheduler's default relax_domain_level. See Documentation/admin-guide/cgroup-v1/cpusets.rst. diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 3137e40fcd3e..220034ff0273 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -6234,6 +6234,14 @@ static int regulator_late_cleanup(struct device *dev, void *data) return 0; } +static bool regulator_ignore_unused; +static int __init regulator_ignore_unused_setup(char *__unused) +{ + regulator_ignore_unused = true; + return 1; +} +__setup("regulator_ignore_unused", regulator_ignore_unused_setup); + static void regulator_init_complete_work_function(struct work_struct *work) { /* @@ -6246,6 +6254,15 @@ static void regulator_init_complete_work_function(struct work_struct *work) class_for_each_device(®ulator_class, NULL, NULL, regulator_register_resolve_supply); + /* + * For debugging purposes, it may be useful to prevent unused + * regulators to be disabled. + */ + if (regulator_ignore_unused) { + pr_warn("regulator: Not disabling unused regulators\n"); + return; + } + /* If we have a full configuration then disable any regulators * we have permission to change the status for and which are * not in use or always_on. This is effectively the default -- 2.41.0