Avoid silently reporting an invalid pressure value when pressure
compensation encounters a division-by-zero condition.
Use the existing return value 0 from bme280_compensate_press() to
detect a compensation failure in bme280_sample_fetch_helper(), Log an
error, and return -EIO instead of storing an invalid pressure reading.
This ensures callers to receive an appropriate error when pressure
compensation cannot be completed successfully.
Signed-off-by: Gobi M <gobi@aerlync.com>
Use legacy method to get the SOC flash node for the rv32m1 flash driver,
because users of this flash driver define multiple child nodes with the
soc-nv-flash compatible. This prevents use of the
SOC_NV_FLASH_CHILD_NODE helper macro, which relies on one compatible
with the child being present.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@analog.com>
When the trng peripheral is not enabled, the read becomes an infinite loop
for gecko-sdk based SoCs.
I don't have a reliable way to reproduce this and thus don't know what the
root cause is. The only thing I found, is that while it's stuck in an
infinite loop, the clock is enabled in the CMU register, but the TRNG is
disabled in it's control register. So hopefully, this fixes the issue.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
Add support for the counter capture API to the MCUX CTIMER driver.
The driver stores capture callbacks per channel, maps Zephyr edge
flags to CTIMER capture modes, enables capture interrupts, and reports
captured TC values from the CTIMER CR registers.
Capture is mutually exclusive with alarms on the same channel because
both features share the counter channel namespace. Add optional
pinctrl and INPUTMUX routing support so boards can route CTIMER capture
sources from devicetree without changing the public counter API.
Signed-off-by: Holt Sun <holt.sun@nxp.com>
Many drivers in tree use a similar pattern to find their child node with
the compatible "soc-nv-flash". Rather than continuing to duplicate this
logic, define a common handler that is instance based in the flash_priv
header file, and include this from each flash driver.
Assisted-by: Claude: claude-opus-4-6
Signed-off-by: Daniel DeGrasse <daniel.degrasse@analog.com>
Return the whole video_buffer structure instead of just the index.
This helps to make index transparent to application and also make the
buffer accessible from the application.
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
In STA mode the interface was brought operational at association, before
the controlled port was authorized, so the IP stack transmitted data
during the 802.1X handshake window which the driver then dropped with
-EPERM.
Advertise WPA_DRIVER_FLAGS_CONTROL_PORT and implement the tx_control_port
op so EAPOL frames are handed to the driver directly instead of going
through the networking stack. With EAPOL off the data path, keep the
interface dormant from association until the controlled port is
authorized, withholding data TX during authorization while the handshake
still completes.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Assisted-by: Claude:claude-opus-4.8
Add three TDM DAI instances (tdm_dai0/1/2) and one unified
acp_tdm_dma DMA controller node to the ACP 7.X device tree.
Update dma-channels default to 6 (2 per instance x 3 TDM
instances) in Kconfig.acp_tdm.
Signed-off-by: DineshKumar Kalva <DineshKumar.Kalva@amd.com>
Signed-off-by: Sneha Voona <sneha.voona@amd.com>
Extend the ACP TDM DMA driver for ACP 7.X:
- Include ACP 7.X chip headers (acp7x_fw_scratch_mem.h,
acp7x_chip_offsets.h, acp7x_chip_reg.h).
- Update ACP_TDM1_FIFO_SIZE from 512 to 768 bytes
- Add ACP_PDM_2_Enable check in acp_pdm_streams_stopped() for
ACP 7.X (2 PDM instances)
- Guard acp_sdw_all_streams_stopped() under CONFIG_SOC_ACP_7_0
since ACP 7.X has no SDW logic implemented.
- Add acp_get_sample_len_from_frame_fmt() helper for 7.X
- Propagate frame_fmt from acp_tdm_context into dma_start for
per-sample-length ITER/IRER configuration
- Default channel count changed from 8 to 6 (2 per TDM instance
x 3 instances for ACP 7.X)
Signed-off-by: DineshKumar Kalva <DineshKumar.Kalva@amd.com>
Signed-off-by: Sneha Voona <sneha.voona@amd.com>
Extend the existing TDM DAI driver for ACP 7.X:
- Add tdm_dai.h header with shared struct definitions
(dai_amd_tdm_params, acp_tdm_dai_config) and include guard
- Include ACP 7.X chip headers via #elif for CONFIG_SOC_ACP_7_X
- Add sample_format field to dai_amd_tdm_params for per-format
clock configuration (16/24/32-bit slots)
- Configure tdm_lrclk_div_val/tdm_bclk_div_val per sample_format
under CONFIG_SOC_ACP_7_X
- Use acp_tdm_frmt union for TXFRMT/RXFRMT register access
Signed-off-by: DineshKumar Kalva <DineshKumar.Kalva@amd.com>
Signed-off-by: Sneha Voona <sneha.voona@amd.com>
SSD1680 supports RAM ping-pong for display mode 2 through the display
option register. Enable F[6] when switching to the partial refresh
profile so partial updates can use the controller's buffer swap behavior.
Expose this as a "ram-ping-pong-mode2" devicetree property on the
SSD1680-specific binding.
Signed-off-by: Aleksandrs Sevastjanovs <sevalks@gmail.com>
Replace the CONFIG_SOC_MCXW70AC / CONFIG_SOC_MCXW716C Kconfig guards
that conditionalize SIRC hardware access with a new DT boolean
property 'sirc-supported' on the nxp,mcxw7x-clock binding.
MCXW70 and MCXW71 carry the SIRC hardware block; MCXW72 (MCXW727C)
does not - its SIRCCSR register block was removed from the SDK
headers, making kCLOCK_ScgSircClk, CLOCK_UnlockSircControlStatusReg,
scg_sirc_config_t, kSCG_SircEnableInSleep and CLOCK_InitSirc
undefined at build time for frdm_mcxw72.
Set sirc-supported in the MCXW70 and MCXW71 clk_ctrl DT nodes.
Leave it absent on MCXW72 so DT_INST_PROP(0, sirc_supported)
evaluates to 0 at compile time, bypassing all three affected sites:
- get_rate() FRO_6M: fall back to the fixed 6000000U constant
- clock_control_init(): skip CLOCK_UnlockSircControlStatusReg()
- clock_control_init(): skip the SIRC LP-mode init block,
which also bypasses enable_sirc_in_lp_mode
Move enable-sirc-in-lp-mode out of nxp_mcxw7x_common.dtsi (where
it was incorrectly inherited by MCXW72) into the MCXW70/MCXW71
per-variant DTS nodes.
Tested: west build -p=always -b frdm_mcxw72 tests/lib/cpp/cxx
builds cleanly after this change.
Signed-off-by: Allen Zhang <chunfeng.zhang@nxp.com>
Zephyr driver and soc code referenced five CONFIG symbols that were
only declared in the hal module, so a compliance run without the
module in place flagged them as undefined.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Replace IS_EQ() + DT_ENUM_IDX() with the simpler and more explicit
DT_ENUM_HAS_VALUE() macro.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
The COND_CASE_1() allows writing chained/nested COND_CODE_1() checks in
a simpler way. Replace such patterns in the STM32 drivers with this new
utility macro.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
In some STM32 drivers, the COND_CODE_1() macro is used with an empty
expression as the `_else` expansion. The `IF_ENABLED()` macro should be
used in this situation since it allows simplifying the code, so perform
the replacement.
While at it, in `dsi_stm32.c`, fix leakage of empty expressions due to
misplaced `;` symbols (outside the block guarded by `IF_ENABLED()`).
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
add a Kconfig, that has to be selected by the
ethernet driver, when extra headroom on tx
is needed, that way we don't need to include that
code when only using NET_L2_ETHERNET_RESERVE_HEADER.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
All I2C access in crypto_ataes132a goes through
ataes132a_device_config. The i2c field in ataes132a_device_data
field is never written or read.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
Table 14-1. ATAES132A Configuration Memory Map says
that key config spans from 0xf080 to 0xf0bf for a total of
16 keys. (0xF080 + (keyid < 2)) uses the boolean operator
instead of bit shift operator and produces values.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
EncryptOK is represented by bits 1 and 2 and the proper
mask is (BIT(1) | BIT(2)) and not (BIT(1) & BIT(2)) that
evaluates always to 0b00.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
Make static the function ataes132a_atmel_crc implemented in
the private header to avoid possible linkage error if the file
is inlcluded ina different object unit.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
Fix gpio_sam_port_toggle_bits() and gpio_sam_port_set_masked_raw()
PIO_MSKR need to be set before configure PIO_ODSR.
Signed-off-by: CHEN Xing <xing.chen@microchip.com>
Add a required ngpios property to the BCM2711 pinctrl binding
and set it in the SoC dtsi. Update the driver to read the number
of GPIOs from devicetree via DT_INST_PROP.
This makes the GPIO count explicit in devicetree and avoids
hardcoded assumptions in the driver.
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
Update the modem script to activate the flight mode before setting the
APN (AT+CGDCONT), otherwise the APN is not configured properly in the
modem and network connection may fail.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The MCXW7x clock controller configured the OSC32K 32 kHz crystal
oscillator with an 8 pF internal load capacitance (cap value 4) on
both the XTAL and EXTAL pins, and hardcoded the amplifier coarse
gain to Range0. This configuration leads to a clock precision issue
of around 180 ppm on the 32 kHz clock.
A 16 pF internal load capacitance is the best configuration to
achieve the best precision, together with a per-SoC coarse amplifier
gain. Fix the default configuration:
- Use a 16 pF internal load capacitance on XTAL and EXTAL.
- Add an osc32k-coarse-adjustment devicetree property so the coarse
amplifier gain is configurable (the driver previously forced
Range0), and wire it into the CCM32K oscillator config.
- Set the coarse gain per SoC: Range3 on MCXW72, Range1 on MCXW71.
MCXW70 is aligned with MCXW72 (Range3).
Also add named dt-bindings macros for the OSC32K load capacitance
(MCXW_CLK_OSC32K_CAP_*pF, value N maps to 2*N pF) and coarse gain
(MCXW_CLK_OSC32K_COARSE_RANGE*) so the devicetree no longer relies
on opaque magic numbers.
Built samples/hello_world for frdm_mcxw70, frdm_mcxw71 and
frdm_mcxw72 and verified the generated devicetree resolves to 16 pF
caps with coarse gain Range3 (W70/W72) and Range1 (W71).
Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
Packets with dribbling error flag set but with valid CRC
should not be discarded, as they are valid.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
For most cellular modem drivers, the PPP net device was
initialized at POST_KERNEL priority 98,
which is after net_if_init() runs at POST_KERNEL priority 90
After PR #112499 net_if_init() skips interfaces whose device is
not yet ready, so the PPP interface was never initialized
and cellular drivers failed to start.
Remove the _prio parameter from MODEM_DEV_PPP_DEFINE,
MODEM_DT_INST_PPP_DEFINE and MODEM_PPP_DEFINE, replacing the
hardcoded 98 with CONFIG_KERNEL_INIT_PRIORITY_DEFAULT (default
40). This matches the priority already used by drivers/net/ppp.c
and ensures the PPP device is ready before net_if_init() checks
it.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
The flash_controller node is defined using the non secure
alias regster. Add a macro to switch between the secure
and non secure one correctly.
Also properly call the serial_memory_setup function to
init the object.
Signed-off-by: Laura Carlesso <laura.carlesso@infineon.com>
The compat string is updated in device drivers to align with
changes in binding files.
Added depends on $(dt_compat_on_bus,$(DT_COMPAT_[DEVICE]),mspi)
to device Kconfig.
Signed-off-by: Swift Tian <swift.tian@ambiq.com>
Change check for unsupported event registration in order to avoid
having to update the LTDC driver everytime a new event is added.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
The consecutive chat-script failure limit, after which the driver gives up
on the current attempt and suspends, was a hard-coded define. Move it to
Kconfig so it can be tuned per application.
Signed-off-by: Paulo Santos <pauloxrms@gmail.com>
Init-script and CMUX-connect failures both enter a recovery that resets or
power-cycles the modem and re-runs the full bring-up, with no attempt cap
and no delay between attempts. A persistently failing modem therefore loops
through hardware resets indefinitely, thrashing the power rails, while the
per-script failure path already caps and suspends.
Add a recovery state that backs off before resetting (delay grows per
attempt, up to a ceiling) and cap the consecutive attempts: once the budget
is exhausted the driver suspends to idle instead of resetting forever,
matching the script-failure behaviour. The counter resets when CMUX
reconnects. The attempt cap, backoff step and ceiling are Kconfig-tunable,
and a zero cap keeps unlimited retries.
Signed-off-by: Paulo Santos <pauloxrms@gmail.com>
Propagate prepare_send_cmd() failures through validate_and_prepare() as
socket-style errors.
When send command preparation fails, translate the returned error code to
errno and return -1 so the socket send path reports failures consistently
with the rest of the offload API.
Keep successful command preparation returning 0.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Move the generic GNSS NMEA match data to the start of the HL78XX GNSS
runtime structure.
The generic gnss_nmea0183_match_* callbacks cast user_data directly to
struct gnss_nmea0183_match_data, so the embedded match_data member must
be at offset zero in struct hl78xx_gnss_data.
Add a static assertion to catch future layout changes that would break
that assumption.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Harden selected HL78XX socket helper paths.
Move IPv4/subnet splitting earlier in the socket implementation and
validate its inputs before copying. Reject NULL inputs, zero-sized output
buffers, empty address/subnet parts, and output buffers that are too
small instead of silently truncating the parsed values.
Add defensive checks before accessing offload socket state in
modem_process_handler(), socket_notify_data(), and KTCP notification
handling so invalid or incomplete state cannot be dereferenced.
Validate send command arguments before formatting TCP or UDP send
commands, and reject UDP sends without a destination address.
Require socket data notifications to include both socket ID and queued
byte count before parsing them.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Wake socket waiters before marking a drained TCP socket as errored.
Some modem socket wait paths do not signal data-ready semaphores after a
socket has been marked disconnected. Notify the waiter while the socket
is still considered connected, then apply the deferred TCP error and
clear the pending error state.
This lets blocked receive paths wake up and observe the deferred socket
error instead of remaining asleep after the modem reports a remote
disconnect with no unread data left.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Move `binary_str_to_byte()` outside the low-power configuration guard
since it is used independently of `CONFIG_MODEM_HL78XX_LOW_POWER_MODE`.
This allows the helper to be shared by code that is built regardless of
low-power support while keeping `byte_to_binary_str()` scoped to the
low-power configuration.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Handle quoted active time and periodic TAU fields when parsing CEREG
responses.
The modem reports PSM timer fields as quoted 8-bit strings, but the
driver stores the raw 8-bit value without quotes. Strip matching quotes
before validating and copying the timer field.
Update the CEREG unit test to pass modem-style quoted timer fields and
expect the normalized unquoted values in the cached registration state.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Rename the CEREG parser boolean from is_urc to has_n_param.
The parser needs to know whether argv contains the query response <n>
parameter before <stat>. Query responses use:
+CEREG: <n>,<stat>,...
while URCs use:
+CEREG: <stat>,...
Use has_n_param to describe the actual parsing decision and update the
caller to pass true when both <n> and <stat> are present.
This avoids treating the flag as a generic URC indicator and makes the
status field index calculation clearer.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Reject PLMN strings that contain more digits than the parser can store.
Previously the parser stopped collecting digits when the local buffer was
full and continued scanning the rest of the string. This could allow an
overlong numeric operator value to be truncated and parsed as if it were
valid.
Return false as soon as the digit buffer would overflow so invalid
operator strings are rejected instead of silently truncated.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Remove the modem chat header include from the public HL78XX API header.
The public API only needs to expose pointers to struct modem_chat_match,
so forward declare the type instead of pulling in
<zephyr/modem/chat.h>. This reduces the header dependency surface for
users of the HL78XX API.
Include <zephyr/modem/chat.h> directly in hl78xx_apis.c, where the full
modem chat definitions are needed.
Also keep the GNSS auxiliary data types and callback registration macros
available from the public API header instead of hiding them behind
CONFIG_HL78XX_GNSS_AUX_DATA_PARSER, so code can compile against the API
types regardless of that build option.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Move auxiliary GNSS NMEA parsing helpers into a dedicated parser module.
Add hl78xx_gnss_aux_parse.c and hl78xx_gnss_aux_parse.h for parsing GSA,
GST, and PSEPU argument lists into HL78XX auxiliary GNSS data. Keep UTC
and optional milli-unit parsing private to that module.
Leave modem chat callback handling in hl78xx_gnss_parsers.c, where the
callbacks can update runtime GNSS state and publish auxiliary data. This
keeps the parsing logic testable without coupling it to modem chat
callback flow.
Build the new auxiliary parser module when HL78XX GNSS support is
enabled.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Move GNSSLOC-specific parser helpers into a dedicated source file.
Create hl78xx_gnssloc.c and hl78xx_gnssloc.h for parsing GNSSLOC DMS
coordinates, values with units, speeds, and GPS time strings. Keep the
NMEA parser file focused on NMEA sentence callbacks and shared NMEA
helper logic.
Build the new GNSSLOC parser file when HL78XX GNSS support is enabled,
and include the new header from the existing GNSS parser implementation.
This also lets unit tests target the GNSSLOC helpers directly without
pulling in unrelated NMEA callback code.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
send_buf uses NRF_GPIO as the GPIO controller base address.
NRF_GPIO is defined as NRF_P0 in sdk-hal_nordic/nrfx/mdk,
so with pins not belong to GPIO0,
it causes data to be sent to the wrong pin.
At compile time get the GPIO controller register address
from devicetree, and calculate the OUTSET base address
with struct NRF_GPIO_Type.
Tested on nRF52833 hardware.
Signed-off-by: ZF Yu <ez4y2f@icloud.com>
Call i2c HAL init after HW FSM reset so i2c_recover_bus() leaves
the controller ready for the next transfer on C5/C6/H2/P4. Return
-EIO on master ACK errors per Zephyr I2C API.
Fixes testcase errors on `tests/drivers/i2c/i2c_at24` for the above
mentioned devices.
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>