sound/soc/codecs/rt1019.c

Source file repositories/reference/linux-study-clean/sound/soc/codecs/rt1019.c

File Facts

System
Linux kernel
Corpus path
sound/soc/codecs/rt1019.c
Extension
.c
Size
15317 bytes
Lines
610
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
//
// rt1019.c  --  RT1019 ALSA SoC audio amplifier driver
// Author: Jack Yu <jack.yu@realtek.com>
//
// Copyright(c) 2021 Realtek Semiconductor Corp.
//
//

#include <linux/acpi.h>
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/regmap.h>
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/firmware.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/initval.h>
#include <sound/tlv.h>

#include "rl6231.h"
#include "rt1019.h"

static const struct reg_default rt1019_reg[] = {
	{ 0x0000, 0x00 },
	{ 0x0011, 0x04 },
	{ 0x0013, 0x00 },
	{ 0x0019, 0x30 },
	{ 0x001b, 0x01 },
	{ 0x005c, 0x00 },
	{ 0x005e, 0x10 },
	{ 0x005f, 0xec },
	{ 0x0061, 0x10 },
	{ 0x0062, 0x19 },
	{ 0x0066, 0x08 },
	{ 0x0100, 0x80 },
	{ 0x0100, 0x51 },
	{ 0x0102, 0x23 },
	{ 0x0311, 0x00 },
	{ 0x0312, 0x3e },
	{ 0x0313, 0x86 },
	{ 0x0400, 0x03 },
	{ 0x0401, 0x02 },
	{ 0x0402, 0x01 },
	{ 0x0504, 0xff },
	{ 0x0505, 0x24 },
	{ 0x0b00, 0x50 },
	{ 0x0b01, 0xc3 },
};

static bool rt1019_volatile_register(struct device *dev, unsigned int reg)
{
	switch (reg) {
	case RT1019_PWR_STRP_2:
	case RT1019_VER_ID:
	case RT1019_VEND_ID_1:
	case RT1019_VEND_ID_2:
	case RT1019_DEV_ID_1:
	case RT1019_DEV_ID_2:
		return true;

	default:
		return false;
	}
}

static bool rt1019_readable_register(struct device *dev, unsigned int reg)
{
	switch (reg) {
	case RT1019_RESET:
	case RT1019_IDS_CTRL:
	case RT1019_ASEL_CTRL:
	case RT1019_PWR_STRP_2:
	case RT1019_BEEP_TONE:
	case RT1019_VER_ID:
	case RT1019_VEND_ID_1:
	case RT1019_VEND_ID_2:
	case RT1019_DEV_ID_1:
	case RT1019_DEV_ID_2:
	case RT1019_SDB_CTRL:
	case RT1019_CLK_TREE_1:
	case RT1019_CLK_TREE_2:

Annotation

Implementation Notes