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>
Add an EEPROM child driver for the Micro Crystal RV-3028 RTC.
The driver provides EEPROM read and write access through the
RV3028 MFD parent driver.
Signed-off-by: Janez Ugovsek <janez@ugovsek.info>
Add a bitmap to track which gpioint values are already assigned
to a tint, and reject connect requests that would either remap an
already-assigned tint or reuse a gpioint that's already in use.
Initialize data->gpioint to 0xFF (unassigned) at device init so the
new checks work correctly on first connect.
Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
Only RZ/V2H supports both GIC interrupt types level/edge for TINT, while
other RZ series keep GIC interrupt type unchanged regardless of TINT
trigger type.
Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
Fix intc_rz_tint_clear_irq_status() to only clear the TINT status
flag when it is actually set, since writing to it otherwise has no
effect per the register spec.
Add explanatory comments describing the V2H/V2N vs other SoC register
differences and the interrupt-setting precautions from the user's
manual.
Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
Introduce a spinlock to protect the shared TSCR/TITSR/TSSR registers
in intc_rz_tint_set_type() and intc_rz_tint_connect(), which can be
called concurrently from different tint instances.
Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
Deactive tx checksum offloading on the
esp32, while it has a big enough fifo,
the tx checksum is not correctly calculated
on every second packet.
Signed-off-by: Fin Maaß <info@finmaass.de>
Add support for configuring ERFO in/out capacitance
through device tree on MAX32657.
Co-authored-by: Okan Sahin <okan.sahin@analog.com>
Signed-off-by: Anu Biradar <anu.biradar@analog.com>
Add RTIO (Real-Time I/O) asynchronous API support to the ENS210
temperature and humidity sensor driver, covering both single-shot
and continuous measurement modes.
- Add ens210_rtio.c with RTIO submit handler and completion callbacks
- Add single-shot async flow using k_work_delayable for conversion delay
- Add continuous mode async flow with direct RTIO chaining
- Add sensor decoder API for frame decoding (temperature/humidity)
- Integrate MPSC lock-free queue for I/O scheduling
- Define RTIO context and I2C IO device per driver instance
- Update Kconfig to select RTIO-related options when async API is enabled
Signed-off-by: Sudarshan Iyengar <sudarshan.iyengar@alifsemi.com>
Assisted-by: Claude:claude-opus-4.7
i2c_dw_probe_hw() still stores the MMIO base returned by
DEVICE_MMIO_GET() in a uint32_t, truncating addresses above 4 GiB on
64-bit systems. Use mm_reg_t for the remaining MMIO base address.
Signed-off-by: Liwen Wu <liwen.wu@spacemit.com>
The GPU2D driver initializes during POST_KERNEL
and emits an INFO log message for successful initialization
that interferes with logging tests that expect an empty queue.
Signed-off-by: Julien Racki <julien.racki-ext@st.com>
Add a register-level BMI323 emulator for I2C and SPI. Model word
transactions, bus-specific dummy bytes, power-on defaults, invalid
sample markers, and soft reset.
Expose raw accelerometer, gyroscope, and temperature setters. Add
native_sim coverage for initialization, attributes, invalid samples,
and converted sensor data on both buses.
Assisted-by: Codex:GPT-5
Signed-off-by: Chaogui Deng <dengchaogui1@gmail.com>
Fix CONFIG_ADC_HAS_SEQUENCE_PRIORITY select by CONFIG_ADC_STM32.
Since st,adc-has-injected-support DT property is of boolean type, use of
dt_compat_any_has_prop(..., st,adc-has-injected-support) always returns
true. Set function argument value to True to get the expected behavior.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
bt_hci_stm32wba_send() calls BleStack_Request() while holding hci_sem.
If the controller indicates an event from within that call, the
resulting BLECB_Indication() takes the same semaphore from the same
thread and blocks forever, since a semaphore has no notion of an owner.
Use a mutex instead, which the owning thread is allowed to lock
recursively.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
The accelerometer scale factor was derived mechanically as
full-scale * g, assuming a sensitivity of FS/32767 for every range.
That holds for 2/4/8g but not for 16g, whose datasheet sensitivity is
0.732 mg/LSB, causing readings ~1.5x too small in that mode.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
lis2du12_enable_delta_int() called lis2du12_interrupt_mode_set() for
the read step of a read-modify-write, pushing an uninitialised struct
into the INTERRUPT_CFG and CTRL1 registers and randomly corrupting
interrupt polarity and latching. Use lis2du12_interrupt_mode_get()
instead.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
On SoCs that route the DesignWare GPIO signals through a pin
controller, the pins must be muxed to their GPIO function before
the controller can drive them. Add an optional "default" pinctrl
state to the binding and apply it during initialization. Everything
is conditional on at least one enabled instance having a pinctrl-0
property, so existing users that do not describe pin muxing are
unaffected.
Signed-off-by: Aravind Krishnan <aravind.krishnan@alifsemi.com>
Signed-off-by: Silesh C V <silesh@alifsemi.com>
adxl345_init() programmed the devicetree ODR but never stored it in
the driver data, so the cached value stayed 0 and the streaming header
carried an invalid rate index. The decoder then derived a zero sample
period, collapsing every timestamp in a FIFO batch to the same instant.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The one-shot fetch path filled a recycled RTIO buffer without ever
initializing struct adxl345_sample::is_fifo, so a stale bit left by a
previous streaming transaction made the decoder take the FIFO path and
misread the sample. Clear the flag before reading the sample, matching
the other ADI accelerometer drivers.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
adxl345_reg_write_mask() OR'd the data argument into the register
without confining it to mask, so callers passing a complemented value
(the INT_MAP routing idiom in adxl345_trigger.c and adxl345_stream.c)
set every bit outside the mask, clobbering unrelated interrupt routing.
AND data with mask before OR'ing it in.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The streaming callback clamped the read length to the space actually
available in the RTIO buffer but still queued one 6-byte read per
hardware FIFO entry, writing past the end of a truncated allocation.
Bound the loop (and the completion-callback attachment) by the clamped
length, and reset fifo_total_bytes at batch start so an aborted chain
cannot leave a stale write offset behind.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The pressure fractional part was always scaled with the 3125/128
factor, which is only exact for the 4096 LSB/hPa sensitivity (1260 hPa
full scale). In the 4060 hPa mode (fs = 1, 2048 LSB/hPa) that halved
the decimal part; use 6250/128 there instead.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
fetch_sem is given on every DRDY event, including conversions nobody
waits for (a late DRDY after a fetch timeout, or the single-shot
conversion started on PM resume), so k_sem_take() could return
immediately and the driver would report the previous conversion's data
forever. Discard any stale count before starting a new conversion.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The +25 C offset was added to val1 after the raw sample had already
been split into integer and fractional parts, so readings below 25 C
produced a positive val1 with a negative val2. Build the value in
micro-Celsius and let sensor_value_from_micro() split it so both
fields carry the same sign.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
Transition the appropriate `MODEM_CELLULAR_COMMON_CHAT_MATCHES` matches
to `MODEM_CELLULAR_OK_CHAT_MATCH_DEFINE` and update the vendor
script implementations to be compatible.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Generates periodic CNV trigger pulses at a configurable rate and duty
cycle to drive ADC conversions, exposed through the standard Zephyr PWM
API. Supports both v1 and v2 register layouts.
CONFIG_PWM_ADI_AXI_PWMGEN is auto-selected when
DT_HAS_ADI_AXI_PWMGEN_ENABLED.
Signed-off-by: Iustin Stolniceanu <iustin.stolniceanu@analog.com>
The flash_stm32h7x driver makes several accesses to properties of the
st,stm32-nv-flash child. Make sure said child exists.
Signed-off-by: Vilhelm Engström <vilhelm.engstrom@tuta.io>
The bank2-flash-size property was introduced as a workaround for the
Cortex-M4 of dual core MCUs cannot access the flash size register. As of
0e41b07309 (drivers : flash: update way to get flash size), this
register is no longer used by the driver. Instead, the size of the
entire flash is derived from the size cell of the corresponding
devicetree node. As this works just as well on the Cortex-M4 as it does
on the Cortex-M7, the bank2-flash-size property is no longer needed.
Signed-off-by: Vilhelm Engström <vilhelm.engstrom@tuta.io>
The changeset in which the removal of LL_GetFLashSize was accounted for
failed to consider that the size cell of the flash nodes on the dual
core MCUs - i.e. the STM32H747, STM32H757, STM32H745 and STM32H755 -
contains the size of a single bank rather than that of the entire flash.
As a result, the driver mistakes the flash mapped at
0x08008000-0x80fffff for a gap between two discontinuous memory banks
rather than a part of bank 1, thereby rendering sectors 4 through 7 of
the latter inaccessible.
Since both banks on the affected MCUs are the same size, simply
multiply said size by 2 to attain the correct total flash size.
Fixes: 0e41b07309 (drivers : flash: update way to get flash size)
Signed-off-by: Vilhelm Engström <vilhelm.engstrom@tuta.io>
Previously, it was possible to have a vsync event happen between the
semaphore reset and the buffer swap call meaning the driver would not
actually wait for the frame to be shown on the LCD before returning
Signed-off-by: André Costa <andre_miguel_costa@hotmail.com>
When converting timeout (in microseconds) to bauds use by the HW
frame timeout use less accurate conversion but one that does not
use 64 bit division. 64 bit division takes a lot of code and time
and shoud be avoided.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
adxl355_decoder_decode() reinterprets a raw sample buffer as
struct adxl355_fifo_data first, checking is_fifo at byte offset 0 to
decide whether to route to adxl355_decode_stream(). struct
adxl355_sample declared is_fifo last (after x/y/z/range), so offset 0
of a one-shot sample buffer was actually the low byte of x - real
accelerometer data, not a flag.
With CONFIG_ADXL355_STREAM=y, roughly half of all one-shot reads
(whenever bit 0 of the raw X LSB happened to be set) were misrouted
into adxl355_decode_stream(), which then reads fifo_byte_count and
sample_set_size at offsets 20-22 - past the 20-byte (sizeof(struct
adxl355_sample)) buffer - causing an out-of-bounds read.
Fix this by giving adxl355_sample an is_fifo field at offset 0,
matching adxl355_fifo_data's layout, and have adxl355_read_sample()
explicitly clear it rather than relying on zero-initialization.
Signed-off-by: Dimitrije Lilic <dimitrije.lilic@orioninc.com>
BMA4XX_RTIO_SPI_DEFINE() called SPI_DT_IODEV_DEFINE() with two arguments
where three are required, so the macro could never expand for an instance
on SPI. Pass an operation of 0, matching the SPI_DT_SPEC_INST_GET() call
made for the same node in BMA4XX_CONFIG_SPI().
This went unnoticed because the definition sits behind
COND_CODE_1(DT_INST_ON_BUS(inst, spi), ...) and no in-tree devicetree
describes a bma4xx on a SPI bus.
Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The optional delay argument accepted by SPI_CONFIG_DT, SPI_CONFIG_DT_INST,
SPI_DT_SPEC_GET, SPI_DT_SPEC_INST_GET and SPI_CS_CONTROL_INIT was
deprecated in Zephyr 4.3 and is now removed as part of the 4.5 deprecation
removal cycle.
These macros now take a fixed argument list, and the chip select timing is
always derived from the spi-cs-setup-delay-ns and spi-cs-hold-delay-ns
devicetree properties of the SPI device node. The SPI_DEPRECATE_DELAY_WARN
helper and the COND_CODE_0()/IS_EMPTY(__VA_ARGS__) plumbing that only
existed to support the deprecated form are dropped as well.
SPI_DT_IODEV_DEFINE and SPI_DT_INST_IODEV_DEFINE lose their variadic
argument too, since they forwarded it into SPI_DT_SPEC_GET.
The four remaining in-tree callers that still passed the deprecated
argument all passed a delay of 0, so nothing needs to be described in
devicetree for them.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
Add Wi-Fi status support to the ST67W611M1 Wi-Fi driver.
Supported for both interfaces (STA and SoftAP).
Signed-off-by: Eliott Speyser <eliott.speyser@st.com>
Add SoftAP support to the ST67W611M1 Wi-Fi driver.
Add a build test for the ST67W611M1_WIFI_STA_SAP_MODE config.
Also update doc and samples (zperf, wifi/apsta) for the X-NUCLEO-67W61M1
shield according to the SoftAP support.
Signed-off-by: Eliott Speyser <eliott.speyser@st.com>
The transmit buffer and the receive buffer share one register
window. A thread queueing the next transmission can write that
window while the receive interrupt handler reads a frame from
it, and the read then returns corrupted data: the frame
information byte loses its extended-id flag, so the frame is
parsed as standard, matches no exact-match filter and is
silently dropped. Guard the frame write plus transmission
request and the frame read plus buffer release with a
per-instance spinlock, releasing the receive buffer before
invoking the receive callbacks.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
The endpoint buffers live in the USB DPRAM, which is in the peripheral
(Device) memory region. On Armv8-M (Cortex-M33) Device memory must be
accessed naturally aligned regardless of CCR.UNALIGN_TRP, so an unaligned
half-word or word access raises a UsageFault.
The payload was copied with plain memcpy()/net_buf_add_mem(). picolibc's
Armv7-M memcpy finishes a 3-byte tail (e.g. the 31-byte USB MSC Command
Block Wrapper) with a byte copy followed by a half-word copy at an odd
address, which faults against the DPRAM. RP2040 (Cortex-M0+) is unaffected
because its libc memcpy is byte-wise.
Copy the word-multiple part with memcpy() and the remainder byte by byte.
Fixes#111789
Assisted-by: Claude:claude-opus-5
Signed-off-by: Andreas Petter <Andreas.Petter@mcnetic.de>
Fixed regression related to ethernet for MCUs that only support 10/100M
and lack RGMII.
Signed-off-by: Vinicius Carvalho <carvalho-vinicius@outlook.com>
Suspending the BMM150 resets its registers, which clears the configured
ODR and repetition settings. bmm150_init_chip() suspends the device
before returning, so the settings are already lost by the time the
driver first resumes it.
The resume path currently restores the power and operating modes only,
leaving the device with the reset values instead of the selected
CONFIG_BMM150_PRESET_* settings.
Tested on a BMM150 using the regular preset. Before this change,
REP_XY/REP_Z read back as 0x00/0x00 after resume. With this change,
they read back as 0x04/0x07 after resume.
Restore the configured preset before returning the device to normal
mode. This also ensures the settings are restored after runtime
suspend/resume cycles.
Signed-off-by: Hasan Albinsaid <mail@hasanabs.com>
The controller path in i2c_dw_setup() had three issues around
10-bit addressing:
* addr_master_10bit was only ever set on the 10-bit branch and
never cleared, so once a 10-bit configuration had been
programmed the controller stayed latched in 10-bit mode for
subsequent 7-bit transfers.
* Both check sites used the deprecated I2C_ADDR_10_BITS macro
instead of the current I2C_MSG_ADDR_10_BITS definition.
* The ic_10bitaddr_master programming (dynamic TAR path) was
guarded by an additional I2C_MODE_CONTROLLER check that is
already asserted earlier in the same function, making the
outer branch redundant.
Fix all three by adding an explicit 7-bit clear branch, replacing
I2C_ADDR_10_BITS with I2C_MSG_ADDR_10_BITS, and collapsing the
dynamic TAR block to a straight if/else. No functional change to
the 7-bit default behavior.
Signed-off-by: Shreehari HK <shreehari.hk@alifsemi.com>
The IT51XXX SMBus controller does not support SMBALERT#.
To support this feature, a GPIO interrupt is configured through a
devicetree property and used as the SMBALERT# notification source.
When the GPIO interrupt is triggered, the driver performs the SMBus Alert
Response Address (ARA) procedure to identify and process the alerting
device.
Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
Type-1 enumeration left prefetchable memory as TODO, so 64-bit BARs
behind a PCI-to-PCI bridge were not forwarded. Program prefetch
base/limit (and upper 32 bits) like the existing non-prefetch MEM
window.
Also advance the ECAM allocation offset when region_get_allocate_base()
aligns a Type-1 window, so subsequent BAR allocations start at the
aligned base instead of overlapping the unaligned remainder.
Signed-off-by: Li Wan <wanli@kylinos.cn>
The one-shot RTIO path sent the bare RM3100_REG_MX address, unlike the
bus and streaming paths which OR in REG_READ_BIT. On SPI this clears the
R/W bit, so the device treats the transfer as a write and never shifts
out measurement data, yielding garbage readings.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
ms5607_compensate() yields pressure in mbar * 100 (i.e. Pa), but
channel_get only divided by 100, returning mbar and thus a value 10x
too large for SENSOR_CHAN_PRESS, which is defined in kilopascal. Scale
by 1000 instead, matching the sibling ms5837 driver.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5