drivers/regulator/mt6360-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/mt6360-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/mt6360-regulator.c- Extension
.c- Size
- 14843 bytes
- Lines
- 467
- Domain
- Driver Families
- Bucket
- drivers/regulator
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/init.hlinux/kernel.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/regmap.hlinux/regulator/driver.hlinux/regulator/machine.hdt-bindings/regulator/mediatek,mt6360-regulator.h
Detected Declarations
struct mt6360_irq_mappingstruct mt6360_regulator_descstruct mt6360_regulator_datafunction mt6360_pgb_event_handlerfunction mt6360_oc_event_handlerfunction mt6360_ov_event_handlerfunction mt6360_uv_event_handlerfunction mt6360_regulator_set_modefunction mt6360_regulator_get_modefunction mt6360_regulator_get_statusfunction mt6360_regulator_of_map_modefunction mt6360_regulator_irq_registerfunction mt6360_regulator_probe
Annotated Snippet
struct mt6360_irq_mapping {
const char *name;
irq_handler_t handler;
};
struct mt6360_regulator_desc {
const struct regulator_desc desc;
unsigned int mode_reg;
unsigned int mode_mask;
unsigned int state_reg;
unsigned int state_mask;
const struct mt6360_irq_mapping *irq_tables;
int irq_table_size;
};
struct mt6360_regulator_data {
struct device *dev;
struct regmap *regmap;
};
static irqreturn_t mt6360_pgb_event_handler(int irq, void *data)
{
struct regulator_dev *rdev = data;
regulator_notifier_call_chain(rdev, REGULATOR_EVENT_FAIL, NULL);
return IRQ_HANDLED;
}
static irqreturn_t mt6360_oc_event_handler(int irq, void *data)
{
struct regulator_dev *rdev = data;
regulator_notifier_call_chain(rdev, REGULATOR_EVENT_OVER_CURRENT, NULL);
return IRQ_HANDLED;
}
static irqreturn_t mt6360_ov_event_handler(int irq, void *data)
{
struct regulator_dev *rdev = data;
regulator_notifier_call_chain(rdev, REGULATOR_EVENT_REGULATION_OUT, NULL);
return IRQ_HANDLED;
}
static irqreturn_t mt6360_uv_event_handler(int irq, void *data)
{
struct regulator_dev *rdev = data;
regulator_notifier_call_chain(rdev, REGULATOR_EVENT_UNDER_VOLTAGE, NULL);
return IRQ_HANDLED;
}
static const struct mt6360_irq_mapping buck1_irq_tbls[] = {
{ "buck1_pgb_evt", mt6360_pgb_event_handler },
{ "buck1_oc_evt", mt6360_oc_event_handler },
{ "buck1_ov_evt", mt6360_ov_event_handler },
{ "buck1_uv_evt", mt6360_uv_event_handler },
};
static const struct mt6360_irq_mapping buck2_irq_tbls[] = {
{ "buck2_pgb_evt", mt6360_pgb_event_handler },
{ "buck2_oc_evt", mt6360_oc_event_handler },
{ "buck2_ov_evt", mt6360_ov_event_handler },
{ "buck2_uv_evt", mt6360_uv_event_handler },
};
static const struct mt6360_irq_mapping ldo6_irq_tbls[] = {
{ "ldo6_pgb_evt", mt6360_pgb_event_handler },
{ "ldo6_oc_evt", mt6360_oc_event_handler },
};
static const struct mt6360_irq_mapping ldo7_irq_tbls[] = {
{ "ldo7_pgb_evt", mt6360_pgb_event_handler },
{ "ldo7_oc_evt", mt6360_oc_event_handler },
};
static const struct mt6360_irq_mapping ldo1_irq_tbls[] = {
{ "ldo1_pgb_evt", mt6360_pgb_event_handler },
{ "ldo1_oc_evt", mt6360_oc_event_handler },
};
static const struct mt6360_irq_mapping ldo2_irq_tbls[] = {
{ "ldo2_pgb_evt", mt6360_pgb_event_handler },
{ "ldo2_oc_evt", mt6360_oc_event_handler },
};
static const struct mt6360_irq_mapping ldo3_irq_tbls[] = {
{ "ldo3_pgb_evt", mt6360_pgb_event_handler },
{ "ldo3_oc_evt", mt6360_oc_event_handler },
};
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/regulator/driver.h`, `linux/regulator/machine.h`.
- Detected declarations: `struct mt6360_irq_mapping`, `struct mt6360_regulator_desc`, `struct mt6360_regulator_data`, `function mt6360_pgb_event_handler`, `function mt6360_oc_event_handler`, `function mt6360_ov_event_handler`, `function mt6360_uv_event_handler`, `function mt6360_regulator_set_mode`, `function mt6360_regulator_get_mode`, `function mt6360_regulator_get_status`.
- Atlas domain: Driver Families / drivers/regulator.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.