arch/arm/mach-omap2/vc.c
Source file repositories/reference/linux-study-clean/arch/arm/mach-omap2/vc.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/mach-omap2/vc.c- Extension
.c- Size
- 24280 bytes
- Lines
- 880
- Domain
- Architecture Layer
- Bucket
- arch/arm
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/delay.hlinux/init.hlinux/bug.hlinux/io.hasm/div64.hiomap.hsoc.hvoltage.hvc.hprm-regbits-34xx.hprm-regbits-44xx.hprm44xx.hpm.hscrm44xx.hcontrol.h
Detected Declarations
struct omap_vc_channel_cfgstruct omap3_vc_timingsstruct omap3_vcstruct i2c_init_datafunction omap_vc_config_channelfunction omap_vc_pre_scalefunction omap_vc_post_scalefunction omap_vc_bypass_scalefunction omap_usec_to_32kfunction omap3_vc_set_pmic_signalingfunction omap4_vc_set_pmic_signalingfunction omap3_vc_init_pmic_signalingfunction omap3_init_voltsetup1function omap3_set_i2c_timingsfunction omap3_set_off_timingsfunction omap3_vc_init_channelfunction omap4_calc_volt_rampfunction omap4_usec_to_val_scrmfunction omap4_set_timingsfunction omap4_vc_init_pmic_signalingfunction omap4_vc_init_channelfunction omap4_vc_i2c_timing_initfunction codefunction omap_vc_calc_vselfunction omap_vc_init_channel
Annotated Snippet
struct omap_vc_channel_cfg {
u8 sa;
u8 rav;
u8 rac;
u8 racen;
u8 cmd;
};
static struct omap_vc_channel_cfg vc_default_channel_cfg = {
.sa = BIT(0),
.rav = BIT(1),
.rac = BIT(2),
.racen = BIT(3),
.cmd = BIT(4),
};
/*
* On OMAP3+, all VC channels have the above default bitfield
* configuration, except the OMAP4 MPU channel. This appears
* to be a freak accident as every other VC channel has the
* default configuration, thus creating a mutant channel config.
*/
static struct omap_vc_channel_cfg vc_mutant_channel_cfg = {
.sa = BIT(0),
.rav = BIT(2),
.rac = BIT(3),
.racen = BIT(4),
.cmd = BIT(1),
};
static struct omap_vc_channel_cfg *vc_cfg_bits;
/* Default I2C trace length on pcb, 6.3cm. Used for capacitance calculations. */
static u32 sr_i2c_pcb_length = 63;
#define CFG_CHANNEL_MASK 0x1f
/**
* omap_vc_config_channel - configure VC channel to PMIC mappings
* @voltdm: pointer to voltagdomain defining the desired VC channel
*
* Configures the VC channel to PMIC mappings for the following
* PMIC settings
* - i2c slave address (SA)
* - voltage configuration address (RAV)
* - command configuration address (RAC) and enable bit (RACEN)
* - command values for ON, ONLP, RET and OFF (CMD)
*
* This function currently only allows flexible configuration of the
* non-default channel. Starting with OMAP4, there are more than 2
* channels, with one defined as the default (on OMAP4, it's MPU.)
* Only the non-default channel can be configured.
*/
static int omap_vc_config_channel(struct voltagedomain *voltdm)
{
struct omap_vc_channel *vc = voltdm->vc;
/*
* For default channel, the only configurable bit is RACEN.
* All others must stay at zero (see function comment above.)
*/
if (vc->flags & OMAP_VC_CHANNEL_DEFAULT)
vc->cfg_channel &= vc_cfg_bits->racen;
voltdm->rmw(CFG_CHANNEL_MASK << vc->cfg_channel_sa_shift,
vc->cfg_channel << vc->cfg_channel_sa_shift,
vc->cfg_channel_reg);
return 0;
}
/* Voltage scale and accessory APIs */
int omap_vc_pre_scale(struct voltagedomain *voltdm,
unsigned long target_volt,
u8 *target_vsel, u8 *current_vsel)
{
struct omap_vc_channel *vc = voltdm->vc;
u32 vc_cmdval;
/* Check if sufficient pmic info is available for this vdd */
if (!voltdm->pmic) {
pr_err("%s: Insufficient pmic info to scale the vdd_%s\n",
__func__, voltdm->name);
return -EINVAL;
}
if (!voltdm->pmic->uv_to_vsel) {
pr_err("%s: PMIC function to convert voltage in uV to vsel not registered. Hence unable to scale voltage for vdd_%s\n",
__func__, voltdm->name);
return -ENODATA;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/delay.h`, `linux/init.h`, `linux/bug.h`, `linux/io.h`, `asm/div64.h`, `iomap.h`, `soc.h`.
- Detected declarations: `struct omap_vc_channel_cfg`, `struct omap3_vc_timings`, `struct omap3_vc`, `struct i2c_init_data`, `function omap_vc_config_channel`, `function omap_vc_pre_scale`, `function omap_vc_post_scale`, `function omap_vc_bypass_scale`, `function omap_usec_to_32k`, `function omap3_vc_set_pmic_signaling`.
- Atlas domain: Architecture Layer / arch/arm.
- 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.