drivers/mfd/max77693.c

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

File Facts

System
Linux kernel
Corpus path
drivers/mfd/max77693.c
Extension
.c
Size
10541 bytes
Lines
369
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+
//
// max77693.c - mfd core driver for the MAX 77693
//
// Copyright (C) 2012 Samsung Electronics
// SangYoung Son <hello.son@samsung.com>
//
// This program is not provided / owned by Maxim Integrated Products.
//
// This driver is based on max8997.c

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/of.h>
#include <linux/pm_runtime.h>
#include <linux/mutex.h>
#include <linux/mfd/core.h>
#include <linux/mfd/max77693.h>
#include <linux/mfd/max77693-common.h>
#include <linux/mfd/max77693-private.h>
#include <linux/regulator/machine.h>
#include <linux/regmap.h>

#define I2C_ADDR_PMIC	(0xCC >> 1)	/* Charger, Flash LED */
#define I2C_ADDR_MUIC	(0x4A >> 1)
#define I2C_ADDR_HAPTIC	(0x90 >> 1)

static const struct mfd_cell max77693_devs[] = {
	{ .name = "max77693-pmic", },
	{
		.name = "max77693-charger",
		.of_compatible = "maxim,max77693-charger",
	},
	{
		.name = "max77693-muic",
		.of_compatible = "maxim,max77693-muic",
	},
	{
		.name = "max77693-haptic",
		.of_compatible = "maxim,max77693-haptic",
	},
	{
		.name = "max77693-led",
		.of_compatible = "maxim,max77693-led",
	},
};

static const struct regmap_config max77693_regmap_config = {
	.reg_bits = 8,
	.val_bits = 8,
	.max_register = MAX77693_PMIC_REG_END,
};

static const struct regmap_irq max77693_led_irqs[] = {
	{ .mask = LED_IRQ_FLED2_OPEN,  },
	{ .mask = LED_IRQ_FLED2_SHORT, },
	{ .mask = LED_IRQ_FLED1_OPEN,  },
	{ .mask = LED_IRQ_FLED1_SHORT, },
	{ .mask = LED_IRQ_MAX_FLASH,   },
};

static const struct regmap_irq_chip max77693_led_irq_chip = {
	.name			= "max77693-led",
	.status_base		= MAX77693_LED_REG_FLASH_INT,
	.mask_base		= MAX77693_LED_REG_FLASH_INT_MASK,
	.num_regs		= 1,
	.irqs			= max77693_led_irqs,
	.num_irqs		= ARRAY_SIZE(max77693_led_irqs),
};

static const struct regmap_irq max77693_topsys_irqs[] = {
	{ .mask = TOPSYS_IRQ_T120C_INT,  },
	{ .mask = TOPSYS_IRQ_T140C_INT,  },
	{ .mask = TOPSYS_IRQ_LOWSYS_INT, },
};

static const struct regmap_irq_chip max77693_topsys_irq_chip = {
	.name			= "max77693-topsys",
	.status_base		= MAX77693_PMIC_REG_TOPSYS_INT,
	.mask_base		= MAX77693_PMIC_REG_TOPSYS_INT_MASK,
	.num_regs		= 1,
	.irqs			= max77693_topsys_irqs,
	.num_irqs		= ARRAY_SIZE(max77693_topsys_irqs),
};

static const struct regmap_irq max77693_charger_irqs[] = {
	{ .mask = CHG_IRQ_BYP_I,   },

Annotation

Implementation Notes