drivers/regulator/tps65086-regulator.c

Source file repositories/reference/linux-study-clean/drivers/regulator/tps65086-regulator.c

File Facts

System
Linux kernel
Corpus path
drivers/regulator/tps65086-regulator.c
Extension
.c
Size
15039 bytes
Lines
420
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 tps65086_regulator {
	struct regulator_desc desc;
	unsigned int decay_reg;
	unsigned int decay_mask;
};

struct tps65086_regulator_config {
	struct tps65086_regulator * const config;
	const unsigned int num_elems;
};

static const struct linear_range tps65086_10mv_ranges[] = {
	REGULATOR_LINEAR_RANGE(0, 0x0, 0x0, 0),
	REGULATOR_LINEAR_RANGE(410000, 0x1, 0x7F, 10000),
};

static const struct linear_range tps65086_buck126_25mv_ranges[] = {
	REGULATOR_LINEAR_RANGE(0, 0x0, 0x0, 0),
	REGULATOR_LINEAR_RANGE(1000000, 0x1, 0x18, 0),
	REGULATOR_LINEAR_RANGE(1025000, 0x19, 0x7F, 25000),
};

static const struct linear_range tps65086_buck345_25mv_ranges[] = {
	REGULATOR_LINEAR_RANGE(0, 0x0, 0x0, 0),
	REGULATOR_LINEAR_RANGE(425000, 0x1, 0x7F, 25000),
};

static const struct linear_range tps65086_ldoa1_ranges[] = {
	REGULATOR_LINEAR_RANGE(1350000, 0x0, 0x0, 0),
	REGULATOR_LINEAR_RANGE(1500000, 0x1, 0x7, 100000),
	REGULATOR_LINEAR_RANGE(2300000, 0x8, 0xB, 100000),
	REGULATOR_LINEAR_RANGE(2850000, 0xC, 0xD, 150000),
	REGULATOR_LINEAR_RANGE(3300000, 0xE, 0xE, 0),
};

static const struct linear_range tps65086_ldoa23_ranges[] = {
	REGULATOR_LINEAR_RANGE(700000, 0x0, 0xD, 50000),
	REGULATOR_LINEAR_RANGE(1400000, 0xE, 0xF, 100000),
};

/* Operations permitted on regulators */
static const struct regulator_ops reg_ops = {
	.enable			= regulator_enable_regmap,
	.disable		= regulator_disable_regmap,
	.is_enabled		= regulator_is_enabled_regmap,
	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
	.map_voltage		= regulator_map_voltage_linear_range,
	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
	.list_voltage		= regulator_list_voltage_linear_range,
};

/* Operations permitted on load switches */
static const struct regulator_ops switch_ops = {
	.enable			= regulator_enable_regmap,
	.disable		= regulator_disable_regmap,
	.is_enabled		= regulator_is_enabled_regmap,
};

static int tps65086_of_parse_cb(struct device_node *dev,
				const struct regulator_desc *desc,
				struct regulator_config *config);

static struct tps65086_regulator tps6508640_regulator_config[] = {
	TPS65086_REGULATOR("BUCK1", "buck1", BUCK1, 0x80, TPS65086_BUCK1CTRL,
			   BUCK_VID_MASK, TPS65086_BUCK123CTRL, BIT(0),
			   tps65086_10mv_ranges, TPS65086_BUCK1CTRL,
			   BIT(0)),
	TPS65086_REGULATOR("BUCK2", "buck2", BUCK2, 0x80, TPS65086_BUCK2CTRL,
			   BUCK_VID_MASK, TPS65086_BUCK123CTRL, BIT(1),
			   tps65086_10mv_ranges, TPS65086_BUCK2CTRL,
			   BIT(0)),
	TPS65086_REGULATOR("BUCK3", "buck3", BUCK3, 0x80, TPS65086_BUCK3VID,
			   BUCK_VID_MASK, TPS65086_BUCK123CTRL, BIT(2),
			   tps65086_10mv_ranges, TPS65086_BUCK3DECAY,
			   BIT(0)),
	TPS65086_REGULATOR("BUCK4", "buck4", BUCK4, 0x80, TPS65086_BUCK4VID,
			   BUCK_VID_MASK, TPS65086_BUCK4CTRL, BIT(0),
			   tps65086_10mv_ranges, TPS65086_BUCK4VID,
			   BIT(0)),
	TPS65086_REGULATOR("BUCK5", "buck5", BUCK5, 0x80, TPS65086_BUCK5VID,
			   BUCK_VID_MASK, TPS65086_BUCK5CTRL, BIT(0),
			   tps65086_10mv_ranges, TPS65086_BUCK5CTRL,
			   BIT(0)),
	TPS65086_REGULATOR("BUCK6", "buck6", BUCK6, 0x80, TPS65086_BUCK6VID,
			   BUCK_VID_MASK, TPS65086_BUCK6CTRL, BIT(0),
			   tps65086_10mv_ranges, TPS65086_BUCK6CTRL,
			   BIT(0)),
	TPS65086_REGULATOR("LDOA1", "ldoa1", LDOA1, 0xF, TPS65086_LDOA1CTRL,
			   VDOA1_VID_MASK, TPS65086_SWVTT_EN, BIT(7),
			   tps65086_ldoa1_ranges, 0, 0),

Annotation

Implementation Notes