Commit graph

15409 commits

Author SHA1 Message Date
Olivier Lesage
7b61bd6518 bluetooth: gatt: Add BT_GATT_CCC_WITH_WRITE_CB()
Add simple helper macro so users can define a CCCD with a write cb
without having to combine BT_GATT_CCC_MANAGED() and
BT_GATT_CCC_INITIALIZER() themselves.

Unlike the changed callback the write callback has a return value
that can be used to reject the write request.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2025-04-11 16:17:42 +02:00
Jeppe Odgaard
231b2a0c19 drivers: sensor: rename tmp116 to tmp11x
The tmp116 sensor driver also supports tmp117 and tmp119. Therefore rename
to indicate that is supports a range of tmp devices.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-04-11 16:17:35 +02:00
Christoph Winklhofer
a5e295c452 json: improve parsing and serializing of integers
Add support for parsing and serializing of following integer types:
'int8_t', 'uint8_t', 'int16_t', 'uint16_t' and 'uint32_t'.

The generic integer token JSON_TOK_INT and JSON_TOK_UINT, in combination
with the field size (set by JSON_OBJ_DESCR_PRIM) allows to parse different
integer types, for example:

struct foo {
  int64_t i64;
  uint32_t u32;
  int16_t i16;
  uint8_t u8;
};

struct json_obj_descr foo_descr[] = {
  JSON_OBJ_DESCR_PRIM(struct foo, i64, JSON_TOK_INT),
  JSON_OBJ_DESCR_PRIM(struct foo, u32, JSON_TOK_UINT),
  JSON_OBJ_DESCR_PRIM(struct foo, i16, JSON_TOK_INT),
  JSON_OBJ_DESCR_PRIM(struct foo, u8, JSON_TOK_UINT),
};

These tokens also support parsing and serializing enums:

enum unsigned_enum { UA=0, UB=1, UC=2 };
enum signed_enum { SA=-1, SB=0, SC=1 };

struct foo {
  enum unsigned_enum u;
  enum signed_enum s;
};

struct json_obj_descr foo_descr[] = {
  JSON_OBJ_DESCR_PRIM(struct foo, u, JSON_TOK_UINT),
  JSON_OBJ_DESCR_PRIM(struct foo, s, JSON_TOK_INT),
};

Signed-off-by: Christoph Winklhofer <cj.winklhofer@gmail.com>
2025-04-11 06:32:50 +02:00
Christoph Winklhofer
63d33e631c json: support parsing and serializing of strings with char arrays
Support parsing and serializing of struct fields that are defined as a
char array.

Use the token JSON_TOK_STRING_BUF to parse and serialize a string for a
char array, for example:

struct foo {
  const char *str;
  char str_buf[30];
};

struct json_obj_descr foo_descr[] = {
  JSON_OBJ_DESCR_PRIM(struct foo, str, JSON_TOK_STRING),
  JSON_OBJ_DESCR_PRIM(struct foo, str_buf, JSON_TOK_STRING_BUF),
};

The struct 'json_obj_descr' now has an additional union member 'field'
to store the size of the struct field, which is used with the token
'JSON_TOK_STRING_BUF' to determine the element size.

Fixes: #65200
Signed-off-by: Christoph Winklhofer <cj.winklhofer@gmail.com>
2025-04-11 06:32:50 +02:00
Stefan Giroux
651ecab53e drivers: gpio: gpio_mcux_igpio: add pull strength configuration
The i.MXRT10xx series have configurable GPIO pull strengths.

These are available for configuration in the pinctrl system, but not for
regular GPIO use.

This commit adds SOC-series specific GPIO configuration bits for selecting
weak or strong GPIO pulls, similar to drive strengths available from other
GPIO pin configuration examples.

This has been tested on a custom i.MXRT1062 product.

Signed-off-by: Stefan Giroux <stefan.g@feniex.com>
2025-04-10 18:05:26 +02:00
Robert Robinson
9c672fb876 include: drivers: clock_control: Remove strict inclusion for nrf_clock.h
This reverts commit ee05087935.
Since all devices now support nrf_clock HAL as of nrfx 3.10

Signed-off-by: Robert Robinson <robert.robinson@nordicsemi.no>
2025-04-10 12:57:52 +02:00
Tomasz Moń
b3eb6f2d11 usb: device_next: Reduce code size on Full-Speed only configuration
Allow compiler optimizations to remove High-Speed handling code. Knowing
that maximum operating speed is Full-Speed allows to reduce bulk buffers
from 512 to 64 bytes. More RAM optimizations are possible but this
commit only gets the low hanging fruits.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2025-04-10 12:57:19 +02:00
Ryan McClelland
28a7ad4a57 drivers: i3c: add primary controller da property
Add a way to assign the dynamic address for a primary controller. This
is the address that is broadcasted out with the ccc DEFTGTS, and is the
address that secondary controllers use to communicate with the primary
controller.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2025-04-10 10:11:37 +02:00
Christoph Winklhofer
fc37c02eb1 json: improve parsing and serializing of 'float' and 'double'
Up to now, the handling of type float was offloaded to the users of the
JSON utility, with the token JSON_TOK_FLOAT.

Improve handling of floating point types and support the types 'float'
and 'double' in a built-in way so that they can be directly parsed to
and serialized from variables (of type float or double).

The types are serialized in the shortest representation, either as a
decimal number or in scientific notation:
  * float (with JSON_TOK_FLOAT_FP): encoded with maximal 9 digits
  * double (with JSON_TOK_DOUBLE_FP): encoded with maximal 16 digits
  * NaN, Infinity, -Infinity: encoded and decoded as:
    {"nan_val":NaN,"inf_pos":Infinity,"inf_neg":-Infinity}

Enable the floating point functionality with the Kconfig option:
  JSON_LIBRARY_FP_SUPPORT=y

It requires a libc implementation with support for floating point
functions: strtof(), strtod(), isnan() and isinf().

Fixes: #59412
Signed-off-by: Christoph Winklhofer <cj.winklhofer@gmail.com>
2025-04-09 22:05:14 +02:00
Declan Snyder
4c6883b7ab include: spi.h: Fix documentation oddities
The recent change to spi.h doc merged a bit too early on accident and
some oddities were left over, fix them, including:

- Weird command causing strange broken topics section in output
- spi_iodev_api should probably be hidden, looks strange in its own
  section on the doc output
- Fix return values of transceive based functions to match transceive
  description

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-04-09 21:10:08 +02:00
Adam Openshaw
1146574b67 drivers: gicv3: Add Support for Extended SPI
Added support to gicv3 driver to utilize the
extended SPI MMIO registers introduced in
GICv3.1 for the extended SPI range.

Documentation for the Extended Shared
Peripheral Interrupts extension can be found
in the ARM General Interrupt Controller
Architecture Specification:

https://developer.arm.com/documentation/ihi0069/latest/

Signed-off-by: Adam Openshaw <quic_adamo@quicinc.com>
2025-04-09 21:09:43 +02:00
Adam Openshaw
b664d3a925 drivers: gicv3: clang-format
Formatting files for compliance

Signed-off-by: Adam Openshaw <quic_adamo@quicinc.com>
2025-04-09 21:09:43 +02:00
Jan Behrens
f75c057e85 drivers: stepper: Renamed DRV8424 to DRV84XX
Renamed the drv8424 stepper driver to indicate its support of the drv8424,
drv8425, drv8426, drv8434 and drv8436 stepper controllors. Also made the
microstep pins optional. All test files are renamed as well.

Signed-off-by: Jan Behrens <jan.behrens@navimatix.de>
2025-04-09 19:34:00 +02:00
Jan Behrens
c8c79a9fc6 drivers: stepper: Renamed Fault Event + Non Static Event Trigger
Renamed fault event to be more in line with other events and added it to
the stepper shell.
Makes the event callback trigger function of the step-dir implementation
non-static so that step-dir stepper drivers can use it to trigger events
themself.

Signed-off-by: Jan Behrens <jan.behrens@navimatix.de>
2025-04-09 19:34:00 +02:00
Jordan Yates
c7bc268656 sensor: current_amp: add a noise threshold
ADC output values can have noise, even if the input is 0V. Add a noise
threshold so that raw ADC readings below the threshold can be zeroed
out. By default the threshold is disabled.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-09 19:32:02 +02:00
Gerhard Jörges
9d0d7ad3b8 net: lib: http_server: implement concurrent
only accept new connections until the configured value for concurrent
connections is reached. Also set the backlog of the listening socket
to the configured value.

Signed-off-by: Gerhard Jörges <joerges@metratec.com>
2025-04-09 17:32:50 +02:00
Okan Sahin
5785c09255 dts: bindings: adc: Add AD4130 binding
This commit adds bindings and analog inputs
for AD4130 ADC.

Signed-off-by: Okan Sahin <Okan.Sahin@analog.com>
2025-04-09 17:32:29 +02:00
Emil Gydesen
a4f8744ccf Bluetooth: CCP: Client: Add get_bearers
Add bt_ccp_client_get_bearers that will return the bearers of
a client so that the application can always retrieve them if they
do not store them from the discovery callback.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-09 15:23:07 +02:00
Tomáš Juřena
1dd63f42a7 include: dt-bindings: power: stm32_pwr: Use BIT macro
Use BIT to create valid bitfields for wakeup sources.

Signed-off-by: Tomáš Juřena <jurenatomas@gmail.com>
2025-04-09 15:22:59 +02:00
Tomáš Juřena
315ea56fef soc: st: common: Rename STM32_PWR_WKUP_PIN_SRC_x
This renames the STM32_PWR_WKUP_PIN_SRC_x symbols to better match
their meaning. It also adds a new symbol (STM32_PWR_WKUP_PIN_NOT_MUXED)
for SoCs without wake-up mux support.

Signed-off-by: Tomáš Juřena <jurenatomas@gmail.com>
2025-04-09 15:22:59 +02:00
Tien Nguyen
3cba2221ed drivers: gpio: Add support for RZ/G2L
Add GPIO support for RZ/G2L

Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2025-04-09 12:35:54 +02:00
Tien Nguyen
1d736d36ab driver: pinctrl: Add support for Renesas RZ/G2L
Add pinctrl support for Renesas RZ/G2L

Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2025-04-09 12:35:54 +02:00
Lyle Zhu
3f7224a926 Bluetooth: Classic: HFP_AG: Update the callback sco_disconnected()
Change the arguments of HFP AG callback `sco_disconnected()` to SCO
conn and disconnection reason.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-09 08:06:04 +02:00
Ryan McClelland
f358f9f6e9 drivers: i3c: run clang-formatter on hdr_ddr.h
run the clang-format on hdr_ddr.h

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2025-04-08 16:12:31 +02:00
Ryan McClelland
e8e590eb46 drivers: i3c: fix read flag for i3c_hdr_ddr_read
i3c_hdr_ddr_read is missing the I3C_MSG_READ. Add it.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2025-04-08 16:12:31 +02:00
Jilay Pandya
4838c0f200 drivers: stepper: introduce valid micro-step resolution check
Introduce macro to check for valid microstep resolution in stepper api
Use this macro in tmc50xx driver. Stepper api tests adjusted in order to
accomodate the not implemented stepper api functions.

Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
2025-04-08 11:45:40 +02:00
Tim Lin
df56c85e94 drivers/clock: Add clock drivers of it51xxx
Add clock drivers for ITE it51xxx series.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2025-04-08 10:48:26 +02:00
Tim Lin
678adea066 drivers/interrupt: Add interrupt and wake-up control drivers of it51xxx
Add interrupt and wake-up control drivers for ITE it51xxx series.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2025-04-08 10:48:26 +02:00
Krzysztof Chruściński
49337973e0 kernel_structs: Add macro CPU_ID for getting current CPU ID
In case of a single core it resolves to 0. In many cases it reduces
code size and execution time compared to reading id in runtime.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-04-08 08:57:57 +02:00
Samuel Chee
7e95006abf drivers: pinctrl: add pinctrl drivers for arm v2m_beetle
Adds pinctrl driver for the v2m_beetle board target.

Signed-off-by: Samuel Chee <samche01@arm.com>
Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-04-07 15:18:10 +02:00
Samuel Chee
a2f0e5d372 drivers: pinctrl: add pinctrl drivers for arm mps3
Adds pinctrl driver for all Arm mps3 targets

Signed-off-by: Samuel Chee <samche01@arm.com>
Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-04-07 15:18:10 +02:00
Samuel Chee
99ae4bf132 drivers: pinctrl: add pinctrl driver for Arm mps2
Adds pinctrl driver for all Arm mps2 targets.

Signed-off-by: Samuel Chee <samche01@arm.com>
Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-04-07 15:18:10 +02:00
Hein Wessels
7d56d6a0b0 lib: os: cbprintf: add initializer for xtensa padding
Hush the compiler warning for missing initializer when compiling
for both Xtensa and C++.

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2025-04-07 11:22:21 +02:00
Aksel Skauge Mellbye
64a4c593e1 drivers: pinctrl: silabs: Add support for fixed routes
Add support for fixed GPIO routes that don't have a configurable
route register, but still require mode configuration and enabling.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-04-07 08:54:38 +02:00
Jordan Yates
c042ddde20 kernel: add K_TIMEOUT_ABS_SEC
Add a new absolute timeout construction macro that operates on seconds.
It has the same semantics as `K_TIMEOUT_ABS_MS`, `K_TIMEOUT_ABS_US`,
etc.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-07 07:28:00 +02:00
Marcio Ribeiro
c01489dadc drivers: i2s: esp32: add support for non-gdma SoCs
Adds support for:
- esp32
- esp32s2

Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
2025-04-06 12:17:58 +02:00
Eric Holmberg
487830c380 data: json: remove extra braces causing designated-initializer errors
When compiling in C++, the designated-initializer error:
	Either all initializer clauses should be designated
	or none of them should be

Will occur due to an extra pair of braces in the Z_JSON_DESCR_OBJ() macro.

Remove the extra pare of braces which allows the code to compile and
function in both C and C++.

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
2025-04-05 11:01:50 +02:00
Julien Racki
c888760663 drivers: clock: Add stm32mp13 clock
Add STM32MP13 clock driver.
Supported clocks are HSE, HSI, PLL1 and peripheral clock.

Signed-off-by: Julien Racki <julien.racki@st.com>
Co-authored-by: Arif Balik <arifbalik@outlook.com>
2025-04-04 09:35:03 +02:00
Julien Racki
9e392c51cf include: dt-bindings: clock: Add stm32mp13 clock
Add STM32MP13 dt bindings for the clock definition

Signed-off-by: Julien Racki <julien.racki@st.com>
2025-04-04 09:35:03 +02:00
Julien Racki
5ee120fade include: dt-bindings: reset: Add stm32mp13 reset
Add STM32MP13 dt bindings for reset

Signed-off-by: Julien Racki <julien.racki@st.com>
2025-04-04 09:35:03 +02:00
Julien Racki
87719828ac arch: arm: Adding fault description for the cortex A7
Add support for processing the Fault Status Registers and recoverable
data abort for the cortex A7.

Based on Cortex-A7 MPCore Technical Reference Manual (ARM DDI 0406).
(see https://developer.arm.com/documentation/ddi0406)

Signed-off-by: Julien Racki <julien.racki@st.com>
2025-04-04 09:35:03 +02:00
Julien Racki
695e6d73d4 arch: arm: Use the armv8_timer.h for the Cortex A7
We can't use the timer.h as the arm timer
is within the soc and does not have an address.

Instead we use the armv8_timer.h, renaming it to armv7_v8_timer.h
for the Cortex-A7 as the cp15 access are compatible.

Signed-off-by: Julien Racki <julien.racki@st.com>
2025-04-04 09:35:03 +02:00
David Cerrone
bbaaac999f drivers: sensor: current_amp: add calibration option
Allow the option to enable or disable calibration of the ADC.

Signed-off-by: David Cerrone <davidcerrone@gmail.com>
2025-04-03 15:26:36 -07:00
Jordan R Abrahams-Whitehead
d3584b4a46 misc: Restrict linkage for main to freestanding
`extern "C"` is not a valid language linkage for declaring
`int main(...)`, as per the ISO C++ Standard Specification.
This fixes the violations of -Wmain, and brings Zephyr
closer to valid C++.

See the C++ standard wording here:
https://eel.is/c++draft/basic.start.main#3.sentence-5

See also the clang warning -Wmain:
https://clang.llvm.org/docs/DiagnosticsReference.html#wmain

However, for freestanding code (i.e. with -ffreestanding),
main has no special meaning, and we need to prevent name
mangling. So allow this forward linkage when not hosted.

This only applies to C++ as these linkage declarations only
exist inside __cplusplus guards.

Signed-off-by: Jordan R Abrahams-Whitehead <ajordanr@google.com>
2025-04-03 15:26:23 -07:00
Tom Hughes
11e3aa8952 tests: mgmt: mcumgr: Disable clang warning
When building with clang it reports:

tests/subsys/mgmt/mcumgr/settings_mgmt/src/main.c:69:22: error: variable
'test_response_read_data_start' is not needed and will not be emitted
[-Werror,-Wunneeded-internal-declaration]
static const uint8_t test_response_read_data_start[5] = {
                     ^
tests/subsys/mgmt/mcumgr/settings_mgmt/src/main.c:73:22: error: variable
'test_response_read_data_end' is not needed and will not be emitted
[-Werror,-Wunneeded-internal-declaration]
static const uint8_t test_response_read_data_end[1] = {
                     ^

The values of test_response_read_data_start and
test_response_read_data_end are not actually used anywhere in the tests.

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-04-03 21:06:02 +02:00
Mark Wang
891e457873 bluetooth: classic: Fix remote name resolving with multiple devices
The error occur when discoverying br devices and need to send request_name
for many found devices.
In system work queue task, bt_hci_inquiry_complete->
report_discovery_results is called, then request_name is called for all
the found devices. The controller gives HCI_Remote_Name_Request_Complete
event for every name request result and one buf is allocated from
hci_rx_pool to save HCI_Remote_Name_Request_Complete. When system work
queue task is blocked to call request_name for every device, many
HCI_Remote_Name_Request_Complete are received for the already sent
request_name, it uses up all the buf of hci_rx_pool, then the bt_rx_thread
task is blocked to get buf from hci_rx_pool when next
HCI_Remote_Name_Request_Complete is received, meanwhile the next
request_name send hci cmd and wait the result, but the hci status/complete
event can't be received because the bt_rx_thread is blocked and
bt_uart_isr is kept in the state to receive last
HCI_Remote_Name_Request_Complete, then bt_dev.ncmd_sem is not released,
then the next request_name send hci cmd again, but the bt_dev.ncmd_sem is
invalid, then bt_hci_cmd_send_sync fail and assert.

resolve it by requesting name one by one.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-04-03 17:48:04 +02:00
Lyle Zhu
c09cf23844 Bluetooth: HFP_AG: Add ACL conn to the connected callback
If the AG works as Data Channel Acceptor, the ACL conn cannot be known
by the application of AG. Similar with HF, add ACL conn as the first
parameter to the `connected` callback of AG.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
d7cdadc4be Bluetooth: HFP_HF: Initiate SLC establishment
Add function `bt_hfp_hf_connect` to initialize the Service Level
Connection establishment procedure.

Add function `bt_hfp_hf_disconnect` to release the Service Level
Connection.

Clear HF object if the RFCOMM is disconnected.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
f482613478 Bluetooth: HFP_AG: fix typo
Change `Dailing` to `Dialing`.
Change `HFP unit` to `HF`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00
Lyle Zhu
d9dd2e476b Bluetooth: HFP_HF: fix typo
Change `HF_SINGNAL_IND` to `HF_SIGNAL_IND`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-03 06:24:32 +02:00