Introduce a new Wakeup Controller (WUC) driver API to manage wakeup
sources in low-power scenarios. The WUC API provides a standardized
interface for enabling, disabling, checking, recording and clearing
wakeup sources that can bring a device out of low-power states.
Signed-off-by: Albort Xue <yao.xue@nxp.com>
Add Atmel SAM USBC driver for SAM4L family. The driver was tested using
CDC-ACM and testusb samples.
Fixes: #74665
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Add hardware crypto drivers for the Bouffalo Lab SEC Engine:
- AES: ECB, CBC, CTR modes with 128/192/256-bit keys
- SHA: SHA-224 and SHA-256 (SHA-384/512 not supported in HW)
- GMAC: Galois MAC (GF(2^128) multiply)
Each sub-block is a separate driver with its own Kconfig and
DT compatible. All drivers recover SEC_ENG_BASE from the DT
sub-block address to work with HAL register offsets.
Signed-off-by: William Markezana <william.markezana@gmail.com>
Added some application services APIs to handle the GNSS, WIFI scan
and to retrieve the RSSI on the st87mxx modem driver.
Signed-off-by: Isabelle OGER <isabelle.oger@st.com>
Ensure the modem is awake before sending socket data when low-power
mode is enabled. Add a PSM-aware wake path and a handshake to gate
offload I/O until the modem is ready.
Changes:
- hl78xx_sockets.c:
- Add HL78XX_PSM_WAKEUP_TIMEOUT_SECONDS (default 60 s).
- Add psm_cntrl_sem to socket data and initialize it at startup.
- Implement hl78xx_release_socket_comms() to release the semaphore
when the modem is ready for data after wake/registration.
- Implement hl78xx_send_wakeup_signal() to dispatch RESUME to the
modem state machine.
- Add hl78xx_ensure_modem_awake():
* If registered, return immediately.
* If in PSM/power-down, send wake, wait on psm_cntrl_sem up to the
timeout; on timeout set errno=EAGAIN and fail.
- Call hl78xx_ensure_modem_awake() from offload_sendto() and fail
early if the modem cannot be woken.
- Wrap a verbose post-process LOG_DBG() behind
CONFIG_MODEM_HL78XX_LOG_CONTEXT_VERBOSE_DEBUG.
Why:
- In low-power (PSM/eDRX) the modem may be asleep when the app tries to
send data. This change wakes the modem and blocks until it is ready,
preventing spurious send failures and lost payloads.
Impact:
- Behavior change for offload_sendto() under PSM:
* Returns -1 with errno=EAGAIN if wake times out.
- hl78xx_release_socket_comms() must be called by the core after wake
(done in driver on +CEREG/+KCELLMEAS paths).
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Add a configurable GNSS processing mode for low-power operation and
teach the GNSS/LTE state machine to run GNSS without unnecessary CFUN
toggling when the RF path is already free in PSM. Improves energy
usage and reduces wake latency.
Kconfig:
- New choice HL78XX_GNSS_REQUEST_PROCESSING_MODE (depends on PSM):
* HL78XX_GNSS_PROCESS_POST_PSM (default).
* HL78XX_GNSS_PROCESS_PRE_PSM.
- Document PRE vs POST behavior and constraints.
Core (hl78xx.c):
- When GNSS is requested in low-power mode, defer to PSM-aware flow:
* PRE‑PSM: start GNSS on PSM entry.
* POST‑PSM: start GNSS after user wake.
- Avoid CFUN=4 when the RF path is already free due to PSM.
- Log intent and return early to skip legacy airplane path.
GNSS TU (hl78xx_gnss.c/.h):
- If PSM is active or just exited, skip CFUN=4 and start GNSS
immediately (RF path free).
- Start GNSS on timeout when RF is free (airplane or PSM), otherwise
queue until free.
- Cancel scheduled power‑down when GNSS actually starts.
- Handle LTE REGISTERED and DEVICE_AWAKE while GNSS is active:
* If LTE reclaims RF, modem auto‑stops GNSS; return to LTE flow.
* If GNSS exit occurs while CFUN=1 (PSM path), auto‑resume LTE
registration; in airplane mode, user restores CFUN=1.
- Clarify state doc: waiting for “RF free (airplane or PSM)” instead of
only airplane.
- Emit HL78XX_GNSS_EVENT_MODE_EXITED with status=false when auto‑stopped
by LTE.
Public API docs (hl78xx_apis.h):
- Document low‑power GNSS paths:
* ENTER: queued, start pre‑ or post‑PSM depending on Kconfig.
* EXIT: auto‑resume LTE in PSM path; airplane path still user‑driven.
Why:
- GNSS can operate while LTE hibernates in PSM; avoiding CFUN toggles
saves energy and time.
- PRE‑PSM maximizes GNSS acquisition window; POST‑PSM delivers fixes at
wake before LTE work.
- Clearer eventing for auto‑stop cases simplifies app logic.
Impact / migration:
- Behavior change for queued GNSS in PSM: CFUN=4 is no longer forced if
PSM already frees the RF path.
- Apps that assumed CFUN=4 during GNSS should rely on events instead.
- Consumers of MODE_EXITED should handle status=false (auto‑stop).
- New Kconfig choice requires MODEM_HL78XX_PSM=y to be effective.
Testing notes:
- Verified PRE‑PSM starts GNSS on PSM entry and cancels power‑down.
- Verified POST‑PSM defers GNSS until wake, then runs before LTE regs.
- Confirmed LTE REGISTERED during GNSS causes clean abort and return to
LTE path.
- Confirmed no CFUN changes when PSM already frees the RF path.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Introduce a low-power framework for HL78xx: new states, events, Kconfig
options, URC handlers, GPIO control, and an optional power-down timer.
Includes DTS pins for WAKE/GPIO6/VGPIO and a public wake API.
Board/DTS:
- swir_hl78xx_ev_kit.overlay:
- Add mdm-vgpio, mdm-gpio6, and mdm-wake GPIOs.
Kconfig:
- Add MODEM_HL78XX_POWER_DOWN when eDRX/PSM are both disabled.
- Add choice for power-down policy:
- MODEM_HL78XX_USE_DELAY_BASED_POWER_DOWN (+ delay seconds).
- MODEM_HL78XX_USE_ACTIVE_TIME_BASED_POWER_DOWN (+ active time).
- Tune eDRX defaults and add PTW value knob.
- Adjust PSM defaults (e.g., TAU default 15 minutes).
- Gate legacy sleep-delay settings when power-down is disabled.
Driver core (hl78xx.c/.h):
- New states:
- RUN_PMC_CONFIG_SCRIPT (apply PSM/eDRX/power-down).
- SLEEP (bus closed, UART suspended, wake via RESUME).
- New events (when low-power enabled):
- DEVICE_ASLEEP, DEVICE_AWAKE, LTE_PSMEV_UPDATE.
- +CEREG handler:
- Feed power timers, handle GNSS interplay, release socket comms
after register when low-power is active.
- +PSMEV handler:
- Track ENTER/EXIT, toggle WAKE pin, dispatch sleep/awake events.
- +KCELLMEAS handler:
- Update RSRP, mark registered on valid signal, release comms.
- Carrier-on / await-registered:
- Distinguish PSM entry vs coverage loss, route to SLEEP or retry.
- Avoid iface status run during initial PSM edge cases.
- Sleep state handlers:
- On enter: WAKE=0, release chat, close pipe, suspend UART, give sem.
- On bus closed: decide GNSS pre/post-PSM behavior.
- On resume: WAKE=1, resume UART, reopen pipe, proceed to GNSS or LTE.
- State-table safety:
- Use MODEM_HL78XX_STATE_COUNT for bounds checks.
- Log improvements and explicit state transition trace.
APIs (hl78xx_apis.c / include):
- Add hl78xx_wakeup_modem() to resume from SLEEP (PSM).
Chat/URC (hl78xx_chat.c/.h):
- Enable +KPSMEV URC and +KCELLMEAS URC when low-power is on.
- Provide disable-PMC script when low-power is off.
Config helpers (hl78xx_cfg.c/.h):
- Add PMC enabling and settings application:
- hl78xx_enable_pmc(), hl78xx_psm_settings(), hl78xx_edrx_settings().
- Power-down timer (when enabled):
- Init/cancel/query and feed functions via k_work_delayable.
- Feed timer on dynamic TX path to extend on activity.
- Add hl78xx_is_rsrp_valid() helper.
- Respect CONFIG_MODEM_LOG_LEVEL in cfg TU logging.
Misc:
- Expose hl78xx_release_socket_comms() for post-register gating.
- Guard init-fail path to require WAKE pin when low-power is on.
- Add RUN_PMC_CONFIG_SCRIPT transitions after RAT config.
Why:
- Reduce energy by using PSM/eDRX and a clean SLEEP state with bus and
UART suspended. Optionally power down the modem when DRX features are
disabled. Provide explicit wake and robust PSM detection.
Impact / migration:
- DTS must define WAKE/GPIO6/VGPIO if low-power is enabled.
- New state/event enums added; state table now uses *_STATE_COUNT.
- +KCELLMEAS URC is enabled unless GNSS blocks it (see comments).
- External users can call hl78xx_wakeup_modem() to resume from PSM.
- Power-down policy and delays are configurable via Kconfig.
Testing notes:
- Verified PSMENTER drives WAKE low and transitions to SLEEP.
- Verified RESUME re-opens UART, waits settle time, then proceeds.
- Confirmed GNSS pre/post-PSM flows per config.
- Checked power-down timer feeds on data activity and triggers OFF.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Add a GPIO driver for the Infineon CYW43439 WiFi chip that exposes
WL_GPIO0-2 as standard Zephyr GPIO pins. Pin 0 is the onboard LED
on Raspberry Pi Pico W and Pico 2 W boards.
The GPIO node is a child of the AIROC WiFi device node in the
devicetree. GPIO control is performed via the WHD gpioout iovar,
serialized with a mutex. A shadow register tracks pin state since
the CYW43439 does not support GPIO readback.
Signed-off-by: John Lin <mcjelcom@gmail.com>
Clearing the status register in adxl367_thread_cb() introduces
a one-sample latency since any trigger handler invoking
adxl367_get_accel_data() has to wait until the next sample sets the
DATA_READY bit again. To fix this, identify trigger source by
reading status_copy register in adxl367_thread_cb(). This preserves
the status register contents for verification prior to fetching data.
Signed-off-by: Shiril Tichkule <Shiril.Tichkule@analog.com>
Regression when original D8C PLL changes were added results
in an unused variable. This fixes that warning.
Signed-off-by: James Bennion-Pedley <james@bojit.org>
This commit is to add DTC transfer feature for both SPI controller mode
and peripheral mode on board RSK-RX130-512KB
Signed-off-by: Minh Tang <minh.tang.ue@bp.renesas.com>
Compress the `struct ina2xx_channels` to only the channels that are
supported. This has the added benefit that trying to access an
unsupported channel (in the driver) is now a compile-time error.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Use `#ifdef`, `#else`, `#endif` to block out implementations, instead
of putting the checks inside an `if`, which results in all the
implementations being indented.
It also makes it much clearer to any user with syntax highlighting
configured, since the unsupported channels are greyed out.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Fix calling `sensor_channel_get` on a channel that is not supported by
the hardware from faulting with a NULL de-reference.
This fixes the following pattern (used by `fuel_guage/composite`):
```
sensor_sample_fetch(dev);
if (sensor_channel_get(dev, chan, val) == -EINVAL) {
printk("Not supported\n");
}
````
Signed-off-by: Jordan Yates <jordan@embeint.com>
This reverts commit ae44e1e7b7.
The only consequence of removing NULL checks is enabling NULL
dereference exceptions. The sensor API is a generic API, a generic
library built on top of that API does not always know which channels a
device supports.
Signed-off-by: Jordan Yates <jordan@embeint.com>
This reverts commit 8340e8c264.
The only consequence of removing NULL checks is enabling NULL
dereference exceptions. The sensor API is a generic API, a generic
library built on top of that API does not always know which channels a
device supports.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Remove instance specific Kconfigs (CONFIG_NRFX_GPIOTEx) as they are no
longer used. Cleanup in all places.
Add prompt to CONFIG_NRFX_GPIOTE to allow enabling the driver.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
If CONFIG_GPIO_NRFX_INTERRUPT is disabled then nrfx_gpiote driver API
shall no be accessed at all (driver can be disabled).
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Adds a Kconfig option to detect if checksum offloading
is supported by any driver and one to activate it.
Main benefit is that `net_if_need_calc_rx_checksum()` and
`net_if_need_calc_tx_checksum()` are now inline and therefore the
compiler can optimize more, when checksum offloading is not supported.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Remove the unconditional `conn_mgr_if_used` call on data reception.
Receiving data ends up being a poor metric for "interface in use" in
many situations. This is especially the case when connected to networks
with broadcast packets that are not necessarily relevant for us, such as
ARP discovery requests.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Use micro-units when converting readings to struct sensor_value.
The previous implementation used 100000-based scaling for fractional
values, while sensor_value expects 10^-6 units. As a result, converted
magnetic field values were reported as 10x the expected gauss value
instead of gauss, and the incorrect scaling caused apparent jumps in
the reported sensor readings.
Fix the conversions by using 1000000-based scaling and
sensor_value_from_micro().
Signed-off-by: Bernhard Reiter <bernhard.reiter@swarovskioptik.com>
Extend the PWM API with optional API functions for enabling DMA requests
Possible solution for #88670
Signed-off-by: Vincent Surkijn <vincent.surkijn@siemens.com>
Update the dwmac_stm32h7x ethernet driver to use the same default
MAC address as the STM32 HAL driver.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Change return value of dwmac_platform_init to int and return error code
in case of failure. This allows to report errors from platform init and
fail the driver probe if platform init fails.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Infineon PSOC4 parts share many ports with a single IRQ line. Using the
SHARED_INTERRUPT handler feature of Zephyr results in a very large IRQ
vector table. Instead structure in DT the idea that the ports are
sharing an interrupt with a sort of pseudo interrupt controller.
This also rectifies the need to ifdef on CAT1C/M0+. I added a note
making it clear that in those cases we likely need to rework the way
interrupts are done anyways as there's secondary interrupt
muxes/controllers involved.
Signed-off-by: Tom Burdick <thomas.burdick@infineon.com>
Use IF_ENABLED when possible to keep code indents looking nicer rather
than ifdef's. Rename everything to be ifx (drop the cat1 naming). Drops
the unused intc_prio config member.
Signed-off-by: Tom Burdick <thomas.burdick@infineon.com>
Per MIPI I3C spec Table 38, RSTACT defining bytes >= 0x80 are only
valid for get operations (Format 3). Reject attempts to use them with
set (Format 2) early with -EINVAL rather than sending an invalid CCC
on the bus.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
The reattach command takes <device> <target> [<old_dyn_addr>], so the
optional old dynamic address is argv[3], not argv[2]. The check also
used argc > 2 which is always true since the minimum argc is 3.
This caused the target device name string to be parsed as a hex
address via strtol, resulting in incorrect old_dyn_addr values.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
i3c_read_to_buffer printed the controller device name (s_dev_name)
instead of the target device name (s_tdev_name) when the target
device lookup failed.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
cmd_i3c_ibi_hj_response used device_get_binding() while every other
function in the file uses shell_device_get_binding(). Use the correct
shell variant for consistent device lookup semantics.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
The cancel-and-wait loop uses `while (retry_count--)` with a post-loop
check of `retry_count == 0`. This is broken in two ways:
1. When all retries are exhausted, the final post-decrement wraps the
uint32_t from 0 to UINT32_MAX, so the timeout check never fires and
the error is silently ignored.
2. When the controller goes idle on the last retry, retry_count is
legitimately 0 after the break, causing a false timeout report.
Replace with a simple for-loop and a bool flag to correctly distinguish
between the idle and timeout cases.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
CONF_STATUS1_IBI_DEPTH extracts bits [12:10] from the CONF_STATUS1
register, but cfg0 (CONF_STATUS0) was being passed instead of cfg1.
This resulted in reading the wrong bits and computing an incorrect
IBI FIFO depth.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
The IBIR depth field occupies bits [7:6], a 2-bit field, but was
right-shifted by 7 instead of 6. This lost the lower bit of the
field, causing incorrect IBIR FIFO depth calculation for half of
the possible hardware configurations.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
The DDR preamble macros were missing parentheses around the shift
expressions. Without them, using these in bitwise OR expressions
produces wrong results due to C operator precedence, since | binds
tighter than <<.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
CMD1_FIFO_DB masked bits [15:8] then shifted left by 8, which always
produced zero when the input is a byte value (0-255) since bits [15:8]
are zero for a uint8_t. The defining byte field is at bits [15:8] of
the command word.
Use FIELD_PREP with the correct field mask to place the defining byte
in the right position.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
The #endif comments for CONFIG_I3C_CONTROLLER and
CONFIG_I3C_TARGET were swapped, and the outermost #endif
was missing its CONFIG_I3C_USE_IBI comment.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Add missing parentheses around macro parameter `m` in
REV_ID_VERSION to prevent operator precedence issues when
a complex expression is passed.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Add driver support for NXP MCUX Quadrature Decoder (QDC) sensor.
The driver provides:
- Position tracking via SENSOR_CHAN_ROTATION channel
- Configurable counts per revolution
- Single phase and normal decoder work modes
- Input filtering with configurable count and sample period
- INPUTMUX integration for flexible signal routing
- Modulo count mode support
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
There are many lm75 variants differing in temperature resolution.
Typical values are 9, 10, 11, and 12 bit. They all use the same
format (16 bit signed integer with LSB at 1/256 degree C).
Depending on the on the actual variant some of the LSB are not
defined. The new calculation scheme uses all 16 bits independent
on the actual sensor resolution. In the worst this leads to
some pseudo-resolution in case the undefined bits are not
reported as 0 by the sensor.
Signed-off-by: Lutz Dittrich <dittrich@netwake.com>
The parameter page is not ECC protected, but can return ECC errors under
some conditions. These errors should be ignored so drivers can
initialize.
Signed-off-by: Atilla Filiz <atilla@fi-tech.be>
SDK 1.0.0's GCC compiler flags a warning about 'cfg' being used without
being set. The compiler is wrong, but let's assign the variable to NULL
to avoid the warning.
Signed-off-by: Keith Packard <keithp@keithp.com>
Add an entropy driver for Bouffalo Lab BL70X that reads
random data from the SEC TRNG block and wires it into
Zephyr's entropy API.
Signed-off-by: William Markezana <william.markezana@gmail.com>