gpu: update gcdENABLE_AUTO_FREQ

This commit is contained in:
杜坤明 2011-06-09 10:54:52 +08:00
parent 7b1cd94ff4
commit 3f7149b60d
4 changed files with 46 additions and 11 deletions

View File

@ -1258,6 +1258,8 @@ static struct platform_device rk29sdk_rfkill = {
#ifdef CONFIG_VIVANTE
#define GPU_HIGH_CLOCK 552
#define GPU_LOW_CLOCK 300
static struct resource resources_gpu[] = {
[0] = {
.name = "gpu_irq",
@ -1266,17 +1268,23 @@ static struct resource resources_gpu[] = {
.flags = IORESOURCE_IRQ,
},
[1] = {
.name = "gpu_base",
.name = "gpu_base",
.start = RK29_GPU_PHYS,
.end = RK29_GPU_PHYS + RK29_GPU_SIZE,
.flags = IORESOURCE_MEM,
},
[2] = {
.name = "gpu_mem",
.name = "gpu_mem",
.start = PMEM_GPU_BASE,
.end = PMEM_GPU_BASE + PMEM_GPU_SIZE,
.flags = IORESOURCE_MEM,
},
[3] = {
.name = "gpu_clk",
.start = GPU_LOW_CLOCK,
.end = GPU_HIGH_CLOCK,
.flags = IORESOURCE_IO,
},
};
static struct platform_device rk29_device_gpu = {
.name = "galcore",
@ -1285,6 +1293,7 @@ static struct platform_device rk29_device_gpu = {
.resource = resources_gpu,
};
#endif
#ifdef CONFIG_KEYS_RK29
extern struct rk29_keys_platform_data rk29_keys_pdata;
static struct platform_device rk29_device_keys = {

View File

@ -1264,6 +1264,8 @@ static struct platform_device rk29sdk_rfkill = {
#ifdef CONFIG_VIVANTE
#define GPU_HIGH_CLOCK 552
#define GPU_LOW_CLOCK 300
static struct resource resources_gpu[] = {
[0] = {
.name = "gpu_irq",
@ -1272,17 +1274,23 @@ static struct resource resources_gpu[] = {
.flags = IORESOURCE_IRQ,
},
[1] = {
.name = "gpu_base",
.name = "gpu_base",
.start = RK29_GPU_PHYS,
.end = RK29_GPU_PHYS + RK29_GPU_SIZE,
.flags = IORESOURCE_MEM,
},
[2] = {
.name = "gpu_mem",
.name = "gpu_mem",
.start = PMEM_GPU_BASE,
.end = PMEM_GPU_BASE + PMEM_GPU_SIZE,
.flags = IORESOURCE_MEM,
},
[3] = {
.name = "gpu_clk",
.start = GPU_LOW_CLOCK,
.end = GPU_HIGH_CLOCK,
.flags = IORESOURCE_IO,
},
};
static struct platform_device rk29_device_gpu = {
.name = "galcore",
@ -1291,6 +1299,7 @@ static struct platform_device rk29_device_gpu = {
.resource = resources_gpu,
};
#endif
#ifdef CONFIG_KEYS_RK29
extern struct rk29_keys_platform_data rk29_keys_pdata;
static struct platform_device rk29_device_keys = {

View File

@ -96,18 +96,21 @@ inline void cal_run_idle(gceCHIPPOWERSTATE State)
gceCHIPPOWERSTATE lastState = gcvPOWER_IDLE;
int lasthighfreq = 0;
extern int needhighfreq;
extern int lowfreq;
extern int highfreq;
struct clk *clk_gpu = NULL;
inline void get_idle_change(gceCHIPPOWERSTATE State)
{
if(gcvPOWER_ON!=lastState && gcvPOWER_ON==State) //gcvPOWER_IDLE->gcvPOWER_ON
{
if(lasthighfreq != needhighfreq) {
int gpufreq = needhighfreq ? 552 : 360;
int gpufreq = needhighfreq ? highfreq : lowfreq;
if(gpufreq<24) gpufreq = 24;
if(gpufreq>600) gpufreq = 600;
clk_gpu = clk_get(NULL, "gpu");
clk_set_parent(clk_gpu, clk_get(NULL, "general_pll"));
clk_set_rate(clk_get(NULL, "codec_pll"), gpufreq*1000000);
clk_set_rate(clk_gpu, gpufreq*1000000);
clk_set_parent(clk_gpu, clk_get(NULL, "codec_pll"));
lasthighfreq = needhighfreq;
printk("gpu: change freq to %d \n", gpufreq);

View File

@ -244,6 +244,8 @@ void gputimer_callback(unsigned long arg)
#include <linux/timer.h>
struct timer_list gpu_timer;
int needhighfreq = 0;
int lowfreq = 300;
int highfreq = 552;
void mod_gpu_timer(void)
{
mod_timer(&gpu_timer, jiffies + 3*HZ);
@ -1042,14 +1044,14 @@ static int __devinit gpu_probe(struct platform_device *pdev)
{
int ret = -ENODEV;
struct resource *res;
res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,"gpu_irq");
res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "gpu_irq");
if (!res) {
printk(KERN_ERR "%s: No irq line supplied.\n",__FUNCTION__);
goto gpu_probe_fail;
}
irqLine = res->start;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,"gpu_base");
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gpu_base");
if (!res) {
printk(KERN_ERR "%s: No register base supplied.\n",__FUNCTION__);
goto gpu_probe_fail;
@ -1058,7 +1060,7 @@ static int __devinit gpu_probe(struct platform_device *pdev)
// dkm: ²»ÄÜ+1
registerMemSize = res->end - res->start;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,"gpu_mem");
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gpu_mem");
if (!res) {
printk(KERN_ERR "%s: No memory base supplied.\n",__FUNCTION__);
goto gpu_probe_fail;
@ -1067,6 +1069,18 @@ static int __devinit gpu_probe(struct platform_device *pdev)
// dkm: ²»ÄÜ+1
contiguousSize = res->end - res->start;
res = platform_get_resource_byname(pdev, IORESOURCE_IO, "gpu_clk");
if (!res) {
printk(KERN_ERR "%s: No gpu clk supplied, use default!\n", __FUNCTION__);
} else {
coreClock = res->end * 1000000;
// dkm: gcdENABLE_AUTO_FREQ
#if (2==gcdENABLE_AUTO_FREQ)
lowfreq = res->start;
highfreq = res->end;
#endif
}
// dkm: gcdENABLE_AUTO_FREQ
#if (1==gcdENABLE_AUTO_FREQ)
init_timer(&gpu_timer);