Connect every SERCOM interrupt line the devicetree node declares via
LISTIFY(DT_INST_NUM_IRQS), instead of a fixed index 0-3 subset
Signed-off-by: Mohamed Azhar <mohamed.azhar@microchip.com>
Update comments, log messages, Kconfig prose, and driver-local
identifiers to use the controller/target terminology ratified by
coding guideline A.2 and already used by the Zephyr I2C API.
Identifiers mirroring the TI driverlib
(e.g. MAP_I2CMaster* / I2CMaster* driverlib functions, I2C_MASTER_CMD_*
driverlib command macros, I2C_MASTER_ERR_* driverlib error macros) are
kept unchanged.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
counter_ns_to_ticks(), counter_ticks_to_ns(), counter_get_frequency_64()
and the other _64 entry points are declared and implemented
unconditionally, but their verifiers were compiled only under
CONFIG_COUNTER_64BITS_TICKS or CONFIG_COUNTER_64BITS_FREQ, so in other
builds they had no handler at all.
Move those verifiers out of the Kconfig guards. counter_get_value_64()
and counter_set_value_64() use K_SYSCALL_OBJ() because their driver op
is optional and the implementation already returns -ENOSYS when it is
absent; set_top_value_64, set_channel_alarm_64 and get_top_value_64
keep the driver-op check where those ops are defined.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
esp_ieee802154_frame_info_t has no member named "time"; the field is
"timestamp". Broken since the code was added (seemingly an errant copy
paste from the nrf5 driver).
Fixes building with CONFIG_NET_PKT_TIMESTAMP=y.
Signed-off-by: Mark H. Spatz <mspatz@leaflabs.com>
The EG915U hardware design requires PWRKEY to be driven low for at
least 2 s to turn the module on and for at least 3 s to turn it off.
The driver applies power_pulse_duration_ms to both the power-on and
the power-off pulse, so the current 2000 ms only satisfies the turn-on
requirement: a power-off request releases PWRKEY after 2 s, the module
ignores the pulse and keeps running while the driver moves on to
AWAIT_POWER_OFF and reports the device as suspended.
Raise the pulse to 3100 ms, which meets both minimums with a small
margin, as already done for the Fibocom LE250 (3200 ms) and the Telit
xEx10x families (5050 ms).
Not built and not run on hardware.
Signed-off-by: Gabriel Germano <gabriel.germano@edge.ufal.br>
The driver defined, deactivated and dialled PDP context 1
unconditionally, hardcoded in the core APN script and in every vendor
dial script. A module whose own functions already own that context, such
as a host-facing network function that activates context 1 by itself,
refuses a dial for the same context and answers NO CARRIER, and the
leading AT+CGACT=0,<cid> tears that other session down on the way.
Add CONFIG_MODEM_CELLULAR_PDP_CONTEXT_ID and thread it through
AT+CGDCONT, AT+CGACT, ATD and the Sierra Wireless AT+KCNXCFG connection
profile, which uses the same identifier. Vendors that dial without a
context or deactivate every context are left alone. The default of 1
keeps the emitted commands byte-identical.
Signed-off-by: Paulo Santos <pauloxrms@gmail.com>
Hold the Ethernet MAC in reset while the pins, the PHY interface mode
and the clocks are configured and release it once the setup is done.
The PHY interface mode must be selected while the MAC is under reset.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
There is only a single BSEC instance, so the upper fuse limit does not
have to be carried around in the driver config. Read it straight from
devicetree and drop the now unused config argument of the accessibility
check.
Assisted-by: Claude:claude-opus-5[1m]
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
The STM32MP13 HAL exposes a different BSEC API than the N6 and MP2
ones: the SAFMEM fuse array has to be powered up before a fuse can be
read from it or programmed, and reading a fuse loads it into its
shadow register on the way.
The upper fuses can be accessed from the secure world only, which is
where Zephyr runs as the first stage boot loader, whatever the life
cycle state of the device, so only an invalid state is rejected.
The BSEC clock is enabled through the clock control API, and its rate
is used to select the SAFMEM frequency range on power up.
Assisted-by: Claude:claude-fable-5-1
Assisted-by: Claude:claude-opus-5[1m]
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
The BSEC is clocked by pclk5, which can be sourced from HSI, HSE or
PLL2_P and may be prescaled, so its frequency has to be looked up
rather than assumed. Report it through the clock control API so that
the BSEC driver can pick the matching SAFMEM frequency range.
Assisted-by: Claude:claude-opus-5[1m]
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Tickless GRTC skipped the first compare and waited for
sys_clock_set_timeout(). The kernel only calls that when insert
reports a new soon-list head. Wheel timeouts past the later window
never do, so announce never starts and k_sleep latches.
The !TICKLESS guard was the old split, a tickful driver must fire
from boot because set_timeout is a no-op, while tickless assumed the
kernel would program the first real deadline. That first call never
comes if soon stays empty, so drop the guard and always arm one tick
at init, matching SysTick and timer_core_init(). The ISR still only
re-arms itself when TICKLESS=n.
Signed-off-by: Dhruv Menon <dhruvmenon1104@gmail.com>
The ERI ISR only cleared the SCI error flags and the pending IELSR.IR
inside the user_cb!=NULL branch. When an RX error (overrun/framing/
parity) occurs while no interrupt callback is registered yet - e.g. the
window during uart_configure()/R_SCI_UART_Open() before the Zephyr
callback is set - nothing is acknowledged, so the error stays pending
and the ISR re-triggers forever, starving the CPU (uart_configure hangs,
USB never enumerates). Always run err_check() and clear IELSR.IR.
Signed-off-by: Mattia Pennasilico <m.pennasilico@arduino.cc>
Assisted-by: Claude:claude-opus-4.8
The ONFI parameter page stores all fields in little endian byte order.
The driver read them directly from the packed struct, which only yields
the correct values on a little-endian host and would return byte-swapped
geometry and CRC values on a big-endian target.
Convert every multi-byte field on access with sys_le16_to_cpu() and
sys_le32_to_cpu().
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
The previous parameter page definition described only ONFI revision 5.2
and folded every field that does not exist in 5.2 into opaque reserved
gaps and an electrical_parameters blob. Many NAND flashes in the field
still implement ONFI 1.0, whose parameter page places different
information at those offsets, so those bytes could not be interpreted.
Cover the full range from ONFI 1.0 to 6.0. Replace the opaque reserved
and blob members of struct spi_nand_onfi_parameter_page with the
individual fields defined across all revisions, such as the partial page
geometry and timing parameters. Annotate each field with the ONFI
revision range in which it is valid so that users can tell which
members a device of a given revision actually populates.
The field offsets and the overall 256 byte layout are unchanged, so the
existing BUILD_ASSERT still holds and no reader is affected.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
The accel and gyro full-scale setters passed the raw field encoding
(0-3 / 0-7) as the value to a register update whose mask is the
FS_SEL field at bits 7:5, so the masked value was always 0 and the
part stayed at +/-16 g and +/-2000 dps while software scaled for the
requested range. Wrap the value in FIELD_PREP and widen the masks to
the 3-bit field the datasheet defines.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The accelerometer sensitivity shift was hardcoded to 10, which matches
neither the selected full-scale range nor the part's 16-bit output
(2048 LSB/g at +/-16 g, i.e. a shift of 11), making every reading twice
too large. Derive the shift from the selected range and write the
full-scale selection into the correct bit field so the two agree.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The fractional part was computed with an unsigned modulo while the
integer part used signed division, so for negative raw values the two
halves used different quotients and the result was one full unit too
high. Compute the value in signed micro-units and let
sensor_value_from_micro() split it consistently.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The pressure trigger setup passed ~int_mask to
inv_icp201xx_set_press_notification_config(), whose argument bits are
cleared from the whole INT_MASK register, so the stray bits set by the
bitwise NOT also un-masked the FIFO watermark, overflow and underflow
sources. Restrict the inverted mask to the two pressure bits.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
icp201xx_trigger_set() returned -1 without releasing the driver mutex
when called with a NULL handler, deadlocking every other driver entry
point. Unregistering now clears the requested trigger's handler,
re-arms the interrupt if another trigger is still registered, unlocks
and returns 0.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
Add a bus emulator for the BMM350 so the driver can be exercised on
native_sim without hardware. It models the register file, the two dummy
bytes returned ahead of every I2C read, the soft-reset and OTP-read
handshake, and the PMU magnetic-reset / forced-mode status sequence, and
implements the emul_sensor backend (set_channel / get_sample_range) for
the magnetometer and die-temperature channels.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Report the on-die temperature via SENSOR_CHAN_DIE_TEMP. The classic API
returns it from channel_get() as a sensor_value, and the RTIO decoder
path gains a matching channel: encode tags the frame with a temperature
bit (widening the encoded channel mask to four bits), get_size_info and
decode emit it as a q31 sample, and streamed data-ready frames now carry
temperature alongside the magnetic axes. The value is reported at 0.01
degC resolution.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
The temperature was converted and compensated at 1 degC resolution, which
also truncated the 25.49 degC offset to 25 and fed only whole-degree
temperature into the magnetic TCO/TCS compensation. Carry the temperature
in centi-degC (0.01 degC) instead: apply the full 25.49 degC offset and
fold the extra factor of 100 into the TCO/TCS stages so the magnetic
compensation uses the full-resolution temperature, matching the Bosch
SensorAPI reference. The stored temperature is now in centi-degC.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
A failed pad drive-strength write in bmm350_init_chip() returned directly
instead of going through the err_poweroff path, leaving the device in an
indeterminate power state unlike every other init failure. Use the common
error path so the part is returned to suspend mode.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
set_powermode() issued the PMU command write and then slept and returned
without inspecting the write result, and bmm350_init_chip() ignored the
return value of the soft-reset command write entirely. Propagate a failed
PMU write instead of sleeping on it, and abort init (returning the part
to suspend) if the soft-reset write fails.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
bmm350_trigger_set() always wrote the full interrupt configuration,
including the data-ready enable, even when called with a NULL handler.
The Zephyr trigger API uses a NULL handler to request "disable", so
there was previously no way to turn the trigger off. Clear the
data-ready and interrupt-output enables when the handler is NULL.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
bmm350_decoder_compensate_raw_data() performed the fixed-point
compensation in int32. The cross-axis stage multiplies the per-axis
value by BMM350_MAG_COMP_COEFF_SCALING (1000) twice, which overflows
int32 once the field exceeds roughly 2 mT (reachable during self-test
excitation or saturation), corrupting the result. Use int64
intermediates for the working values and cast back to int32 only for
the final stored readings.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
bmm350_submit_one_shot() and the streaming event handler acquired the
completion-callback RTIO SQE with rtio_sqe_acquire() but used it
without checking for NULL. If the SQE pool is exhausted the acquire
returns NULL and rtio_sqe_prep_callback_no_cqe() then dereferences it.
Check the result, drop any partially-prepared SQEs and fail the
submission with -ENOMEM, matching how the preceding read SQE is already
handled.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Add bmm350_self_test() to the driver's public header, following the
Bosch BMM350 SensorAPI self-test sequence: re-initialise the TMR sensor
(suspend, flux-guide reset, fast bit reset, fast-forced mode) with
per-step PMU command status verification, then measure the response to
a positive and negative excitation on the X and Y axes.
The excited-axis response is read uncompensated and converted to
micro-Tesla using the default sensitivity coefficients, matching the
SensorAPI read_out_raw_data(); OTP compensation is intentionally not
applied since the test evaluates the differential response. Results
(per-axis responses and deltas) are reported through a
bmm350_self_test_result struct, and the prior power mode is restored on
return. Judging the deltas against the datasheet self-test limit is
left to the caller.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
The BMM350 driver only supported I2C. Extend the existing RTIO bus
abstraction to also drive the sensor over I3C, following the same
multi-bus pattern used by the bmp581 driver.
A new BMM350_BUS_TYPE_I3C bus type is selected per devicetree instance
based on the bus the node sits on. The RTIO register read/write helpers
set the I3C stop/restart iodev flags, and bus readiness is checked via
the I3C controller device. Register access, triggering and one-shot/
streaming all flow through the existing bus_io vtable unchanged.
Add a bosch,bmm350-i3c.yaml binding that reuses the common properties,
make the I2C/I3C Kconfig selects conditional on the instance bus, and
add an I3C node to the sensor build_all test.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Add support for the Texas Instruments ADC124S021, a 4-channel
12-bit SPI ADC.
The driver implements the Zephyr ADC API and supports single-ended
reads on channels 0 through 3. Unsupported ADC API features such as
programmable gain, differential mode, oversampling, calibration, and
selectable resolution return -ENOTSUP.
Signed-off-by: Manuel Sanchez Monge <manuel.sanchezm2003@gmail.com>
The FIFO temperature is a signed quantity (8-bit at 2.07 LSB/degC in
standard packets, 16-bit at 132.48 LSB/degC in hires packets, both
offset at 25 degC), but the decoder read the bytes as unsigned, so any
temperature below 25 degC decoded as a large bogus positive value and
could trip the whole-degrees range assert. Cast to the signed width
before converting.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The sensor streams sample registers MSB-first, so assembling the value
as (MSB << 8) | LSB already yields a CPU-order value. Wrapping it in
sys_le16_to_cpu() byte-swapped every sample on big-endian targets; use
sys_get_be16() instead.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The streaming header unconditionally reported fifo_count as the FIFO
watermark, even on the flush paths (SENSOR_STREAM_DATA_NOP/DROP or
FIFO_FULL trigger) where only a header-sized buffer is allocated and
no FIFO payload is read, causing the decoder to walk past the end of
the buffer. Set fifo_count to 0 unless the watermark trigger requested
the data to be included, matching the read performed in the FIFO event
handler.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The one-shot decoder read edata->readings directly, ignoring the
axis_align remap that icm4268x_encode stores in the header and that
both the FIFO decoder and the sync channel_get path apply. Index and
sign the accel/gyro readings through header->axis_align so async
one-shot reads match the other data paths.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
icm4268x_safely_configure() overwrote the primary configure error
with the rollback result, so a failed reconfigure followed by a
successful rollback returned 0 to callers such as attr_set even
though the requested configuration was never applied. Keep the
original error and only log a rollback failure.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The FIFO temperature was packed by OR-ing a FIELD_PREP'd whole part
with a fraction term computed via unsigned GENMASK64 arithmetic. For
negative temperatures both pieces are negative, so the unsigned divide
produced garbage and bitwise OR cannot perform the required signed
add. Compute the q31 value with signed 64-bit arithmetic instead.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The non-hires FIFO decode path masked with BIT(16), which can never
be set in a 16-bit sample, so negative accel/gyro values were never
sign-extended and decoded as large positive values. Use BIT(15) to
match the 20-bit hires path's BIT(19) idiom.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The simulated radio derives its centre frequency as 2407 + channel * 5,
so it only ever operates in the 2.4 GHz band and the constant is
correct.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The channel getter and both interface status handlers split the band at
channel 14, which reports a 6 GHz channel as 5 GHz. Use the shared
helper so the split is done in one place and an out of range channel
reports WIFI_FREQ_BAND_UNKNOWN.
The scan handler is left alone. It takes the band from the band field
the firmware reports for the BSS rather than deriving it, which is the
better source where it is available.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The scan handler and both interface status handlers derived the band
with an open coded "channel > 14", which reports a 6 GHz channel as
5 GHz and a channel of 0 as 2.4 GHz. Use the shared helper instead, so
an interface whose channel is not known reports
WIFI_FREQ_BAND_UNKNOWN.
The softAP status handler also assigned acs_band, a driver internal
0/1 value, straight into the band field. That happens to produce the
right answer only because the two enumerations start with the same two
values, so spell the conversion out.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The interface status handler decided the band with "channel > 11",
which places channels 12, 13 and 14 in the 5 GHz band. Those are valid
2.4 GHz channels in several regulatory domains, so a station connected
on one of them reported the wrong band. The scan handler in the same
driver used "channel > 14", so the two disagreed about the same BSS.
Use the shared helper in both places. That fixes the 12-14 range, makes
scan and status agree, and reports 6 GHz channels as 6 GHz instead of
folding them into 5 GHz. A channel the driver never filled in now reads
as WIFI_FREQ_BAND_UNKNOWN rather than 2.4 GHz.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The other Wi-Fi drivers now derive the interface status band from the
channel rather than reporting a constant. This one cannot: the part is
2.4 GHz only and the driver reports channel 0, so deriving the band
would replace a correct answer with an unknown one.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The +CWJAP: response handler set the band to WIFI_FREQ_BAND_2_4_GHZ
before parsing anything, overwriting the WIFI_FREQ_BAND_UNKNOWN that
esp_mgmt_iface_status() had deliberately set, even when the response
turned out to be unparseable and the handler returned an error.
Derive the band from the channel once the channel has been parsed. The
scan handler never set the band at all, so every scan result carried a
zero, which is WIFI_FREQ_BAND_2_4_GHZ rather than an unknown band;
derive it there too. The supported parts are 2.4 GHz only, so the band
reported for a connection does not change.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The interface status handler reported WIFI_FREQ_BAND_2_4_GHZ
unconditionally, before it had asked the co-processor anything, so a
disconnected interface and any future dual band part would both be
described as being on 2.4 GHz.
Derive the band from the channel once the channel is known, for both
the station and the access point case, and leave it as
WIFI_FREQ_BAND_UNKNOWN until then. The scan handler filled in the
channel but never the band at all, which left every scan result
looking like a 2.4 GHz one, so fill it in there as well.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The interface status band was set from the interface flags, and only
when the 2.4 GHz flag was present. Everywhere else it was left at the
value the initial memset() produced, which is WIFI_FREQ_BAND_2_4_GHZ
rather than an unknown band. An interface that is not up yet returns
early from the handler and so reported 2.4 GHz without ever looking at
the radio.
The scan handler had its own open coded version of the same conversion:
it defaulted the band to 2.4 GHz and replaced it with an unknown band
when the channel fell outside 1-14. rf_channel is a uint8_t, so the
"<= 0" half of that range test could only ever match channel 0.
Derive the band from the channel in both places, once the channel is
known, and leave it as WIFI_FREQ_BAND_UNKNOWN until then. The scan
warning is kept, now driven by the derived band, so a channel the part
cannot be on is still reported. The part is 2.4 GHz only, so the band
does not change for an interface that is actually connected.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The interface status handler reported WIFI_FREQ_BAND_2_4_GHZ
unconditionally, so on the dual band ESP32-C5 a connection on a 5 GHz
channel was shown as 2.4 GHz by "wifi status" while "wifi scan" showed
the same BSS as 5 GHz. The constant was harmless while every supported
part was 2.4 GHz only.
Derive the band from the channel once the channel is known, in both the
station and the access point case, and default to
WIFI_FREQ_BAND_UNKNOWN so that a status query that cannot determine the
channel no longer claims 2.4 GHz. The scan path already derived the
band, but only distinguished 2.4 from 5 GHz, so let it use the same
helper.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>