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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
Cadence MSPI controller uses a FIFO for indirect access operations on the
device on bus. Right now we directly use the physical address provided via
DT. This does not work on cores with MMU like A53; hence, map the FIFO
address the same way base contrller register space is mapped.
Signed-off-by: Amneesh Singh <amneesh@ti.com>
Add the read delay field in the timing configuration to allow configuring
delay for read data capture. This is supposed to be set either by the
peripheral using this controller at runtime or the user.
Additionally, also make the related struct and parameters public by
separating out the header.
Signed-off-by: Amneesh Singh <amneesh@ti.com>
Add a mechanism to configure the CS timing based on the configured clock
frequency for the peripheral (SCLK) in reference clock cycles for the
controller (RCLK).
Signed-off-by: Amneesh Singh <amneesh@ti.com>
We configure address length as 'length - 1' in the controller. This
currently does not check if the length is 0, in which case it causes
unsigned integer underflow, so add a check for that.
Signed-off-by: Amneesh Singh <amneesh@ti.com>
Cadence OSPI controller allows dual byte opcodes which are used by the
flash on the bus for modes such as Octal SDR/DDR. Hence, allow
configuration for dual byte opcodes.
Signed-off-by: Amneesh Singh <amneesh@ti.com>
Cadence OSPI/QSPI controller allows peripherals on its bus to have
configurations like 8D-8D-8D or 4S-4D-4D which require DTR configuration
for dual transfer rate. Hence, allow having DTR configuration in the
driver.
Signed-off-by: Amneesh Singh <amneesh@ti.com>
Add a Cadence MSPI peripheral driver, used in the TI K3 platform. The
driver was tested in 1S-1S-1S and 4S-4S-4S mode with the onboard infineon
s25h flash of the am243x launchpad and a custom driver for the flash using
this interface.
The command and dummy cycles are always taken from the xfer request and
never from the devicetree since different commands might have different
latencies.
The driver is somewhat basic for now and lacks e.g. callback
implementation. This is something that can be added in the future. If a
non-supported / invalid request is detected a error code is returned.
Signed-off-by: Mika Braunschweig <mika.braunschweig@siemens.com>
The free-running 64-bit wall clock (external to the CPUs, shared across
SMP) with its absolute comparator. Arming disarms the comparator, writes
both halves and rearms it, so a counter that reaches the target during
that sequence leaves the match unarmed, and on a 64-bit counter it never
comes round again. That makes this a COMPARE_EXACT backend: the core
rewrites through its verify loop until the target is genuinely ahead of
the counter, which is what the driver's MIN_DELAY floor used to
approximate.
The driver keeps timer_driver_cycle_get() (the counter) and
timer_driver_set_compare() (arm the comparator), and the core takes over
the tick accounting: the last_count baseline, the deadline math, the
range clamp and the announce. The ISR reduces to acknowledging the
trigger and announcing.
The wall clock is a genuine 64-bit counter on this 32-bit CPU, so
TIMER_CORE_COUNTER_WIDTH is set to 64 to use its full range.
The driver keeps both cycle getters: count32() reads the counter's low
half in a single access where the core's extend path takes three, and a
driver that supplies one getter supplies the other.
Build-tested on intel_adsp/cavs25 and intel_adsp/ace15_mtpm.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Add error logs for failed interrupt GPIO initialization. This should make
it clearer as to why CAN driver driver initialization failed.
Fixes: #117799
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Hold the Ethernet MAC in reset while the pads, the PHY interface and
the clocks are configured, and release it once the setup is done. The
PHY interface selection is sampled when the MAC leaves reset, so it
has to be in place before that.
The MCXE31x has no reset line for the MAC, so its clocks are gated for
the same purpose there.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
z_vrfy_charger_get_prop left k_val uninitialized and copied the whole
union out on success, while a driver only writes the one member the
property selects. Every successful read therefore handed user mode up
to 15 bytes of kernel stack.
Zero the union first. The fuel gauge verifier avoids this by copying
the caller's value in beforehand.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:claude-opus-5
union charger_propval carries two function pointers, selected by
CHARGER_PROP_STATUS_NOTIFICATION and CHARGER_PROP_ONLINE_NOTIFICATION.
z_vrfy_charger_set_prop copied the whole union in without inspecting
prop, and drivers store those members and later call them.
z_vrfy_charger_get_prop copied the union back out the same way.
Reject both properties in both verifiers, including when the callback
is NULL: the notifiers are device state, so allowing a clear would let
user mode disable a notifier a supervisor thread installed. A
BUILD_ASSERT on CHARGER_PROP_COMMON_COUNT forces the list to be
revisited when a property is added. Supervisor mode is unaffected.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:claude-opus-5
Adds two API functions:
- haptics_set_trigger() to configure edge-triggered effects
- haptics_trigger() to trigger the effect
Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
GPTIMER has no absolute compare register, only a relative reload, so it is
a RELOAD backend: subtimer 1 free-runs as the cycle source and subtimer 0
is loaded with the relative delay the core derives from a tick-aligned
deadline. The driver keeps timer_driver_cycle_get() (the free-running
counter) and timer_driver_set_reload() (program subtimer 0); the core takes
over the announce baseline, the deadline math, the range clamp and the
announce. The ISR reduces to acknowledging, one-shot stop when tickless and
keep periodic otherwise, and announcing.
The subtimers run at the system rate divided by the shared prescaler, so
the core works in that divided cycle domain and derives its cycles-per-tick
from it. sys_clock_cycle_get_32() stays the driver's own and scales the
subtimer count back up to the system cycle rate.
timer_api, context, sleep and tickless pass on qemu_leon3, and timer_api
passes there with CONFIG_TICKLESS_KERNEL=n (the periodic path).
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
counter_rpi_pico_timer_set_alarm() computed the alarm target using
only the low 32 bits of the hardware's free-running microsecond
counter (TIMERAWL), which wraps every ~71.6 minutes. Once uptime
exceeded this, every subsequent alarm target was computed against a
stale/wrapped "now", causing timer_hardware_alarm_set_target() to
always report the target as missed. This made counter_set_channel_alarm()
return -ETIME permanently until reboot.
Fix by reading the full 64-bit hardware time instead of the
truncated low word.
Fixes#115552
Signed-off-by: Rene Zeiml <renezeiml@hotmail.com>
Assisted-by: Claude:claude-sonnet-5
Add support for adding multiple CAN controller state change callbacks to a
single CAN controller driver instance.
The new state change callbacks must be initialized by the caller via
can_init_state_change_callback() and added/removed via new API functions
can_add_state_change_callback() and can_remove_state_change_callback().
Adapt the existing API can_set_state_change_callback() API function to be a
wrapper for the new API functions.
Replace the mandatory can_set_state_change_callback_t() driver ops with an
optional can_state_change_callbacks_enabled_t() driver ops, allowing CAN
controller drivers to enable/disable state change IRQs based on whether any
state change callbacks are added.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
The GPIO callback forwarded its first argument, which is the GPIO
controller device, to the sensor trigger handler instead of the
HDC302x device. Store a back-pointer to the sensor device in the
driver data and pass that to the handler.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
In trigger-on-demand mode, sample_fetch() issued the measurement
command and immediately read the result, but the sensor NACKs the
read until the conversion completes (up to 12.5 ms in LPM0), so every
fetch failed. Sleep for the datasheet measurement duration of the
selected power mode before reading.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The forward conversion borrowed from the integer part on a negative
remainder, producing val1 negative with val2 positive, which violates
the struct sensor_value contract. Keep the integer part truncated
toward zero and let val2 carry the sign of the result.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The probe fused the CRC check and the ID comparison with &&, so init
only failed when both the CRC was bad and the ID mismatched, making the
identity check dead code for any CRC-valid response. Split it into two
independent guards returning -EIO and -EINVAL respectively.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
Added pm_action suspend/resume/turn_on routine for I2C
Assisted-by: Claude:claude-opus-4.8
Signed-off-by: Richard Mc Sweeney <Richard.McSweeney@infineon.com>
Replace direct NVIC pending-state calls with k_irq_set_pending()/
k_irq_is_pending()/k_irq_clear_pending(), dropping the dependency on
cmsis_core.h where nothing else needed it.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Replace direct NVIC pending-state calls with k_irq_set_pending()/
k_irq_is_pending()/k_irq_clear_pending(), dropping the dependency on
cmsis_core.h where nothing else needed it.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
TIMER_CORE_COUNTER_WIDTH used __LONG_WIDTH__, a predefined macro that
doesn't exist with older toolchains such as the Xtensa xt-clang
(Clang 10.0.1).
Use (__SIZEOF_LONG__ * 8) instead, which every GCC/Clang defines and
yields the same width.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
A CONFIG_CODING_GUIDELINE_CHECK build compiles the driver with
-Wimplicit-fallthrough=2, which flags two case reaches. The await power
on handler means its one, so mark it. The RING case in await ppp dead
does not, and ending it makes no observable difference, checked by
driving RING into that state with the timeout pending.
Signed-off-by: Paulo Santos <pauloxrms@gmail.com>
Added pm_action suspend/resume/turn_on routine for DMA
Assisted-by: Claude:claude-opus-4.8
Signed-off-by: Richard Mc Sweeney <Richard.McSweeney@infineon.com>
Handle PSC3M6 SCB naming differences in the PDL. Select the
multi-processor-mode field for the UART under SOC_DIE_PSC3M6.
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Richard Mc Sweeney <Richard.McSweeney@infineon.com>
Signed-off-by: Niranjan M <niranjan@aerlync.com>