ad405x_reg_update_bits() performs a raw read-modify-write without
shifting the value into the field position. The sample rate field
in TIMER_CONFIG occupies bits [7:4] (AD405X_FS_BURST_AUTO_MSK =
GENMASK(7, 4)), but ad405x_set_sample_rate() passes the raw enum
value (0-15) without shifting it.
This causes the rate value to be written into bits [3:0] instead
of bits [7:4], corrupting unrelated fields and setting the wrong
sample rate.
Shift the value by 4 to place it into the correct bit position,
consistent with how other callers handle non-zero-based fields
(e.g., ad405x_set_gp_mode() manually shifts for GP1_MODE_MSK).
Fixes: 4a9d1473d3 ("drivers: adc: ad405x: Add AD405X driver")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Instead of switching the DLCI channel used for AT commands from DLCI1 to
DLCI2 halfway through the setup process, always use DLCI1. For PPP, use
the clean DLCI2 channel. The only "command" sent on the DLCI2 channel
before handing over to the PPP module is the dial script.
Signed-off-by: Jordan Yates <jordan@embeint.com>
This reverts commit 8d45e18d23.
With the intent to keep the AT command channel on DLCI1 and use DLCI2
exclusively for PPP, the concern about buffered messages when the
channel switches is no longer relevent.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Calculate the future time correctly to avoid negative value for "value_ms".
Register the pm_policy_event when HAL_RADIO_TIMER_SetRadioTimerValue
returns success.
Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
Handle repetition and adaptive health test errors for STM32WB09 properly.
Resetting Health error flags is not enough. See also RM0505 §14.7.11
Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
Avoid entering low power mode while waiting for an event to be
generated by TRNG interrupt when CONFIG_PM_S2RAM is set.
Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
Add support for the no-3-3-v and no-3-0-v devicetree properties in the
IMX USDHC driver. When both are set, the driver overrides the host
capability flags to disable 3.3V and 3.0V support, and sets the USDHC
VSELECT bit at init time to configure the data line sampling threshold
for 1.8V I/O without triggering the SD voltage switch protocol.
Update the reset function to respect the voltage configuration: when
both no-3-3-v and no-3-0-v are set, the reset path now restores 1.8V
signaling instead of unconditionally switching to 3.3V, ensuring correct
behavior after card re-initialization on fixed 1.8V I/O boards.
This is required for boards like the MIMXRT700-EVK where the USDHC1
I/O voltage domain (VDDIO_0) is fixed at 1.8V.
Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
Initialize the 32-bit DR temporary at declaration before copying a
partial tail chunk in qspi_nor_write_fifo(). Without this, 1-3 byte
writes can leave the upper bytes unchanged and push stale bits into
MPI_DR.
Signed-off-by: Haoran Jiang <halfsweet@halfsweet.cn>
In adxl362_set_interrupt_mode(), the LINKLOOP field is first cleared
from the register value, but then the original uncleared register
value is OR'd back in on the next line, restoring the old LINKLOOP
bits. This makes it impossible to change the interrupt mode from its
current value.
Remove the erroneous OR of old_act_inact_reg so the cleared field is
properly set to the new mode value.
Fixes: 11295c190b ("drivers: sensor: Add ADXL362 interrupt handling")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Add support for multiple plane devices to the SPI NAND driver.
This includes adding a new plane-bytes property to the device
tree bindings, which indicates the size of each plane in the
flash device. For devices with a single plane, this should be
set to the same value as size-bytes.
Some devices require the plane address as part of read and/or
program commands. For these devices, the new has-read-plane-select
and has-program-plane-select properties can be set to indicate
that the driver should include the plane address in read and
program commands.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
i3c_bus_rstdaa_all() sends the RSTDAA broadcast and clears every
attached descriptor's dynamic_addr, but does not return those
addresses to the address-slot pool. Subsequent calls to
i3c_addr_slots_next_free_find() therefore skip the freed DAs and
the bus monotonically exhausts the valid dynamic-address range
across successive RSTDAA + DAA cycles.
Free each target's DA in the address-slot bookkeeping in the same
loop that clears dynamic_addr, so RSTDAA is fully reversible at
the software level.
This fixes sustained RSTDAA+DAA test cycles across all I3C
controller drivers (cadence, dw, mcux, max32, stm32, npcx,
renesas, it51xxx). Previously, after ~10-20 RSTDAA cycles the
bus would run out of assignable dynamic addresses.
Signed-off-by: Sudarshan Iyengar <sudarshan.iyengar@alifsemi.com>
Assisted-by: Claude:claude-opus-4.7
The DesignWare I3C controller driver maintained several pieces of
per-target state that went out of sync with hardware whenever DAA ran
more than once on the same bus (e.g., boot DAA, RSTDAA + DAA, or a
second explicit i3c_do_daa() call).This desynchronization between
software state and hardware resulted in persistent -ENXIO errors
on all transfers after bus re-enumeration.
Root cause (shared by all three fixes below):
The DW controller's ENTDAA implementation treats DAT slots as a free
pool. It fills empty slots starting at COMMAND_PORT_DEV_INDEX in
arbitration order (lowest PID wins first). This order is unrelated to
the slot chosen by dw_i3c_attach_device() at subsystem init. The driver
previously assumed the attach-time binding was stable across DAA
cycles and never re-read hardware state; any target that participated
in ENTDAA (i.e., had no "assigned-address" in DT, or lost its DA via
RSTDAA) ended up with desc->controller_priv pointing to one DAT slot
while hardware had placed the target in another.
Three related issues are fixed together:
1. add_slave_from_daa() did not refresh BCR/DCR on re-DAA. The I3C
spec allows a target to publish different BCR/DCR after a reset,
and after RSTDAA the cached values may no longer reflect the
target's current capabilities. Always re-read from the Device
Characteristic Table when a new DA is assigned.
2. add_slave_from_daa() did not detect the priv->id != pos case
described above. When it occurs (the common case for any DT
target without "assigned-address"), rebind controller_priv to
the DAT slot hardware chose and return the old slot to the free
pool. Without this, subsequent transfers write the command DAT
index of an empty slot and NACK with -ENXIO.
3. dw_i3c_device_find() only searched the static dev_list built
from DT. Targets allocated dynamically for non-DT devices on the
bus were invisible to PID lookups, so add_slave_from_daa() kept
allocating fresh descriptors on every DAA cycle and eventually
exhausted the descriptor pool. Fall back to scanning the
attached-device runtime list by PID when the static lookup
misses.
Signed-off-by: Sudarshan Iyengar <sudarshan.iyengar@alifsemi.com>
Assisted-by: Claude:claude-opus-4.7
Implement .recover_bus for both the i3c and i2c_api entries in the
DesignWare I3C driver so that i3c_recover_bus() and the i3c shell
can actually recover a stuck bus. Previously the callback was not
wired up and calls returned -ENOSYS.
The implementation deliberately avoids RESET_CTRL_SOFT and the
RESET_CTRL_ALL superset, because those clear the Device Address
Table (DAT) and Device Characteristic Table (DCT), destroying the
driver-to-hardware mapping of attached targets. Instead the
recovery path:
- drains any pending IBIs that could block a resume,
- flushes the command, response, RX, TX, and IBI queues,
- asserts DEV_CTRL_RESUME to clear a halt caused by a prior
transfer error.
This is the same FIFO flush + RESUME sequence already used by the
driver's per-transfer error path, so the safety properties are
well understood. The operation is mutex-guarded to avoid racing
with in-flight transfers.
Signed-off-by: Sudarshan Iyengar <sudarshan.iyengar@alifsemi.com>
Assisted-by: Claude:claude-opus-4.7
Since bt_hci_evt_hdr is a variable sized struct, it shall be
located at the end of the struct.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
For devices that does not have interrupt pin, default to polling mode
instead.
Polling period can be configured through
CONFIG_ETH_W5500_POLL_PERIOD.
Signed-off-by: Aiman Mazlan <mohammad.aiman@stratusauto.com>
`hazard3_irq_init` enables `MSTATUS_IEN` too early,
which allows ISRs, specifically machine timer ISR,
to be fired before `_kernel.cpus[0].irq_stack` is
initialized in `prepare_multithreading()` /
`z_init_cpu()`.
This can result in interrupt being handled with
uninitialized IRQ stack, causing system to crash.
Signed-off-by: Andy Lin <andylinpersonal@gmail.com>
Use the scl_od_min.low_ns and scl_od_min.high_ns fields from
i3c_config_controller to configure Open Drain SCL timing instead
of hardcoding. The OD low period is programmed via PRESCL_CTRL1.od_low
and the OD high period is honored by adjusting PRESCL_CTRL0.i3c if
the base period's T/2 is insufficient.
- Load od-thigh-min-ns and od-tlow-min-ns from devicetree in the
instantiation macro
- Copy scl_od_min from incoming config in cdns_i3c_configure
- Adjust I3C prescaler upward if needed to meet high_ns minimum,
warning that push-pull speed will also be reduced
- Use scl_od_min.low_ns for OD low calculation, falling back to
I3C_OD_TLOW_MIN_NS (200ns) when unset
- Remove duplicate I3C_BUS_TLOW_OD_MIN_NS in favor of
I3C_OD_TLOW_MIN_NS from i3c.h
- Replace magic 1000000000 constants with NSEC_PER_SEC
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
commit 9b2593b8c5 has changed the internal
ili9xxx driver color config from setting BGR mode (Blue-Red channels
swap, not pixel format byte-swap) by default, to conditioning it on the
use of PIXEL_FORMAT_BGR_565 (ILI9XXX_PIXEL_FORMAT_BGR565 in devicetree),
but without updating all boards/shields to use
ILI9XXX_PIXEL_FORMAT_BGR565 to preserve their old config.
Then commit 69e353904c replaced
ILI9XXX_PIXEL_FORMAT_BGR565 to PANEL_PIXEL_FORMAT_BGR565.
Later, commit b13d9a0510 renamed
PANEL_PIXEL_FORMAT_BGR565 to PANEL_PIXEL_FORMAT_RGB565X, and defined it
as "Byte swapped version of the PIXEL_FORMAT_RGB_565 format", which is
different from how it was interpreted by ili9xxx devices (B/R channel
swapped format).
The fix for this mess is:
- separate BGR mode (B/R channel swap) setting for ili9xxx from pixel
format,
- restore the initial driver config that sets BGR mode by default, in
order to not break in-tree and out-of-tree panels that relied on that
behavior,
- introduce a DT property that allows disabling BGR mode.
A bonus enhancement is to set BGR mode in ili9xxx driver outside
set_orientation() function, since they are unrelated.
Fixes https://github.com/zephyrproject-rtos/zephyr/issues/105521
Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
If DT has IRQ defined, the board supports NMI mode, if reset-capable
property is set then the board can support reset as well. Based
on these DT properties and the flags passed by the application,
NMI mode or Reset mode can be set.
Signed-off-by: Sunil Hegde <s-hegde3@ti.com>
CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE sets how many line buffers
should be used for the driver. When ther is no need to synchronize
the buffering default value should be maximal
(optimized write performance).
Whe ther is need for synchronize - value should be minimal
buffering - x1 (optimized radio firmware execution).
By mistake the default values were mixed eatch other.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Enable STM32 backup domain access on H7RS series when accessing some
RTC alarm configuration registers that otherwise would be read as 0.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Some devices do not have DEVICEID or BLE-related registers
in FICR. Use NFCID instead in such cases, if available.
Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
Add #ifdef guards around WMM_UAPSD specific API calls in power save
functions to fix compilation errors when CONFIG_NXP_WIFI_WMM_UAPSD
is disabled.
Signed-off-by: Qingling Wu <qingling.wu@nxp.com>
When CONFIG_NXP_WIFI_HOST_SLEEP is disabled:
- Provide a stub implementation of device_wlan_pm_action()
- Conditionally compile nxp_wifi_wlan_wakeup() helper function
This preserves PM device infrastructure while avoiding references to
host sleep symbols that are conditionally compiled in wifi_nxp module.
Signed-off-by: Qingling Wu <qingling.wu@nxp.com>
The get_resolution function returns 13 when the resolution bit is set
and 16 when it is clear. Per the ADT7420 datasheet, bit 7 of the
config register set to 1 means 16-bit resolution and 0 means 13-bit.
This is also confirmed by the driver's own set_resolution and init
code which sets the bit when 16-bit mode is desired.
Swap the return values so that 16 is returned when the resolution bit
is set and 13 when it is clear.
Fixes: d07b8a20f6 ("sensor: adt7420: Extend ADT7420 Driver Support")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Add support for the Trasna LEXI-R10 cellular modem in the generic
cellular module driver, starting from similar cellular modules
(e.g., LARA-R6 and/or SARA-R4).
LEXI-R10 is an ultra-compact LTE Cat-1bis module, designed for
IoT and M2M applications, featuring integrated IP connectivity
and clients.
The binding identifies the UART of the device.
Signed-off-by: Mattia Rebato <mattia.rebato@trasna.io>
Currently the stm32g4x flash driver only works in dual bank for devices
that support it. This is inconvenient when using mcuboot on a device with
less than the maximum 512k of flash, as it creates an unaddressable "hole"
between the two banks, artificially constraining the partition layout for
the bootloader, primary, and upgrade slots. Update the flash driver to add
a runtime check to see if the device is configured in single bank or dual
bank mode and adjust the page size accordingly. Note that the driver must
do both a compile time and runtime check for dual bank configuration as
dual bank mode is only supported on some devices in the family, and for
those that do support dual bank mode, they may or may not be configured as
such.
Signed-off-by: Michael Estes <michael.estes@byteserv.io>
Add RTC shell commands for alarm configuration and query.
This patch introduces three new shell commands under CONFIG_RTC_ALARM:
`set_alarm <dev> <id> <mask> <time>`:
Set an alarm for the specified device.
`get_alarm <dev> <id>`: Retrieve the current alarm time.
`get_alarm_mask <dev> <id>`: Show supported fields/mask of the alarm.
Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
Compute tm_wday after parsing RTC shell input by converting the parsed
datetime into a timestamp and back to struct tm.
Some RTC drivers rely on tm_wday when setting time, so ensure it is
always derived from the provided date to maintain consistent and correct
behavior.
Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
The status variable is used in the while loop condition before
ad4114_read_reg() has a chance to populate it. If the uninitialized
stack value happens to have bit 7 set, the loop is skipped entirely
and the driver proceeds to read ADC data before the conversion is
ready, returning stale or invalid results.
Initialize status to 0 so the loop always executes at least once.
Fixes: 8250cc68b7 ("drivers: adc: ad4114: add driver support")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Use logical AND (&&) instead of bitwise AND (&) when checking the
product ID during initialization. The intent is to verify that the
product ID matches neither AD4052 nor AD4050, which requires a
logical operation.
Fixes: 4a9d1473d3 ("drivers: adc: ad405x: Add AD405X driver")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
R_RTC_ClockSourceSet() stops the RTC by clearing the START bit.
Explicitly restart the RTC after clock source configuration on
non-warm reset so the RTC runs correctly after initialization.
Signed-off-by: Khai Cao <khai.cao.xk@renesas.com>
Normally, the RTC clock source is configured only on a cold reset.
However, flashing with Twister triggers a software reset, which can
cause RTC tests to fail.
This option forces the RTC clock source to be configured after
flashing, ensuring the RTC test runs reliably.
Signed-off-by: Khai Cao <khai.cao.xk@renesas.com>
On some Renesas RA boards, `RSTSR0_PORF` is not set after a power-on reset.
Switch to using `RSTSR2_CWSF` (cold/warm start flag) to decide whether the
RTC clock source needs to be reconfigured.
Signed-off-by: Khai Cao <khai.cao.xk@renesas.com>
The IIC controller does not implement the recover_bus API. When a
peripheral holds SDA low, the bus becomes stuck and cannot be
recovered without intervention (such as a reset).
Add bus recovery support via GPIO bitbanging. When enabled via
`CONFIG_I2C_RENESAS_RA_BUS_RECOVERY`, the driver reconfigures
the SCL and SDA pins as GPIOs, clocks out 9 pulses on SCL to force
the peripheral to release SDA, then restores the pins to the hardware
I2C controller via pinctrl.
Add scl-gpios and sda-gpios devicetree properties to identify
the GPIO lines used for recovery.
Signed-off-by: Andres Hernandez <andres.a.h@outlook.com>
The driver needs all child nodes to be on the same adc device and the
channels to be in increasing index since it uses the ADC sequencing API,
validate that the config is correct before initializing the driver.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>