Commit graph

36 commits

Author SHA1 Message Date
Flavio Ceolin 6b9d01f995 intel_adsp/ace: power: No pending transaction before power gate
Issue an upstream read transaction through uncached memory to flush
out all pending transactions before power down the host domain.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-03-22 21:29:33 -04:00
Krzysztof Chruściński 25173f71cd pm: device_runtime: Extend with synchronous runtime PM
In many cases suspending or resuming of a device is limited to
just a few register writes. Current solution assumes that those
operations may be blocking, asynchronous and take a lot of time.
Due to this assumption runtime PM API cannot be effectively used
from the interrupt context. Zephyr has few driver APIs which
can be used from an interrupt context and now use of runtime PM
is limited in those cases.

Patch introduces a new type of PM device - synchronous PM. If
device is specified as capable of synchronous PM operations then
device runtime getting and putting is executed in the critical
section. In that case, runtime API can be used from an interrupt
context. Additionally, this approach reduces RAM needed for
PM device (104 -> 20 bytes of RAM on ARM Cortex-M).

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-02-01 15:03:42 +01:00
Jordan Yates 673009f665 drivers: power_domain: add missing dependency
The GPIO power domain driver needs device power management enabled
to compile if `PM_DEVICE_POWER_DOMAIN` is enabled.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2024-01-28 22:03:25 -06:00
Flavio Ceolin 4e39f79eeb drivers: power_domain/intel_adsp: Init priority option
Add a Kconfig option to customize initialization priority of
Intel ADSP power domain.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-01-24 18:20:17 -05:00
Flavio Ceolin e80ea1e129 drivers: power_domain/gpio: Init priority option
Add a Kconfig option to customize initialization priority of
gpio power domain.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-01-24 18:20:17 -05:00
Flavio Ceolin 9506720bd8 drivers: power_domain/gpio_monitor: Init priority option
Add a Kconfig option to customize initialization priority of
gpio monitor power domain.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-01-24 18:20:17 -05:00
Anas Nashif 6df6935b67 intel_adsp: ace: do not use external kconfigs in code
use CONFIG_SOC_INTEL_ACE15_MTPM instead of CONFIG_ACE_VERSION_1_5.

CONFIG_ACE_VERSION_1_5 leaked from SOF.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-01-22 17:02:47 -05:00
Guennadi Liakhovetski ac71dfae90 intel-adsp: use proper error codes
Use proper errno.h error codes in pd_intel_adsp_set_power_enable()
instead of -1.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-01-17 09:55:48 +01:00
Guennadi Liakhovetski ca12fd13c6 xtensa: intel_adsp: fix a cache handling error
.bss and .data are uncached in Zephyr builds for intel_adsp. No need
to try to manipulate cache of objects in those sections.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-01-15 09:59:07 +01:00
Tomasz Leman 1c0c900cbb intel_adsp: ace15: Enhance HST domain power-down sequence
This patch enhances the power-down sequence for the HOST (HST) domain
within the Intel ADSP ACE 1.5 architecture. It introduces a check to
ensure that a specific condition, represented by a magic key value, is
met before disabling the HST domain. This additional verification step
ensures that the HST domain is only powered down when it is safe to do
so, thereby maintaining the stability and reliability of the system.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2024-01-11 10:05:12 +01:00
Marc Herbert c73e67018d power_domain_intel_adsp.c: revert recent INIT_PRIORITY change
This is a partial revert of one-line from commit 06cfbd4159 ("drivers:
power_domain: Introduce a gpio monitor driver") which not just
introduced a new driver (no problem with that) but also changed the
initialization priority of another, unrelated and existing power domain
driver without even trying to compile it:

https://github.com/zephyrproject-rtos/zephyr/pull/61166#issuecomment-1780959157

```
west config manifest.project-filter -- +sof
west update

west build -b intel_adsp_ace20_lnl modules/audio/sof/app/

ERROR: /soc/ssp@28100 POST_KERNEL 43 < /soc/dfpmccu@71b00/io0_domain  51
ERROR: /soc/ssp@29100 POST_KERNEL 44 < /soc/dfpmccu@71b00/io0_domain  51
ERROR: /soc/ssp@2a100 POST_KERNEL 45 < /soc/dfpmccu@71b00/io0_domain  51
ERROR: /soc/ssp@2b100 POST_KERNEL 46 < /soc/dfpmccu@71b00/io0_domain  51
ERROR: /soc/ssp@2c100 POST_KERNEL 47 < /soc/dfpmccu@71b00/io0_domain  51
ERROR: /soc/ssp@2d100 POST_KERNEL 48 < /soc/dfpmccu@71b00/io0_domain  51
```

Also note a reviewer (@ceolin) expressed concerns about this unrelated
change but it was ignored:
https://github.com/zephyrproject-rtos/zephyr/pull/61166#discussion_r1357908984

Using `CONFIG_KERNEL_INIT_PRIORITY_DEFAULT` here may be "bad" for some
reason(s) and maybe it should be changed in the future, but it's nothing
compared to breaking _compilation_ of code that has been validated for
months and been released in production
(https://github.com/thesofproject/sof-bin/releases/tag/v2023.09)

So the very urgent thing is to very quickly revert to the previous state
to unblock development. Then we can discuss what is the better thing to
do here.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-11-02 08:33:40 +00:00
Albert Jakieła 06cfbd4159 drivers: power_domain: Introduce a gpio monitor driver
Power rails of some peripherals are controlled externally.
This is a case in embedded controllers, where the power of
some I2C devices are managed by the main application
processor.

To ensure that zephyr drivers access the devices where is
powered on, introduce a "monitoring" power domain. It works
by registering interrupt handler with gpio a pin, so that
when power state changes, it will notify relevant drivers.

Additionaly add CONFIG_POWER_DOMAIN_INIT_PRIORITY to replace
harcoded init priority.

Fixes: #51349

Signed-off-by: Albert Jakieła <jakiela@google.com>
2023-11-01 10:57:17 +00:00
Tom Burdick f0326f7249 tests: dma_loopback: Intel ADSP ACE15 disable PM
Disable power management for this particular test case as it expects a
particular pattern of pm get/puts that isn't matched by the driver and
usage in SoF.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-10-23 10:01:09 -05:00
Nick Ward 2d65acca3a drivers: gpio: use gpio_is_ready_dt helper function
Update `struct gpio_dt_spec` use with gpio_is_ready_dt()

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-08-28 08:48:35 -05:00
Fabio Baltieri 3f0ee7f6db power_domain: intel_adsp: initialize after DMA
Change the power_domain_intel_adsp initialization priority so that it
initializes after the DMA driver that it depends on.

Fixes a few:

ERROR: /soc/dma@72c00 POST_KERNEL 40 69 <
	/soc/dfpmccu@71b00/hst_domain POST_KERNEL 75 65
ERROR: /soc/dma@72400 POST_KERNEL 40 66 <
	/soc/dfpmccu@71b00/hst_domain POST_KERNEL 75 65
...

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-28 14:10:17 +01:00
Jordan Yates 014760234b power_domain: gpio: init with pm_device_driver_init
Startup power domains according to the expected final state given the
power supply and PM device runtime support.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-26 08:16:44 +00:00
Jordan Yates 1ddadaf255 power_domain: gpio: compile without PM_DEVICE_POWER_DOMAIN
Let the driver compile without `PM_DEVICE_POWER_DOMAIN`, in which case
the driver only controls the GPIO, without notifying dependant devices.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-26 08:16:44 +00:00
Jordan Yates f613074283 Revert "power_domain: gpio: compile without PM_DEVICE_POWER_DOMAIN"
This reverts commit 1f1217e832.
2023-07-25 14:17:11 +02:00
Jordan Yates 226f1c5e4b Revert "power_domain: gpio: init with pm_device_driver_init"
This reverts commit 39b2ec57a0.
2023-07-25 14:17:11 +02:00
Jordan Yates 39b2ec57a0 power_domain: gpio: init with pm_device_driver_init
Startup power domains according to the expected final state given the
power supply and PM device runtime support.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-25 09:13:16 +02:00
Jordan Yates 1f1217e832 power_domain: gpio: compile without PM_DEVICE_POWER_DOMAIN
Let the driver compile without `PM_DEVICE_POWER_DOMAIN`, in which case
the driver only controls the GPIO, without notifying dependant devices.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-25 09:13:16 +02:00
Gerard Marull-Paretas 48b201cc53 device: make device dependencies optional
Device dependencies are not always required, so make them optional via
CONFIG_DEVICE_DEPS. When enabled, the gen_device_deps script will run so
that dependencies are collected and part of the final image. Related
APIs will be also made available. Since device dependencies are used in
just a few places (power domains), disable the feature by default. When
not enabled, a second linking pass will not be required.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-06-21 09:32:05 +02:00
Tomasz Leman 3024bc5b19 power_domain: intel_adsp: wait for the power domain wake up
Waiting till power domain will wake up from power gating state.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-03-29 19:59:07 -04:00
Tomasz Leman cdc39c9482 power_domain: intel_adsp: correct function call order
Changing function call order. We need to first power-up the power domain
before we turn on the devices.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-03-29 19:59:07 -04:00
Jordan Yates addf405fe6 power_domain: gpio: only run actions for children on domain
Only run the `PM_DEVICE_ACTION_TURN_ON` and `PM_DEVICE_ACTION_TURN_OFF`
actions for child devices that have refered to the domain via the
`power-domain` property.

This prevents multiple actions being run for devices that refer to
several power domains, e.g.

```
	test_dev: test_dev {
		compatible = "test-device-pm";
		status = "okay";
		power-domain = <&test_reg_1>;
		alternate-domain = <&test_reg_chained>;
	};
```

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-01-24 09:42:11 +01:00
Tomasz Leman d9a416f38d power_domain: intel_adsp: code update
This patch contains several small changes to the intel adsp power
domain.

- include missing header,
- replacing sys_write32/sys_read32 with sys_write16/sys_read16 since
  DfPWRCTL is a 16 bit register,
- renaming struct to be more representing what it is,
- passing register address, not a value to the sys_read/sys_write
  functions,
- pd_intel_adsp_init is now returning actual status.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-11-30 17:46:17 -05:00
Arsen Eloglian c67666ae1b board: rename dtsi node 'lps' to 'dfpmcch'
dfpmcch covers lps memory mapping.
Making lps a part of dfpmcch.

Signed-off-by: Arsen Eloglian <ArsenX.Eloglian@intel.com>
2022-11-22 20:03:06 -05:00
Kumar Gala d2326fe187 drivers: power_domain: Update drivers to use devicetree Kconfig symbol
Update power_domain drivers to use DT_HAS_<compat>_ENABLED Kconfig
symbol to expose the driver and enable it by default based on
devicetree.

We remove one reference in prj.conf that is no longer needed.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-11-02 15:41:17 +09:00
Gerard Marull-Paretas 0cd311c4a1 include: fix files using legacy include paths
Some files were still using the already deprecated include path, fix
this.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-31 06:49:00 -04:00
Krzysztof Frydryk 078de4e021 power_domain: Intel ADSP: Add power gating mechanism for Intel ADSP devices
This adds power domain gating mechanisms for Intel ADSP devices.

Signed-off-by: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
2022-08-10 11:58:45 +02:00
Jordan Yates e5c391fad6 power_domain: gpio: improve logging
Improve the power domain logging by making the log level configurable
and boosting the log level of the messages printed when the domain turns
on and off.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-10 17:59:56 -04:00
Jordan Yates 9b59721ab3 power_domain: gpio: update include paths
Update the Zephyr include paths to be compatible with removing
`CONFIG_LEGACY_INCLUDE_PATH` in the future.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-06 11:33:10 +02:00
Jordan Yates d1ab0f6b6e power_domain: gpio: use on-off and startup time
Respect the configured values for how long the domain takes to turn on,
and how long the domain needs to be off for before it can be repowered.

As these actions can block, guard the transition function with
pm_device_action_can_block. To avoid system PM being able to turn the
domain off but not back on again, guard the entire implementation.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-06 11:33:10 +02:00
Jordan Yates 31ad7e2bd4 power_domain: gpio: remove unused strings
Remove unused power domain transition strings.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-06 11:33:10 +02:00
Jordan Yates 6d1a08b3a8 pm: device: move pm_device_runtime_init_* funcs
Move the `pm_device_runtime_init_*` functions from <pm/device_runtime.h>
to <pm/device.h>. The initial device state should be settable
independently of whether `CONFIG_PM_DEVICE_RUNTIME` is enabled.

This also resolves a compilation error when attempting to use these
functions without also including <pm/device.h>.

Function documentation is also updated to be more general than only
referencing runtime PM, as this also applies to system PM and manually
run actions.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-25 10:39:55 +01:00
Jordan Yates ccdc009077 drivers: power_domain: gpio controlled domain
Initial implementation of a simple GPIO controlled power domain.
It exposes no API of its own, all functionality is contained inside
the runtime power management callbacks.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-19 13:35:32 -05:00