The wire length field counts the payload plus the 2-byte checksum, but
the receive validator compared it against the payload-only package size,
so every full-size data packet was rejected with -EINVAL. Bound the
length by the receive buffer's body capacity instead, and widen the
checksum offset so a 256-byte package length cannot truncate it.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
grow_r502a_led_on()/grow_r502a_led_off() called fps_led_control()
without holding drv_data->lock, so a concurrent LED request could
overwrite the shared UART tx/rx buffers of an in-flight sensor
transaction. Take the per-device mutex around the transport call, as
every other entry point does.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
device_map() hands out a new virtual mapping on every call and nothing
unmaps it, so reconfiguring pins at runtime leaks virtual address space
until k_mem_map() fails and the kernel panics.
Signed-off-by: Jonathan Elliot Peace <jep@alphabetiq.com>
In the hostap repo, since commit 13a30f10ce523ed341d907796d8dabcf382dd78f,
it now presents a key to the driver to avoid a race condition:
To avoid a race condition, wpa_supplicant now sends the key at step 3/4
instead of 4/4 to load the key before encrypted traffic abunds, but
requires to complete the TX message (4/4) unencrypted, so hardware has to
support setting the key for RX path only, not supported there, skipping,
waiting the key to be presented again in step 4/4.
This is explained in detail in the hostap commit.
Signed-off-by: Josuah Demangeon <me@josuah.net>
modules/hostap/src/supp_main.c is calling os_free() on everything filled
in events, so the values passed need to be os_malloc()'ed.
Signed-off-by: Josuah Demangeon <me@josuah.net>
With DISPLAY_ORIENTATION_ROTATED_180, the gate window was set to the
requested x range in reverse order instead of to the mirrored range, so
buffers narrower than the display were drawn at the horizontally
mirrored position. Mirror the gate window as the ROTATED_90 case does.
Tested on reel_board@2.
Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The RX completion combined the EOF descriptor length with rx_offset,
which double-reported bytes after a finite idle timeout. The GDMA
driver also invokes the RX callback for non-EOF descriptor blocks.
Ignore block callbacks, derive an absolute buffer position from the
EOF descriptor, and protect callbacks and timeout work when RX is
rearmed.
Retain FIFO interrupt counting for RX disable before the open DMA
descriptor has written back its received length. Clamp the count to
the buffer and report only bytes beyond rx_offset. Clear a pending FIFO
interrupt when EOF has already consumed its bytes, so it cannot increment
the next buffer's counter.
Validate initial and successor RX buffer lengths against the UHCI
packet threshold, and clear RX state when DMA setup fails.
Signed-off-by: JiaXiang Liang <moonbite233@gmail.com>
Assisted-by: Codex:gpt-6
An async RX buffer can be released without a successor while RXFIFO
level interrupts remain enabled. A byte left in the FIFO then keeps
the UART ISR running and starves the system timer.
Use the shared RX disable helper to mask interrupts at both async stop
points. Keep the PM lock release in the async paths, as interrupt-driven
RX does not hold that lock. Drop completion and timeout work after the
RX buffer has been released.
Signed-off-by: JiaXiang Liang <moonbite233@gmail.com>
Assisted-by: Codex:gpt-6
uart_async_sf32lb_rx_disable() and uart_async_sf32lb_tx_abort() jump to
their shared unlock label when the DMA channel is busy, which is before
irq_lock() has run, so irq_unlock() writes an uninitialized value to
PRIMASK. Return -EBUSY directly, as the other async entry points
already do on the same check.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
commit 7acfb6145f ("drivers: flash: unify SOC_NV_FLASH_NODE logic")
switched this driver to SOC_NV_FLASH_CHILD_NODE(), which only handles a
controller with one soc-nv-flash child. cc23x0 has two, the main sector
and the CCFG sector whose compatible list also carries soc-nv-flash, so
the macro expands to two juxtaposed node ids and nothing with flash
enabled compiles.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
An interrupt can arrive immediately after the GPIO interrupt is
enabled. Register the initialized callback first so that the first
touch edge is not lost during initialization.
Assisted-by: Codex:GPT-6
Signed-off-by: Shawn Yang <y810004@gmail.com>
The PMOD_B UARTB case OR-ed PM_A_CFG0_UART1b, which shifts into the
PMOD A mux field, so PMOD B was left unprogrammed and PMOD A's
setting was corrupted. Use PM_B_CFG0_UART2b, the otherwise unused
constant defined for this case.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
ipm_handlers.c covers the other four IPM syscalls but not ipm_complete,
so it was not dispatched.
Add the verifier. The object check is used rather than the driver-op
form because complete is optional and the struct member is absent
entirely when CONFIG_IPM_CALLBACK_ASYNC=n.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
The three converters produce an intermediate value in hundredths of a
unit but scaled the remainder by 1000, while sensor_value::val2 is
expressed in micro-units. Scale by 10000 instead so the reported
fraction is no longer ten times too small.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
tad214x_sample_fetch() discarded the TAD214x_GetData() result and always
returned 0, and the I2C helpers ignored the i2c_write()/i2c_read()/
i2c_transfer() return codes, so transport failures were reported as
successful reads of stale or never-measured data. Check and propagate
those return codes instead.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
In encoder mode tad214x_trigger_set() installed the internal quadrature
decoder into drdy_handler, so the application callback was never stored
nor invoked, and it armed the ENCA/ENCB/ENCZ interrupts even when called
with a NULL handler to disable the trigger. The decoder is now a plain
internal step run from tad214x_thread_cb(), the caller's handler is
stored as in the non-encoder branch, and a NULL handler leaves the
encoder interrupts disabled.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
int-gpios is optional in the binding, but tad214x_init() unconditionally
called tad214x_trigger_init(), which returns -ENODEV for a bus instance
with no interrupt line, leaving the device not ready even for polled use.
Only initialize the trigger when an interrupt GPIO is present, drop the
redundant "default y" so TAD2144_TRIGGER_NONE works, and reject
trigger_set() on interrupt-less instances.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The cadence value is in u6.2 format, so the number of samples between
two steps is raw_val / 4, but the conversion divided by
raw_val + (raw_val & 0x03), double-counting the fractional bits and
dividing by zero when no cadence had been reported yet. Divide by
raw_val alone and report 0 steps/s when raw_val is 0.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The FIFO packet size was hard-coded to include 6 gyroscope bytes, which
the ICM42370P never puts in a frame, so every frame after the first was
decoded at the wrong offset. Size the read from the actual FIFO
configuration and advance the decode index by the size the frame header
says the frame occupies.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
icm42x70_trigger_set() took the mutex and disabled the INT1 GPIO
interrupt before validating the trigger type, so returning -ENOTSUP left
the mutex held and the interrupt masked forever. Validate the trigger
type before acquiring anything so the error path has nothing to undo.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
icm42x70_attr_set() dropped the return value of every configuration
helper and always returned 0, so a rejected ODR, full-scale or APEX
setting looked applied to the caller, and a failed bus write still
updated the cached rate/range used to scale samples. Capture the helper
and HAL status codes, only commit the cached values once the register
write succeeded, and return the result from attr_set.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
icm42605_trigger_set() relied on icm42605_turn_on_sensor() to push the
tap_en flag to the chip, but that helper returns -EALREADY once the
sensor is running, so a tap trigger registered after a data-ready
trigger never enabled APEX tap detection. Re-apply the FIFO/APEX
configuration in that case, and only re-enable the interrupt once the
registers have been written.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
icm42605_turn_off_sensor() powered down the accel/gyro and bypassed the
FIFO but left drv_data->sensor_started set, so a later re-arm made
icm42605_turn_on_sensor() bail out with -EALREADY and the device stayed
powered off forever. Clear the flag once the sensor is turned off.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The 8-bit FIFO temperature field is two's complement, but the driver
cast the uint8_t FIFO byte directly to int16_t, zero-extending it and
turning every reading below 25 degC into a bogus 87..148 degC value.
Cast through int8_t so the sign bit is preserved.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
icm42605_set_fs() ORed the raw full-scale index into ACCEL_CONFIG0 and
GYRO_CONFIG0 without shifting it into the FS_SEL field (bits 7:5), so
the range was always left at 000 (+/-16 g / +/-2000 dps) and both the
devicetree accel-fs/gyro-fs properties and SENSOR_ATTR_FULL_SCALE were
silently ignored. Shift the selector into place and derive the
sensitivity constants from the configured range instead of hard-coding
them, so reported values match the range actually programmed.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
set_accel_range() and set_gyro_range() updated the cached full-scale
range before writing the ACC_RANGE/GYR_RANGE register, so a failed
write left the cache disagreeing with the hardware and silently scaled
every subsequent sample. Commit the new range only once the register
write succeeds.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The anymo_2 threshold field spans bits [10:0] (1 LSB = 1/2048 g), but
the driver scaled the requested value with BIT_MASK(10), programming
half the requested threshold and capping the maximum at 0.5 g. Use the
correct 11-bit full scale and mask the field before shifting.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The config-file upload loop reassigned ret on every iteration, so a
failed chunk write was overwritten by the next successful one and
write_config_file() returned 0 despite a corrupted upload. Stop the
loop as soon as a chunk write fails so the first bus error is
returned to bmi270_init().
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
write_config_file() always wrote BMI270_WR_LEN (32) bytes per chunk,
reading past the end of config files whose size is not a multiple of 32
(the default max_fifo image is 328 bytes, so the last chunk over-read 24
bytes). Clamp each chunk to the number of bytes actually remaining.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The runtime data structure stored motion_time and motion_threshold as
uint8_t while the config structure and devicetree properties use
uint16_t, truncating the binding's default 500 milli-g threshold to 244
and rejecting motion times above 255 ms. Widen both fields to uint16_t.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
SENSOR_CHAN_MAX32664C_SKIN_CONTACT always read report.scd_state, which
is never populated in SCD only mode or in extended report builds, so it
returned a stale or zero state. Read the SCD classifier in SCD only mode
and the extended report field when extended reports are enabled.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The worker thread had no case for MAX32664C_OP_MODE_SCD, so the hub
FIFO was never read, the SCD report queue never filled and the status
byte was evaluated uninitialized. Add the SCD read/parse path, clear
the status byte before the switch and report the SCD classifier on the
skin contact channel when running in SCD only mode.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The GPIO configuration used for I2C recovery previously omitted the
GPIO_INPUT flag. Due to a recent change in the behavior of the GPIO
driver, this caused the input buffer to not be enabled, and the GPIO was
always being read back as 0, and the bus was being reported as stuck.
This commit adds the GPIO_INPUT flag to the GPIO configuration for I2C
recovery so the GPIO can be read correctly.
Assisted-by: Copilot:claude-opus-5.5
Signed-off-by: John Batch <john.batch@infineon.com>
ifx_cat1_uart_configure() stored the requested uart_config into
data->cfg at the top of the function, before ifx_cat1_uart_set_baud()
ran. When the requested rate is unachievable -- for example 9600 baud on
an SCB clocked from an 8-bit peripheral divider group, where the divider
needed overflows the register -- set_baud() fails and configure()
returns -ENOTSUP, but data->cfg has already been overwritten with the
rejected configuration.
Every subsequent uart_config_get() then returns the bad config, and each
per-test re-init re-applies and re-fails it, cascading a single rejected
reconfigure across an entire suite (observed as drivers.uart.async_api
failing on kit_psc3m5_evk after test_read_abort switches to 9600 baud).
Cache data->cfg only after set_baud() succeeds, so a rejected
reconfigure leaves the previously-applied configuration intact.
Verified on kit_psc3m5_evk/psc3m5fds2afq1 with an SCB on an 8-bit divider
group: uart_configure(9600) is rejected (-ENOTSUP) and uart_config_get()
now returns the prior 115200 config instead of the rejected 9600.
Assisted-by: AI (GitHub Copilot)
Signed-off-by: Bill Waters <bill.waters@infineon.com>
The PDL asserts on zero-length FIFO reads and writes, which the UART
API allows; return 0 for them.
uart_irq_is_pending() and uart_irq_tx_ready() read the latched
interrupt status, which the PDL clears only after the callback
returns, so a callback looping on uart_irq_is_pending() never
returned. Use the RX and TX FIFO levels instead.
Tested with hci_uart on cyw920829m2evk_02/cyw20829b0lkml.
Assisted-by: Copilot:claude-opus-5.5
Signed-off-by: Merin George <merin.george@infineon.com>
Add a sensor driver for the EMU internal die temperature sensor on
Silicon Labs Series 2 (EFR32) SoCs, exposed via SENSOR_CHAN_DIE_TEMP.
Reads use sl_hal_emu_get_temperature() so the driver also works
unchanged on Series 3.
The devicetree models the EMU as a container node (silabs,emu) with
temp as a child, leaving room to represent other EMU functions later.
Enable the sensor and its die-temp0 alias directly in the
kg100s_rb4332a board devicetree, since it is an internal peripheral
with no board-specific wiring.
Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Nahuel Mesa <nahuel.mesa@focus.uy>
Export the SMP IRQ lock helpers used by irq_lock()/irq_unlock() and
the 32-bit counter used by k_cycle_get_32() and spinlock time limits.
These existing inline APIs leave imports in loadable extensions that
cannot resolve them without entries in the built-in symbol table.
Signed-off-by: Jinming Zhao <jinmzhao@qti.qualcomm.com>
init_acpi_ec1() checked xec_acpi_ec2_cfg.host_io_addr before programming
the ACPI_EC1 I/O BAR from xec_acpi_ec1_cfg.host_io_addr. Check the
ACPI_EC1 configuration instead.
The branch is only compiled when neither ESPI_PERIPHERAL_EC_HOST_CMD
nor ESPI_PERIPHERAL_HOST_IO_PVT is enabled, while the enclosing block
requires one of them, so the code is currently unreachable and this has
no functional effect.
Signed-off-by: Manimaran A <manimaran.a@microchip.com>
hd_init_tbl[] references INIT_UART, which is only defined when
CONFIG_ESPI_PERIPHERAL_UART is enabled. The NULL defaults were named
INIT_UART0 and INIT_UART1 and were never used, so disabling the eSPI
UART failed to build with 'INIT_UART' undeclared.
Replace the unused defaults with an INIT_UART NULL default and note
that the driver exposes a single eSPI UART although the hardware
implements several UART logical devices.
Signed-off-by: Manimaran A <manimaran.a@microchip.com>
The SSD1675A does not swap its black and red RAM after a partial
refresh, so the red RAM, which holds the previous image, went stale
and garbled later partial updates. Write the new image to the red RAM
on this controller.
Tested on reel_board@2.
Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The controller RAM uses a set bit for a white pixel, but the driver
reported PIXEL_FORMAT_MONO10, so LVGL and the character framebuffer
rendered inverted images. Report PIXEL_FORMAT_MONO01.
Tested on reel_board@2.
Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
errno values are positive. Set ENOTSUP instead of -ENOTSUP so that
callers returning -errno report the failure.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrey Dodonov <Andrey.Dodonov@endress.com>
Make BLECB_Indication() set ll_state_busy and return 1 only when packet
handling fails with -ENOMEM.
Previously, all receive errors were treated as a busy condition, including
malformed packets and other parsing failures. This could incorrectly signal
that the host was unable to accept data and trigger unnecessary
flow-control behavior.
Refactor treat_evt(), treat_acl(), and treat_iso() to return explicit error
codes and pass the received net_buf through an output parameter so the
caller can distinguish buffer exhaustion from other receive failures.
treat_evt() ignores discardable events on memory allocation failure without
returning an error
Fixes#118805
Signed-off-by: Michele Sardo <msmttchr@gmail.com>
Since commit 3cb68a9fc4 ("drivers: usb: common: stm32_pwr: add
support for STM32H5E/F line"), stm32_usb_pwr_enable() and
stm32_usb_pwr_disable() call LL_PWR_EnableVddUSB() and
LL_PWR_DisableVddUSB() on every STM32H5. STM32H503 has no PWR_USBSCR
register, as its USB transceiver is supplied from VDD (RM0492 Rev 3
section 9.4.5), and the HAL does not define these functions for it, so
any build that enables the USB device controller on it fails.
Call them only when PWR_USBSCR_USB33SV is defined, which is how this
file selected them on STM32H5 before that commit.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: YunHung Hua <oliverhua.us@gmail.com>
The async API, its DMA callbacks and event helpers repeat the full
data->async.dma_rx.<member> and data->async.dma_tx.<member> chains on
every access. The long, repetitive statements make the code hard to
read.
Take a local pointer to the stream (dma_tx, dma_rx) and to the async
context (async) at the top of each function that uses them, and rejoin
the statements that now fit on one line.
No functional change.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
data_bits_lut and stop_bits_lut are only used inside
uart_infineon_pdl.c. Give them internal linkage so they are no longer
exported as global symbols.
Also remove parity_lut. It was never referenced, because the parity
conversion already uses a switch statement.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
The PTP clock always selected digital rollover, where the sub-second
field counts nanoseconds. The 3.x core in STM32F1 predates that option:
its timestamp control register has no rollover select and its
sub-second field always counts in units of 2^-31 s, so the increment
was applied in the wrong unit and the values handed to the network
stack were off by a factor of about 2.15 and exceeded one second.
Digital rollover remains the default through the hidden KConfig option
PTP_CLOCK_DWC_MAC_DIGITAL_ROLLOVER, where the conversions are the
identity. The option is not offered on STM32F1, which therefore runs
in binary rollover mode.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
CONFIG_MCUMGR_TRANSPORT_UART_MTU and CONFIG_MCUMGR_TRANSPORT_SHELL_MTU
only set the value returned by the get_mtu callbacks of the UART and
shell transports, which the SMP layer does not use. Serial frames are
limited to MCUMGR_SERIAL_MAX_FRAME (127) bytes and the reassembled
packet size is limited by CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE.
Deprecate them along with the callback. They keep their default and
keep working until removal, and emit a deprecation warning when changed
from the default (on a separate symbol, due to Kconfig limitations).
Also fix the UART_MCUMGR_RX_BUF_COUNT help text, which related the
buffer count to the UART MTU. Each receive buffer holds one line until
it is decoded into the packet buffer, so the count only limits how many
fragments can be queued.
Fixes#54106
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Aric Radzin <aric.radzin@gmail.com>