use linear_range_get_win_index instead of
linear_range_group_get_win_index because it is only
one range.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
make r_is unsigned and use 0 as the invalid
value, as in the code we divide by r_is and we don't
want to divide by 0.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Add support for the PM API to the flash simulator. This enables testing
the PM behaviour of higher level libraries that use PM in CI to ensure
there are no missing/excessive calls to `pm_device_runtime_put` by the
library. For example:
```
ZTEST(library_pm, test_pm_calls)
{
const struct device *flash = DEVICE_DT_GET_ONE();
zassert_equal(0, pm_device_runtime_usage(flash));
some_complex_flash_user();
zassert_equal(0, pm_device_runtime_usage(flash));
}
```
Signed-off-by: Jordan Yates <jordan@embeint.com>
To allow cellular modems to be declared outside of modem_cellular.c
file, move all structure definitions and macros into internal header
zephyr/drivers/cellular_internal.h
This allows out-of-tree modem to be defined with
MODEM_CELLULAR_DEFINE_INSTANCE() macro.
Remove Devicetree dependency from CONFIG_MODEM_CELLULAR
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
On CY_IP_S8SRSSLT devices (PSOC 4), the WDT match register is 16-bit.
When Cy_SysClk_IloCompensate returns a compensated count that exceeds
UINT16_MAX (e.g. for a ~2000ms timeout at ~32768 Hz), passing it to
Cy_WDT_SetMatch triggers a HAL assertion that causes a HardFault on
Cortex-M0+.
Clamp ilo_compensated_counts to UINT16_MAX in the setup path, matching
the existing clamp in the feed path (ifx_wdt_timeout_to_match).
Signed-off-by: Braeden Lane <Braeden.Lane@infineon.com>
Fixes list_voltages for the tps55297
regulator driver. We can't use
`linear_range_get_value()`here, as it
subtracts `min_idx` from `idx` and we don't want that.
It lead to for some idx in the middle and the beginning
that no value is written to `volt_uv`.
It first occours for the idx between 0 and 0xf0.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
If we don't use the gpio to reset the chip, we don't
really know the current state, so we are going to
fetch it via i2c. For the en gpio case we already know,
that it won't be enabled.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Issue was corrected where transfers waiting on a busy
endpoint were not being serviced. This was causing some transfers
to never complete.
Signed-off-by: Brandon Hurst <brandon.hurst@analog.com>
Move xfer_in_done and xfer_out_done to after xfer_in
and xfer_out. This is because they will need to call
these functions in the next commit to handle deferred
traffic.
Signed-off-by: Brandon Hurst <brandon.hurst@analog.com>
UDC driver was submitting spurious resume events
when receiving DPACT events while the device was not
suspended.
- Change udc_max32_event callback to only respond to
DPACT events when suspended
Signed-off-by: Brandon Hurst <brandon.hurst@analog.com>
MAX32 USB had some functions in ISR context allocating memory &
acquiring mutexes. This commit fixes this by separating the
transfer completion events into ISR-safe / non ISR-safe steps.
Additionally, some apparent swapping of devicetree configuration
for in/out endpoints is resolved.
- Rename UDC_MAX32_EVT_XFER to UDC_MAX32_EVT_START_XFER
- Add MAX32 UDC events for XFER_IN_DONE and XFER_OUT_DONE
- Refactor xfer_in/out callbacks to only submit messages to a
message queue
- Provide xfer_in_Done and xfer_out_done to handle transfer
completions from UDC thread context.
- Add XFER_IN_DONE and XFER_OUT_DONE events to thread handler
- Fix swapping in devicetree macros of num_of_in_eps /
num_of_out_eps and ep_cfg_in / ep_cfg_out
Signed-off-by: Brandon Hurst <brandon.hurst@analog.com>
Promiscuous mode is enabled during initialization and cannot be
disabled at runtime.
Return -EINVAL when a request attempts to disable promiscuous mode.
Signed-off-by: Mori Fumita <mfumita@electromag.com.au>
ETHERNET_PROMISC_MODE is not advertised in
eth_nxp_enet_get_capabilities() even though promiscuous
mode is enabled during initialization when
CONFIG_NET_PROMISCUOUS_MODE=y.
Advertise ETHERNET_PROMISC_MODE in
eth_nxp_enet_get_capabilities() and accept
ETHERNET_CONFIG_TYPE_PROMISC_MODE in
eth_nxp_enet_set_config().
Signed-off-by: Mori Fumita <mfumita@electromag.com.au>
This was not noticed because there is currently no STM32 with a GPIOW port,
but adding it to the list is better for future-proofing.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Move the I2C_RTIO_DEFINE macro to the beginning of the
I2C_NRFX_TWI_RTIO_DEVICE macro definition, before the
struct that references it.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
On BL70x, pins 23-28 are output-only and must be routed through the
PSRAM IO pads. When PSRAM is not enabled, set GLB_GPIO_USE_PSRAM_IO
so these pins are usable as regular GPIOs.
Signed-off-by: William Markezana <william.markezana@gmail.com>
Use BIT(pin) instead of the raw pin number when setting or clearing
GPIO output values. Without BIT(), only the lowest pins were
affected and higher pins were never toggled.
Signed-off-by: William Markezana <william.markezana@gmail.com>
Allow the ADI MAX32 platform use `counter_reset` and `counter_set_value`
- `reset` clears the counter
- `set_value` sets it to a given value
Signed-off-by: James Roy <rruuaanng@outlook.com>
Replace the switch statement with an array-based register lookup and a
modulo operation to resolve a Coverity "integer handling" issue and make
the code simpler.
The original subtractions (*led -= 4U/8U/12U) were guarded by switch cases
making underflow impossible in practice, but the pattern was flagged
nevertheless. The new array-based approach is semantically equivalent and
arguably more readable.
Fixeszephyrproject-rtos/zephyr#84770
Fixes Coverity CID 487606
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Placing device drivers in vendor-specific subfolders provides greater
flexibility for approaches like `<vendor/device>-common.c/h` without
cluttering a shared directory. The sensor subsystem provides good
examples of the benefits of this approach -- in particular, the
/drivers/sensor/ti/ina2xx/ subdirectory.
Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
Enable CONFIG_SHARED_INTERRUPTS to allow multiple devices
to register handlers on the same IRQ line.
Replace irq_connect_dynamic() with IRQ_CONNECT() to configure
interrupts at build time, eliminating runtime setup overhead.
Signed-off-by: Manojkumar Konisetty <manoj@aerlync.com>
Signed-off-by: Sayooj K Karun <sayooj@aerlync.com>
Avoid this warning associated with the spi_context_cs_* functions
when DT_SPI_CTX_HAS_NO_CS_GPIOS is defined.
warning: statement with no effect [-Wunused-value]
Signed-off-by: Bill Waters <bill.waters@infineon.com>
Fix interrupt enable/disable sequence per ADXL345 datasheet
recommendations.
The ADXL345 datasheet (page 19) states: "When initially configuring
the interrupt pins, it is recommended that the functions and interrupt
mapping be done before enabling the interrupts."
Main changes:
1. Remove adxl345_interrupt_config() which incorrectly enabled
interrupts during driver initialization without proper sequencing.
It's not clear to me what was the purpose of this function as all
the required logic (setting gpio interrups, adxl mapping and enabling
happens already in tigger_set).
I checked other drivers and this seems to be the common pattern.
2. Implement proper INT_ENABLE disable/enable sequence in
adxl345_submit_stream() when reconfiguring watermark interrupts:
- Disable watermark interrupt in INT_ENABLE
- Configure interrupt mapping in INT_MAP
- Flush FIFO
- Re-enable watermark interrupt in INT_ENABLE
3. Add datasheet-based comments in adxl345_trigger.c explaining
non-obvious register operations:
- AC/DC coupling modes (ACT_INACT_CTL register)
- INT_MAP routing logic (0=INT1, 1=INT2)
- Interrupt clearing by reading data registers
4. Fix bug in adxl345_trigger_set() where ADXL345_INT_MAP_DATA_RDY_MSK
was hardcoded instead of using the correct int_mask variable.
Fixes#100891
Tested on ebyte_e73_tbb with samples `accel_polling` and `accel_trig`
Signed-off-by: Tobias Kässer <t.kaesser@gmail.com>
Added support for the low side power switch pin used for switching
DUTs attached to the ADC. The switch is configured though the
drivers device tree.
Signed-off-by: Noah Stephens <nstephens78@gmail.com>
Rename it to USB buffers so we can use it in host support without
confusion. Keep the UDC_* macros for now, we can deprecate and remove
them later.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
set the init prio of ethernet, mdio and the ethernet phy
to the same value, that way the prio from the dt is used.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Refactor MAX32 UART driver to use pm_device_driver_init so that the
device is moved to the appropriate power state expected by the system
during initialization.
Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
Add PM policy constraints so that UART driver can prevent the system
going to sleep before all characters are sent or received.
Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
`gpio_xec_pin_interrupt_config` returned early when the computed IDET
configuration matched the current CR1 IDET field. On some reset paths
the GPIO control register can retain the same IDET value while the
interrupt aggregator state is reset/reconfigured. In that case, the
early return prevents re-enabling the aggregator and interrupts remain
disabled.
Remove the IDET equality early-return so the driver always updates the
level/edge bookkeeping and programs the interrupt aggregator enable
state.
Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com>
Currently, scmi_send_message()'s logic is split across two functions,
each of which handling either polling or interrupt-based reply waiting.
Since the two functions are pretty much similar, merge them together in
a single scmi_send_message() function, which is able to handle both wait
startegies.
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
So far, the SCMI core has been in charge of enabling/disabling the "poll
for message reply" logic by directly using functions from MBOX/SHMEM.
This behavior should be abstracted away by a simple transport layer
send_message() function, with the SCMI core not having to know (or care)
about which kind of transport is being used.
To fix this problem, move the polling logic to the transport layer. Now,
based on the value of the "use_polling" parameter propagated from the SCMI
core, SHMEM will set/clear the interrupt-related bit from the flags
portion of the SHMEM area.
Note that now we only alter the state of the SHMEM flags with the MBOX
interrupts being enabled at all times. This should be enough to signal
the SCMI platform that the agent is not interested in receiving interrupts
whenever polling is enabled.
This commit is part of #102904.
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Add a new parameter to SHMEM's write_message() functon, which is meant to
allow it to perform the required configuration whenever the SCMI stack
(via the SCMI transport layer) wishes to poll for the reply.
For now, don't implement any logic related to this. Thus, no functional
change.
This commit is part of #102904.
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Add a new parameter to the transport layer's send_message() function,
which is meant to allow it to perform the required configuration whenever
the SCMI stack user (via the SCMI core layer) wishes to poll for the
reply.
For now, don't implement any logic related to this. Thus, no functional
change.
This commit is part of #102904.
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
stepper-ctrl is used as suffix for motion control drivers
stepper-driver is used as suffix for stepper drivers in mfd devices
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
Verify the return value of gpio_pin_configure_dt() when configuring
the codec reset GPIO.
Previously, failures during GPIO configuration were ignored, which
could leave the codec in an undefined state while the initialization
sequence continued.
Propagate the error to the caller to ensure proper failure handling.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
Add initial support for Analog Devices ADE7978 isolated energy
metering IC for polyphase shunt meters.
The driver implements the Zephyr sensor API and provides:
- SPI communication (read/write 8/16/32-bit registers)
- Phase A RMS current measurement (SENSOR_CHAN_CURRENT)
- Phase A RMS voltage measurement (SENSOR_CHAN_VOLTAGE)
- Device Tree bindings
This is an initial minimal working implementation. Future enhancements
will include:
- Multi-phase support (Phase B, C, Neutral)
- Active and reactive power measurement
- Interrupt support
- Calibration API
Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>