drivers/mfd/mt6370.c
Source file repositories/reference/linux-study-clean/drivers/mfd/mt6370.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/mt6370.c- Extension
.c- Size
- 9990 bytes
- Lines
- 313
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bits.hlinux/bitfield.hlinux/i2c.hlinux/interrupt.hlinux/kernel.hlinux/mfd/core.hlinux/module.hlinux/regmap.hmt6370.h
Detected Declarations
function mt6370_check_vendor_infofunction mt6370_regmap_readfunction mt6370_regmap_writefunction mt6370_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2022 Richtek Technology Corp.
*
* Author: ChiYuan Huang <cy_huang@richtek.com>
*/
#include <linux/bits.h>
#include <linux/bitfield.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/mfd/core.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include "mt6370.h"
#define MT6370_REG_DEV_INFO 0x100
#define MT6370_REG_CHG_IRQ1 0x1C0
#define MT6370_REG_CHG_MASK1 0x1E0
#define MT6370_REG_MAXADDR 0x1FF
#define MT6370_VENID_MASK GENMASK(7, 4)
#define MT6370_NUM_IRQREGS 16
#define MT6370_USBC_I2CADDR 0x4E
#define MT6370_MAX_ADDRLEN 2
#define MT6370_VENID_RT5081 0x8
#define MT6370_VENID_RT5081A 0xA
#define MT6370_VENID_MT6370 0xE
#define MT6370_VENID_MT6371 0xF
#define MT6370_VENID_MT6372P 0x9
#define MT6370_VENID_MT6372CP 0xB
static const struct regmap_irq mt6370_irqs[] = {
REGMAP_IRQ_REG_LINE(MT6370_IRQ_DIRCHGON, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_TREG, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_AICR, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_MIVR, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_PWR_RDY, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_FL_CHG_VINOVP, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_VSYSUV, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_VSYSOV, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_VBATOV, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_VINOVPCHG, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_TS_BAT_COLD, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_TS_BAT_COOL, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_TS_BAT_WARM, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_TS_BAT_HOT, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_TS_STATC, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_FAULT, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_STATC, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_TMR, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_BATABS, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_ADPBAD, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_RVP, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_TSHUTDOWN, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_IINMEAS, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_ICCMEAS, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHGDET_DONE, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_WDTMR, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_SSFINISH, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_RECHG, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_TERM, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_IEOC, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_ADC_DONE, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_PUMPX_DONE, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_BST_BATUV, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_BST_MIDOV, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_BST_OLP, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_ATTACH, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_DETACH, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_HVDCP_STPDONE, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_HVDCP_VBUSDET_DONE, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_HVDCP_DET, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHGDET, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_DCDT, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_DIRCHG_VGOK, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_DIRCHG_WDTMR, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_DIRCHG_UC, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_DIRCHG_OC, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_DIRCHG_OV, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_OVPCTRL_SWON, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_OVPCTRL_UVP_D, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_OVPCTRL_UVP, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_OVPCTRL_OVP_D, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_OVPCTRL_OVP, 8),
REGMAP_IRQ_REG_LINE(MT6370_IRQ_FLED_STRBPIN, 8),
Annotation
- Immediate include surface: `linux/bits.h`, `linux/bitfield.h`, `linux/i2c.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/mfd/core.h`, `linux/module.h`, `linux/regmap.h`.
- Detected declarations: `function mt6370_check_vendor_info`, `function mt6370_regmap_read`, `function mt6370_regmap_write`, `function mt6370_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.