drivers/regulator/bd9576-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/bd9576-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/bd9576-regulator.c- Extension
.c- Size
- 31715 bytes
- Lines
- 1141
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/err.hlinux/gpio/consumer.hlinux/interrupt.hlinux/jiffies.hlinux/kernel.hlinux/mfd/rohm-bd957x.hlinux/mfd/rohm-generic.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/property.hlinux/regulator/driver.hlinux/regulator/machine.hlinux/regulator/of_regulator.hlinux/slab.hlinux/spinlock.hlinux/workqueue.h
Detected Declarations
struct bd957x_regulator_datastruct bd957x_datafunction bd957x_vout34_list_voltagefunction bd957x_list_voltagefunction bd9576_fill_ovd_flagsfunction bd9576_fill_ocp_flagsfunction bd9576_fill_uvd_flagsfunction bd9576_fill_temp_flagsfunction bd9576_set_limitfunction check_ocp_flag_mismatchfunction check_uvd_flag_mismatchfunction check_ovd_flag_mismatchfunction check_temp_flag_mismatchfunction bd9576_set_ocpfunction bd9576_set_uvpfunction bd9576_set_ovpfunction bd9576_set_twfunction vouts1_get_fet_resfunction bd9576_renablefunction bd9576_uvd_renablefunction bd9576_ovd_renablefunction bd9576_temp_renablefunction bd9576_uvd_handlerfunction for_each_set_bitfunction bd9576_ovd_handlerfunction for_each_set_bitfunction bd9576_thermal_handlerfunction bd957x_probe
Annotated Snippet
struct bd957x_regulator_data {
struct regulator_desc desc;
int base_voltage;
struct regulator_dev *rdev;
int ovd_notif;
int uvd_notif;
int temp_notif;
int ovd_err;
int uvd_err;
int temp_err;
const struct linear_range *xvd_ranges;
int num_xvd_ranges;
bool oc_supported;
unsigned int ovd_reg;
unsigned int uvd_reg;
unsigned int xvd_mask;
unsigned int ocp_reg;
unsigned int ocp_mask;
unsigned int ocw_reg;
unsigned int ocw_mask;
unsigned int ocw_rfet;
};
#define BD9576_NUM_REGULATORS 6
#define BD9576_NUM_OVD_REGULATORS 5
struct bd957x_data {
struct bd957x_regulator_data regulator_data[BD9576_NUM_REGULATORS];
struct regmap *regmap;
struct delayed_work therm_irq_suppress;
struct delayed_work ovd_irq_suppress;
struct delayed_work uvd_irq_suppress;
unsigned int therm_irq;
unsigned int ovd_irq;
unsigned int uvd_irq;
spinlock_t err_lock;
int regulator_global_err;
};
static int bd957x_vout34_list_voltage(struct regulator_dev *rdev,
unsigned int selector)
{
const struct regulator_desc *desc = rdev->desc;
int multiplier = selector & desc->vsel_mask & 0x7f;
int tune;
/* VOUT3 and 4 has 10mV step */
tune = multiplier * 10000;
if (!(selector & 0x80))
return desc->fixed_uV - tune;
return desc->fixed_uV + tune;
}
static int bd957x_list_voltage(struct regulator_dev *rdev,
unsigned int selector)
{
const struct regulator_desc *desc = rdev->desc;
int index = selector & desc->vsel_mask & 0x7f;
if (!(selector & 0x80))
index += desc->n_voltages/2;
if (index >= desc->n_voltages)
return -EINVAL;
return desc->volt_table[index];
}
static void bd9576_fill_ovd_flags(struct bd957x_regulator_data *data,
bool warn)
{
if (warn) {
data->ovd_notif = REGULATOR_EVENT_OVER_VOLTAGE_WARN;
data->ovd_err = REGULATOR_ERROR_OVER_VOLTAGE_WARN;
} else {
data->ovd_notif = REGULATOR_EVENT_REGULATION_OUT;
data->ovd_err = REGULATOR_ERROR_REGULATION_OUT;
}
}
static void bd9576_fill_ocp_flags(struct bd957x_regulator_data *data,
bool warn)
{
if (warn) {
data->uvd_notif = REGULATOR_EVENT_OVER_CURRENT_WARN;
data->uvd_err = REGULATOR_ERROR_OVER_CURRENT_WARN;
} else {
data->uvd_notif = REGULATOR_EVENT_OVER_CURRENT;
Annotation
- Immediate include surface: `linux/err.h`, `linux/gpio/consumer.h`, `linux/interrupt.h`, `linux/jiffies.h`, `linux/kernel.h`, `linux/mfd/rohm-bd957x.h`, `linux/mfd/rohm-generic.h`, `linux/module.h`.
- Detected declarations: `struct bd957x_regulator_data`, `struct bd957x_data`, `function bd957x_vout34_list_voltage`, `function bd957x_list_voltage`, `function bd9576_fill_ovd_flags`, `function bd9576_fill_ocp_flags`, `function bd9576_fill_uvd_flags`, `function bd9576_fill_temp_flags`, `function bd9576_set_limit`, `function check_ocp_flag_mismatch`.
- 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.