Commit graph zephyr/drivers
Author SHA1 Message Date
Flavio Ceolin
7a1d901113 drivers: sensor: cht8315: combine OR'd status flag checks
(tmp & A) != 0 || (tmp & B) != 0 is equivalent to (tmp & (A | B)) != 0.
Collapse the temperature and humidity threshold status tests into single
masked checks.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-25 11:54:45 -07:00
Flavio Ceolin
7e9fc7d6e5 drivers: mfd: rv3032: combine OR'd status flag checks
(status & A) || (status & B) is equivalent to status & (A | B). Collapse
the RV3032_STATUS_TLF / RV3032_STATUS_THF test into a single masked
check.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-25 11:54:45 -07:00
Flavio Ceolin
5b0516f6fb drivers: sdhc: cdns: combine OR'd response type checks
(op & A) || (op & B) is equivalent to op & (A | B). Collapse the
RES_TYPE_SEL_48 / RES_TYPE_SEL_136 test into a single masked check.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-25 11:54:45 -07:00
Flavio Ceolin
179594850f drivers: rtc: rv8803: combine OR'd alarm mask checks
(mask & A) || (mask & B) is equivalent to mask & (A | B). Collapse the
RTC_ALARM_TIME_MASK_MONTHDAY / _WEEKDAY test into a single masked check.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-25 11:54:45 -07:00
Flavio Ceolin
36af600439 drivers: i2s: nrf_tdm: combine OR'd format/option checks
(cfg & A) || (cfg & B) is equivalent to cfg & (A | B). Collapse the
I2S_FMT_* and I2S_OPT_* tests into single masked checks.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-25 11:54:45 -07:00
Flavio Ceolin
3e9f7e678f drivers: i2c: bflb: combine OR'd interrupt status checks
(tmp & A) != 0 || (tmp & B) != 0 is equivalent to (tmp & (A | B)) != 0.
Collapse the I2C_ARB_INT / I2C_FER_INT test into a single masked check.
No change in behavior.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-25 11:54:45 -07:00
Flavio Ceolin
d51e8aea98 drivers: can: mcp2515: combine OR'd error flag checks
(eflg & A) || (eflg & B) is equivalent to eflg & (A | B). Collapse the
MCP2515_EFLG_RXEP / MCP2515_EFLG_TXEP test into a single masked check.
No change in behavior.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-25 11:54:45 -07:00
Flavio Ceolin
6dcb9ef805 drivers: interrupt_controller: ite: combine OR'd IRQ type checks
(flags & A) || (flags & B) is equivalent to flags & (A | B). Collapse
the IRQ_TYPE_* polarity/level tests into a single masked check.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-25 11:54:45 -07:00
Flavio Ceolin
28fac2e862 drivers: gpio: combine OR'd flag bitmask checks
(flags & A) || (flags & B) is equivalent to flags & (A | B). Collapse
the pull-up/pull-down, output-init, and input/output bias tests into a
single masked check.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-25 11:54:45 -07:00
Flavio Ceolin
6817996786 drivers: watchdog: combine OR'd PAUSE option bitmask checks
(options & A) || (options & B) is equivalent to options & (A | B).
Collapse the two WDT_OPT_PAUSE_IN_SLEEP / WDT_OPT_PAUSE_HALTED_BY_DBG
tests into a single masked check.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-25 11:54:45 -07:00
Aditya Bhutada
1029b2c916 drivers: espi_taf_npcx: Fix RPMC OP2 premature status completion issue
Flash operation experiments revealed that sending the OP2 command may
prematurely return status 0x80 (successful completion) while the data
is not yet ready. Per vendor note, data must be read only after
successfully confirming the operation status.

Refactor espi_taf_npcx_rpmc_op2() to separate status polling from data
reading:
- Split UMA operations into distinct status and data structures
- Add timeout check after retry loop to catch persistent BUSY status

Signed-off-by: Aditya Bhutada <aditya.bhutada@intel.com>
2026-07-25 17:11:41 +02:00
Rupesh Majhi
cee2a2ad76 drivers: sensor: bmi270: guard any-motion against missing feature set
The default "bosch,bmi270" compatible selects the max_fifo feature set,
whose anymo_1/anymo_2 registers are NULL. Enabling SENSOR_TRIG_MOTION then
made bmi270_anymo_config() pass those NULL pointers to
bmi270_feature_reg_write(); on Cortex-M address 0 is readable, so the write
silently targeted an unintended feature page and returned success, leaving
the trigger a no-op.

Return -ENOTSUP when the configured feature set does not provide the
any-motion registers, so the condition is reported instead of failing
silently.

Fixes #112938

Signed-off-by: Rupesh Majhi <zoone.rupert@gmail.com>
2026-07-25 17:10:36 +02:00
Benjamin Cabé
ebf1b9e88a drivers: dma: wch: Fix base/extended controller split for channel 8
The base controller holds channels 0 to 7, but the interrupt flag
lookup, flag clearing and ISR dispatch all treated channel 8 as a
base channel, shifting the 32-bit flag registers by 32 and leaving
the first extended slot unreachable. Split at eight consistently.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-25 17:10:22 +02:00
Fin Maaß
2e6e001f73 drivers: ethernet: use net_pkt_frag_unref
use net_pkt_frag_unref instead of net_buf_unref,
so the allocation tracking information is correct

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-07-25 17:10:00 +02:00
Benjamin Cabé
e1b981ba38 drivers: stepper: tmc50xx: Iterate rampstat over motion controllers
The rampstat poll loop indexes the motion controller array but was
bounded by the stepper driver count, skipping controllers or
reading out of bounds when the two child counts differ.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-25 17:09:45 +02:00
Benjamin Cabé
3eb7824e16 drivers: stepper: tmc50xx: Fix build with stallguard logging
log_stallguard() called tmc50xx_read_actual_position() without the
motor index argument, breaking the build whenever
CONFIG_STEPPER_ADI_TMC50XX_RAMPSTAT_POLL_STALLGUARD_LOG is
enabled. Pass the index of the motor being polled.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-25 17:09:45 +02:00
Benjamin Cabé
1cfdd9dce2 drivers: pinctrl: aesc: Fix pin index bounds check
AESC_PINCTRL_MAX_PINS is the pin count, so valid indices are
0 to MAX_PINS - 1, but the guard used '>', letting pin 128 write one
register past the pin mux range. Use '>='.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-25 17:09:29 +02:00
Benjamin Cabé
47dc88536d drivers: gpio: b91: Fix bit index for GPIO function enable
WRITE_BIT takes a bit index but was passed BIT(pin), applying the
GPIO-function enable to the wrong bit. Pass the pin index.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-25 17:09:17 +02:00
Flavio Ceolin
0da3be402c drivers: interconn/renesas: Fix header inclusion
syscall_handler.h is internal/syscall_handler.h

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-25 17:08:11 +02:00
Anas Nashif
95a3c9df5b timer: openrisc: do not miss a compare armed at or behind the count
The tick timer fires only on an exact TTMR.TP == TTCR[27:0] match, but
sys_clock_set_timeout() wrote the computed compare value blindly. A
deadline that lands at or behind the count by the time TTMR is written
- for instance a timeout armed just before its tick boundary, or an
arm delayed by interrupt latency - is silently missed until the 28-bit
count wraps, 13.4 seconds at the 20 MHz QEMU clock. The one-tick arms
in the ISR (tickful) and at driver init carry the same, rarer,
exposure.

Route all compare writes through a catch-up: after writing the target,
re-read the count and, while the target is not strictly in the future,
push it MIN_DELAY ahead of the fresh count. A post-write count read
still behind the target proves the match is armed; the exit check
accepts any strictly-future target rather than demanding MIN_DELAY of
remaining headroom, which a count that advances between the write and
the re-read could never satisfy (that stricter form livelocks under
QEMU icount, where the count moves every instruction).

Found by the kernel.timer.timeout_churn near-boundary sweep, which
steps zero-duration timer arms across the tick phase: an arm landing
within the final microseconds of a tick fired 13430 ms late.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-07-24 12:40:58 -07:00
Alberto Escolar Piedras
0909d784fb drivers: rtc: sam: Avoid unusued variables warnings
Let's ifdef the common variables, so we avoid unused variables
warnings when neither RTC_ALARM or RTC_UPDATE are set.

This can be reproduced for examples building
tests/drivers/rtc/rtc_api_helpers for sam_v71_xult/samv71q21

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-07-24 12:38:30 -07:00
Benjamin Cabé
ea48fbd36a drivers: watchdog: intel_adsp: Fix reset flag handling
The reset flags are a two-bit enumerated field, not independent
bits, so testing flags with a bitwise AND against
WDT_FLAG_RESET_CPU_CORE left WDT_FLAG_RESET_SOC without reset
enabled. The flag was also never cleared on re-install. Derive
allow_reset from the masked field on every install.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-24 12:37:02 -07:00
Benjamin Cabé
339e3a88eb drivers: sensor: sb_tsi: Fix channel check in emulator set_channel
The channel guard combined its checks with &&, accepting any channel
type with index 0. Use ||, matching sb_tsi_emul_get_sample_range().

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-24 12:36:44 -07:00
Benjamin Cabé
f8266bc00b drivers: sensor: ntc_thermistor: Fix NCP15XH103 table entry
The 2586 Ohm point was listed at 64 degC in a table that steps by
exactly 10 degC, skewing interpolation between 55 and 75 degC. Use
65 degC.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-24 12:36:32 -07:00
Benjamin Cabé
18ce2d4668 drivers: sensor: mlx90394: Fix temperature raw value assembly
Operator precedence applied the scale factor to the high byte before
OR-ing in the low byte, and the 16-bit sign was lost. Assemble and
sign-extend the raw value first, as the magnetometer path does.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-24 12:36:20 -07:00
Benjamin Cabé
3c131d740a drivers: sensor: bmp581: Fix temperature IIR coefficient programming
set_iir_config() overwrote the whole DSP_IIR register with the raw
temperature coefficient instead of programming it through the
BMP5_SET_IIR_TEMP bitfield, corrupting the pressure IIR setting.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-24 12:36:09 -07:00
Benjamin Cabé
b3b981fa06 drivers: sensor: mtch9010: Fix heartbeat error channel fall-through
The heartbeat error case fell through into default and returned
-ENOTSUP, so fetching the channel always failed. Add the missing
break.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-24 12:35:49 -07:00
Benjamin Cabé
e844e5f01e drivers: sensor: mtch9010: Fix receive length in reference averaging
sizeof(temp_buffer) on a pointer parameter truncated the UART receive
to the pointer size. Pass MTCH9010_INTERNAL_BUFFER_SIZE.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-24 12:35:49 -07:00
Benjamin Cabé
5eada09e7b drivers: sensor: lsm9ds0_mfd: Fix build with runtime full-scale
The accel and magn full-scale setters used an undeclared data pointer
when the respective FULL_SCALE_RUNTIME options are enabled. Declare
it from dev->data.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-24 12:35:26 -07:00
Benjamin Cabé
337811b7db drivers: sensor: lsm9ds0_gyro: Fix build with runtime full-scale
lsm9ds0_gyro_set_fs_raw() used an undeclared data pointer when
CONFIG_LSM9DS0_GYRO_FULLSCALE_RUNTIME is enabled. Declare it from
dev->data.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-24 12:35:26 -07:00
Benjamin Cabé
614a3baea0 drivers: sensor: lsm9ds0_mfd: Use magn ODR map in magn ODR setter
lsm9ds0_mfd_magn_set_odr() iterated the accelerometer ODR map instead
of the dedicated magnetometer map, producing out-of-range M_ODR codes
for frequencies above 100 Hz.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-24 12:35:26 -07:00
Benjamin Cabé
adf539509a drivers: sensor: lsm9ds0_gyro: Fix ODR field shift in CTRL_REG1_G
The sample rate was shifted with the bandwidth field shift, so the
value never intersected the DR mask and the requested ODR was always
programmed as zero. Use the DR field shift.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-24 12:35:26 -07:00
Krzysztof Chruściński
2d4e1c7249 drivers: serial: nrfx_uarte: Improvement for running on VPR
Minor improvements in the driver found when running UART stress test
(uart_async_dual). Mainly, preventing running RX timeout handler when
RX is already being disabled and missing barrier when reading CC TIMER
register.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-07-24 15:34:21 -04:00
Sunil Abraham
5cf1866014 drivers: clock_control: PIC32CM_SG_GC: Add clock control driver
Add clock control driver
Implement bootup clock initialization, on, off, configure and get_rate API

Signed-off-by: Sunil Abraham <Sunil.Abraham@microchip.com>
2026-07-24 15:34:12 -04:00
Richard Osterloh
441c4d0034 drivers: i2c: esp32: fix bus recovery for SDA/SCL on gpio1 (GPIO32+)
i2c_esp32_config_pin() reattaches the I2C peripheral to its pins after
i2c_master_clear_bus() has bit-banged them as GPIOs to clock a stuck
slave free. It did so with esp_rom_gpio_matrix_out/in(), passing
gpio_dt_spec::pin as the absolute GPIO number. That only holds for the
gpio0 bank (GPIO0..31).

On the original ESP32, GPIO32..39 are exposed through a second controller
(gpio1) where the pin index is 0..7. For an I2C bus whose SDA/SCL live on
gpio1, the reattach rerouted the I2C signals onto GPIO0/1 instead. GPIO1
is the default UART0 TX, so triggering bus recovery hijacked the console
and never restored the bus -- and the original ESP32 has no hardware
clear-bus, so this bit-bang path is the only recovery available.

Reapply the pinctrl default state instead, which restores exactly the mux
the driver installed at init, independent of the GPIO bank the pins are
on.

Signed-off-by: Richard Osterloh <richard.osterloh@gmail.com>
2026-07-24 15:33:35 -04:00
Henrik Brix Andersen
f45025108c drivers: input: xpt2046: select CONFIG_INPUT_TOUCH
Select CONFIG_INPUT_TOUCH as this driver now depends on the APIs
implemented there.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2026-07-24 15:53:40 +02:00
Henrik Brix Andersen
6ef08da5cd drivers: input: ili2132a: select CONFIG_INPUT_TOUCH
Select CONFIG_INPUT_TOUCH as this driver now depends on the APIs
implemented there.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2026-07-24 15:53:40 +02:00
Henrik Brix Andersen
48ace0e390 drivers: input: cst8xx: select CONFIG_INPUT_TOUCH
Select CONFIG_INPUT_TOUCH as this driver now depends on the APIs
implemented there.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2026-07-24 15:53:40 +02:00
Fabian Blatz
816cbf2dd7 drivers: input: chsc6x: Add touchscreen common config
Adds the touchscreen common config to the chsc6x controller.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2026-07-24 14:10:00 +02:00
Fabian Blatz
21802e47cc drivers: input: xpt2046: Add touchscreen common config
Adds the touchscreen common config to the xpt2046 controller.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2026-07-24 14:10:00 +02:00
Fabian Blatz
ea8d0d478d drivers: input: ili2132a: Add touchscreen common config
Adds the touchscreen common config to the ili2132a controller.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2026-07-24 14:10:00 +02:00
Fabian Blatz
7b34108be5 drivers: input: cst8xx: Add touchscreen common config
Adds the touchscreen common config to the cst8xx controller.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2026-07-24 14:10:00 +02:00
Benjamin Cabé
e9e5a696a5 drivers: watchdog: renesas_ra: Clamp window position table indices
The window lookup indices are computed against the closest
achievable period, which can be smaller than the requested window
bounds, producing index 5 and reading one past the end of the
five-entry lookup tables. Clamp the indices so an out-of-range
start hits the invalid sentinel and the end saturates at 100%.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-24 14:09:20 +02:00
Benjamin Cabé
77b6f75d30 drivers: ethernet: dwc_xgmac: Flush only the sent bytes on TX
The TX path flushed a fixed CONFIG_NET_BUF_DATA_SIZE per fragment
though the DMA reads only frag->len. Flush only frag->len bytes.

Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-24 14:09:08 +02:00
Benjamin Cabé
8a95923776 drivers: ethernet: dwc_xgmac: Hoist TX frame length
net_pkt_get_len() was called for every fragment, walking the chain
each time. Compute the frame length once before the descriptor loop.

Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-24 14:09:08 +02:00
Alberto Escolar Piedras
d9a0c4ed76 drivers: spi: nrf_spim_rtio: Explicitly point at spim data
Let's avoid a build warning/error in the spim interrupt handler mapping,
by being explicit about passing to it as parameter the address of
`nrfx_spim_t spim` data instead of knowing implicitly that it is the first
element of `struct driver_data`.

This avoid the following build warning/error:
nfx_spim.h:472:42: note: expected 'nrfx_spim_t *' but argument is of
type 'struct driver_data *'

Issue introduced in:
6f2829ea0c

Can be reproduced building
tests/arch/arm/arm_irq_vector_table for thingy53/nrf5340/cpuapp
with CONFIG_SPI_RTIO=y

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-07-24 14:08:51 +02:00
Alberto Escolar Piedras
119121765f drivers: spi: nrf_spim: Explicitly point at spim data
Let's avoid a build warning/error in the spim interrupt handler mapping,
by being explicit about passing to it as parameter the address of
`nrfx_spim_t spim` data instead of knowing implicitly that it is the first
element of `struct driver_data`.

This avoid the following build warning/error:
  nrfx_spim.h:472:42: note: expected 'nrfx_spim_t *' but argument is of
  type 'struct driver_data *'

Issue introduced in:
e4d61fc472

Can be reproduced building
tests/arch/arm/arm_irq_vector_table for thingy53/nrf5340/cpuapp

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-07-24 14:08:51 +02:00
Lars Jeppesen
9d78aee36d drivers: spi: mcux_flexcomm: fix DMA width for last TX word
The last TX word must be written to FIFOWR as a full 32-bit write to
properly set the EOT (end-of-transfer) control bit at bit 20. Commit
7cb3fca changed the DMA block_size for the last word from
sizeof(uint32_t) to data->word_size_bytes, which meant only the lower
data bytes were transferred, missing the EOT flag entirely.

The issue #107484 mentions that this will cause the last
transfer to be incorrect width, but deep down in the NXP dma driver
there is a fix for this. See dma_mcux_lpc.c (line 262-273).

Fixes: #107484

Signed-off-by: Lars Jeppesen <lje@foss.dk>
2026-07-24 14:08:36 +02:00
Jaro Van Landschoot
4eb0236a91 drivers: counter: mcux_gpt: add input capture support
Implement the counter capture API (capture_configure, enable_capture,
disable_capture) for both GPT input capture channels (CAPTURE1 and
CAPTURE2).

Supported trigger modes: rising edge, falling edge, both edges.
Single-shot capture disables the interrupt and resets the channel
after the first event; continuous capture leaves it armed.

Select COUNTER_SUPPORTS_CAPTURE in Kconfig so the generic counter
layer exposes the capture API to applications.

Signed-off-by: Jaro Van Landschoot <jaro.vanlandschoot@basalte.be>
2026-07-24 14:08:12 +02:00
Jaro Van Landschoot
d141014e37 drivers: counter: mcux_gpt: add pinctrl support
Add optional pinctrl support so board files can mux GPT_CLK,
GPT_CAPTUREn, and GPT_COMPAREn pins via the standard pinctrl-0
property. The default state is applied early in driver init, before
GPT_Init. A missing pinctrl state (-ENOENT) is treated as optional
and silently ignored.

Signed-off-by: Jaro Van Landschoot <jaro.vanlandschoot@basalte.be>
2026-07-24 14:08:12 +02:00