Commit graph zephyr/drivers
Author SHA1 Message Date
Anas Nashif
2be19f6503 drivers: peci: npcx: use portable IRQ pending API
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ() calls with
k_irq_set_pending()/k_irq_clear_pending(), dropping the dependency on
cmsis_core.h where nothing else needed it. These platforms are
plain-NVIC Cortex-M, so the pending-state capabilities are always
available where this code builds.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:43 -04:00
Anas Nashif
1b5fa366b9 drivers: bluetooth: hci_da1469x: use portable IRQ pending API
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ()/
NVIC_EnableIRQ() calls with the portable k_irq_set_pending()/
k_irq_clear_pending()/irq_enable() equivalents. The Smartbond DA1469x
is a plain-NVIC Cortex-M33, so the pending-state capabilities are
always available where this code builds.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:38 -04:00
Anas Nashif
a82cc1085d drivers: usb: smartbond: use portable IRQ pending API
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ()/
NVIC_EnableIRQ() calls with the portable k_irq_set_pending()/
k_irq_clear_pending()/irq_enable() equivalents. The Smartbond DA1469x
is a plain-NVIC Cortex-M33, so the pending-state capabilities are
always available where this code builds.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:38 -04:00
Anas Nashif
09ffe52fd5 drivers: timer: smartbond: use portable IRQ pending API
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ()/
NVIC_EnableIRQ() calls with the portable k_irq_set_pending()/
k_irq_clear_pending()/irq_enable() equivalents. The Smartbond DA1469x
is a plain-NVIC Cortex-M33, so the pending-state capabilities are
always available where this code builds.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:38 -04:00
Anas Nashif
c01e2c55a7 drivers: counter: smartbond: use portable IRQ pending API
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ()/
NVIC_EnableIRQ() calls with the portable k_irq_set_pending()/
k_irq_clear_pending()/irq_enable() equivalents. The Smartbond DA1469x
is a plain-NVIC Cortex-M33, so the pending-state capabilities are
always available where this code builds.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:38 -04:00
Anas Nashif
9de57e7041 drivers: entropy: smartbond: use portable IRQ pending API
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ()/
NVIC_EnableIRQ() calls with the portable k_irq_set_pending()/
k_irq_clear_pending()/irq_enable() equivalents. The Smartbond DA1469x
is a plain-NVIC Cortex-M33, so the pending-state capabilities are
always available where this code builds.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:38 -04:00
Anas Nashif
7dc5112b90 drivers: adc: smartbond: use portable IRQ pending API
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ()/
NVIC_EnableIRQ() calls with the portable k_irq_set_pending()/
k_irq_clear_pending()/irq_enable() equivalents. The Smartbond DA1469x
is a plain-NVIC Cortex-M33, so the pending-state capabilities are
always available where this code builds.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:38 -04:00
Anas Nashif
454c23d8eb drivers: lora: stm32wl: use portable IRQ pending API
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ() calls with
k_irq_set_pending()/k_irq_clear_pending().

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:33 -04:00
Anas Nashif
09fb8a776e drivers: timer: stm32_lptim: use portable IRQ pending API
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ() calls with
k_irq_set_pending()/k_irq_clear_pending().

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:33 -04:00
Anas Nashif
8fe2ee23c1 drivers: counter: stm32_timer: use portable IRQ pending API
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ() calls with
k_irq_set_pending()/k_irq_clear_pending().

This also deletes the driver's private counter_stm32_set_pending()
helper, which hand-dispatched between the ARM GIC and the NVIC --
exactly what the portable API now does -- along with its conditional
gic.h include.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:33 -04:00
Anas Nashif
25064db654 drivers: counter: stm32_rtc: use portable IRQ pending API
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ() calls with
k_irq_set_pending()/k_irq_clear_pending().

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:33 -04:00
Anas Nashif
1bf50b335d drivers: entropy: stm32: use portable IRQ pending API
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ() calls with
k_irq_set_pending()/k_irq_clear_pending().

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:33 -04:00
Anas Nashif
39602248a8 drivers: counter: mcux_qtmr: update comment for portable IRQ API
The late-alarm comment still referred to NVIC_SetPendingIRQ() after
the code moved to k_irq_set_pending(); make it match.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:29 -04:00
Anas Nashif
cb3178d8ee drivers: serial: lpc11u6x: use portable IRQ pending API
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>
2026-08-27 22:12:29 -04:00
Anas Nashif
27d14379f3 drivers: watchdog: mcux_wwdt: use portable IRQ pending API
Replace direct NVIC pending-state calls with k_irq_set_pending()/
k_irq_is_pending()/k_irq_clear_pending().

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:29 -04:00
Anas Nashif
36c8272b3f drivers: ieee802154: kw41z: use portable IRQ pending API
Replace direct NVIC pending-state calls with k_irq_set_pending()/
k_irq_is_pending()/k_irq_clear_pending().

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:29 -04:00
Anas Nashif
70d58653a8 drivers: counter: nxp_s32_sys_timer: use portable IRQ pending API
Replace direct NVIC pending-state calls with k_irq_set_pending()/
k_irq_is_pending()/k_irq_clear_pending().

This also deletes the driver's private GIC-or-NVIC dispatch helper,
which is exactly what the portable API now provides.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:29 -04:00
Anas Nashif
9f1eeff96c drivers: counter: mcux_wake_timer: use portable IRQ pending API
Replace direct NVIC pending-state calls with k_irq_set_pending()/
k_irq_is_pending()/k_irq_clear_pending().

This also deletes the driver's private GIC-or-NVIC dispatch helpers,
which are exactly what the portable API now provides.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:29 -04:00
Anas Nashif
01981397e1 drivers: counter: mcux_rtc_jdp: use portable IRQ pending API
Replace direct NVIC pending-state calls with k_irq_set_pending()/
k_irq_is_pending()/k_irq_clear_pending().

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:29 -04:00
Anas Nashif
d6010435ae drivers: counter: mcux_sysctr: use portable IRQ pending API
Replace direct NVIC pending-state calls with k_irq_set_pending()/
k_irq_is_pending()/k_irq_clear_pending().

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:29 -04:00
Anas Nashif
a6400dc045 drivers: counter: mcux_qtmr: use portable IRQ pending API
Replace direct NVIC pending-state calls with k_irq_set_pending()/
k_irq_is_pending()/k_irq_clear_pending().

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:29 -04:00
Anas Nashif
c9d1e904cf drivers: counter: max32: use portable IRQ pending API
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>
2026-08-27 22:12:25 -04:00
Anas Nashif
41b15df0d3 drivers: counter: rza2m_ostm: use portable IRQ pending API
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.

This driver called the arm_gic_irq_* pending helpers directly; the
portable API removes the GIC-specific dependency. The gic.h include
stays for GIC_SPI_INT_BASE.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:21 -04:00
Anas Nashif
bdaf153ade drivers: gpio: si32: use portable IRQ pending API
Replace the direct NVIC_ClearPendingIRQ() call with
k_irq_clear_pending() and drop the cmsis_core.h include.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:17 -04:00
Anas Nashif
bf16c3af13 drivers: timer: gecko_burtc: use portable IRQ pending API
Replace the direct NVIC_ClearPendingIRQ() call with
k_irq_clear_pending().

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:17 -04:00
Daniel Leung
305f7fe714 i3c: support expected NACK from target device on data xfer
There are some situations where a NACK is expected from
the target after sending the address. One example would be
MCTP, where the target would NACK if there is no data to return
during polling. This use case is not entirely conforming to
traditional I2C/I3C transfer mechanism where a NACK after
the address byte means there is no target with this address
or the target is not responding to the transfer request.
In order to support MCTP, we will need to handle this type of
transfer gracefully, by adding a new transfer message flag to
indicate this type of transfer. A new return value is also
being introduced to i3c_transfer() to signal the expected NACK
is received. Since most of the wire interactions are handled
by the hardware, each individual driver will need to purposely
handle this use case. For now, this commit only introduces
the building block needed for the drivers to implement the bits
to support this use case.

Also changed the RTIO generic I3C code to support this.

Relates to #114312

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2026-08-27 22:12:13 -04:00
Anas Nashif
fd518df155 drivers: i2c: dw: use k_irq_clear_pending()
Replace the direct NVIC_ClearPendingIRQ() call in the RTS5912 quirk
path with the portable k_irq_clear_pending() and drop the cmsis_core.h
include, removing the last piece of CPU-specific code from the
DesignWare I2C driver. RTS5912 is a plain-NVIC Cortex-M33, so the
capability is always available where the quirk compiles.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:09 -04:00
Anas Nashif
55afd0c7da drivers: i2c: dw: scope the NVIC pending-clear to RTS5912
i2c_dw_transfer_complete() clears the NVIC pending bit for its own IRQ
line after clearing the IP-level interrupt source. This was added along
with the RTS5912 support in commit 748789eadf ("drivers: i2c: rts5912
i2c dirver") but gated on CONFIG_CPU_CORTEX_M, so every Cortex-M user of
the DesignWare IP -- RP2040/RP2350, SiWG917, Synaptics SR100 -- silently
inherited a Realtek-specific workaround, and the shared IP driver grew a
dependency on cmsis_core.h.

Clearing the NVIC pending bit after the source has already been cleared
also discards any interrupt that latched in between, so it is not a
harmless no-op on parts that do not need it.

Gate the call, the cmsis_core.h include and the irqnumber config member
on CONFIG_I2C_RTS5912 instead, matching the other RTS5912 carve-outs
already present in Kconfig.dw. Behaviour on RTS5912 is unchanged; other
Cortex-M platforms return to the pre-748789eadf710 behaviour. Dropping
irqnumber for everyone else also removes a DT_INST_IRQN() on PCIe
instances, which have no devicetree interrupt of their own.

Also drop the unused zephyr/arch/cpu.h include added by the same commit;
it is a pure dispatch header and kernel.h and irq.h already provide
everything the driver uses.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:09 -04:00
Angel Covarrubias
36b3c8f4b1 drivers: modem: sim7080: handle F_GETFL/F_SETFL in offload_ioctl
The native TLS socket layer calls zsock_fcntl(F_GETFL) on the
underlying offloaded socket to clear and restore O_NONBLOCK around the
TLS handshake (ztls_connect_ctx), before issuing the underlying
connect. offload_ioctl() only handled the poll ioctls, so the fcntl
failed with EINVAL and any connection over TLS-native sockets on top of
this driver aborted before AT+CAOPEN was ever sent, with only a
confusing "AT+CACLOSE=0 ret: -5" from the cleanup path in the log.

Handle ZVFS_F_GETFL and ZVFS_F_SETFL by returning 0: the offloaded
socket is always blocking and non-blocking reads are requested per
call via MSG_DONTWAIT. This is the same approach used by the
ublox-sara-r4 and hl78xx drivers.

Tested on SIM7080G (Cat-M1) hardware against an MQTT broker on port
8883 with CONFIG_NET_SOCKETS_SOCKOPT_TLS=y and CONFIG_MQTT_LIB_TLS=y:
without this change mqtt_connect() always fails with -EINVAL; with it
the TLS handshake and MQTT session complete normally.

Note: this issue was diagnosed and the fix developed with the
assistance of an AI tool; the change was reviewed and verified on
real hardware by the author.

Assisted-by: AI tool (Claude Code)
Signed-off-by: Angel Covarrubias <angelcovarrubias319@gmail.com>
2026-08-27 22:12:04 -04:00
Mark Geiger
86c1cfba0d drivers: gnss: add option to suspend gnss_nmea_generic
add method to suspend generic nmea gnss driver and call it via pm action

Signed-off-by: Mark Geiger <MarkGeiger@posteo.de>
2026-08-27 22:12:00 -04:00
Nicolas Pitre
9eb485f6c5 drivers: timer: separate the arm reach from the unannounced span
TIMER_CORE_MAX_UNANNOUNCED_CYCLES was the smaller of two unrelated
limits: what the counter can still resolve, and what the alarm can
express. The tick clamp divides by it, so where a tick is longer than the
alarm can hold, it comes out zero and the arm path collapses:

	span = 0                                /* clamped */
	want = 0 * CYC_PER_TICK          = 0
	rel  = (want > done) ? want - done : 0  /* 0 */
	rel < ALARM_MIN                         /* floored */
	set_reload(ALARM_MIN)

On frdm_mcxn947 at 150 MHz with CONFIG_SYS_CLOCK_TICKS_PER_SEC=1 a tick
is 150000000 cycles against a 24-bit SysTick reload of 16777215, so the
driver arms 1499 cycles, the 10 us floor, and interrupts 78000 times a
second announcing nothing. Asking for one tick a second then costs more
interrupts than any other tick rate.

Only the counter's reach bounds how much unannounced time may accumulate.
The alarm's reach bounds a single arm. Split them:

	MAX_UNANNOUNCED_CYCLES = COUNTER_SAFE_SPAN
	MAX_ARM_CYCLES         = MIN(COUNTER_SAFE_SPAN, ALARM_MAX_CYCLES)

The tick clamp uses the first, so a tick always fits, and each arm is
capped at the second. That board now spans 14 ticks and arms 16777215
cycles at a time, nine interrupts to cross one tick, which is what the
driver already did for a timeout longer than its reload.

The cap is guarded on the two bounds differing, so it folds away where
the alarm covers the whole span and the span clamp has already bounded
the value.

Fixes: #117169

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2026-08-27 22:11:41 -04:00
Sergei Ovchinnikov
90fd710d1f drivers: gpio: npm10xx: use mfd configuration function
Centralise the GPIO arbitration and remove duplication. Add initial value
setting based on provided flags.

Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
2026-08-27 22:11:37 -04:00
Jérôme Pouiller
c3b8b33224 drivers: serial: silabs: drop orphans eusart_silabs_ll2cfg_*()
The functions eusart_silabs_ll2cfg_*() have never been used. Probably the
original author wrote them for the completeness since their
eusart_silabs_cfg2ll counterparts were required.

Orphan function generate warning that could in turn generate error with
-Werror.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2026-08-27 21:24:48 +01:00
Jérôme Pouiller
3ff1816c5f drivers: serial: silabs: drop orphans uart_silabs_ll2cfg_*()
The functions uart_silabs_ll2cfg_*() have never been used. Probably the
original author wrote them for the completeness since their
uart_silabs_cfg2ll counterparts were required.

Orphan function generate warning that could in turn generate error with
-Werror.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2026-08-27 21:24:48 +01:00
Kai Vehmanen
3ae0c77dd7 drivers: dai: allow bespoke config blobs larger than the stack buffer
The dai_config_set()/dai_config_update() syscall verifiers copied the
user-space bespoke configuration blob into a fixed stack buffer of
CONFIG_DAI_MAX_BESPOKE_CFG_SIZE bytes and rejected anything larger with
-EINVAL. This turns out to be too limiting and we need to support larger
configuration objects.

Decouple the stack buffer size from the maximum allowed blob size and
change implementation such that objects up to DAI_BESPOKE_CFG_STACK_SIZE
are validated on the stack as before, but for larger objects,
k_malloc'ed kernel buffer is used instead.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2026-08-27 21:24:11 +01:00
Etienne Carriere
a17a6d7a71 drivers: i2c: Fix CONFIG_I2C_MCUX_*_BUS_RECOVERY default values
Since recover-bus-on-init DT property if of boolean type, use of
dt_compat_any_has_prop() without an explicit value argument of True
makes that function to always return true and
CONFIG_I2C_MCUX_LPI2C_BUS_RECOVERY and
CONFIG_I2C_MCUX_FLEXCOMM_BUS_RECOVERY configuration options always enabled
(when their dependencies are met).

Set function argument value to True to get the expected behavior.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-08-27 21:24:05 +01:00
Sylvio Alves
c4b880e2d5 drivers: spi: esp32: use spi2 gdma trigger id for dma slot
The AHB GDMA path passed dma-host, the SPI host index, as
the DMA peripheral trigger. That happens to match on SoCs
where the SPI2 trigger is zero, but on esp32c5 and esp32c61
the SPI2 trigger is 1, so RX and TX were connected to the
wrong peripheral and no data was transferred. Derive the
trigger from the SPI2 base as the AXI path already does.
spi_loopback DMA mode passes on esp32c5 and esp32c61.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-08-27 21:23:34 +01:00
Sylvio Alves
a7864b0be7 drivers: clock_control: validate rc fast cpu clock explicitly
The esp32c5 and esp32c61 devicetree binding value for the rc
fast cpu clock source does not match the hal enum, so the
fallback comparison could accept a pll configuration when rc
fast was requested. Compare the rc fast case explicitly.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-08-27 21:23:34 +01:00
Sylvio Alves
48ee388bbb drivers: clock_control: add esp32c61 support
Wire the esp32c61 into the pmu clock driver: per-soc
includes, the rc32k exclusions, the regi2c slow-clock
tuning writes, the devicetree clock-source mapping for the
fixed 160 MHz pll, and clocking the console uart from xtal
since the bbpll is transiently disabled during ocode
calibration. Configure the regi2c analog master clock when
the cpu runs from the pll, as done for esp32c6, and guard
the deprecated periph_module calls out as on the esp32p4.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-08-27 21:23:34 +01:00
Sylvio Alves
dde217c098 drivers: espressif: enable esp32c61 in shared drivers
Add the C61 conditionals to the shared espressif drivers:
gpio, uart, usb-serial, spi, counter, entropy, hwinfo,
pinctrl, watchdog and the timer and clock Kconfig, mostly
mirroring the single-core C5 behavior.

Assisted-by: Claude:opus-4-8
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-08-27 21:23:34 +01:00
Benjamin Cabé
3544dc3db3 drivers: sensor: apds9960: place the proximity gain in CONTROL[3:2]
pgain was shifted by one instead of two, so the selection landed below
the PGAIN field of register 0x8F and was masked away entirely: every
board ran at 1x proximity gain no matter what devicetree asked for.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-27 21:23:24 +01:00
Benjamin Cabé
6598df3bb8 drivers: sensor: apds9960: shift ppulse-length into the PPLEN field
The ppulse-length selection was OR'd straight into ppcount, landing in
the PPULSE pulse-count bits instead of PPLEN (bits 7:6) of register
0x8E. Every configuration therefore ran with 4 us pulses, and the 16 and
32 us selections corrupted the pulse count on top of that.

Shift the selection into PPLEN and mask the count to the six bits the
field actually has.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-27 21:23:24 +01:00
Benjamin Cabé
62d4052664 dts: bindings: sensor: apds9960: use physical values for the register enums
The pgain, again, ppulse-length and pled-boost enums spelled the 2-bit
register fields they select in hex, i.e. 0x00/0x01/0x10/0x11, so the
last two selections were really 16 and 17 and reached the registers as
such. The pgain entries were also mislabelled, listing 4x twice instead
of the 1x/2x/4x/8x the part supports.

Express each enum as the physical value it selects - gain multipliers,
microseconds and percent - and let DT_INST_ENUM_IDX() turn the selection
back into the register field value, which the enums are already ordered
to match. Devicetree now describes the sensor instead of its register
encoding, and the defaults keep selecting the same settings as before.

While here, give every default the justification the binding guidelines
require, and bound ppulse-count to the 1 to 64 pulses the PPULSE field
can encode.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-27 21:23:24 +01:00
Måns Ansgariusson
3fa70873f0 modem: Update ring_buf usage
This commit updates the usage of ring_buf to utilize the new
put_ptr/commit/get_ptr/consume pattern instead of the traditional
claim/finish approach. This change is part of a larger refactor aimed at
streamlining the ring_buf API and improving its efficiency.

Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
2026-08-27 21:23:19 +01:00
Benjamin Cabé
d167d885cf drivers: sensor: fdc2x1x: fix output gain scaling in freq conversion
The OUTPUT_GAIN register codes 0..3 select a gain of 1/4/8/16, but the
12-bit frequency conversion used the raw code as a power-of-two exponent,
so any non-zero gain reported twice the actual frequency (and a quarter of
the actual capacitance). Map the code to its real log2(gain) instead.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-27 21:23:09 +01:00
Benjamin Cabé
3c6d31adbc drivers: sensor: fdc2x1x: apply reference divider in freq conversion
fdc2x1x_raw_to_freq() converted raw data using the raw controller
clock, ignoring the per-channel CHx_FREF_DIVIDER the driver programs
at init. The datasheet defines the conversion against the divided
reference f_REFx = f_CLK / CHx_FREF_DIVIDER, so frequency and
capacitance were wrong on any channel with a divider other than 1.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-27 21:23:09 +01:00
Benjamin Cabé
ea4ab76115 drivers: sensor: fdc2x1x: fix truncated FREF_DIVIDER field width
The CHx_FREF_DIVIDER field of CLOCK_DIVIDERS_CHx is 10 bits wide, but
the SET/GET accessors masked it to 9 bits while the field mask covered
bits 9:0, so any divider from 512 to 1023 was programmed as value-512.
Widen both accessors to 0x3FF to match the mask and the binding.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-27 21:23:09 +01:00
Benjamin Cabé
15d8e97ab7 drivers: sensor: ina2xx: fix sign loss in voltage scaling
The channel mult/div scale factors are uint32_t, so the sign-extended
sample was converted to unsigned and the division performed unsigned,
turning negative readings into large positive ones (e.g. INA226 shunt
voltage, which uses 2500/1000). Scale in signed 64-bit arithmetic.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-27 21:22:57 +01:00
Benjamin Cabé
3740a878bf drivers: sensor: ina2xx: fix INA230 device data struct layout
struct ina230_data did not start with a struct ina2xx_data, so the
shared ina2xx_sample_fetch()/ina2xx_channel_get() code, which casts
dev->data to struct ina2xx_data *, wrote raw register bytes over the
cached device pointer used by the alert trigger. Embed the common data
struct as the first member and drop the now unused value fields.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-27 21:22:57 +01:00
Benjamin Cabé
908fe08745 drivers: sensor: bq274xx: enter shutdown on PM SUSPEND action
The PM hook only handled TURN_OFF, which the PM core rejects unless the
device is already suspended, so the shutdown and wake sequences were
unreachable and the gauge kept running. Handle SUSPEND to enter shutdown
mode and accept TURN_ON/TURN_OFF as no-ops.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-27 21:22:49 +01:00