drivers/regulator/pv88080-regulator.c

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

File Facts

System
Linux kernel
Corpus path
drivers/regulator/pv88080-regulator.c
Extension
.c
Size
15844 bytes
Lines
548
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 pv88080_regulator {
	struct regulator_desc desc;
	unsigned int mode_reg;
	unsigned int conf2;
	unsigned int conf5;
};

struct pv88080 {
	struct device *dev;
	struct regmap *regmap;
	struct regulator_dev *rdev[PV88080_MAX_REGULATORS];
	unsigned long type;
	const struct pv88080_compatible_regmap *regmap_config;
};

struct pv88080_buck_voltage {
	int min_uV;
	int max_uV;
	int uV_step;
};

struct pv88080_buck_regmap {
	/* REGS */
	int buck_enable_reg;
	int buck_vsel_reg;
	int buck_mode_reg;
	int buck_limit_reg;
	int buck_vdac_range_reg;
	int buck_vrange_gain_reg;
	/* MASKS */
	int buck_enable_mask;
	int buck_vsel_mask;
	int buck_limit_mask;
};

struct pv88080_compatible_regmap {
	/* BUCK1, 2, 3 */
	struct pv88080_buck_regmap buck_regmap[PV88080_MAX_REGULATORS-1];
	/* HVBUCK */
	int hvbuck_enable_reg;
	int hvbuck_vsel_reg;
	int hvbuck_enable_mask;
	int hvbuck_vsel_mask;
};

static const struct regmap_config pv88080_regmap_config = {
	.reg_bits = 8,
	.val_bits = 8,
};

/* Current limits array (in uA) for BUCK1, BUCK2, BUCK3.
 * Entry indexes corresponds to register values.
 */

static const unsigned int pv88080_buck1_limits[] = {
	3230000, 5130000, 6960000, 8790000
};

static const unsigned int pv88080_buck23_limits[] = {
	1496000, 2393000, 3291000, 4189000
};

static const struct pv88080_buck_voltage pv88080_buck_vol[2] = {
	{
		.min_uV = 600000,
		.max_uV = 1393750,
		.uV_step = 6250,
	},
	{
		.min_uV = 1400000,
		.max_uV = 2193750,
		.uV_step = 6250,
	},
};

static const struct pv88080_compatible_regmap pv88080_aa_regs = {
	/* BUCK1 */
	.buck_regmap[0] = {
		.buck_enable_reg      = PV88080AA_REG_BUCK1_CONF0,
		.buck_vsel_reg        = PV88080AA_REG_BUCK1_CONF0,
		.buck_mode_reg        = PV88080AA_REG_BUCK1_CONF1,
		.buck_limit_reg       = PV88080AA_REG_BUCK1_CONF1,
		.buck_vdac_range_reg  = PV88080AA_REG_BUCK1_CONF2,
		.buck_vrange_gain_reg = PV88080AA_REG_BUCK1_CONF5,
		.buck_enable_mask     = PV88080_BUCK1_EN,
		.buck_vsel_mask       = PV88080_VBUCK1_MASK,
		.buck_limit_mask      = PV88080_BUCK1_ILIM_MASK,
	},
	/* BUCK2 */
	.buck_regmap[1] = {

Annotation

Implementation Notes