Allow selecting from all five GPT clock sources (off, periph,
high-freq, ext, low-freq, osc) via a new clock-source DT property.
The ext source fixes the prescaler at 1 since the frequency
is unknown to software.
gptfreq is no longer required when clock-source = "ext", in which
case counter_get_freq() returns 0 and callers work in raw ticks.
Signed-off-by: Jaro Van Landschoot <jaro.vanlandschoot@basalte.be>
The NXP IRTC driver declared the RTC calibration ops but left both
set_calibration and get_calibration as -ENOTSUP stubs, even though
they are wired into the API table under CONFIG_RTC_CALIBRATION.
Implement them on top of the IRTC coarse compensation logic. With
fine compensation disabled, COMPEN[7:0] is a two's-complement count
of RTC source clock cycles added to / removed from the cycles used
to generate one 1 Hz tick, applied once per COMPEN[15:8]-second
interval. The source clock frequency is taken from the node's
clock-frequency property (16.384 kHz or 32.768 kHz) rather than
CTRL[CLK_SEL], because that field is not configured / readable on
every IRTC platform (e.g. RT700 does not set clock-src). Fixing the
interval at 1 s gives ppb = value * 1e9 / cycles; set() computes the
rounded register value, rejects values outside the -128..+127
register range with -EINVAL, and get() reports the programmed
(quantized) value so a set()/get() round-trips at the hardware
resolution.
A positive COMPEN value adds source clock cycles and slows the RTC
down (measured on MCXN236 hardware), while the RTC API defines
positive calibration as increasing the RTC frequency, so the value
is negated in both directions.
Per the RM, with CTRL[FINEEN] = 0 compensation must be disabled via
CTRL[COMP_EN] before COMPEN is changed for the first time, so the
update sequence always disables compensation around the COMPEN
write. get() reports 0 when compensation is disabled. Both ops
return -EPERM on a share-counter secondary instance, whose time
counters are owned by the primary IRTC. All register access reuses
the driver's existing write-protection unlock under irq_lock rather
than the MCUX HAL, which does not unlock write protection.
Validated on frdm_mcxn236 (16.384 kHz source):
tests/drivers/rtc/rtc_api with CONFIG_RTC_CALIBRATION=y passes 4/4,
and a differential second-edge timing measurement against the CPU
cycle counter confirms +max/-max calibration shortens/lengthens the
RTC second by the expected ~0.77%.
Link: MCX N23x Reference Manual, Rev. 4 - RTC chapter 43 (COMPEN 43.5.1.18)
Signed-off-by: Holt Sun <holt.sun@nxp.com>
nxp_irtc_update_set_callback() called ARG_UNUSED(calibration) on an
identifier that does not exist in that function, which would fail to
compile with CONFIG_RTC_UPDATE=y. Reference the actual unused
parameter (callback) instead.
Signed-off-by: Holt Sun <holt.sun@nxp.com>
The STM32H5 clock driver disabled PLL1 before reconfiguring it but
did not wait until PLL1RDY was cleared. On STM32H5 this can leave
PLL1 reconfiguration unreliable when switching to a high-frequency
system clock during early boot.
Wait for PLL1 to be fully disabled (PLL1RDY cleared) before
reconfiguring it, as required by the reference manual.
Signed-off-by: Liang Jiaxiang <moonbite233@gmail.com>
Introduce initial implementation of shell subcommands for the SCMI Base
protocol. This expands the existing `scmi` shell command with a new
`base` subcommand, allowing users to access SCMI Base operations from
the shell.
Previously, only clock protocol commands were available through the SCMI
shell interface. This change adds support for retrieving protocol
version and platform revision information, discovering agents,
configuring device permissions, and resetting agent configurations,
using base protocol.
The change also updates CMakeLists.txt to include the new 'base.c'
source file when SCMI Base helpers are enabled.
Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
Signed-off-by: Svitlana Drozd <svitlana_drozd@epam.com>
Refactor SCMI base protocol API by removing the version extraction from
the `scmi_base_get_revision_info` function and renaming to the
`scmi_base_get_platform_info`.
Previously, the implementation version (`impl_ver`) was not stored
in the platform info structure, resulting in incomplete data. Fix
this by assigning `impl_ver` after retrieving the implementation
version.
Add the new `scmi_base_get_num_agents` function to simplify
agent_id input validation, eliminating the need to call the larger
`scmi_base_get_revision_info` for simple check.
Signed-off-by: Svitlana Drozd <svitlana_drozd@epam.com>
Previously, flash parameters (size, erase/write block size) were
hardcoded for internal flash only.
Introduce struct flash_info and update_flash_info() to dynamically
resolve flash parameters based on the active flash target (internal,
external CS0/CS1).
Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
No logging level was defined for the WM8904 audio codec driver.
Set it to the audio codec log level, allowing for uniformized,
yet granular log level control.
Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
No logging level was defined for the PCM1681 audio codec driver.
Set it to the audio codec log level, allowing for uniformized,
yet granular log level control.
Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
No logging level was defined for the MAX98091 audio codec driver.
Set it to the audio codec log level, allowing for uniformized,
yet granular log level control.
Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
No logging level was defined for the CS43L22 audio codec driver.
Set it to the audio codec log level, allowing for uniformized,
yet granular log level control.
Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
SLIRCLR is write-1-to-clear, so writing zero clears nothing. Skip the
SPI write when slir is zero.
Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Add a driver for the Hamamatsu S9706 digital RGB sensor using plain
GPIOs. All parameters (e.g. integration time and sensor range) are
runtime-configurable via sensor attributes.
Signed-off-by: Anton Puppe <anton-noel-flynn.puppe@zeiss.com>
Adjust defaults on nRF70 Series for a lower RAM footprint.
A 130 kB heap is too large for many applications.
Signed-off-by: Simon Duquennoy <simon.duquennoy@nordicsemi.no>
Store the return value of lc709203f_set_temp_mode() in ret so errors
during temperature mode configuration are properly logged and detected
rather than testing a stale return value.
Assisted-by: Antigravity:gemini-3.6-flash
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
LP IO wakeup sampling needs the independent LP IO clock enabled
when programming pin wakeup. Without it, the first deep sleep
cycle can draw excess current until sleep prepare force-enables
the clock. Enable/disable the clock with EXT1/GPIO wakeup setup.
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
After dynamic address assignment the code intends to release the
device's static address, but freed the newly assigned dynamic
address instead, undoing the reservation made just above and
allowing the same dynamic address to be handed out again.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
After dynamic address assignment the code intends to release the
device's static address, but freed the newly assigned dynamic
address instead, undoing the reservation made just above and
allowing the same dynamic address to be handed out again.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
After dynamic address assignment the code intends to release the
device's static address, but freed the newly assigned dynamic
address instead, undoing the reservation made just above and
allowing the same dynamic address to be handed out again.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
After dynamic address assignment the code intends to release the
device's static address, but freed the newly assigned dynamic
address instead, undoing the reservation made just above and
allowing the same dynamic address to be handed out again.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Setting the gender attribute wrote sub-index 0x08, which belongs to
age (height 0x06, weight 0x07, age 0x08), overwriting the age
setting. Use sub-index 0x09.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The full-scale attribute passed MAX31875_DATA_FORMAT_SHIFT (a bit
position) as the register mask, clearing the conversion-rate bits and
never setting the data format. Use BIT(MAX31875_DATA_FORMAT_SHIFT).
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Before this change, the host performed half-duplex SPI transactions,
which caused frames that happen to be queued by ESP at the same time
of a TX transfer to be dropped. This is especially noticeable with
the new firmware.
Rework the driver so every SPI transaction is full-duplex: outgoing
frames are queued and the event task drains TX while simultaneously
capturing RX, so nothing is lost.
Other major improvements of the driver:
* Remove SPI bus semaphore, since only the event task uses the bus now.
* Reduce stack usage of all threads by 50% by refactoring data structures.
* Simplify event task by moving fragment validation and reassembly into
a utility function.
* Fix undefined behavior in checksum validation.
* Fix the reassembly overflow guard (was off by twice the header).
* Split TX/RX queue sizes into separate Kconfig options.
* Fix and improve error codes usage (use -ENOBUFS, -EMSGSIZE, etc).
Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
The wait loop after enabling the PLL spun while the stable bit was
set, so it exited immediately while the PLL was still locking. Wait
until the stable bit becomes set.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Starting the LXT passed the PWRCTL HIRC enable bit position as the
STATUS bit to poll, so LXT readiness was judged from an unrelated bit.
Pass CLK_STATUS_LXTSTB_Pos, matching the HXT and LIRC calls.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit separates the stepper adi_tmc registers into separate headers
by series. It removes any dependencies between series in the register
definitions. See #105388.
Assisted-by: Claude:claude-opus-4.8
Signed-off-by: Perry Naseck <pnaseck@media.mit.edu>
Implement soc_secure_mem_read for flash driver to read secure memory,
access to the range of secure memory from non secure side should be
governed by tfm_platform allow list, implementation aligns to nrf_rram
driver secure memory read.
Signed-off-by: Travis Lam <travis.lam@nordicsemi.no>
As we now use net_pkt_set_tx_timestamping for
every tx packet that needs timestamping,
we no longer need to also check if the ptype is
NET_ETH_PTYPE_PTP.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
The gain switch mapped ADC_GAIN_3 to hardware gain 4 and ADC_GAIN_4
to gain 8, so requesting gain 4 configured gain 8 and the supported
gain 8 was rejected. Map ADC_GAIN_4 and ADC_GAIN_8 to their matching
PGA settings and drop the unsupported ADC_GAIN_3.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The guard required addr == 0 && addr > I2C_MAX_TARGET_ADDR, which is
never true, so invalid addresses were accepted. Use ||.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The size BUILD_ASSERTs referenced kb_code_map/mouse_code_map, which
do not exist, so they always passed. Use the real property names.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The bring-up path pulses the power key unconditionally. On modems that
toggle power with the key, that turns off a modem still running after an
MCU-only reset, and the driver then times out against a dead bus until the
modem completes a full power cycle.
Add an optional mdm-status-gpios input reporting modem power state. When it
is present and asserted at start-up, skip the power-on pulse and bring up
the bus directly; the init script confirms the modem responds, and if it
does not, the driver powers the modem on. Boards without the GPIO behave as
before.
Signed-off-by: Paulo Santos <pauloxrms@gmail.com>
Use the per controller timeout macro instead of the config directly,
this allows using per controller timeout and is a no-op for existing
users.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
swapped-x-y exchanges only the reported event codes. That is correct
when the touchscreen's coordinate space and the display share an aspect
ratio, and wrong as soon as they do not: on a rotated non-square panel
the swapped axes still carry each other's range, so X arrives bounded by
the screen height while Y overruns the display's.
A concrete case: a 480x272 panel whose controller reports in its own
480x272 space, mounted rotated a quarter turn. swapped-x-y alone
confines the reported X to 0..272 and lets Y reach 480 on a panel 272
tall. There is no combination of the existing properties that expresses
the rotation, because none of them rescale.
Add optional output-width / output-height describing the space
coordinates should land in, and scale into it after inverting and
swapping. Each value keeps its own source range -- the value held as X
always spans screen-width -- while its target dimension follows the code
it is reported under, which swapped-x-y has already chosen. So with the
axes swapped, the X value is scaled by output-height/screen-width and
lands on INPUT_ABS_Y.
The dimensions can also come from a display controller directly: an
optional display phandle sources output-width / output-height from the
referenced node's width / height, so the panel resolution is not
duplicated on the touchscreen node.
Both output dimensions are optional and resolve to 0 when absent, which
disables scaling: every existing driver and board keeps reporting
exactly what the controller produced.
Signed-off-by: Arkadiusz Grzelka <devitwise@gmail.com>
The two dimension checks in input_touchscreen_report_pos() are written as
equivalences:
__ASSERT(cfg->inverted_x == (cfg->screen_width > 0),
"X coordinate inversion requires screen-width");
which asserts more than the message says. It does require a width when
inverting, but it equally forbids declaring screen-width without asking for
inversion -- so a node that states the touchscreen's resolution for any
other reason trips an assert whose text does not mention that case.
Several in-tree boards already do exactly that. These all set screen-width
and screen-height with no inverted-x or inverted-y, and would fire the
assert under CONFIG_ASSERT:
boards/st/stm32f469i_disco
boards/st/stm32h573i_dk
boards/st/stm32l562e_dk
boards/adafruit/adafruit_2_8_tft_touch_v2
boards/m5stack/m5stack_core2
boards/lilygo/twatch_s3
tests/.../g1120b0mipi.overlay
Make the checks implications, so each property means what its message says
and declaring the dimensions alone is allowed.
Signed-off-by: Arkadiusz Grzelka <devitwise@gmail.com>
NRFX_IPC_ID_MAX_VALUE is the channel count: the callback arrays,
the ISR asserts and the virtual device list all treat it as an
exclusive bound. The send checks nevertheless accepted an id equal
to it and max_id_val_get() advertised it as valid, letting callers
signal a nonexistent channel. Treat it as an exclusive bound.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
esp_ieee802154_transmit_failed() received the transmission error and
discarded it, unlocking tx_wait exactly like the success path does. As a
result k_sem_take() in esp32_tx() returned 0 for a frame that lost channel
access or was never acknowledged, and the driver reported a successful
transmission to the upper layer. OpenThread was told the frame had been
sent and therefore never retransmitted it, so the frame was dropped
silently with no error reported anywhere.
Store the error reported by the callback and translate it into the return
values documented for the tx() operation in ieee802154_radio.h: -EBUSY for
a busy medium and -ENOMSG for a missing or invalid ACK. The OpenThread
platform layer maps these to OT_ERROR_CHANNEL_ACCESS_FAILURE and
OT_ERROR_NO_ACK respectively, both of which trigger a retransmission.
Clear ack_frame and ack_frame_info at the start of every transmission.
A transmission that fails produces no ACK, and one that times out never
reaches handle_ack(), so in both cases the pointers from the previous
transmission stayed live and handle_ack() released a frame that had
already been released. Clear ack_frame_info alongside ack_frame in
handle_ack() as well, so the pair is never left half valid.
Measured on an ESP32-C6 joined to a live Thread network sharing a channel
with three other nodes: a test sending five UDP datagrams and requiring all
five to be reflected failed on roughly half of all boots before this change
and passed 30 consecutive boots afterwards. The errors reported by the
callback were CCA_BUSY and NO_ACK.
Signed-off-by: David Girle <davidgirle@gmail.com>
buffer_size was set to the size of the whole data struct instead of
the uint16_t buffer member. Use sizeof of the member.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The SPI read command buffer was 2 bytes but described with a length
of 3, reading past the stack array and clocking out an indeterminate
byte. Size the buffer to match.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The trigger setup wrote the FF_MT_THS register address (0x17) as the
threshold instead of the maximum. Write FXOS8700_FF_MT_THS_MASK as
the comment describes.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Two build assertion guards tested MCUX_ACMP_HAS_OFFSET and
MCUX_ACMP_HAS_INPSEL/INNSEL, which are never defined; the macros
defined by this file carry a COMP_ prefix, as used by every other
guard here. The enum consistency assertions were therefore always
compiled out.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
set_trigger() only unmasked interrupts and relied on OR-ing a zero
mask for the COMPARATOR_TRIGGER_NONE case, which is a no-op, so a
previously enabled trigger kept firing after being set to none.
Mask the interrupt sources unconditionally before reconfiguring,
as the sibling NXP comparator drivers do.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The divide by ten was placed inside the property name argument of
DT_INST_PROP_OR, mangling the generated existence macro so the
lookup never matched and both hysteresis fields were always
programmed to zero. Divide the property value instead.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Apply the same controller lock lifecycle fix as the XSPI driver.
mspi_dev_config() released the controller lock before returning, so
no exclusive session was held until mspi_get_channel_status().
A successful mspi_dev_config() now keeps the lock, and
mspi_get_channel_status() releases it and clears the device ownership
once the controller is idle.
Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
Apply the same controller lock lifecycle fix as the XSPI driver.
mspi_dev_config() released the controller lock before returning, so
no exclusive session was held until mspi_get_channel_status().
A successful mspi_dev_config() now keeps the lock, and
mspi_get_channel_status() releases it and clears the device ownership
once the controller is idle. The re-init force-release also clears
the device ownership.
Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
mspi_dev_config() released the controller lock before returning, so
the lock only guarded the config call itself and no exclusive session
was held until mspi_get_channel_status(), as the MSPI API expects.
A successful mspi_dev_config() now keeps the lock, and
mspi_get_channel_status() releases it and clears the device ownership
once the controller is idle. Error paths release the lock only when
the same call took it, and the re-init force-release also clears the
device ownership.
Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
Let the IRTC wake-timer wake the CPU from deep sleep on SoCs where its
wake path is gated by a WUC (e.g. the i.MX RT700 SLEEPCON). Arm the WUC
line when a one-shot alarm is pending on a wakeup source, and disarm it
when the alarm fires or is cancelled.
The wake-timer is a wakeup source when devicetree declares it one
(wakeup-source) and routes it to a controller (wakeup-ctrls). An armed
alarm then wakes the SoC in two cases: the wake-timer is the chosen
system-timer low-power companion (zephyr,system-timer-companion), whose
alarm arms via the tickless idle path with no run-time enable; or an
application enabled it as a wakeup source at run time
(pm_device_wakeup_enable(), PM_DEVICE_FLAG_WS_ENABLED).
Disarming keys off the static "is a wakeup source" condition, not on the
companion role or the run-time enable: the companion arms without ever
setting WS_ENABLED, and the run-time enable may be cleared while an alarm
is pending, so gating disarm on either would leave a stale entry armed.
Disarming an instance that never armed is an idempotent no-op.
All WUC access is gated by IS_ENABLED(CONFIG_WUC) and a NULL wuc.dev, so
builds and SoCs without WUC are unaffected.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
Give the IRTC wake-timer a PM device with a stub action, initialised via
pm_device_driver_init(). It gates no clocks or state on suspend or resume,
but having a pm_base lets the device be selected as a wakeup source with
pm_device_wakeup_enable(), which sets the WS_ENABLED flag. No functional
change to counter behaviour.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>