sound/usb/qcom/qc_audio_offload.c
Source file repositories/reference/linux-study-clean/sound/usb/qcom/qc_audio_offload.c
File Facts
- System
- Linux kernel
- Corpus path
sound/usb/qcom/qc_audio_offload.c- Extension
.c- Size
- 53145 bytes
- Lines
- 2023
- Domain
- Driver Families
- Bucket
- sound/usb
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/auxiliary_bus.hlinux/ctype.hlinux/dma-mapping.hlinux/dma-map-ops.hlinux/init.hlinux/iommu.hlinux/module.hlinux/moduleparam.hlinux/soc/qcom/qmi.hlinux/usb.hlinux/usb/audio.hlinux/usb/audio-v2.hlinux/usb/audio-v3.hlinux/usb/hcd.hlinux/usb/quirks.hlinux/usb/xhci-sideband.hsound/control.hsound/core.hsound/info.hsound/initval.hsound/pcm.hsound/pcm_params.hsound/q6usboffload.hsound/soc.hsound/soc-usb.h../usbaudio.h../card.h../endpoint.h../format.h../helper.h../pcm.h../power.h
Detected Declarations
struct iova_infostruct intf_infostruct uaudio_qmi_devstruct uaudio_devstruct uaudio_qmi_svcenum mem_typeenum usb_qmi_audio_formatfunction usb_qmi_get_pcm_numfunction list_for_each_entryfunction get_speed_infofunction list_for_each_entryfunction info_idx_from_ifnumfunction get_data_interval_from_sifunction map_pcm_formatfunction uaudio_send_disconnect_indfunction uaudio_get_iovafunction list_for_each_entryfunction uaudio_put_iovafunction list_for_each_entryfunction uaudio_iommu_unmapfunction uaudio_iommu_map_protfunction uaudio_iommu_map_pafunction uaudio_iommu_map_xfer_buffunction usb_get_controller_idfunction uaudio_dev_intf_cleanupfunction uaudio_event_ring_cleanup_freefunction uaudio_dev_cleanupfunction disable_audio_streamfunction qmi_stop_sessionfunction uaudio_sideband_notifierfunction qmi_bye_cbfunction qmi_svc_disconnect_cbfunction uaudio_dev_releasefunction enable_audio_streamfunction uaudio_transfer_buffer_setupfunction uaudio_endpoint_setupfunction uaudio_event_ring_setupfunction uaudio_populate_uac_descfunction prepare_qmi_responsefunction handle_uaudio_stream_reqfunction scoped_guardfunction qc_usb_audio_offload_init_qmi_devfunction qc_usb_audio_offload_fill_avail_pcmsfunction list_for_each_entryfunction qc_usb_audio_offload_probefunction qc_usb_audio_cleanup_qmi_devfunction qc_usb_audio_offload_disconnectfunction qc_usb_audio_offload_suspend
Annotated Snippet
struct iova_info {
struct list_head list;
unsigned long start_iova;
size_t size;
bool in_use;
};
struct intf_info {
/* IOMMU ring/buffer mapping information */
unsigned long data_xfer_ring_va;
size_t data_xfer_ring_size;
unsigned long sync_xfer_ring_va;
size_t sync_xfer_ring_size;
dma_addr_t xfer_buf_iova;
size_t xfer_buf_size;
dma_addr_t xfer_buf_dma;
u8 *xfer_buf_cpu;
/* USB endpoint information */
unsigned int data_ep_pipe;
unsigned int sync_ep_pipe;
unsigned int data_ep_idx;
unsigned int sync_ep_idx;
u8 intf_num;
u8 pcm_card_num;
u8 pcm_dev_num;
u8 direction;
bool in_use;
};
struct uaudio_qmi_dev {
struct device *dev;
struct q6usb_offload *data;
struct auxiliary_device *auxdev;
/* list to keep track of available iova */
struct list_head xfer_ring_list;
size_t xfer_ring_iova_size;
unsigned long curr_xfer_ring_iova;
struct list_head xfer_buf_list;
size_t xfer_buf_iova_size;
unsigned long curr_xfer_buf_iova;
/* bit fields representing pcm card enabled */
unsigned long card_slot;
/* indicate event ring mapped or not */
bool er_mapped;
};
struct uaudio_dev {
struct usb_device *udev;
/* audio control interface */
struct usb_host_interface *ctrl_intf;
unsigned int usb_core_id;
atomic_t in_use;
struct kref kref;
wait_queue_head_t disconnect_wq;
/* interface specific */
int num_intf;
struct intf_info *info;
struct snd_usb_audio *chip;
/* xhci sideband */
struct xhci_sideband *sb;
/* SoC USB device */
struct snd_soc_usb_device *sdev;
};
static struct uaudio_dev uadev[SNDRV_CARDS];
static struct uaudio_qmi_dev *uaudio_qdev;
static struct uaudio_qmi_svc *uaudio_svc;
static DEFINE_MUTEX(qdev_mutex);
struct uaudio_qmi_svc {
struct qmi_handle *uaudio_svc_hdl;
struct sockaddr_qrtr client_sq;
bool client_connected;
};
enum mem_type {
MEM_EVENT_RING,
MEM_XFER_RING,
MEM_XFER_BUF,
};
/* Supported audio formats */
enum usb_qmi_audio_format {
Annotation
- Immediate include surface: `linux/auxiliary_bus.h`, `linux/ctype.h`, `linux/dma-mapping.h`, `linux/dma-map-ops.h`, `linux/init.h`, `linux/iommu.h`, `linux/module.h`, `linux/moduleparam.h`.
- Detected declarations: `struct iova_info`, `struct intf_info`, `struct uaudio_qmi_dev`, `struct uaudio_dev`, `struct uaudio_qmi_svc`, `enum mem_type`, `enum usb_qmi_audio_format`, `function usb_qmi_get_pcm_num`, `function list_for_each_entry`, `function get_speed_info`.
- Atlas domain: Driver Families / sound/usb.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.