drivers/mfd/wm5102-tables.c

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

File Facts

System
Linux kernel
Corpus path
drivers/mfd/wm5102-tables.c
Extension
.c
Size
85258 bytes
Lines
1946
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
/*
 * wm5102-tables.c  --  WM5102 data tables
 *
 * Copyright 2012 Wolfson Microelectronics plc
 *
 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
 */

#include <linux/device.h>
#include <linux/module.h>

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

#include "arizona.h"

#define WM5102_NUM_AOD_ISR 2
#define WM5102_NUM_ISR 5

static const struct reg_sequence wm5102_reva_patch[] = {
	{ 0x80, 0x0003 },
	{ 0x221, 0x0090 },
	{ 0x211, 0x0014 },
	{ 0x212, 0x0000 },
	{ 0x214, 0x000C },
	{ 0x171, 0x0002 },
	{ 0x171, 0x0000 },
	{ 0x461, 0x8000 },
	{ 0x463, 0x50F0 },
	{ 0x465, 0x4820 },
	{ 0x467, 0x4040 },
	{ 0x469, 0x3940 },
	{ 0x46B, 0x3310 },
	{ 0x46D, 0x2D80 },
	{ 0x46F, 0x2890 },
	{ 0x471, 0x1990 },
	{ 0x473, 0x1450 },
	{ 0x475, 0x1020 },
	{ 0x477, 0x0CD0 },
	{ 0x479, 0x0A30 },
	{ 0x47B, 0x0810 },
	{ 0x47D, 0x0510 },
	{ 0x4D1, 0x017F },
	{ 0x500, 0x000D },
	{ 0x507, 0x1820 },
	{ 0x508, 0x1820 },
	{ 0x540, 0x000D },
	{ 0x547, 0x1820 },
	{ 0x548, 0x1820 },
	{ 0x580, 0x000D },
	{ 0x587, 0x1820 },
	{ 0x588, 0x1820 },
	{ 0x80, 0x0000 },
};

static const struct reg_sequence wm5102_revb_patch[] = {
	{ 0x19, 0x0001 },
	{ 0x80, 0x0003 },
	{ 0x081, 0xE022 },
	{ 0x410, 0x6080 },
	{ 0x418, 0xa080 },
	{ 0x420, 0xa080 },
	{ 0x428, 0xe000 },
	{ 0x442, 0x3F0A },
	{ 0x443, 0xDC1F },
	{ 0x4B0, 0x0066 },
	{ 0x458, 0x000b },
	{ 0x212, 0x0000 },
	{ 0x171, 0x0000 },
	{ 0x35E, 0x000C },
	{ 0x2D4, 0x0000 },
	{ 0x4DC, 0x0900 },
	{ 0x80, 0x0000 },
};

/* We use a function so we can use ARRAY_SIZE() */
int wm5102_patch(struct arizona *arizona)
{
	const struct reg_sequence *wm5102_patch;
	int patch_size;

	switch (arizona->rev) {
	case 0:
		wm5102_patch = wm5102_reva_patch;
		patch_size = ARRAY_SIZE(wm5102_reva_patch);
		break;
	default:
		wm5102_patch = wm5102_revb_patch;
		patch_size = ARRAY_SIZE(wm5102_revb_patch);

Annotation

Implementation Notes