drivers/regulator/s2mps11.c
Source file repositories/reference/linux-study-clean/drivers/regulator/s2mps11.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/s2mps11.c- Extension
.c- Size
- 81088 bytes
- Lines
- 2296
- 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
dt-bindings/regulator/samsung,s2mpg10-regulator.hlinux/bug.hlinux/cleanup.hlinux/err.hlinux/gpio/consumer.hlinux/slab.hlinux/module.hlinux/of.hlinux/regmap.hlinux/platform_device.hlinux/regulator/driver.hlinux/regulator/machine.hlinux/regulator/of_regulator.hlinux/mfd/samsung/core.hlinux/mfd/samsung/s2mpg10.hlinux/mfd/samsung/s2mpg11.hlinux/mfd/samsung/s2mps11.hlinux/mfd/samsung/s2mps13.hlinux/mfd/samsung/s2mps14.hlinux/mfd/samsung/s2mps15.hlinux/mfd/samsung/s2mpu02.hlinux/mfd/samsung/s2mpu05.h
Detected Declarations
struct s2mps11_infostruct s2mpg10_regulator_descfunction get_ramp_delayfunction s2mps11_regulator_set_voltage_time_selfunction s2mps11_set_ramp_delayfunction s2mps11_regulator_enablefunction s2mps11_regulator_set_suspend_disablefunction s2mps11_of_parse_gpiodfunction s2mps11_of_parse_cbfunction s2mpg10_of_parse_cbfunction s2mpg10_enable_ext_controlfunction s2mpg10_regulator_enable_nopfunction s2mpg10_regulator_buck_enable_timefunction s2mpg1x_regulator_buck_set_voltage_timefunction s2mpg10_regulator_buck_set_voltage_timefunction s2mpg11_regulator_buck_set_voltage_timefunction fixedfunction s2mps14_pmic_enable_ext_controlfunction s2mpu02_set_ramp_delayfunction s2mps11_handle_ext_controlfunction s2mps11_pmic_probe
Annotated Snippet
struct s2mps11_info {
int ramp_delay2;
int ramp_delay34;
int ramp_delay5;
int ramp_delay16;
int ramp_delay7810;
int ramp_delay9;
enum sec_device_type dev_type;
/*
* One bit for each S2MPS11/S2MPS13/S2MPS14/S2MPU02 regulator whether
* the suspend mode was enabled.
*/
DECLARE_BITMAP(suspend_state, S2MPS_REGULATOR_MAX);
};
#define to_s2mpg10_regulator_desc(x) container_of((x), struct s2mpg10_regulator_desc, desc)
struct s2mpg10_regulator_desc {
struct regulator_desc desc;
/* Ramp rate during enable, valid for bucks only. */
unsigned int enable_ramp_rate;
/* Registers for external control of rail. */
unsigned int pctrlsel_reg;
unsigned int pctrlsel_mask;
/* Populated from DT. */
unsigned int pctrlsel_val;
};
static int get_ramp_delay(int ramp_delay)
{
unsigned char cnt = 0;
ramp_delay /= 6250;
while (true) {
ramp_delay = ramp_delay >> 1;
if (ramp_delay == 0)
break;
cnt++;
}
if (cnt > 3)
cnt = 3;
return cnt;
}
static int s2mps11_regulator_set_voltage_time_sel(struct regulator_dev *rdev,
unsigned int old_selector,
unsigned int new_selector)
{
struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
int rdev_id = rdev_get_id(rdev);
unsigned int ramp_delay = 0;
int old_volt, new_volt;
switch (rdev_id) {
case S2MPS11_BUCK2:
ramp_delay = s2mps11->ramp_delay2;
break;
case S2MPS11_BUCK3:
case S2MPS11_BUCK4:
ramp_delay = s2mps11->ramp_delay34;
break;
case S2MPS11_BUCK5:
ramp_delay = s2mps11->ramp_delay5;
break;
case S2MPS11_BUCK6:
case S2MPS11_BUCK1:
ramp_delay = s2mps11->ramp_delay16;
break;
case S2MPS11_BUCK7:
case S2MPS11_BUCK8:
case S2MPS11_BUCK10:
ramp_delay = s2mps11->ramp_delay7810;
break;
case S2MPS11_BUCK9:
ramp_delay = s2mps11->ramp_delay9;
}
if (ramp_delay == 0)
ramp_delay = rdev->desc->ramp_delay;
old_volt = rdev->desc->min_uV + (rdev->desc->uV_step * old_selector);
new_volt = rdev->desc->min_uV + (rdev->desc->uV_step * new_selector);
Annotation
- Immediate include surface: `dt-bindings/regulator/samsung,s2mpg10-regulator.h`, `linux/bug.h`, `linux/cleanup.h`, `linux/err.h`, `linux/gpio/consumer.h`, `linux/slab.h`, `linux/module.h`, `linux/of.h`.
- Detected declarations: `struct s2mps11_info`, `struct s2mpg10_regulator_desc`, `function get_ramp_delay`, `function s2mps11_regulator_set_voltage_time_sel`, `function s2mps11_set_ramp_delay`, `function s2mps11_regulator_enable`, `function s2mps11_regulator_set_suspend_disable`, `function s2mps11_of_parse_gpiod`, `function s2mps11_of_parse_cb`, `function s2mpg10_of_parse_cb`.
- 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.