drivers/regulator/bd71828-regulator.c

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

File Facts

System
Linux kernel
Corpus path
drivers/regulator/bd71828-regulator.c
Extension
.c
Size
56698 bytes
Lines
1714
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 reg_init {
	unsigned int reg;
	unsigned int mask;
	unsigned int val;
};
struct bd71828_regulator_data {
	struct regulator_desc desc;
	const struct rohm_dvs_config dvs;
	const struct reg_init *reg_inits;
	int reg_init_amnt;
};

static const struct reg_init bd71828_buck1_inits[] = {
	/*
	 * DVS Buck voltages can be changed by register values or via GPIO.
	 * Use register accesses by default.
	 */
	{
		.reg = BD71828_REG_PS_CTRL_1,
		.mask = BD71828_MASK_DVS_BUCK1_CTRL,
		.val = BD71828_DVS_BUCK1_CTRL_I2C,
	},
};

static const struct reg_init bd71828_buck2_inits[] = {
	{
		.reg = BD71828_REG_PS_CTRL_1,
		.mask = BD71828_MASK_DVS_BUCK2_CTRL,
		.val = BD71828_DVS_BUCK2_CTRL_I2C,
	},
};

static const struct reg_init bd71828_buck6_inits[] = {
	{
		.reg = BD71828_REG_PS_CTRL_1,
		.mask = BD71828_MASK_DVS_BUCK6_CTRL,
		.val = BD71828_DVS_BUCK6_CTRL_I2C,
	},
};

static const struct reg_init bd71828_buck7_inits[] = {
	{
		.reg = BD71828_REG_PS_CTRL_1,
		.mask = BD71828_MASK_DVS_BUCK7_CTRL,
		.val = BD71828_DVS_BUCK7_CTRL_I2C,
	},
};

#define BD72720_MASK_DVS_BUCK1_CTRL BIT(4)
#define BD72720_MASK_DVS_LDO1_CTRL BIT(5)

static const struct reg_init bd72720_buck1_inits[] = {
	{
		.reg = BD72720_REG_PS_CTRL_2,
		.mask = BD72720_MASK_DVS_BUCK1_CTRL,
		.val = 0, /* Disable "run-level" control */
	},
};

static const struct reg_init bd72720_ldo1_inits[] = {
	{
		.reg = BD72720_REG_PS_CTRL_2,
		.mask = BD72720_MASK_DVS_LDO1_CTRL,
		.val = 0, /* Disable "run-level" control */
	},
};

/* BD71828 Buck voltages */
static const struct linear_range bd71828_buck1267_volts[] = {
	REGULATOR_LINEAR_RANGE(500000, 0x00, 0xef, 6250),
	REGULATOR_LINEAR_RANGE(2000000, 0xf0, 0xff, 0),
};

static const struct linear_range bd71828_buck3_volts[] = {
	REGULATOR_LINEAR_RANGE(1200000, 0x00, 0x0f, 50000),
	REGULATOR_LINEAR_RANGE(2000000, 0x10, 0x1f, 0),
};

static const struct linear_range bd71828_buck4_volts[] = {
	REGULATOR_LINEAR_RANGE(1000000, 0x00, 0x1f, 25000),
	REGULATOR_LINEAR_RANGE(1800000, 0x20, 0x3f, 0),
};

static const struct linear_range bd71828_buck5_volts[] = {
	REGULATOR_LINEAR_RANGE(2500000, 0x00, 0x0f, 50000),
	REGULATOR_LINEAR_RANGE(3300000, 0x10, 0x1f, 0),
};

/* BD71828 LDO voltages */
static const struct linear_range bd71828_ldo_volts[] = {

Annotation

Implementation Notes