sound/soc/codecs/rt715-sdca-sdw.c

Source file repositories/reference/linux-study-clean/sound/soc/codecs/rt715-sdca-sdw.c

File Facts

System
Linux kernel
Corpus path
sound/soc/codecs/rt715-sdca-sdw.c
Extension
.c
Size
6795 bytes
Lines
273
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-only
//
// rt715-sdca-sdw.c -- rt715 ALSA SoC audio driver
//
// Copyright(c) 2020 Realtek Semiconductor Corp.
//
//

#include <linux/delay.h>
#include <linux/device.h>
#include <linux/mod_devicetable.h>
#include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_type.h>
#include <linux/soundwire/sdw_registers.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <sound/soc.h>
#include "rt715-sdca.h"
#include "rt715-sdca-sdw.h"

static bool rt715_sdca_readable_register(struct device *dev, unsigned int reg)
{
	switch (reg) {
	case 0x201a ... 0x2027:
	case 0x2029 ... 0x202a:
	case 0x202d ... 0x2034:
	case 0x2200 ... 0x2204:
	case 0x2206 ... 0x2212:
	case 0x2230 ... 0x2239:
	case 0x2f5b:
	case SDW_SDCA_CTL(FUN_MIC_ARRAY, RT715_SDCA_SMPU_TRIG_ST_EN,
		RT715_SDCA_SMPU_TRIG_ST_CTRL, CH_00):
		return true;
	default:
		return false;
	}
}

static bool rt715_sdca_volatile_register(struct device *dev, unsigned int reg)
{
	switch (reg) {
	case 0x201b:
	case 0x201c:
	case 0x201d:
	case 0x201f:
	case 0x2021:
	case 0x2023:
	case 0x2230:
	case 0x202d ... 0x202f: /* BRA */
	case 0x2200 ... 0x2212: /* i2c debug */
	case 0x2f07:
	case 0x2f1b ... 0x2f1e:
	case 0x2f30 ... 0x2f34:
	case 0x2f50 ... 0x2f51:
	case 0x2f53 ... 0x2f59:
	case 0x2f5c ... 0x2f5f:
	case SDW_SDCA_CTL(FUN_MIC_ARRAY, RT715_SDCA_SMPU_TRIG_ST_EN,
		RT715_SDCA_SMPU_TRIG_ST_CTRL, CH_00): /* VAD Searching status */
		return true;
	default:
		return false;
	}
}

static bool rt715_sdca_mbq_readable_register(struct device *dev, unsigned int reg)
{
	switch (reg) {
	case 0x2000000:
	case 0x200002b:
	case 0x2000036:
	case 0x2000037:
	case 0x2000039:
	case 0x2000044:
	case 0x6100000:
		return true;
	default:
		return false;
	}
}

static bool rt715_sdca_mbq_volatile_register(struct device *dev, unsigned int reg)
{
	switch (reg) {
	case 0x2000000:
		return true;
	default:
		return false;
	}
}

Annotation

Implementation Notes