?? jz_dpm.h
字號:
/* * include/asm-mips/jzsoc/jz_dpm.h JzSOC-specific definitions for DPM * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Copyright (C) 2002, MontaVista Software <source@mvista.com> * * Adapted for JzSOC by Ingenic * Copyright (c) 2005 Ingenic IC Inc. * */#ifndef __ASM_JZSOC_DPM_H__#define __ASM_JZSOC_DPM_H__/* * machine dependent operating state * * An operating state is a cpu execution state that has implications for power * management. The DPM will select operating points based largely on the * current operating state. * * DPM_STATES is the number of supported operating states. Valid operating * states are from 0 to DPM_STATES-1 but when setting an operating state the * kernel should only specify a state from the set of "base states" and should * do so by name. During the context switch the new operating state is simply * extracted from current->dpm_state. * * task states: * * APIs that reference task states use the range -(DPM_TASK_STATE_LIMIT + 1) * through +DPM_TASK_STATE_LIMIT. This value is added to DPM_TASK_STATE to * obtain the downward or upward adjusted task state value. The * -(DPM_TASK_STATE_LIMIT + 1) value is interpreted specially, and equates to * DPM_NO_STATE. * * Tasks inherit their task operating states across calls to * fork(). DPM_TASK_STATE is the default operating state for all tasks, and is * inherited from init. Tasks can change (or have changed) their tasks states * using the DPM_SET_TASK_STATE variant of the sys_dpm() system call. */#define DPM_NO_STATE -1#define DPM_RELOCK_STATE 0#define DPM_IDLE_TASK_STATE 1#define DPM_IDLE_STATE 2#define DPM_SLEEP_STATE 3#define DPM_BASE_STATES 4#define DPM_TASK_STATE_LIMIT 4#define DPM_TASK_STATE (DPM_BASE_STATES + DPM_TASK_STATE_LIMIT)#define DPM_STATES (DPM_TASK_STATE + DPM_TASK_STATE_LIMIT + 1)#define DPM_TASK_STATES (DPM_STATES - DPM_BASE_STATES)#define DPM_STATE_NAMES \{ "relock", "idle-task", "idle", "sleep",\ "task-4", "task-3", "task-2", "task-1",\ "task", \ "task+1", "task+2", "task+3", "task+4" \}/* MD operating point parameters */#define DPM_MD_V 0 #define DPM_MD_PLL_NF 1 /* PLL freq: feedback div */#define DPM_MD_PLL_NR 2 /* PLL freq: input div */#define DPM_MD_PLL_NO 3 /* PLL freq: output div */#define DPM_MD_ICLK_DIV 4 /* ICLK division */#define DPM_MD_SCLK_DIV 5 /* SCLK division */#define DPM_MD_MCLK_DIV 6 /* MCLK division */#define DPM_MD_PCLK_DIV 7 /* PCLK division */#define DPM_PP_NBR 8#ifdef __KERNEL__#ifndef __ASSEMBLER__#include <linux/types.h>#include <linux/proc_fs.h>#include <asm/preem_latency.h>#define DPM_MD_STATStypedef __u64 dpm_md_count_t;typedef __u64 dpm_md_time_t;#if 0#define dpm_md_time() ~((unsigned long)REG32(TMU_TCNT2))/* mputimer 1 runs @ 6Mhz 6 ticks = 1 microsecond */#define DPM_MD_HZ 6 * 1000000/* Hardcode this for now. */#define tb_ticks_per_second DPM_MD_HZ #else// FIXME: Hardcode dummy for now, and maybe should support for JzSOC later#define dpm_md_time() 1#define DPM_MD_HZ 1000000#define tb_ticks_per_second DPM_MD_HZ#endif/* Disable *all* asynchronous interrupts for a super-critical section. Must occur in pairs. This is necessarily done this way because RT Linux hacks break the symmetry of save/restore flags. */#define critical_save_and_cli(flags) save_and_cli(flags)#define critical_restore_flags(flags) restore_flags(flags)/* * This contains the registers value for an operating point. * If only part of a register needs to change then there is * a mask value for that register. * When going to a new operating point the current register * value is ANDed with the ~mask and ORed with the new value. */struct dpm_regs { u32 cfcr; /* Clock Freq Control Register */ u32 cfcr_mask; /* Clock Freq Control Register mask */ u32 cfcr2; /* Clock Freq Control Register 2 */ u32 cfcr2_mask; /* Clock Freq Control Register 2 mask */ u32 plcr1; /* PLL1 Control Register */ u32 plcr1_mask; /* PLL1 Control Register mask */ u32 pll_up_flag; /* New PLL freq is higher than current or not */};/* Instances of this structure define valid Innovator operating points for DPM. Voltages are represented in mV, and frequencies are represented in KHz. */ struct dpm_md_opt { unsigned int v; /* Target voltage in mV */ unsigned int pll; /* PLL output frequency in Hz */ unsigned int cpu; /* CPU frequency in Hz */ unsigned int sys; unsigned int mem; unsigned int per; unsigned int lpj; /* New value for loops_per_jiffy */ struct dpm_regs regs; /* Register values */};void dpm_jz_board_setup(void);typedef void (*dpm_fscaler)(struct dpm_regs *regs);#define basic_idle(parms) jz_pm_idle()/* Machine-dependent operating point creating/query/setting */#endif /* __ASSEMBLER__ */#endif /* __KERNEL__ */#endif /* __ASM_JZSOC_DPM_H__ */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -