Commit graph

15409 commits

Author SHA1 Message Date
Fabio Baltieri
bd8cee8683 drivers: input: add an analog-axis driver
Add an input driver to read data from an analog device, such as a
thumbstick, connected to an ADC channel, and report it as an input
device.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-01-10 15:05:35 +01:00
Yong Cong Sin
abb21d48d9 posix: semaphore: implement sem_open(), sem_unlink() & sem_close()
Implements `sem_open()`, `sem_unlink()` & `sem_close()`
functions and added tests for them.

Updated existing tests and POSIX docs.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-01-10 07:18:19 -05:00
Shane Snover
e49d174be9 driver: usb: change function parameter name from class to base_class.
Change function parameter name in function usbd_device_set_code_triple
from `class` to `base_class` as `class` is a keyword in C++.

Signed-off-by: Shane Snover <ssnover95@gmail.com>
2024-01-10 11:08:11 +01:00
Ricardo Rivera-Matos
7d51b7cdc1 charger: Adds input current notifier properties
Some charger devices (such as BQ25710 and ISL9241) issue
notifications to the system via a dedicated line (such as
the PROCHOT signal on x86 platforms) to almost instantly
throttle the system load to prevent a brownout event.

This patch introduces two properties to configure two
distinct input current notification events of different
severity.

Signed-off-by: Ricardo Rivera-Matos <ricardo.rivera-matos@cirrus.com>
2024-01-10 09:59:41 +01:00
Ricardo Rivera-Matos
f7d6c4f439 charger: Adds CHARGER_PROP_INPUT_REGULATION_VOLTAGE_UV prop
Adds support for setting a falling input voltage limit regulated
by an analog loop. Under heavy loads the analog loop will throttle
the charge current to prevent the power source from crashing.

Signed-off-by: Ricardo Rivera-Matos <ricardo.rivera-matos@cirrus.com>
2024-01-10 09:59:41 +01:00
Ricardo Rivera-Matos
45232aeaa2 charger: Adds CHARGER_PROP_INPUT_REGULATION_CURRENT_UA prop
Adds support for setting the target threshold for an input current
limit regulated by an analog loop. The analog loop responds by
throttling the charge current limit as necessary.

These are distinct from comparator based overcurrent protection
thresholds that isolated the charger from the power source when
triggered.

Signed-off-by: Ricardo Rivera-Matos <ricardo.rivera-matos@cirrus.com>
2024-01-10 09:59:41 +01:00
Anas Nashif
37f427a5c7 arch: introduce arch_smp_init
Introduce a new arch interface for intializing smp.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-01-09 10:00:17 +01:00
Daniela Andreea Dumitrache
3bfb2e3ab2 Bluetooth: Audio: Add implementation for PBP and dedicated sample apps.
PBP API allows sources to create a Public Broadcast Announcement.
PBP API to parse a Public Broadcast Announcement.

public_broadcast_source application starts extended advertising and
includes a Public Broadcast Announcement. The advertised broadcast
audio stream quality will cycle between high and standard quality.

public_broadcast_sink application scans for broadcast sources and
synchronizes to the first found source which defines a Public Broadcast
Announcement including a High Quality Public Broadcast Audio Stream
configuration.

Add bsim tests for Public Broadcast Profile APIs.

Add shell implementation for Public Broadcast Profile APIs.

Signed-off-by: Daniela Andreea Dumitrache <danielaandreea.dumitrache@nxp.com>
2024-01-09 09:59:23 +01:00
Gerard Marull-Paretas
0106e8d14c arch: riscv: introduce RISCV_PRIVILEGED
Introduce a new arch level Kconfig option to signal the implementation
of the RISCV Privileged ISA spec. This replaces
SOC_FAMILY_RISCV_PRIVILEGED, because this is not a SoC specific
property, nor a SoC family.

Note that the SoC family naming scheme will be fixed in upcoming
commits.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-01-09 09:40:07 +01:00
Piotr Pryga
4d0ef142f3 Bluetooth: services: Add HRS notification changed app callback
It is useful for an application to be informed when there is
a subscriber waiting for HRS service notification.
Extend HRS service API and add required code to service implementation.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2024-01-08 15:34:20 +02:00
Jai Arora
5c34726ab1 posix: patch to implement get_pid function
patch to implement get_pid function

Signed-off-by: Jai Arora <infolinesoni@gmail.com>
2024-01-08 12:44:45 +01:00
Jai Arora
a3573a9e30 posix: implement clock_getcpuclockid function
Implements clock_getcpuclockid function

Fixes #59954

Signed-off-by: Jai Arora <infolinesoni@gmail.com>
2024-01-08 12:44:45 +01:00
Mathieu Choplain
991a85361e llext: use generic attributes instead of GCC's
Replace the GCC-syntax attributes used for LL_EXTENSION_SYMBOL
with the toolchain-independent versions provided in toolchain.h

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2024-01-08 10:10:28 +01:00
Mathieu Choplain
5993192ec1 llext: fix incorrect elf64_sym structure
The elf64_sym structure was defined as having the members order
as the elf32_sym structure, which is incorrect.

Use the correct layout as defined by the ELF specification
(see https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.symtab.html)

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2024-01-08 10:10:28 +01:00
Jonathan Rico
79e86472c3 Bluetooth: L2CAP: clarify BT_L2CAP_STATUS_OUT
Makes it clearer what that bit means:
If set, the channel has capacity to send at least one PDU.

If unset, the channel ran out of credits and won't be able to send
anything until the peer sends credits back.

Also add debug logs.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-01-05 14:30:18 +01:00
Bartosz Bilas
7ef10d0f71 drivers: regulator: add regulator-init-microamp property
It allows setting regulator current value during driver
initialization automatically.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2024-01-05 09:07:10 +01:00
Emil Gydesen
87c8b897b3 include: util: Add mem_xor functions
Add functions to do XOR on arrays of memory, with one that
takes arbitrary sizes and one for 32 bits and 128 bits as
those are common sizes for this functionality.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-05 09:06:36 +01:00
Eduardo Montoya
5767998d4f drivers: ieee802154: nrf: make selective tx power the default
Remove `IEEE802154_SELECTIVE_TXPOWER` option.

Cache the tx power value in nRF5 driver and make use of it on each
operation.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2024-01-05 09:04:17 +01:00
Chekhov Ma
81cf8db0ed soc: imx93: enable lpspi
- Add LPSPI1 ~ LPSPI8 instances to soc dtsi.
- Expand clock dt-bindings for LPSPI to instance 7 & 8.
- Add LPSPI driver in imx9 Kconfig.

Signed-off-by: Chekhov Ma <chekhov.ma@nxp.com>
2024-01-05 09:01:55 +01:00
Chekhov Ma
4a82128c69 soc: imx93: enable lpi2c
- Add LPI2C1 ~ LPI2C8 instances to soc dtsi.
- Expand clock dt-bindings for LPI2C to instance 7 & 8.
- Add LPUART and LPI2C driver in imx9 Kconfig.

Signed-off-by: Chekhov Ma <chekhov.ma@nxp.com>
2024-01-05 09:01:55 +01:00
Henrik Brix Andersen
21e37498e3 Bluetooth: Audio: fix doxygen warnings
Fix doxygen warnings ("warning: found </em> tag without matching <em>")
from building the Bluetooth Audio API documention.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-01-04 13:55:12 +01:00
Rodrigo Peixoto
c992707251 zbus: add priority boost feature
Replace mutexes with semaphores to protect the channels in conjunction with
a priority boost algorithm based on the observers' priority.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2024-01-04 09:41:54 +01:00
Christopher Friedt
95a22b1217 posix: clock: clock_gettime() should not be a syscall
We try to implement Zephyr's POSIX API as regular library
functions, so remove the __syscall annotation from
clock_gettime() and implement the syscall portion of it under
the hood.

This also adds a bit of a micro-optimization in that
we can do a lot of processing outside of the system call.

In fact, processing CLOCK_MONOTONIC likely does not
require any syscall other than k_uptime_ticks().

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-04 08:27:29 +09:00
Christopher Friedt
42335036b7 include: util: add array for-each macros
AFAIK, we do not have array for-each loops. Seemed like an
obvious gap to fill, so introduce two variants:

* ARRAY_FOR_EACH(array, idx_var)
* ARRAY_FOR_EACH_PTR(array, ptr_var)

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-04 08:27:29 +09:00
Robert Lubos
898aa9ed9a net: sockets: tls: Align DTLS connect() behavior with regular TLS
DTLS socket is not really connection-less as UDP, as it required the
DTLS handshake to take place before the socket is usable. Therefore,
align the DTLS connect() behavior with regular TLS.
The change is backward compatible. connect() call is still optional for
DTLS socket (the handshake can still take place from send()/recv()) and
a socket option was provided to disable DTLS handshake on connect().

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-03 19:00:15 +00:00
Bjarki Arge Andreasen
ed8578d566 pm: device_runtime: Add missing include to header
The device_runtime header includes references to struct device
and k_timeout_t, but only zephyr/device.h is included. k_timeout_t
is in zephyr/kernel, so it must also be included.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-03 17:24:42 +00:00
Jan Müller
8f0abaf87f Doc: Clearify bt_conn_set_security documentation
Clearify the sec parameter in the documentation of bt_conn_set_security.

This should make the API documentation easier to understand.

Signed-off-by: Jan Müller <jan.mueller@nordicsemi.no>
2024-01-03 10:21:48 +01:00
Bjarki Arge Andreasen
f9491034be modem: modem_cellular: Update driver to implement cellular API
Move the implementations of the cellular API in modem_cellular.c
to an cellular_driver_structure, and implement this API structure
withing the device drivers.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-03 10:21:18 +01:00
Bjarki Arge Andreasen
6f55309659 modem: cellular: Restructure cellular API to fit device driver model
The current cellular API header is not written to conform with
the device driver model. This commit fixes that.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-03 10:21:18 +01:00
Junfan Song
4ae558c505 kernel: work: Fix race in workqueue thread
After a call to k_work_flush returns the sync variable
may still be modified by the workq.  This is because
the work queue thread continues to modify the flag in
sync even after k_work_flush returns.  This commit adds
K_WORK_FLUSHING_BIT, and with this bit, we moved the
logic of waking up the caller from handle_flush to the
finalize_flush_locked in workq, so that after waking up
the caller, the workqueue will no longer operate on sync.

Fixes: #64530

Signed-off-by: Junfan Song <sjf221100@gmail.com>
2024-01-03 10:20:19 +01:00
TOKITA Hiroshi
bccd281b3d drivers: interrupt_controller: ra_icu: Adding disconnect_dynamic
Adding `ra_icu_irq_disconnect_dynamic()` corresponds with
`ra_icu_irq_connect_dynamic()`.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2024-01-02 19:12:46 +00:00
Pieter De Gendt
b4cd9c462a sys: util_macro: Add IF_DISABLED
Add the opposite for IF_ENABLED macro.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-12-28 12:06:28 +00:00
Flavio Ceolin
0bf5cbc1c8 syscall_handler: Fix warnings in K_SYSCALL_MEMORY
Put parenthesis around parameters in K_SYSCALL_MEMORY_SIZE_CHECK
to avoid possible warnings during the macro expansion.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-12-28 09:52:15 +01:00
Christopher Friedt
1f67dcbd89 posix: remove deprecated non-standard PTHREAD_MUTEX_DEFINE, etc
Remove the previously deprecated and non-standard macros
* PTHREAD_MUTEX_DEFINE()
* PTHREAD_COND_DEFINE()

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-28 03:40:57 -05:00
Flavio Ceolin
87d056bd31 syscall: Fix static analysis compalins
Since K_SYSCALL_MEMORY can be called with signed/unsigned size types, if
we check if size >= 0, static anlysis will complain about it when
size in unsigned.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-12-27 21:14:31 +01:00
Fabio Baltieri
ff8970318d input: define optional functions when generating documentation
Add a defined(__DOXYGEN__) condition for the optional APIs so that they
get included in the documentation.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-27 16:50:21 +00:00
Fabio Baltieri
4307882dd1 input: kbd_matrix: add actual key mask runtime control
Add an option to enable a input_kbd_matrix_actual_key_mask_set API to
enable or disable keys dynamically in the mask. This can be useful if
the exact key mask is determined in runtime and the device is using a
single firmware for multiple matrix configurations.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-27 16:50:21 +00:00
Chekhov Ma
3f148d6bb4 arch: arm: mmu: generate mmu region entry from devicetree
Many peripherals have multiple instances, whether each of them
are enabled are not known. Adding all available instances into
"mmu_regions" array may not be the best choice.
This commit adds a macro to generate mmu region entry in "mmu_regions"
from devicetree. Used with "DT_FOREACH_STATUS_OKAY_VARGS", it generates
mmu region entry for all nodes enabled and compatiable to a certain
driver.

Signed-off-by: Chekhov Ma <chekhov.ma@nxp.com>
2023-12-27 16:09:42 +00:00
Christopher Friedt
fcd139d7af posix: pthread: support stack sizes larger than 65k
A previous size optimization capped the pthread_attr_t stacksize
property at 65536. Some Zephyr users felt that was not large
enough for specific use cases.

Modify struct pthread_attr to support large stack sizes by
default with the flexibility to allow users to vary the number
of bits used for both stacksizes and guardsizes.

The default guardsize remains zero sinze Zephyr's stack
allocators already pad stacks with a guard area based on other
config parameters, and since Zephyr is already designed to
support both SW and HW stack protection at the kernel layer.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-23 22:29:41 -05:00
Emil Gydesen
547ffdab6e Bluetooth: MICP: Add mic_ctlr_get_by_conn
Add function to get a MICP microphone controller
instance from a connection pointer. This is effectively
the reverse of bt_micp_mic_ctlr_conn_get, and works similar to
bt_vcp_vol_ctlr_get_by_conn.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-12-22 14:41:17 +00:00
Seppo Takalo
071cad2e76 net: lwm2m: Deprecate lwm2m_get/set_u64
Deprecate lwm2m_set_u64() and lwm2m_get_u64 as only
LWM2M_RES_TYPE_S64 exist. Unsigned variant is not defined.

Technically these might have worked OK, but it is undefined
what happens to large unsigned values when those are
converted to various payload formats (like CBOR) that might
decode numbers differently depending of their signedness.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-22 09:54:07 +01:00
TOKITA Hiroshi
2f2d8143f4 dt-bindings: interrupt-controller: ra-icu: Correct event numbers
The 64 is a missing entry in this event number table.
All after the 64th entry have shifted one before.

https://www.renesas.com/jp/ja/document/mah/renesas-ra4m1-group-users-manual-hardware?r=1054146#G17.2544398

I corrected the after of the 64th entry to the correct number.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-12-22 09:52:50 +01:00
Christopher Friedt
a7d2c5cb32 posix: implement pthread_getguardsize() pthread_setguardsize()
Implement pthread_getguardsize() and pthread_setguardsize().

pthread_getguardsize() and pthread_setguardsize() are required
by the POSIX_THREADS_EXT Option Group as detailed in Section
E.1 of IEEE-1003.1-2017. However, they were formerly part of
XSI_THREADS_EXT.

The XSI_THREADS_EXT Option Group was required for PSE51, PSE52,
PSE53, and PSE54 conformance.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-20 14:20:58 +00:00
Christopher Friedt
eb7e4bed98 posix: pthread_attr: use space in struct more efficiently
This change reduces the space occupied by struct pthread_attr
which is the internal type used for pthread_attr_t.

We cap the stack size at 16 bits (so up to 65536 bytes) and
since a stack size of 0 is invalid, we can encode the stack
size by simply subtracting 1 or adding 1 when setting or
getting.

The schedpolicy is capped at 2 bits and initialized,
cancellable, and detached are given 1 bit.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-20 14:20:58 +00:00
Sylvio Alves
2f2ee91947 pinctrl: esp32: move files from hal_espressif to main
ESP32 family pinctrl files are currently placed in hal_espressif.
Move to main branch as part of pinctrl dt-bindings.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-12-20 14:17:49 +00:00
Seppo Takalo
6161fbdf21 net: lwm2m: Transmission state indications
Allow engine to give hints about ongoing CoAP transmissions.
This information can be used to control various power saving
modes for network interfaces. For example cellular networks might
support release assist indicator.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-20 11:57:48 +00:00
Seppo Takalo
01568b573a net: coap: Add API to count number of pending requests
Add coap_pendings_count() that return number of waiting
requests on the pendings array.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-20 11:57:48 +00:00
Laurentiu Mihalcea
897897970b include: dai.h: Add definitions for parsing dai_config's format field
This commit introduces some macros and enums which can
be used to parse struct dai_config's format field. This is
required by the SAI driver since it uses dai_config's format
field to select the protocol, clock configuration and clock
inversion. This is added to the dai.h header to avoid having
to define these macros/enums in each of the DAI drivers.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-12-20 11:15:13 +01:00
Andrei-Edward Popa
ea1cafbee7 drivers: clock_control: Added clock driver for Raspberry Pi Pico
Added clock driver for Raspberry Pi Pico platform

Signed-off-by: Andrei-Edward Popa <andrei.popa105@yahoo.com>
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2023-12-20 11:14:24 +01:00
Johan Hedberg
3fbf12487c kernel: Introduce a way to specify minimum system heap size
There are several subsystems and boards which require a relatively large
system heap (used by k_malloc()) to function properly. This became even
more notable with the recent introduction of the ACPICA library, which
causes ACPI-using boards to require a system heap of up to several
megabytes in size.

Until now, subsystems and boards have tried to solve this by having
Kconfig overlays which modify the default value of HEAP_MEM_POOL_SIZE.
This works ok, except when applications start explicitly setting values
in their prj.conf files:

$ git grep CONFIG_HEAP_MEM_POOL_SIZE= tests samples|wc -l
     157

The vast majority of values set by current sample or test applications
is much too small for subsystems like ACPI, which results in the
application not being able to run on such boards.

To solve this situation, we introduce support for subsystems to specify
their own custom system heap size requirement. Subsystems do
this by defining Kconfig options with the prefix HEAP_MEM_POOL_ADD_SIZE_.
The final value of the system heap is the sum of the custom
minimum requirements, or the value existing HEAP_MEM_POOL_SIZE option,
whichever is greater.

We also introduce a new HEAP_MEM_POOL_IGNORE_MIN Kconfig option which
applications can use to force a lower value than what subsystems have
specficied, however this behavior is disabled by default.

Whenever the minimum is greater than the requested value a CMake warning
will be issued in the build output.

This patch ends up modifying several places outside of kernel code,
since the presence of the system heap is no longer detected using a
non-zero CONFIG_HEAP_MEM_POOL_SIZE value, rather it's now detected using
a new K_HEAP_MEM_POOL_SIZE value that's evaluated at build.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2023-12-20 11:01:42 +01:00