From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753339AbcDXWvh (ORCPT ); Sun, 24 Apr 2016 18:51:37 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:39968 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753287AbcDXWvg (ORCPT ); Sun, 24 Apr 2016 18:51:36 -0400 Date: Sun, 24 Apr 2016 23:51:27 +0100 From: Mark Brown To: WEN Pingbo Cc: linux-kernel@vger.kernel.org, lgirdwood@gmail.com, vincent.guittot@linaro.org, stephen.boyd@linaro.org Message-ID: <20160424225127.GI3217@sirena.org.uk> References: <1461395466-14896-1-git-send-email-pingbo.wen@linaro.org> <1461395466-14896-2-git-send-email-pingbo.wen@linaro.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="s/WT9nMb2Y5oFLLC" Content-Disposition: inline In-Reply-To: <1461395466-14896-2-git-send-email-pingbo.wen@linaro.org> X-Cookie: Tomorrow, you can be anywhere. User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: 2a01:348:6:8808:fab::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Re: [RFC PATCH 2/2] regulator: add boot protection flag X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --s/WT9nMb2Y5oFLLC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Apr 23, 2016 at 03:11:06PM +0800, WEN Pingbo wrote: > This patch try to add a boot_protection flag in regulator constraints. > So the regulator core will prevent the specified operation during kernel > booting. > The boot_protection flag only work before late_initicall. And as other > constraints liked, you can specify this flag in a board file, or in > dts file. By default, all operations of this regulator will be rejected > during kernel booting, if you add this flag in a regulator. But you > still have a chance to change this, by modifying boot_valid_ops_mask. This is still a complete hack which is going to break as soon as things are built modular, it's definitely *not* something that should ever appear in DT since it depends so heavily on implementation details. If you need some driver to start early work on getting that sorted. This is also going to interact badly with any other drivers that are trying to configure things at runtime, if they've done enables and disables (or especially an enable without a matching disable) their refcounts are going to be wrong and if they've tried to do anything with setting voltages we'll have completely ignored whatever they asked for or told them that they can't change voltages. If we were doing anything like this it would need to be a lot more transparent to other regulators sharing the supplies (which are presumably what's causing problems here). > [ This patch depends on regulator_ops_is_valid patch. And some document > need to add, but I want to hear some voice first. ] There is no need to say that patch 2 in a series depends on patch 1. > @@ -868,7 +877,7 @@ static void print_constraints(struct regulator_dev *r= dev) > rdev_dbg(rdev, "%s\n", buf); > =20 > if ((constraints->min_uV !=3D constraints->max_uV) && > - !regulator_ops_is_valid(rdev, REGULATOR_CHANGE_VOLTAGE)) > + !(constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) > rdev_warn(rdev, > "Voltage range but no REGULATOR_CHANGE_VOLTAGE\n"); > } This appears to be unrelated? > + if (constraints->boot_protection) { > + if (of_property_read_bool(np, "boot-allow-set-voltage")) > + constraints->boot_valid_ops_mask |=3D > + REGULATOR_CHANGE_VOLTAGE; We were factoring things out a minute ago... --s/WT9nMb2Y5oFLLC Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXHU3tAAoJECTWi3JdVIfQwkQH/i9u5qfezfunp+faDNoC0P8G dy6ZTOdiVWxd0LZTJCy3kvqyso3xnqFzSkYmfOfRzIhRdB+VxWfIVLCtlFFAjaor 9mQVFW7B4gdxRsoX+q94jgzdNllMObtazVkwqz9gCgJmF5YtMLqVvIWC396mz7nl +iCa3dznGnYILefQUnt+Ky35FMTVlc71nY7cjwkxCMTEWyLuSYTLVIecOirtBPBd iJtsL3KV1x1kN1rU7k+7jGa+rd2S3/DCRsYoWEEUwYHW7niMZwhRgHT8oxtgzW3g Ws72GavQ/nmuAdWOGGa7ZE7+8qcCkY829b9cS/zomTGX4+h5uU42lIOJKfFkDms= =7Nvr -----END PGP SIGNATURE----- --s/WT9nMb2Y5oFLLC--