Commit graph zephyr/drivers
Author SHA1 Message Date
Johan Hedberg
f372302419 drivers: adc: shell: enumerate ADC controllers by device class
Replace the hardcoded list of 96 ADC controller compatibles with a
single iteration over the "adc" device class that adc-controller.yaml
now declares. New in-tree ADC drivers no longer need to patch this
list, and the shell now also covers out-of-tree ADC controllers, which
the compatible list could never contain.

Enumeration semantics are unchanged: the class covers the same nodes
as a complete compatible list, i.e. every status "okay" ADC controller
node, whether or not its driver is enabled.

Built samples/subsys/shell/shell_module for native_sim with
CONFIG_ADC=y and CONFIG_ADC_SHELL=y and verified that the emulated ADC
node is picked up through the class iteration. Not run on hardware.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-09-14 15:41:31 -04:00
Johan Hedberg
fa635fec2c Bluetooth: hci_spi_st: Gate and check the LL-only write in raw builds
The controller-only build sends the link layer only configuration from
open() for every BlueNRG ACI controller, while the Host build's setup()
sends it only when the device tree sets req-ll-only, as introduced for
the X-NUCLEO-WBA25A1 support in commit a8c09c2e34 ("drivers:
bluetooth: hci: Modify BLE driver to support X-Nucleo-WBA25A1"). Apply
the same condition in open(), and fail open() when the command cannot
be sent instead of ignoring the result.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-09-14 15:41:26 -04:00
Johan Hedberg
327a0aa361 Bluetooth: hci_spi_st: Check the result of the LL-only configuration
bt_spi_bluenrg_setup() ignores the return value of the
ACI_HAL_WRITE_CONFIG_DATA command that puts the BlueNRG into link layer
only mode, while checking the one that sets the public address a few
lines further down. The command was originally sent from the RX
thread's vendor event handler, where there was no caller to report to,
and kept its unchecked form when it moved into setup().

Link layer only mode is a precondition for the Zephyr Host, which needs
a plain HCI controller underneath, and the controller only accepts the
write as its first command after reset, so a failure cannot be retried
later. Return the error, so that bt_enable() fails instead of the stack
coming up on a controller whose embedded host is still active.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-09-14 15:41:26 -04:00
Ahnaf Shahriar
bdbe375beb drivers: modem: cellular: track 5GS registration separately
modem_cellular_chat_on_cxreg() matches "+CREG: " and "+CGREG: " and
files everything else into registration_status_lte. The handler is
public and MODEM_CELLULAR_COMMON_UNSOL_MATCHES is meant to be extended
by vendor drivers, so a driver that adds a "+C5GREG: " match ends up
writing the 5GS registration state into the LTE slot.

That is wrong in both directions on a module registered on 5G SA. Such
a module answers "+CEREG: <n>,0" and "+C5GREG: <n>,1", so whichever of
the two arrives last decides the state. The periodic script reads
+CEREG?, which overwrites the good status with "not registered",
modem_cellular_is_registered() turns false, and the driver tears the
link down once per periodic cycle.

Give 5GS its own registration_status_5g, dispatch "+C5GREG: " to it,
clear it along with the others, and treat the modem as registered when
any of the four accesses is registered home or roaming. This also lets
cellular_get_registration_status() answer for
CELLULAR_ACCESS_TECHNOLOGY_NR_5G_CN and CELLULAR_ACCESS_TECHNOLOGY_NG_RAN,
which the driver previously had to report as -ENODATA.

Signed-off-by: Ahnaf Shahriar <shahriarahnaf007@gmail.com>
2026-09-14 15:41:21 -04:00
Robyn MILAS
ed367255c8 drivers: sensors: bmp581: Prevent loss of 6 bit of precision
The bmp581 driver was losing 6 bits of precision when converting
the raw temperature and pressure values to compensated values.

This was due to an early truncation while parsing raw data.

Signed-off-by: Robyn MILAS <robyn.milas@valotec.com>
2026-09-14 15:41:17 -04:00
Konstantinos Papadopoulos
8f179ce145 modem: cellular: vendor: sara-r4 remove user_pipe
Removed user pipe 4 as there is no such DLCI channel in R4 variant.

Signed-off-by: Konstantinos Papadopoulos <kostas.papadopulos@gmail.com>
2026-09-14 15:41:12 -04:00
Konstantinos Papadopoulos
43f60b4d3a modem: cellular: vendor: sara-r4 enable more modem info
Enable more modem information for sara-r4.

Signed-off-by: Konstantinos Papadopoulos <kostas.papadopulos@gmail.com>
2026-09-14 15:41:12 -04:00
Konstantinos Papadopoulos
6033efd542 modem: cellular: vendor: sara-r4 set APP RDY greeting
Set the greeting message to APP RDY, that simple change makes the
driver bring up sooner than before instead of waisting further more
time until the timeout occurs.

Signed-off-by: Konstantinos Papadopoulos <kostas.papadopulos@gmail.com>
2026-09-14 15:41:12 -04:00
Konstantinos Papadopoulos
52bdfecf8f modem: cellular: vendor: sara-r4: add baud rate change function
Add baud-rate change functionality for sara-r4.

Signed-off-by: Konstantinos Papadopoulos <kostas.papadopulos@gmail.com>
2026-09-14 15:41:12 -04:00
Tim Pambor
3a79220df7 drivers: ethernet: dwc_mac: nxp: document the bus type of the DMA master
The DMA master of this IP is AHB, so say so next to the data bus width
rather than giving the width alone.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-09-14 08:43:56 -04:00
Dominik Chat
b8ff98fc97 drivers: sensor: adxl367: make self-test at init optional
Add a new "self-test-enable" DT boolean property that controls whether
the driver performs a self-test during initialization. When the property
is not set, the self-test is skipped.

Previously, adxl367_probe() always ran adxl367_self_test() unconditionally.
Running the self-test adds a noticeable delay to initialization: the
routine sleeps 2 * (4 / ODR) which at the default 12.5 Hz ODR amounts to
approximately 640 ms. Making the self-test opt-in lets applications that
do not need it avoid this cost.

This change matches the semantics already in place for the sibling
adi,adxl355 driver, which uses the same "self-test-enable" property.

Signed-off-by: Dominik Chat <dominik.chat@nordicsemi.no>
2026-09-14 08:43:47 -04:00
Dominik Chat
ca2d55a09c drivers: sensor: adxl367: program ODR before running self-test
adxl367_self_test() computes its post-force-test settling delay as
4 / ODR based on cfg->odr from the device tree. However, in the
probe path the hardware ODR was only programmed later via
adxl367_set_output_rate(), so the device was still running at its
reset-default rate (100 Hz) while the driver waited an interval
derived from the intended ODR.

For cfg->odr <= 100 Hz this only meant a longer-than-necessary wait,
but for 200 Hz and 400 Hz the driver waited less than 4 / 100 Hz,
which could make the self-test read stale acceleration values and
spuriously fail.

Move adxl367_set_output_rate() so it runs before adxl367_self_test(),
right after adxl367_reset(), so that the delay inside the self-test
matches the actual hardware ODR.

Signed-off-by: Dominik Chat <dominik.chat@nordicsemi.no>
2026-09-14 08:43:47 -04:00
Titouan Christophe
d34e8ee246 drivers: audio: cs43l22: select GPIO (instead of depending on it)
The CS43L22 is at the moment only used in two boards in-tree:
- stm32f4_disco
- stm32l476g_disco

These two boards are based on STM32, and recently GPIO was disabled
by default on these series (see #109468). Therefore, any application
using audio output would need to explicitely select GPIO, otherwise
the CS43L22 audio codec is simply not selectable.

For other peripherals, GPIO is already pulled in as needed
(see #110259, #112742, #112881). Because the CS43L22 *needs* GPIO,
it makes more sense to simply select it.

This fixes samples/drivers/i2s/i2s_codec for stm32f4_disco.

Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
2026-09-14 08:43:42 -04:00
Wojciech Slenska
1a20436ef7 drivers: clock_control: stm32h5: add flash programming delay
WRHIGHFREQ in FLASH_ACR controls the delay between flash signals during
program operations and has to match the configured read latency, as
described in RM0481 rev 5, Table 48. Nothing programs it today: it is
left at its reset value of 01, which is only valid up to 3 wait states.
Above that the programming timings are too tight and program operations
are not reliable, which is reachable on any board running the flash
above ~4 wait states.

Derive the field from the latency selected by LL_SetFlashLatency().

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2026-09-14 08:43:23 -04:00
Benjamin Cabé
53abe1568c drivers: audio: mpxxdtyy: use inclusive terminology
comm_master holds the device the microphone hangs off, taken from
DT_INST_BUS(). Rename it to comm_dev, which says the same thing without
the term coding guideline A.2 rules out. The field is private to the
driver.

No functional change.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-09-14 08:43:19 -04:00
Benjamin Cabé
ad4cf7add5 drivers: audio: tlv320dac310x: use inclusive terminology
The message is logged from the branch taken when the codec is the bit
clock controller, so name the role the way I2S_OPT_BIT_CLK_CONTROLLER
guarding that branch already does.

Log message only.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-09-14 08:43:19 -04:00
Benjamin Cabé
8765f8a088 drivers: audio: tlv320aic3110: use inclusive terminology
The message is logged from the branch taken when the codec is the bit
clock controller, so name the role the way I2S_OPT_BIT_CLK_CONTROLLER
guarding that branch already does.

Log message only.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-09-14 08:43:19 -04:00
Benjamin Cabé
184fb6276e drivers: audio: tlv320aic26: use inclusive terminology
The local flag tracking the codec clock role is the only place left
using the former terminology; the log message it feeds already reports
"controller" or "target". Rename it to match.

AIC26_SLVMS keeps its datasheet mnemonic.

No functional change.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-09-14 08:43:19 -04:00
Benjamin Cabé
f2e9b74789 drivers: audio: da7212: use inclusive terminology
Describe the DAI clock direction with the controller/target pair taken
from revision 3.0 of the I2S bus specification, as coding guideline A.2
requires. The comments are the driver's own prose, not expansions of
DIALOG7212_DAI_CLK_MODE field names, so nothing datasheet-traceable is
lost.

Comment-only change.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-09-14 08:43:19 -04:00
Benjamin Cabé
598867bc2e drivers: audio: aw88298: use inclusive terminology
The driver was the last in-tree user of the I2S_OPT_BIT_CLK_SLAVE and
I2S_OPT_FRAME_CLK_SLAVE macros, deprecated in v4.4 in favour of the
_TARGET names taken from revision 3.0 of the I2S bus specification. Use
the current names and update the log messages to match.

The macros are compatibility aliases with identical values, so there is
no functional change.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-09-14 08:43:19 -04:00
Benjamin Cabé
93b9d84231 drivers: audio: wm8962: use inclusive terminology
wm8962_set_master_clock() configures the codec to drive BCLK and LRCLK,
which the I2S bus specification 3.0 and coding guideline A.2 call the
clock controller role. Rename it accordingly; the call site already
selects it from I2S_OPT_FRAME_CLK_TARGET.

WM8962_IFACE1_SLAVE and WM8962_IFACE1_MASTER are driver-composed value
names for the IFACE1 MS field, not datasheet mnemonics, so rename them
too. WM8962_IFACE1_MS_MASK, _SHIFT and MS(x) keep the datasheet name.

No functional change. The signature is rewrapped to stay within 100
columns and the macro block is realigned after the rename.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-09-14 08:43:19 -04:00
Benjamin Cabé
a8554abedd drivers: audio: wm8904: use inclusive terminology
wm8904_set_master_clock() configures the codec to drive BCLK and LRCLK,
which the I2S bus specification 3.0 and coding guideline A.2 call the
clock controller role. Rename it accordingly; the call site already
selects it from I2S_OPT_FRAME_CLK_TARGET.

No functional change. The signature is rewrapped to stay within 100
columns after the rename.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-09-14 08:43:19 -04:00
Marvin Gnad
9cd42e7ec5 drivers: clock_control: mcux_syscon: report the LPC54xxx CTIMER rate
CLOCK_GetCTimerClkFreq() has no LPC54xxx equivalent, because the part
has no per-timer clock select register. CTIMER0-2 sit on the
synchronous APB and run from the main clock; CTIMER3 and CTIMER4 are
behind the asynchronous APB bridge, whose source is selected
separately, so they are reported from CLOCK_GetAsyncApbClkFreq().

Both SoCs in the series are laid out this way: CTIMER3 and CTIMER4 take
their clock enable from ASYNCAPBCLKCTRL on LPC54114 (UM10914 table 185)
and on LPC54628 (UM10912 table 237).

The existing arm of this switch had never been compiled for the series,
since no LPC54xxx SoC declared a nxp,lpc-ctimer node.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Marvin Gnad <marvin.gnad@gmail.com>
2026-09-14 08:43:07 -04:00
Benjamin Cabé
97f170b004 drivers: sensor: emul: drop empty configuration structs
Seven sensor emulators declared an empty `struct <dev>_emul_cfg` and
passed its address to EMUL_DT_INST_DEFINE() even though nothing ever
reads emul->cfg. An empty struct is a GNU extension, not valid ISO C,
and icm4268x additionally carried a dummy member under CONFIG_CPP to
keep sizeof() consistent between C and C++.

Drop the structs and their instances and pass NULL for cfg_ptr, as
ltc4286, sb_tsi, bmp581 and bmi323 already do.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-09-14 08:43:02 -04:00
Furkan Akkiz
d439c42d77 drivers: gpio: Add GPIO disable functionality to MAX32 driver
This commit adds the ability to disable GPIO pins in the MAX32 driver.

Signed-off-by: Furkan Akkiz <hasanfurkan.akkiz@analog.com>
2026-09-14 08:42:52 -04:00
Johan Hedberg
b05a1fdf42 Bluetooth: hci_stm32wba: Serialize all BleStack_Request() calls
hci_lock exists to serialize the accesses to the controller through
BleStack_Request(), but only send() takes it: the vendor commands that
setup() and close() send bypass it. Nothing else calls into the
controller at those points of the current call sequence, so this is
not an observed race, but the invariant is the driver's own and is
cheap to hold unconditionally. Take the lock around both calls, with
the same error handling as send().

Assisted-by: Claude:claude-fable-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-09-14 08:42:24 -04:00
Johan Hedberg
560b657df9 Bluetooth: hci_stm32wba: Remove unused aci_set_ble_addr structure
The structure has no users: bt_hci_stm32wba_setup() builds the
ACI_HAL_WRITE_CONFIG_DATA command in a byte array instead.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-09-14 08:42:24 -04:00
Zafer SEN
5ceef4d230 drivers: modem: preserve NB-NTN RAT on NB-IoT URCs
Prevent NB-NTN RAT selection from being overwritten by NB-IoT
technology reports received from registration and KSTATEV URCs.

NB-NTN uses the NB-IoT protocol stack, so these URCs report
NB-IoT even when AT+KSRAT is set to NB-NTN. Treating those
reports as RAT changes caused false transitions from NB-NTN to
terrestrial NB-IoT and triggered unnecessary NTN reconfiguration
flows.

Keep AT+KSRAT readbacks as the authoritative source of RAT
selection and ignore NB-IoT URCs while NB-NTN is selected.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-09-14 08:42:15 -04:00
Zafer SEN
10aec52507 drivers: modem: enable NTN configuration for Auto-RAT fallback
Introduce a capability symbol that identifies configurations where
NB-NTN can become the active RAT at runtime and use it to enable
NTN-specific support independently of the compile-time RAT
selection.

Add MODEM_HL78XX_NTN_SUPPORT, which is enabled for dedicated
NB-NTN builds and for Auto-RAT builds that can transition to NTN
through the terrestrial-to-NTN fallback flow. Use this symbol to
gate NTN positioning configuration, KNTNCFG handling and NTN
event support throughout the driver.

Update RAT configuration handling to apply NTN configuration when
the modem is actually operating in NB-NTN mode, including after
an Auto-RAT fallback has latched KSRAT=3 and restarted. This
ensures NTN configuration is applied based on the runtime RAT
rather than solely on the compile-time RAT selection.

Allow NTN positioning configuration options to be available
whenever NTN operation is possible, including Auto-RAT builds
that may enter NTN mode dynamically.

These changes ensure dedicated NB-NTN and Auto-RAT fallback paths
share the same NTN configuration and positioning support,
preventing NTN-specific configuration from being omitted when the
modem reaches NB-NTN through runtime RAT transitions.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-09-14 08:42:15 -04:00
Zafer SEN
3599a61beb drivers: modem: revoke pending GNSS entry on exit request
Clear any queued GNSS mode entry request when an explicit GNSS
exit is requested.

A caller that invokes hl78xx_exit_gnss_mode() is signalling that
GNSS is no longer desired. If a pending entry request remains
latched, it may later be executed autonomously when the modem
reaches a state that can service GNSS, causing an unexpected
transition into GNSS mode after the caller has already requested
an exit.

Check for and clear any pending GNSS mode entry request before
processing the exit path. When the modem is not currently in GNSS
mode, this allows hl78xx_exit_gnss_mode() to revoke queued GNSS
work while preserving the existing "nothing to exit" behaviour.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-09-14 08:42:15 -04:00
Zafer SEN
39eb06b594 drivers: modem: retry init script on AT+CCID timeouts
Add a targeted recovery rule that retries the modem
initialisation script when AT+CCID goes unanswered,
before escalating to a modem reset.

An intermittent failure has been observed where
AT+CCID does not receive a response immediately after a
GNSS teardown. In this case the modem remains
responsive and a complete modem reset is usually
unnecessary. However, the existing recovery path
escalates directly to a reset after the init script
fails.

Introduce a retry-only recovery action for this
specific scenario.

Changes:
- Add hl78xx_recover_init_script_retry() recovery
  helper
- Add a recovery rule for AT+CCID timeouts and aborts
  in RUN_INIT_SCRIPT
- Re-run the init script on recovery success
- Limit retries to two attempts before fallback
  recovery occurs
- Retain the existing reset pulse escalation path when
  retries are exhausted

Recovery behaviour:

Before:
- AT+CCID timeout
- Init script failure
- Immediate escalation to modem reset

After:
- AT+CCID timeout or abort
- Retry the init script
- Retry a second time if required
- Fall back to modem reset only after retry budget is
  exhausted

The recovery action intentionally performs no repair of
its own. The observed failure mode is a missed response
rather than persistent modem corruption, so rerunning
the init script is itself the recovery mechanism. If
the modem is genuinely unresponsive, the retry will
fail again and existing recovery escalation will still
trigger a reset.

Benefits:
- Avoids unnecessary modem resets
- Reduces recovery time after transient AT+CCID
  failures
- Preserves the existing reset-based recovery path for
  persistent failures
- Improves robustness after GNSS teardown sequences
- Provides clearer diagnostics for init-script
  retry events

This change treats intermittent AT+CCID failures as a
recoverable initialisation issue and uses a bounded
init-script retry before resorting to a modem reset.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-09-14 08:42:15 -04:00
Zafer SEN
e671d9715d drivers: modem: ignore stale registration URCs during CFUN transitions
Harden modem state handling around CFUN transitions,
GNSS startup and inactivity-triggered power-down by
preventing stale registration state from driving modem
behaviour after the modem has already moved on.

Late registration URCs:

A transition to CFUN=0 or CFUN=4 can take several
seconds while the modem detaches from the network.
During this window the modem may flush queued CREG or
CEREG notifications from the previous state at the same
time the CFUN command completes.

Previously those delayed registration notifications
were processed normally, allowing obsolete registration
state to trigger follow-up actions against a modem that
was already switching SIMs, entering GNSS mode or
shutting down.

Changes:
- Mark phone-functionality transitions as in-progress
  before sending AT+CFUN
- Restore the previous state if the CFUN command fails
- Ignore registration-event dispatch while a transition
  to non-functional or airplane mode is active
- Continue recording reported registration state while
  suppressing side effects

This prevents stale registration notifications from
starting post-registration activity during modem state
transitions.

Power-down control:

Add explicit application ownership of pending modem
shutdowns.

Changes:
- Add HL78XX_POWER_DOWN_RESPONSE_ABORT
- Allow applications to cancel a pending shutdown
- Cancel scheduled shutdown work when shutdown is
  aborted
- Re-enable inactivity timer feeding after an abort
- Clear shutdown ownership state when cancellation
  occurs

This allows active operations such as searches,
reconnect flows, SIM switches and FOTA activity to
retain ownership of the modem without racing the
automatic power-down path.

Power-down backstop cleanup:

Improve inactivity timer handling when registration is
lost.

Previously a power-down backstop armed while registered
could remain queued after registration disappeared.
This allowed stale registration state to trigger modem
power-downs much later during unrelated modem activity.

Changes:
- Cancel pending power-down backstop timers when
  registration is no longer present
- Log cancellation events
- Preserve application-requested shutdown behaviour

This ensures the power-down watchdog remains tied to
its original registration condition.

GNSS startup robustness:

Improve recovery from GNSS startup races and missed
events.

Changes:
- Allow GNSS start requests to proceed even when the
  local running-state latch is already set
- Dispatch AT_CMD_READY from GNSS init entry when the
  normal airplane-mode path did not announce it
- Detect GNSS starts that never receive confirmation
- Report GNSS start failures instead of silently
  stalling

A previous race could leave all layers waiting for a
GNSS session that was never actually started. Sending
the command regardless and reporting startup failures
ensures recovery paths are activated.

Post-restart handling:

Update the post-restart script to explicitly enter
airplane mode before querying RAT state.

Changes:
- Add AT+CFUN=4 to the post-restart script sequence
- Ensure modem state is aligned before subsequent
  configuration and status queries

Benefits:
- Prevents stale registration events from influencing
  the new modem state
- Avoids erroneous post-registration processing during
  SIM switches, GNSS entry and shutdown
- Allows applications to veto pending modem shutdowns
- Eliminates delayed shutdowns caused by stale
  registration activity
- Improves GNSS startup reliability
- Recovers from missed readiness notifications
- Maintains consistent modem state after restart

The modem now treats registration state, shutdown
ownership and GNSS startup as state-machine scoped
operations, preventing notifications and timers from a
previous modem state leaking into the next one.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-09-14 08:42:15 -04:00
Zafer SEN
3504840322 drivers: modem: run modem init before restoring LTE
Fix LTE restoration after GNSS and carrier-off flows
when the current modem session has not yet completed
its initialization sequence.

The driver intentionally ignores registration URCs
while init_sequence_completed is false. A modem boots
in an unconfigured state and registration events that
arrive before the configuration chain has completed
must not drive search-policy decisions.

However, a session that detours directly into GNSS or
airplane mode during startup can later restore LTE by
entering RUN_ENABLE_GPRS_SCRIPT directly. In that
case the configuration chain is bypassed entirely.

The modem can successfully register, but the resulting
CxREG notifications are discarded because the session
is still marked uninitialized. Search policy never
observes the registration and eventually times the RAT
out despite service being available.

Changes:
- Add hl78xx_enter_lte_restore_state()
- Route LTE restoration through RUN_INIT_SCRIPT when
  init_sequence_completed is false
- Continue to enter RUN_ENABLE_GPRS_SCRIPT directly
  once the session has already been configured
- Use the helper when leaving GNSS mode
- Use the helper from carrier-off LTE recovery paths
- Increase visibility of discarded registration URCs
  while initialization is incomplete

The new helper centralizes LTE restoration decisions
and guarantees that every return path to LTE applies
the required configuration sequence before attempting
network registration.

Benefits:
- Prevents LTE registration on unconfigured sessions
- Ensures registration URCs reach search policy
- Avoids false RAT search timeouts
- Prevents coverage from being misclassified as
  unavailable
- Keeps GNSS, airplane-mode and carrier recovery
  behaviour consistent
- Provides diagnostics when registration is ignored
  due to an incomplete initialization sequence

A modem session that reaches GNSS or airplane mode
before initialization now completes the configuration
chain before restoring LTE service, ensuring
registration events are accepted and processed
correctly.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-09-14 08:42:15 -04:00
Zafer SEN
ecad221394 drivers: modem: invalidate cached state across modem restarts
Reset driver-maintained modem and GNSS state whenever a
modem session ends and a new one begins.

Several driver caches describe runtime state inside the
modem, including phone functionality and GNSS engine
status. These values are learned from AT responses and
URCs and are only valid for the current modem session.

Previously they could survive power cycles, graceful
shutdowns and unexpected restarts, allowing stale state
from a previous modem session to influence decisions in
the next one.

Changes:
- Add hl78xx_reset_modem_session_state()
- Add hl78xx_gnss_reset_session_state()
- Reset modem session state at power-on
- Reset modem session state before power-off
- Reset modem session state after unexpected restarts
- Reset modem session state after configuration-driven
  modem reboots
- Invalidate cached phone functionality across session
  boundaries
- Clear stale GNSS runtime state and search latches

Phone functionality handling:

Introduce explicit validity tracking for cached CFUN
state.

A cached functionality value cannot be trusted across a
modem restart because modem firmware may boot in a
different state or preserve functionality settings
across some reset paths.

Changes:
- Add phone_functionality.valid
- Mark functionality valid only after modem-confirmed
  CFUN information
- Invalidate cached functionality at every session
  boundary
- Require a valid functionality reading before taking
  GNSS airplane-mode shortcuts

This prevents logic from acting on functionality values
that belong to a previous modem session.

GNSS recovery:

Reset GNSS state derived from the previous modem
session:

- search_state
- gnss_start_status
- gnss_init_status
- exit_to_lte_pending
- RRC recovery state

Pending GNSS requests are intentionally preserved
because they represent caller intent rather than modem
state and are expected to be serviced after restart.

Without this reset a stale GNSS start latch could
survive a modem restart and permanently block later
searches because only URCs from the terminated session
could clear it.

GNSS initialization:

Only use the airplane-mode shortcut when the modem has
confirmed the functionality state during the current
power session.

When functionality is not verified, GNSS initialization
now explicitly drives the modem to CFUN=4 rather than
assuming a cached AIRPLANE state is still valid.

Benefits:
- Prevents stale modem state from leaking across
  restarts and power cycles
- Eliminates invalid CFUN assumptions after reboot
- Prevents stale GNSS latches from blocking searches
- Improves recovery after unexpected modem restarts
- Ensures GNSS startup decisions use modem-confirmed
  state
- Makes modem session boundaries explicit in the driver

Treat every modem power cycle and restart as a new
session by discarding cached runtime state that no
longer reflects modem reality.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-09-14 08:42:15 -04:00
Zafer SEN
625d4f6218 drivers: modem: harden PDP activation and power-down recovery
Improve HL78xx behaviour when GSM PDP activation stalls or a
power-down request interrupts network bring-up.

Split the carrier-on path into PDP activation and post-activation
handling so recovery and retry paths resume from a single point.
When PDP activation fails, transition through CARRIER_OFF rather
than continuing with stale network state. This prevents DNS and
carrier readiness from being reported when no working PDP context
exists and allows normal search-policy recovery.

Extend GSM PDP activation handling to use a timeout aligned with
the modem's activation behaviour and match the full terminal
response set. This distinguishes activation refusals from missing
modem responses and avoids command-stream desynchronisation during
long-running activation attempts.

Add shutdown ownership tracking for modem power-down handling.
Once shutdown is requested, abort any active script that owns the
chat interface, prevent new network activity from starting, and
allow power-off processing to complete cleanly even when PDP
activation is still in progress.

Add a timeout backstop for the graceful power-off sequence and
continue shutdown when detach scripts fail, time out, or cannot be
started. This prevents the modem from remaining powered
indefinitely when the network or command interface does not
respond.

Introduce a helper for aborting the currently active chat script
and use it during shutdown to release synchronous script waiters
and free the command interface.

Improve DNS recovery by detecting resolver contexts that contain
configured servers but never completed initialisation. Rebuild the
resolver context and reopen DNS sockets when reconfiguration would
otherwise report success without restoring resolver functionality.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-09-14 08:42:15 -04:00
Zafer SEN
a6ed563734 drivers: modem: hl78xx: support eUICC ICCID responses
Update AT+CCID parsing to handle eUICC responses that
include both the ICCID and EID.

The existing implementation expected AT+CCID responses
to contain only an ICCID:

    +CCID: <iccid>

However, eUICCs return:

    +CCID: <iccid>,<eid>

The chat matcher treated the entire response as a single
field, causing ICCID handling to fail when an EID was
present.

Changes:
- Split AT+CCID responses on ',' in the chat matcher
- Accept both two-field and three-field callback
  arguments
- Continue storing only the ICCID
- Ignore the EID portion of the response

Examples:

Physical SIM:
- +CCID: <iccid>
- argc = 2
- argv[1] = ICCID

eUICC:
- +CCID: <iccid>,<eid>
- argc = 3
- argv[1] = ICCID
- argv[2] = EID

This preserves existing SIM behaviour while adding
support for eUICCs that append an EID to the AT+CCID
response.

Fixes ICCID retrieval failures on eUICC-equipped
devices by ensuring the ICCID is parsed correctly
regardless of whether an EID is returned.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-09-14 08:42:15 -04:00
Zafer SEN
60098dce6b drivers: modem: hl78xx: add Auto-RAT inhibit and AT busy query APIs
Improve HL78xx startup handling and add APIs that allow
higher layers to safely coordinate Auto-RAT and dynamic
AT command activity.

Startup handling:
- Treat all non-zero +KSUP statuses as startup failures
- Detect startup failures independently of restart state
- Prevent failed first boots from being reported as
  successful startups
- Preserve first-successful-boot semantics after a
  failed startup attempt
- Document propagation of the raw +KSUP status value to
  application handlers

Auto-RAT control:
- Add driver-level Auto-RAT inhibit state
- Add public API to enable or clear Auto-RAT restore
  inhibition
- Prevent hl78xx_rat_cfg() from automatically restoring
  configured PRLs while inhibition is active
- Preserve intentionally cleared PRLs across modem
  restarts

NB-NTN support:
- Support workflows that deliberately clear terrestrial
  Auto-RAT PRLs before moving to NB-NTN operation
- Prevent restart processing from immediately restoring
  terrestrial PRLs and undoing the requested
  configuration
- Avoid unnecessary restart cycles caused by repeated
  PRL reapplication

AT command coordination:
- Add API to query whether the modem chat engine is
  currently running a script
- Expose driver busy state to higher-layer modules
- Allow callers to avoid predictable -EBUSY failures
  before attempting dynamic AT commands
- Preserve existing requirement to handle send failures
  due to inherent race conditions

Driver APIs:
- Add hl78xx_set_autorat_inhibit()
- Add hl78xx_at_is_busy()
- Add corresponding public API documentation
- Add implementation-defined behaviour descriptions and
  usage guidance

Implementation details:
- Store Auto-RAT inhibit state within the driver
  context
- Protect inhibit updates with the existing API lock
- Use modem_chat execution state when reporting AT bus
  availability
- Default invalid device queries to a safe "busy"
  result

Benefits:
- Fixes incorrect startup success reporting for failed
  first boot attempts
- Enables deliberate PRL-clearing workflows to survive
  modem restarts
- Prevents Auto-RAT configuration from undoing NB-NTN
  transitions
- Reduces unnecessary AT command failures caused by
  avoidable modem-chat contention
- Provides explicit coordination mechanisms between the
  HL78xx driver and higher-level modem management logic

This change strengthens startup-state correctness and
adds the driver controls required for higher layers to
manage Auto-RAT and AT-command ownership safely during
advanced modem configuration workflows.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-09-14 08:42:15 -04:00
Zafer SEN
42a720d72a drivers: modem: reset init completion state on power-on entry
Move init_sequence_completed state reset to the entry
point of the power-on sequence.

Changes:
- Clear boot.init_sequence_completed when entering
  AWAIT_POWER_ON
- Remove the later reset performed after UART
  configuration in the power-on event handler

Rationale:
- Ensure initialization state is reset immediately when a
  new modem boot cycle begins
- Better align the flag lifetime with the modem power
  state machine
- Avoid carrying completion state from a previous boot
  cycle during startup processing
- Make initialization tracking deterministic across modem
  restarts and power cycles

Behavior:
- Each modem power-on sequence now starts with
  init_sequence_completed cleared
- AT command readiness handling remains unchanged
- Initialization completion continues to be reported only
  after the current boot sequence finishes successfully

This change improves state-machine correctness by tying
initialization state reset to the start of a modem power
cycle rather than a later stage of the startup process.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-09-14 08:42:15 -04:00
Zafer SEN
81a476520d drivers: modem: avoid configuring APN for NB-NTN PDP contexts
Change NB-NTN PDP context provisioning to leave the APN
field empty when configuring modem data contexts.

Changes:
- Use an empty APN in AT+CGDCONT configuration
- Use an empty APN in the NB-NTN AT+KCNXCFG command path
- Keep existing APN handling unchanged for non-NB-NTN RATs

Before:
- AT+CGDCONT=1,"<family>","<apn>"
- AT+KCNXCFG=1,"GPRS","<apn>",,,   (NB-NTN)

After:
- AT+CGDCONT=1,"<family>",""
- AT+KCNXCFG=1,"GPRS","",,,        (NB-NTN)

This allows APN selection for NB-NTN connections to be
handled by modem, SIM, or network provisioning rather than
being explicitly programmed by the driver.

Non-NB-NTN behavior is unchanged.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-09-14 08:42:15 -04:00
Zafer SEN
f37e0f3f82 drivers: modem: hl78xx: add GNSS search timeout query API
Add an API for retrieving the remaining GNSS search timeout
from the HL78xx modem driver.

Changes:
- Add hl78xx_get_timer_remaining() helper to expose the
  remaining timeout work duration
- Add
  hl78xx_gnss_get_search_timeout_remaining() public GNSS
  API
- Export API declaration in hl78xx_apis.h
- Return remaining timeout only while GNSS is in STARTING
  or SEARCHING states

The new API allows applications to determine how much time
remains in the current GNSS search window without needing
to track timeout values externally.

Behavior:
- Returns the remaining search timeout in milliseconds
- Returns 0 when GNSS is not actively searching
- Validates modem and GNSS context availability before
  reporting timeout information
- Reuses the existing modem timeout infrastructure

This improves GNSS status reporting and enables
applications to present accurate search progress and
remaining-time information to users.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-09-14 08:42:15 -04:00
Nhut Nguyen
6131cf94b7 drivers: i2c: renesas: use DEVICE_MMIO for register access
Add DEVICE_MMIO_ROM/RAM to the config and data structs and map the
peripheral region with DEVICE_MMIO_MAP() at init, so the driver works
on RZ SoCs where the MMU requires an explicit device mapping instead
of using physical addresses directly.

Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2026-09-14 08:42:01 -04:00
Liam Ogletree
4403457d53 drivers: haptics: Cleanup and bug fixes for CS40L26/27 PM handling
Fixes PM put/get leaks and adds uniform log messages for PM-related
failures.

Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
2026-09-14 08:41:47 -04:00
Liam Ogletree
3bec58d346 drivers: haptics: Cleanup and bug fixes for CS40L5X PM handling
Fixes PM put/get leaks, moves the regulator from resume/suspend
to turn off/turn on, adds trigger gpios to PM framework, and
adds uniform log messages for PM-related failures.

Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
2026-09-14 08:41:47 -04:00
Gerhard Jörges
48fc53325b drivers: otp: implement otp_program for stm32 MCUs
adds support to program the OTP memory on stm32 MCUs

Signed-off-by: Gerhard Jörges <joerges@metratec.com>
2026-09-14 08:41:42 -04:00
Gerhard Jörges
f611fde6d3 drivers: flash: Change init level to PRE_KERNEL_1 for STM flash drivers
preparation to add OTP runtim program support

Signed-off-by: Gerhard Jörges <joerges@metratec.com>
2026-09-14 08:41:42 -04:00
Robert Robinson
95981292ca drivers: adc: nrfx_saadc: Enable support for connecting PSELP to ground
For any adc measurements where the input must selected on PSELN, PSELP
must be grounded in order to obtain a valid reading. This can be
achieved using AVSS input selection. This commit adds support for this.

Signed-off-by: Robert Robinson <robert.robinson@nordicsemi.no>
2026-09-14 08:41:37 -04:00
Amneesh Singh
308bb5709a drivers: flash: mspi_nor: do JEDEC ID verification after switching
Right now JEDEC ID verification is done before switching IO mode; so,
abstract the verification part into it's own function and call it twice,
once at the start and second after switching.

Signed-off-by: Amneesh Singh <amneesh@ti.com>
2026-09-14 08:41:32 -04:00
Amneesh Singh
1fcee49018 drivers: flash: mspi_nor: add s28hx512t flash
- Add support for Infineon Semper S28HX512T NOR flash. This supports SPI
  mode (1S-1S-1S), 8S-8S-8S and 8D-8D-8D.

- Expose set_up_xfer_with_addr, read_jedec_id and soft_reset_66_99
  function declarations to the vendor specific quirks.

- Add more macros to the spi_nor_s28hx512t.h header that can be used in
  addition to the already present macros.

- Add a specific quirk that is only used when the parent controller for
  this flash is Cadence MSPI (OSPI). This involves calibrating a delay for
  capturing data on the controller by reading JEDEC IDs on different
  configurations.

- Add DT binding for the flash to allow convenient Kconfig symbols that
  depend on the presence of the compatible flash node in the DT.

- Move FLASH_MSPI_QUIRKS_GET to the bottom of file in
  flash_mspi_nor_quirks.h header.

Signed-off-by: Amneesh Singh <amneesh@ti.com>
2026-09-14 08:41:32 -04:00
Amneesh Singh
b516b1f2ee drivers: flash: mspi_nor: fix initial MSPI configuration
Use DT for initial endianness configuration since it should be the
same as the target endian configuration.

The initial MSPI dev_config() call applied MSPI_DEVICE_CONFIG_ALL. Use
NON_XIP_DEV_CFG_MASK instead, which excludes parameters that do not need
configuration.

Signed-off-by: Amneesh Singh <amneesh@ti.com>
2026-09-14 08:41:32 -04:00
Amneesh Singh
4abc28c23e drivers: flash: flash_mspi_nor: fix octal cmd read
DDR Octal SPI configurations require reading an even number of bytes at a
time. This includes commands such as RDSR (Status Register) and RDID
(JEDEC ID). Currently this can cause timing issues, hence use an even
number of bytes for the both aforementioned commands if the data rate is
dual.

Signed-off-by: Amneesh Singh <amneesh@ti.com>
2026-09-14 08:41:32 -04:00