drivers/regulator/qcom-rpmh-regulator.c

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

File Facts

System
Linux kernel
Corpus path
drivers/regulator/qcom-rpmh-regulator.c
Extension
.c
Size
76477 bytes
Lines
2011
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 resource_name_formats {
	const char *rsc_name_fmt;
	const char *rsc_name_fmt1;
};

static const struct resource_name_formats vreg_rsc_name_lookup[NUM_REGULATOR_TYPES] = {
	[SMPS]	= {"S%d%s", "smp%s%d"},
	[LDO]	= {"L%d%s", "ldo%s%d"},
	[BOB]	= {"B%d%s", "bob%s%d"},
	[VS]	= {"VS%d%s", "vs%s%d"},
};

#define RPMH_REGULATOR_REG_VRM_VOLTAGE		0x0
#define RPMH_REGULATOR_REG_ENABLE		0x4
#define RPMH_REGULATOR_REG_VRM_MODE		0x8

#define PMIC4_LDO_MODE_RETENTION		4
#define PMIC4_LDO_MODE_LPM			5
#define PMIC4_LDO_MODE_HPM			7

#define PMIC4_SMPS_MODE_RETENTION		4
#define PMIC4_SMPS_MODE_PFM			5
#define PMIC4_SMPS_MODE_AUTO			6
#define PMIC4_SMPS_MODE_PWM			7

#define PMIC4_BOB_MODE_PASS			0
#define PMIC4_BOB_MODE_PFM			1
#define PMIC4_BOB_MODE_AUTO			2
#define PMIC4_BOB_MODE_PWM			3

#define PMIC5_LDO_MODE_RETENTION		3
#define PMIC5_LDO_MODE_LPM			4
#define PMIC5_LDO_MODE_HPM			7

#define PMIC5_SMPS_MODE_RETENTION		3
#define PMIC5_SMPS_MODE_PFM			4
#define PMIC5_SMPS_MODE_AUTO			6
#define PMIC5_SMPS_MODE_PWM			7

#define PMIC5_BOB_MODE_PASS			2
#define PMIC5_BOB_MODE_PFM			4
#define PMIC5_BOB_MODE_AUTO			6
#define PMIC5_BOB_MODE_PWM			7

#define PMIC530_LDO_MODE_RETENTION		3
#define PMIC530_LDO_MODE_LPM			4
#define PMIC530_LDO_MODE_OPM			5
#define PMIC530_LDO_MODE_HPM			7

#define PMIC_ID_LEN				4
/**
 * struct rpmh_vreg_hw_data - RPMh regulator hardware configurations
 * @regulator_type:		RPMh accelerator type used to manage this
 *				regulator
 * @ops:			Pointer to regulator ops callback structure
 * @voltage_ranges:		The possible ranges of voltages supported by this
 * 				PMIC regulator type
 * @n_linear_ranges:		Number of entries in voltage_ranges
 * @n_voltages:			The number of unique voltage set points defined
 *				by voltage_ranges
 * @hpm_min_load_uA:		Minimum load current in microamps that requires
 *				high power mode (HPM) operation.  This is used
 *				for LDO hardware type regulators only.
 * @pmic_mode_map:		Array indexed by regulator framework mode
 *				containing PMIC hardware modes.  Must be large
 *				enough to index all framework modes supported
 *				by this regulator hardware type.
 * @of_map_mode:		Maps an RPMH_REGULATOR_MODE_* mode value defined
 *				in device tree to a regulator framework mode
 */
struct rpmh_vreg_hw_data {
	enum rpmh_regulator_type		regulator_type;
	const struct regulator_ops		*ops;
	const struct linear_range		*voltage_ranges;
	int					n_linear_ranges;
	int					n_voltages;
	int					hpm_min_load_uA;
	const int				*pmic_mode_map;
	unsigned int			      (*of_map_mode)(unsigned int mode);
};

/**
 * struct rpmh_vreg - individual RPMh regulator data structure encapsulating a
 *		single regulator device
 * @dev:			Device pointer for the top-level PMIC RPMh
 *				regulator parent device.  This is used as a
 *				handle in RPMh write requests.
 * @addr:			Base address of the regulator resource within
 *				an RPMh accelerator
 * @rdesc:			Regulator descriptor

Annotation

Implementation Notes