drivers/regulator/rk808-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/rk808-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/rk808-regulator.c- Extension
.c- Size
- 73988 bytes
- Lines
- 2206
- 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.
- 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/delay.hlinux/module.hlinux/of.hlinux/mfd/rk808.hlinux/platform_device.hlinux/regulator/driver.hlinux/regulator/of_regulator.hlinux/gpio/consumer.h
Detected Declarations
struct rk8xx_register_bitstruct rk808_regulator_datafunction rk806_set_mode_dcdcfunction rk806_get_mode_dcdcfunction rk806_set_ramp_delay_dcdcfunction rk806_set_suspend_voltage_rangefunction rk806_set_suspend_voltage_range_dcdcfunction rk806_set_suspend_voltage_range_nldofunction rk806_set_suspend_voltage_range_pldofunction rk808_buck1_2_get_voltage_sel_regmapfunction rk808_buck1_2_i2c_set_voltage_selfunction rk808_buck1_2_set_voltage_selfunction rk808_buck1_2_set_voltage_time_selfunction rk808_set_suspend_voltagefunction rk808_set_suspend_voltage_rangefunction rk805_set_suspend_enablefunction rk805_set_suspend_disablefunction rk806_set_suspend_enablefunction rk806_set_suspend_disablefunction rk808_set_suspend_enablefunction rk808_set_suspend_disablefunction rk816_set_suspend_enablefunction rk816_set_suspend_disablefunction rk817_set_suspend_enable_ctrlfunction rk817_set_suspend_enablefunction rk817_set_suspend_disablefunction rk8xx_set_suspend_modefunction rk8xx_set_modefunction rk8xx_get_modefunction rk8xx_is_enabled_wmsk_regmapfunction rk8xx_regulator_of_map_modefunction rk801_get_modefunction rk801_set_modefunction rk801_set_suspend_voltagefunction rk801_set_suspend_enablefunction rk801_set_suspend_disablefunction rk801_set_voltage_time_selfunction rk808_regulator_dt_parse_pdatafunction rk808_regulator_probe
Annotated Snippet
struct rk8xx_register_bit {
u8 reg;
u8 bit;
};
#define RK8XX_REG_BIT(_reg, _bit) \
{ \
.reg = _reg, \
.bit = BIT(_bit), \
}
struct rk808_regulator_data {
struct gpio_desc *dvs_gpio[2];
};
static const struct linear_range rk808_ldo3_voltage_ranges[] = {
REGULATOR_LINEAR_RANGE(800000, 0, 13, 100000),
REGULATOR_LINEAR_RANGE(2500000, 15, 15, 0),
};
#define RK809_BUCK5_SEL_CNT (8)
static const struct linear_range rk809_buck5_voltage_ranges[] = {
REGULATOR_LINEAR_RANGE(1500000, 0, 0, 0),
REGULATOR_LINEAR_RANGE(1800000, 1, 3, 200000),
REGULATOR_LINEAR_RANGE(2800000, 4, 5, 200000),
REGULATOR_LINEAR_RANGE(3300000, 6, 7, 300000),
};
#define RK817_BUCK1_MIN0 500000
#define RK817_BUCK1_MAX0 1500000
#define RK817_BUCK1_MIN1 1600000
#define RK817_BUCK1_MAX1 2400000
#define RK817_BUCK3_MAX1 3400000
#define RK817_BUCK1_STP0 12500
#define RK817_BUCK1_STP1 100000
#define RK817_BUCK1_SEL0 ((RK817_BUCK1_MAX0 - RK817_BUCK1_MIN0) /\
RK817_BUCK1_STP0)
#define RK817_BUCK1_SEL1 ((RK817_BUCK1_MAX1 - RK817_BUCK1_MIN1) /\
RK817_BUCK1_STP1)
#define RK817_BUCK3_SEL1 ((RK817_BUCK3_MAX1 - RK817_BUCK1_MIN1) /\
RK817_BUCK1_STP1)
#define RK817_BUCK1_SEL_CNT (RK817_BUCK1_SEL0 + RK817_BUCK1_SEL1 + 1)
#define RK817_BUCK3_SEL_CNT (RK817_BUCK1_SEL0 + RK817_BUCK3_SEL1 + 1)
static const struct linear_range rk817_buck1_voltage_ranges[] = {
REGULATOR_LINEAR_RANGE(RK817_BUCK1_MIN0, 0,
RK817_BUCK1_SEL0, RK817_BUCK1_STP0),
REGULATOR_LINEAR_RANGE(RK817_BUCK1_MIN1, RK817_BUCK1_SEL0 + 1,
RK817_BUCK1_SEL_CNT, RK817_BUCK1_STP1),
};
static const struct linear_range rk817_buck3_voltage_ranges[] = {
REGULATOR_LINEAR_RANGE(RK817_BUCK1_MIN0, 0,
RK817_BUCK1_SEL0, RK817_BUCK1_STP0),
REGULATOR_LINEAR_RANGE(RK817_BUCK1_MIN1, RK817_BUCK1_SEL0 + 1,
RK817_BUCK3_SEL_CNT, RK817_BUCK1_STP1),
};
static const unsigned int rk808_buck1_2_ramp_table[] = {
2000, 4000, 6000, 10000
};
/* RK817/RK809/RK816 (buck 1/2 only) */
static const unsigned int rk817_buck1_4_ramp_table[] = {
3000, 6300, 12500, 25000
};
static int rk806_set_mode_dcdc(struct regulator_dev *rdev, unsigned int mode)
{
unsigned int rid = rdev_get_id(rdev);
unsigned int ctr_bit, reg;
reg = RK806_POWER_FPWM_EN0 + rid / 8;
ctr_bit = rid % 8;
switch (mode) {
case REGULATOR_MODE_FAST:
return regmap_update_bits(rdev->regmap, reg,
PWM_MODE_MSK << ctr_bit,
FPWM_MODE << ctr_bit);
case REGULATOR_MODE_NORMAL:
return regmap_update_bits(rdev->regmap, reg,
PWM_MODE_MSK << ctr_bit,
Annotation
- Immediate include surface: `linux/delay.h`, `linux/module.h`, `linux/of.h`, `linux/mfd/rk808.h`, `linux/platform_device.h`, `linux/regulator/driver.h`, `linux/regulator/of_regulator.h`, `linux/gpio/consumer.h`.
- Detected declarations: `struct rk8xx_register_bit`, `struct rk808_regulator_data`, `function rk806_set_mode_dcdc`, `function rk806_get_mode_dcdc`, `function rk806_set_ramp_delay_dcdc`, `function rk806_set_suspend_voltage_range`, `function rk806_set_suspend_voltage_range_dcdc`, `function rk806_set_suspend_voltage_range_nldo`, `function rk806_set_suspend_voltage_range_pldo`, `function rk808_buck1_2_get_voltage_sel_regmap`.
- Atlas domain: Driver Families / drivers/regulator.
- Implementation status: source implementation candidate.
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.