Commit graph zephyr/subsys/usb
Author SHA1 Message Date
Josuah Demangeon
93511748ee video: import source content from drivers/video
Move most of the shared sources from drivers/video/ into subsys/video/.
The content left in drivers/video/ is now only used by drivers, or
drivers themselves.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2026-07-17 19:04:54 -04:00
Josuah Demangeon
a0666f3877 drivers: video: only use <zephyr/drivers/video.h> for API shims
Move all the content of <zephyr/drivers/video.h> to a separate include
file in <zephyr/video/video.h> except driver entry points, all with a
video_drivers_... prefix.

Video control IDs are now in <zephyr/video/controls.h> and included
from both <zephyr/drivers/video.h> and <zephyr/video/video.h>.

Video format FourCCs are now in <zephyr/video/formats.h> and included
from both <zephyr/drivers/video.h> and <zephyr/video/video.h>.

As a side effect, introduce a video subsystem in MAINTAINERS.yml

Signed-off-by: Josuah Demangeon <me@josuah.net>
2026-07-17 19:04:54 -04:00
Nicholas Cadieux
f2474064e0 usb_c: prl: avoid unconditional poll of tcpc rx fifo
The prl_run function unconditionally called
prl_rx_wait_for_phy_message on every cycle, including wakeups
caused by TCPC_ALERT_TRANSMIT_MSG_SUCCESS. This allowed stale
data in the TCPC RX buffer to be read and forwarded to the
Policy Engine as a real message.

Add PRL_FLAGS_RX_COMPLETE (bit 10) to prl_rx->flags. The flag is
set in alert_handler when TCPC_ALERT_MSG_STATUS is received,
which the TCPC driver fires only for real non-GoodCRC messages.
prl_run now gates prl_rx_wait_for_phy_message on this flag, so
the RX path is only entered when the TCPC has explicitly
signaled a message is available.

Signed-off-by: Nicholas Cadieux <ncadieux@qti.qualcomm.com>
2026-07-15 10:42:17 +02:00
Nicholas Cadieux
b8bc6d0fde usb_c: prl: use atomic_clear to reset protocol layer flags
The PRL flag fields are reset with plain stores
(flags = ATOMIC_INIT(0)), which race with atomic_set_bit() calls
made from alert_handler on the TCPC driver's workqueue thread. A
concurrent set can be lost, dropping a message or reset
notification. Use atomic_clear() so the reset is race-safe.

Signed-off-by: Nicholas Cadieux <ncadieux@qti.qualcomm.com>
2026-07-15 10:42:17 +02:00
Tomasz Moń
ffed387a51 usb: device_next: Return data IN buffer instead of error
When USB control request cannot be handled the endpoint should be
stalled regardless of the reason. Simplify control request to host
handlers by changing the return type to the allocated buffer. Returning
NULL is enough to indicate to device stack that the request should be
stalled.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2026-07-13 09:43:54 +02:00
Tomasz Moń
e5bc5c7a6d usb: device_next: Allocate data IN stage in handler
For control transfers with data stage from device to host, only the
handler knows how large buffer is necessary (by specification host is
allowed to request up to 65535 bytes for every control read transfer).
While generally hosts do keep wLength relatively low, there are cases
where the value is big enough that the buffer cannot be allocated with
default UDC_BUF_POOL_SIZE value. Right now the only workaround is to
increase UDC_BUF_POOL_SIZE to large enough value but this is not a
viable solution on memory constrained targets. For example USB3CV
Mass Storage tests read string descriptor 0 with wLength set to 4096,
while the Zephyr response to this request is 4 bytes (and therefore 4
byte long buffer is enough).

Move the allocation to handler to allow the code to allocate as small
buffer as possible to handle the transfer. This allows MSC sample to
pass USB3CV with default UDC_BUF_POOL_SIZE value.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2026-07-13 09:43:54 +02:00
Mark Wang
dc810d622f usb: host: uvc: raise VIDEO_BUF_ABORTED signal on device removal
When a UVC device is removed, signal any waiting threads that buffers
have been aborted by raising the VIDEO_BUF_ABORTED signal. This ensures
proper cleanup and prevents threads from waiting indefinitely on buffers
that will never complete.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2026-07-12 20:00:48 -04:00
Tomasz Moń
8d5d9bb1ee usb: device_next: Return error code directly
Universal Serial Bus Specification Revision 2.0 does not differentiate
between "stack errors" and "protocol errors". 8.5.3.1 Reporting Status
Results lists three control transfer outcomes:
  * Function completes (ZLP/ACK)
  * Function has an error (STALL)
  * Function is busy (NAK)

If the control transfer fails, the device should respond with a STALL
handshake. In addition to protocol errors, which are reported using
errno values, the new device stack uses control transfer handler
return values as indicators for unrecoverable errors. Handlers that
wish to send a STALL handshake must set an errno value and return 0.

The idea of using both errno and return values was to propagate
unrecoverable errors to the user application, which would then shut
down and re-enable the stack. However, this approach is not unambiguous
for users and causes non-compliant timeout behavior when a handler
returns a non-zero value.

Make the stack always behave standards-compliant by removing errno
usage and passing the result directly via the control handler return
value. For now, keep the errno detection to output a deprecation warning.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2026-07-09 13:42:04 +01:00
Michael Zimmermann
e10af22991 tree-wide: replace usages of k_work_q thread with thread_id
The `thread` field is not initialized, if it's being animated via
k_work_queue_run instead of k_work_queue_start.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2026-06-29 22:17:45 -04:00
Anas Nashif
8104af619e typos: fix various typos under subsys/
Fix various typos.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-17 10:12:27 -04:00
Antoni Duda
2ee94b6b68 usb: cdc_acm: device_next: Mitigate posix ECHO issues
On linux the tty is opened in ECHO mode by default causing any data sent
immidiately after boot to be looped back into rx. This was mitigated in
old implementation in the commit 0127d000a2
("usb: device: cdc_acm: Use ZLP to detect initial host read").
The mitigation works by enqueing a ZLP. When the ZLP is consumed by the
host it means that it started reading. The patch then waits for some
time before sending actual payload. This gives the host application time
to switch off the ECHO mode.

This commit introduces analogous solution to device_next.

Signed-off-by: Antoni Duda <antoni.duda@nordicsemi.no>
2026-06-12 07:49:59 +02:00
Johann Fischer
c49b758d87 usb: device_next: respect wLength in CDC NCM to-host control handler
Limit the number of bytes that will be copied to the DATA IN buffer in
the CDC NCM implementation.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-06-11 15:51:06 +02:00
Johann Fischer
552ca37125 usb: device_next: dfu: fix the possible null pointer dereference
The buf parameter in handle_download() is allowed to be NULL. Check it
explicitly before using it for the length calculation or as an argument
for the callback.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-06-11 15:50:52 +02:00
Tomasz Moń
74d6e4a21c usb: device_next: hid: Add verify callback for Set Report request
Add new optional callback that lets application decide whether Set
Report payload should be received or not. This allows applications to
stop Set Report control transfer handling during Data OUT stage.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2026-06-10 13:11:36 +02:00
Tomasz Moń
70952dee35 usb: device_next: Allow handler to STALL Data OUT stage
Universal Serial Bus Specification Revision 2.0 9.2.7 Request Error
states "It is preferred that the STALL PID be returned at the next
Data stage transaction, as this avoids unnecessary bus activity.".

USB device_next implementation always attempted to receive Data OUT
stage without asking the handler if request can be handled. The only
case where the Data OUT stage was STALLed was when there was not enough
memory to allocate Data OUT buffer.

Do not automatically enqueue buffer to receive Data OUT stage. Call the
handler first with NULL buffer to determine whether the Data OUT stage
can be received. The handler will be called again after Data OUT stage
is received (it may not be called if there is not enough memory to
allocate Data OUT buffer, or if host aborts the transfer).

Modify all in-tree control transfer handlers to perform sanity check
before Data OUT stage is received. Out-of-tree classes that handle
control transfers with Data OUT stage will have to be updated. It was
chosen to implement this as a breaking change in order to not add any
new callbacks and to encourage device implementations to STALL Data OUT
stage as preferred by the USB specification.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2026-06-10 13:11:36 +02:00
Johan Hedberg
bae93e076e usb: legacy: Use net_buf_drop() where applicable
Replace the two-line pattern:

  net_buf_unref(buf);
  buf = NULL;

with net_buf_drop(&buf) which performs both operations
atomically in a single step.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 07:48:40 +02:00
Johan Hedberg
8d1110e446 usb: device_next: Use net_buf_drop() where applicable
Replace the two-line pattern:

  net_buf_unref(buf);
  buf = NULL;

with net_buf_drop(&buf) which performs both operations
atomically in a single step.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 07:48:40 +02:00
Johann Fischer
4709a88d72 usb: device_next: allow message callback to be set if USB is not enabled
Allow the notification callback to be set as long as USB is not enabled,
and permit users to change the callback.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-06-04 09:06:55 +02:00
Thomas Hebb
68a329a70b style: Fix various typos across the tree
Some of these are in user-visible log messages, but none are breaking
changes for applications.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
2026-06-03 08:26:41 +02:00
Fin Maaß
5769b11505 usb: dfu: select MPU_ALLOW_FLASH_WRITE only if ARM_MPU
only when ARM_MPU is enabled, the option
MPU_ALLOW_FLASH_WRITE needs to be enabled.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-29 22:09:37 +02:00
Fin Maaß
0dcf6a345a serial: uart: change return type of irq_update to void
the return value of uart_irq_update() is not relevant,
therefore change it to void.

Also as most uart drivers don't need irq_update, make
it optional to implement this function in the driver.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-19 17:46:51 -04:00
Aiden Hu
4b87a8f161 usb: host: fix root device lifecycle management
Move ctx->root assignment and clearing from event handlers
into usbh_device_connect() and usbh_device_disconnect().
This avoid dangling pointer issue.

Signed-off-by: Aiden Hu <weiwei.hu@nxp.com>
2026-05-13 05:12:09 +02:00
Aiden Hu
f938d67e91 usb: device_next: cdc_acm: make buffer pool size configurable
Add Kconfig option USBD_CDC_ACM_BUF_POOL_SIZE to allow
configuring the CDC ACM buffer pool size instead of
using the fixed MPS value.

Signed-off-by: Aiden Hu <weiwei.hu@nxp.com>
2026-05-13 05:10:30 +02:00
Josuah Demangeon
608d1b2bec usb: device_next: cdc_acm: update if0_cm.bDataInterface
The bDataInterface field is expected to contain the interface to use
for sending the data payloads, containing the BULK IN and OUT endpoints.
It is having a default value of 1 which fits USB descriptors at startup,
but once the stack renumbers the interfaces, it needs to be updated
with the numbers the host assigned.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2026-05-12 22:27:56 +02:00
Kristoffer Skøien
a03b6d540a usb: uac2: Adjust log level
The ECONNABORTED occurs on host stop and start.
Lowered the log level.

Signed-off-by: Kristoffer Skøien <kristoffer.skoien@nordicsemi.no>
2026-05-11 15:32:34 +01:00
Egill Sigurdur
16ac4a5b78 kernel: mem_slab: add K_MEM_SLAB_DEFINE_TYPE for automatic alignment
Introduces K_MEM_SLAB_DEFINE_TYPE() and K_MEM_SLAB_DEFINE_STATIC_TYPE()
helpers to allow the user to declare slabs for types without having to
manually ensure the alignment is correct.

Manual slab alignment was very error-prone and this change fixes several
instances of misalignment that would be trapped by the undefined
behavior sanitizer when running on 64-bit targets.

Signed-off-by: Egill Sigurdur <egill@egill.xyz>
2026-05-07 18:09:41 -05:00
Jonas R. Hansen
db2d9162b7 usb: usbip: make USBIP service port configurable
Makes it possible to host multiple native_sim's with native networking
without port collisions

Signed-off-by: Jonas R. Hansen <jonas.jmh@gmail.com>
2026-05-07 15:11:38 +01:00
Fin Maaß
22947e1019 usb: host: shell: fix level of printed messages
fix level of printed messages.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-04 22:08:01 +02:00
Fin Maaß
db984ee196 net: l2: ethernet: add struct net_if to arguments
add struct net_if to arguments

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-04 14:55:03 +02:00
Johann Fischer
ecbae771d8 usb: host: allow shell to select and use any host context
Add a command to select the USB host context, similar to the select
command in device support. Set the USB host context used by the shell to
the first entry in the section by default. The USB host context defined
in the shell is not necessary anymore and is moved to the sample code.
This has a very small impact on the user. The way the host shell
commands are used has not changed.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-05-01 16:21:57 -05:00
Johann Fischer
a055ab70c2 usb: host: fix copy and paste mistakes in shell outputs
Fix copy and paste mistakes in shell outputs. Remove unnecessary
shell_error() in device descriptor command.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-04-30 14:04:45 -04:00
Johann Fischer
b5ca615467 usb: host: clear root device if initialization failed
Otherwise, the disconnect event handler will attempt to free unallocated
resources.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-04-30 14:04:45 -04:00
Roman Leonov
57a430c679 usb: host: shell: rename list_dd command to info
Rename list_dd command to simplified info.

Signed-off-by: Roman Leonov <jam_roma@yahoo.com>
2026-04-29 16:34:24 -04:00
Johann Fischer
babe3f55ab usb: device_next: return EBUSY instead of ALREADY if USB device is enabled
Replace EALREADY return values of the functions that modify or set USB
device attributes to EBUSY. EBUSY seems to be more appropriate for the
case when a user tries to change the attributes of an operational
device.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-04-28 15:25:22 +02:00
Jay Beavers
255bccc1ba usb: device_next: cdc_ncm: Check usbd_ep_enqueue() return value
The cdc_ncm_send() function ignores the return value from
usbd_ep_enqueue(). If the enqueue fails, the code proceeds to block
forever on k_sem_take() waiting for a completion callback that will
never arrive, causing a deadlock.

This was discovered by comparing the CDC-NCM implementation with
CDC-ECM, which correctly checks the return value:

    ret = usbd_ep_enqueue(c_data, buf);
    if (ret) {
        LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep);
        net_buf_unref(buf);
        return ret;
    }

The NCM driver was missing this error handling, leading to potential
hangs if usbd_ep_enqueue() fails for any reason (e.g., endpoint not
ready, USB disconnected, buffer issues).

Fix by checking the return value and properly cleaning up (freeing
the buffer) before returning the error code to the caller.

Signed-off-by: Jay Beavers <jay@tolttechnologies.com>
2026-04-24 10:29:15 -04:00
Roman Leonov
12d918f38b usb: host: shell: use SHELL_HELP() macro
Use SHELL_HELP() macro in USB host shell support.

Signed-off-by: Roman Leonov <jam_roma@yahoo.com>
2026-04-21 18:40:49 -04:00
Roman Leonov
a0dee7ddad usb: host: shell: add usbh device list_dd command
Added:
- usbh shell command to dump descriptors

Signed-off-by: Roman Leonov <jam_roma@yahoo.com>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-04-17 10:34:50 +02:00
Johann Fischer
8d2cc34ecf usb: device_next: allow cdc_acm_poll_in() to receive
Allow cdc_acm_poll_in() to receive when CDC ACM function gets enabled,
but only when the IRQ API is not already used.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-04-14 22:08:22 -04:00
Nicholas Cadieux
4e5cb31d32 usb_c: pe: fix PE state on DRS sender response timeout
When the SenderResponseTimer expires in PE_DRS_SEND_SWAP, PE was
unconditionally transitioning to PE_SNK_READY. This is incorrect when
the port is operating as a Source, as it should return to PE_SRC_READY.

Replace pe_set_state(dev, PE_SNK_READY) with pe_set_ready_state(dev),
which selects the correct ready state based on the current power role.

Signed-off-by: Nicholas Cadieux <ncadieux@qti.qualcomm.com>
2026-03-31 18:24:46 -05:00
Alexander Wachter
a03080b002 usb: usb_c: fix level of vbus check in Attached.SNK
The transition from Attached.SNK to Unattached.SNK is currently
triggered if vbus is < vSafe5V.
USB-Type C Spec R2.4 Table 4-3 defines vSinkDisconnect as
the voltage to be used for the transition from
Attached.SNK to Unattached.SNK
This commit changes the check to use the correct voltage level.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2026-03-31 18:22:17 -05:00
Nicholas Cadieux
2665774487 usb: usb_c: pe: fix DPM notifications on PD attach and detach
On PD capable SRC detach, DPM was not being notified of
POWER_CHANGE_0A0 or NOT_PD_CONNECTED. Fix by notifying
POWER_CHANGE_0A0 in tc_attached_snk_exit() and NOT_PD_CONNECTED in
pe_suspend_entry().

On PD capable SNK or SRC detach, pe_suspend_entry() did not clear
the explicit contract flag. Fix by clearing PE_FLAGS_EXPLICIT_CONTRACT
in pe_suspend_entry().

On PD capable SNK attach, DPM was not being notified of PD_CONNECTED
at the correct time. Fix by notifying PD_CONNECTED when PS_RDY is
successfully transmitted (source) or received (sink), using
atomic_test_and_set_bit() to prevent duplicate notifications during
renegotiations.

Signed-off-by: Nicholas Cadieux <ncadieux@qti.qualcomm.com>
2026-03-30 10:02:58 -05:00
Fabio Baltieri
4d8eeff467 usb: device_next: cdc_acm: fix an llvm warning
Fixes an unused function warning when compiling with llvm, looks like
that does not fire with gcc for inline functions but it does for llvm,
tested with:

west build -p -b nrf52840dk/nrf52840 samples/subsys/usb/cdc_acm --
-DTOOLCHAIN_VARIANT_COMPILER=llvm -DCONFIG_UART_LINE_CTRL=n

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2026-03-27 12:35:07 -04:00
Fabio Baltieri
f08d56de23 usb: device_next: hid: fix some llvm warnings
Fixes:

zephyrproject/zephyr/subsys/usb/device_next/class/usbd_hid.c:635:19:
warning: unused function 'hid_dev_set_out_polling' [-Wunused-function]
zephyrproject/zephyr/subsys/usb/device_next/class/usbd_hid.c:665:19:
warning: unused function 'hid_dev_set_in_polling' [-Wunused-function]

When compiling with LLVM:

west build -p -b nrf52840dk/nrf52840 samples/subsys/usb/hid-keyboard --
-DTOOLCHAIN_VARIANT_COMPILER=llvm

Functions are only used when CONFIG_USBD_HID_SET_POLLING_PERIOD is
enabled, set as __maybe_unused instaed of inline.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2026-03-27 12:35:07 -04:00
Josuah Demangeon
7f1bf6028c usb: uvc: fix incorrect frame interval decoding
UVC counts frame intervals as 100ns units, so to get a number in
nanosecond, the value from USB needs to be divided by either
(USEC_PER_SEC * 10) or (NSEC_PER_SEC / 100). A mix of the two
was used.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2026-03-26 10:47:08 -04:00
Johann Fischer
04c150e3df usb: uvc: assign the actual streaming interface number
When UVC is part of a multi-function device, baInterfaceNr(0) may point
to an incorrect interface number. Assign the actual streaming interface
number after the configuration descriptor is initialized.

This is follow-up on commit 8d7bb597fc
("usb: uvc: use uvc_device_ in API and add _enable()/_shutdown()").

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-03-26 10:45:17 -04:00
Josuah Demangeon
8d7bb597fc usb: uvc: use uvc_device_ in API and add _enable()/_shutdown()
Use a different API call to complete the function rather than
relying on USB .init() to terminate the configuration.
This allows to set the endpoint descriptors before usbd_init()
is called.

Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-03-23 12:31:57 -05:00
Nicholas Cadieux
cf8197b7d1 usbc: tcpc: fix memory corruption in vconn_en and vconn_discharge callbacks
The vconn_en and vconn_discharge callbacks were invoked with the TCPC
device as the first argument. Application callbacks then called
usbc_get_dpm_data(dev) with the TCPC device, causing dev->data (which
is struct tcpc_data *) to be misinterpreted as struct usbc_port_data *.
This resulted in dpm_data->vconn_pol being written to an incorrect
memory offset, silently corrupting TCPC driver state.

Fix by adding a const struct device *usbc_dev parameter to
tcpc_vconn_control_cb_t and tcpc_vconn_discharge_cb_t, and propagating
it through set_vconn_cb and set_vconn_discharge_cb in the driver API.

Signed-off-by: Nicholas Cadieux <ncadieux@qti.qualcomm.com>
2026-03-21 00:48:09 +00:00
Nicholas Cadieux
d920c1689f usb: usb_c: tc: fix usbc_tc init race condition
Introduces a new TC_STARTUP_STATE to handle the initialization phase of
the Type-C state machine.

Previously, the state machine was initialized to TC_DISABLED_STATE during
POST_KERNEL initialization. This state inherits from
TC_CC_OPEN_SUPER_STATE, which executes tcpc_set_vconn(false). Since
VCONN callbacks are typically registered in main() (which runs after
POST_KERNEL), this resulted in an error log and the statemachine
unexpectedly transitioning to TC_ERROR_RECOVERY_STATE.

The new TC_STARTUP_STATE has no parent state and performs no hardware
operations. The state machine now transitions:
1. Boot (POST_KERNEL): Initialize to TC_STARTUP_STATE.
2. Start (MAIN): When usbc_start() runs the thread, tc_init() transitions
   to TC_DISABLED_STATE (ensuring VCONN/VBUS off with valid callbacks).
3. Run: Immediately transitions to TC_ERROR_RECOVERY_STATE to begin
   protocol operation.

Signed-off-by: Nicholas Cadieux <ncadieux@qti.qualcomm.com>
2026-03-21 00:48:09 +00:00
Nicholas Cadieux
9990ffa1d6 usb: usb_c: add Dual Role Power (DRP) support
Introduces DRP support to the USB-C subsystem, enabling dynamic
support for both Source and Sink power roles. Unattached devices
toggle between Source (Rp) and Sink (Rd) CC advertisements based
on the configured DRP period (tDRP) and duty cycle (dcSRC.DRP).
Once an attach is detected, the device enters the appropriate
Attached.SRC or Attached.SNK usbc_tc state and starts the
corresponding usbc_pe state machine to negotiate a power contract.

Signed-off-by: Nicholas Cadieux <ncadieux@qti.qualcomm.com>
2026-03-21 00:48:09 +00:00
Tomasz Moń
1525950cd6 usb: device_next: remove udc_buf_get_all()
Function udc_buf_get_all() was intended to be a helper to remove all
requests from endpoint FIFO. While for just freeing all queue the
it may be argued that there may be some doubtful simplicity argument,
merging multiple submitted transfers into one is just enforcing
unnecessary complexity on class implementations.

At general level, every submitted (enqueued) request should get
corresponding completion (request callback) call. UDC drivers were
violating this sensible behavior when dequeuing (cancelling) requests by
merging all submitted requests into one.

Remove udc_buf_get_all() and replace all uses with simple loops. For
most classes (that submit just one request for an endpoint at a time)
this has no functional difference. For classes that implement double
buffering this simplifies completion handling.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2026-03-21 00:47:16 +00:00