Skip to content

Commit

Permalink
Mali r5p0 ODROID build integration
Browse files Browse the repository at this point in the history
struct mali_gpu_device_data has changed, so update the mali_utgard.h
copy under mach-exynos. This was taken from drivers/gpu/arm/mali but
with the osk_types.h include removed.

Disable DVFS - I thought this was done previously? Have we been shipping
recent kernels with this option enabled?

Tweak mali_gpu_data to remove the DVFS-only utilization handler, and
no need to set utilization_interval to 1000, that is the default.

Readd odroid platform file but this time without the DVFS version.
Tweak mali_kernel_core.c and mali_pm.c like before to call into this.
  • Loading branch information
dsd committed Dec 19, 2014
1 parent 771df56 commit 7c87ebf
Show file tree
Hide file tree
Showing 10 changed files with 912 additions and 170 deletions.
1 change: 1 addition & 0 deletions arch/arm/configs/odroidu_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2729,6 +2729,7 @@ CONFIG_MALI400=y
# CONFIG_MALI400_DEBUG is not set
# CONFIG_MALI400_PROFILING is not set
# CONFIG_MALI400_UMP is not set
# CONFIG_MALI_DVFS is not set
# CONFIG_MALI400_POWER_PERFORMANCE_POLICY is not set
CONFIG_MALI_DMA_BUF_MAP_ON_ATTACH=y
# CONFIG_MALI_SHARED_INTERRUPTS is not set
Expand Down
1 change: 1 addition & 0 deletions arch/arm/configs/odroidx2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2578,6 +2578,7 @@ CONFIG_MALI400=y
# CONFIG_MALI400_DEBUG is not set
# CONFIG_MALI400_PROFILING is not set
# CONFIG_MALI400_UMP is not set
# CONFIG_MALI_DVFS is not set
# CONFIG_MALI400_POWER_PERFORMANCE_POLICY is not set
CONFIG_MALI_DMA_BUF_MAP_ON_ATTACH=y
# CONFIG_MALI_SHARED_INTERRUPTS is not set
Expand Down
1 change: 1 addition & 0 deletions arch/arm/configs/odroidx_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2561,6 +2561,7 @@ CONFIG_MALI400=y
# CONFIG_MALI400_DEBUG is not set
# CONFIG_MALI400_PROFILING is not set
# CONFIG_MALI400_UMP is not set
# CONFIG_MALI_DVFS is not set
# CONFIG_MALI400_POWER_PERFORMANCE_POLICY is not set
CONFIG_MALI_DMA_BUF_MAP_ON_ATTACH=y
# CONFIG_MALI_SHARED_INTERRUPTS is not set
Expand Down
441 changes: 273 additions & 168 deletions arch/arm/mach-exynos/include/mach/mali_utgard.h
100644 → 100755

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions arch/arm/plat-samsung/devs.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,6 @@ struct platform_device s5p_device_jpeg = {
/* FIMD0 */
static struct mali_gpu_device_data mali_gpu_data = {
.shared_mem_size = 256*1024*1024,
.utilization_interval = 1000,
.utilization_handler = mali_gpu_utilization_handler,
};

static struct resource mali_gpu_resource[] = {
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/arm/mali/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ mali-y += \
common/mali_pm_domain.o \
linux/mali_osk_pm.o \
linux/mali_pmu_power_up_down.o \
platform/odroid.o \
__malidrv_build_info.o

ifneq ($(MALI_PLATFORM_FILES),)
Expand Down
4 changes: 4 additions & 0 deletions drivers/gpu/arm/mali/common/mali_kernel_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "mali_timeline.h"
#include "mali_soft_job.h"
#include "mali_pm_domain.h"
#include "mali_platform.h"
#if defined(CONFIG_MALI400_PROFILING)
#include "mali_osk_profiling.h"
#endif
Expand Down Expand Up @@ -882,6 +883,8 @@ _mali_osk_errcode_t mali_initialize_subsystems(void)
/* Allowing the system to be turned off */
mali_pm_init_end();

mali_platform_init();

return _MALI_OSK_ERR_OK; /* all ok */
}

Expand All @@ -891,6 +894,7 @@ void mali_terminate_subsystems(void)

MALI_DEBUG_PRINT(2, ("terminate_subsystems() called\n"));

mali_platform_deinit();
mali_utilization_term();
mali_control_timer_term();

Expand Down
14 changes: 14 additions & 0 deletions drivers/gpu/arm/mali/common/mali_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include "mali_executor.h"
#include "mali_control_timer.h"

#include <linux/pm_runtime.h>

extern struct platform_device *mali_platform_device;

#if defined(DEBUG)
u32 num_pm_runtime_resume = 0;
u32 num_pm_updates = 0;
Expand Down Expand Up @@ -96,6 +100,12 @@ _mali_osk_errcode_t mali_pm_initialize(void)
_mali_osk_errcode_t err;
struct mali_pmu_core *pmu;

#ifdef CONFIG_PM_RUNTIME
pm_runtime_set_autosuspend_delay(&(mali_platform_device->dev), 1000);
pm_runtime_use_autosuspend(&(mali_platform_device->dev));
pm_runtime_enable(&(mali_platform_device->dev));
#endif

pm_lock_state = _mali_osk_spinlock_irq_init(_MALI_OSK_LOCKFLAG_ORDERED,
_MALI_OSK_LOCK_ORDER_PM_STATE);
if (NULL == pm_lock_state) {
Expand Down Expand Up @@ -145,6 +155,10 @@ _mali_osk_errcode_t mali_pm_initialize(void)

void mali_pm_terminate(void)
{
#ifdef CONFIG_PM_RUNTIME
pm_runtime_disable(&(mali_platform_device->dev));
#endif

if (NULL != pm_work) {
_mali_osk_wq_delete_work(pm_work);
pm_work = NULL;
Expand Down
129 changes: 129 additions & 0 deletions drivers/gpu/arm/mali/platform/mali_platform.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/*
* 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.
*
* A copy of the licence is included with the program, and can also be obtained from Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

/**
* @file mali_platform.h
* Platform specific Mali driver functions
*/

#ifndef __MALI_PLATFORM_H__
#define __MALI_PLATFORM_H__

#include "mali_osk.h"
#ifndef USING_MALI_PMM
/* @brief System power up/down cores that can be passed into mali_platform_powerdown/up() */
#define MALI_PLATFORM_SYSTEM 0
#endif

#ifdef __cplusplus
extern "C" {
#endif

/** @brief description of power change reasons
*/
typedef enum mali_power_mode_tag
{
MALI_POWER_MODE_ON,
MALI_POWER_MODE_LIGHT_SLEEP,
MALI_POWER_MODE_DEEP_SLEEP,
} mali_power_mode;

/** @brief Platform specific setup and initialisation of MALI
*
* This is called from the entrypoint of the driver to initialize the platform
*
* @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
*/
_mali_osk_errcode_t mali_platform_init(void);

/** @brief Platform specific deinitialisation of MALI
*
* This is called on the exit of the driver to terminate the platform
*
* @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
*/
_mali_osk_errcode_t mali_platform_deinit(void);

/** @brief Platform specific powerdown sequence of MALI
*
* Call as part of platform init if there is no PMM support, else the
* PMM will call it.
* There are three power modes defined:
* 1) MALI_POWER_MODE_ON
* 2) MALI_POWER_MODE_LIGHT_SLEEP
* 3) MALI_POWER_MODE_DEEP_SLEEP
* MALI power management module transitions to MALI_POWER_MODE_LIGHT_SLEEP mode when MALI is idle
* for idle timer (software timer defined in mali_pmm_policy_jobcontrol.h) duration, MALI transitions
* to MALI_POWER_MODE_LIGHT_SLEEP mode during timeout if there are no more jobs queued.
* MALI power management module transitions to MALI_POWER_MODE_DEEP_SLEEP mode when OS does system power
* off.
* Customer has to add power down code when MALI transitions to MALI_POWER_MODE_LIGHT_SLEEP or MALI_POWER_MODE_DEEP_SLEEP
* mode.
* MALI_POWER_MODE_ON mode is entered when the MALI is to powered up. Some customers want to control voltage regulators during
* the whole system powers on/off. Customer can track in this function whether the MALI is powered up from
* MALI_POWER_MODE_LIGHT_SLEEP or MALI_POWER_MODE_DEEP_SLEEP mode and manage the voltage regulators as well.
* @param power_mode defines the power modes
* @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
*/
_mali_osk_errcode_t mali_platform_power_mode_change(mali_power_mode power_mode);


/** @brief Platform specific handling of GPU utilization data
*
* When GPU utilization data is enabled, this function will be
* periodically called.
*
* @param utilization The workload utilization of the Mali GPU. 0 = no utilization, 256 = full utilization.
*/
void mali_gpu_utilization_handler(u32 utilization);

/** @brief Setting the power domain of MALI
*
* This function sets the power domain of MALI if Linux run time power management is enabled
*
* @param dev Reference to struct platform_device (defined in linux) used by MALI GPU
*/
void mali_utilization_suspend(void);

#ifdef CONFIG_REGULATOR
int mali_regulator_get_usecount(void);
void mali_regulator_disable(void);
void mali_regulator_enable(void);
void mali_regulator_set_voltage(int min_uV, int max_uV);
#endif

mali_bool mali_clk_set_rate(unsigned int clk, unsigned int mhz);
unsigned long mali_clk_get_rate(void);
void mali_clk_put(mali_bool binc_mali_clk);

#ifdef MALI_PMM_RUNTIME_JOB_CONTROL_ON
_mali_osk_errcode_t mali_platform_powerdown(u32 cores);
_mali_osk_errcode_t mali_platform_powerup(u32 cores);
#endif

#ifdef CONFIG_MALI_DVFS
#define MALI_DVFS_STEPS 5
mali_bool init_mali_dvfs_status(int step);
void deinit_mali_dvfs_status(void);
mali_bool mali_dvfs_handler(u32 utilization);
int mali_dvfs_is_running(void);
void mali_dvfs_late_resume(void);
int get_mali_dvfs_control_status(void);
mali_bool set_mali_dvfs_current_step(unsigned int step);
void mali_default_step_set(int step, mali_bool boostup);
int change_dvfs_tableset(int change_clk, int change_step);
#endif

void mali_set_runtime_resume_params(int clk, int volt);

#ifdef __cplusplus
}
#endif
#endif
Loading

0 comments on commit 7c87ebf

Please sign in to comment.