drivers/soundwire/intel_ace2x_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/soundwire/intel_ace2x_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soundwire/intel_ace2x_debugfs.c- Extension
.c- Size
- 3990 bytes
- Lines
- 154
- 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.
- 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/acpi.hlinux/debugfs.hlinux/delay.hlinux/device.hlinux/io.hlinux/pm_runtime.hlinux/soundwire/sdw.hlinux/soundwire/sdw_intel.hlinux/soundwire/sdw_registers.hbus.hcadence_master.hintel.h
Detected Declarations
function intel_sprintffunction intel_reg_showfunction intel_set_m_datamodefunction intel_set_s_datamodefunction intel_ace2x_debugfs_initfunction intel_ace2x_debugfs_exit
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
// Copyright(c) 2023 Intel Corporation
#include <linux/acpi.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/io.h>
#include <linux/pm_runtime.h>
#include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_intel.h>
#include <linux/soundwire/sdw_registers.h>
#include "bus.h"
#include "cadence_master.h"
#include "intel.h"
/*
* debugfs
*/
#ifdef CONFIG_DEBUG_FS
#define RD_BUF (2 * PAGE_SIZE)
static ssize_t intel_sprintf(void __iomem *mem, bool l,
char *buf, size_t pos, unsigned int reg)
{
int value;
if (l)
value = intel_readl(mem, reg);
else
value = intel_readw(mem, reg);
return scnprintf(buf + pos, RD_BUF - pos, "%4x\t%4x\n", reg, value);
}
static int intel_reg_show(struct seq_file *s_file, void *data)
{
struct sdw_intel *sdw = s_file->private;
void __iomem *s = sdw->link_res->shim;
void __iomem *vs_s = sdw->link_res->shim_vs;
ssize_t ret;
u32 pcm_cap;
int pcm_bd;
char *buf;
int j;
buf = kzalloc(RD_BUF, GFP_KERNEL);
if (!buf)
return -ENOMEM;
ret = scnprintf(buf, RD_BUF, "Register Value\n");
ret += scnprintf(buf + ret, RD_BUF - ret, "\nShim\n");
ret += intel_sprintf(s, true, buf, ret, SDW_SHIM2_LECAP);
ret += intel_sprintf(s, false, buf, ret, SDW_SHIM2_PCMSCAP);
pcm_cap = intel_readw(s, SDW_SHIM2_PCMSCAP);
pcm_bd = FIELD_GET(SDW_SHIM2_PCMSCAP_BSS, pcm_cap);
for (j = 0; j < pcm_bd; j++) {
ret += intel_sprintf(s, false, buf, ret,
SDW_SHIM2_PCMSYCHM(j));
ret += intel_sprintf(s, false, buf, ret,
SDW_SHIM2_PCMSYCHC(j));
}
ret += scnprintf(buf + ret, RD_BUF - ret, "\nVS CLK controls\n");
ret += intel_sprintf(vs_s, true, buf, ret, SDW_SHIM2_INTEL_VS_LVSCTL);
ret += scnprintf(buf + ret, RD_BUF - ret, "\nVS Wake registers\n");
ret += intel_sprintf(vs_s, false, buf, ret, SDW_SHIM2_INTEL_VS_WAKEEN);
ret += intel_sprintf(vs_s, false, buf, ret, SDW_SHIM2_INTEL_VS_WAKESTS);
ret += scnprintf(buf + ret, RD_BUF - ret, "\nVS IOCTL, ACTMCTL\n");
ret += intel_sprintf(vs_s, false, buf, ret, SDW_SHIM2_INTEL_VS_IOCTL);
ret += intel_sprintf(vs_s, false, buf, ret, SDW_SHIM2_INTEL_VS_ACTMCTL);
if (sdw->link_res->mic_privacy) {
ret += scnprintf(buf + ret, RD_BUF - ret, "\nVS PVCCS\n");
ret += intel_sprintf(vs_s, false, buf, ret,
SDW_SHIM2_INTEL_VS_PVCCS);
}
seq_printf(s_file, "%s", buf);
kfree(buf);
return 0;
}
DEFINE_SHOW_ATTRIBUTE(intel_reg);
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/device.h`, `linux/io.h`, `linux/pm_runtime.h`, `linux/soundwire/sdw.h`, `linux/soundwire/sdw_intel.h`.
- Detected declarations: `function intel_sprintf`, `function intel_reg_show`, `function intel_set_m_datamode`, `function intel_set_s_datamode`, `function intel_ace2x_debugfs_init`, `function intel_ace2x_debugfs_exit`.
- Atlas domain: Driver Families / drivers/soundwire.
- Implementation status: source implementation candidate.
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.