Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

dvfs_core.c File Reference


Detailed Description

A simplied driver for the Freescale Semiconductor MXC DVFS module.

Upon initialization, the DVFS driver initializes the DVFS hardware sets up driver nodes attaches to the DVFS interrupt and initializes internal data structures. When the DVFS interrupt occurs the driver checks the cause of the interrupt (lower frequency, increase frequency or emergency) and changes the CPU voltage according to translation table that is loaded into the driver.

Definition in file dvfs_core.c.

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/fs.h>
#include <linux/interrupt.h>
#include <linux/jiffies.h>
#include <linux/device.h>
#include <linux/sysdev.h>
#include <linux/delay.h>
#include <linux/clk.h>
#include <linux/regulator/consumer.h>
#include <linux/input.h>
#include <linux/platform_device.h>
#include <linux/cpufreq.h>
#include <mach/hardware.h>
#include <mach/mxc_dvfs.h>

Go to the source code of this file.

Defines

#define DVFS_LTBRSR   (2 << MXC_DVFSCNTR_LTBRSR_OFFSET)
#define MXC_DVFSCNTR_DVFEN   0x00000001
#define MXC_DVFSCNTR_DVFEV   0x10000000
#define MXC_DVFSCNTR_DVFIS   0x01000000
#define MXC_DVFSCNTR_FSVAI_MASK   0x00300000
#define MXC_DVFSCNTR_FSVAI_OFFSET   20
#define MXC_DVFSCNTR_FSVAIM   0x00400000
#define MXC_DVFSCNTR_LBFL   0x06000000
#define MXC_DVFSCNTR_LBMI   0x08000000
#define MXC_DVFSCNTR_LTBRSR_MASK   0x00000018
#define MXC_DVFSCNTR_LTBRSR_OFFSET   3
#define MXC_DVFSCNTR_MAXF_MASK   0x00040000
#define MXC_DVFSCNTR_MAXF_OFFSET   18
#define MXC_DVFSCNTR_MINF_MASK   0x00020000
#define MXC_DVFSCNTR_MINF_OFFSET   17
#define MXC_DVFSCNTR_WFIM   0x00080000
#define MXC_DVFSCNTR_WFIM_OFFSET   19
#define MXC_DVFSCOUN_DNCNT_MASK   0x00FF0000
#define MXC_DVFSCOUN_DNCNT_OFFSET   16
#define MXC_DVFSCOUN_UPCNT_MASK   0x000000FF
#define MXC_DVFSCOUN_UPCNT_OFFSET   0
#define MXC_DVFSEMAC_EMAC_MASK   0x000001FF
#define MXC_DVFSEMAC_EMAC_OFFSET   0
#define MXC_DVFSTHRS_DNTHR_MASK   0x003F0000
#define MXC_DVFSTHRS_DNTHR_OFFSET   16
#define MXC_DVFSTHRS_PNCTHR_MASK   0x0000003F
#define MXC_DVFSTHRS_PNCTHR_OFFSET   0
#define MXC_DVFSTHRS_UPTHR_MASK   0x0FC00000
#define MXC_DVFSTHRS_UPTHR_OFFSET   22

Enumerations

enum  { FSVAI_FREQ_NOCHANGE = 0x0, FSVAI_FREQ_INCREASE, FSVAI_FREQ_DECREASE, FSVAI_FREQ_EMERG }

Functions

 DEFINE_SPINLOCK (mxc_dvfs_core_lock)
static DEVICE_ATTR (down_count, 0644, downcount_show, downcount_store)
static DEVICE_ATTR (down_threshold, 0644, downthreshold_show, downthreshold_store)
static DEVICE_ATTR (show_regs, 0644, dvfs_regs_show, dvfs_regs_store)
static DEVICE_ATTR (enable, 0644, dvfs_enable_show, dvfs_enable_store)
static ssize_t downcount_show (struct device *dev, struct device_attribute *attr, char *buf)
static ssize_t downcount_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
static ssize_t downthreshold_show (struct device *dev, struct device_attribute *attr, char *buf)
static ssize_t downthreshold_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
void dump_dvfs_core_regs (void)
static void __exit dvfs_cleanup (void)
static void dvfs_core_work_handler (struct work_struct *work)
static ssize_t dvfs_enable_show (struct device *dev, struct device_attribute *attr, char *buf)
static ssize_t dvfs_enable_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
static int __init dvfs_init (void)
static irqreturn_t dvfs_irq (int irq, void *dev_id)
static void dvfs_load_config (int set_point)
static ssize_t dvfs_regs_show (struct device *dev, struct device_attribute *attr, char *buf)
static ssize_t dvfs_regs_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
static int init_dvfs_controller (void)
int low_freq_bus_used (void)
 MODULE_AUTHOR ("Freescale Semiconductor, Inc.")
 MODULE_DESCRIPTION ("DVFS driver")
 module_exit (dvfs_cleanup)
 module_init (dvfs_init)
 MODULE_LICENSE ("GPL")
static int __devinit mxc_dvfs_core_probe (struct platform_device *pdev)
static int mxc_dvfs_core_resume (struct platform_device *pdev)
static int mxc_dvfs_core_suspend (struct platform_device *pdev, pm_message_t state)
void propagate_rate (struct clk *tclk)
static int set_cpu_freq (int wp)
int set_high_bus_freq (int high_bus_speed)
int set_low_bus_freq (void)
void setup_pll (void)
static int start_dvfs (void)
static void stop_dvfs (void)

Variables

struct timeval core_prev_intr
static struct regulator * core_regulator
static struct clk * cpu_clk
int cpu_wp_nr
static struct cpu_wp * cpu_wp_tbl
int cpufreq_trig_needed
int curr_wp
static struct clk * dvfs_clk
static struct delayed_work dvfs_core_handler
int dvfs_core_is_active
int dvfs_core_resume
struct dvfs_wp dvfs_core_setpoint [2]
static struct
mxc_dvfs_platform_data * 
dvfs_data
static struct device * dvfs_dev
int high_bus_freq_mode
int low_bus_freq_mode
static struct platform_driver mxc_dvfs_core_driver
int old_wp
static struct clk * pll1_sw_clk


Generated by  Doxygen 1.6.0   Back to index