drivers/regulator/dbx500-prcmu.c
Source file repositories/reference/linux-study-clean/drivers/regulator/dbx500-prcmu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/dbx500-prcmu.c- Extension
.c- Size
- 3811 bytes
- Lines
- 156
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/kernel.hlinux/err.hlinux/regulator/driver.hlinux/debugfs.hlinux/seq_file.hlinux/slab.hlinux/module.hdbx500-prcmu.h
Detected Declarations
function power_state_active_enablefunction power_state_active_disablefunction power_state_active_getfunction ux500_regulator_power_state_cnt_showfunction ux500_regulator_status_showfunction ux500_regulator_debug_initfunction ux500_regulator_debug_exit
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) ST-Ericsson SA 2010
*
* Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson
* Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson
*
* UX500 common part of Power domain regulators
*/
#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/regulator/driver.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/module.h>
#include "dbx500-prcmu.h"
/*
* power state reference count
*/
static int power_state_active_cnt; /* will initialize to zero */
static DEFINE_SPINLOCK(power_state_active_lock);
void power_state_active_enable(void)
{
unsigned long flags;
spin_lock_irqsave(&power_state_active_lock, flags);
power_state_active_cnt++;
spin_unlock_irqrestore(&power_state_active_lock, flags);
}
int power_state_active_disable(void)
{
int ret = 0;
unsigned long flags;
spin_lock_irqsave(&power_state_active_lock, flags);
if (power_state_active_cnt <= 0) {
pr_err("power state: unbalanced enable/disable calls\n");
ret = -EINVAL;
goto out;
}
power_state_active_cnt--;
out:
spin_unlock_irqrestore(&power_state_active_lock, flags);
return ret;
}
#ifdef CONFIG_REGULATOR_DEBUG
static int power_state_active_get(void)
{
unsigned long flags;
int cnt;
spin_lock_irqsave(&power_state_active_lock, flags);
cnt = power_state_active_cnt;
spin_unlock_irqrestore(&power_state_active_lock, flags);
return cnt;
}
static struct ux500_regulator_debug {
struct dentry *dir;
struct dbx500_regulator_info *regulator_array;
int num_regulators;
u8 *state_before_suspend;
u8 *state_after_suspend;
} rdebug;
static int ux500_regulator_power_state_cnt_show(struct seq_file *s, void *p)
{
/* print power state count */
seq_printf(s, "ux500-regulator power state count: %i\n",
power_state_active_get());
return 0;
}
DEFINE_SHOW_ATTRIBUTE(ux500_regulator_power_state_cnt);
static int ux500_regulator_status_show(struct seq_file *s, void *p)
{
int i;
/* print dump header */
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/err.h`, `linux/regulator/driver.h`, `linux/debugfs.h`, `linux/seq_file.h`, `linux/slab.h`, `linux/module.h`, `dbx500-prcmu.h`.
- Detected declarations: `function power_state_active_enable`, `function power_state_active_disable`, `function power_state_active_get`, `function ux500_regulator_power_state_cnt_show`, `function ux500_regulator_status_show`, `function ux500_regulator_debug_init`, `function ux500_regulator_debug_exit`.
- Atlas domain: Driver Families / drivers/regulator.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.