drivers/regulator/atc260x-regulator.c

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

File Facts

System
Linux kernel
Corpus path
drivers/regulator/atc260x-regulator.c
Extension
.c
Size
17095 bytes
Lines
544
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 atc260x_regulator_data {
	int voltage_time_dcdc;
	int voltage_time_ldo;
};

static const struct linear_range atc2603c_dcdc_voltage_ranges[] = {
	REGULATOR_LINEAR_RANGE(1300000, 0, 13, 50000),
	REGULATOR_LINEAR_RANGE(1950000, 14, 15, 100000),
};

static const struct linear_range atc2609a_dcdc_voltage_ranges[] = {
	REGULATOR_LINEAR_RANGE(600000, 0, 127, 6250),
	REGULATOR_LINEAR_RANGE(1400000, 128, 232, 25000),
};

static const struct linear_range atc2609a_ldo_voltage_ranges0[] = {
	REGULATOR_LINEAR_RANGE(700000, 0, 15, 100000),
	REGULATOR_LINEAR_RANGE(2100000, 0, 12, 100000),
};

static const struct linear_range atc2609a_ldo_voltage_ranges1[] = {
	REGULATOR_LINEAR_RANGE(850000, 0, 15, 100000),
	REGULATOR_LINEAR_RANGE(2100000, 0, 11, 100000),
};

static const unsigned int atc260x_ldo_voltage_range_sel[] = {
	0x0, 0x1,
};

static int atc260x_dcdc_set_voltage_time_sel(struct regulator_dev *rdev,
					     unsigned int old_selector,
					     unsigned int new_selector)
{
	struct atc260x_regulator_data *data = rdev_get_drvdata(rdev);

	if (new_selector > old_selector)
		return data->voltage_time_dcdc;

	return 0;
}

static int atc260x_ldo_set_voltage_time_sel(struct regulator_dev *rdev,
					    unsigned int old_selector,
					    unsigned int new_selector)
{
	struct atc260x_regulator_data *data = rdev_get_drvdata(rdev);

	if (new_selector > old_selector)
		return data->voltage_time_ldo;

	return 0;
}

static const struct regulator_ops atc260x_dcdc_ops = {
	.enable	= regulator_enable_regmap,
	.disable = regulator_disable_regmap,
	.is_enabled = regulator_is_enabled_regmap,
	.list_voltage = regulator_list_voltage_linear,
	.set_voltage_sel = regulator_set_voltage_sel_regmap,
	.get_voltage_sel = regulator_get_voltage_sel_regmap,
	.set_voltage_time_sel = atc260x_dcdc_set_voltage_time_sel,
};

static const struct regulator_ops atc260x_ldo_ops = {
	.enable	= regulator_enable_regmap,
	.disable = regulator_disable_regmap,
	.is_enabled = regulator_is_enabled_regmap,
	.list_voltage = regulator_list_voltage_linear,
	.set_voltage_sel = regulator_set_voltage_sel_regmap,
	.get_voltage_sel = regulator_get_voltage_sel_regmap,
	.set_voltage_time_sel = atc260x_ldo_set_voltage_time_sel,
};

static const struct regulator_ops atc260x_ldo_bypass_ops = {
	.enable	= regulator_enable_regmap,
	.disable = regulator_disable_regmap,
	.is_enabled = regulator_is_enabled_regmap,
	.list_voltage = regulator_list_voltage_linear,
	.set_voltage_sel = regulator_set_voltage_sel_regmap,
	.get_voltage_sel = regulator_get_voltage_sel_regmap,
	.set_voltage_time_sel = atc260x_ldo_set_voltage_time_sel,
	.set_bypass = regulator_set_bypass_regmap,
	.get_bypass = regulator_get_bypass_regmap,
};

static const struct regulator_ops atc260x_ldo_bypass_discharge_ops = {
	.enable	= regulator_enable_regmap,
	.disable = regulator_disable_regmap,
	.is_enabled = regulator_is_enabled_regmap,
	.list_voltage = regulator_list_voltage_linear,

Annotation

Implementation Notes