drivers/regulator/bcm590xx-regulator.c

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

File Facts

System
Linux kernel
Corpus path
drivers/regulator/bcm590xx-regulator.c
Extension
.c
Size
27648 bytes
Lines
1178
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 bcm590xx_reg_data {
	enum bcm590xx_reg_type type;
	enum bcm590xx_regmap_type regmap;
	const struct regulator_desc desc;
};

struct bcm590xx_reg {
	struct bcm590xx *mfd;
	unsigned int n_regulators;
	const struct bcm590xx_reg_data *regs;
};

static const struct regulator_ops bcm590xx_ops_ldo = {
	.is_enabled		= regulator_is_enabled_regmap,
	.enable			= regulator_enable_regmap,
	.disable		= regulator_disable_regmap,
	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
	.list_voltage		= regulator_list_voltage_table,
	.map_voltage		= regulator_map_voltage_iterate,
};

/*
 * LDO ops without voltage selection, used for MICLDO on BCM59054.
 * (These are currently the same as VBUS ops, but will be different
 * in the future once full PMMODE support is implemented.)
 */
static const struct regulator_ops bcm590xx_ops_ldo_novolt = {
	.is_enabled		= regulator_is_enabled_regmap,
	.enable			= regulator_enable_regmap,
	.disable		= regulator_disable_regmap,
};

static const struct regulator_ops bcm590xx_ops_dcdc = {
	.is_enabled		= regulator_is_enabled_regmap,
	.enable			= regulator_enable_regmap,
	.disable		= regulator_disable_regmap,
	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
	.list_voltage		= regulator_list_voltage_linear_range,
	.map_voltage		= regulator_map_voltage_linear_range,
};

static const struct regulator_ops bcm590xx_ops_vbus = {
	.is_enabled		= regulator_is_enabled_regmap,
	.enable			= regulator_enable_regmap,
	.disable		= regulator_disable_regmap,
};

#define BCM590XX_REG_DESC(_model, _name, _name_lower)			\
	.id = _model##_REG_##_name,					\
	.name = #_name_lower,						\
	.of_match = of_match_ptr(#_name_lower),				\
	.regulators_node = of_match_ptr("regulators"),			\
	.type = REGULATOR_VOLTAGE,					\
	.owner = THIS_MODULE						\

#define BCM590XX_LDO_DESC(_model, _model_lower, _name, _name_lower, _table) \
	BCM590XX_REG_DESC(_model, _name, _name_lower),			\
	.ops = &bcm590xx_ops_ldo,					\
	.n_voltages = ARRAY_SIZE(_model_lower##_##_table),		\
	.volt_table = _model_lower##_##_table,				\
	.vsel_reg = _model##_##_name##CTRL,				\
	.vsel_mask = BCM590XX_LDO_VSEL_MASK,				\
	.enable_reg = _model##_##_name##PMCTRL1,			\
	.enable_mask = BCM590XX_REG_ENABLE,				\
	.enable_is_inverted = true

#define BCM590XX_SR_DESC(_model, _model_lower, _name, _name_lower, _ranges) \
	BCM590XX_REG_DESC(_model, _name, _name_lower),			\
	.ops = &bcm590xx_ops_dcdc,					\
	.n_voltages = 64,						\
	.linear_ranges = _model_lower##_##_ranges,			\
	.n_linear_ranges = ARRAY_SIZE(_model_lower##_##_ranges),	\
	.vsel_reg = _model##_##_name##VOUT1,				\
	.vsel_mask = BCM590XX_SR_VSEL_MASK,				\
	.enable_reg = _model##_##_name##PMCTRL1,			\
	.enable_mask = BCM590XX_REG_ENABLE,				\
	.enable_is_inverted = true

#define BCM59056_REG_DESC(_name, _name_lower)				\
	BCM590XX_REG_DESC(BCM59056, _name, _name_lower)
#define BCM59056_LDO_DESC(_name, _name_lower, _table)			\
	BCM590XX_LDO_DESC(BCM59056, bcm59056, _name, _name_lower, _table)
#define BCM59056_SR_DESC(_name, _name_lower, _ranges)			\
	BCM590XX_SR_DESC(BCM59056, bcm59056, _name, _name_lower, _ranges)

#define BCM59054_REG_DESC(_name, _name_lower)				\
	BCM590XX_REG_DESC(BCM59054, _name, _name_lower)
#define BCM59054_LDO_DESC(_name, _name_lower, _table)			\

Annotation

Implementation Notes