(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>
(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>
(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>
(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>
(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>
(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>
(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>
(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>
(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>
(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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Add clock control driver
Implement bootup clock initialization, on, off, configure and get_rate API
Signed-off-by: Sunil Abraham <Sunil.Abraham@microchip.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>