Commit graph

15409 commits

Author SHA1 Message Date
Hao Luo
7090605026 drivers: pinctrl: Add pinctrl driver for Apollo510 SoCs
This commit adds pinctrl support for Apollo510 SoCs,
and unified pinctrl bindings across apollo families.

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-04-21 20:04:31 +02:00
Phi Bang Nguyen
7a1285efe5 drivers: video: Add support for controls of menu types
Add support for controls of menu types, standard menu and drivers'
defined menu.

Rework the ov5640's test pattern and power line frequency controls using
this new support.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2025-04-21 20:03:31 +02:00
Phi Bang Nguyen
3378d683e9 drivers: video: Add support for composite controls
For controls that are dependent from others, we need to "cluster" them.
Whenever one or more controls of the same cluster are set or gotten,
only the callback of the 1st control of the cluster, i.e. the master
control, is called. The master control is the one that represents the
whole cluster.

A common type of control cluster is "auto"-cluster, e.g. auto_gain/gain,
auto_exposure/exposure, auto_white_balance/red_balance/blue_balance,
etc. If the cluster is in automatic mode, then the manual controls are
marked inactive and volatile which are read via get_volatile_ctrl().
If the cluster is put in manual mode, then the manual controls should
become active again and the volatile flag is cleared.

Re-implement the ov5640's autogain/analogue_gain controls with the new
auto cluster mechanism so that it work correctly and fully.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2025-04-21 20:03:31 +02:00
Phi Bang Nguyen
cbf104f3d0 drivers: video: Add get_volatile_ctrl driver's API
Add get_volatile_ctrl() driver's API to retrieve the current value of a
control marked as volatile, e.g. gain, exposure. This function triggers
a hardware register reading instead of returning a cached value to ensure
that users always get a fresh value which is constantly updated by the HW.

Note that the driver is responsible for marking a control as volatile by
setting VIDEO_CTRL_FLAG_VOLATILE when registering a control because not
all hardwares work the same way for the same control.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2025-04-21 20:03:31 +02:00
Phi Bang Nguyen
f363bd6e36 drivers: video: Support controls of 64-bit integer type
Add supports for controls that need 64-bit integer such as pixel rate.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2025-04-21 20:03:31 +02:00
Phi Bang Nguyen
c95387a815 drivers: video: Add video query control API
Application can query information about a control given the control id,
the framework fill the rest of the structure. Application can also
enumerate all kinds of device's supported controls by iterating with
VIDEO_CTRL_FLAG_NEXT_CTRL on the same API.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2025-04-21 20:03:31 +02:00
Phi Bang Nguyen
135528a1be drivers: video: Implement video control framework
Implement the video control framework with the following features:

- Drivers initialize the control with a valid value range at boot which
  guides the application developer and the framework. Hence, the video
  framework could do all common works for drivers e.g., sanity check.

- Controls need to be cached to memory. Video framework handles
  get_ctrl(), drivers don't need to implement this API. It is because
  reading control value directly from registers are not only inefficient
  but also sometimes impossible, e.g. controls that scatter through
  several registers. Only "volatile" control needs to be updated at
  runtime.

- Only the devices (e.g., sensors) owning the controls need to
  implement set_ctrl(). Other devices of the pipeline do not need to
  propagate set_ctrl() and hence, do not need to implement this API

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2025-04-21 20:03:31 +02:00
Tom Burdick
1e0af58b51 pmci: Move MCTP into the PMCI subsys
PMCI conveys a stack of specifications from DMTF including MCTP (a
transport layer protocol), PLDM (request/response messaging protocol),
and ancillary SPDM messaging. Placing all these libraries under PMCI
subsystem makes more sense than simply adding MCTP as its own subsystem.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2025-04-21 12:43:33 +02:00
Julian Achatzi
f9168ae464 arch: common: Make nocache region loadable
The `nocache` is not loadable, thus data stored therein cannot be
initialized by the startup code. This might be needed in special
cases. E.g. One might have a buffer which one wants to DMA into,
and which is a member of a struct. Other members of the struct one
may want to have initialized by the startup code.
The buffer thus should be placed in the `nocache` region, but for
the other members of the buffer to be initialized by the startup
code, the `nocache` region needs to be loadable.

Fix it by making the `nocache` region loadable. Adding a KConfig
symbol to do this optionally was considered, but deemed unnecessary
during the PR.

Signed-off-by: Julian Achatzi <mail@achatzi.pro>
2025-04-21 12:42:19 +02:00
Krzysztof Chruściński
5a313e141d pm: Add option to quickly detect power state availability
When all states are locked or latency requirement cannot be met
by any power state it is important to be able to quickly exit
suspend procedure because that usually means that application
requires high performance. Add function for detecting if any
power state is available.

Additionally, add function pm_policy_state_is_available for
checking if given state is available which means that it is not
locked and fulfills current latency requirement.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-04-21 07:45:07 +02:00
Anas Nashif
a97881fd63 doc: doxygen: move usermode mutex/sem under usermode group
Move usermode mutex/semaphore under the usermode group.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-18 17:46:50 +02:00
Anas Nashif
8fe2395103 doc: doxygen: add @brief to few APIs
Add some clarity to some of the groups using @brief.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-18 17:46:50 +02:00
Anas Nashif
3dc7291115 doc: doxygen: move notify/onoff to os_services
Those are no kernel permitives and belong under os services.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-18 17:46:50 +02:00
Anas Nashif
9babde4e78 doc: doxygen: move battery api under sensors
move from currently top level to sensors where it is defined.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-18 17:46:50 +02:00
Anas Nashif
b18995acd9 doc: stmesp: move to logging group
Move under logging group.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-18 17:46:50 +02:00
Anas Nashif
ec405a8632 doc: doxygen: group debugging APIs
Create new group for debugging and move all debugging APIs under this
group.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-18 17:46:50 +02:00
Ryan McClelland
26c03005e7 drivers: i3c: fix warning with cpp builds
When compiling with C++ enabled (CONFIG_CPP), add an unused member to
prevent an empty struct; this makes the struct size the same for both C
and C++.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2025-04-18 10:40:18 +02:00
Emil Gydesen
4a0ddbefe0 include: Bluetooth: Add missing includes for all BT host files
Added missing includes and fixed typos in the header files
for Bluetooth.

There is one exception in hci_vs.h where `struct arch_esf`
is still missing an include, but that is because that
is only specific for ARM.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-17 21:17:29 +02:00
Krzysztof Chruściński
ecabcf5db5 pm: Use pointers for current and forced power states
Use power state pointers instead of copies which improves performance.

Align power_mgmt_multicore test which was creating pm states in
runtime.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-04-17 21:17:18 +02:00
Ryan McClelland
c0503597ba drivers: i3c: add rstdaa direct helper
In I3C v1.0, there was a RSTDAA direct CCC. It is deprecated in I3C v1.1
and later. This adds a CCC helper for it.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2025-04-17 21:16:45 +02:00
Ryan McClelland
2e8c911fa3 drivers: i3c: add v1.0 support flag
This adds a v1.0 support dts flag for devices. This also makes it so it
doesn't try to send a GETCAPS (GETHDRCAP) ccc if this flag is set and it
doesn't support any HDR modes.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2025-04-17 21:16:45 +02:00
Aleksandr Khromykh
b53b5e198a bluetooth: rename _bt_gatt_ccc and clarify usage
Bluetooth had two public types with similar name _bt_gatt_ccc and
bt_gatt_ccc, but for absolutely different purposes.
That caused misunderstanding of relationship of them and cases
where to use which one.

Commit changes name of _bt_gatt_ccc to more suitable by usage and
improves documentation of it.

Additionally, it changes name of BT_GATT_CCC_INITIALIZER
to correspond the type name.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-04-17 17:24:19 +02:00
Martin Durietz
3197be97e6 lorawan: add link check support.
Add link check support, by adding:
- link check callback in response of LinkCheckAns.
- link check request function using LinkCheckReq.

Signed-off-by: Martin Durietz <martin.durietz@gmail.com>
2025-04-17 17:23:12 +02:00
Ryan McClelland
2c66a2adc0 drivers: i3c: add i3c controller and target kconfigs
I3C can contain a lot of features that may be unused. Add Kconfigs for
enabling controller and/or target code. Choosing just one can reduce
the code size footprint.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2025-04-17 09:05:36 +02:00
Aditya Bhutada
4102010456 drivers: espi: Add return value to eSPI send_vwire API
Added note about return value to the eSPI send_vwire API in the header:
-ETIMEDOUT & _EINVAL.

Signed-off-by: Aditya Bhutada <aditya.bhutada@intel.com>
2025-04-17 00:57:28 +02:00
Daniel Leung
277fa9e8ac xtensa: userspace: swap page tables via assembly code
Since the necessary register values are now pre-computed and
stored in the memory domain struct, we can use them directly
in various assembly locations, thus replacing the function
call to xtensa_swap_update_page_tables().

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-04-17 00:57:19 +02:00
Daniel Leung
689e1121cf kernel: typedef k_mem_domain_t and _mem_domain_info_t
Create alias for struct k_mem_domain into k_mem_domain_t,
and struct _mem_domain_info into _mem_domain_info_t via
typedef. These are needed to generate offsets via
GEN_OFFSET_SYM.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-04-17 00:57:19 +02:00
Daniel Leung
2abf7ce2f1 xtensa: userspace: prevent potential privilege escalation
When context switching and dealing with non-nested interrupts,
the context to be restored are saved in the thread stack.
When userspace is enabled, this means saving context into
the user stacks for user threads. This allows PS values to be
manipulated externally by setting PS.RING in the saved PS
value to 0, resulting in granting kernel access privilege when
the thread is restored. To prevent this, we store the PS value
into the thread struct instead, where user threads cannot
manipulate that. Note that nested interrupts and syscalls are
not using the user stack but the interrupt stack and thread
privileged stack respectively, where they are not accessible
under user mode.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-04-17 00:57:19 +02:00
Daniel Leung
d5c2e4b03c xtensa: userspace: workaround return PC calc with loops
When syscall assembly is executed, the EPC points to the syscall
instruction, and we have to manually advance it so we will
return to the instruction after syscall to continue execution.
However, with zero-overhead loops and the syscall instruction is
the last instruction, this simple addition does not work as it
would point past the loop and would have skipped the loop.
Because of this, syscall entrance would need to look at the loop
registers and set the PC back to the beginning of loop if we are
still looping. Assuming most of the syscalls are not inside
loops, the extra handling code consumes quite a few cycles.
To workaround this, simply adds a nop after syscall so we no
longer have to deal with loops at syscall entrance, and that
a nop is faster than all the code to manipulate loop registers.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-04-17 00:57:19 +02:00
Daniel Leung
0dce0bdc0b xtensa: userspace: pre-compute MMU registers at domain init
Instead of computing all the needed register values when
swapping page tables, we can pre-compute those values when
the memory domain is first initialized. Should save some
time during context switching.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-04-17 00:57:19 +02:00
Keith Packard
9398174340 kernel: Unify .ctors and .init_array handling
Handle both of these sections in a single chunk of code instead of
separately. We don't need to use the legacy .ctors ABI as both
the constructors array and startup logic are managed within a single
link result.

This can now also be used with ARC MWDT which had been using the .ctors
sections but with .init_array semantics. For ARC MWDT, we now always
discard .dtors and .fini sections as Zephyr will never cause global
destructors to execute. Stop discarding .eh_frame sections so that
exception handling works as expected.

When building a NATIVE_APPLICATION, we ask the native C library to run all
of the constructors to ensure any non-Zephyr constructors are run before
main is invoked. It might be "nice" to split the constructors so that the
Zephyr constructors were executed by the Zephyr code while the non-Zephyr
ones were executed by the native C library. I think that could be done if
we knew the pathnames of either the Zephyr or non-Zephyr files. That might
make a good future enhancement.

Signed-off-by: Keith Packard <keithp@keithp.com>
2025-04-16 20:36:27 +02:00
Arnaud Pouliquen
9dec55e107 arch: arm: mmu: add missing includes
The samples/subsys/llext/shell_loader test fails when running as a
twister test on the stm32mp135f_dk/stm32mp135fxx platform, with the
following error:

zephyr/include/zephyr/arch/arm/mmu/arm_mmu.h:112:9:
error: unknown type name 'uintptr_t'

This commit adds the necessary includes to define the missing types.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2025-04-16 17:08:37 +02:00
Jukka Rissanen
4c01b37bda net: pkt_filter: Add VLAN support to filtering
The Ethernet matching needs tweaking so that it will also
work with VLAN packets.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-16 08:07:34 +02:00
Jukka Rissanen
f5bac38865 net: pkt_filter: Add enablers for shell support
Add helpers and enablers that allow "net filter" shell command to
work.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-16 08:07:34 +02:00
Jukka Rissanen
cde70232b9 net: pkt_filter: Add statistics support to packet filter
As the network packet filter drops packets without any indication
that the packet is dropped, it can be difficult to monitor what
is going on in the system when receiving data. The user can
now monitor the statistics and see if packets are being dropped
because of packet filter activity.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-16 08:07:34 +02:00
Tom Hughes
d024158d83 include: linker: Add missing symbols needed for LLVM's libunwind
LLVM's libunwind needs eh_frame_start/eh_frame_end and
eh_frame_hdr_start/eh_frame_hdr_end symbols.

See
80267f8148/libunwind/src/AddressSpace.hpp (L73-L103)

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-04-16 01:10:50 +02:00
Emil Gydesen
2420b61037 include: arch: ffs: include toolchain/common.h
Add an include of toolchain/common.h for the ALWAYS_INLINE
macro.

This is a general issue in many files across Zephyr, specifically
for the ALWAYS_INLINE macro, but for simplicity this commit
only includes it for this file as that has been shown to
cause compilaion issues without it.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-15 15:33:33 +02:00
Francois Ramu
95728178f5 include: bindings: stm32wba clock domain definition
Add the clock domain definition for the stm32wba CCIPR

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-04-15 15:33:15 +02:00
Chris Friedt
c46f7f54e8 doc: kernel: threads: add dynamic thread stack docs
Add documentation to indicate that, aside from static thread
stack allocation, Zephyr supports dynamically allocated thread
stacks.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-04-14 23:06:41 +02:00
Chris Friedt
582c98344f kernel: revise doc for k_thread_stack_alloc and k_thread_create
Update the kernel API doxygen for k_thread_stack_alloc() and
k_thread_create() to convey that kernel thread stacks may be
dynamically allocated as an alternative to static allocation.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-04-14 23:06:41 +02:00
Utsav Munendra
fd8abcff37 portability: cmsis: Avoid copying objects names into control block
Instead, just store the pointer to the string provided as part of the
RTOS object init attributes.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-04-14 20:03:19 +02:00
Utsav Munendra
e676bf3d35 portability: cmsis: Store thread name within Zephyr k_thread
Use underlying Zephyr thread directly to store thread name instead of
storing the name in CMSIS control block. Also, allow `osThreadGetName`
to work within ISR, as expected from spec.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-04-14 20:03:19 +02:00
Jordan Yates
ab34a9df48 zbus: remove k_malloc dependency for ZBUS_RUNTIME_OBSERVERS
Remove the dependency on the system heap existing when enabling
`ZBUS_RUNTIME_OBSERVERS`. Instead the previously allocated memory is
required to be provided to `zbus_chan_add_obs` (which can still be
allocated through malloc).

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-14 20:03:09 +02:00
Fin Maaß
ddefc4222b storage: flash_map: add flash_area_copy()
add flash_area_copy() function based on
flash_copy().

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-14 16:07:35 +02:00
Théo Battrel
2158f4897d include: util: Add util_eq and util_memeq
`util_eq` compare two memory areas and their length. It returns true if
they are equal, else false.

`util_memeq` the first n bytes of two memory areas. It returns true if
they are equal, else false.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2025-04-14 16:06:38 +02:00
Josuah Demangeon
90b23bfd58 drivers: video: formats: add grayscale formats
Add the grayscale formats in the same packing as defined by MIPI.
The Linux V4L2 naming is preserved.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-04-14 11:49:49 +02:00
Josuah Demangeon
8ae185561c drivers: video: formats: include bayer 10/12/14-bits formats
In addition to the 8-bit, introduce all the other bayer formats
described by MIPI-CSI2 specification. The 8-bit bayer formats
description is shortened to just 4 bytes like the other formats,
to help intuition while comparing the different formats.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-04-14 11:49:49 +02:00
Josuah Demangeon
2c5ec1cc07 drivers: video: improve the format description docs
@verbatim shows the leading comment '*' fence in the output.
@code{.unparsed} allows extracting the text only.
In some formats, the pixels are also not immediately packed into fixed
number of bytes, like YUYV due to chroma subsampling. Disambiguate.
Add numbers marks on top to help identify the individual pixels.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-04-14 11:49:49 +02:00
JP Hutchins
fe6366b804 lib: crc: add CRC-32K/4.2
This adds the best HD=4 CRC32 polynomial. The discovery
is the result of research by Philip Koopman of Carnegie
Mellon University, and is well documented at
https://users.ece.cmu.edu/~koopman/crc/.

The user is given the option of trading 1024B of RAM to
improve the execution speed. The unit tests are parameterized
with this KConfig option.

Signed-off-by: JP Hutchins <jp@intercreate.io>
2025-04-14 09:49:02 +02:00
Simone Orru
bb39048cc2 uuid: Add UUID utilities
Add UUID generation and parsing utilities compliant
with RFC9562.

Signed-off-by: Simone Orru <simone.orru@secomind.com>
2025-04-14 09:47:26 +02:00