drivers/regulator/rt5133-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/rt5133-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/rt5133-regulator.c- Extension
.c- Size
- 17892 bytes
- Lines
- 643
- 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.
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/crc8.hlinux/delay.hlinux/gpio/consumer.hlinux/gpio/driver.hlinux/i2c.hlinux/interrupt.hlinux/kernel.hlinux/module.hlinux/of.hlinux/regmap.hlinux/regulator/driver.h
Detected Declarations
struct chip_datastruct rt5133_privfunction rt5133_gpio_direction_outputfunction rt5133_gpio_getfunction rt5133_get_gpioen_maskfunction rt5133_gpio_setfunction rt5133_intr_handlerfunction rt5133_enable_interruptsfunction rt5133_regmap_hw_readfunction rt5133_regmap_hw_writefunction rt5133_is_volatile_regfunction rt5133_chip_resetfunction rt5133_validate_vendor_infofunction rt5133_parse_dtfunction rt5133_probe
Annotated Snippet
struct chip_data {
const struct regulator_desc *regulators;
const u8 vendor_id;
};
struct rt5133_priv {
struct device *dev;
struct regmap *regmap;
struct gpio_desc *enable_gpio;
struct regulator_dev *rdev[RT5133_REGULATOR_MAX];
struct gpio_chip gc;
const struct chip_data *cdata;
unsigned int gpio_output_flag;
u8 crc8_tbls[CRC8_TABLE_SIZE];
};
static const unsigned int vout_type1_tables[] = {
1800000, 2500000, 2700000, 2800000, 2900000, 3000000, 3100000, 3200000
};
static const unsigned int vout_type2_tables[] = {
1700000, 1800000, 1900000, 2500000, 2700000, 2800000, 2900000, 3000000
};
static const unsigned int vout_type3_tables[] = {
900000, 950000, 1000000, 1050000, 1100000, 1150000, 1200000, 1800000
};
static const unsigned int vout_type4_tables[] = {
855000, 900000, 950000, 1000000, 1040000, 1090000, 1140000, 1710000
};
static const struct regulator_ops rt5133_regulator_ops = {
.list_voltage = regulator_list_voltage_table,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
.set_active_discharge = regulator_set_active_discharge_regmap,
};
static const struct regulator_ops rt5133_base_regulator_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
};
#define RT5133_REGULATOR_DESC(_name, _node_name, vtables, _supply) \
{\
.name = #_name,\
.id = RT5133_REGULATOR_##_name,\
.of_match = of_match_ptr(#_node_name),\
.regulators_node = of_match_ptr("regulators"),\
.supply_name = _supply,\
.type = REGULATOR_VOLTAGE,\
.owner = THIS_MODULE,\
.ops = &rt5133_regulator_ops,\
.n_voltages = ARRAY_SIZE(vtables),\
.volt_table = vtables,\
.enable_reg = RT5133_REG_##_name##_CTRL1,\
.enable_mask = RT5133_LDO_ENABLE_MASK,\
.vsel_reg = RT5133_REG_##_name##_CTRL2,\
.vsel_mask = RT5133_LDO_VSEL_MASK,\
.active_discharge_reg = RT5133_REG_##_name##_CTRL3,\
.active_discharge_mask = RT5133_LDO_AD_MASK,\
}
static const struct regulator_desc rt5133_regulators[] = {
/* For digital part, base current control */
{
.name = "base",
.id = RT5133_REGULATOR_BASE,
.of_match = of_match_ptr("base"),
.regulators_node = of_match_ptr("regulators"),
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
.ops = &rt5133_base_regulator_ops,
.enable_reg = RT5133_REG_BASE_CTRL,
.enable_mask = RT5133_FOFF_BASE_MASK,
.enable_is_inverted = true,
},
RT5133_REGULATOR_DESC(LDO1, ldo1, vout_type1_tables, "base"),
RT5133_REGULATOR_DESC(LDO2, ldo2, vout_type1_tables, "base"),
RT5133_REGULATOR_DESC(LDO3, ldo3, vout_type2_tables, "base"),
RT5133_REGULATOR_DESC(LDO4, ldo4, vout_type2_tables, "base"),
RT5133_REGULATOR_DESC(LDO5, ldo5, vout_type2_tables, "base"),
RT5133_REGULATOR_DESC(LDO6, ldo6, vout_type2_tables, "base"),
RT5133_REGULATOR_DESC(LDO7, ldo7, vout_type3_tables, "vin"),
RT5133_REGULATOR_DESC(LDO8, ldo8, vout_type3_tables, "vin"),
Annotation
- Immediate include surface: `linux/crc8.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/gpio/driver.h`, `linux/i2c.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/module.h`.
- Detected declarations: `struct chip_data`, `struct rt5133_priv`, `function rt5133_gpio_direction_output`, `function rt5133_gpio_get`, `function rt5133_get_gpioen_mask`, `function rt5133_gpio_set`, `function rt5133_intr_handler`, `function rt5133_enable_interrupts`, `function rt5133_regmap_hw_read`, `function rt5133_regmap_hw_write`.
- Atlas domain: Driver Families / drivers/regulator.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.