arch/mips/loongson2ef/lemote-2f/clock.c
Source file repositories/reference/linux-study-clean/arch/mips/loongson2ef/lemote-2f/clock.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/loongson2ef/lemote-2f/clock.c- Extension
.c- Size
- 1311 bytes
- Lines
- 52
- Domain
- Architecture Layer
- Bucket
- arch/mips
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cpufreq.hlinux/errno.hlinux/export.hasm/mach-loongson2ef/loongson.h
Detected Declarations
function loongson2_cpu_set_rateexport loongson2_clockmod_tableexport loongson2_cpu_set_rate
Annotated Snippet
#include <linux/cpufreq.h>
#include <linux/errno.h>
#include <linux/export.h>
#include <asm/mach-loongson2ef/loongson.h>
enum {
DC_ZERO, DC_25PT = 2, DC_37PT, DC_50PT, DC_62PT, DC_75PT,
DC_87PT, DC_DISABLE, DC_RESV
};
struct cpufreq_frequency_table loongson2_clockmod_table[] = {
{0, DC_RESV, CPUFREQ_ENTRY_INVALID},
{0, DC_ZERO, CPUFREQ_ENTRY_INVALID},
{0, DC_25PT, 0},
{0, DC_37PT, 0},
{0, DC_50PT, 0},
{0, DC_62PT, 0},
{0, DC_75PT, 0},
{0, DC_87PT, 0},
{0, DC_DISABLE, 0},
{0, DC_RESV, CPUFREQ_TABLE_END},
};
EXPORT_SYMBOL_GPL(loongson2_clockmod_table);
int loongson2_cpu_set_rate(unsigned long rate_khz)
{
struct cpufreq_frequency_table *pos;
int regval;
cpufreq_for_each_valid_entry(pos, loongson2_clockmod_table)
if (rate_khz == pos->frequency)
break;
if (rate_khz != pos->frequency)
return -ENOTSUPP;
regval = readl(LOONGSON_CHIPCFG);
regval = (regval & ~0x7) | (pos->driver_data - 1);
writel(regval, LOONGSON_CHIPCFG);
return 0;
}
EXPORT_SYMBOL_GPL(loongson2_cpu_set_rate);
Annotation
- Immediate include surface: `linux/cpufreq.h`, `linux/errno.h`, `linux/export.h`, `asm/mach-loongson2ef/loongson.h`.
- Detected declarations: `function loongson2_cpu_set_rate`, `export loongson2_clockmod_table`, `export loongson2_cpu_set_rate`.
- Atlas domain: Architecture Layer / arch/mips.
- Implementation status: integration 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.