Commit graph

57420 commits

Author SHA1 Message Date
Flavio Ceolin
b83128e169 pm: Keep track of active states on state_force
Update z_cpu_active in pm_power_state_force

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-11-06 10:21:53 -04:00
Flavio Ceolin
d3a1549ba2 pm: Keep cpu power state consistent
Set the cpu state to ACTIVE after it resumes.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-11-06 10:21:53 -04:00
Flavio Ceolin
05c17b8443 pm: Remove _handle_device_abort
_handle_device_abort is only called in one place and it basically does
two instructions. Just remove it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-11-06 10:21:53 -04:00
Flavio Ceolin
9ddcf255bd pm: smp: Properly handle device pm on SMP
On smp environment, we cannot do device power management based only on
the state the current core. For example, do not suspend devices if
there are other cores active, or resume devices if there are other
cores already active.

This change ensure that devices are only suspend when the last active
core become idle and that these devices are resumed only when the first
core becomes active.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-11-06 10:21:53 -04:00
Flavio Ceolin
9444480c7b pm: Better return type for pm_system_suspend
Instead of returning PM_STATE_ACTIVE for when the cpu didn't enter a
low power state and a different state when it entered, but has
already left the state and is active again, it changes
pm_system_suspend to return true when the cpu has entered a low power
state and false otherwise.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-11-06 10:21:53 -04:00
Flavio Ceolin
8c3d9afed7 pm: Change pm_power_state_next_get to support SMP
Change the API to account multiple CPUs.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-11-06 10:21:53 -04:00
Flavio Ceolin
af2def14d8 pm: Document missing parameter in exit post ops
info parameter was not properly documented.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-11-06 10:21:53 -04:00
Flavio Ceolin
bd83a46a56 pm: policy: residency: Support multiple CPUs
Each CPU can have its own set of states. Update the policy to get them
from DT and account it when return the best state to the kernel.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-11-06 10:21:53 -04:00
Flavio Ceolin
dd152c2b89 pm: policy: Add cpu information in the API
On multicore environments the policy may need to know which CPU is
idle.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-11-06 10:21:53 -04:00
Flavio Ceolin
9765e93064 pm: Track power state per cpu
Currently power management subsystem uses a global variable to hold
power state. On multicore environment this is a problem and we have to
have this information per core.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-11-06 10:21:53 -04:00
Flavio Ceolin
e05247a789 pm: Change post_ops_done type to boolean
Boolean is more appropriate to this variable and it is aligned with
Zephyr's code guideline.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-11-06 10:21:53 -04:00
Guillaume Lager
ec0d5b6e8d driver: modem: Fix mux device name comparison
CONFIG_UART_MUX_DEVICE_NAME is used as a prefix for the uart muxes
name. Pointer comparison will always return false

Fix #39774

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-11-06 10:20:42 -04:00
Jair Jack
8e95b95bb4 drivers: modem: gsm: Fix to COPS cmd parse info
drivers: modem: gsm: Quectel EC21 and BG9x act as a gsm modem without
problem, but COPS commands can returns just one value with 'mode'.

Format and oper are not mandatory. This modification reads 'mode'.
Also a modification on modem_cmd_read_cops_cmd is needed.

Signed-off-by: Jair Jack <jack@icatorze.com.br>
2021-11-06 10:20:11 -04:00
Andrzej Głąbek
cd2236c199 samples: hci_spi: Decrease maximum number of BT connections
With the maximum number set to 20, the sample fails to build for
both platforms set as allowed for this sample and mentioned in its
documentation, i.e. 96b_carbon_nrf51 and nrf51dk_nrf51422 (a build
attempt ends up with an SRAM region overflow). Use a lower number
to prevent this failure and set both those boards as integration
platforms, so that such problem, if it was to appear again, could be
caught by CI.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-11-06 13:54:08 +01:00
Johan Lundin
bc0db8931c Bluetooth: Host: Set SID in bt_le_per_adv_sync_recv_info
Sets SID in bt_le_per_adv_sync_recv_info when host receives
a Periodic Advertising Report

Signed-off-by: Johan Lundin <johan.lundin@nordicsemi.no>
2021-11-06 00:41:28 +02:00
Lingao Meng
b29ce22a96 Bluetooth: Mesh: Fix incorrect write conn_count
When Device use pb-gatt bearer provisioning, and first
provisioning failed due to some reasons(invalid oob etc..).

Which cause `proxy:gatt_disconnectd` incorrected write `conn_count`

Cause this var euqals `-1`.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-11-05 14:29:27 -04:00
Sylvio Alves
1bd54d6f11 docs: remove deprecated I2C references
As from this PR, Zephyr has no I2C_X references
and this notes presented in the documentation
can be removed.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-05 14:07:09 -04:00
Sylvio Alves
ab91612a6d driver: esp32: I2C code refactoring
Use i2c_hal functions to enable support for
multiple SoCs.

Use DT compat to enable I2C from device
tree configuration

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-05 14:07:09 -04:00
Sylvio Alves
0931dd1d53 boards: faze: remove invalid defconfig
Removes invalid I2C defconfig in this board, as
config I2C_x is not implemented.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-05 14:07:09 -04:00
Sylvio Alves
3c34e156d9 boards: arduino: remove unused I2C config
Arduino Nano 33 board has undefined I2C_0 and I2C_1
configs. This removes it as I2C_TWIN kconfig already
handles it by its DTS file.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-05 14:07:09 -04:00
Henrik Brix Andersen
6cc536daa8 boards: riscv: neorv32: minor documentation improvements
Add a few minor improvements to the NEORV32 board documentation based on
community feedback.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-11-05 12:18:30 -05:00
Daniel N. Hansten
48a1e76e83 drivers: led: pca9633: add support for multiple devices
PCA9633 driver does not cunnetly support multiple devices.
Updated the driver to use DT_INST_FOREACH_STATUS_OKAY to
configure all devices defined in the device tree.
Convert driver to use `i2c_dt_spec` helpers.

Fixes #40076

Signed-off-by: Daniel N. Hansten <dnh2000@gmail.com>
2021-11-05 10:27:48 -05:00
Anas Nashif
6432289baf tests: add integration_platforms to socket/tls test
Run only on defined integration platforms in CI.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-05 09:23:41 -04:00
Bradley Bolen
6336cb26d8 libc: minimal: Use new ZRESTRICT macro
This lets the toolchain header files determine how to use "restrict"
instead of having that decision down in the minimal libc library.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2021-11-05 13:29:31 +01:00
Nicholas Lowell
c00b85b0e9 posix: semaphore: use ZRESTRICT
To better handle all possible definitions of restrict
or __restrict keyword and avoid redefinition errors, use
the ZRESTRICT pre-processor defined in toolchain.h

Signed-off-by: Nicholas Lowell <nlowell@lexmark.com>
2021-11-05 13:29:31 +01:00
Nicholas Lowell
0d31403318 toolchain: define ZRESTRICT for restrict aliasing
restrict keyword is not supported in C++, however
GNUC does support __restrict for C/C++ so we can use that,
however the complexity of toolchains requires a ZRESTRICT
symbol that should be used throughout the codebase to not
cause any conflicts or redefinition errors

Signed-off-by: Nicholas Lowell <nlowell@lexmark.com>
2021-11-05 13:29:31 +01:00
Gerard Marull-Paretas
4ae9fb6ce5 ci: doc-publish: fix run condition syntax
To restrict the job to the upstream repository a new `if` entry was
added, however, another `if` was already present (violates yaml).
Combined the conditions into a single expression.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-05 08:23:06 -04:00
Dino Li
963d05bd52 timer: it8xxx2: enable free run timer overflow interrupt
The ISR will be called on each overflow.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-11-05 03:03:16 -04:00
Martí Bolívar
612409d39d doc: west 0.12 docs
Update the documentation for this release.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-11-04 19:30:42 -04:00
Johann Fischer
b52c60188d manifest: update hal_nordic revision
Updates hal_nordic revision to fix spurious USBPWRRDY events.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-04 19:24:10 -04:00
Sylvio Alves
27e44acda1 clock: esp32: unify clock control for all espressif socs
This joins all clock control handling to same source
by using hal clock functions. It also brings ESP32C3
clock support.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-04 15:21:26 -04:00
Carlo Caione
2c08114c27 ipc_service: mi: Convert to device driver
As part of the work to support multiple IPC instances / backends using
IPC service, the static vrings mi code must be reworked to resemble a
classic device driver.

Fix also the sample using it.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-11-04 18:03:16 +01:00
Carlo Caione
086801ca2e ipc: ipc_service: Add support for multiple instances
The IPC service code is currently assuming that only one IPC instance
does exist and the user can use the IPC service API to interface with
that singleton instance.

This is a huge limitation and this patch is trying to fix this
assumption introducing three major changes to the IPC service API:

- All the IPC instances are now supposed to be instantiated as a struct
  device. A new test is introduced to be used as skeleton for all the
  other backends.

- ipc_service_register_backend() is now removed (because multiple
  backends are now supported at the same time).

- All the other ipc_service_*() functions are now taking a struct device
  pointer as parameter to specify on which instance the user is going to
  act and operate.

In this patch the documentation is also extended to better clarify the
terminology used.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-11-04 18:03:16 +01:00
Gerard Marull-Paretas
3b4515a6e9 doc: doxyfile: remove redundant predefinitions
PM related pre-definitions are not required, so remove them.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00
Gerard Marull-Paretas
ac0925ae21 pm: device: rename INIT_PM_DEVICE_RUNTIME
Rename the macro used to initialize the runtime fields to
Z_PM_DEVICE_RUNTIME_INIT (emphasize it is internal and follows parent
macro naming).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00
Gerard Marull-Paretas
f01007c0cb pm: state: make helper macros internal
Some macros were helpers for the state initializers (e.g. to assist
UTIL_LISTIFY). In order to make the API more clear, they have been
prefixed with Z_ to emphasize they are internal and they have also been
removed from documentation.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00
Gerard Marull-Paretas
a9af6b023a pm: device: add missing return code to pm_device_state_get
-ENOSYS can be returned if the device does not support PM.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00
Gerard Marull-Paretas
6d7e864714 pm: device: remove redundant initialization field
Z_PM_DEVICE_INIT is used as a static initializer, so all non-specified
fields will already be set to zero.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00
Gerard Marull-Paretas
6bb9cab0ef pm: device: hide struct pm_device from docs
This structure is meant for internal usage, same as its initializer.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00
Gerard Marull-Paretas
042297b298 pm: device: improve wakeup API docs
Improve the Doxygen docs for the pm_device_wakeup* APIs.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00
Gerard Marull-Paretas
59c0bd3050 pm: device: add dummy implementation for wakeup API
Add a dummy implementation for the wakeup API, so that it can still be
used when no PM_DEVICE is enabled.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00
Gerard Marull-Paretas
b51b85f3e7 pm: device: improve pm_device_busy* APIs docs
Make the API docs more concise.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00
Gerard Marull-Paretas
dc0b337a7c pm: device: remove internal comment
The comment provides internal details which are not relevant.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00
Gerard Marull-Paretas
793c8ddd63 pm: device: hide internal flags from public docs
The PM flags are only used internally, so there is no need to include
them in the documentation.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00
Gerard Marull-Paretas
b5e1ec60be pm: device: adjust flag names
Some flags were using `FLAGS` instead of `FLAG`.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00
Gerard Marull-Paretas
e433c56349 pm: device: remove unused flag
PM_DEVICE_FLAG_COUNT is not used, so remove it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00
Gerard Marull-Paretas
2a6aca1dd6 pm: device: document deprecated functions and macros
Document the deprecated functions and macros, tag them with @deprecated
command to inform about the replacement.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00
Gerard Marull-Paretas
aa5b1d5503 pm: state: use code/endcode for code examples
Enclode code examples using code/endcode Doxygen commands.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00
Gerard Marull-Paretas
4daf285c8c pm: cleanup Doxygen groups and inclusion
- Add a new `subsys_pm` group, part of `subsys`
- Improve group naming
- Include conditional code using __DOXYGEN__, it allows to have better
  control of inclusion.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00
Gerard Marull-Paretas
c8814f639e doc: doxygen: add group definition file
Add an external group definition file. It can be used to create high
level group for things like subsystems, as there is no header such as
"subsys.h" where these type of logical groups can be defined.

This approach is followed by projects such as pipewire to organize
Doxygen modules.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-04 16:49:08 +01:00