drivers/mfd/max77541.c

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

File Facts

System
Linux kernel
Corpus path
drivers/mfd/max77541.c
Extension
.c
Size
5743 bytes
Lines
221
Domain
Driver Families
Bucket
drivers/mfd
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-or-later
/*
 * Copyright (c) 2022 Analog Devices, Inc.
 * Driver for the MAX77540 and MAX77541
 */

#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/mfd/core.h>
#include <linux/mfd/max77541.h>
#include <linux/property.h>
#include <linux/regmap.h>

static const struct regmap_config max77541_regmap_config = {
	.reg_bits   = 8,
	.val_bits   = 8,
};

static const struct regmap_irq max77541_src_irqs[] = {
	{ .mask = MAX77541_BIT_INT_SRC_TOPSYS },
	{ .mask = MAX77541_BIT_INT_SRC_BUCK },
};

static const struct regmap_irq_chip max77541_src_irq_chip = {
	.name		= "max77541-src",
	.status_base	= MAX77541_REG_INT_SRC,
	.mask_base	= MAX77541_REG_INT_SRC_M,
	.num_regs	= 1,
	.irqs		= max77541_src_irqs,
	.num_irqs       = ARRAY_SIZE(max77541_src_irqs),
};

static const struct regmap_irq max77541_topsys_irqs[] = {
	{ .mask = MAX77541_BIT_TOPSYS_INT_TJ_120C },
	{ .mask = MAX77541_BIT_TOPSYS_INT_TJ_140C },
	{ .mask = MAX77541_BIT_TOPSYS_INT_TSHDN },
	{ .mask = MAX77541_BIT_TOPSYS_INT_UVLO },
	{ .mask = MAX77541_BIT_TOPSYS_INT_ALT_SWO },
	{ .mask = MAX77541_BIT_TOPSYS_INT_EXT_FREQ_DET },
};

static const struct regmap_irq_chip max77541_topsys_irq_chip = {
	.name		= "max77541-topsys",
	.status_base	= MAX77541_REG_TOPSYS_INT,
	.mask_base	= MAX77541_REG_TOPSYS_INT_M,
	.num_regs	= 1,
	.irqs		= max77541_topsys_irqs,
	.num_irqs	= ARRAY_SIZE(max77541_topsys_irqs),
};

static const struct regmap_irq max77541_buck_irqs[] = {
	{ .mask = MAX77541_BIT_BUCK_INT_M1_POK_FLT },
	{ .mask = MAX77541_BIT_BUCK_INT_M2_POK_FLT },
	{ .mask = MAX77541_BIT_BUCK_INT_M1_SCFLT },
	{ .mask = MAX77541_BIT_BUCK_INT_M2_SCFLT },
};

static const struct regmap_irq_chip max77541_buck_irq_chip = {
	.name		= "max77541-buck",
	.status_base	= MAX77541_REG_BUCK_INT,
	.mask_base	= MAX77541_REG_BUCK_INT_M,
	.num_regs	= 1,
	.irqs		= max77541_buck_irqs,
	.num_irqs	= ARRAY_SIZE(max77541_buck_irqs),
};

static const struct regmap_irq max77541_adc_irqs[] = {
	{ .mask = MAX77541_BIT_ADC_INT_CH1_I },
	{ .mask = MAX77541_BIT_ADC_INT_CH2_I },
	{ .mask = MAX77541_BIT_ADC_INT_CH3_I },
	{ .mask = MAX77541_BIT_ADC_INT_CH6_I },
};

static const struct regmap_irq_chip max77541_adc_irq_chip = {
	.name		= "max77541-adc",
	.status_base	= MAX77541_REG_ADC_INT,
	.mask_base	= MAX77541_REG_ADC_INT_M,
	.num_regs	= 1,
	.irqs		= max77541_adc_irqs,
	.num_irqs	= ARRAY_SIZE(max77541_adc_irqs),
};

static const struct mfd_cell max77540_devs[] = {
	MFD_CELL_OF("max77540-regulator", NULL, NULL, 0, 0, NULL),
};

static const struct mfd_cell max77541_devs[] = {
	MFD_CELL_OF("max77541-regulator", NULL, NULL, 0, 0, NULL),
	MFD_CELL_OF("max77541-adc", NULL, NULL, 0, 0, NULL),
};

Annotation

Implementation Notes