drivers/mfd/wm8998-tables.c

Source file repositories/reference/linux-study-clean/drivers/mfd/wm8998-tables.c

File Facts

System
Linux kernel
Corpus path
drivers/mfd/wm8998-tables.c
Extension
.c
Size
69944 bytes
Lines
1564
Domain
Driver Families
Bucket
drivers/mfd
Inferred role
Driver Families: exported/initcall integration point
Status
integration 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
/*
 * wm8998-tables.c  --  data tables for wm8998-class codecs
 *
 * Copyright 2014 Wolfson Microelectronics plc
 *
 * Author: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
 */

#include <linux/module.h>

#include <linux/mfd/arizona/core.h>
#include <linux/mfd/arizona/registers.h>
#include <linux/device.h>

#include "arizona.h"

#define WM8998_NUM_AOD_ISR 2
#define WM8998_NUM_ISR 5

static const struct reg_sequence wm8998_rev_a_patch[] = {
	{ 0x0212, 0x0000 },
	{ 0x0211, 0x0014 },
	{ 0x04E4, 0x0E0D },
	{ 0x04E5, 0x0E0D },
	{ 0x04E6, 0x0E0D },
	{ 0x04EB, 0x060E },
	{ 0x0441, 0xC759 },
	{ 0x0442, 0x2A08 },
	{ 0x0443, 0x5CFA },
	{ 0x026E, 0x0064 },
	{ 0x026F, 0x00EA },
	{ 0x0270, 0x1F16 },
	{ 0x0410, 0x2080 },
	{ 0x0418, 0x2080 },
	{ 0x0420, 0x2080 },
	{ 0x04B8, 0x1120 },
	{ 0x047E, 0x080E },
	{ 0x0448, 0x03EF },
};

/* We use a function so we can use ARRAY_SIZE() */
int wm8998_patch(struct arizona *arizona)
{
	return regmap_register_patch(arizona->regmap,
				     wm8998_rev_a_patch,
				     ARRAY_SIZE(wm8998_rev_a_patch));
}

static const struct regmap_irq wm8998_aod_irqs[ARIZONA_NUM_IRQ] = {
	[ARIZONA_IRQ_MICD_CLAMP_FALL] = {
		.mask = ARIZONA_MICD_CLAMP_FALL_EINT1
	},
	[ARIZONA_IRQ_MICD_CLAMP_RISE] = {
		.mask = ARIZONA_MICD_CLAMP_RISE_EINT1
	},
	[ARIZONA_IRQ_GP5_FALL] = { .mask = ARIZONA_GP5_FALL_EINT1 },
	[ARIZONA_IRQ_GP5_RISE] = { .mask = ARIZONA_GP5_RISE_EINT1 },
	[ARIZONA_IRQ_JD_FALL] = { .mask = ARIZONA_JD1_FALL_EINT1 },
	[ARIZONA_IRQ_JD_RISE] = { .mask = ARIZONA_JD1_RISE_EINT1 },
};

struct regmap_irq_chip wm8998_aod = {
	.name = "wm8998 AOD",
	.status_base = ARIZONA_AOD_IRQ1,
	.mask_base = ARIZONA_AOD_IRQ_MASK_IRQ1,
	.ack_base = ARIZONA_AOD_IRQ1,
	.wake_base = ARIZONA_WAKE_CONTROL,
	.wake_invert = 1,
	.num_regs = 1,
	.irqs = wm8998_aod_irqs,
	.num_irqs = ARRAY_SIZE(wm8998_aod_irqs),
};

static const struct regmap_irq wm8998_irqs[ARIZONA_NUM_IRQ] = {
	[ARIZONA_IRQ_GP4] = { .reg_offset = 0, .mask = ARIZONA_GP4_EINT1 },
	[ARIZONA_IRQ_GP3] = { .reg_offset = 0, .mask = ARIZONA_GP3_EINT1 },
	[ARIZONA_IRQ_GP2] = { .reg_offset = 0, .mask = ARIZONA_GP2_EINT1 },
	[ARIZONA_IRQ_GP1] = { .reg_offset = 0, .mask = ARIZONA_GP1_EINT1 },

	[ARIZONA_IRQ_SPK_OVERHEAT_WARN] = {
		.reg_offset = 2, .mask = ARIZONA_SPK_OVERHEAT_WARN_EINT1
	},
	[ARIZONA_IRQ_SPK_OVERHEAT] = {
		.reg_offset = 2, .mask = ARIZONA_SPK_OVERHEAT_EINT1
	},
	[ARIZONA_IRQ_HPDET] = {
		.reg_offset = 2, .mask = ARIZONA_HPDET_EINT1
	},
	[ARIZONA_IRQ_MICDET] = {

Annotation

Implementation Notes