mbox series

[v4,0/6] Exynos Adaptive Supply Voltage support

Message ID 20190910123618.27985-1-s.nawrocki@samsung.com
Headers show
Series Exynos Adaptive Supply Voltage support | expand

Message

Sylwester Nawrocki Sept. 10, 2019, 12:36 p.m. UTC
This is fourth iteration of my patch series adding ASV (Adaptive Supply 
Voltage) support for Exynos SoCs. The previous one can be found at:
https://lkml.org/lkml/2019/8/13/808

Major change since v3 is a conversion to use dev_pm_opp_adjust_voltage(),
rather than removing and adding an OPP again. Hence the series now 
depends on patch [1].

I have included here a patch to address review comments
"opp: Handle target/min/max voltage in dev_pm_opp_adjust_voltage()",
which could be squashed with patch [1].

The CHIPID patches are dropped from the series as they have already 
been merged.

The patch set is based on for-next branch, 
git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git

Tested on Odroid XU3, XU3 Lite, XU4.

One of the things on TODO list is support for the Adaptive Body Bias.
This would require modifications on the cpufreq driver side in order 
to support multiple voltage regulators as well as changes in the OPP 
framework to support adding OPPs with multiple voltages.

[1] "[v4, 6/8] PM / OPP: Support adjusting OPP voltages at runtime"
    https://lore.kernel.org/linux-arm-kernel/1565703113-31479-7-git-send-email-andrew-sh.cheng@mediatek.com

Sylwester Nawrocki (6):
  opp: Handle target/min/max voltage in dev_pm_opp_adjust_voltage()
  dt-bindings: samsung: Update the CHIP ID binding documentation
  soc: samsung: Add Exynos Adaptive Supply Voltage driver
  ARM: EXYNOS: Enable exynos-asv driver for ARCH_EXYNOS
  ARM: dts: Add "syscon" compatible string to chipid node
  ARM: dts: Add samsung,asv-bin property for odroidxu3-lite

 .../bindings/arm/samsung/exynos-chipid.txt    |  10 +-
 arch/arm/boot/dts/exynos5.dtsi                |   4 +-
 .../boot/dts/exynos5422-odroidxu3-lite.dts    |   4 +
 arch/arm/mach-exynos/Kconfig                  |   1 +
 drivers/opp/core.c                            |  10 +-
 drivers/soc/samsung/Kconfig                   |  10 +
 drivers/soc/samsung/Makefile                  |   3 +
 drivers/soc/samsung/exynos-asv.c              | 179 ++++++
 drivers/soc/samsung/exynos-asv.h              |  82 +++
 drivers/soc/samsung/exynos5422-asv.c          | 509 ++++++++++++++++++
 drivers/soc/samsung/exynos5422-asv.h          |  25 +
 include/linux/pm_opp.h                        |   3 +-
 12 files changed, 833 insertions(+), 7 deletions(-)
 create mode 100644 drivers/soc/samsung/exynos-asv.c
 create mode 100644 drivers/soc/samsung/exynos-asv.h
 create mode 100644 drivers/soc/samsung/exynos5422-asv.c
 create mode 100644 drivers/soc/samsung/exynos5422-asv.h

Comments

Krzysztof Kozlowski Oct. 2, 2019, 2:33 p.m. UTC | #1
On Tue, Sep 10, 2019 at 02:36:13PM +0200, Sylwester Nawrocki wrote:
> To be squashed with patch "PM / OPP: Support adjusting OPP voltages
> at runtime".
> 
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
> Changes since v3:
>  - new patch
> 
>  drivers/opp/core.c     | 10 ++++++++--
>  include/linux/pm_opp.h |  3 ++-
>  2 files changed, 10 insertions(+), 3 deletions(-)

I'll take the ASV driver via samsung-soc but I see it depends on this
one.  Please provide me a stable tag with it or an Ack.

Best regards,
Krzysztof


> 
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index 407a07f29b12..4ebe5a6c280b 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -2057,14 +2057,18 @@ static int _opp_set_availability(struct device *dev, unsigned long freq,
>   * dev_pm_opp_adjust_voltage() - helper to change the voltage of an OPP
>   * @dev:		device for which we do this operation
>   * @freq:		OPP frequency to adjust voltage of
> - * @u_volt:		new OPP voltage
> + * @u_volt:		new OPP target voltage
> + * @u_volt_min:		new OPP min voltage
> + * @u_volt_max:		new OPP max voltage
>   *
>   * Return: -EINVAL for bad pointers, -ENOMEM if no memory available for the
>   * copy operation, returns 0 if no modifcation was done OR modification was
>   * successful.
>   */
>  int dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq,
> -			      unsigned long u_volt)
> +			      unsigned long u_volt, unsigned long u_volt_min,
> +			      unsigned long u_volt_max)
> +
>  {
>  	struct opp_table *opp_table;
>  	struct dev_pm_opp *tmp_opp, *opp = ERR_PTR(-ENODEV);
> @@ -2098,6 +2102,8 @@ int dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq,
>  		goto adjust_unlock;
> 
>  	opp->supplies->u_volt = u_volt;
> +	opp->supplies->u_volt_min = u_volt_min;
> +	opp->supplies->u_volt_max = u_volt_max;
> 
>  	dev_pm_opp_get(opp);
>  	mutex_unlock(&opp_table->lock);
> diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
> index 86947d53e8c4..0ee1daafe6af 100644
> --- a/include/linux/pm_opp.h
> +++ b/include/linux/pm_opp.h
> @@ -113,7 +113,8 @@ void dev_pm_opp_remove(struct device *dev, unsigned long freq);
>  void dev_pm_opp_remove_all_dynamic(struct device *dev);
> 
>  int dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq,
> -			      unsigned long u_volt);
> +			      unsigned long u_volt, unsigned long u_volt_min,
> +			      unsigned long u_volt_max);
> 
>  int dev_pm_opp_enable(struct device *dev, unsigned long freq);
> 
> --
> 2.17.1
>
Krzysztof Kozlowski Oct. 2, 2019, 3:44 p.m. UTC | #2
On Tue, Sep 10, 2019 at 02:36:17PM +0200, Sylwester Nawrocki wrote:
> The CHIP ID block in addition to exact chip revision information
> contains data and control registers for ASV (Adaptive Supply Voltage)
> and ABB (Adaptive Body Bias). Add "syscon" compatible so the CHIPID
> block can be shared by respective drivers.
> 
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
> Changes since v2:
>  - none
> 
> Changes since v1 (RFC):
>  - new patch
> ---
>  arch/arm/boot/dts/exynos5.dtsi | 4 ++--

Please do not forget about exynos prefix in subject.

Thanks, applied.

Best regards,
Krzysztof
Krzysztof Kozlowski Oct. 2, 2019, 3:44 p.m. UTC | #3
On Tue, Sep 10, 2019 at 02:36:18PM +0200, Sylwester Nawrocki wrote:
> The Exynos5422 SoC used on Odroid XU3 Lite boards belongs to
> a special ASV bin but this information cannot be read from the
> CHIPID block registers. Add samsung,asv-bin property for XU3
> Lite to ensure the ASV bin is properly determined.
> 
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
> Changes since v2:
>  - none
> 
> Changes since v1 (RFC):
>  - new patch
> ---
>  arch/arm/boot/dts/exynos5422-odroidxu3-lite.dts | 4 ++++

Thanks, applied.

Best regards,
Krzysztof
Sylwester Nawrocki Oct. 2, 2019, 3:54 p.m. UTC | #4
On 10/2/19 16:33, Krzysztof Kozlowski wrote:
> On Tue, Sep 10, 2019 at 02:36:13PM +0200, Sylwester Nawrocki wrote:
>> To be squashed with patch "PM / OPP: Support adjusting OPP voltages
>> at runtime".
>>
>> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
>> ---
>>
>>  drivers/opp/core.c     | 10 ++++++++--
>>  include/linux/pm_opp.h |  3 ++-
>>  2 files changed, 10 insertions(+), 3 deletions(-)
>
> I'll take the ASV driver via samsung-soc but I see it depends on this
> one.  Please provide me a stable tag with it or an Ack.

There is further dependency on patch 
"[PATCH v4 6/8] PM / OPP: Support adjusting OPP voltages at runtime"
https://lore.kernel.org/linux-arm-kernel/1565703113-31479-7-git-send-email-andrew-sh.cheng@mediatek.com

Viresh, what are your plans WRT to those patches?
Viresh Kumar Oct. 14, 2019, 6:26 a.m. UTC | #5
On 02-10-19, 17:54, Sylwester Nawrocki wrote:
> On 10/2/19 16:33, Krzysztof Kozlowski wrote:
> > On Tue, Sep 10, 2019 at 02:36:13PM +0200, Sylwester Nawrocki wrote:
> >> To be squashed with patch "PM / OPP: Support adjusting OPP voltages
> >> at runtime".
> >>
> >> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> >> ---
> >>
> >>  drivers/opp/core.c     | 10 ++++++++--
> >>  include/linux/pm_opp.h |  3 ++-
> >>  2 files changed, 10 insertions(+), 3 deletions(-)
> >
> > I'll take the ASV driver via samsung-soc but I see it depends on this
> > one.  Please provide me a stable tag with it or an Ack.
> 
> There is further dependency on patch 
> "[PATCH v4 6/8] PM / OPP: Support adjusting OPP voltages at runtime"
> https://lore.kernel.org/linux-arm-kernel/1565703113-31479-7-git-send-email-andrew-sh.cheng@mediatek.com
> 
> Viresh, what are your plans WRT to those patches?

I am waiting for Andrew to send me the next set of patches. You depend
on only one of the patches ? In that case you can just pick that patch
from his series, keep his authorship intact and make changes from 1/6
and send along with your series.
Sylwester Nawrocki Oct. 16, 2019, 9:15 a.m. UTC | #6
On 10/14/19 08:26, Viresh Kumar wrote:
> I am waiting for Andrew to send me the next set of patches. You depend
> on only one of the patches ? In that case you can just pick that patch
> from his series, keep his authorship intact and make changes from 1/6
> and send along with your series.

Yes, only that single patch. I will incorporate my changes then and resend, 
thank you.