drivers/regulator/hi6421-regulator.c

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

File Facts

System
Linux kernel
Corpus path
drivers/regulator/hi6421-regulator.c
Extension
.c
Size
18377 bytes
Lines
591
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 hi6421_regulator_pdata {
	struct mutex lock;
};

/*
 * struct hi6421_regulator_info - hi6421 regulator information
 * @desc: regulator description
 * @mode_mask: ECO mode bitmask of LDOs; for BUCKs, this masks sleep
 * @eco_microamp: eco mode load upper limit (in uA), valid for LDOs only
 */
struct hi6421_regulator_info {
	struct regulator_desc	desc;
	u8		mode_mask;
	u32		eco_microamp;
};

/* HI6421 regulators */
enum hi6421_regulator_id {
	HI6421_LDO0,
	HI6421_LDO1,
	HI6421_LDO2,
	HI6421_LDO3,
	HI6421_LDO4,
	HI6421_LDO5,
	HI6421_LDO6,
	HI6421_LDO7,
	HI6421_LDO8,
	HI6421_LDO9,
	HI6421_LDO10,
	HI6421_LDO11,
	HI6421_LDO12,
	HI6421_LDO13,
	HI6421_LDO14,
	HI6421_LDO15,
	HI6421_LDO16,
	HI6421_LDO17,
	HI6421_LDO18,
	HI6421_LDO19,
	HI6421_LDO20,
	HI6421_LDOAUDIO,
	HI6421_BUCK0,
	HI6421_BUCK1,
	HI6421_BUCK2,
	HI6421_BUCK3,
	HI6421_BUCK4,
	HI6421_BUCK5,
	HI6421_NUM_REGULATORS,
};

/* LDO 0, 4~7, 9~14, 16~20 have same voltage table. */
static const unsigned int ldo_0_voltages[] = {
	1500000, 1800000, 2400000, 2500000,
	2600000, 2700000, 2850000, 3000000,
};

/* LDO 8, 15 have same voltage table. */
static const unsigned int ldo_8_voltages[] = {
	1500000, 1800000, 2400000, 2600000,
	2700000, 2850000, 3000000, 3300000,
};

/* Ranges are sorted in ascending order. */
static const struct linear_range ldo_audio_volt_range[] = {
	REGULATOR_LINEAR_RANGE(2800000, 0, 3, 50000),
	REGULATOR_LINEAR_RANGE(3000000, 4, 7, 100000),
};

static const unsigned int buck_3_voltages[] = {
	 950000, 1050000, 1100000, 1117000,
	1134000, 1150000, 1167000, 1200000,
};

static const unsigned int buck_4_voltages[] = {
	1150000, 1200000, 1250000, 1350000,
	1700000, 1800000, 1900000, 2000000,
};

static const unsigned int buck_5_voltages[] = {
	1150000, 1200000, 1250000, 1350000,
	1600000, 1700000, 1800000, 1900000,
};

static const struct regulator_ops hi6421_ldo_ops;
static const struct regulator_ops hi6421_ldo_linear_ops;
static const struct regulator_ops hi6421_ldo_linear_range_ops;
static const struct regulator_ops hi6421_buck012_ops;
static const struct regulator_ops hi6421_buck345_ops;

#define HI6421_LDO_ENABLE_TIME (350)
/*

Annotation

Implementation Notes