Commit graph zephyr/drivers
Author SHA1 Message Date
Jaro Van Landschoot
1dfd0e2142 drivers: counter: mcux_gpt: add configurable clock source
Allow selecting from all five GPT clock sources (off, periph,
high-freq, ext, low-freq, osc) via a new clock-source DT property.
The ext source fixes the prescaler at 1 since the frequency
is unknown to software.

gptfreq is no longer required when clock-source = "ext", in which
case counter_get_freq() returns 0 and callers work in raw ticks.

Signed-off-by: Jaro Van Landschoot <jaro.vanlandschoot@basalte.be>
2026-07-24 14:08:12 +02:00
Holt Sun
e9365a37f9 drivers: rtc: irtc: implement clock calibration
The NXP IRTC driver declared the RTC calibration ops but left both
set_calibration and get_calibration as -ENOTSUP stubs, even though
they are wired into the API table under CONFIG_RTC_CALIBRATION.

Implement them on top of the IRTC coarse compensation logic. With
fine compensation disabled, COMPEN[7:0] is a two's-complement count
of RTC source clock cycles added to / removed from the cycles used
to generate one 1 Hz tick, applied once per COMPEN[15:8]-second
interval. The source clock frequency is taken from the node's
clock-frequency property (16.384 kHz or 32.768 kHz) rather than
CTRL[CLK_SEL], because that field is not configured / readable on
every IRTC platform (e.g. RT700 does not set clock-src). Fixing the
interval at 1 s gives ppb = value * 1e9 / cycles; set() computes the
rounded register value, rejects values outside the -128..+127
register range with -EINVAL, and get() reports the programmed
(quantized) value so a set()/get() round-trips at the hardware
resolution.

A positive COMPEN value adds source clock cycles and slows the RTC
down (measured on MCXN236 hardware), while the RTC API defines
positive calibration as increasing the RTC frequency, so the value
is negated in both directions.

Per the RM, with CTRL[FINEEN] = 0 compensation must be disabled via
CTRL[COMP_EN] before COMPEN is changed for the first time, so the
update sequence always disables compensation around the COMPEN
write. get() reports 0 when compensation is disabled. Both ops
return -EPERM on a share-counter secondary instance, whose time
counters are owned by the primary IRTC. All register access reuses
the driver's existing write-protection unlock under irq_lock rather
than the MCUX HAL, which does not unlock write protection.

Validated on frdm_mcxn236 (16.384 kHz source):
tests/drivers/rtc/rtc_api with CONFIG_RTC_CALIBRATION=y passes 4/4,
and a differential second-edge timing measurement against the CPU
cycle counter confirms +max/-max calibration shortens/lengthens the
RTC second by the expected ~0.77%.

Link: MCX N23x Reference Manual, Rev. 4 - RTC chapter 43 (COMPEN 43.5.1.18)
Signed-off-by: Holt Sun <holt.sun@nxp.com>
2026-07-24 09:45:42 +02:00
Holt Sun
9c85a60d3e drivers: rtc: irtc: fix undefined identifier in update callback stub
nxp_irtc_update_set_callback() called ARG_UNUSED(calibration) on an
identifier that does not exist in that function, which would fail to
compile with CONFIG_RTC_UPDATE=y. Reference the actual unused
parameter (callback) instead.

Signed-off-by: Holt Sun <holt.sun@nxp.com>
2026-07-24 09:45:42 +02:00
Liang Jiaxiang
5277513c36 drivers: clock_control: stm32h5: wait for PLL1 to be fully disabled
The STM32H5 clock driver disabled PLL1 before reconfiguring it but
did not wait until PLL1RDY was cleared. On STM32H5 this can leave
PLL1 reconfiguration unreliable when switching to a high-frequency
system clock during early boot.

Wait for PLL1 to be fully disabled (PLL1RDY cleared) before
reconfiguring it, as required by the reference manual.

Signed-off-by: Liang Jiaxiang <moonbite233@gmail.com>
2026-07-24 09:45:14 +02:00
Svitlana Drozd
6efcc8f9df drivers: scmi: shell: add base subcommands
Introduce initial implementation of shell subcommands for the SCMI Base
protocol. This expands the existing `scmi` shell command with a new
`base` subcommand, allowing users to access SCMI Base operations from
the shell.

Previously, only clock protocol commands were available through the SCMI
shell interface. This change adds support for retrieving protocol
version and platform revision information, discovering agents,
configuring device permissions, and resetting agent configurations,
using base protocol.

The change also updates CMakeLists.txt to include the new 'base.c'
source file when SCMI Base helpers are enabled.

Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
Signed-off-by: Svitlana Drozd <svitlana_drozd@epam.com>
2026-07-24 09:43:42 +02:00
Svitlana Drozd
f5aa099f0d firmware: scmi: improve base protocol api
Refactor SCMI base protocol API by removing the version extraction from
the `scmi_base_get_revision_info` function and renaming to the
`scmi_base_get_platform_info`.

Previously, the implementation version (`impl_ver`) was not stored
in the platform info structure, resulting in incomplete data. Fix
this by assigning `impl_ver` after retrieving the implementation
version.

Add the new `scmi_base_get_num_agents` function to simplify
agent_id input validation, eliminating the need to call the larger
`scmi_base_get_revision_info` for simple check.

Signed-off-by: Svitlana Drozd <svitlana_drozd@epam.com>
2026-07-24 09:43:42 +02:00
Tim Lin
dbc5448bcb drivers/flash: it51xxx: Retrieve flash info based on the selected flash
Previously, flash parameters (size, erase/write block size) were
hardcoded for internal flash only.

Introduce struct flash_info and update_flash_info() to dynamically
resolve flash parameters based on the active flash target (internal,
external CS0/CS1).

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2026-07-23 21:03:57 -07:00
Samuel Slesar
47b852b651 drivers: add MCXL LPSPI clocks
Add LPSPI0 and LPSPI1 clock rate handling for MCXL SoCs.

Signed-off-by: Samuel Slesar <samuel.slesar@nxp.com>
2026-07-23 21:01:14 -07:00
Titouan Christophe
0ed82c89a4 drivers: audio: wm8904: use subsystem log level
No logging level was defined for the WM8904 audio codec driver.
Set it to the audio codec log level, allowing for uniformized,
yet granular log level control.

Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
2026-07-23 17:16:47 -07:00
Titouan Christophe
ebcf74dc78 drivers: audio: pcm1681: use subsystem log level
No logging level was defined for the PCM1681 audio codec driver.
Set it to the audio codec log level, allowing for uniformized,
yet granular log level control.

Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
2026-07-23 17:16:47 -07:00
Titouan Christophe
2b9932c2e9 drivers: audio: max98091: use subsystem log level
No logging level was defined for the MAX98091 audio codec driver.
Set it to the audio codec log level, allowing for uniformized,
yet granular log level control.

Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
2026-07-23 17:16:47 -07:00
Titouan Christophe
4c3d136853 drivers: audio: cs43l22: use subsystem log level
No logging level was defined for the CS43L22 audio codec driver.
Set it to the audio codec log level, allowing for uniformized,
yet granular log level control.

Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
2026-07-23 17:16:47 -07:00
Benjamin Cabé
95ce9e7bb4 drivers: ethernet: w6100: Skip no-op SLIRCLR write
SLIRCLR is write-1-to-clear, so writing zero clears nothing. Skip the
SPI write when slir is zero.

Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 17:16:19 -07:00
Anton Puppe
2fead6e31e drivers: add Hamamatsu S9706 digital color sensor driver
Add a driver for the Hamamatsu S9706 digital RGB sensor using plain
GPIOs. All parameters (e.g. integration time and sensor range) are
runtime-configurable via sensor attributes.

Signed-off-by: Anton Puppe <anton-noel-flynn.puppe@zeiss.com>
2026-07-23 17:14:29 -07:00
Simon Duquennoy
7f85410504 drivers: wifi: nrf_wifi: lower default RAM footprint for nrf70 Series
Adjust defaults on nRF70 Series for a lower RAM footprint.
A 130 kB heap is too large for many applications.

Signed-off-by: Simon Duquennoy <simon.duquennoy@nordicsemi.no>
2026-07-23 18:02:43 -04:00
Benjamin Cabé
efd0c6c2aa drivers: fuel_gauge: lc709203f: Propagate error code from temp mode config
Store the return value of lc709203f_set_temp_mode() in ret so errors
during temperature mode configuration are properly logged and detected
rather than testing a stale return value.

Assisted-by: Antigravity:gemini-3.6-flash
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 18:01:45 -04:00
Raffael Rostagno
99e635ace5 drivers: gpio: esp32: Fix deep_sleep current on first cycle
LP IO wakeup sampling needs the independent LP IO clock enabled
when programming pin wakeup. Without it, the first deep sleep
cycle can draw excess current until sleep prepare force-enables
the clock. Enable/disable the clock with EXT1/GPIO wakeup setup.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-07-23 13:47:07 -05:00
Benjamin Cabé
7f3bfe7495 drivers: i3c: stm32: Free the static address after DAA
After dynamic address assignment the code intends to release the
device's static address, but freed the newly assigned dynamic
address instead, undoing the reservation made just above and
allowing the same dynamic address to be handed out again.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 13:46:35 -05:00
Benjamin Cabé
21b896d8a0 drivers: i3c: max32: Free the static address after DAA
After dynamic address assignment the code intends to release the
device's static address, but freed the newly assigned dynamic
address instead, undoing the reservation made just above and
allowing the same dynamic address to be handed out again.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 13:46:35 -05:00
Benjamin Cabé
30645ad551 drivers: i3c: npcx: Free the static address after DAA
After dynamic address assignment the code intends to release the
device's static address, but freed the newly assigned dynamic
address instead, undoing the reservation made just above and
allowing the same dynamic address to be handed out again.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 13:46:35 -05:00
Benjamin Cabé
4354b42fb8 drivers: i3c: mcux: Free the static address after DAA
After dynamic address assignment the code intends to release the
device's static address, but freed the newly assigned dynamic
address instead, undoing the reservation made just above and
allowing the same dynamic address to be handed out again.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 13:46:35 -05:00
Benjamin Cabé
e03e40aec4 drivers: sensor: max32664c: Fix gender algorithm config sub-index
Setting the gender attribute wrote sub-index 0x08, which belongs to
age (height 0x06, weight 0x07, age 0x08), overwriting the age
setting. Use sub-index 0x09.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 11:46:21 -07:00
Benjamin Cabé
1fd8608075 drivers: sensor: max31875: Pass a mask to the config update helper
The full-scale attribute passed MAX31875_DATA_FORMAT_SHIFT (a bit
position) as the register mask, clearing the conversion-rate bits and
never setting the data format. Use BIT(MAX31875_DATA_FORMAT_SHIFT).

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 11:46:21 -07:00
Ibrahim Abdalkader
93c32f240c drivers: wifi: esp_hosted: Support full-duplex SPI transfer.
Before this change, the host performed half-duplex SPI transactions,
which caused frames that happen to be queued by ESP at the same time
of a TX transfer to be dropped. This is especially noticeable with
the new firmware.

Rework the driver so every SPI transaction is full-duplex: outgoing
frames are queued and the event task drains TX while simultaneously
capturing RX, so nothing is lost.

Other major improvements of the driver:
* Remove SPI bus semaphore, since only the event task uses the bus now.
* Reduce stack usage of all threads by 50% by refactoring data structures.
* Simplify event task by moving fragment validation and reassembly into
  a utility function.
* Fix undefined behavior in checksum validation.
* Fix the reassembly overflow guard (was off by twice the header).
* Split TX/RX queue sizes into separate Kconfig options.
* Fix and improve error codes usage (use -ENOBUFS, -EMSGSIZE, etc).

Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
2026-07-23 11:45:33 -07:00
Benjamin Cabé
8bad9abad7 drivers: clock_control: numicro_m4: Fix inverted PLL stable wait
The wait loop after enabling the PLL spun while the stable bit was
set, so it exited immediately while the PLL was still locking. Wait
until the stable bit becomes set.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 18:20:34 +02:00
Benjamin Cabé
922bd21fdc drivers: clock_control: numicro_m4: Poll LXT stability on the right bit
Starting the LXT passed the PWRCTL HIRC enable bit position as the
STATUS bit to poll, so LXT readiness was judged from an unrelated bit.
Pass CLK_STATUS_LXTSTB_Pos, matching the HXT and LIRC calls.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 18:20:34 +02:00
Perry Naseck
ced398472e stepper: adi_tmc: Separate regs into headers by series
This commit separates the stepper adi_tmc registers into separate headers
by series. It removes any dependencies between series in the register
definitions. See #105388.

Assisted-by: Claude:claude-opus-4.8

Signed-off-by: Perry Naseck <pnaseck@media.mit.edu>
2026-07-23 18:15:58 +02:00
Travis Lam
208748bd0b driver: flash: nrf_mramc driver allow to read tfm secure memory
Implement soc_secure_mem_read for flash driver to read secure memory,
access to the range of secure memory from non secure side should be
governed by tfm_platform allow list, implementation aligns to nrf_rram
driver secure memory read.

Signed-off-by: Travis Lam <travis.lam@nordicsemi.no>
2026-07-23 18:15:41 +02:00
Fin Maaß
680606c525 drivers: ethernet: don't use NET_ETH_PTYPE_PTP for timestamping
As we now use net_pkt_set_tx_timestamping for
every tx packet that needs timestamping,
we no longer need to also check if the ptype is
NET_ETH_PTYPE_PTP.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-07-23 18:15:38 +02:00
Benjamin Cabé
e547b8d8dd drivers: adc: ads1112: Fix PGA gain mapping
The gain switch mapped ADC_GAIN_3 to hardware gain 4 and ADC_GAIN_4
to gain 8, so requesting gain 4 configured gain 8 and the supported
gain 8 was rejected. Map ADC_GAIN_4 and ADC_GAIN_8 to their matching
PGA settings and drop the unsupported ADC_GAIN_3.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 18:13:29 +02:00
Benjamin Cabé
20509f06c4 drivers: i2c: bcm_iproc: Fix target address validation
The guard required addr == 0 && addr > I2C_MAX_TARGET_ADDR, which is
never true, so invalid addresses were accepted. Use ||.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 18:13:20 +02:00
Benjamin Cabé
de58d88aed drivers: input: ch9350l: Fix property names in codemap asserts
The size BUILD_ASSERTs referenced kb_code_map/mouse_code_map, which
do not exist, so they always passed. Use the real property names.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 18:13:05 +02:00
Paulo Santos
8e9066062b modem: cellular: skip power-on pulse when modem already on
The bring-up path pulses the power key unconditionally. On modems that
toggle power with the key, that turns off a modem still running after an
MCU-only reset, and the driver then times out against a dead bus until the
modem completes a full power cycle.

Add an optional mdm-status-gpios input reporting modem power state. When it
is present and asserted at start-up, skip the power-on pulse and bring up
the bus directly; the init script confirms the modem responds, and if it
does not, the driver powers the modem on. Boards without the GPIO behave as
before.

Signed-off-by: Paulo Santos <pauloxrms@gmail.com>
2026-07-23 18:12:55 +02:00
Fabio Baltieri
d3a9de81f4 i2c: npcx: support per controller timeout
Use the per controller timeout macro instead of the config directly,
this allows using per controller timeout and is a no-op for existing
users.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2026-07-23 16:26:36 +02:00
Fabio Baltieri
1100769f35 i2c: ite: switch to the generic timeout macro
Remove the ite specific timeout property and use the generic one.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2026-07-23 16:25:25 +02:00
Arkadiusz Grzelka
b06f511136 input: touch: scale reported coordinates into the display's space
swapped-x-y exchanges only the reported event codes. That is correct
when the touchscreen's coordinate space and the display share an aspect
ratio, and wrong as soon as they do not: on a rotated non-square panel
the swapped axes still carry each other's range, so X arrives bounded by
the screen height while Y overruns the display's.

A concrete case: a 480x272 panel whose controller reports in its own
480x272 space, mounted rotated a quarter turn. swapped-x-y alone
confines the reported X to 0..272 and lets Y reach 480 on a panel 272
tall. There is no combination of the existing properties that expresses
the rotation, because none of them rescale.

Add optional output-width / output-height describing the space
coordinates should land in, and scale into it after inverting and
swapping. Each value keeps its own source range -- the value held as X
always spans screen-width -- while its target dimension follows the code
it is reported under, which swapped-x-y has already chosen. So with the
axes swapped, the X value is scaled by output-height/screen-width and
lands on INPUT_ABS_Y.

The dimensions can also come from a display controller directly: an
optional display phandle sources output-width / output-height from the
referenced node's width / height, so the panel resolution is not
duplicated on the touchscreen node.

Both output dimensions are optional and resolve to 0 when absent, which
disables scaling: every existing driver and board keeps reporting
exactly what the controller produced.

Signed-off-by: Arkadiusz Grzelka <devitwise@gmail.com>
2026-07-23 16:22:41 +02:00
Arkadiusz Grzelka
6fa0613e64 input: touch: require screen dimensions only when inverting
The two dimension checks in input_touchscreen_report_pos() are written as
equivalences:

	__ASSERT(cfg->inverted_x == (cfg->screen_width > 0),
		 "X coordinate inversion requires screen-width");

which asserts more than the message says. It does require a width when
inverting, but it equally forbids declaring screen-width without asking for
inversion -- so a node that states the touchscreen's resolution for any
other reason trips an assert whose text does not mention that case.

Several in-tree boards already do exactly that. These all set screen-width
and screen-height with no inverted-x or inverted-y, and would fire the
assert under CONFIG_ASSERT:

  boards/st/stm32f469i_disco
  boards/st/stm32h573i_dk
  boards/st/stm32l562e_dk
  boards/adafruit/adafruit_2_8_tft_touch_v2
  boards/m5stack/m5stack_core2
  boards/lilygo/twatch_s3
  tests/.../g1120b0mipi.overlay

Make the checks implications, so each property means what its message says
and declaring the dimensions alone is allowed.

Signed-off-by: Arkadiusz Grzelka <devitwise@gmail.com>
2026-07-23 16:22:41 +02:00
Benjamin Cabé
fe70fa2257 drivers: ipm: nrfx_ipc: Fix off-by-one in message id validation
NRFX_IPC_ID_MAX_VALUE is the channel count: the callback arrays,
the ISR asserts and the virtual device list all treat it as an
exclusive bound. The send checks nevertheless accepted an id equal
to it and max_id_val_get() advertised it as valid, letting callers
signal a nonexistent channel. Treat it as an exclusive bound.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 16:22:13 +02:00
David Girle
c251684f0d drivers: ieee802154: esp32: report transmission failures
esp_ieee802154_transmit_failed() received the transmission error and
discarded it, unlocking tx_wait exactly like the success path does. As a
result k_sem_take() in esp32_tx() returned 0 for a frame that lost channel
access or was never acknowledged, and the driver reported a successful
transmission to the upper layer. OpenThread was told the frame had been
sent and therefore never retransmitted it, so the frame was dropped
silently with no error reported anywhere.

Store the error reported by the callback and translate it into the return
values documented for the tx() operation in ieee802154_radio.h: -EBUSY for
a busy medium and -ENOMSG for a missing or invalid ACK. The OpenThread
platform layer maps these to OT_ERROR_CHANNEL_ACCESS_FAILURE and
OT_ERROR_NO_ACK respectively, both of which trigger a retransmission.

Clear ack_frame and ack_frame_info at the start of every transmission.
A transmission that fails produces no ACK, and one that times out never
reaches handle_ack(), so in both cases the pointers from the previous
transmission stayed live and handle_ack() released a frame that had
already been released. Clear ack_frame_info alongside ack_frame in
handle_ack() as well, so the pair is never left half valid.

Measured on an ESP32-C6 joined to a live Thread network sharing a channel
with three other nodes: a test sending five UDP datagrams and requiring all
five to be reflected failed on roughly half of all boots before this change
and passed 30 consecutive boots afterwards. The errors reported by the
callback were CCA_BUSY and NO_ACK.

Signed-off-by: David Girle <davidgirle@gmail.com>
2026-07-23 16:20:51 +02:00
Benjamin Cabé
64fd17543c drivers: sensor: nxp_pmc_tmpsns: Fix ADC sequence buffer size
buffer_size was set to the size of the whole data struct instead of
the uint16_t buffer member. Use sizeof of the member.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 16:19:46 +02:00
Benjamin Cabé
f57c2f82a3 drivers: sensor: fxas21002: Fix out-of-bounds SPI command buffer
The SPI read command buffer was 2 bytes but described with a length
of 3, reading past the stack array and clocking out an indeterminate
byte. Size the buffer to match.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 16:19:46 +02:00
Benjamin Cabé
1fce583536 drivers: sensor: fxos8700: Fix motion threshold value
The trigger setup wrote the FF_MT_THS register address (0x17) as the
threshold instead of the maximum. Write FXOS8700_FF_MT_THS_MASK as
the comment describes.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 16:19:46 +02:00
Benjamin Cabé
01dd853ec0 drivers: comparator: mcux_acmp: Fix feature guard macro names
Two build assertion guards tested MCUX_ACMP_HAS_OFFSET and
MCUX_ACMP_HAS_INPSEL/INNSEL, which are never defined; the macros
defined by this file carry a COMP_ prefix, as used by every other
guard here. The enum consistency assertions were therefore always
compiled out.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 16:19:05 +02:00
Benjamin Cabé
355e4100df drivers: comparator: nxp_acomp: Disable interrupts on trigger removal
set_trigger() only unmasked interrupts and relied on OR-ing a zero
mask for the COMPARATOR_TRIGGER_NONE case, which is a no-op, so a
previously enabled trigger kept firing after being set to none.
Mask the interrupt sources unconditionally before reconfiguring,
as the sibling NXP comparator drivers do.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 16:19:05 +02:00
Benjamin Cabé
f083bb615a drivers: comparator: nxp_acomp: Fix hysteresis property lookup
The divide by ten was placed inside the property name argument of
DT_INST_PROP_OR, mangling the generated existence macro so the
lookup never matched and both hysteresis fields were always
programmed to zero. Divide the property value instead.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 16:19:05 +02:00
Filip Stojanovic
beebdec474 drivers: mspi: stm32: fix QSPI controller lock lifecycle
Apply the same controller lock lifecycle fix as the XSPI driver.
mspi_dev_config() released the controller lock before returning, so
no exclusive session was held until mspi_get_channel_status().

A successful mspi_dev_config() now keeps the lock, and
mspi_get_channel_status() releases it and clears the device ownership
once the controller is idle.

Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
2026-07-23 16:13:08 +02:00
Filip Stojanovic
ccfb6aca84 drivers: mspi: stm32: fix OSPI controller lock lifecycle
Apply the same controller lock lifecycle fix as the XSPI driver.
mspi_dev_config() released the controller lock before returning, so
no exclusive session was held until mspi_get_channel_status().

A successful mspi_dev_config() now keeps the lock, and
mspi_get_channel_status() releases it and clears the device ownership
once the controller is idle. The re-init force-release also clears
the device ownership.

Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
2026-07-23 16:13:08 +02:00
Filip Stojanovic
e58a6b5a50 drivers: mspi: stm32: fix XSPI controller lock lifecycle
mspi_dev_config() released the controller lock before returning, so
the lock only guarded the config call itself and no exclusive session
was held until mspi_get_channel_status(), as the MSPI API expects.

A successful mspi_dev_config() now keeps the lock, and
mspi_get_channel_status() releases it and clears the device ownership
once the controller is idle. Error paths release the lock only when
the same call took it, and the re-init force-release also clears the
device ownership.

Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
2026-07-23 16:13:08 +02:00
Zhaoxiang Jin
829e930031 drivers: counter: support irtc as a deep-sleep wakeup source
Let the IRTC wake-timer wake the CPU from deep sleep on SoCs where its
wake path is gated by a WUC (e.g. the i.MX RT700 SLEEPCON). Arm the WUC
line when a one-shot alarm is pending on a wakeup source, and disarm it
when the alarm fires or is cancelled.

The wake-timer is a wakeup source when devicetree declares it one
(wakeup-source) and routes it to a controller (wakeup-ctrls). An armed
alarm then wakes the SoC in two cases: the wake-timer is the chosen
system-timer low-power companion (zephyr,system-timer-companion), whose
alarm arms via the tickless idle path with no run-time enable; or an
application enabled it as a wakeup source at run time
(pm_device_wakeup_enable(), PM_DEVICE_FLAG_WS_ENABLED).

Disarming keys off the static "is a wakeup source" condition, not on the
companion role or the run-time enable: the companion arms without ever
setting WS_ENABLED, and the run-time enable may be cleared while an alarm
is pending, so gating disarm on either would leave a stale entry armed.
Disarming an instance that never armed is an idempotent no-op.

All WUC access is gated by IS_ENABLED(CONFIG_WUC) and a NULL wuc.dev, so
builds and SoCs without WUC are unaffected.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-07-23 16:11:52 +02:00
Zhaoxiang Jin
66b1832343 drivers: counter: add pm device support to irtc wake-timer
Give the IRTC wake-timer a PM device with a stub action, initialised via
pm_device_driver_init(). It gates no clocks or state on suspend or resume,
but having a pm_base lets the device be selected as a wakeup source with
pm_device_wakeup_enable(), which sets the WS_ENABLED flag. No functional
change to counter behaviour.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-07-23 16:11:52 +02:00