aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/samsung/mali/platform/pegasus-m400/mali_platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/samsung/mali/platform/pegasus-m400/mali_platform.c')
-rw-r--r--drivers/media/video/samsung/mali/platform/pegasus-m400/mali_platform.c118
1 files changed, 87 insertions, 31 deletions
diff --git a/drivers/media/video/samsung/mali/platform/pegasus-m400/mali_platform.c b/drivers/media/video/samsung/mali/platform/pegasus-m400/mali_platform.c
index 397ba942..e8e5129 100644
--- a/drivers/media/video/samsung/mali/platform/pegasus-m400/mali_platform.c
+++ b/drivers/media/video/samsung/mali/platform/pegasus-m400/mali_platform.c
@@ -1,5 +1,4 @@
-/*
- * Copyright (C) 2010 ARM Limited. All rights reserved.
+/* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
@@ -19,7 +18,7 @@
#include "mali_linux_pm.h"
#if USING_MALI_PMM
-#include "mali_pmm.h"
+#include "mali_pm.h"
#endif
#include <linux/clk.h>
@@ -32,8 +31,9 @@
#include <plat/pd.h>
#endif
-#if MALI_TIMELINE_PROFILING_ENABLED
-#include "mali_kernel_profiling.h"
+#if MALI_INTERNAL_TIMELINE_PROFILING_ENABLED
+#include "mali_osk_profiling.h"
+#include "cinstr/mali_cinstr_profiling_events_m200.h"
#endif
#include <asm/io.h>
@@ -58,12 +58,20 @@ typedef struct mali_runtime_resumeTag{
int vol;
}mali_runtime_resume_table;
-mali_runtime_resume_table mali_runtime_resume = {266, 900000};
+mali_runtime_resume_table mali_runtime_resume = {350, 950000};
/* lock/unlock CPU freq by Mali */
extern int cpufreq_lock_by_mali(unsigned int freq);
extern void cpufreq_unlock_by_mali(void);
+/* start of modification by skkim */
+extern mali_bool init_mali_dvfs_status(int step);
+extern void deinit_mali_dvfs_status(void);
+extern mali_bool mali_dvfs_handler(u32 utilization);
+extern int get_mali_dvfs_control_status(void);
+extern mali_bool set_mali_dvfs_current_step(unsigned int step);
+/* end of modification by skkim */
+
static struct clk *ext_xtal_clock = 0;
static struct clk *vpll_src_clock = 0;
static struct clk *fout_vpll_clock = 0;
@@ -76,11 +84,11 @@ static struct clk *mali_clock = 0;
static unsigned int GPU_MHZ = 1000000;
-int mali_gpu_clk = 266;
-int mali_gpu_vol = 900000;
+int mali_gpu_clk = 350;
+int mali_gpu_vol = 950000;
#if MALI_DVFS_ENABLED
-#define MALI_DVFS_DEFAULT_STEP 0
+#define MALI_DVFS_DEFAULT_STEP 2
#endif
#if MALI_VOLTAGE_LOCK
int mali_lock_vol = 0;
@@ -134,7 +142,6 @@ int mali_regulator_get_usecount(void)
void mali_regulator_disable(void)
{
- bPoweroff = 1;
if( IS_ERR_OR_NULL(g3d_regulator) )
{
MALI_DEBUG_PRINT(1, ("error on mali_regulator_disable : g3d_regulator is null\n"));
@@ -142,11 +149,11 @@ void mali_regulator_disable(void)
}
regulator_disable(g3d_regulator);
MALI_DEBUG_PRINT(1, ("regulator_disable -> use cnt: %d \n",mali_regulator_get_usecount()));
+ bPoweroff = 1;
}
void mali_regulator_enable(void)
{
- bPoweroff = 0;
if( IS_ERR_OR_NULL(g3d_regulator) )
{
MALI_DEBUG_PRINT(1, ("error on mali_regulator_enable : g3d_regulator is null\n"));
@@ -154,6 +161,7 @@ void mali_regulator_enable(void)
}
regulator_enable(g3d_regulator);
MALI_DEBUG_PRINT(1, ("regulator_enable -> use cnt: %d \n",mali_regulator_get_usecount()));
+ bPoweroff = 0;
}
void mali_regulator_set_voltage(int min_uV, int max_uV)
@@ -196,8 +204,8 @@ void mali_regulator_set_voltage(int min_uV, int max_uV)
MALI_DEBUG_PRINT(2, ("= regulator_set_voltage: %d, %d \n",min_uV, max_uV));
-#if MALI_TIMELINE_PROFILING_ENABLED
- _mali_profiling_add_event( MALI_PROFILING_EVENT_TYPE_SINGLE |
+#if MALI_INTERNAL_TIMELINE_PROFILING_ENABLED
+ _mali_osk_profiling_add_event( MALI_PROFILING_EVENT_TYPE_SINGLE |
MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
MALI_PROFILING_EVENT_REASON_SINGLE_SW_GPU_VOLTS,
min_uV, max_uV, 1, 0, 0);
@@ -206,8 +214,8 @@ void mali_regulator_set_voltage(int min_uV, int max_uV)
regulator_set_voltage(g3d_regulator,min_uV,max_uV);
voltage = regulator_get_voltage(g3d_regulator);
-#if MALI_TIMELINE_PROFILING_ENABLED
- _mali_profiling_add_event( MALI_PROFILING_EVENT_TYPE_SINGLE |
+#if MALI_INTERNAL_TIMELINE_PROFILING_ENABLED
+ _mali_osk_profiling_add_event( MALI_PROFILING_EVENT_TYPE_SINGLE |
MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
MALI_PROFILING_EVENT_REASON_SINGLE_SW_GPU_VOLTS,
voltage, 0, 2, 0, 0);
@@ -398,18 +406,20 @@ mali_bool mali_clk_set_rate(unsigned int clk, unsigned int mhz)
if (clk_enable(mali_clock) < 0)
return MALI_FALSE;
-#if MALI_TIMELINE_PROFILING_ENABLED
- _mali_profiling_add_event( MALI_PROFILING_EVENT_TYPE_SINGLE |
+#if MALI_INTERNAL_TIMELINE_PROFILING_ENABLED
+ unsigned long previous_rate = 0;
+ previous_rate = clk_get_rate(mali_clock);
+ _mali_osk_profiling_add_event( MALI_PROFILING_EVENT_TYPE_SINGLE |
MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
MALI_PROFILING_EVENT_REASON_SINGLE_SW_GPU_FREQ,
- rate, 0, 0, 0, 0);
+ previous_rate, 0, 0, 0, 0);
#endif
clk_set_rate(mali_clock, rate);
rate = clk_get_rate(mali_clock);
-#if MALI_TIMELINE_PROFILING_ENABLED
- _mali_profiling_add_event( MALI_PROFILING_EVENT_TYPE_SINGLE |
+#if MALI_INTERNAL_TIMELINE_PROFILING_ENABLED
+ _mali_osk_profiling_add_event( MALI_PROFILING_EVENT_TYPE_SINGLE |
MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
MALI_PROFILING_EVENT_REASON_SINGLE_SW_GPU_FREQ,
rate, 1, 0, 0, 0);
@@ -434,8 +444,6 @@ static mali_bool init_mali_clock(void)
{
mali_bool ret = MALI_TRUE;
- gpu_power_state = 0;
-
if (mali_clock != 0)
return ret; // already initialized
@@ -475,15 +483,15 @@ static mali_bool init_mali_clock(void)
MALI_DEBUG_PRINT(2, ("MALI Clock is set at mali driver\n"));
-
MALI_DEBUG_PRINT(3,("::clk_put:: %s mali_parent_clock - normal\n", __FUNCTION__));
MALI_DEBUG_PRINT(3,("::clk_put:: %s mpll_clock - normal\n", __FUNCTION__));
mali_clk_put(MALI_FALSE);
- return MALI_TRUE;
-
+ gpu_power_state=0;
+ bPoweroff=1;
+ return MALI_TRUE;
#ifdef CONFIG_REGULATOR
err_regulator:
regulator_put(g3d_regulator);
@@ -526,12 +534,13 @@ static _mali_osk_errcode_t enable_mali_clocks(void)
else {
mali_regulator_set_voltage(mali_runtime_resume.vol, mali_runtime_resume.vol);
mali_clk_set_rate(mali_runtime_resume.clk, GPU_MHZ);
+ set_mali_dvfs_current_step(MALI_DVFS_DEFAULT_STEP);
}
- if (mali_gpu_clk <= mali_runtime_resume.clk)
- set_mali_dvfs_current_step(5);
+#if CPUFREQ_LOCK_DURING_440
/* lock/unlock CPU freq by Mali */
if (mali_gpu_clk == 440)
err = cpufreq_lock_by_mali(1200);
+#endif
#else
mali_regulator_set_voltage(mali_runtime_resume.vol, mali_runtime_resume.vol);
mali_clk_set_rate(mali_runtime_resume.clk, GPU_MHZ);
@@ -547,8 +556,10 @@ static _mali_osk_errcode_t disable_mali_clocks(void)
clk_disable(mali_clock);
MALI_DEBUG_PRINT(3,("disable_mali_clocks mali_clock %p \n", mali_clock));
+#if MALI_DVFS_ENABLED
/* lock/unlock CPU freq by Mali */
cpufreq_unlock_by_mali();
+#endif
MALI_SUCCESS;
}
@@ -569,7 +580,7 @@ _mali_osk_errcode_t g3d_power_domain_control(int bpower_on)
{
#if MALI_PMM_RUNTIME_JOB_CONTROL_ON
MALI_DEBUG_PRINT(3,("_mali_osk_pmm_dev_activate \n"));
- _mali_osk_pmm_dev_activate();
+ _mali_osk_pm_dev_activate();
#else //MALI_PMM_RUNTIME_JOB_CONTROL_ON
void __iomem *status;
u32 timeout;
@@ -586,14 +597,14 @@ _mali_osk_errcode_t g3d_power_domain_control(int bpower_on)
timeout--;
_mali_osk_time_ubusydelay(100);
}
+ MALI_PRINTF(("MALI Power domain enabled"));
#endif //MALI_PMM_RUNTIME_JOB_CONTROL_ON
}
else
{
#if MALI_PMM_RUNTIME_JOB_CONTROL_ON
MALI_DEBUG_PRINT( 4,("_mali_osk_pmm_dev_idle\n"));
- _mali_osk_pmm_dev_idle();
-
+ _mali_osk_pm_dev_idle();
#else //MALI_PMM_RUNTIME_JOB_CONTROL_ON
void __iomem *status;
u32 timeout;
@@ -611,6 +622,7 @@ _mali_osk_errcode_t g3d_power_domain_control(int bpower_on)
timeout--;
_mali_osk_time_ubusydelay( 100);
}
+ MALI_PRINTF(("MALI Power domain disabled"));
#endif //MALI_PMM_RUNTIME_JOB_CONTROL_ON
}
@@ -714,7 +726,51 @@ u32 pmu_get_power_up_down_info(void)
_mali_osk_errcode_t mali_platform_power_mode_change(mali_power_mode power_mode)
{
- MALI_SUCCESS;
+ switch (power_mode)
+ {
+ case MALI_POWER_MODE_ON:
+ MALI_DEBUG_PRINT(1, ("Mali platform: Got MALI_POWER_MODE_ON event, %s\n", bPoweroff ? "powering on" : "already on"));
+ if (bPoweroff == 1)
+ {
+ /** If run time power management is used, donot call this function */
+#ifndef CONFIG_PM_RUNTIME
+ g3d_power_domain_control(1);
+#endif
+
+ MALI_DEBUG_PRINT(4,("enable clock \n"));
+ enable_mali_clocks();
+#if MALI_INTERNAL_TIMELINE_PROFILING_ENABLED
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE| MALI_PROFILING_EVENT_CHANNEL_GPU|MALI_PROFILING_EVENT_REASON_SINGLE_GPU_FREQ_VOLT_CHANGE, mali_gpu_clk, mali_gpu_vol/1000, 0, 0, 0);
+#endif
+ //MALI_PRINTF(("Mali Platform powered up"));
+ gpu_power_state=1;
+ bPoweroff=0;
+ }
+ break;
+ case MALI_POWER_MODE_LIGHT_SLEEP:
+ case MALI_POWER_MODE_DEEP_SLEEP:
+ MALI_DEBUG_PRINT(1, ("Mali platform: Got %s event, %s\n",
+ power_mode == MALI_POWER_MODE_LIGHT_SLEEP ? "MALI_POWER_MODE_LIGHT_SLEEP" : "MALI_POWER_MODE_DEEP_SLEEP",
+ bPoweroff ? "already off" : "powering off"));
+ if (bPoweroff == 0)
+ {
+ disable_mali_clocks();
+#if MALI_INTERNAL_TIMELINE_PROFILING_ENABLED
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE| MALI_PROFILING_EVENT_CHANNEL_GPU|MALI_PROFILING_EVENT_REASON_SINGLE_GPU_FREQ_VOLT_CHANGE, 0, 0, 0, 0, 0);
+#endif
+
+#ifndef CONFIG_PM_RUNTIME
+ g3d_power_domain_control(0);
+#endif
+
+ //MALI_PRINTF(("Mali Platform powered down"));
+ gpu_power_state=0;
+ bPoweroff=1;
+ }
+
+ break;
+ }
+ MALI_SUCCESS;
}
#if MALI_VOLTAGE_LOCK