sound/soc/sdca/sdca_class.c
Source file repositories/reference/linux-study-clean/sound/soc/sdca/sdca_class.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sdca/sdca_class.c- Extension
.c- Size
- 6595 bytes
- Lines
- 299
- Domain
- Driver Families
- Bucket
- sound/soc
- 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/device.hlinux/err.hlinux/mod_devicetable.hlinux/module.hlinux/pm.hlinux/pm_runtime.hlinux/regmap.hlinux/soundwire/sdw.hlinux/soundwire/sdw_registers.hlinux/soundwire/sdw_type.hsound/sdca.hsound/sdca_function.hsound/sdca_interrupts.hsound/sdca_regmap.hsdca_class.h
Detected Declarations
function class_read_propfunction class_regmap_lockfunction class_regmap_unlockfunction class_dev_regmap_volatilefunction class_dev_regmap_preciousfunction class_remove_functionsfunction class_boot_workfunction class_sdw_probefunction class_sdw_removefunction class_suspendfunction class_resumefunction class_runtime_suspendfunction class_runtime_resume
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2025 Cirrus Logic, Inc. and
// Cirrus Logic International Semiconductor Ltd.
/*
* The MIPI SDCA specification is available for public downloads at
* https://www.mipi.org/mipi-sdca-v1-0-download
*/
#include <linux/device.h>
#include <linux/err.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_registers.h>
#include <linux/soundwire/sdw_type.h>
#include <sound/sdca.h>
#include <sound/sdca_function.h>
#include <sound/sdca_interrupts.h>
#include <sound/sdca_regmap.h>
#include "sdca_class.h"
#define CLASS_SDW_ATTACH_TIMEOUT_MS 5000
static int class_read_prop(struct sdw_slave *sdw)
{
struct sdw_slave_prop *prop = &sdw->prop;
sdw_slave_read_prop(sdw);
prop->use_domain_irq = true;
prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY |
SDW_SCP_INT1_IMPL_DEF;
return 0;
}
static const struct sdw_slave_ops class_sdw_ops = {
.read_prop = class_read_prop,
};
static void class_regmap_lock(void *data)
{
struct mutex *lock = data;
mutex_lock(lock);
}
static void class_regmap_unlock(void *data)
{
struct mutex *lock = data;
mutex_unlock(lock);
}
static bool class_dev_regmap_volatile(struct device *dev, unsigned int reg)
{
switch (reg) {
case SDW_SCP_SDCA_INTMASK1 ... SDW_SCP_SDCA_INTMASK4:
return false;
default:
return true;
}
}
static bool class_dev_regmap_precious(struct device *dev, unsigned int reg)
{
switch (reg) {
case SDW_SCP_SDCA_INT1 ... SDW_SCP_SDCA_INT4:
case SDW_SCP_SDCA_INTMASK1 ... SDW_SCP_SDCA_INTMASK4:
return false;
default:
return true;
}
}
static const struct regmap_config class_dev_regmap_config = {
.name = "sdca-device",
.reg_bits = 32,
.val_bits = 8,
.max_register = SDW_SDCA_MAX_REGISTER,
.volatile_reg = class_dev_regmap_volatile,
.precious_reg = class_dev_regmap_precious,
.cache_type = REGCACHE_MAPLE,
Annotation
- Immediate include surface: `linux/device.h`, `linux/err.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/pm.h`, `linux/pm_runtime.h`, `linux/regmap.h`, `linux/soundwire/sdw.h`.
- Detected declarations: `function class_read_prop`, `function class_regmap_lock`, `function class_regmap_unlock`, `function class_dev_regmap_volatile`, `function class_dev_regmap_precious`, `function class_remove_functions`, `function class_boot_work`, `function class_sdw_probe`, `function class_sdw_remove`, `function class_suspend`.
- Atlas domain: Driver Families / sound/soc.
- 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.