drivers/regulator/adp5055-regulator.c

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

File Facts

System
Linux kernel
Corpus path
drivers/regulator/adp5055-regulator.c
Extension
.c
Size
11609 bytes
Lines
425
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 adp5055 {
	struct device *dev;
	struct regmap *regmap;
	u32 tset;
	struct gpio_desc *en_gpiod[ADP5055_NUM_CH];
	bool en_mode_software;
	int dvs_limit_upper[ADP5055_NUM_CH];
	int dvs_limit_lower[ADP5055_NUM_CH];
	u32 fast_transient[ADP5055_NUM_CH];
	bool mask_power_good[ADP5055_NUM_CH];
};

static const unsigned int adp5055_tset_vals[] = {
	2600,
	20800,
};

static const unsigned int adp5055_enable_delay_vals_2_6[] = {
	0,
	2600,
	5200,
	7800,
	10400,
	13000,
	15600,
	18200,
};

static const unsigned int adp5055_enable_delay_vals_20_8[] = {
	0,
	20800,
	41600,
	62400,
	83200,
	104000,
	124800,
	145600,
};

static const char * const adp5055_fast_transient_vals[] = {
	"none",
	"3G_1.5%",
	"5G_1.5%",
	"5G_2.5%",
};

static int adp5055_get_prop_index(const u32 *table, size_t table_size,
				  u32 value)
{
	int i;

	for (i = 0; i < table_size; i++)
		if (table[i] == value)
			return i;

	return -EINVAL;
}

static const struct regmap_range adp5055_reg_ranges[] = {
	regmap_reg_range(0xD1, 0xE0),
};

static const struct regmap_access_table adp5055_access_ranges_table = {
	.yes_ranges	= adp5055_reg_ranges,
	.n_yes_ranges	= ARRAY_SIZE(adp5055_reg_ranges),
};

static const struct regmap_config adp5055_regmap_config = {
	.reg_bits = 8,
	.val_bits = 8,
	.max_register = 0xE0,
	.wr_table = &adp5055_access_ranges_table,
	.rd_table = &adp5055_access_ranges_table,
};

static const struct linear_range adp5055_voltage_ranges[] = {
	REGULATOR_LINEAR_RANGE(ADP5055_MIN_VOUT, 0, 255, 1500),
};

static int adp5055_parse_fw(struct device *dev, struct  adp5055 *adp5055)
{
	int i, ret;
	struct regmap *regmap = adp5055->regmap;
	int val;
	bool ocp_blanking;
	bool delay_power_good;

	ret = device_property_read_u32(dev, "adi,tset-us", &adp5055->tset);
	if (!ret) {
		ret = adp5055_get_prop_index(adp5055_tset_vals,

Annotation

Implementation Notes