drivers/mfd/max77714.c
Source file repositories/reference/linux-study-clean/drivers/mfd/max77714.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/max77714.c- Extension
.c- Size
- 4783 bytes
- Lines
- 153
- 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/i2c.hlinux/interrupt.hlinux/mfd/core.hlinux/mfd/max77714.hlinux/module.hlinux/of.hlinux/regmap.h
Detected Declarations
function OKfunction max77714_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Maxim MAX77714 Core Driver
*
* Copyright (C) 2022 Luca Ceresoli
* Author: Luca Ceresoli <luca.ceresoli@bootlin.com>
*/
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/mfd/core.h>
#include <linux/mfd/max77714.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/regmap.h>
static const struct mfd_cell max77714_cells[] = {
{ .name = "max77714-watchdog" },
{ .name = "max77714-rtc" },
};
static const struct regmap_range max77714_readable_ranges[] = {
regmap_reg_range(MAX77714_INT_TOP, MAX77714_INT_TOP),
regmap_reg_range(MAX77714_INT_TOPM, MAX77714_INT_TOPM),
regmap_reg_range(MAX77714_32K_STATUS, MAX77714_32K_CONFIG),
regmap_reg_range(MAX77714_CNFG_GLBL2, MAX77714_CNFG2_ONOFF),
};
static const struct regmap_range max77714_writable_ranges[] = {
regmap_reg_range(MAX77714_INT_TOPM, MAX77714_INT_TOPM),
regmap_reg_range(MAX77714_32K_CONFIG, MAX77714_32K_CONFIG),
regmap_reg_range(MAX77714_CNFG_GLBL2, MAX77714_CNFG2_ONOFF),
};
static const struct regmap_access_table max77714_readable_table = {
.yes_ranges = max77714_readable_ranges,
.n_yes_ranges = ARRAY_SIZE(max77714_readable_ranges),
};
static const struct regmap_access_table max77714_writable_table = {
.yes_ranges = max77714_writable_ranges,
.n_yes_ranges = ARRAY_SIZE(max77714_writable_ranges),
};
static const struct regmap_config max77714_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = MAX77714_CNFG2_ONOFF,
.rd_table = &max77714_readable_table,
.wr_table = &max77714_writable_table,
};
static const struct regmap_irq max77714_top_irqs[] = {
REGMAP_IRQ_REG(MAX77714_IRQ_TOP_ONOFF, 0, MAX77714_INT_TOP_ONOFF),
REGMAP_IRQ_REG(MAX77714_IRQ_TOP_RTC, 0, MAX77714_INT_TOP_RTC),
REGMAP_IRQ_REG(MAX77714_IRQ_TOP_GPIO, 0, MAX77714_INT_TOP_GPIO),
REGMAP_IRQ_REG(MAX77714_IRQ_TOP_LDO, 0, MAX77714_INT_TOP_LDO),
REGMAP_IRQ_REG(MAX77714_IRQ_TOP_SD, 0, MAX77714_INT_TOP_SD),
REGMAP_IRQ_REG(MAX77714_IRQ_TOP_GLBL, 0, MAX77714_INT_TOP_GLBL),
};
static const struct regmap_irq_chip max77714_irq_chip = {
.name = "max77714-pmic",
.status_base = MAX77714_INT_TOP,
.mask_base = MAX77714_INT_TOPM,
.num_regs = 1,
.irqs = max77714_top_irqs,
.num_irqs = ARRAY_SIZE(max77714_top_irqs),
};
/*
* MAX77714 initially uses the internal, low precision oscillator. Enable
* the external oscillator by setting the XOSC_RETRY bit. If the external
* oscillator is not OK (probably not installed) this has no effect.
*/
static int max77714_setup_xosc(struct device *dev, struct regmap *regmap)
{
/* Internal Crystal Load Capacitance, indexed by value of 32KLOAD bits */
static const unsigned int load_cap[4] = {0, 10, 12, 22}; /* pF */
unsigned int load_cap_idx;
unsigned int status;
int err;
err = regmap_update_bits(regmap, MAX77714_32K_CONFIG,
MAX77714_32K_CONFIG_XOSC_RETRY,
MAX77714_32K_CONFIG_XOSC_RETRY);
if (err)
return dev_err_probe(dev, err, "Failed to configure the external oscillator\n");
err = regmap_read(regmap, MAX77714_32K_STATUS, &status);
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/interrupt.h`, `linux/mfd/core.h`, `linux/mfd/max77714.h`, `linux/module.h`, `linux/of.h`, `linux/regmap.h`.
- Detected declarations: `function OK`, `function max77714_probe`.
- Atlas domain: Driver Families / drivers/mfd.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.