From: Hans de Goede <hdegoede@redhat.com>
To: Mark Brown <broonie@kernel.org>
Cc: "Gregory CLEMENT" <gregory.clement@free-electrons.com>,
"Tejun Heo" <tj@kernel.org>,
linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
"Antoine Ténart" <antoine.tenart@free-electrons.com>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>,
"Ezequiel Garcia" <ezequiel.garcia@free-electrons.com>,
"Maxime Ripard" <maxime.ripard@free-electrons.com>,
"Boris BREZILLON" <boris.brezillon@free-electrons.com>,
"Jason Cooper" <jason@lakedaemon.net>,
"Andrew Lunn" <andrew@lunn.ch>,
"Sebastian Hesselbarth" <sebastian.hesselbarth@gmail.com>,
linux-arm-kernel@lists.infradead.org,
"Lior Amsalem" <alior@marvell.com>,
"Tawfik Bayouk" <tawfik@marvell.com>,
"Nadav Haklai" <nadavh@marvell.com>,
"Mark Rutland" <mark.rutland@arm.com>,
devicetree@vger.kernel.org
Subject: Re: [PATCH v4 4/4] ARM: mvebu: Armada 385 GP: Add regulators to the SATA port
Date: Fri, 16 Jan 2015 20:12:28 +0100 [thread overview]
Message-ID: <54B9629C.9090800@redhat.com> (raw)
In-Reply-To: <20150116123705.GM3043@sirena.org.uk>
Hi,
On 16-01-15 13:37, Mark Brown wrote:
> On Fri, Jan 16, 2015 at 11:10:18AM +0100, Hans de Goede wrote:
>> On 16-01-15 10:27, Gregory CLEMENT wrote:
>
>>>>> + reg_sata0: pwr-sata0 {
>>>>> + compatible = "regulator-fixed";
>>>>> + regulator-name = "pwr_en_sata0";
>>>>> + enable-active-high;
>>>>> + regulator-always-on;
>
>>>> done, but we're not using a power on delay anyways.
>
>>> But if regulator-always-on prevent to switch it off in
>>> suspend then yes using regulator-boot-on is better.
>
>> AFAIK regulator-always-on means exactly that and thus likely
>> is not what you want. As for using regulator-off-in-suspend
>> that is not necessary as the suspend method for the acpi
>> driver will already turn it off.
>
> regulator-always-on is a bit fuzzy for suspend, if the regulator has
> suspend control it'll kick in - it's really about the Linux refcounting
> while it's running. What's more concerning here is that the quick
> sample of the regulators flagged as always on like the above that I
> looked at in the patch don't seem to have any enable control in the DT
> so this will have absolutely no effect.
>
>> It is probably a good idea to use regulator-boot-on and
>> then test things this way, and if that works use
>> regulator-boot-on.
>
> No, it's unlikely that boot-on makes sense here - it's there for cases
> where we can't read back the hardware state at power on.
Which we cannot here since we've a gpio driven regulator, with the pin
in output mode, so we cannot read it back. Or at least the current kernel
implementation relies on regulator-boot-on rather then reading the
state back from the hardware.
If we do not specify regulator-boot-on then drivers/regulator/fixed.c :
of_get_fixed_voltage_config() will set the cfg.ena_gpio_flags
GPIOF_OUT_INIT_HIGH / GPIOF_OUT_INIT_LOW flags such that the regulator
will get turned off when registered (*) and then it will get turned back
on when the ahci driver loads causing the disk to powercycle while
spinning seriously deteriorating its live time, so regulator nodes
for supplies which power spinning disks definitely need
regulator-boot-on.
An alternative would be using regulator-always-on, but using
regulator-always-on here is wrong because it removes all of control from
the driver, making e.g. runtime pm for unused disks or empty drive-bays
impossible.
*) It will turn it off as soon as it requests the gpio.
> Generally
> drivers should work regardless of the initial state of the regulator
> (and modular drivers will actually break if they try to rely on boot-on
> since we clean up unused regulators at boot).
This is not about drivers, the driver will work fine, the problem is
that power-cycling disks which have already been spun-up by the bootloader
is very bad for those disks.
While we're discussing this I would also like to advocate to change the
behavior for regulator-boot-on to be the same as always-on when it comes
to regulator_init_complete(), iow regulator-boot-on regulators should
not be touched by regulator_init_complete(). It makes no sense to have
different behavior for build in versus module drivers here.
For build-in the regulator is left on (or turned on even) as soon as the
regulator registers, and then stays that way until explicitly turned off
by a driver,
I believe we should still leave these on once userspace starts running,
there is a reason they are marked as regulator-boot-on and the fact that
we're ready to start running userspace does not take away that reason, to
me regulator-boot-on means "do not turn off until explicitly told so by
a driver which (hopefully) knows wtf it is doing".
Regards,
Hans
next prev parent reply other threads:[~2015-01-16 19:12 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-15 14:09 [PATCH v4 0/4] ata: libahci: Allow using a regulator for each port Gregory CLEMENT
2015-01-15 14:09 ` [PATCH v4 1/4] ata: libahci: Clean-up the ahci_platform_en/disable_phys functions Gregory CLEMENT
2015-01-15 14:09 ` [PATCH v4 2/4] Documentation: bindings: Add the regulator property to the sub-nodes AHCI bindings Gregory CLEMENT
2015-01-15 14:09 ` [PATCH v4 3/4] ata: libahci: Allow using multiple regulators Gregory CLEMENT
2015-01-15 14:09 ` [PATCH v4 4/4] ARM: mvebu: Armada 385 GP: Add regulators to the SATA port Gregory CLEMENT
2015-01-16 8:17 ` Hans de Goede
2015-01-16 9:27 ` Gregory CLEMENT
2015-01-16 10:10 ` Hans de Goede
2015-01-16 12:37 ` Mark Brown
2015-01-16 14:27 ` Gregory CLEMENT
[not found] ` <54B91FB4.5080707-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2015-01-16 15:34 ` Mark Brown
2015-01-16 19:13 ` Hans de Goede
2015-01-16 19:44 ` Mark Brown
2015-01-16 19:12 ` Hans de Goede [this message]
[not found] ` <54B9629C.9090800-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-01-16 20:25 ` Mark Brown
2015-01-17 8:48 ` Hans de Goede
[not found] ` <54BA21F9.5050408-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-01-17 13:14 ` Mark Brown
2015-01-17 14:28 ` Hans de Goede
[not found] ` <54BA7197.40301-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-01-18 12:35 ` Mark Brown
2015-01-18 15:29 ` Hans de Goede
2015-01-18 19:28 ` Mark Brown
[not found] ` <1421330978-9694-1-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2015-01-16 7:58 ` [PATCH v4 0/4] ata: libahci: Allow using a regulator for each port Hans de Goede
2015-01-19 14:54 ` Tejun Heo
2015-01-19 15:05 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54B9629C.9090800@redhat.com \
--to=hdegoede@redhat.com \
--cc=alior@marvell.com \
--cc=andrew@lunn.ch \
--cc=antoine.tenart@free-electrons.com \
--cc=boris.brezillon@free-electrons.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=ezequiel.garcia@free-electrons.com \
--cc=gregory.clement@free-electrons.com \
--cc=jason@lakedaemon.net \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maxime.ripard@free-electrons.com \
--cc=nadavh@marvell.com \
--cc=sebastian.hesselbarth@gmail.com \
--cc=tawfik@marvell.com \
--cc=thomas.petazzoni@free-electrons.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).