sound/soc/soc-usb.c

Source file repositories/reference/linux-study-clean/sound/soc/soc-usb.c

File Facts

System
Linux kernel
Corpus path
sound/soc/soc-usb.c
Extension
.c
Size
7834 bytes
Lines
323
Domain
Driver Families
Bucket
sound/soc
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (ctx == usb) {
			list_del(&ctx->list);
			break;
		}
	}
	mutex_unlock(&ctx_mutex);
}
EXPORT_SYMBOL_GPL(snd_soc_usb_remove_port);

/**
 * snd_soc_usb_connect() - Notification of USB device connection
 * @usbdev: USB bus device
 * @sdev: USB SND device to add
 *
 * Notify of a new USB SND device connection.  The sdev->card_idx can be used to
 * handle how the DPCM backend selects, which device to enable USB offloading
 * on.
 *
 */
int snd_soc_usb_connect(struct device *usbdev, struct snd_soc_usb_device *sdev)
{
	struct snd_soc_usb *ctx;

	if (!usbdev)
		return -ENODEV;

	mutex_lock(&ctx_mutex);
	ctx = snd_soc_find_usb_ctx(usbdev);
	if (!ctx)
		goto exit;

	if (ctx->connection_status_cb)
		ctx->connection_status_cb(ctx, sdev, true);

exit:
	mutex_unlock(&ctx_mutex);

	return 0;
}
EXPORT_SYMBOL_GPL(snd_soc_usb_connect);

/**
 * snd_soc_usb_disconnect() - Notification of USB device disconnection
 * @usbdev: USB bus device
 * @sdev: USB SND device to remove
 *
 * Notify of a new USB SND device disconnection to the USB backend.
 *
 */
int snd_soc_usb_disconnect(struct device *usbdev, struct snd_soc_usb_device *sdev)
{
	struct snd_soc_usb *ctx;

	if (!usbdev)
		return -ENODEV;

	mutex_lock(&ctx_mutex);
	ctx = snd_soc_find_usb_ctx(usbdev);
	if (!ctx)
		goto exit;

	if (ctx->connection_status_cb)
		ctx->connection_status_cb(ctx, sdev, false);

exit:
	mutex_unlock(&ctx_mutex);

	return 0;
}
EXPORT_SYMBOL_GPL(snd_soc_usb_disconnect);

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("SoC USB driver for offloading");

Annotation

Implementation Notes