Re: [PATCH 0/7] Implement generic regulator constraints parsing for ACPI and OF
From: Furquan Shaikh
Date: Wed Jan 25 2017 - 11:57:10 EST
On Wed, Jan 25, 2017 at 4:55 AM, Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote:
>
> On Wed, Jan 25, 2017 at 1:49 PM, Mark Brown <broonie@xxxxxxxxxx> wrote:
> > On Tue, Jan 24, 2017 at 04:06:34PM -0800, Furquan Shaikh wrote:
> >
> >> Since regulator properties remain the same across OF and ACPI
> >> regulators, this series of patches provides common routine for
> >> obtaining regulation constraints from device tree and ACPI nodes. In
> >
> > As Lorenzo explained this is really not a good idea, ACPI has a power
> > management model which is just being ignored here. If you're producing
> > systems using ACPI you really need to use ACPI in a joined up fashion
> > rather than just blindly importing all DT bindings into ACPI. While
> > there are many areas where ACPI just doesn't do anything and as a result
> > it does make sense to reuse existing DT bindings there are also plenty
> > of areas where work has been done on the ACPI side. Regulators and
> > power management are definitely one of those areas.
>
> This is exactly right. :-)
>
> Thanks,
> Rafael
I understand that ACPI provides its own bindings to allow firmware to
control power management and thus regulators have been a part of the
firmware control. However, there are use cases where the kernel driver
wishes to control the regulator to manage power to the device
irrespective of the way regulator is passed in (ACPI/OF).
That is the reason why the recent change to add ACPI support to fixed
regulators was done
(https://github.com/torvalds/linux/blob/master/drivers/regulator/fixed.c#L100).
It needs regulators for USB driver. Similarly, other drivers like ELAN
touchscreen that plan to control power to the device in a generic way
irrespective of OF/ACPI need to control regulators in kernel itself.
The above change for adding ACPI support to fixed regulators is
currently parsing only limited parameters and also does not work the
same way for ACPI and OF, though it ends to introduce the regulators
in a way similar to OF.
We need to support existing drivers and use cases for power management
in both OF and ACPI environments (keeping in mind that suspend to idle
bypasses parts of firmware) without needing to change all the drivers.
How can we achieve this?