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.

Dependency Surface

Detected Declarations

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

Implementation Notes