drivers/soc/mediatek/mtk-svs.c
Source file repositories/reference/linux-study-clean/drivers/soc/mediatek/mtk-svs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/mediatek/mtk-svs.c- Extension
.c- Size
- 79522 bytes
- Lines
- 2960
- Domain
- Driver Families
- Bucket
- drivers/soc
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/bitfield.hlinux/bits.hlinux/clk.hlinux/completion.hlinux/cleanup.hlinux/cpu.hlinux/cpuidle.hlinux/debugfs.hlinux/device.hlinux/init.hlinux/interrupt.hlinux/kernel.hlinux/kthread.hlinux/module.hlinux/mutex.hlinux/nvmem-consumer.hlinux/of_address.hlinux/of_irq.hlinux/of_platform.hlinux/platform_device.hlinux/pm_domain.hlinux/pm_opp.hlinux/pm_runtime.hlinux/regulator/consumer.hlinux/reset.hlinux/seq_file.hlinux/slab.hlinux/spinlock.hlinux/thermal.h
Detected Declarations
struct svs_fusemapstruct svs_platformstruct svs_platform_datastruct svs_bank_pdatastruct svs_bankstruct svs_dentryenum svsb_sw_idenum svsb_typeenum svsb_phaseenum svs_reg_indexenum svs_fusemap_devenum svs_fusemap_glbfunction percentfunction svs_readl_relaxedfunction svs_writel_relaxedfunction svs_switch_bankfunction svs_bank_volt_to_opp_voltfunction svs_opp_volt_to_bank_voltfunction svs_sync_bank_volts_from_oppfunction svs_adjust_pm_opp_voltsfunction svs_bank_disable_and_restore_default_voltsfunction svs_dump_debug_showfunction svs_enable_debug_showfunction svs_enable_debug_writefunction svs_status_debug_showfunction svs_create_debug_cmdsfunction interpolatefunction svs_get_bank_volts_v3function svs_set_bank_freq_pct_v3function svs_get_bank_volts_v2function svs_set_bank_freq_pct_v2function svs_set_bank_phasefunction svs_save_bank_register_datafunction svs_error_isr_handlerfunction svs_init01_isr_handlerfunction svs_init02_isr_handlerfunction svs_mon_mode_isr_handlerfunction svs_isrfunction svs_mode_availablefunction svs_init01function svs_init02function svs_mon_modefunction svs_startfunction svs_suspendfunction svs_resumefunction svs_bank_resource_setupfunction svs_get_efuse_datafunction svs_get_fuse_val
Annotated Snippet
static const struct file_operations svs_##name##_debug_fops = { \
.owner = THIS_MODULE, \
.open = svs_##name##_debug_open, \
.read = seq_read, \
.llseek = seq_lseek, \
.release = single_release, \
}
#define debug_fops_rw(name) \
static int svs_##name##_debug_open(struct inode *inode, \
struct file *filp) \
{ \
return single_open(filp, svs_##name##_debug_show, \
inode->i_private); \
} \
static const struct file_operations svs_##name##_debug_fops = { \
.owner = THIS_MODULE, \
.open = svs_##name##_debug_open, \
.read = seq_read, \
.write = svs_##name##_debug_write, \
.llseek = seq_lseek, \
.release = single_release, \
}
#define svs_dentry_data(name) {__stringify(name), &svs_##name##_debug_fops}
#endif
/**
* enum svsb_sw_id - SVS Bank Software ID
* @SVSB_SWID_CPU_LITTLE: CPU little cluster Bank
* @SVSB_SWID_CPU_BIG: CPU big cluster Bank
* @SVSB_SWID_CCI: Cache Coherent Interconnect Bank
* @SVSB_SWID_GPU: GPU Bank
* @SVSB_SWID_MAX: Total number of Banks
*/
enum svsb_sw_id {
SVSB_SWID_CPU_LITTLE,
SVSB_SWID_CPU_BIG,
SVSB_SWID_CCI,
SVSB_SWID_GPU,
SVSB_SWID_MAX
};
/**
* enum svsb_type - SVS Bank 2-line: Type and Role
* @SVSB_TYPE_NONE: One-line type Bank - Global role
* @SVSB_TYPE_LOW: Two-line type Bank - Low bank role
* @SVSB_TYPE_HIGH: Two-line type Bank - High bank role
* @SVSB_TYPE_MAX: Total number of bank types
*/
enum svsb_type {
SVSB_TYPE_NONE,
SVSB_TYPE_LOW,
SVSB_TYPE_HIGH,
SVSB_TYPE_MAX
};
/**
* enum svsb_phase - svs bank phase enumeration
* @SVSB_PHASE_ERROR: svs bank encounters unexpected condition
* @SVSB_PHASE_INIT01: svs bank basic init for data calibration
* @SVSB_PHASE_INIT02: svs bank can provide voltages to opp table
* @SVSB_PHASE_MON: svs bank can provide voltages with thermal effect
* @SVSB_PHASE_MAX: total number of svs bank phase (debug purpose)
*
* Each svs bank has its own independent phase and we enable each svs bank by
* running their phase orderly. However, when svs bank encounters unexpected
* condition, it will fire an irq (PHASE_ERROR) to inform svs software.
*
* svs bank general phase-enabled order:
* SVSB_PHASE_INIT01 -> SVSB_PHASE_INIT02 -> SVSB_PHASE_MON
*/
enum svsb_phase {
SVSB_PHASE_ERROR = 0,
SVSB_PHASE_INIT01,
SVSB_PHASE_INIT02,
SVSB_PHASE_MON,
SVSB_PHASE_MAX,
};
enum svs_reg_index {
DESCHAR = 0,
TEMPCHAR,
DETCHAR,
AGECHAR,
DCCONFIG,
AGECONFIG,
FREQPCT30,
FREQPCT74,
LIMITVALS,
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bits.h`, `linux/clk.h`, `linux/completion.h`, `linux/cleanup.h`, `linux/cpu.h`, `linux/cpuidle.h`, `linux/debugfs.h`.
- Detected declarations: `struct svs_fusemap`, `struct svs_platform`, `struct svs_platform_data`, `struct svs_bank_pdata`, `struct svs_bank`, `struct svs_dentry`, `enum svsb_sw_id`, `enum svsb_type`, `enum svsb_phase`, `enum svs_reg_index`.
- Atlas domain: Driver Families / drivers/soc.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.