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.

Dependency Surface

Detected Declarations

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

Implementation Notes