drivers/soundwire/qcom.c
Source file repositories/reference/linux-study-clean/drivers/soundwire/qcom.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soundwire/qcom.c- Extension
.c- Size
- 53210 bytes
- Lines
- 1839
- Domain
- Driver Families
- Bucket
- drivers/soundwire
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/clk.hlinux/completion.hlinux/interrupt.hlinux/io.hlinux/kernel.hlinux/module.hlinux/debugfs.hlinux/of.hlinux/of_irq.hlinux/pm_runtime.hlinux/regmap.hlinux/reset.hlinux/slab.hlinux/pm_wakeirq.hlinux/slimbus.hlinux/soundwire/sdw.hlinux/soundwire/sdw_registers.hsound/pcm_params.hsound/soc.hbus.h
Detected Declarations
struct qcom_swrm_port_configstruct qcom_swrm_ctrlstruct qcom_swrm_datafunction qcom_swrm_ahb_reg_readfunction qcom_swrm_ahb_reg_writefunction qcom_swrm_cpu_reg_readfunction qcom_swrm_cpu_reg_writefunction swrm_get_packed_reg_valfunction swrm_wait_for_rd_fifo_availfunction swrm_wait_for_wr_fifo_availfunction swrm_wait_for_wr_fifo_donefunction qcom_swrm_cmd_fifo_wr_cmdfunction qcom_swrm_cmd_fifo_rd_cmdfunction qcom_swrm_get_alert_slave_dev_numfunction qcom_swrm_get_device_statusfunction qcom_swrm_set_slave_dev_numfunction qcom_swrm_enumeratefunction list_for_each_entry_safefunction qcom_swrm_wake_irq_handlerfunction qcom_swrm_irq_handlerfunction swrm_wait_for_frame_gen_enabledfunction qcom_swrm_initfunction qcom_swrm_read_propfunction qcom_swrm_xfer_msgfunction qcom_swrm_pre_bank_switchfunction qcom_swrm_port_paramsfunction qcom_swrm_transport_paramsfunction qcom_swrm_port_enablefunction qcom_swrm_compute_paramsfunction list_for_each_entryfunction list_for_each_entryfunction list_for_each_entryfunction qcom_swrm_stream_free_portsfunction list_for_each_entryfunction qcom_swrm_stream_alloc_portsfunction list_for_each_entryfunction list_for_each_entryfunction list_for_each_entryfunction qcom_swrm_hw_paramsfunction qcom_swrm_hw_freefunction qcom_swrm_set_sdw_streamfunction qcom_swrm_startupfunction qcom_swrm_shutdownfunction qcom_swrm_register_daisfunction qcom_swrm_get_port_configfunction swrm_reg_showfunction qcom_swrm_probefunction qcom_swrm_remove
Annotated Snippet
struct qcom_swrm_port_config {
u16 si;
u8 off1;
u8 off2;
u8 bp_mode;
u8 hstart;
u8 hstop;
u8 word_length;
u8 blk_group_count;
u8 lane_control;
};
/*
* Internal IDs for different register layouts. Only few registers differ per
* each variant, so the list of IDs below does not include all of registers.
*/
enum {
SWRM_REG_FRAME_GEN_ENABLED,
SWRM_REG_INTERRUPT_STATUS,
SWRM_REG_INTERRUPT_MASK_ADDR,
SWRM_REG_INTERRUPT_CLEAR,
SWRM_REG_INTERRUPT_CPU_EN,
SWRM_REG_CMD_FIFO_WR_CMD,
SWRM_REG_CMD_FIFO_RD_CMD,
SWRM_REG_CMD_FIFO_STATUS,
SWRM_REG_CMD_FIFO_RD_FIFO_ADDR,
SWRM_OFFSET_DP_PORT_CTRL_BANK,
SWRM_OFFSET_DP_PORT_CTRL_2_BANK,
SWRM_OFFSET_DP_BLOCK_CTRL_1,
SWRM_OFFSET_DP_BLOCK_CTRL2_BANK,
SWRM_OFFSET_DP_PORT_HCTRL_BANK,
SWRM_OFFSET_DP_BLOCK_CTRL3_BANK,
SWRM_OFFSET_DP_SAMPLECTRL2_BANK,
};
struct qcom_swrm_ctrl {
struct sdw_bus bus;
struct device *dev;
struct regmap *regmap;
u32 max_reg;
const unsigned int *reg_layout;
void __iomem *mmio;
struct reset_control *audio_cgcr;
#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs;
#endif
struct completion broadcast;
struct completion enumeration;
/* Port alloc/free lock */
struct mutex port_lock;
struct clk *hclk;
int irq;
unsigned int version;
int wake_irq;
int num_din_ports;
int num_dout_ports;
int nports;
int cols_index;
int rows_index;
unsigned long port_mask;
u32 intr_mask;
u8 rcmd_id;
u8 wcmd_id;
/* Port numbers are 1 - 14 */
struct qcom_swrm_port_config *pconfig;
struct sdw_stream_runtime *sruntime[SWRM_MAX_DAIS];
enum sdw_slave_status status[SDW_MAX_DEVICES + 1];
int (*reg_read)(struct qcom_swrm_ctrl *ctrl, int reg, u32 *val);
int (*reg_write)(struct qcom_swrm_ctrl *ctrl, int reg, int val);
u32 slave_status;
u32 wr_fifo_depth;
bool clock_stop_not_supported;
};
struct qcom_swrm_data {
u32 default_cols;
u32 default_rows;
bool sw_clk_gate_required;
u32 max_reg;
const unsigned int *reg_layout;
};
static const unsigned int swrm_v1_3_reg_layout[] = {
[SWRM_REG_FRAME_GEN_ENABLED] = SWRM_COMP_STATUS,
[SWRM_REG_INTERRUPT_STATUS] = SWRM_V1_3_INTERRUPT_STATUS,
[SWRM_REG_INTERRUPT_MASK_ADDR] = SWRM_V1_3_INTERRUPT_MASK_ADDR,
[SWRM_REG_INTERRUPT_CLEAR] = SWRM_V1_3_INTERRUPT_CLEAR,
[SWRM_REG_INTERRUPT_CPU_EN] = SWRM_V1_3_INTERRUPT_CPU_EN,
[SWRM_REG_CMD_FIFO_WR_CMD] = SWRM_V1_3_CMD_FIFO_WR_CMD,
[SWRM_REG_CMD_FIFO_RD_CMD] = SWRM_V1_3_CMD_FIFO_RD_CMD,
Annotation
- Immediate include surface: `linux/clk.h`, `linux/completion.h`, `linux/interrupt.h`, `linux/io.h`, `linux/kernel.h`, `linux/module.h`, `linux/debugfs.h`, `linux/of.h`.
- Detected declarations: `struct qcom_swrm_port_config`, `struct qcom_swrm_ctrl`, `struct qcom_swrm_data`, `function qcom_swrm_ahb_reg_read`, `function qcom_swrm_ahb_reg_write`, `function qcom_swrm_cpu_reg_read`, `function qcom_swrm_cpu_reg_write`, `function swrm_get_packed_reg_val`, `function swrm_wait_for_rd_fifo_avail`, `function swrm_wait_for_wr_fifo_avail`.
- Atlas domain: Driver Families / drivers/soundwire.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.