drivers/regulator/fan53555.c
Source file repositories/reference/linux-study-clean/drivers/regulator/fan53555.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/fan53555.c- Extension
.c- Size
- 19323 bytes
- Lines
- 796
- 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/bitops.hlinux/err.hlinux/i2c.hlinux/module.hlinux/of.hlinux/param.hlinux/platform_device.hlinux/regmap.hlinux/regulator/driver.hlinux/regulator/fan53555.hlinux/regulator/machine.hlinux/regulator/of_regulator.hlinux/slab.h
Detected Declarations
struct fan53555_device_infoenum fan53555_vendorfunction fan53555_set_suspend_voltagefunction fan53555_set_suspend_enablefunction fan53555_set_suspend_disablefunction fan53555_set_modefunction fan53555_get_modefunction fan53526_voltages_setup_fairchildfunction fan53555_voltages_setup_fairchildfunction fan53555_voltages_setup_rockchipfunction rk8602_voltages_setup_rockchipfunction fan53555_voltages_setup_silergyfunction fan53526_voltages_setup_tcsfunction fan53555_device_setupfunction fan53555_regulator_registerfunction fan53555_regulator_probe
Annotated Snippet
struct fan53555_device_info {
enum fan53555_vendor vendor;
struct device *dev;
struct regulator_desc desc;
struct regulator_init_data *regulator;
/* IC Type and Rev */
int chip_id;
int chip_rev;
/* Voltage setting register */
unsigned int vol_reg;
unsigned int sleep_reg;
unsigned int en_reg;
unsigned int sleep_en_reg;
/* Voltage range and step(linear) */
unsigned int vsel_min;
unsigned int vsel_step;
unsigned int vsel_count;
/* Mode */
unsigned int mode_reg;
unsigned int mode_mask;
/* Sleep voltage cache */
unsigned int sleep_vol_cache;
/* Slew rate */
unsigned int slew_reg;
unsigned int slew_mask;
const unsigned int *ramp_delay_table;
unsigned int n_ramp_values;
unsigned int enable_time;
unsigned int slew_rate;
};
static int fan53555_set_suspend_voltage(struct regulator_dev *rdev, int uV)
{
struct fan53555_device_info *di = rdev_get_drvdata(rdev);
int ret;
if (di->sleep_vol_cache == uV)
return 0;
ret = regulator_map_voltage_linear(rdev, uV, uV);
if (ret < 0)
return ret;
ret = regmap_update_bits(rdev->regmap, di->sleep_reg,
di->desc.vsel_mask, ret);
if (ret < 0)
return ret;
/* Cache the sleep voltage setting.
* Might not be the real voltage which is rounded */
di->sleep_vol_cache = uV;
return 0;
}
static int fan53555_set_suspend_enable(struct regulator_dev *rdev)
{
struct fan53555_device_info *di = rdev_get_drvdata(rdev);
return regmap_update_bits(rdev->regmap, di->sleep_en_reg,
VSEL_BUCK_EN, VSEL_BUCK_EN);
}
static int fan53555_set_suspend_disable(struct regulator_dev *rdev)
{
struct fan53555_device_info *di = rdev_get_drvdata(rdev);
return regmap_update_bits(rdev->regmap, di->sleep_en_reg,
VSEL_BUCK_EN, 0);
}
static int fan53555_set_mode(struct regulator_dev *rdev, unsigned int mode)
{
struct fan53555_device_info *di = rdev_get_drvdata(rdev);
switch (mode) {
case REGULATOR_MODE_FAST:
regmap_update_bits(rdev->regmap, di->mode_reg,
di->mode_mask, di->mode_mask);
break;
case REGULATOR_MODE_NORMAL:
regmap_update_bits(rdev->regmap, di->vol_reg, di->mode_mask, 0);
break;
default:
return -EINVAL;
}
return 0;
}
static unsigned int fan53555_get_mode(struct regulator_dev *rdev)
{
struct fan53555_device_info *di = rdev_get_drvdata(rdev);
unsigned int val;
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/err.h`, `linux/i2c.h`, `linux/module.h`, `linux/of.h`, `linux/param.h`, `linux/platform_device.h`, `linux/regmap.h`.
- Detected declarations: `struct fan53555_device_info`, `enum fan53555_vendor`, `function fan53555_set_suspend_voltage`, `function fan53555_set_suspend_enable`, `function fan53555_set_suspend_disable`, `function fan53555_set_mode`, `function fan53555_get_mode`, `function fan53526_voltages_setup_fairchild`, `function fan53555_voltages_setup_fairchild`, `function fan53555_voltages_setup_rockchip`.
- 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.