Lines Matching +full:usb +full:- +full:dai +full:- +full:link

1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved.
6 #include <linux/usb.h>
9 #include <sound/soc-usb.h>
11 #include "../usb/card.h"
20 node = of_parse_phandle(dev->of_node, "usb-soc-be", 0); in snd_soc_find_phandle()
22 return ERR_PTR(-ENODEV); in snd_soc_find_phandle()
35 if (ctx->component->dev->of_node == node) in snd_soc_usb_ctx_lookup()
52 ctx = snd_soc_usb_ctx_lookup(dev->of_node); in snd_soc_find_usb_ctx()
58 /* SOC USB sound kcontrols */
60 * snd_soc_usb_setup_offload_jack() - Create USB offloading jack
61 * @component: USB DPCM backend DAI component
75 ret = snd_soc_card_jack_new(component->card, "USB Offload Jack", in snd_soc_usb_setup_offload_jack()
78 dev_err(component->card->dev, "Unable to add USB offload jack: %d\n", in snd_soc_usb_setup_offload_jack()
85 dev_err(component->card->dev, "Failed to set jack: %d\n", ret); in snd_soc_usb_setup_offload_jack()
94 * snd_soc_usb_update_offload_route - Find active USB offload path
95 * @dev: USB device to get offload status
96 * @card: USB card index
97 * @pcm: USB PCM device index
102 * Fetch the current status for the USB SND card and PCM device indexes
113 int ret = -ENODEV; in snd_soc_usb_update_offload_route()
120 if (ctx->update_offload_route_info) in snd_soc_usb_update_offload_route()
121 ret = ctx->update_offload_route_info(ctx->component, card, pcm, in snd_soc_usb_update_offload_route()
131 * snd_soc_usb_find_priv_data() - Retrieve private data stored
134 * Fetch the private data stored in the USB SND SoC structure.
145 return ctx ? ctx->priv_data : NULL; in snd_soc_usb_find_priv_data()
150 * snd_soc_usb_find_supported_format() - Check if audio format is supported
151 * @card_idx: USB sound chip array index
156 * supported by the USB device.
169 return -EOPNOTSUPP; in snd_soc_usb_find_supported_format()
176 * snd_soc_usb_allocate_port() - allocate a SoC USB port for offloading support
177 * @component: USB DPCM backend DAI component
180 * Allocate and initialize a SoC USB port. The SoC USB port is used to communicate
181 * different USB audio devices attached, in order to start audio offloading handled
182 * by an ASoC entity. USB device plug in/out events are signaled with a
183 * notification, but don't directly impact the memory allocated for the SoC USB
190 struct snd_soc_usb *usb; in snd_soc_usb_allocate_port() local
192 usb = kzalloc(sizeof(*usb), GFP_KERNEL); in snd_soc_usb_allocate_port()
193 if (!usb) in snd_soc_usb_allocate_port()
194 return ERR_PTR(-ENOMEM); in snd_soc_usb_allocate_port()
196 usb->component = component; in snd_soc_usb_allocate_port()
197 usb->priv_data = data; in snd_soc_usb_allocate_port()
199 return usb; in snd_soc_usb_allocate_port()
204 * snd_soc_usb_free_port() - free a SoC USB port used for offloading support
205 * @usb: allocated SoC USB port
207 * Free and remove the SoC USB port from the available list of ports. This will
208 * ensure that the communication between USB SND and ASoC is halted.
211 void snd_soc_usb_free_port(struct snd_soc_usb *usb) in snd_soc_usb_free_port() argument
213 snd_soc_usb_remove_port(usb); in snd_soc_usb_free_port()
214 kfree(usb); in snd_soc_usb_free_port()
219 * snd_soc_usb_add_port() - Add a USB backend port
220 * @usb: soc usb port to add
222 * Register a USB backend DAI link to the USB SoC framework. Memory is allocated
223 * as part of the USB backend DAI link.
226 void snd_soc_usb_add_port(struct snd_soc_usb *usb) in snd_soc_usb_add_port() argument
229 list_add_tail(&usb->list, &usb_ctx_list); in snd_soc_usb_add_port()
237 * snd_soc_usb_remove_port() - Remove a USB backend port
238 * @usb: soc usb port to remove
240 * Remove a USB backend DAI link from USB SoC. Memory is freed when USB backend
241 * DAI is removed, or when snd_soc_usb_free_port() is called.
244 void snd_soc_usb_remove_port(struct snd_soc_usb *usb) in snd_soc_usb_remove_port() argument
250 if (ctx == usb) { in snd_soc_usb_remove_port()
251 list_del(&ctx->list); in snd_soc_usb_remove_port()
260 * snd_soc_usb_connect() - Notification of USB device connection
261 * @usbdev: USB bus device
262 * @sdev: USB SND device to add
264 * Notify of a new USB SND device connection. The sdev->card_idx can be used to
265 * handle how the DPCM backend selects, which device to enable USB offloading
274 return -ENODEV; in snd_soc_usb_connect()
281 if (ctx->connection_status_cb) in snd_soc_usb_connect()
282 ctx->connection_status_cb(ctx, sdev, true); in snd_soc_usb_connect()
292 * snd_soc_usb_disconnect() - Notification of USB device disconnection
293 * @usbdev: USB bus device
294 * @sdev: USB SND device to remove
296 * Notify of a new USB SND device disconnection to the USB backend.
304 return -ENODEV; in snd_soc_usb_disconnect()
311 if (ctx->connection_status_cb) in snd_soc_usb_disconnect()
312 ctx->connection_status_cb(ctx, sdev, false); in snd_soc_usb_disconnect()
322 MODULE_DESCRIPTION("SoC USB driver for offloading");