Skip to content

Commit

Permalink
mali: gpu boost on touch
Browse files Browse the repository at this point in the history
  • Loading branch information
gokhanmoral committed Oct 11, 2012
1 parent ab64964 commit 42edc86
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 8 deletions.
8 changes: 4 additions & 4 deletions arch/arm/mach-exynos/include/mach/midas-tsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ int is_melfas_vdd_on(void);
int melfas_mux_fw_flash(bool to_gpios);
void midas_tsp_set_lcdtype(int lcd_type);

#ifdef CONFIG_CPU_FREQ_GOV_ONDEMAND_FLEXRATE
//#ifdef CONFIG_CPU_FREQ_GOV_ONDEMAND_FLEXRATE
extern void midas_tsp_request_qos(void *data);
#else
#define midas_tsp_request_qos NULL
#endif
//#else
//#define midas_tsp_request_qos NULL
//#endif

#endif /* __MIDAS_TSP_H */
11 changes: 9 additions & 2 deletions arch/arm/mach-exynos/midas-tsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2247,6 +2247,8 @@ static void flexrate_work(struct work_struct *work)
{
cpufreq_ondemand_flexrate_request(10000, 10);
}
static DECLARE_WORK(flex_work, flexrate_work);
#endif

#include <linux/pm_qos_params.h>
static struct pm_qos_request_list busfreq_qos;
Expand All @@ -2255,13 +2257,16 @@ static void flexrate_qos_cancel(struct work_struct *work)
pm_qos_update_request(&busfreq_qos, 0);
}

static DECLARE_WORK(flex_work, flexrate_work);
static DECLARE_DELAYED_WORK(busqos_work, flexrate_qos_cancel);

extern void gpu_boost_on_touch(void);
extern void new_gpu_boost_on_touch(void);
void midas_tsp_request_qos(void *data)
{
#ifdef CONFIG_CPU_FREQ_GOV_ONDEMAND_FLEXRATE
if (!work_pending(&flex_work))
schedule_work_on(0, &flex_work);
#endif

/* Guarantee that the bus runs at >= 266MHz */
if (!pm_qos_request_active(&busfreq_qos))
Expand All @@ -2272,7 +2277,9 @@ void midas_tsp_request_qos(void *data)
pm_qos_update_request(&busfreq_qos, 266000);
}

SAMSUNGROM gpu_boost_on_touch();
else new_gpu_boost_on_touch();

/* Cancel the QoS request after 1/10 sec */
schedule_delayed_work_on(0, &busqos_work, HZ / 5);
}
#endif
2 changes: 2 additions & 0 deletions drivers/input/keyboard/cypress/cypress-touchkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <linux/i2c/mxt224_u1.h>
#endif
#include <linux/i2c/touchkey_i2c.h>
#include <mach/midas-tsp.h>

/* M0 Touchkey temporary setting */

Expand Down Expand Up @@ -722,6 +723,7 @@ AOSPROM {
}
}
}
midas_tsp_request_qos(NULL);
} else {
AOSPROM {
// touch led timeout on keyup
Expand Down
2 changes: 2 additions & 0 deletions drivers/input/touchscreen/mms_ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

#include <asm/unaligned.h>
#include "../keyboard/cypress/cypress-touchkey.h"
#include <mach/midas-tsp.h>

#define MAX_FINGERS 10
#define MAX_WIDTH 30
Expand Down Expand Up @@ -741,6 +742,7 @@ static irqreturn_t mms_ts_interrupt(int irq, void *dev_id)
}

#if TOUCH_BOOSTER
if(!!touch_is_pressed) midas_tsp_request_qos(NULL);
set_dvfs_lock(info, !!touch_is_pressed);
#endif
out:
Expand Down
4 changes: 4 additions & 0 deletions drivers/media/video/samsung/mali/linux/mali_kernel_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ module_param(gpu_power_state, int, S_IRUSR | S_IRGRP | S_IROTH); /* r--r--r-- */
MODULE_PARM_DESC(gpu_power_state, "Mali Power State");
extern _mali_device_power_states mali_dvfs_device_state;

int mali_touch_boost_level = 0;
module_param(mali_touch_boost_level, int, S_IRUSR | S_IWUSR | S_IWGRP | S_IRGRP | S_IROTH); /* rw--rw--r-- */
MODULE_PARM_DESC(mali_touch_boost_level, "Mali Touch Boost Level");

static char mali_dev_name[] = "mali"; /* should be const, but the functions we call requires non-cost */

/* the mali device */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,28 +132,35 @@ int mali_regulator_get_usecount(void)
return rdev->use_count;
}

static DEFINE_MUTEX(boostpop_mutex);
void mali_regulator_disable(void)
{
bPoweroff = 1;
mutex_lock(&boostpop_mutex);
if( IS_ERR_OR_NULL(g3d_regulator) )
{
mutex_unlock(&boostpop_mutex);
MALI_DEBUG_PRINT(1, ("error on mali_regulator_disable : g3d_regulator is null\n"));
return;
}
regulator_disable(g3d_regulator);
MALI_DEBUG_PRINT(1, ("regulator_disable -> use cnt: %d \n",mali_regulator_get_usecount()));
bPoweroff = 1;
mutex_unlock(&boostpop_mutex);
}

void mali_regulator_enable(void)
{
bPoweroff = 0;
mutex_lock(&boostpop_mutex);
if( IS_ERR_OR_NULL(g3d_regulator) )
{
mutex_unlock(&boostpop_mutex);
MALI_DEBUG_PRINT(1, ("error on mali_regulator_enable : g3d_regulator is null\n"));
return;
}
regulator_enable(g3d_regulator);
MALI_DEBUG_PRINT(1, ("regulator_enable -> use cnt: %d \n",mali_regulator_get_usecount()));
bPoweroff = 0;
mutex_unlock(&boostpop_mutex);
}

void mali_regulator_set_voltage(int min_uV, int max_uV)
Expand Down Expand Up @@ -519,6 +526,37 @@ static mali_bool deinit_mali_clock(void)

return MALI_TRUE;
}
extern int mali_touch_boost_level;
static int is_gpu_boosted = 0;
static struct timer_list boostpop_timer;
static void boostpop(struct work_struct *boostpop_work)
{
mutex_lock(&boostpop_mutex);
mali_dvfs_bottom_lock_pop();
is_gpu_boosted = 0;
mutex_unlock(&boostpop_mutex);
}
static DECLARE_WORK(boostpop_work, boostpop);

static void handle_boostpop(unsigned long data)
{
schedule_work(&boostpop_work);
}


void gpu_boost_on_touch(void)
{
if(!mali_touch_boost_level) return;
mutex_lock(&boostpop_mutex);
if(!is_gpu_boosted && !bPoweroff)
{
mali_dvfs_bottom_lock_push(mali_touch_boost_level);
is_gpu_boosted = 1;
}
mutex_unlock(&boostpop_mutex);
mod_timer(&boostpop_timer, jiffies + msecs_to_jiffies(1000));
}

static _mali_osk_errcode_t enable_mali_clocks(void)
{
int err;
Expand Down Expand Up @@ -642,6 +680,7 @@ _mali_osk_errcode_t mali_platform_init()
if(!init_mali_dvfs_status(MALI_DVFS_DEFAULT_STEP))
MALI_DEBUG_PRINT(1, ("mali_platform_init failed\n"));
#endif
setup_timer(&boostpop_timer, handle_boostpop, 0);

MALI_SUCCESS;
}
Expand All @@ -660,6 +699,7 @@ _mali_osk_errcode_t mali_platform_deinit()
clk_register_map=0;
}
#endif
del_timer(&boostpop_timer);

MALI_SUCCESS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
#define change_dvfs_tableset new_change_dvfs_tableset
#define maliDvfsStatus new_maliDvfsStatus
#define mali_dvfs_control new_mali_dvfs_control
#define gpu_boost_on_touch new_gpu_boost_on_touch

#ifndef __MALI_OSK_H__
#define __MALI_OSK_H__
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,28 +140,35 @@ int mali_regulator_get_usecount(void)
return rdev->use_count;
}

static DEFINE_MUTEX(boostpop_mutex);
void mali_regulator_disable(void)
{
mutex_lock(&boostpop_mutex);
if( IS_ERR_OR_NULL(g3d_regulator) )
{
mutex_unlock(&boostpop_mutex);
MALI_DEBUG_PRINT(1, ("error on mali_regulator_disable : g3d_regulator is null\n"));
return;
}
regulator_disable(g3d_regulator);
MALI_DEBUG_PRINT(1, ("regulator_disable -> use cnt: %d \n",mali_regulator_get_usecount()));
bPoweroff = 1;
mutex_unlock(&boostpop_mutex);
}

void mali_regulator_enable(void)
{
mutex_lock(&boostpop_mutex);
if( IS_ERR_OR_NULL(g3d_regulator) )
{
mutex_unlock(&boostpop_mutex);
MALI_DEBUG_PRINT(1, ("error on mali_regulator_enable : g3d_regulator is null\n"));
return;
}
regulator_enable(g3d_regulator);
MALI_DEBUG_PRINT(1, ("regulator_enable -> use cnt: %d \n",mali_regulator_get_usecount()));
bPoweroff = 0;
mutex_unlock(&boostpop_mutex);
}

void mali_regulator_set_voltage(int min_uV, int max_uV)
Expand Down Expand Up @@ -527,6 +534,37 @@ static mali_bool deinit_mali_clock(void)

return MALI_TRUE;
}
extern int mali_touch_boost_level;
static int is_gpu_boosted = 0;
static struct timer_list boostpop_timer;
static void boostpop(struct work_struct *boostpop_work)
{
mutex_lock(&boostpop_mutex);
mali_dvfs_bottom_lock_pop();
is_gpu_boosted = 0;
mutex_unlock(&boostpop_mutex);
}
static DECLARE_WORK(boostpop_work, boostpop);

static void handle_boostpop(unsigned long data)
{
schedule_work(&boostpop_work);
}


void gpu_boost_on_touch(void)
{
if(!mali_touch_boost_level) return;
mutex_lock(&boostpop_mutex);
if(!is_gpu_boosted && !bPoweroff)
{
mali_dvfs_bottom_lock_push(mali_touch_boost_level);
is_gpu_boosted = 1;
}
mutex_unlock(&boostpop_mutex);
mod_timer(&boostpop_timer, jiffies + msecs_to_jiffies(1000));
}

static _mali_osk_errcode_t enable_mali_clocks(void)
{
int err;
Expand Down Expand Up @@ -649,6 +687,7 @@ _mali_osk_errcode_t mali_platform_init()
if(!init_mali_dvfs_status(MALI_DVFS_DEFAULT_STEP))
MALI_DEBUG_PRINT(1, ("mali_platform_init failed\n"));
#endif
setup_timer(&boostpop_timer, handle_boostpop, 0);

MALI_SUCCESS;
}
Expand All @@ -667,6 +706,7 @@ _mali_osk_errcode_t mali_platform_deinit()
clk_register_map=0;
}
#endif
del_timer(&boostpop_timer);

MALI_SUCCESS;
}
Expand Down

0 comments on commit 42edc86

Please sign in to comment.