Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp685338rdb; Tue, 31 Oct 2023 21:57:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHaDPZcpvV9FaAcd70jSfan630mV+PXkcU3u+CrDbo7oH3tiuH+LfaCL8uighbqZO+voCCg X-Received: by 2002:a05:6a21:6d9c:b0:162:4f45:b415 with SMTP id wl28-20020a056a216d9c00b001624f45b415mr19444815pzb.51.1698814644891; Tue, 31 Oct 2023 21:57:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698814644; cv=none; d=google.com; s=arc-20160816; b=H1fNS7GTnQpkX2B8WcaaODHY3fqke1ogfLWgvtlbaH4j6VNuH9xD8Ns2CVZ76KayXm dj7CKpL0jikz5CCIsETIus5mNOdKwNDLMgEWV6x7h2ZVS7U7HphTZAbrpcSRFy1T+KQ3 h9w5yllB2+bAHmO0WP8eL/ZA8d1Ip3CxqS8XDS/LBBYybWtKToLzP0VXh+MGcWzsbp7+ 7/Uc0RSaE4z2UeCCUtqZ0haMTQBaKDecgVDbmsDjib8Iu7R3a2IYJBVJeA19H6xKaY+d WQ3cNxIB4j7A+Cl/fAJTcQJRRtkk/rCGa1a1uLF9bTTM15wRQUO0dMjQx2kaeSd3W+ew tSfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=s1aUG2VquO55arbsVnQyRGsbI/5cAEqcx0fI+4RcGag=; fh=pSMBRxxl7TpkKGWZaeoRPEzKrXRauoxb8Lve6KznhIc=; b=DRSX0CN5qbmWYv9R58p6ngQYYbnz5R/nGMkgRvUexnEcsvVg1BrCYdWGJOk3TU3WUK tDR4hjnVq/tGFpAcedqPr54kG+ty4wkn7gr1XTsqfJ2yLnWLbeGtOwBVMjNDkIm/GA8b CWD5wG6uvZKMSekbj3hWgEDYeRc/9+CuqTR9vHT0e4+UPyfi5HLZ0bZQp7dndB6Pf092 mjJa6yL9mFDgF4vcweS87uBc/sa77mzOwvbmALBQHjwmBFoOAA/XtD+S+BGDi/pgSz9z n0dLV1Gw+pyJ4ljJfICnnp8lxOs52AdAGRiB0kqoWRyrBw1GzDjZ0dFuPxbar0wsCSgV 6gzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IZGqMAS8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id x2-20020a170902ec8200b001c59b6ed118si2300000plg.157.2023.10.31.21.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 21:57:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IZGqMAS8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 5A598809A9BB; Tue, 31 Oct 2023 21:57:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347596AbjKAE5O (ORCPT + 99 others); Wed, 1 Nov 2023 00:57:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347588AbjKAE5M (ORCPT ); Wed, 1 Nov 2023 00:57:12 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4B3710F for ; Tue, 31 Oct 2023 21:57:09 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7D96C433C7; Wed, 1 Nov 2023 04:57:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698814629; bh=WZ7SUIOWohN5AEnVEnPROIft0gHOpjrwRA4R5V62NE8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IZGqMAS8v8/526lxoxoktvLI3XNOUSOSE75EPfqiMj1gam1kF/FoZg5cXgRgXMBlA MGm2y+ovkUifXYrOYOeMT6MnYgkUjKL7sZztMV8pGCqWHJ2pAtZipPVEYPYoZD7TXB WxYPiB7FlXGiRp9X6JSTnsCdezN4aV8cifhL/kTpRK9Nr9Db2Ze8ySe0zgCmehimff sE4QGX0dV1u4eevQVpiYOlHI6QYaCxINZe8AUBFqBOIv1aXkgyyRoL5JYqIEG8qkSt zYPLpRRGeB32udiGcjmox2pS7vbmM/CiHKd+/hpwgOFY5G5LAasEsO2IH8QvdaBciM 9T8xxYXISK48A== Date: Wed, 1 Nov 2023 10:26:52 +0530 From: Manivannan Sadhasivam To: Javier Martinez Canillas Cc: linux-kernel@vger.kernel.org, Manivannan Sadhasivam , 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: Re: [PATCH] regulator: core: Add option to prevent disabling unused regulators Message-ID: <20231101045652.GA2897@thinkpad> References: <20231028102423.179400-1-javierm@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231028102423.179400-1-javierm@redhat.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Tue, 31 Oct 2023 21:57:22 -0700 (PDT) On Sat, Oct 28, 2023 at 12:24:03PM +0200, Javier Martinez Canillas wrote: > 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 Acked-by: Manivannan Sadhasivam Thanks for looking into this. This patch is very handy to debug display related issues on platforms without serial console. On the other note, I'm wondering if we could use sync_state() for handling the regulator_init_complete() work. This would ensure that the regulators are only disabled when all the consumers are probed. - Mani > --- > > 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 > -- மணிவண்ணன் சதாசிவம்