linux-stable/drivers/clk/tegra
Dmitry Osipenko b1bc04a2ac clk: tegra: Support runtime PM and power domain
The Clock-and-Reset controller resides in a core power domain on NVIDIA
Tegra SoCs.  In order to support voltage scaling of the core power domain,
we hook up DVFS-capable clocks to the core GENPD for managing of the
GENPD's performance state based on the clock changes.

Some clocks don't have any specific physical hardware unit that backs
them, like root PLLs and system clock and they have theirs own voltage
requirements.  This patch adds new clk-device driver that backs the clocks
and provides runtime PM functionality for them.  A virtual clk-device is
created for each such DVFS-capable clock at the clock's registration time
by the new tegra_clk_register() helper.  Driver changes clock's device
GENPD performance state based on clk-rate notifications.

In result we have this sequence of events:

  1. Clock driver creates virtual device for selective clocks, enables
     runtime PM for the created device and registers the clock.
  2. Clk-device driver starts to listen to clock rate changes.
  3. Something changes clk rate or enables/disables clk.
  4. CCF core propagates the change through the clk tree.
  5. Clk-device driver gets clock rate-change notification or GENPD core
     handles prepare/unprepare of the clock.
  6. Clk-device driver changes GENPD performance state on clock rate
     change.
  7. GENPD driver changes voltage regulator state change.
  8. The regulator state is committed to hardware via I2C.

We rely on fact that DVFS is not needed for Tegra I2C and that Tegra I2C
driver already keeps clock always-prepared.  Hence I2C subsystem stays
independent from the clk power management and there are no deadlock spots
in the sequence.

Currently all clocks are registered very early during kernel boot when the
device driver core isn't available yet.  The clk-device can't be created
at that time.  This patch splits the registration of the clocks in two
phases:

  1. Register all essential clocks which don't use RPM and are needed
     during early boot.

  2. Register at a later boot time the rest of clocks.

This patch adds power management support for Tegra20 and Tegra30 clocks.

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Peter Geis <pgwipeout@gmail.com> # Ouya T30
Tested-by: Paul Fertser <fercerpav@gmail.com> # PAZ00 T20
Tested-by: Nicolas Chauvet <kwizart@gmail.com> # PAZ00 T20 and TK1 T124
Tested-by: Matt Merhar <mattmerhar@protonmail.com> # Ouya T30
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2021-12-15 18:55:21 +01:00
..
clk-audio-sync.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
clk-bpmp.c clk: tegra: bpmp: Clamp clock rates on requests 2020-11-26 16:28:07 +01:00
clk-device.c clk: tegra: Support runtime PM and power domain 2021-12-15 18:55:21 +01:00
clk-dfll.c clk: tegra: fix old-style declaration 2021-08-29 11:38:11 -07:00
clk-dfll.h clk: tegra: clk-dfll: Add suspend and resume support 2019-11-11 14:53:03 +01:00
clk-divider.c clk: tegra: divider: Check UART's divider enable-bit state on rate's recalculation 2020-01-10 15:50:05 +01:00
clk-id.h clk: tegra: Fix duplicated SE clock entry 2020-12-10 12:51:59 -08:00
clk-periph-fixed.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
clk-periph-gate.c clk: tegra: Don't deassert reset on enabling clocks 2021-05-31 15:16:46 +02:00
clk-periph.c clk: tegra: Fix refcounting of gate clocks 2021-05-31 15:16:24 +02:00
clk-pll-out.c clk: tegra: pllout: Save and restore pllout context 2019-11-11 14:53:02 +01:00
clk-pll.c clk: tegra: Support runtime PM and power domain 2021-12-15 18:55:21 +01:00
clk-sdmmc-mux.c clk: tegra: Implement disable_unused() of tegra_clk_sdmmc_mux_ops 2021-07-27 14:54:19 -07:00
clk-super.c clk: tegra: Support runtime PM and power domain 2021-12-15 18:55:21 +01:00
clk-tegra-audio.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
clk-tegra-fixed.c clk: tegra: Remove CLK_M_DIV fixed clocks 2020-03-12 11:33:32 +01:00
clk-tegra-periph.c clk: tegra: Remove CLK_IS_CRITICAL flag from fuse clock 2021-08-11 11:57:01 +02:00
clk-tegra-super-cclk.c clk: tegra: cclk: Handle thermal DIV2 CPU frequency throttling 2021-05-31 15:16:26 +02:00
clk-tegra-super-gen4.c clk: tegra: clk-super: Fix to enable PLLP branches to CPU 2019-11-11 14:53:03 +01:00
clk-tegra20-emc.c clk: tegra: Export Tegra20 EMC kernel symbols 2020-11-06 19:24:04 +01:00
clk-tegra20.c clk: tegra: Support runtime PM and power domain 2021-12-15 18:55:21 +01:00
clk-tegra30.c clk: tegra: Support runtime PM and power domain 2021-12-15 18:55:21 +01:00
clk-tegra114.c clk: tegra: Make vde a child of pll_p on tegra114 2021-12-15 16:39:15 +01:00
clk-tegra124-dfll-fcpu.c clk: tegra: clk-tegra124-dfll-fcpu: don't use devm functions for regulator 2021-06-25 16:23:07 -07:00
clk-tegra124-emc.c clk: tegra: tegra124-emc: Fix clock imbalance in emc_set_timing() 2021-06-02 11:08:00 +02:00
clk-tegra124.c memory: tegra124-emc: Make driver modular 2021-01-05 18:00:09 +01:00
clk-tegra210-emc.c This pull request contains zero diff to the core framework. It is a collection 2020-10-22 12:53:28 -07:00
clk-tegra210.c clk: tegra: Add PLLE HW power sequencer control 2021-03-24 14:01:58 +01:00
clk-utils.c clk: tegra: Refactor fractional divider calculation 2018-07-25 13:43:34 -07:00
clk.c clk: tegra: Support runtime PM and power domain 2021-12-15 18:55:21 +01:00
clk.h clk: tegra: Support runtime PM and power domain 2021-12-15 18:55:21 +01:00
cvb.c clk: tegra: cvb: Provide missing description for 'tegra_cvb_add_opp_table()'s align param 2021-02-11 11:56:05 -08:00
cvb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
Kconfig memory: tegra124-emc: Make driver modular 2021-01-05 18:00:09 +01:00
Makefile clk: tegra: Support runtime PM and power domain 2021-12-15 18:55:21 +01:00